diff --git a/CREDITS.md b/CREDITS.md new file mode 100644 index 0000000..7e92a64 --- /dev/null +++ b/CREDITS.md @@ -0,0 +1,24 @@ +# Credits — Demo & Test Images + +The sample images used in the iOS demo app and the Kit test fixtures are +**CC0 1.0 (Public Domain Dedication)** images from Wikimedia Commons. CC0 +requires no attribution and permits commercial use; the sources are listed here +as a courtesy. + +| File | Source (Wikimedia Commons) | License | +|---|---|---| +| `cc0_cherry_blossom` | [Brightin Star 35mm f0.95 - Cherry Blossom](https://commons.wikimedia.org/wiki/File:Brightin_Star_35mm_f0.95_-_Cherry_Blossom.jpg) | CC0 1.0 | +| `cc0_flower_bokeh` | [Beautiful Flower covered in an artistic Bokeh](https://commons.wikimedia.org/wiki/File:Beautiful_Flower_covered_in_an_artistic_Bokeh_(54028221085).jpg) | CC0 1.0 | +| `cc0_ant_sunflower` | [Ant on sunflower with snail](https://commons.wikimedia.org/wiki/File:Ant_on_sunflower_with_snail.jpg) | CC0 1.0 | +| `cc0_highway_bokeh` | [Highway Bokeh](https://commons.wikimedia.org/wiki/File:Highway_Bokeh_(49256321736).jpg) | CC0 1.0 | +| `cc0_misty_river` | [Blurry misty river](https://commons.wikimedia.org/wiki/File:Blurry_misty_river.jpg) | CC0 1.0 | +| `cc0_street_bokeh` | [Street bokeh (Unsplash)](https://commons.wikimedia.org/wiki/File:Street_bokeh_(Unsplash).jpg) | CC0 1.0 | +| `cc0_morning_coffee` | [Morning coffee (Unsplash)](https://commons.wikimedia.org/wiki/File:Morning_coffee_(Unsplash).jpg) | CC0 1.0 | +| `cc0_love_in_a_cup` | [Love in a cup (Unsplash)](https://commons.wikimedia.org/wiki/File:Love_in_a_cup_(Unsplash).jpg) | CC0 1.0 | +| `cc0_dew_grass` | [Dew on Grass, beautiful greenery](https://commons.wikimedia.org/wiki/File:Dew_on_Grass,_beautiful_greenery.jpg) | CC0 1.0 | +| `cc0_panning_gulls` | [Panning gulls](https://commons.wikimedia.org/wiki/File:Panning_gulls.jpg) | CC0 1.0 | +| `cc0_clover_closeup` | [Trifolium subterraneum close-up](https://commons.wikimedia.org/wiki/File:Trifolium_subterraneum_close-up.jpg) | CC0 1.0 | +| `cc0_icicles` | [Icicles on a winter morning](https://commons.wikimedia.org/wiki/File:Icicles_on_a_winter_morning_(30982282464).jpg) | CC0 1.0 | + +Images were downscaled to 1024 px (longest side) for use in the demo; no other +modifications were made to their licensing status. diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit.xcodeproj/project.pbxproj b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit.xcodeproj/project.pbxproj index bacd5f4..6bb0e0f 100644 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit.xcodeproj/project.pbxproj +++ b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit.xcodeproj/project.pbxproj @@ -7,699 +7,19 @@ objects = { /* Begin PBXBuildFile section */ - DE02C86029EDD68500FD93D2 /* libtensorflow-lite.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = DE02C85C29EDCAF900FD93D2 /* libtensorflow-lite.xcframework */; }; + 0A8978422621CC9146B5BCF3 /* CGImage+resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = D5F2E2AF2A0437537333C08A /* CGImage+resize.swift */; }; + 56EBB025FFBC562404E3CD1A /* cc0_misty_river.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 7D3DD43200685F748A77934D /* cc0_misty_river.jpg */; }; + 6B22DA0DF98A5F3F043C2FB2 /* BlurSegmentation.mlpackage in Sources */ = {isa = PBXBuildFile; fileRef = 32C2EACCA5B7A4F2C00A54F5 /* BlurSegmentation.mlpackage */; }; + 7B7E6B5BF45BC50981B78C13 /* BlurDiscriminatorLoadingTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C4695E27633018BA75A53F2 /* BlurDiscriminatorLoadingTests.swift */; }; + 9420062D36C325523D8A97CD /* CoreMLBlurPredictor.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4FB3A2C4F29FFCAF4B2288D7 /* CoreMLBlurPredictor.swift */; }; + AAC604803B1845D1F5A5FA06 /* cc0_cherry_blossom.jpg in Resources */ = {isa = PBXBuildFile; fileRef = 27A4C748729C296387CA6A57 /* cc0_cherry_blossom.jpg */; }; + C42C470E371C0665D6122AD6 /* cc0_ant_sunflower.jpg in Resources */ = {isa = PBXBuildFile; fileRef = C64B8D724CF8C561C84E3B3D /* cc0_ant_sunflower.jpg */; }; + DE85CC4F3DD8CF3298FCC7F0 /* BlurMap.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98EFA6F3C2DB0A382A617E59 /* BlurMap.swift */; }; DE90DBBC2737B43F0048E41B /* BlurDiscriminatorKitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DE90DBBB2737B43F0048E41B /* BlurDiscriminatorKitTests.swift */; }; DE90DBBE2737B43F0048E41B /* BlurDiscriminatorKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = DEEA0E7C2732F3A90060812D /* BlurDiscriminatorKit.framework */; platformFilter = ios; }; - DE90DBC92737BB9A0048E41B /* image_f264_horizontal_fliped.jpg in Resources */ = {isa = PBXBuildFile; fileRef = DE90DBC52737BB9A0048E41B /* image_f264_horizontal_fliped.jpg */; }; - DE90DBCA2737BB9A0048E41B /* image_f67_origin.jpg in Resources */ = {isa = PBXBuildFile; fileRef = DE90DBC62737BB9A0048E41B /* image_f67_origin.jpg */; }; - DE90DBCB2737BB9A0048E41B /* blur_segmentation_quantized.tflite in Resources */ = {isa = PBXBuildFile; fileRef = DE90DBC72737BB9A0048E41B /* blur_segmentation_quantized.tflite */; }; - DE90DBCC2737BB9A0048E41B /* image_f477_origin.jpg in Resources */ = {isa = PBXBuildFile; fileRef = DE90DBC82737BB9A0048E41B /* image_f477_origin.jpg */; }; DEEA0E812732F3A90060812D /* BlurDiscriminatorKit.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0E7F2732F3A90060812D /* BlurDiscriminatorKit.h */; settings = {ATTRIBUTES = (Public, ); }; }; - DEEA11DB2732F4420060812D /* InterpreterWrapper.mm in Sources */ = {isa = PBXBuildFile; fileRef = DEEA0E882732F43E0060812D /* InterpreterWrapper.mm */; }; - DEEA11DC2732F4420060812D /* InterpreterWrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0E892732F43E0060812D /* InterpreterWrapper.h */; settings = {ATTRIBUTES = (Private, ); }; }; - DEEA11DE2732F4420060812D /* CGImage+resize.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEA0E8C2732F43E0060812D /* CGImage+resize.swift */; }; - DEEA11E12732F4430060812D /* micro_interpreter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0E932732F43E0060812D /* micro_interpreter.h */; }; - DEEA11E22732F4430060812D /* compatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0E942732F43E0060812D /* compatibility.h */; }; - DEEA11E32732F4430060812D /* kernel_runner.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0E982732F43E0060812D /* kernel_runner.h */; }; - DEEA11E42732F4430060812D /* micro_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0E992732F43E0060812D /* micro_utils.h */; }; - DEEA11E52732F4430060812D /* mli_tf_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0E9B2732F43E0060812D /* mli_tf_utils.h */; }; - DEEA11E62732F4430060812D /* scratch_buffers.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0E9C2732F43E0060812D /* scratch_buffers.h */; }; - DEEA11E72732F4430060812D /* mli_slicers.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0E9D2732F43E0060812D /* mli_slicers.h */; }; - DEEA11E82732F4430060812D /* scratch_buf_mgr.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0E9E2732F43E0060812D /* scratch_buf_mgr.h */; }; - DEEA11E92732F4430060812D /* kernel_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0E9F2732F43E0060812D /* kernel_util.h */; }; - DEEA11EA2732F4430060812D /* fully_connected.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EA02732F43E0060812D /* fully_connected.h */; }; - DEEA11EB2732F4430060812D /* fixedpoint_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EA22732F43E0060812D /* fixedpoint_utils.h */; }; - DEEA11EC2732F4430060812D /* activation_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EA32732F43E0060812D /* activation_utils.h */; }; - DEEA11ED2732F4430060812D /* xtensa_tf_micro_common.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EA52732F43E0060812D /* xtensa_tf_micro_common.h */; }; - DEEA11EE2732F4430060812D /* xa_nnlib_api.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EAA2732F43E0060812D /* xa_nnlib_api.h */; }; - DEEA11EF2732F4430060812D /* xa_nnlib_kernels_api.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EAB2732F43E0060812D /* xa_nnlib_kernels_api.h */; }; - DEEA11F02732F4430060812D /* xa_nnlib_standards.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EAC2732F43E0060812D /* xa_nnlib_standards.h */; }; - DEEA11F12732F4430060812D /* xa_type_def.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EAD2732F43E0060812D /* xa_type_def.h */; }; - DEEA11F22732F4430060812D /* xa_nnlib_common.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EB12732F43E0060812D /* xa_nnlib_common.h */; }; - DEEA11F32732F4430060812D /* xa_nnlib_err_chk.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EB22732F43E0060812D /* xa_nnlib_err_chk.h */; }; - DEEA11F42732F4430060812D /* xa_nnlib_definitions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EB32732F43E0060812D /* xa_nnlib_definitions.h */; }; - DEEA11F52732F4430060812D /* xa_api_defs.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EB42732F43E0060812D /* xa_api_defs.h */; }; - DEEA11F62732F4430060812D /* xa_nnlib_common_macros.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EB52732F43E0060812D /* xa_nnlib_common_macros.h */; }; - DEEA11F72732F4430060812D /* xtensa_tf_micro_common.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EB62732F43E0060812D /* xtensa_tf_micro_common.h */; }; - DEEA11F82732F4430060812D /* micro_ops.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EB72732F43E0060812D /* micro_ops.h */; }; - DEEA11F92732F4430060812D /* micro_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EB82732F43E0060812D /* micro_utils.h */; }; - DEEA12002732F4430060812D /* simple_memory_allocator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0ECB2732F43E0060812D /* simple_memory_allocator.h */; }; - DEEA12012732F4430060812D /* micro_mutable_op_resolver.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0ECC2732F43E0060812D /* micro_mutable_op_resolver.h */; }; - DEEA12022732F4430060812D /* debug_log.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0ECE2732F43F0060812D /* debug_log.h */; }; - DEEA12032732F4430060812D /* recording_micro_allocator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0ECF2732F43F0060812D /* recording_micro_allocator.h */; }; - DEEA12042732F4430060812D /* micro_string.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0ED02732F43F0060812D /* micro_string.h */; }; - DEEA12052732F4430060812D /* test_helpers.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0ED22732F43F0060812D /* test_helpers.h */; }; - DEEA12072732F4430060812D /* micro_error_reporter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0ED52732F43F0060812D /* micro_error_reporter.h */; }; - DEEA12082732F4430060812D /* recording_simple_memory_allocator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0ED62732F43F0060812D /* recording_simple_memory_allocator.h */; }; - DEEA12092732F4430060812D /* micro_op_resolver.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0ED72732F43F0060812D /* micro_op_resolver.h */; }; - DEEA12152732F4430060812D /* micro_time.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EE62732F43F0060812D /* micro_time.h */; }; - DEEA12162732F4430060812D /* image_provider.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EE92732F43F0060812D /* image_provider.h */; }; - DEEA12172732F4430060812D /* app_camera_esp.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EEB2732F43F0060812D /* app_camera_esp.h */; }; - DEEA12192732F4430060812D /* HM01B0_Walking1s_01.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EEF2732F43F0060812D /* HM01B0_Walking1s_01.h */; }; - DEEA121A2732F4430060812D /* HM01B0_optimized.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EF02732F43F0060812D /* HM01B0_optimized.h */; }; - DEEA121B2732F4430060812D /* HM01B0.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EF12732F43F0060812D /* HM01B0.h */; }; - DEEA121C2732F4430060812D /* HM01B0_RAW8_QVGA_8bits_lsb_5fps.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EF22732F43F0060812D /* HM01B0_RAW8_QVGA_8bits_lsb_5fps.h */; }; - DEEA121D2732F4430060812D /* HM01B0_debug.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EF32732F43F0060812D /* HM01B0_debug.h */; }; - DEEA121E2732F4430060812D /* person_image_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EF42732F43F0060812D /* person_image_data.h */; }; - DEEA121F2732F4430060812D /* person_detect_model_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EF52732F43F0060812D /* person_detect_model_data.h */; }; - DEEA12202732F4430060812D /* HM01B0_platform.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EF72732F43F0060812D /* HM01B0_platform.h */; }; - DEEA12212732F4430060812D /* model_settings.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EF82732F43F0060812D /* model_settings.h */; }; - DEEA12222732F4430060812D /* main_functions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EF92732F43F0060812D /* main_functions.h */; }; - DEEA12232732F4430060812D /* no_person_image_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EFA2732F43F0060812D /* no_person_image_data.h */; }; - DEEA12242732F4430060812D /* detection_responder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EFB2732F43F0060812D /* detection_responder.h */; }; - DEEA12252732F4430060812D /* output_handler.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EFD2732F43F0060812D /* output_handler.h */; }; - DEEA12262732F4430060812D /* constants.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0EFF2732F43F0060812D /* constants.h */; }; - DEEA12272732F4430060812D /* main_functions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F002732F43F0060812D /* main_functions.h */; }; - DEEA12292732F4430060812D /* model.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F032732F43F0060812D /* model.h */; }; - DEEA122B2732F4430060812D /* accelerometer_handler.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F062732F43F0060812D /* accelerometer_handler.h */; }; - DEEA122C2732F4430060812D /* output_handler.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F072732F43F0060812D /* output_handler.h */; }; - DEEA122D2732F4430060812D /* constants.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F082732F43F0060812D /* constants.h */; }; - DEEA122F2732F4430060812D /* accelerometer_handler.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F0D2732F43F0060812D /* accelerometer_handler.h */; }; - DEEA12302732F4430060812D /* gesture_predictor.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F0E2732F43F0060812D /* gesture_predictor.h */; }; - DEEA12312732F4430060812D /* ring_micro_features_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F0F2732F43F0060812D /* ring_micro_features_data.h */; }; - DEEA12322732F4430060812D /* main_functions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F102732F43F0060812D /* main_functions.h */; }; - DEEA12352732F4430060812D /* slope_micro_features_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F162732F43F0060812D /* slope_micro_features_data.h */; }; - DEEA12362732F4430060812D /* magic_wand_model_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F172732F43F0060812D /* magic_wand_model_data.h */; }; - DEEA12372732F4430060812D /* image_provider.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F192732F43F0060812D /* image_provider.h */; }; - DEEA12382732F4430060812D /* display_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F1B2732F43F0060812D /* display_util.h */; }; - DEEA12392732F4430060812D /* image_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F1C2732F43F0060812D /* image_util.h */; }; - DEEA123A2732F4430060812D /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F1D2732F43F0060812D /* util.h */; }; - DEEA123B2732F4430060812D /* image_recognition_model.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F1E2732F43F0060812D /* image_recognition_model.h */; }; - DEEA123C2732F4430060812D /* image_provider.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F202732F43F0060812D /* image_provider.h */; }; - DEEA123D2732F4430060812D /* platform_Sparkfun_Edge.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F222732F43F0060812D /* platform_Sparkfun_Edge.h */; }; - DEEA123E2732F4430060812D /* HM01B0_Walking1s_01.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F232732F43F0060812D /* HM01B0_Walking1s_01.h */; }; - DEEA123F2732F4430060812D /* HM01B0_optimized.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F242732F43F0060812D /* HM01B0_optimized.h */; }; - DEEA12402732F4430060812D /* HM01B0.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F252732F43F0060812D /* HM01B0.h */; }; - DEEA12412732F4430060812D /* HM01B0_RAW8_QVGA_8bits_lsb_5fps.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F262732F43F0060812D /* HM01B0_RAW8_QVGA_8bits_lsb_5fps.h */; }; - DEEA12422732F4430060812D /* HM01B0_debug.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F272732F43F0060812D /* HM01B0_debug.h */; }; - DEEA12432732F4430060812D /* person_image_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F282732F43F0060812D /* person_image_data.h */; }; - DEEA12442732F4430060812D /* person_detect_model_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F292732F43F0060812D /* person_detect_model_data.h */; }; - DEEA12452732F4430060812D /* model_settings.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F2A2732F43F0060812D /* model_settings.h */; }; - DEEA12462732F4430060812D /* main_functions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F2B2732F43F0060812D /* main_functions.h */; }; - DEEA12472732F4430060812D /* no_person_image_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F2C2732F43F0060812D /* no_person_image_data.h */; }; - DEEA12482732F4430060812D /* detection_responder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F2D2732F43F0060812D /* detection_responder.h */; }; - DEEA12492732F4430060812D /* input_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F2F2732F43F0060812D /* input_data.h */; }; - DEEA124A2732F4430060812D /* network_model.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F302732F43F0060812D /* network_model.h */; }; - DEEA124B2732F4430060812D /* expected_output_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F312732F43F0060812D /* expected_output_data.h */; }; - DEEA124C2732F4430060812D /* no_1000ms_sample_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F332732F43F0060812D /* no_1000ms_sample_data.h */; }; - DEEA124D2732F4430060812D /* yes_1000ms_sample_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F342732F43F0060812D /* yes_1000ms_sample_data.h */; }; - DEEA124E2732F4430060812D /* audio_provider.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F352732F43F0060812D /* audio_provider.h */; }; - DEEA12542732F4430060812D /* ringbuf.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F3D2732F43F0060812D /* ringbuf.h */; }; - DEEA12552732F4430060812D /* command_responder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F3E2732F43F0060812D /* command_responder.h */; }; - DEEA12562732F4430060812D /* yes_30ms_sample_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F402732F43F0060812D /* yes_30ms_sample_data.h */; }; - DEEA12582732F4430060812D /* feature_provider.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F432732F43F0060812D /* feature_provider.h */; }; - DEEA12592732F4430060812D /* sin_1k.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F452732F43F0060812D /* sin_1k.h */; }; - DEEA125A2732F4430060812D /* hanning.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F462732F43F0060812D /* hanning.h */; }; - DEEA125B2732F4430060812D /* no_30ms_sample_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F472732F43F0060812D /* no_30ms_sample_data.h */; }; - DEEA125C2732F4430060812D /* main_functions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F482732F43F0060812D /* main_functions.h */; }; - DEEA125F2732F4430060812D /* micro_features_generator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F4D2732F43F0060812D /* micro_features_generator.h */; }; - DEEA12602732F4430060812D /* micro_model_settings.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F4E2732F43F0060812D /* micro_model_settings.h */; }; - DEEA12612732F4430060812D /* yes_micro_features_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F4F2732F43F0060812D /* yes_micro_features_data.h */; }; - DEEA12622732F4430060812D /* static_alloc.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F502732F43F0060812D /* static_alloc.h */; }; - DEEA12632732F4430060812D /* no_micro_features_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F512732F43F0060812D /* no_micro_features_data.h */; }; - DEEA12642732F4430060812D /* model.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F522732F43F0060812D /* model.h */; }; - DEEA12652732F4430060812D /* no_feature_data_slice.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F532732F43F0060812D /* no_feature_data_slice.h */; }; - DEEA12662732F4430060812D /* yes_feature_data_slice.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F542732F43F0060812D /* yes_feature_data_slice.h */; }; - DEEA12672732F4430060812D /* recognize_commands.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F552732F43F0060812D /* recognize_commands.h */; }; - DEEA12682732F4430060812D /* no_power_spectrum_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F572732F43F0060812D /* no_power_spectrum_data.h */; }; - DEEA12692732F4430060812D /* yes_power_spectrum_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F582732F43F0060812D /* yes_power_spectrum_data.h */; }; - DEEA126A2732F4430060812D /* simple_features_generator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F592732F43F0060812D /* simple_features_generator.h */; }; - DEEA126B2732F4430060812D /* yes_simple_features_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F5A2732F43F0060812D /* yes_simple_features_data.h */; }; - DEEA126C2732F4430060812D /* simple_model_settings.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F5B2732F43F0060812D /* simple_model_settings.h */; }; - DEEA126D2732F4430060812D /* model.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F5C2732F43F0060812D /* model.h */; }; - DEEA126E2732F4430060812D /* no_simple_features_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F5D2732F43F0060812D /* no_simple_features_data.h */; }; - DEEA126F2732F4430060812D /* micro_benchmark.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F5F2732F43F0060812D /* micro_benchmark.h */; }; - DEEA12702732F4430060812D /* keyword_scrambled_model_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F602732F43F0060812D /* keyword_scrambled_model_data.h */; }; - DEEA12712732F4430060812D /* greedy_memory_planner.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F632732F43F0060812D /* greedy_memory_planner.h */; }; - DEEA12722732F4430060812D /* memory_planner.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F642732F43F0060812D /* memory_planner.h */; }; - DEEA12732732F4430060812D /* linear_memory_planner.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F652732F43F0060812D /* linear_memory_planner.h */; }; - DEEA12742732F4430060812D /* micro_allocator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F662732F43F0060812D /* micro_allocator.h */; }; - DEEA12752732F4430060812D /* micro_profiler.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F672732F43F0060812D /* micro_profiler.h */; }; - DEEA12762732F4430060812D /* memory_helpers.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F682732F43F0060812D /* memory_helpers.h */; }; - DEEA12772732F4430060812D /* all_ops_resolver.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F692732F43F0060812D /* all_ops_resolver.h */; }; - DEEA12782732F4430060812D /* recording_micro_interpreter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F6B2732F43F0060812D /* recording_micro_interpreter.h */; }; - DEEA12792732F4430060812D /* dequantize.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F6D2732F43F0060812D /* dequantize.h */; }; - DEEA127A2732F4430060812D /* cpu_backend_context.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F6E2732F43F0060812D /* cpu_backend_context.h */; }; - DEEA127B2732F4430060812D /* cpu_backend_gemm.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F6F2732F43F0060812D /* cpu_backend_gemm.h */; }; - DEEA127C2732F4430060812D /* cpu_backend_gemm_ruy.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F702732F43F0060812D /* cpu_backend_gemm_ruy.h */; }; - DEEA127D2732F4430060812D /* kernel_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F712732F43F0060812D /* kernel_util.h */; }; - DEEA127E2732F4430060812D /* acceleration_test_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F722732F43F0060812D /* acceleration_test_util.h */; }; - DEEA127F2732F4430060812D /* fully_connected.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F732732F43F0060812D /* fully_connected.h */; }; - DEEA12802732F4430060812D /* subgraph_test_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F742732F43F0060812D /* subgraph_test_util.h */; }; - DEEA12812732F4430060812D /* lstm_eval.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F752732F43F0060812D /* lstm_eval.h */; }; - DEEA12822732F4430060812D /* compatibility.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F772732F43F0060812D /* compatibility.h */; }; - DEEA12832732F4430060812D /* portable_tensor.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F782732F43F0060812D /* portable_tensor.h */; }; - DEEA12842732F4430060812D /* tensor_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F792732F43F0060812D /* tensor_utils.h */; }; - DEEA12852732F4430060812D /* min.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F7A2732F43F0060812D /* min.h */; }; - DEEA12862732F4430060812D /* mfcc.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F7B2732F43F0060812D /* mfcc.h */; }; - DEEA12872732F4430060812D /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F7C2732F43F0060812D /* types.h */; }; - DEEA12882732F4430060812D /* transpose_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F7D2732F43F0060812D /* transpose_utils.h */; }; - DEEA12892732F4430060812D /* cppmath.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F7E2732F43F0060812D /* cppmath.h */; }; - DEEA128A2732F4430060812D /* quantization_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F7F2732F43F0060812D /* quantization_util.h */; }; - DEEA128B2732F4430060812D /* mfcc_dct.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F802732F43F0060812D /* mfcc_dct.h */; }; - DEEA128C2732F4430060812D /* spectrogram.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F812732F43F0060812D /* spectrogram.h */; }; - DEEA128D2732F4430060812D /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F822732F43F0060812D /* common.h */; }; - DEEA128E2732F4430060812D /* sse_tensor_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F842732F43F0060812D /* sse_tensor_utils.h */; }; - DEEA128F2732F4430060812D /* eigen_tensor_reduced_instantiations_google.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F852732F43F0060812D /* eigen_tensor_reduced_instantiations_google.h */; }; - DEEA12902732F4430060812D /* fully_connected.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F872732F43F0060812D /* fully_connected.h */; }; - DEEA12912732F4430060812D /* optimized_ops.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F882732F43F0060812D /* optimized_ops.h */; }; - DEEA12922732F4430060812D /* depthwise_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F8A2732F43F0060812D /* depthwise_conv.h */; }; - DEEA12932732F4430060812D /* depthwise_conv_hybrid_3x3_filter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F8B2732F43F0060812D /* depthwise_conv_hybrid_3x3_filter.h */; }; - DEEA12942732F4430060812D /* fully_connected.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F8C2732F43F0060812D /* fully_connected.h */; }; - DEEA12952732F4430060812D /* depthwise_conv_3x3_filter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F8D2732F43F0060812D /* depthwise_conv_3x3_filter.h */; }; - DEEA12962732F4430060812D /* add.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F8E2732F43F0060812D /* add.h */; }; - DEEA12972732F4430060812D /* depthwise_conv_hybrid.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F8F2732F43F0060812D /* depthwise_conv_hybrid.h */; }; - DEEA12982732F4430060812D /* mul.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F902732F43F0060812D /* mul.h */; }; - DEEA12992732F4430060812D /* mean.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F912732F43F0060812D /* mean.h */; }; - DEEA129A2732F4430060812D /* pooling.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F922732F43F0060812D /* pooling.h */; }; - DEEA129B2732F4430060812D /* transpose_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F932732F43F0060812D /* transpose_conv.h */; }; - DEEA129C2732F4430060812D /* conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F942732F43F0060812D /* conv.h */; }; - DEEA129D2732F4430060812D /* sse_check.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F952732F43F0060812D /* sse_check.h */; }; - DEEA129E2732F4430060812D /* neon_check.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F962732F43F0060812D /* neon_check.h */; }; - DEEA129F2732F4430060812D /* depthwiseconv_uint8.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F972732F43F0060812D /* depthwiseconv_uint8.h */; }; - DEEA12A02732F4430060812D /* neon_tensor_utils_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F982732F43F0060812D /* neon_tensor_utils_impl.h */; }; - DEEA12A12732F4430060812D /* depthwiseconv_uint8_transitional.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F992732F43F0060812D /* depthwiseconv_uint8_transitional.h */; }; - DEEA12A22732F4430060812D /* cpu_check.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F9A2732F43F0060812D /* cpu_check.h */; }; - DEEA12A32732F4430060812D /* im2col_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F9B2732F43F0060812D /* im2col_utils.h */; }; - DEEA12A42732F4430060812D /* depthwiseconv_multithread.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F9C2732F43F0060812D /* depthwiseconv_multithread.h */; }; - DEEA12A52732F4430060812D /* depthwiseconv_float.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F9D2732F43F0060812D /* depthwiseconv_float.h */; }; - DEEA12A62732F4430060812D /* depthwiseconv_uint8_3x3_filter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F9E2732F43F0060812D /* depthwiseconv_uint8_3x3_filter.h */; }; - DEEA12A72732F4430060812D /* multithreaded_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0F9F2732F43F0060812D /* multithreaded_conv.h */; }; - DEEA12A82732F4430060812D /* eigen_spatial_convolutions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FA02732F43F0060812D /* eigen_spatial_convolutions.h */; }; - DEEA12A92732F4430060812D /* batch_matmul.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FA12732F43F0060812D /* batch_matmul.h */; }; - DEEA12AA2732F4430060812D /* eigen_tensor_reduced_instantiations_oss.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FA22732F43F0060812D /* eigen_tensor_reduced_instantiations_oss.h */; }; - DEEA12AB2732F4430060812D /* legacy_optimized_ops.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FA32732F43F0060812D /* legacy_optimized_ops.h */; }; - DEEA12AC2732F4430060812D /* sse_tensor_utils_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FA42732F43F0060812D /* sse_tensor_utils_impl.h */; }; - DEEA12AD2732F4430060812D /* neon_tensor_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FA52732F43F0060812D /* neon_tensor_utils.h */; }; - DEEA12AE2732F4430060812D /* depthwiseconv_3x3_filter_common.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FA62732F43F0060812D /* depthwiseconv_3x3_filter_common.h */; }; - DEEA12AF2732F4430060812D /* mfcc_mel_filterbank.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FA72732F43F0060812D /* mfcc_mel_filterbank.h */; }; - DEEA12B02732F4430060812D /* max.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FA82732F43F0060812D /* max.h */; }; - DEEA12B12732F4430060812D /* strided_slice_logic.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FA92732F43F0060812D /* strided_slice_logic.h */; }; - DEEA12B22732F4430060812D /* tensor_ctypes.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FAA2732F43F0060812D /* tensor_ctypes.h */; }; - DEEA12B32732F4430060812D /* kernel_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FAB2732F43F0060812D /* kernel_utils.h */; }; - DEEA12B42732F4430060812D /* legacy_types.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FAC2732F4400060812D /* legacy_types.h */; }; - DEEA12B52732F4430060812D /* tensor.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FAD2732F4400060812D /* tensor.h */; }; - DEEA12B62732F4430060812D /* softmax.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FAF2732F4400060812D /* softmax.h */; }; - DEEA12B72732F4430060812D /* quantize.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FB02732F4400060812D /* quantize.h */; }; - DEEA12B82732F4430060812D /* dequantize.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FB12732F4400060812D /* dequantize.h */; }; - DEEA12B92732F4430060812D /* portable_tensor_utils_impl.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FB22732F4400060812D /* portable_tensor_utils_impl.h */; }; - DEEA12BA2732F4430060812D /* fully_connected.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FB42732F4400060812D /* fully_connected.h */; }; - DEEA12BB2732F4430060812D /* strided_slice.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FB52732F4400060812D /* strided_slice.h */; }; - DEEA12BC2732F4430060812D /* legacy_reference_ops.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FB62732F4400060812D /* legacy_reference_ops.h */; }; - DEEA12BD2732F4430060812D /* requantize.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FB72732F4400060812D /* requantize.h */; }; - DEEA12BE2732F4430060812D /* dequantize.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FB92732F4400060812D /* dequantize.h */; }; - DEEA12BF2732F4430060812D /* depthwise_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FBA2732F4400060812D /* depthwise_conv.h */; }; - DEEA12C02732F4430060812D /* logistic.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FBB2732F4400060812D /* logistic.h */; }; - DEEA12C12732F4430060812D /* fully_connected.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FBC2732F4400060812D /* fully_connected.h */; }; - DEEA12C22732F4430060812D /* add.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FBD2732F4400060812D /* add.h */; }; - DEEA12C32732F4430060812D /* l2normalization.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FBE2732F4400060812D /* l2normalization.h */; }; - DEEA12C42732F4430060812D /* log_softmax.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FBF2732F4400060812D /* log_softmax.h */; }; - DEEA12C52732F4430060812D /* tanh.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FC02732F4400060812D /* tanh.h */; }; - DEEA12C62732F4430060812D /* mul.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FC12732F4400060812D /* mul.h */; }; - DEEA12C72732F4430060812D /* mean.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FC22732F4400060812D /* mean.h */; }; - DEEA12C82732F4430060812D /* pooling.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FC32732F4400060812D /* pooling.h */; }; - DEEA12C92732F4430060812D /* transpose_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FC42732F4400060812D /* transpose_conv.h */; }; - DEEA12CA2732F4430060812D /* conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FC52732F4400060812D /* conv.h */; }; - DEEA12CB2732F4430060812D /* logistic.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FC62732F4400060812D /* logistic.h */; }; - DEEA12CC2732F4430060812D /* fully_connected.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FC72732F4400060812D /* fully_connected.h */; }; - DEEA12CD2732F4430060812D /* svdf.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FC82732F4400060812D /* svdf.h */; }; - DEEA12CE2732F4430060812D /* prelu.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FC92732F4400060812D /* prelu.h */; }; - DEEA12CF2732F4430060812D /* round.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FCA2732F4400060812D /* round.h */; }; - DEEA12D02732F4430060812D /* sub.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FCB2732F4400060812D /* sub.h */; }; - DEEA12D12732F4430060812D /* pad.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FCC2732F4400060812D /* pad.h */; }; - DEEA12D22732F4430060812D /* add.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FCD2732F4400060812D /* add.h */; }; - DEEA12D32732F4430060812D /* l2normalization.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FCE2732F4400060812D /* l2normalization.h */; }; - DEEA12D42732F4430060812D /* arg_min_max.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FCF2732F4400060812D /* arg_min_max.h */; }; - DEEA12D52732F4430060812D /* ceil.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FD02732F4400060812D /* ceil.h */; }; - DEEA12D62732F4430060812D /* hard_swish.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FD12732F4400060812D /* hard_swish.h */; }; - DEEA12D72732F4430060812D /* resize_nearest_neighbor.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FD22732F4400060812D /* resize_nearest_neighbor.h */; }; - DEEA12D82732F4430060812D /* concatenation.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FD32732F4400060812D /* concatenation.h */; }; - DEEA12D92732F4430060812D /* depthwiseconv_uint8.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FD42732F4400060812D /* depthwiseconv_uint8.h */; }; - DEEA12DA2732F4430060812D /* tanh.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FD52732F4400060812D /* tanh.h */; }; - DEEA12DB2732F4430060812D /* string_comparisons.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FD62732F4400060812D /* string_comparisons.h */; }; - DEEA12DC2732F4430060812D /* mul.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FD72732F4400060812D /* mul.h */; }; - DEEA12DD2732F4430060812D /* portable_tensor_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FD82732F4400060812D /* portable_tensor_utils.h */; }; - DEEA12DE2732F4430060812D /* densify.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FD92732F4400060812D /* densify.h */; }; - DEEA12DF2732F4430060812D /* reduce.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FDA2732F4400060812D /* reduce.h */; }; - DEEA12E02732F4430060812D /* depthwiseconv_float.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FDB2732F4400060812D /* depthwiseconv_float.h */; }; - DEEA12E12732F4430060812D /* process_broadcast_shapes.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FDC2732F4400060812D /* process_broadcast_shapes.h */; }; - DEEA12E22732F4430060812D /* non_max_suppression.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FDD2732F4400060812D /* non_max_suppression.h */; }; - DEEA12E32732F4430060812D /* maximum_minimum.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FDE2732F4400060812D /* maximum_minimum.h */; }; - DEEA12E42732F4430060812D /* pooling.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FDF2732F4400060812D /* pooling.h */; }; - DEEA12E52732F4430060812D /* neg.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FE02732F4400060812D /* neg.h */; }; - DEEA12E62732F4430060812D /* comparisons.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FE12732F4400060812D /* comparisons.h */; }; - DEEA12E72732F4430060812D /* reference_ops.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FE22732F4400060812D /* reference_ops.h */; }; - DEEA12E82732F4430060812D /* batch_matmul.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FE32732F4400060812D /* batch_matmul.h */; }; - DEEA12E92732F4430060812D /* conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FE42732F4400060812D /* conv.h */; }; - DEEA12EA2732F4430060812D /* floor.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FE52732F4400060812D /* floor.h */; }; - DEEA12EB2732F4430060812D /* binary_function.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FE62732F4400060812D /* binary_function.h */; }; - DEEA12EC2732F4430060812D /* test_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FE72732F4400060812D /* test_util.h */; }; - DEEA12ED2732F4430060812D /* lstm_shared.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FE82732F4400060812D /* lstm_shared.h */; }; - DEEA12EE2732F4430060812D /* cpu_backend_gemm_x86.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FE92732F4400060812D /* cpu_backend_gemm_x86.h */; }; - DEEA12EF2732F4430060812D /* cpu_backend_gemm_params.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FEA2732F4400060812D /* cpu_backend_gemm_params.h */; }; - DEEA12F02732F4430060812D /* register_ref.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FEB2732F4400060812D /* register_ref.h */; }; - DEEA12F12732F4430060812D /* cpu_backend_threadpool.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FEC2732F4400060812D /* cpu_backend_threadpool.h */; }; - DEEA12F22732F4430060812D /* builtin_op_kernels.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FED2732F4400060812D /* builtin_op_kernels.h */; }; - DEEA12F32732F4430060812D /* op_macros.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FEE2732F4400060812D /* op_macros.h */; }; - DEEA12F42732F4430060812D /* cpu_backend_gemm_custom_gemv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FEF2732F4400060812D /* cpu_backend_gemm_custom_gemv.h */; }; - DEEA12F52732F4430060812D /* eigen_support.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FF02732F4400060812D /* eigen_support.h */; }; - DEEA12F62732F4430060812D /* acceleration_test_util_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FF12732F4400060812D /* acceleration_test_util_internal.h */; }; - DEEA12F72732F4430060812D /* cpu_backend_gemm_gemmlowp.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FF22732F4400060812D /* cpu_backend_gemm_gemmlowp.h */; }; - DEEA12F82732F4430060812D /* test_delegate_providers.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FF32732F4400060812D /* test_delegate_providers.h */; }; - DEEA12F92732F4430060812D /* hashtable_ops.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FF52732F4400060812D /* hashtable_ops.h */; }; - DEEA12FA2732F4430060812D /* register.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FF62732F4400060812D /* register.h */; }; - DEEA12FB2732F4430060812D /* reshape_test_common.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FF72732F4400060812D /* reshape_test_common.h */; }; - DEEA12FC2732F4430060812D /* test_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FF82732F4400060812D /* test_util.h */; }; - DEEA12FD2732F4430060812D /* padding.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FF92732F4400060812D /* padding.h */; }; - DEEA12FE2732F4430060812D /* custom_ops_register.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FFA2732F4400060812D /* custom_ops_register.h */; }; - DEEA12FF2732F4430060812D /* cpu_backend_gemm_eigen.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FFB2732F4400060812D /* cpu_backend_gemm_eigen.h */; }; - DEEA13002732F4430060812D /* context_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FFC2732F4400060812D /* context_util.h */; }; - DEEA13012732F4430060812D /* lookup_interfaces.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA0FFF2732F4400060812D /* lookup_interfaces.h */; }; - DEEA13022732F4430060812D /* lookup_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10002732F4400060812D /* lookup_util.h */; }; - DEEA13032732F4430060812D /* resource_base.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10012732F4400060812D /* resource_base.h */; }; - DEEA13042732F4430060812D /* resource_variable.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10022732F4400060812D /* resource_variable.h */; }; - DEEA13052732F4430060812D /* static_hashtable.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10032732F4400060812D /* static_hashtable.h */; }; - DEEA13062732F4430060812D /* gen_op_registration.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10052732F4400060812D /* gen_op_registration.h */; }; - DEEA13072732F4430060812D /* version.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10062732F4400060812D /* version.h */; }; - DEEA13082732F4430060812D /* portable_type_to_tflitetype.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10072732F4400060812D /* portable_type_to_tflitetype.h */; }; - DEEA13092732F4430060812D /* builtin_ops.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10082732F4400060812D /* builtin_ops.h */; }; - DEEA130A2732F4430060812D /* shared_library.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10092732F4400060812D /* shared_library.h */; }; - DEEA130B2732F4430060812D /* subgraph.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA100B2732F4400060812D /* subgraph.h */; }; - DEEA130C2732F4430060812D /* macros.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA100C2732F4400060812D /* macros.h */; }; - DEEA130D2732F4430060812D /* tensor_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA100E2732F4400060812D /* tensor_utils.h */; }; - DEEA130E2732F4430060812D /* op_resolver.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA100F2732F4400060812D /* op_resolver.h */; }; - DEEA130F2732F4430060812D /* verifier.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10102732F4400060812D /* verifier.h */; }; - DEEA13102732F4430060812D /* error_reporter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10112732F4400060812D /* error_reporter.h */; }; - DEEA13112732F4430060812D /* flatbuffer_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10122732F4400060812D /* flatbuffer_conversions.h */; }; - DEEA13122732F4430060812D /* profiler.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10132732F4400060812D /* profiler.h */; }; - DEEA13132732F4430060812D /* op_resolver.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10142732F4400060812D /* op_resolver.h */; }; - DEEA13142732F4430060812D /* minimal_logging.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10152732F4400060812D /* minimal_logging.h */; }; - DEEA13152732F4430060812D /* string_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10162732F4400060812D /* string_util.h */; }; - DEEA13162732F4430060812D /* stderr_reporter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10172732F4400060812D /* stderr_reporter.h */; }; - DEEA13172732F4430060812D /* allocation.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10182732F4400060812D /* allocation.h */; }; - DEEA13182732F4430060812D /* arena_planner.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10192732F4400060812D /* arena_planner.h */; }; - DEEA13192732F4430060812D /* interpreter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA101A2732F4400060812D /* interpreter.h */; }; - DEEA131A2732F4430060812D /* builtin_op_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA101B2732F4400060812D /* builtin_op_data.h */; }; - DEEA131B2732F4430060812D /* memory_planner.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA101C2732F4400060812D /* memory_planner.h */; }; - DEEA131C2732F4430060812D /* context.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA101D2732F4400060812D /* context.h */; }; - DEEA131D2732F4430060812D /* type_to_tflitetype.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA101E2732F4400060812D /* type_to_tflitetype.h */; }; - DEEA131E2732F4430060812D /* tflite_with_xnnpack_optional.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA101F2732F4400060812D /* tflite_with_xnnpack_optional.h */; }; - DEEA131F2732F4430060812D /* simple_memory_arena.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10202732F4400060812D /* simple_memory_arena.h */; }; - DEEA13202732F4430060812D /* error_reporter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10212732F4400060812D /* error_reporter.h */; }; - DEEA13212732F4430060812D /* schema_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10232732F4400060812D /* schema_utils.h */; }; - DEEA13222732F4430060812D /* schema_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10242732F4400060812D /* schema_generated.h */; }; - DEEA13232732F4430060812D /* generator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10262732F4400060812D /* generator.h */; }; - DEEA13242732F4430060812D /* string_type.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10272732F4400060812D /* string_type.h */; }; - DEEA13252732F4430060812D /* NeuralNetworksTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10292732F4400060812D /* NeuralNetworksTypes.h */; }; - DEEA13262732F4430060812D /* nnapi_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA102A2732F4400060812D /* nnapi_util.h */; }; - DEEA13272732F4430060812D /* nnapi_implementation.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA102B2732F4400060812D /* nnapi_implementation.h */; }; - DEEA13282732F4430060812D /* NeuralNetworksShim.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA102C2732F4400060812D /* NeuralNetworksShim.h */; }; - DEEA13292732F4430060812D /* nnapi_handler.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA102D2732F4400060812D /* nnapi_handler.h */; }; - DEEA132A2732F4430060812D /* external_cpu_backend_context.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA102E2732F4400060812D /* external_cpu_backend_context.h */; }; - DEEA132B2732F4430060812D /* mutable_op_resolver.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA102F2732F4400060812D /* mutable_op_resolver.h */; }; - DEEA132C2732F4430060812D /* stateful_error_reporter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10302732F4400060812D /* stateful_error_reporter.h */; }; - DEEA132D2732F4430060812D /* model_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10312732F4400060812D /* model_builder.h */; }; - DEEA132E2732F4430060812D /* interpreter_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10322732F4400060812D /* interpreter_builder.h */; }; - DEEA132F2732F4430060812D /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10332732F4400060812D /* util.h */; }; - DEEA13302732F4430060812D /* model.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10342732F4400060812D /* model.h */; }; - DEEA13312732F4430060812D /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10362732F4400060812D /* utils.h */; }; - DEEA13322732F4430060812D /* delegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10382732F4400060812D /* delegate.h */; }; - DEEA13332732F4430060812D /* compute_task.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA103A2732F4400060812D /* compute_task.h */; }; - DEEA13342732F4430060812D /* winograd.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA103C2732F4400060812D /* winograd.h */; }; - DEEA13352732F4430060812D /* softmax.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA103D2732F4400060812D /* softmax.h */; }; - DEEA13362732F4430060812D /* depthwise_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA103E2732F4400060812D /* depthwise_conv.h */; }; - DEEA13372732F4430060812D /* relu.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA103F2732F4400060812D /* relu.h */; }; - DEEA13382732F4430060812D /* max_unpooling.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10402732F4400060812D /* max_unpooling.h */; }; - DEEA13392732F4430060812D /* elementwise.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10412732F4400060812D /* elementwise.h */; }; - DEEA133A2732F4430060812D /* fully_connected.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10422732F4400060812D /* fully_connected.h */; }; - DEEA133B2732F4430060812D /* prelu.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10432732F4400060812D /* prelu.h */; }; - DEEA133C2732F4430060812D /* slice.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10442732F4400060812D /* slice.h */; }; - DEEA133D2732F4430060812D /* add.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10452732F4400060812D /* add.h */; }; - DEEA133E2732F4430060812D /* concat.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10462732F4400060812D /* concat.h */; }; - DEEA133F2732F4430060812D /* resize.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10472732F4400060812D /* resize.h */; }; - DEEA13402732F4430060812D /* custom_registry.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10482732F4400060812D /* custom_registry.h */; }; - DEEA13412732F4430060812D /* reshape.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10492732F4400060812D /* reshape.h */; }; - DEEA13422732F4430060812D /* mean.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA104A2732F4400060812D /* mean.h */; }; - DEEA13432732F4430060812D /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA104B2732F4400060812D /* util.h */; }; - DEEA13442732F4430060812D /* space_to_depth.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA104C2732F4400060812D /* space_to_depth.h */; }; - DEEA13452732F4430060812D /* pooling.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA104D2732F4400060812D /* pooling.h */; }; - DEEA13462732F4430060812D /* transpose_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA104E2732F4400060812D /* transpose_conv.h */; }; - DEEA13472732F4430060812D /* conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA104F2732F4400060812D /* conv.h */; }; - DEEA13482732F4430060812D /* test_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10502732F4400060812D /* test_util.h */; }; - DEEA13492732F4430060812D /* padding.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10512732F4400060812D /* padding.h */; }; - DEEA134A2732F4430060812D /* quantize_and_dequantize.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10522732F4400060812D /* quantize_and_dequantize.h */; }; - DEEA134D2732F4430060812D /* arguments.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10572732F4400060812D /* arguments.h */; }; - DEEA134E2732F4430060812D /* runtime_options.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10582732F4400060812D /* runtime_options.h */; }; - DEEA134F2732F4430060812D /* environment.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10592732F4400060812D /* environment.h */; }; - DEEA13502732F4430060812D /* api.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA105A2732F4400060812D /* api.h */; }; - DEEA13512732F4430060812D /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA105B2732F4400060812D /* common.h */; }; - DEEA13522732F4430060812D /* metal_arguments.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA105C2732F4400060812D /* metal_arguments.h */; }; - DEEA13532732F4430060812D /* compiled_model.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA105D2732F4400060812D /* compiled_model.h */; }; - DEEA13542732F4430060812D /* compute_task_descriptor.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA105E2732F4400060812D /* compute_task_descriptor.h */; }; - DEEA13552732F4430060812D /* inference_context.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA105F2732F4400060812D /* inference_context.h */; }; - DEEA13562732F4430060812D /* buffer_convert.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10602732F4400060812D /* buffer_convert.h */; }; - DEEA13572732F4430060812D /* gl_delegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10612732F4400060812D /* gl_delegate.h */; }; - DEEA13582732F4430060812D /* api.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10622732F4400060812D /* api.h */; }; - DEEA13592732F4430060812D /* winograd_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10642732F4400060812D /* winograd_util.h */; }; - DEEA135A2732F4430060812D /* gpu_info.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10652732F4400060812D /* gpu_info.h */; }; - DEEA135B2732F4430060812D /* status.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10662732F4400060812D /* status.h */; }; - DEEA135C2732F4430060812D /* add_bias.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10682732F4400060812D /* add_bias.h */; }; - DEEA135D2732F4430060812D /* matching.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10692732F4400060812D /* matching.h */; }; - DEEA135E2732F4430060812D /* add_quant_adjustments.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA106A2732F4400060812D /* add_quant_adjustments.h */; }; - DEEA135F2732F4430060812D /* fuse_add_to_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA106B2732F4400060812D /* fuse_add_to_conv.h */; }; - DEEA13602732F4430060812D /* make_fully_connected.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA106C2732F4400060812D /* make_fully_connected.h */; }; - DEEA13612732F4430060812D /* merge_padding_with.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA106D2732F4400060812D /* merge_padding_with.h */; }; - DEEA13622732F4430060812D /* model_transformations.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA106E2732F4400060812D /* model_transformations.h */; }; - DEEA13632732F4430060812D /* make_padding.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA106F2732F4400060812D /* make_padding.h */; }; - DEEA13642732F4430060812D /* fuse_mul_to_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10702732F4400060812D /* fuse_mul_to_conv.h */; }; - DEEA13652732F4430060812D /* remove_noop.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10712732F4400060812D /* remove_noop.h */; }; - DEEA13662732F4430060812D /* lstm_parser.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10722732F4400060812D /* lstm_parser.h */; }; - DEEA13672732F4430060812D /* operations.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10732732F4400060812D /* operations.h */; }; - DEEA13682732F4430060812D /* custom_parsers.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10742732F4400060812D /* custom_parsers.h */; }; - DEEA13692732F4430060812D /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10752732F4400060812D /* types.h */; }; - DEEA136A2732F4430060812D /* workgroup_selection.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10762732F4400060812D /* workgroup_selection.h */; }; - DEEA136B2732F4430060812D /* access_type.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10772732F4400060812D /* access_type.h */; }; - DEEA136C2732F4430060812D /* shape.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10782732F4400060812D /* shape.h */; }; - DEEA136D2732F4430060812D /* data_type.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10792732F4400060812D /* data_type.h */; }; - DEEA136E2732F4430060812D /* quantization_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA107A2732F4400060812D /* quantization_util.h */; }; - DEEA136F2732F4430060812D /* memory_management.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA107B2732F4400060812D /* memory_management.h */; }; - DEEA13702732F4430060812D /* model_transformer.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA107C2732F4400060812D /* model_transformer.h */; }; - DEEA13712732F4430060812D /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA107F2732F4400060812D /* utils.h */; }; - DEEA13722732F4430060812D /* add.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10812732F4400060812D /* add.h */; }; - DEEA13732732F4430060812D /* feature_parity.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10822732F4400060812D /* feature_parity.h */; }; - DEEA13742732F4430060812D /* tflite_model_reader.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10832732F4400060812D /* tflite_model_reader.h */; }; - DEEA13752732F4430060812D /* interpreter_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10842732F4400060812D /* interpreter_utils.h */; }; - DEEA13762732F4430060812D /* internal.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10862732F4400060812D /* internal.h */; }; - DEEA13772732F4430060812D /* naive_assignment.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10872732F4400060812D /* naive_assignment.h */; }; - DEEA13782732F4430060812D /* greedy_in_order_assignment.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10882732F4400060812D /* greedy_in_order_assignment.h */; }; - DEEA13792732F4430060812D /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10892732F4410060812D /* types.h */; }; - DEEA137A2732F4430060812D /* greedy_by_size_assignment.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA108A2732F4410060812D /* greedy_by_size_assignment.h */; }; - DEEA137B2732F4430060812D /* min_cost_flow_assignment.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA108B2732F4410060812D /* min_cost_flow_assignment.h */; }; - DEEA137C2732F4430060812D /* greedy_by_breadth_assignment.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA108C2732F4410060812D /* greedy_by_breadth_assignment.h */; }; - DEEA137D2732F4430060812D /* equality_assignment.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA108D2732F4410060812D /* equality_assignment.h */; }; - DEEA137E2732F4430060812D /* model_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA108E2732F4410060812D /* model_builder.h */; }; - DEEA137F2732F4430060812D /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA108F2732F4410060812D /* util.h */; }; - DEEA13802732F4430060812D /* model.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10902732F4410060812D /* model.h */; }; - DEEA13812732F4430060812D /* custom_transformations.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10912732F4410060812D /* custom_transformations.h */; }; - DEEA13822732F4430060812D /* model_builder_helper.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10922732F4410060812D /* model_builder_helper.h */; }; - DEEA13832732F4430060812D /* convert.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10932732F4410060812D /* convert.h */; }; - DEEA13842732F4430060812D /* object_reader.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10942732F4410060812D /* object_reader.h */; }; - DEEA13852732F4430060812D /* tensor.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10952732F4410060812D /* tensor.h */; }; - DEEA13862732F4430060812D /* metal_delegate_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10962732F4410060812D /* metal_delegate_internal.h */; }; - DEEA13872732F4430060812D /* softmax.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10992732F4410060812D /* softmax.h */; }; - DEEA13882732F4430060812D /* depthwise_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA109A2732F4410060812D /* depthwise_conv.h */; }; - DEEA13892732F4430060812D /* relu.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA109B2732F4410060812D /* relu.h */; }; - DEEA138A2732F4430060812D /* max_unpooling.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA109C2732F4410060812D /* max_unpooling.h */; }; - DEEA138B2732F4430060812D /* elementwise.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA109D2732F4410060812D /* elementwise.h */; }; - DEEA138C2732F4430060812D /* fully_connected.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA109E2732F4410060812D /* fully_connected.h */; }; - DEEA138D2732F4430060812D /* prelu.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA109F2732F4410060812D /* prelu.h */; }; - DEEA138E2732F4430060812D /* slice.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10A02732F4410060812D /* slice.h */; }; - DEEA138F2732F4430060812D /* pad.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10A12732F4410060812D /* pad.h */; }; - DEEA13902732F4430060812D /* add.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10A22732F4410060812D /* add.h */; }; - DEEA13912732F4430060812D /* converter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10A32732F4410060812D /* converter.h */; }; - DEEA13922732F4430060812D /* lstm.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10A42732F4410060812D /* lstm.h */; }; - DEEA13932732F4430060812D /* registry.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10A52732F4410060812D /* registry.h */; }; - DEEA13942732F4430060812D /* concat.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10A62732F4410060812D /* concat.h */; }; - DEEA13952732F4430060812D /* resize.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10A72732F4410060812D /* resize.h */; }; - DEEA13962732F4430060812D /* mul.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10A82732F4410060812D /* mul.h */; }; - DEEA13972732F4430060812D /* custom_registry.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10A92732F4410060812D /* custom_registry.h */; }; - DEEA13982732F4430060812D /* reshape.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10AA2732F4410060812D /* reshape.h */; }; - DEEA13992732F4430060812D /* mean.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10AB2732F4410060812D /* mean.h */; }; - DEEA139A2732F4430060812D /* space_to_depth.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10AC2732F4410060812D /* space_to_depth.h */; }; - DEEA139B2732F4430060812D /* pooling.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10AD2732F4410060812D /* pooling.h */; }; - DEEA139C2732F4430060812D /* transpose_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10AE2732F4410060812D /* transpose_conv.h */; }; - DEEA139D2732F4430060812D /* conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10AF2732F4410060812D /* conv.h */; }; - DEEA139E2732F4430060812D /* test_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10B02732F4410060812D /* test_util.h */; }; - DEEA139F2732F4430060812D /* quantize_and_dequantize.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10B12732F4410060812D /* quantize_and_dequantize.h */; }; - DEEA13A02732F4430060812D /* object_manager.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10B22732F4410060812D /* object_manager.h */; }; - DEEA13A12732F4430060812D /* compiler_options.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10B32732F4410060812D /* compiler_options.h */; }; - DEEA13A22732F4430060812D /* float16_conversions.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10B42732F4410060812D /* float16_conversions.h */; }; - DEEA13A32732F4430060812D /* gl_errors.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10B52732F4410060812D /* gl_errors.h */; }; - DEEA13A42732F4430060812D /* compiler.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10B62732F4410060812D /* compiler.h */; }; - DEEA13A52732F4430060812D /* egl_context.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10B72732F4410060812D /* egl_context.h */; }; - DEEA13A62732F4430060812D /* runtime_options.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10B82732F4410060812D /* runtime_options.h */; }; - DEEA13A72732F4430060812D /* serialization.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10B92732F4410060812D /* serialization.h */; }; - DEEA13A82732F4430060812D /* egl_surface.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10BA2732F4410060812D /* egl_surface.h */; }; - DEEA13A92732F4430060812D /* shared_buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10BC2732F4410060812D /* shared_buffer.h */; }; - DEEA13AA2732F4430060812D /* gl_shader.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10BD2732F4410060812D /* gl_shader.h */; }; - DEEA13AB2732F4430060812D /* gl_texture.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10BE2732F4410060812D /* gl_texture.h */; }; - DEEA13AC2732F4430060812D /* phwc4_to_bhwc.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10C02732F4410060812D /* phwc4_to_bhwc.h */; }; - DEEA13AD2732F4430060812D /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10C12732F4410060812D /* util.h */; }; - DEEA13AE2732F4430060812D /* bhwc_to_phwc4.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10C22732F4410060812D /* bhwc_to_phwc4.h */; }; - DEEA13AF2732F4430060812D /* best_effort_calculator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10C42732F4410060812D /* best_effort_calculator.h */; }; - DEEA13B02732F4430060812D /* calculator_from_metadata.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10C52732F4410060812D /* calculator_from_metadata.h */; }; - DEEA13B12732F4430060812D /* default_calculator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10C62732F4410060812D /* default_calculator.h */; }; - DEEA13B22732F4430060812D /* calculator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10C72732F4410060812D /* calculator.h */; }; - DEEA13B32732F4430060812D /* ideal_workgroup_picker.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10C82732F4410060812D /* ideal_workgroup_picker.h */; }; - DEEA13B42732F4430060812D /* variable.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10C92732F4410060812D /* variable.h */; }; - DEEA13B52732F4430060812D /* gl_program.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10CA2732F4410060812D /* gl_program.h */; }; - DEEA13B62732F4430060812D /* runtime.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10CB2732F4410060812D /* runtime.h */; }; - DEEA13B72732F4430060812D /* api.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10CC2732F4410060812D /* api.h */; }; - DEEA13B82732F4430060812D /* node_shader.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10CD2732F4410060812D /* node_shader.h */; }; - DEEA13B92732F4430060812D /* portable_gl31.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10CE2732F4410060812D /* portable_gl31.h */; }; - DEEA13BA2732F4430060812D /* api2.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10CF2732F4410060812D /* api2.h */; }; - DEEA13BB2732F4430060812D /* gl_call.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10D02732F4410060812D /* gl_call.h */; }; - DEEA13BC2732F4430060812D /* object.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10D12732F4410060812D /* object.h */; }; - DEEA13BD2732F4430060812D /* request_gpu_info.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10D22732F4410060812D /* request_gpu_info.h */; }; - DEEA13BE2732F4430060812D /* gl_buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10D32732F4410060812D /* gl_buffer.h */; }; - DEEA13BF2732F4430060812D /* egl_environment.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10D42732F4410060812D /* egl_environment.h */; }; - DEEA13C02732F4430060812D /* gl_sync.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10D52732F4410060812D /* gl_sync.h */; }; - DEEA13C12732F4430060812D /* variable_accessor.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10D72732F4410060812D /* variable_accessor.h */; }; - DEEA13C22732F4430060812D /* shader_code.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10D82732F4410060812D /* shader_code.h */; }; - DEEA13C32732F4430060812D /* shader_codegen.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10D92732F4410060812D /* shader_codegen.h */; }; - DEEA13C42732F4430060812D /* fuse_auto_input.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10DA2732F4410060812D /* fuse_auto_input.h */; }; - DEEA13C52732F4430060812D /* fuse_inplace.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10DB2732F4410060812D /* fuse_inplace.h */; }; - DEEA13C62732F4430060812D /* object_accessor.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10DC2732F4410060812D /* object_accessor.h */; }; - DEEA13C72732F4430060812D /* fuse_inline.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10DD2732F4410060812D /* fuse_inline.h */; }; - DEEA13C82732F4430060812D /* rename.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10DE2732F4410060812D /* rename.h */; }; - DEEA13C92732F4430060812D /* compiled_node.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10DF2732F4410060812D /* compiled_node.h */; }; - DEEA13CA2732F4430060812D /* preprocessor.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10E02732F4410060812D /* preprocessor.h */; }; - DEEA13CB2732F4430060812D /* stats.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10E12732F4410060812D /* stats.h */; }; - DEEA13CC2732F4430060812D /* command_queue.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10E22732F4410060812D /* command_queue.h */; }; - DEEA13CD2732F4430060812D /* portable_egl.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10E32732F4410060812D /* portable_egl.h */; }; - DEEA13CE2732F4430060812D /* spi.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10E42732F4410060812D /* spi.h */; }; - DEEA13CF2732F4430060812D /* texture2d.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10E62732F4410060812D /* texture2d.h */; }; - DEEA13D02732F4430060812D /* winograd.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10E82732F4410060812D /* winograd.h */; }; - DEEA13D12732F4430060812D /* softmax.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10E92732F4410060812D /* softmax.h */; }; - DEEA13D22732F4430060812D /* strided_slice.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10EA2732F4410060812D /* strided_slice.h */; }; - DEEA13D32732F4430060812D /* depthwise_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10EB2732F4410060812D /* depthwise_conv.h */; }; - DEEA13D42732F4430060812D /* convolution_transposed_4x4.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10EC2732F4410060812D /* convolution_transposed_4x4.h */; }; - DEEA13D52732F4430060812D /* conv_constants.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10ED2732F4410060812D /* conv_constants.h */; }; - DEEA13D62732F4430060812D /* relu.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10EE2732F4410060812D /* relu.h */; }; - DEEA13D72732F4430060812D /* max_unpooling.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10EF2732F4410060812D /* max_unpooling.h */; }; - DEEA13D82732F4430060812D /* elementwise.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10F02732F4410060812D /* elementwise.h */; }; - DEEA13D92732F4430060812D /* cl_test.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10F12732F4410060812D /* cl_test.h */; }; - DEEA13DA2732F4430060812D /* fully_connected.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10F22732F4410060812D /* fully_connected.h */; }; - DEEA13DB2732F4430060812D /* concat_z.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10F32732F4410060812D /* concat_z.h */; }; - DEEA13DC2732F4430060812D /* convolution_transposed_thin.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10F42732F4410060812D /* convolution_transposed_thin.h */; }; - DEEA13DD2732F4430060812D /* prelu.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10F52732F4410060812D /* prelu.h */; }; - DEEA13DE2732F4430060812D /* reshapex4.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10F62732F4410060812D /* reshapex4.h */; }; - DEEA13DF2732F4430060812D /* conv_weights_converter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10F72732F4410060812D /* conv_weights_converter.h */; }; - DEEA13E02732F4430060812D /* convolution_transposed.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10F82732F4410060812D /* convolution_transposed.h */; }; - DEEA13E12732F4430060812D /* add.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10F92732F4410060812D /* add.h */; }; - DEEA13E22732F4430060812D /* convolution_transposed_3x3.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10FA2732F4410060812D /* convolution_transposed_3x3.h */; }; - DEEA13E32732F4430060812D /* depthwise_conv_3x3.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10FB2732F4410060812D /* depthwise_conv_3x3.h */; }; - DEEA13E42732F4430060812D /* converter.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10FC2732F4410060812D /* converter.h */; }; - DEEA13E52732F4430060812D /* tuning_parameters.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10FD2732F4410060812D /* tuning_parameters.h */; }; - DEEA13E62732F4430060812D /* lstm.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA10FE2732F4410060812D /* lstm.h */; }; - DEEA13E72732F4430060812D /* fc_fc_add.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11002732F4410060812D /* fc_fc_add.h */; }; - DEEA13E82732F4430060812D /* depthwise_conv_plus_1x1_conv.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11012732F4410060812D /* depthwise_conv_plus_1x1_conv.h */; }; - DEEA13E92732F4430060812D /* resize.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11022732F4410060812D /* resize.h */; }; - DEEA13EA2732F4430060812D /* convolution_transposed_3x3_thin.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11032732F4410060812D /* convolution_transposed_3x3_thin.h */; }; - DEEA13EB2732F4430060812D /* conv_common.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11042732F4410060812D /* conv_common.h */; }; - DEEA13EC2732F4430060812D /* gpu_operation.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11052732F4410060812D /* gpu_operation.h */; }; - DEEA13ED2732F4430060812D /* reshape.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11062732F4410060812D /* reshape.h */; }; - DEEA13EE2732F4430060812D /* reduce.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11072732F4410060812D /* reduce.h */; }; - DEEA13EF2732F4430060812D /* mean.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11082732F4410060812D /* mean.h */; }; - DEEA13F02732F4430060812D /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11092732F4410060812D /* util.h */; }; - DEEA13F12732F4430060812D /* conv_powervr.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA110A2732F4410060812D /* conv_powervr.h */; }; - DEEA13F22732F4430060812D /* space_to_depth.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA110B2732F4410060812D /* space_to_depth.h */; }; - DEEA13F32732F4430060812D /* pooling.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA110C2732F4410060812D /* pooling.h */; }; - DEEA13F42732F4430060812D /* conv_buffer_1x1.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA110D2732F4410060812D /* conv_buffer_1x1.h */; }; - DEEA13F52732F4430060812D /* work_group_picking.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA110E2732F4410060812D /* work_group_picking.h */; }; - DEEA13F62732F4430060812D /* softmax1x1.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA110F2732F4410060812D /* softmax1x1.h */; }; - DEEA13F72732F4430060812D /* transpose.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11102732F4410060812D /* transpose.h */; }; - DEEA13F82732F4430060812D /* padding.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11112732F4410060812D /* padding.h */; }; - DEEA13F92732F4430060812D /* mean_stddev_normalization.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11122732F4410060812D /* mean_stddev_normalization.h */; }; - DEEA13FA2732F4430060812D /* quantize_and_dequantize.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11132732F4410060812D /* quantize_and_dequantize.h */; }; - DEEA13FB2732F4430060812D /* concat_xy.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11142732F4410060812D /* concat_xy.h */; }; - DEEA13FC2732F4440060812D /* gpu_api_delegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11152732F4410060812D /* gpu_api_delegate.h */; }; - DEEA13FD2732F4440060812D /* opencl_wrapper.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11162732F4410060812D /* opencl_wrapper.h */; }; - DEEA13FE2732F4440060812D /* program_cache.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11172732F4410060812D /* program_cache.h */; }; - DEEA13FF2732F4440060812D /* cl_test.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11182732F4410060812D /* cl_test.h */; }; - DEEA14002732F4440060812D /* arguments.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11192732F4410060812D /* arguments.h */; }; - DEEA14012732F4440060812D /* precision.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA111A2732F4410060812D /* precision.h */; }; - DEEA14022732F4440060812D /* serialization.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA111B2732F4410060812D /* serialization.h */; }; - DEEA14032732F4440060812D /* cl_kernel.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA111C2732F4410060812D /* cl_kernel.h */; }; - DEEA14042732F4440060812D /* compiled_program_cache_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA111D2732F4410060812D /* compiled_program_cache_generated.h */; }; - DEEA14052732F4440060812D /* cl_memory.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA111E2732F4410060812D /* cl_memory.h */; }; - DEEA14062732F4440060812D /* cl_context.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA111F2732F4410060812D /* cl_context.h */; }; - DEEA14072732F4440060812D /* environment.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11202732F4410060812D /* environment.h */; }; - DEEA14082732F4440060812D /* cl_image_format.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11212732F4410060812D /* cl_image_format.h */; }; - DEEA14092732F4440060812D /* api.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11222732F4410060812D /* api.h */; }; - DEEA140A2732F4440060812D /* storage_type_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11232732F4410060812D /* storage_type_util.h */; }; - DEEA140B2732F4440060812D /* cl_errors.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11242732F4410060812D /* cl_errors.h */; }; - DEEA140C2732F4440060812D /* tensor_type_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11252732F4410060812D /* tensor_type_util.h */; }; - DEEA140D2732F4440060812D /* linear_storage.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11262732F4410060812D /* linear_storage.h */; }; - DEEA140E2732F4440060812D /* buffer.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11272732F4410060812D /* buffer.h */; }; - DEEA140F2732F4440060812D /* gl_interop.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11282732F4410060812D /* gl_interop.h */; }; - DEEA14102732F4440060812D /* gpu_object.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11292732F4410060812D /* gpu_object.h */; }; - DEEA14112732F4440060812D /* cl_command_queue.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA112A2732F4410060812D /* cl_command_queue.h */; }; - DEEA14122732F4440060812D /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA112B2732F4410060812D /* util.h */; }; - DEEA14132732F4440060812D /* egl_sync.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA112C2732F4410060812D /* egl_sync.h */; }; - DEEA14142732F4440060812D /* cl_device.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA112D2732F4410060812D /* cl_device.h */; }; - DEEA14152732F4440060812D /* tensor_type.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA112E2732F4410060812D /* tensor_type.h */; }; - DEEA14162732F4440060812D /* cl_event.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA112F2732F4410060812D /* cl_event.h */; }; - DEEA14172732F4440060812D /* model_hints.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11302732F4410060812D /* model_hints.h */; }; - DEEA14182732F4440060812D /* cl_program.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11312732F4410060812D /* cl_program.h */; }; - DEEA14192732F4440060812D /* tensor.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11322732F4410060812D /* tensor.h */; }; - DEEA141A2732F4440060812D /* device_info.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11332732F4410060812D /* device_info.h */; }; - DEEA141B2732F4440060812D /* inference_context.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11342732F4410060812D /* inference_context.h */; }; - DEEA141C2732F4440060812D /* fully_connected_selector.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11362732F4410060812D /* fully_connected_selector.h */; }; - DEEA141D2732F4440060812D /* simple_selectors.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11372732F4410060812D /* simple_selectors.h */; }; - DEEA141E2732F4440060812D /* operation_selector.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11382732F4410060812D /* operation_selector.h */; }; - DEEA141F2732F4440060812D /* subgraph.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11392732F4410060812D /* subgraph.h */; }; - DEEA14202732F4440060812D /* special_selector.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA113A2732F4410060812D /* special_selector.h */; }; - DEEA14212732F4440060812D /* dw_convolution_selector.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA113B2732F4410060812D /* dw_convolution_selector.h */; }; - DEEA14222732F4440060812D /* default_selector.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA113C2732F4410060812D /* default_selector.h */; }; - DEEA14232732F4440060812D /* convolution_selector.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA113D2732F4410060812D /* convolution_selector.h */; }; - DEEA14242732F4440060812D /* convolution_transposed_selector.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA113E2732F4410060812D /* convolution_transposed_selector.h */; }; - DEEA14252732F4440060812D /* metal_delegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA113F2732F4410060812D /* metal_delegate.h */; }; - DEEA14262732F4440060812D /* status.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11402732F4410060812D /* status.h */; }; - DEEA14272732F4440060812D /* dummy_delegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11432732F4410060812D /* dummy_delegate.h */; }; - DEEA14282732F4440060812D /* simple_delegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11442732F4410060812D /* simple_delegate.h */; }; - DEEA14292732F4440060812D /* utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11462732F4410060812D /* utils.h */; }; - DEEA142A2732F4440060812D /* batch_seq_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11482732F4410060812D /* batch_seq_builder.h */; }; - DEEA142B2732F4440060812D /* matmul_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11492732F4410060812D /* matmul_builder.h */; }; - DEEA142C2732F4440060812D /* reshape_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA114A2732F4410060812D /* reshape_builder.h */; }; - DEEA142D2732F4440060812D /* slice_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA114B2732F4410060812D /* slice_builder.h */; }; - DEEA142E2732F4440060812D /* transpose_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA114C2732F4410060812D /* transpose_builder.h */; }; - DEEA142F2732F4440060812D /* neg_op_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA114D2732F4410060812D /* neg_op_builder.h */; }; - DEEA14302732F4440060812D /* l2_normalization_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA114E2732F4410060812D /* l2_normalization_builder.h */; }; - DEEA14312732F4440060812D /* arg_min_max_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA114F2732F4410060812D /* arg_min_max_builder.h */; }; - DEEA14322732F4440060812D /* concat_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11502732F4410060812D /* concat_builder.h */; }; - DEEA14332732F4440060812D /* cast_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11512732F4410060812D /* cast_builder.h */; }; - DEEA14342732F4440060812D /* split_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11522732F4410060812D /* split_builder.h */; }; - DEEA14352732F4440060812D /* resize_bilinear_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11532732F4410060812D /* resize_bilinear_builder.h */; }; - DEEA14362732F4440060812D /* pool_2d_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11542732F4410060812D /* pool_2d_builder.h */; }; - DEEA14372732F4440060812D /* quantize_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11552732F4410060812D /* quantize_builder.h */; }; - DEEA14382732F4440060812D /* reduce_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11562732F4410060812D /* reduce_builder.h */; }; - DEEA14392732F4440060812D /* softmax_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11572732F4410060812D /* softmax_builder.h */; }; - DEEA143A2732F4440060812D /* hexagon_delegate_op_model.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11592732F4410060812D /* hexagon_delegate_op_model.h */; }; - DEEA143B2732F4440060812D /* transpose_conv_2d_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA115A2732F4410060812D /* transpose_conv_2d_builder.h */; }; - DEEA143C2732F4440060812D /* activation_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA115B2732F4410060812D /* activation_builder.h */; }; - DEEA143D2732F4440060812D /* space_to_depth_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA115C2732F4410060812D /* space_to_depth_builder.h */; }; - DEEA143E2732F4440060812D /* conv_2d_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA115D2732F4410060812D /* conv_2d_builder.h */; }; - DEEA143F2732F4440060812D /* resize_nearest_neighbor_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA115E2732F4410060812D /* resize_nearest_neighbor_builder.h */; }; - DEEA14402732F4440060812D /* op_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA115F2732F4410060812D /* op_builder.h */; }; - DEEA14412732F4440060812D /* pad_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11602732F4410060812D /* pad_builder.h */; }; - DEEA14422732F4440060812D /* min_max_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11612732F4410060812D /* min_max_builder.h */; }; - DEEA14432732F4440060812D /* mirror_pad_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11622732F4410060812D /* mirror_pad_builder.h */; }; - DEEA14442732F4440060812D /* strided_slice_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11632732F4410060812D /* strided_slice_builder.h */; }; - DEEA14452732F4440060812D /* op_factory.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11642732F4410060812D /* op_factory.h */; }; - DEEA14462732F4440060812D /* hardswish_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11652732F4410060812D /* hardswish_builder.h */; }; - DEEA14472732F4440060812D /* arithmetic_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11662732F4410060812D /* arithmetic_builder.h */; }; - DEEA14482732F4440060812D /* pack_builder.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11672732F4410060812D /* pack_builder.h */; }; - DEEA14492732F4440060812D /* hexagon_nn_interface.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11682732F4410060812D /* hexagon_nn_interface.h */; }; - DEEA144A2732F4440060812D /* hexagon_delegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11692732F4410060812D /* hexagon_delegate.h */; }; - DEEA144B2732F4440060812D /* hexagon_nn_init.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA116B2732F4410060812D /* hexagon_nn_init.h */; }; - DEEA144C2732F4440060812D /* hexagon_nn.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA116C2732F4410060812D /* hexagon_nn.h */; }; - DEEA144D2732F4440060812D /* hexagon_implementation.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA116D2732F4410060812D /* hexagon_implementation.h */; }; - DEEA144E2732F4440060812D /* hexagon_delegate_kernel.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA116E2732F4410060812D /* hexagon_delegate_kernel.h */; }; - DEEA144F2732F4440060812D /* nnapi_delegate_kernel.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11702732F4410060812D /* nnapi_delegate_kernel.h */; }; - DEEA14502732F4440060812D /* acceleration_test_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11712732F4410060812D /* acceleration_test_util.h */; }; - DEEA14512732F4440060812D /* quant_lstm_sup.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11722732F4410060812D /* quant_lstm_sup.h */; }; - DEEA14522732F4440060812D /* nnapi_delegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11732732F4410060812D /* nnapi_delegate.h */; }; - DEEA14532732F4440060812D /* nnapi_delegate_mock_test.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11742732F4410060812D /* nnapi_delegate_mock_test.h */; }; - DEEA14542732F4440060812D /* pool_2d_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11762732F4420060812D /* pool_2d_tester.h */; }; - DEEA14552732F4440060812D /* reshape_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11772732F4420060812D /* reshape_tester.h */; }; - DEEA14562732F4440060812D /* unary_elementwise_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11782732F4420060812D /* unary_elementwise_tester.h */; }; - DEEA14572732F4440060812D /* leaky_relu_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11792732F4420060812D /* leaky_relu_tester.h */; }; - DEEA14582732F4440060812D /* xnnpack_delegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA117A2732F4420060812D /* xnnpack_delegate.h */; }; - DEEA14592732F4440060812D /* binary_elementwise_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA117B2732F4420060812D /* binary_elementwise_tester.h */; }; - DEEA145A2732F4440060812D /* reduce_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA117C2732F4420060812D /* reduce_tester.h */; }; - DEEA145B2732F4440060812D /* depthwise_conv_2d_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA117D2732F4420060812D /* depthwise_conv_2d_tester.h */; }; - DEEA145C2732F4440060812D /* resize_bilinear_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA117E2732F4420060812D /* resize_bilinear_tester.h */; }; - DEEA145D2732F4440060812D /* conv_2d_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA117F2732F4420060812D /* conv_2d_tester.h */; }; - DEEA145E2732F4440060812D /* softmax_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11802732F4420060812D /* softmax_tester.h */; }; - DEEA145F2732F4440060812D /* prelu_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11812732F4420060812D /* prelu_tester.h */; }; - DEEA14602732F4440060812D /* fully_connected_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11822732F4420060812D /* fully_connected_tester.h */; }; - DEEA14612732F4440060812D /* pad_tester.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11832732F4420060812D /* pad_tester.h */; }; - DEEA14622732F4440060812D /* external_delegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11852732F4420060812D /* external_delegate.h */; }; - DEEA14632732F4440060812D /* delegate_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11872732F4420060812D /* delegate_data.h */; }; - DEEA14642732F4440060812D /* delegate.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11882732F4420060812D /* delegate.h */; }; - DEEA14652732F4440060812D /* allowlisted_flex_ops_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11892732F4420060812D /* allowlisted_flex_ops_internal.h */; }; - DEEA14662732F4440060812D /* buffer_map.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA118A2732F4420060812D /* buffer_map.h */; }; - DEEA14672732F4440060812D /* allowlisted_flex_ops.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA118B2732F4420060812D /* allowlisted_flex_ops.h */; }; - DEEA14682732F4440060812D /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA118C2732F4420060812D /* util.h */; }; - DEEA14692732F4440060812D /* kernel.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA118D2732F4420060812D /* kernel.h */; }; - DEEA146A2732F4440060812D /* test_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA118E2732F4420060812D /* test_util.h */; }; - DEEA146B2732F4440060812D /* interpreter_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA118F2732F4420060812D /* interpreter_utils.h */; }; - DEEA146C2732F4440060812D /* graph_info.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11902732F4420060812D /* graph_info.h */; }; - DEEA146D2732F4440060812D /* optional_debug_tools.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11912732F4420060812D /* optional_debug_tools.h */; }; - DEEA146E2732F4440060812D /* c_api_experimental.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11932732F4420060812D /* c_api_experimental.h */; }; - DEEA146F2732F4440060812D /* c_api_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11942732F4420060812D /* c_api_internal.h */; }; - DEEA14702732F4440060812D /* c_api.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11952732F4420060812D /* c_api.h */; }; - DEEA14712732F4440060812D /* builtin_op_data.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11962732F4420060812D /* builtin_op_data.h */; }; - DEEA14722732F4440060812D /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11972732F4420060812D /* common.h */; }; - DEEA14732732F4440060812D /* toco_types.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11992732F4420060812D /* toco_types.h */; }; - DEEA14742732F4440060812D /* tensorflow_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA119A2732F4420060812D /* tensorflow_util.h */; }; - DEEA14752732F4440060812D /* model_cmdline_flags.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA119B2732F4420060812D /* model_cmdline_flags.h */; }; - DEEA14762732F4440060812D /* op_version.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA119D2732F4420060812D /* op_version.h */; }; - DEEA14772732F4440060812D /* export.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA119E2732F4420060812D /* export.h */; }; - DEEA14782732F4440060812D /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA119F2732F4420060812D /* types.h */; }; - DEEA14792732F4440060812D /* operator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11A02732F4420060812D /* operator.h */; }; - DEEA147A2732F4440060812D /* builtin_operator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11A12732F4420060812D /* builtin_operator.h */; }; - DEEA147B2732F4440060812D /* custom_operator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11A22732F4420060812D /* custom_operator.h */; }; - DEEA147C2732F4440060812D /* simple_operator.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11A32732F4420060812D /* simple_operator.h */; }; - DEEA147D2732F4440060812D /* import.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11A42732F4420060812D /* import.h */; }; - DEEA147E2732F4440060812D /* toco_convert.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11A52732F4420060812D /* toco_convert.h */; }; - DEEA147F2732F4440060812D /* toco_port.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11A62732F4420060812D /* toco_port.h */; }; - DEEA14802732F4440060812D /* toco_python_api.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11A82732F4420060812D /* toco_python_api.h */; }; - DEEA14812732F4440060812D /* import_tensorflow.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11A92732F4420060812D /* import_tensorflow.h */; }; - DEEA14822732F4440060812D /* format_port.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11AA2732F4420060812D /* format_port.h */; }; - DEEA14832732F4440060812D /* types.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11AC2732F4420060812D /* types.h */; }; - DEEA14842732F4440060812D /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11AD2732F4420060812D /* common.h */; }; - DEEA14852732F4440060812D /* dump_graphviz.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11AE2732F4420060812D /* dump_graphviz.h */; }; - DEEA14862732F4440060812D /* args.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11AF2732F4420060812D /* args.h */; }; - DEEA14872732F4440060812D /* export_tensorflow.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11B02732F4420060812D /* export_tensorflow.h */; }; - DEEA14882732F4440060812D /* model.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11B12732F4420060812D /* model.h */; }; - DEEA14892732F4440060812D /* toco_tooling.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11B22732F4420060812D /* toco_tooling.h */; }; - DEEA148A2732F4440060812D /* toco_cmdline_flags.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11B32732F4420060812D /* toco_cmdline_flags.h */; }; - DEEA148B2732F4440060812D /* tooling_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11B42732F4420060812D /* tooling_util.h */; }; - DEEA148C2732F4440060812D /* identify_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11B62732F4420060812D /* identify_util.h */; }; - DEEA148D2732F4440060812D /* quantization_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11B72732F4420060812D /* quantization_util.h */; }; - DEEA148E2732F4440060812D /* graph_transformations.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11B82732F4420060812D /* graph_transformations.h */; }; - DEEA148F2732F4440060812D /* remove_trivial_passthrough.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11B92732F4420060812D /* remove_trivial_passthrough.h */; }; - DEEA14902732F4440060812D /* lstm_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11BA2732F4420060812D /* lstm_utils.h */; }; - DEEA14912732F4440060812D /* allocate_transient_arrays.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11BB2732F4420060812D /* allocate_transient_arrays.h */; }; - DEEA14922732F4440060812D /* conversion_log_util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11BD2732F4420060812D /* conversion_log_util.h */; }; - DEEA14932732F4440060812D /* toco_graphviz_dump_options.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11BE2732F4420060812D /* toco_graphviz_dump_options.h */; }; - DEEA14942732F4440060812D /* cluster.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11C02732F4420060812D /* cluster.h */; }; - DEEA14952732F4440060812D /* cluster_utils.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11C12732F4420060812D /* cluster_utils.h */; }; - DEEA14962732F4440060812D /* resolve_svdf.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11C22732F4420060812D /* resolve_svdf.h */; }; - DEEA14972732F4440060812D /* resolve_cluster.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11C32732F4420060812D /* resolve_cluster.h */; }; - DEEA14982732F4440060812D /* grpc.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11C52732F4420060812D /* grpc.h */; }; - DEEA14992732F4440060812D /* idl.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11C62732F4420060812D /* idl.h */; }; - DEEA149A2732F4440060812D /* reflection_generated.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11C72732F4420060812D /* reflection_generated.h */; }; - DEEA149B2732F4440060812D /* registry.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11C82732F4420060812D /* registry.h */; }; - DEEA149C2732F4440060812D /* flatbuffers.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11C92732F4420060812D /* flatbuffers.h */; }; - DEEA149D2732F4440060812D /* flatc.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11CA2732F4420060812D /* flatc.h */; }; - DEEA149E2732F4440060812D /* flexbuffers.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11CB2732F4420060812D /* flexbuffers.h */; }; - DEEA149F2732F4440060812D /* minireflect.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11CC2732F4420060812D /* minireflect.h */; }; - DEEA14A02732F4440060812D /* util.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11CD2732F4420060812D /* util.h */; }; - DEEA14A12732F4440060812D /* code_generators.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11CE2732F4420060812D /* code_generators.h */; }; - DEEA14A22732F4440060812D /* stl_emulation.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11CF2732F4420060812D /* stl_emulation.h */; }; - DEEA14A32732F4440060812D /* hash.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11D02732F4420060812D /* hash.h */; }; - DEEA14A42732F4440060812D /* reflection.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11D12732F4420060812D /* reflection.h */; }; - DEEA14A52732F4440060812D /* base.h in Headers */ = {isa = PBXBuildFile; fileRef = DEEA11D22732F4420060812D /* base.h */; }; - DEEA14A62732F4440060812D /* InputConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEA11D32732F4420060812D /* InputConverter.swift */; }; - DEEA14A72732F4440060812D /* RGBConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEA11D52732F4420060812D /* RGBConverter.swift */; }; DEEA14A82732F4440060812D /* BlurObservation.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEA11D62732F4420060812D /* BlurObservation.swift */; }; DEEA14A92732F4440060812D /* BlurDiscriminator.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEA11D72732F4420060812D /* BlurDiscriminator.swift */; }; - DEEA14AA2732F4440060812D /* OutputConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEA11D82732F4420060812D /* OutputConverter.swift */; }; - DEEA14AB2732F4440060812D /* GrayscaleConverter.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEA11D92732F4420060812D /* GrayscaleConverter.swift */; }; - DEEA14AC2732F4440060812D /* Constants.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEA11DA2732F4420060812D /* Constants.swift */; }; /* End PBXBuildFile section */ /* Begin PBXContainerItemProxy section */ @@ -713,703 +33,22 @@ /* End PBXContainerItemProxy section */ /* Begin PBXFileReference section */ - DE02C85C29EDCAF900FD93D2 /* libtensorflow-lite.xcframework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcframework; path = "libtensorflow-lite.xcframework"; sourceTree = ""; }; + 27A4C748729C296387CA6A57 /* cc0_cherry_blossom.jpg */ = {isa = PBXFileReference; includeInIndex = 1; path = cc0_cherry_blossom.jpg; sourceTree = ""; }; + 2C4695E27633018BA75A53F2 /* BlurDiscriminatorLoadingTests.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = BlurDiscriminatorLoadingTests.swift; sourceTree = ""; }; + 32C2EACCA5B7A4F2C00A54F5 /* BlurSegmentation.mlpackage */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = folder.mlpackage; path = BlurSegmentation.mlpackage; sourceTree = ""; }; + 4FB3A2C4F29FFCAF4B2288D7 /* CoreMLBlurPredictor.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = CoreMLBlurPredictor.swift; sourceTree = ""; }; + 7D3DD43200685F748A77934D /* cc0_misty_river.jpg */ = {isa = PBXFileReference; includeInIndex = 1; path = cc0_misty_river.jpg; sourceTree = ""; }; + 98EFA6F3C2DB0A382A617E59 /* BlurMap.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = BlurMap.swift; sourceTree = ""; }; + C64B8D724CF8C561C84E3B3D /* cc0_ant_sunflower.jpg */ = {isa = PBXFileReference; includeInIndex = 1; path = cc0_ant_sunflower.jpg; sourceTree = ""; }; + D5F2E2AF2A0437537333C08A /* CGImage+resize.swift */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.swift; path = "CGImage+resize.swift"; sourceTree = ""; }; DE90DBB92737B43E0048E41B /* BlurDiscriminatorKitTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BlurDiscriminatorKitTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; DE90DBBB2737B43F0048E41B /* BlurDiscriminatorKitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BlurDiscriminatorKitTests.swift; sourceTree = ""; }; DE90DBBD2737B43F0048E41B /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DE90DBC52737BB9A0048E41B /* image_f264_horizontal_fliped.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_f264_horizontal_fliped.jpg; sourceTree = ""; }; - DE90DBC62737BB9A0048E41B /* image_f67_origin.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_f67_origin.jpg; sourceTree = ""; }; - DE90DBC72737BB9A0048E41B /* blur_segmentation_quantized.tflite */ = {isa = PBXFileReference; lastKnownFileType = file; path = blur_segmentation_quantized.tflite; sourceTree = ""; }; - DE90DBC82737BB9A0048E41B /* image_f477_origin.jpg */ = {isa = PBXFileReference; lastKnownFileType = image.jpeg; path = image_f477_origin.jpg; sourceTree = ""; }; DEEA0E7C2732F3A90060812D /* BlurDiscriminatorKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = BlurDiscriminatorKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DEEA0E7F2732F3A90060812D /* BlurDiscriminatorKit.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BlurDiscriminatorKit.h; sourceTree = ""; }; DEEA0E802732F3A90060812D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; - DEEA0E882732F43E0060812D /* InterpreterWrapper.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = InterpreterWrapper.mm; sourceTree = ""; }; - DEEA0E892732F43E0060812D /* InterpreterWrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = InterpreterWrapper.h; sourceTree = ""; }; - DEEA0E8C2732F43E0060812D /* CGImage+resize.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CGImage+resize.swift"; sourceTree = ""; }; - DEEA0E932732F43E0060812D /* micro_interpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_interpreter.h; sourceTree = ""; }; - DEEA0E942732F43E0060812D /* compatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compatibility.h; sourceTree = ""; }; - DEEA0E982732F43E0060812D /* kernel_runner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kernel_runner.h; sourceTree = ""; }; - DEEA0E992732F43E0060812D /* micro_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_utils.h; sourceTree = ""; }; - DEEA0E9B2732F43E0060812D /* mli_tf_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mli_tf_utils.h; sourceTree = ""; }; - DEEA0E9C2732F43E0060812D /* scratch_buffers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scratch_buffers.h; sourceTree = ""; }; - DEEA0E9D2732F43E0060812D /* mli_slicers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mli_slicers.h; sourceTree = ""; }; - DEEA0E9E2732F43E0060812D /* scratch_buf_mgr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scratch_buf_mgr.h; sourceTree = ""; }; - DEEA0E9F2732F43E0060812D /* kernel_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kernel_util.h; sourceTree = ""; }; - DEEA0EA02732F43E0060812D /* fully_connected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected.h; sourceTree = ""; }; - DEEA0EA22732F43E0060812D /* fixedpoint_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fixedpoint_utils.h; sourceTree = ""; }; - DEEA0EA32732F43E0060812D /* activation_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = activation_utils.h; sourceTree = ""; }; - DEEA0EA52732F43E0060812D /* xtensa_tf_micro_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xtensa_tf_micro_common.h; sourceTree = ""; }; - DEEA0EAA2732F43E0060812D /* xa_nnlib_api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xa_nnlib_api.h; sourceTree = ""; }; - DEEA0EAB2732F43E0060812D /* xa_nnlib_kernels_api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xa_nnlib_kernels_api.h; sourceTree = ""; }; - DEEA0EAC2732F43E0060812D /* xa_nnlib_standards.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xa_nnlib_standards.h; sourceTree = ""; }; - DEEA0EAD2732F43E0060812D /* xa_type_def.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xa_type_def.h; sourceTree = ""; }; - DEEA0EB12732F43E0060812D /* xa_nnlib_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xa_nnlib_common.h; sourceTree = ""; }; - DEEA0EB22732F43E0060812D /* xa_nnlib_err_chk.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xa_nnlib_err_chk.h; sourceTree = ""; }; - DEEA0EB32732F43E0060812D /* xa_nnlib_definitions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xa_nnlib_definitions.h; sourceTree = ""; }; - DEEA0EB42732F43E0060812D /* xa_api_defs.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xa_api_defs.h; sourceTree = ""; }; - DEEA0EB52732F43E0060812D /* xa_nnlib_common_macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xa_nnlib_common_macros.h; sourceTree = ""; }; - DEEA0EB62732F43E0060812D /* xtensa_tf_micro_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xtensa_tf_micro_common.h; sourceTree = ""; }; - DEEA0EB72732F43E0060812D /* micro_ops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_ops.h; sourceTree = ""; }; - DEEA0EB82732F43E0060812D /* micro_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_utils.h; sourceTree = ""; }; - DEEA0ECB2732F43E0060812D /* simple_memory_allocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simple_memory_allocator.h; sourceTree = ""; }; - DEEA0ECC2732F43E0060812D /* micro_mutable_op_resolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_mutable_op_resolver.h; sourceTree = ""; }; - DEEA0ECE2732F43F0060812D /* debug_log.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = debug_log.h; sourceTree = ""; }; - DEEA0ECF2732F43F0060812D /* recording_micro_allocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = recording_micro_allocator.h; sourceTree = ""; }; - DEEA0ED02732F43F0060812D /* micro_string.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_string.h; sourceTree = ""; }; - DEEA0ED22732F43F0060812D /* test_helpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = test_helpers.h; sourceTree = ""; }; - DEEA0ED52732F43F0060812D /* micro_error_reporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_error_reporter.h; sourceTree = ""; }; - DEEA0ED62732F43F0060812D /* recording_simple_memory_allocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = recording_simple_memory_allocator.h; sourceTree = ""; }; - DEEA0ED72732F43F0060812D /* micro_op_resolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_op_resolver.h; sourceTree = ""; }; - DEEA0EE62732F43F0060812D /* micro_time.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_time.h; sourceTree = ""; }; - DEEA0EE92732F43F0060812D /* image_provider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = image_provider.h; sourceTree = ""; }; - DEEA0EEB2732F43F0060812D /* app_camera_esp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = app_camera_esp.h; sourceTree = ""; }; - DEEA0EEF2732F43F0060812D /* HM01B0_Walking1s_01.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HM01B0_Walking1s_01.h; sourceTree = ""; }; - DEEA0EF02732F43F0060812D /* HM01B0_optimized.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HM01B0_optimized.h; sourceTree = ""; }; - DEEA0EF12732F43F0060812D /* HM01B0.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HM01B0.h; sourceTree = ""; }; - DEEA0EF22732F43F0060812D /* HM01B0_RAW8_QVGA_8bits_lsb_5fps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HM01B0_RAW8_QVGA_8bits_lsb_5fps.h; sourceTree = ""; }; - DEEA0EF32732F43F0060812D /* HM01B0_debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HM01B0_debug.h; sourceTree = ""; }; - DEEA0EF42732F43F0060812D /* person_image_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = person_image_data.h; sourceTree = ""; }; - DEEA0EF52732F43F0060812D /* person_detect_model_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = person_detect_model_data.h; sourceTree = ""; }; - DEEA0EF72732F43F0060812D /* HM01B0_platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HM01B0_platform.h; sourceTree = ""; }; - DEEA0EF82732F43F0060812D /* model_settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model_settings.h; sourceTree = ""; }; - DEEA0EF92732F43F0060812D /* main_functions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = main_functions.h; sourceTree = ""; }; - DEEA0EFA2732F43F0060812D /* no_person_image_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = no_person_image_data.h; sourceTree = ""; }; - DEEA0EFB2732F43F0060812D /* detection_responder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = detection_responder.h; sourceTree = ""; }; - DEEA0EFD2732F43F0060812D /* output_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = output_handler.h; sourceTree = ""; }; - DEEA0EFF2732F43F0060812D /* constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = constants.h; sourceTree = ""; }; - DEEA0F002732F43F0060812D /* main_functions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = main_functions.h; sourceTree = ""; }; - DEEA0F032732F43F0060812D /* model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model.h; sourceTree = ""; }; - DEEA0F062732F43F0060812D /* accelerometer_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = accelerometer_handler.h; sourceTree = ""; }; - DEEA0F072732F43F0060812D /* output_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = output_handler.h; sourceTree = ""; }; - DEEA0F082732F43F0060812D /* constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = constants.h; sourceTree = ""; }; - DEEA0F0D2732F43F0060812D /* accelerometer_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = accelerometer_handler.h; sourceTree = ""; }; - DEEA0F0E2732F43F0060812D /* gesture_predictor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gesture_predictor.h; sourceTree = ""; }; - DEEA0F0F2732F43F0060812D /* ring_micro_features_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ring_micro_features_data.h; sourceTree = ""; }; - DEEA0F102732F43F0060812D /* main_functions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = main_functions.h; sourceTree = ""; }; - DEEA0F162732F43F0060812D /* slope_micro_features_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slope_micro_features_data.h; sourceTree = ""; }; - DEEA0F172732F43F0060812D /* magic_wand_model_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = magic_wand_model_data.h; sourceTree = ""; }; - DEEA0F192732F43F0060812D /* image_provider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = image_provider.h; sourceTree = ""; }; - DEEA0F1B2732F43F0060812D /* display_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = display_util.h; sourceTree = ""; }; - DEEA0F1C2732F43F0060812D /* image_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = image_util.h; sourceTree = ""; }; - DEEA0F1D2732F43F0060812D /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; - DEEA0F1E2732F43F0060812D /* image_recognition_model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = image_recognition_model.h; sourceTree = ""; }; - DEEA0F202732F43F0060812D /* image_provider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = image_provider.h; sourceTree = ""; }; - DEEA0F222732F43F0060812D /* platform_Sparkfun_Edge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = platform_Sparkfun_Edge.h; sourceTree = ""; }; - DEEA0F232732F43F0060812D /* HM01B0_Walking1s_01.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HM01B0_Walking1s_01.h; sourceTree = ""; }; - DEEA0F242732F43F0060812D /* HM01B0_optimized.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HM01B0_optimized.h; sourceTree = ""; }; - DEEA0F252732F43F0060812D /* HM01B0.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HM01B0.h; sourceTree = ""; }; - DEEA0F262732F43F0060812D /* HM01B0_RAW8_QVGA_8bits_lsb_5fps.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HM01B0_RAW8_QVGA_8bits_lsb_5fps.h; sourceTree = ""; }; - DEEA0F272732F43F0060812D /* HM01B0_debug.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HM01B0_debug.h; sourceTree = ""; }; - DEEA0F282732F43F0060812D /* person_image_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = person_image_data.h; sourceTree = ""; }; - DEEA0F292732F43F0060812D /* person_detect_model_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = person_detect_model_data.h; sourceTree = ""; }; - DEEA0F2A2732F43F0060812D /* model_settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model_settings.h; sourceTree = ""; }; - DEEA0F2B2732F43F0060812D /* main_functions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = main_functions.h; sourceTree = ""; }; - DEEA0F2C2732F43F0060812D /* no_person_image_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = no_person_image_data.h; sourceTree = ""; }; - DEEA0F2D2732F43F0060812D /* detection_responder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = detection_responder.h; sourceTree = ""; }; - DEEA0F2F2732F43F0060812D /* input_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = input_data.h; sourceTree = ""; }; - DEEA0F302732F43F0060812D /* network_model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = network_model.h; sourceTree = ""; }; - DEEA0F312732F43F0060812D /* expected_output_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = expected_output_data.h; sourceTree = ""; }; - DEEA0F332732F43F0060812D /* no_1000ms_sample_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = no_1000ms_sample_data.h; sourceTree = ""; }; - DEEA0F342732F43F0060812D /* yes_1000ms_sample_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yes_1000ms_sample_data.h; sourceTree = ""; }; - DEEA0F352732F43F0060812D /* audio_provider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = audio_provider.h; sourceTree = ""; }; - DEEA0F3D2732F43F0060812D /* ringbuf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ringbuf.h; sourceTree = ""; }; - DEEA0F3E2732F43F0060812D /* command_responder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = command_responder.h; sourceTree = ""; }; - DEEA0F402732F43F0060812D /* yes_30ms_sample_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yes_30ms_sample_data.h; sourceTree = ""; }; - DEEA0F432732F43F0060812D /* feature_provider.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = feature_provider.h; sourceTree = ""; }; - DEEA0F452732F43F0060812D /* sin_1k.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sin_1k.h; sourceTree = ""; }; - DEEA0F462732F43F0060812D /* hanning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hanning.h; sourceTree = ""; }; - DEEA0F472732F43F0060812D /* no_30ms_sample_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = no_30ms_sample_data.h; sourceTree = ""; }; - DEEA0F482732F43F0060812D /* main_functions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = main_functions.h; sourceTree = ""; }; - DEEA0F4D2732F43F0060812D /* micro_features_generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_features_generator.h; sourceTree = ""; }; - DEEA0F4E2732F43F0060812D /* micro_model_settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_model_settings.h; sourceTree = ""; }; - DEEA0F4F2732F43F0060812D /* yes_micro_features_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yes_micro_features_data.h; sourceTree = ""; }; - DEEA0F502732F43F0060812D /* static_alloc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = static_alloc.h; sourceTree = ""; }; - DEEA0F512732F43F0060812D /* no_micro_features_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = no_micro_features_data.h; sourceTree = ""; }; - DEEA0F522732F43F0060812D /* model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model.h; sourceTree = ""; }; - DEEA0F532732F43F0060812D /* no_feature_data_slice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = no_feature_data_slice.h; sourceTree = ""; }; - DEEA0F542732F43F0060812D /* yes_feature_data_slice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yes_feature_data_slice.h; sourceTree = ""; }; - DEEA0F552732F43F0060812D /* recognize_commands.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = recognize_commands.h; sourceTree = ""; }; - DEEA0F572732F43F0060812D /* no_power_spectrum_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = no_power_spectrum_data.h; sourceTree = ""; }; - DEEA0F582732F43F0060812D /* yes_power_spectrum_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yes_power_spectrum_data.h; sourceTree = ""; }; - DEEA0F592732F43F0060812D /* simple_features_generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simple_features_generator.h; sourceTree = ""; }; - DEEA0F5A2732F43F0060812D /* yes_simple_features_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = yes_simple_features_data.h; sourceTree = ""; }; - DEEA0F5B2732F43F0060812D /* simple_model_settings.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simple_model_settings.h; sourceTree = ""; }; - DEEA0F5C2732F43F0060812D /* model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model.h; sourceTree = ""; }; - DEEA0F5D2732F43F0060812D /* no_simple_features_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = no_simple_features_data.h; sourceTree = ""; }; - DEEA0F5F2732F43F0060812D /* micro_benchmark.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_benchmark.h; sourceTree = ""; }; - DEEA0F602732F43F0060812D /* keyword_scrambled_model_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = keyword_scrambled_model_data.h; sourceTree = ""; }; - DEEA0F632732F43F0060812D /* greedy_memory_planner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = greedy_memory_planner.h; sourceTree = ""; }; - DEEA0F642732F43F0060812D /* memory_planner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory_planner.h; sourceTree = ""; }; - DEEA0F652732F43F0060812D /* linear_memory_planner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = linear_memory_planner.h; sourceTree = ""; }; - DEEA0F662732F43F0060812D /* micro_allocator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_allocator.h; sourceTree = ""; }; - DEEA0F672732F43F0060812D /* micro_profiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = micro_profiler.h; sourceTree = ""; }; - DEEA0F682732F43F0060812D /* memory_helpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory_helpers.h; sourceTree = ""; }; - DEEA0F692732F43F0060812D /* all_ops_resolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = all_ops_resolver.h; sourceTree = ""; }; - DEEA0F6B2732F43F0060812D /* recording_micro_interpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = recording_micro_interpreter.h; sourceTree = ""; }; - DEEA0F6D2732F43F0060812D /* dequantize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dequantize.h; sourceTree = ""; }; - DEEA0F6E2732F43F0060812D /* cpu_backend_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_backend_context.h; sourceTree = ""; }; - DEEA0F6F2732F43F0060812D /* cpu_backend_gemm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_backend_gemm.h; sourceTree = ""; }; - DEEA0F702732F43F0060812D /* cpu_backend_gemm_ruy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_backend_gemm_ruy.h; sourceTree = ""; }; - DEEA0F712732F43F0060812D /* kernel_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kernel_util.h; sourceTree = ""; }; - DEEA0F722732F43F0060812D /* acceleration_test_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acceleration_test_util.h; sourceTree = ""; }; - DEEA0F732732F43F0060812D /* fully_connected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected.h; sourceTree = ""; }; - DEEA0F742732F43F0060812D /* subgraph_test_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = subgraph_test_util.h; sourceTree = ""; }; - DEEA0F752732F43F0060812D /* lstm_eval.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lstm_eval.h; sourceTree = ""; }; - DEEA0F772732F43F0060812D /* compatibility.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compatibility.h; sourceTree = ""; }; - DEEA0F782732F43F0060812D /* portable_tensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = portable_tensor.h; sourceTree = ""; }; - DEEA0F792732F43F0060812D /* tensor_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tensor_utils.h; sourceTree = ""; }; - DEEA0F7A2732F43F0060812D /* min.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = min.h; sourceTree = ""; }; - DEEA0F7B2732F43F0060812D /* mfcc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mfcc.h; sourceTree = ""; }; - DEEA0F7C2732F43F0060812D /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; - DEEA0F7D2732F43F0060812D /* transpose_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = transpose_utils.h; sourceTree = ""; }; - DEEA0F7E2732F43F0060812D /* cppmath.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cppmath.h; sourceTree = ""; }; - DEEA0F7F2732F43F0060812D /* quantization_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quantization_util.h; sourceTree = ""; }; - DEEA0F802732F43F0060812D /* mfcc_dct.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mfcc_dct.h; sourceTree = ""; }; - DEEA0F812732F43F0060812D /* spectrogram.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spectrogram.h; sourceTree = ""; }; - DEEA0F822732F43F0060812D /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; - DEEA0F842732F43F0060812D /* sse_tensor_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sse_tensor_utils.h; sourceTree = ""; }; - DEEA0F852732F43F0060812D /* eigen_tensor_reduced_instantiations_google.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eigen_tensor_reduced_instantiations_google.h; sourceTree = ""; }; - DEEA0F872732F43F0060812D /* fully_connected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected.h; sourceTree = ""; }; - DEEA0F882732F43F0060812D /* optimized_ops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = optimized_ops.h; sourceTree = ""; }; - DEEA0F8A2732F43F0060812D /* depthwise_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwise_conv.h; sourceTree = ""; }; - DEEA0F8B2732F43F0060812D /* depthwise_conv_hybrid_3x3_filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwise_conv_hybrid_3x3_filter.h; sourceTree = ""; }; - DEEA0F8C2732F43F0060812D /* fully_connected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected.h; sourceTree = ""; }; - DEEA0F8D2732F43F0060812D /* depthwise_conv_3x3_filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwise_conv_3x3_filter.h; sourceTree = ""; }; - DEEA0F8E2732F43F0060812D /* add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = add.h; sourceTree = ""; }; - DEEA0F8F2732F43F0060812D /* depthwise_conv_hybrid.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwise_conv_hybrid.h; sourceTree = ""; }; - DEEA0F902732F43F0060812D /* mul.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mul.h; sourceTree = ""; }; - DEEA0F912732F43F0060812D /* mean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mean.h; sourceTree = ""; }; - DEEA0F922732F43F0060812D /* pooling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pooling.h; sourceTree = ""; }; - DEEA0F932732F43F0060812D /* transpose_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = transpose_conv.h; sourceTree = ""; }; - DEEA0F942732F43F0060812D /* conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv.h; sourceTree = ""; }; - DEEA0F952732F43F0060812D /* sse_check.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sse_check.h; sourceTree = ""; }; - DEEA0F962732F43F0060812D /* neon_check.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = neon_check.h; sourceTree = ""; }; - DEEA0F972732F43F0060812D /* depthwiseconv_uint8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwiseconv_uint8.h; sourceTree = ""; }; - DEEA0F982732F43F0060812D /* neon_tensor_utils_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = neon_tensor_utils_impl.h; sourceTree = ""; }; - DEEA0F992732F43F0060812D /* depthwiseconv_uint8_transitional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwiseconv_uint8_transitional.h; sourceTree = ""; }; - DEEA0F9A2732F43F0060812D /* cpu_check.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_check.h; sourceTree = ""; }; - DEEA0F9B2732F43F0060812D /* im2col_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = im2col_utils.h; sourceTree = ""; }; - DEEA0F9C2732F43F0060812D /* depthwiseconv_multithread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwiseconv_multithread.h; sourceTree = ""; }; - DEEA0F9D2732F43F0060812D /* depthwiseconv_float.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwiseconv_float.h; sourceTree = ""; }; - DEEA0F9E2732F43F0060812D /* depthwiseconv_uint8_3x3_filter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwiseconv_uint8_3x3_filter.h; sourceTree = ""; }; - DEEA0F9F2732F43F0060812D /* multithreaded_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = multithreaded_conv.h; sourceTree = ""; }; - DEEA0FA02732F43F0060812D /* eigen_spatial_convolutions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eigen_spatial_convolutions.h; sourceTree = ""; }; - DEEA0FA12732F43F0060812D /* batch_matmul.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = batch_matmul.h; sourceTree = ""; }; - DEEA0FA22732F43F0060812D /* eigen_tensor_reduced_instantiations_oss.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eigen_tensor_reduced_instantiations_oss.h; sourceTree = ""; }; - DEEA0FA32732F43F0060812D /* legacy_optimized_ops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = legacy_optimized_ops.h; sourceTree = ""; }; - DEEA0FA42732F43F0060812D /* sse_tensor_utils_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sse_tensor_utils_impl.h; sourceTree = ""; }; - DEEA0FA52732F43F0060812D /* neon_tensor_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = neon_tensor_utils.h; sourceTree = ""; }; - DEEA0FA62732F43F0060812D /* depthwiseconv_3x3_filter_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwiseconv_3x3_filter_common.h; sourceTree = ""; }; - DEEA0FA72732F43F0060812D /* mfcc_mel_filterbank.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mfcc_mel_filterbank.h; sourceTree = ""; }; - DEEA0FA82732F43F0060812D /* max.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = max.h; sourceTree = ""; }; - DEEA0FA92732F43F0060812D /* strided_slice_logic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strided_slice_logic.h; sourceTree = ""; }; - DEEA0FAA2732F43F0060812D /* tensor_ctypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tensor_ctypes.h; sourceTree = ""; }; - DEEA0FAB2732F43F0060812D /* kernel_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kernel_utils.h; sourceTree = ""; }; - DEEA0FAC2732F4400060812D /* legacy_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = legacy_types.h; sourceTree = ""; }; - DEEA0FAD2732F4400060812D /* tensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tensor.h; sourceTree = ""; }; - DEEA0FAF2732F4400060812D /* softmax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = softmax.h; sourceTree = ""; }; - DEEA0FB02732F4400060812D /* quantize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quantize.h; sourceTree = ""; }; - DEEA0FB12732F4400060812D /* dequantize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dequantize.h; sourceTree = ""; }; - DEEA0FB22732F4400060812D /* portable_tensor_utils_impl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = portable_tensor_utils_impl.h; sourceTree = ""; }; - DEEA0FB42732F4400060812D /* fully_connected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected.h; sourceTree = ""; }; - DEEA0FB52732F4400060812D /* strided_slice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strided_slice.h; sourceTree = ""; }; - DEEA0FB62732F4400060812D /* legacy_reference_ops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = legacy_reference_ops.h; sourceTree = ""; }; - DEEA0FB72732F4400060812D /* requantize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = requantize.h; sourceTree = ""; }; - DEEA0FB92732F4400060812D /* dequantize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dequantize.h; sourceTree = ""; }; - DEEA0FBA2732F4400060812D /* depthwise_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwise_conv.h; sourceTree = ""; }; - DEEA0FBB2732F4400060812D /* logistic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = logistic.h; sourceTree = ""; }; - DEEA0FBC2732F4400060812D /* fully_connected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected.h; sourceTree = ""; }; - DEEA0FBD2732F4400060812D /* add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = add.h; sourceTree = ""; }; - DEEA0FBE2732F4400060812D /* l2normalization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = l2normalization.h; sourceTree = ""; }; - DEEA0FBF2732F4400060812D /* log_softmax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = log_softmax.h; sourceTree = ""; }; - DEEA0FC02732F4400060812D /* tanh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tanh.h; sourceTree = ""; }; - DEEA0FC12732F4400060812D /* mul.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mul.h; sourceTree = ""; }; - DEEA0FC22732F4400060812D /* mean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mean.h; sourceTree = ""; }; - DEEA0FC32732F4400060812D /* pooling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pooling.h; sourceTree = ""; }; - DEEA0FC42732F4400060812D /* transpose_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = transpose_conv.h; sourceTree = ""; }; - DEEA0FC52732F4400060812D /* conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv.h; sourceTree = ""; }; - DEEA0FC62732F4400060812D /* logistic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = logistic.h; sourceTree = ""; }; - DEEA0FC72732F4400060812D /* fully_connected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected.h; sourceTree = ""; }; - DEEA0FC82732F4400060812D /* svdf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = svdf.h; sourceTree = ""; }; - DEEA0FC92732F4400060812D /* prelu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prelu.h; sourceTree = ""; }; - DEEA0FCA2732F4400060812D /* round.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = round.h; sourceTree = ""; }; - DEEA0FCB2732F4400060812D /* sub.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = sub.h; sourceTree = ""; }; - DEEA0FCC2732F4400060812D /* pad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pad.h; sourceTree = ""; }; - DEEA0FCD2732F4400060812D /* add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = add.h; sourceTree = ""; }; - DEEA0FCE2732F4400060812D /* l2normalization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = l2normalization.h; sourceTree = ""; }; - DEEA0FCF2732F4400060812D /* arg_min_max.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arg_min_max.h; sourceTree = ""; }; - DEEA0FD02732F4400060812D /* ceil.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ceil.h; sourceTree = ""; }; - DEEA0FD12732F4400060812D /* hard_swish.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hard_swish.h; sourceTree = ""; }; - DEEA0FD22732F4400060812D /* resize_nearest_neighbor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resize_nearest_neighbor.h; sourceTree = ""; }; - DEEA0FD32732F4400060812D /* concatenation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = concatenation.h; sourceTree = ""; }; - DEEA0FD42732F4400060812D /* depthwiseconv_uint8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwiseconv_uint8.h; sourceTree = ""; }; - DEEA0FD52732F4400060812D /* tanh.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tanh.h; sourceTree = ""; }; - DEEA0FD62732F4400060812D /* string_comparisons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = string_comparisons.h; sourceTree = ""; }; - DEEA0FD72732F4400060812D /* mul.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mul.h; sourceTree = ""; }; - DEEA0FD82732F4400060812D /* portable_tensor_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = portable_tensor_utils.h; sourceTree = ""; }; - DEEA0FD92732F4400060812D /* densify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = densify.h; sourceTree = ""; }; - DEEA0FDA2732F4400060812D /* reduce.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reduce.h; sourceTree = ""; }; - DEEA0FDB2732F4400060812D /* depthwiseconv_float.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwiseconv_float.h; sourceTree = ""; }; - DEEA0FDC2732F4400060812D /* process_broadcast_shapes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = process_broadcast_shapes.h; sourceTree = ""; }; - DEEA0FDD2732F4400060812D /* non_max_suppression.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = non_max_suppression.h; sourceTree = ""; }; - DEEA0FDE2732F4400060812D /* maximum_minimum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = maximum_minimum.h; sourceTree = ""; }; - DEEA0FDF2732F4400060812D /* pooling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pooling.h; sourceTree = ""; }; - DEEA0FE02732F4400060812D /* neg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = neg.h; sourceTree = ""; }; - DEEA0FE12732F4400060812D /* comparisons.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = comparisons.h; sourceTree = ""; }; - DEEA0FE22732F4400060812D /* reference_ops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reference_ops.h; sourceTree = ""; }; - DEEA0FE32732F4400060812D /* batch_matmul.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = batch_matmul.h; sourceTree = ""; }; - DEEA0FE42732F4400060812D /* conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv.h; sourceTree = ""; }; - DEEA0FE52732F4400060812D /* floor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = floor.h; sourceTree = ""; }; - DEEA0FE62732F4400060812D /* binary_function.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = binary_function.h; sourceTree = ""; }; - DEEA0FE72732F4400060812D /* test_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = test_util.h; sourceTree = ""; }; - DEEA0FE82732F4400060812D /* lstm_shared.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lstm_shared.h; sourceTree = ""; }; - DEEA0FE92732F4400060812D /* cpu_backend_gemm_x86.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_backend_gemm_x86.h; sourceTree = ""; }; - DEEA0FEA2732F4400060812D /* cpu_backend_gemm_params.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_backend_gemm_params.h; sourceTree = ""; }; - DEEA0FEB2732F4400060812D /* register_ref.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = register_ref.h; sourceTree = ""; }; - DEEA0FEC2732F4400060812D /* cpu_backend_threadpool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_backend_threadpool.h; sourceTree = ""; }; - DEEA0FED2732F4400060812D /* builtin_op_kernels.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = builtin_op_kernels.h; sourceTree = ""; }; - DEEA0FEE2732F4400060812D /* op_macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_macros.h; sourceTree = ""; }; - DEEA0FEF2732F4400060812D /* cpu_backend_gemm_custom_gemv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_backend_gemm_custom_gemv.h; sourceTree = ""; }; - DEEA0FF02732F4400060812D /* eigen_support.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = eigen_support.h; sourceTree = ""; }; - DEEA0FF12732F4400060812D /* acceleration_test_util_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acceleration_test_util_internal.h; sourceTree = ""; }; - DEEA0FF22732F4400060812D /* cpu_backend_gemm_gemmlowp.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_backend_gemm_gemmlowp.h; sourceTree = ""; }; - DEEA0FF32732F4400060812D /* test_delegate_providers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = test_delegate_providers.h; sourceTree = ""; }; - DEEA0FF52732F4400060812D /* hashtable_ops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hashtable_ops.h; sourceTree = ""; }; - DEEA0FF62732F4400060812D /* register.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = register.h; sourceTree = ""; }; - DEEA0FF72732F4400060812D /* reshape_test_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reshape_test_common.h; sourceTree = ""; }; - DEEA0FF82732F4400060812D /* test_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = test_util.h; sourceTree = ""; }; - DEEA0FF92732F4400060812D /* padding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = padding.h; sourceTree = ""; }; - DEEA0FFA2732F4400060812D /* custom_ops_register.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = custom_ops_register.h; sourceTree = ""; }; - DEEA0FFB2732F4400060812D /* cpu_backend_gemm_eigen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cpu_backend_gemm_eigen.h; sourceTree = ""; }; - DEEA0FFC2732F4400060812D /* context_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = context_util.h; sourceTree = ""; }; - DEEA0FFF2732F4400060812D /* lookup_interfaces.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lookup_interfaces.h; sourceTree = ""; }; - DEEA10002732F4400060812D /* lookup_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lookup_util.h; sourceTree = ""; }; - DEEA10012732F4400060812D /* resource_base.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resource_base.h; sourceTree = ""; }; - DEEA10022732F4400060812D /* resource_variable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resource_variable.h; sourceTree = ""; }; - DEEA10032732F4400060812D /* static_hashtable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = static_hashtable.h; sourceTree = ""; }; - DEEA10052732F4400060812D /* gen_op_registration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gen_op_registration.h; sourceTree = ""; }; - DEEA10062732F4400060812D /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = ""; }; - DEEA10072732F4400060812D /* portable_type_to_tflitetype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = portable_type_to_tflitetype.h; sourceTree = ""; }; - DEEA10082732F4400060812D /* builtin_ops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = builtin_ops.h; sourceTree = ""; }; - DEEA10092732F4400060812D /* shared_library.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shared_library.h; sourceTree = ""; }; - DEEA100B2732F4400060812D /* subgraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = subgraph.h; sourceTree = ""; }; - DEEA100C2732F4400060812D /* macros.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = macros.h; sourceTree = ""; }; - DEEA100E2732F4400060812D /* tensor_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tensor_utils.h; sourceTree = ""; }; - DEEA100F2732F4400060812D /* op_resolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_resolver.h; sourceTree = ""; }; - DEEA10102732F4400060812D /* verifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = verifier.h; sourceTree = ""; }; - DEEA10112732F4400060812D /* error_reporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = error_reporter.h; sourceTree = ""; }; - DEEA10122732F4400060812D /* flatbuffer_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = flatbuffer_conversions.h; sourceTree = ""; }; - DEEA10132732F4400060812D /* profiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = profiler.h; sourceTree = ""; }; - DEEA10142732F4400060812D /* op_resolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_resolver.h; sourceTree = ""; }; - DEEA10152732F4400060812D /* minimal_logging.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = minimal_logging.h; sourceTree = ""; }; - DEEA10162732F4400060812D /* string_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = string_util.h; sourceTree = ""; }; - DEEA10172732F4400060812D /* stderr_reporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stderr_reporter.h; sourceTree = ""; }; - DEEA10182732F4400060812D /* allocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = allocation.h; sourceTree = ""; }; - DEEA10192732F4400060812D /* arena_planner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arena_planner.h; sourceTree = ""; }; - DEEA101A2732F4400060812D /* interpreter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = interpreter.h; sourceTree = ""; }; - DEEA101B2732F4400060812D /* builtin_op_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = builtin_op_data.h; sourceTree = ""; }; - DEEA101C2732F4400060812D /* memory_planner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory_planner.h; sourceTree = ""; }; - DEEA101D2732F4400060812D /* context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = context.h; sourceTree = ""; }; - DEEA101E2732F4400060812D /* type_to_tflitetype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = type_to_tflitetype.h; sourceTree = ""; }; - DEEA101F2732F4400060812D /* tflite_with_xnnpack_optional.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tflite_with_xnnpack_optional.h; sourceTree = ""; }; - DEEA10202732F4400060812D /* simple_memory_arena.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simple_memory_arena.h; sourceTree = ""; }; - DEEA10212732F4400060812D /* error_reporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = error_reporter.h; sourceTree = ""; }; - DEEA10232732F4400060812D /* schema_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = schema_utils.h; sourceTree = ""; }; - DEEA10242732F4400060812D /* schema_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = schema_generated.h; sourceTree = ""; }; - DEEA10262732F4400060812D /* generator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = generator.h; sourceTree = ""; }; - DEEA10272732F4400060812D /* string_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = string_type.h; sourceTree = ""; }; - DEEA10292732F4400060812D /* NeuralNetworksTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NeuralNetworksTypes.h; sourceTree = ""; }; - DEEA102A2732F4400060812D /* nnapi_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nnapi_util.h; sourceTree = ""; }; - DEEA102B2732F4400060812D /* nnapi_implementation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nnapi_implementation.h; sourceTree = ""; }; - DEEA102C2732F4400060812D /* NeuralNetworksShim.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NeuralNetworksShim.h; sourceTree = ""; }; - DEEA102D2732F4400060812D /* nnapi_handler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nnapi_handler.h; sourceTree = ""; }; - DEEA102E2732F4400060812D /* external_cpu_backend_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = external_cpu_backend_context.h; sourceTree = ""; }; - DEEA102F2732F4400060812D /* mutable_op_resolver.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mutable_op_resolver.h; sourceTree = ""; }; - DEEA10302732F4400060812D /* stateful_error_reporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stateful_error_reporter.h; sourceTree = ""; }; - DEEA10312732F4400060812D /* model_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model_builder.h; sourceTree = ""; }; - DEEA10322732F4400060812D /* interpreter_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = interpreter_builder.h; sourceTree = ""; }; - DEEA10332732F4400060812D /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; - DEEA10342732F4400060812D /* model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model.h; sourceTree = ""; }; - DEEA10362732F4400060812D /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = ""; }; - DEEA10382732F4400060812D /* delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = delegate.h; sourceTree = ""; }; - DEEA103A2732F4400060812D /* compute_task.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compute_task.h; sourceTree = ""; }; - DEEA103C2732F4400060812D /* winograd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = winograd.h; sourceTree = ""; }; - DEEA103D2732F4400060812D /* softmax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = softmax.h; sourceTree = ""; }; - DEEA103E2732F4400060812D /* depthwise_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwise_conv.h; sourceTree = ""; }; - DEEA103F2732F4400060812D /* relu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = relu.h; sourceTree = ""; }; - DEEA10402732F4400060812D /* max_unpooling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = max_unpooling.h; sourceTree = ""; }; - DEEA10412732F4400060812D /* elementwise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = elementwise.h; sourceTree = ""; }; - DEEA10422732F4400060812D /* fully_connected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected.h; sourceTree = ""; }; - DEEA10432732F4400060812D /* prelu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prelu.h; sourceTree = ""; }; - DEEA10442732F4400060812D /* slice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slice.h; sourceTree = ""; }; - DEEA10452732F4400060812D /* add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = add.h; sourceTree = ""; }; - DEEA10462732F4400060812D /* concat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = concat.h; sourceTree = ""; }; - DEEA10472732F4400060812D /* resize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resize.h; sourceTree = ""; }; - DEEA10482732F4400060812D /* custom_registry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = custom_registry.h; sourceTree = ""; }; - DEEA10492732F4400060812D /* reshape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reshape.h; sourceTree = ""; }; - DEEA104A2732F4400060812D /* mean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mean.h; sourceTree = ""; }; - DEEA104B2732F4400060812D /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; - DEEA104C2732F4400060812D /* space_to_depth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = space_to_depth.h; sourceTree = ""; }; - DEEA104D2732F4400060812D /* pooling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pooling.h; sourceTree = ""; }; - DEEA104E2732F4400060812D /* transpose_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = transpose_conv.h; sourceTree = ""; }; - DEEA104F2732F4400060812D /* conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv.h; sourceTree = ""; }; - DEEA10502732F4400060812D /* test_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = test_util.h; sourceTree = ""; }; - DEEA10512732F4400060812D /* padding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = padding.h; sourceTree = ""; }; - DEEA10522732F4400060812D /* quantize_and_dequantize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quantize_and_dequantize.h; sourceTree = ""; }; - DEEA10572732F4400060812D /* arguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arguments.h; sourceTree = ""; }; - DEEA10582732F4400060812D /* runtime_options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = runtime_options.h; sourceTree = ""; }; - DEEA10592732F4400060812D /* environment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = environment.h; sourceTree = ""; }; - DEEA105A2732F4400060812D /* api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = api.h; sourceTree = ""; }; - DEEA105B2732F4400060812D /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; - DEEA105C2732F4400060812D /* metal_arguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = metal_arguments.h; sourceTree = ""; }; - DEEA105D2732F4400060812D /* compiled_model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compiled_model.h; sourceTree = ""; }; - DEEA105E2732F4400060812D /* compute_task_descriptor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compute_task_descriptor.h; sourceTree = ""; }; - DEEA105F2732F4400060812D /* inference_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inference_context.h; sourceTree = ""; }; - DEEA10602732F4400060812D /* buffer_convert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = buffer_convert.h; sourceTree = ""; }; - DEEA10612732F4400060812D /* gl_delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_delegate.h; sourceTree = ""; }; - DEEA10622732F4400060812D /* api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = api.h; sourceTree = ""; }; - DEEA10642732F4400060812D /* winograd_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = winograd_util.h; sourceTree = ""; }; - DEEA10652732F4400060812D /* gpu_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gpu_info.h; sourceTree = ""; }; - DEEA10662732F4400060812D /* status.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = status.h; sourceTree = ""; }; - DEEA10682732F4400060812D /* add_bias.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = add_bias.h; sourceTree = ""; }; - DEEA10692732F4400060812D /* matching.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = matching.h; sourceTree = ""; }; - DEEA106A2732F4400060812D /* add_quant_adjustments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = add_quant_adjustments.h; sourceTree = ""; }; - DEEA106B2732F4400060812D /* fuse_add_to_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fuse_add_to_conv.h; sourceTree = ""; }; - DEEA106C2732F4400060812D /* make_fully_connected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = make_fully_connected.h; sourceTree = ""; }; - DEEA106D2732F4400060812D /* merge_padding_with.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = merge_padding_with.h; sourceTree = ""; }; - DEEA106E2732F4400060812D /* model_transformations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model_transformations.h; sourceTree = ""; }; - DEEA106F2732F4400060812D /* make_padding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = make_padding.h; sourceTree = ""; }; - DEEA10702732F4400060812D /* fuse_mul_to_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fuse_mul_to_conv.h; sourceTree = ""; }; - DEEA10712732F4400060812D /* remove_noop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = remove_noop.h; sourceTree = ""; }; - DEEA10722732F4400060812D /* lstm_parser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lstm_parser.h; sourceTree = ""; }; - DEEA10732732F4400060812D /* operations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = operations.h; sourceTree = ""; }; - DEEA10742732F4400060812D /* custom_parsers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = custom_parsers.h; sourceTree = ""; }; - DEEA10752732F4400060812D /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; - DEEA10762732F4400060812D /* workgroup_selection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = workgroup_selection.h; sourceTree = ""; }; - DEEA10772732F4400060812D /* access_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = access_type.h; sourceTree = ""; }; - DEEA10782732F4400060812D /* shape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shape.h; sourceTree = ""; }; - DEEA10792732F4400060812D /* data_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = data_type.h; sourceTree = ""; }; - DEEA107A2732F4400060812D /* quantization_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quantization_util.h; sourceTree = ""; }; - DEEA107B2732F4400060812D /* memory_management.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = memory_management.h; sourceTree = ""; }; - DEEA107C2732F4400060812D /* model_transformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model_transformer.h; sourceTree = ""; }; - DEEA107F2732F4400060812D /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = ""; }; - DEEA10812732F4400060812D /* add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = add.h; sourceTree = ""; }; - DEEA10822732F4400060812D /* feature_parity.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = feature_parity.h; sourceTree = ""; }; - DEEA10832732F4400060812D /* tflite_model_reader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tflite_model_reader.h; sourceTree = ""; }; - DEEA10842732F4400060812D /* interpreter_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = interpreter_utils.h; sourceTree = ""; }; - DEEA10862732F4400060812D /* internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = internal.h; sourceTree = ""; }; - DEEA10872732F4400060812D /* naive_assignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = naive_assignment.h; sourceTree = ""; }; - DEEA10882732F4400060812D /* greedy_in_order_assignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = greedy_in_order_assignment.h; sourceTree = ""; }; - DEEA10892732F4410060812D /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; - DEEA108A2732F4410060812D /* greedy_by_size_assignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = greedy_by_size_assignment.h; sourceTree = ""; }; - DEEA108B2732F4410060812D /* min_cost_flow_assignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = min_cost_flow_assignment.h; sourceTree = ""; }; - DEEA108C2732F4410060812D /* greedy_by_breadth_assignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = greedy_by_breadth_assignment.h; sourceTree = ""; }; - DEEA108D2732F4410060812D /* equality_assignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = equality_assignment.h; sourceTree = ""; }; - DEEA108E2732F4410060812D /* model_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model_builder.h; sourceTree = ""; }; - DEEA108F2732F4410060812D /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; - DEEA10902732F4410060812D /* model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model.h; sourceTree = ""; }; - DEEA10912732F4410060812D /* custom_transformations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = custom_transformations.h; sourceTree = ""; }; - DEEA10922732F4410060812D /* model_builder_helper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model_builder_helper.h; sourceTree = ""; }; - DEEA10932732F4410060812D /* convert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convert.h; sourceTree = ""; }; - DEEA10942732F4410060812D /* object_reader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = object_reader.h; sourceTree = ""; }; - DEEA10952732F4410060812D /* tensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tensor.h; sourceTree = ""; }; - DEEA10962732F4410060812D /* metal_delegate_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = metal_delegate_internal.h; sourceTree = ""; }; - DEEA10992732F4410060812D /* softmax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = softmax.h; sourceTree = ""; }; - DEEA109A2732F4410060812D /* depthwise_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwise_conv.h; sourceTree = ""; }; - DEEA109B2732F4410060812D /* relu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = relu.h; sourceTree = ""; }; - DEEA109C2732F4410060812D /* max_unpooling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = max_unpooling.h; sourceTree = ""; }; - DEEA109D2732F4410060812D /* elementwise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = elementwise.h; sourceTree = ""; }; - DEEA109E2732F4410060812D /* fully_connected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected.h; sourceTree = ""; }; - DEEA109F2732F4410060812D /* prelu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prelu.h; sourceTree = ""; }; - DEEA10A02732F4410060812D /* slice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slice.h; sourceTree = ""; }; - DEEA10A12732F4410060812D /* pad.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pad.h; sourceTree = ""; }; - DEEA10A22732F4410060812D /* add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = add.h; sourceTree = ""; }; - DEEA10A32732F4410060812D /* converter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = converter.h; sourceTree = ""; }; - DEEA10A42732F4410060812D /* lstm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lstm.h; sourceTree = ""; }; - DEEA10A52732F4410060812D /* registry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = registry.h; sourceTree = ""; }; - DEEA10A62732F4410060812D /* concat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = concat.h; sourceTree = ""; }; - DEEA10A72732F4410060812D /* resize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resize.h; sourceTree = ""; }; - DEEA10A82732F4410060812D /* mul.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mul.h; sourceTree = ""; }; - DEEA10A92732F4410060812D /* custom_registry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = custom_registry.h; sourceTree = ""; }; - DEEA10AA2732F4410060812D /* reshape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reshape.h; sourceTree = ""; }; - DEEA10AB2732F4410060812D /* mean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mean.h; sourceTree = ""; }; - DEEA10AC2732F4410060812D /* space_to_depth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = space_to_depth.h; sourceTree = ""; }; - DEEA10AD2732F4410060812D /* pooling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pooling.h; sourceTree = ""; }; - DEEA10AE2732F4410060812D /* transpose_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = transpose_conv.h; sourceTree = ""; }; - DEEA10AF2732F4410060812D /* conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv.h; sourceTree = ""; }; - DEEA10B02732F4410060812D /* test_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = test_util.h; sourceTree = ""; }; - DEEA10B12732F4410060812D /* quantize_and_dequantize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quantize_and_dequantize.h; sourceTree = ""; }; - DEEA10B22732F4410060812D /* object_manager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = object_manager.h; sourceTree = ""; }; - DEEA10B32732F4410060812D /* compiler_options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compiler_options.h; sourceTree = ""; }; - DEEA10B42732F4410060812D /* float16_conversions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = float16_conversions.h; sourceTree = ""; }; - DEEA10B52732F4410060812D /* gl_errors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_errors.h; sourceTree = ""; }; - DEEA10B62732F4410060812D /* compiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compiler.h; sourceTree = ""; }; - DEEA10B72732F4410060812D /* egl_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = egl_context.h; sourceTree = ""; }; - DEEA10B82732F4410060812D /* runtime_options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = runtime_options.h; sourceTree = ""; }; - DEEA10B92732F4410060812D /* serialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = serialization.h; sourceTree = ""; }; - DEEA10BA2732F4410060812D /* egl_surface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = egl_surface.h; sourceTree = ""; }; - DEEA10BC2732F4410060812D /* shared_buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shared_buffer.h; sourceTree = ""; }; - DEEA10BD2732F4410060812D /* gl_shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_shader.h; sourceTree = ""; }; - DEEA10BE2732F4410060812D /* gl_texture.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_texture.h; sourceTree = ""; }; - DEEA10C02732F4410060812D /* phwc4_to_bhwc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = phwc4_to_bhwc.h; sourceTree = ""; }; - DEEA10C12732F4410060812D /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; - DEEA10C22732F4410060812D /* bhwc_to_phwc4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = bhwc_to_phwc4.h; sourceTree = ""; }; - DEEA10C42732F4410060812D /* best_effort_calculator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = best_effort_calculator.h; sourceTree = ""; }; - DEEA10C52732F4410060812D /* calculator_from_metadata.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = calculator_from_metadata.h; sourceTree = ""; }; - DEEA10C62732F4410060812D /* default_calculator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default_calculator.h; sourceTree = ""; }; - DEEA10C72732F4410060812D /* calculator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = calculator.h; sourceTree = ""; }; - DEEA10C82732F4410060812D /* ideal_workgroup_picker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ideal_workgroup_picker.h; sourceTree = ""; }; - DEEA10C92732F4410060812D /* variable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = variable.h; sourceTree = ""; }; - DEEA10CA2732F4410060812D /* gl_program.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_program.h; sourceTree = ""; }; - DEEA10CB2732F4410060812D /* runtime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = runtime.h; sourceTree = ""; }; - DEEA10CC2732F4410060812D /* api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = api.h; sourceTree = ""; }; - DEEA10CD2732F4410060812D /* node_shader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = node_shader.h; sourceTree = ""; }; - DEEA10CE2732F4410060812D /* portable_gl31.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = portable_gl31.h; sourceTree = ""; }; - DEEA10CF2732F4410060812D /* api2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = api2.h; sourceTree = ""; }; - DEEA10D02732F4410060812D /* gl_call.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_call.h; sourceTree = ""; }; - DEEA10D12732F4410060812D /* object.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = object.h; sourceTree = ""; }; - DEEA10D22732F4410060812D /* request_gpu_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = request_gpu_info.h; sourceTree = ""; }; - DEEA10D32732F4410060812D /* gl_buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_buffer.h; sourceTree = ""; }; - DEEA10D42732F4410060812D /* egl_environment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = egl_environment.h; sourceTree = ""; }; - DEEA10D52732F4410060812D /* gl_sync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_sync.h; sourceTree = ""; }; - DEEA10D72732F4410060812D /* variable_accessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = variable_accessor.h; sourceTree = ""; }; - DEEA10D82732F4410060812D /* shader_code.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shader_code.h; sourceTree = ""; }; - DEEA10D92732F4410060812D /* shader_codegen.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shader_codegen.h; sourceTree = ""; }; - DEEA10DA2732F4410060812D /* fuse_auto_input.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fuse_auto_input.h; sourceTree = ""; }; - DEEA10DB2732F4410060812D /* fuse_inplace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fuse_inplace.h; sourceTree = ""; }; - DEEA10DC2732F4410060812D /* object_accessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = object_accessor.h; sourceTree = ""; }; - DEEA10DD2732F4410060812D /* fuse_inline.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fuse_inline.h; sourceTree = ""; }; - DEEA10DE2732F4410060812D /* rename.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rename.h; sourceTree = ""; }; - DEEA10DF2732F4410060812D /* compiled_node.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compiled_node.h; sourceTree = ""; }; - DEEA10E02732F4410060812D /* preprocessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = preprocessor.h; sourceTree = ""; }; - DEEA10E12732F4410060812D /* stats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stats.h; sourceTree = ""; }; - DEEA10E22732F4410060812D /* command_queue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = command_queue.h; sourceTree = ""; }; - DEEA10E32732F4410060812D /* portable_egl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = portable_egl.h; sourceTree = ""; }; - DEEA10E42732F4410060812D /* spi.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = spi.h; sourceTree = ""; }; - DEEA10E62732F4410060812D /* texture2d.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = texture2d.h; sourceTree = ""; }; - DEEA10E82732F4410060812D /* winograd.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = winograd.h; sourceTree = ""; }; - DEEA10E92732F4410060812D /* softmax.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = softmax.h; sourceTree = ""; }; - DEEA10EA2732F4410060812D /* strided_slice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strided_slice.h; sourceTree = ""; }; - DEEA10EB2732F4410060812D /* depthwise_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwise_conv.h; sourceTree = ""; }; - DEEA10EC2732F4410060812D /* convolution_transposed_4x4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convolution_transposed_4x4.h; sourceTree = ""; }; - DEEA10ED2732F4410060812D /* conv_constants.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv_constants.h; sourceTree = ""; }; - DEEA10EE2732F4410060812D /* relu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = relu.h; sourceTree = ""; }; - DEEA10EF2732F4410060812D /* max_unpooling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = max_unpooling.h; sourceTree = ""; }; - DEEA10F02732F4410060812D /* elementwise.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = elementwise.h; sourceTree = ""; }; - DEEA10F12732F4410060812D /* cl_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cl_test.h; sourceTree = ""; }; - DEEA10F22732F4410060812D /* fully_connected.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected.h; sourceTree = ""; }; - DEEA10F32732F4410060812D /* concat_z.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = concat_z.h; sourceTree = ""; }; - DEEA10F42732F4410060812D /* convolution_transposed_thin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convolution_transposed_thin.h; sourceTree = ""; }; - DEEA10F52732F4410060812D /* prelu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prelu.h; sourceTree = ""; }; - DEEA10F62732F4410060812D /* reshapex4.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reshapex4.h; sourceTree = ""; }; - DEEA10F72732F4410060812D /* conv_weights_converter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv_weights_converter.h; sourceTree = ""; }; - DEEA10F82732F4410060812D /* convolution_transposed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convolution_transposed.h; sourceTree = ""; }; - DEEA10F92732F4410060812D /* add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = add.h; sourceTree = ""; }; - DEEA10FA2732F4410060812D /* convolution_transposed_3x3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convolution_transposed_3x3.h; sourceTree = ""; }; - DEEA10FB2732F4410060812D /* depthwise_conv_3x3.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwise_conv_3x3.h; sourceTree = ""; }; - DEEA10FC2732F4410060812D /* converter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = converter.h; sourceTree = ""; }; - DEEA10FD2732F4410060812D /* tuning_parameters.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tuning_parameters.h; sourceTree = ""; }; - DEEA10FE2732F4410060812D /* lstm.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lstm.h; sourceTree = ""; }; - DEEA11002732F4410060812D /* fc_fc_add.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fc_fc_add.h; sourceTree = ""; }; - DEEA11012732F4410060812D /* depthwise_conv_plus_1x1_conv.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwise_conv_plus_1x1_conv.h; sourceTree = ""; }; - DEEA11022732F4410060812D /* resize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resize.h; sourceTree = ""; }; - DEEA11032732F4410060812D /* convolution_transposed_3x3_thin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convolution_transposed_3x3_thin.h; sourceTree = ""; }; - DEEA11042732F4410060812D /* conv_common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv_common.h; sourceTree = ""; }; - DEEA11052732F4410060812D /* gpu_operation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gpu_operation.h; sourceTree = ""; }; - DEEA11062732F4410060812D /* reshape.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reshape.h; sourceTree = ""; }; - DEEA11072732F4410060812D /* reduce.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reduce.h; sourceTree = ""; }; - DEEA11082732F4410060812D /* mean.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mean.h; sourceTree = ""; }; - DEEA11092732F4410060812D /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; - DEEA110A2732F4410060812D /* conv_powervr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv_powervr.h; sourceTree = ""; }; - DEEA110B2732F4410060812D /* space_to_depth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = space_to_depth.h; sourceTree = ""; }; - DEEA110C2732F4410060812D /* pooling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pooling.h; sourceTree = ""; }; - DEEA110D2732F4410060812D /* conv_buffer_1x1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv_buffer_1x1.h; sourceTree = ""; }; - DEEA110E2732F4410060812D /* work_group_picking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = work_group_picking.h; sourceTree = ""; }; - DEEA110F2732F4410060812D /* softmax1x1.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = softmax1x1.h; sourceTree = ""; }; - DEEA11102732F4410060812D /* transpose.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = transpose.h; sourceTree = ""; }; - DEEA11112732F4410060812D /* padding.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = padding.h; sourceTree = ""; }; - DEEA11122732F4410060812D /* mean_stddev_normalization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mean_stddev_normalization.h; sourceTree = ""; }; - DEEA11132732F4410060812D /* quantize_and_dequantize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quantize_and_dequantize.h; sourceTree = ""; }; - DEEA11142732F4410060812D /* concat_xy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = concat_xy.h; sourceTree = ""; }; - DEEA11152732F4410060812D /* gpu_api_delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gpu_api_delegate.h; sourceTree = ""; }; - DEEA11162732F4410060812D /* opencl_wrapper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = opencl_wrapper.h; sourceTree = ""; }; - DEEA11172732F4410060812D /* program_cache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = program_cache.h; sourceTree = ""; }; - DEEA11182732F4410060812D /* cl_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cl_test.h; sourceTree = ""; }; - DEEA11192732F4410060812D /* arguments.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arguments.h; sourceTree = ""; }; - DEEA111A2732F4410060812D /* precision.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = precision.h; sourceTree = ""; }; - DEEA111B2732F4410060812D /* serialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = serialization.h; sourceTree = ""; }; - DEEA111C2732F4410060812D /* cl_kernel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cl_kernel.h; sourceTree = ""; }; - DEEA111D2732F4410060812D /* compiled_program_cache_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = compiled_program_cache_generated.h; sourceTree = ""; }; - DEEA111E2732F4410060812D /* cl_memory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cl_memory.h; sourceTree = ""; }; - DEEA111F2732F4410060812D /* cl_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cl_context.h; sourceTree = ""; }; - DEEA11202732F4410060812D /* environment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = environment.h; sourceTree = ""; }; - DEEA11212732F4410060812D /* cl_image_format.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cl_image_format.h; sourceTree = ""; }; - DEEA11222732F4410060812D /* api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = api.h; sourceTree = ""; }; - DEEA11232732F4410060812D /* storage_type_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = storage_type_util.h; sourceTree = ""; }; - DEEA11242732F4410060812D /* cl_errors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cl_errors.h; sourceTree = ""; }; - DEEA11252732F4410060812D /* tensor_type_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tensor_type_util.h; sourceTree = ""; }; - DEEA11262732F4410060812D /* linear_storage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = linear_storage.h; sourceTree = ""; }; - DEEA11272732F4410060812D /* buffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = buffer.h; sourceTree = ""; }; - DEEA11282732F4410060812D /* gl_interop.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gl_interop.h; sourceTree = ""; }; - DEEA11292732F4410060812D /* gpu_object.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = gpu_object.h; sourceTree = ""; }; - DEEA112A2732F4410060812D /* cl_command_queue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cl_command_queue.h; sourceTree = ""; }; - DEEA112B2732F4410060812D /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; - DEEA112C2732F4410060812D /* egl_sync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = egl_sync.h; sourceTree = ""; }; - DEEA112D2732F4410060812D /* cl_device.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cl_device.h; sourceTree = ""; }; - DEEA112E2732F4410060812D /* tensor_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tensor_type.h; sourceTree = ""; }; - DEEA112F2732F4410060812D /* cl_event.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cl_event.h; sourceTree = ""; }; - DEEA11302732F4410060812D /* model_hints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model_hints.h; sourceTree = ""; }; - DEEA11312732F4410060812D /* cl_program.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cl_program.h; sourceTree = ""; }; - DEEA11322732F4410060812D /* tensor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tensor.h; sourceTree = ""; }; - DEEA11332732F4410060812D /* device_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = device_info.h; sourceTree = ""; }; - DEEA11342732F4410060812D /* inference_context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = inference_context.h; sourceTree = ""; }; - DEEA11362732F4410060812D /* fully_connected_selector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected_selector.h; sourceTree = ""; }; - DEEA11372732F4410060812D /* simple_selectors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simple_selectors.h; sourceTree = ""; }; - DEEA11382732F4410060812D /* operation_selector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = operation_selector.h; sourceTree = ""; }; - DEEA11392732F4410060812D /* subgraph.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = subgraph.h; sourceTree = ""; }; - DEEA113A2732F4410060812D /* special_selector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = special_selector.h; sourceTree = ""; }; - DEEA113B2732F4410060812D /* dw_convolution_selector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dw_convolution_selector.h; sourceTree = ""; }; - DEEA113C2732F4410060812D /* default_selector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = default_selector.h; sourceTree = ""; }; - DEEA113D2732F4410060812D /* convolution_selector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convolution_selector.h; sourceTree = ""; }; - DEEA113E2732F4410060812D /* convolution_transposed_selector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = convolution_transposed_selector.h; sourceTree = ""; }; - DEEA113F2732F4410060812D /* metal_delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = metal_delegate.h; sourceTree = ""; }; - DEEA11402732F4410060812D /* status.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = status.h; sourceTree = ""; }; - DEEA11432732F4410060812D /* dummy_delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dummy_delegate.h; sourceTree = ""; }; - DEEA11442732F4410060812D /* simple_delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simple_delegate.h; sourceTree = ""; }; - DEEA11462732F4410060812D /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = ""; }; - DEEA11482732F4410060812D /* batch_seq_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = batch_seq_builder.h; sourceTree = ""; }; - DEEA11492732F4410060812D /* matmul_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = matmul_builder.h; sourceTree = ""; }; - DEEA114A2732F4410060812D /* reshape_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reshape_builder.h; sourceTree = ""; }; - DEEA114B2732F4410060812D /* slice_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = slice_builder.h; sourceTree = ""; }; - DEEA114C2732F4410060812D /* transpose_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = transpose_builder.h; sourceTree = ""; }; - DEEA114D2732F4410060812D /* neg_op_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = neg_op_builder.h; sourceTree = ""; }; - DEEA114E2732F4410060812D /* l2_normalization_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = l2_normalization_builder.h; sourceTree = ""; }; - DEEA114F2732F4410060812D /* arg_min_max_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arg_min_max_builder.h; sourceTree = ""; }; - DEEA11502732F4410060812D /* concat_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = concat_builder.h; sourceTree = ""; }; - DEEA11512732F4410060812D /* cast_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cast_builder.h; sourceTree = ""; }; - DEEA11522732F4410060812D /* split_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = split_builder.h; sourceTree = ""; }; - DEEA11532732F4410060812D /* resize_bilinear_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resize_bilinear_builder.h; sourceTree = ""; }; - DEEA11542732F4410060812D /* pool_2d_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pool_2d_builder.h; sourceTree = ""; }; - DEEA11552732F4410060812D /* quantize_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quantize_builder.h; sourceTree = ""; }; - DEEA11562732F4410060812D /* reduce_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reduce_builder.h; sourceTree = ""; }; - DEEA11572732F4410060812D /* softmax_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = softmax_builder.h; sourceTree = ""; }; - DEEA11592732F4410060812D /* hexagon_delegate_op_model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hexagon_delegate_op_model.h; sourceTree = ""; }; - DEEA115A2732F4410060812D /* transpose_conv_2d_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = transpose_conv_2d_builder.h; sourceTree = ""; }; - DEEA115B2732F4410060812D /* activation_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = activation_builder.h; sourceTree = ""; }; - DEEA115C2732F4410060812D /* space_to_depth_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = space_to_depth_builder.h; sourceTree = ""; }; - DEEA115D2732F4410060812D /* conv_2d_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv_2d_builder.h; sourceTree = ""; }; - DEEA115E2732F4410060812D /* resize_nearest_neighbor_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resize_nearest_neighbor_builder.h; sourceTree = ""; }; - DEEA115F2732F4410060812D /* op_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_builder.h; sourceTree = ""; }; - DEEA11602732F4410060812D /* pad_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pad_builder.h; sourceTree = ""; }; - DEEA11612732F4410060812D /* min_max_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = min_max_builder.h; sourceTree = ""; }; - DEEA11622732F4410060812D /* mirror_pad_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mirror_pad_builder.h; sourceTree = ""; }; - DEEA11632732F4410060812D /* strided_slice_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = strided_slice_builder.h; sourceTree = ""; }; - DEEA11642732F4410060812D /* op_factory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_factory.h; sourceTree = ""; }; - DEEA11652732F4410060812D /* hardswish_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hardswish_builder.h; sourceTree = ""; }; - DEEA11662732F4410060812D /* arithmetic_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = arithmetic_builder.h; sourceTree = ""; }; - DEEA11672732F4410060812D /* pack_builder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pack_builder.h; sourceTree = ""; }; - DEEA11682732F4410060812D /* hexagon_nn_interface.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hexagon_nn_interface.h; sourceTree = ""; }; - DEEA11692732F4410060812D /* hexagon_delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hexagon_delegate.h; sourceTree = ""; }; - DEEA116B2732F4410060812D /* hexagon_nn_init.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hexagon_nn_init.h; sourceTree = ""; }; - DEEA116C2732F4410060812D /* hexagon_nn.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hexagon_nn.h; sourceTree = ""; }; - DEEA116D2732F4410060812D /* hexagon_implementation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hexagon_implementation.h; sourceTree = ""; }; - DEEA116E2732F4410060812D /* hexagon_delegate_kernel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hexagon_delegate_kernel.h; sourceTree = ""; }; - DEEA11702732F4410060812D /* nnapi_delegate_kernel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nnapi_delegate_kernel.h; sourceTree = ""; }; - DEEA11712732F4410060812D /* acceleration_test_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = acceleration_test_util.h; sourceTree = ""; }; - DEEA11722732F4410060812D /* quant_lstm_sup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quant_lstm_sup.h; sourceTree = ""; }; - DEEA11732732F4410060812D /* nnapi_delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nnapi_delegate.h; sourceTree = ""; }; - DEEA11742732F4410060812D /* nnapi_delegate_mock_test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nnapi_delegate_mock_test.h; sourceTree = ""; }; - DEEA11762732F4420060812D /* pool_2d_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pool_2d_tester.h; sourceTree = ""; }; - DEEA11772732F4420060812D /* reshape_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reshape_tester.h; sourceTree = ""; }; - DEEA11782732F4420060812D /* unary_elementwise_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = unary_elementwise_tester.h; sourceTree = ""; }; - DEEA11792732F4420060812D /* leaky_relu_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = leaky_relu_tester.h; sourceTree = ""; }; - DEEA117A2732F4420060812D /* xnnpack_delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = xnnpack_delegate.h; sourceTree = ""; }; - DEEA117B2732F4420060812D /* binary_elementwise_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = binary_elementwise_tester.h; sourceTree = ""; }; - DEEA117C2732F4420060812D /* reduce_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reduce_tester.h; sourceTree = ""; }; - DEEA117D2732F4420060812D /* depthwise_conv_2d_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = depthwise_conv_2d_tester.h; sourceTree = ""; }; - DEEA117E2732F4420060812D /* resize_bilinear_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resize_bilinear_tester.h; sourceTree = ""; }; - DEEA117F2732F4420060812D /* conv_2d_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conv_2d_tester.h; sourceTree = ""; }; - DEEA11802732F4420060812D /* softmax_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = softmax_tester.h; sourceTree = ""; }; - DEEA11812732F4420060812D /* prelu_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = prelu_tester.h; sourceTree = ""; }; - DEEA11822732F4420060812D /* fully_connected_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = fully_connected_tester.h; sourceTree = ""; }; - DEEA11832732F4420060812D /* pad_tester.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = pad_tester.h; sourceTree = ""; }; - DEEA11852732F4420060812D /* external_delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = external_delegate.h; sourceTree = ""; }; - DEEA11872732F4420060812D /* delegate_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = delegate_data.h; sourceTree = ""; }; - DEEA11882732F4420060812D /* delegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = delegate.h; sourceTree = ""; }; - DEEA11892732F4420060812D /* allowlisted_flex_ops_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = allowlisted_flex_ops_internal.h; sourceTree = ""; }; - DEEA118A2732F4420060812D /* buffer_map.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = buffer_map.h; sourceTree = ""; }; - DEEA118B2732F4420060812D /* allowlisted_flex_ops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = allowlisted_flex_ops.h; sourceTree = ""; }; - DEEA118C2732F4420060812D /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; - DEEA118D2732F4420060812D /* kernel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = kernel.h; sourceTree = ""; }; - DEEA118E2732F4420060812D /* test_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = test_util.h; sourceTree = ""; }; - DEEA118F2732F4420060812D /* interpreter_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = interpreter_utils.h; sourceTree = ""; }; - DEEA11902732F4420060812D /* graph_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graph_info.h; sourceTree = ""; }; - DEEA11912732F4420060812D /* optional_debug_tools.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = optional_debug_tools.h; sourceTree = ""; }; - DEEA11932732F4420060812D /* c_api_experimental.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_api_experimental.h; sourceTree = ""; }; - DEEA11942732F4420060812D /* c_api_internal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_api_internal.h; sourceTree = ""; }; - DEEA11952732F4420060812D /* c_api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = c_api.h; sourceTree = ""; }; - DEEA11962732F4420060812D /* builtin_op_data.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = builtin_op_data.h; sourceTree = ""; }; - DEEA11972732F4420060812D /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; - DEEA11992732F4420060812D /* toco_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = toco_types.h; sourceTree = ""; }; - DEEA119A2732F4420060812D /* tensorflow_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tensorflow_util.h; sourceTree = ""; }; - DEEA119B2732F4420060812D /* model_cmdline_flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model_cmdline_flags.h; sourceTree = ""; }; - DEEA119D2732F4420060812D /* op_version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = op_version.h; sourceTree = ""; }; - DEEA119E2732F4420060812D /* export.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = export.h; sourceTree = ""; }; - DEEA119F2732F4420060812D /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; - DEEA11A02732F4420060812D /* operator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = operator.h; sourceTree = ""; }; - DEEA11A12732F4420060812D /* builtin_operator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = builtin_operator.h; sourceTree = ""; }; - DEEA11A22732F4420060812D /* custom_operator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = custom_operator.h; sourceTree = ""; }; - DEEA11A32732F4420060812D /* simple_operator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = simple_operator.h; sourceTree = ""; }; - DEEA11A42732F4420060812D /* import.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = import.h; sourceTree = ""; }; - DEEA11A52732F4420060812D /* toco_convert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = toco_convert.h; sourceTree = ""; }; - DEEA11A62732F4420060812D /* toco_port.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = toco_port.h; sourceTree = ""; }; - DEEA11A82732F4420060812D /* toco_python_api.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = toco_python_api.h; sourceTree = ""; }; - DEEA11A92732F4420060812D /* import_tensorflow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = import_tensorflow.h; sourceTree = ""; }; - DEEA11AA2732F4420060812D /* format_port.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = format_port.h; sourceTree = ""; }; - DEEA11AC2732F4420060812D /* types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = types.h; sourceTree = ""; }; - DEEA11AD2732F4420060812D /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = common.h; sourceTree = ""; }; - DEEA11AE2732F4420060812D /* dump_graphviz.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dump_graphviz.h; sourceTree = ""; }; - DEEA11AF2732F4420060812D /* args.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = args.h; sourceTree = ""; }; - DEEA11B02732F4420060812D /* export_tensorflow.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = export_tensorflow.h; sourceTree = ""; }; - DEEA11B12732F4420060812D /* model.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = model.h; sourceTree = ""; }; - DEEA11B22732F4420060812D /* toco_tooling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = toco_tooling.h; sourceTree = ""; }; - DEEA11B32732F4420060812D /* toco_cmdline_flags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = toco_cmdline_flags.h; sourceTree = ""; }; - DEEA11B42732F4420060812D /* tooling_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tooling_util.h; sourceTree = ""; }; - DEEA11B62732F4420060812D /* identify_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = identify_util.h; sourceTree = ""; }; - DEEA11B72732F4420060812D /* quantization_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = quantization_util.h; sourceTree = ""; }; - DEEA11B82732F4420060812D /* graph_transformations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = graph_transformations.h; sourceTree = ""; }; - DEEA11B92732F4420060812D /* remove_trivial_passthrough.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = remove_trivial_passthrough.h; sourceTree = ""; }; - DEEA11BA2732F4420060812D /* lstm_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = lstm_utils.h; sourceTree = ""; }; - DEEA11BB2732F4420060812D /* allocate_transient_arrays.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = allocate_transient_arrays.h; sourceTree = ""; }; - DEEA11BD2732F4420060812D /* conversion_log_util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = conversion_log_util.h; sourceTree = ""; }; - DEEA11BE2732F4420060812D /* toco_graphviz_dump_options.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = toco_graphviz_dump_options.h; sourceTree = ""; }; - DEEA11C02732F4420060812D /* cluster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cluster.h; sourceTree = ""; }; - DEEA11C12732F4420060812D /* cluster_utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cluster_utils.h; sourceTree = ""; }; - DEEA11C22732F4420060812D /* resolve_svdf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resolve_svdf.h; sourceTree = ""; }; - DEEA11C32732F4420060812D /* resolve_cluster.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = resolve_cluster.h; sourceTree = ""; }; - DEEA11C52732F4420060812D /* grpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = grpc.h; sourceTree = ""; }; - DEEA11C62732F4420060812D /* idl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = idl.h; sourceTree = ""; }; - DEEA11C72732F4420060812D /* reflection_generated.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reflection_generated.h; sourceTree = ""; }; - DEEA11C82732F4420060812D /* registry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = registry.h; sourceTree = ""; }; - DEEA11C92732F4420060812D /* flatbuffers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = flatbuffers.h; sourceTree = ""; }; - DEEA11CA2732F4420060812D /* flatc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = flatc.h; sourceTree = ""; }; - DEEA11CB2732F4420060812D /* flexbuffers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = flexbuffers.h; sourceTree = ""; }; - DEEA11CC2732F4420060812D /* minireflect.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = minireflect.h; sourceTree = ""; }; - DEEA11CD2732F4420060812D /* util.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = util.h; sourceTree = ""; }; - DEEA11CE2732F4420060812D /* code_generators.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = code_generators.h; sourceTree = ""; }; - DEEA11CF2732F4420060812D /* stl_emulation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = stl_emulation.h; sourceTree = ""; }; - DEEA11D02732F4420060812D /* hash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = hash.h; sourceTree = ""; }; - DEEA11D12732F4420060812D /* reflection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = reflection.h; sourceTree = ""; }; - DEEA11D22732F4420060812D /* base.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = base.h; sourceTree = ""; }; - DEEA11D32732F4420060812D /* InputConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = InputConverter.swift; sourceTree = ""; }; - DEEA11D42732F4420060812D /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = ""; }; - DEEA11D52732F4420060812D /* RGBConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RGBConverter.swift; sourceTree = ""; }; DEEA11D62732F4420060812D /* BlurObservation.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlurObservation.swift; sourceTree = ""; }; DEEA11D72732F4420060812D /* BlurDiscriminator.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BlurDiscriminator.swift; sourceTree = ""; }; - DEEA11D82732F4420060812D /* OutputConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OutputConverter.swift; sourceTree = ""; }; - DEEA11D92732F4420060812D /* GrayscaleConverter.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = GrayscaleConverter.swift; sourceTree = ""; }; - DEEA11DA2732F4420060812D /* Constants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Constants.swift; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -1425,7 +64,6 @@ isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( - DE02C86029EDD68500FD93D2 /* libtensorflow-lite.xcframework in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -1445,6 +83,7 @@ DE90DBC42737BA230048E41B /* resources */, DE90DBBB2737B43F0048E41B /* BlurDiscriminatorKitTests.swift */, DE90DBBD2737B43F0048E41B /* Info.plist */, + 2C4695E27633018BA75A53F2 /* BlurDiscriminatorLoadingTests.swift */, ); path = BlurDiscriminatorKitTests; sourceTree = ""; @@ -1452,10 +91,9 @@ DE90DBC42737BA230048E41B /* resources */ = { isa = PBXGroup; children = ( - DE90DBC72737BB9A0048E41B /* blur_segmentation_quantized.tflite */, - DE90DBC62737BB9A0048E41B /* image_f67_origin.jpg */, - DE90DBC52737BB9A0048E41B /* image_f264_horizontal_fliped.jpg */, - DE90DBC82737BB9A0048E41B /* image_f477_origin.jpg */, + 27A4C748729C296387CA6A57 /* cc0_cherry_blossom.jpg */, + C64B8D724CF8C561C84E3B3D /* cc0_ant_sunflower.jpg */, + 7D3DD43200685F748A77934D /* cc0_misty_river.jpg */, ); path = resources; sourceTree = ""; @@ -1482,1555 +120,18 @@ DEEA0E7E2732F3A90060812D /* BlurDiscriminatorKit */ = { isa = PBXGroup; children = ( - DEEA0E872732F43E0060812D /* objc_wrapper */, - DEEA0E8E2732F43E0060812D /* externals */, - DEEA0E8A2732F43E0060812D /* extensions */, DEEA11D72732F4420060812D /* BlurDiscriminator.swift */, - DEEA11DA2732F4420060812D /* Constants.swift */, - DEEA11D32732F4420060812D /* InputConverter.swift */, - DEEA11D52732F4420060812D /* RGBConverter.swift */, - DEEA11D82732F4420060812D /* OutputConverter.swift */, - DEEA11D92732F4420060812D /* GrayscaleConverter.swift */, DEEA11D62732F4420060812D /* BlurObservation.swift */, - DEEA11D42732F4420060812D /* module.modulemap */, DEEA0E7F2732F3A90060812D /* BlurDiscriminatorKit.h */, DEEA0E802732F3A90060812D /* Info.plist */, + 4FB3A2C4F29FFCAF4B2288D7 /* CoreMLBlurPredictor.swift */, + 98EFA6F3C2DB0A382A617E59 /* BlurMap.swift */, + 32C2EACCA5B7A4F2C00A54F5 /* BlurSegmentation.mlpackage */, + D5F2E2AF2A0437537333C08A /* CGImage+resize.swift */, ); path = BlurDiscriminatorKit; sourceTree = ""; }; - DEEA0E872732F43E0060812D /* objc_wrapper */ = { - isa = PBXGroup; - children = ( - DEEA0E882732F43E0060812D /* InterpreterWrapper.mm */, - DEEA0E892732F43E0060812D /* InterpreterWrapper.h */, - ); - path = objc_wrapper; - sourceTree = ""; - }; - DEEA0E8A2732F43E0060812D /* extensions */ = { - isa = PBXGroup; - children = ( - DEEA0E8C2732F43E0060812D /* CGImage+resize.swift */, - ); - path = extensions; - sourceTree = ""; - }; - DEEA0E8E2732F43E0060812D /* externals */ = { - isa = PBXGroup; - children = ( - DE02C85C29EDCAF900FD93D2 /* libtensorflow-lite.xcframework */, - DEEA0E902732F43E0060812D /* tensorflow */, - DEEA11C42732F4420060812D /* flatbuffers */, - ); - path = externals; - sourceTree = ""; - }; - DEEA0E902732F43E0060812D /* tensorflow */ = { - isa = PBXGroup; - children = ( - DEEA0E912732F43E0060812D /* lite */, - ); - path = tensorflow; - sourceTree = ""; - }; - DEEA0E912732F43E0060812D /* lite */ = { - isa = PBXGroup; - children = ( - DEEA0E922732F43E0060812D /* micro */, - DEEA0F6C2732F43F0060812D /* kernels */, - DEEA0FFC2732F4400060812D /* context_util.h */, - DEEA0FFD2732F4400060812D /* experimental */, - DEEA10042732F4400060812D /* tools */, - DEEA10062732F4400060812D /* version.h */, - DEEA10072732F4400060812D /* portable_type_to_tflitetype.h */, - DEEA10082732F4400060812D /* builtin_ops.h */, - DEEA10092732F4400060812D /* shared_library.h */, - DEEA100A2732F4400060812D /* core */, - DEEA10142732F4400060812D /* op_resolver.h */, - DEEA10152732F4400060812D /* minimal_logging.h */, - DEEA10162732F4400060812D /* string_util.h */, - DEEA10172732F4400060812D /* stderr_reporter.h */, - DEEA10182732F4400060812D /* allocation.h */, - DEEA10192732F4400060812D /* arena_planner.h */, - DEEA101A2732F4400060812D /* interpreter.h */, - DEEA101B2732F4400060812D /* builtin_op_data.h */, - DEEA101C2732F4400060812D /* memory_planner.h */, - DEEA101D2732F4400060812D /* context.h */, - DEEA101E2732F4400060812D /* type_to_tflitetype.h */, - DEEA101F2732F4400060812D /* tflite_with_xnnpack_optional.h */, - DEEA10202732F4400060812D /* simple_memory_arena.h */, - DEEA10212732F4400060812D /* error_reporter.h */, - DEEA10222732F4400060812D /* schema */, - DEEA10272732F4400060812D /* string_type.h */, - DEEA10282732F4400060812D /* nnapi */, - DEEA102E2732F4400060812D /* external_cpu_backend_context.h */, - DEEA102F2732F4400060812D /* mutable_op_resolver.h */, - DEEA10302732F4400060812D /* stateful_error_reporter.h */, - DEEA10312732F4400060812D /* model_builder.h */, - DEEA10322732F4400060812D /* interpreter_builder.h */, - DEEA10332732F4400060812D /* util.h */, - DEEA10342732F4400060812D /* model.h */, - DEEA10352732F4400060812D /* delegates */, - DEEA11902732F4420060812D /* graph_info.h */, - DEEA11912732F4420060812D /* optional_debug_tools.h */, - DEEA11922732F4420060812D /* c */, - DEEA11982732F4420060812D /* toco */, - ); - path = lite; - sourceTree = ""; - }; - DEEA0E922732F43E0060812D /* micro */ = { - isa = PBXGroup; - children = ( - DEEA0E932732F43E0060812D /* micro_interpreter.h */, - DEEA0E942732F43E0060812D /* compatibility.h */, - DEEA0E972732F43E0060812D /* kernels */, - DEEA0EB82732F43E0060812D /* micro_utils.h */, - DEEA0ECB2732F43E0060812D /* simple_memory_allocator.h */, - DEEA0ECC2732F43E0060812D /* micro_mutable_op_resolver.h */, - DEEA0ECE2732F43F0060812D /* debug_log.h */, - DEEA0ECF2732F43F0060812D /* recording_micro_allocator.h */, - DEEA0ED02732F43F0060812D /* micro_string.h */, - DEEA0ED22732F43F0060812D /* test_helpers.h */, - DEEA0ED52732F43F0060812D /* micro_error_reporter.h */, - DEEA0ED62732F43F0060812D /* recording_simple_memory_allocator.h */, - DEEA0ED72732F43F0060812D /* micro_op_resolver.h */, - DEEA0EE62732F43F0060812D /* micro_time.h */, - DEEA0EE72732F43F0060812D /* examples */, - DEEA0F5E2732F43F0060812D /* benchmarks */, - DEEA0F622732F43F0060812D /* memory_planner */, - DEEA0F662732F43F0060812D /* micro_allocator.h */, - DEEA0F672732F43F0060812D /* micro_profiler.h */, - DEEA0F682732F43F0060812D /* memory_helpers.h */, - DEEA0F692732F43F0060812D /* all_ops_resolver.h */, - DEEA0F6B2732F43F0060812D /* recording_micro_interpreter.h */, - ); - path = micro; - sourceTree = ""; - }; - DEEA0E972732F43E0060812D /* kernels */ = { - isa = PBXGroup; - children = ( - DEEA0E982732F43E0060812D /* kernel_runner.h */, - DEEA0E992732F43E0060812D /* micro_utils.h */, - DEEA0E9A2732F43E0060812D /* arc_mli */, - DEEA0E9F2732F43E0060812D /* kernel_util.h */, - DEEA0EA02732F43E0060812D /* fully_connected.h */, - DEEA0EA12732F43E0060812D /* xtensa_hifimini */, - DEEA0EA32732F43E0060812D /* activation_utils.h */, - DEEA0EA42732F43E0060812D /* xtensa_hifi */, - DEEA0EA62732F43E0060812D /* xtensa_hifimini_staging */, - DEEA0EB72732F43E0060812D /* micro_ops.h */, - ); - path = kernels; - sourceTree = ""; - }; - DEEA0E9A2732F43E0060812D /* arc_mli */ = { - isa = PBXGroup; - children = ( - DEEA0E9B2732F43E0060812D /* mli_tf_utils.h */, - DEEA0E9C2732F43E0060812D /* scratch_buffers.h */, - DEEA0E9D2732F43E0060812D /* mli_slicers.h */, - DEEA0E9E2732F43E0060812D /* scratch_buf_mgr.h */, - ); - path = arc_mli; - sourceTree = ""; - }; - DEEA0EA12732F43E0060812D /* xtensa_hifimini */ = { - isa = PBXGroup; - children = ( - DEEA0EA22732F43E0060812D /* fixedpoint_utils.h */, - ); - path = xtensa_hifimini; - sourceTree = ""; - }; - DEEA0EA42732F43E0060812D /* xtensa_hifi */ = { - isa = PBXGroup; - children = ( - DEEA0EA52732F43E0060812D /* xtensa_tf_micro_common.h */, - ); - path = xtensa_hifi; - sourceTree = ""; - }; - DEEA0EA62732F43E0060812D /* xtensa_hifimini_staging */ = { - isa = PBXGroup; - children = ( - DEEA0EA72732F43E0060812D /* xa_nnlib */, - DEEA0EB62732F43E0060812D /* xtensa_tf_micro_common.h */, - ); - path = xtensa_hifimini_staging; - sourceTree = ""; - }; - DEEA0EA72732F43E0060812D /* xa_nnlib */ = { - isa = PBXGroup; - children = ( - DEEA0EA82732F43E0060812D /* include */, - DEEA0EAE2732F43E0060812D /* algo */, - ); - path = xa_nnlib; - sourceTree = ""; - }; - DEEA0EA82732F43E0060812D /* include */ = { - isa = PBXGroup; - children = ( - DEEA0EA92732F43E0060812D /* nnlib */, - DEEA0EAD2732F43E0060812D /* xa_type_def.h */, - ); - path = include; - sourceTree = ""; - }; - DEEA0EA92732F43E0060812D /* nnlib */ = { - isa = PBXGroup; - children = ( - DEEA0EAA2732F43E0060812D /* xa_nnlib_api.h */, - DEEA0EAB2732F43E0060812D /* xa_nnlib_kernels_api.h */, - DEEA0EAC2732F43E0060812D /* xa_nnlib_standards.h */, - ); - path = nnlib; - sourceTree = ""; - }; - DEEA0EAE2732F43E0060812D /* algo */ = { - isa = PBXGroup; - children = ( - DEEA0EAF2732F43E0060812D /* common */, - ); - path = algo; - sourceTree = ""; - }; - DEEA0EAF2732F43E0060812D /* common */ = { - isa = PBXGroup; - children = ( - DEEA0EB02732F43E0060812D /* include */, - ); - path = common; - sourceTree = ""; - }; - DEEA0EB02732F43E0060812D /* include */ = { - isa = PBXGroup; - children = ( - DEEA0EB12732F43E0060812D /* xa_nnlib_common.h */, - DEEA0EB22732F43E0060812D /* xa_nnlib_err_chk.h */, - DEEA0EB32732F43E0060812D /* xa_nnlib_definitions.h */, - DEEA0EB42732F43E0060812D /* xa_api_defs.h */, - DEEA0EB52732F43E0060812D /* xa_nnlib_common_macros.h */, - ); - path = include; - sourceTree = ""; - }; - DEEA0EE72732F43F0060812D /* examples */ = { - isa = PBXGroup; - children = ( - DEEA0EE82732F43F0060812D /* person_detection */, - DEEA0EFC2732F43F0060812D /* hello_world */, - DEEA0F052732F43F0060812D /* magic_wand */, - DEEA0F182732F43F0060812D /* image_recognition_experimental */, - DEEA0F1F2732F43F0060812D /* person_detection_experimental */, - DEEA0F2E2732F43F0060812D /* network_tester */, - DEEA0F322732F43F0060812D /* micro_speech */, - ); - path = examples; - sourceTree = ""; - }; - DEEA0EE82732F43F0060812D /* person_detection */ = { - isa = PBXGroup; - children = ( - DEEA0EE92732F43F0060812D /* image_provider.h */, - DEEA0EEA2732F43F0060812D /* esp */, - DEEA0EEE2732F43F0060812D /* himax_driver */, - DEEA0EF42732F43F0060812D /* person_image_data.h */, - DEEA0EF52732F43F0060812D /* person_detect_model_data.h */, - DEEA0EF62732F43F0060812D /* arduino */, - DEEA0EF82732F43F0060812D /* model_settings.h */, - DEEA0EF92732F43F0060812D /* main_functions.h */, - DEEA0EFA2732F43F0060812D /* no_person_image_data.h */, - DEEA0EFB2732F43F0060812D /* detection_responder.h */, - ); - path = person_detection; - sourceTree = ""; - }; - DEEA0EEA2732F43F0060812D /* esp */ = { - isa = PBXGroup; - children = ( - DEEA0EEB2732F43F0060812D /* app_camera_esp.h */, - DEEA0EEC2732F43F0060812D /* main */, - ); - path = esp; - sourceTree = ""; - }; - DEEA0EEC2732F43F0060812D /* main */ = { - isa = PBXGroup; - children = ( - ); - path = main; - sourceTree = ""; - }; - DEEA0EEE2732F43F0060812D /* himax_driver */ = { - isa = PBXGroup; - children = ( - DEEA0EEF2732F43F0060812D /* HM01B0_Walking1s_01.h */, - DEEA0EF02732F43F0060812D /* HM01B0_optimized.h */, - DEEA0EF12732F43F0060812D /* HM01B0.h */, - DEEA0EF22732F43F0060812D /* HM01B0_RAW8_QVGA_8bits_lsb_5fps.h */, - DEEA0EF32732F43F0060812D /* HM01B0_debug.h */, - ); - path = himax_driver; - sourceTree = ""; - }; - DEEA0EF62732F43F0060812D /* arduino */ = { - isa = PBXGroup; - children = ( - DEEA0EF72732F43F0060812D /* HM01B0_platform.h */, - ); - path = arduino; - sourceTree = ""; - }; - DEEA0EFC2732F43F0060812D /* hello_world */ = { - isa = PBXGroup; - children = ( - DEEA0EFD2732F43F0060812D /* output_handler.h */, - DEEA0EFE2732F43F0060812D /* images */, - DEEA0EFF2732F43F0060812D /* constants.h */, - DEEA0F002732F43F0060812D /* main_functions.h */, - DEEA0F012732F43F0060812D /* train */, - DEEA0F032732F43F0060812D /* model.h */, - ); - path = hello_world; - sourceTree = ""; - }; - DEEA0EFE2732F43F0060812D /* images */ = { - isa = PBXGroup; - children = ( - ); - path = images; - sourceTree = ""; - }; - DEEA0F012732F43F0060812D /* train */ = { - isa = PBXGroup; - children = ( - ); - path = train; - sourceTree = ""; - }; - DEEA0F052732F43F0060812D /* magic_wand */ = { - isa = PBXGroup; - children = ( - DEEA0F062732F43F0060812D /* accelerometer_handler.h */, - DEEA0F072732F43F0060812D /* output_handler.h */, - DEEA0F082732F43F0060812D /* constants.h */, - DEEA0F092732F43F0060812D /* zephyr_riscv */, - DEEA0F0E2732F43F0060812D /* gesture_predictor.h */, - DEEA0F0F2732F43F0060812D /* ring_micro_features_data.h */, - DEEA0F102732F43F0060812D /* main_functions.h */, - DEEA0F112732F43F0060812D /* train */, - DEEA0F162732F43F0060812D /* slope_micro_features_data.h */, - DEEA0F172732F43F0060812D /* magic_wand_model_data.h */, - ); - path = magic_wand; - sourceTree = ""; - }; - DEEA0F092732F43F0060812D /* zephyr_riscv */ = { - isa = PBXGroup; - children = ( - DEEA0F0A2732F43F0060812D /* boards */, - DEEA0F0C2732F43F0060812D /* src */, - ); - path = zephyr_riscv; - sourceTree = ""; - }; - DEEA0F0A2732F43F0060812D /* boards */ = { - isa = PBXGroup; - children = ( - ); - path = boards; - sourceTree = ""; - }; - DEEA0F0C2732F43F0060812D /* src */ = { - isa = PBXGroup; - children = ( - DEEA0F0D2732F43F0060812D /* accelerometer_handler.h */, - ); - path = src; - sourceTree = ""; - }; - DEEA0F112732F43F0060812D /* train */ = { - isa = PBXGroup; - children = ( - DEEA0F132732F43F0060812D /* netmodels */, - ); - path = train; - sourceTree = ""; - }; - DEEA0F132732F43F0060812D /* netmodels */ = { - isa = PBXGroup; - children = ( - DEEA0F142732F43F0060812D /* CNN */, - ); - path = netmodels; - sourceTree = ""; - }; - DEEA0F142732F43F0060812D /* CNN */ = { - isa = PBXGroup; - children = ( - ); - path = CNN; - sourceTree = ""; - }; - DEEA0F182732F43F0060812D /* image_recognition_experimental */ = { - isa = PBXGroup; - children = ( - DEEA0F192732F43F0060812D /* image_provider.h */, - DEEA0F1A2732F43F0060812D /* stm32f746_discovery */, - DEEA0F1D2732F43F0060812D /* util.h */, - DEEA0F1E2732F43F0060812D /* image_recognition_model.h */, - ); - path = image_recognition_experimental; - sourceTree = ""; - }; - DEEA0F1A2732F43F0060812D /* stm32f746_discovery */ = { - isa = PBXGroup; - children = ( - DEEA0F1B2732F43F0060812D /* display_util.h */, - DEEA0F1C2732F43F0060812D /* image_util.h */, - ); - path = stm32f746_discovery; - sourceTree = ""; - }; - DEEA0F1F2732F43F0060812D /* person_detection_experimental */ = { - isa = PBXGroup; - children = ( - DEEA0F202732F43F0060812D /* image_provider.h */, - DEEA0F212732F43F0060812D /* himax_driver */, - DEEA0F282732F43F0060812D /* person_image_data.h */, - DEEA0F292732F43F0060812D /* person_detect_model_data.h */, - DEEA0F2A2732F43F0060812D /* model_settings.h */, - DEEA0F2B2732F43F0060812D /* main_functions.h */, - DEEA0F2C2732F43F0060812D /* no_person_image_data.h */, - DEEA0F2D2732F43F0060812D /* detection_responder.h */, - ); - path = person_detection_experimental; - sourceTree = ""; - }; - DEEA0F212732F43F0060812D /* himax_driver */ = { - isa = PBXGroup; - children = ( - DEEA0F222732F43F0060812D /* platform_Sparkfun_Edge.h */, - DEEA0F232732F43F0060812D /* HM01B0_Walking1s_01.h */, - DEEA0F242732F43F0060812D /* HM01B0_optimized.h */, - DEEA0F252732F43F0060812D /* HM01B0.h */, - DEEA0F262732F43F0060812D /* HM01B0_RAW8_QVGA_8bits_lsb_5fps.h */, - DEEA0F272732F43F0060812D /* HM01B0_debug.h */, - ); - path = himax_driver; - sourceTree = ""; - }; - DEEA0F2E2732F43F0060812D /* network_tester */ = { - isa = PBXGroup; - children = ( - DEEA0F2F2732F43F0060812D /* input_data.h */, - DEEA0F302732F43F0060812D /* network_model.h */, - DEEA0F312732F43F0060812D /* expected_output_data.h */, - ); - path = network_tester; - sourceTree = ""; - }; - DEEA0F322732F43F0060812D /* micro_speech */ = { - isa = PBXGroup; - children = ( - DEEA0F332732F43F0060812D /* no_1000ms_sample_data.h */, - DEEA0F342732F43F0060812D /* yes_1000ms_sample_data.h */, - DEEA0F352732F43F0060812D /* audio_provider.h */, - DEEA0F362732F43F0060812D /* apollo3 */, - DEEA0F3C2732F43F0060812D /* esp */, - DEEA0F3E2732F43F0060812D /* command_responder.h */, - DEEA0F3F2732F43F0060812D /* images */, - DEEA0F402732F43F0060812D /* yes_30ms_sample_data.h */, - DEEA0F412732F43F0060812D /* apollo3evb */, - DEEA0F432732F43F0060812D /* feature_provider.h */, - DEEA0F442732F43F0060812D /* CMSIS */, - DEEA0F472732F43F0060812D /* no_30ms_sample_data.h */, - DEEA0F482732F43F0060812D /* main_functions.h */, - DEEA0F4A2732F43F0060812D /* train */, - DEEA0F4C2732F43F0060812D /* micro_features */, - DEEA0F552732F43F0060812D /* recognize_commands.h */, - DEEA0F562732F43F0060812D /* simple_features */, - ); - path = micro_speech; - sourceTree = ""; - }; - DEEA0F362732F43F0060812D /* apollo3 */ = { - isa = PBXGroup; - children = ( - ); - path = apollo3; - sourceTree = ""; - }; - DEEA0F3C2732F43F0060812D /* esp */ = { - isa = PBXGroup; - children = ( - DEEA0F3D2732F43F0060812D /* ringbuf.h */, - ); - path = esp; - sourceTree = ""; - }; - DEEA0F3F2732F43F0060812D /* images */ = { - isa = PBXGroup; - children = ( - ); - path = images; - sourceTree = ""; - }; - DEEA0F412732F43F0060812D /* apollo3evb */ = { - isa = PBXGroup; - children = ( - ); - path = apollo3evb; - sourceTree = ""; - }; - DEEA0F442732F43F0060812D /* CMSIS */ = { - isa = PBXGroup; - children = ( - DEEA0F452732F43F0060812D /* sin_1k.h */, - DEEA0F462732F43F0060812D /* hanning.h */, - ); - path = CMSIS; - sourceTree = ""; - }; - DEEA0F4A2732F43F0060812D /* train */ = { - isa = PBXGroup; - children = ( - ); - path = train; - sourceTree = ""; - }; - DEEA0F4C2732F43F0060812D /* micro_features */ = { - isa = PBXGroup; - children = ( - DEEA0F4D2732F43F0060812D /* micro_features_generator.h */, - DEEA0F4E2732F43F0060812D /* micro_model_settings.h */, - DEEA0F4F2732F43F0060812D /* yes_micro_features_data.h */, - DEEA0F502732F43F0060812D /* static_alloc.h */, - DEEA0F512732F43F0060812D /* no_micro_features_data.h */, - DEEA0F522732F43F0060812D /* model.h */, - DEEA0F532732F43F0060812D /* no_feature_data_slice.h */, - DEEA0F542732F43F0060812D /* yes_feature_data_slice.h */, - ); - path = micro_features; - sourceTree = ""; - }; - DEEA0F562732F43F0060812D /* simple_features */ = { - isa = PBXGroup; - children = ( - DEEA0F572732F43F0060812D /* no_power_spectrum_data.h */, - DEEA0F582732F43F0060812D /* yes_power_spectrum_data.h */, - DEEA0F592732F43F0060812D /* simple_features_generator.h */, - DEEA0F5A2732F43F0060812D /* yes_simple_features_data.h */, - DEEA0F5B2732F43F0060812D /* simple_model_settings.h */, - DEEA0F5C2732F43F0060812D /* model.h */, - DEEA0F5D2732F43F0060812D /* no_simple_features_data.h */, - ); - path = simple_features; - sourceTree = ""; - }; - DEEA0F5E2732F43F0060812D /* benchmarks */ = { - isa = PBXGroup; - children = ( - DEEA0F5F2732F43F0060812D /* micro_benchmark.h */, - DEEA0F602732F43F0060812D /* keyword_scrambled_model_data.h */, - ); - path = benchmarks; - sourceTree = ""; - }; - DEEA0F622732F43F0060812D /* memory_planner */ = { - isa = PBXGroup; - children = ( - DEEA0F632732F43F0060812D /* greedy_memory_planner.h */, - DEEA0F642732F43F0060812D /* memory_planner.h */, - DEEA0F652732F43F0060812D /* linear_memory_planner.h */, - ); - path = memory_planner; - sourceTree = ""; - }; - DEEA0F6C2732F43F0060812D /* kernels */ = { - isa = PBXGroup; - children = ( - DEEA0F6D2732F43F0060812D /* dequantize.h */, - DEEA0F6E2732F43F0060812D /* cpu_backend_context.h */, - DEEA0F6F2732F43F0060812D /* cpu_backend_gemm.h */, - DEEA0F702732F43F0060812D /* cpu_backend_gemm_ruy.h */, - DEEA0F712732F43F0060812D /* kernel_util.h */, - DEEA0F722732F43F0060812D /* acceleration_test_util.h */, - DEEA0F732732F43F0060812D /* fully_connected.h */, - DEEA0F742732F43F0060812D /* subgraph_test_util.h */, - DEEA0F752732F43F0060812D /* lstm_eval.h */, - DEEA0F762732F43F0060812D /* internal */, - DEEA0FE82732F4400060812D /* lstm_shared.h */, - DEEA0FE92732F4400060812D /* cpu_backend_gemm_x86.h */, - DEEA0FEA2732F4400060812D /* cpu_backend_gemm_params.h */, - DEEA0FEB2732F4400060812D /* register_ref.h */, - DEEA0FEC2732F4400060812D /* cpu_backend_threadpool.h */, - DEEA0FED2732F4400060812D /* builtin_op_kernels.h */, - DEEA0FEE2732F4400060812D /* op_macros.h */, - DEEA0FEF2732F4400060812D /* cpu_backend_gemm_custom_gemv.h */, - DEEA0FF02732F4400060812D /* eigen_support.h */, - DEEA0FF12732F4400060812D /* acceleration_test_util_internal.h */, - DEEA0FF22732F4400060812D /* cpu_backend_gemm_gemmlowp.h */, - DEEA0FF32732F4400060812D /* test_delegate_providers.h */, - DEEA0FF42732F4400060812D /* hashtable */, - DEEA0FF62732F4400060812D /* register.h */, - DEEA0FF72732F4400060812D /* reshape_test_common.h */, - DEEA0FF82732F4400060812D /* test_util.h */, - DEEA0FF92732F4400060812D /* padding.h */, - DEEA0FFA2732F4400060812D /* custom_ops_register.h */, - DEEA0FFB2732F4400060812D /* cpu_backend_gemm_eigen.h */, - ); - path = kernels; - sourceTree = ""; - }; - DEEA0F762732F43F0060812D /* internal */ = { - isa = PBXGroup; - children = ( - DEEA0F772732F43F0060812D /* compatibility.h */, - DEEA0F782732F43F0060812D /* portable_tensor.h */, - DEEA0F792732F43F0060812D /* tensor_utils.h */, - DEEA0F7A2732F43F0060812D /* min.h */, - DEEA0F7B2732F43F0060812D /* mfcc.h */, - DEEA0F7C2732F43F0060812D /* types.h */, - DEEA0F7D2732F43F0060812D /* transpose_utils.h */, - DEEA0F7E2732F43F0060812D /* cppmath.h */, - DEEA0F7F2732F43F0060812D /* quantization_util.h */, - DEEA0F802732F43F0060812D /* mfcc_dct.h */, - DEEA0F812732F43F0060812D /* spectrogram.h */, - DEEA0F822732F43F0060812D /* common.h */, - DEEA0F832732F43F0060812D /* optimized */, - DEEA0FA72732F43F0060812D /* mfcc_mel_filterbank.h */, - DEEA0FA82732F43F0060812D /* max.h */, - DEEA0FA92732F43F0060812D /* strided_slice_logic.h */, - DEEA0FAA2732F43F0060812D /* tensor_ctypes.h */, - DEEA0FAB2732F43F0060812D /* kernel_utils.h */, - DEEA0FAC2732F4400060812D /* legacy_types.h */, - DEEA0FAD2732F4400060812D /* tensor.h */, - DEEA0FAE2732F4400060812D /* reference */, - DEEA0FE72732F4400060812D /* test_util.h */, - ); - path = internal; - sourceTree = ""; - }; - DEEA0F832732F43F0060812D /* optimized */ = { - isa = PBXGroup; - children = ( - DEEA0F842732F43F0060812D /* sse_tensor_utils.h */, - DEEA0F852732F43F0060812D /* eigen_tensor_reduced_instantiations_google.h */, - DEEA0F862732F43F0060812D /* sparse_ops */, - DEEA0F882732F43F0060812D /* optimized_ops.h */, - DEEA0F892732F43F0060812D /* integer_ops */, - DEEA0F952732F43F0060812D /* sse_check.h */, - DEEA0F962732F43F0060812D /* neon_check.h */, - DEEA0F972732F43F0060812D /* depthwiseconv_uint8.h */, - DEEA0F982732F43F0060812D /* neon_tensor_utils_impl.h */, - DEEA0F992732F43F0060812D /* depthwiseconv_uint8_transitional.h */, - DEEA0F9A2732F43F0060812D /* cpu_check.h */, - DEEA0F9B2732F43F0060812D /* im2col_utils.h */, - DEEA0F9C2732F43F0060812D /* depthwiseconv_multithread.h */, - DEEA0F9D2732F43F0060812D /* depthwiseconv_float.h */, - DEEA0F9E2732F43F0060812D /* depthwiseconv_uint8_3x3_filter.h */, - DEEA0F9F2732F43F0060812D /* multithreaded_conv.h */, - DEEA0FA02732F43F0060812D /* eigen_spatial_convolutions.h */, - DEEA0FA12732F43F0060812D /* batch_matmul.h */, - DEEA0FA22732F43F0060812D /* eigen_tensor_reduced_instantiations_oss.h */, - DEEA0FA32732F43F0060812D /* legacy_optimized_ops.h */, - DEEA0FA42732F43F0060812D /* sse_tensor_utils_impl.h */, - DEEA0FA52732F43F0060812D /* neon_tensor_utils.h */, - DEEA0FA62732F43F0060812D /* depthwiseconv_3x3_filter_common.h */, - ); - path = optimized; - sourceTree = ""; - }; - DEEA0F862732F43F0060812D /* sparse_ops */ = { - isa = PBXGroup; - children = ( - DEEA0F872732F43F0060812D /* fully_connected.h */, - ); - path = sparse_ops; - sourceTree = ""; - }; - DEEA0F892732F43F0060812D /* integer_ops */ = { - isa = PBXGroup; - children = ( - DEEA0F8A2732F43F0060812D /* depthwise_conv.h */, - DEEA0F8B2732F43F0060812D /* depthwise_conv_hybrid_3x3_filter.h */, - DEEA0F8C2732F43F0060812D /* fully_connected.h */, - DEEA0F8D2732F43F0060812D /* depthwise_conv_3x3_filter.h */, - DEEA0F8E2732F43F0060812D /* add.h */, - DEEA0F8F2732F43F0060812D /* depthwise_conv_hybrid.h */, - DEEA0F902732F43F0060812D /* mul.h */, - DEEA0F912732F43F0060812D /* mean.h */, - DEEA0F922732F43F0060812D /* pooling.h */, - DEEA0F932732F43F0060812D /* transpose_conv.h */, - DEEA0F942732F43F0060812D /* conv.h */, - ); - path = integer_ops; - sourceTree = ""; - }; - DEEA0FAE2732F4400060812D /* reference */ = { - isa = PBXGroup; - children = ( - DEEA0FAF2732F4400060812D /* softmax.h */, - DEEA0FB02732F4400060812D /* quantize.h */, - DEEA0FB12732F4400060812D /* dequantize.h */, - DEEA0FB22732F4400060812D /* portable_tensor_utils_impl.h */, - DEEA0FB32732F4400060812D /* sparse_ops */, - DEEA0FB52732F4400060812D /* strided_slice.h */, - DEEA0FB62732F4400060812D /* legacy_reference_ops.h */, - DEEA0FB72732F4400060812D /* requantize.h */, - DEEA0FB82732F4400060812D /* integer_ops */, - DEEA0FC62732F4400060812D /* logistic.h */, - DEEA0FC72732F4400060812D /* fully_connected.h */, - DEEA0FC82732F4400060812D /* svdf.h */, - DEEA0FC92732F4400060812D /* prelu.h */, - DEEA0FCA2732F4400060812D /* round.h */, - DEEA0FCB2732F4400060812D /* sub.h */, - DEEA0FCC2732F4400060812D /* pad.h */, - DEEA0FCD2732F4400060812D /* add.h */, - DEEA0FCE2732F4400060812D /* l2normalization.h */, - DEEA0FCF2732F4400060812D /* arg_min_max.h */, - DEEA0FD02732F4400060812D /* ceil.h */, - DEEA0FD12732F4400060812D /* hard_swish.h */, - DEEA0FD22732F4400060812D /* resize_nearest_neighbor.h */, - DEEA0FD32732F4400060812D /* concatenation.h */, - DEEA0FD42732F4400060812D /* depthwiseconv_uint8.h */, - DEEA0FD52732F4400060812D /* tanh.h */, - DEEA0FD62732F4400060812D /* string_comparisons.h */, - DEEA0FD72732F4400060812D /* mul.h */, - DEEA0FD82732F4400060812D /* portable_tensor_utils.h */, - DEEA0FD92732F4400060812D /* densify.h */, - DEEA0FDA2732F4400060812D /* reduce.h */, - DEEA0FDB2732F4400060812D /* depthwiseconv_float.h */, - DEEA0FDC2732F4400060812D /* process_broadcast_shapes.h */, - DEEA0FDD2732F4400060812D /* non_max_suppression.h */, - DEEA0FDE2732F4400060812D /* maximum_minimum.h */, - DEEA0FDF2732F4400060812D /* pooling.h */, - DEEA0FE02732F4400060812D /* neg.h */, - DEEA0FE12732F4400060812D /* comparisons.h */, - DEEA0FE22732F4400060812D /* reference_ops.h */, - DEEA0FE32732F4400060812D /* batch_matmul.h */, - DEEA0FE42732F4400060812D /* conv.h */, - DEEA0FE52732F4400060812D /* floor.h */, - DEEA0FE62732F4400060812D /* binary_function.h */, - ); - path = reference; - sourceTree = ""; - }; - DEEA0FB32732F4400060812D /* sparse_ops */ = { - isa = PBXGroup; - children = ( - DEEA0FB42732F4400060812D /* fully_connected.h */, - ); - path = sparse_ops; - sourceTree = ""; - }; - DEEA0FB82732F4400060812D /* integer_ops */ = { - isa = PBXGroup; - children = ( - DEEA0FB92732F4400060812D /* dequantize.h */, - DEEA0FBA2732F4400060812D /* depthwise_conv.h */, - DEEA0FBB2732F4400060812D /* logistic.h */, - DEEA0FBC2732F4400060812D /* fully_connected.h */, - DEEA0FBD2732F4400060812D /* add.h */, - DEEA0FBE2732F4400060812D /* l2normalization.h */, - DEEA0FBF2732F4400060812D /* log_softmax.h */, - DEEA0FC02732F4400060812D /* tanh.h */, - DEEA0FC12732F4400060812D /* mul.h */, - DEEA0FC22732F4400060812D /* mean.h */, - DEEA0FC32732F4400060812D /* pooling.h */, - DEEA0FC42732F4400060812D /* transpose_conv.h */, - DEEA0FC52732F4400060812D /* conv.h */, - ); - path = integer_ops; - sourceTree = ""; - }; - DEEA0FF42732F4400060812D /* hashtable */ = { - isa = PBXGroup; - children = ( - DEEA0FF52732F4400060812D /* hashtable_ops.h */, - ); - path = hashtable; - sourceTree = ""; - }; - DEEA0FFD2732F4400060812D /* experimental */ = { - isa = PBXGroup; - children = ( - DEEA0FFE2732F4400060812D /* resource */, - ); - path = experimental; - sourceTree = ""; - }; - DEEA0FFE2732F4400060812D /* resource */ = { - isa = PBXGroup; - children = ( - DEEA0FFF2732F4400060812D /* lookup_interfaces.h */, - DEEA10002732F4400060812D /* lookup_util.h */, - DEEA10012732F4400060812D /* resource_base.h */, - DEEA10022732F4400060812D /* resource_variable.h */, - DEEA10032732F4400060812D /* static_hashtable.h */, - ); - path = resource; - sourceTree = ""; - }; - DEEA10042732F4400060812D /* tools */ = { - isa = PBXGroup; - children = ( - DEEA10052732F4400060812D /* gen_op_registration.h */, - ); - path = tools; - sourceTree = ""; - }; - DEEA100A2732F4400060812D /* core */ = { - isa = PBXGroup; - children = ( - DEEA100B2732F4400060812D /* subgraph.h */, - DEEA100C2732F4400060812D /* macros.h */, - DEEA100D2732F4400060812D /* api */, - ); - path = core; - sourceTree = ""; - }; - DEEA100D2732F4400060812D /* api */ = { - isa = PBXGroup; - children = ( - DEEA100E2732F4400060812D /* tensor_utils.h */, - DEEA100F2732F4400060812D /* op_resolver.h */, - DEEA10102732F4400060812D /* verifier.h */, - DEEA10112732F4400060812D /* error_reporter.h */, - DEEA10122732F4400060812D /* flatbuffer_conversions.h */, - DEEA10132732F4400060812D /* profiler.h */, - ); - path = api; - sourceTree = ""; - }; - DEEA10222732F4400060812D /* schema */ = { - isa = PBXGroup; - children = ( - DEEA10232732F4400060812D /* schema_utils.h */, - DEEA10242732F4400060812D /* schema_generated.h */, - DEEA10252732F4400060812D /* builtin_ops_header */, - ); - path = schema; - sourceTree = ""; - }; - DEEA10252732F4400060812D /* builtin_ops_header */ = { - isa = PBXGroup; - children = ( - DEEA10262732F4400060812D /* generator.h */, - ); - path = builtin_ops_header; - sourceTree = ""; - }; - DEEA10282732F4400060812D /* nnapi */ = { - isa = PBXGroup; - children = ( - DEEA10292732F4400060812D /* NeuralNetworksTypes.h */, - DEEA102A2732F4400060812D /* nnapi_util.h */, - DEEA102B2732F4400060812D /* nnapi_implementation.h */, - DEEA102C2732F4400060812D /* NeuralNetworksShim.h */, - DEEA102D2732F4400060812D /* nnapi_handler.h */, - ); - path = nnapi; - sourceTree = ""; - }; - DEEA10352732F4400060812D /* delegates */ = { - isa = PBXGroup; - children = ( - DEEA10362732F4400060812D /* utils.h */, - DEEA10372732F4400060812D /* gpu */, - DEEA11402732F4410060812D /* status.h */, - DEEA11412732F4410060812D /* utils */, - DEEA11452732F4410060812D /* hexagon */, - DEEA116F2732F4410060812D /* nnapi */, - DEEA11752732F4420060812D /* xnnpack */, - DEEA11842732F4420060812D /* external */, - DEEA11862732F4420060812D /* flex */, - DEEA118F2732F4420060812D /* interpreter_utils.h */, - ); - path = delegates; - sourceTree = ""; - }; - DEEA10372732F4400060812D /* gpu */ = { - isa = PBXGroup; - children = ( - DEEA10382732F4400060812D /* delegate.h */, - DEEA10392732F4400060812D /* metal */, - DEEA10612732F4400060812D /* gl_delegate.h */, - DEEA10622732F4400060812D /* api.h */, - DEEA10632732F4400060812D /* common */, - DEEA10962732F4410060812D /* metal_delegate_internal.h */, - DEEA10972732F4410060812D /* gl */, - DEEA10E42732F4410060812D /* spi.h */, - DEEA10E52732F4410060812D /* cl */, - DEEA113F2732F4410060812D /* metal_delegate.h */, - ); - path = gpu; - sourceTree = ""; - }; - DEEA10392732F4400060812D /* metal */ = { - isa = PBXGroup; - children = ( - DEEA103A2732F4400060812D /* compute_task.h */, - DEEA103B2732F4400060812D /* kernels */, - DEEA10532732F4400060812D /* ComponentsTests.tulsiproj */, - DEEA10572732F4400060812D /* arguments.h */, - DEEA10582732F4400060812D /* runtime_options.h */, - DEEA10592732F4400060812D /* environment.h */, - DEEA105A2732F4400060812D /* api.h */, - DEEA105B2732F4400060812D /* common.h */, - DEEA105C2732F4400060812D /* metal_arguments.h */, - DEEA105D2732F4400060812D /* compiled_model.h */, - DEEA105E2732F4400060812D /* compute_task_descriptor.h */, - DEEA105F2732F4400060812D /* inference_context.h */, - DEEA10602732F4400060812D /* buffer_convert.h */, - ); - path = metal; - sourceTree = ""; - }; - DEEA103B2732F4400060812D /* kernels */ = { - isa = PBXGroup; - children = ( - DEEA103C2732F4400060812D /* winograd.h */, - DEEA103D2732F4400060812D /* softmax.h */, - DEEA103E2732F4400060812D /* depthwise_conv.h */, - DEEA103F2732F4400060812D /* relu.h */, - DEEA10402732F4400060812D /* max_unpooling.h */, - DEEA10412732F4400060812D /* elementwise.h */, - DEEA10422732F4400060812D /* fully_connected.h */, - DEEA10432732F4400060812D /* prelu.h */, - DEEA10442732F4400060812D /* slice.h */, - DEEA10452732F4400060812D /* add.h */, - DEEA10462732F4400060812D /* concat.h */, - DEEA10472732F4400060812D /* resize.h */, - DEEA10482732F4400060812D /* custom_registry.h */, - DEEA10492732F4400060812D /* reshape.h */, - DEEA104A2732F4400060812D /* mean.h */, - DEEA104B2732F4400060812D /* util.h */, - DEEA104C2732F4400060812D /* space_to_depth.h */, - DEEA104D2732F4400060812D /* pooling.h */, - DEEA104E2732F4400060812D /* transpose_conv.h */, - DEEA104F2732F4400060812D /* conv.h */, - DEEA10502732F4400060812D /* test_util.h */, - DEEA10512732F4400060812D /* padding.h */, - DEEA10522732F4400060812D /* quantize_and_dequantize.h */, - ); - path = kernels; - sourceTree = ""; - }; - DEEA10532732F4400060812D /* ComponentsTests.tulsiproj */ = { - isa = PBXGroup; - children = ( - DEEA10542732F4400060812D /* Configs */, - ); - path = ComponentsTests.tulsiproj; - sourceTree = ""; - }; - DEEA10542732F4400060812D /* Configs */ = { - isa = PBXGroup; - children = ( - ); - path = Configs; - sourceTree = ""; - }; - DEEA10632732F4400060812D /* common */ = { - isa = PBXGroup; - children = ( - DEEA10642732F4400060812D /* winograd_util.h */, - DEEA10652732F4400060812D /* gpu_info.h */, - DEEA10662732F4400060812D /* status.h */, - DEEA10672732F4400060812D /* transformations */, - DEEA10722732F4400060812D /* lstm_parser.h */, - DEEA10732732F4400060812D /* operations.h */, - DEEA10742732F4400060812D /* custom_parsers.h */, - DEEA10752732F4400060812D /* types.h */, - DEEA10762732F4400060812D /* workgroup_selection.h */, - DEEA10772732F4400060812D /* access_type.h */, - DEEA10782732F4400060812D /* shape.h */, - DEEA10792732F4400060812D /* data_type.h */, - DEEA107A2732F4400060812D /* quantization_util.h */, - DEEA107B2732F4400060812D /* memory_management.h */, - DEEA107C2732F4400060812D /* model_transformer.h */, - DEEA107D2732F4400060812D /* testing */, - DEEA10852732F4400060812D /* memory_management */, - DEEA108E2732F4410060812D /* model_builder.h */, - DEEA108F2732F4410060812D /* util.h */, - DEEA10902732F4410060812D /* model.h */, - DEEA10912732F4410060812D /* custom_transformations.h */, - DEEA10922732F4410060812D /* model_builder_helper.h */, - DEEA10932732F4410060812D /* convert.h */, - DEEA10942732F4410060812D /* object_reader.h */, - DEEA10952732F4410060812D /* tensor.h */, - ); - path = common; - sourceTree = ""; - }; - DEEA10672732F4400060812D /* transformations */ = { - isa = PBXGroup; - children = ( - DEEA10682732F4400060812D /* add_bias.h */, - DEEA10692732F4400060812D /* matching.h */, - DEEA106A2732F4400060812D /* add_quant_adjustments.h */, - DEEA106B2732F4400060812D /* fuse_add_to_conv.h */, - DEEA106C2732F4400060812D /* make_fully_connected.h */, - DEEA106D2732F4400060812D /* merge_padding_with.h */, - DEEA106E2732F4400060812D /* model_transformations.h */, - DEEA106F2732F4400060812D /* make_padding.h */, - DEEA10702732F4400060812D /* fuse_mul_to_conv.h */, - DEEA10712732F4400060812D /* remove_noop.h */, - ); - path = transformations; - sourceTree = ""; - }; - DEEA107D2732F4400060812D /* testing */ = { - isa = PBXGroup; - children = ( - DEEA107E2732F4400060812D /* feature_parity */, - DEEA10832732F4400060812D /* tflite_model_reader.h */, - DEEA10842732F4400060812D /* interpreter_utils.h */, - ); - path = testing; - sourceTree = ""; - }; - DEEA107E2732F4400060812D /* feature_parity */ = { - isa = PBXGroup; - children = ( - DEEA107F2732F4400060812D /* utils.h */, - DEEA10802732F4400060812D /* generators */, - DEEA10822732F4400060812D /* feature_parity.h */, - ); - path = feature_parity; - sourceTree = ""; - }; - DEEA10802732F4400060812D /* generators */ = { - isa = PBXGroup; - children = ( - DEEA10812732F4400060812D /* add.h */, - ); - path = generators; - sourceTree = ""; - }; - DEEA10852732F4400060812D /* memory_management */ = { - isa = PBXGroup; - children = ( - DEEA10862732F4400060812D /* internal.h */, - DEEA10872732F4400060812D /* naive_assignment.h */, - DEEA10882732F4400060812D /* greedy_in_order_assignment.h */, - DEEA10892732F4410060812D /* types.h */, - DEEA108A2732F4410060812D /* greedy_by_size_assignment.h */, - DEEA108B2732F4410060812D /* min_cost_flow_assignment.h */, - DEEA108C2732F4410060812D /* greedy_by_breadth_assignment.h */, - DEEA108D2732F4410060812D /* equality_assignment.h */, - ); - path = memory_management; - sourceTree = ""; - }; - DEEA10972732F4410060812D /* gl */ = { - isa = PBXGroup; - children = ( - DEEA10982732F4410060812D /* kernels */, - DEEA10B22732F4410060812D /* object_manager.h */, - DEEA10B32732F4410060812D /* compiler_options.h */, - DEEA10B42732F4410060812D /* float16_conversions.h */, - DEEA10B52732F4410060812D /* gl_errors.h */, - DEEA10B62732F4410060812D /* compiler.h */, - DEEA10B72732F4410060812D /* egl_context.h */, - DEEA10B82732F4410060812D /* runtime_options.h */, - DEEA10B92732F4410060812D /* serialization.h */, - DEEA10BA2732F4410060812D /* egl_surface.h */, - DEEA10BB2732F4410060812D /* runtime */, - DEEA10BD2732F4410060812D /* gl_shader.h */, - DEEA10BE2732F4410060812D /* gl_texture.h */, - DEEA10BF2732F4410060812D /* converters */, - DEEA10C32732F4410060812D /* workgroups */, - DEEA10C92732F4410060812D /* variable.h */, - DEEA10CA2732F4410060812D /* gl_program.h */, - DEEA10CB2732F4410060812D /* runtime.h */, - DEEA10CC2732F4410060812D /* api.h */, - DEEA10CD2732F4410060812D /* node_shader.h */, - DEEA10CE2732F4410060812D /* portable_gl31.h */, - DEEA10CF2732F4410060812D /* api2.h */, - DEEA10D02732F4410060812D /* gl_call.h */, - DEEA10D12732F4410060812D /* object.h */, - DEEA10D22732F4410060812D /* request_gpu_info.h */, - DEEA10D32732F4410060812D /* gl_buffer.h */, - DEEA10D42732F4410060812D /* egl_environment.h */, - DEEA10D52732F4410060812D /* gl_sync.h */, - DEEA10D62732F4410060812D /* compiler */, - DEEA10E12732F4410060812D /* stats.h */, - DEEA10E22732F4410060812D /* command_queue.h */, - DEEA10E32732F4410060812D /* portable_egl.h */, - ); - path = gl; - sourceTree = ""; - }; - DEEA10982732F4410060812D /* kernels */ = { - isa = PBXGroup; - children = ( - DEEA10992732F4410060812D /* softmax.h */, - DEEA109A2732F4410060812D /* depthwise_conv.h */, - DEEA109B2732F4410060812D /* relu.h */, - DEEA109C2732F4410060812D /* max_unpooling.h */, - DEEA109D2732F4410060812D /* elementwise.h */, - DEEA109E2732F4410060812D /* fully_connected.h */, - DEEA109F2732F4410060812D /* prelu.h */, - DEEA10A02732F4410060812D /* slice.h */, - DEEA10A12732F4410060812D /* pad.h */, - DEEA10A22732F4410060812D /* add.h */, - DEEA10A32732F4410060812D /* converter.h */, - DEEA10A42732F4410060812D /* lstm.h */, - DEEA10A52732F4410060812D /* registry.h */, - DEEA10A62732F4410060812D /* concat.h */, - DEEA10A72732F4410060812D /* resize.h */, - DEEA10A82732F4410060812D /* mul.h */, - DEEA10A92732F4410060812D /* custom_registry.h */, - DEEA10AA2732F4410060812D /* reshape.h */, - DEEA10AB2732F4410060812D /* mean.h */, - DEEA10AC2732F4410060812D /* space_to_depth.h */, - DEEA10AD2732F4410060812D /* pooling.h */, - DEEA10AE2732F4410060812D /* transpose_conv.h */, - DEEA10AF2732F4410060812D /* conv.h */, - DEEA10B02732F4410060812D /* test_util.h */, - DEEA10B12732F4410060812D /* quantize_and_dequantize.h */, - ); - path = kernels; - sourceTree = ""; - }; - DEEA10BB2732F4410060812D /* runtime */ = { - isa = PBXGroup; - children = ( - DEEA10BC2732F4410060812D /* shared_buffer.h */, - ); - path = runtime; - sourceTree = ""; - }; - DEEA10BF2732F4410060812D /* converters */ = { - isa = PBXGroup; - children = ( - DEEA10C02732F4410060812D /* phwc4_to_bhwc.h */, - DEEA10C12732F4410060812D /* util.h */, - DEEA10C22732F4410060812D /* bhwc_to_phwc4.h */, - ); - path = converters; - sourceTree = ""; - }; - DEEA10C32732F4410060812D /* workgroups */ = { - isa = PBXGroup; - children = ( - DEEA10C42732F4410060812D /* best_effort_calculator.h */, - DEEA10C52732F4410060812D /* calculator_from_metadata.h */, - DEEA10C62732F4410060812D /* default_calculator.h */, - DEEA10C72732F4410060812D /* calculator.h */, - DEEA10C82732F4410060812D /* ideal_workgroup_picker.h */, - ); - path = workgroups; - sourceTree = ""; - }; - DEEA10D62732F4410060812D /* compiler */ = { - isa = PBXGroup; - children = ( - DEEA10D72732F4410060812D /* variable_accessor.h */, - DEEA10D82732F4410060812D /* shader_code.h */, - DEEA10D92732F4410060812D /* shader_codegen.h */, - DEEA10DA2732F4410060812D /* fuse_auto_input.h */, - DEEA10DB2732F4410060812D /* fuse_inplace.h */, - DEEA10DC2732F4410060812D /* object_accessor.h */, - DEEA10DD2732F4410060812D /* fuse_inline.h */, - DEEA10DE2732F4410060812D /* rename.h */, - DEEA10DF2732F4410060812D /* compiled_node.h */, - DEEA10E02732F4410060812D /* preprocessor.h */, - ); - path = compiler; - sourceTree = ""; - }; - DEEA10E52732F4410060812D /* cl */ = { - isa = PBXGroup; - children = ( - DEEA10E62732F4410060812D /* texture2d.h */, - DEEA10E72732F4410060812D /* kernels */, - DEEA11152732F4410060812D /* gpu_api_delegate.h */, - DEEA11162732F4410060812D /* opencl_wrapper.h */, - DEEA11172732F4410060812D /* program_cache.h */, - DEEA11182732F4410060812D /* cl_test.h */, - DEEA11192732F4410060812D /* arguments.h */, - DEEA111A2732F4410060812D /* precision.h */, - DEEA111B2732F4410060812D /* serialization.h */, - DEEA111C2732F4410060812D /* cl_kernel.h */, - DEEA111D2732F4410060812D /* compiled_program_cache_generated.h */, - DEEA111E2732F4410060812D /* cl_memory.h */, - DEEA111F2732F4410060812D /* cl_context.h */, - DEEA11202732F4410060812D /* environment.h */, - DEEA11212732F4410060812D /* cl_image_format.h */, - DEEA11222732F4410060812D /* api.h */, - DEEA11232732F4410060812D /* storage_type_util.h */, - DEEA11242732F4410060812D /* cl_errors.h */, - DEEA11252732F4410060812D /* tensor_type_util.h */, - DEEA11262732F4410060812D /* linear_storage.h */, - DEEA11272732F4410060812D /* buffer.h */, - DEEA11282732F4410060812D /* gl_interop.h */, - DEEA11292732F4410060812D /* gpu_object.h */, - DEEA112A2732F4410060812D /* cl_command_queue.h */, - DEEA112B2732F4410060812D /* util.h */, - DEEA112C2732F4410060812D /* egl_sync.h */, - DEEA112D2732F4410060812D /* cl_device.h */, - DEEA112E2732F4410060812D /* tensor_type.h */, - DEEA112F2732F4410060812D /* cl_event.h */, - DEEA11302732F4410060812D /* model_hints.h */, - DEEA11312732F4410060812D /* cl_program.h */, - DEEA11322732F4410060812D /* tensor.h */, - DEEA11332732F4410060812D /* device_info.h */, - DEEA11342732F4410060812D /* inference_context.h */, - DEEA11352732F4410060812D /* selectors */, - ); - path = cl; - sourceTree = ""; - }; - DEEA10E72732F4410060812D /* kernels */ = { - isa = PBXGroup; - children = ( - DEEA10E82732F4410060812D /* winograd.h */, - DEEA10E92732F4410060812D /* softmax.h */, - DEEA10EA2732F4410060812D /* strided_slice.h */, - DEEA10EB2732F4410060812D /* depthwise_conv.h */, - DEEA10EC2732F4410060812D /* convolution_transposed_4x4.h */, - DEEA10ED2732F4410060812D /* conv_constants.h */, - DEEA10EE2732F4410060812D /* relu.h */, - DEEA10EF2732F4410060812D /* max_unpooling.h */, - DEEA10F02732F4410060812D /* elementwise.h */, - DEEA10F12732F4410060812D /* cl_test.h */, - DEEA10F22732F4410060812D /* fully_connected.h */, - DEEA10F32732F4410060812D /* concat_z.h */, - DEEA10F42732F4410060812D /* convolution_transposed_thin.h */, - DEEA10F52732F4410060812D /* prelu.h */, - DEEA10F62732F4410060812D /* reshapex4.h */, - DEEA10F72732F4410060812D /* conv_weights_converter.h */, - DEEA10F82732F4410060812D /* convolution_transposed.h */, - DEEA10F92732F4410060812D /* add.h */, - DEEA10FA2732F4410060812D /* convolution_transposed_3x3.h */, - DEEA10FB2732F4410060812D /* depthwise_conv_3x3.h */, - DEEA10FC2732F4410060812D /* converter.h */, - DEEA10FD2732F4410060812D /* tuning_parameters.h */, - DEEA10FE2732F4410060812D /* lstm.h */, - DEEA10FF2732F4410060812D /* special */, - DEEA11022732F4410060812D /* resize.h */, - DEEA11032732F4410060812D /* convolution_transposed_3x3_thin.h */, - DEEA11042732F4410060812D /* conv_common.h */, - DEEA11052732F4410060812D /* gpu_operation.h */, - DEEA11062732F4410060812D /* reshape.h */, - DEEA11072732F4410060812D /* reduce.h */, - DEEA11082732F4410060812D /* mean.h */, - DEEA11092732F4410060812D /* util.h */, - DEEA110A2732F4410060812D /* conv_powervr.h */, - DEEA110B2732F4410060812D /* space_to_depth.h */, - DEEA110C2732F4410060812D /* pooling.h */, - DEEA110D2732F4410060812D /* conv_buffer_1x1.h */, - DEEA110E2732F4410060812D /* work_group_picking.h */, - DEEA110F2732F4410060812D /* softmax1x1.h */, - DEEA11102732F4410060812D /* transpose.h */, - DEEA11112732F4410060812D /* padding.h */, - DEEA11122732F4410060812D /* mean_stddev_normalization.h */, - DEEA11132732F4410060812D /* quantize_and_dequantize.h */, - DEEA11142732F4410060812D /* concat_xy.h */, - ); - path = kernels; - sourceTree = ""; - }; - DEEA10FF2732F4410060812D /* special */ = { - isa = PBXGroup; - children = ( - DEEA11002732F4410060812D /* fc_fc_add.h */, - DEEA11012732F4410060812D /* depthwise_conv_plus_1x1_conv.h */, - ); - path = special; - sourceTree = ""; - }; - DEEA11352732F4410060812D /* selectors */ = { - isa = PBXGroup; - children = ( - DEEA11362732F4410060812D /* fully_connected_selector.h */, - DEEA11372732F4410060812D /* simple_selectors.h */, - DEEA11382732F4410060812D /* operation_selector.h */, - DEEA11392732F4410060812D /* subgraph.h */, - DEEA113A2732F4410060812D /* special_selector.h */, - DEEA113B2732F4410060812D /* dw_convolution_selector.h */, - DEEA113C2732F4410060812D /* default_selector.h */, - DEEA113D2732F4410060812D /* convolution_selector.h */, - DEEA113E2732F4410060812D /* convolution_transposed_selector.h */, - ); - path = selectors; - sourceTree = ""; - }; - DEEA11412732F4410060812D /* utils */ = { - isa = PBXGroup; - children = ( - DEEA11422732F4410060812D /* dummy_delegate */, - DEEA11442732F4410060812D /* simple_delegate.h */, - ); - path = utils; - sourceTree = ""; - }; - DEEA11422732F4410060812D /* dummy_delegate */ = { - isa = PBXGroup; - children = ( - DEEA11432732F4410060812D /* dummy_delegate.h */, - ); - path = dummy_delegate; - sourceTree = ""; - }; - DEEA11452732F4410060812D /* hexagon */ = { - isa = PBXGroup; - children = ( - DEEA11462732F4410060812D /* utils.h */, - DEEA11472732F4410060812D /* builders */, - DEEA11682732F4410060812D /* hexagon_nn_interface.h */, - DEEA11692732F4410060812D /* hexagon_delegate.h */, - DEEA116A2732F4410060812D /* hexagon_nn */, - DEEA116D2732F4410060812D /* hexagon_implementation.h */, - DEEA116E2732F4410060812D /* hexagon_delegate_kernel.h */, - ); - path = hexagon; - sourceTree = ""; - }; - DEEA11472732F4410060812D /* builders */ = { - isa = PBXGroup; - children = ( - DEEA11482732F4410060812D /* batch_seq_builder.h */, - DEEA11492732F4410060812D /* matmul_builder.h */, - DEEA114A2732F4410060812D /* reshape_builder.h */, - DEEA114B2732F4410060812D /* slice_builder.h */, - DEEA114C2732F4410060812D /* transpose_builder.h */, - DEEA114D2732F4410060812D /* neg_op_builder.h */, - DEEA114E2732F4410060812D /* l2_normalization_builder.h */, - DEEA114F2732F4410060812D /* arg_min_max_builder.h */, - DEEA11502732F4410060812D /* concat_builder.h */, - DEEA11512732F4410060812D /* cast_builder.h */, - DEEA11522732F4410060812D /* split_builder.h */, - DEEA11532732F4410060812D /* resize_bilinear_builder.h */, - DEEA11542732F4410060812D /* pool_2d_builder.h */, - DEEA11552732F4410060812D /* quantize_builder.h */, - DEEA11562732F4410060812D /* reduce_builder.h */, - DEEA11572732F4410060812D /* softmax_builder.h */, - DEEA11582732F4410060812D /* tests */, - DEEA115A2732F4410060812D /* transpose_conv_2d_builder.h */, - DEEA115B2732F4410060812D /* activation_builder.h */, - DEEA115C2732F4410060812D /* space_to_depth_builder.h */, - DEEA115D2732F4410060812D /* conv_2d_builder.h */, - DEEA115E2732F4410060812D /* resize_nearest_neighbor_builder.h */, - DEEA115F2732F4410060812D /* op_builder.h */, - DEEA11602732F4410060812D /* pad_builder.h */, - DEEA11612732F4410060812D /* min_max_builder.h */, - DEEA11622732F4410060812D /* mirror_pad_builder.h */, - DEEA11632732F4410060812D /* strided_slice_builder.h */, - DEEA11642732F4410060812D /* op_factory.h */, - DEEA11652732F4410060812D /* hardswish_builder.h */, - DEEA11662732F4410060812D /* arithmetic_builder.h */, - DEEA11672732F4410060812D /* pack_builder.h */, - ); - path = builders; - sourceTree = ""; - }; - DEEA11582732F4410060812D /* tests */ = { - isa = PBXGroup; - children = ( - DEEA11592732F4410060812D /* hexagon_delegate_op_model.h */, - ); - path = tests; - sourceTree = ""; - }; - DEEA116A2732F4410060812D /* hexagon_nn */ = { - isa = PBXGroup; - children = ( - DEEA116B2732F4410060812D /* hexagon_nn_init.h */, - DEEA116C2732F4410060812D /* hexagon_nn.h */, - ); - path = hexagon_nn; - sourceTree = ""; - }; - DEEA116F2732F4410060812D /* nnapi */ = { - isa = PBXGroup; - children = ( - DEEA11702732F4410060812D /* nnapi_delegate_kernel.h */, - DEEA11712732F4410060812D /* acceleration_test_util.h */, - DEEA11722732F4410060812D /* quant_lstm_sup.h */, - DEEA11732732F4410060812D /* nnapi_delegate.h */, - DEEA11742732F4410060812D /* nnapi_delegate_mock_test.h */, - ); - path = nnapi; - sourceTree = ""; - }; - DEEA11752732F4420060812D /* xnnpack */ = { - isa = PBXGroup; - children = ( - DEEA11762732F4420060812D /* pool_2d_tester.h */, - DEEA11772732F4420060812D /* reshape_tester.h */, - DEEA11782732F4420060812D /* unary_elementwise_tester.h */, - DEEA11792732F4420060812D /* leaky_relu_tester.h */, - DEEA117A2732F4420060812D /* xnnpack_delegate.h */, - DEEA117B2732F4420060812D /* binary_elementwise_tester.h */, - DEEA117C2732F4420060812D /* reduce_tester.h */, - DEEA117D2732F4420060812D /* depthwise_conv_2d_tester.h */, - DEEA117E2732F4420060812D /* resize_bilinear_tester.h */, - DEEA117F2732F4420060812D /* conv_2d_tester.h */, - DEEA11802732F4420060812D /* softmax_tester.h */, - DEEA11812732F4420060812D /* prelu_tester.h */, - DEEA11822732F4420060812D /* fully_connected_tester.h */, - DEEA11832732F4420060812D /* pad_tester.h */, - ); - path = xnnpack; - sourceTree = ""; - }; - DEEA11842732F4420060812D /* external */ = { - isa = PBXGroup; - children = ( - DEEA11852732F4420060812D /* external_delegate.h */, - ); - path = external; - sourceTree = ""; - }; - DEEA11862732F4420060812D /* flex */ = { - isa = PBXGroup; - children = ( - DEEA11872732F4420060812D /* delegate_data.h */, - DEEA11882732F4420060812D /* delegate.h */, - DEEA11892732F4420060812D /* allowlisted_flex_ops_internal.h */, - DEEA118A2732F4420060812D /* buffer_map.h */, - DEEA118B2732F4420060812D /* allowlisted_flex_ops.h */, - DEEA118C2732F4420060812D /* util.h */, - DEEA118D2732F4420060812D /* kernel.h */, - DEEA118E2732F4420060812D /* test_util.h */, - ); - path = flex; - sourceTree = ""; - }; - DEEA11922732F4420060812D /* c */ = { - isa = PBXGroup; - children = ( - DEEA11932732F4420060812D /* c_api_experimental.h */, - DEEA11942732F4420060812D /* c_api_internal.h */, - DEEA11952732F4420060812D /* c_api.h */, - DEEA11962732F4420060812D /* builtin_op_data.h */, - DEEA11972732F4420060812D /* common.h */, - ); - path = c; - sourceTree = ""; - }; - DEEA11982732F4420060812D /* toco */ = { - isa = PBXGroup; - children = ( - DEEA11992732F4420060812D /* toco_types.h */, - DEEA119A2732F4420060812D /* tensorflow_util.h */, - DEEA119B2732F4420060812D /* model_cmdline_flags.h */, - DEEA119C2732F4420060812D /* tflite */, - DEEA11A52732F4420060812D /* toco_convert.h */, - DEEA11A62732F4420060812D /* toco_port.h */, - DEEA11A72732F4420060812D /* python */, - DEEA11A92732F4420060812D /* import_tensorflow.h */, - DEEA11AA2732F4420060812D /* format_port.h */, - DEEA11AB2732F4420060812D /* runtime */, - DEEA11AE2732F4420060812D /* dump_graphviz.h */, - DEEA11AF2732F4420060812D /* args.h */, - DEEA11B02732F4420060812D /* export_tensorflow.h */, - DEEA11B12732F4420060812D /* model.h */, - DEEA11B22732F4420060812D /* toco_tooling.h */, - DEEA11B32732F4420060812D /* toco_cmdline_flags.h */, - DEEA11B42732F4420060812D /* tooling_util.h */, - DEEA11B52732F4420060812D /* graph_transformations */, - DEEA11BB2732F4420060812D /* allocate_transient_arrays.h */, - DEEA11BC2732F4420060812D /* logging */, - DEEA11BE2732F4420060812D /* toco_graphviz_dump_options.h */, - DEEA11BF2732F4420060812D /* tensorflow_graph_matching */, - ); - path = toco; - sourceTree = ""; - }; - DEEA119C2732F4420060812D /* tflite */ = { - isa = PBXGroup; - children = ( - DEEA119D2732F4420060812D /* op_version.h */, - DEEA119E2732F4420060812D /* export.h */, - DEEA119F2732F4420060812D /* types.h */, - DEEA11A02732F4420060812D /* operator.h */, - DEEA11A12732F4420060812D /* builtin_operator.h */, - DEEA11A22732F4420060812D /* custom_operator.h */, - DEEA11A32732F4420060812D /* simple_operator.h */, - DEEA11A42732F4420060812D /* import.h */, - ); - path = tflite; - sourceTree = ""; - }; - DEEA11A72732F4420060812D /* python */ = { - isa = PBXGroup; - children = ( - DEEA11A82732F4420060812D /* toco_python_api.h */, - ); - path = python; - sourceTree = ""; - }; - DEEA11AB2732F4420060812D /* runtime */ = { - isa = PBXGroup; - children = ( - DEEA11AC2732F4420060812D /* types.h */, - DEEA11AD2732F4420060812D /* common.h */, - ); - path = runtime; - sourceTree = ""; - }; - DEEA11B52732F4420060812D /* graph_transformations */ = { - isa = PBXGroup; - children = ( - DEEA11B62732F4420060812D /* identify_util.h */, - DEEA11B72732F4420060812D /* quantization_util.h */, - DEEA11B82732F4420060812D /* graph_transformations.h */, - DEEA11B92732F4420060812D /* remove_trivial_passthrough.h */, - DEEA11BA2732F4420060812D /* lstm_utils.h */, - ); - path = graph_transformations; - sourceTree = ""; - }; - DEEA11BC2732F4420060812D /* logging */ = { - isa = PBXGroup; - children = ( - DEEA11BD2732F4420060812D /* conversion_log_util.h */, - ); - path = logging; - sourceTree = ""; - }; - DEEA11BF2732F4420060812D /* tensorflow_graph_matching */ = { - isa = PBXGroup; - children = ( - DEEA11C02732F4420060812D /* cluster.h */, - DEEA11C12732F4420060812D /* cluster_utils.h */, - DEEA11C22732F4420060812D /* resolve_svdf.h */, - DEEA11C32732F4420060812D /* resolve_cluster.h */, - ); - path = tensorflow_graph_matching; - sourceTree = ""; - }; - DEEA11C42732F4420060812D /* flatbuffers */ = { - isa = PBXGroup; - children = ( - DEEA11C52732F4420060812D /* grpc.h */, - DEEA11C62732F4420060812D /* idl.h */, - DEEA11C72732F4420060812D /* reflection_generated.h */, - DEEA11C82732F4420060812D /* registry.h */, - DEEA11C92732F4420060812D /* flatbuffers.h */, - DEEA11CA2732F4420060812D /* flatc.h */, - DEEA11CB2732F4420060812D /* flexbuffers.h */, - DEEA11CC2732F4420060812D /* minireflect.h */, - DEEA11CD2732F4420060812D /* util.h */, - DEEA11CE2732F4420060812D /* code_generators.h */, - DEEA11CF2732F4420060812D /* stl_emulation.h */, - DEEA11D02732F4420060812D /* hash.h */, - DEEA11D12732F4420060812D /* reflection.h */, - DEEA11D22732F4420060812D /* base.h */, - ); - path = flatbuffers; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXHeadersBuildPhase section */ @@ -3038,683 +139,7 @@ isa = PBXHeadersBuildPhase; buildActionMask = 2147483647; files = ( - DEEA145F2732F4440060812D /* prelu_tester.h in Headers */, - DEEA11DC2732F4420060812D /* InterpreterWrapper.h in Headers */, - DEEA126F2732F4430060812D /* micro_benchmark.h in Headers */, - DEEA14902732F4440060812D /* lstm_utils.h in Headers */, - DEEA14062732F4440060812D /* cl_context.h in Headers */, - DEEA12082732F4430060812D /* recording_simple_memory_allocator.h in Headers */, - DEEA146D2732F4440060812D /* optional_debug_tools.h in Headers */, - DEEA125F2732F4430060812D /* micro_features_generator.h in Headers */, - DEEA14362732F4440060812D /* pool_2d_builder.h in Headers */, DEEA0E812732F3A90060812D /* BlurDiscriminatorKit.h in Headers */, - DEEA13552732F4430060812D /* inference_context.h in Headers */, - DEEA132C2732F4430060812D /* stateful_error_reporter.h in Headers */, - DEEA13C12732F4430060812D /* variable_accessor.h in Headers */, - DEEA12772732F4430060812D /* all_ops_resolver.h in Headers */, - DEEA12FA2732F4430060812D /* register.h in Headers */, - DEEA124C2732F4430060812D /* no_1000ms_sample_data.h in Headers */, - DEEA13222732F4430060812D /* schema_generated.h in Headers */, - DEEA142B2732F4440060812D /* matmul_builder.h in Headers */, - DEEA12DA2732F4430060812D /* tanh.h in Headers */, - DEEA12352732F4430060812D /* slope_micro_features_data.h in Headers */, - DEEA11F12732F4430060812D /* xa_type_def.h in Headers */, - DEEA136C2732F4430060812D /* shape.h in Headers */, - DEEA124E2732F4430060812D /* audio_provider.h in Headers */, - DEEA147B2732F4440060812D /* custom_operator.h in Headers */, - DEEA14992732F4440060812D /* idl.h in Headers */, - DEEA12482732F4430060812D /* detection_responder.h in Headers */, - DEEA13172732F4430060812D /* allocation.h in Headers */, - DEEA13792732F4430060812D /* types.h in Headers */, - DEEA14802732F4440060812D /* toco_python_api.h in Headers */, - DEEA14812732F4440060812D /* import_tensorflow.h in Headers */, - DEEA138A2732F4430060812D /* max_unpooling.h in Headers */, - DEEA149E2732F4440060812D /* flexbuffers.h in Headers */, - DEEA135A2732F4430060812D /* gpu_info.h in Headers */, - DEEA14772732F4440060812D /* export.h in Headers */, - DEEA13DD2732F4430060812D /* prelu.h in Headers */, - DEEA12792732F4430060812D /* dequantize.h in Headers */, - DEEA131B2732F4430060812D /* memory_planner.h in Headers */, - DEEA12092732F4430060812D /* micro_op_resolver.h in Headers */, - DEEA14952732F4440060812D /* cluster_utils.h in Headers */, - DEEA14752732F4440060812D /* model_cmdline_flags.h in Headers */, - DEEA142A2732F4440060812D /* batch_seq_builder.h in Headers */, - DEEA13EA2732F4430060812D /* convolution_transposed_3x3_thin.h in Headers */, - DEEA13112732F4430060812D /* flatbuffer_conversions.h in Headers */, - DEEA13152732F4430060812D /* string_util.h in Headers */, - DEEA128A2732F4430060812D /* quantization_util.h in Headers */, - DEEA12EA2732F4430060812D /* floor.h in Headers */, - DEEA12A22732F4430060812D /* cpu_check.h in Headers */, - DEEA14972732F4440060812D /* resolve_cluster.h in Headers */, - DEEA13DE2732F4430060812D /* reshapex4.h in Headers */, - DEEA12E12732F4430060812D /* process_broadcast_shapes.h in Headers */, - DEEA12972732F4430060812D /* depthwise_conv_hybrid.h in Headers */, - DEEA13802732F4430060812D /* model.h in Headers */, - DEEA13AC2732F4430060812D /* phwc4_to_bhwc.h in Headers */, - DEEA13392732F4430060812D /* elementwise.h in Headers */, - DEEA12AB2732F4430060812D /* legacy_optimized_ops.h in Headers */, - DEEA13FC2732F4440060812D /* gpu_api_delegate.h in Headers */, - DEEA13062732F4430060812D /* gen_op_registration.h in Headers */, - DEEA12322732F4430060812D /* main_functions.h in Headers */, - DEEA13FB2732F4430060812D /* concat_xy.h in Headers */, - DEEA12222732F4430060812D /* main_functions.h in Headers */, - DEEA14492732F4440060812D /* hexagon_nn_interface.h in Headers */, - DEEA13A32732F4430060812D /* gl_errors.h in Headers */, - DEEA12AF2732F4430060812D /* mfcc_mel_filterbank.h in Headers */, - DEEA138D2732F4430060812D /* prelu.h in Headers */, - DEEA12CC2732F4430060812D /* fully_connected.h in Headers */, - DEEA147D2732F4440060812D /* import.h in Headers */, - DEEA11E52732F4430060812D /* mli_tf_utils.h in Headers */, - DEEA11E62732F4430060812D /* scratch_buffers.h in Headers */, - DEEA124D2732F4430060812D /* yes_1000ms_sample_data.h in Headers */, - DEEA12EC2732F4430060812D /* test_util.h in Headers */, - DEEA138E2732F4430060812D /* slice.h in Headers */, - DEEA13A82732F4430060812D /* egl_surface.h in Headers */, - DEEA12BE2732F4430060812D /* dequantize.h in Headers */, - DEEA13C02732F4430060812D /* gl_sync.h in Headers */, - DEEA13822732F4430060812D /* model_builder_helper.h in Headers */, - DEEA14732732F4440060812D /* toco_types.h in Headers */, - DEEA12D62732F4430060812D /* hard_swish.h in Headers */, - DEEA13632732F4430060812D /* make_padding.h in Headers */, - DEEA13CB2732F4430060812D /* stats.h in Headers */, - DEEA130A2732F4430060812D /* shared_library.h in Headers */, - DEEA13D72732F4430060812D /* max_unpooling.h in Headers */, - DEEA12B72732F4430060812D /* quantize.h in Headers */, - DEEA123E2732F4430060812D /* HM01B0_Walking1s_01.h in Headers */, - DEEA13592732F4430060812D /* winograd_util.h in Headers */, - DEEA13B92732F4430060812D /* portable_gl31.h in Headers */, - DEEA14502732F4440060812D /* acceleration_test_util.h in Headers */, - DEEA13192732F4430060812D /* interpreter.h in Headers */, - DEEA12932732F4430060812D /* depthwise_conv_hybrid_3x3_filter.h in Headers */, - DEEA12372732F4430060812D /* image_provider.h in Headers */, - DEEA13132732F4430060812D /* op_resolver.h in Headers */, - DEEA14122732F4440060812D /* util.h in Headers */, - DEEA11F62732F4430060812D /* xa_nnlib_common_macros.h in Headers */, - DEEA13962732F4430060812D /* mul.h in Headers */, - DEEA12242732F4430060812D /* detection_responder.h in Headers */, - DEEA12B92732F4430060812D /* portable_tensor_utils_impl.h in Headers */, - DEEA13532732F4430060812D /* compiled_model.h in Headers */, - DEEA14482732F4440060812D /* pack_builder.h in Headers */, - DEEA13662732F4430060812D /* lstm_parser.h in Headers */, - DEEA13762732F4430060812D /* internal.h in Headers */, - DEEA141D2732F4440060812D /* simple_selectors.h in Headers */, - DEEA144B2732F4440060812D /* hexagon_nn_init.h in Headers */, - DEEA141A2732F4440060812D /* device_info.h in Headers */, - DEEA12822732F4430060812D /* compatibility.h in Headers */, - DEEA13F52732F4430060812D /* work_group_picking.h in Headers */, - DEEA13F82732F4430060812D /* padding.h in Headers */, - DEEA14212732F4440060812D /* dw_convolution_selector.h in Headers */, - DEEA14192732F4440060812D /* tensor.h in Headers */, - DEEA13262732F4430060812D /* nnapi_util.h in Headers */, - DEEA14912732F4440060812D /* allocate_transient_arrays.h in Headers */, - DEEA12AC2732F4430060812D /* sse_tensor_utils_impl.h in Headers */, - DEEA13312732F4430060812D /* utils.h in Headers */, - DEEA137C2732F4430060812D /* greedy_by_breadth_assignment.h in Headers */, - DEEA12892732F4430060812D /* cppmath.h in Headers */, - DEEA140F2732F4440060812D /* gl_interop.h in Headers */, - DEEA132B2732F4430060812D /* mutable_op_resolver.h in Headers */, - DEEA140E2732F4440060812D /* buffer.h in Headers */, - DEEA13002732F4430060812D /* context_util.h in Headers */, - DEEA135E2732F4430060812D /* add_quant_adjustments.h in Headers */, - DEEA12452732F4430060812D /* model_settings.h in Headers */, - DEEA12CE2732F4430060812D /* prelu.h in Headers */, - DEEA14432732F4440060812D /* mirror_pad_builder.h in Headers */, - DEEA14822732F4440060812D /* format_port.h in Headers */, - DEEA13992732F4430060812D /* mean.h in Headers */, - DEEA13D82732F4430060812D /* elementwise.h in Headers */, - DEEA13A52732F4430060812D /* egl_context.h in Headers */, - DEEA123D2732F4430060812D /* platform_Sparkfun_Edge.h in Headers */, - DEEA14872732F4440060812D /* export_tensorflow.h in Headers */, - DEEA136D2732F4430060812D /* data_type.h in Headers */, - DEEA123B2732F4430060812D /* image_recognition_model.h in Headers */, - DEEA12D82732F4430060812D /* concatenation.h in Headers */, - DEEA139B2732F4430060812D /* pooling.h in Headers */, - DEEA14692732F4440060812D /* kernel.h in Headers */, - DEEA12A42732F4430060812D /* depthwiseconv_multithread.h in Headers */, - DEEA14842732F4440060812D /* common.h in Headers */, - DEEA13D02732F4430060812D /* winograd.h in Headers */, - DEEA14552732F4440060812D /* reshape_tester.h in Headers */, - DEEA146E2732F4440060812D /* c_api_experimental.h in Headers */, - DEEA12152732F4430060812D /* micro_time.h in Headers */, - DEEA13DB2732F4430060812D /* concat_z.h in Headers */, - DEEA135D2732F4430060812D /* matching.h in Headers */, - DEEA12BB2732F4430060812D /* strided_slice.h in Headers */, - DEEA13692732F4430060812D /* types.h in Headers */, - DEEA128B2732F4430060812D /* mfcc_dct.h in Headers */, - DEEA13E32732F4430060812D /* depthwise_conv_3x3.h in Headers */, - DEEA13742732F4430060812D /* tflite_model_reader.h in Headers */, - DEEA13512732F4430060812D /* common.h in Headers */, - DEEA121C2732F4430060812D /* HM01B0_RAW8_QVGA_8bits_lsb_5fps.h in Headers */, - DEEA136B2732F4430060812D /* access_type.h in Headers */, - DEEA148F2732F4440060812D /* remove_trivial_passthrough.h in Headers */, - DEEA13AD2732F4430060812D /* util.h in Headers */, - DEEA149F2732F4440060812D /* minireflect.h in Headers */, - DEEA12922732F4430060812D /* depthwise_conv.h in Headers */, - DEEA12032732F4430060812D /* recording_micro_allocator.h in Headers */, - DEEA12AE2732F4430060812D /* depthwiseconv_3x3_filter_common.h in Headers */, - DEEA12562732F4430060812D /* yes_30ms_sample_data.h in Headers */, - DEEA14792732F4440060812D /* operator.h in Headers */, - DEEA14342732F4440060812D /* split_builder.h in Headers */, - DEEA11F02732F4430060812D /* xa_nnlib_standards.h in Headers */, - DEEA124A2732F4430060812D /* network_model.h in Headers */, - DEEA123A2732F4430060812D /* util.h in Headers */, - DEEA128E2732F4430060812D /* sse_tensor_utils.h in Headers */, - DEEA133F2732F4430060812D /* resize.h in Headers */, - DEEA130C2732F4430060812D /* macros.h in Headers */, - DEEA12882732F4430060812D /* transpose_utils.h in Headers */, - DEEA14442732F4440060812D /* strided_slice_builder.h in Headers */, - DEEA12A62732F4430060812D /* depthwiseconv_uint8_3x3_filter.h in Headers */, - DEEA146B2732F4440060812D /* interpreter_utils.h in Headers */, - DEEA12F52732F4430060812D /* eigen_support.h in Headers */, - DEEA12B32732F4430060812D /* kernel_utils.h in Headers */, - DEEA13A92732F4430060812D /* shared_buffer.h in Headers */, - DEEA11E82732F4430060812D /* scratch_buf_mgr.h in Headers */, - DEEA12EB2732F4430060812D /* binary_function.h in Headers */, - DEEA13AA2732F4430060812D /* gl_shader.h in Headers */, - DEEA14932732F4440060812D /* toco_graphviz_dump_options.h in Headers */, - DEEA13A22732F4430060812D /* float16_conversions.h in Headers */, - DEEA13732732F4430060812D /* feature_parity.h in Headers */, - DEEA12E62732F4430060812D /* comparisons.h in Headers */, - DEEA144C2732F4440060812D /* hexagon_nn.h in Headers */, - DEEA12D12732F4430060812D /* pad.h in Headers */, - DEEA13F92732F4430060812D /* mean_stddev_normalization.h in Headers */, - DEEA12F22732F4430060812D /* builtin_op_kernels.h in Headers */, - DEEA12F12732F4430060812D /* cpu_backend_threadpool.h in Headers */, - DEEA13EF2732F4430060812D /* mean.h in Headers */, - DEEA13C32732F4430060812D /* shader_codegen.h in Headers */, - DEEA145D2732F4440060812D /* conv_2d_tester.h in Headers */, - DEEA13F42732F4430060812D /* conv_buffer_1x1.h in Headers */, - DEEA13B02732F4430060812D /* calculator_from_metadata.h in Headers */, - DEEA12D02732F4430060812D /* sub.h in Headers */, - DEEA13D22732F4430060812D /* strided_slice.h in Headers */, - DEEA13852732F4430060812D /* tensor.h in Headers */, - DEEA12B82732F4430060812D /* dequantize.h in Headers */, - DEEA143E2732F4440060812D /* conv_2d_builder.h in Headers */, - DEEA131E2732F4430060812D /* tflite_with_xnnpack_optional.h in Headers */, - DEEA13462732F4430060812D /* transpose_conv.h in Headers */, - DEEA126A2732F4430060812D /* simple_features_generator.h in Headers */, - DEEA128D2732F4430060812D /* common.h in Headers */, - DEEA144D2732F4440060812D /* hexagon_implementation.h in Headers */, - DEEA13672732F4430060812D /* operations.h in Headers */, - DEEA13452732F4430060812D /* pooling.h in Headers */, - DEEA13C92732F4430060812D /* compiled_node.h in Headers */, - DEEA13812732F4430060812D /* custom_transformations.h in Headers */, - DEEA127D2732F4430060812D /* kernel_util.h in Headers */, - DEEA12762732F4430060812D /* memory_helpers.h in Headers */, - DEEA12412732F4430060812D /* HM01B0_RAW8_QVGA_8bits_lsb_5fps.h in Headers */, - DEEA14862732F4440060812D /* args.h in Headers */, - DEEA12782732F4430060812D /* recording_micro_interpreter.h in Headers */, - DEEA11EB2732F4430060812D /* fixedpoint_utils.h in Headers */, - DEEA122B2732F4430060812D /* accelerometer_handler.h in Headers */, - DEEA12EF2732F4430060812D /* cpu_backend_gemm_params.h in Headers */, - DEEA13F32732F4430060812D /* pooling.h in Headers */, - DEEA12982732F4430060812D /* mul.h in Headers */, - DEEA12272732F4430060812D /* main_functions.h in Headers */, - DEEA13F72732F4430060812D /* transpose.h in Headers */, - DEEA140A2732F4440060812D /* storage_type_util.h in Headers */, - DEEA14672732F4440060812D /* allowlisted_flex_ops.h in Headers */, - DEEA126D2732F4430060812D /* model.h in Headers */, - DEEA133A2732F4430060812D /* fully_connected.h in Headers */, - DEEA14082732F4440060812D /* cl_image_format.h in Headers */, - DEEA14102732F4440060812D /* gpu_object.h in Headers */, - DEEA13352732F4430060812D /* softmax.h in Headers */, - DEEA13BE2732F4430060812D /* gl_buffer.h in Headers */, - DEEA12302732F4430060812D /* gesture_predictor.h in Headers */, - DEEA144E2732F4440060812D /* hexagon_delegate_kernel.h in Headers */, - DEEA121B2732F4430060812D /* HM01B0.h in Headers */, - DEEA12E42732F4430060812D /* pooling.h in Headers */, - DEEA14422732F4440060812D /* min_max_builder.h in Headers */, - DEEA12F92732F4430060812D /* hashtable_ops.h in Headers */, - DEEA14782732F4440060812D /* types.h in Headers */, - DEEA128C2732F4430060812D /* spectrogram.h in Headers */, - DEEA14522732F4440060812D /* nnapi_delegate.h in Headers */, - DEEA137A2732F4430060812D /* greedy_by_size_assignment.h in Headers */, - DEEA14402732F4440060812D /* op_builder.h in Headers */, - DEEA13B22732F4430060812D /* calculator.h in Headers */, - DEEA144A2732F4440060812D /* hexagon_delegate.h in Headers */, - DEEA13042732F4430060812D /* resource_variable.h in Headers */, - DEEA13BF2732F4430060812D /* egl_environment.h in Headers */, - DEEA11E12732F4430060812D /* micro_interpreter.h in Headers */, - DEEA13D32732F4430060812D /* depthwise_conv.h in Headers */, - DEEA133E2732F4430060812D /* concat.h in Headers */, - DEEA13582732F4430060812D /* api.h in Headers */, - DEEA139F2732F4430060812D /* quantize_and_dequantize.h in Headers */, - DEEA14352732F4440060812D /* resize_bilinear_builder.h in Headers */, - DEEA12622732F4430060812D /* static_alloc.h in Headers */, - DEEA12712732F4430060812D /* greedy_memory_planner.h in Headers */, - DEEA13722732F4430060812D /* add.h in Headers */, - DEEA12DC2732F4430060812D /* mul.h in Headers */, - DEEA14612732F4440060812D /* pad_tester.h in Headers */, - DEEA121E2732F4430060812D /* person_image_data.h in Headers */, - DEEA14412732F4440060812D /* pad_builder.h in Headers */, - DEEA14252732F4440060812D /* metal_delegate.h in Headers */, - DEEA14332732F4440060812D /* cast_builder.h in Headers */, - DEEA133D2732F4430060812D /* add.h in Headers */, - DEEA12C72732F4430060812D /* mean.h in Headers */, - DEEA130B2732F4430060812D /* subgraph.h in Headers */, - DEEA14142732F4440060812D /* cl_device.h in Headers */, - DEEA13B12732F4430060812D /* default_calculator.h in Headers */, - DEEA13252732F4430060812D /* NeuralNetworksTypes.h in Headers */, - DEEA14592732F4440060812D /* binary_elementwise_tester.h in Headers */, - DEEA12C32732F4430060812D /* l2normalization.h in Headers */, - DEEA12962732F4430060812D /* add.h in Headers */, - DEEA12FC2732F4430060812D /* test_util.h in Headers */, - DEEA121D2732F4430060812D /* HM01B0_debug.h in Headers */, - DEEA139A2732F4430060812D /* space_to_depth.h in Headers */, - DEEA14372732F4440060812D /* quantize_builder.h in Headers */, - DEEA12312732F4430060812D /* ring_micro_features_data.h in Headers */, - DEEA14922732F4440060812D /* conversion_log_util.h in Headers */, - DEEA13BB2732F4430060812D /* gl_call.h in Headers */, - DEEA12B62732F4430060812D /* softmax.h in Headers */, - DEEA13072732F4430060812D /* version.h in Headers */, - DEEA12692732F4430060812D /* yes_power_spectrum_data.h in Headers */, - DEEA12942732F4430060812D /* fully_connected.h in Headers */, - DEEA139D2732F4430060812D /* conv.h in Headers */, - DEEA145B2732F4440060812D /* depthwise_conv_2d_tester.h in Headers */, - DEEA143C2732F4440060812D /* activation_builder.h in Headers */, - DEEA136A2732F4430060812D /* workgroup_selection.h in Headers */, - DEEA14012732F4440060812D /* precision.h in Headers */, - DEEA12362732F4430060812D /* magic_wand_model_data.h in Headers */, - DEEA12E92732F4430060812D /* conv.h in Headers */, - DEEA125B2732F4430060812D /* no_30ms_sample_data.h in Headers */, - DEEA12A32732F4430060812D /* im2col_utils.h in Headers */, - DEEA147A2732F4440060812D /* builtin_operator.h in Headers */, - DEEA12FB2732F4430060812D /* reshape_test_common.h in Headers */, - DEEA149B2732F4440060812D /* registry.h in Headers */, - DEEA13E22732F4430060812D /* convolution_transposed_3x3.h in Headers */, - DEEA14292732F4440060812D /* utils.h in Headers */, - DEEA14162732F4440060812D /* cl_event.h in Headers */, - DEEA13BD2732F4430060812D /* request_gpu_info.h in Headers */, - DEEA12CD2732F4430060812D /* svdf.h in Headers */, - DEEA13242732F4430060812D /* string_type.h in Headers */, - DEEA143D2732F4440060812D /* space_to_depth_builder.h in Headers */, - DEEA12C22732F4430060812D /* add.h in Headers */, - DEEA14A42732F4440060812D /* reflection.h in Headers */, - DEEA12F42732F4430060812D /* cpu_backend_gemm_custom_gemv.h in Headers */, - DEEA12632732F4430060812D /* no_micro_features_data.h in Headers */, - DEEA13CE2732F4430060812D /* spi.h in Headers */, - DEEA14722732F4440060812D /* common.h in Headers */, - DEEA127F2732F4430060812D /* fully_connected.h in Headers */, - DEEA14312732F4440060812D /* arg_min_max_builder.h in Headers */, - DEEA12A92732F4430060812D /* batch_matmul.h in Headers */, - DEEA131F2732F4430060812D /* simple_memory_arena.h in Headers */, - DEEA13772732F4430060812D /* naive_assignment.h in Headers */, - DEEA12BC2732F4430060812D /* legacy_reference_ops.h in Headers */, - DEEA13C82732F4430060812D /* rename.h in Headers */, - DEEA133B2732F4430060812D /* prelu.h in Headers */, - DEEA13602732F4430060812D /* make_fully_connected.h in Headers */, - DEEA141E2732F4440060812D /* operation_selector.h in Headers */, - DEEA13DA2732F4430060812D /* fully_connected.h in Headers */, - DEEA12852732F4430060812D /* min.h in Headers */, - DEEA12BD2732F4430060812D /* requantize.h in Headers */, - DEEA122D2732F4430060812D /* constants.h in Headers */, - DEEA13D12732F4430060812D /* softmax.h in Headers */, - DEEA13E82732F4430060812D /* depthwise_conv_plus_1x1_conv.h in Headers */, - DEEA13EC2732F4430060812D /* gpu_operation.h in Headers */, - DEEA13942732F4430060812D /* concat.h in Headers */, - DEEA13162732F4430060812D /* stderr_reporter.h in Headers */, - DEEA14032732F4440060812D /* cl_kernel.h in Headers */, - DEEA13DF2732F4430060812D /* conv_weights_converter.h in Headers */, - DEEA13562732F4430060812D /* buffer_convert.h in Headers */, - DEEA12172732F4430060812D /* app_camera_esp.h in Headers */, - DEEA12072732F4430060812D /* micro_error_reporter.h in Headers */, - DEEA130D2732F4430060812D /* tensor_utils.h in Headers */, - DEEA143F2732F4440060812D /* resize_nearest_neighbor_builder.h in Headers */, - DEEA13CC2732F4430060812D /* command_queue.h in Headers */, - DEEA141B2732F4440060812D /* inference_context.h in Headers */, - DEEA12812732F4430060812D /* lstm_eval.h in Headers */, - DEEA14A12732F4440060812D /* code_generators.h in Headers */, - DEEA12D32732F4430060812D /* l2normalization.h in Headers */, - DEEA14452732F4440060812D /* op_factory.h in Headers */, - DEEA12C82732F4430060812D /* pooling.h in Headers */, - DEEA13C62732F4430060812D /* object_accessor.h in Headers */, - DEEA12B02732F4430060812D /* max.h in Headers */, - DEEA137E2732F4430060812D /* model_builder.h in Headers */, - DEEA13922732F4430060812D /* lstm.h in Headers */, - DEEA13E02732F4430060812D /* convolution_transposed.h in Headers */, - DEEA14562732F4440060812D /* unary_elementwise_tester.h in Headers */, - DEEA12672732F4430060812D /* recognize_commands.h in Headers */, - DEEA13422732F4430060812D /* mean.h in Headers */, - DEEA14572732F4440060812D /* leaky_relu_tester.h in Headers */, - DEEA14382732F4440060812D /* reduce_builder.h in Headers */, - DEEA13082732F4430060812D /* portable_type_to_tflitetype.h in Headers */, - DEEA14A22732F4440060812D /* stl_emulation.h in Headers */, - DEEA12442732F4430060812D /* person_detect_model_data.h in Headers */, - DEEA13472732F4430060812D /* conv.h in Headers */, - DEEA148B2732F4440060812D /* tooling_util.h in Headers */, - DEEA13382732F4430060812D /* max_unpooling.h in Headers */, - DEEA13952732F4430060812D /* resize.h in Headers */, - DEEA128F2732F4430060812D /* eigen_tensor_reduced_instantiations_google.h in Headers */, - DEEA12862732F4430060812D /* mfcc.h in Headers */, - DEEA12602732F4430060812D /* micro_model_settings.h in Headers */, - DEEA13E72732F4430060812D /* fc_fc_add.h in Headers */, - DEEA14962732F4440060812D /* resolve_svdf.h in Headers */, - DEEA13CF2732F4430060812D /* texture2d.h in Headers */, - DEEA129B2732F4430060812D /* transpose_conv.h in Headers */, - DEEA13A72732F4430060812D /* serialization.h in Headers */, - DEEA133C2732F4430060812D /* slice.h in Headers */, - DEEA14112732F4440060812D /* cl_command_queue.h in Headers */, - DEEA148A2732F4440060812D /* toco_cmdline_flags.h in Headers */, - DEEA13182732F4430060812D /* arena_planner.h in Headers */, - DEEA13542732F4430060812D /* compute_task_descriptor.h in Headers */, - DEEA13ED2732F4430060812D /* reshape.h in Headers */, - DEEA12BF2732F4430060812D /* depthwise_conv.h in Headers */, - DEEA13D62732F4430060812D /* relu.h in Headers */, - DEEA13C22732F4430060812D /* shader_code.h in Headers */, - DEEA11EF2732F4430060812D /* xa_nnlib_kernels_api.h in Headers */, - DEEA123F2732F4430060812D /* HM01B0_optimized.h in Headers */, - DEEA12842732F4430060812D /* tensor_utils.h in Headers */, - DEEA12F62732F4430060812D /* acceleration_test_util_internal.h in Headers */, - DEEA13D42732F4430060812D /* convolution_transposed_4x4.h in Headers */, - DEEA13E92732F4430060812D /* resize.h in Headers */, - DEEA127E2732F4430060812D /* acceleration_test_util.h in Headers */, - DEEA11F42732F4430060812D /* xa_nnlib_definitions.h in Headers */, - DEEA12DE2732F4430060812D /* densify.h in Headers */, - DEEA138B2732F4430060812D /* elementwise.h in Headers */, - DEEA12CF2732F4430060812D /* round.h in Headers */, - DEEA12432732F4430060812D /* person_image_data.h in Headers */, - DEEA13DC2732F4430060812D /* convolution_transposed_thin.h in Headers */, - DEEA11F32732F4430060812D /* xa_nnlib_err_chk.h in Headers */, - DEEA14762732F4440060812D /* op_version.h in Headers */, - DEEA13B42732F4430060812D /* variable.h in Headers */, - DEEA13282732F4430060812D /* NeuralNetworksShim.h in Headers */, - DEEA136F2732F4430060812D /* memory_management.h in Headers */, - DEEA130E2732F4430060812D /* op_resolver.h in Headers */, - DEEA14392732F4440060812D /* softmax_builder.h in Headers */, - DEEA13032732F4430060812D /* resource_base.h in Headers */, - DEEA146C2732F4440060812D /* graph_info.h in Headers */, - DEEA13092732F4430060812D /* builtin_ops.h in Headers */, - DEEA13AF2732F4430060812D /* best_effort_calculator.h in Headers */, - DEEA14092732F4440060812D /* api.h in Headers */, - DEEA146F2732F4440060812D /* c_api_internal.h in Headers */, - DEEA12E02732F4430060812D /* depthwiseconv_float.h in Headers */, - DEEA13292732F4430060812D /* nnapi_handler.h in Headers */, - DEEA12262732F4430060812D /* constants.h in Headers */, - DEEA12832732F4430060812D /* portable_tensor.h in Headers */, - DEEA13AE2732F4430060812D /* bhwc_to_phwc4.h in Headers */, - DEEA12A82732F4430060812D /* eigen_spatial_convolutions.h in Headers */, - DEEA13C52732F4430060812D /* fuse_inplace.h in Headers */, - DEEA131C2732F4430060812D /* context.h in Headers */, - DEEA135C2732F4430060812D /* add_bias.h in Headers */, - DEEA13442732F4430060812D /* space_to_depth.h in Headers */, - DEEA12002732F4430060812D /* simple_memory_allocator.h in Headers */, - DEEA12AD2732F4430060812D /* neon_tensor_utils.h in Headers */, - DEEA147C2732F4440060812D /* simple_operator.h in Headers */, - DEEA12E22732F4430060812D /* non_max_suppression.h in Headers */, - DEEA13B72732F4430060812D /* api.h in Headers */, - DEEA12D72732F4430060812D /* resize_nearest_neighbor.h in Headers */, - DEEA13FD2732F4440060812D /* opencl_wrapper.h in Headers */, - DEEA13622732F4430060812D /* model_transformations.h in Headers */, - DEEA149D2732F4440060812D /* flatc.h in Headers */, - DEEA12382732F4430060812D /* display_util.h in Headers */, - DEEA14322732F4440060812D /* concat_builder.h in Headers */, - DEEA149C2732F4440060812D /* flatbuffers.h in Headers */, - DEEA13702732F4430060812D /* model_transformer.h in Headers */, - DEEA14232732F4440060812D /* convolution_selector.h in Headers */, - DEEA12192732F4430060812D /* HM01B0_Walking1s_01.h in Headers */, - DEEA11E22732F4430060812D /* compatibility.h in Headers */, - DEEA13A42732F4430060812D /* compiler.h in Headers */, - DEEA13752732F4430060812D /* interpreter_utils.h in Headers */, - DEEA142C2732F4440060812D /* reshape_builder.h in Headers */, - DEEA12D42732F4430060812D /* arg_min_max.h in Headers */, - DEEA135B2732F4430060812D /* status.h in Headers */, - DEEA13842732F4430060812D /* object_reader.h in Headers */, - DEEA13302732F4430060812D /* model.h in Headers */, - DEEA14272732F4440060812D /* dummy_delegate.h in Headers */, - DEEA11EE2732F4430060812D /* xa_nnlib_api.h in Headers */, - DEEA132A2732F4430060812D /* external_cpu_backend_context.h in Headers */, - DEEA12AA2732F4430060812D /* eigen_tensor_reduced_instantiations_oss.h in Headers */, - DEEA14582732F4440060812D /* xnnpack_delegate.h in Headers */, - DEEA13272732F4430060812D /* nnapi_implementation.h in Headers */, - DEEA148C2732F4440060812D /* identify_util.h in Headers */, - DEEA125A2732F4430060812D /* hanning.h in Headers */, - DEEA145A2732F4440060812D /* reduce_tester.h in Headers */, - DEEA12B52732F4430060812D /* tensor.h in Headers */, - DEEA14052732F4440060812D /* cl_memory.h in Headers */, - DEEA12FD2732F4430060812D /* padding.h in Headers */, - DEEA137F2732F4430060812D /* util.h in Headers */, - DEEA13142732F4430060812D /* minimal_logging.h in Headers */, - DEEA12E82732F4430060812D /* batch_matmul.h in Headers */, - DEEA137B2732F4430060812D /* min_cost_flow_assignment.h in Headers */, - DEEA11E32732F4430060812D /* kernel_runner.h in Headers */, - DEEA12802732F4430060812D /* subgraph_test_util.h in Headers */, - DEEA13972732F4430060812D /* custom_registry.h in Headers */, - DEEA12C52732F4430060812D /* tanh.h in Headers */, - DEEA14A02732F4440060812D /* util.h in Headers */, - DEEA13AB2732F4430060812D /* gl_texture.h in Headers */, - DEEA12422732F4430060812D /* HM01B0_debug.h in Headers */, - DEEA13712732F4430060812D /* utils.h in Headers */, - DEEA12CA2732F4430060812D /* conv.h in Headers */, - DEEA14282732F4440060812D /* simple_delegate.h in Headers */, - DEEA129D2732F4430060812D /* sse_check.h in Headers */, - DEEA12C62732F4430060812D /* mul.h in Headers */, - DEEA11E72732F4430060812D /* mli_slicers.h in Headers */, - DEEA12D92732F4430060812D /* depthwiseconv_uint8.h in Headers */, - DEEA123C2732F4430060812D /* image_provider.h in Headers */, - DEEA142D2732F4440060812D /* slice_builder.h in Headers */, - DEEA132E2732F4430060812D /* interpreter_builder.h in Headers */, - DEEA127B2732F4430060812D /* cpu_backend_gemm.h in Headers */, - DEEA143B2732F4440060812D /* transpose_conv_2d_builder.h in Headers */, - DEEA13682732F4430060812D /* custom_parsers.h in Headers */, - DEEA13A62732F4430060812D /* runtime_options.h in Headers */, - DEEA13202732F4430060812D /* error_reporter.h in Headers */, - DEEA14182732F4440060812D /* cl_program.h in Headers */, - DEEA14642732F4440060812D /* delegate.h in Headers */, - DEEA134E2732F4430060812D /* runtime_options.h in Headers */, - DEEA12EE2732F4430060812D /* cpu_backend_gemm_x86.h in Headers */, - DEEA12552732F4430060812D /* command_responder.h in Headers */, - DEEA13F22732F4430060812D /* space_to_depth.h in Headers */, - DEEA13122732F4430060812D /* profiler.h in Headers */, - DEEA12052732F4430060812D /* test_helpers.h in Headers */, - DEEA12402732F4430060812D /* HM01B0.h in Headers */, - DEEA126B2732F4430060812D /* yes_simple_features_data.h in Headers */, - DEEA13B32732F4430060812D /* ideal_workgroup_picker.h in Headers */, - DEEA12652732F4430060812D /* no_feature_data_slice.h in Headers */, - DEEA14892732F4440060812D /* toco_tooling.h in Headers */, - DEEA13492732F4430060812D /* padding.h in Headers */, - DEEA13832732F4430060812D /* convert.h in Headers */, - DEEA140D2732F4440060812D /* linear_storage.h in Headers */, - DEEA149A2732F4440060812D /* reflection_generated.h in Headers */, - DEEA12A52732F4430060812D /* depthwiseconv_float.h in Headers */, - DEEA148D2732F4440060812D /* quantization_util.h in Headers */, - DEEA139E2732F4430060812D /* test_util.h in Headers */, - DEEA12752732F4430060812D /* micro_profiler.h in Headers */, - DEEA14262732F4440060812D /* status.h in Headers */, - DEEA13FF2732F4440060812D /* cl_test.h in Headers */, - DEEA13902732F4430060812D /* add.h in Headers */, - DEEA12CB2732F4430060812D /* logistic.h in Headers */, - DEEA13502732F4430060812D /* api.h in Headers */, - DEEA14302732F4440060812D /* l2_normalization_builder.h in Headers */, - DEEA14622732F4440060812D /* external_delegate.h in Headers */, - DEEA13402732F4430060812D /* custom_registry.h in Headers */, - DEEA14602732F4440060812D /* fully_connected_tester.h in Headers */, - DEEA14512732F4440060812D /* quant_lstm_sup.h in Headers */, - DEEA132F2732F4430060812D /* util.h in Headers */, - DEEA141F2732F4440060812D /* subgraph.h in Headers */, - DEEA12252732F4430060812D /* output_handler.h in Headers */, - DEEA12E72732F4430060812D /* reference_ops.h in Headers */, - DEEA13862732F4430060812D /* metal_delegate_internal.h in Headers */, - DEEA13FE2732F4440060812D /* program_cache.h in Headers */, - DEEA12952732F4430060812D /* depthwise_conv_3x3_filter.h in Headers */, - DEEA13232732F4430060812D /* generator.h in Headers */, - DEEA14942732F4440060812D /* cluster.h in Headers */, - DEEA12F82732F4430060812D /* test_delegate_providers.h in Headers */, - DEEA12022732F4430060812D /* debug_log.h in Headers */, - DEEA129F2732F4430060812D /* depthwiseconv_uint8.h in Headers */, - DEEA13782732F4430060812D /* greedy_in_order_assignment.h in Headers */, - DEEA148E2732F4440060812D /* graph_transformations.h in Headers */, - DEEA12F72732F4430060812D /* cpu_backend_gemm_gemmlowp.h in Headers */, - DEEA12232732F4430060812D /* no_person_image_data.h in Headers */, - DEEA13412732F4430060812D /* reshape.h in Headers */, - DEEA12D22732F4430060812D /* add.h in Headers */, - DEEA14222732F4440060812D /* default_selector.h in Headers */, - DEEA146A2732F4440060812D /* test_util.h in Headers */, - DEEA14542732F4440060812D /* pool_2d_tester.h in Headers */, - DEEA12ED2732F4430060812D /* lstm_shared.h in Headers */, - DEEA13E52732F4430060812D /* tuning_parameters.h in Headers */, - DEEA145E2732F4440060812D /* softmax_tester.h in Headers */, - DEEA122C2732F4430060812D /* output_handler.h in Headers */, - DEEA12292732F4430060812D /* model.h in Headers */, - DEEA13102732F4430060812D /* error_reporter.h in Headers */, - DEEA12DD2732F4430060812D /* portable_tensor_utils.h in Headers */, - DEEA13572732F4430060812D /* gl_delegate.h in Headers */, - DEEA13BC2732F4430060812D /* object.h in Headers */, - DEEA137D2732F4430060812D /* equality_assignment.h in Headers */, - DEEA13912732F4430060812D /* converter.h in Headers */, - DEEA13882732F4430060812D /* depthwise_conv.h in Headers */, - DEEA14882732F4440060812D /* model.h in Headers */, - DEEA13D52732F4430060812D /* conv_constants.h in Headers */, - DEEA12C92732F4430060812D /* transpose_conv.h in Headers */, - DEEA13872732F4430060812D /* softmax.h in Headers */, - DEEA12732732F4430060812D /* linear_memory_planner.h in Headers */, - DEEA13982732F4430060812D /* reshape.h in Headers */, - DEEA13B62732F4430060812D /* runtime.h in Headers */, - DEEA134D2732F4430060812D /* arguments.h in Headers */, - DEEA13332732F4430060812D /* compute_task.h in Headers */, - DEEA11EC2732F4430060812D /* activation_utils.h in Headers */, - DEEA126E2732F4430060812D /* no_simple_features_data.h in Headers */, - DEEA12492732F4430060812D /* input_data.h in Headers */, - DEEA13642732F4430060812D /* fuse_mul_to_conv.h in Headers */, - DEEA14702732F4440060812D /* c_api.h in Headers */, - DEEA12042732F4430060812D /* micro_string.h in Headers */, - DEEA12542732F4430060812D /* ringbuf.h in Headers */, - DEEA12472732F4430060812D /* no_person_image_data.h in Headers */, - DEEA12872732F4430060812D /* types.h in Headers */, - DEEA135F2732F4430060812D /* fuse_add_to_conv.h in Headers */, - DEEA12702732F4430060812D /* keyword_scrambled_model_data.h in Headers */, - DEEA14652732F4440060812D /* allowlisted_flex_ops_internal.h in Headers */, - DEEA12A72732F4430060812D /* multithreaded_conv.h in Headers */, - DEEA129C2732F4430060812D /* conv.h in Headers */, - DEEA11EA2732F4430060812D /* fully_connected.h in Headers */, - DEEA132D2732F4430060812D /* model_builder.h in Headers */, - DEEA13012732F4430060812D /* lookup_interfaces.h in Headers */, - DEEA13F62732F4430060812D /* softmax1x1.h in Headers */, - DEEA13022732F4430060812D /* lookup_util.h in Headers */, - DEEA130F2732F4430060812D /* verifier.h in Headers */, - DEEA12202732F4430060812D /* HM01B0_platform.h in Headers */, - DEEA13EB2732F4430060812D /* conv_common.h in Headers */, - DEEA14982732F4440060812D /* grpc.h in Headers */, - DEEA12592732F4430060812D /* sin_1k.h in Headers */, - DEEA12662732F4430060812D /* yes_feature_data_slice.h in Headers */, - DEEA13932732F4430060812D /* registry.h in Headers */, - DEEA12FE2732F4430060812D /* custom_ops_register.h in Headers */, - DEEA13B82732F4430060812D /* node_shader.h in Headers */, - DEEA12E32732F4430060812D /* maximum_minimum.h in Headers */, - DEEA13CD2732F4430060812D /* portable_egl.h in Headers */, - DEEA11F72732F4430060812D /* xtensa_tf_micro_common.h in Headers */, - DEEA12DB2732F4430060812D /* string_comparisons.h in Headers */, - DEEA121A2732F4430060812D /* HM01B0_optimized.h in Headers */, - DEEA13892732F4430060812D /* relu.h in Headers */, - DEEA12F02732F4430060812D /* register_ref.h in Headers */, - DEEA11E42732F4430060812D /* micro_utils.h in Headers */, - DEEA14832732F4440060812D /* types.h in Headers */, - DEEA13C72732F4430060812D /* fuse_inline.h in Headers */, - DEEA13E42732F4430060812D /* converter.h in Headers */, - DEEA140B2732F4440060812D /* cl_errors.h in Headers */, - DEEA124B2732F4430060812D /* expected_output_data.h in Headers */, - DEEA140C2732F4440060812D /* tensor_type_util.h in Headers */, - DEEA138C2732F4430060812D /* fully_connected.h in Headers */, - DEEA138F2732F4430060812D /* pad.h in Headers */, - DEEA13CA2732F4430060812D /* preprocessor.h in Headers */, - DEEA13432732F4430060812D /* util.h in Headers */, - DEEA13C42732F4430060812D /* fuse_auto_input.h in Headers */, - DEEA13BA2732F4430060812D /* api2.h in Headers */, - DEEA11F52732F4430060812D /* xa_api_defs.h in Headers */, - DEEA12162732F4430060812D /* image_provider.h in Headers */, - DEEA12D52732F4430060812D /* ceil.h in Headers */, - DEEA12DF2732F4430060812D /* reduce.h in Headers */, - DEEA13E62732F4430060812D /* lstm.h in Headers */, - DEEA13652732F4430060812D /* remove_noop.h in Headers */, - DEEA12992732F4430060812D /* mean.h in Headers */, - DEEA12C02732F4430060812D /* logistic.h in Headers */, - DEEA12C12732F4430060812D /* fully_connected.h in Headers */, - DEEA14172732F4440060812D /* model_hints.h in Headers */, - DEEA14202732F4440060812D /* special_selector.h in Headers */, - DEEA129E2732F4430060812D /* neon_check.h in Headers */, - DEEA14632732F4440060812D /* delegate_data.h in Headers */, - DEEA14A32732F4440060812D /* hash.h in Headers */, - DEEA147E2732F4440060812D /* toco_convert.h in Headers */, - DEEA14152732F4440060812D /* tensor_type.h in Headers */, - DEEA12722732F4430060812D /* memory_planner.h in Headers */, - DEEA13A02732F4430060812D /* object_manager.h in Headers */, - DEEA11F82732F4430060812D /* micro_ops.h in Headers */, - DEEA14132732F4440060812D /* egl_sync.h in Headers */, - DEEA12A12732F4430060812D /* depthwiseconv_uint8_transitional.h in Headers */, - DEEA12BA2732F4430060812D /* fully_connected.h in Headers */, - DEEA121F2732F4430060812D /* person_detect_model_data.h in Headers */, - DEEA13372732F4430060812D /* relu.h in Headers */, - DEEA12F32732F4430060812D /* op_macros.h in Headers */, - DEEA144F2732F4440060812D /* nnapi_delegate_kernel.h in Headers */, - DEEA13E12732F4430060812D /* add.h in Headers */, - DEEA12B42732F4430060812D /* legacy_types.h in Headers */, - DEEA14852732F4440060812D /* dump_graphviz.h in Headers */, - DEEA12392732F4430060812D /* image_util.h in Headers */, - DEEA136E2732F4430060812D /* quantization_util.h in Headers */, - DEEA11E92732F4430060812D /* kernel_util.h in Headers */, - DEEA141C2732F4440060812D /* fully_connected_selector.h in Headers */, - DEEA139C2732F4430060812D /* transpose_conv.h in Headers */, - DEEA13052732F4430060812D /* static_hashtable.h in Headers */, - DEEA142F2732F4440060812D /* neg_op_builder.h in Headers */, - DEEA12212732F4430060812D /* model_settings.h in Headers */, - DEEA12612732F4430060812D /* yes_micro_features_data.h in Headers */, - DEEA11F22732F4430060812D /* xa_nnlib_common.h in Headers */, - DEEA11ED2732F4430060812D /* xtensa_tf_micro_common.h in Headers */, - DEEA12682732F4430060812D /* no_power_spectrum_data.h in Headers */, - DEEA12C42732F4430060812D /* log_softmax.h in Headers */, - DEEA14682732F4440060812D /* util.h in Headers */, - DEEA13212732F4430060812D /* schema_utils.h in Headers */, - DEEA14042732F4440060812D /* compiled_program_cache_generated.h in Headers */, - DEEA14742732F4440060812D /* tensorflow_util.h in Headers */, - DEEA13342732F4430060812D /* winograd.h in Headers */, - DEEA12B22732F4430060812D /* tensor_ctypes.h in Headers */, - DEEA11F92732F4430060812D /* micro_utils.h in Headers */, - DEEA12912732F4430060812D /* optimized_ops.h in Headers */, - DEEA13F02732F4430060812D /* util.h in Headers */, - DEEA142E2732F4440060812D /* transpose_builder.h in Headers */, - DEEA12B12732F4430060812D /* strided_slice_logic.h in Headers */, - DEEA14072732F4440060812D /* environment.h in Headers */, - DEEA12A02732F4430060812D /* neon_tensor_utils_impl.h in Headers */, - DEEA145C2732F4440060812D /* resize_bilinear_tester.h in Headers */, - DEEA125C2732F4430060812D /* main_functions.h in Headers */, - DEEA147F2732F4440060812D /* toco_port.h in Headers */, - DEEA13EE2732F4430060812D /* reduce.h in Headers */, - DEEA12E52732F4430060812D /* neg.h in Headers */, - DEEA12012732F4430060812D /* micro_mutable_op_resolver.h in Headers */, - DEEA12902732F4430060812D /* fully_connected.h in Headers */, - DEEA14002732F4440060812D /* arguments.h in Headers */, - DEEA131A2732F4430060812D /* builtin_op_data.h in Headers */, - DEEA129A2732F4430060812D /* pooling.h in Headers */, - DEEA14462732F4440060812D /* hardswish_builder.h in Headers */, - DEEA13B52732F4430060812D /* gl_program.h in Headers */, - DEEA14712732F4440060812D /* builtin_op_data.h in Headers */, - DEEA13362732F4430060812D /* depthwise_conv.h in Headers */, - DEEA13D92732F4430060812D /* cl_test.h in Headers */, - DEEA14242732F4440060812D /* convolution_transposed_selector.h in Headers */, - DEEA143A2732F4440060812D /* hexagon_delegate_op_model.h in Headers */, - DEEA12FF2732F4430060812D /* cpu_backend_gemm_eigen.h in Headers */, - DEEA13A12732F4430060812D /* compiler_options.h in Headers */, - DEEA14A52732F4440060812D /* base.h in Headers */, - DEEA122F2732F4430060812D /* accelerometer_handler.h in Headers */, - DEEA12582732F4430060812D /* feature_provider.h in Headers */, - DEEA14472732F4440060812D /* arithmetic_builder.h in Headers */, - DEEA13F12732F4430060812D /* conv_powervr.h in Headers */, - DEEA131D2732F4430060812D /* type_to_tflitetype.h in Headers */, - DEEA14532732F4440060812D /* nnapi_delegate_mock_test.h in Headers */, - DEEA13612732F4430060812D /* merge_padding_with.h in Headers */, - DEEA126C2732F4430060812D /* simple_model_settings.h in Headers */, - DEEA12642732F4430060812D /* model.h in Headers */, - DEEA13522732F4430060812D /* metal_arguments.h in Headers */, - DEEA13482732F4430060812D /* test_util.h in Headers */, - DEEA13322732F4430060812D /* delegate.h in Headers */, - DEEA134A2732F4430060812D /* quantize_and_dequantize.h in Headers */, - DEEA12462732F4430060812D /* main_functions.h in Headers */, - DEEA13FA2732F4430060812D /* quantize_and_dequantize.h in Headers */, - DEEA127C2732F4430060812D /* cpu_backend_gemm_ruy.h in Headers */, - DEEA127A2732F4430060812D /* cpu_backend_context.h in Headers */, - DEEA14022732F4440060812D /* serialization.h in Headers */, - DEEA12742732F4430060812D /* micro_allocator.h in Headers */, - DEEA134F2732F4430060812D /* environment.h in Headers */, - DEEA14662732F4440060812D /* buffer_map.h in Headers */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3799,10 +224,9 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - DE90DBC92737BB9A0048E41B /* image_f264_horizontal_fliped.jpg in Resources */, - DE90DBCC2737BB9A0048E41B /* image_f477_origin.jpg in Resources */, - DE90DBCB2737BB9A0048E41B /* blur_segmentation_quantized.tflite in Resources */, - DE90DBCA2737BB9A0048E41B /* image_f67_origin.jpg in Resources */, + AAC604803B1845D1F5A5FA06 /* cc0_cherry_blossom.jpg in Resources */, + C42C470E371C0665D6122AD6 /* cc0_ant_sunflower.jpg in Resources */, + 56EBB025FFBC562404E3CD1A /* cc0_misty_river.jpg in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3821,6 +245,7 @@ buildActionMask = 2147483647; files = ( DE90DBBC2737B43F0048E41B /* BlurDiscriminatorKitTests.swift in Sources */, + 7B7E6B5BF45BC50981B78C13 /* BlurDiscriminatorLoadingTests.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3828,15 +253,12 @@ isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( - DEEA14A72732F4440060812D /* RGBConverter.swift in Sources */, - DEEA14AC2732F4440060812D /* Constants.swift in Sources */, - DEEA14AA2732F4440060812D /* OutputConverter.swift in Sources */, - DEEA11DB2732F4420060812D /* InterpreterWrapper.mm in Sources */, DEEA14A82732F4440060812D /* BlurObservation.swift in Sources */, - DEEA14AB2732F4440060812D /* GrayscaleConverter.swift in Sources */, - DEEA11DE2732F4420060812D /* CGImage+resize.swift in Sources */, - DEEA14A62732F4440060812D /* InputConverter.swift in Sources */, DEEA14A92732F4440060812D /* BlurDiscriminator.swift in Sources */, + 9420062D36C325523D8A97CD /* CoreMLBlurPredictor.swift in Sources */, + DE85CC4F3DD8CF3298FCC7F0 /* BlurMap.swift in Sources */, + 6B22DA0DF98A5F3F043C2FB2 /* BlurSegmentation.mlpackage in Sources */, + 0A8978422621CC9146B5BCF3 /* CGImage+resize.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3858,7 +280,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = NHMWTHTL9L; INFOPLIST_FILE = BlurDiscriminatorKitTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.5; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3877,7 +299,7 @@ CODE_SIGN_STYLE = Automatic; DEVELOPMENT_TEAM = NHMWTHTL9L; INFOPLIST_FILE = BlurDiscriminatorKitTests/Info.plist; - IPHONEOS_DEPLOYMENT_TARGET = 14.5; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; LD_RUNPATH_SEARCH_PATHS = ( "$(inherited)", "@executable_path/Frameworks", @@ -3943,13 +365,14 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_ACTIVE_COMPILATION_CONDITIONS = DEBUG; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_STRICT_CONCURRENCY = complete; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; }; @@ -4002,13 +425,14 @@ GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; GCC_WARN_UNUSED_FUNCTION = YES; GCC_WARN_UNUSED_VARIABLE = YES; - IPHONEOS_DEPLOYMENT_TARGET = 13.0; + IPHONEOS_DEPLOYMENT_TARGET = 16.2; MTL_ENABLE_DEBUG_INFO = NO; MTL_FAST_MATH = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; SWIFT_COMPILATION_MODE = wholemodule; SWIFT_OPTIMIZATION_LEVEL = "-O"; + SWIFT_STRICT_CONCURRENCY = complete; VALIDATE_PRODUCT = YES; VERSIONING_SYSTEM = "apple-generic"; VERSION_INFO_PREFIX = ""; @@ -4027,7 +451,6 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - HEADER_SEARCH_PATHS = "${SRCROOT}/BlurDiscriminatorKit/externals"; INFOPLIST_FILE = BlurDiscriminatorKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 16.2; @@ -4036,13 +459,8 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/BlurDiscriminatorKit/externals", - ); MACH_O_TYPE = mh_dylib; MARKETING_VERSION = 0.0; - MODULEMAP_FILE = "${SRCROOT}/BlurDiscriminatorKit/module.modulemap"; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = syjdev.BlurDiscriminatorKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; @@ -4066,7 +484,6 @@ DYLIB_COMPATIBILITY_VERSION = 1; DYLIB_CURRENT_VERSION = 1; DYLIB_INSTALL_NAME_BASE = "@rpath"; - HEADER_SEARCH_PATHS = "${SRCROOT}/BlurDiscriminatorKit/externals"; INFOPLIST_FILE = BlurDiscriminatorKit/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; IPHONEOS_DEPLOYMENT_TARGET = 16.2; @@ -4075,13 +492,8 @@ "@executable_path/Frameworks", "@loader_path/Frameworks", ); - LIBRARY_SEARCH_PATHS = ( - "$(inherited)", - "$(PROJECT_DIR)/BlurDiscriminatorKit/externals", - ); MACH_O_TYPE = mh_dylib; MARKETING_VERSION = 0.0; - MODULEMAP_FILE = "${SRCROOT}/BlurDiscriminatorKit/module.modulemap"; ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = syjdev.BlurDiscriminatorKit; PRODUCT_NAME = "$(TARGET_NAME:c99extidentifier)"; diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurDiscriminator.swift b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurDiscriminator.swift index 0408059..cf8cf25 100644 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurDiscriminator.swift +++ b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurDiscriminator.swift @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: Apache-2.0 // // BlurDiscriminator.swift // BlurDiscriminatorKit @@ -5,44 +6,94 @@ // Created by syjdev on 2021/09/23. // -import Foundation import CoreGraphics -import BlurDiscriminatorKit.Private +import Foundation + +/// An error thrown by ``BlurDiscriminator/predict(input:)``. +public enum BlurDiscriminatorError: Error { + /// The Core ML model failed to load from the framework bundle. + case modelLoadFailed(underlying: Error) + /// The input image could not be prepared (letterboxed) for the model. + case imagePreprocessingFailed + /// The Vision request failed while running the model. + case inferenceFailed(underlying: Error) + /// The model produced an output the framework does not understand. + case unexpectedOutput +} -public final class BlurDiscriminator: @unchecked Sendable { - private let interpreter: InterpreterWrapper - private let inputConverter: InputConverter = RGBConverter(inputWidth: Constants.inputWidth, - inputHeight: Constants.inputHeight) - private let outputConverter: OutputConverter = GrayscaleConverter(inputWidth: Constants.inputWidth, - inputHeight: Constants.inputHeight) +/// What ``BlurDiscriminator`` needs from its inference engine — a seam for +/// injecting a test double in place of the Core ML-backed predictor. +internal protocol BlurPredicting: Sendable { + func predict(input: CGImage) throws -> BlurObservation +} - private let inferenceQueue = DispatchQueue(label: "com.blurdiscriminatorkit.inference", qos: .userInitiated) +/// A deep-learning based detector that classifies the clear and blurry regions of an image. +/// +/// `BlurDiscriminator` wraps a Core ML segmentation model (`BlurSegmentation.mlpackage`, bundled +/// inside this framework). Given a `CGImage`, it produces a ``BlurObservation`` describing, per +/// pixel, how blurry the input is. +/// +/// The input image is letterboxed to the model's fixed input size (currently 224×224) internally — +/// aspect ratio is preserved with black padding — and the resulting blur map is cropped back to the +/// original image's aspect ratio. Any image size may be passed. `BlurDiscriminator` is an actor: +/// concurrent calls are serialized by actor isolation, so a single instance is safe to share across +/// concurrency domains. +/// +/// ```swift +/// let discriminator = BlurDiscriminator() +/// +/// let observation = try await discriminator.predict(input: cgImage) +/// imageView.image = UIImage(cgImage: observation.blurMap) +/// ``` +public actor BlurDiscriminator { + private let loadPredictor: @Sendable () async throws -> any BlurPredicting + private var predictor: (any BlurPredicting)? + private var loadTask: Task? - public init(modelPath: String, numberOfThread: UInt8) { - interpreter = InterpreterWrapper(modelPath: modelPath, andNumberOfThread: numberOfThread) + /// Creates a discriminator backed by the bundled Core ML model. + /// + /// Creation is cheap: the model is loaded lazily on the first call to ``predict(input:)``, + /// so initializing the discriminator never blocks the calling thread. + public init() { + self.loadPredictor = { try await CoreMLBlurPredictor() } } - public func predict(input: CGImage) -> BlurObservation? { - return inferenceQueue.sync { runPrediction(input: input) } + /// Test seam: creates a discriminator that loads its predictor from the given closure. + internal init(loadPredictor: @escaping @Sendable () async throws -> any BlurPredicting) { + self.loadPredictor = loadPredictor } - public func predict(input: CGImage) async -> BlurObservation? { - return await withCheckedContinuation { continuation in - inferenceQueue.async { [self] in - continuation.resume(returning: runPrediction(input: input)) - } - } + /// Runs blur detection on the given image. + /// + /// The Core ML model is loaded on the first call and cached for subsequent calls. + /// Inference is actor-isolated: concurrent calls are executed one at a time, and the + /// calling task is suspended (not blocked) until inference completes. + /// + /// - Parameter input: The image to analyze. It is resized to the model input size internally. + /// - Returns: A ``BlurObservation`` describing the blur map. + /// - Throws: ``BlurDiscriminatorError`` if the model could not be loaded, inference failed, + /// or the model produced an unexpected output. + public func predict(input: CGImage) async throws -> BlurObservation { + return try await loadedPredictor().predict(input: input) } - private func runPrediction(input: CGImage) -> BlurObservation? { - guard let convertedData = inputConverter.convert(cgImage: input), - let outputData = interpreter.interpret(withInputData: convertedData) - else { - return nil + /// Returns the cached predictor, loading the model on first use. A single in-flight load + /// task is shared between reentrant callers so the model is never loaded twice; a failed + /// load is not cached, so a later call may retry. + private func loadedPredictor() async throws -> any BlurPredicting { + if let predictor { + return predictor } + if let loadTask { + return try await loadTask.value + } + + let task = Task { [loadPredictor] in try await loadPredictor() } + loadTask = task + defer { loadTask = nil } - return outputConverter.convert(data: outputData, - originImageWidth: input.width, - originImageHeight: input.height) + let loaded = try await task.value + predictor = loaded + return loaded } } diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurMap.swift b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurMap.swift new file mode 100644 index 0000000..afe2143 --- /dev/null +++ b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurMap.swift @@ -0,0 +1,87 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// BlurMap.swift +// BlurDiscriminatorKit +// +// Helpers that turn the Core ML sigmoid output into an 8-bit grayscale blur map. +// + +import Accelerate +import CoreGraphics +import Foundation + + +internal enum PixelConverter { + /// Converts a float sigmoid buffer in [0, 1] to UInt8 [0, 255] with vDSP: + /// scale by 255, clip to the valid range, then round-to-nearest into UInt8. + /// Replaces per-pixel `UInt8(max(0, min(255, v * 255)))` loops. + static func floatToUInt8(_ source: Buffer) -> [UInt8] where Buffer.Element == Float { + let scaled = vDSP.clip(vDSP.multiply(255, source), to: 0 ... 255) + + var pixels = [UInt8](repeating: 0, count: scaled.count) + vDSP.convertElements(of: scaled, to: &pixels, rounding: .towardNearestInteger) + return pixels + } +} + + +internal enum BlurMapGeometry { + /// The un-padded region of a letterboxed square output, matching the original image's aspect + /// ratio. Mirrors the top-left aspect-fit placement used by ``CGImage/makeAspectFitPadded(width:height:)``, + /// so the returned size is the slice of the model output that corresponds to real image content. + static func croppedSize(outputWidth: Int, outputHeight: Int, + originalWidth: Int, originalHeight: Int) -> (width: Int, height: Int) { + guard originalWidth > 0, originalHeight > 0 else { return (outputWidth, outputHeight) } + + if originalWidth > originalHeight { + return (outputWidth, Int(Float(outputHeight) * Float(originalHeight) / Float(originalWidth))) + } else if originalWidth < originalHeight { + return (Int(Float(outputWidth) * Float(originalWidth) / Float(originalHeight)), outputHeight) + } else { + return (outputWidth, outputHeight) + } + } + + /// Crops the top-left `cropWidth`×`cropHeight` block out of a row-major, `sourceWidth`-wide map. + static func cropTopLeft(_ pixels: [UInt8], sourceWidth: Int, + cropWidth: Int, cropHeight: Int) -> [UInt8] { + guard sourceWidth > 0 else { return pixels } + let sourceHeight = pixels.count / sourceWidth + guard cropWidth < sourceWidth || cropHeight < sourceHeight else { return pixels } + + var cropped = [UInt8]() + cropped.reserveCapacity(cropWidth * cropHeight) + for row in 0 ..< cropHeight { + let start = row * sourceWidth + cropped.append(contentsOf: pixels[start ..< start + cropWidth]) + } + return cropped + } +} + + +internal enum BlurMapRenderer { + /// Builds a grayscale CGImage from width×height UInt8 pixels in row-major order. + static func makeBlurMap(grayscaledPixels: [UInt8], width: Int, height: Int) -> CGImage? { + guard width > 0, height > 0, grayscaledPixels.count == width * height else { return nil } + + // Keep every use of the pixel buffer inside the closure: `makeImage()` copies the + // bitmap, so the context never sees the pointer beyond this scope. (Passing `&pixels` + // straight to `CGContext(data:)` would leave the context holding a pointer that is + // only valid for the duration of the initializer call.) + var pixels = grayscaledPixels + return pixels.withUnsafeMutableBytes { buffer -> CGImage? in + guard let context = CGContext( + data: buffer.baseAddress, + width: width, + height: height, + bitsPerComponent: 8, + bytesPerRow: width, + space: CGColorSpaceCreateDeviceGray(), + bitmapInfo: CGImageAlphaInfo.none.rawValue + ) else { return nil } + + return context.makeImage() + } + } +} diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurObservation.swift b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurObservation.swift index e67e810..a075cdf 100644 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurObservation.swift +++ b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurObservation.swift @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: Apache-2.0 // // BlurObservation.swift // BlurDiscriminatorKit @@ -5,30 +6,39 @@ // Created by syjdev on 2021/11/03. // -import Foundation import CoreGraphics -public final class BlurObservation { +/// The result of running ``BlurDiscriminator/predict(input:)`` on an image. +/// +/// A `BlurObservation` describes, per pixel, how blurry the analyzed image is. Pixel values +/// range from `0` (clear) to `255` (blurry), matched to the original image's dimensions. +public struct BlurObservation: Sendable { + /// A grayscale blur map sized to the original image, where brighter pixels are blurrier. + /// + /// Suitable for direct display, e.g. `UIImage(cgImage: observation.blurMap)`. public let blurMap: CGImage + + /// The raw per-pixel blur intensities of ``blurMap``, from `0` (clear) to `255` (blurry), + /// in row-major order. public let grayscaledPixels: [UInt8] - public let data: Data - internal init(blurMap: CGImage, - grayscaledPixels: [UInt8], - data: Data = Data()) { + internal init(blurMap: CGImage, grayscaledPixels: [UInt8]) { self.blurMap = blurMap self.grayscaledPixels = grayscaledPixels - self.data = data } - - public func blurRatio(threshold: Int) -> Float { - let numberOfBlur: Float = grayscaledPixels.reduce(into: 0) { result, element in - if element > threshold { - result += 1 - } - } - - return numberOfBlur / Float(grayscaledPixels.count) + + /// The fraction of pixels considered blurry. + /// + /// A pixel counts as blurry when its intensity in ``grayscaledPixels`` is strictly greater + /// than `threshold`. Use the returned ratio to decide whether an image is blurry overall, + /// e.g. treat it as blurry when the ratio exceeds some cutoff. + /// + /// - Parameter threshold: The intensity cutoff; higher values count fewer pixels as blurry. + /// Defaults to `127`, the midpoint of the intensity range. + /// - Returns: A value in `0...1` — the number of blurry pixels divided by the total. + public func blurRatio(threshold: UInt8 = 127) -> Float { + let numberOfBlur = grayscaledPixels.count { $0 > threshold } + return Float(numberOfBlur) / Float(grayscaledPixels.count) } } diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurSegmentation.mlpackage/Data/com.apple.CoreML/model.mlmodel b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurSegmentation.mlpackage/Data/com.apple.CoreML/model.mlmodel new file mode 100644 index 0000000..e62b00b Binary files /dev/null and b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurSegmentation.mlpackage/Data/com.apple.CoreML/model.mlmodel differ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurSegmentation.mlpackage/Data/com.apple.CoreML/weights/weight.bin b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurSegmentation.mlpackage/Data/com.apple.CoreML/weights/weight.bin new file mode 100644 index 0000000..1ea4fab Binary files /dev/null and b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurSegmentation.mlpackage/Data/com.apple.CoreML/weights/weight.bin differ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurSegmentation.mlpackage/Manifest.json b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurSegmentation.mlpackage/Manifest.json new file mode 100644 index 0000000..e1078ce --- /dev/null +++ b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurSegmentation.mlpackage/Manifest.json @@ -0,0 +1,18 @@ +{ + "fileFormatVersion": "1.0.0", + "itemInfoEntries": { + "15F4E827-89F3-4D2A-AFF3-A1609A536263": { + "author": "com.apple.CoreML", + "description": "CoreML Model Specification", + "name": "model.mlmodel", + "path": "com.apple.CoreML/model.mlmodel" + }, + "4FAA7EEF-8FF4-4185-B2F6-2461CB59E676": { + "author": "com.apple.CoreML", + "description": "CoreML Model Weights", + "name": "weights", + "path": "com.apple.CoreML/weights" + } + }, + "rootModelIdentifier": "15F4E827-89F3-4D2A-AFF3-A1609A536263" +} diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/extensions/CGImage+resize.swift b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/CGImage+resize.swift similarity index 63% rename from Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/extensions/CGImage+resize.swift rename to Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/CGImage+resize.swift index 3deefb0..e935920 100644 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/extensions/CGImage+resize.swift +++ b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/CGImage+resize.swift @@ -1,3 +1,4 @@ +// SPDX-License-Identifier: Apache-2.0 // // CGImage+resize.swift // BlurDiscriminatorKit @@ -5,12 +6,17 @@ // Created by syjdev on 2021/10/07. // -import Foundation import CoreGraphics extension CGImage { - func makeAspectFitPaddedContext(width: Int, height: Int) -> CGContext? { + /// Returns a `width`×`height` image with `self` aspect-fit into the top-left corner and the + /// remaining area padded with black. + /// + /// This reproduces the letterbox preprocessing the model was trained with: the aspect ratio is + /// preserved (no stretching), and the padding is placed at the bottom/right so the content is + /// top-left aligned. ``BlurMapGeometry`` later crops the model output back to this same region. + func makeAspectFitPadded(width: Int, height: Int) -> CGImage? { guard self.width > 0, self.height > 0, let context = CGContext( data: nil, @@ -32,6 +38,7 @@ extension CGImage { let scaledWidth = CGFloat(self.width) * scale let scaledHeight = CGFloat(self.height) * scale + // Context origin is bottom-left, so `y = height - scaledHeight` pins the content to the top. let drawRect = CGRect(x: 0, y: CGFloat(height) - scaledHeight, width: scaledWidth, @@ -40,6 +47,6 @@ extension CGImage { context.interpolationQuality = .high context.draw(self, in: drawRect) - return context + return context.makeImage() } } diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/Constants.swift b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/Constants.swift deleted file mode 100644 index 1fc2f3e..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/Constants.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// Constants.swift -// BlurDiscriminatorKit -// -// Created by syjdev on 2021/11/03. -// - -import Foundation - - -internal struct Constants { - static let inputWidth = 224 - static let inputHeight = 224 -} diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/CoreMLBlurPredictor.swift b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/CoreMLBlurPredictor.swift new file mode 100644 index 0000000..2c4445a --- /dev/null +++ b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/CoreMLBlurPredictor.swift @@ -0,0 +1,162 @@ +// SPDX-License-Identifier: Apache-2.0 +// +// CoreMLBlurPredictor.swift +// BlurDiscriminatorKit +// +// Runs BlurSegmentation.mlpackage (converted by snorlax/convert_model.py). +// The Core ML model takes a 224x224 RGB image (pixel values 0-255, the +// 1/255 normalization is baked into the model) and outputs a 1x224x224x1 +// float map where bright = blurred. +// + +import Accelerate +import CoreGraphics +import CoreML +import Vision + + +/// Core ML inference engine behind ``BlurDiscriminator``. Kept internal so the framework's public +/// surface stays limited to ``BlurDiscriminator`` and ``BlurObservation``. +/// +/// `@unchecked Sendable`: the only stored property is an immutable `VNCoreMLModel`, which +/// Vision allows to be shared across threads. (`VNCoreMLModel` itself just isn't annotated.) +internal final class CoreMLBlurPredictor: BlurPredicting, @unchecked Sendable { + private struct MalformedModelError: Error { let reason: String } + + private let visionModel: VNCoreMLModel + private let inputWidth: Int + private let inputHeight: Int + + /// Loads the compiled model that ships in this framework's bundle. + /// + /// `BlurSegmentation` is the class Xcode generates from `BlurSegmentation.mlpackage`; + /// its loader resolves `BlurSegmentation.mlmodelc` inside this framework's bundle, + /// so there is no bundle/URL lookup to get wrong here. + /// + /// - Throws: ``BlurDiscriminatorError/modelLoadFailed(underlying:)`` if loading fails. + init() async throws { + let configuration = MLModelConfiguration() + configuration.computeUnits = .all // CPU / GPU / Neural Engine + + do { + let segmentation = try await BlurSegmentation.load(configuration: configuration) + let mlModel = segmentation.model + + // Read the required input size from the model instead of hardcoding 224, so a + // reconverted model with a different input size keeps working. + guard let imageInput = mlModel.modelDescription.inputDescriptionsByName.values.first(where: { $0.type == .image }), + let constraint = imageInput.imageConstraint else { + throw MalformedModelError(reason: "model has no image input constraint") + } + self.inputWidth = constraint.pixelsWide + self.inputHeight = constraint.pixelsHigh + self.visionModel = try VNCoreMLModel(for: mlModel) + } catch { + throw BlurDiscriminatorError.modelLoadFailed(underlying: error) + } + } + + func predict(input: CGImage) throws -> BlurObservation { + // Letterbox to the model's input size so the model sees the same undistorted, black-padded + // image it was trained on. Because the padded image already matches the input size, Vision's + // `.scaleFill` is an identity resize and introduces no distortion of its own. + guard let paddedInput = input.makeAspectFitPadded(width: inputWidth, height: inputHeight) else { + throw BlurDiscriminatorError.imagePreprocessingFailed + } + + let request = VNCoreMLRequest(model: visionModel) + request.imageCropAndScaleOption = .scaleFill + + let handler = VNImageRequestHandler(cgImage: paddedInput, options: [:]) + do { + try handler.perform([request]) + } catch { + throw BlurDiscriminatorError.inferenceFailed(underlying: error) + } + + guard let observation = request.results?.first as? VNCoreMLFeatureValueObservation, + let multiArray = observation.featureValue.multiArrayValue else { + throw BlurDiscriminatorError.unexpectedOutput + } + + return try makeObservation(from: multiArray, + originalWidth: input.width, + originalHeight: input.height) + } + + private func makeObservation(from multiArray: MLMultiArray, + originalWidth: Int, + originalHeight: Int) throws -> BlurObservation { + // The model outputs a 1xHxWx1 (NHWC) sigmoid map. Take the blur-map size from + // the actual output tensor instead of hardcoding the model's current 224x224. + let shape = multiArray.shape.map { $0.intValue } + guard shape.count == 4, shape[0] == 1, shape[3] == 1 else { + throw BlurDiscriminatorError.unexpectedOutput + } + let outputHeight = shape[1] + let outputWidth = shape[2] + + let fullPixels = try grayscalePixels(from: multiArray, count: outputWidth * outputHeight) + + // Crop the padded region back out so the blur map matches the original image's aspect ratio. + let cropped = BlurMapGeometry.croppedSize(outputWidth: outputWidth, + outputHeight: outputHeight, + originalWidth: originalWidth, + originalHeight: originalHeight) + let pixels = BlurMapGeometry.cropTopLeft(fullPixels, + sourceWidth: outputWidth, + cropWidth: cropped.width, + cropHeight: cropped.height) + + guard let blurMap = BlurMapRenderer.makeBlurMap(grayscaledPixels: pixels, + width: cropped.width, + height: cropped.height) else { + throw BlurDiscriminatorError.unexpectedOutput + } + return BlurObservation(blurMap: blurMap, grayscaledPixels: pixels) + } + + /// Reads the sigmoid map without the per-element `multiArray[index]` + /// subscript, which bridges an NSNumber for every one of the 50k pixels. + /// The scoped buffer accessors replace the deprecated `dataPointer` and + /// keep the pointer's lifetime bounded to the closure. + private func grayscalePixels(from multiArray: MLMultiArray, count: Int) throws -> [UInt8] { + switch multiArray.dataType { + case .float32: + return multiArray.withUnsafeBufferPointer(ofType: Float.self) { + PixelConverter.floatToUInt8($0) + } + + case .float16: + // Widen to Float32 with vImage, then reuse vDSP. (Swift's `Float16` + // is unavailable on x86_64, so go through raw bytes + vImage.) + let floats = try multiArray.withUnsafeBytes { raw -> [Float] in + var floats = [Float](repeating: 0, count: count) + var source = vImage_Buffer(data: UnsafeMutableRawPointer(mutating: raw.baseAddress), + height: 1, + width: vImagePixelCount(count), + rowBytes: count * MemoryLayout.stride) + let error = floats.withUnsafeMutableBytes { destinationRaw -> vImage_Error in + var destination = vImage_Buffer(data: destinationRaw.baseAddress, + height: 1, + width: vImagePixelCount(count), + rowBytes: count * MemoryLayout.stride) + return vImageConvert_Planar16FtoPlanarF(&source, &destination, vImage_Flags(kvImageNoFlags)) + } + guard error == kvImageNoError else { + throw BlurDiscriminatorError.unexpectedOutput + } + return floats + } + return PixelConverter.floatToUInt8(floats) + + default: + // Rare fallback (e.g. .double): slower NSNumber access, but correct. + var floats = [Float](repeating: 0, count: count) + for index in 0.. BlurObservation? { - // The uint8 model emits one byte per pixel (sigmoid output, scale 1/256), - // which maps directly onto an 8-bit grayscale image. - guard data.count >= inputWidth * inputHeight, - originImageWidth > 0, originImageHeight > 0 - else { - return nil - } - - let pixels = [UInt8](data.prefix(inputWidth * inputHeight)) - - let cropWidth: Int - let cropHeight: Int - if originImageWidth > originImageHeight { - cropWidth = inputWidth - cropHeight = Int(Float(inputHeight) * Float(originImageHeight) / Float(originImageWidth)) - } else if originImageWidth < originImageHeight { - cropWidth = Int(Float(inputWidth) * Float(originImageWidth) / Float(originImageHeight)) - cropHeight = inputHeight - } else { - cropWidth = inputWidth - cropHeight = inputHeight - } - - let croppedPixels = cropPixels(pixels, cropWidth: cropWidth, cropHeight: cropHeight) - - guard let blurMap = makeGrayscaleImage(pixels: croppedPixels, width: cropWidth, height: cropHeight) else { - return nil - } - - return BlurObservation(blurMap: blurMap, grayscaledPixels: croppedPixels) - } - - private func cropPixels(_ pixels: [UInt8], cropWidth: Int, cropHeight: Int) -> [UInt8] { - guard cropWidth != inputWidth || cropHeight != inputHeight else { return pixels } - - var cropped = [UInt8]() - cropped.reserveCapacity(cropWidth * cropHeight) - for row in 0.. CGImage? { - guard width > 0, height > 0, - let dataProvider = CGDataProvider(data: Data(pixels) as CFData) - else { - return nil - } - - return CGImage(width: width, - height: height, - bitsPerComponent: 8, - bitsPerPixel: 8, - bytesPerRow: width, - space: CGColorSpaceCreateDeviceGray(), - bitmapInfo: CGBitmapInfo(rawValue: CGImageAlphaInfo.none.rawValue), - provider: dataProvider, - decode: nil, - shouldInterpolate: false, - intent: .defaultIntent) - } -} diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/InputConverter.swift b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/InputConverter.swift deleted file mode 100644 index 0c6b045..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/InputConverter.swift +++ /dev/null @@ -1,14 +0,0 @@ -// -// InputConverter.swift -// BlurDiscriminatorKit -// -// Created by syjdev on 2021/10/06. -// - -import Foundation -import CoreGraphics - - -internal protocol InputConverter: AnyObject { - func convert(cgImage: CGImage) -> Data? -} diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/OutputConverter.swift b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/OutputConverter.swift deleted file mode 100644 index 52da17e..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/OutputConverter.swift +++ /dev/null @@ -1,13 +0,0 @@ -// -// OutputConverter.swift -// BlurDiscriminatorKit -// -// Created by syjdev on 2021/11/03. -// - -import Foundation - - -internal protocol OutputConverter: AnyObject { - func convert(data: Data, originImageWidth: Int, originImageHeight: Int) -> BlurObservation? -} diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/RGBConverter.swift b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/RGBConverter.swift deleted file mode 100644 index c61e55e..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/RGBConverter.swift +++ /dev/null @@ -1,51 +0,0 @@ -// -// RGBConverter.swift -// BlurDiscriminatorKit -// -// Created by syjdev on 2021/10/06. -// - -import Foundation -import CoreGraphics -import Accelerate - - -internal final class RGBConverter: InputConverter { - private let inputWidth: Int - private let inputHeight: Int - - - internal init(inputWidth: Int, inputHeight: Int) { - self.inputWidth = inputWidth - self.inputHeight = inputHeight - } - - - internal func convert(cgImage: CGImage) -> Data? { - guard let context = cgImage.makeAspectFitPaddedContext(width: inputWidth, height: inputHeight), - let baseAddress = context.data - else { - return nil - } - - var sourceBuffer = vImage_Buffer(data: baseAddress, - height: vImagePixelCount(inputHeight), - width: vImagePixelCount(inputWidth), - rowBytes: context.bytesPerRow) - - // The uint8 model quantizes the input with scale 1/255 and zero point 0, - // so raw pixel values are already the quantized representation. - var pixelData = [UInt8](repeating: 0, count: inputWidth * inputHeight * 3) - let conversionError = pixelData.withUnsafeMutableBytes { rawBufferPointer -> vImage_Error in - var destinationBuffer = vImage_Buffer(data: rawBufferPointer.baseAddress, - height: vImagePixelCount(inputHeight), - width: vImagePixelCount(inputWidth), - rowBytes: inputWidth * 3) - return vImageConvert_ARGB8888toRGB888(&sourceBuffer, &destinationBuffer, vImage_Flags(kvImageNoFlags)) - } - - guard conversionError == kvImageNoError else { return nil } - - return Data(pixelData) - } -} diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/base.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/base.h deleted file mode 100644 index 9557380..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/base.h +++ /dev/null @@ -1,398 +0,0 @@ -#ifndef FLATBUFFERS_BASE_H_ -#define FLATBUFFERS_BASE_H_ - -// clang-format off - -// If activate should be declared and included first. -#if defined(FLATBUFFERS_MEMORY_LEAK_TRACKING) && \ - defined(_MSC_VER) && defined(_DEBUG) - // The _CRTDBG_MAP_ALLOC inside will replace - // calloc/free (etc) to its debug version using #define directives. - #define _CRTDBG_MAP_ALLOC - #include - #include - // Replace operator new by trace-enabled version. - #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) - #define new DEBUG_NEW -#endif - -#if !defined(FLATBUFFERS_ASSERT) -#include -#define FLATBUFFERS_ASSERT assert -#elif defined(FLATBUFFERS_ASSERT_INCLUDE) -// Include file with forward declaration -#include FLATBUFFERS_ASSERT_INCLUDE -#endif - -#ifndef ARDUINO -#include -#endif - -#include -#include -#include - -#if defined(ARDUINO) && !defined(ARDUINOSTL_M_H) - #include -#else - #include -#endif - -#include -#include -#include -#include -#include -#include -#include - -#ifdef _STLPORT_VERSION - #define FLATBUFFERS_CPP98_STL -#endif -#ifndef FLATBUFFERS_CPP98_STL - #include -#endif - -#include "flatbuffers/stl_emulation.h" - -#if defined(__ICCARM__) -#include -#endif - -// Note the __clang__ check is needed, because clang presents itself -// as an older GNUC compiler (4.2). -// Clang 3.3 and later implement all of the ISO C++ 2011 standard. -// Clang 3.4 and later implement all of the ISO C++ 2014 standard. -// http://clang.llvm.org/cxx_status.html - -// Note the MSVC value '__cplusplus' may be incorrect: -// The '__cplusplus' predefined macro in the MSVC stuck at the value 199711L, -// indicating (erroneously!) that the compiler conformed to the C++98 Standard. -// This value should be correct starting from MSVC2017-15.7-Preview-3. -// The '__cplusplus' will be valid only if MSVC2017-15.7-P3 and the `/Zc:__cplusplus` switch is set. -// Workaround (for details see MSDN): -// Use the _MSC_VER and _MSVC_LANG definition instead of the __cplusplus for compatibility. -// The _MSVC_LANG macro reports the Standard version regardless of the '/Zc:__cplusplus' switch. - -#if defined(__GNUC__) && !defined(__clang__) - #define FLATBUFFERS_GCC (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__) -#else - #define FLATBUFFERS_GCC 0 -#endif - -#if defined(__clang__) - #define FLATBUFFERS_CLANG (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__) -#else - #define FLATBUFFERS_CLANG 0 -#endif - -/// @cond FLATBUFFERS_INTERNAL -#if __cplusplus <= 199711L && \ - (!defined(_MSC_VER) || _MSC_VER < 1600) && \ - (!defined(__GNUC__) || \ - (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 40400)) - #error A C++11 compatible compiler with support for the auto typing is \ - required for FlatBuffers. - #error __cplusplus _MSC_VER __GNUC__ __GNUC_MINOR__ __GNUC_PATCHLEVEL__ -#endif - -#if !defined(__clang__) && \ - defined(__GNUC__) && \ - (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__ < 40600) - // Backwards compatibility for g++ 4.4, and 4.5 which don't have the nullptr - // and constexpr keywords. Note the __clang__ check is needed, because clang - // presents itself as an older GNUC compiler. - #ifndef nullptr_t - const class nullptr_t { - public: - template inline operator T*() const { return 0; } - private: - void operator&() const; - } nullptr = {}; - #endif - #ifndef constexpr - #define constexpr const - #endif -#endif - -// The wire format uses a little endian encoding (since that's efficient for -// the common platforms). -#if defined(__s390x__) - #define FLATBUFFERS_LITTLEENDIAN 0 -#endif // __s390x__ -#if !defined(FLATBUFFERS_LITTLEENDIAN) - #if defined(__GNUC__) || defined(__clang__) || defined(__ICCARM__) - #if (defined(__BIG_ENDIAN__) || \ - (defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__)) - #define FLATBUFFERS_LITTLEENDIAN 0 - #else - #define FLATBUFFERS_LITTLEENDIAN 1 - #endif // __BIG_ENDIAN__ - #elif defined(_MSC_VER) - #if defined(_M_PPC) - #define FLATBUFFERS_LITTLEENDIAN 0 - #else - #define FLATBUFFERS_LITTLEENDIAN 1 - #endif - #else - #error Unable to determine endianness, define FLATBUFFERS_LITTLEENDIAN. - #endif -#endif // !defined(FLATBUFFERS_LITTLEENDIAN) - -#define FLATBUFFERS_VERSION_MAJOR 1 -#define FLATBUFFERS_VERSION_MINOR 12 -#define FLATBUFFERS_VERSION_REVISION 0 -#define FLATBUFFERS_STRING_EXPAND(X) #X -#define FLATBUFFERS_STRING(X) FLATBUFFERS_STRING_EXPAND(X) -namespace flatbuffers { - // Returns version as string "MAJOR.MINOR.REVISION". - const char* FLATBUFFERS_VERSION(); -} - -#if (!defined(_MSC_VER) || _MSC_VER > 1600) && \ - (!defined(__GNUC__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 407)) || \ - defined(__clang__) - #define FLATBUFFERS_FINAL_CLASS final - #define FLATBUFFERS_OVERRIDE override - #define FLATBUFFERS_VTABLE_UNDERLYING_TYPE : flatbuffers::voffset_t -#else - #define FLATBUFFERS_FINAL_CLASS - #define FLATBUFFERS_OVERRIDE - #define FLATBUFFERS_VTABLE_UNDERLYING_TYPE -#endif - -#if (!defined(_MSC_VER) || _MSC_VER >= 1900) && \ - (!defined(__GNUC__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)) || \ - (defined(__cpp_constexpr) && __cpp_constexpr >= 200704) - #define FLATBUFFERS_CONSTEXPR constexpr -#else - #define FLATBUFFERS_CONSTEXPR const -#endif - -#if (defined(__cplusplus) && __cplusplus >= 201402L) || \ - (defined(__cpp_constexpr) && __cpp_constexpr >= 201304) - #define FLATBUFFERS_CONSTEXPR_CPP14 FLATBUFFERS_CONSTEXPR -#else - #define FLATBUFFERS_CONSTEXPR_CPP14 -#endif - -#if (defined(__GXX_EXPERIMENTAL_CXX0X__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 406)) || \ - (defined(_MSC_FULL_VER) && (_MSC_FULL_VER >= 190023026)) || \ - defined(__clang__) - #define FLATBUFFERS_NOEXCEPT noexcept -#else - #define FLATBUFFERS_NOEXCEPT -#endif - -// NOTE: the FLATBUFFERS_DELETE_FUNC macro may change the access mode to -// private, so be sure to put it at the end or reset access mode explicitly. -#if (!defined(_MSC_VER) || _MSC_FULL_VER >= 180020827) && \ - (!defined(__GNUC__) || (__GNUC__ * 100 + __GNUC_MINOR__ >= 404)) || \ - defined(__clang__) - #define FLATBUFFERS_DELETE_FUNC(func) func = delete; -#else - #define FLATBUFFERS_DELETE_FUNC(func) private: func; -#endif - -#ifndef FLATBUFFERS_HAS_STRING_VIEW - // Only provide flatbuffers::string_view if __has_include can be used - // to detect a header that provides an implementation - #if defined(__has_include) - // Check for std::string_view (in c++17) - #if __has_include() && (__cplusplus >= 201606 || (defined(_HAS_CXX17) && _HAS_CXX17)) - #include - namespace flatbuffers { - typedef std::string_view string_view; - } - #define FLATBUFFERS_HAS_STRING_VIEW 1 - // Check for std::experimental::string_view (in c++14, compiler-dependent) - #elif __has_include() && (__cplusplus >= 201411) - #include - namespace flatbuffers { - typedef std::experimental::string_view string_view; - } - #define FLATBUFFERS_HAS_STRING_VIEW 1 - // Check for absl::string_view - #elif __has_include("absl/strings/string_view.h") - #include "absl/strings/string_view.h" - namespace flatbuffers { - typedef absl::string_view string_view; - } - #define FLATBUFFERS_HAS_STRING_VIEW 1 - #endif - #endif // __has_include -#endif // !FLATBUFFERS_HAS_STRING_VIEW - -#ifndef FLATBUFFERS_HAS_NEW_STRTOD - // Modern (C++11) strtod and strtof functions are available for use. - // 1) nan/inf strings as argument of strtod; - // 2) hex-float as argument of strtod/strtof. - #if (defined(_MSC_VER) && _MSC_VER >= 1900) || \ - (defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409)) || \ - (defined(__clang__)) - #define FLATBUFFERS_HAS_NEW_STRTOD 1 - #endif -#endif // !FLATBUFFERS_HAS_NEW_STRTOD - -#ifndef FLATBUFFERS_LOCALE_INDEPENDENT - // Enable locale independent functions {strtof_l, strtod_l,strtoll_l, strtoull_l}. - // They are part of the POSIX-2008 but not part of the C/C++ standard. - // GCC/Clang have definition (_XOPEN_SOURCE>=700) if POSIX-2008. - #if ((defined(_MSC_VER) && _MSC_VER >= 1800) || \ - (defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE>=700))) - #define FLATBUFFERS_LOCALE_INDEPENDENT 1 - #else - #define FLATBUFFERS_LOCALE_INDEPENDENT 0 - #endif -#endif // !FLATBUFFERS_LOCALE_INDEPENDENT - -// Suppress Undefined Behavior Sanitizer (recoverable only). Usage: -// - __supress_ubsan__("undefined") -// - __supress_ubsan__("signed-integer-overflow") -#if defined(__clang__) && (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >=7)) - #define __supress_ubsan__(type) __attribute__((no_sanitize(type))) -#elif defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 409) - #define __supress_ubsan__(type) __attribute__((no_sanitize_undefined)) -#else - #define __supress_ubsan__(type) -#endif - -// This is constexpr function used for checking compile-time constants. -// Avoid `#pragma warning(disable: 4127) // C4127: expression is constant`. -template FLATBUFFERS_CONSTEXPR inline bool IsConstTrue(T t) { - return !!t; -} - -// Enable C++ attribute [[]] if std:c++17 or higher. -#if ((__cplusplus >= 201703L) \ - || (defined(_MSVC_LANG) && (_MSVC_LANG >= 201703L))) - // All attributes unknown to an implementation are ignored without causing an error. - #define FLATBUFFERS_ATTRIBUTE(attr) [[attr]] - - #define FLATBUFFERS_FALLTHROUGH() [[fallthrough]] -#else - #define FLATBUFFERS_ATTRIBUTE(attr) - - #if FLATBUFFERS_CLANG >= 30800 - #define FLATBUFFERS_FALLTHROUGH() [[clang::fallthrough]] - #elif FLATBUFFERS_GCC >= 70300 - #define FLATBUFFERS_FALLTHROUGH() [[gnu::fallthrough]] - #else - #define FLATBUFFERS_FALLTHROUGH() - #endif -#endif - -/// @endcond - -/// @file -namespace flatbuffers { - -/// @cond FLATBUFFERS_INTERNAL -// Our default offset / size type, 32bit on purpose on 64bit systems. -// Also, using a consistent offset type maintains compatibility of serialized -// offset values between 32bit and 64bit systems. -typedef uint32_t uoffset_t; - -// Signed offsets for references that can go in both directions. -typedef int32_t soffset_t; - -// Offset/index used in v-tables, can be changed to uint8_t in -// format forks to save a bit of space if desired. -typedef uint16_t voffset_t; - -typedef uintmax_t largest_scalar_t; - -// In 32bits, this evaluates to 2GB - 1 -#define FLATBUFFERS_MAX_BUFFER_SIZE ((1ULL << (sizeof(::flatbuffers::soffset_t) * 8 - 1)) - 1) - -// We support aligning the contents of buffers up to this size. -#define FLATBUFFERS_MAX_ALIGNMENT 16 - -#if defined(_MSC_VER) - #pragma warning(push) - #pragma warning(disable: 4127) // C4127: conditional expression is constant -#endif - -template T EndianSwap(T t) { - #if defined(_MSC_VER) - #define FLATBUFFERS_BYTESWAP16 _byteswap_ushort - #define FLATBUFFERS_BYTESWAP32 _byteswap_ulong - #define FLATBUFFERS_BYTESWAP64 _byteswap_uint64 - #elif defined(__ICCARM__) - #define FLATBUFFERS_BYTESWAP16 __REV16 - #define FLATBUFFERS_BYTESWAP32 __REV - #define FLATBUFFERS_BYTESWAP64(x) \ - ((__REV(static_cast(x >> 32U))) | (static_cast(__REV(static_cast(x)))) << 32U) - #else - #if defined(__GNUC__) && __GNUC__ * 100 + __GNUC_MINOR__ < 408 && !defined(__clang__) - // __builtin_bswap16 was missing prior to GCC 4.8. - #define FLATBUFFERS_BYTESWAP16(x) \ - static_cast(__builtin_bswap32(static_cast(x) << 16)) - #else - #define FLATBUFFERS_BYTESWAP16 __builtin_bswap16 - #endif - #define FLATBUFFERS_BYTESWAP32 __builtin_bswap32 - #define FLATBUFFERS_BYTESWAP64 __builtin_bswap64 - #endif - if (sizeof(T) == 1) { // Compile-time if-then's. - return t; - } else if (sizeof(T) == 2) { - union { T t; uint16_t i; } u = { t }; - u.i = FLATBUFFERS_BYTESWAP16(u.i); - return u.t; - } else if (sizeof(T) == 4) { - union { T t; uint32_t i; } u = { t }; - u.i = FLATBUFFERS_BYTESWAP32(u.i); - return u.t; - } else if (sizeof(T) == 8) { - union { T t; uint64_t i; } u = { t }; - u.i = FLATBUFFERS_BYTESWAP64(u.i); - return u.t; - } else { - FLATBUFFERS_ASSERT(0); - return t; - } -} - -#if defined(_MSC_VER) - #pragma warning(pop) -#endif - - -template T EndianScalar(T t) { - #if FLATBUFFERS_LITTLEENDIAN - return t; - #else - return EndianSwap(t); - #endif -} - -template -// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details. -__supress_ubsan__("alignment") -T ReadScalar(const void *p) { - return EndianScalar(*reinterpret_cast(p)); -} - -template -// UBSAN: C++ aliasing type rules, see std::bit_cast<> for details. -__supress_ubsan__("alignment") -void WriteScalar(void *p, T t) { - *reinterpret_cast(p) = EndianScalar(t); -} - -template struct Offset; -template __supress_ubsan__("alignment") void WriteScalar(void *p, Offset t) { - *reinterpret_cast(p) = EndianScalar(t.o); -} - -// Computes how many bytes you'd have to pad to be able to write an -// "scalar_size" scalar if the buffer had grown to "buf_size" (downwards in -// memory). -__supress_ubsan__("unsigned-integer-overflow") -inline size_t PaddingBytes(size_t buf_size, size_t scalar_size) { - return ((~buf_size) + 1) & (scalar_size - 1); -} - -} // namespace flatbuffers -#endif // FLATBUFFERS_BASE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/code_generators.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/code_generators.h deleted file mode 100644 index bccd9fe..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/code_generators.h +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright 2014 Google Inc. 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 FLATBUFFERS_CODE_GENERATORS_H_ -#define FLATBUFFERS_CODE_GENERATORS_H_ - -#include -#include - -#include "flatbuffers/idl.h" - -namespace flatbuffers { - -// Utility class to assist in generating code through use of text templates. -// -// Example code: -// CodeWriter code("\t"); -// code.SetValue("NAME", "Foo"); -// code += "void {{NAME}}() { printf("%s", "{{NAME}}"); }"; -// code.SetValue("NAME", "Bar"); -// code += "void {{NAME}}() { printf("%s", "{{NAME}}"); }"; -// std::cout << code.ToString() << std::endl; -// -// Output: -// void Foo() { printf("%s", "Foo"); } -// void Bar() { printf("%s", "Bar"); } -class CodeWriter { - public: - CodeWriter(std::string pad = std::string()) - : pad_(pad), cur_ident_lvl_(0), ignore_ident_(false) {} - - // Clears the current "written" code. - void Clear() { - stream_.str(""); - stream_.clear(); - } - - // Associates a key with a value. All subsequent calls to operator+=, where - // the specified key is contained in {{ and }} delimiters will be replaced by - // the given value. - void SetValue(const std::string &key, const std::string &value) { - value_map_[key] = value; - } - - std::string GetValue(const std::string &key) const { - const auto it = value_map_.find(key); - return it == value_map_.end() ? "" : it->second; - } - - // Appends the given text to the generated code as well as a newline - // character. Any text within {{ and }} delimeters is replaced by values - // previously stored in the CodeWriter by calling SetValue above. The newline - // will be suppressed if the text ends with the \\ character. - void operator+=(std::string text); - - // Returns the current contents of the CodeWriter as a std::string. - std::string ToString() const { return stream_.str(); } - - // Increase ident level for writing code - void IncrementIdentLevel() { cur_ident_lvl_++; } - // Decrease ident level for writing code - void DecrementIdentLevel() { - if (cur_ident_lvl_) cur_ident_lvl_--; - } - - private: - std::map value_map_; - std::stringstream stream_; - std::string pad_; - int cur_ident_lvl_; - bool ignore_ident_; - - // Add ident padding (tab or space) based on ident level - void AppendIdent(std::stringstream &stream); -}; - -class BaseGenerator { - public: - virtual bool generate() = 0; - - static std::string NamespaceDir(const Parser &parser, const std::string &path, - const Namespace &ns); - - std::string GeneratedFileName(const std::string &path, - const std::string &file_name, - const IDLOptions &options) const; - - protected: - BaseGenerator(const Parser &parser, const std::string &path, - const std::string &file_name, std::string qualifying_start, - std::string qualifying_separator, std::string default_extension) - : parser_(parser), - path_(path), - file_name_(file_name), - qualifying_start_(qualifying_start), - qualifying_separator_(qualifying_separator), - default_extension_(default_extension) {} - virtual ~BaseGenerator() {} - - // No copy/assign. - BaseGenerator &operator=(const BaseGenerator &); - BaseGenerator(const BaseGenerator &); - - std::string NamespaceDir(const Namespace &ns) const; - - static const char *FlatBuffersGeneratedWarning(); - - static std::string FullNamespace(const char *separator, const Namespace &ns); - - static std::string LastNamespacePart(const Namespace &ns); - - // tracks the current namespace for early exit in WrapInNameSpace - // c++, java and csharp returns a different namespace from - // the following default (no early exit, always fully qualify), - // which works for js and php - virtual const Namespace *CurrentNameSpace() const { return nullptr; } - - // Ensure that a type is prefixed with its namespace even within - // its own namespace to avoid conflict between generated method - // names and similarly named classes or structs - std::string WrapInNameSpace(const Namespace *ns, - const std::string &name) const; - - std::string WrapInNameSpace(const Definition &def) const; - - std::string GetNameSpace(const Definition &def) const; - - const Parser &parser_; - const std::string &path_; - const std::string &file_name_; - const std::string qualifying_start_; - const std::string qualifying_separator_; - const std::string default_extension_; -}; - -struct CommentConfig { - const char *first_line; - const char *content_line_prefix; - const char *last_line; -}; - -extern void GenComment(const std::vector &dc, - std::string *code_ptr, const CommentConfig *config, - const char *prefix = ""); - -class FloatConstantGenerator { - public: - virtual ~FloatConstantGenerator() {} - std::string GenFloatConstant(const FieldDef &field) const; - - private: - virtual std::string Value(double v, const std::string &src) const = 0; - virtual std::string Inf(double v) const = 0; - virtual std::string NaN(double v) const = 0; - - virtual std::string Value(float v, const std::string &src) const = 0; - virtual std::string Inf(float v) const = 0; - virtual std::string NaN(float v) const = 0; - - template - std::string GenFloatConstantImpl(const FieldDef &field) const; -}; - -class SimpleFloatConstantGenerator : public FloatConstantGenerator { - public: - SimpleFloatConstantGenerator(const char *nan_number, - const char *pos_inf_number, - const char *neg_inf_number); - - private: - std::string Value(double v, - const std::string &src) const FLATBUFFERS_OVERRIDE; - std::string Inf(double v) const FLATBUFFERS_OVERRIDE; - std::string NaN(double v) const FLATBUFFERS_OVERRIDE; - - std::string Value(float v, const std::string &src) const FLATBUFFERS_OVERRIDE; - std::string Inf(float v) const FLATBUFFERS_OVERRIDE; - std::string NaN(float v) const FLATBUFFERS_OVERRIDE; - - const std::string nan_number_; - const std::string pos_inf_number_; - const std::string neg_inf_number_; -}; - -// C++, C#, Java like generator. -class TypedFloatConstantGenerator : public FloatConstantGenerator { - public: - TypedFloatConstantGenerator(const char *double_prefix, - const char *single_prefix, const char *nan_number, - const char *pos_inf_number, - const char *neg_inf_number = ""); - - private: - std::string Value(double v, - const std::string &src) const FLATBUFFERS_OVERRIDE; - std::string Inf(double v) const FLATBUFFERS_OVERRIDE; - - std::string NaN(double v) const FLATBUFFERS_OVERRIDE; - - std::string Value(float v, const std::string &src) const FLATBUFFERS_OVERRIDE; - std::string Inf(float v) const FLATBUFFERS_OVERRIDE; - std::string NaN(float v) const FLATBUFFERS_OVERRIDE; - - std::string MakeNaN(const std::string &prefix) const; - std::string MakeInf(bool neg, const std::string &prefix) const; - - const std::string double_prefix_; - const std::string single_prefix_; - const std::string nan_number_; - const std::string pos_inf_number_; - const std::string neg_inf_number_; -}; - -} // namespace flatbuffers - -#endif // FLATBUFFERS_CODE_GENERATORS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/flatbuffers.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/flatbuffers.h deleted file mode 100644 index c4dc5bc..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/flatbuffers.h +++ /dev/null @@ -1,2783 +0,0 @@ -/* - * Copyright 2014 Google Inc. 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 FLATBUFFERS_H_ -#define FLATBUFFERS_H_ - -#include "flatbuffers/base.h" - -#if defined(FLATBUFFERS_NAN_DEFAULTS) -# include -#endif - -namespace flatbuffers { -// Generic 'operator==' with conditional specialisations. -// T e - new value of a scalar field. -// T def - default of scalar (is known at compile-time). -template inline bool IsTheSameAs(T e, T def) { return e == def; } - -#if defined(FLATBUFFERS_NAN_DEFAULTS) && \ - defined(FLATBUFFERS_HAS_NEW_STRTOD) && (FLATBUFFERS_HAS_NEW_STRTOD > 0) -// Like `operator==(e, def)` with weak NaN if T=(float|double). -template inline bool IsFloatTheSameAs(T e, T def) { - return (e == def) || ((def != def) && (e != e)); -} -template<> inline bool IsTheSameAs(float e, float def) { - return IsFloatTheSameAs(e, def); -} -template<> inline bool IsTheSameAs(double e, double def) { - return IsFloatTheSameAs(e, def); -} -#endif - -// Check 'v' is out of closed range [low; high]. -// Workaround for GCC warning [-Werror=type-limits]: -// comparison is always true due to limited range of data type. -template -inline bool IsOutRange(const T &v, const T &low, const T &high) { - return (v < low) || (high < v); -} - -// Check 'v' is in closed range [low; high]. -template -inline bool IsInRange(const T &v, const T &low, const T &high) { - return !IsOutRange(v, low, high); -} - -// Wrapper for uoffset_t to allow safe template specialization. -// Value is allowed to be 0 to indicate a null object (see e.g. AddOffset). -template struct Offset { - uoffset_t o; - Offset() : o(0) {} - Offset(uoffset_t _o) : o(_o) {} - Offset Union() const { return Offset(o); } - bool IsNull() const { return !o; } -}; - -inline void EndianCheck() { - int endiantest = 1; - // If this fails, see FLATBUFFERS_LITTLEENDIAN above. - FLATBUFFERS_ASSERT(*reinterpret_cast(&endiantest) == - FLATBUFFERS_LITTLEENDIAN); - (void)endiantest; -} - -template FLATBUFFERS_CONSTEXPR size_t AlignOf() { - // clang-format off - #ifdef _MSC_VER - return __alignof(T); - #else - #ifndef alignof - return __alignof__(T); - #else - return alignof(T); - #endif - #endif - // clang-format on -} - -// When we read serialized data from memory, in the case of most scalars, -// we want to just read T, but in the case of Offset, we want to actually -// perform the indirection and return a pointer. -// The template specialization below does just that. -// It is wrapped in a struct since function templates can't overload on the -// return type like this. -// The typedef is for the convenience of callers of this function -// (avoiding the need for a trailing return decltype) -template struct IndirectHelper { - typedef T return_type; - typedef T mutable_return_type; - static const size_t element_stride = sizeof(T); - static return_type Read(const uint8_t *p, uoffset_t i) { - return EndianScalar((reinterpret_cast(p))[i]); - } -}; -template struct IndirectHelper> { - typedef const T *return_type; - typedef T *mutable_return_type; - static const size_t element_stride = sizeof(uoffset_t); - static return_type Read(const uint8_t *p, uoffset_t i) { - p += i * sizeof(uoffset_t); - return reinterpret_cast(p + ReadScalar(p)); - } -}; -template struct IndirectHelper { - typedef const T *return_type; - typedef T *mutable_return_type; - static const size_t element_stride = sizeof(T); - static return_type Read(const uint8_t *p, uoffset_t i) { - return reinterpret_cast(p + i * sizeof(T)); - } -}; - -// An STL compatible iterator implementation for Vector below, effectively -// calling Get() for every element. -template struct VectorIterator { - typedef std::random_access_iterator_tag iterator_category; - typedef IT value_type; - typedef ptrdiff_t difference_type; - typedef IT *pointer; - typedef IT &reference; - - VectorIterator(const uint8_t *data, uoffset_t i) - : data_(data + IndirectHelper::element_stride * i) {} - VectorIterator(const VectorIterator &other) : data_(other.data_) {} - VectorIterator() : data_(nullptr) {} - - VectorIterator &operator=(const VectorIterator &other) { - data_ = other.data_; - return *this; - } - - // clang-format off - #if !defined(FLATBUFFERS_CPP98_STL) - VectorIterator &operator=(VectorIterator &&other) { - data_ = other.data_; - return *this; - } - #endif // !defined(FLATBUFFERS_CPP98_STL) - // clang-format on - - bool operator==(const VectorIterator &other) const { - return data_ == other.data_; - } - - bool operator<(const VectorIterator &other) const { - return data_ < other.data_; - } - - bool operator!=(const VectorIterator &other) const { - return data_ != other.data_; - } - - difference_type operator-(const VectorIterator &other) const { - return (data_ - other.data_) / IndirectHelper::element_stride; - } - - IT operator*() const { return IndirectHelper::Read(data_, 0); } - - IT operator->() const { return IndirectHelper::Read(data_, 0); } - - VectorIterator &operator++() { - data_ += IndirectHelper::element_stride; - return *this; - } - - VectorIterator operator++(int) { - VectorIterator temp(data_, 0); - data_ += IndirectHelper::element_stride; - return temp; - } - - VectorIterator operator+(const uoffset_t &offset) const { - return VectorIterator(data_ + offset * IndirectHelper::element_stride, - 0); - } - - VectorIterator &operator+=(const uoffset_t &offset) { - data_ += offset * IndirectHelper::element_stride; - return *this; - } - - VectorIterator &operator--() { - data_ -= IndirectHelper::element_stride; - return *this; - } - - VectorIterator operator--(int) { - VectorIterator temp(data_, 0); - data_ -= IndirectHelper::element_stride; - return temp; - } - - VectorIterator operator-(const uoffset_t &offset) const { - return VectorIterator(data_ - offset * IndirectHelper::element_stride, - 0); - } - - VectorIterator &operator-=(const uoffset_t &offset) { - data_ -= offset * IndirectHelper::element_stride; - return *this; - } - - private: - const uint8_t *data_; -}; - -template -struct VectorReverseIterator : public std::reverse_iterator { - explicit VectorReverseIterator(Iterator iter) - : std::reverse_iterator(iter) {} - - typename Iterator::value_type operator*() const { - return *(std::reverse_iterator::current); - } - - typename Iterator::value_type operator->() const { - return *(std::reverse_iterator::current); - } -}; - -struct String; - -// This is used as a helper type for accessing vectors. -// Vector::data() assumes the vector elements start after the length field. -template class Vector { - public: - typedef VectorIterator::mutable_return_type> - iterator; - typedef VectorIterator::return_type> - const_iterator; - typedef VectorReverseIterator reverse_iterator; - typedef VectorReverseIterator const_reverse_iterator; - - uoffset_t size() const { return EndianScalar(length_); } - - // Deprecated: use size(). Here for backwards compatibility. - FLATBUFFERS_ATTRIBUTE(deprecated("use size() instead")) - uoffset_t Length() const { return size(); } - - typedef typename IndirectHelper::return_type return_type; - typedef typename IndirectHelper::mutable_return_type mutable_return_type; - - return_type Get(uoffset_t i) const { - FLATBUFFERS_ASSERT(i < size()); - return IndirectHelper::Read(Data(), i); - } - - return_type operator[](uoffset_t i) const { return Get(i); } - - // If this is a Vector of enums, T will be its storage type, not the enum - // type. This function makes it convenient to retrieve value with enum - // type E. - template E GetEnum(uoffset_t i) const { - return static_cast(Get(i)); - } - - // If this a vector of unions, this does the cast for you. There's no check - // to make sure this is the right type! - template const U *GetAs(uoffset_t i) const { - return reinterpret_cast(Get(i)); - } - - // If this a vector of unions, this does the cast for you. There's no check - // to make sure this is actually a string! - const String *GetAsString(uoffset_t i) const { - return reinterpret_cast(Get(i)); - } - - const void *GetStructFromOffset(size_t o) const { - return reinterpret_cast(Data() + o); - } - - iterator begin() { return iterator(Data(), 0); } - const_iterator begin() const { return const_iterator(Data(), 0); } - - iterator end() { return iterator(Data(), size()); } - const_iterator end() const { return const_iterator(Data(), size()); } - - reverse_iterator rbegin() { return reverse_iterator(end() - 1); } - const_reverse_iterator rbegin() const { - return const_reverse_iterator(end() - 1); - } - - reverse_iterator rend() { return reverse_iterator(begin() - 1); } - const_reverse_iterator rend() const { - return const_reverse_iterator(begin() - 1); - } - - const_iterator cbegin() const { return begin(); } - - const_iterator cend() const { return end(); } - - const_reverse_iterator crbegin() const { return rbegin(); } - - const_reverse_iterator crend() const { return rend(); } - - // Change elements if you have a non-const pointer to this object. - // Scalars only. See reflection.h, and the documentation. - void Mutate(uoffset_t i, const T &val) { - FLATBUFFERS_ASSERT(i < size()); - WriteScalar(data() + i, val); - } - - // Change an element of a vector of tables (or strings). - // "val" points to the new table/string, as you can obtain from - // e.g. reflection::AddFlatBuffer(). - void MutateOffset(uoffset_t i, const uint8_t *val) { - FLATBUFFERS_ASSERT(i < size()); - static_assert(sizeof(T) == sizeof(uoffset_t), "Unrelated types"); - WriteScalar(data() + i, - static_cast(val - (Data() + i * sizeof(uoffset_t)))); - } - - // Get a mutable pointer to tables/strings inside this vector. - mutable_return_type GetMutableObject(uoffset_t i) const { - FLATBUFFERS_ASSERT(i < size()); - return const_cast(IndirectHelper::Read(Data(), i)); - } - - // The raw data in little endian format. Use with care. - const uint8_t *Data() const { - return reinterpret_cast(&length_ + 1); - } - - uint8_t *Data() { return reinterpret_cast(&length_ + 1); } - - // Similarly, but typed, much like std::vector::data - const T *data() const { return reinterpret_cast(Data()); } - T *data() { return reinterpret_cast(Data()); } - - template return_type LookupByKey(K key) const { - void *search_result = std::bsearch( - &key, Data(), size(), IndirectHelper::element_stride, KeyCompare); - - if (!search_result) { - return nullptr; // Key not found. - } - - const uint8_t *element = reinterpret_cast(search_result); - - return IndirectHelper::Read(element, 0); - } - - protected: - // This class is only used to access pre-existing data. Don't ever - // try to construct these manually. - Vector(); - - uoffset_t length_; - - private: - // This class is a pointer. Copying will therefore create an invalid object. - // Private and unimplemented copy constructor. - Vector(const Vector &); - Vector &operator=(const Vector &); - - template static int KeyCompare(const void *ap, const void *bp) { - const K *key = reinterpret_cast(ap); - const uint8_t *data = reinterpret_cast(bp); - auto table = IndirectHelper::Read(data, 0); - - // std::bsearch compares with the operands transposed, so we negate the - // result here. - return -table->KeyCompareWithValue(*key); - } -}; - -// Represent a vector much like the template above, but in this case we -// don't know what the element types are (used with reflection.h). -class VectorOfAny { - public: - uoffset_t size() const { return EndianScalar(length_); } - - const uint8_t *Data() const { - return reinterpret_cast(&length_ + 1); - } - uint8_t *Data() { return reinterpret_cast(&length_ + 1); } - - protected: - VectorOfAny(); - - uoffset_t length_; - - private: - VectorOfAny(const VectorOfAny &); - VectorOfAny &operator=(const VectorOfAny &); -}; - -#ifndef FLATBUFFERS_CPP98_STL -template -Vector> *VectorCast(Vector> *ptr) { - static_assert(std::is_base_of::value, "Unrelated types"); - return reinterpret_cast> *>(ptr); -} - -template -const Vector> *VectorCast(const Vector> *ptr) { - static_assert(std::is_base_of::value, "Unrelated types"); - return reinterpret_cast> *>(ptr); -} -#endif - -// Convenient helper function to get the length of any vector, regardless -// of whether it is null or not (the field is not set). -template static inline size_t VectorLength(const Vector *v) { - return v ? v->size() : 0; -} - -// This is used as a helper type for accessing arrays. -template class Array { - typedef - typename flatbuffers::integral_constant::value> - scalar_tag; - typedef - typename flatbuffers::conditional::type - IndirectHelperType; - - public: - typedef typename IndirectHelper::return_type return_type; - typedef VectorIterator const_iterator; - typedef VectorReverseIterator const_reverse_iterator; - - FLATBUFFERS_CONSTEXPR uint16_t size() const { return length; } - - return_type Get(uoffset_t i) const { - FLATBUFFERS_ASSERT(i < size()); - return IndirectHelper::Read(Data(), i); - } - - return_type operator[](uoffset_t i) const { return Get(i); } - - // If this is a Vector of enums, T will be its storage type, not the enum - // type. This function makes it convenient to retrieve value with enum - // type E. - template E GetEnum(uoffset_t i) const { - return static_cast(Get(i)); - } - - const_iterator begin() const { return const_iterator(Data(), 0); } - const_iterator end() const { return const_iterator(Data(), size()); } - - const_reverse_iterator rbegin() const { - return const_reverse_iterator(end()); - } - const_reverse_iterator rend() const { return const_reverse_iterator(end()); } - - const_iterator cbegin() const { return begin(); } - const_iterator cend() const { return end(); } - - const_reverse_iterator crbegin() const { return rbegin(); } - const_reverse_iterator crend() const { return rend(); } - - // Get a mutable pointer to elements inside this array. - // This method used to mutate arrays of structs followed by a @p Mutate - // operation. For primitive types use @p Mutate directly. - // @warning Assignments and reads to/from the dereferenced pointer are not - // automatically converted to the correct endianness. - typename flatbuffers::conditional::type - GetMutablePointer(uoffset_t i) const { - FLATBUFFERS_ASSERT(i < size()); - return const_cast(&data()[i]); - } - - // Change elements if you have a non-const pointer to this object. - void Mutate(uoffset_t i, const T &val) { MutateImpl(scalar_tag(), i, val); } - - // The raw data in little endian format. Use with care. - const uint8_t *Data() const { return data_; } - - uint8_t *Data() { return data_; } - - // Similarly, but typed, much like std::vector::data - const T *data() const { return reinterpret_cast(Data()); } - T *data() { return reinterpret_cast(Data()); } - - protected: - void MutateImpl(flatbuffers::integral_constant, uoffset_t i, - const T &val) { - FLATBUFFERS_ASSERT(i < size()); - WriteScalar(data() + i, val); - } - - void MutateImpl(flatbuffers::integral_constant, uoffset_t i, - const T &val) { - *(GetMutablePointer(i)) = val; - } - - // This class is only used to access pre-existing data. Don't ever - // try to construct these manually. - // 'constexpr' allows us to use 'size()' at compile time. - // @note Must not use 'FLATBUFFERS_CONSTEXPR' here, as const is not allowed on - // a constructor. -#if defined(__cpp_constexpr) - constexpr Array(); -#else - Array(); -#endif - - uint8_t data_[length * sizeof(T)]; - - private: - // This class is a pointer. Copying will therefore create an invalid object. - // Private and unimplemented copy constructor. - Array(const Array &); - Array &operator=(const Array &); -}; - -// Specialization for Array[struct] with access using Offset pointer. -// This specialization used by idl_gen_text.cpp. -template class Array, length> { - static_assert(flatbuffers::is_same::value, "unexpected type T"); - - public: - typedef const void *return_type; - - const uint8_t *Data() const { return data_; } - - // Make idl_gen_text.cpp::PrintContainer happy. - return_type operator[](uoffset_t) const { - FLATBUFFERS_ASSERT(false); - return nullptr; - } - - private: - // This class is only used to access pre-existing data. - Array(); - Array(const Array &); - Array &operator=(const Array &); - - uint8_t data_[1]; -}; - -// Lexicographically compare two strings (possibly containing nulls), and -// return true if the first is less than the second. -static inline bool StringLessThan(const char *a_data, uoffset_t a_size, - const char *b_data, uoffset_t b_size) { - const auto cmp = memcmp(a_data, b_data, (std::min)(a_size, b_size)); - return cmp == 0 ? a_size < b_size : cmp < 0; -} - -struct String : public Vector { - const char *c_str() const { return reinterpret_cast(Data()); } - std::string str() const { return std::string(c_str(), size()); } - - // clang-format off - #ifdef FLATBUFFERS_HAS_STRING_VIEW - flatbuffers::string_view string_view() const { - return flatbuffers::string_view(c_str(), size()); - } - #endif // FLATBUFFERS_HAS_STRING_VIEW - // clang-format on - - bool operator<(const String &o) const { - return StringLessThan(this->data(), this->size(), o.data(), o.size()); - } -}; - -// Convenience function to get std::string from a String returning an empty -// string on null pointer. -static inline std::string GetString(const String *str) { - return str ? str->str() : ""; -} - -// Convenience function to get char* from a String returning an empty string on -// null pointer. -static inline const char *GetCstring(const String *str) { - return str ? str->c_str() : ""; -} - -// Allocator interface. This is flatbuffers-specific and meant only for -// `vector_downward` usage. -class Allocator { - public: - virtual ~Allocator() {} - - // Allocate `size` bytes of memory. - virtual uint8_t *allocate(size_t size) = 0; - - // Deallocate `size` bytes of memory at `p` allocated by this allocator. - virtual void deallocate(uint8_t *p, size_t size) = 0; - - // Reallocate `new_size` bytes of memory, replacing the old region of size - // `old_size` at `p`. In contrast to a normal realloc, this grows downwards, - // and is intended specifcally for `vector_downward` use. - // `in_use_back` and `in_use_front` indicate how much of `old_size` is - // actually in use at each end, and needs to be copied. - virtual uint8_t *reallocate_downward(uint8_t *old_p, size_t old_size, - size_t new_size, size_t in_use_back, - size_t in_use_front) { - FLATBUFFERS_ASSERT(new_size > old_size); // vector_downward only grows - uint8_t *new_p = allocate(new_size); - memcpy_downward(old_p, old_size, new_p, new_size, in_use_back, - in_use_front); - deallocate(old_p, old_size); - return new_p; - } - - protected: - // Called by `reallocate_downward` to copy memory from `old_p` of `old_size` - // to `new_p` of `new_size`. Only memory of size `in_use_front` and - // `in_use_back` will be copied from the front and back of the old memory - // allocation. - void memcpy_downward(uint8_t *old_p, size_t old_size, uint8_t *new_p, - size_t new_size, size_t in_use_back, - size_t in_use_front) { - memcpy(new_p + new_size - in_use_back, old_p + old_size - in_use_back, - in_use_back); - memcpy(new_p, old_p, in_use_front); - } -}; - -// DefaultAllocator uses new/delete to allocate memory regions -class DefaultAllocator : public Allocator { - public: - uint8_t *allocate(size_t size) FLATBUFFERS_OVERRIDE { - return new uint8_t[size]; - } - - void deallocate(uint8_t *p, size_t) FLATBUFFERS_OVERRIDE { delete[] p; } - - static void dealloc(void *p, size_t) { delete[] static_cast(p); } -}; - -// These functions allow for a null allocator to mean use the default allocator, -// as used by DetachedBuffer and vector_downward below. -// This is to avoid having a statically or dynamically allocated default -// allocator, or having to move it between the classes that may own it. -inline uint8_t *Allocate(Allocator *allocator, size_t size) { - return allocator ? allocator->allocate(size) - : DefaultAllocator().allocate(size); -} - -inline void Deallocate(Allocator *allocator, uint8_t *p, size_t size) { - if (allocator) - allocator->deallocate(p, size); - else - DefaultAllocator().deallocate(p, size); -} - -inline uint8_t *ReallocateDownward(Allocator *allocator, uint8_t *old_p, - size_t old_size, size_t new_size, - size_t in_use_back, size_t in_use_front) { - return allocator ? allocator->reallocate_downward(old_p, old_size, new_size, - in_use_back, in_use_front) - : DefaultAllocator().reallocate_downward( - old_p, old_size, new_size, in_use_back, in_use_front); -} - -// DetachedBuffer is a finished flatbuffer memory region, detached from its -// builder. The original memory region and allocator are also stored so that -// the DetachedBuffer can manage the memory lifetime. -class DetachedBuffer { - public: - DetachedBuffer() - : allocator_(nullptr), - own_allocator_(false), - buf_(nullptr), - reserved_(0), - cur_(nullptr), - size_(0) {} - - DetachedBuffer(Allocator *allocator, bool own_allocator, uint8_t *buf, - size_t reserved, uint8_t *cur, size_t sz) - : allocator_(allocator), - own_allocator_(own_allocator), - buf_(buf), - reserved_(reserved), - cur_(cur), - size_(sz) {} - - // clang-format off - #if !defined(FLATBUFFERS_CPP98_STL) - // clang-format on - DetachedBuffer(DetachedBuffer &&other) - : allocator_(other.allocator_), - own_allocator_(other.own_allocator_), - buf_(other.buf_), - reserved_(other.reserved_), - cur_(other.cur_), - size_(other.size_) { - other.reset(); - } - // clang-format off - #endif // !defined(FLATBUFFERS_CPP98_STL) - // clang-format on - - // clang-format off - #if !defined(FLATBUFFERS_CPP98_STL) - // clang-format on - DetachedBuffer &operator=(DetachedBuffer &&other) { - if (this == &other) return *this; - - destroy(); - - allocator_ = other.allocator_; - own_allocator_ = other.own_allocator_; - buf_ = other.buf_; - reserved_ = other.reserved_; - cur_ = other.cur_; - size_ = other.size_; - - other.reset(); - - return *this; - } - // clang-format off - #endif // !defined(FLATBUFFERS_CPP98_STL) - // clang-format on - - ~DetachedBuffer() { destroy(); } - - const uint8_t *data() const { return cur_; } - - uint8_t *data() { return cur_; } - - size_t size() const { return size_; } - - // clang-format off - #if 0 // disabled for now due to the ordering of classes in this header - template - bool Verify() const { - Verifier verifier(data(), size()); - return verifier.Verify(nullptr); - } - - template - const T* GetRoot() const { - return flatbuffers::GetRoot(data()); - } - - template - T* GetRoot() { - return flatbuffers::GetRoot(data()); - } - #endif - // clang-format on - - // clang-format off - #if !defined(FLATBUFFERS_CPP98_STL) - // clang-format on - // These may change access mode, leave these at end of public section - FLATBUFFERS_DELETE_FUNC(DetachedBuffer(const DetachedBuffer &other)) - FLATBUFFERS_DELETE_FUNC( - DetachedBuffer &operator=(const DetachedBuffer &other)) - // clang-format off - #endif // !defined(FLATBUFFERS_CPP98_STL) - // clang-format on - - protected: - Allocator *allocator_; - bool own_allocator_; - uint8_t *buf_; - size_t reserved_; - uint8_t *cur_; - size_t size_; - - inline void destroy() { - if (buf_) Deallocate(allocator_, buf_, reserved_); - if (own_allocator_ && allocator_) { delete allocator_; } - reset(); - } - - inline void reset() { - allocator_ = nullptr; - own_allocator_ = false; - buf_ = nullptr; - reserved_ = 0; - cur_ = nullptr; - size_ = 0; - } -}; - -// This is a minimal replication of std::vector functionality, -// except growing from higher to lower addresses. i.e push_back() inserts data -// in the lowest address in the vector. -// Since this vector leaves the lower part unused, we support a "scratch-pad" -// that can be stored there for temporary data, to share the allocated space. -// Essentially, this supports 2 std::vectors in a single buffer. -class vector_downward { - public: - explicit vector_downward(size_t initial_size, Allocator *allocator, - bool own_allocator, size_t buffer_minalign) - : allocator_(allocator), - own_allocator_(own_allocator), - initial_size_(initial_size), - buffer_minalign_(buffer_minalign), - reserved_(0), - buf_(nullptr), - cur_(nullptr), - scratch_(nullptr) {} - - // clang-format off - #if !defined(FLATBUFFERS_CPP98_STL) - vector_downward(vector_downward &&other) - #else - vector_downward(vector_downward &other) - #endif // defined(FLATBUFFERS_CPP98_STL) - // clang-format on - : allocator_(other.allocator_), - own_allocator_(other.own_allocator_), - initial_size_(other.initial_size_), - buffer_minalign_(other.buffer_minalign_), - reserved_(other.reserved_), - buf_(other.buf_), - cur_(other.cur_), - scratch_(other.scratch_) { - // No change in other.allocator_ - // No change in other.initial_size_ - // No change in other.buffer_minalign_ - other.own_allocator_ = false; - other.reserved_ = 0; - other.buf_ = nullptr; - other.cur_ = nullptr; - other.scratch_ = nullptr; - } - - // clang-format off - #if !defined(FLATBUFFERS_CPP98_STL) - // clang-format on - vector_downward &operator=(vector_downward &&other) { - // Move construct a temporary and swap idiom - vector_downward temp(std::move(other)); - swap(temp); - return *this; - } - // clang-format off - #endif // defined(FLATBUFFERS_CPP98_STL) - // clang-format on - - ~vector_downward() { - clear_buffer(); - clear_allocator(); - } - - void reset() { - clear_buffer(); - clear(); - } - - void clear() { - if (buf_) { - cur_ = buf_ + reserved_; - } else { - reserved_ = 0; - cur_ = nullptr; - } - clear_scratch(); - } - - void clear_scratch() { scratch_ = buf_; } - - void clear_allocator() { - if (own_allocator_ && allocator_) { delete allocator_; } - allocator_ = nullptr; - own_allocator_ = false; - } - - void clear_buffer() { - if (buf_) Deallocate(allocator_, buf_, reserved_); - buf_ = nullptr; - } - - // Relinquish the pointer to the caller. - uint8_t *release_raw(size_t &allocated_bytes, size_t &offset) { - auto *buf = buf_; - allocated_bytes = reserved_; - offset = static_cast(cur_ - buf_); - - // release_raw only relinquishes the buffer ownership. - // Does not deallocate or reset the allocator. Destructor will do that. - buf_ = nullptr; - clear(); - return buf; - } - - // Relinquish the pointer to the caller. - DetachedBuffer release() { - // allocator ownership (if any) is transferred to DetachedBuffer. - DetachedBuffer fb(allocator_, own_allocator_, buf_, reserved_, cur_, - size()); - if (own_allocator_) { - allocator_ = nullptr; - own_allocator_ = false; - } - buf_ = nullptr; - clear(); - return fb; - } - - size_t ensure_space(size_t len) { - FLATBUFFERS_ASSERT(cur_ >= scratch_ && scratch_ >= buf_); - if (len > static_cast(cur_ - scratch_)) { reallocate(len); } - // Beyond this, signed offsets may not have enough range: - // (FlatBuffers > 2GB not supported). - FLATBUFFERS_ASSERT(size() < FLATBUFFERS_MAX_BUFFER_SIZE); - return len; - } - - inline uint8_t *make_space(size_t len) { - size_t space = ensure_space(len); - cur_ -= space; - return cur_; - } - - // Returns nullptr if using the DefaultAllocator. - Allocator *get_custom_allocator() { return allocator_; } - - uoffset_t size() const { - return static_cast(reserved_ - (cur_ - buf_)); - } - - uoffset_t scratch_size() const { - return static_cast(scratch_ - buf_); - } - - size_t capacity() const { return reserved_; } - - uint8_t *data() const { - FLATBUFFERS_ASSERT(cur_); - return cur_; - } - - uint8_t *scratch_data() const { - FLATBUFFERS_ASSERT(buf_); - return buf_; - } - - uint8_t *scratch_end() const { - FLATBUFFERS_ASSERT(scratch_); - return scratch_; - } - - uint8_t *data_at(size_t offset) const { return buf_ + reserved_ - offset; } - - void push(const uint8_t *bytes, size_t num) { - if (num > 0) { memcpy(make_space(num), bytes, num); } - } - - // Specialized version of push() that avoids memcpy call for small data. - template void push_small(const T &little_endian_t) { - make_space(sizeof(T)); - *reinterpret_cast(cur_) = little_endian_t; - } - - template void scratch_push_small(const T &t) { - ensure_space(sizeof(T)); - *reinterpret_cast(scratch_) = t; - scratch_ += sizeof(T); - } - - // fill() is most frequently called with small byte counts (<= 4), - // which is why we're using loops rather than calling memset. - void fill(size_t zero_pad_bytes) { - make_space(zero_pad_bytes); - for (size_t i = 0; i < zero_pad_bytes; i++) cur_[i] = 0; - } - - // Version for when we know the size is larger. - // Precondition: zero_pad_bytes > 0 - void fill_big(size_t zero_pad_bytes) { - memset(make_space(zero_pad_bytes), 0, zero_pad_bytes); - } - - void pop(size_t bytes_to_remove) { cur_ += bytes_to_remove; } - void scratch_pop(size_t bytes_to_remove) { scratch_ -= bytes_to_remove; } - - void swap(vector_downward &other) { - using std::swap; - swap(allocator_, other.allocator_); - swap(own_allocator_, other.own_allocator_); - swap(initial_size_, other.initial_size_); - swap(buffer_minalign_, other.buffer_minalign_); - swap(reserved_, other.reserved_); - swap(buf_, other.buf_); - swap(cur_, other.cur_); - swap(scratch_, other.scratch_); - } - - void swap_allocator(vector_downward &other) { - using std::swap; - swap(allocator_, other.allocator_); - swap(own_allocator_, other.own_allocator_); - } - - private: - // You shouldn't really be copying instances of this class. - FLATBUFFERS_DELETE_FUNC(vector_downward(const vector_downward &)) - FLATBUFFERS_DELETE_FUNC(vector_downward &operator=(const vector_downward &)) - - Allocator *allocator_; - bool own_allocator_; - size_t initial_size_; - size_t buffer_minalign_; - size_t reserved_; - uint8_t *buf_; - uint8_t *cur_; // Points at location between empty (below) and used (above). - uint8_t *scratch_; // Points to the end of the scratchpad in use. - - void reallocate(size_t len) { - auto old_reserved = reserved_; - auto old_size = size(); - auto old_scratch_size = scratch_size(); - reserved_ += - (std::max)(len, old_reserved ? old_reserved / 2 : initial_size_); - reserved_ = (reserved_ + buffer_minalign_ - 1) & ~(buffer_minalign_ - 1); - if (buf_) { - buf_ = ReallocateDownward(allocator_, buf_, old_reserved, reserved_, - old_size, old_scratch_size); - } else { - buf_ = Allocate(allocator_, reserved_); - } - cur_ = buf_ + reserved_ - old_size; - scratch_ = buf_ + old_scratch_size; - } -}; - -// Converts a Field ID to a virtual table offset. -inline voffset_t FieldIndexToOffset(voffset_t field_id) { - // Should correspond to what EndTable() below builds up. - const int fixed_fields = 2; // Vtable size and Object Size. - return static_cast((field_id + fixed_fields) * sizeof(voffset_t)); -} - -template -const T *data(const std::vector &v) { - // Eventually the returned pointer gets passed down to memcpy, so - // we need it to be non-null to avoid undefined behavior. - static uint8_t t; - return v.empty() ? reinterpret_cast(&t) : &v.front(); -} -template T *data(std::vector &v) { - // Eventually the returned pointer gets passed down to memcpy, so - // we need it to be non-null to avoid undefined behavior. - static uint8_t t; - return v.empty() ? reinterpret_cast(&t) : &v.front(); -} - -/// @endcond - -/// @addtogroup flatbuffers_cpp_api -/// @{ -/// @class FlatBufferBuilder -/// @brief Helper class to hold data needed in creation of a FlatBuffer. -/// To serialize data, you typically call one of the `Create*()` functions in -/// the generated code, which in turn call a sequence of `StartTable`/ -/// `PushElement`/`AddElement`/`EndTable`, or the builtin `CreateString`/ -/// `CreateVector` functions. Do this is depth-first order to build up a tree to -/// the root. `Finish()` wraps up the buffer ready for transport. -class FlatBufferBuilder { - public: - /// @brief Default constructor for FlatBufferBuilder. - /// @param[in] initial_size The initial size of the buffer, in bytes. Defaults - /// to `1024`. - /// @param[in] allocator An `Allocator` to use. If null will use - /// `DefaultAllocator`. - /// @param[in] own_allocator Whether the builder/vector should own the - /// allocator. Defaults to / `false`. - /// @param[in] buffer_minalign Force the buffer to be aligned to the given - /// minimum alignment upon reallocation. Only needed if you intend to store - /// types with custom alignment AND you wish to read the buffer in-place - /// directly after creation. - explicit FlatBufferBuilder( - size_t initial_size = 1024, Allocator *allocator = nullptr, - bool own_allocator = false, - size_t buffer_minalign = AlignOf()) - : buf_(initial_size, allocator, own_allocator, buffer_minalign), - num_field_loc(0), - max_voffset_(0), - nested(false), - finished(false), - minalign_(1), - force_defaults_(false), - dedup_vtables_(true), - string_pool(nullptr) { - EndianCheck(); - } - - // clang-format off - /// @brief Move constructor for FlatBufferBuilder. - #if !defined(FLATBUFFERS_CPP98_STL) - FlatBufferBuilder(FlatBufferBuilder &&other) - #else - FlatBufferBuilder(FlatBufferBuilder &other) - #endif // #if !defined(FLATBUFFERS_CPP98_STL) - : buf_(1024, nullptr, false, AlignOf()), - num_field_loc(0), - max_voffset_(0), - nested(false), - finished(false), - minalign_(1), - force_defaults_(false), - dedup_vtables_(true), - string_pool(nullptr) { - EndianCheck(); - // Default construct and swap idiom. - // Lack of delegating constructors in vs2010 makes it more verbose than needed. - Swap(other); - } - // clang-format on - - // clang-format off - #if !defined(FLATBUFFERS_CPP98_STL) - // clang-format on - /// @brief Move assignment operator for FlatBufferBuilder. - FlatBufferBuilder &operator=(FlatBufferBuilder &&other) { - // Move construct a temporary and swap idiom - FlatBufferBuilder temp(std::move(other)); - Swap(temp); - return *this; - } - // clang-format off - #endif // defined(FLATBUFFERS_CPP98_STL) - // clang-format on - - void Swap(FlatBufferBuilder &other) { - using std::swap; - buf_.swap(other.buf_); - swap(num_field_loc, other.num_field_loc); - swap(max_voffset_, other.max_voffset_); - swap(nested, other.nested); - swap(finished, other.finished); - swap(minalign_, other.minalign_); - swap(force_defaults_, other.force_defaults_); - swap(dedup_vtables_, other.dedup_vtables_); - swap(string_pool, other.string_pool); - } - - ~FlatBufferBuilder() { - if (string_pool) delete string_pool; - } - - void Reset() { - Clear(); // clear builder state - buf_.reset(); // deallocate buffer - } - - /// @brief Reset all the state in this FlatBufferBuilder so it can be reused - /// to construct another buffer. - void Clear() { - ClearOffsets(); - buf_.clear(); - nested = false; - finished = false; - minalign_ = 1; - if (string_pool) string_pool->clear(); - } - - /// @brief The current size of the serialized buffer, counting from the end. - /// @return Returns an `uoffset_t` with the current size of the buffer. - uoffset_t GetSize() const { return buf_.size(); } - - /// @brief Get the serialized buffer (after you call `Finish()`). - /// @return Returns an `uint8_t` pointer to the FlatBuffer data inside the - /// buffer. - uint8_t *GetBufferPointer() const { - Finished(); - return buf_.data(); - } - - /// @brief Get a pointer to an unfinished buffer. - /// @return Returns a `uint8_t` pointer to the unfinished buffer. - uint8_t *GetCurrentBufferPointer() const { return buf_.data(); } - - /// @brief Get the released pointer to the serialized buffer. - /// @warning Do NOT attempt to use this FlatBufferBuilder afterwards! - /// @return A `FlatBuffer` that owns the buffer and its allocator and - /// behaves similar to a `unique_ptr` with a deleter. - FLATBUFFERS_ATTRIBUTE(deprecated("use Release() instead")) - DetachedBuffer ReleaseBufferPointer() { - Finished(); - return buf_.release(); - } - - /// @brief Get the released DetachedBuffer. - /// @return A `DetachedBuffer` that owns the buffer and its allocator. - DetachedBuffer Release() { - Finished(); - return buf_.release(); - } - - /// @brief Get the released pointer to the serialized buffer. - /// @param size The size of the memory block containing - /// the serialized `FlatBuffer`. - /// @param offset The offset from the released pointer where the finished - /// `FlatBuffer` starts. - /// @return A raw pointer to the start of the memory block containing - /// the serialized `FlatBuffer`. - /// @remark If the allocator is owned, it gets deleted when the destructor is - /// called.. - uint8_t *ReleaseRaw(size_t &size, size_t &offset) { - Finished(); - return buf_.release_raw(size, offset); - } - - /// @brief get the minimum alignment this buffer needs to be accessed - /// properly. This is only known once all elements have been written (after - /// you call Finish()). You can use this information if you need to embed - /// a FlatBuffer in some other buffer, such that you can later read it - /// without first having to copy it into its own buffer. - size_t GetBufferMinAlignment() { - Finished(); - return minalign_; - } - - /// @cond FLATBUFFERS_INTERNAL - void Finished() const { - // If you get this assert, you're attempting to get access a buffer - // which hasn't been finished yet. Be sure to call - // FlatBufferBuilder::Finish with your root table. - // If you really need to access an unfinished buffer, call - // GetCurrentBufferPointer instead. - FLATBUFFERS_ASSERT(finished); - } - /// @endcond - - /// @brief In order to save space, fields that are set to their default value - /// don't get serialized into the buffer. - /// @param[in] fd When set to `true`, always serializes default values that - /// are set. Optional fields which are not set explicitly, will still not be - /// serialized. - void ForceDefaults(bool fd) { force_defaults_ = fd; } - - /// @brief By default vtables are deduped in order to save space. - /// @param[in] dedup When set to `true`, dedup vtables. - void DedupVtables(bool dedup) { dedup_vtables_ = dedup; } - - /// @cond FLATBUFFERS_INTERNAL - void Pad(size_t num_bytes) { buf_.fill(num_bytes); } - - void TrackMinAlign(size_t elem_size) { - if (elem_size > minalign_) minalign_ = elem_size; - } - - void Align(size_t elem_size) { - TrackMinAlign(elem_size); - buf_.fill(PaddingBytes(buf_.size(), elem_size)); - } - - void PushFlatBuffer(const uint8_t *bytes, size_t size) { - PushBytes(bytes, size); - finished = true; - } - - void PushBytes(const uint8_t *bytes, size_t size) { buf_.push(bytes, size); } - - void PopBytes(size_t amount) { buf_.pop(amount); } - - template void AssertScalarT() { - // The code assumes power of 2 sizes and endian-swap-ability. - static_assert(flatbuffers::is_scalar::value, "T must be a scalar type"); - } - - // Write a single aligned scalar to the buffer - template uoffset_t PushElement(T element) { - AssertScalarT(); - T litle_endian_element = EndianScalar(element); - Align(sizeof(T)); - buf_.push_small(litle_endian_element); - return GetSize(); - } - - template uoffset_t PushElement(Offset off) { - // Special case for offsets: see ReferTo below. - return PushElement(ReferTo(off.o)); - } - - // When writing fields, we track where they are, so we can create correct - // vtables later. - void TrackField(voffset_t field, uoffset_t off) { - FieldLoc fl = { off, field }; - buf_.scratch_push_small(fl); - num_field_loc++; - max_voffset_ = (std::max)(max_voffset_, field); - } - - // Like PushElement, but additionally tracks the field this represents. - template void AddElement(voffset_t field, T e, T def) { - // We don't serialize values equal to the default. - if (IsTheSameAs(e, def) && !force_defaults_) return; - auto off = PushElement(e); - TrackField(field, off); - } - - template void AddOffset(voffset_t field, Offset off) { - if (off.IsNull()) return; // Don't store. - AddElement(field, ReferTo(off.o), static_cast(0)); - } - - template void AddStruct(voffset_t field, const T *structptr) { - if (!structptr) return; // Default, don't store. - Align(AlignOf()); - buf_.push_small(*structptr); - TrackField(field, GetSize()); - } - - void AddStructOffset(voffset_t field, uoffset_t off) { - TrackField(field, off); - } - - // Offsets initially are relative to the end of the buffer (downwards). - // This function converts them to be relative to the current location - // in the buffer (when stored here), pointing upwards. - uoffset_t ReferTo(uoffset_t off) { - // Align to ensure GetSize() below is correct. - Align(sizeof(uoffset_t)); - // Offset must refer to something already in buffer. - FLATBUFFERS_ASSERT(off && off <= GetSize()); - return GetSize() - off + static_cast(sizeof(uoffset_t)); - } - - void NotNested() { - // If you hit this, you're trying to construct a Table/Vector/String - // during the construction of its parent table (between the MyTableBuilder - // and table.Finish(). - // Move the creation of these sub-objects to above the MyTableBuilder to - // not get this assert. - // Ignoring this assert may appear to work in simple cases, but the reason - // it is here is that storing objects in-line may cause vtable offsets - // to not fit anymore. It also leads to vtable duplication. - FLATBUFFERS_ASSERT(!nested); - // If you hit this, fields were added outside the scope of a table. - FLATBUFFERS_ASSERT(!num_field_loc); - } - - // From generated code (or from the parser), we call StartTable/EndTable - // with a sequence of AddElement calls in between. - uoffset_t StartTable() { - NotNested(); - nested = true; - return GetSize(); - } - - // This finishes one serialized object by generating the vtable if it's a - // table, comparing it against existing vtables, and writing the - // resulting vtable offset. - uoffset_t EndTable(uoffset_t start) { - // If you get this assert, a corresponding StartTable wasn't called. - FLATBUFFERS_ASSERT(nested); - // Write the vtable offset, which is the start of any Table. - // We fill it's value later. - auto vtableoffsetloc = PushElement(0); - // Write a vtable, which consists entirely of voffset_t elements. - // It starts with the number of offsets, followed by a type id, followed - // by the offsets themselves. In reverse: - // Include space for the last offset and ensure empty tables have a - // minimum size. - max_voffset_ = - (std::max)(static_cast(max_voffset_ + sizeof(voffset_t)), - FieldIndexToOffset(0)); - buf_.fill_big(max_voffset_); - auto table_object_size = vtableoffsetloc - start; - // Vtable use 16bit offsets. - FLATBUFFERS_ASSERT(table_object_size < 0x10000); - WriteScalar(buf_.data() + sizeof(voffset_t), - static_cast(table_object_size)); - WriteScalar(buf_.data(), max_voffset_); - // Write the offsets into the table - for (auto it = buf_.scratch_end() - num_field_loc * sizeof(FieldLoc); - it < buf_.scratch_end(); it += sizeof(FieldLoc)) { - auto field_location = reinterpret_cast(it); - auto pos = static_cast(vtableoffsetloc - field_location->off); - // If this asserts, it means you've set a field twice. - FLATBUFFERS_ASSERT( - !ReadScalar(buf_.data() + field_location->id)); - WriteScalar(buf_.data() + field_location->id, pos); - } - ClearOffsets(); - auto vt1 = reinterpret_cast(buf_.data()); - auto vt1_size = ReadScalar(vt1); - auto vt_use = GetSize(); - // See if we already have generated a vtable with this exact same - // layout before. If so, make it point to the old one, remove this one. - if (dedup_vtables_) { - for (auto it = buf_.scratch_data(); it < buf_.scratch_end(); - it += sizeof(uoffset_t)) { - auto vt_offset_ptr = reinterpret_cast(it); - auto vt2 = reinterpret_cast(buf_.data_at(*vt_offset_ptr)); - auto vt2_size = ReadScalar(vt2); - if (vt1_size != vt2_size || 0 != memcmp(vt2, vt1, vt1_size)) continue; - vt_use = *vt_offset_ptr; - buf_.pop(GetSize() - vtableoffsetloc); - break; - } - } - // If this is a new vtable, remember it. - if (vt_use == GetSize()) { buf_.scratch_push_small(vt_use); } - // Fill the vtable offset we created above. - // The offset points from the beginning of the object to where the - // vtable is stored. - // Offsets default direction is downward in memory for future format - // flexibility (storing all vtables at the start of the file). - WriteScalar(buf_.data_at(vtableoffsetloc), - static_cast(vt_use) - - static_cast(vtableoffsetloc)); - - nested = false; - return vtableoffsetloc; - } - - FLATBUFFERS_ATTRIBUTE(deprecated("call the version above instead")) - uoffset_t EndTable(uoffset_t start, voffset_t /*numfields*/) { - return EndTable(start); - } - - // This checks a required field has been set in a given table that has - // just been constructed. - template void Required(Offset table, voffset_t field); - - uoffset_t StartStruct(size_t alignment) { - Align(alignment); - return GetSize(); - } - - uoffset_t EndStruct() { return GetSize(); } - - void ClearOffsets() { - buf_.scratch_pop(num_field_loc * sizeof(FieldLoc)); - num_field_loc = 0; - max_voffset_ = 0; - } - - // Aligns such that when "len" bytes are written, an object can be written - // after it with "alignment" without padding. - void PreAlign(size_t len, size_t alignment) { - TrackMinAlign(alignment); - buf_.fill(PaddingBytes(GetSize() + len, alignment)); - } - template void PreAlign(size_t len) { - AssertScalarT(); - PreAlign(len, sizeof(T)); - } - /// @endcond - - /// @brief Store a string in the buffer, which can contain any binary data. - /// @param[in] str A const char pointer to the data to be stored as a string. - /// @param[in] len The number of bytes that should be stored from `str`. - /// @return Returns the offset in the buffer where the string starts. - Offset CreateString(const char *str, size_t len) { - NotNested(); - PreAlign(len + 1); // Always 0-terminated. - buf_.fill(1); - PushBytes(reinterpret_cast(str), len); - PushElement(static_cast(len)); - return Offset(GetSize()); - } - - /// @brief Store a string in the buffer, which is null-terminated. - /// @param[in] str A const char pointer to a C-string to add to the buffer. - /// @return Returns the offset in the buffer where the string starts. - Offset CreateString(const char *str) { - return CreateString(str, strlen(str)); - } - - /// @brief Store a string in the buffer, which is null-terminated. - /// @param[in] str A char pointer to a C-string to add to the buffer. - /// @return Returns the offset in the buffer where the string starts. - Offset CreateString(char *str) { - return CreateString(str, strlen(str)); - } - - /// @brief Store a string in the buffer, which can contain any binary data. - /// @param[in] str A const reference to a std::string to store in the buffer. - /// @return Returns the offset in the buffer where the string starts. - Offset CreateString(const std::string &str) { - return CreateString(str.c_str(), str.length()); - } - - // clang-format off - #ifdef FLATBUFFERS_HAS_STRING_VIEW - /// @brief Store a string in the buffer, which can contain any binary data. - /// @param[in] str A const string_view to copy in to the buffer. - /// @return Returns the offset in the buffer where the string starts. - Offset CreateString(flatbuffers::string_view str) { - return CreateString(str.data(), str.size()); - } - #endif // FLATBUFFERS_HAS_STRING_VIEW - // clang-format on - - /// @brief Store a string in the buffer, which can contain any binary data. - /// @param[in] str A const pointer to a `String` struct to add to the buffer. - /// @return Returns the offset in the buffer where the string starts - Offset CreateString(const String *str) { - return str ? CreateString(str->c_str(), str->size()) : 0; - } - - /// @brief Store a string in the buffer, which can contain any binary data. - /// @param[in] str A const reference to a std::string like type with support - /// of T::c_str() and T::length() to store in the buffer. - /// @return Returns the offset in the buffer where the string starts. - template Offset CreateString(const T &str) { - return CreateString(str.c_str(), str.length()); - } - - /// @brief Store a string in the buffer, which can contain any binary data. - /// If a string with this exact contents has already been serialized before, - /// instead simply returns the offset of the existing string. - /// @param[in] str A const char pointer to the data to be stored as a string. - /// @param[in] len The number of bytes that should be stored from `str`. - /// @return Returns the offset in the buffer where the string starts. - Offset CreateSharedString(const char *str, size_t len) { - if (!string_pool) - string_pool = new StringOffsetMap(StringOffsetCompare(buf_)); - auto size_before_string = buf_.size(); - // Must first serialize the string, since the set is all offsets into - // buffer. - auto off = CreateString(str, len); - auto it = string_pool->find(off); - // If it exists we reuse existing serialized data! - if (it != string_pool->end()) { - // We can remove the string we serialized. - buf_.pop(buf_.size() - size_before_string); - return *it; - } - // Record this string for future use. - string_pool->insert(off); - return off; - } - - /// @brief Store a string in the buffer, which null-terminated. - /// If a string with this exact contents has already been serialized before, - /// instead simply returns the offset of the existing string. - /// @param[in] str A const char pointer to a C-string to add to the buffer. - /// @return Returns the offset in the buffer where the string starts. - Offset CreateSharedString(const char *str) { - return CreateSharedString(str, strlen(str)); - } - - /// @brief Store a string in the buffer, which can contain any binary data. - /// If a string with this exact contents has already been serialized before, - /// instead simply returns the offset of the existing string. - /// @param[in] str A const reference to a std::string to store in the buffer. - /// @return Returns the offset in the buffer where the string starts. - Offset CreateSharedString(const std::string &str) { - return CreateSharedString(str.c_str(), str.length()); - } - - /// @brief Store a string in the buffer, which can contain any binary data. - /// If a string with this exact contents has already been serialized before, - /// instead simply returns the offset of the existing string. - /// @param[in] str A const pointer to a `String` struct to add to the buffer. - /// @return Returns the offset in the buffer where the string starts - Offset CreateSharedString(const String *str) { - return CreateSharedString(str->c_str(), str->size()); - } - - /// @cond FLATBUFFERS_INTERNAL - uoffset_t EndVector(size_t len) { - FLATBUFFERS_ASSERT(nested); // Hit if no corresponding StartVector. - nested = false; - return PushElement(static_cast(len)); - } - - void StartVector(size_t len, size_t elemsize) { - NotNested(); - nested = true; - PreAlign(len * elemsize); - PreAlign(len * elemsize, elemsize); // Just in case elemsize > uoffset_t. - } - - // Call this right before StartVector/CreateVector if you want to force the - // alignment to be something different than what the element size would - // normally dictate. - // This is useful when storing a nested_flatbuffer in a vector of bytes, - // or when storing SIMD floats, etc. - void ForceVectorAlignment(size_t len, size_t elemsize, size_t alignment) { - PreAlign(len * elemsize, alignment); - } - - // Similar to ForceVectorAlignment but for String fields. - void ForceStringAlignment(size_t len, size_t alignment) { - PreAlign((len + 1) * sizeof(char), alignment); - } - - /// @endcond - - /// @brief Serialize an array into a FlatBuffer `vector`. - /// @tparam T The data type of the array elements. - /// @param[in] v A pointer to the array of type `T` to serialize into the - /// buffer as a `vector`. - /// @param[in] len The number of elements to serialize. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template Offset> CreateVector(const T *v, size_t len) { - // If this assert hits, you're specifying a template argument that is - // causing the wrong overload to be selected, remove it. - AssertScalarT(); - StartVector(len, sizeof(T)); - // clang-format off - #if FLATBUFFERS_LITTLEENDIAN - PushBytes(reinterpret_cast(v), len * sizeof(T)); - #else - if (sizeof(T) == 1) { - PushBytes(reinterpret_cast(v), len); - } else { - for (auto i = len; i > 0; ) { - PushElement(v[--i]); - } - } - #endif - // clang-format on - return Offset>(EndVector(len)); - } - - template - Offset>> CreateVector(const Offset *v, size_t len) { - StartVector(len, sizeof(Offset)); - for (auto i = len; i > 0;) { PushElement(v[--i]); } - return Offset>>(EndVector(len)); - } - - /// @brief Serialize a `std::vector` into a FlatBuffer `vector`. - /// @tparam T The data type of the `std::vector` elements. - /// @param v A const reference to the `std::vector` to serialize into the - /// buffer as a `vector`. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template Offset> CreateVector(const std::vector &v) { - return CreateVector(data(v), v.size()); - } - - // vector may be implemented using a bit-set, so we can't access it as - // an array. Instead, read elements manually. - // Background: https://isocpp.org/blog/2012/11/on-vectorbool - Offset> CreateVector(const std::vector &v) { - StartVector(v.size(), sizeof(uint8_t)); - for (auto i = v.size(); i > 0;) { - PushElement(static_cast(v[--i])); - } - return Offset>(EndVector(v.size())); - } - - // clang-format off - #ifndef FLATBUFFERS_CPP98_STL - /// @brief Serialize values returned by a function into a FlatBuffer `vector`. - /// This is a convenience function that takes care of iteration for you. - /// @tparam T The data type of the `std::vector` elements. - /// @param f A function that takes the current iteration 0..vector_size-1 and - /// returns any type that you can construct a FlatBuffers vector out of. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template Offset> CreateVector(size_t vector_size, - const std::function &f) { - std::vector elems(vector_size); - for (size_t i = 0; i < vector_size; i++) elems[i] = f(i); - return CreateVector(elems); - } - #endif - // clang-format on - - /// @brief Serialize values returned by a function into a FlatBuffer `vector`. - /// This is a convenience function that takes care of iteration for you. - /// @tparam T The data type of the `std::vector` elements. - /// @param f A function that takes the current iteration 0..vector_size-1, - /// and the state parameter returning any type that you can construct a - /// FlatBuffers vector out of. - /// @param state State passed to f. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template - Offset> CreateVector(size_t vector_size, F f, S *state) { - std::vector elems(vector_size); - for (size_t i = 0; i < vector_size; i++) elems[i] = f(i, state); - return CreateVector(elems); - } - - /// @brief Serialize a `std::vector` into a FlatBuffer `vector`. - /// This is a convenience function for a common case. - /// @param v A const reference to the `std::vector` to serialize into the - /// buffer as a `vector`. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - Offset>> CreateVectorOfStrings( - const std::vector &v) { - std::vector> offsets(v.size()); - for (size_t i = 0; i < v.size(); i++) offsets[i] = CreateString(v[i]); - return CreateVector(offsets); - } - - /// @brief Serialize an array of structs into a FlatBuffer `vector`. - /// @tparam T The data type of the struct array elements. - /// @param[in] v A pointer to the array of type `T` to serialize into the - /// buffer as a `vector`. - /// @param[in] len The number of elements to serialize. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template - Offset> CreateVectorOfStructs(const T *v, size_t len) { - StartVector(len * sizeof(T) / AlignOf(), AlignOf()); - PushBytes(reinterpret_cast(v), sizeof(T) * len); - return Offset>(EndVector(len)); - } - - /// @brief Serialize an array of native structs into a FlatBuffer `vector`. - /// @tparam T The data type of the struct array elements. - /// @tparam S The data type of the native struct array elements. - /// @param[in] v A pointer to the array of type `S` to serialize into the - /// buffer as a `vector`. - /// @param[in] len The number of elements to serialize. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template - Offset> CreateVectorOfNativeStructs(const S *v, - size_t len) { - extern T Pack(const S &); - std::vector vv(len); - std::transform(v, v + len, vv.begin(), Pack); - return CreateVectorOfStructs(data(vv), vv.size()); - } - - // clang-format off - #ifndef FLATBUFFERS_CPP98_STL - /// @brief Serialize an array of structs into a FlatBuffer `vector`. - /// @tparam T The data type of the struct array elements. - /// @param[in] filler A function that takes the current iteration 0..vector_size-1 - /// and a pointer to the struct that must be filled. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - /// This is mostly useful when flatbuffers are generated with mutation - /// accessors. - template Offset> CreateVectorOfStructs( - size_t vector_size, const std::function &filler) { - T* structs = StartVectorOfStructs(vector_size); - for (size_t i = 0; i < vector_size; i++) { - filler(i, structs); - structs++; - } - return EndVectorOfStructs(vector_size); - } - #endif - // clang-format on - - /// @brief Serialize an array of structs into a FlatBuffer `vector`. - /// @tparam T The data type of the struct array elements. - /// @param[in] f A function that takes the current iteration 0..vector_size-1, - /// a pointer to the struct that must be filled and the state argument. - /// @param[in] state Arbitrary state to pass to f. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - /// This is mostly useful when flatbuffers are generated with mutation - /// accessors. - template - Offset> CreateVectorOfStructs(size_t vector_size, F f, - S *state) { - T *structs = StartVectorOfStructs(vector_size); - for (size_t i = 0; i < vector_size; i++) { - f(i, structs, state); - structs++; - } - return EndVectorOfStructs(vector_size); - } - - /// @brief Serialize a `std::vector` of structs into a FlatBuffer `vector`. - /// @tparam T The data type of the `std::vector` struct elements. - /// @param[in] v A const reference to the `std::vector` of structs to - /// serialize into the buffer as a `vector`. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template - Offset> CreateVectorOfStructs( - const std::vector &v) { - return CreateVectorOfStructs(data(v), v.size()); - } - - /// @brief Serialize a `std::vector` of native structs into a FlatBuffer - /// `vector`. - /// @tparam T The data type of the `std::vector` struct elements. - /// @tparam S The data type of the `std::vector` native struct elements. - /// @param[in] v A const reference to the `std::vector` of structs to - /// serialize into the buffer as a `vector`. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template - Offset> CreateVectorOfNativeStructs( - const std::vector &v) { - return CreateVectorOfNativeStructs(data(v), v.size()); - } - - /// @cond FLATBUFFERS_INTERNAL - template struct StructKeyComparator { - bool operator()(const T &a, const T &b) const { - return a.KeyCompareLessThan(&b); - } - - private: - StructKeyComparator &operator=(const StructKeyComparator &); - }; - /// @endcond - - /// @brief Serialize a `std::vector` of structs into a FlatBuffer `vector` - /// in sorted order. - /// @tparam T The data type of the `std::vector` struct elements. - /// @param[in] v A const reference to the `std::vector` of structs to - /// serialize into the buffer as a `vector`. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template - Offset> CreateVectorOfSortedStructs(std::vector *v) { - return CreateVectorOfSortedStructs(data(*v), v->size()); - } - - /// @brief Serialize a `std::vector` of native structs into a FlatBuffer - /// `vector` in sorted order. - /// @tparam T The data type of the `std::vector` struct elements. - /// @tparam S The data type of the `std::vector` native struct elements. - /// @param[in] v A const reference to the `std::vector` of structs to - /// serialize into the buffer as a `vector`. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template - Offset> CreateVectorOfSortedNativeStructs( - std::vector *v) { - return CreateVectorOfSortedNativeStructs(data(*v), v->size()); - } - - /// @brief Serialize an array of structs into a FlatBuffer `vector` in sorted - /// order. - /// @tparam T The data type of the struct array elements. - /// @param[in] v A pointer to the array of type `T` to serialize into the - /// buffer as a `vector`. - /// @param[in] len The number of elements to serialize. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template - Offset> CreateVectorOfSortedStructs(T *v, size_t len) { - std::sort(v, v + len, StructKeyComparator()); - return CreateVectorOfStructs(v, len); - } - - /// @brief Serialize an array of native structs into a FlatBuffer `vector` in - /// sorted order. - /// @tparam T The data type of the struct array elements. - /// @tparam S The data type of the native struct array elements. - /// @param[in] v A pointer to the array of type `S` to serialize into the - /// buffer as a `vector`. - /// @param[in] len The number of elements to serialize. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template - Offset> CreateVectorOfSortedNativeStructs(S *v, - size_t len) { - extern T Pack(const S &); - typedef T (*Pack_t)(const S &); - std::vector vv(len); - std::transform(v, v + len, vv.begin(), static_cast(Pack)); - return CreateVectorOfSortedStructs(vv, len); - } - - /// @cond FLATBUFFERS_INTERNAL - template struct TableKeyComparator { - TableKeyComparator(vector_downward &buf) : buf_(buf) {} - TableKeyComparator(const TableKeyComparator &other) : buf_(other.buf_) {} - bool operator()(const Offset &a, const Offset &b) const { - auto table_a = reinterpret_cast(buf_.data_at(a.o)); - auto table_b = reinterpret_cast(buf_.data_at(b.o)); - return table_a->KeyCompareLessThan(table_b); - } - vector_downward &buf_; - - private: - TableKeyComparator &operator=(const TableKeyComparator &other) { - buf_ = other.buf_; - return *this; - } - }; - /// @endcond - - /// @brief Serialize an array of `table` offsets as a `vector` in the buffer - /// in sorted order. - /// @tparam T The data type that the offset refers to. - /// @param[in] v An array of type `Offset` that contains the `table` - /// offsets to store in the buffer in sorted order. - /// @param[in] len The number of elements to store in the `vector`. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template - Offset>> CreateVectorOfSortedTables(Offset *v, - size_t len) { - std::sort(v, v + len, TableKeyComparator(buf_)); - return CreateVector(v, len); - } - - /// @brief Serialize an array of `table` offsets as a `vector` in the buffer - /// in sorted order. - /// @tparam T The data type that the offset refers to. - /// @param[in] v An array of type `Offset` that contains the `table` - /// offsets to store in the buffer in sorted order. - /// @return Returns a typed `Offset` into the serialized data indicating - /// where the vector is stored. - template - Offset>> CreateVectorOfSortedTables( - std::vector> *v) { - return CreateVectorOfSortedTables(data(*v), v->size()); - } - - /// @brief Specialized version of `CreateVector` for non-copying use cases. - /// Write the data any time later to the returned buffer pointer `buf`. - /// @param[in] len The number of elements to store in the `vector`. - /// @param[in] elemsize The size of each element in the `vector`. - /// @param[out] buf A pointer to a `uint8_t` pointer that can be - /// written to at a later time to serialize the data into a `vector` - /// in the buffer. - uoffset_t CreateUninitializedVector(size_t len, size_t elemsize, - uint8_t **buf) { - NotNested(); - StartVector(len, elemsize); - buf_.make_space(len * elemsize); - auto vec_start = GetSize(); - auto vec_end = EndVector(len); - *buf = buf_.data_at(vec_start); - return vec_end; - } - - /// @brief Specialized version of `CreateVector` for non-copying use cases. - /// Write the data any time later to the returned buffer pointer `buf`. - /// @tparam T The data type of the data that will be stored in the buffer - /// as a `vector`. - /// @param[in] len The number of elements to store in the `vector`. - /// @param[out] buf A pointer to a pointer of type `T` that can be - /// written to at a later time to serialize the data into a `vector` - /// in the buffer. - template - Offset> CreateUninitializedVector(size_t len, T **buf) { - AssertScalarT(); - return CreateUninitializedVector(len, sizeof(T), - reinterpret_cast(buf)); - } - - template - Offset> CreateUninitializedVectorOfStructs(size_t len, - T **buf) { - return CreateUninitializedVector(len, sizeof(T), - reinterpret_cast(buf)); - } - - // @brief Create a vector of scalar type T given as input a vector of scalar - // type U, useful with e.g. pre "enum class" enums, or any existing scalar - // data of the wrong type. - template - Offset> CreateVectorScalarCast(const U *v, size_t len) { - AssertScalarT(); - AssertScalarT(); - StartVector(len, sizeof(T)); - for (auto i = len; i > 0;) { PushElement(static_cast(v[--i])); } - return Offset>(EndVector(len)); - } - - /// @brief Write a struct by itself, typically to be part of a union. - template Offset CreateStruct(const T &structobj) { - NotNested(); - Align(AlignOf()); - buf_.push_small(structobj); - return Offset(GetSize()); - } - - /// @brief The length of a FlatBuffer file header. - static const size_t kFileIdentifierLength = 4; - - /// @brief Finish serializing a buffer by writing the root offset. - /// @param[in] file_identifier If a `file_identifier` is given, the buffer - /// will be prefixed with a standard FlatBuffers file header. - template - void Finish(Offset root, const char *file_identifier = nullptr) { - Finish(root.o, file_identifier, false); - } - - /// @brief Finish a buffer with a 32 bit size field pre-fixed (size of the - /// buffer following the size field). These buffers are NOT compatible - /// with standard buffers created by Finish, i.e. you can't call GetRoot - /// on them, you have to use GetSizePrefixedRoot instead. - /// All >32 bit quantities in this buffer will be aligned when the whole - /// size pre-fixed buffer is aligned. - /// These kinds of buffers are useful for creating a stream of FlatBuffers. - template - void FinishSizePrefixed(Offset root, - const char *file_identifier = nullptr) { - Finish(root.o, file_identifier, true); - } - - void SwapBufAllocator(FlatBufferBuilder &other) { - buf_.swap_allocator(other.buf_); - } - - protected: - // You shouldn't really be copying instances of this class. - FlatBufferBuilder(const FlatBufferBuilder &); - FlatBufferBuilder &operator=(const FlatBufferBuilder &); - - void Finish(uoffset_t root, const char *file_identifier, bool size_prefix) { - NotNested(); - buf_.clear_scratch(); - // This will cause the whole buffer to be aligned. - PreAlign((size_prefix ? sizeof(uoffset_t) : 0) + sizeof(uoffset_t) + - (file_identifier ? kFileIdentifierLength : 0), - minalign_); - if (file_identifier) { - FLATBUFFERS_ASSERT(strlen(file_identifier) == kFileIdentifierLength); - PushBytes(reinterpret_cast(file_identifier), - kFileIdentifierLength); - } - PushElement(ReferTo(root)); // Location of root. - if (size_prefix) { PushElement(GetSize()); } - finished = true; - } - - struct FieldLoc { - uoffset_t off; - voffset_t id; - }; - - vector_downward buf_; - - // Accumulating offsets of table members while it is being built. - // We store these in the scratch pad of buf_, after the vtable offsets. - uoffset_t num_field_loc; - // Track how much of the vtable is in use, so we can output the most compact - // possible vtable. - voffset_t max_voffset_; - - // Ensure objects are not nested. - bool nested; - - // Ensure the buffer is finished before it is being accessed. - bool finished; - - size_t minalign_; - - bool force_defaults_; // Serialize values equal to their defaults anyway. - - bool dedup_vtables_; - - struct StringOffsetCompare { - StringOffsetCompare(const vector_downward &buf) : buf_(&buf) {} - bool operator()(const Offset &a, const Offset &b) const { - auto stra = reinterpret_cast(buf_->data_at(a.o)); - auto strb = reinterpret_cast(buf_->data_at(b.o)); - return StringLessThan(stra->data(), stra->size(), strb->data(), - strb->size()); - } - const vector_downward *buf_; - }; - - // For use with CreateSharedString. Instantiated on first use only. - typedef std::set, StringOffsetCompare> StringOffsetMap; - StringOffsetMap *string_pool; - - private: - // Allocates space for a vector of structures. - // Must be completed with EndVectorOfStructs(). - template T *StartVectorOfStructs(size_t vector_size) { - StartVector(vector_size * sizeof(T) / AlignOf(), AlignOf()); - return reinterpret_cast(buf_.make_space(vector_size * sizeof(T))); - } - - // End the vector of structues in the flatbuffers. - // Vector should have previously be started with StartVectorOfStructs(). - template - Offset> EndVectorOfStructs(size_t vector_size) { - return Offset>(EndVector(vector_size)); - } -}; -/// @} - -/// @cond FLATBUFFERS_INTERNAL -// Helpers to get a typed pointer to the root object contained in the buffer. -template T *GetMutableRoot(void *buf) { - EndianCheck(); - return reinterpret_cast( - reinterpret_cast(buf) + - EndianScalar(*reinterpret_cast(buf))); -} - -template const T *GetRoot(const void *buf) { - return GetMutableRoot(const_cast(buf)); -} - -template const T *GetSizePrefixedRoot(const void *buf) { - return GetRoot(reinterpret_cast(buf) + sizeof(uoffset_t)); -} - -/// Helpers to get a typed pointer to objects that are currently being built. -/// @warning Creating new objects will lead to reallocations and invalidates -/// the pointer! -template -T *GetMutableTemporaryPointer(FlatBufferBuilder &fbb, Offset offset) { - return reinterpret_cast(fbb.GetCurrentBufferPointer() + fbb.GetSize() - - offset.o); -} - -template -const T *GetTemporaryPointer(FlatBufferBuilder &fbb, Offset offset) { - return GetMutableTemporaryPointer(fbb, offset); -} - -/// @brief Get a pointer to the the file_identifier section of the buffer. -/// @return Returns a const char pointer to the start of the file_identifier -/// characters in the buffer. The returned char * has length -/// 'flatbuffers::FlatBufferBuilder::kFileIdentifierLength'. -/// This function is UNDEFINED for FlatBuffers whose schema does not include -/// a file_identifier (likely points at padding or the start of a the root -/// vtable). -inline const char *GetBufferIdentifier(const void *buf, - bool size_prefixed = false) { - return reinterpret_cast(buf) + - ((size_prefixed) ? 2 * sizeof(uoffset_t) : sizeof(uoffset_t)); -} - -// Helper to see if the identifier in a buffer has the expected value. -inline bool BufferHasIdentifier(const void *buf, const char *identifier, - bool size_prefixed = false) { - return strncmp(GetBufferIdentifier(buf, size_prefixed), identifier, - FlatBufferBuilder::kFileIdentifierLength) == 0; -} - -// Helper class to verify the integrity of a FlatBuffer -class Verifier FLATBUFFERS_FINAL_CLASS { - public: - Verifier(const uint8_t *buf, size_t buf_len, uoffset_t _max_depth = 64, - uoffset_t _max_tables = 1000000, bool _check_alignment = true) - : buf_(buf), - size_(buf_len), - depth_(0), - max_depth_(_max_depth), - num_tables_(0), - max_tables_(_max_tables), - upper_bound_(0), - check_alignment_(_check_alignment) { - FLATBUFFERS_ASSERT(size_ < FLATBUFFERS_MAX_BUFFER_SIZE); - } - - // Central location where any verification failures register. - bool Check(bool ok) const { - // clang-format off - #ifdef FLATBUFFERS_DEBUG_VERIFICATION_FAILURE - FLATBUFFERS_ASSERT(ok); - #endif - #ifdef FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE - if (!ok) - upper_bound_ = 0; - #endif - // clang-format on - return ok; - } - - // Verify any range within the buffer. - bool Verify(size_t elem, size_t elem_len) const { - // clang-format off - #ifdef FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE - auto upper_bound = elem + elem_len; - if (upper_bound_ < upper_bound) - upper_bound_ = upper_bound; - #endif - // clang-format on - return Check(elem_len < size_ && elem <= size_ - elem_len); - } - - template bool VerifyAlignment(size_t elem) const { - return Check((elem & (sizeof(T) - 1)) == 0 || !check_alignment_); - } - - // Verify a range indicated by sizeof(T). - template bool Verify(size_t elem) const { - return VerifyAlignment(elem) && Verify(elem, sizeof(T)); - } - - bool VerifyFromPointer(const uint8_t *p, size_t len) { - auto o = static_cast(p - buf_); - return Verify(o, len); - } - - // Verify relative to a known-good base pointer. - bool Verify(const uint8_t *base, voffset_t elem_off, size_t elem_len) const { - return Verify(static_cast(base - buf_) + elem_off, elem_len); - } - - template - bool Verify(const uint8_t *base, voffset_t elem_off) const { - return Verify(static_cast(base - buf_) + elem_off, sizeof(T)); - } - - // Verify a pointer (may be NULL) of a table type. - template bool VerifyTable(const T *table) { - return !table || table->Verify(*this); - } - - // Verify a pointer (may be NULL) of any vector type. - template bool VerifyVector(const Vector *vec) const { - return !vec || VerifyVectorOrString(reinterpret_cast(vec), - sizeof(T)); - } - - // Verify a pointer (may be NULL) of a vector to struct. - template bool VerifyVector(const Vector *vec) const { - return VerifyVector(reinterpret_cast *>(vec)); - } - - // Verify a pointer (may be NULL) to string. - bool VerifyString(const String *str) const { - size_t end; - return !str || (VerifyVectorOrString(reinterpret_cast(str), - 1, &end) && - Verify(end, 1) && // Must have terminator - Check(buf_[end] == '\0')); // Terminating byte must be 0. - } - - // Common code between vectors and strings. - bool VerifyVectorOrString(const uint8_t *vec, size_t elem_size, - size_t *end = nullptr) const { - auto veco = static_cast(vec - buf_); - // Check we can read the size field. - if (!Verify(veco)) return false; - // Check the whole array. If this is a string, the byte past the array - // must be 0. - auto size = ReadScalar(vec); - auto max_elems = FLATBUFFERS_MAX_BUFFER_SIZE / elem_size; - if (!Check(size < max_elems)) - return false; // Protect against byte_size overflowing. - auto byte_size = sizeof(size) + elem_size * size; - if (end) *end = veco + byte_size; - return Verify(veco, byte_size); - } - - // Special case for string contents, after the above has been called. - bool VerifyVectorOfStrings(const Vector> *vec) const { - if (vec) { - for (uoffset_t i = 0; i < vec->size(); i++) { - if (!VerifyString(vec->Get(i))) return false; - } - } - return true; - } - - // Special case for table contents, after the above has been called. - template bool VerifyVectorOfTables(const Vector> *vec) { - if (vec) { - for (uoffset_t i = 0; i < vec->size(); i++) { - if (!vec->Get(i)->Verify(*this)) return false; - } - } - return true; - } - - __supress_ubsan__("unsigned-integer-overflow") bool VerifyTableStart( - const uint8_t *table) { - // Check the vtable offset. - auto tableo = static_cast(table - buf_); - if (!Verify(tableo)) return false; - // This offset may be signed, but doing the subtraction unsigned always - // gives the result we want. - auto vtableo = tableo - static_cast(ReadScalar(table)); - // Check the vtable size field, then check vtable fits in its entirety. - return VerifyComplexity() && Verify(vtableo) && - VerifyAlignment(ReadScalar(buf_ + vtableo)) && - Verify(vtableo, ReadScalar(buf_ + vtableo)); - } - - template - bool VerifyBufferFromStart(const char *identifier, size_t start) { - if (identifier && (size_ < 2 * sizeof(flatbuffers::uoffset_t) || - !BufferHasIdentifier(buf_ + start, identifier))) { - return false; - } - - // Call T::Verify, which must be in the generated code for this type. - auto o = VerifyOffset(start); - return o && reinterpret_cast(buf_ + start + o)->Verify(*this) - // clang-format off - #ifdef FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE - && GetComputedSize() - #endif - ; - // clang-format on - } - - // Verify this whole buffer, starting with root type T. - template bool VerifyBuffer() { return VerifyBuffer(nullptr); } - - template bool VerifyBuffer(const char *identifier) { - return VerifyBufferFromStart(identifier, 0); - } - - template bool VerifySizePrefixedBuffer(const char *identifier) { - return Verify(0U) && - ReadScalar(buf_) == size_ - sizeof(uoffset_t) && - VerifyBufferFromStart(identifier, sizeof(uoffset_t)); - } - - uoffset_t VerifyOffset(size_t start) const { - if (!Verify(start)) return 0; - auto o = ReadScalar(buf_ + start); - // May not point to itself. - if (!Check(o != 0)) return 0; - // Can't wrap around / buffers are max 2GB. - if (!Check(static_cast(o) >= 0)) return 0; - // Must be inside the buffer to create a pointer from it (pointer outside - // buffer is UB). - if (!Verify(start + o, 1)) return 0; - return o; - } - - uoffset_t VerifyOffset(const uint8_t *base, voffset_t start) const { - return VerifyOffset(static_cast(base - buf_) + start); - } - - // Called at the start of a table to increase counters measuring data - // structure depth and amount, and possibly bails out with false if - // limits set by the constructor have been hit. Needs to be balanced - // with EndTable(). - bool VerifyComplexity() { - depth_++; - num_tables_++; - return Check(depth_ <= max_depth_ && num_tables_ <= max_tables_); - } - - // Called at the end of a table to pop the depth count. - bool EndTable() { - depth_--; - return true; - } - - // Returns the message size in bytes - size_t GetComputedSize() const { - // clang-format off - #ifdef FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE - uintptr_t size = upper_bound_; - // Align the size to uoffset_t - size = (size - 1 + sizeof(uoffset_t)) & ~(sizeof(uoffset_t) - 1); - return (size > size_) ? 0 : size; - #else - // Must turn on FLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE for this to work. - (void)upper_bound_; - FLATBUFFERS_ASSERT(false); - return 0; - #endif - // clang-format on - } - - private: - const uint8_t *buf_; - size_t size_; - uoffset_t depth_; - uoffset_t max_depth_; - uoffset_t num_tables_; - uoffset_t max_tables_; - mutable size_t upper_bound_; - bool check_alignment_; -}; - -// Convenient way to bundle a buffer and its length, to pass it around -// typed by its root. -// A BufferRef does not own its buffer. -struct BufferRefBase {}; // for std::is_base_of -template struct BufferRef : BufferRefBase { - BufferRef() : buf(nullptr), len(0), must_free(false) {} - BufferRef(uint8_t *_buf, uoffset_t _len) - : buf(_buf), len(_len), must_free(false) {} - - ~BufferRef() { - if (must_free) free(buf); - } - - const T *GetRoot() const { return flatbuffers::GetRoot(buf); } - - bool Verify() { - Verifier verifier(buf, len); - return verifier.VerifyBuffer(nullptr); - } - - uint8_t *buf; - uoffset_t len; - bool must_free; -}; - -// "structs" are flat structures that do not have an offset table, thus -// always have all members present and do not support forwards/backwards -// compatible extensions. - -class Struct FLATBUFFERS_FINAL_CLASS { - public: - template T GetField(uoffset_t o) const { - return ReadScalar(&data_[o]); - } - - template T GetStruct(uoffset_t o) const { - return reinterpret_cast(&data_[o]); - } - - const uint8_t *GetAddressOf(uoffset_t o) const { return &data_[o]; } - uint8_t *GetAddressOf(uoffset_t o) { return &data_[o]; } - - private: - // private constructor & copy constructor: you obtain instances of this - // class by pointing to existing data only - Struct(); - Struct(const Struct &); - Struct &operator=(const Struct &); - - uint8_t data_[1]; -}; - -// "tables" use an offset table (possibly shared) that allows fields to be -// omitted and added at will, but uses an extra indirection to read. -class Table { - public: - const uint8_t *GetVTable() const { - return data_ - ReadScalar(data_); - } - - // This gets the field offset for any of the functions below it, or 0 - // if the field was not present. - voffset_t GetOptionalFieldOffset(voffset_t field) const { - // The vtable offset is always at the start. - auto vtable = GetVTable(); - // The first element is the size of the vtable (fields + type id + itself). - auto vtsize = ReadScalar(vtable); - // If the field we're accessing is outside the vtable, we're reading older - // data, so it's the same as if the offset was 0 (not present). - return field < vtsize ? ReadScalar(vtable + field) : 0; - } - - template T GetField(voffset_t field, T defaultval) const { - auto field_offset = GetOptionalFieldOffset(field); - return field_offset ? ReadScalar(data_ + field_offset) : defaultval; - } - - template P GetPointer(voffset_t field) { - auto field_offset = GetOptionalFieldOffset(field); - auto p = data_ + field_offset; - return field_offset ? reinterpret_cast

(p + ReadScalar(p)) - : nullptr; - } - template P GetPointer(voffset_t field) const { - return const_cast(this)->GetPointer

(field); - } - - template P GetStruct(voffset_t field) const { - auto field_offset = GetOptionalFieldOffset(field); - auto p = const_cast(data_ + field_offset); - return field_offset ? reinterpret_cast

(p) : nullptr; - } - - template bool SetField(voffset_t field, T val, T def) { - auto field_offset = GetOptionalFieldOffset(field); - if (!field_offset) return IsTheSameAs(val, def); - WriteScalar(data_ + field_offset, val); - return true; - } - - bool SetPointer(voffset_t field, const uint8_t *val) { - auto field_offset = GetOptionalFieldOffset(field); - if (!field_offset) return false; - WriteScalar(data_ + field_offset, - static_cast(val - (data_ + field_offset))); - return true; - } - - uint8_t *GetAddressOf(voffset_t field) { - auto field_offset = GetOptionalFieldOffset(field); - return field_offset ? data_ + field_offset : nullptr; - } - const uint8_t *GetAddressOf(voffset_t field) const { - return const_cast

(this)->GetAddressOf(field); - } - - bool CheckField(voffset_t field) const { - return GetOptionalFieldOffset(field) != 0; - } - - // Verify the vtable of this table. - // Call this once per table, followed by VerifyField once per field. - bool VerifyTableStart(Verifier &verifier) const { - return verifier.VerifyTableStart(data_); - } - - // Verify a particular field. - template - bool VerifyField(const Verifier &verifier, voffset_t field) const { - // Calling GetOptionalFieldOffset should be safe now thanks to - // VerifyTable(). - auto field_offset = GetOptionalFieldOffset(field); - // Check the actual field. - return !field_offset || verifier.Verify(data_, field_offset); - } - - // VerifyField for required fields. - template - bool VerifyFieldRequired(const Verifier &verifier, voffset_t field) const { - auto field_offset = GetOptionalFieldOffset(field); - return verifier.Check(field_offset != 0) && - verifier.Verify(data_, field_offset); - } - - // Versions for offsets. - bool VerifyOffset(const Verifier &verifier, voffset_t field) const { - auto field_offset = GetOptionalFieldOffset(field); - return !field_offset || verifier.VerifyOffset(data_, field_offset); - } - - bool VerifyOffsetRequired(const Verifier &verifier, voffset_t field) const { - auto field_offset = GetOptionalFieldOffset(field); - return verifier.Check(field_offset != 0) && - verifier.VerifyOffset(data_, field_offset); - } - - private: - // private constructor & copy constructor: you obtain instances of this - // class by pointing to existing data only - Table(); - Table(const Table &other); - Table &operator=(const Table &); - - uint8_t data_[1]; -}; - -template -void FlatBufferBuilder::Required(Offset table, voffset_t field) { - auto table_ptr = reinterpret_cast(buf_.data_at(table.o)); - bool ok = table_ptr->GetOptionalFieldOffset(field) != 0; - // If this fails, the caller will show what field needs to be set. - FLATBUFFERS_ASSERT(ok); - (void)ok; -} - -/// @brief This can compute the start of a FlatBuffer from a root pointer, i.e. -/// it is the opposite transformation of GetRoot(). -/// This may be useful if you want to pass on a root and have the recipient -/// delete the buffer afterwards. -inline const uint8_t *GetBufferStartFromRootPointer(const void *root) { - auto table = reinterpret_cast(root); - auto vtable = table->GetVTable(); - // Either the vtable is before the root or after the root. - auto start = (std::min)(vtable, reinterpret_cast(root)); - // Align to at least sizeof(uoffset_t). - start = reinterpret_cast(reinterpret_cast(start) & - ~(sizeof(uoffset_t) - 1)); - // Additionally, there may be a file_identifier in the buffer, and the root - // offset. The buffer may have been aligned to any size between - // sizeof(uoffset_t) and FLATBUFFERS_MAX_ALIGNMENT (see "force_align"). - // Sadly, the exact alignment is only known when constructing the buffer, - // since it depends on the presence of values with said alignment properties. - // So instead, we simply look at the next uoffset_t values (root, - // file_identifier, and alignment padding) to see which points to the root. - // None of the other values can "impersonate" the root since they will either - // be 0 or four ASCII characters. - static_assert(FlatBufferBuilder::kFileIdentifierLength == sizeof(uoffset_t), - "file_identifier is assumed to be the same size as uoffset_t"); - for (auto possible_roots = FLATBUFFERS_MAX_ALIGNMENT / sizeof(uoffset_t) + 1; - possible_roots; possible_roots--) { - start -= sizeof(uoffset_t); - if (ReadScalar(start) + start == - reinterpret_cast(root)) - return start; - } - // We didn't find the root, either the "root" passed isn't really a root, - // or the buffer is corrupt. - // Assert, because calling this function with bad data may cause reads - // outside of buffer boundaries. - FLATBUFFERS_ASSERT(false); - return nullptr; -} - -/// @brief This return the prefixed size of a FlatBuffer. -inline uoffset_t GetPrefixedSize(const uint8_t *buf) { - return ReadScalar(buf); -} - -// Base class for native objects (FlatBuffer data de-serialized into native -// C++ data structures). -// Contains no functionality, purely documentative. -struct NativeTable {}; - -/// @brief Function types to be used with resolving hashes into objects and -/// back again. The resolver gets a pointer to a field inside an object API -/// object that is of the type specified in the schema using the attribute -/// `cpp_type` (it is thus important whatever you write to this address -/// matches that type). The value of this field is initially null, so you -/// may choose to implement a delayed binding lookup using this function -/// if you wish. The resolver does the opposite lookup, for when the object -/// is being serialized again. -typedef uint64_t hash_value_t; -// clang-format off -#ifdef FLATBUFFERS_CPP98_STL - typedef void (*resolver_function_t)(void **pointer_adr, hash_value_t hash); - typedef hash_value_t (*rehasher_function_t)(void *pointer); -#else - typedef std::function - resolver_function_t; - typedef std::function rehasher_function_t; -#endif -// clang-format on - -// Helper function to test if a field is present, using any of the field -// enums in the generated code. -// `table` must be a generated table type. Since this is a template parameter, -// this is not typechecked to be a subclass of Table, so beware! -// Note: this function will return false for fields equal to the default -// value, since they're not stored in the buffer (unless force_defaults was -// used). -template -bool IsFieldPresent(const T *table, typename T::FlatBuffersVTableOffset field) { - // Cast, since Table is a private baseclass of any table types. - return reinterpret_cast(table)->CheckField( - static_cast(field)); -} - -// Utility function for reverse lookups on the EnumNames*() functions -// (in the generated C++ code) -// names must be NULL terminated. -inline int LookupEnum(const char **names, const char *name) { - for (const char **p = names; *p; p++) - if (!strcmp(*p, name)) return static_cast(p - names); - return -1; -} - -// These macros allow us to layout a struct with a guarantee that they'll end -// up looking the same on different compilers and platforms. -// It does this by disallowing the compiler to do any padding, and then -// does padding itself by inserting extra padding fields that make every -// element aligned to its own size. -// Additionally, it manually sets the alignment of the struct as a whole, -// which is typically its largest element, or a custom size set in the schema -// by the force_align attribute. -// These are used in the generated code only. - -// clang-format off -#if defined(_MSC_VER) - #define FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(alignment) \ - __pragma(pack(1)) \ - struct __declspec(align(alignment)) - #define FLATBUFFERS_STRUCT_END(name, size) \ - __pragma(pack()) \ - static_assert(sizeof(name) == size, "compiler breaks packing rules") -#elif defined(__GNUC__) || defined(__clang__) || defined(__ICCARM__) - #define FLATBUFFERS_MANUALLY_ALIGNED_STRUCT(alignment) \ - _Pragma("pack(1)") \ - struct __attribute__((aligned(alignment))) - #define FLATBUFFERS_STRUCT_END(name, size) \ - _Pragma("pack()") \ - static_assert(sizeof(name) == size, "compiler breaks packing rules") -#else - #error Unknown compiler, please define structure alignment macros -#endif -// clang-format on - -// Minimal reflection via code generation. -// Besides full-fat reflection (see reflection.h) and parsing/printing by -// loading schemas (see idl.h), we can also have code generation for mimimal -// reflection data which allows pretty-printing and other uses without needing -// a schema or a parser. -// Generate code with --reflect-types (types only) or --reflect-names (names -// also) to enable. -// See minireflect.h for utilities using this functionality. - -// These types are organized slightly differently as the ones in idl.h. -enum SequenceType { ST_TABLE, ST_STRUCT, ST_UNION, ST_ENUM }; - -// Scalars have the same order as in idl.h -// clang-format off -#define FLATBUFFERS_GEN_ELEMENTARY_TYPES(ET) \ - ET(ET_UTYPE) \ - ET(ET_BOOL) \ - ET(ET_CHAR) \ - ET(ET_UCHAR) \ - ET(ET_SHORT) \ - ET(ET_USHORT) \ - ET(ET_INT) \ - ET(ET_UINT) \ - ET(ET_LONG) \ - ET(ET_ULONG) \ - ET(ET_FLOAT) \ - ET(ET_DOUBLE) \ - ET(ET_STRING) \ - ET(ET_SEQUENCE) // See SequenceType. - -enum ElementaryType { - #define FLATBUFFERS_ET(E) E, - FLATBUFFERS_GEN_ELEMENTARY_TYPES(FLATBUFFERS_ET) - #undef FLATBUFFERS_ET -}; - -inline const char * const *ElementaryTypeNames() { - static const char * const names[] = { - #define FLATBUFFERS_ET(E) #E, - FLATBUFFERS_GEN_ELEMENTARY_TYPES(FLATBUFFERS_ET) - #undef FLATBUFFERS_ET - }; - return names; -} -// clang-format on - -// Basic type info cost just 16bits per field! -struct TypeCode { - uint16_t base_type : 4; // ElementaryType - uint16_t is_vector : 1; - int16_t sequence_ref : 11; // Index into type_refs below, or -1 for none. -}; - -static_assert(sizeof(TypeCode) == 2, "TypeCode"); - -struct TypeTable; - -// Signature of the static method present in each type. -typedef const TypeTable *(*TypeFunction)(); - -struct TypeTable { - SequenceType st; - size_t num_elems; // of type_codes, values, names (but not type_refs). - const TypeCode *type_codes; // num_elems count - const TypeFunction *type_refs; // less than num_elems entries (see TypeCode). - const int64_t *values; // Only set for non-consecutive enum/union or structs. - const char *const *names; // Only set if compiled with --reflect-names. -}; - -// String which identifies the current version of FlatBuffers. -// flatbuffer_version_string is used by Google developers to identify which -// applications uploaded to Google Play are using this library. This allows -// the development team at Google to determine the popularity of the library. -// How it works: Applications that are uploaded to the Google Play Store are -// scanned for this version string. We track which applications are using it -// to measure popularity. You are free to remove it (of course) but we would -// appreciate if you left it in. - -// Weak linkage is culled by VS & doesn't work on cygwin. -// clang-format off -#if !defined(_WIN32) && !defined(__CYGWIN__) - -extern volatile __attribute__((weak)) const char *flatbuffer_version_string; -volatile __attribute__((weak)) const char *flatbuffer_version_string = - "FlatBuffers " - FLATBUFFERS_STRING(FLATBUFFERS_VERSION_MAJOR) "." - FLATBUFFERS_STRING(FLATBUFFERS_VERSION_MINOR) "." - FLATBUFFERS_STRING(FLATBUFFERS_VERSION_REVISION); - -#endif // !defined(_WIN32) && !defined(__CYGWIN__) - -#define FLATBUFFERS_DEFINE_BITMASK_OPERATORS(E, T)\ - inline E operator | (E lhs, E rhs){\ - return E(T(lhs) | T(rhs));\ - }\ - inline E operator & (E lhs, E rhs){\ - return E(T(lhs) & T(rhs));\ - }\ - inline E operator ^ (E lhs, E rhs){\ - return E(T(lhs) ^ T(rhs));\ - }\ - inline E operator ~ (E lhs){\ - return E(~T(lhs));\ - }\ - inline E operator |= (E &lhs, E rhs){\ - lhs = lhs | rhs;\ - return lhs;\ - }\ - inline E operator &= (E &lhs, E rhs){\ - lhs = lhs & rhs;\ - return lhs;\ - }\ - inline E operator ^= (E &lhs, E rhs){\ - lhs = lhs ^ rhs;\ - return lhs;\ - }\ - inline bool operator !(E rhs) \ - {\ - return !bool(T(rhs)); \ - } -/// @endcond -} // namespace flatbuffers - -// clang-format on - -#endif // FLATBUFFERS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/flatc.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/flatc.h deleted file mode 100644 index 5e2709e..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/flatc.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Copyright 2017 Google Inc. 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 FLATBUFFERS_FLATC_H_ -#define FLATBUFFERS_FLATC_H_ - -#include -#include -#include - -#include "flatbuffers/flatbuffers.h" -#include "flatbuffers/idl.h" -#include "flatbuffers/util.h" - -namespace flatbuffers { - -extern void LogCompilerWarn(const std::string &warn); -extern void LogCompilerError(const std::string &err); - -class FlatCompiler { - public: - // Output generator for the various programming languages and formats we - // support. - struct Generator { - typedef bool (*GenerateFn)(const flatbuffers::Parser &parser, - const std::string &path, - const std::string &file_name); - typedef std::string (*MakeRuleFn)(const flatbuffers::Parser &parser, - const std::string &path, - const std::string &file_name); - - GenerateFn generate; - const char *generator_opt_short; - const char *generator_opt_long; - const char *lang_name; - bool schema_only; - GenerateFn generateGRPC; - flatbuffers::IDLOptions::Language lang; - const char *generator_help; - MakeRuleFn make_rule; - }; - - typedef void (*WarnFn)(const FlatCompiler *flatc, const std::string &warn, - bool show_exe_name); - - typedef void (*ErrorFn)(const FlatCompiler *flatc, const std::string &err, - bool usage, bool show_exe_name); - - // Parameters required to initialize the FlatCompiler. - struct InitParams { - InitParams() - : generators(nullptr), - num_generators(0), - warn_fn(nullptr), - error_fn(nullptr) {} - - const Generator *generators; - size_t num_generators; - WarnFn warn_fn; - ErrorFn error_fn; - }; - - explicit FlatCompiler(const InitParams ¶ms) : params_(params) {} - - int Compile(int argc, const char **argv); - - std::string GetUsageString(const char *program_name) const; - - private: - void ParseFile(flatbuffers::Parser &parser, const std::string &filename, - const std::string &contents, - std::vector &include_directories) const; - - void LoadBinarySchema(Parser &parser, const std::string &filename, - const std::string &contents); - - void Warn(const std::string &warn, bool show_exe_name = true) const; - - void Error(const std::string &err, bool usage = true, - bool show_exe_name = true) const; - - InitParams params_; -}; - -} // namespace flatbuffers - -#endif // FLATBUFFERS_FLATC_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/flexbuffers.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/flexbuffers.h deleted file mode 100644 index dceaa3b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/flexbuffers.h +++ /dev/null @@ -1,1617 +0,0 @@ -/* - * Copyright 2017 Google Inc. 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 FLATBUFFERS_FLEXBUFFERS_H_ -#define FLATBUFFERS_FLEXBUFFERS_H_ - -#include -// Used to select STL variant. -#include "flatbuffers/base.h" -// We use the basic binary writing functions from the regular FlatBuffers. -#include "flatbuffers/util.h" - -#ifdef _MSC_VER -# include -#endif - -#if defined(_MSC_VER) -# pragma warning(push) -# pragma warning(disable : 4127) // C4127: conditional expression is constant -#endif - -namespace flexbuffers { - -class Reference; -class Map; - -// These are used in the lower 2 bits of a type field to determine the size of -// the elements (and or size field) of the item pointed to (e.g. vector). -enum BitWidth { - BIT_WIDTH_8 = 0, - BIT_WIDTH_16 = 1, - BIT_WIDTH_32 = 2, - BIT_WIDTH_64 = 3, -}; - -// These are used as the upper 6 bits of a type field to indicate the actual -// type. -enum Type { - FBT_NULL = 0, - FBT_INT = 1, - FBT_UINT = 2, - FBT_FLOAT = 3, - // Types above stored inline, types below store an offset. - FBT_KEY = 4, - FBT_STRING = 5, - FBT_INDIRECT_INT = 6, - FBT_INDIRECT_UINT = 7, - FBT_INDIRECT_FLOAT = 8, - FBT_MAP = 9, - FBT_VECTOR = 10, // Untyped. - FBT_VECTOR_INT = 11, // Typed any size (stores no type table). - FBT_VECTOR_UINT = 12, - FBT_VECTOR_FLOAT = 13, - FBT_VECTOR_KEY = 14, - // DEPRECATED, use FBT_VECTOR or FBT_VECTOR_KEY instead. - // Read test.cpp/FlexBuffersDeprecatedTest() for details on why. - FBT_VECTOR_STRING_DEPRECATED = 15, - FBT_VECTOR_INT2 = 16, // Typed tuple (no type table, no size field). - FBT_VECTOR_UINT2 = 17, - FBT_VECTOR_FLOAT2 = 18, - FBT_VECTOR_INT3 = 19, // Typed triple (no type table, no size field). - FBT_VECTOR_UINT3 = 20, - FBT_VECTOR_FLOAT3 = 21, - FBT_VECTOR_INT4 = 22, // Typed quad (no type table, no size field). - FBT_VECTOR_UINT4 = 23, - FBT_VECTOR_FLOAT4 = 24, - FBT_BLOB = 25, - FBT_BOOL = 26, - FBT_VECTOR_BOOL = - 36, // To Allow the same type of conversion of type to vector type -}; - -inline bool IsInline(Type t) { return t <= FBT_FLOAT || t == FBT_BOOL; } - -inline bool IsTypedVectorElementType(Type t) { - return (t >= FBT_INT && t <= FBT_STRING) || t == FBT_BOOL; -} - -inline bool IsTypedVector(Type t) { - return (t >= FBT_VECTOR_INT && t <= FBT_VECTOR_STRING_DEPRECATED) || - t == FBT_VECTOR_BOOL; -} - -inline bool IsFixedTypedVector(Type t) { - return t >= FBT_VECTOR_INT2 && t <= FBT_VECTOR_FLOAT4; -} - -inline Type ToTypedVector(Type t, size_t fixed_len = 0) { - FLATBUFFERS_ASSERT(IsTypedVectorElementType(t)); - switch (fixed_len) { - case 0: return static_cast(t - FBT_INT + FBT_VECTOR_INT); - case 2: return static_cast(t - FBT_INT + FBT_VECTOR_INT2); - case 3: return static_cast(t - FBT_INT + FBT_VECTOR_INT3); - case 4: return static_cast(t - FBT_INT + FBT_VECTOR_INT4); - default: FLATBUFFERS_ASSERT(0); return FBT_NULL; - } -} - -inline Type ToTypedVectorElementType(Type t) { - FLATBUFFERS_ASSERT(IsTypedVector(t)); - return static_cast(t - FBT_VECTOR_INT + FBT_INT); -} - -inline Type ToFixedTypedVectorElementType(Type t, uint8_t *len) { - FLATBUFFERS_ASSERT(IsFixedTypedVector(t)); - auto fixed_type = t - FBT_VECTOR_INT2; - *len = static_cast(fixed_type / 3 + - 2); // 3 types each, starting from length 2. - return static_cast(fixed_type % 3 + FBT_INT); -} - -// TODO: implement proper support for 8/16bit floats, or decide not to -// support them. -typedef int16_t half; -typedef int8_t quarter; - -// TODO: can we do this without conditionals using intrinsics or inline asm -// on some platforms? Given branch prediction the method below should be -// decently quick, but it is the most frequently executed function. -// We could do an (unaligned) 64-bit read if we ifdef out the platforms for -// which that doesn't work (or where we'd read into un-owned memory). -template -R ReadSizedScalar(const uint8_t *data, uint8_t byte_width) { - return byte_width < 4 - ? (byte_width < 2 - ? static_cast(flatbuffers::ReadScalar(data)) - : static_cast(flatbuffers::ReadScalar(data))) - : (byte_width < 8 - ? static_cast(flatbuffers::ReadScalar(data)) - : static_cast(flatbuffers::ReadScalar(data))); -} - -inline int64_t ReadInt64(const uint8_t *data, uint8_t byte_width) { - return ReadSizedScalar( - data, byte_width); -} - -inline uint64_t ReadUInt64(const uint8_t *data, uint8_t byte_width) { - // This is the "hottest" function (all offset lookups use this), so worth - // optimizing if possible. - // TODO: GCC apparently replaces memcpy by a rep movsb, but only if count is a - // constant, which here it isn't. Test if memcpy is still faster than - // the conditionals in ReadSizedScalar. Can also use inline asm. - // clang-format off - #if defined(_MSC_VER) && (defined(_M_X64) || defined _M_IX86) - uint64_t u = 0; - __movsb(reinterpret_cast(&u), - reinterpret_cast(data), byte_width); - return flatbuffers::EndianScalar(u); - #else - return ReadSizedScalar( - data, byte_width); - #endif - // clang-format on -} - -inline double ReadDouble(const uint8_t *data, uint8_t byte_width) { - return ReadSizedScalar(data, - byte_width); -} - -inline const uint8_t *Indirect(const uint8_t *offset, uint8_t byte_width) { - return offset - ReadUInt64(offset, byte_width); -} - -template const uint8_t *Indirect(const uint8_t *offset) { - return offset - flatbuffers::ReadScalar(offset); -} - -inline BitWidth WidthU(uint64_t u) { -#define FLATBUFFERS_GET_FIELD_BIT_WIDTH(value, width) \ - { \ - if (!((u) & ~((1ULL << (width)) - 1ULL))) return BIT_WIDTH_##width; \ - } - FLATBUFFERS_GET_FIELD_BIT_WIDTH(u, 8); - FLATBUFFERS_GET_FIELD_BIT_WIDTH(u, 16); - FLATBUFFERS_GET_FIELD_BIT_WIDTH(u, 32); -#undef FLATBUFFERS_GET_FIELD_BIT_WIDTH - return BIT_WIDTH_64; -} - -inline BitWidth WidthI(int64_t i) { - auto u = static_cast(i) << 1; - return WidthU(i >= 0 ? u : ~u); -} - -inline BitWidth WidthF(double f) { - return static_cast(static_cast(f)) == f ? BIT_WIDTH_32 - : BIT_WIDTH_64; -} - -// Base class of all types below. -// Points into the data buffer and allows access to one type. -class Object { - public: - Object(const uint8_t *data, uint8_t byte_width) - : data_(data), byte_width_(byte_width) {} - - protected: - const uint8_t *data_; - uint8_t byte_width_; -}; - -// Object that has a size, obtained either from size prefix, or elsewhere. -class Sized : public Object { - public: - // Size prefix. - Sized(const uint8_t *data, uint8_t byte_width) - : Object(data, byte_width), size_(read_size()) {} - // Manual size. - Sized(const uint8_t *data, uint8_t byte_width, size_t sz) - : Object(data, byte_width), size_(sz) {} - size_t size() const { return size_; } - // Access size stored in `byte_width_` bytes before data_ pointer. - size_t read_size() const { - return static_cast(ReadUInt64(data_ - byte_width_, byte_width_)); - } - - protected: - size_t size_; -}; - -class String : public Sized { - public: - // Size prefix. - String(const uint8_t *data, uint8_t byte_width) : Sized(data, byte_width) {} - // Manual size. - String(const uint8_t *data, uint8_t byte_width, size_t sz) - : Sized(data, byte_width, sz) {} - - size_t length() const { return size(); } - const char *c_str() const { return reinterpret_cast(data_); } - std::string str() const { return std::string(c_str(), size()); } - - static String EmptyString() { - static const char *empty_string = ""; - return String(reinterpret_cast(empty_string), 1, 0); - } - bool IsTheEmptyString() const { return data_ == EmptyString().data_; } -}; - -class Blob : public Sized { - public: - Blob(const uint8_t *data_buf, uint8_t byte_width) - : Sized(data_buf, byte_width) {} - - static Blob EmptyBlob() { - static const uint8_t empty_blob[] = { 0 /*len*/ }; - return Blob(empty_blob + 1, 1); - } - bool IsTheEmptyBlob() const { return data_ == EmptyBlob().data_; } - const uint8_t *data() const { return data_; } -}; - -class Vector : public Sized { - public: - Vector(const uint8_t *data, uint8_t byte_width) : Sized(data, byte_width) {} - - Reference operator[](size_t i) const; - - static Vector EmptyVector() { - static const uint8_t empty_vector[] = { 0 /*len*/ }; - return Vector(empty_vector + 1, 1); - } - bool IsTheEmptyVector() const { return data_ == EmptyVector().data_; } -}; - -class TypedVector : public Sized { - public: - TypedVector(const uint8_t *data, uint8_t byte_width, Type element_type) - : Sized(data, byte_width), type_(element_type) {} - - Reference operator[](size_t i) const; - - static TypedVector EmptyTypedVector() { - static const uint8_t empty_typed_vector[] = { 0 /*len*/ }; - return TypedVector(empty_typed_vector + 1, 1, FBT_INT); - } - bool IsTheEmptyVector() const { - return data_ == TypedVector::EmptyTypedVector().data_; - } - - Type ElementType() { return type_; } - - friend Reference; - - private: - Type type_; - - friend Map; -}; - -class FixedTypedVector : public Object { - public: - FixedTypedVector(const uint8_t *data, uint8_t byte_width, Type element_type, - uint8_t len) - : Object(data, byte_width), type_(element_type), len_(len) {} - - Reference operator[](size_t i) const; - - static FixedTypedVector EmptyFixedTypedVector() { - static const uint8_t fixed_empty_vector[] = { 0 /* unused */ }; - return FixedTypedVector(fixed_empty_vector, 1, FBT_INT, 0); - } - bool IsTheEmptyFixedTypedVector() const { - return data_ == FixedTypedVector::EmptyFixedTypedVector().data_; - } - - Type ElementType() { return type_; } - uint8_t size() { return len_; } - - private: - Type type_; - uint8_t len_; -}; - -class Map : public Vector { - public: - Map(const uint8_t *data, uint8_t byte_width) : Vector(data, byte_width) {} - - Reference operator[](const char *key) const; - Reference operator[](const std::string &key) const; - - Vector Values() const { return Vector(data_, byte_width_); } - - TypedVector Keys() const { - const size_t num_prefixed_fields = 3; - auto keys_offset = data_ - byte_width_ * num_prefixed_fields; - return TypedVector(Indirect(keys_offset, byte_width_), - static_cast( - ReadUInt64(keys_offset + byte_width_, byte_width_)), - FBT_KEY); - } - - static Map EmptyMap() { - static const uint8_t empty_map[] = { - 0 /*keys_len*/, 0 /*keys_offset*/, 1 /*keys_width*/, 0 /*len*/ - }; - return Map(empty_map + 4, 1); - } - - bool IsTheEmptyMap() const { return data_ == EmptyMap().data_; } -}; - -template -void AppendToString(std::string &s, T &&v, bool keys_quoted) { - s += "[ "; - for (size_t i = 0; i < v.size(); i++) { - if (i) s += ", "; - v[i].ToString(true, keys_quoted, s); - } - s += " ]"; -} - -class Reference { - public: - Reference() - : data_(nullptr), - parent_width_(0), - byte_width_(BIT_WIDTH_8), - type_(FBT_NULL) {} - - Reference(const uint8_t *data, uint8_t parent_width, uint8_t byte_width, - Type type) - : data_(data), - parent_width_(parent_width), - byte_width_(byte_width), - type_(type) {} - - Reference(const uint8_t *data, uint8_t parent_width, uint8_t packed_type) - : data_(data), parent_width_(parent_width) { - byte_width_ = 1U << static_cast(packed_type & 3); - type_ = static_cast(packed_type >> 2); - } - - Type GetType() const { return type_; } - - bool IsNull() const { return type_ == FBT_NULL; } - bool IsBool() const { return type_ == FBT_BOOL; } - bool IsInt() const { return type_ == FBT_INT || type_ == FBT_INDIRECT_INT; } - bool IsUInt() const { - return type_ == FBT_UINT || type_ == FBT_INDIRECT_UINT; - } - bool IsIntOrUint() const { return IsInt() || IsUInt(); } - bool IsFloat() const { - return type_ == FBT_FLOAT || type_ == FBT_INDIRECT_FLOAT; - } - bool IsNumeric() const { return IsIntOrUint() || IsFloat(); } - bool IsString() const { return type_ == FBT_STRING; } - bool IsKey() const { return type_ == FBT_KEY; } - bool IsVector() const { return type_ == FBT_VECTOR || type_ == FBT_MAP; } - bool IsUntypedVector() const { return type_ == FBT_VECTOR; } - bool IsTypedVector() const { return flexbuffers::IsTypedVector(type_); } - bool IsFixedTypedVector() const { - return flexbuffers::IsFixedTypedVector(type_); - } - bool IsAnyVector() const { - return (IsTypedVector() || IsFixedTypedVector() || IsVector()); - } - bool IsMap() const { return type_ == FBT_MAP; } - bool IsBlob() const { return type_ == FBT_BLOB; } - bool AsBool() const { - return (type_ == FBT_BOOL ? ReadUInt64(data_, parent_width_) - : AsUInt64()) != 0; - } - - // Reads any type as a int64_t. Never fails, does most sensible conversion. - // Truncates floats, strings are attempted to be parsed for a number, - // vectors/maps return their size. Returns 0 if all else fails. - int64_t AsInt64() const { - if (type_ == FBT_INT) { - // A fast path for the common case. - return ReadInt64(data_, parent_width_); - } else - switch (type_) { - case FBT_INDIRECT_INT: return ReadInt64(Indirect(), byte_width_); - case FBT_UINT: return ReadUInt64(data_, parent_width_); - case FBT_INDIRECT_UINT: return ReadUInt64(Indirect(), byte_width_); - case FBT_FLOAT: - return static_cast(ReadDouble(data_, parent_width_)); - case FBT_INDIRECT_FLOAT: - return static_cast(ReadDouble(Indirect(), byte_width_)); - case FBT_NULL: return 0; - case FBT_STRING: return flatbuffers::StringToInt(AsString().c_str()); - case FBT_VECTOR: return static_cast(AsVector().size()); - case FBT_BOOL: return ReadInt64(data_, parent_width_); - default: - // Convert other things to int. - return 0; - } - } - - // TODO: could specialize these to not use AsInt64() if that saves - // extension ops in generated code, and use a faster op than ReadInt64. - int32_t AsInt32() const { return static_cast(AsInt64()); } - int16_t AsInt16() const { return static_cast(AsInt64()); } - int8_t AsInt8() const { return static_cast(AsInt64()); } - - uint64_t AsUInt64() const { - if (type_ == FBT_UINT) { - // A fast path for the common case. - return ReadUInt64(data_, parent_width_); - } else - switch (type_) { - case FBT_INDIRECT_UINT: return ReadUInt64(Indirect(), byte_width_); - case FBT_INT: return ReadInt64(data_, parent_width_); - case FBT_INDIRECT_INT: return ReadInt64(Indirect(), byte_width_); - case FBT_FLOAT: - return static_cast(ReadDouble(data_, parent_width_)); - case FBT_INDIRECT_FLOAT: - return static_cast(ReadDouble(Indirect(), byte_width_)); - case FBT_NULL: return 0; - case FBT_STRING: return flatbuffers::StringToUInt(AsString().c_str()); - case FBT_VECTOR: return static_cast(AsVector().size()); - case FBT_BOOL: return ReadUInt64(data_, parent_width_); - default: - // Convert other things to uint. - return 0; - } - } - - uint32_t AsUInt32() const { return static_cast(AsUInt64()); } - uint16_t AsUInt16() const { return static_cast(AsUInt64()); } - uint8_t AsUInt8() const { return static_cast(AsUInt64()); } - - double AsDouble() const { - if (type_ == FBT_FLOAT) { - // A fast path for the common case. - return ReadDouble(data_, parent_width_); - } else - switch (type_) { - case FBT_INDIRECT_FLOAT: return ReadDouble(Indirect(), byte_width_); - case FBT_INT: - return static_cast(ReadInt64(data_, parent_width_)); - case FBT_UINT: - return static_cast(ReadUInt64(data_, parent_width_)); - case FBT_INDIRECT_INT: - return static_cast(ReadInt64(Indirect(), byte_width_)); - case FBT_INDIRECT_UINT: - return static_cast(ReadUInt64(Indirect(), byte_width_)); - case FBT_NULL: return 0.0; - case FBT_STRING: { - double d; - flatbuffers::StringToNumber(AsString().c_str(), &d); - return d; - } - case FBT_VECTOR: return static_cast(AsVector().size()); - case FBT_BOOL: - return static_cast(ReadUInt64(data_, parent_width_)); - default: - // Convert strings and other things to float. - return 0; - } - } - - float AsFloat() const { return static_cast(AsDouble()); } - - const char *AsKey() const { - if (type_ == FBT_KEY || type_ == FBT_STRING) { - return reinterpret_cast(Indirect()); - } else { - return ""; - } - } - - // This function returns the empty string if you try to read something that - // is not a string or key. - String AsString() const { - if (type_ == FBT_STRING) { - return String(Indirect(), byte_width_); - } else if (type_ == FBT_KEY) { - auto key = Indirect(); - return String(key, byte_width_, - strlen(reinterpret_cast(key))); - } else { - return String::EmptyString(); - } - } - - // Unlike AsString(), this will convert any type to a std::string. - std::string ToString() const { - std::string s; - ToString(false, false, s); - return s; - } - - // Convert any type to a JSON-like string. strings_quoted determines if - // string values at the top level receive "" quotes (inside other values - // they always do). keys_quoted determines if keys are quoted, at any level. - // TODO(wvo): add further options to have indentation/newlines. - void ToString(bool strings_quoted, bool keys_quoted, std::string &s) const { - if (type_ == FBT_STRING) { - String str(Indirect(), byte_width_); - if (strings_quoted) { - flatbuffers::EscapeString(str.c_str(), str.length(), &s, true, false); - } else { - s.append(str.c_str(), str.length()); - } - } else if (IsKey()) { - auto str = AsKey(); - if (keys_quoted) { - flatbuffers::EscapeString(str, strlen(str), &s, true, false); - } else { - s += str; - } - } else if (IsInt()) { - s += flatbuffers::NumToString(AsInt64()); - } else if (IsUInt()) { - s += flatbuffers::NumToString(AsUInt64()); - } else if (IsFloat()) { - s += flatbuffers::NumToString(AsDouble()); - } else if (IsNull()) { - s += "null"; - } else if (IsBool()) { - s += AsBool() ? "true" : "false"; - } else if (IsMap()) { - s += "{ "; - auto m = AsMap(); - auto keys = m.Keys(); - auto vals = m.Values(); - for (size_t i = 0; i < keys.size(); i++) { - keys[i].ToString(true, keys_quoted, s); - s += ": "; - vals[i].ToString(true, keys_quoted, s); - if (i < keys.size() - 1) s += ", "; - } - s += " }"; - } else if (IsVector()) { - AppendToString(s, AsVector(), keys_quoted); - } else if (IsTypedVector()) { - AppendToString(s, AsTypedVector(), keys_quoted); - } else if (IsFixedTypedVector()) { - AppendToString(s, AsFixedTypedVector(), keys_quoted); - } else if (IsBlob()) { - auto blob = AsBlob(); - flatbuffers::EscapeString(reinterpret_cast(blob.data()), - blob.size(), &s, true, false); - } else { - s += "(?)"; - } - } - - // This function returns the empty blob if you try to read a not-blob. - // Strings can be viewed as blobs too. - Blob AsBlob() const { - if (type_ == FBT_BLOB || type_ == FBT_STRING) { - return Blob(Indirect(), byte_width_); - } else { - return Blob::EmptyBlob(); - } - } - - // This function returns the empty vector if you try to read a not-vector. - // Maps can be viewed as vectors too. - Vector AsVector() const { - if (type_ == FBT_VECTOR || type_ == FBT_MAP) { - return Vector(Indirect(), byte_width_); - } else { - return Vector::EmptyVector(); - } - } - - TypedVector AsTypedVector() const { - if (IsTypedVector()) { - auto tv = - TypedVector(Indirect(), byte_width_, ToTypedVectorElementType(type_)); - if (tv.type_ == FBT_STRING) { - // These can't be accessed as strings, since we don't know the bit-width - // of the size field, see the declaration of - // FBT_VECTOR_STRING_DEPRECATED above for details. - // We change the type here to be keys, which are a subtype of strings, - // and will ignore the size field. This will truncate strings with - // embedded nulls. - tv.type_ = FBT_KEY; - } - return tv; - } else { - return TypedVector::EmptyTypedVector(); - } - } - - FixedTypedVector AsFixedTypedVector() const { - if (IsFixedTypedVector()) { - uint8_t len = 0; - auto vtype = ToFixedTypedVectorElementType(type_, &len); - return FixedTypedVector(Indirect(), byte_width_, vtype, len); - } else { - return FixedTypedVector::EmptyFixedTypedVector(); - } - } - - Map AsMap() const { - if (type_ == FBT_MAP) { - return Map(Indirect(), byte_width_); - } else { - return Map::EmptyMap(); - } - } - - template T As() const; - - // Experimental: Mutation functions. - // These allow scalars in an already created buffer to be updated in-place. - // Since by default scalars are stored in the smallest possible space, - // the new value may not fit, in which case these functions return false. - // To avoid this, you can construct the values you intend to mutate using - // Builder::ForceMinimumBitWidth. - bool MutateInt(int64_t i) { - if (type_ == FBT_INT) { - return Mutate(data_, i, parent_width_, WidthI(i)); - } else if (type_ == FBT_INDIRECT_INT) { - return Mutate(Indirect(), i, byte_width_, WidthI(i)); - } else if (type_ == FBT_UINT) { - auto u = static_cast(i); - return Mutate(data_, u, parent_width_, WidthU(u)); - } else if (type_ == FBT_INDIRECT_UINT) { - auto u = static_cast(i); - return Mutate(Indirect(), u, byte_width_, WidthU(u)); - } else { - return false; - } - } - - bool MutateBool(bool b) { - return type_ == FBT_BOOL && Mutate(data_, b, parent_width_, BIT_WIDTH_8); - } - - bool MutateUInt(uint64_t u) { - if (type_ == FBT_UINT) { - return Mutate(data_, u, parent_width_, WidthU(u)); - } else if (type_ == FBT_INDIRECT_UINT) { - return Mutate(Indirect(), u, byte_width_, WidthU(u)); - } else if (type_ == FBT_INT) { - auto i = static_cast(u); - return Mutate(data_, i, parent_width_, WidthI(i)); - } else if (type_ == FBT_INDIRECT_INT) { - auto i = static_cast(u); - return Mutate(Indirect(), i, byte_width_, WidthI(i)); - } else { - return false; - } - } - - bool MutateFloat(float f) { - if (type_ == FBT_FLOAT) { - return MutateF(data_, f, parent_width_, BIT_WIDTH_32); - } else if (type_ == FBT_INDIRECT_FLOAT) { - return MutateF(Indirect(), f, byte_width_, BIT_WIDTH_32); - } else { - return false; - } - } - - bool MutateFloat(double d) { - if (type_ == FBT_FLOAT) { - return MutateF(data_, d, parent_width_, WidthF(d)); - } else if (type_ == FBT_INDIRECT_FLOAT) { - return MutateF(Indirect(), d, byte_width_, WidthF(d)); - } else { - return false; - } - } - - bool MutateString(const char *str, size_t len) { - auto s = AsString(); - if (s.IsTheEmptyString()) return false; - // This is very strict, could allow shorter strings, but that creates - // garbage. - if (s.length() != len) return false; - memcpy(const_cast(s.c_str()), str, len); - return true; - } - bool MutateString(const char *str) { return MutateString(str, strlen(str)); } - bool MutateString(const std::string &str) { - return MutateString(str.data(), str.length()); - } - - private: - const uint8_t *Indirect() const { - return flexbuffers::Indirect(data_, parent_width_); - } - - template - bool Mutate(const uint8_t *dest, T t, size_t byte_width, - BitWidth value_width) { - auto fits = static_cast(static_cast(1U) << value_width) <= - byte_width; - if (fits) { - t = flatbuffers::EndianScalar(t); - memcpy(const_cast(dest), &t, byte_width); - } - return fits; - } - - template - bool MutateF(const uint8_t *dest, T t, size_t byte_width, - BitWidth value_width) { - if (byte_width == sizeof(double)) - return Mutate(dest, static_cast(t), byte_width, value_width); - if (byte_width == sizeof(float)) - return Mutate(dest, static_cast(t), byte_width, value_width); - FLATBUFFERS_ASSERT(false); - return false; - } - - const uint8_t *data_; - uint8_t parent_width_; - uint8_t byte_width_; - Type type_; -}; - -// Template specialization for As(). -template<> inline bool Reference::As() const { return AsBool(); } - -template<> inline int8_t Reference::As() const { return AsInt8(); } -template<> inline int16_t Reference::As() const { return AsInt16(); } -template<> inline int32_t Reference::As() const { return AsInt32(); } -template<> inline int64_t Reference::As() const { return AsInt64(); } - -template<> inline uint8_t Reference::As() const { return AsUInt8(); } -template<> inline uint16_t Reference::As() const { - return AsUInt16(); -} -template<> inline uint32_t Reference::As() const { - return AsUInt32(); -} -template<> inline uint64_t Reference::As() const { - return AsUInt64(); -} - -template<> inline double Reference::As() const { return AsDouble(); } -template<> inline float Reference::As() const { return AsFloat(); } - -template<> inline String Reference::As() const { return AsString(); } -template<> inline std::string Reference::As() const { - return AsString().str(); -} - -template<> inline Blob Reference::As() const { return AsBlob(); } -template<> inline Vector Reference::As() const { return AsVector(); } -template<> inline TypedVector Reference::As() const { - return AsTypedVector(); -} -template<> inline FixedTypedVector Reference::As() const { - return AsFixedTypedVector(); -} -template<> inline Map Reference::As() const { return AsMap(); } - -inline uint8_t PackedType(BitWidth bit_width, Type type) { - return static_cast(bit_width | (type << 2)); -} - -inline uint8_t NullPackedType() { return PackedType(BIT_WIDTH_8, FBT_NULL); } - -// Vector accessors. -// Note: if you try to access outside of bounds, you get a Null value back -// instead. Normally this would be an assert, but since this is "dynamically -// typed" data, you may not want that (someone sends you a 2d vector and you -// wanted 3d). -// The Null converts seamlessly into a default value for any other type. -// TODO(wvo): Could introduce an #ifdef that makes this into an assert? -inline Reference Vector::operator[](size_t i) const { - auto len = size(); - if (i >= len) return Reference(nullptr, 1, NullPackedType()); - auto packed_type = (data_ + len * byte_width_)[i]; - auto elem = data_ + i * byte_width_; - return Reference(elem, byte_width_, packed_type); -} - -inline Reference TypedVector::operator[](size_t i) const { - auto len = size(); - if (i >= len) return Reference(nullptr, 1, NullPackedType()); - auto elem = data_ + i * byte_width_; - return Reference(elem, byte_width_, 1, type_); -} - -inline Reference FixedTypedVector::operator[](size_t i) const { - if (i >= len_) return Reference(nullptr, 1, NullPackedType()); - auto elem = data_ + i * byte_width_; - return Reference(elem, byte_width_, 1, type_); -} - -template int KeyCompare(const void *key, const void *elem) { - auto str_elem = reinterpret_cast( - Indirect(reinterpret_cast(elem))); - auto skey = reinterpret_cast(key); - return strcmp(skey, str_elem); -} - -inline Reference Map::operator[](const char *key) const { - auto keys = Keys(); - // We can't pass keys.byte_width_ to the comparison function, so we have - // to pick the right one ahead of time. - int (*comp)(const void *, const void *) = nullptr; - switch (keys.byte_width_) { - case 1: comp = KeyCompare; break; - case 2: comp = KeyCompare; break; - case 4: comp = KeyCompare; break; - case 8: comp = KeyCompare; break; - } - auto res = std::bsearch(key, keys.data_, keys.size(), keys.byte_width_, comp); - if (!res) return Reference(nullptr, 1, NullPackedType()); - auto i = (reinterpret_cast(res) - keys.data_) / keys.byte_width_; - return (*static_cast(this))[i]; -} - -inline Reference Map::operator[](const std::string &key) const { - return (*this)[key.c_str()]; -} - -inline Reference GetRoot(const uint8_t *buffer, size_t size) { - // See Finish() below for the serialization counterpart of this. - // The root starts at the end of the buffer, so we parse backwards from there. - auto end = buffer + size; - auto byte_width = *--end; - auto packed_type = *--end; - end -= byte_width; // The root data item. - return Reference(end, byte_width, packed_type); -} - -inline Reference GetRoot(const std::vector &buffer) { - return GetRoot(flatbuffers::vector_data(buffer), buffer.size()); -} - -// Flags that configure how the Builder behaves. -// The "Share" flags determine if the Builder automatically tries to pool -// this type. Pooling can reduce the size of serialized data if there are -// multiple maps of the same kind, at the expense of slightly slower -// serialization (the cost of lookups) and more memory use (std::set). -// By default this is on for keys, but off for strings. -// Turn keys off if you have e.g. only one map. -// Turn strings on if you expect many non-unique string values. -// Additionally, sharing key vectors can save space if you have maps with -// identical field populations. -enum BuilderFlag { - BUILDER_FLAG_NONE = 0, - BUILDER_FLAG_SHARE_KEYS = 1, - BUILDER_FLAG_SHARE_STRINGS = 2, - BUILDER_FLAG_SHARE_KEYS_AND_STRINGS = 3, - BUILDER_FLAG_SHARE_KEY_VECTORS = 4, - BUILDER_FLAG_SHARE_ALL = 7, -}; - -class Builder FLATBUFFERS_FINAL_CLASS { - public: - Builder(size_t initial_size = 256, - BuilderFlag flags = BUILDER_FLAG_SHARE_KEYS) - : buf_(initial_size), - finished_(false), - flags_(flags), - force_min_bit_width_(BIT_WIDTH_8), - key_pool(KeyOffsetCompare(buf_)), - string_pool(StringOffsetCompare(buf_)) { - buf_.clear(); - } - - /// @brief Get the serialized buffer (after you call `Finish()`). - /// @return Returns a vector owned by this class. - const std::vector &GetBuffer() const { - Finished(); - return buf_; - } - - // Size of the buffer. Does not include unfinished values. - size_t GetSize() const { return buf_.size(); } - - // Reset all state so we can re-use the buffer. - void Clear() { - buf_.clear(); - stack_.clear(); - finished_ = false; - // flags_ remains as-is; - force_min_bit_width_ = BIT_WIDTH_8; - key_pool.clear(); - string_pool.clear(); - } - - // All value constructing functions below have two versions: one that - // takes a key (for placement inside a map) and one that doesn't (for inside - // vectors and elsewhere). - - void Null() { stack_.push_back(Value()); } - void Null(const char *key) { - Key(key); - Null(); - } - - void Int(int64_t i) { stack_.push_back(Value(i, FBT_INT, WidthI(i))); } - void Int(const char *key, int64_t i) { - Key(key); - Int(i); - } - - void UInt(uint64_t u) { stack_.push_back(Value(u, FBT_UINT, WidthU(u))); } - void UInt(const char *key, uint64_t u) { - Key(key); - UInt(u); - } - - void Float(float f) { stack_.push_back(Value(f)); } - void Float(const char *key, float f) { - Key(key); - Float(f); - } - - void Double(double f) { stack_.push_back(Value(f)); } - void Double(const char *key, double d) { - Key(key); - Double(d); - } - - void Bool(bool b) { stack_.push_back(Value(b)); } - void Bool(const char *key, bool b) { - Key(key); - Bool(b); - } - - void IndirectInt(int64_t i) { PushIndirect(i, FBT_INDIRECT_INT, WidthI(i)); } - void IndirectInt(const char *key, int64_t i) { - Key(key); - IndirectInt(i); - } - - void IndirectUInt(uint64_t u) { - PushIndirect(u, FBT_INDIRECT_UINT, WidthU(u)); - } - void IndirectUInt(const char *key, uint64_t u) { - Key(key); - IndirectUInt(u); - } - - void IndirectFloat(float f) { - PushIndirect(f, FBT_INDIRECT_FLOAT, BIT_WIDTH_32); - } - void IndirectFloat(const char *key, float f) { - Key(key); - IndirectFloat(f); - } - - void IndirectDouble(double f) { - PushIndirect(f, FBT_INDIRECT_FLOAT, WidthF(f)); - } - void IndirectDouble(const char *key, double d) { - Key(key); - IndirectDouble(d); - } - - size_t Key(const char *str, size_t len) { - auto sloc = buf_.size(); - WriteBytes(str, len + 1); - if (flags_ & BUILDER_FLAG_SHARE_KEYS) { - auto it = key_pool.find(sloc); - if (it != key_pool.end()) { - // Already in the buffer. Remove key we just serialized, and use - // existing offset instead. - buf_.resize(sloc); - sloc = *it; - } else { - key_pool.insert(sloc); - } - } - stack_.push_back(Value(static_cast(sloc), FBT_KEY, BIT_WIDTH_8)); - return sloc; - } - - size_t Key(const char *str) { return Key(str, strlen(str)); } - size_t Key(const std::string &str) { return Key(str.c_str(), str.size()); } - - size_t String(const char *str, size_t len) { - auto reset_to = buf_.size(); - auto sloc = CreateBlob(str, len, 1, FBT_STRING); - if (flags_ & BUILDER_FLAG_SHARE_STRINGS) { - StringOffset so(sloc, len); - auto it = string_pool.find(so); - if (it != string_pool.end()) { - // Already in the buffer. Remove string we just serialized, and use - // existing offset instead. - buf_.resize(reset_to); - sloc = it->first; - stack_.back().u_ = sloc; - } else { - string_pool.insert(so); - } - } - return sloc; - } - size_t String(const char *str) { return String(str, strlen(str)); } - size_t String(const std::string &str) { - return String(str.c_str(), str.size()); - } - void String(const flexbuffers::String &str) { - String(str.c_str(), str.length()); - } - - void String(const char *key, const char *str) { - Key(key); - String(str); - } - void String(const char *key, const std::string &str) { - Key(key); - String(str); - } - void String(const char *key, const flexbuffers::String &str) { - Key(key); - String(str); - } - - size_t Blob(const void *data, size_t len) { - return CreateBlob(data, len, 0, FBT_BLOB); - } - size_t Blob(const std::vector &v) { - return CreateBlob(flatbuffers::vector_data(v), v.size(), 0, FBT_BLOB); - } - - // TODO(wvo): support all the FlexBuffer types (like flexbuffers::String), - // e.g. Vector etc. Also in overloaded versions. - // Also some FlatBuffers types? - - size_t StartVector() { return stack_.size(); } - size_t StartVector(const char *key) { - Key(key); - return stack_.size(); - } - size_t StartMap() { return stack_.size(); } - size_t StartMap(const char *key) { - Key(key); - return stack_.size(); - } - - // TODO(wvo): allow this to specify an aligment greater than the natural - // alignment. - size_t EndVector(size_t start, bool typed, bool fixed) { - auto vec = CreateVector(start, stack_.size() - start, 1, typed, fixed); - // Remove temp elements and return vector. - stack_.resize(start); - stack_.push_back(vec); - return static_cast(vec.u_); - } - - size_t EndMap(size_t start) { - // We should have interleaved keys and values on the stack. - // Make sure it is an even number: - auto len = stack_.size() - start; - FLATBUFFERS_ASSERT(!(len & 1)); - len /= 2; - // Make sure keys are all strings: - for (auto key = start; key < stack_.size(); key += 2) { - FLATBUFFERS_ASSERT(stack_[key].type_ == FBT_KEY); - } - // Now sort values, so later we can do a binary search lookup. - // We want to sort 2 array elements at a time. - struct TwoValue { - Value key; - Value val; - }; - // TODO(wvo): strict aliasing? - // TODO(wvo): allow the caller to indicate the data is already sorted - // for maximum efficiency? With an assert to check sortedness to make sure - // we're not breaking binary search. - // Or, we can track if the map is sorted as keys are added which would be - // be quite cheap (cheaper than checking it here), so we can skip this - // step automatically when appliccable, and encourage people to write in - // sorted fashion. - // std::sort is typically already a lot faster on sorted data though. - auto dict = - reinterpret_cast(flatbuffers::vector_data(stack_) + start); - std::sort(dict, dict + len, - [&](const TwoValue &a, const TwoValue &b) -> bool { - auto as = reinterpret_cast( - flatbuffers::vector_data(buf_) + a.key.u_); - auto bs = reinterpret_cast( - flatbuffers::vector_data(buf_) + b.key.u_); - auto comp = strcmp(as, bs); - // If this assertion hits, you've added two keys with the same - // value to this map. - // TODO: Have to check for pointer equality, as some sort - // implementation apparently call this function with the same - // element?? Why? - FLATBUFFERS_ASSERT(comp || &a == &b); - return comp < 0; - }); - // First create a vector out of all keys. - // TODO(wvo): if kBuilderFlagShareKeyVectors is true, see if we can share - // the first vector. - auto keys = CreateVector(start, len, 2, true, false); - auto vec = CreateVector(start + 1, len, 2, false, false, &keys); - // Remove temp elements and return map. - stack_.resize(start); - stack_.push_back(vec); - return static_cast(vec.u_); - } - - template size_t Vector(F f) { - auto start = StartVector(); - f(); - return EndVector(start, false, false); - } - template size_t Vector(F f, T &state) { - auto start = StartVector(); - f(state); - return EndVector(start, false, false); - } - template size_t Vector(const char *key, F f) { - auto start = StartVector(key); - f(); - return EndVector(start, false, false); - } - template - size_t Vector(const char *key, F f, T &state) { - auto start = StartVector(key); - f(state); - return EndVector(start, false, false); - } - - template void Vector(const T *elems, size_t len) { - if (flatbuffers::is_scalar::value) { - // This path should be a lot quicker and use less space. - ScalarVector(elems, len, false); - } else { - auto start = StartVector(); - for (size_t i = 0; i < len; i++) Add(elems[i]); - EndVector(start, false, false); - } - } - template - void Vector(const char *key, const T *elems, size_t len) { - Key(key); - Vector(elems, len); - } - template void Vector(const std::vector &vec) { - Vector(flatbuffers::vector_data(vec), vec.size()); - } - - template size_t TypedVector(F f) { - auto start = StartVector(); - f(); - return EndVector(start, true, false); - } - template size_t TypedVector(F f, T &state) { - auto start = StartVector(); - f(state); - return EndVector(start, true, false); - } - template size_t TypedVector(const char *key, F f) { - auto start = StartVector(key); - f(); - return EndVector(start, true, false); - } - template - size_t TypedVector(const char *key, F f, T &state) { - auto start = StartVector(key); - f(state); - return EndVector(start, true, false); - } - - template size_t FixedTypedVector(const T *elems, size_t len) { - // We only support a few fixed vector lengths. Anything bigger use a - // regular typed vector. - FLATBUFFERS_ASSERT(len >= 2 && len <= 4); - // And only scalar values. - static_assert(flatbuffers::is_scalar::value, "Unrelated types"); - return ScalarVector(elems, len, true); - } - - template - size_t FixedTypedVector(const char *key, const T *elems, size_t len) { - Key(key); - return FixedTypedVector(elems, len); - } - - template size_t Map(F f) { - auto start = StartMap(); - f(); - return EndMap(start); - } - template size_t Map(F f, T &state) { - auto start = StartMap(); - f(state); - return EndMap(start); - } - template size_t Map(const char *key, F f) { - auto start = StartMap(key); - f(); - return EndMap(start); - } - template size_t Map(const char *key, F f, T &state) { - auto start = StartMap(key); - f(state); - return EndMap(start); - } - template void Map(const std::map &map) { - auto start = StartMap(); - for (auto it = map.begin(); it != map.end(); ++it) - Add(it->first.c_str(), it->second); - EndMap(start); - } - - // If you wish to share a value explicitly (a value not shared automatically - // through one of the BUILDER_FLAG_SHARE_* flags) you can do so with these - // functions. Or if you wish to turn those flags off for performance reasons - // and still do some explicit sharing. For example: - // builder.IndirectDouble(M_PI); - // auto id = builder.LastValue(); // Remember where we stored it. - // .. more code goes here .. - // builder.ReuseValue(id); // Refers to same double by offset. - // LastValue works regardless of wether the value has a key or not. - // Works on any data type. - struct Value; - Value LastValue() { return stack_.back(); } - void ReuseValue(Value v) { stack_.push_back(v); } - void ReuseValue(const char *key, Value v) { - Key(key); - ReuseValue(v); - } - - // Overloaded Add that tries to call the correct function above. - void Add(int8_t i) { Int(i); } - void Add(int16_t i) { Int(i); } - void Add(int32_t i) { Int(i); } - void Add(int64_t i) { Int(i); } - void Add(uint8_t u) { UInt(u); } - void Add(uint16_t u) { UInt(u); } - void Add(uint32_t u) { UInt(u); } - void Add(uint64_t u) { UInt(u); } - void Add(float f) { Float(f); } - void Add(double d) { Double(d); } - void Add(bool b) { Bool(b); } - void Add(const char *str) { String(str); } - void Add(const std::string &str) { String(str); } - void Add(const flexbuffers::String &str) { String(str); } - - template void Add(const std::vector &vec) { Vector(vec); } - - template void Add(const char *key, const T &t) { - Key(key); - Add(t); - } - - template void Add(const std::map &map) { - Map(map); - } - - template void operator+=(const T &t) { Add(t); } - - // This function is useful in combination with the Mutate* functions above. - // It forces elements of vectors and maps to have a minimum size, such that - // they can later be updated without failing. - // Call with no arguments to reset. - void ForceMinimumBitWidth(BitWidth bw = BIT_WIDTH_8) { - force_min_bit_width_ = bw; - } - - void Finish() { - // If you hit this assert, you likely have objects that were never included - // in a parent. You need to have exactly one root to finish a buffer. - // Check your Start/End calls are matched, and all objects are inside - // some other object. - FLATBUFFERS_ASSERT(stack_.size() == 1); - - // Write root value. - auto byte_width = Align(stack_[0].ElemWidth(buf_.size(), 0)); - WriteAny(stack_[0], byte_width); - // Write root type. - Write(stack_[0].StoredPackedType(), 1); - // Write root size. Normally determined by parent, but root has no parent :) - Write(byte_width, 1); - - finished_ = true; - } - - private: - void Finished() const { - // If you get this assert, you're attempting to get access a buffer - // which hasn't been finished yet. Be sure to call - // Builder::Finish with your root object. - FLATBUFFERS_ASSERT(finished_); - } - - // Align to prepare for writing a scalar with a certain size. - uint8_t Align(BitWidth alignment) { - auto byte_width = 1U << alignment; - buf_.insert(buf_.end(), flatbuffers::PaddingBytes(buf_.size(), byte_width), - 0); - return static_cast(byte_width); - } - - void WriteBytes(const void *val, size_t size) { - buf_.insert(buf_.end(), reinterpret_cast(val), - reinterpret_cast(val) + size); - } - - template void Write(T val, size_t byte_width) { - FLATBUFFERS_ASSERT(sizeof(T) >= byte_width); - val = flatbuffers::EndianScalar(val); - WriteBytes(&val, byte_width); - } - - void WriteDouble(double f, uint8_t byte_width) { - switch (byte_width) { - case 8: Write(f, byte_width); break; - case 4: Write(static_cast(f), byte_width); break; - // case 2: Write(static_cast(f), byte_width); break; - // case 1: Write(static_cast(f), byte_width); break; - default: FLATBUFFERS_ASSERT(0); - } - } - - void WriteOffset(uint64_t o, uint8_t byte_width) { - auto reloff = buf_.size() - o; - FLATBUFFERS_ASSERT(byte_width == 8 || reloff < 1ULL << (byte_width * 8)); - Write(reloff, byte_width); - } - - template void PushIndirect(T val, Type type, BitWidth bit_width) { - auto byte_width = Align(bit_width); - auto iloc = buf_.size(); - Write(val, byte_width); - stack_.push_back(Value(static_cast(iloc), type, bit_width)); - } - - static BitWidth WidthB(size_t byte_width) { - switch (byte_width) { - case 1: return BIT_WIDTH_8; - case 2: return BIT_WIDTH_16; - case 4: return BIT_WIDTH_32; - case 8: return BIT_WIDTH_64; - default: FLATBUFFERS_ASSERT(false); return BIT_WIDTH_64; - } - } - - template static Type GetScalarType() { - static_assert(flatbuffers::is_scalar::value, "Unrelated types"); - return flatbuffers::is_floating_point::value - ? FBT_FLOAT - : flatbuffers::is_same::value - ? FBT_BOOL - : (flatbuffers::is_unsigned::value ? FBT_UINT - : FBT_INT); - } - - public: - // This was really intended to be private, except for LastValue/ReuseValue. - struct Value { - union { - int64_t i_; - uint64_t u_; - double f_; - }; - - Type type_; - - // For scalars: of itself, for vector: of its elements, for string: length. - BitWidth min_bit_width_; - - Value() : i_(0), type_(FBT_NULL), min_bit_width_(BIT_WIDTH_8) {} - - Value(bool b) - : u_(static_cast(b)), - type_(FBT_BOOL), - min_bit_width_(BIT_WIDTH_8) {} - - Value(int64_t i, Type t, BitWidth bw) - : i_(i), type_(t), min_bit_width_(bw) {} - Value(uint64_t u, Type t, BitWidth bw) - : u_(u), type_(t), min_bit_width_(bw) {} - - Value(float f) : f_(f), type_(FBT_FLOAT), min_bit_width_(BIT_WIDTH_32) {} - Value(double f) : f_(f), type_(FBT_FLOAT), min_bit_width_(WidthF(f)) {} - - uint8_t StoredPackedType(BitWidth parent_bit_width_ = BIT_WIDTH_8) const { - return PackedType(StoredWidth(parent_bit_width_), type_); - } - - BitWidth ElemWidth(size_t buf_size, size_t elem_index) const { - if (IsInline(type_)) { - return min_bit_width_; - } else { - // We have an absolute offset, but want to store a relative offset - // elem_index elements beyond the current buffer end. Since whether - // the relative offset fits in a certain byte_width depends on - // the size of the elements before it (and their alignment), we have - // to test for each size in turn. - for (size_t byte_width = 1; - byte_width <= sizeof(flatbuffers::largest_scalar_t); - byte_width *= 2) { - // Where are we going to write this offset? - auto offset_loc = buf_size + - flatbuffers::PaddingBytes(buf_size, byte_width) + - elem_index * byte_width; - // Compute relative offset. - auto offset = offset_loc - u_; - // Does it fit? - auto bit_width = WidthU(offset); - if (static_cast(static_cast(1U) << bit_width) == - byte_width) - return bit_width; - } - FLATBUFFERS_ASSERT(false); // Must match one of the sizes above. - return BIT_WIDTH_64; - } - } - - BitWidth StoredWidth(BitWidth parent_bit_width_ = BIT_WIDTH_8) const { - if (IsInline(type_)) { - return (std::max)(min_bit_width_, parent_bit_width_); - } else { - return min_bit_width_; - } - } - }; - - private: - void WriteAny(const Value &val, uint8_t byte_width) { - switch (val.type_) { - case FBT_NULL: - case FBT_INT: Write(val.i_, byte_width); break; - case FBT_BOOL: - case FBT_UINT: Write(val.u_, byte_width); break; - case FBT_FLOAT: WriteDouble(val.f_, byte_width); break; - default: WriteOffset(val.u_, byte_width); break; - } - } - - size_t CreateBlob(const void *data, size_t len, size_t trailing, Type type) { - auto bit_width = WidthU(len); - auto byte_width = Align(bit_width); - Write(len, byte_width); - auto sloc = buf_.size(); - WriteBytes(data, len + trailing); - stack_.push_back(Value(static_cast(sloc), type, bit_width)); - return sloc; - } - - template - size_t ScalarVector(const T *elems, size_t len, bool fixed) { - auto vector_type = GetScalarType(); - auto byte_width = sizeof(T); - auto bit_width = WidthB(byte_width); - // If you get this assert, you're trying to write a vector with a size - // field that is bigger than the scalars you're trying to write (e.g. a - // byte vector > 255 elements). For such types, write a "blob" instead. - // TODO: instead of asserting, could write vector with larger elements - // instead, though that would be wasteful. - FLATBUFFERS_ASSERT(WidthU(len) <= bit_width); - Align(bit_width); - if (!fixed) Write(len, byte_width); - auto vloc = buf_.size(); - for (size_t i = 0; i < len; i++) Write(elems[i], byte_width); - stack_.push_back(Value(static_cast(vloc), - ToTypedVector(vector_type, fixed ? len : 0), - bit_width)); - return vloc; - } - - Value CreateVector(size_t start, size_t vec_len, size_t step, bool typed, - bool fixed, const Value *keys = nullptr) { - FLATBUFFERS_ASSERT( - !fixed || - typed); // typed=false, fixed=true combination is not supported. - // Figure out smallest bit width we can store this vector with. - auto bit_width = (std::max)(force_min_bit_width_, WidthU(vec_len)); - auto prefix_elems = 1; - if (keys) { - // If this vector is part of a map, we will pre-fix an offset to the keys - // to this vector. - bit_width = (std::max)(bit_width, keys->ElemWidth(buf_.size(), 0)); - prefix_elems += 2; - } - Type vector_type = FBT_KEY; - // Check bit widths and types for all elements. - for (size_t i = start; i < stack_.size(); i += step) { - auto elem_width = stack_[i].ElemWidth(buf_.size(), i + prefix_elems); - bit_width = (std::max)(bit_width, elem_width); - if (typed) { - if (i == start) { - vector_type = stack_[i].type_; - } else { - // If you get this assert, you are writing a typed vector with - // elements that are not all the same type. - FLATBUFFERS_ASSERT(vector_type == stack_[i].type_); - } - } - } - // If you get this assert, your fixed types are not one of: - // Int / UInt / Float / Key. - FLATBUFFERS_ASSERT(!fixed || IsTypedVectorElementType(vector_type)); - auto byte_width = Align(bit_width); - // Write vector. First the keys width/offset if available, and size. - if (keys) { - WriteOffset(keys->u_, byte_width); - Write(1ULL << keys->min_bit_width_, byte_width); - } - if (!fixed) Write(vec_len, byte_width); - // Then the actual data. - auto vloc = buf_.size(); - for (size_t i = start; i < stack_.size(); i += step) { - WriteAny(stack_[i], byte_width); - } - // Then the types. - if (!typed) { - for (size_t i = start; i < stack_.size(); i += step) { - buf_.push_back(stack_[i].StoredPackedType(bit_width)); - } - } - return Value(static_cast(vloc), - keys ? FBT_MAP - : (typed ? ToTypedVector(vector_type, fixed ? vec_len : 0) - : FBT_VECTOR), - bit_width); - } - - // You shouldn't really be copying instances of this class. - Builder(const Builder &); - Builder &operator=(const Builder &); - - std::vector buf_; - std::vector stack_; - - bool finished_; - - BuilderFlag flags_; - - BitWidth force_min_bit_width_; - - struct KeyOffsetCompare { - explicit KeyOffsetCompare(const std::vector &buf) : buf_(&buf) {} - bool operator()(size_t a, size_t b) const { - auto stra = - reinterpret_cast(flatbuffers::vector_data(*buf_) + a); - auto strb = - reinterpret_cast(flatbuffers::vector_data(*buf_) + b); - return strcmp(stra, strb) < 0; - } - const std::vector *buf_; - }; - - typedef std::pair StringOffset; - struct StringOffsetCompare { - explicit StringOffsetCompare(const std::vector &buf) - : buf_(&buf) {} - bool operator()(const StringOffset &a, const StringOffset &b) const { - auto stra = reinterpret_cast( - flatbuffers::vector_data(*buf_) + a.first); - auto strb = reinterpret_cast( - flatbuffers::vector_data(*buf_) + b.first); - return strncmp(stra, strb, (std::min)(a.second, b.second) + 1) < 0; - } - const std::vector *buf_; - }; - - typedef std::set KeyOffsetMap; - typedef std::set StringOffsetMap; - - KeyOffsetMap key_pool; - StringOffsetMap string_pool; -}; - -} // namespace flexbuffers - -#if defined(_MSC_VER) -# pragma warning(pop) -#endif - -#endif // FLATBUFFERS_FLEXBUFFERS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/grpc.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/grpc.h deleted file mode 100644 index bd24c50..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/grpc.h +++ /dev/null @@ -1,330 +0,0 @@ -/* - * Copyright 2014 Google Inc. 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 FLATBUFFERS_GRPC_H_ -#define FLATBUFFERS_GRPC_H_ - -// Helper functionality to glue FlatBuffers and GRPC. - -#include "flatbuffers/flatbuffers.h" -#include "grpc++/support/byte_buffer.h" -#include "grpc/byte_buffer_reader.h" - -namespace flatbuffers { -namespace grpc { - -// Message is a typed wrapper around a buffer that manages the underlying -// `grpc_slice` and also provides flatbuffers-specific helpers such as `Verify` -// and `GetRoot`. Since it is backed by a `grpc_slice`, the underlying buffer -// is refcounted and ownership is be managed automatically. -template class Message { - public: - Message() : slice_(grpc_empty_slice()) {} - - Message(grpc_slice slice, bool add_ref) - : slice_(add_ref ? grpc_slice_ref(slice) : slice) {} - - Message &operator=(const Message &other) = delete; - - Message(Message &&other) : slice_(other.slice_) { - other.slice_ = grpc_empty_slice(); - } - - Message(const Message &other) = delete; - - Message &operator=(Message &&other) { - grpc_slice_unref(slice_); - slice_ = other.slice_; - other.slice_ = grpc_empty_slice(); - return *this; - } - - ~Message() { grpc_slice_unref(slice_); } - - const uint8_t *mutable_data() const { return GRPC_SLICE_START_PTR(slice_); } - - const uint8_t *data() const { return GRPC_SLICE_START_PTR(slice_); } - - size_t size() const { return GRPC_SLICE_LENGTH(slice_); } - - bool Verify() const { - Verifier verifier(data(), size()); - return verifier.VerifyBuffer(nullptr); - } - - T *GetMutableRoot() { return flatbuffers::GetMutableRoot(mutable_data()); } - - const T *GetRoot() const { return flatbuffers::GetRoot(data()); } - - // This is only intended for serializer use, or if you know what you're doing - const grpc_slice &BorrowSlice() const { return slice_; } - - private: - grpc_slice slice_; -}; - -class MessageBuilder; - -// SliceAllocator is a gRPC-specific allocator that uses the `grpc_slice` -// refcounted slices to manage memory ownership. This makes it easy and -// efficient to transfer buffers to gRPC. -class SliceAllocator : public Allocator { - public: - SliceAllocator() : slice_(grpc_empty_slice()) {} - - SliceAllocator(const SliceAllocator &other) = delete; - SliceAllocator &operator=(const SliceAllocator &other) = delete; - - SliceAllocator(SliceAllocator &&other) : slice_(grpc_empty_slice()) { - // default-construct and swap idiom - swap(other); - } - - SliceAllocator &operator=(SliceAllocator &&other) { - // move-construct and swap idiom - SliceAllocator temp(std::move(other)); - swap(temp); - return *this; - } - - void swap(SliceAllocator &other) { - using std::swap; - swap(slice_, other.slice_); - } - - virtual ~SliceAllocator() { grpc_slice_unref(slice_); } - - virtual uint8_t *allocate(size_t size) override { - FLATBUFFERS_ASSERT(GRPC_SLICE_IS_EMPTY(slice_)); - slice_ = grpc_slice_malloc(size); - return GRPC_SLICE_START_PTR(slice_); - } - - virtual void deallocate(uint8_t *p, size_t size) override { - FLATBUFFERS_ASSERT(p == GRPC_SLICE_START_PTR(slice_)); - FLATBUFFERS_ASSERT(size == GRPC_SLICE_LENGTH(slice_)); - grpc_slice_unref(slice_); - slice_ = grpc_empty_slice(); - } - - virtual uint8_t *reallocate_downward(uint8_t *old_p, size_t old_size, - size_t new_size, size_t in_use_back, - size_t in_use_front) override { - FLATBUFFERS_ASSERT(old_p == GRPC_SLICE_START_PTR(slice_)); - FLATBUFFERS_ASSERT(old_size == GRPC_SLICE_LENGTH(slice_)); - FLATBUFFERS_ASSERT(new_size > old_size); - grpc_slice old_slice = slice_; - grpc_slice new_slice = grpc_slice_malloc(new_size); - uint8_t *new_p = GRPC_SLICE_START_PTR(new_slice); - memcpy_downward(old_p, old_size, new_p, new_size, in_use_back, - in_use_front); - slice_ = new_slice; - grpc_slice_unref(old_slice); - return new_p; - } - - private: - grpc_slice &get_slice(uint8_t *p, size_t size) { - FLATBUFFERS_ASSERT(p == GRPC_SLICE_START_PTR(slice_)); - FLATBUFFERS_ASSERT(size == GRPC_SLICE_LENGTH(slice_)); - return slice_; - } - - grpc_slice slice_; - - friend class MessageBuilder; -}; - -// SliceAllocatorMember is a hack to ensure that the MessageBuilder's -// slice_allocator_ member is constructed before the FlatBufferBuilder, since -// the allocator is used in the FlatBufferBuilder ctor. -namespace detail { -struct SliceAllocatorMember { - SliceAllocator slice_allocator_; -}; -} // namespace detail - -// MessageBuilder is a gRPC-specific FlatBufferBuilder that uses SliceAllocator -// to allocate gRPC buffers. -class MessageBuilder : private detail::SliceAllocatorMember, - public FlatBufferBuilder { - public: - explicit MessageBuilder(uoffset_t initial_size = 1024) - : FlatBufferBuilder(initial_size, &slice_allocator_, false) {} - - MessageBuilder(const MessageBuilder &other) = delete; - MessageBuilder &operator=(const MessageBuilder &other) = delete; - - MessageBuilder(MessageBuilder &&other) - : FlatBufferBuilder(1024, &slice_allocator_, false) { - // Default construct and swap idiom. - Swap(other); - } - - /// Create a MessageBuilder from a FlatBufferBuilder. - explicit MessageBuilder(FlatBufferBuilder &&src, - void (*dealloc)(void *, - size_t) = &DefaultAllocator::dealloc) - : FlatBufferBuilder(1024, &slice_allocator_, false) { - src.Swap(*this); - src.SwapBufAllocator(*this); - if (buf_.capacity()) { - uint8_t *buf = buf_.scratch_data(); // pointer to memory - size_t capacity = buf_.capacity(); // size of memory - slice_allocator_.slice_ = grpc_slice_new_with_len(buf, capacity, dealloc); - } else { - slice_allocator_.slice_ = grpc_empty_slice(); - } - } - - /// Move-assign a FlatBufferBuilder to a MessageBuilder. - /// Only FlatBufferBuilder with default allocator (basically, nullptr) is - /// supported. - MessageBuilder &operator=(FlatBufferBuilder &&src) { - // Move construct a temporary and swap - MessageBuilder temp(std::move(src)); - Swap(temp); - return *this; - } - - MessageBuilder &operator=(MessageBuilder &&other) { - // Move construct a temporary and swap - MessageBuilder temp(std::move(other)); - Swap(temp); - return *this; - } - - void Swap(MessageBuilder &other) { - slice_allocator_.swap(other.slice_allocator_); - FlatBufferBuilder::Swap(other); - // After swapping the FlatBufferBuilder, we swap back the allocator, which - // restores the original allocator back in place. This is necessary because - // MessageBuilder's allocator is its own member (SliceAllocatorMember). The - // allocator passed to FlatBufferBuilder::vector_downward must point to this - // member. - buf_.swap_allocator(other.buf_); - } - - // Releases the ownership of the buffer pointer. - // Returns the size, offset, and the original grpc_slice that - // allocated the buffer. Also see grpc_slice_unref(). - uint8_t *ReleaseRaw(size_t &size, size_t &offset, grpc_slice &slice) { - uint8_t *buf = FlatBufferBuilder::ReleaseRaw(size, offset); - slice = slice_allocator_.slice_; - slice_allocator_.slice_ = grpc_empty_slice(); - return buf; - } - - ~MessageBuilder() {} - - // GetMessage extracts the subslice of the buffer corresponding to the - // flatbuffers-encoded region and wraps it in a `Message` to handle buffer - // ownership. - template Message GetMessage() { - auto buf_data = buf_.scratch_data(); // pointer to memory - auto buf_size = buf_.capacity(); // size of memory - auto msg_data = buf_.data(); // pointer to msg - auto msg_size = buf_.size(); // size of msg - // Do some sanity checks on data/size - FLATBUFFERS_ASSERT(msg_data); - FLATBUFFERS_ASSERT(msg_size); - FLATBUFFERS_ASSERT(msg_data >= buf_data); - FLATBUFFERS_ASSERT(msg_data + msg_size <= buf_data + buf_size); - // Calculate offsets from the buffer start - auto begin = msg_data - buf_data; - auto end = begin + msg_size; - // Get the slice we are working with (no refcount change) - grpc_slice slice = slice_allocator_.get_slice(buf_data, buf_size); - // Extract a subslice of the existing slice (increment refcount) - grpc_slice subslice = grpc_slice_sub(slice, begin, end); - // Wrap the subslice in a `Message`, but don't increment refcount - Message msg(subslice, false); - return msg; - } - - template Message ReleaseMessage() { - Message msg = GetMessage(); - Reset(); - return msg; - } - - private: - // SliceAllocator slice_allocator_; // part of SliceAllocatorMember -}; - -} // namespace grpc -} // namespace flatbuffers - -namespace grpc { - -template class SerializationTraits> { - public: - static grpc::Status Serialize(const flatbuffers::grpc::Message &msg, - grpc_byte_buffer **buffer, bool *own_buffer) { - // We are passed in a `Message`, which is a wrapper around a - // `grpc_slice`. We extract it here using `BorrowSlice()`. The const cast - // is necessary because the `grpc_raw_byte_buffer_create` func expects - // non-const slices in order to increment their refcounts. - grpc_slice *slice = const_cast(&msg.BorrowSlice()); - // Now use `grpc_raw_byte_buffer_create` to package the single slice into a - // `grpc_byte_buffer`, incrementing the refcount in the process. - *buffer = grpc_raw_byte_buffer_create(slice, 1); - *own_buffer = true; - return grpc::Status::OK; - } - - // Deserialize by pulling the - static grpc::Status Deserialize(grpc_byte_buffer *buffer, - flatbuffers::grpc::Message *msg) { - if (!buffer) { - return ::grpc::Status(::grpc::StatusCode::INTERNAL, "No payload"); - } - // Check if this is a single uncompressed slice. - if ((buffer->type == GRPC_BB_RAW) && - (buffer->data.raw.compression == GRPC_COMPRESS_NONE) && - (buffer->data.raw.slice_buffer.count == 1)) { - // If it is, then we can reference the `grpc_slice` directly. - grpc_slice slice = buffer->data.raw.slice_buffer.slices[0]; - // We wrap a `Message` around the slice, incrementing the refcount. - *msg = flatbuffers::grpc::Message(slice, true); - } else { - // Otherwise, we need to use `grpc_byte_buffer_reader_readall` to read - // `buffer` into a single contiguous `grpc_slice`. The gRPC reader gives - // us back a new slice with the refcount already incremented. - grpc_byte_buffer_reader reader; - grpc_byte_buffer_reader_init(&reader, buffer); - grpc_slice slice = grpc_byte_buffer_reader_readall(&reader); - grpc_byte_buffer_reader_destroy(&reader); - // We wrap a `Message` around the slice, but don't increment refcount - *msg = flatbuffers::grpc::Message(slice, false); - } - grpc_byte_buffer_destroy(buffer); -#if FLATBUFFERS_GRPC_DISABLE_AUTO_VERIFICATION - return ::grpc::Status::OK; -#else - if (msg->Verify()) { - return ::grpc::Status::OK; - } else { - return ::grpc::Status(::grpc::StatusCode::INTERNAL, - "Message verification failed"); - } -#endif - } -}; - -} // namespace grpc - -#endif // FLATBUFFERS_GRPC_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/hash.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/hash.h deleted file mode 100644 index aebf071..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/hash.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2015 Google Inc. 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 FLATBUFFERS_HASH_H_ -#define FLATBUFFERS_HASH_H_ - -#include -#include - -#include "flatbuffers/flatbuffers.h" - -namespace flatbuffers { - -template struct FnvTraits { - static const T kFnvPrime; - static const T kOffsetBasis; -}; - -template<> struct FnvTraits { - static const uint32_t kFnvPrime = 0x01000193; - static const uint32_t kOffsetBasis = 0x811C9DC5; -}; - -template<> struct FnvTraits { - static const uint64_t kFnvPrime = 0x00000100000001b3ULL; - static const uint64_t kOffsetBasis = 0xcbf29ce484222645ULL; -}; - -template T HashFnv1(const char *input) { - T hash = FnvTraits::kOffsetBasis; - for (const char *c = input; *c; ++c) { - hash *= FnvTraits::kFnvPrime; - hash ^= static_cast(*c); - } - return hash; -} - -template T HashFnv1a(const char *input) { - T hash = FnvTraits::kOffsetBasis; - for (const char *c = input; *c; ++c) { - hash ^= static_cast(*c); - hash *= FnvTraits::kFnvPrime; - } - return hash; -} - -template<> inline uint16_t HashFnv1(const char *input) { - uint32_t hash = HashFnv1(input); - return (hash >> 16) ^ (hash & 0xffff); -} - -template<> inline uint16_t HashFnv1a(const char *input) { - uint32_t hash = HashFnv1a(input); - return (hash >> 16) ^ (hash & 0xffff); -} - -template struct NamedHashFunction { - const char *name; - - typedef T (*HashFunction)(const char *); - HashFunction function; -}; - -const NamedHashFunction kHashFunctions16[] = { - { "fnv1_16", HashFnv1 }, - { "fnv1a_16", HashFnv1a }, -}; - -const NamedHashFunction kHashFunctions32[] = { - { "fnv1_32", HashFnv1 }, - { "fnv1a_32", HashFnv1a }, -}; - -const NamedHashFunction kHashFunctions64[] = { - { "fnv1_64", HashFnv1 }, - { "fnv1a_64", HashFnv1a }, -}; - -inline NamedHashFunction::HashFunction FindHashFunction16( - const char *name) { - std::size_t size = sizeof(kHashFunctions16) / sizeof(kHashFunctions16[0]); - for (std::size_t i = 0; i < size; ++i) { - if (std::strcmp(name, kHashFunctions16[i].name) == 0) { - return kHashFunctions16[i].function; - } - } - return nullptr; -} - -inline NamedHashFunction::HashFunction FindHashFunction32( - const char *name) { - std::size_t size = sizeof(kHashFunctions32) / sizeof(kHashFunctions32[0]); - for (std::size_t i = 0; i < size; ++i) { - if (std::strcmp(name, kHashFunctions32[i].name) == 0) { - return kHashFunctions32[i].function; - } - } - return nullptr; -} - -inline NamedHashFunction::HashFunction FindHashFunction64( - const char *name) { - std::size_t size = sizeof(kHashFunctions64) / sizeof(kHashFunctions64[0]); - for (std::size_t i = 0; i < size; ++i) { - if (std::strcmp(name, kHashFunctions64[i].name) == 0) { - return kHashFunctions64[i].function; - } - } - return nullptr; -} - -} // namespace flatbuffers - -#endif // FLATBUFFERS_HASH_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/idl.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/idl.h deleted file mode 100644 index 12b2b14..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/idl.h +++ /dev/null @@ -1,1137 +0,0 @@ -/* - * Copyright 2014 Google Inc. 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 FLATBUFFERS_IDL_H_ -#define FLATBUFFERS_IDL_H_ - -#include -#include -#include - -#include "flatbuffers/base.h" -#include "flatbuffers/flatbuffers.h" -#include "flatbuffers/flexbuffers.h" -#include "flatbuffers/hash.h" -#include "flatbuffers/reflection.h" - -#if !defined(FLATBUFFERS_CPP98_STL) -# include -#endif // !defined(FLATBUFFERS_CPP98_STL) - -// This file defines the data types representing a parsed IDL (Interface -// Definition Language) / schema file. - -// Limits maximum depth of nested objects. -// Prevents stack overflow while parse flatbuffers or json. -#if !defined(FLATBUFFERS_MAX_PARSING_DEPTH) -# define FLATBUFFERS_MAX_PARSING_DEPTH 64 -#endif - -namespace flatbuffers { - -// The order of these matters for Is*() functions below. -// Additionally, Parser::ParseType assumes bool..string is a contiguous range -// of type tokens. -// clang-format off -#define FLATBUFFERS_GEN_TYPES_SCALAR(TD) \ - TD(NONE, "", uint8_t, byte, byte, byte, uint8, u8, UByte, UInt8) \ - TD(UTYPE, "", uint8_t, byte, byte, byte, uint8, u8, UByte, UInt8) /* begin scalar/int */ \ - TD(BOOL, "bool", uint8_t, boolean,bool, bool, bool, bool, Boolean, Bool) \ - TD(CHAR, "byte", int8_t, byte, int8, sbyte, int8, i8, Byte, Int8) \ - TD(UCHAR, "ubyte", uint8_t, byte, byte, byte, uint8, u8, UByte, UInt8) \ - TD(SHORT, "short", int16_t, short, int16, short, int16, i16, Short, Int16) \ - TD(USHORT, "ushort", uint16_t, short, uint16, ushort, uint16, u16, UShort, UInt16) \ - TD(INT, "int", int32_t, int, int32, int, int32, i32, Int, Int32) \ - TD(UINT, "uint", uint32_t, int, uint32, uint, uint32, u32, UInt, UInt32) \ - TD(LONG, "long", int64_t, long, int64, long, int64, i64, Long, Int64) \ - TD(ULONG, "ulong", uint64_t, long, uint64, ulong, uint64, u64, ULong, UInt64) /* end int */ \ - TD(FLOAT, "float", float, float, float32, float, float32, f32, Float, Float32) /* begin float */ \ - TD(DOUBLE, "double", double, double, float64, double, float64, f64, Double, Double) /* end float/scalar */ -#define FLATBUFFERS_GEN_TYPES_POINTER(TD) \ - TD(STRING, "string", Offset, int, int, StringOffset, int, unused, Int, Offset) \ - TD(VECTOR, "", Offset, int, int, VectorOffset, int, unused, Int, Offset) \ - TD(STRUCT, "", Offset, int, int, int, int, unused, Int, Offset) \ - TD(UNION, "", Offset, int, int, int, int, unused, Int, Offset) -#define FLATBUFFERS_GEN_TYPE_ARRAY(TD) \ - TD(ARRAY, "", int, int, int, int, int, unused, Int, Offset) -// The fields are: -// - enum -// - FlatBuffers schema type. -// - C++ type. -// - Java type. -// - Go type. -// - C# / .Net type. -// - Python type. -// - Rust type. -// - Kotlin type. - -// using these macros, we can now write code dealing with types just once, e.g. - -/* -switch (type) { - #define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, JTYPE, GTYPE, NTYPE, PTYPE, \ - RTYPE, KTYPE) \ - case BASE_TYPE_ ## ENUM: \ - // do something specific to CTYPE here - FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD) - #undef FLATBUFFERS_TD -} -*/ - -// If not all FLATBUFFERS_GEN_() arguments are necessary for implementation -// of FLATBUFFERS_TD, you can use a variadic macro (with __VA_ARGS__ if needed). -// In the above example, only CTYPE is used to generate the code, it can be rewritten: - -/* -switch (type) { - #define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \ - case BASE_TYPE_ ## ENUM: \ - // do something specific to CTYPE here - FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD) - #undef FLATBUFFERS_TD -} -*/ - -#define FLATBUFFERS_GEN_TYPES(TD) \ - FLATBUFFERS_GEN_TYPES_SCALAR(TD) \ - FLATBUFFERS_GEN_TYPES_POINTER(TD) \ - FLATBUFFERS_GEN_TYPE_ARRAY(TD) - -// Create an enum for all the types above. -#ifdef __GNUC__ -__extension__ // Stop GCC complaining about trailing comma with -Wpendantic. -#endif -enum BaseType { - #define FLATBUFFERS_TD(ENUM, ...) \ - BASE_TYPE_ ## ENUM, - FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD) - #undef FLATBUFFERS_TD -}; - -#define FLATBUFFERS_TD(ENUM, IDLTYPE, CTYPE, ...) \ - static_assert(sizeof(CTYPE) <= sizeof(largest_scalar_t), \ - "define largest_scalar_t as " #CTYPE); - FLATBUFFERS_GEN_TYPES(FLATBUFFERS_TD) -#undef FLATBUFFERS_TD - -inline bool IsScalar (BaseType t) { return t >= BASE_TYPE_UTYPE && - t <= BASE_TYPE_DOUBLE; } -inline bool IsInteger(BaseType t) { return t >= BASE_TYPE_UTYPE && - t <= BASE_TYPE_ULONG; } -inline bool IsFloat (BaseType t) { return t == BASE_TYPE_FLOAT || - t == BASE_TYPE_DOUBLE; } -inline bool IsLong (BaseType t) { return t == BASE_TYPE_LONG || - t == BASE_TYPE_ULONG; } -inline bool IsBool (BaseType t) { return t == BASE_TYPE_BOOL; } -inline bool IsOneByte(BaseType t) { return t >= BASE_TYPE_UTYPE && - t <= BASE_TYPE_UCHAR; } - -inline bool IsUnsigned(BaseType t) { - return (t == BASE_TYPE_UTYPE) || (t == BASE_TYPE_UCHAR) || - (t == BASE_TYPE_USHORT) || (t == BASE_TYPE_UINT) || - (t == BASE_TYPE_ULONG); -} - -// clang-format on - -extern const char *const kTypeNames[]; -extern const char kTypeSizes[]; - -inline size_t SizeOf(BaseType t) { return kTypeSizes[t]; } - -struct StructDef; -struct EnumDef; -class Parser; - -// Represents any type in the IDL, which is a combination of the BaseType -// and additional information for vectors/structs_. -struct Type { - explicit Type(BaseType _base_type = BASE_TYPE_NONE, StructDef *_sd = nullptr, - EnumDef *_ed = nullptr, uint16_t _fixed_length = 0) - : base_type(_base_type), - element(BASE_TYPE_NONE), - struct_def(_sd), - enum_def(_ed), - fixed_length(_fixed_length) {} - - bool operator==(const Type &o) { - return base_type == o.base_type && element == o.element && - struct_def == o.struct_def && enum_def == o.enum_def; - } - - Type VectorType() const { - return Type(element, struct_def, enum_def, fixed_length); - } - - Offset Serialize(FlatBufferBuilder *builder) const; - - bool Deserialize(const Parser &parser, const reflection::Type *type); - - BaseType base_type; - BaseType element; // only set if t == BASE_TYPE_VECTOR - StructDef *struct_def; // only set if t or element == BASE_TYPE_STRUCT - EnumDef *enum_def; // set if t == BASE_TYPE_UNION / BASE_TYPE_UTYPE, - // or for an integral type derived from an enum. - uint16_t fixed_length; // only set if t == BASE_TYPE_ARRAY -}; - -// Represents a parsed scalar value, it's type, and field offset. -struct Value { - Value() - : constant("0"), - offset(static_cast(~(static_cast(0U)))) {} - Type type; - std::string constant; - voffset_t offset; -}; - -// Helper class that retains the original order of a set of identifiers and -// also provides quick lookup. -template class SymbolTable { - public: - ~SymbolTable() { - for (auto it = vec.begin(); it != vec.end(); ++it) { delete *it; } - } - - bool Add(const std::string &name, T *e) { - vector_emplace_back(&vec, e); - auto it = dict.find(name); - if (it != dict.end()) return true; - dict[name] = e; - return false; - } - - void Move(const std::string &oldname, const std::string &newname) { - auto it = dict.find(oldname); - if (it != dict.end()) { - auto obj = it->second; - dict.erase(it); - dict[newname] = obj; - } else { - FLATBUFFERS_ASSERT(false); - } - } - - T *Lookup(const std::string &name) const { - auto it = dict.find(name); - return it == dict.end() ? nullptr : it->second; - } - - public: - std::map dict; // quick lookup - std::vector vec; // Used to iterate in order of insertion -}; - -// A name space, as set in the schema. -struct Namespace { - Namespace() : from_table(0) {} - - // Given a (potentally unqualified) name, return the "fully qualified" name - // which has a full namespaced descriptor. - // With max_components you can request less than the number of components - // the current namespace has. - std::string GetFullyQualifiedName(const std::string &name, - size_t max_components = 1000) const; - - std::vector components; - size_t from_table; // Part of the namespace corresponds to a message/table. -}; - -inline bool operator<(const Namespace &a, const Namespace &b) { - size_t min_size = std::min(a.components.size(), b.components.size()); - for (size_t i = 0; i < min_size; ++i) { - if (a.components[i] != b.components[i]) - return a.components[i] < b.components[i]; - } - return a.components.size() < b.components.size(); -} - -// Base class for all definition types (fields, structs_, enums_). -struct Definition { - Definition() - : generated(false), - defined_namespace(nullptr), - serialized_location(0), - index(-1), - refcount(1) {} - - flatbuffers::Offset< - flatbuffers::Vector>> - SerializeAttributes(FlatBufferBuilder *builder, const Parser &parser) const; - - bool DeserializeAttributes(Parser &parser, - const Vector> *attrs); - - std::string name; - std::string file; - std::vector doc_comment; - SymbolTable attributes; - bool generated; // did we already output code for this definition? - Namespace *defined_namespace; // Where it was defined. - - // For use with Serialize() - uoffset_t serialized_location; - int index; // Inside the vector it is stored. - int refcount; -}; - -struct FieldDef : public Definition { - FieldDef() - : deprecated(false), - required(false), - key(false), - shared(false), - native_inline(false), - flexbuffer(false), - nested_flatbuffer(NULL), - padding(0) {} - - Offset Serialize(FlatBufferBuilder *builder, uint16_t id, - const Parser &parser) const; - - bool Deserialize(Parser &parser, const reflection::Field *field); - - Value value; - bool deprecated; // Field is allowed to be present in old data, but can't be. - // written in new data nor accessed in new code. - bool required; // Field must always be present. - bool key; // Field functions as a key for creating sorted vectors. - bool shared; // Field will be using string pooling (i.e. CreateSharedString) - // as default serialization behavior if field is a string. - bool native_inline; // Field will be defined inline (instead of as a pointer) - // for native tables if field is a struct. - bool flexbuffer; // This field contains FlexBuffer data. - StructDef *nested_flatbuffer; // This field contains nested FlatBuffer data. - size_t padding; // Bytes to always pad after this field. -}; - -struct StructDef : public Definition { - StructDef() - : fixed(false), - predecl(true), - sortbysize(true), - has_key(false), - minalign(1), - bytesize(0) {} - - void PadLastField(size_t min_align) { - auto padding = PaddingBytes(bytesize, min_align); - bytesize += padding; - if (fields.vec.size()) fields.vec.back()->padding = padding; - } - - Offset Serialize(FlatBufferBuilder *builder, - const Parser &parser) const; - - bool Deserialize(Parser &parser, const reflection::Object *object); - - SymbolTable fields; - - bool fixed; // If it's struct, not a table. - bool predecl; // If it's used before it was defined. - bool sortbysize; // Whether fields come in the declaration or size order. - bool has_key; // It has a key field. - size_t minalign; // What the whole object needs to be aligned to. - size_t bytesize; // Size if fixed. - - flatbuffers::unique_ptr original_location; -}; - -struct EnumDef; -struct EnumValBuilder; - -struct EnumVal { - Offset Serialize(FlatBufferBuilder *builder, - const Parser &parser) const; - - bool Deserialize(const Parser &parser, const reflection::EnumVal *val); - - uint64_t GetAsUInt64() const { return static_cast(value); } - int64_t GetAsInt64() const { return value; } - bool IsZero() const { return 0 == value; } - bool IsNonZero() const { return !IsZero(); } - - std::string name; - std::vector doc_comment; - Type union_type; - - private: - friend EnumDef; - friend EnumValBuilder; - friend bool operator==(const EnumVal &lhs, const EnumVal &rhs); - - EnumVal(const std::string &_name, int64_t _val) : name(_name), value(_val) {} - EnumVal() : value(0) {} - - int64_t value; -}; - -struct EnumDef : public Definition { - EnumDef() : is_union(false), uses_multiple_type_instances(false) {} - - Offset Serialize(FlatBufferBuilder *builder, - const Parser &parser) const; - - bool Deserialize(Parser &parser, const reflection::Enum *values); - - template void ChangeEnumValue(EnumVal *ev, T new_val); - void SortByValue(); - void RemoveDuplicates(); - - std::string AllFlags() const; - const EnumVal *MinValue() const; - const EnumVal *MaxValue() const; - // Returns the number of integer steps from v1 to v2. - uint64_t Distance(const EnumVal *v1, const EnumVal *v2) const; - // Returns the number of integer steps from Min to Max. - uint64_t Distance() const { return Distance(MinValue(), MaxValue()); } - - EnumVal *ReverseLookup(int64_t enum_idx, - bool skip_union_default = false) const; - EnumVal *FindByValue(const std::string &constant) const; - - std::string ToString(const EnumVal &ev) const { - return IsUInt64() ? NumToString(ev.GetAsUInt64()) - : NumToString(ev.GetAsInt64()); - } - - size_t size() const { return vals.vec.size(); } - - const std::vector &Vals() const { - return vals.vec; - } - - const EnumVal *Lookup(const std::string &enum_name) const { - return vals.Lookup(enum_name); - } - - bool is_union; - // Type is a union which uses type aliases where at least one type is - // available under two different names. - bool uses_multiple_type_instances; - Type underlying_type; - - private: - bool IsUInt64() const { - return (BASE_TYPE_ULONG == underlying_type.base_type); - } - - friend EnumValBuilder; - SymbolTable vals; -}; - -inline bool IsStruct(const Type &type) { - return type.base_type == BASE_TYPE_STRUCT && type.struct_def->fixed; -} - -inline bool IsUnion(const Type &type) { - return type.enum_def != nullptr && type.enum_def->is_union; -} - -inline bool IsVector(const Type &type) { - return type.base_type == BASE_TYPE_VECTOR; -} - -inline bool IsArray(const Type &type) { - return type.base_type == BASE_TYPE_ARRAY; -} - -inline bool IsSeries(const Type &type) { - return IsVector(type) || IsArray(type); -} - -inline bool IsEnum(const Type &type) { - return type.enum_def != nullptr && IsInteger(type.base_type); -} - -inline size_t InlineSize(const Type &type) { - return IsStruct(type) - ? type.struct_def->bytesize - : (IsArray(type) - ? InlineSize(type.VectorType()) * type.fixed_length - : SizeOf(type.base_type)); -} - -inline size_t InlineAlignment(const Type &type) { - if (IsStruct(type)) { - return type.struct_def->minalign; - } else if (IsArray(type)) { - return IsStruct(type.VectorType()) ? type.struct_def->minalign - : SizeOf(type.element); - } else { - return SizeOf(type.base_type); - } -} -inline bool operator==(const EnumVal &lhs, const EnumVal &rhs) { - return lhs.value == rhs.value; -} -inline bool operator!=(const EnumVal &lhs, const EnumVal &rhs) { - return !(lhs == rhs); -} - -inline bool EqualByName(const Type &a, const Type &b) { - return a.base_type == b.base_type && a.element == b.element && - (a.struct_def == b.struct_def || - a.struct_def->name == b.struct_def->name) && - (a.enum_def == b.enum_def || a.enum_def->name == b.enum_def->name); -} - -struct RPCCall : public Definition { - Offset Serialize(FlatBufferBuilder *builder, - const Parser &parser) const; - - bool Deserialize(Parser &parser, const reflection::RPCCall *call); - - StructDef *request, *response; -}; - -struct ServiceDef : public Definition { - Offset Serialize(FlatBufferBuilder *builder, - const Parser &parser) const; - bool Deserialize(Parser &parser, const reflection::Service *service); - - SymbolTable calls; -}; - -// Container of options that may apply to any of the source/text generators. -struct IDLOptions { - // Use flexbuffers instead for binary and text generation - bool use_flexbuffers; - bool strict_json; - bool skip_js_exports; - bool use_goog_js_export_format; - bool use_ES6_js_export_format; - bool output_default_scalars_in_json; - int indent_step; - bool output_enum_identifiers; - bool prefixed_enums; - bool scoped_enums; - bool include_dependence_headers; - bool mutable_buffer; - bool one_file; - bool proto_mode; - bool proto_oneof_union; - bool generate_all; - bool skip_unexpected_fields_in_json; - bool generate_name_strings; - bool generate_object_based_api; - bool gen_compare; - std::string cpp_object_api_pointer_type; - std::string cpp_object_api_string_type; - bool cpp_object_api_string_flexible_constructor; - bool gen_nullable; - bool java_checkerframework; - bool gen_generated; - std::string object_prefix; - std::string object_suffix; - bool union_value_namespacing; - bool allow_non_utf8; - bool natural_utf8; - std::string include_prefix; - bool keep_include_path; - bool binary_schema_comments; - bool binary_schema_builtins; - bool binary_schema_gen_embed; - bool skip_flatbuffers_import; - std::string go_import; - std::string go_namespace; - bool reexport_ts_modules; - bool js_ts_short_names; - bool protobuf_ascii_alike; - bool size_prefixed; - std::string root_type; - bool force_defaults; - bool java_primitive_has_method; - bool cs_gen_json_serializer; - std::vector cpp_includes; - std::string cpp_std; - std::string proto_namespace_suffix; - std::string filename_suffix; - std::string filename_extension; - - // Possible options for the more general generator below. - enum Language { - kJava = 1 << 0, - kCSharp = 1 << 1, - kGo = 1 << 2, - kCpp = 1 << 3, - kJs = 1 << 4, - kPython = 1 << 5, - kPhp = 1 << 6, - kJson = 1 << 7, - kBinary = 1 << 8, - kTs = 1 << 9, - kJsonSchema = 1 << 10, - kDart = 1 << 11, - kLua = 1 << 12, - kLobster = 1 << 13, - kRust = 1 << 14, - kKotlin = 1 << 15, - kSwift = 1 << 16, - kMAX - }; - - Language lang; - - enum MiniReflect { kNone, kTypes, kTypesAndNames }; - - MiniReflect mini_reflect; - - // The corresponding language bit will be set if a language is included - // for code generation. - unsigned long lang_to_generate; - - // If set (default behavior), empty string fields will be set to nullptr to - // make the flatbuffer more compact. - bool set_empty_strings_to_null; - - // If set (default behavior), empty vector fields will be set to nullptr to - // make the flatbuffer more compact. - bool set_empty_vectors_to_null; - - IDLOptions() - : use_flexbuffers(false), - strict_json(false), - skip_js_exports(false), - use_goog_js_export_format(false), - use_ES6_js_export_format(false), - output_default_scalars_in_json(false), - indent_step(2), - output_enum_identifiers(true), - prefixed_enums(true), - scoped_enums(false), - include_dependence_headers(true), - mutable_buffer(false), - one_file(false), - proto_mode(false), - proto_oneof_union(false), - generate_all(false), - skip_unexpected_fields_in_json(false), - generate_name_strings(false), - generate_object_based_api(false), - gen_compare(false), - cpp_object_api_pointer_type("std::unique_ptr"), - cpp_object_api_string_flexible_constructor(false), - gen_nullable(false), - java_checkerframework(false), - gen_generated(false), - object_suffix("T"), - union_value_namespacing(true), - allow_non_utf8(false), - natural_utf8(false), - keep_include_path(false), - binary_schema_comments(false), - binary_schema_builtins(false), - binary_schema_gen_embed(false), - skip_flatbuffers_import(false), - reexport_ts_modules(true), - js_ts_short_names(false), - protobuf_ascii_alike(false), - size_prefixed(false), - force_defaults(false), - java_primitive_has_method(false), - cs_gen_json_serializer(false), - filename_suffix("_generated"), - filename_extension(), - lang(IDLOptions::kJava), - mini_reflect(IDLOptions::kNone), - lang_to_generate(0), - set_empty_strings_to_null(true), - set_empty_vectors_to_null(true) {} -}; - -// This encapsulates where the parser is in the current source file. -struct ParserState { - ParserState() - : cursor_(nullptr), - line_start_(nullptr), - line_(0), - token_(-1), - attr_is_trivial_ascii_string_(true) {} - - protected: - void ResetState(const char *source) { - cursor_ = source; - line_ = 0; - MarkNewLine(); - } - - void MarkNewLine() { - line_start_ = cursor_; - line_ += 1; - } - - int64_t CursorPosition() const { - FLATBUFFERS_ASSERT(cursor_ && line_start_ && cursor_ >= line_start_); - return static_cast(cursor_ - line_start_); - } - - const char *cursor_; - const char *line_start_; - int line_; // the current line being parsed - int token_; - - // Flag: text in attribute_ is true ASCII string without escape - // sequences. Only printable ASCII (without [\t\r\n]). - // Used for number-in-string (and base64 string in future). - bool attr_is_trivial_ascii_string_; - std::string attribute_; - std::vector doc_comment_; -}; - -// A way to make error propagation less error prone by requiring values to be -// checked. -// Once you create a value of this type you must either: -// - Call Check() on it. -// - Copy or assign it to another value. -// Failure to do so leads to an assert. -// This guarantees that this as return value cannot be ignored. -class CheckedError { - public: - explicit CheckedError(bool error) - : is_error_(error), has_been_checked_(false) {} - - CheckedError &operator=(const CheckedError &other) { - is_error_ = other.is_error_; - has_been_checked_ = false; - other.has_been_checked_ = true; - return *this; - } - - CheckedError(const CheckedError &other) { - *this = other; // Use assignment operator. - } - - ~CheckedError() { FLATBUFFERS_ASSERT(has_been_checked_); } - - bool Check() { - has_been_checked_ = true; - return is_error_; - } - - private: - bool is_error_; - mutable bool has_been_checked_; -}; - -// Additionally, in GCC we can get these errors statically, for additional -// assurance: -// clang-format off -#ifdef __GNUC__ -#define FLATBUFFERS_CHECKED_ERROR CheckedError \ - __attribute__((warn_unused_result)) -#else -#define FLATBUFFERS_CHECKED_ERROR CheckedError -#endif -// clang-format on - -class Parser : public ParserState { - public: - explicit Parser(const IDLOptions &options = IDLOptions()) - : current_namespace_(nullptr), - empty_namespace_(nullptr), - flex_builder_(256, flexbuffers::BUILDER_FLAG_SHARE_ALL), - root_struct_def_(nullptr), - opts(options), - uses_flexbuffers_(false), - source_(nullptr), - anonymous_counter(0), - recurse_protection_counter(0) { - if (opts.force_defaults) { builder_.ForceDefaults(true); } - // Start out with the empty namespace being current. - empty_namespace_ = new Namespace(); - namespaces_.push_back(empty_namespace_); - current_namespace_ = empty_namespace_; - known_attributes_["deprecated"] = true; - known_attributes_["required"] = true; - known_attributes_["key"] = true; - known_attributes_["shared"] = true; - known_attributes_["hash"] = true; - known_attributes_["id"] = true; - known_attributes_["force_align"] = true; - known_attributes_["bit_flags"] = true; - known_attributes_["original_order"] = true; - known_attributes_["nested_flatbuffer"] = true; - known_attributes_["csharp_partial"] = true; - known_attributes_["streaming"] = true; - known_attributes_["idempotent"] = true; - known_attributes_["cpp_type"] = true; - known_attributes_["cpp_ptr_type"] = true; - known_attributes_["cpp_ptr_type_get"] = true; - known_attributes_["cpp_str_type"] = true; - known_attributes_["cpp_str_flex_ctor"] = true; - known_attributes_["native_inline"] = true; - known_attributes_["native_custom_alloc"] = true; - known_attributes_["native_type"] = true; - known_attributes_["native_default"] = true; - known_attributes_["flexbuffer"] = true; - known_attributes_["private"] = true; - } - - ~Parser() { - for (auto it = namespaces_.begin(); it != namespaces_.end(); ++it) { - delete *it; - } - } - - // Parse the string containing either schema or JSON data, which will - // populate the SymbolTable's or the FlatBufferBuilder above. - // include_paths is used to resolve any include statements, and typically - // should at least include the project path (where you loaded source_ from). - // include_paths must be nullptr terminated if specified. - // If include_paths is nullptr, it will attempt to load from the current - // directory. - // If the source was loaded from a file and isn't an include file, - // supply its name in source_filename. - // All paths specified in this call must be in posix format, if you accept - // paths from user input, please call PosixPath on them first. - bool Parse(const char *_source, const char **include_paths = nullptr, - const char *source_filename = nullptr); - - // Set the root type. May override the one set in the schema. - bool SetRootType(const char *name); - - // Mark all definitions as already having code generated. - void MarkGenerated(); - - // Get the files recursively included by the given file. The returned - // container will have at least the given file. - std::set GetIncludedFilesRecursive( - const std::string &file_name) const; - - // Fills builder_ with a binary version of the schema parsed. - // See reflection/reflection.fbs - void Serialize(); - - // Deserialize a schema buffer - bool Deserialize(const uint8_t *buf, const size_t size); - - // Fills internal structure as if the schema passed had been loaded by parsing - // with Parse except that included filenames will not be populated. - bool Deserialize(const reflection::Schema *schema); - - Type *DeserializeType(const reflection::Type *type); - - // Checks that the schema represented by this parser is a safe evolution - // of the schema provided. Returns non-empty error on any problems. - std::string ConformTo(const Parser &base); - - // Similar to Parse(), but now only accepts JSON to be parsed into a - // FlexBuffer. - bool ParseFlexBuffer(const char *source, const char *source_filename, - flexbuffers::Builder *builder); - - StructDef *LookupStruct(const std::string &id) const; - - std::string UnqualifiedName(const std::string &fullQualifiedName); - - FLATBUFFERS_CHECKED_ERROR Error(const std::string &msg); - - private: - void Message(const std::string &msg); - void Warning(const std::string &msg); - FLATBUFFERS_CHECKED_ERROR ParseHexNum(int nibbles, uint64_t *val); - FLATBUFFERS_CHECKED_ERROR Next(); - FLATBUFFERS_CHECKED_ERROR SkipByteOrderMark(); - bool Is(int t) const; - bool IsIdent(const char *id) const; - FLATBUFFERS_CHECKED_ERROR Expect(int t); - std::string TokenToStringId(int t) const; - EnumDef *LookupEnum(const std::string &id); - FLATBUFFERS_CHECKED_ERROR ParseNamespacing(std::string *id, - std::string *last); - FLATBUFFERS_CHECKED_ERROR ParseTypeIdent(Type &type); - FLATBUFFERS_CHECKED_ERROR ParseType(Type &type); - FLATBUFFERS_CHECKED_ERROR AddField(StructDef &struct_def, - const std::string &name, const Type &type, - FieldDef **dest); - FLATBUFFERS_CHECKED_ERROR ParseField(StructDef &struct_def); - FLATBUFFERS_CHECKED_ERROR ParseString(Value &val); - FLATBUFFERS_CHECKED_ERROR ParseComma(); - FLATBUFFERS_CHECKED_ERROR ParseAnyValue(Value &val, FieldDef *field, - size_t parent_fieldn, - const StructDef *parent_struct_def, - uoffset_t count, - bool inside_vector = false); - template - FLATBUFFERS_CHECKED_ERROR ParseTableDelimiters(size_t &fieldn, - const StructDef *struct_def, - F body); - FLATBUFFERS_CHECKED_ERROR ParseTable(const StructDef &struct_def, - std::string *value, uoffset_t *ovalue); - void SerializeStruct(const StructDef &struct_def, const Value &val); - void SerializeStruct(FlatBufferBuilder &builder, const StructDef &struct_def, - const Value &val); - template - FLATBUFFERS_CHECKED_ERROR ParseVectorDelimiters(uoffset_t &count, F body); - FLATBUFFERS_CHECKED_ERROR ParseVector(const Type &type, uoffset_t *ovalue, - FieldDef *field, size_t fieldn); - FLATBUFFERS_CHECKED_ERROR ParseArray(Value &array); - FLATBUFFERS_CHECKED_ERROR ParseNestedFlatbuffer( - Value &val, FieldDef *field, size_t fieldn, - const StructDef *parent_struct_def); - FLATBUFFERS_CHECKED_ERROR ParseMetaData(SymbolTable *attributes); - FLATBUFFERS_CHECKED_ERROR TryTypedValue(const std::string *name, int dtoken, - bool check, Value &e, BaseType req, - bool *destmatch); - FLATBUFFERS_CHECKED_ERROR ParseHash(Value &e, FieldDef *field); - FLATBUFFERS_CHECKED_ERROR TokenError(); - FLATBUFFERS_CHECKED_ERROR ParseSingleValue(const std::string *name, Value &e, - bool check_now); - FLATBUFFERS_CHECKED_ERROR ParseEnumFromString(const Type &type, - std::string *result); - StructDef *LookupCreateStruct(const std::string &name, - bool create_if_new = true, - bool definition = false); - FLATBUFFERS_CHECKED_ERROR ParseEnum(bool is_union, EnumDef **dest); - FLATBUFFERS_CHECKED_ERROR ParseNamespace(); - FLATBUFFERS_CHECKED_ERROR StartStruct(const std::string &name, - StructDef **dest); - FLATBUFFERS_CHECKED_ERROR StartEnum(const std::string &name, bool is_union, - EnumDef **dest); - FLATBUFFERS_CHECKED_ERROR ParseDecl(); - FLATBUFFERS_CHECKED_ERROR ParseService(); - FLATBUFFERS_CHECKED_ERROR ParseProtoFields(StructDef *struct_def, - bool isextend, bool inside_oneof); - FLATBUFFERS_CHECKED_ERROR ParseProtoOption(); - FLATBUFFERS_CHECKED_ERROR ParseProtoKey(); - FLATBUFFERS_CHECKED_ERROR ParseProtoDecl(); - FLATBUFFERS_CHECKED_ERROR ParseProtoCurliesOrIdent(); - FLATBUFFERS_CHECKED_ERROR ParseTypeFromProtoType(Type *type); - FLATBUFFERS_CHECKED_ERROR SkipAnyJsonValue(); - FLATBUFFERS_CHECKED_ERROR ParseFlexBufferValue(flexbuffers::Builder *builder); - FLATBUFFERS_CHECKED_ERROR StartParseFile(const char *source, - const char *source_filename); - FLATBUFFERS_CHECKED_ERROR ParseRoot(const char *_source, - const char **include_paths, - const char *source_filename); - FLATBUFFERS_CHECKED_ERROR DoParse(const char *_source, - const char **include_paths, - const char *source_filename, - const char *include_filename); - FLATBUFFERS_CHECKED_ERROR CheckClash(std::vector &fields, - StructDef *struct_def, - const char *suffix, BaseType baseType); - - bool SupportsAdvancedUnionFeatures() const; - bool SupportsAdvancedArrayFeatures() const; - Namespace *UniqueNamespace(Namespace *ns); - - FLATBUFFERS_CHECKED_ERROR RecurseError(); - template CheckedError Recurse(F f); - - public: - SymbolTable types_; - SymbolTable structs_; - SymbolTable enums_; - SymbolTable services_; - std::vector namespaces_; - Namespace *current_namespace_; - Namespace *empty_namespace_; - std::string error_; // User readable error_ if Parse() == false - - FlatBufferBuilder builder_; // any data contained in the file - flexbuffers::Builder flex_builder_; - flexbuffers::Reference flex_root_; - StructDef *root_struct_def_; - std::string file_identifier_; - std::string file_extension_; - - std::map included_files_; - std::map> files_included_per_file_; - std::vector native_included_files_; - - std::map known_attributes_; - - IDLOptions opts; - bool uses_flexbuffers_; - - private: - const char *source_; - - std::string file_being_parsed_; - - std::vector> field_stack_; - - int anonymous_counter; - int recurse_protection_counter; -}; - -// Utility functions for multiple generators: - -extern std::string MakeCamel(const std::string &in, bool first = true); - -extern std::string MakeScreamingCamel(const std::string &in); - -// Generate text (JSON) from a given FlatBuffer, and a given Parser -// object that has been populated with the corresponding schema. -// If ident_step is 0, no indentation will be generated. Additionally, -// if it is less than 0, no linefeeds will be generated either. -// See idl_gen_text.cpp. -// strict_json adds "quotes" around field names if true. -// If the flatbuffer cannot be encoded in JSON (e.g., it contains non-UTF-8 -// byte arrays in String values), returns false. -extern bool GenerateTextFromTable(const Parser &parser, const void *table, - const std::string &tablename, - std::string *text); -extern bool GenerateText(const Parser &parser, const void *flatbuffer, - std::string *text); -extern bool GenerateTextFile(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate binary files from a given FlatBuffer, and a given Parser -// object that has been populated with the corresponding schema. -// See code_generators.cpp. -extern bool GenerateBinary(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate a C++ header from the definitions in the Parser object. -// See idl_gen_cpp. -extern bool GenerateCPP(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate C# files from the definitions in the Parser object. -// See idl_gen_csharp.cpp. -extern bool GenerateCSharp(const Parser &parser, const std::string &path, - const std::string &file_name); - -extern bool GenerateDart(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate Java files from the definitions in the Parser object. -// See idl_gen_java.cpp. -extern bool GenerateJava(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate JavaScript or TypeScript code from the definitions in the Parser -// object. See idl_gen_js. -extern bool GenerateJSTS(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate Go files from the definitions in the Parser object. -// See idl_gen_go.cpp. -extern bool GenerateGo(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate Php code from the definitions in the Parser object. -// See idl_gen_php. -extern bool GeneratePhp(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate Python files from the definitions in the Parser object. -// See idl_gen_python.cpp. -extern bool GeneratePython(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate Lobster files from the definitions in the Parser object. -// See idl_gen_lobster.cpp. -extern bool GenerateLobster(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate Lua files from the definitions in the Parser object. -// See idl_gen_lua.cpp. -extern bool GenerateLua(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate Rust files from the definitions in the Parser object. -// See idl_gen_rust.cpp. -extern bool GenerateRust(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate Json schema file -// See idl_gen_json_schema.cpp. -extern bool GenerateJsonSchema(const Parser &parser, const std::string &path, - const std::string &file_name); - -extern bool GenerateKotlin(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate Swift classes. -// See idl_gen_swift.cpp -extern bool GenerateSwift(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate a schema file from the internal representation, useful after -// parsing a .proto schema. -extern std::string GenerateFBS(const Parser &parser, - const std::string &file_name); -extern bool GenerateFBS(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate a make rule for the generated JavaScript or TypeScript code. -// See idl_gen_js.cpp. -extern std::string JSTSMakeRule(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate a make rule for the generated C++ header. -// See idl_gen_cpp.cpp. -extern std::string CPPMakeRule(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate a make rule for the generated Dart code -// see idl_gen_dart.cpp -extern std::string DartMakeRule(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate a make rule for the generated Rust code. -// See idl_gen_rust.cpp. -extern std::string RustMakeRule(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate a make rule for generated Java or C# files. -// See code_generators.cpp. -extern std::string JavaCSharpMakeRule(const Parser &parser, - const std::string &path, - const std::string &file_name); - -// Generate a make rule for the generated text (JSON) files. -// See idl_gen_text.cpp. -extern std::string TextMakeRule(const Parser &parser, const std::string &path, - const std::string &file_names); - -// Generate a make rule for the generated binary files. -// See code_generators.cpp. -extern std::string BinaryMakeRule(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate GRPC Cpp interfaces. -// See idl_gen_grpc.cpp. -bool GenerateCppGRPC(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate GRPC Go interfaces. -// See idl_gen_grpc.cpp. -bool GenerateGoGRPC(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate GRPC Java classes. -// See idl_gen_grpc.cpp -bool GenerateJavaGRPC(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate GRPC Python interfaces. -// See idl_gen_grpc.cpp. -bool GeneratePythonGRPC(const Parser &parser, const std::string &path, - const std::string &file_name); - -// Generate GRPC Swift interfaces. -// See idl_gen_grpc.cpp. -extern bool GenerateSwiftGRPC(const Parser &parser, const std::string &path, - const std::string &file_name); - -} // namespace flatbuffers - -#endif // FLATBUFFERS_IDL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/minireflect.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/minireflect.h deleted file mode 100644 index 67a79a9..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/minireflect.h +++ /dev/null @@ -1,408 +0,0 @@ -/* - * Copyright 2017 Google Inc. 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 FLATBUFFERS_MINIREFLECT_H_ -#define FLATBUFFERS_MINIREFLECT_H_ - -#include "flatbuffers/flatbuffers.h" -#include "flatbuffers/util.h" - -namespace flatbuffers { - -// Utilities that can be used with the "mini reflection" tables present -// in generated code with --reflect-types (only types) or --reflect-names -// (also names). -// This allows basic reflection functionality such as pretty-printing -// that does not require the use of the schema parser or loading of binary -// schema files at runtime (reflection.h). - -// For any of the functions below that take `const TypeTable *`, you pass -// `FooTypeTable()` if the type of the root is `Foo`. - -// First, a generic iterator that can be used by multiple algorithms. - -struct IterationVisitor { - // These mark the scope of a table or struct. - virtual void StartSequence() {} - virtual void EndSequence() {} - // Called for each field regardless of wether it is present or not. - // If not present, val == nullptr. set_idx is the index of all set fields. - virtual void Field(size_t /*field_idx*/, size_t /*set_idx*/, - ElementaryType /*type*/, bool /*is_vector*/, - const TypeTable * /*type_table*/, const char * /*name*/, - const uint8_t * /*val*/) {} - // Called for a value that is actually present, after a field, or as part - // of a vector. - virtual void UType(uint8_t, const char *) {} - virtual void Bool(bool) {} - virtual void Char(int8_t, const char *) {} - virtual void UChar(uint8_t, const char *) {} - virtual void Short(int16_t, const char *) {} - virtual void UShort(uint16_t, const char *) {} - virtual void Int(int32_t, const char *) {} - virtual void UInt(uint32_t, const char *) {} - virtual void Long(int64_t) {} - virtual void ULong(uint64_t) {} - virtual void Float(float) {} - virtual void Double(double) {} - virtual void String(const String *) {} - virtual void Unknown(const uint8_t *) {} // From a future version. - // These mark the scope of a vector. - virtual void StartVector() {} - virtual void EndVector() {} - virtual void Element(size_t /*i*/, ElementaryType /*type*/, - const TypeTable * /*type_table*/, - const uint8_t * /*val*/) {} - virtual ~IterationVisitor() {} -}; - -inline size_t InlineSize(ElementaryType type, const TypeTable *type_table) { - switch (type) { - case ET_UTYPE: - case ET_BOOL: - case ET_CHAR: - case ET_UCHAR: return 1; - case ET_SHORT: - case ET_USHORT: return 2; - case ET_INT: - case ET_UINT: - case ET_FLOAT: - case ET_STRING: return 4; - case ET_LONG: - case ET_ULONG: - case ET_DOUBLE: return 8; - case ET_SEQUENCE: - switch (type_table->st) { - case ST_TABLE: - case ST_UNION: return 4; - case ST_STRUCT: - return static_cast(type_table->values[type_table->num_elems]); - default: FLATBUFFERS_ASSERT(false); return 1; - } - default: FLATBUFFERS_ASSERT(false); return 1; - } -} - -inline int64_t LookupEnum(int64_t enum_val, const int64_t *values, - size_t num_values) { - if (!values) return enum_val; - for (size_t i = 0; i < num_values; i++) { - if (enum_val == values[i]) return static_cast(i); - } - return -1; // Unknown enum value. -} - -template const char *EnumName(T tval, const TypeTable *type_table) { - if (!type_table || !type_table->names) return nullptr; - auto i = LookupEnum(static_cast(tval), type_table->values, - type_table->num_elems); - if (i >= 0 && i < static_cast(type_table->num_elems)) { - return type_table->names[i]; - } - return nullptr; -} - -void IterateObject(const uint8_t *obj, const TypeTable *type_table, - IterationVisitor *visitor); - -inline void IterateValue(ElementaryType type, const uint8_t *val, - const TypeTable *type_table, const uint8_t *prev_val, - soffset_t vector_index, IterationVisitor *visitor) { - switch (type) { - case ET_UTYPE: { - auto tval = ReadScalar(val); - visitor->UType(tval, EnumName(tval, type_table)); - break; - } - case ET_BOOL: { - visitor->Bool(ReadScalar(val) != 0); - break; - } - case ET_CHAR: { - auto tval = ReadScalar(val); - visitor->Char(tval, EnumName(tval, type_table)); - break; - } - case ET_UCHAR: { - auto tval = ReadScalar(val); - visitor->UChar(tval, EnumName(tval, type_table)); - break; - } - case ET_SHORT: { - auto tval = ReadScalar(val); - visitor->Short(tval, EnumName(tval, type_table)); - break; - } - case ET_USHORT: { - auto tval = ReadScalar(val); - visitor->UShort(tval, EnumName(tval, type_table)); - break; - } - case ET_INT: { - auto tval = ReadScalar(val); - visitor->Int(tval, EnumName(tval, type_table)); - break; - } - case ET_UINT: { - auto tval = ReadScalar(val); - visitor->UInt(tval, EnumName(tval, type_table)); - break; - } - case ET_LONG: { - visitor->Long(ReadScalar(val)); - break; - } - case ET_ULONG: { - visitor->ULong(ReadScalar(val)); - break; - } - case ET_FLOAT: { - visitor->Float(ReadScalar(val)); - break; - } - case ET_DOUBLE: { - visitor->Double(ReadScalar(val)); - break; - } - case ET_STRING: { - val += ReadScalar(val); - visitor->String(reinterpret_cast(val)); - break; - } - case ET_SEQUENCE: { - switch (type_table->st) { - case ST_TABLE: - val += ReadScalar(val); - IterateObject(val, type_table, visitor); - break; - case ST_STRUCT: IterateObject(val, type_table, visitor); break; - case ST_UNION: { - val += ReadScalar(val); - FLATBUFFERS_ASSERT(prev_val); - auto union_type = *prev_val; // Always a uint8_t. - if (vector_index >= 0) { - auto type_vec = reinterpret_cast *>(prev_val); - union_type = type_vec->Get(static_cast(vector_index)); - } - auto type_code_idx = - LookupEnum(union_type, type_table->values, type_table->num_elems); - if (type_code_idx >= 0 && - type_code_idx < static_cast(type_table->num_elems)) { - auto type_code = type_table->type_codes[type_code_idx]; - switch (type_code.base_type) { - case ET_SEQUENCE: { - auto ref = type_table->type_refs[type_code.sequence_ref](); - IterateObject(val, ref, visitor); - break; - } - case ET_STRING: - visitor->String(reinterpret_cast(val)); - break; - default: visitor->Unknown(val); - } - } else { - visitor->Unknown(val); - } - break; - } - case ST_ENUM: FLATBUFFERS_ASSERT(false); break; - } - break; - } - default: { - visitor->Unknown(val); - break; - } - } -} - -inline void IterateObject(const uint8_t *obj, const TypeTable *type_table, - IterationVisitor *visitor) { - visitor->StartSequence(); - const uint8_t *prev_val = nullptr; - size_t set_idx = 0; - for (size_t i = 0; i < type_table->num_elems; i++) { - auto type_code = type_table->type_codes[i]; - auto type = static_cast(type_code.base_type); - auto is_vector = type_code.is_vector != 0; - auto ref_idx = type_code.sequence_ref; - const TypeTable *ref = nullptr; - if (ref_idx >= 0) { ref = type_table->type_refs[ref_idx](); } - auto name = type_table->names ? type_table->names[i] : nullptr; - const uint8_t *val = nullptr; - if (type_table->st == ST_TABLE) { - val = reinterpret_cast(obj)->GetAddressOf( - FieldIndexToOffset(static_cast(i))); - } else { - val = obj + type_table->values[i]; - } - visitor->Field(i, set_idx, type, is_vector, ref, name, val); - if (val) { - set_idx++; - if (is_vector) { - val += ReadScalar(val); - auto vec = reinterpret_cast *>(val); - visitor->StartVector(); - auto elem_ptr = vec->Data(); - for (size_t j = 0; j < vec->size(); j++) { - visitor->Element(j, type, ref, elem_ptr); - IterateValue(type, elem_ptr, ref, prev_val, static_cast(j), - visitor); - elem_ptr += InlineSize(type, ref); - } - visitor->EndVector(); - } else { - IterateValue(type, val, ref, prev_val, -1, visitor); - } - } - prev_val = val; - } - visitor->EndSequence(); -} - -inline void IterateFlatBuffer(const uint8_t *buffer, - const TypeTable *type_table, - IterationVisitor *callback) { - IterateObject(GetRoot(buffer), type_table, callback); -} - -// Outputting a Flatbuffer to a string. Tries to conform as close to JSON / -// the output generated by idl_gen_text.cpp. - -struct ToStringVisitor : public IterationVisitor { - std::string s; - std::string d; - bool q; - std::string in; - size_t indent_level; - bool vector_delimited; - ToStringVisitor(std::string delimiter, bool quotes, std::string indent, - bool vdelimited = true) - : d(delimiter), - q(quotes), - in(indent), - indent_level(0), - vector_delimited(vdelimited) {} - ToStringVisitor(std::string delimiter) - : d(delimiter), - q(false), - in(""), - indent_level(0), - vector_delimited(true) {} - - void append_indent() { - for (size_t i = 0; i < indent_level; i++) { s += in; } - } - - void StartSequence() { - s += "{"; - s += d; - indent_level++; - } - void EndSequence() { - s += d; - indent_level--; - append_indent(); - s += "}"; - } - void Field(size_t /*field_idx*/, size_t set_idx, ElementaryType /*type*/, - bool /*is_vector*/, const TypeTable * /*type_table*/, - const char *name, const uint8_t *val) { - if (!val) return; - if (set_idx) { - s += ","; - s += d; - } - append_indent(); - if (name) { - if (q) s += "\""; - s += name; - if (q) s += "\""; - s += ": "; - } - } - template void Named(T x, const char *name) { - if (name) { - if (q) s += "\""; - s += name; - if (q) s += "\""; - } else { - s += NumToString(x); - } - } - void UType(uint8_t x, const char *name) { Named(x, name); } - void Bool(bool x) { s += x ? "true" : "false"; } - void Char(int8_t x, const char *name) { Named(x, name); } - void UChar(uint8_t x, const char *name) { Named(x, name); } - void Short(int16_t x, const char *name) { Named(x, name); } - void UShort(uint16_t x, const char *name) { Named(x, name); } - void Int(int32_t x, const char *name) { Named(x, name); } - void UInt(uint32_t x, const char *name) { Named(x, name); } - void Long(int64_t x) { s += NumToString(x); } - void ULong(uint64_t x) { s += NumToString(x); } - void Float(float x) { s += NumToString(x); } - void Double(double x) { s += NumToString(x); } - void String(const struct String *str) { - EscapeString(str->c_str(), str->size(), &s, true, false); - } - void Unknown(const uint8_t *) { s += "(?)"; } - void StartVector() { - s += "["; - if (vector_delimited) { - s += d; - indent_level++; - append_indent(); - } else { - s += " "; - } - } - void EndVector() { - if (vector_delimited) { - s += d; - indent_level--; - append_indent(); - } else { - s += " "; - } - s += "]"; - } - void Element(size_t i, ElementaryType /*type*/, - const TypeTable * /*type_table*/, const uint8_t * /*val*/) { - if (i) { - s += ","; - if (vector_delimited) { - s += d; - append_indent(); - } else { - s += " "; - } - } - } -}; - -inline std::string FlatBufferToString(const uint8_t *buffer, - const TypeTable *type_table, - bool multi_line = false, - bool vector_delimited = true) { - ToStringVisitor tostring_visitor(multi_line ? "\n" : " ", false, "", - vector_delimited); - IterateFlatBuffer(buffer, type_table, &tostring_visitor); - return tostring_visitor.s; -} - -} // namespace flatbuffers - -#endif // FLATBUFFERS_MINIREFLECT_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/reflection.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/reflection.h deleted file mode 100644 index 052e6d9..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/reflection.h +++ /dev/null @@ -1,477 +0,0 @@ -/* - * Copyright 2015 Google Inc. 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 FLATBUFFERS_REFLECTION_H_ -#define FLATBUFFERS_REFLECTION_H_ - -// This is somewhat of a circular dependency because flatc (and thus this -// file) is needed to generate this header in the first place. -// Should normally not be a problem since it can be generated by the -// previous version of flatc whenever this code needs to change. -// See reflection/generate_code.sh -#include "flatbuffers/reflection_generated.h" - -// Helper functionality for reflection. - -namespace flatbuffers { - -// ------------------------- GETTERS ------------------------- - -inline bool IsScalar(reflection::BaseType t) { - return t >= reflection::UType && t <= reflection::Double; -} -inline bool IsInteger(reflection::BaseType t) { - return t >= reflection::UType && t <= reflection::ULong; -} -inline bool IsFloat(reflection::BaseType t) { - return t == reflection::Float || t == reflection::Double; -} -inline bool IsLong(reflection::BaseType t) { - return t == reflection::Long || t == reflection::ULong; -} - -// Size of a basic type, don't use with structs. -inline size_t GetTypeSize(reflection::BaseType base_type) { - // This needs to correspond to the BaseType enum. - static size_t sizes[] = { 0, 1, 1, 1, 1, 2, 2, 4, 4, 8, 8, 4, 8, 4, 4, 4, 4 }; - return sizes[base_type]; -} - -// Same as above, but now correctly returns the size of a struct if -// the field (or vector element) is a struct. -inline size_t GetTypeSizeInline(reflection::BaseType base_type, int type_index, - const reflection::Schema &schema) { - if (base_type == reflection::Obj && - schema.objects()->Get(type_index)->is_struct()) { - return schema.objects()->Get(type_index)->bytesize(); - } else { - return GetTypeSize(base_type); - } -} - -// Get the root, regardless of what type it is. -inline Table *GetAnyRoot(uint8_t *flatbuf) { - return GetMutableRoot
(flatbuf); -} -inline const Table *GetAnyRoot(const uint8_t *flatbuf) { - return GetRoot
(flatbuf); -} - -// Get a field's default, if you know it's an integer, and its exact type. -template T GetFieldDefaultI(const reflection::Field &field) { - FLATBUFFERS_ASSERT(sizeof(T) == GetTypeSize(field.type()->base_type())); - return static_cast(field.default_integer()); -} - -// Get a field's default, if you know it's floating point and its exact type. -template T GetFieldDefaultF(const reflection::Field &field) { - FLATBUFFERS_ASSERT(sizeof(T) == GetTypeSize(field.type()->base_type())); - return static_cast(field.default_real()); -} - -// Get a field, if you know it's an integer, and its exact type. -template -T GetFieldI(const Table &table, const reflection::Field &field) { - FLATBUFFERS_ASSERT(sizeof(T) == GetTypeSize(field.type()->base_type())); - return table.GetField(field.offset(), - static_cast(field.default_integer())); -} - -// Get a field, if you know it's floating point and its exact type. -template -T GetFieldF(const Table &table, const reflection::Field &field) { - FLATBUFFERS_ASSERT(sizeof(T) == GetTypeSize(field.type()->base_type())); - return table.GetField(field.offset(), - static_cast(field.default_real())); -} - -// Get a field, if you know it's a string. -inline const String *GetFieldS(const Table &table, - const reflection::Field &field) { - FLATBUFFERS_ASSERT(field.type()->base_type() == reflection::String); - return table.GetPointer(field.offset()); -} - -// Get a field, if you know it's a vector. -template -Vector *GetFieldV(const Table &table, const reflection::Field &field) { - FLATBUFFERS_ASSERT(field.type()->base_type() == reflection::Vector && - sizeof(T) == GetTypeSize(field.type()->element())); - return table.GetPointer *>(field.offset()); -} - -// Get a field, if you know it's a vector, generically. -// To actually access elements, use the return value together with -// field.type()->element() in any of GetAnyVectorElemI below etc. -inline VectorOfAny *GetFieldAnyV(const Table &table, - const reflection::Field &field) { - return table.GetPointer(field.offset()); -} - -// Get a field, if you know it's a table. -inline Table *GetFieldT(const Table &table, const reflection::Field &field) { - FLATBUFFERS_ASSERT(field.type()->base_type() == reflection::Obj || - field.type()->base_type() == reflection::Union); - return table.GetPointer
(field.offset()); -} - -// Get a field, if you know it's a struct. -inline const Struct *GetFieldStruct(const Table &table, - const reflection::Field &field) { - // TODO: This does NOT check if the field is a table or struct, but we'd need - // access to the schema to check the is_struct flag. - FLATBUFFERS_ASSERT(field.type()->base_type() == reflection::Obj); - return table.GetStruct(field.offset()); -} - -// Get a structure's field, if you know it's a struct. -inline const Struct *GetFieldStruct(const Struct &structure, - const reflection::Field &field) { - FLATBUFFERS_ASSERT(field.type()->base_type() == reflection::Obj); - return structure.GetStruct(field.offset()); -} - -// Raw helper functions used below: get any value in memory as a 64bit int, a -// double or a string. -// All scalars get static_cast to an int64_t, strings use strtoull, every other -// data type returns 0. -int64_t GetAnyValueI(reflection::BaseType type, const uint8_t *data); -// All scalars static cast to double, strings use strtod, every other data -// type is 0.0. -double GetAnyValueF(reflection::BaseType type, const uint8_t *data); -// All scalars converted using stringstream, strings as-is, and all other -// data types provide some level of debug-pretty-printing. -std::string GetAnyValueS(reflection::BaseType type, const uint8_t *data, - const reflection::Schema *schema, int type_index); - -// Get any table field as a 64bit int, regardless of what type it is. -inline int64_t GetAnyFieldI(const Table &table, - const reflection::Field &field) { - auto field_ptr = table.GetAddressOf(field.offset()); - return field_ptr ? GetAnyValueI(field.type()->base_type(), field_ptr) - : field.default_integer(); -} - -// Get any table field as a double, regardless of what type it is. -inline double GetAnyFieldF(const Table &table, const reflection::Field &field) { - auto field_ptr = table.GetAddressOf(field.offset()); - return field_ptr ? GetAnyValueF(field.type()->base_type(), field_ptr) - : field.default_real(); -} - -// Get any table field as a string, regardless of what type it is. -// You may pass nullptr for the schema if you don't care to have fields that -// are of table type pretty-printed. -inline std::string GetAnyFieldS(const Table &table, - const reflection::Field &field, - const reflection::Schema *schema) { - auto field_ptr = table.GetAddressOf(field.offset()); - return field_ptr ? GetAnyValueS(field.type()->base_type(), field_ptr, schema, - field.type()->index()) - : ""; -} - -// Get any struct field as a 64bit int, regardless of what type it is. -inline int64_t GetAnyFieldI(const Struct &st, const reflection::Field &field) { - return GetAnyValueI(field.type()->base_type(), - st.GetAddressOf(field.offset())); -} - -// Get any struct field as a double, regardless of what type it is. -inline double GetAnyFieldF(const Struct &st, const reflection::Field &field) { - return GetAnyValueF(field.type()->base_type(), - st.GetAddressOf(field.offset())); -} - -// Get any struct field as a string, regardless of what type it is. -inline std::string GetAnyFieldS(const Struct &st, - const reflection::Field &field) { - return GetAnyValueS(field.type()->base_type(), - st.GetAddressOf(field.offset()), nullptr, -1); -} - -// Get any vector element as a 64bit int, regardless of what type it is. -inline int64_t GetAnyVectorElemI(const VectorOfAny *vec, - reflection::BaseType elem_type, size_t i) { - return GetAnyValueI(elem_type, vec->Data() + GetTypeSize(elem_type) * i); -} - -// Get any vector element as a double, regardless of what type it is. -inline double GetAnyVectorElemF(const VectorOfAny *vec, - reflection::BaseType elem_type, size_t i) { - return GetAnyValueF(elem_type, vec->Data() + GetTypeSize(elem_type) * i); -} - -// Get any vector element as a string, regardless of what type it is. -inline std::string GetAnyVectorElemS(const VectorOfAny *vec, - reflection::BaseType elem_type, size_t i) { - return GetAnyValueS(elem_type, vec->Data() + GetTypeSize(elem_type) * i, - nullptr, -1); -} - -// Get a vector element that's a table/string/vector from a generic vector. -// Pass Table/String/VectorOfAny as template parameter. -// Warning: does no typechecking. -template -T *GetAnyVectorElemPointer(const VectorOfAny *vec, size_t i) { - auto elem_ptr = vec->Data() + sizeof(uoffset_t) * i; - return reinterpret_cast(elem_ptr + ReadScalar(elem_ptr)); -} - -// Get the inline-address of a vector element. Useful for Structs (pass Struct -// as template arg), or being able to address a range of scalars in-line. -// Get elem_size from GetTypeSizeInline(). -// Note: little-endian data on all platforms, use EndianScalar() instead of -// raw pointer access with scalars). -template -T *GetAnyVectorElemAddressOf(const VectorOfAny *vec, size_t i, - size_t elem_size) { - return reinterpret_cast(vec->Data() + elem_size * i); -} - -// Similarly, for elements of tables. -template -T *GetAnyFieldAddressOf(const Table &table, const reflection::Field &field) { - return reinterpret_cast(table.GetAddressOf(field.offset())); -} - -// Similarly, for elements of structs. -template -T *GetAnyFieldAddressOf(const Struct &st, const reflection::Field &field) { - return reinterpret_cast(st.GetAddressOf(field.offset())); -} - -// ------------------------- SETTERS ------------------------- - -// Set any scalar field, if you know its exact type. -template -bool SetField(Table *table, const reflection::Field &field, T val) { - reflection::BaseType type = field.type()->base_type(); - if (!IsScalar(type)) { return false; } - FLATBUFFERS_ASSERT(sizeof(T) == GetTypeSize(type)); - T def; - if (IsInteger(type)) { - def = GetFieldDefaultI(field); - } else { - FLATBUFFERS_ASSERT(IsFloat(type)); - def = GetFieldDefaultF(field); - } - return table->SetField(field.offset(), val, def); -} - -// Raw helper functions used below: set any value in memory as a 64bit int, a -// double or a string. -// These work for all scalar values, but do nothing for other data types. -// To set a string, see SetString below. -void SetAnyValueI(reflection::BaseType type, uint8_t *data, int64_t val); -void SetAnyValueF(reflection::BaseType type, uint8_t *data, double val); -void SetAnyValueS(reflection::BaseType type, uint8_t *data, const char *val); - -// Set any table field as a 64bit int, regardless of type what it is. -inline bool SetAnyFieldI(Table *table, const reflection::Field &field, - int64_t val) { - auto field_ptr = table->GetAddressOf(field.offset()); - if (!field_ptr) return val == GetFieldDefaultI(field); - SetAnyValueI(field.type()->base_type(), field_ptr, val); - return true; -} - -// Set any table field as a double, regardless of what type it is. -inline bool SetAnyFieldF(Table *table, const reflection::Field &field, - double val) { - auto field_ptr = table->GetAddressOf(field.offset()); - if (!field_ptr) return val == GetFieldDefaultF(field); - SetAnyValueF(field.type()->base_type(), field_ptr, val); - return true; -} - -// Set any table field as a string, regardless of what type it is. -inline bool SetAnyFieldS(Table *table, const reflection::Field &field, - const char *val) { - auto field_ptr = table->GetAddressOf(field.offset()); - if (!field_ptr) return false; - SetAnyValueS(field.type()->base_type(), field_ptr, val); - return true; -} - -// Set any struct field as a 64bit int, regardless of type what it is. -inline void SetAnyFieldI(Struct *st, const reflection::Field &field, - int64_t val) { - SetAnyValueI(field.type()->base_type(), st->GetAddressOf(field.offset()), - val); -} - -// Set any struct field as a double, regardless of type what it is. -inline void SetAnyFieldF(Struct *st, const reflection::Field &field, - double val) { - SetAnyValueF(field.type()->base_type(), st->GetAddressOf(field.offset()), - val); -} - -// Set any struct field as a string, regardless of type what it is. -inline void SetAnyFieldS(Struct *st, const reflection::Field &field, - const char *val) { - SetAnyValueS(field.type()->base_type(), st->GetAddressOf(field.offset()), - val); -} - -// Set any vector element as a 64bit int, regardless of type what it is. -inline void SetAnyVectorElemI(VectorOfAny *vec, reflection::BaseType elem_type, - size_t i, int64_t val) { - SetAnyValueI(elem_type, vec->Data() + GetTypeSize(elem_type) * i, val); -} - -// Set any vector element as a double, regardless of type what it is. -inline void SetAnyVectorElemF(VectorOfAny *vec, reflection::BaseType elem_type, - size_t i, double val) { - SetAnyValueF(elem_type, vec->Data() + GetTypeSize(elem_type) * i, val); -} - -// Set any vector element as a string, regardless of type what it is. -inline void SetAnyVectorElemS(VectorOfAny *vec, reflection::BaseType elem_type, - size_t i, const char *val) { - SetAnyValueS(elem_type, vec->Data() + GetTypeSize(elem_type) * i, val); -} - -// ------------------------- RESIZING SETTERS ------------------------- - -// "smart" pointer for use with resizing vectors: turns a pointer inside -// a vector into a relative offset, such that it is not affected by resizes. -template class pointer_inside_vector { - public: - pointer_inside_vector(T *ptr, std::vector &vec) - : offset_(reinterpret_cast(ptr) - - reinterpret_cast(flatbuffers::vector_data(vec))), - vec_(vec) {} - - T *operator*() const { - return reinterpret_cast( - reinterpret_cast(flatbuffers::vector_data(vec_)) + offset_); - } - T *operator->() const { return operator*(); } - void operator=(const pointer_inside_vector &piv); - - private: - size_t offset_; - std::vector &vec_; -}; - -// Helper to create the above easily without specifying template args. -template -pointer_inside_vector piv(T *ptr, std::vector &vec) { - return pointer_inside_vector(ptr, vec); -} - -inline const char *UnionTypeFieldSuffix() { return "_type"; } - -// Helper to figure out the actual table type a union refers to. -inline const reflection::Object &GetUnionType( - const reflection::Schema &schema, const reflection::Object &parent, - const reflection::Field &unionfield, const Table &table) { - auto enumdef = schema.enums()->Get(unionfield.type()->index()); - // TODO: this is clumsy and slow, but no other way to find it? - auto type_field = parent.fields()->LookupByKey( - (unionfield.name()->str() + UnionTypeFieldSuffix()).c_str()); - FLATBUFFERS_ASSERT(type_field); - auto union_type = GetFieldI(table, *type_field); - auto enumval = enumdef->values()->LookupByKey(union_type); - return *enumval->object(); -} - -// Changes the contents of a string inside a FlatBuffer. FlatBuffer must -// live inside a std::vector so we can resize the buffer if needed. -// "str" must live inside "flatbuf" and may be invalidated after this call. -// If your FlatBuffer's root table is not the schema's root table, you should -// pass in your root_table type as well. -void SetString(const reflection::Schema &schema, const std::string &val, - const String *str, std::vector *flatbuf, - const reflection::Object *root_table = nullptr); - -// Resizes a flatbuffers::Vector inside a FlatBuffer. FlatBuffer must -// live inside a std::vector so we can resize the buffer if needed. -// "vec" must live inside "flatbuf" and may be invalidated after this call. -// If your FlatBuffer's root table is not the schema's root table, you should -// pass in your root_table type as well. -uint8_t *ResizeAnyVector(const reflection::Schema &schema, uoffset_t newsize, - const VectorOfAny *vec, uoffset_t num_elems, - uoffset_t elem_size, std::vector *flatbuf, - const reflection::Object *root_table = nullptr); - -template -void ResizeVector(const reflection::Schema &schema, uoffset_t newsize, T val, - const Vector *vec, std::vector *flatbuf, - const reflection::Object *root_table = nullptr) { - auto delta_elem = static_cast(newsize) - static_cast(vec->size()); - auto newelems = ResizeAnyVector( - schema, newsize, reinterpret_cast(vec), vec->size(), - static_cast(sizeof(T)), flatbuf, root_table); - // Set new elements to "val". - for (int i = 0; i < delta_elem; i++) { - auto loc = newelems + i * sizeof(T); - auto is_scalar = flatbuffers::is_scalar::value; - if (is_scalar) { - WriteScalar(loc, val); - } else { // struct - *reinterpret_cast(loc) = val; - } - } -} - -// Adds any new data (in the form of a new FlatBuffer) to an existing -// FlatBuffer. This can be used when any of the above methods are not -// sufficient, in particular for adding new tables and new fields. -// This is potentially slightly less efficient than a FlatBuffer constructed -// in one piece, since the new FlatBuffer doesn't share any vtables with the -// existing one. -// The return value can now be set using Vector::MutateOffset or SetFieldT -// below. -const uint8_t *AddFlatBuffer(std::vector &flatbuf, - const uint8_t *newbuf, size_t newlen); - -inline bool SetFieldT(Table *table, const reflection::Field &field, - const uint8_t *val) { - FLATBUFFERS_ASSERT(sizeof(uoffset_t) == - GetTypeSize(field.type()->base_type())); - return table->SetPointer(field.offset(), val); -} - -// ------------------------- COPYING ------------------------- - -// Generic copying of tables from a FlatBuffer into a FlatBuffer builder. -// Can be used to do any kind of merging/selecting you may want to do out -// of existing buffers. Also useful to reconstruct a whole buffer if the -// above resizing functionality has introduced garbage in a buffer you want -// to remove. -// Note: this does not deal with DAGs correctly. If the table passed forms a -// DAG, the copy will be a tree instead (with duplicates). Strings can be -// shared however, by passing true for use_string_pooling. - -Offset CopyTable(FlatBufferBuilder &fbb, - const reflection::Schema &schema, - const reflection::Object &objectdef, - const Table &table, - bool use_string_pooling = false); - -// Verifies the provided flatbuffer using reflection. -// root should point to the root type for this flatbuffer. -// buf should point to the start of flatbuffer data. -// length specifies the size of the flatbuffer data. -bool Verify(const reflection::Schema &schema, const reflection::Object &root, - const uint8_t *buf, size_t length); - -} // namespace flatbuffers - -#endif // FLATBUFFERS_REFLECTION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/reflection_generated.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/reflection_generated.h deleted file mode 100644 index e7237ff..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/reflection_generated.h +++ /dev/null @@ -1,1222 +0,0 @@ -// automatically generated by the FlatBuffers compiler, do not modify - - -#ifndef FLATBUFFERS_GENERATED_REFLECTION_REFLECTION_H_ -#define FLATBUFFERS_GENERATED_REFLECTION_REFLECTION_H_ - -#include "flatbuffers/flatbuffers.h" - -namespace reflection { - -struct Type; -struct TypeBuilder; - -struct KeyValue; -struct KeyValueBuilder; - -struct EnumVal; -struct EnumValBuilder; - -struct Enum; -struct EnumBuilder; - -struct Field; -struct FieldBuilder; - -struct Object; -struct ObjectBuilder; - -struct RPCCall; -struct RPCCallBuilder; - -struct Service; -struct ServiceBuilder; - -struct Schema; -struct SchemaBuilder; - -enum BaseType { - None = 0, - UType = 1, - Bool = 2, - Byte = 3, - UByte = 4, - Short = 5, - UShort = 6, - Int = 7, - UInt = 8, - Long = 9, - ULong = 10, - Float = 11, - Double = 12, - String = 13, - Vector = 14, - Obj = 15, - Union = 16, - Array = 17 -}; - -inline const BaseType (&EnumValuesBaseType())[18] { - static const BaseType values[] = { - None, - UType, - Bool, - Byte, - UByte, - Short, - UShort, - Int, - UInt, - Long, - ULong, - Float, - Double, - String, - Vector, - Obj, - Union, - Array - }; - return values; -} - -inline const char * const *EnumNamesBaseType() { - static const char * const names[19] = { - "None", - "UType", - "Bool", - "Byte", - "UByte", - "Short", - "UShort", - "Int", - "UInt", - "Long", - "ULong", - "Float", - "Double", - "String", - "Vector", - "Obj", - "Union", - "Array", - nullptr - }; - return names; -} - -inline const char *EnumNameBaseType(BaseType e) { - if (flatbuffers::IsOutRange(e, None, Array)) return ""; - const size_t index = static_cast(e); - return EnumNamesBaseType()[index]; -} - -struct Type FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef TypeBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_BASE_TYPE = 4, - VT_ELEMENT = 6, - VT_INDEX = 8, - VT_FIXED_LENGTH = 10 - }; - reflection::BaseType base_type() const { - return static_cast(GetField(VT_BASE_TYPE, 0)); - } - reflection::BaseType element() const { - return static_cast(GetField(VT_ELEMENT, 0)); - } - int32_t index() const { - return GetField(VT_INDEX, -1); - } - uint16_t fixed_length() const { - return GetField(VT_FIXED_LENGTH, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_BASE_TYPE) && - VerifyField(verifier, VT_ELEMENT) && - VerifyField(verifier, VT_INDEX) && - VerifyField(verifier, VT_FIXED_LENGTH) && - verifier.EndTable(); - } -}; - -struct TypeBuilder { - typedef Type Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_base_type(reflection::BaseType base_type) { - fbb_.AddElement(Type::VT_BASE_TYPE, static_cast(base_type), 0); - } - void add_element(reflection::BaseType element) { - fbb_.AddElement(Type::VT_ELEMENT, static_cast(element), 0); - } - void add_index(int32_t index) { - fbb_.AddElement(Type::VT_INDEX, index, -1); - } - void add_fixed_length(uint16_t fixed_length) { - fbb_.AddElement(Type::VT_FIXED_LENGTH, fixed_length, 0); - } - explicit TypeBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TypeBuilder &operator=(const TypeBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateType( - flatbuffers::FlatBufferBuilder &_fbb, - reflection::BaseType base_type = reflection::None, - reflection::BaseType element = reflection::None, - int32_t index = -1, - uint16_t fixed_length = 0) { - TypeBuilder builder_(_fbb); - builder_.add_index(index); - builder_.add_fixed_length(fixed_length); - builder_.add_element(element); - builder_.add_base_type(base_type); - return builder_.Finish(); -} - -struct KeyValue FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef KeyValueBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_KEY = 4, - VT_VALUE = 6 - }; - const flatbuffers::String *key() const { - return GetPointer(VT_KEY); - } - bool KeyCompareLessThan(const KeyValue *o) const { - return *key() < *o->key(); - } - int KeyCompareWithValue(const char *val) const { - return strcmp(key()->c_str(), val); - } - const flatbuffers::String *value() const { - return GetPointer(VT_VALUE); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffsetRequired(verifier, VT_KEY) && - verifier.VerifyString(key()) && - VerifyOffset(verifier, VT_VALUE) && - verifier.VerifyString(value()) && - verifier.EndTable(); - } -}; - -struct KeyValueBuilder { - typedef KeyValue Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_key(flatbuffers::Offset key) { - fbb_.AddOffset(KeyValue::VT_KEY, key); - } - void add_value(flatbuffers::Offset value) { - fbb_.AddOffset(KeyValue::VT_VALUE, value); - } - explicit KeyValueBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - KeyValueBuilder &operator=(const KeyValueBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - fbb_.Required(o, KeyValue::VT_KEY); - return o; - } -}; - -inline flatbuffers::Offset CreateKeyValue( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset key = 0, - flatbuffers::Offset value = 0) { - KeyValueBuilder builder_(_fbb); - builder_.add_value(value); - builder_.add_key(key); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateKeyValueDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *key = nullptr, - const char *value = nullptr) { - auto key__ = key ? _fbb.CreateString(key) : 0; - auto value__ = value ? _fbb.CreateString(value) : 0; - return reflection::CreateKeyValue( - _fbb, - key__, - value__); -} - -struct EnumVal FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef EnumValBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NAME = 4, - VT_VALUE = 6, - VT_OBJECT = 8, - VT_UNION_TYPE = 10, - VT_DOCUMENTATION = 12 - }; - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); - } - int64_t value() const { - return GetField(VT_VALUE, 0); - } - bool KeyCompareLessThan(const EnumVal *o) const { - return value() < o->value(); - } - int KeyCompareWithValue(int64_t val) const { - return static_cast(value() > val) - static_cast(value() < val); - } - const reflection::Object *object() const { - return GetPointer(VT_OBJECT); - } - const reflection::Type *union_type() const { - return GetPointer(VT_UNION_TYPE); - } - const flatbuffers::Vector> *documentation() const { - return GetPointer> *>(VT_DOCUMENTATION); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffsetRequired(verifier, VT_NAME) && - verifier.VerifyString(name()) && - VerifyField(verifier, VT_VALUE) && - VerifyOffset(verifier, VT_OBJECT) && - verifier.VerifyTable(object()) && - VerifyOffset(verifier, VT_UNION_TYPE) && - verifier.VerifyTable(union_type()) && - VerifyOffset(verifier, VT_DOCUMENTATION) && - verifier.VerifyVector(documentation()) && - verifier.VerifyVectorOfStrings(documentation()) && - verifier.EndTable(); - } -}; - -struct EnumValBuilder { - typedef EnumVal Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_name(flatbuffers::Offset name) { - fbb_.AddOffset(EnumVal::VT_NAME, name); - } - void add_value(int64_t value) { - fbb_.AddElement(EnumVal::VT_VALUE, value, 0); - } - void add_object(flatbuffers::Offset object) { - fbb_.AddOffset(EnumVal::VT_OBJECT, object); - } - void add_union_type(flatbuffers::Offset union_type) { - fbb_.AddOffset(EnumVal::VT_UNION_TYPE, union_type); - } - void add_documentation(flatbuffers::Offset>> documentation) { - fbb_.AddOffset(EnumVal::VT_DOCUMENTATION, documentation); - } - explicit EnumValBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - EnumValBuilder &operator=(const EnumValBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - fbb_.Required(o, EnumVal::VT_NAME); - return o; - } -}; - -inline flatbuffers::Offset CreateEnumVal( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset name = 0, - int64_t value = 0, - flatbuffers::Offset object = 0, - flatbuffers::Offset union_type = 0, - flatbuffers::Offset>> documentation = 0) { - EnumValBuilder builder_(_fbb); - builder_.add_value(value); - builder_.add_documentation(documentation); - builder_.add_union_type(union_type); - builder_.add_object(object); - builder_.add_name(name); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateEnumValDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *name = nullptr, - int64_t value = 0, - flatbuffers::Offset object = 0, - flatbuffers::Offset union_type = 0, - const std::vector> *documentation = nullptr) { - auto name__ = name ? _fbb.CreateString(name) : 0; - auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; - return reflection::CreateEnumVal( - _fbb, - name__, - value, - object, - union_type, - documentation__); -} - -struct Enum FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef EnumBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NAME = 4, - VT_VALUES = 6, - VT_IS_UNION = 8, - VT_UNDERLYING_TYPE = 10, - VT_ATTRIBUTES = 12, - VT_DOCUMENTATION = 14 - }; - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); - } - bool KeyCompareLessThan(const Enum *o) const { - return *name() < *o->name(); - } - int KeyCompareWithValue(const char *val) const { - return strcmp(name()->c_str(), val); - } - const flatbuffers::Vector> *values() const { - return GetPointer> *>(VT_VALUES); - } - bool is_union() const { - return GetField(VT_IS_UNION, 0) != 0; - } - const reflection::Type *underlying_type() const { - return GetPointer(VT_UNDERLYING_TYPE); - } - const flatbuffers::Vector> *attributes() const { - return GetPointer> *>(VT_ATTRIBUTES); - } - const flatbuffers::Vector> *documentation() const { - return GetPointer> *>(VT_DOCUMENTATION); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffsetRequired(verifier, VT_NAME) && - verifier.VerifyString(name()) && - VerifyOffsetRequired(verifier, VT_VALUES) && - verifier.VerifyVector(values()) && - verifier.VerifyVectorOfTables(values()) && - VerifyField(verifier, VT_IS_UNION) && - VerifyOffsetRequired(verifier, VT_UNDERLYING_TYPE) && - verifier.VerifyTable(underlying_type()) && - VerifyOffset(verifier, VT_ATTRIBUTES) && - verifier.VerifyVector(attributes()) && - verifier.VerifyVectorOfTables(attributes()) && - VerifyOffset(verifier, VT_DOCUMENTATION) && - verifier.VerifyVector(documentation()) && - verifier.VerifyVectorOfStrings(documentation()) && - verifier.EndTable(); - } -}; - -struct EnumBuilder { - typedef Enum Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_name(flatbuffers::Offset name) { - fbb_.AddOffset(Enum::VT_NAME, name); - } - void add_values(flatbuffers::Offset>> values) { - fbb_.AddOffset(Enum::VT_VALUES, values); - } - void add_is_union(bool is_union) { - fbb_.AddElement(Enum::VT_IS_UNION, static_cast(is_union), 0); - } - void add_underlying_type(flatbuffers::Offset underlying_type) { - fbb_.AddOffset(Enum::VT_UNDERLYING_TYPE, underlying_type); - } - void add_attributes(flatbuffers::Offset>> attributes) { - fbb_.AddOffset(Enum::VT_ATTRIBUTES, attributes); - } - void add_documentation(flatbuffers::Offset>> documentation) { - fbb_.AddOffset(Enum::VT_DOCUMENTATION, documentation); - } - explicit EnumBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - EnumBuilder &operator=(const EnumBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - fbb_.Required(o, Enum::VT_NAME); - fbb_.Required(o, Enum::VT_VALUES); - fbb_.Required(o, Enum::VT_UNDERLYING_TYPE); - return o; - } -}; - -inline flatbuffers::Offset CreateEnum( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset name = 0, - flatbuffers::Offset>> values = 0, - bool is_union = false, - flatbuffers::Offset underlying_type = 0, - flatbuffers::Offset>> attributes = 0, - flatbuffers::Offset>> documentation = 0) { - EnumBuilder builder_(_fbb); - builder_.add_documentation(documentation); - builder_.add_attributes(attributes); - builder_.add_underlying_type(underlying_type); - builder_.add_values(values); - builder_.add_name(name); - builder_.add_is_union(is_union); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateEnumDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *name = nullptr, - std::vector> *values = nullptr, - bool is_union = false, - flatbuffers::Offset underlying_type = 0, - std::vector> *attributes = nullptr, - const std::vector> *documentation = nullptr) { - auto name__ = name ? _fbb.CreateString(name) : 0; - auto values__ = values ? _fbb.CreateVectorOfSortedTables(values) : 0; - auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables(attributes) : 0; - auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; - return reflection::CreateEnum( - _fbb, - name__, - values__, - is_union, - underlying_type, - attributes__, - documentation__); -} - -struct Field FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef FieldBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NAME = 4, - VT_TYPE = 6, - VT_ID = 8, - VT_OFFSET = 10, - VT_DEFAULT_INTEGER = 12, - VT_DEFAULT_REAL = 14, - VT_DEPRECATED = 16, - VT_REQUIRED = 18, - VT_KEY = 20, - VT_ATTRIBUTES = 22, - VT_DOCUMENTATION = 24 - }; - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); - } - bool KeyCompareLessThan(const Field *o) const { - return *name() < *o->name(); - } - int KeyCompareWithValue(const char *val) const { - return strcmp(name()->c_str(), val); - } - const reflection::Type *type() const { - return GetPointer(VT_TYPE); - } - uint16_t id() const { - return GetField(VT_ID, 0); - } - uint16_t offset() const { - return GetField(VT_OFFSET, 0); - } - int64_t default_integer() const { - return GetField(VT_DEFAULT_INTEGER, 0); - } - double default_real() const { - return GetField(VT_DEFAULT_REAL, 0.0); - } - bool deprecated() const { - return GetField(VT_DEPRECATED, 0) != 0; - } - bool required() const { - return GetField(VT_REQUIRED, 0) != 0; - } - bool key() const { - return GetField(VT_KEY, 0) != 0; - } - const flatbuffers::Vector> *attributes() const { - return GetPointer> *>(VT_ATTRIBUTES); - } - const flatbuffers::Vector> *documentation() const { - return GetPointer> *>(VT_DOCUMENTATION); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffsetRequired(verifier, VT_NAME) && - verifier.VerifyString(name()) && - VerifyOffsetRequired(verifier, VT_TYPE) && - verifier.VerifyTable(type()) && - VerifyField(verifier, VT_ID) && - VerifyField(verifier, VT_OFFSET) && - VerifyField(verifier, VT_DEFAULT_INTEGER) && - VerifyField(verifier, VT_DEFAULT_REAL) && - VerifyField(verifier, VT_DEPRECATED) && - VerifyField(verifier, VT_REQUIRED) && - VerifyField(verifier, VT_KEY) && - VerifyOffset(verifier, VT_ATTRIBUTES) && - verifier.VerifyVector(attributes()) && - verifier.VerifyVectorOfTables(attributes()) && - VerifyOffset(verifier, VT_DOCUMENTATION) && - verifier.VerifyVector(documentation()) && - verifier.VerifyVectorOfStrings(documentation()) && - verifier.EndTable(); - } -}; - -struct FieldBuilder { - typedef Field Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_name(flatbuffers::Offset name) { - fbb_.AddOffset(Field::VT_NAME, name); - } - void add_type(flatbuffers::Offset type) { - fbb_.AddOffset(Field::VT_TYPE, type); - } - void add_id(uint16_t id) { - fbb_.AddElement(Field::VT_ID, id, 0); - } - void add_offset(uint16_t offset) { - fbb_.AddElement(Field::VT_OFFSET, offset, 0); - } - void add_default_integer(int64_t default_integer) { - fbb_.AddElement(Field::VT_DEFAULT_INTEGER, default_integer, 0); - } - void add_default_real(double default_real) { - fbb_.AddElement(Field::VT_DEFAULT_REAL, default_real, 0.0); - } - void add_deprecated(bool deprecated) { - fbb_.AddElement(Field::VT_DEPRECATED, static_cast(deprecated), 0); - } - void add_required(bool required) { - fbb_.AddElement(Field::VT_REQUIRED, static_cast(required), 0); - } - void add_key(bool key) { - fbb_.AddElement(Field::VT_KEY, static_cast(key), 0); - } - void add_attributes(flatbuffers::Offset>> attributes) { - fbb_.AddOffset(Field::VT_ATTRIBUTES, attributes); - } - void add_documentation(flatbuffers::Offset>> documentation) { - fbb_.AddOffset(Field::VT_DOCUMENTATION, documentation); - } - explicit FieldBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - FieldBuilder &operator=(const FieldBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - fbb_.Required(o, Field::VT_NAME); - fbb_.Required(o, Field::VT_TYPE); - return o; - } -}; - -inline flatbuffers::Offset CreateField( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset name = 0, - flatbuffers::Offset type = 0, - uint16_t id = 0, - uint16_t offset = 0, - int64_t default_integer = 0, - double default_real = 0.0, - bool deprecated = false, - bool required = false, - bool key = false, - flatbuffers::Offset>> attributes = 0, - flatbuffers::Offset>> documentation = 0) { - FieldBuilder builder_(_fbb); - builder_.add_default_real(default_real); - builder_.add_default_integer(default_integer); - builder_.add_documentation(documentation); - builder_.add_attributes(attributes); - builder_.add_type(type); - builder_.add_name(name); - builder_.add_offset(offset); - builder_.add_id(id); - builder_.add_key(key); - builder_.add_required(required); - builder_.add_deprecated(deprecated); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateFieldDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *name = nullptr, - flatbuffers::Offset type = 0, - uint16_t id = 0, - uint16_t offset = 0, - int64_t default_integer = 0, - double default_real = 0.0, - bool deprecated = false, - bool required = false, - bool key = false, - std::vector> *attributes = nullptr, - const std::vector> *documentation = nullptr) { - auto name__ = name ? _fbb.CreateString(name) : 0; - auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables(attributes) : 0; - auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; - return reflection::CreateField( - _fbb, - name__, - type, - id, - offset, - default_integer, - default_real, - deprecated, - required, - key, - attributes__, - documentation__); -} - -struct Object FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ObjectBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NAME = 4, - VT_FIELDS = 6, - VT_IS_STRUCT = 8, - VT_MINALIGN = 10, - VT_BYTESIZE = 12, - VT_ATTRIBUTES = 14, - VT_DOCUMENTATION = 16 - }; - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); - } - bool KeyCompareLessThan(const Object *o) const { - return *name() < *o->name(); - } - int KeyCompareWithValue(const char *val) const { - return strcmp(name()->c_str(), val); - } - const flatbuffers::Vector> *fields() const { - return GetPointer> *>(VT_FIELDS); - } - bool is_struct() const { - return GetField(VT_IS_STRUCT, 0) != 0; - } - int32_t minalign() const { - return GetField(VT_MINALIGN, 0); - } - int32_t bytesize() const { - return GetField(VT_BYTESIZE, 0); - } - const flatbuffers::Vector> *attributes() const { - return GetPointer> *>(VT_ATTRIBUTES); - } - const flatbuffers::Vector> *documentation() const { - return GetPointer> *>(VT_DOCUMENTATION); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffsetRequired(verifier, VT_NAME) && - verifier.VerifyString(name()) && - VerifyOffsetRequired(verifier, VT_FIELDS) && - verifier.VerifyVector(fields()) && - verifier.VerifyVectorOfTables(fields()) && - VerifyField(verifier, VT_IS_STRUCT) && - VerifyField(verifier, VT_MINALIGN) && - VerifyField(verifier, VT_BYTESIZE) && - VerifyOffset(verifier, VT_ATTRIBUTES) && - verifier.VerifyVector(attributes()) && - verifier.VerifyVectorOfTables(attributes()) && - VerifyOffset(verifier, VT_DOCUMENTATION) && - verifier.VerifyVector(documentation()) && - verifier.VerifyVectorOfStrings(documentation()) && - verifier.EndTable(); - } -}; - -struct ObjectBuilder { - typedef Object Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_name(flatbuffers::Offset name) { - fbb_.AddOffset(Object::VT_NAME, name); - } - void add_fields(flatbuffers::Offset>> fields) { - fbb_.AddOffset(Object::VT_FIELDS, fields); - } - void add_is_struct(bool is_struct) { - fbb_.AddElement(Object::VT_IS_STRUCT, static_cast(is_struct), 0); - } - void add_minalign(int32_t minalign) { - fbb_.AddElement(Object::VT_MINALIGN, minalign, 0); - } - void add_bytesize(int32_t bytesize) { - fbb_.AddElement(Object::VT_BYTESIZE, bytesize, 0); - } - void add_attributes(flatbuffers::Offset>> attributes) { - fbb_.AddOffset(Object::VT_ATTRIBUTES, attributes); - } - void add_documentation(flatbuffers::Offset>> documentation) { - fbb_.AddOffset(Object::VT_DOCUMENTATION, documentation); - } - explicit ObjectBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ObjectBuilder &operator=(const ObjectBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - fbb_.Required(o, Object::VT_NAME); - fbb_.Required(o, Object::VT_FIELDS); - return o; - } -}; - -inline flatbuffers::Offset CreateObject( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset name = 0, - flatbuffers::Offset>> fields = 0, - bool is_struct = false, - int32_t minalign = 0, - int32_t bytesize = 0, - flatbuffers::Offset>> attributes = 0, - flatbuffers::Offset>> documentation = 0) { - ObjectBuilder builder_(_fbb); - builder_.add_documentation(documentation); - builder_.add_attributes(attributes); - builder_.add_bytesize(bytesize); - builder_.add_minalign(minalign); - builder_.add_fields(fields); - builder_.add_name(name); - builder_.add_is_struct(is_struct); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateObjectDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *name = nullptr, - std::vector> *fields = nullptr, - bool is_struct = false, - int32_t minalign = 0, - int32_t bytesize = 0, - std::vector> *attributes = nullptr, - const std::vector> *documentation = nullptr) { - auto name__ = name ? _fbb.CreateString(name) : 0; - auto fields__ = fields ? _fbb.CreateVectorOfSortedTables(fields) : 0; - auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables(attributes) : 0; - auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; - return reflection::CreateObject( - _fbb, - name__, - fields__, - is_struct, - minalign, - bytesize, - attributes__, - documentation__); -} - -struct RPCCall FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef RPCCallBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NAME = 4, - VT_REQUEST = 6, - VT_RESPONSE = 8, - VT_ATTRIBUTES = 10, - VT_DOCUMENTATION = 12 - }; - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); - } - bool KeyCompareLessThan(const RPCCall *o) const { - return *name() < *o->name(); - } - int KeyCompareWithValue(const char *val) const { - return strcmp(name()->c_str(), val); - } - const reflection::Object *request() const { - return GetPointer(VT_REQUEST); - } - const reflection::Object *response() const { - return GetPointer(VT_RESPONSE); - } - const flatbuffers::Vector> *attributes() const { - return GetPointer> *>(VT_ATTRIBUTES); - } - const flatbuffers::Vector> *documentation() const { - return GetPointer> *>(VT_DOCUMENTATION); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffsetRequired(verifier, VT_NAME) && - verifier.VerifyString(name()) && - VerifyOffsetRequired(verifier, VT_REQUEST) && - verifier.VerifyTable(request()) && - VerifyOffsetRequired(verifier, VT_RESPONSE) && - verifier.VerifyTable(response()) && - VerifyOffset(verifier, VT_ATTRIBUTES) && - verifier.VerifyVector(attributes()) && - verifier.VerifyVectorOfTables(attributes()) && - VerifyOffset(verifier, VT_DOCUMENTATION) && - verifier.VerifyVector(documentation()) && - verifier.VerifyVectorOfStrings(documentation()) && - verifier.EndTable(); - } -}; - -struct RPCCallBuilder { - typedef RPCCall Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_name(flatbuffers::Offset name) { - fbb_.AddOffset(RPCCall::VT_NAME, name); - } - void add_request(flatbuffers::Offset request) { - fbb_.AddOffset(RPCCall::VT_REQUEST, request); - } - void add_response(flatbuffers::Offset response) { - fbb_.AddOffset(RPCCall::VT_RESPONSE, response); - } - void add_attributes(flatbuffers::Offset>> attributes) { - fbb_.AddOffset(RPCCall::VT_ATTRIBUTES, attributes); - } - void add_documentation(flatbuffers::Offset>> documentation) { - fbb_.AddOffset(RPCCall::VT_DOCUMENTATION, documentation); - } - explicit RPCCallBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - RPCCallBuilder &operator=(const RPCCallBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - fbb_.Required(o, RPCCall::VT_NAME); - fbb_.Required(o, RPCCall::VT_REQUEST); - fbb_.Required(o, RPCCall::VT_RESPONSE); - return o; - } -}; - -inline flatbuffers::Offset CreateRPCCall( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset name = 0, - flatbuffers::Offset request = 0, - flatbuffers::Offset response = 0, - flatbuffers::Offset>> attributes = 0, - flatbuffers::Offset>> documentation = 0) { - RPCCallBuilder builder_(_fbb); - builder_.add_documentation(documentation); - builder_.add_attributes(attributes); - builder_.add_response(response); - builder_.add_request(request); - builder_.add_name(name); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateRPCCallDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *name = nullptr, - flatbuffers::Offset request = 0, - flatbuffers::Offset response = 0, - std::vector> *attributes = nullptr, - const std::vector> *documentation = nullptr) { - auto name__ = name ? _fbb.CreateString(name) : 0; - auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables(attributes) : 0; - auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; - return reflection::CreateRPCCall( - _fbb, - name__, - request, - response, - attributes__, - documentation__); -} - -struct Service FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ServiceBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NAME = 4, - VT_CALLS = 6, - VT_ATTRIBUTES = 8, - VT_DOCUMENTATION = 10 - }; - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); - } - bool KeyCompareLessThan(const Service *o) const { - return *name() < *o->name(); - } - int KeyCompareWithValue(const char *val) const { - return strcmp(name()->c_str(), val); - } - const flatbuffers::Vector> *calls() const { - return GetPointer> *>(VT_CALLS); - } - const flatbuffers::Vector> *attributes() const { - return GetPointer> *>(VT_ATTRIBUTES); - } - const flatbuffers::Vector> *documentation() const { - return GetPointer> *>(VT_DOCUMENTATION); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffsetRequired(verifier, VT_NAME) && - verifier.VerifyString(name()) && - VerifyOffset(verifier, VT_CALLS) && - verifier.VerifyVector(calls()) && - verifier.VerifyVectorOfTables(calls()) && - VerifyOffset(verifier, VT_ATTRIBUTES) && - verifier.VerifyVector(attributes()) && - verifier.VerifyVectorOfTables(attributes()) && - VerifyOffset(verifier, VT_DOCUMENTATION) && - verifier.VerifyVector(documentation()) && - verifier.VerifyVectorOfStrings(documentation()) && - verifier.EndTable(); - } -}; - -struct ServiceBuilder { - typedef Service Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_name(flatbuffers::Offset name) { - fbb_.AddOffset(Service::VT_NAME, name); - } - void add_calls(flatbuffers::Offset>> calls) { - fbb_.AddOffset(Service::VT_CALLS, calls); - } - void add_attributes(flatbuffers::Offset>> attributes) { - fbb_.AddOffset(Service::VT_ATTRIBUTES, attributes); - } - void add_documentation(flatbuffers::Offset>> documentation) { - fbb_.AddOffset(Service::VT_DOCUMENTATION, documentation); - } - explicit ServiceBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ServiceBuilder &operator=(const ServiceBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - fbb_.Required(o, Service::VT_NAME); - return o; - } -}; - -inline flatbuffers::Offset CreateService( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset name = 0, - flatbuffers::Offset>> calls = 0, - flatbuffers::Offset>> attributes = 0, - flatbuffers::Offset>> documentation = 0) { - ServiceBuilder builder_(_fbb); - builder_.add_documentation(documentation); - builder_.add_attributes(attributes); - builder_.add_calls(calls); - builder_.add_name(name); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateServiceDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *name = nullptr, - std::vector> *calls = nullptr, - std::vector> *attributes = nullptr, - const std::vector> *documentation = nullptr) { - auto name__ = name ? _fbb.CreateString(name) : 0; - auto calls__ = calls ? _fbb.CreateVectorOfSortedTables(calls) : 0; - auto attributes__ = attributes ? _fbb.CreateVectorOfSortedTables(attributes) : 0; - auto documentation__ = documentation ? _fbb.CreateVector>(*documentation) : 0; - return reflection::CreateService( - _fbb, - name__, - calls__, - attributes__, - documentation__); -} - -struct Schema FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SchemaBuilder Builder; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_OBJECTS = 4, - VT_ENUMS = 6, - VT_FILE_IDENT = 8, - VT_FILE_EXT = 10, - VT_ROOT_TABLE = 12, - VT_SERVICES = 14 - }; - const flatbuffers::Vector> *objects() const { - return GetPointer> *>(VT_OBJECTS); - } - const flatbuffers::Vector> *enums() const { - return GetPointer> *>(VT_ENUMS); - } - const flatbuffers::String *file_ident() const { - return GetPointer(VT_FILE_IDENT); - } - const flatbuffers::String *file_ext() const { - return GetPointer(VT_FILE_EXT); - } - const reflection::Object *root_table() const { - return GetPointer(VT_ROOT_TABLE); - } - const flatbuffers::Vector> *services() const { - return GetPointer> *>(VT_SERVICES); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffsetRequired(verifier, VT_OBJECTS) && - verifier.VerifyVector(objects()) && - verifier.VerifyVectorOfTables(objects()) && - VerifyOffsetRequired(verifier, VT_ENUMS) && - verifier.VerifyVector(enums()) && - verifier.VerifyVectorOfTables(enums()) && - VerifyOffset(verifier, VT_FILE_IDENT) && - verifier.VerifyString(file_ident()) && - VerifyOffset(verifier, VT_FILE_EXT) && - verifier.VerifyString(file_ext()) && - VerifyOffset(verifier, VT_ROOT_TABLE) && - verifier.VerifyTable(root_table()) && - VerifyOffset(verifier, VT_SERVICES) && - verifier.VerifyVector(services()) && - verifier.VerifyVectorOfTables(services()) && - verifier.EndTable(); - } -}; - -struct SchemaBuilder { - typedef Schema Table; - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_objects(flatbuffers::Offset>> objects) { - fbb_.AddOffset(Schema::VT_OBJECTS, objects); - } - void add_enums(flatbuffers::Offset>> enums) { - fbb_.AddOffset(Schema::VT_ENUMS, enums); - } - void add_file_ident(flatbuffers::Offset file_ident) { - fbb_.AddOffset(Schema::VT_FILE_IDENT, file_ident); - } - void add_file_ext(flatbuffers::Offset file_ext) { - fbb_.AddOffset(Schema::VT_FILE_EXT, file_ext); - } - void add_root_table(flatbuffers::Offset root_table) { - fbb_.AddOffset(Schema::VT_ROOT_TABLE, root_table); - } - void add_services(flatbuffers::Offset>> services) { - fbb_.AddOffset(Schema::VT_SERVICES, services); - } - explicit SchemaBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SchemaBuilder &operator=(const SchemaBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - fbb_.Required(o, Schema::VT_OBJECTS); - fbb_.Required(o, Schema::VT_ENUMS); - return o; - } -}; - -inline flatbuffers::Offset CreateSchema( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset>> objects = 0, - flatbuffers::Offset>> enums = 0, - flatbuffers::Offset file_ident = 0, - flatbuffers::Offset file_ext = 0, - flatbuffers::Offset root_table = 0, - flatbuffers::Offset>> services = 0) { - SchemaBuilder builder_(_fbb); - builder_.add_services(services); - builder_.add_root_table(root_table); - builder_.add_file_ext(file_ext); - builder_.add_file_ident(file_ident); - builder_.add_enums(enums); - builder_.add_objects(objects); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateSchemaDirect( - flatbuffers::FlatBufferBuilder &_fbb, - std::vector> *objects = nullptr, - std::vector> *enums = nullptr, - const char *file_ident = nullptr, - const char *file_ext = nullptr, - flatbuffers::Offset root_table = 0, - std::vector> *services = nullptr) { - auto objects__ = objects ? _fbb.CreateVectorOfSortedTables(objects) : 0; - auto enums__ = enums ? _fbb.CreateVectorOfSortedTables(enums) : 0; - auto file_ident__ = file_ident ? _fbb.CreateString(file_ident) : 0; - auto file_ext__ = file_ext ? _fbb.CreateString(file_ext) : 0; - auto services__ = services ? _fbb.CreateVectorOfSortedTables(services) : 0; - return reflection::CreateSchema( - _fbb, - objects__, - enums__, - file_ident__, - file_ext__, - root_table, - services__); -} - -inline const reflection::Schema *GetSchema(const void *buf) { - return flatbuffers::GetRoot(buf); -} - -inline const reflection::Schema *GetSizePrefixedSchema(const void *buf) { - return flatbuffers::GetSizePrefixedRoot(buf); -} - -inline const char *SchemaIdentifier() { - return "BFBS"; -} - -inline bool SchemaBufferHasIdentifier(const void *buf) { - return flatbuffers::BufferHasIdentifier( - buf, SchemaIdentifier()); -} - -inline bool VerifySchemaBuffer( - flatbuffers::Verifier &verifier) { - return verifier.VerifyBuffer(SchemaIdentifier()); -} - -inline bool VerifySizePrefixedSchemaBuffer( - flatbuffers::Verifier &verifier) { - return verifier.VerifySizePrefixedBuffer(SchemaIdentifier()); -} - -inline const char *SchemaExtension() { - return "bfbs"; -} - -inline void FinishSchemaBuffer( - flatbuffers::FlatBufferBuilder &fbb, - flatbuffers::Offset root) { - fbb.Finish(root, SchemaIdentifier()); -} - -inline void FinishSizePrefixedSchemaBuffer( - flatbuffers::FlatBufferBuilder &fbb, - flatbuffers::Offset root) { - fbb.FinishSizePrefixed(root, SchemaIdentifier()); -} - -} // namespace reflection - -#endif // FLATBUFFERS_GENERATED_REFLECTION_REFLECTION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/registry.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/registry.h deleted file mode 100644 index 9ea425b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/registry.h +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright 2017 Google Inc. 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 FLATBUFFERS_REGISTRY_H_ -#define FLATBUFFERS_REGISTRY_H_ - -#include "flatbuffers/idl.h" - -namespace flatbuffers { - -// Convenience class to easily parse or generate text for arbitrary FlatBuffers. -// Simply pre-populate it with all schema filenames that may be in use, and -// This class will look them up using the file_identifier declared in the -// schema. -class Registry { - public: - // Call this for all schemas that may be in use. The identifier has - // a function in the generated code, e.g. MonsterIdentifier(). - void Register(const char *file_identifier, const char *schema_path) { - Schema schema; - schema.path_ = schema_path; - schemas_[file_identifier] = schema; - } - - // Generate text from an arbitrary FlatBuffer by looking up its - // file_identifier in the registry. - bool FlatBufferToText(const uint8_t *flatbuf, size_t len, std::string *dest) { - // Get the identifier out of the buffer. - // If the buffer is truncated, exit. - if (len < sizeof(uoffset_t) + FlatBufferBuilder::kFileIdentifierLength) { - lasterror_ = "buffer truncated"; - return false; - } - std::string ident( - reinterpret_cast(flatbuf) + sizeof(uoffset_t), - FlatBufferBuilder::kFileIdentifierLength); - // Load and parse the schema. - Parser parser; - if (!LoadSchema(ident, &parser)) return false; - // Now we're ready to generate text. - if (!GenerateText(parser, flatbuf, dest)) { - lasterror_ = "unable to generate text for FlatBuffer binary"; - return false; - } - return true; - } - - // Converts a binary buffer to text using one of the schemas in the registry, - // use the file_identifier to indicate which. - // If DetachedBuffer::data() is null then parsing failed. - DetachedBuffer TextToFlatBuffer(const char *text, - const char *file_identifier) { - // Load and parse the schema. - Parser parser; - if (!LoadSchema(file_identifier, &parser)) return DetachedBuffer(); - // Parse the text. - if (!parser.Parse(text)) { - lasterror_ = parser.error_; - return DetachedBuffer(); - } - // We have a valid FlatBuffer. Detach it from the builder and return. - return parser.builder_.Release(); - } - - // Modify any parsing / output options used by the other functions. - void SetOptions(const IDLOptions &opts) { opts_ = opts; } - - // If schemas used contain include statements, call this function for every - // directory the parser should search them for. - void AddIncludeDirectory(const char *path) { include_paths_.push_back(path); } - - // Returns a human readable error if any of the above functions fail. - const std::string &GetLastError() { return lasterror_; } - - private: - bool LoadSchema(const std::string &ident, Parser *parser) { - // Find the schema, if not, exit. - auto it = schemas_.find(ident); - if (it == schemas_.end()) { - // Don't attach the identifier, since it may not be human readable. - lasterror_ = "identifier for this buffer not in the registry"; - return false; - } - auto &schema = it->second; - // Load the schema from disk. If not, exit. - std::string schematext; - if (!LoadFile(schema.path_.c_str(), false, &schematext)) { - lasterror_ = "could not load schema: " + schema.path_; - return false; - } - // Parse schema. - parser->opts = opts_; - if (!parser->Parse(schematext.c_str(), vector_data(include_paths_), - schema.path_.c_str())) { - lasterror_ = parser->error_; - return false; - } - return true; - } - - struct Schema { - std::string path_; - // TODO(wvo) optionally cache schema file or parsed schema here. - }; - - std::string lasterror_; - IDLOptions opts_; - std::vector include_paths_; - std::map schemas_; -}; - -} // namespace flatbuffers - -#endif // FLATBUFFERS_REGISTRY_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/stl_emulation.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/stl_emulation.h deleted file mode 100644 index 8bae61b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/stl_emulation.h +++ /dev/null @@ -1,307 +0,0 @@ -/* - * Copyright 2017 Google Inc. 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 FLATBUFFERS_STL_EMULATION_H_ -#define FLATBUFFERS_STL_EMULATION_H_ - -// clang-format off - -#include -#include -#include -#include -#include - -#if defined(_STLPORT_VERSION) && !defined(FLATBUFFERS_CPP98_STL) - #define FLATBUFFERS_CPP98_STL -#endif // defined(_STLPORT_VERSION) && !defined(FLATBUFFERS_CPP98_STL) - -#if defined(FLATBUFFERS_CPP98_STL) - #include -#endif // defined(FLATBUFFERS_CPP98_STL) - -// Check if we can use template aliases -// Not possible if Microsoft Compiler before 2012 -// Possible is the language feature __cpp_alias_templates is defined well -// Or possible if the C++ std is C+11 or newer -#if (defined(_MSC_VER) && _MSC_VER > 1700 /* MSVC2012 */) \ - || (defined(__cpp_alias_templates) && __cpp_alias_templates >= 200704) \ - || (defined(__cplusplus) && __cplusplus >= 201103L) - #define FLATBUFFERS_TEMPLATES_ALIASES -#endif - -// This header provides backwards compatibility for C++98 STLs like stlport. -namespace flatbuffers { - -// Retrieve ::back() from a string in a way that is compatible with pre C++11 -// STLs (e.g stlport). -inline char& string_back(std::string &value) { - return value[value.length() - 1]; -} - -inline char string_back(const std::string &value) { - return value[value.length() - 1]; -} - -// Helper method that retrieves ::data() from a vector in a way that is -// compatible with pre C++11 STLs (e.g stlport). -template inline T *vector_data(std::vector &vector) { - // In some debug environments, operator[] does bounds checking, so &vector[0] - // can't be used. - return vector.empty() ? nullptr : &vector[0]; -} - -template inline const T *vector_data( - const std::vector &vector) { - return vector.empty() ? nullptr : &vector[0]; -} - -template -inline void vector_emplace_back(std::vector *vector, V &&data) { - #if defined(FLATBUFFERS_CPP98_STL) - vector->push_back(data); - #else - vector->emplace_back(std::forward(data)); - #endif // defined(FLATBUFFERS_CPP98_STL) -} - -#ifndef FLATBUFFERS_CPP98_STL - #if defined(FLATBUFFERS_TEMPLATES_ALIASES) - template - using numeric_limits = std::numeric_limits; - #else - template class numeric_limits : - public std::numeric_limits {}; - #endif // defined(FLATBUFFERS_TEMPLATES_ALIASES) -#else - template class numeric_limits : - public std::numeric_limits { - public: - // Android NDK fix. - static T lowest() { - return std::numeric_limits::min(); - } - }; - - template <> class numeric_limits : - public std::numeric_limits { - public: - static float lowest() { return -FLT_MAX; } - }; - - template <> class numeric_limits : - public std::numeric_limits { - public: - static double lowest() { return -DBL_MAX; } - }; - - template <> class numeric_limits { - public: - static unsigned long long min() { return 0ULL; } - static unsigned long long max() { return ~0ULL; } - static unsigned long long lowest() { - return numeric_limits::min(); - } - }; - - template <> class numeric_limits { - public: - static long long min() { - return static_cast(1ULL << ((sizeof(long long) << 3) - 1)); - } - static long long max() { - return static_cast( - (1ULL << ((sizeof(long long) << 3) - 1)) - 1); - } - static long long lowest() { - return numeric_limits::min(); - } - }; -#endif // FLATBUFFERS_CPP98_STL - -#if defined(FLATBUFFERS_TEMPLATES_ALIASES) - #ifndef FLATBUFFERS_CPP98_STL - template using is_scalar = std::is_scalar; - template using is_same = std::is_same; - template using is_floating_point = std::is_floating_point; - template using is_unsigned = std::is_unsigned; - template using is_enum = std::is_enum; - template using make_unsigned = std::make_unsigned; - template - using conditional = std::conditional; - template - using integral_constant = std::integral_constant; - #else - // Map C++ TR1 templates defined by stlport. - template using is_scalar = std::tr1::is_scalar; - template using is_same = std::tr1::is_same; - template using is_floating_point = - std::tr1::is_floating_point; - template using is_unsigned = std::tr1::is_unsigned; - template using is_enum = std::tr1::is_enum; - // Android NDK doesn't have std::make_unsigned or std::tr1::make_unsigned. - template struct make_unsigned { - static_assert(is_unsigned::value, "Specialization not implemented!"); - using type = T; - }; - template<> struct make_unsigned { using type = unsigned char; }; - template<> struct make_unsigned { using type = unsigned short; }; - template<> struct make_unsigned { using type = unsigned int; }; - template<> struct make_unsigned { using type = unsigned long; }; - template<> - struct make_unsigned { using type = unsigned long long; }; - template - using conditional = std::tr1::conditional; - template - using integral_constant = std::tr1::integral_constant; - #endif // !FLATBUFFERS_CPP98_STL -#else - // MSVC 2010 doesn't support C++11 aliases. - template struct is_scalar : public std::is_scalar {}; - template struct is_same : public std::is_same {}; - template struct is_floating_point : - public std::is_floating_point {}; - template struct is_unsigned : public std::is_unsigned {}; - template struct is_enum : public std::is_enum {}; - template struct make_unsigned : public std::make_unsigned {}; - template - struct conditional : public std::conditional {}; - template - struct integral_constant : public std::integral_constant {}; -#endif // defined(FLATBUFFERS_TEMPLATES_ALIASES) - -#ifndef FLATBUFFERS_CPP98_STL - #if defined(FLATBUFFERS_TEMPLATES_ALIASES) - template using unique_ptr = std::unique_ptr; - #else - // MSVC 2010 doesn't support C++11 aliases. - // We're manually "aliasing" the class here as we want to bring unique_ptr - // into the flatbuffers namespace. We have unique_ptr in the flatbuffers - // namespace we have a completely independent implemenation (see below) - // for C++98 STL implementations. - template class unique_ptr : public std::unique_ptr { - public: - unique_ptr() {} - explicit unique_ptr(T* p) : std::unique_ptr(p) {} - unique_ptr(std::unique_ptr&& u) { *this = std::move(u); } - unique_ptr(unique_ptr&& u) { *this = std::move(u); } - unique_ptr& operator=(std::unique_ptr&& u) { - std::unique_ptr::reset(u.release()); - return *this; - } - unique_ptr& operator=(unique_ptr&& u) { - std::unique_ptr::reset(u.release()); - return *this; - } - unique_ptr& operator=(T* p) { - return std::unique_ptr::operator=(p); - } - }; - #endif // defined(FLATBUFFERS_TEMPLATES_ALIASES) -#else - // Very limited implementation of unique_ptr. - // This is provided simply to allow the C++ code generated from the default - // settings to function in C++98 environments with no modifications. - template class unique_ptr { - public: - typedef T element_type; - - unique_ptr() : ptr_(nullptr) {} - explicit unique_ptr(T* p) : ptr_(p) {} - unique_ptr(unique_ptr&& u) : ptr_(nullptr) { reset(u.release()); } - unique_ptr(const unique_ptr& u) : ptr_(nullptr) { - reset(const_cast(&u)->release()); - } - ~unique_ptr() { reset(); } - - unique_ptr& operator=(const unique_ptr& u) { - reset(const_cast(&u)->release()); - return *this; - } - - unique_ptr& operator=(unique_ptr&& u) { - reset(u.release()); - return *this; - } - - unique_ptr& operator=(T* p) { - reset(p); - return *this; - } - - const T& operator*() const { return *ptr_; } - T* operator->() const { return ptr_; } - T* get() const noexcept { return ptr_; } - explicit operator bool() const { return ptr_ != nullptr; } - - // modifiers - T* release() { - T* value = ptr_; - ptr_ = nullptr; - return value; - } - - void reset(T* p = nullptr) { - T* value = ptr_; - ptr_ = p; - if (value) delete value; - } - - void swap(unique_ptr& u) { - T* temp_ptr = ptr_; - ptr_ = u.ptr_; - u.ptr_ = temp_ptr; - } - - private: - T* ptr_; - }; - - template bool operator==(const unique_ptr& x, - const unique_ptr& y) { - return x.get() == y.get(); - } - - template bool operator==(const unique_ptr& x, - const D* y) { - return static_cast(x.get()) == y; - } - - template bool operator==(const unique_ptr& x, intptr_t y) { - return reinterpret_cast(x.get()) == y; - } - - template bool operator!=(const unique_ptr& x, decltype(nullptr)) { - return !!x; - } - - template bool operator!=(decltype(nullptr), const unique_ptr& x) { - return !!x; - } - - template bool operator==(const unique_ptr& x, decltype(nullptr)) { - return !x; - } - - template bool operator==(decltype(nullptr), const unique_ptr& x) { - return !x; - } - -#endif // !FLATBUFFERS_CPP98_STL - -} // namespace flatbuffers - -#endif // FLATBUFFERS_STL_EMULATION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/util.h deleted file mode 100644 index a13fc5d..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/flatbuffers/util.h +++ /dev/null @@ -1,683 +0,0 @@ -/* - * Copyright 2014 Google Inc. 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 FLATBUFFERS_UTIL_H_ -#define FLATBUFFERS_UTIL_H_ - -#include - -#include "flatbuffers/base.h" - -#ifndef FLATBUFFERS_PREFER_PRINTF -# include -#else // FLATBUFFERS_PREFER_PRINTF -# include -# include -#endif // FLATBUFFERS_PREFER_PRINTF - -#include -#include - -namespace flatbuffers { - -// @locale-independent functions for ASCII characters set. - -// Fast checking that character lies in closed range: [a <= x <= b] -// using one compare (conditional branch) operator. -inline bool check_ascii_range(char x, char a, char b) { - FLATBUFFERS_ASSERT(a <= b); - // (Hacker's Delight): `a <= x <= b` <=> `(x-a) <={u} (b-a)`. - // The x, a, b will be promoted to int and subtracted without overflow. - return static_cast(x - a) <= static_cast(b - a); -} - -// Case-insensitive isalpha -inline bool is_alpha(char c) { - // ASCII only: alpha to upper case => reset bit 0x20 (~0x20 = 0xDF). - return check_ascii_range(c & 0xDF, 'a' & 0xDF, 'z' & 0xDF); -} - -// Check (case-insensitive) that `c` is equal to alpha. -inline bool is_alpha_char(char c, char alpha) { - FLATBUFFERS_ASSERT(is_alpha(alpha)); - // ASCII only: alpha to upper case => reset bit 0x20 (~0x20 = 0xDF). - return ((c & 0xDF) == (alpha & 0xDF)); -} - -// https://en.cppreference.com/w/cpp/string/byte/isxdigit -// isdigit and isxdigit are the only standard narrow character classification -// functions that are not affected by the currently installed C locale. although -// some implementations (e.g. Microsoft in 1252 codepage) may classify -// additional single-byte characters as digits. -inline bool is_digit(char c) { return check_ascii_range(c, '0', '9'); } - -inline bool is_xdigit(char c) { - // Replace by look-up table. - return is_digit(c) || check_ascii_range(c & 0xDF, 'a' & 0xDF, 'f' & 0xDF); -} - -// Case-insensitive isalnum -inline bool is_alnum(char c) { return is_alpha(c) || is_digit(c); } - -// @end-locale-independent functions for ASCII character set - -#ifdef FLATBUFFERS_PREFER_PRINTF -template size_t IntToDigitCount(T t) { - size_t digit_count = 0; - // Count the sign for negative numbers - if (t < 0) digit_count++; - // Count a single 0 left of the dot for fractional numbers - if (-1 < t && t < 1) digit_count++; - // Count digits until fractional part - T eps = std::numeric_limits::epsilon(); - while (t <= (-1 + eps) || (1 - eps) <= t) { - t /= 10; - digit_count++; - } - return digit_count; -} - -template size_t NumToStringWidth(T t, int precision = 0) { - size_t string_width = IntToDigitCount(t); - // Count the dot for floating point numbers - if (precision) string_width += (precision + 1); - return string_width; -} - -template -std::string NumToStringImplWrapper(T t, const char *fmt, int precision = 0) { - size_t string_width = NumToStringWidth(t, precision); - std::string s(string_width, 0x00); - // Allow snprintf to use std::string trailing null to detect buffer overflow - snprintf(const_cast(s.data()), (s.size() + 1), fmt, string_width, t); - return s; -} -#endif // FLATBUFFERS_PREFER_PRINTF - -// Convert an integer or floating point value to a string. -// In contrast to std::stringstream, "char" values are -// converted to a string of digits, and we don't use scientific notation. -template std::string NumToString(T t) { - // clang-format off - - #ifndef FLATBUFFERS_PREFER_PRINTF - std::stringstream ss; - ss << t; - return ss.str(); - #else // FLATBUFFERS_PREFER_PRINTF - auto v = static_cast(t); - return NumToStringImplWrapper(v, "%.*lld"); - #endif // FLATBUFFERS_PREFER_PRINTF - // clang-format on -} -// Avoid char types used as character data. -template<> inline std::string NumToString(signed char t) { - return NumToString(static_cast(t)); -} -template<> inline std::string NumToString(unsigned char t) { - return NumToString(static_cast(t)); -} -template<> inline std::string NumToString(char t) { - return NumToString(static_cast(t)); -} -#if defined(FLATBUFFERS_CPP98_STL) -template<> inline std::string NumToString(long long t) { - char buf[21]; // (log((1 << 63) - 1) / log(10)) + 2 - snprintf(buf, sizeof(buf), "%lld", t); - return std::string(buf); -} - -template<> -inline std::string NumToString(unsigned long long t) { - char buf[22]; // (log((1 << 63) - 1) / log(10)) + 1 - snprintf(buf, sizeof(buf), "%llu", t); - return std::string(buf); -} -#endif // defined(FLATBUFFERS_CPP98_STL) - -// Special versions for floats/doubles. -template std::string FloatToString(T t, int precision) { - // clang-format off - - #ifndef FLATBUFFERS_PREFER_PRINTF - // to_string() prints different numbers of digits for floats depending on - // platform and isn't available on Android, so we use stringstream - std::stringstream ss; - // Use std::fixed to suppress scientific notation. - ss << std::fixed; - // Default precision is 6, we want that to be higher for doubles. - ss << std::setprecision(precision); - ss << t; - auto s = ss.str(); - #else // FLATBUFFERS_PREFER_PRINTF - auto v = static_cast(t); - auto s = NumToStringImplWrapper(v, "%0.*f", precision); - #endif // FLATBUFFERS_PREFER_PRINTF - // clang-format on - // Sadly, std::fixed turns "1" into "1.00000", so here we undo that. - auto p = s.find_last_not_of('0'); - if (p != std::string::npos) { - // Strip trailing zeroes. If it is a whole number, keep one zero. - s.resize(p + (s[p] == '.' ? 2 : 1)); - } - return s; -} - -template<> inline std::string NumToString(double t) { - return FloatToString(t, 12); -} -template<> inline std::string NumToString(float t) { - return FloatToString(t, 6); -} - -// Convert an integer value to a hexadecimal string. -// The returned string length is always xdigits long, prefixed by 0 digits. -// For example, IntToStringHex(0x23, 8) returns the string "00000023". -inline std::string IntToStringHex(int i, int xdigits) { - FLATBUFFERS_ASSERT(i >= 0); - // clang-format off - - #ifndef FLATBUFFERS_PREFER_PRINTF - std::stringstream ss; - ss << std::setw(xdigits) << std::setfill('0') << std::hex << std::uppercase - << i; - return ss.str(); - #else // FLATBUFFERS_PREFER_PRINTF - return NumToStringImplWrapper(i, "%.*X", xdigits); - #endif // FLATBUFFERS_PREFER_PRINTF - // clang-format on -} - -// clang-format off -// Use locale independent functions {strtod_l, strtof_l, strtoll_l, strtoull_l}. -#if defined(FLATBUFFERS_LOCALE_INDEPENDENT) && (FLATBUFFERS_LOCALE_INDEPENDENT > 0) - class ClassicLocale { - #ifdef _MSC_VER - typedef _locale_t locale_type; - #else - typedef locale_t locale_type; // POSIX.1-2008 locale_t type - #endif - ClassicLocale(); - ~ClassicLocale(); - locale_type locale_; - static ClassicLocale instance_; - public: - static locale_type Get() { return instance_.locale_; } - }; - - #ifdef _MSC_VER - #define __strtoull_impl(s, pe, b) _strtoui64_l(s, pe, b, ClassicLocale::Get()) - #define __strtoll_impl(s, pe, b) _strtoi64_l(s, pe, b, ClassicLocale::Get()) - #define __strtod_impl(s, pe) _strtod_l(s, pe, ClassicLocale::Get()) - #define __strtof_impl(s, pe) _strtof_l(s, pe, ClassicLocale::Get()) - #else - #define __strtoull_impl(s, pe, b) strtoull_l(s, pe, b, ClassicLocale::Get()) - #define __strtoll_impl(s, pe, b) strtoll_l(s, pe, b, ClassicLocale::Get()) - #define __strtod_impl(s, pe) strtod_l(s, pe, ClassicLocale::Get()) - #define __strtof_impl(s, pe) strtof_l(s, pe, ClassicLocale::Get()) - #endif -#else - #define __strtod_impl(s, pe) strtod(s, pe) - #define __strtof_impl(s, pe) static_cast(strtod(s, pe)) - #ifdef _MSC_VER - #define __strtoull_impl(s, pe, b) _strtoui64(s, pe, b) - #define __strtoll_impl(s, pe, b) _strtoi64(s, pe, b) - #else - #define __strtoull_impl(s, pe, b) strtoull(s, pe, b) - #define __strtoll_impl(s, pe, b) strtoll(s, pe, b) - #endif -#endif - -inline void strtoval_impl(int64_t *val, const char *str, char **endptr, - int base) { - *val = __strtoll_impl(str, endptr, base); -} - -inline void strtoval_impl(uint64_t *val, const char *str, char **endptr, - int base) { - *val = __strtoull_impl(str, endptr, base); -} - -inline void strtoval_impl(double *val, const char *str, char **endptr) { - *val = __strtod_impl(str, endptr); -} - -// UBSAN: double to float is safe if numeric_limits::is_iec559 is true. -__supress_ubsan__("float-cast-overflow") -inline void strtoval_impl(float *val, const char *str, char **endptr) { - *val = __strtof_impl(str, endptr); -} -#undef __strtoull_impl -#undef __strtoll_impl -#undef __strtod_impl -#undef __strtof_impl -// clang-format on - -// Adaptor for strtoull()/strtoll(). -// Flatbuffers accepts numbers with any count of leading zeros (-009 is -9), -// while strtoll with base=0 interprets first leading zero as octal prefix. -// In future, it is possible to add prefixed 0b0101. -// 1) Checks errno code for overflow condition (out of range). -// 2) If base <= 0, function try to detect base of number by prefix. -// -// Return value (like strtoull and strtoll, but reject partial result): -// - If successful, an integer value corresponding to the str is returned. -// - If full string conversion can't be performed, 0 is returned. -// - If the converted value falls out of range of corresponding return type, a -// range error occurs. In this case value MAX(T)/MIN(T) is returned. -template -inline bool StringToIntegerImpl(T *val, const char *const str, - const int base = 0, - const bool check_errno = true) { - // T is int64_t or uint64_T - FLATBUFFERS_ASSERT(str); - if (base <= 0) { - auto s = str; - while (*s && !is_digit(*s)) s++; - if (s[0] == '0' && is_alpha_char(s[1], 'X')) - return StringToIntegerImpl(val, str, 16, check_errno); - // if a prefix not match, try base=10 - return StringToIntegerImpl(val, str, 10, check_errno); - } else { - if (check_errno) errno = 0; // clear thread-local errno - auto endptr = str; - strtoval_impl(val, str, const_cast(&endptr), base); - if ((*endptr != '\0') || (endptr == str)) { - *val = 0; // erase partial result - return false; // invalid string - } - // errno is out-of-range, return MAX/MIN - if (check_errno && errno) return false; - return true; - } -} - -template -inline bool StringToFloatImpl(T *val, const char *const str) { - // Type T must be either float or double. - FLATBUFFERS_ASSERT(str && val); - auto end = str; - strtoval_impl(val, str, const_cast(&end)); - auto done = (end != str) && (*end == '\0'); - if (!done) *val = 0; // erase partial result - return done; -} - -// Convert a string to an instance of T. -// Return value (matched with StringToInteger64Impl and strtod): -// - If successful, a numeric value corresponding to the str is returned. -// - If full string conversion can't be performed, 0 is returned. -// - If the converted value falls out of range of corresponding return type, a -// range error occurs. In this case value MAX(T)/MIN(T) is returned. -template inline bool StringToNumber(const char *s, T *val) { - FLATBUFFERS_ASSERT(s && val); - int64_t i64; - // The errno check isn't needed, will return MAX/MIN on overflow. - if (StringToIntegerImpl(&i64, s, 0, false)) { - const int64_t max = (flatbuffers::numeric_limits::max)(); - const int64_t min = flatbuffers::numeric_limits::lowest(); - if (i64 > max) { - *val = static_cast(max); - return false; - } - if (i64 < min) { - // For unsigned types return max to distinguish from - // "no conversion can be performed" when 0 is returned. - *val = static_cast(flatbuffers::is_unsigned::value ? max : min); - return false; - } - *val = static_cast(i64); - return true; - } - *val = 0; - return false; -} - -template<> inline bool StringToNumber(const char *str, int64_t *val) { - return StringToIntegerImpl(val, str); -} - -template<> -inline bool StringToNumber(const char *str, uint64_t *val) { - if (!StringToIntegerImpl(val, str)) return false; - // The strtoull accepts negative numbers: - // If the minus sign was part of the input sequence, the numeric value - // calculated from the sequence of digits is negated as if by unary minus - // in the result type, which applies unsigned integer wraparound rules. - // Fix this behaviour (except -0). - if (*val) { - auto s = str; - while (*s && !is_digit(*s)) s++; - s = (s > str) ? (s - 1) : s; // step back to one symbol - if (*s == '-') { - // For unsigned types return the max to distinguish from - // "no conversion can be performed". - *val = (flatbuffers::numeric_limits::max)(); - return false; - } - } - return true; -} - -template<> inline bool StringToNumber(const char *s, float *val) { - return StringToFloatImpl(val, s); -} - -template<> inline bool StringToNumber(const char *s, double *val) { - return StringToFloatImpl(val, s); -} - -inline int64_t StringToInt(const char *s, int base = 10) { - int64_t val; - return StringToIntegerImpl(&val, s, base) ? val : 0; -} - -inline uint64_t StringToUInt(const char *s, int base = 10) { - uint64_t val; - return StringToIntegerImpl(&val, s, base) ? val : 0; -} - -typedef bool (*LoadFileFunction)(const char *filename, bool binary, - std::string *dest); -typedef bool (*FileExistsFunction)(const char *filename); - -LoadFileFunction SetLoadFileFunction(LoadFileFunction load_file_function); - -FileExistsFunction SetFileExistsFunction( - FileExistsFunction file_exists_function); - -// Check if file "name" exists. -bool FileExists(const char *name); - -// Check if "name" exists and it is also a directory. -bool DirExists(const char *name); - -// Load file "name" into "buf" returning true if successful -// false otherwise. If "binary" is false data is read -// using ifstream's text mode, otherwise data is read with -// no transcoding. -bool LoadFile(const char *name, bool binary, std::string *buf); - -// Save data "buf" of length "len" bytes into a file -// "name" returning true if successful, false otherwise. -// If "binary" is false data is written using ifstream's -// text mode, otherwise data is written with no -// transcoding. -bool SaveFile(const char *name, const char *buf, size_t len, bool binary); - -// Save data "buf" into file "name" returning true if -// successful, false otherwise. If "binary" is false -// data is written using ifstream's text mode, otherwise -// data is written with no transcoding. -inline bool SaveFile(const char *name, const std::string &buf, bool binary) { - return SaveFile(name, buf.c_str(), buf.size(), binary); -} - -// Functionality for minimalistic portable path handling. - -// The functions below behave correctly regardless of whether posix ('/') or -// Windows ('/' or '\\') separators are used. - -// Any new separators inserted are always posix. -FLATBUFFERS_CONSTEXPR char kPathSeparator = '/'; - -// Returns the path with the extension, if any, removed. -std::string StripExtension(const std::string &filepath); - -// Returns the extension, if any. -std::string GetExtension(const std::string &filepath); - -// Return the last component of the path, after the last separator. -std::string StripPath(const std::string &filepath); - -// Strip the last component of the path + separator. -std::string StripFileName(const std::string &filepath); - -// Concatenates a path with a filename, regardless of wether the path -// ends in a separator or not. -std::string ConCatPathFileName(const std::string &path, - const std::string &filename); - -// Replaces any '\\' separators with '/' -std::string PosixPath(const char *path); - -// This function ensure a directory exists, by recursively -// creating dirs for any parts of the path that don't exist yet. -void EnsureDirExists(const std::string &filepath); - -// Obtains the absolute path from any other path. -// Returns the input path if the absolute path couldn't be resolved. -std::string AbsolutePath(const std::string &filepath); - -// To and from UTF-8 unicode conversion functions - -// Convert a unicode code point into a UTF-8 representation by appending it -// to a string. Returns the number of bytes generated. -inline int ToUTF8(uint32_t ucc, std::string *out) { - FLATBUFFERS_ASSERT(!(ucc & 0x80000000)); // Top bit can't be set. - // 6 possible encodings: http://en.wikipedia.org/wiki/UTF-8 - for (int i = 0; i < 6; i++) { - // Max bits this encoding can represent. - uint32_t max_bits = 6 + i * 5 + static_cast(!i); - if (ucc < (1u << max_bits)) { // does it fit? - // Remaining bits not encoded in the first byte, store 6 bits each - uint32_t remain_bits = i * 6; - // Store first byte: - (*out) += static_cast((0xFE << (max_bits - remain_bits)) | - (ucc >> remain_bits)); - // Store remaining bytes: - for (int j = i - 1; j >= 0; j--) { - (*out) += static_cast(((ucc >> (j * 6)) & 0x3F) | 0x80); - } - return i + 1; // Return the number of bytes added. - } - } - FLATBUFFERS_ASSERT(0); // Impossible to arrive here. - return -1; -} - -// Converts whatever prefix of the incoming string corresponds to a valid -// UTF-8 sequence into a unicode code. The incoming pointer will have been -// advanced past all bytes parsed. -// returns -1 upon corrupt UTF-8 encoding (ignore the incoming pointer in -// this case). -inline int FromUTF8(const char **in) { - int len = 0; - // Count leading 1 bits. - for (int mask = 0x80; mask >= 0x04; mask >>= 1) { - if (**in & mask) { - len++; - } else { - break; - } - } - if ((static_cast(**in) << len) & 0x80) - return -1; // Bit after leading 1's must be 0. - if (!len) return *(*in)++; - // UTF-8 encoded values with a length are between 2 and 4 bytes. - if (len < 2 || len > 4) { return -1; } - // Grab initial bits of the code. - int ucc = *(*in)++ & ((1 << (7 - len)) - 1); - for (int i = 0; i < len - 1; i++) { - if ((**in & 0xC0) != 0x80) return -1; // Upper bits must 1 0. - ucc <<= 6; - ucc |= *(*in)++ & 0x3F; // Grab 6 more bits of the code. - } - // UTF-8 cannot encode values between 0xD800 and 0xDFFF (reserved for - // UTF-16 surrogate pairs). - if (ucc >= 0xD800 && ucc <= 0xDFFF) { return -1; } - // UTF-8 must represent code points in their shortest possible encoding. - switch (len) { - case 2: - // Two bytes of UTF-8 can represent code points from U+0080 to U+07FF. - if (ucc < 0x0080 || ucc > 0x07FF) { return -1; } - break; - case 3: - // Three bytes of UTF-8 can represent code points from U+0800 to U+FFFF. - if (ucc < 0x0800 || ucc > 0xFFFF) { return -1; } - break; - case 4: - // Four bytes of UTF-8 can represent code points from U+10000 to U+10FFFF. - if (ucc < 0x10000 || ucc > 0x10FFFF) { return -1; } - break; - } - return ucc; -} - -#ifndef FLATBUFFERS_PREFER_PRINTF -// Wraps a string to a maximum length, inserting new lines where necessary. Any -// existing whitespace will be collapsed down to a single space. A prefix or -// suffix can be provided, which will be inserted before or after a wrapped -// line, respectively. -inline std::string WordWrap(const std::string in, size_t max_length, - const std::string wrapped_line_prefix, - const std::string wrapped_line_suffix) { - std::istringstream in_stream(in); - std::string wrapped, line, word; - - in_stream >> word; - line = word; - - while (in_stream >> word) { - if ((line.length() + 1 + word.length() + wrapped_line_suffix.length()) < - max_length) { - line += " " + word; - } else { - wrapped += line + wrapped_line_suffix + "\n"; - line = wrapped_line_prefix + word; - } - } - wrapped += line; - - return wrapped; -} -#endif // !FLATBUFFERS_PREFER_PRINTF - -inline bool EscapeString(const char *s, size_t length, std::string *_text, - bool allow_non_utf8, bool natural_utf8) { - std::string &text = *_text; - text += "\""; - for (uoffset_t i = 0; i < length; i++) { - char c = s[i]; - switch (c) { - case '\n': text += "\\n"; break; - case '\t': text += "\\t"; break; - case '\r': text += "\\r"; break; - case '\b': text += "\\b"; break; - case '\f': text += "\\f"; break; - case '\"': text += "\\\""; break; - case '\\': text += "\\\\"; break; - default: - if (c >= ' ' && c <= '~') { - text += c; - } else { - // Not printable ASCII data. Let's see if it's valid UTF-8 first: - const char *utf8 = s + i; - int ucc = FromUTF8(&utf8); - if (ucc < 0) { - if (allow_non_utf8) { - text += "\\x"; - text += IntToStringHex(static_cast(c), 2); - } else { - // There are two cases here: - // - // 1) We reached here by parsing an IDL file. In that case, - // we previously checked for non-UTF-8, so we shouldn't reach - // here. - // - // 2) We reached here by someone calling GenerateText() - // on a previously-serialized flatbuffer. The data might have - // non-UTF-8 Strings, or might be corrupt. - // - // In both cases, we have to give up and inform the caller - // they have no JSON. - return false; - } - } else { - if (natural_utf8) { - // utf8 points to past all utf-8 bytes parsed - text.append(s + i, static_cast(utf8 - s - i)); - } else if (ucc <= 0xFFFF) { - // Parses as Unicode within JSON's \uXXXX range, so use that. - text += "\\u"; - text += IntToStringHex(ucc, 4); - } else if (ucc <= 0x10FFFF) { - // Encode Unicode SMP values to a surrogate pair using two \u - // escapes. - uint32_t base = ucc - 0x10000; - auto high_surrogate = (base >> 10) + 0xD800; - auto low_surrogate = (base & 0x03FF) + 0xDC00; - text += "\\u"; - text += IntToStringHex(high_surrogate, 4); - text += "\\u"; - text += IntToStringHex(low_surrogate, 4); - } - // Skip past characters recognized. - i = static_cast(utf8 - s - 1); - } - } - break; - } - } - text += "\""; - return true; -} - -inline std::string BufferToHexText(const void *buffer, size_t buffer_size, - size_t max_length, - const std::string &wrapped_line_prefix, - const std::string &wrapped_line_suffix) { - std::string text = wrapped_line_prefix; - size_t start_offset = 0; - const char *s = reinterpret_cast(buffer); - for (size_t i = 0; s && i < buffer_size; i++) { - // Last iteration or do we have more? - bool have_more = i + 1 < buffer_size; - text += "0x"; - text += IntToStringHex(static_cast(s[i]), 2); - if (have_more) { text += ','; } - // If we have more to process and we reached max_length - if (have_more && - text.size() + wrapped_line_suffix.size() >= start_offset + max_length) { - text += wrapped_line_suffix; - text += '\n'; - start_offset = text.size(); - text += wrapped_line_prefix; - } - } - text += wrapped_line_suffix; - return text; -} - -// Remove paired quotes in a string: "text"|'text' -> text. -std::string RemoveStringQuotes(const std::string &s); - -// Change th global C-locale to locale with name . -// Returns an actual locale name in <_value>, useful if locale_name is "" or -// null. -bool SetGlobalTestLocale(const char *locale_name, - std::string *_value = nullptr); - -// Read (or test) a value of environment variable. -bool ReadEnvironmentVariable(const char *var_name, - std::string *_value = nullptr); - -// MSVC specific: Send all assert reports to STDOUT to prevent CI hangs. -void SetupDefaultCRTReportMode(); - -} // namespace flatbuffers - -#endif // FLATBUFFERS_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/Info.plist b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/Info.plist deleted file mode 100644 index 188a8b8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/Info.plist +++ /dev/null @@ -1,40 +0,0 @@ - - - - - AvailableLibraries - - - LibraryIdentifier - ios-arm64 - LibraryPath - libtensorflow-lite-for-device-arm64.a - SupportedArchitectures - - arm64 - - SupportedPlatform - ios - - - LibraryIdentifier - ios-arm64_x86_64-simulator - LibraryPath - libtensorflow-lite-for-simulator.a - SupportedArchitectures - - arm64 - x86_64 - - SupportedPlatform - ios - SupportedPlatformVariant - simulator - - - CFBundlePackageType - XFWK - XCFrameworkFormatVersion - 1.0 - - diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/ios-arm64/libtensorflow-lite-for-device-arm64.a b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/ios-arm64/libtensorflow-lite-for-device-arm64.a deleted file mode 100644 index 9a951ed..0000000 Binary files a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/ios-arm64/libtensorflow-lite-for-device-arm64.a and /dev/null differ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/ios-arm64_x86_64-simulator/libtensorflow-lite-for-simulator.a b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/ios-arm64_x86_64-simulator/libtensorflow-lite-for-simulator.a deleted file mode 100644 index c7a172b..0000000 Binary files a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/ios-arm64_x86_64-simulator/libtensorflow-lite-for-simulator.a and /dev/null differ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/ios-arm64_x86_64-simulator/libtensorflow-lite.a b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/ios-arm64_x86_64-simulator/libtensorflow-lite.a deleted file mode 100644 index 2a83d14..0000000 Binary files a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/libtensorflow-lite.xcframework/ios-arm64_x86_64-simulator/libtensorflow-lite.a and /dev/null differ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/allocation.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/allocation.h deleted file mode 100644 index cf9ff5c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/allocation.h +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright 2017 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. -==============================================================================*/ -/// \file -/// Memory management for TF Lite. -#ifndef TENSORFLOW_LITE_ALLOCATION_H_ -#define TENSORFLOW_LITE_ALLOCATION_H_ - -#include -#include -#include -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/core/api/error_reporter.h" -#include "tensorflow/lite/string_type.h" - -namespace tflite { - -// A memory allocation handle. This could be a mmap or shared memory. -class Allocation { - public: - virtual ~Allocation() {} - - enum class Type { - kMMap, - kFileCopy, - kMemory, - }; - - // Base pointer of this allocation - virtual const void* base() const = 0; - // Size in bytes of the allocation - virtual size_t bytes() const = 0; - // Whether the allocation is valid - virtual bool valid() const = 0; - // Return the type of the Allocation. - Type type() const { return type_; } - - protected: - Allocation(ErrorReporter* error_reporter, Type type) - : error_reporter_(error_reporter), type_(type) {} - ErrorReporter* error_reporter_; - - private: - const Type type_; -}; - -class MMAPAllocation : public Allocation { - public: - MMAPAllocation(const char* filename, ErrorReporter* error_reporter); - virtual ~MMAPAllocation(); - const void* base() const override; - size_t bytes() const override; - bool valid() const override; - - int fd() const { return mmap_fd_; } - - static bool IsSupported(); - - protected: - // Data required for mmap. - int mmap_fd_ = -1; // mmap file descriptor - const void* mmapped_buffer_; - size_t buffer_size_bytes_ = 0; -}; - -class FileCopyAllocation : public Allocation { - public: - FileCopyAllocation(const char* filename, ErrorReporter* error_reporter); - virtual ~FileCopyAllocation(); - const void* base() const override; - size_t bytes() const override; - bool valid() const override; - - private: - // Data required for mmap. - std::unique_ptr copied_buffer_; - size_t buffer_size_bytes_ = 0; -}; - -class MemoryAllocation : public Allocation { - public: - // Allocates memory with the pointer and the number of bytes of the memory. - // The pointer has to remain alive and unchanged until the destructor is - // called. - MemoryAllocation(const void* ptr, size_t num_bytes, - ErrorReporter* error_reporter); - virtual ~MemoryAllocation(); - const void* base() const override; - size_t bytes() const override; - bool valid() const override; - - private: - const void* buffer_; - size_t buffer_size_bytes_ = 0; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_ALLOCATION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/arena_planner.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/arena_planner.h deleted file mode 100644 index 5f7b990..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/arena_planner.h +++ /dev/null @@ -1,138 +0,0 @@ -/* Copyright 2017 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_ARENA_PLANNER_H_ -#define TENSORFLOW_LITE_ARENA_PLANNER_H_ - -#include -#include -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/graph_info.h" -#include "tensorflow/lite/memory_planner.h" -#include "tensorflow/lite/simple_memory_arena.h" -#include "tensorflow/lite/util.h" - -namespace tflite { - -constexpr const int kDefaultArenaAlignment = 64; -struct AllocationInfo; - -// A memory planner that makes all the allocations using arenas. -// -// Before a model is executed by the interpreter, this class determines when -// each tensor needs to be allocated and deallocated, and preallocates all the -// necessary memory (the PlanAllocations phase). It then assigns portions of -// this memory buffer to each tensor (the ExecuteAllocations phase). Tensors may -// share some of the buffer if a tensor B is to be allocated after another -// tensor A has been deallocated. -// -// If dynamic tensors are used the planning steps can be repeated during model -// execution. Since dynamic tensors don't have sizes until after the -// corresponding operation is executed, this class supports incremental -// planning. -class ArenaPlanner : public MemoryPlanner { - public: - // Ownership of 'context' is not taken and it must remain util the - // ArenaPlanner is destroyed. If 'preserve_inputs' is true the inputs to the - // graph will not share memory with any other tensor, effectively preserving - // them until the end of inference. - ArenaPlanner(TfLiteContext* context, std::unique_ptr graph_info, - bool preserve_inputs, bool preserve_intermediates, - int tensor_alignment); - ~ArenaPlanner() override; - ArenaPlanner(const ArenaPlanner&) = delete; - ArenaPlanner& operator=(const ArenaPlanner&) = delete; - - TfLiteStatus ResetAllocations() override; - TfLiteStatus ResetAllocationsAfter(int node) override; - TfLiteStatus PlanAllocations() override; - TfLiteStatus ExecuteAllocations(int first_node, int last_node) override; - TfLiteStatus ReleaseNonPersistentMemory() override; - TfLiteStatus AcquireNonPersistentMemory() override; - bool HasNonPersistentMemory() override; - - // Returns the base arena location for a given allocation type. - std::intptr_t BasePointer(TfLiteAllocationType type); - - private: - // Make sure all the arenas have reserved enough memory to store all their - // tensors. - TfLiteStatus Commit(); - - // Returns vector of tensor number ordered by the following algorithm. - // Comparator to sort tensors for the allocation algorithm: - // - Tensors that have lifespan through the whole model inference time go - // first; - // - Other tensors (e.g. intermediate and temporary ones) are sorted in - // non-increasing order of their size. If sizes of two tensors are equal, the - // one that needs to be allocated earlier goes first. - std::vector CreateTensorAllocationVector(int first_node, - int last_node); - - // Traverse the allocation queue and reserve space in the appropriate arena - // for all tensors affected by ops in the interval [first_node, last_node]. - TfLiteStatus CalculateAllocations(int first_node, int last_node); - - // Assign absolute memory location to a tensor, based on its relative - // position inside the corresponding arena buffer. - TfLiteStatus ResolveTensorAllocation(int tensor_index); - - // Register an allocation for all internal (temporary) tensors of - // 'node_index'. - TfLiteStatus CalculateAllocationOfInternalTensors(int node_index); - - // Register a deallocation for all internal (temporary) tensors of - // 'node_index'. - TfLiteStatus CalculateDeallocationOfInternalTensors(int node_index); - - TfLiteContext* context_; - std::unique_ptr graph_info_; - - // Stores allocation data for all tensors. - std::vector allocs_; - - // First node, that uses the tensor. It needs to be allocated before - // execution of the node's operation. - std::vector alloc_node_; - - // Last node, that uses the tensor. It can be deallocated after execution of - // the node's operation. - std::vector dealloc_node_; - - // Raw memory buffer that is allocated for all temporary and graph outputs - // that are declared kTfLiteArenaRw. - SimpleMemoryArena arena_; - - // Raw memory buffer that is allocated for persistent tensors that are - // declared as kTfLiteArenaRwPersistent. - SimpleMemoryArena persistent_arena_; - - // Ensure that the memory self-allocated for inputs is never reused by the - // allocator. This allows for example, multiple runs without getting - // unpredictable results. - bool preserve_inputs_; - - // If true, then no overlapping of memory areas is done, meaning intermediate - // results can be queried after running (modulo running delegates). - bool preserve_intermediates_; - - // Number of bytes that tensor buffers should be aligned to. - int tensor_alignment_; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_ARENA_PLANNER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/builtin_op_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/builtin_op_data.h deleted file mode 100644 index b9d4284..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/builtin_op_data.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright 2017 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. -==============================================================================*/ -// Compatibility shim for new location of interface definitions. - -#ifndef TENSORFLOW_LITE_BUILTIN_OP_DATA_H_ -#define TENSORFLOW_LITE_BUILTIN_OP_DATA_H_ - -#include "tensorflow/lite/c/builtin_op_data.h" - -#endif // TENSORFLOW_LITE_BUILTIN_OP_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/builtin_ops.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/builtin_ops.h deleted file mode 100644 index 3595209..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/builtin_ops.h +++ /dev/null @@ -1,164 +0,0 @@ -/* Copyright 2018 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_BUILTIN_OPS_H_ -#define TENSORFLOW_LITE_BUILTIN_OPS_H_ - -// DO NOT EDIT MANUALLY: This file is automatically generated by -// `schema/builtin_ops_header/generator.cc`. - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// The enum for builtin operators. -// Note: CUSTOM, DELEGATE, and PLACEHOLDER_FOR_GREATER_OP_CODES are 3 special -// ops which are not real built-in ops. -typedef enum { - kTfLiteBuiltinAdd = 0, - kTfLiteBuiltinAveragePool2d = 1, - kTfLiteBuiltinConcatenation = 2, - kTfLiteBuiltinConv2d = 3, - kTfLiteBuiltinDepthwiseConv2d = 4, - kTfLiteBuiltinDepthToSpace = 5, - kTfLiteBuiltinDequantize = 6, - kTfLiteBuiltinEmbeddingLookup = 7, - kTfLiteBuiltinFloor = 8, - kTfLiteBuiltinFullyConnected = 9, - kTfLiteBuiltinHashtableLookup = 10, - kTfLiteBuiltinL2Normalization = 11, - kTfLiteBuiltinL2Pool2d = 12, - kTfLiteBuiltinLocalResponseNormalization = 13, - kTfLiteBuiltinLogistic = 14, - kTfLiteBuiltinLshProjection = 15, - kTfLiteBuiltinLstm = 16, - kTfLiteBuiltinMaxPool2d = 17, - kTfLiteBuiltinMul = 18, - kTfLiteBuiltinRelu = 19, - kTfLiteBuiltinReluN1To1 = 20, - kTfLiteBuiltinRelu6 = 21, - kTfLiteBuiltinReshape = 22, - kTfLiteBuiltinResizeBilinear = 23, - kTfLiteBuiltinRnn = 24, - kTfLiteBuiltinSoftmax = 25, - kTfLiteBuiltinSpaceToDepth = 26, - kTfLiteBuiltinSvdf = 27, - kTfLiteBuiltinTanh = 28, - kTfLiteBuiltinConcatEmbeddings = 29, - kTfLiteBuiltinSkipGram = 30, - kTfLiteBuiltinCall = 31, - kTfLiteBuiltinCustom = 32, - kTfLiteBuiltinEmbeddingLookupSparse = 33, - kTfLiteBuiltinPad = 34, - kTfLiteBuiltinUnidirectionalSequenceRnn = 35, - kTfLiteBuiltinGather = 36, - kTfLiteBuiltinBatchToSpaceNd = 37, - kTfLiteBuiltinSpaceToBatchNd = 38, - kTfLiteBuiltinTranspose = 39, - kTfLiteBuiltinMean = 40, - kTfLiteBuiltinSub = 41, - kTfLiteBuiltinDiv = 42, - kTfLiteBuiltinSqueeze = 43, - kTfLiteBuiltinUnidirectionalSequenceLstm = 44, - kTfLiteBuiltinStridedSlice = 45, - kTfLiteBuiltinBidirectionalSequenceRnn = 46, - kTfLiteBuiltinExp = 47, - kTfLiteBuiltinTopkV2 = 48, - kTfLiteBuiltinSplit = 49, - kTfLiteBuiltinLogSoftmax = 50, - kTfLiteBuiltinDelegate = 51, - kTfLiteBuiltinBidirectionalSequenceLstm = 52, - kTfLiteBuiltinCast = 53, - kTfLiteBuiltinPrelu = 54, - kTfLiteBuiltinMaximum = 55, - kTfLiteBuiltinArgMax = 56, - kTfLiteBuiltinMinimum = 57, - kTfLiteBuiltinLess = 58, - kTfLiteBuiltinNeg = 59, - kTfLiteBuiltinPadv2 = 60, - kTfLiteBuiltinGreater = 61, - kTfLiteBuiltinGreaterEqual = 62, - kTfLiteBuiltinLessEqual = 63, - kTfLiteBuiltinSelect = 64, - kTfLiteBuiltinSlice = 65, - kTfLiteBuiltinSin = 66, - kTfLiteBuiltinTransposeConv = 67, - kTfLiteBuiltinSparseToDense = 68, - kTfLiteBuiltinTile = 69, - kTfLiteBuiltinExpandDims = 70, - kTfLiteBuiltinEqual = 71, - kTfLiteBuiltinNotEqual = 72, - kTfLiteBuiltinLog = 73, - kTfLiteBuiltinSum = 74, - kTfLiteBuiltinSqrt = 75, - kTfLiteBuiltinRsqrt = 76, - kTfLiteBuiltinShape = 77, - kTfLiteBuiltinPow = 78, - kTfLiteBuiltinArgMin = 79, - kTfLiteBuiltinFakeQuant = 80, - kTfLiteBuiltinReduceProd = 81, - kTfLiteBuiltinReduceMax = 82, - kTfLiteBuiltinPack = 83, - kTfLiteBuiltinLogicalOr = 84, - kTfLiteBuiltinOneHot = 85, - kTfLiteBuiltinLogicalAnd = 86, - kTfLiteBuiltinLogicalNot = 87, - kTfLiteBuiltinUnpack = 88, - kTfLiteBuiltinReduceMin = 89, - kTfLiteBuiltinFloorDiv = 90, - kTfLiteBuiltinReduceAny = 91, - kTfLiteBuiltinSquare = 92, - kTfLiteBuiltinZerosLike = 93, - kTfLiteBuiltinFill = 94, - kTfLiteBuiltinFloorMod = 95, - kTfLiteBuiltinRange = 96, - kTfLiteBuiltinResizeNearestNeighbor = 97, - kTfLiteBuiltinLeakyRelu = 98, - kTfLiteBuiltinSquaredDifference = 99, - kTfLiteBuiltinMirrorPad = 100, - kTfLiteBuiltinAbs = 101, - kTfLiteBuiltinSplitV = 102, - kTfLiteBuiltinUnique = 103, - kTfLiteBuiltinCeil = 104, - kTfLiteBuiltinReverseV2 = 105, - kTfLiteBuiltinAddN = 106, - kTfLiteBuiltinGatherNd = 107, - kTfLiteBuiltinCos = 108, - kTfLiteBuiltinWhere = 109, - kTfLiteBuiltinRank = 110, - kTfLiteBuiltinElu = 111, - kTfLiteBuiltinReverseSequence = 112, - kTfLiteBuiltinMatrixDiag = 113, - kTfLiteBuiltinQuantize = 114, - kTfLiteBuiltinMatrixSetDiag = 115, - kTfLiteBuiltinRound = 116, - kTfLiteBuiltinHardSwish = 117, - kTfLiteBuiltinIf = 118, - kTfLiteBuiltinWhile = 119, - kTfLiteBuiltinNonMaxSuppressionV4 = 120, - kTfLiteBuiltinNonMaxSuppressionV5 = 121, - kTfLiteBuiltinScatterNd = 122, - kTfLiteBuiltinSelectV2 = 123, - kTfLiteBuiltinDensify = 124, - kTfLiteBuiltinSegmentSum = 125, - kTfLiteBuiltinBatchMatmul = 126, - kTfLiteBuiltinPlaceholderForGreaterOpCodes = 127, - kTfLiteBuiltinCumsum = 128, -} TfLiteBuiltinOperator; - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus -#endif // TENSORFLOW_LITE_BUILTIN_OPS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/builtin_op_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/builtin_op_data.h deleted file mode 100644 index a511e51..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/builtin_op_data.h +++ /dev/null @@ -1,477 +0,0 @@ -/* Copyright 2017 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_C_BUILTIN_OP_DATA_H_ -#define TENSORFLOW_LITE_C_BUILTIN_OP_DATA_H_ - -#include - -#include "tensorflow/lite/c/common.h" - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// TfLiteReshapeParams can't have dynamic data so we fix the maximum possible -// number of dimensions. -#define TFLITE_RESHAPE_PARAMS_MAX_DIMENSION_COUNT 8 - -// TODO(aselle): Consider using "if this then that" for testing. - -// Useful placeholder to put in otherwise empty structs to avoid size warnings. -typedef struct { - char dummy; -} EmptyStructPlaceholder; - -// IMPORTANT: All new members of structs must be added at the end to ensure -// backwards compatibility. - -// Possible padding types (for convolutions) -typedef enum { - kTfLitePaddingUnknown = 0, - kTfLitePaddingSame, - kTfLitePaddingValid, -} TfLitePadding; - -typedef enum { - kTfLiteMirrorPaddingUnknown = 0, - kTfLiteMirrorPaddingReflect, - kTfLiteMirrorPaddingSymmetric, -} TfLiteMirrorPaddingMode; - -// TODO(b/130259536): We should move this out of builtin_op_data. -typedef struct { - int width; - int height; - int width_offset; - int height_offset; -} TfLitePaddingValues; - -typedef struct { - TfLiteMirrorPaddingMode mode; -} TfLiteMirrorPaddingParams; - -// Possible fused activation functions. -// TODO(aselle): rename to TfLiteActivation -typedef enum { - kTfLiteActNone = 0, - kTfLiteActRelu, - kTfLiteActReluN1To1, // min(max(-1, x), 1) - kTfLiteActRelu1 = kTfLiteActReluN1To1, // kTfLiteActRelu1 will be deprecated. - kTfLiteActRelu6, // min(max(0, x), 6) - kTfLiteActTanh, - kTfLiteActSignBit, - kTfLiteActSigmoid, -} TfLiteFusedActivation; - -typedef struct { - // Parameters for CONV_2D version 1. - TfLitePadding padding; - int stride_width; - int stride_height; - TfLiteFusedActivation activation; - - // Parameters for CONV_2D version 2. - // Note: Version 2 supports dilation values not equal to 1. - int dilation_width_factor; - int dilation_height_factor; -} TfLiteConvParams; - -typedef struct { - TfLitePadding padding; - int stride_width; - int stride_height; - int filter_width; - int filter_height; - TfLiteFusedActivation activation; - struct { - TfLitePaddingValues padding; - } computed; -} TfLitePoolParams; - -typedef struct { - // Parameters for DepthwiseConv version 1 or above. - TfLitePadding padding; - int stride_width; - int stride_height; - // `depth_multiplier` is redundant. It's used by CPU kernels in - // TensorFlow 2.0 or below, but ignored in versions above. - // - // The information can be deduced from the shape of input and the shape of - // weights. Since the TFLiteConverter toolchain doesn't support partially - // specified shapes, relying on `depth_multiplier` stops us from supporting - // graphs with dynamic shape tensors. - // - // Note: Some of the delegates (e.g. NNAPI, GPU) are still relying on this - // field. - int depth_multiplier; - TfLiteFusedActivation activation; - // Parameters for DepthwiseConv version 2 or above. - int dilation_width_factor; - int dilation_height_factor; -} TfLiteDepthwiseConvParams; - -typedef struct { - int rank; - TfLiteFusedActivation activation; - - // Parameter for SVDF version 4. - bool asymmetric_quantize_inputs; -} TfLiteSVDFParams; - -typedef struct { - TfLiteFusedActivation activation; - - // Parameter for RNN version 3. - bool asymmetric_quantize_inputs; -} TfLiteRNNParams; - -typedef struct { - bool time_major; - TfLiteFusedActivation activation; - - // Parameter for Sequence RNN version 3. - bool asymmetric_quantize_inputs; -} TfLiteSequenceRNNParams; - -typedef struct { - bool time_major; - TfLiteFusedActivation activation; - bool merge_outputs; - - // Parameter for Bidirectional RNN verison 3. - bool asymmetric_quantize_inputs; -} TfLiteBidirectionalSequenceRNNParams; - -typedef enum { - kTfLiteFullyConnectedWeightsFormatDefault = 0, - kTfLiteFullyConnectedWeightsFormatShuffled4x16Int8 = 1, -} TfLiteFullyConnectedWeightsFormat; - -typedef struct { - // Parameters for FullyConnected version 1 or above. - TfLiteFusedActivation activation; - - // Parameters for FullyConnected version 2 or above. - TfLiteFullyConnectedWeightsFormat weights_format; - - // Parameters for FullyConnected version 5 or above. - // If set to true, then the number of dimensions in the input and the output - // tensors are the same. Furthermore, all but the last dimension of the input - // and output shapes will be equal. - bool keep_num_dims; - - // Parameters for FullyConnected version 7 or above. - // If set to true and the weights are quantized, then non constant inputs - // are quantized at evaluation time with asymmetric quantization. - bool asymmetric_quantize_inputs; -} TfLiteFullyConnectedParams; - -typedef enum { - kTfLiteLshProjectionUnknown = 0, - kTfLiteLshProjectionSparse = 1, - kTfLiteLshProjectionDense = 2, -} TfLiteLSHProjectionType; - -typedef struct { - TfLiteLSHProjectionType type; -} TfLiteLSHProjectionParams; - -typedef struct { - float beta; -} TfLiteSoftmaxParams; - -typedef struct { - int axis; - TfLiteFusedActivation activation; -} TfLiteConcatenationParams; - -typedef struct { - TfLiteFusedActivation activation; - // Parameter added for the version 4. - bool pot_scale_int16; -} TfLiteAddParams; - -typedef struct { - EmptyStructPlaceholder placeholder; -} TfLiteSpaceToBatchNDParams; - -typedef struct { - EmptyStructPlaceholder placeholder; -} TfLiteBatchToSpaceNDParams; - -typedef struct { - bool adj_x; - bool adj_y; -} TfLiteBatchMatMulParams; - -typedef struct { - TfLiteFusedActivation activation; -} TfLiteMulParams; - -typedef struct { - TfLiteFusedActivation activation; - // Parameter added for the version 5. - bool pot_scale_int16; -} TfLiteSubParams; - -typedef struct { - TfLiteFusedActivation activation; -} TfLiteDivParams; - -typedef struct { - TfLiteFusedActivation activation; -} TfLiteL2NormParams; - -typedef struct { - int radius; - float bias; - float alpha; - float beta; -} TfLiteLocalResponseNormParams; - -typedef enum { - kTfLiteLSTMFullKernel = 0, - kTfLiteLSTMBasicKernel -} TfLiteLSTMKernelType; - -typedef struct { - // Parameters for LSTM version 1. - TfLiteFusedActivation activation; - float cell_clip; - float proj_clip; - - // Parameters for LSTM version 2. - // kTfLiteLSTMBasicKernel is only supported in version 2 or above. - TfLiteLSTMKernelType kernel_type; - - // Parameters for LSTM version 4. - bool asymmetric_quantize_inputs; -} TfLiteLSTMParams; - -typedef struct { - // Parameters needed for the underlying LSTM. - TfLiteFusedActivation activation; - float cell_clip; - float proj_clip; - - // If set to true then the first dimension is time, otherwise batch. - bool time_major; - - // Parameter for unidirectional sequence RNN version 3. - bool asymmetric_quantize_inputs; -} TfLiteUnidirectionalSequenceLSTMParams; - -typedef struct { - // Parameters supported by version 1: - // Parameters inherited for the LSTM kernel. - TfLiteFusedActivation activation; - float cell_clip; - float proj_clip; - - // If true, store the outputs of both directions in the first output. - bool merge_outputs; - - // Parameters supported by version 2: - // If set to true then the first dimension is time, otherwise batch. - bool time_major; - - // Parameters supported by version 4: - // If set to true, then hybrid ops use asymmetric quantization for inputs. - bool asymmetric_quantize_inputs; -} TfLiteBidirectionalSequenceLSTMParams; - -typedef struct { - bool align_corners; - // half_pixel_centers assumes pixels are of half the actual dimensions, and - // yields more accurate resizes. Corresponds to the same argument for the - // original TensorFlow op in TF2.0. - bool half_pixel_centers; -} TfLiteResizeBilinearParams; - -typedef struct { - bool align_corners; - bool half_pixel_centers; -} TfLiteResizeNearestNeighborParams; - -typedef struct { - EmptyStructPlaceholder placeholder; -} TfLitePadParams; - -typedef struct { - EmptyStructPlaceholder placeholder; -} TfLitePadV2Params; - -typedef struct { - // TODO(ahentz): We can't have dynamic data in this struct, at least not yet. - // For now we will fix the maximum possible number of dimensions. - int shape[TFLITE_RESHAPE_PARAMS_MAX_DIMENSION_COUNT]; - int num_dimensions; -} TfLiteReshapeParams; - -typedef struct { - int ngram_size; - int max_skip_size; - bool include_all_ngrams; -} TfLiteSkipGramParams; - -typedef struct { - int block_size; -} TfLiteSpaceToDepthParams; - -typedef struct { - int block_size; -} TfLiteDepthToSpaceParams; - -typedef struct { - TfLiteType in_data_type; - TfLiteType out_data_type; -} TfLiteCastParams; - -typedef enum { - kTfLiteCombinerTypeSum = 0, - kTfLiteCombinerTypeMean = 1, - kTfLiteCombinerTypeSqrtn = 2, -} TfLiteCombinerType; - -typedef struct { - TfLiteCombinerType combiner; -} TfLiteEmbeddingLookupSparseParams; - -typedef struct { - int axis; -} TfLiteGatherParams; - -typedef struct { - EmptyStructPlaceholder placeholder; -} TfLiteTransposeParams; - -typedef struct { - bool keep_dims; -} TfLiteReducerParams; - -typedef struct { - int num_splits; -} TfLiteSplitParams; - -typedef struct { - int num_splits; -} TfLiteSplitVParams; - -typedef struct { - // TODO(ahentz): We can't have dynamic data in this struct, at least not yet. - // For now we will fix the maximum possible number of dimensions. - int squeeze_dims[8]; - int num_squeeze_dims; -} TfLiteSqueezeParams; - -typedef struct { - int begin_mask; - int end_mask; - int ellipsis_mask; - int new_axis_mask; - int shrink_axis_mask; -} TfLiteStridedSliceParams; - -typedef struct { - TfLiteType output_type; -} TfLiteArgMaxParams; - -typedef struct { - TfLiteType output_type; -} TfLiteArgMinParams; - -typedef struct { - TfLitePadding padding; - int stride_width; - int stride_height; -} TfLiteTransposeConvParams; - -typedef struct { - bool validate_indices; -} TfLiteSparseToDenseParams; - -typedef struct { - TfLiteType out_type; -} TfLiteShapeParams; - -typedef struct { - EmptyStructPlaceholder placeholder; -} TfLiteRankParams; - -typedef struct { - // Parameters supported by version 1: - float min; - float max; - int num_bits; - - // Parameters supported by version 2: - bool narrow_range; -} TfLiteFakeQuantParams; - -typedef struct { - int values_count; - int axis; -} TfLitePackParams; - -typedef struct { - int axis; -} TfLiteOneHotParams; - -typedef struct { - int num; - int axis; -} TfLiteUnpackParams; - -typedef struct { - float alpha; -} TfLiteLeakyReluParams; - -typedef struct { - TfLiteType index_out_type; -} TfLiteUniqueParams; - -typedef struct { - int seq_dim; - int batch_dim; -} TfLiteReverseSequenceParams; - -typedef struct { - EmptyStructPlaceholder placeholder; -} TfLiteMatrixDiagParams; - -typedef struct { - EmptyStructPlaceholder placeholder; -} TfLiteMatrixSetDiagParams; - -typedef struct { - int then_subgraph_index; - int else_subgraph_index; -} TfLiteIfParams; - -typedef struct { - int cond_subgraph_index; - int body_subgraph_index; -} TfLiteWhileParams; - -typedef struct { - bool exclusive; - bool reverse; -} TfLiteCumsumParams; - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif // TENSORFLOW_LITE_C_BUILTIN_OP_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/c_api.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/c_api.h deleted file mode 100644 index 152bcf9..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/c_api.h +++ /dev/null @@ -1,255 +0,0 @@ -/* Copyright 2018 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_C_C_API_H_ -#define TENSORFLOW_LITE_C_C_API_H_ - -#include -#include - -#include "common.h" - -// -------------------------------------------------------------------------- -/// C API for TensorFlow Lite. -/// -/// The API leans towards simplicity and uniformity instead of convenience, as -/// most usage will be by language-specific wrappers. It provides largely the -/// same set of functionality as that of the C++ TensorFlow Lite `Interpreter` -/// API, but is useful for shared libraries where having a stable ABI boundary -/// is important. -/// -/// Conventions: -/// * We use the prefix TfLite for everything in the API. -/// * size_t is used to represent byte sizes of objects that are -/// materialized in the address space of the calling process. -/// * int is used as an index into arrays. -/// -/// Usage: -///

-/// // Create the model and interpreter options.
-/// TfLiteModel* model = TfLiteModelCreateFromFile("/path/to/model.tflite");
-/// TfLiteInterpreterOptions* options = TfLiteInterpreterOptionsCreate();
-/// TfLiteInterpreterOptionsSetNumThreads(options, 2);
-///
-/// // Create the interpreter.
-/// TfLiteInterpreter* interpreter = TfLiteInterpreterCreate(model, options);
-///
-/// // Allocate tensors and populate the input tensor data.
-/// TfLiteInterpreterAllocateTensors(interpreter);
-/// TfLiteTensor* input_tensor =
-///     TfLiteInterpreterGetInputTensor(interpreter, 0);
-/// TfLiteTensorCopyFromBuffer(input_tensor, input.data(),
-///                            input.size() * sizeof(float));
-///
-/// // Execute inference.
-/// TfLiteInterpreterInvoke(interpreter);
-///
-/// // Extract the output tensor data.
-/// const TfLiteTensor* output_tensor =
-//      TfLiteInterpreterGetOutputTensor(interpreter, 0);
-/// TfLiteTensorCopyToBuffer(output_tensor, output.data(),
-///                          output.size() * sizeof(float));
-///
-/// // Dispose of the model and interpreter objects.
-/// TfLiteInterpreterDelete(interpreter);
-/// TfLiteInterpreterOptionsDelete(options);
-/// TfLiteModelDelete(model);
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-// --------------------------------------------------------------------------
-// TfLiteVersion returns a string describing version information of the
-// TensorFlow Lite library. TensorFlow Lite uses semantic versioning.
-TFL_CAPI_EXPORT extern const char* TfLiteVersion(void);
-
-// --------------------------------------------------------------------------
-// TfLiteModel wraps a loaded TensorFlow Lite model.
-typedef struct TfLiteModel TfLiteModel;
-
-// Returns a model from the provided buffer, or null on failure.
-TFL_CAPI_EXPORT extern TfLiteModel* TfLiteModelCreate(const void* model_data,
-                                                      size_t model_size);
-
-// Returns a model from the provided file, or null on failure.
-TFL_CAPI_EXPORT extern TfLiteModel* TfLiteModelCreateFromFile(
-    const char* model_path);
-
-// Destroys the model instance.
-TFL_CAPI_EXPORT extern void TfLiteModelDelete(TfLiteModel* model);
-
-// --------------------------------------------------------------------------
-// TfLiteInterpreterOptions allows customized interpreter configuration.
-typedef struct TfLiteInterpreterOptions TfLiteInterpreterOptions;
-
-// Returns a new interpreter options instances.
-TFL_CAPI_EXPORT extern TfLiteInterpreterOptions*
-TfLiteInterpreterOptionsCreate();
-
-// Destroys the interpreter options instance.
-TFL_CAPI_EXPORT extern void TfLiteInterpreterOptionsDelete(
-    TfLiteInterpreterOptions* options);
-
-// Sets the number of CPU threads to use for the interpreter.
-TFL_CAPI_EXPORT extern void TfLiteInterpreterOptionsSetNumThreads(
-    TfLiteInterpreterOptions* options, int32_t num_threads);
-
-// Adds a delegate to be applied during `TfLiteInterpreter` creation.
-//
-// If delegate application fails, interpreter creation will also fail with an
-// associated error logged.
-//
-// NOTE: The caller retains ownership of the delegate and should ensure that it
-// remains valid for the duration of any created interpreter's lifetime.
-TFL_CAPI_EXPORT extern void TfLiteInterpreterOptionsAddDelegate(
-    TfLiteInterpreterOptions* options, TfLiteDelegate* delegate);
-
-// Sets a custom error reporter for interpreter execution.
-//
-// * `reporter` takes the provided `user_data` object, as well as a C-style
-//   format string and arg list (see also vprintf).
-// * `user_data` is optional. If provided, it is owned by the client and must
-//   remain valid for the duration of the interpreter lifetime.
-TFL_CAPI_EXPORT extern void TfLiteInterpreterOptionsSetErrorReporter(
-    TfLiteInterpreterOptions* options,
-    void (*reporter)(void* user_data, const char* format, va_list args),
-    void* user_data);
-
-// --------------------------------------------------------------------------
-// TfLiteInterpreter provides inference from a provided model.
-typedef struct TfLiteInterpreter TfLiteInterpreter;
-
-// Returns a new interpreter using the provided model and options, or null on
-// failure.
-//
-// * `model` must be a valid model instance. The caller retains ownership of the
-//   object, and can destroy it immediately after creating the interpreter; the
-//   interpreter will maintain its own reference to the underlying model data.
-// * `optional_options` may be null. The caller retains ownership of the object,
-//   and can safely destroy it immediately after creating the interpreter.
-//
-// NOTE: The client *must* explicitly allocate tensors before attempting to
-// access input tensor data or invoke the interpreter.
-TFL_CAPI_EXPORT extern TfLiteInterpreter* TfLiteInterpreterCreate(
-    const TfLiteModel* model, const TfLiteInterpreterOptions* optional_options);
-
-// Destroys the interpreter.
-TFL_CAPI_EXPORT extern void TfLiteInterpreterDelete(
-    TfLiteInterpreter* interpreter);
-
-// Returns the number of input tensors associated with the model.
-TFL_CAPI_EXPORT extern int32_t TfLiteInterpreterGetInputTensorCount(
-    const TfLiteInterpreter* interpreter);
-
-// Returns the tensor associated with the input index.
-// REQUIRES: 0 <= input_index < TfLiteInterpreterGetInputTensorCount(tensor)
-TFL_CAPI_EXPORT extern TfLiteTensor* TfLiteInterpreterGetInputTensor(
-    const TfLiteInterpreter* interpreter, int32_t input_index);
-
-// Resizes the specified input tensor.
-//
-// NOTE: After a resize, the client *must* explicitly allocate tensors before
-// attempting to access the resized tensor data or invoke the interpreter.
-// REQUIRES: 0 <= input_index < TfLiteInterpreterGetInputTensorCount(tensor)
-TFL_CAPI_EXPORT extern TfLiteStatus TfLiteInterpreterResizeInputTensor(
-    TfLiteInterpreter* interpreter, int32_t input_index, const int* input_dims,
-    int32_t input_dims_size);
-
-// Updates allocations for all tensors, resizing dependent tensors using the
-// specified input tensor dimensionality.
-//
-// This is a relatively expensive operation, and need only be called after
-// creating the graph and/or resizing any inputs.
-TFL_CAPI_EXPORT extern TfLiteStatus TfLiteInterpreterAllocateTensors(
-    TfLiteInterpreter* interpreter);
-
-// Runs inference for the loaded graph.
-//
-// NOTE: It is possible that the interpreter is not in a ready state to
-// evaluate (e.g., if a ResizeInputTensor() has been performed without a call to
-// AllocateTensors()).
-TFL_CAPI_EXPORT extern TfLiteStatus TfLiteInterpreterInvoke(
-    TfLiteInterpreter* interpreter);
-
-// Returns the number of output tensors associated with the model.
-TFL_CAPI_EXPORT extern int32_t TfLiteInterpreterGetOutputTensorCount(
-    const TfLiteInterpreter* interpreter);
-
-// Returns the tensor associated with the output index.
-// REQUIRES: 0 <= output_index < TfLiteInterpreterGetOutputTensorCount(tensor)
-//
-// NOTE: The shape and underlying data buffer for output tensors may be not
-// be available until after the output tensor has been both sized and allocated.
-// In general, best practice is to interact with the output tensor *after*
-// calling TfLiteInterpreterInvoke().
-TFL_CAPI_EXPORT extern const TfLiteTensor* TfLiteInterpreterGetOutputTensor(
-    const TfLiteInterpreter* interpreter, int32_t output_index);
-
-// --------------------------------------------------------------------------
-// TfLiteTensor wraps data associated with a graph tensor.
-//
-// Note that, while the TfLiteTensor struct is not currently opaque, and its
-// fields can be accessed directly, these methods are still convenient for
-// language bindings. In the future the tensor struct will likely be made opaque
-// in the public API.
-
-// Returns the type of a tensor element.
-TFL_CAPI_EXPORT extern TfLiteType TfLiteTensorType(const TfLiteTensor* tensor);
-
-// Returns the number of dimensions that the tensor has.
-TFL_CAPI_EXPORT extern int32_t TfLiteTensorNumDims(const TfLiteTensor* tensor);
-
-// Returns the length of the tensor in the "dim_index" dimension.
-// REQUIRES: 0 <= dim_index < TFLiteTensorNumDims(tensor)
-TFL_CAPI_EXPORT extern int32_t TfLiteTensorDim(const TfLiteTensor* tensor,
-                                               int32_t dim_index);
-
-// Returns the size of the underlying data in bytes.
-TFL_CAPI_EXPORT extern size_t TfLiteTensorByteSize(const TfLiteTensor* tensor);
-
-// Returns a pointer to the underlying data buffer.
-//
-// NOTE: The result may be null if tensors have not yet been allocated, e.g.,
-// if the Tensor has just been created or resized and `TfLiteAllocateTensors()`
-// has yet to be called, or if the output tensor is dynamically sized and the
-// interpreter hasn't been invoked.
-TFL_CAPI_EXPORT extern void* TfLiteTensorData(const TfLiteTensor* tensor);
-
-// Returns the (null-terminated) name of the tensor.
-TFL_CAPI_EXPORT extern const char* TfLiteTensorName(const TfLiteTensor* tensor);
-
-// Returns the parameters for asymmetric quantization. The quantization
-// parameters are only valid when the tensor type is `kTfLiteUInt8` and the
-// `scale != 0`. Quantized values can be converted back to float using:
-//    real_value = scale * (quantized_value - zero_point);
-TFL_CAPI_EXPORT extern TfLiteQuantizationParams TfLiteTensorQuantizationParams(
-    const TfLiteTensor* tensor);
-
-// Copies from the provided input buffer into the tensor's buffer.
-// REQUIRES: input_data_size == TfLiteTensorByteSize(tensor)
-TFL_CAPI_EXPORT extern TfLiteStatus TfLiteTensorCopyFromBuffer(
-    TfLiteTensor* tensor, const void* input_data, size_t input_data_size);
-
-// Copies to the provided output buffer from the tensor's buffer.
-// REQUIRES: output_data_size == TfLiteTensorByteSize(tensor)
-TFL_CAPI_EXPORT extern TfLiteStatus TfLiteTensorCopyToBuffer(
-    const TfLiteTensor* output_tensor, void* output_data,
-    size_t output_data_size);
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-
-#endif  // TENSORFLOW_LITE_C_C_API_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/c_api_experimental.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/c_api_experimental.h
deleted file mode 100644
index bfbdd9c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/c_api_experimental.h
+++ /dev/null
@@ -1,126 +0,0 @@
-/* Copyright 2018 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_C_C_API_EXPERIMENTAL_H_
-#define TENSORFLOW_LITE_C_C_API_EXPERIMENTAL_H_
-
-#include "tensorflow/lite/builtin_ops.h"
-#include "tensorflow/lite/c/c_api.h"
-#include "tensorflow/lite/c/common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-/// Resets all variable tensors to zero.
-///
-/// WARNING: This is an experimental API and subject to change.
-TFL_CAPI_EXPORT extern TfLiteStatus TfLiteInterpreterResetVariableTensors(
-    TfLiteInterpreter* interpreter);
-
-/// Adds an op registration for a builtin operator.
-///
-/// Op registrations are used to map ops referenced in the flatbuffer model
-/// to executable function pointers (`TfLiteRegistration`s).
-///
-/// NOTE: The interpreter will make a shallow copy of `registration` internally,
-/// so the caller should ensure that its contents (function pointers, etc...)
-/// remain valid for the duration of the interpreter's lifetime. A common
-/// practice is making the provided `TfLiteRegistration` instance static.
-///
-/// Code that uses this function should NOT call
-/// `TfLiteInterpreterOptionsSetOpResolver' on the same options object.
-///
-/// WARNING: This is an experimental API and subject to change.
-TFL_CAPI_EXPORT void TfLiteInterpreterOptionsAddBuiltinOp(
-    TfLiteInterpreterOptions* options, TfLiteBuiltinOperator op,
-    const TfLiteRegistration* registration, int32_t min_version,
-    int32_t max_version);
-
-/// Adds an op registration for a custom operator.
-///
-/// Op registrations are used to map ops referenced in the flatbuffer model
-/// to executable function pointers (`TfLiteRegistration`s).
-///
-/// NOTE: The interpreter will make a shallow copy of `registration` internally,
-/// so the caller should ensure that its contents (function pointers, etc...)
-/// remain valid for the duration of any created interpreter's lifetime. A
-/// common practice is making the provided `TfLiteRegistration` instance static.
-///
-/// Code that uses this function should NOT call
-/// `TfLiteInterpreterOptionsSetOpResolver' on the same options object.
-///
-/// WARNING: This is an experimental API and subject to change.
-TFL_CAPI_EXPORT void TfLiteInterpreterOptionsAddCustomOp(
-    TfLiteInterpreterOptions* options, const char* name,
-    const TfLiteRegistration* registration, int32_t min_version,
-    int32_t max_version);
-
-/// Registers callbacks for resolving builtin or custom operators.
-///
-/// The `TfLiteInterpreterOptionsSetOpResolver` function provides an alternative
-/// method for registering builtin ops and/or custom ops, by providing operator
-/// resolver callbacks.  Unlike using `TfLiteInterpreterOptionsAddBuiltinOp`
-/// and/or `TfLiteInterpreterOptionsAddAddCustomOp`, these let you register all
-/// the operators in a single call.
-///
-/// Code that uses this function should NOT call
-/// `TfLiteInterpreterOptionsAddBuiltin' or
-/// `TfLiteInterpreterOptionsAddCustomOp' on the same options object.
-///
-/// WARNING: This is an experimental API and subject to change.
-void TfLiteInterpreterOptionsSetOpResolver(
-    TfLiteInterpreterOptions* options,
-    const TfLiteRegistration* (*find_builtin_op)(void* user_data,
-                                                 TfLiteBuiltinOperator op,
-                                                 int version),
-    const TfLiteRegistration* (*find_custom_op)(void* user_data,
-                                                const char* custom_op,
-                                                int version),
-    void* op_resolver_user_data);
-
-/// Returns a new interpreter using the provided model and options, or null on
-/// failure, where the model uses only the operators explicitly added to the
-/// options.  This is the same as `TFLiteInterpreterCreate` from `c_api.h`,
-/// except that the only operators that are supported are the ones registered
-/// in `options` via calls to `TfLiteInterpreterOptionsSetOpResolver`,
-/// `TfLiteInterpreterOptionsAddBuiltinOp`, and/or
-/// `TfLiteInterpreterOptionsAddCustomOp`.
-///
-/// * `model` must be a valid model instance. The caller retains ownership of
-///   the object, and can destroy it immediately after creating the interpreter;
-///   the interpreter will maintain its own reference to the underlying model
-///   data.
-/// * `options` should not be null. The caller retains ownership of the object,
-///   and can safely destroy it immediately after creating the interpreter.
-///
-/// NOTE: The client *must* explicitly allocate tensors before attempting to
-/// access input tensor data or invoke the interpreter.
-///
-/// WARNING: This is an experimental API and subject to change.
-TFL_CAPI_EXPORT extern TfLiteInterpreter*
-TfLiteInterpreterCreateWithSelectedOps(const TfLiteModel* model,
-                                       const TfLiteInterpreterOptions* options);
-
-/// Enable or disable the NN API for the interpreter (true to enable).
-///
-/// WARNING: This is an experimental API and subject to change.
-TFL_CAPI_EXPORT extern void TfLiteInterpreterOptionsSetUseNNAPI(
-    TfLiteInterpreterOptions* options, bool enable);
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-
-#endif  // TENSORFLOW_LITE_C_C_API_EXPERIMENTAL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/c_api_internal.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/c_api_internal.h
deleted file mode 100644
index ee07e3e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/c_api_internal.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* Copyright 2018 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_C_C_API_INTERNAL_H_
-#define TENSORFLOW_LITE_C_C_API_INTERNAL_H_
-
-#include 
-
-#include 
-#include 
-
-#include "tensorflow/lite/builtin_ops.h"
-#include "tensorflow/lite/core/api/error_reporter.h"
-#include "tensorflow/lite/core/api/op_resolver.h"
-#include "tensorflow/lite/interpreter.h"
-#include "tensorflow/lite/model.h"
-#include "tensorflow/lite/mutable_op_resolver.h"
-
-// Internal structures and subroutines used by the C API. These are likely to
-// change and should not be depended on directly by any C API clients.
-//
-// NOTE: This header does not follow C conventions and does not define a C API.
-// It is effectively an (internal) implementation detail of the C API.
-
-struct TfLiteModel {
-  // Sharing is safe as FlatBufferModel is const.
-  std::shared_ptr impl;
-};
-
-// The `TfLiteOpResolver` struct is an abstract callback interface that
-// contains function pointers for callbacks that return a
-// `TfLiteRegistration` given an op code or custom op name. This mechanism is
-// used to map ops referenced in the flatbuffer model to executable function
-// pointers (`TfLiteRegistration`s).
-// This struct mirrors the tflite::OpResolver C++ abstract base class.
-struct TfLiteOpResolverCallbacks {
-  // Opaque data that gets passed down to the callback functions.
-  void* user_data = nullptr;
-
-  // Callback that finds the op registration for a builtin operator by enum
-  // code.  The `user_data` parameter will be set to the
-  // `op_resolver_user_data` value that was passed to
-  // `TfLiteInterpreterOptionsSetOpResolver`.
-  const TfLiteRegistration* (*find_builtin_op)(void* user_data,
-                                               TfLiteBuiltinOperator op,
-                                               int version);
-  // Callback that finds the op registration of a custom operator by op name.
-  // The `user_data` parameter will be set to the `op_resolver_user_data` value
-  // that was passed to `TfLiteInterpreterOptionsSetOpResolver`.
-  const TfLiteRegistration* (*find_custom_op)(void* user_data, const char* op,
-                                              int version);
-};
-
-// This struct mirrors the tflite::ErrorResolver C++ abstract base class.
-struct TfLiteErrorReporterCallback {
-  // Opaque data that gets passed down to the callback function.
-  void* user_data = nullptr;
-
-  // Callback function that reports an error.
-  void (*error_reporter)(void* user_data, const char* format,
-                         va_list args) = nullptr;
-};
-
-struct TfLiteInterpreterOptions {
-  enum {
-    kDefaultNumThreads = -1,
-  };
-  int num_threads = kDefaultNumThreads;
-
-  tflite::MutableOpResolver mutable_op_resolver;
-
-  TfLiteOpResolverCallbacks op_resolver_callbacks = {};
-
-  std::vector delegates;
-
-  TfLiteErrorReporterCallback error_reporter_callback;
-
-  bool use_nnapi = false;
-};
-
-struct TfLiteInterpreter {
-  // Taking a reference to the (const) model data avoids lifetime-related issues
-  // and complexity with the TfLiteModel's existence.
-  std::shared_ptr model;
-
-  // The interpreter does not take ownership of the provided ErrorReporter
-  // instance, so we ensure its validity here. Note that the interpreter may use
-  // the reporter in its destructor, so the reporter should be declared first.
-  std::unique_ptr optional_error_reporter;
-
-  std::unique_ptr impl;
-};
-
-namespace tflite {
-namespace internal {
-
-// This adds the builtin and/or custom operators specified in options in
-// `optional_options` (if any) to `mutable_resolver`, and then returns a newly
-// created TfLiteInterpreter using `mutable_op_resolver` as the default
-// OpResolver, and using any other options in `optional_options`, and using
-// the provided `model`.
-//
-// * `model` must be a valid model instance. The caller retains ownership of the
-//   object, and can destroy it immediately after creating the interpreter; the
-//   interpreter will maintain its own reference to the underlying model data.
-// * `optional_options` may be null. The caller retains ownership of the object,
-//   and can safely destroy it immediately after creating the interpreter.
-// * `mutable_resolver` must not be null. The caller retains ownership of the
-//   MutableOpResolver object, and can safely destroy it immediately after
-//   creating the interpreter.
-//
-// NOTE: The client *must* explicitly allocate tensors before attempting to
-// access input tensor data or invoke the interpreter.
-
-TfLiteInterpreter* InterpreterCreateWithOpResolver(
-    const TfLiteModel* model, const TfLiteInterpreterOptions* optional_options,
-    tflite::MutableOpResolver* mutable_resolver);
-
-}  // namespace internal
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_C_C_API_INTERNAL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/common.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/common.h
deleted file mode 100644
index e04e1a1..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/c/common.h
+++ /dev/null
@@ -1,969 +0,0 @@
-/* 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.
-==============================================================================*/
-
-// This file defines common C types and APIs for implementing operations,
-// delegates and other constructs in TensorFlow Lite. The actual operations and
-// delegates can be defined using C++, but the interface between the interpreter
-// and the operations are C.
-//
-// Summary of abstractions
-// TF_LITE_ENSURE - Self-sufficient error checking
-// TfLiteStatus - Status reporting
-// TfLiteIntArray - stores tensor shapes (dims),
-// TfLiteContext - allows an op to access the tensors
-// TfLiteTensor - tensor (a multidimensional array)
-// TfLiteNode - a single node or operation
-// TfLiteRegistration - the implementation of a conceptual operation.
-// TfLiteDelegate - allows delegation of nodes to alternative backends.
-//
-// Some abstractions in this file are created and managed by Interpreter.
-//
-// NOTE: The order of values in these structs are "semi-ABI stable". New values
-// should be added only to the end of structs and never reordered.
-
-#ifndef TENSORFLOW_LITE_C_COMMON_H_
-#define TENSORFLOW_LITE_C_COMMON_H_
-
-#include 
-#include 
-#include 
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-typedef enum TfLiteStatus {
-  kTfLiteOk = 0,
-
-  // Generally referring to an error in the runtime (i.e. interpreter)
-  kTfLiteError = 1,
-
-  // Generally referring to an error from a TfLiteDelegate itself.
-  kTfLiteDelegateError = 2,
-
-  // Generally referring to an error in applying a delegate due to
-  // incompatibility between runtime and delegate, e.g., this error is returned
-  // when trying to apply a TfLite delegate onto a model graph that's already
-  // immutable.
-  kTfLiteApplicationError = 3
-} TfLiteStatus;
-
-// The list of external context types known to TF Lite. This list exists solely
-// to avoid conflicts and to ensure ops can share the external contexts they
-// need. Access to the external contexts is controlled by one of the
-// corresponding support files.
-typedef enum TfLiteExternalContextType {
-  kTfLiteEigenContext = 0,       // include eigen_support.h to use.
-  kTfLiteGemmLowpContext = 1,    // include gemm_support.h to use.
-  kTfLiteEdgeTpuContext = 2,     // Placeholder for Edge TPU support.
-  kTfLiteCpuBackendContext = 3,  // include cpu_backend_context.h to use.
-  kTfLiteMaxExternalContexts = 4
-} TfLiteExternalContextType;
-
-// Forward declare so dependent structs and methods can reference these types
-// prior to the struct definitions.
-struct TfLiteContext;
-struct TfLiteDelegate;
-struct TfLiteRegistration;
-
-// An external context is a collection of information unrelated to the TF Lite
-// framework, but useful to a subset of the ops. TF Lite knows very little
-// about about the actual contexts, but it keeps a list of them, and is able to
-// refresh them if configurations like the number of recommended threads
-// change.
-typedef struct TfLiteExternalContext {
-  TfLiteExternalContextType type;
-  TfLiteStatus (*Refresh)(struct TfLiteContext* context);
-} TfLiteExternalContext;
-
-#define kTfLiteOptionalTensor (-1)
-
-// Fixed size list of integers. Used for dimensions and inputs/outputs tensor
-// indices
-typedef struct TfLiteIntArray {
-  int size;
-// gcc 6.1+ have a bug where flexible members aren't properly handled
-// https://github.com/google/re2/commit/b94b7cd42e9f02673cd748c1ac1d16db4052514c
-#if (!defined(__clang__) && defined(__GNUC__) && __GNUC__ == 6 && \
-     __GNUC_MINOR__ >= 1) ||                                      \
-    defined(HEXAGON) || (__clang_major__ == 7 && __clang_minor__ == 1)
-  int data[0];
-#else
-  int data[];
-#endif
-} TfLiteIntArray;
-
-// Given the size (number of elements) in a TfLiteIntArray, calculate its size
-// in bytes.
-int TfLiteIntArrayGetSizeInBytes(int size);
-
-#ifndef TF_LITE_STATIC_MEMORY
-// Create a array of a given `size` (uninitialized entries).
-// This returns a pointer, that you must free using TfLiteIntArrayFree().
-TfLiteIntArray* TfLiteIntArrayCreate(int size);
-#endif
-
-// Check if two intarrays are equal. Returns 1 if they are equal, 0 otherwise.
-int TfLiteIntArrayEqual(const TfLiteIntArray* a, const TfLiteIntArray* b);
-
-// Check if an intarray equals an array. Returns 1 if equals, 0 otherwise.
-int TfLiteIntArrayEqualsArray(const TfLiteIntArray* a, int b_size,
-                              const int b_data[]);
-
-#ifndef TF_LITE_STATIC_MEMORY
-// Create a copy of an array passed as `src`.
-// You are expected to free memory with TfLiteIntArrayFree
-TfLiteIntArray* TfLiteIntArrayCopy(const TfLiteIntArray* src);
-
-// Free memory of array `a`.
-void TfLiteIntArrayFree(TfLiteIntArray* a);
-#endif  // TF_LITE_STATIC_MEMORY
-
-// Fixed size list of floats. Used for per-channel quantization.
-typedef struct TfLiteFloatArray {
-  int size;
-// gcc 6.1+ have a bug where flexible members aren't properly handled
-// https://github.com/google/re2/commit/b94b7cd42e9f02673cd748c1ac1d16db4052514c
-// This also applies to the toolchain used for Qualcomm Hexagon DSPs.
-#if !defined(__clang__) && defined(__GNUC__) && __GNUC__ == 6 && \
-    __GNUC_MINOR__ >= 1
-  float data[0];
-#else
-  float data[];
-#endif
-} TfLiteFloatArray;
-
-// Given the size (number of elements) in a TfLiteFloatArray, calculate its size
-// in bytes.
-int TfLiteFloatArrayGetSizeInBytes(int size);
-
-#ifndef TF_LITE_STATIC_MEMORY
-// Create a array of a given `size` (uninitialized entries).
-// This returns a pointer, that you must free using TfLiteFloatArrayFree().
-TfLiteFloatArray* TfLiteFloatArrayCreate(int size);
-
-// Free memory of array `a`.
-void TfLiteFloatArrayFree(TfLiteFloatArray* a);
-#endif  // TF_LITE_STATIC_MEMORY
-
-// Since we must not depend on any libraries, define a minimal subset of
-// error macros while avoiding names that have pre-conceived meanings like
-// assert and check.
-
-// Try to make all reporting calls through TF_LITE_KERNEL_LOG rather than
-// calling the context->ReportError function directly, so that message strings
-// can be stripped out if the binary size needs to be severely optimized.
-#ifndef TF_LITE_STRIP_ERROR_STRINGS
-#define TF_LITE_KERNEL_LOG(context, ...)            \
-  do {                                              \
-    (context)->ReportError((context), __VA_ARGS__); \
-  } while (false)
-
-#define TF_LITE_MAYBE_KERNEL_LOG(context, ...)        \
-  do {                                                \
-    if ((context) != nullptr) {                       \
-      (context)->ReportError((context), __VA_ARGS__); \
-    }                                                 \
-  } while (false)
-#else  // TF_LITE_STRIP_ERROR_STRINGS
-#define TF_LITE_KERNEL_LOG(context, ...)
-#define TF_LITE_MAYBE_KERNEL_LOG(context, ...)
-#endif  // TF_LITE_STRIP_ERROR_STRINGS
-
-// Check whether value is true, and if not return kTfLiteError from
-// the current function (and report the error string msg).
-#define TF_LITE_ENSURE_MSG(context, value, msg)        \
-  do {                                                 \
-    if (!(value)) {                                    \
-      TF_LITE_KERNEL_LOG((context), __FILE__ " " msg); \
-      return kTfLiteError;                             \
-    }                                                  \
-  } while (0)
-
-// Check whether the value `a` is true, and if not return kTfLiteError from
-// the current function, while also reporting the location of the error.
-#define TF_LITE_ENSURE(context, a)                                      \
-  do {                                                                  \
-    if (!(a)) {                                                         \
-      TF_LITE_KERNEL_LOG((context), "%s:%d %s was not true.", __FILE__, \
-                         __LINE__, #a);                                 \
-      return kTfLiteError;                                              \
-    }                                                                   \
-  } while (0)
-
-#define TF_LITE_ENSURE_STATUS(a) \
-  do {                           \
-    const TfLiteStatus s = (a);  \
-    if (s != kTfLiteOk) {        \
-      return s;                  \
-    }                            \
-  } while (0)
-
-// Check whether the value `a == b` is true, and if not return kTfLiteError from
-// the current function, while also reporting the location of the error.
-// `a` and `b` may be evaluated more than once, so no side effects or
-// extremely expensive computations should be done.
-// NOTE: Use TF_LITE_ENSURE_TYPES_EQ if comparing TfLiteTypes.
-#define TF_LITE_ENSURE_EQ(context, a, b)                                   \
-  do {                                                                     \
-    if ((a) != (b)) {                                                      \
-      TF_LITE_KERNEL_LOG((context), "%s:%d %s != %s (%d != %d)", __FILE__, \
-                         __LINE__, #a, #b, (a), (b));                      \
-      return kTfLiteError;                                                 \
-    }                                                                      \
-  } while (0)
-
-#define TF_LITE_ENSURE_TYPES_EQ(context, a, b)                             \
-  do {                                                                     \
-    if ((a) != (b)) {                                                      \
-      TF_LITE_KERNEL_LOG((context), "%s:%d %s != %s (%s != %s)", __FILE__, \
-                         __LINE__, #a, #b, TfLiteTypeGetName(a),           \
-                         TfLiteTypeGetName(b));                            \
-      return kTfLiteError;                                                 \
-    }                                                                      \
-  } while (0)
-
-#define TF_LITE_ENSURE_NEAR(context, a, b, epsilon)                          \
-  do {                                                                       \
-    auto delta = ((a) > (b)) ? ((a) - (b)) : ((b) - (a));                    \
-    if (delta > epsilon) {                                                   \
-      TF_LITE_KERNEL_LOG((context), "%s:%d %s not near %s (%f != %f)",       \
-                         __FILE__, __LINE__, #a, #b, static_cast(a), \
-                         static_cast(b));                            \
-      return kTfLiteError;                                                   \
-    }                                                                        \
-  } while (0)
-
-#define TF_LITE_ENSURE_OK(context, status) \
-  do {                                     \
-    const TfLiteStatus s = (status);       \
-    if ((s) != kTfLiteOk) {                \
-      return s;                            \
-    }                                      \
-  } while (0)
-
-// Define TFL_CAPI_EXPORT macro to export a function properly with a shared
-// library.
-#ifdef SWIG
-#define TFL_CAPI_EXPORT
-#else
-#if defined(_WIN32)
-#ifdef TFL_COMPILE_LIBRARY
-#define TFL_CAPI_EXPORT __declspec(dllexport)
-#else
-#define TFL_CAPI_EXPORT __declspec(dllimport)
-#endif  // TFL_COMPILE_LIBRARY
-#else
-#define TFL_CAPI_EXPORT __attribute__((visibility("default")))
-#endif  // _WIN32
-#endif  // SWIG
-
-// Single-precision complex data type compatible with the C99 definition.
-typedef struct TfLiteComplex64 {
-  float re, im;  // real and imaginary parts, respectively.
-} TfLiteComplex64;
-
-// Double-precision complex data type compatible with the C99 definition.
-typedef struct TfLiteComplex128 {
-  double re, im;  // real and imaginary parts, respectively.
-} TfLiteComplex128;
-
-// Half precision data type compatible with the C99 definition.
-typedef struct TfLiteFloat16 {
-  uint16_t data;
-} TfLiteFloat16;
-
-// Types supported by tensor
-typedef enum {
-  kTfLiteNoType = 0,
-  kTfLiteFloat32 = 1,
-  kTfLiteInt32 = 2,
-  kTfLiteUInt8 = 3,
-  kTfLiteInt64 = 4,
-  kTfLiteString = 5,
-  kTfLiteBool = 6,
-  kTfLiteInt16 = 7,
-  kTfLiteComplex64 = 8,
-  kTfLiteInt8 = 9,
-  kTfLiteFloat16 = 10,
-  kTfLiteFloat64 = 11,
-  kTfLiteComplex128 = 12,
-} TfLiteType;
-
-// Return the name of a given type, for error reporting purposes.
-const char* TfLiteTypeGetName(TfLiteType type);
-
-// SupportedQuantizationTypes.
-typedef enum TfLiteQuantizationType {
-  // No quantization.
-  kTfLiteNoQuantization = 0,
-  // Affine quantization (with support for per-channel quantization).
-  // Corresponds to TfLiteAffineQuantization.
-  kTfLiteAffineQuantization = 1,
-} TfLiteQuantizationType;
-
-// Structure specifying the quantization used by the tensor, if-any.
-typedef struct TfLiteQuantization {
-  // The type of quantization held by params.
-  TfLiteQuantizationType type;
-  // Holds a reference to one of the quantization param structures specified
-  // below.
-  void* params;
-} TfLiteQuantization;
-
-// Legacy. Will be deprecated in favor of TfLiteAffineQuantization.
-// If per-layer quantization is specified this field will still be populated in
-// addition to TfLiteAffineQuantization.
-// Parameters for asymmetric quantization. Quantized values can be converted
-// back to float using:
-//     real_value = scale * (quantized_value - zero_point)
-typedef struct TfLiteQuantizationParams {
-  float scale;
-  int32_t zero_point;
-} TfLiteQuantizationParams;
-
-// Parameters for asymmetric quantization across a dimension (i.e per output
-// channel quantization).
-// quantized_dimension specifies which dimension the scales and zero_points
-// correspond to.
-// For a particular value in quantized_dimension, quantized values can be
-// converted back to float using:
-//     real_value = scale * (quantized_value - zero_point)
-typedef struct TfLiteAffineQuantization {
-  TfLiteFloatArray* scale;
-  TfLiteIntArray* zero_point;
-  int32_t quantized_dimension;
-} TfLiteAffineQuantization;
-
-/* A union of pointers that points to memory for a given tensor. */
-typedef union TfLitePtrUnion {
-  /* Do not access these members directly, if possible, use
-   * GetTensorData(tensor) instead, otherwise only access .data, as other
-   * members are deprecated. */
-  int32_t* i32;
-  int64_t* i64;
-  float* f;
-  TfLiteFloat16* f16;
-  double* f64;
-  char* raw;
-  const char* raw_const;
-  uint8_t* uint8;
-  bool* b;
-  int16_t* i16;
-  TfLiteComplex64* c64;
-  TfLiteComplex128* c128;
-  int8_t* int8;
-  /* Only use this member. */
-  void* data;
-} TfLitePtrUnion;
-
-// Memory allocation strategies.
-//  * kTfLiteMmapRo: Read-only memory-mapped data, or data externally allocated.
-//  * kTfLiteArenaRw: Arena allocated with no guarantees about persistence,
-//        and available during eval.
-//  * kTfLiteArenaRwPersistent: Arena allocated but persistent across eval, and
-//        only available during eval.
-//  * kTfLiteDynamic: Allocated during eval, or for string tensors.
-//  * kTfLitePersistentRo: Allocated and populated during prepare. This is
-//        useful for tensors that can be computed during prepare and treated
-//        as constant inputs for downstream ops (also in prepare).
-//  * kTfLiteCustom: Custom memory allocation provided by the user. See
-//        TfLiteCustomAllocation below.
-typedef enum TfLiteAllocationType {
-  kTfLiteMemNone = 0,
-  kTfLiteMmapRo,
-  kTfLiteArenaRw,
-  kTfLiteArenaRwPersistent,
-  kTfLiteDynamic,
-  kTfLitePersistentRo,
-  kTfLiteCustom,
-} TfLiteAllocationType;
-
-// The delegates should use zero or positive integers to represent handles.
-// -1 is reserved from unallocated status.
-typedef int TfLiteBufferHandle;
-enum {
-  kTfLiteNullBufferHandle = -1,
-};
-
-// Storage format of each dimension in a sparse tensor.
-typedef enum TfLiteDimensionType {
-  kTfLiteDimDense = 0,
-  kTfLiteDimSparseCSR,
-} TfLiteDimensionType;
-
-// Metadata to encode each dimension in a sparse tensor.
-typedef struct TfLiteDimensionMetadata {
-  TfLiteDimensionType format;
-  int dense_size;
-  TfLiteIntArray* array_segments;
-  TfLiteIntArray* array_indices;
-} TfLiteDimensionMetadata;
-
-// Parameters used to encode a sparse tensor. For detailed explanation of each
-// field please refer to lite/schema/schema.fbs.
-typedef struct TfLiteSparsity {
-  TfLiteIntArray* traversal_order;
-  TfLiteIntArray* block_map;
-  TfLiteDimensionMetadata* dim_metadata;
-  int dim_metadata_size;
-} TfLiteSparsity;
-
-// Defines a custom memory allocation not owned by the runtime.
-// `data` should be aligned to kDefaultTensorAlignment defined in
-// lite/util.h. (Currently 64 bytes)
-// NOTE: See Interpreter.SetCustomAllocationForTensor for details on usage.
-typedef struct TfLiteCustomAllocation {
-  void* data;
-  size_t bytes;
-} TfLiteCustomAllocation;
-
-// A tensor in the interpreter system which is a wrapper around a buffer of
-// data including a dimensionality (or NULL if not currently defined).
-#ifndef TF_LITE_STATIC_MEMORY
-typedef struct TfLiteTensor {
-  // The data type specification for data stored in `data`. This affects
-  // what member of `data` union should be used.
-  TfLiteType type;
-  // A union of data pointers. The appropriate type should be used for a typed
-  // tensor based on `type`.
-  TfLitePtrUnion data;
-  // A pointer to a structure representing the dimensionality interpretation
-  // that the buffer should have. NOTE: the product of elements of `dims`
-  // and the element datatype size should be equal to `bytes` below.
-  TfLiteIntArray* dims;
-  // Quantization information.
-  TfLiteQuantizationParams params;
-  // How memory is mapped
-  //  kTfLiteMmapRo: Memory mapped read only.
-  //  i.e. weights
-  //  kTfLiteArenaRw: Arena allocated read write memory
-  //  (i.e. temporaries, outputs).
-  TfLiteAllocationType allocation_type;
-  // The number of bytes required to store the data of this Tensor. I.e.
-  // (bytes of each element) * dims[0] * ... * dims[n-1].  For example, if
-  // type is kTfLiteFloat32 and dims = {3, 2} then
-  // bytes = sizeof(float) * 3 * 2 = 4 * 3 * 2 = 24.
-  size_t bytes;
-
-  // An opaque pointer to a tflite::MMapAllocation
-  const void* allocation;
-
-  // Null-terminated name of this tensor.
-  const char* name;
-
-  // The delegate which knows how to handle `buffer_handle`.
-  // WARNING: This is an experimental interface that is subject to change.
-  struct TfLiteDelegate* delegate;
-
-  // An integer buffer handle that can be handled by `delegate`.
-  // The value is valid only when delegate is not null.
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteBufferHandle buffer_handle;
-
-  // If the delegate uses its own buffer (e.g. GPU memory), the delegate is
-  // responsible to set data_is_stale to true.
-  // `delegate->CopyFromBufferHandle` can be called to copy the data from
-  // delegate buffer.
-  // WARNING: This is an // experimental interface that is subject to change.
-  bool data_is_stale;
-
-  // True if the tensor is a variable.
-  bool is_variable;
-
-  // Quantization information. Replaces params field above.
-  TfLiteQuantization quantization;
-
-  // Parameters used to encode a sparse tensor.
-  // This is optional. The field is NULL if a tensor is dense.
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteSparsity* sparsity;
-
-  // Optional. Encodes shapes with unknown dimensions with -1. This field is
-  // only populated when unknown dimensions exist in a read-write tensor (i.e.
-  // an input or output tensor). (e.g.  `dims` contains [1, 1, 1, 3] and
-  // `dims_signature` contains [1, -1, -1, 3]).
-  const TfLiteIntArray* dims_signature;
-} TfLiteTensor;
-
-// A structure representing an instance of a node.
-// This structure only exhibits the inputs, outputs and user defined data, not
-// other features like the type.
-typedef struct TfLiteNode {
-  // Inputs to this node expressed as indices into the simulator's tensors.
-  TfLiteIntArray* inputs;
-
-  // Outputs to this node expressed as indices into the simulator's tensors.
-  TfLiteIntArray* outputs;
-
-  // intermediate tensors to this node expressed as indices into the simulator's
-  // tensors.
-  TfLiteIntArray* intermediates;
-
-  // Temporary tensors uses during the computations. This usually contains no
-  // tensors, but ops are allowed to change that if they need scratch space of
-  // any sort.
-  TfLiteIntArray* temporaries;
-
-  // Opaque data provided by the node implementer through `Registration.init`.
-  void* user_data;
-
-  // Opaque data provided to the node if the node is a builtin. This is usually
-  // a structure defined in builtin_op_data.h
-  void* builtin_data;
-
-  // Custom initial data. This is the opaque data provided in the flatbuffer.
-  // WARNING: This is an experimental interface that is subject to change.
-  const void* custom_initial_data;
-  int custom_initial_data_size;
-
-  // The pointer to the delegate. This is non-null only when the node is
-  // created by calling `interpreter.ModifyGraphWithDelegate`.
-  // WARNING: This is an experimental interface that is subject to change.
-  struct TfLiteDelegate* delegate;
-} TfLiteNode;
-#else  // defined(TF_LITE_STATIC_MEMORY)?
-// NOTE: This flag is opt-in only at compile time.
-//
-// Specific reduced TfLiteTensor struct for TF Micro runtime. This struct
-// contains only the minimum fields required to initialize and prepare a micro
-// inference graph. The fields in this struct have been ordered from
-// largest-to-smallest for optimal struct sizeof.
-//
-// This struct does not use:
-// - allocation
-// - buffer_handle
-// - data_is_stale
-// - delegate
-// - dims_signature
-// - name
-// - sparsity
-typedef struct TfLiteTensor {
-  // TODO(b/155784997): Consider consolidating these quantization fields:
-  // Quantization information. Replaces params field above.
-  TfLiteQuantization quantization;
-
-  // Quantization information.
-  TfLiteQuantizationParams params;
-
-  // A union of data pointers. The appropriate type should be used for a typed
-  // tensor based on `type`.
-  TfLitePtrUnion data;
-
-  // A pointer to a structure representing the dimensionality interpretation
-  // that the buffer should have. NOTE: the product of elements of `dims`
-  // and the element datatype size should be equal to `bytes` below.
-  TfLiteIntArray* dims;
-
-  // The number of bytes required to store the data of this Tensor. I.e.
-  // (bytes of each element) * dims[0] * ... * dims[n-1].  For example, if
-  // type is kTfLiteFloat32 and dims = {3, 2} then
-  // bytes = sizeof(float) * 3 * 2 = 4 * 3 * 2 = 24.
-  size_t bytes;
-
-  // The data type specification for data stored in `data`. This affects
-  // what member of `data` union should be used.
-  TfLiteType type;
-
-  // How memory is mapped
-  //  kTfLiteMmapRo: Memory mapped read only.
-  //  i.e. weights
-  //  kTfLiteArenaRw: Arena allocated read write memory
-  //  (i.e. temporaries, outputs).
-  TfLiteAllocationType allocation_type;
-
-  // True if the tensor is a variable.
-  bool is_variable;
-} TfLiteTensor;
-
-// Specific reduced TfLiteNode struct for TF Micro runtime. This struct contains
-// only the minimum fields required to represent a node.
-//
-// This struct does not use:
-// - delegate
-// - intermediates
-// - temporaries
-typedef struct TfLiteNode {
-  // Inputs to this node expressed as indices into the simulator's tensors.
-  TfLiteIntArray* inputs;
-
-  // Outputs to this node expressed as indices into the simulator's tensors.
-  TfLiteIntArray* outputs;
-
-  // Opaque data provided by the node implementer through `Registration.init`.
-  void* user_data;
-
-  // Opaque data provided to the node if the node is a builtin. This is usually
-  // a structure defined in builtin_op_data.h
-  void* builtin_data;
-
-  // Custom initial data. This is the opaque data provided in the flatbuffer.
-  // WARNING: This is an experimental interface that is subject to change.
-  const void* custom_initial_data;
-  int custom_initial_data_size;
-} TfLiteNode;
-#endif  // TF_LITE_STATIC_MEMORY
-
-// Light-weight tensor struct for TF Micro runtime. Provides the minimal amount
-// of information required for a kernel to run during TfLiteRegistration::Eval.
-// TODO(b/160955687): Move this field into TF_LITE_STATIC_MEMORY when TFLM
-// builds with this flag by default internally.
-typedef struct TfLiteEvalTensor {
-  // A union of data pointers. The appropriate type should be used for a typed
-  // tensor based on `type`.
-  TfLitePtrUnion data;
-
-  // A pointer to a structure representing the dimensionality interpretation
-  // that the buffer should have.
-  TfLiteIntArray* dims;
-
-  // The data type specification for data stored in `data`. This affects
-  // what member of `data` union should be used.
-  TfLiteType type;
-} TfLiteEvalTensor;
-
-#ifndef TF_LITE_STATIC_MEMORY
-// Free data memory of tensor `t`.
-void TfLiteTensorDataFree(TfLiteTensor* t);
-
-// Free quantization data.
-void TfLiteQuantizationFree(TfLiteQuantization* quantization);
-
-// Free sparsity parameters.
-void TfLiteSparsityFree(TfLiteSparsity* sparsity);
-
-// Free memory of tensor `t`.
-void TfLiteTensorFree(TfLiteTensor* t);
-
-// Set all of a tensor's fields (and free any previously allocated data).
-void TfLiteTensorReset(TfLiteType type, const char* name, TfLiteIntArray* dims,
-                       TfLiteQuantizationParams quantization, char* buffer,
-                       size_t size, TfLiteAllocationType allocation_type,
-                       const void* allocation, bool is_variable,
-                       TfLiteTensor* tensor);
-
-// Resize the allocated data of a (dynamic) tensor. Tensors with allocation
-// types other than kTfLiteDynamic will be ignored.
-void TfLiteTensorRealloc(size_t num_bytes, TfLiteTensor* tensor);
-#endif  // TF_LITE_STATIC_MEMORY
-
-// WARNING: This is an experimental interface that is subject to change.
-//
-// Currently, TfLiteDelegateParams has to be allocated in a way that it's
-// trivially destructable. It will be stored as `builtin_data` field in
-// `TfLiteNode` of the delegate node.
-//
-// See also the `CreateDelegateParams` function in `interpreter.cc` details.
-typedef struct TfLiteDelegateParams {
-  struct TfLiteDelegate* delegate;
-  TfLiteIntArray* nodes_to_replace;
-  TfLiteIntArray* input_tensors;
-  TfLiteIntArray* output_tensors;
-} TfLiteDelegateParams;
-
-typedef struct TfLiteContext {
-  // Number of tensors in the context.
-  size_t tensors_size;
-
-  // The execution plan contains a list of the node indices in execution
-  // order. execution_plan->size is the current number of nodes. And,
-  // execution_plan->data[0] is the first node that needs to be run.
-  // TfLiteDelegates can traverse the current execution plan by iterating
-  // through each member of this array and using GetNodeAndRegistration() to
-  // access details about a node. i.e.
-  // TfLiteIntArray* execution_plan;
-  // TF_LITE_ENSURE_STATUS(context->GetExecutionPlan(context, &execution_plan));
-  // for (int exec_index = 0; exec_index < execution_plan->size; exec_index++) {
-  //    int node_index = execution_plan->data[exec_index];
-  //    TfLiteNode* node;
-  //    TfLiteRegistration* reg;
-  //    context->GetNodeAndRegistration(context, node_index, &node, ®);
-  // }
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteStatus (*GetExecutionPlan)(struct TfLiteContext* context,
-                                   TfLiteIntArray** execution_plan);
-
-  // An array of tensors in the interpreter context (of length `tensors_size`)
-  TfLiteTensor* tensors;
-
-  // opaque full context ptr (an opaque c++ data structure)
-  void* impl_;
-
-  // Request memory pointer be resized. Updates dimensions on the tensor.
-  // NOTE: ResizeTensor takes ownership of newSize.
-  TfLiteStatus (*ResizeTensor)(struct TfLiteContext*, TfLiteTensor* tensor,
-                               TfLiteIntArray* new_size);
-  // Request that an error be reported with format string msg.
-  void (*ReportError)(struct TfLiteContext*, const char* msg, ...);
-
-  // Add `tensors_to_add` tensors, preserving pre-existing Tensor entries.  If
-  // non-null, the value pointed to by `first_new_tensor_index` will be set to
-  // the index of the first new tensor.
-  TfLiteStatus (*AddTensors)(struct TfLiteContext*, int tensors_to_add,
-                             int* first_new_tensor_index);
-
-  // Get a Tensor node by node_index.
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteStatus (*GetNodeAndRegistration)(
-      struct TfLiteContext*, int node_index, TfLiteNode** node,
-      struct TfLiteRegistration** registration);
-
-  // Replace ops with one or more stub delegate operations. This function
-  // does not take ownership of `nodes_to_replace`.
-  TfLiteStatus (*ReplaceNodeSubsetsWithDelegateKernels)(
-      struct TfLiteContext*, struct TfLiteRegistration registration,
-      const TfLiteIntArray* nodes_to_replace, struct TfLiteDelegate* delegate);
-
-  // Number of threads that are recommended to subsystems like gemmlowp and
-  // eigen.
-  int recommended_num_threads;
-
-  // Access external contexts by type.
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteExternalContext* (*GetExternalContext)(struct TfLiteContext*,
-                                               TfLiteExternalContextType);
-  // Set the value of a external context. Does not take ownership of the
-  // pointer.
-  // WARNING: This is an experimental interface that is subject to change.
-  void (*SetExternalContext)(struct TfLiteContext*, TfLiteExternalContextType,
-                             TfLiteExternalContext*);
-
-  // Flag for allowing float16 precision for FP32 calculation.
-  // default: false.
-  // WARNING: This is an experimental API and subject to change.
-  bool allow_fp32_relax_to_fp16;
-
-  // Pointer to the op-level profiler, if set; nullptr otherwise.
-  void* profiler;
-
-  // Allocate persistent buffer which has the same life time as the interpreter.
-  // Returns nullptr on failure.
-  // The memory is allocated from heap for TFL, and from tail in TFLM.
-  // This method is only available in Init or Prepare stage.
-  // WARNING: This is an experimental interface that is subject to change.
-  void* (*AllocatePersistentBuffer)(struct TfLiteContext* ctx, size_t bytes);
-
-  // Allocate a buffer which will be deallocated right after invoke phase.
-  // The memory is allocated from heap in TFL, and from volatile arena in TFLM.
-  // This method is only available in invoke stage.
-  // NOTE: If possible use RequestScratchBufferInArena method to avoid memory
-  // allocation during inference time.
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteStatus (*AllocateBufferForEval)(struct TfLiteContext* ctx, size_t bytes,
-                                        void** ptr);
-
-  // Request a scratch buffer in the arena through static memory planning.
-  // This method is only available in Prepare stage and the buffer is allocated
-  // by the interpreter between Prepare and Eval stage. In Eval stage,
-  // GetScratchBuffer API can be used to fetch the address.
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteStatus (*RequestScratchBufferInArena)(struct TfLiteContext* ctx,
-                                              size_t bytes, int* buffer_idx);
-
-  // Get the scratch buffer pointer.
-  // This method is only available in Eval stage.
-  // WARNING: This is an experimental interface that is subject to change.
-  void* (*GetScratchBuffer)(struct TfLiteContext* ctx, int buffer_idx);
-
-  // Resize the memory pointer of the `tensor`. This method behaves the same as
-  // `ResizeTensor`, except that it makes a copy of the shape array internally
-  // so the shape array could be deallocated right afterwards.
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteStatus (*ResizeTensorExplicit)(struct TfLiteContext* ctx,
-                                       TfLiteTensor* tensor, int dims,
-                                       const int* shape);
-
-  // This method provides a preview of post-delegation partitioning. Each
-  // TfLiteDelegateParams in the referenced array corresponds to one instance of
-  // the delegate kernel.
-  // Example usage:
-  //
-  // TfLiteIntArray* nodes_to_replace = ...;
-  // TfLiteDelegateParams* params_array;
-  // int num_partitions = 0;
-  // TF_LITE_ENSURE_STATUS(context->PreviewDelegatePartitioning(
-  //    context, delegate, nodes_to_replace, ¶ms_array, &num_partitions));
-  // for (int idx = 0; idx < num_partitions; idx++) {
-  //    const auto& partition_params = params_array[idx];
-  //    ...
-  // }
-  //
-  // NOTE: The context owns the memory referenced by partition_params_array. It
-  // will be cleared with another call to PreviewDelegateParitioning, or after
-  // TfLiteDelegateParams::Prepare returns.
-  //
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteStatus (*PreviewDelegatePartitioning)(
-      struct TfLiteContext* context, const TfLiteIntArray* nodes_to_replace,
-      TfLiteDelegateParams** partition_params_array, int* num_partitions);
-
-  // Returns a TfLiteTensor struct for a given index.
-  // WARNING: This is an experimental interface that is subject to change.
-  // WARNING: This method may not be available on all platforms.
-  TfLiteTensor* (*GetTensor)(const struct TfLiteContext* context,
-                             int tensor_idx);
-
-  // Returns a TfLiteEvalTensor struct for a given index.
-  // WARNING: This is an experimental interface that is subject to change.
-  // WARNING: This method may not be available on all platforms.
-  TfLiteEvalTensor* (*GetEvalTensor)(const struct TfLiteContext* context,
-                                     int tensor_idx);
-} TfLiteContext;
-
-typedef struct TfLiteRegistration {
-  // Initializes the op from serialized data.
-  // If a built-in op:
-  //   `buffer` is the op's params data (TfLiteLSTMParams*).
-  //   `length` is zero.
-  // If custom op:
-  //   `buffer` is the op's `custom_options`.
-  //   `length` is the size of the buffer.
-  //
-  // Returns a type-punned (i.e. void*) opaque data (e.g. a primitive pointer
-  // or an instance of a struct).
-  //
-  // The returned pointer will be stored with the node in the `user_data` field,
-  // accessible within prepare and invoke functions below.
-  // NOTE: if the data is already in the desired format, simply implement this
-  // function to return `nullptr` and implement the free function to be a no-op.
-  void* (*init)(TfLiteContext* context, const char* buffer, size_t length);
-
-  // The pointer `buffer` is the data previously returned by an init invocation.
-  void (*free)(TfLiteContext* context, void* buffer);
-
-  // prepare is called when the inputs this node depends on have been resized.
-  // context->ResizeTensor() can be called to request output tensors to be
-  // resized.
-  //
-  // Returns kTfLiteOk on success.
-  TfLiteStatus (*prepare)(TfLiteContext* context, TfLiteNode* node);
-
-  // Execute the node (should read node->inputs and output to node->outputs).
-  // Returns kTfLiteOk on success.
-  TfLiteStatus (*invoke)(TfLiteContext* context, TfLiteNode* node);
-
-  // profiling_string is called during summarization of profiling information
-  // in order to group executions together. Providing a value here will cause a
-  // given op to appear multiple times is the profiling report. This is
-  // particularly useful for custom ops that can perform significantly
-  // different calculations depending on their `user-data`.
-  const char* (*profiling_string)(const TfLiteContext* context,
-                                  const TfLiteNode* node);
-
-  // Builtin codes. If this kernel refers to a builtin this is the code
-  // of the builtin. This is so we can do marshaling to other frameworks like
-  // NN API.
-  // Note: It is the responsibility of the registration binder to set this
-  // properly.
-  int32_t builtin_code;
-
-  // Custom op name. If the op is a builtin, this will be null.
-  // Note: It is the responsibility of the registration binder to set this
-  // properly.
-  // WARNING: This is an experimental interface that is subject to change.
-  const char* custom_name;
-
-  // The version of the op.
-  // Note: It is the responsibility of the registration binder to set this
-  // properly.
-  int version;
-} TfLiteRegistration;
-
-// The flags used in `TfLiteDelegate`. Note that this is a bitmask, so the
-// values should be 1, 2, 4, 8, ...etc.
-typedef enum TfLiteDelegateFlags {
-  kTfLiteDelegateFlagsNone = 0,
-  // The flag is set if the delegate can handle dynamic sized tensors.
-  // For example, the output shape of a `Resize` op with non-constant shape
-  // can only be inferred when the op is invoked.
-  // In this case, the Delegate is responsible for calling
-  // `SetTensorToDynamic` to mark the tensor as a dynamic tensor, and calling
-  // `ResizeTensor` when invoking the op.
-  //
-  // If the delegate isn't capable to handle dynamic tensors, this flag need
-  // to be set to false.
-  kTfLiteDelegateFlagsAllowDynamicTensors = 1,
-
-  // This flag can be used by delegates (that allow dynamic tensors) to ensure
-  // applicable tensor shapes are automatically propagated in the case of tensor
-  // resizing.
-  // This means that non-dynamic (allocation_type != kTfLiteDynamic) I/O tensors
-  // of a delegate kernel will have correct shapes before its Prepare() method
-  // is called. The runtime leverages TFLite builtin ops in the original
-  // execution plan to propagate shapes.
-  //
-  // A few points to note:
-  // 1. This requires kTfLiteDelegateFlagsAllowDynamicTensors. If that flag is
-  // false, this one is redundant since the delegate kernels are re-initialized
-  // every time tensors are resized.
-  // 2. Enabling this flag adds some overhead to AllocateTensors(), since extra
-  // work is required to prepare the original execution plan.
-  // 3. This flag requires that the original execution plan only have ops with
-  // valid registrations (and not 'dummy' custom ops like with Flex).
-  // WARNING: This feature is experimental and subject to change.
-  kTfLiteDelegateFlagsRequirePropagatedShapes = 2
-} TfLiteDelegateFlags;
-
-// WARNING: This is an experimental interface that is subject to change.
-typedef struct TfLiteDelegate {
-  // Data that delegate needs to identify itself. This data is owned by the
-  // delegate. The delegate is owned in the user code, so the delegate is
-  // responsible for doing this when it is destroyed.
-  void* data_;
-
-  // Invoked by ModifyGraphWithDelegate. This prepare is called, giving the
-  // delegate a view of the current graph through TfLiteContext*. It typically
-  // will look at the nodes and call ReplaceNodeSubsetsWithDelegateKernels()
-  // to ask the TensorFlow lite runtime to create macro-nodes to represent
-  // delegated subgraphs of the original graph.
-  TfLiteStatus (*Prepare)(TfLiteContext* context,
-                          struct TfLiteDelegate* delegate);
-
-  // Copy the data from delegate buffer handle into raw memory of the given
-  // 'tensor'. Note that the delegate is allowed to allocate the raw bytes as
-  // long as it follows the rules for kTfLiteDynamic tensors, in which case this
-  // cannot be null.
-  TfLiteStatus (*CopyFromBufferHandle)(TfLiteContext* context,
-                                       struct TfLiteDelegate* delegate,
-                                       TfLiteBufferHandle buffer_handle,
-                                       TfLiteTensor* tensor);
-
-  // Copy the data from raw memory of the given 'tensor' to delegate buffer
-  // handle. This can be null if the delegate doesn't use its own buffer.
-  TfLiteStatus (*CopyToBufferHandle)(TfLiteContext* context,
-                                     struct TfLiteDelegate* delegate,
-                                     TfLiteBufferHandle buffer_handle,
-                                     TfLiteTensor* tensor);
-
-  // Free the Delegate Buffer Handle. Note: This only frees the handle, but
-  // this doesn't release the underlying resource (e.g. textures). The
-  // resources are either owned by application layer or the delegate.
-  // This can be null if the delegate doesn't use its own buffer.
-  void (*FreeBufferHandle)(TfLiteContext* context,
-                           struct TfLiteDelegate* delegate,
-                           TfLiteBufferHandle* handle);
-
-  // Bitmask flags. See the comments in `TfLiteDelegateFlags`.
-  int64_t flags;
-} TfLiteDelegate;
-
-// Build a 'null' delegate, with all the fields properly set to their default
-// values.
-TfLiteDelegate TfLiteDelegateCreate();
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-#endif  // TENSORFLOW_LITE_C_COMMON_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/context.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/context.h
deleted file mode 100644
index b32e98b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/context.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* Copyright 2017 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.
-==============================================================================*/
-// Compatibility shim for moved header location.
-#ifndef TENSORFLOW_LITE_CONTEXT_H_
-#define TENSORFLOW_LITE_CONTEXT_H_
-
-#include "tensorflow/lite/c/common.h"
-
-#endif  // TENSORFLOW_LITE_CONTEXT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/context_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/context_util.h
deleted file mode 100644
index cc1a2ff..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/context_util.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright 2017 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.
-==============================================================================*/
-// This provides a few C++ helpers that are useful for manipulating C structures
-// in C++.
-#ifndef TENSORFLOW_LITE_CONTEXT_UTIL_H_
-#define TENSORFLOW_LITE_CONTEXT_UTIL_H_
-
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-
-// Provide a range iterable wrapper for TfLiteIntArray* (C lists that TfLite
-// C api uses. Can't use the google array_view, since we can't depend on even
-// absl for embedded device reasons.
-class TfLiteIntArrayView {
- public:
-  // Construct a view of a TfLiteIntArray*. Note, `int_array` should be non-null
-  // and this view does not take ownership of it.
-  explicit TfLiteIntArrayView(const TfLiteIntArray* int_array)
-      : int_array_(int_array) {}
-
-  TfLiteIntArrayView(const TfLiteIntArrayView&) = default;
-  TfLiteIntArrayView& operator=(const TfLiteIntArrayView& rhs) = default;
-
-  typedef const int* const_iterator;
-  const_iterator begin() const { return int_array_->data; }
-  const_iterator end() const { return &int_array_->data[int_array_->size]; }
-  size_t size() const { return end() - begin(); }
-  int operator[](size_t pos) const { return int_array_->data[pos]; }
-
- private:
-  const TfLiteIntArray* int_array_;
-};
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_CONTEXT_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/error_reporter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/error_reporter.h
deleted file mode 100644
index 05839a6..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/error_reporter.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright 2017 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_CORE_API_ERROR_REPORTER_H_
-#define TENSORFLOW_LITE_CORE_API_ERROR_REPORTER_H_
-
-#include 
-
-namespace tflite {
-
-/// A functor that reports error to supporting system. Invoked similar to
-/// printf.
-///
-/// Usage:
-///  ErrorReporter foo;
-///  foo.Report("test %d", 5);
-/// or
-///  va_list args;
-///  foo.Report("test %d", args); // where args is va_list
-///
-/// Subclass ErrorReporter to provide another reporting destination.
-/// For example, if you have a GUI program, you might redirect to a buffer
-/// that drives a GUI error log box.
-class ErrorReporter {
- public:
-  virtual ~ErrorReporter() {}
-  virtual int Report(const char* format, va_list args) = 0;
-  int Report(const char* format, ...);
-  int ReportError(void*, const char* format, ...);
-};
-
-}  // namespace tflite
-
-// You should not make bare calls to the error reporter, instead use the
-// TF_LITE_REPORT_ERROR macro, since this allows message strings to be
-// stripped when the binary size has to be optimized. If you are looking to
-// reduce binary size, define TF_LITE_STRIP_ERROR_STRINGS when compiling and
-// every call will be stubbed out, taking no memory.
-#ifndef TF_LITE_STRIP_ERROR_STRINGS
-#define TF_LITE_REPORT_ERROR(reporter, ...)                             \
-  do {                                                                  \
-    static_cast(reporter)->Report(__VA_ARGS__); \
-  } while (false)
-#else  // TF_LITE_STRIP_ERROR_STRINGS
-#define TF_LITE_REPORT_ERROR(reporter, ...)
-#endif  // TF_LITE_STRIP_ERROR_STRINGS
-
-#endif  // TENSORFLOW_LITE_CORE_API_ERROR_REPORTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/flatbuffer_conversions.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/flatbuffer_conversions.h
deleted file mode 100644
index 1368099..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/flatbuffer_conversions.h
+++ /dev/null
@@ -1,264 +0,0 @@
-/* Copyright 2018 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_CORE_API_FLATBUFFER_CONVERSIONS_H_
-#define TENSORFLOW_LITE_CORE_API_FLATBUFFER_CONVERSIONS_H_
-
-// These functions transform codes and data structures that are defined in the
-// flatbuffer serialization format into in-memory values that are used by the
-// runtime API and interpreter.
-
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/core/api/error_reporter.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-
-// Interface class for builtin data allocations.
-class BuiltinDataAllocator {
- public:
-  virtual void* Allocate(size_t size, size_t alignment_hint) = 0;
-  virtual void Deallocate(void* data) = 0;
-
-  // Allocate a structure, but make sure it is a POD structure that doesn't
-  // require constructors to run. The reason we do this, is that Interpreter's C
-  // extension part will take ownership so destructors  will not be run during
-  // deallocation.
-  template 
-  T* AllocatePOD() {
-    // TODO(b/154346074): Change this to is_trivially_destructible when all
-    // platform targets support that properly.
-    static_assert(std::is_pod::value, "Builtin data structure must be POD.");
-    void* allocated_memory = this->Allocate(sizeof(T), alignof(T));
-    return new (allocated_memory) T();
-  }
-
-  virtual ~BuiltinDataAllocator() {}
-};
-
-// Parse the appropriate data out of the op.
-//
-// This handles builtin data explicitly as there are flatbuffer schemas.
-// If it returns kTfLiteOk, it passes the data out with `builtin_data`. The
-// calling function has to pass in an allocator object, and this allocator
-// will be called to reserve space for the output data. If the calling
-// function's allocator reserves memory on the heap, then it's the calling
-// function's responsibility to free it.
-// If it returns kTfLiteError, `builtin_data` will be `nullptr`.
-TfLiteStatus ParseOpData(const Operator* op, BuiltinOperator op_type,
-                         ErrorReporter* error_reporter,
-                         BuiltinDataAllocator* allocator, void** builtin_data);
-
-// Converts the tensor data type used in the flat buffer to the representation
-// used by the runtime.
-TfLiteStatus ConvertTensorType(TensorType tensor_type, TfLiteType* type,
-                               ErrorReporter* error_reporter);
-
-TfLiteStatus ParseAbs(const Operator* op, ErrorReporter* error_reporter,
-                      BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseAdd(const Operator* op, ErrorReporter* error_reporter,
-                      BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseArgMax(const Operator* op, ErrorReporter* error_reporter,
-                         BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseArgMin(const Operator* op, ErrorReporter* error_reporter,
-                         BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseCeil(const Operator* op, ErrorReporter* error_reporter,
-                       BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseConcatenation(const Operator* op,
-                                ErrorReporter* error_reporter,
-                                BuiltinDataAllocator* allocator,
-                                void** builtin_data);
-
-TfLiteStatus ParseConv2D(const Operator* op, ErrorReporter* error_reporter,
-                         BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseCos(const Operator* op, ErrorReporter* error_reporter,
-                      BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseDepthwiseConv2D(const Operator* op,
-                                  ErrorReporter* error_reporter,
-                                  BuiltinDataAllocator* allocator,
-                                  void** builtin_data);
-
-TfLiteStatus ParseDequantize(const Operator* op, ErrorReporter* error_reporter,
-                             BuiltinDataAllocator* allocator,
-                             void** builtin_data);
-
-TfLiteStatus ParseEqual(const Operator* op, ErrorReporter* error_reporter,
-                        BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseFloor(const Operator* op, ErrorReporter* error_reporter,
-                        BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseFullyConnected(const Operator* op,
-                                 ErrorReporter* error_reporter,
-                                 BuiltinDataAllocator* allocator,
-                                 void** builtin_data);
-
-TfLiteStatus ParseGreater(const Operator* op, ErrorReporter* error_reporter,
-                          BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseGreaterEqual(const Operator* op,
-                               ErrorReporter* error_reporter,
-                               BuiltinDataAllocator* allocator,
-                               void** builtin_data);
-
-TfLiteStatus ParseHardSwish(const Operator* op, ErrorReporter* error_reporter,
-                            BuiltinDataAllocator* allocator,
-                            void** builtin_data);
-
-TfLiteStatus ParseL2Normalization(const Operator* op,
-                                  ErrorReporter* error_reporter,
-                                  BuiltinDataAllocator* allocator,
-                                  void** builtin_data);
-
-TfLiteStatus ParseLess(const Operator* op, ErrorReporter* error_reporter,
-                       BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseLessEqual(const Operator* op, ErrorReporter* error_reporter,
-                            BuiltinDataAllocator* allocator,
-                            void** builtin_data);
-
-TfLiteStatus ParseLog(const Operator* op, ErrorReporter* error_reporter,
-                      BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseLogicalAnd(const Operator* op, ErrorReporter* error_reporter,
-                             BuiltinDataAllocator* allocator,
-                             void** builtin_data);
-
-TfLiteStatus ParseLogicalNot(const Operator* op, ErrorReporter* error_reporter,
-                             BuiltinDataAllocator* allocator,
-                             void** builtin_data);
-
-TfLiteStatus ParseLogicalOr(const Operator* op, ErrorReporter* error_reporter,
-                            BuiltinDataAllocator* allocator,
-                            void** builtin_data);
-
-TfLiteStatus ParseLogistic(const Operator* op, ErrorReporter* error_reporter,
-                           BuiltinDataAllocator* allocator,
-                           void** builtin_data);
-
-TfLiteStatus ParseMaximum(const Operator* op, ErrorReporter* error_reporter,
-                          BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseMinimum(const Operator* op, ErrorReporter* error_reporter,
-                          BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseMul(const Operator* op, ErrorReporter* error_reporter,
-                      BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseNeg(const Operator* op, ErrorReporter* error_reporter,
-                      BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseNotEqual(const Operator* op, ErrorReporter* error_reporter,
-                           BuiltinDataAllocator* allocator,
-                           void** builtin_data);
-
-TfLiteStatus ParsePack(const Operator* op, ErrorReporter* error_reporter,
-                       BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParsePad(const Operator* op, ErrorReporter* error_reporter,
-                      BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParsePadV2(const Operator* op, ErrorReporter* error_reporter,
-                        BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParsePool(const Operator* op, ErrorReporter* error_reporter,
-                       BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParsePrelu(const Operator* op, ErrorReporter* error_reporter,
-                        BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseQuantize(const Operator* op, ErrorReporter* error_reporter,
-                           BuiltinDataAllocator* allocator,
-                           void** builtin_data);
-
-TfLiteStatus ParseReducer(const Operator* op, ErrorReporter* error_reporter,
-                          BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseRelu(const Operator* op, ErrorReporter* error_reporter,
-                       BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseRelu6(const Operator* op, ErrorReporter* error_reporter,
-                        BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseReshape(const Operator* op, ErrorReporter* error_reporter,
-                          BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseResizeBilinear(const Operator* op,
-                                 ErrorReporter* error_reporter,
-                                 BuiltinDataAllocator* allocator,
-                                 void** builtin_data);
-
-TfLiteStatus ParseResizeNearestNeighbor(const Operator* op,
-                                        ErrorReporter* error_reporter,
-                                        BuiltinDataAllocator* allocator,
-                                        void** builtin_data);
-
-TfLiteStatus ParseRound(const Operator* op, ErrorReporter* error_reporter,
-                        BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseRsqrt(const Operator* op, ErrorReporter* error_reporter,
-                        BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseShape(const Operator* op, ErrorReporter* error_reporter,
-                        BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseSin(const Operator* op, ErrorReporter* error_reporter,
-                      BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseSoftmax(const Operator* op, ErrorReporter* error_reporter,
-                          BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseSplit(const Operator* op, ErrorReporter* error_reporter,
-                        BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseSplitV(const Operator* op, ErrorReporter* error_reporter,
-                         BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseSqrt(const Operator* op, ErrorReporter* error_reporter,
-                       BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseSquare(const Operator* op, ErrorReporter* error_reporter,
-                         BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseStridedSlice(const Operator* op,
-                               ErrorReporter* error_reporter,
-                               BuiltinDataAllocator* allocator,
-                               void** builtin_data);
-
-TfLiteStatus ParseSub(const Operator* op, ErrorReporter* error_reporter,
-                      BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseSvdf(const Operator* op, ErrorReporter* error_reporter,
-                       BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseTanh(const Operator* op, ErrorReporter* error_reporter,
-                       BuiltinDataAllocator* allocator, void** builtin_data);
-
-TfLiteStatus ParseUnpack(const Operator* op, ErrorReporter* error_reporter,
-                         BuiltinDataAllocator* allocator, void** builtin_data);
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_CORE_API_FLATBUFFER_CONVERSIONS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/op_resolver.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/op_resolver.h
deleted file mode 100644
index b6a8171..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/op_resolver.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright 2018 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_CORE_API_OP_RESOLVER_H_
-#define TENSORFLOW_LITE_CORE_API_OP_RESOLVER_H_
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/core/api/error_reporter.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-
-/// Abstract interface that returns TfLiteRegistrations given op codes or custom
-/// op names. This is the mechanism that ops being referenced in the flatbuffer
-/// model are mapped to executable function pointers (TfLiteRegistrations).
-class OpResolver {
- public:
-  /// Finds the op registration for a builtin operator by enum code.
-  virtual const TfLiteRegistration* FindOp(tflite::BuiltinOperator op,
-                                           int version) const = 0;
-  /// Finds the op registration of a custom operator by op name.
-  virtual const TfLiteRegistration* FindOp(const char* op,
-                                           int version) const = 0;
-
-  // Returns optional delegates for resolving and handling ops in the flatbuffer
-  // model. This may be used in addition to the standard TfLiteRegistration
-  // lookup for graph resolution.
-  using TfLiteDelegatePtrVector =
-      std::vector>;
-  virtual TfLiteDelegatePtrVector GetDelegates(int num_threads) const {
-    return TfLiteDelegatePtrVector();
-  }
-
-  virtual ~OpResolver() {}
-};
-
-// Handles the logic for converting between an OperatorCode structure extracted
-// from a flatbuffer and information about a registered operator
-// implementation.
-TfLiteStatus GetRegistrationFromOpCode(const OperatorCode* opcode,
-                                       const OpResolver& op_resolver,
-                                       ErrorReporter* error_reporter,
-                                       const TfLiteRegistration** registration);
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_CORE_API_OP_RESOLVER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/profiler.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/profiler.h
deleted file mode 100644
index 897efbe..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/profiler.h
+++ /dev/null
@@ -1,194 +0,0 @@
-/* Copyright 2017 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_CORE_API_PROFILER_H_
-#define TENSORFLOW_LITE_CORE_API_PROFILER_H_
-
-#include 
-
-namespace tflite {
-
-// A simple utility for enabling profiled event tracing in TensorFlow Lite.
-class Profiler {
- public:
-  // As certain Profiler instance might be only interested in certain event
-  // types, we define each event type value to allow a Profiler to use
-  // bitmasking bitwise operations to determine whether an event should be
-  // recorded or not.
-  enum class EventType {
-    // Default event type, the metadata field has no special significance.
-    DEFAULT = 1,
-
-    // The event is an operator invocation and the event_metadata field is the
-    // index of operator node.
-    OPERATOR_INVOKE_EVENT = 2,
-
-    // The event is an invocation for an internal operator of a TFLite delegate.
-    // The event_metadata field is the index of operator node that's specific to
-    // the delegate.
-    DELEGATE_OPERATOR_INVOKE_EVENT = 4,
-
-    // The event is a recording of runtime instrumentation such as the overall
-    // TFLite runtime status, the TFLite delegate status (if a delegate
-    // is applied), and the overall model inference latency etc.
-    // Note, the delegate status and overall status are stored as separate
-    // event_metadata fields. In particular, the delegate status is encoded
-    // as DelegateStatus::full_status().
-    GENERAL_RUNTIME_INSTRUMENTATION_EVENT = 8,
-  };
-
-  virtual ~Profiler() {}
-
-  // Signals the beginning of an event and returns a handle to the profile
-  // event. The `event_metadata1` and `event_metadata2` have different
-  // interpretations based on the actual Profiler instance and the `event_type`.
-  // For example, as for the 'SubgraphAwareProfiler' defined in
-  // lite/core/subgraph.h, when the event_type is OPERATOR_INVOKE_EVENT,
-  // `event_metadata1` represents the index of a TFLite node, and
-  // `event_metadata2` represents the index of the subgraph that this event
-  // comes from.
-  virtual uint32_t BeginEvent(const char* tag, EventType event_type,
-                              int64_t event_metadata1,
-                              int64_t event_metadata2) = 0;
-  // Similar w/ the above, but `event_metadata2` defaults to 0.
-  uint32_t BeginEvent(const char* tag, EventType event_type,
-                      int64_t event_metadata) {
-    return BeginEvent(tag, event_type, event_metadata, /*event_metadata2*/ 0);
-  }
-
-  // Signals an end to the specified profile event with 'event_metadata's, This
-  // is useful when 'event_metadata's are not available when the event begins
-  // or when one wants to overwrite the 'event_metadata's set at the beginning.
-  virtual void EndEvent(uint32_t event_handle, int64_t event_metadata1,
-                        int64_t event_metadata2) {}
-  // Signals an end to the specified profile event.
-  virtual void EndEvent(uint32_t event_handle) = 0;
-
-  // Appends an event of type 'event_type' with 'tag' and 'event_metadata'
-  // which started at 'start' and ended at 'end'
-  // Note:
-  // In cases were ProfileSimmarizer and tensorflow::StatsCalculator are used
-  // they assume the value is in "usec", if in any case subclasses
-  // didn't put usec, then the values are not meaningful.
-  // TODO karimnosseir: Revisit and make the function more clear.
-  void AddEvent(const char* tag, EventType event_type, uint64_t start,
-                uint64_t end, int64_t event_metadata) {
-    AddEvent(tag, event_type, start, end, event_metadata,
-             /*event_metadata2*/ 0);
-  }
-
-  virtual void AddEvent(const char* tag, EventType event_type, uint64_t start,
-                        uint64_t end, int64_t event_metadata1,
-                        int64_t event_metadata2) {}
-
- protected:
-  friend class ScopedProfile;
-};
-
-// Adds a profile event to `profiler` that begins with the construction
-// of the object and ends when the object goes out of scope.
-// The lifetime of tag should be at least the lifetime of `profiler`.
-// `profiler` may be null, in which case nothing is profiled.
-class ScopedProfile {
- public:
-  ScopedProfile(Profiler* profiler, const char* tag,
-                Profiler::EventType event_type = Profiler::EventType::DEFAULT,
-                int64_t event_metadata = 0)
-      : profiler_(profiler), event_handle_(0) {
-    if (profiler) {
-      event_handle_ = profiler_->BeginEvent(tag, event_type, event_metadata);
-    }
-  }
-
-  ~ScopedProfile() {
-    if (profiler_) {
-      profiler_->EndEvent(event_handle_);
-    }
-  }
-
- protected:
-  Profiler* profiler_;
-  uint32_t event_handle_;
-};
-
-class ScopedOperatorProfile : public ScopedProfile {
- public:
-  ScopedOperatorProfile(Profiler* profiler, const char* tag, int node_index)
-      : ScopedProfile(profiler, tag, Profiler::EventType::OPERATOR_INVOKE_EVENT,
-                      static_cast(node_index)) {}
-};
-
-class ScopedDelegateOperatorProfile : public ScopedProfile {
- public:
-  ScopedDelegateOperatorProfile(Profiler* profiler, const char* tag,
-                                int node_index)
-      : ScopedProfile(profiler, tag,
-                      Profiler::EventType::DELEGATE_OPERATOR_INVOKE_EVENT,
-                      static_cast(node_index)) {}
-};
-
-class ScopedRuntimeInstrumentationProfile : public ScopedProfile {
- public:
-  ScopedRuntimeInstrumentationProfile(Profiler* profiler, const char* tag)
-      : ScopedProfile(
-            profiler, tag,
-            Profiler::EventType::GENERAL_RUNTIME_INSTRUMENTATION_EVENT, -1) {}
-
-  void set_runtime_status(int64_t delegate_status, int64_t interpreter_status) {
-    if (profiler_) {
-      delegate_status_ = delegate_status;
-      interpreter_status_ = interpreter_status;
-    }
-  }
-
-  ~ScopedRuntimeInstrumentationProfile() {
-    if (profiler_) {
-      profiler_->EndEvent(event_handle_, delegate_status_, interpreter_status_);
-    }
-  }
-
- private:
-  int64_t delegate_status_;
-  int64_t interpreter_status_;
-};
-
-}  // namespace tflite
-
-#define TFLITE_VARNAME_UNIQ_IMPL(name, ctr) name##ctr
-#define TFLITE_VARNAME_UNIQ(name, ctr) TFLITE_VARNAME_UNIQ_IMPL(name, ctr)
-
-#define TFLITE_SCOPED_TAGGED_DEFAULT_PROFILE(profiler, tag)          \
-  tflite::ScopedProfile TFLITE_VARNAME_UNIQ(_profile_, __COUNTER__)( \
-      (profiler), (tag))
-
-#define TFLITE_SCOPED_TAGGED_OPERATOR_PROFILE(profiler, tag, node_index)     \
-  tflite::ScopedOperatorProfile TFLITE_VARNAME_UNIQ(_profile_, __COUNTER__)( \
-      (profiler), (tag), (node_index))
-
-#define TFLITE_SCOPED_DELEGATE_OPERATOR_PROFILE(profiler, tag, node_index) \
-  tflite::ScopedDelegateOperatorProfile TFLITE_VARNAME_UNIQ(               \
-      _profile_, __COUNTER__)((profiler), (tag), (node_index))
-
-#define TFLITE_ADD_RUNTIME_INSTRUMENTATION_EVENT(                          \
-    profiler, tag, delegate_status, interpreter_status)                    \
-  do {                                                                     \
-    if (!profiler) {                                                       \
-      const auto handle = profiler->BeginEvent(                            \
-          tag, Profiler::EventType::GENERAL_RUNTIME_INSTRUMENTATION_EVENT, \
-          delegate_status, interpreter_status);                            \
-      profiler->EndEvent(handle);                                          \
-    }                                                                      \
-  } while (false);
-
-#endif  // TENSORFLOW_LITE_CORE_API_PROFILER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/tensor_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/tensor_utils.h
deleted file mode 100644
index 9f1cf94..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/tensor_utils.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* 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_CORE_API_TENSOR_UTILS_H_
-#define TENSORFLOW_LITE_CORE_API_TENSOR_UTILS_H_
-
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-
-// Resets a variable tensor to the default value.
-TfLiteStatus ResetVariableTensor(TfLiteTensor* tensor);
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_CORE_API_TENSOR_UTILS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/verifier.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/verifier.h
deleted file mode 100644
index ca1cfb0..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/api/verifier.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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.
-==============================================================================*/
-/// \file
-/// Abstract interface for verifying a model.
-#ifndef TENSORFLOW_LITE_CORE_API_VERIFIER_H_
-#define TENSORFLOW_LITE_CORE_API_VERIFIER_H_
-
-#include "tensorflow/lite/core/api/error_reporter.h"
-
-namespace tflite {
-
-/// Abstract interface that verifies whether a given model is legit.
-/// It facilitates the use-case to verify and build a model without loading it
-/// twice.
-/// (See also "tensorflow/lite/tools/verifier.h".)
-class TfLiteVerifier {
- public:
-  /// Returns true if the model is legit.
-  virtual bool Verify(const char* data, int length,
-                      ErrorReporter* reporter) = 0;
-  virtual ~TfLiteVerifier() {}
-};
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_CORE_API_VERIFIER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/macros.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/macros.h
deleted file mode 100644
index 034ad8d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/macros.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* 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.
-==============================================================================*/
-// This provides utility macros and functions that are inherently platform
-// specific.
-#ifndef TENSORFLOW_LITE_CORE_MACROS_H_
-#define TENSORFLOW_LITE_CORE_MACROS_H_
-
-#ifdef __has_builtin
-#define TFLITE_HAS_BUILTIN(x) __has_builtin(x)
-#else
-#define TFLITE_HAS_BUILTIN(x) 0
-#endif
-
-#if (!defined(__NVCC__)) && (TFLITE_HAS_BUILTIN(__builtin_expect) || \
-                             (defined(__GNUC__) && __GNUC__ >= 3))
-#define TFLITE_EXPECT_FALSE(cond) __builtin_expect(cond, false)
-#define TFLITE_EXPECT_TRUE(cond) __builtin_expect(!!(cond), true)
-#else
-#define TFLITE_EXPECT_FALSE(cond) (cond)
-#define TFLITE_EXPECT_TRUE(cond) (cond)
-#endif
-
-// Normally we'd use ABSL_HAVE_ATTRIBUTE_WEAK and ABSL_ATTRIBUTE_WEAK, but
-// we avoid the absl dependency for binary size reasons.
-#ifdef __has_attribute
-#define TFLITE_HAS_ATTRIBUTE(x) __has_attribute(x)
-#else
-#define TFLITE_HAS_ATTRIBUTE(x) 0
-#endif
-
-#if (TFLITE_HAS_ATTRIBUTE(weak) ||                  \
-     (defined(__GNUC__) && !defined(__clang__))) && \
-    !(defined(__llvm__) && defined(_WIN32)) && !defined(__MINGW32__)
-#undef TFLITE_ATTRIBUTE_WEAK
-#define TFLITE_ATTRIBUTE_WEAK __attribute__((weak))
-#define TFLITE_HAS_ATTRIBUTE_WEAK 1
-#else
-#define TFLITE_ATTRIBUTE_WEAK
-#define TFLITE_HAS_ATTRIBUTE_WEAK 0
-#endif
-
-#endif  // TENSORFLOW_LITE_CORE_MACROS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/subgraph.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/subgraph.h
deleted file mode 100644
index a3ae0f3..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/core/subgraph.h
+++ /dev/null
@@ -1,751 +0,0 @@
-/* Copyright 2018 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_CORE_SUBGRAPH_H_
-#define TENSORFLOW_LITE_CORE_SUBGRAPH_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/allocation.h"
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/core/api/profiler.h"
-#include "tensorflow/lite/core/macros.h"
-#include "tensorflow/lite/delegates/nnapi/nnapi_delegate.h"
-#include "tensorflow/lite/experimental/resource/resource_base.h"
-#include "tensorflow/lite/memory_planner.h"
-#include "tensorflow/lite/util.h"
-
-namespace tflite {
-
-// Forward declare since NNAPIDelegate uses Interpreter.
-class NNAPIDelegate;
-
-class Subgraph {
- public:
-  friend class Interpreter;
-
-  Subgraph(ErrorReporter* error_reporter,
-           TfLiteExternalContext** external_contexts,
-           std::vector>* subgraphs,
-           resource::ResourceMap* resources);
-
-  Subgraph(const Subgraph&) = delete;
-
-  // Subgraphs should be movable but not copyable.
-  Subgraph(Subgraph&&) = default;
-  Subgraph& operator=(const Subgraph&) = delete;
-  virtual ~Subgraph();
-
-  // Provide a list of tensor indexes that are inputs to the model.
-  // Each index is bound check and this modifies the consistent_ flag of the
-  // interpreter.
-  TfLiteStatus SetInputs(std::vector inputs);
-
-  // Provide a list of tensor indexes that are outputs to the model
-  // Each index is bound check and this modifies the consistent_ flag of the
-  // interpreter.
-  TfLiteStatus SetOutputs(std::vector outputs);
-
-  // Provide a list of tensor indexes that are variable tensors.
-  // Each index is bound check and this modifies the consistent_ flag of the
-  // interpreter.
-  TfLiteStatus SetVariables(std::vector variables);
-
-  // Ensure the internal node storage memory allocates at least `count`
-  // spots for node. NOTE, this doesn't actually add operators. This is an
-  // efficiency optimization that is subject to change.
-  void ReserveNodes(int count);
-
-  // Adds a node with the given parameters and returns the index of the new
-  // node in `node_index` (optionally). Interpreter will take ownership of
-  // `builtin_data` and destroy it with `free`. Ownership of 'init_data'
-  // remains with the caller.
-  TfLiteStatus AddNodeWithParameters(const std::vector& inputs,
-                                     const std::vector& outputs,
-                                     const std::vector& intermediates,
-                                     const char* init_data,
-                                     size_t init_data_size, void* builtin_data,
-                                     const TfLiteRegistration* registration,
-                                     int* node_index = nullptr);
-
-  // Adds `tensors_to_add` tensors, preserving pre-existing Tensor entries.
-  // The value pointed to by `first_new_tensor_index` will be set to the
-  // index of the first new tensor if `first_new_tensor_index` is non-null.
-  TfLiteStatus AddTensors(int tensors_to_add,
-                          int* first_new_tensor_index = nullptr);
-
-  // Set description of inputs/outputs/data/fptrs for node `node_index`.
-  // This variant assumes an external buffer has been allocated of size
-  // bytes. The lifetime of buffer must be ensured to be greater or equal
-  // to Interpreter. `quantization` ownership is passed to the subgraph.
-  inline TfLiteStatus SetTensorParametersReadOnly(
-      int tensor_index, TfLiteType type, const char* name,
-      const std::vector& dims, TfLiteQuantization quantization,
-      const char* buffer, size_t bytes, const Allocation* allocation = nullptr,
-      TfLiteSparsity* sparsity = nullptr) {
-    return SetTensorParametersReadOnly(tensor_index, type, name, dims.size(),
-                                       dims.data(), quantization, buffer, bytes,
-                                       allocation, sparsity);
-  }
-  TfLiteStatus SetTensorParametersReadOnly(
-      int tensor_index, TfLiteType type, const char* name, const size_t rank,
-      const int* dims, TfLiteQuantization quantization, const char* buffer,
-      size_t bytes, const Allocation* allocation = nullptr,
-      TfLiteSparsity* sparsity = nullptr);
-
-  // Set description of inputs/outputs/data/fptrs for node `node_index`.
-  // This variant assumes an external buffer has been allocated of size
-  // bytes. The lifetime of buffer must be ensured to be greater or equal
-  // to Interpreter. `quantization` ownership is passed to the subgraph.
-  inline TfLiteStatus SetTensorParametersReadWrite(
-      int tensor_index, TfLiteType type, const char* name,
-      const std::vector& dims, TfLiteQuantization quantization,
-      bool is_variable = false, const size_t rank_dims_signature = 0,
-      const int* dims_signature = nullptr) {
-    return SetTensorParametersReadWrite(tensor_index, type, name, dims.size(),
-                                        dims.data(), quantization, is_variable,
-                                        rank_dims_signature, dims_signature);
-  }
-  TfLiteStatus SetTensorParametersReadWrite(
-      int tensor_index, TfLiteType type, const char* name, const size_t rank,
-      const int* dims, TfLiteQuantization quantization,
-      bool is_variable = false, const size_t rank_dims_signature = 0,
-      const int* dims_signature = nullptr);
-
-  // WARNING: Experimental interface, subject to change
-  // Overrides execution plan. This bounds checks indices sent in.
-  TfLiteStatus SetExecutionPlan(const std::vector& new_plan);
-
-  // Get a mutable tensor data structure.
-  // TODO(aselle): Create a safe ArrayHandle interface to avoid exposing this
-  // read/write access to structure
-  TfLiteTensor* tensor(int tensor_index) {
-    if (tensor_index < 0 ||
-        static_cast(tensor_index) >= context_.tensors_size) {
-      return nullptr;
-    }
-    return &context_.tensors[tensor_index];
-  }
-
-  // Get an immutable tensor data structure.
-  const TfLiteTensor* tensor(int tensor_index) const {
-    if (tensor_index < 0 ||
-        static_cast(tensor_index) >= context_.tensors_size) {
-      return nullptr;
-    }
-    return &context_.tensors[tensor_index];
-  }
-
-  // Read only access to list of inputs.
-  std::vector& inputs() { return inputs_; }
-
-  // Read only access to list of inputs.
-  const std::vector& inputs() const { return inputs_; }
-
-  // Read only access to list of outputs.
-  std::vector& outputs() { return outputs_; }
-
-  // Read only access to list of outputs.
-  const std::vector& outputs() const { return outputs_; }
-
-  // Read only access to list of variable tensors.
-  std::vector& variables() { return variables_; }
-
-  // Read only access to list of variable tensors.
-  const std::vector& variables() const { return variables_; }
-
-  // WARNING: Experimental interface, subject to change.
-  // TODO(ycling): Move this function to an external context interface.
-  resource::ResourceMap& resources() { return *resources_; }
-
-  size_t tensors_size() const { return tensors_.size(); }
-
-  // Return the number of ops in the model.
-  size_t nodes_size() const { return nodes_and_registration_.size(); }
-
-  // Return vector of node indices in the order of execution.
-  std::vector& execution_plan() { return execution_plan_; }
-
-  // Return read-only vector of node indices in the order of execution.
-  const std::vector& execution_plan() const { return execution_plan_; }
-
-  // Mutable form of tensors (TEMPORARY for refactor).
-  // TODO(b/119495520): remove when refactoring complete.
-  std::vector& tensors() { return tensors_; }
-  // Mutable form of tensors (TEMPORARY for refactor).
-  // TODO(b/119495520): remove when refactoring complete.
-  std::vector>&
-  nodes_and_registration() {
-    return nodes_and_registration_;
-  }
-
-  const std::vector>&
-  nodes_and_registration() const {
-    return nodes_and_registration_;
-  }
-
-  // Get a pointer to an operation and registration data structure if in bounds.
-  const std::pair* node_and_registration(
-      int node_index) const {
-    if (node_index < 0 || static_cast(node_index) >= nodes_size())
-      return nullptr;
-    return &nodes_and_registration_[node_index];
-  }
-
-  // Change the dimensionality of a given tensor. Note, this is only acceptable
-  // for tensor indices that are inputs.
-  // Returns status of failure or success.
-  // TODO(aselle): Consider implementing ArraySlice equivalent to make this
-  //   more adept at accepting data without an extra copy. Use absl::ArraySlice
-  //   if our partners determine that dependency is acceptable.
-  TfLiteStatus ResizeInputTensor(int tensor_index,
-                                 const std::vector& dims);
-
-  // WARNING: Experimental interface, subject to change
-  // Change the dimensionality of a given tensor. This is only acceptable for
-  // tensor indices that are inputs or variables. Only unknown dimensions can be
-  // resized with this function. Unknown dimensions are indicated as `-1` in the
-  // `dims_signature` attribute of a `TfLiteTensor`. Returns status of failure
-  // or success.
-  TfLiteStatus ResizeInputTensorStrict(int tensor_index,
-                                       const std::vector& dims);
-
-  // This releases memory held by non-persistent tensors. It does NOT re-perform
-  // memory planning.
-  // AllocateTensors needs to be called before next invocation.
-  TfLiteStatus ReleaseNonPersistentMemory();
-
-  // Update allocations for all tensors. This will redim dependent tensors using
-  // the input tensor dimensionality as given. This is relatively expensive.
-  // If you know that your sizes are not changing, you need not call this.
-  // Returns status of success or failure.
-  TfLiteStatus AllocateTensors();
-
-  // Invoke the subgraph (run the whole graph in dependency order).
-  //
-  // NOTE: It is possible that the interpreter is not in a ready state
-  // to evaluate (i.e. if a ResizeTensor() has been performed without an
-  // AllocateTensors().
-  // Returns status of success or failure.
-  TfLiteStatus Invoke();
-
-  // Entry point for C node plugin API to report an error.
-  void ReportError(const char* format, ...);
-
-  void UseNNAPI(bool enable);
-
-  // Return the subgraph specific context.
-  TfLiteContext* context() { return &context_; }
-
-  // Set the value of an external context.
-  void SetExternalContext(TfLiteExternalContextType type,
-                          TfLiteExternalContext* ctx);
-  // Get the half precision flag.
-  // WARNING: This is an experimental API and subject to change.
-  bool GetAllowFp16PrecisionForFp32() const {
-    return context_.allow_fp32_relax_to_fp16;
-  }
-
-  // Sets the cancellation function pointer in order to cancel a request in the
-  // middle of a call to Invoke(). The interpreter queries this function during
-  // inference, between op invocations; when it returns true, the interpreter
-  // will abort execution and return `kTfLiteError`. The `data` parameter
-  // contains any data used by the cancellation function, and if non-null,
-  // remains owned by the caller.
-  // WARNING: This is an experimental API and subject to change.
-  void SetCancellationFunction(void* data, bool (*check_cancelled_func)(void*));
-
-  // Ensure the data in `tensor.data` is readable. In case delegate is used,
-  // it might require to copy the data from delegate buffer to raw memory.
-  // WARNING: This is an experimental API and subject to change.
-  // TODO(b/119495520): make this private when refactoring complete.
-  TfLiteStatus EnsureTensorDataIsReadable(int tensor_index) {
-    TfLiteTensor* t = &tensors_[tensor_index];
-    TF_LITE_ENSURE(&context_, t != nullptr);
-    if (t->data_is_stale) {
-      TF_LITE_ENSURE(&context_, t->delegate != nullptr);
-      TF_LITE_ENSURE(&context_, t->buffer_handle != kTfLiteNullBufferHandle);
-      TF_LITE_ENSURE(&context_, t->delegate->CopyFromBufferHandle != nullptr);
-      // TODO(b/120420546): we must add a test that exercise this code.
-      TF_LITE_ENSURE_STATUS(t->delegate->CopyFromBufferHandle(
-          &context_, t->delegate, t->buffer_handle, t));
-      t->data_is_stale = false;
-    }
-    return kTfLiteOk;
-  }
-
-  // The default capacity of `tensors_` vector.
-  static constexpr int kTensorsReservedCapacity = 128;
-  // The capacity headroom of `tensors_` vector before calling ops'
-  // `prepare` and `invoke` function. In these functions, it's guaranteed
-  // allocating up to `kTensorsCapacityHeadroom` more tensors won't invalidate
-  // pointers to existing tensors.
-  static constexpr int kTensorsCapacityHeadroom = 16;
-
-  // Reset all variable tensors to the default value.
-  // If a variable tensor doesn't have a buffer, reset it to zero.
-  // TODO(b/115961645): Implement - If a variable tensor has a buffer, reset it
-  // to the value of the buffer.
-  // WARNING: This is an experimental API and subject to change.
-  TfLiteStatus ResetVariableTensors();
-
-  void SetProfiler(Profiler* profiler, int associated_subgraph_idx) {
-    if (!profiler) {
-      profiler_.reset(nullptr);
-      context_.profiler = nullptr;
-    } else {
-      profiler_.reset(
-          new SubgraphAwareProfiler(profiler, associated_subgraph_idx));
-      context_.profiler = profiler_.get();
-    }
-  }
-
-  Profiler* GetProfiler() { return profiler_.get(); }
-
-  // Returns a pointer to vector of subgraphs.
-  // WARNING: This is an experimental API and subject to change.
-  std::vector>* GetSubgraphs() { return subgraphs_; }
-
-  // True if all tensors in the graph has static size after calling
-  // `AllocateTensors` function.
-  // Before `AllocateTensors` is called, this will always return true;
-  bool HasDynamicTensors() { return has_dynamic_tensors_; }
-
-  // Assigns (or reassigns) a custom memory allocation for the given tensor.
-  // If AllocateTensors() is called after this, the runtime does not consider
-  // the tensor during internal memory planning and will continue using the
-  // provided allocation for the tensor (assuming it satisfies the expected
-  // tensor byte length).
-  // The runtime does NOT take ownership of the underlying memory.
-  // Note that while this function can be called again to set a new allocation
-  // for the tensor, it can no longer be reset to the TFLite arena memory.
-  //
-  // Parameters should satisfy the following conditions:
-  // 1. tensor->allocation_type == kTfLiteArenaRw or kTfLiteArenaRwPersistent
-  //    In general, this is true for I/O tensors & variable tensors.
-  // 2. allocation->data has the appropriate permissions for runtime access
-  //    (Read-only for inputs, Read-Write for others), and outlives Interpreter.
-  // 3. allocation->bytes >= tensor->bytes.
-  //    This condition is checked again if any tensors are resized.
-  // 4. allocation->data should be aligned to kDefaultTensorAlignment
-  //    defined in lite/util.h. (Currently 64 bytes)
-  //
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteStatus SetCustomAllocationForTensor(
-      int tensor_index, const TfLiteCustomAllocation& allocation);
-
- private:
-  // SubgraphAwareProfiler wraps an actual TFLite profiler, such as a
-  // BufferedProfiler instance, and takes care of event profiling/tracing in a
-  // certain subgraph.
-  class SubgraphAwareProfiler : public Profiler {
-   public:
-    // Constructor should be called with the non-nullptr profiler argument.
-    SubgraphAwareProfiler(Profiler* profiler, int64_t subgraph_index)
-        : profiler_(profiler), subgraph_index_(subgraph_index) {}
-    ~SubgraphAwareProfiler() override {}
-
-    uint32_t BeginEvent(const char* tag, EventType event_type,
-                        int64_t event_metadata1,
-                        int64_t event_metadata2) override {
-      if (!profiler_) return 0;
-      return profiler_->BeginEvent(tag, event_type, event_metadata1,
-                                   subgraph_index_);
-    }
-
-    void EndEvent(uint32_t event_handle) override {
-      if (!profiler_) return;
-      profiler_->EndEvent(event_handle);
-    }
-
-    void EndEvent(uint32_t event_handle, int64_t event_metadata1,
-                  int64_t event_metadata2) override {
-      if (!profiler_) return;
-      profiler_->EndEvent(event_handle, event_metadata1, event_metadata2);
-    }
-
-    void AddEvent(const char* tag, EventType event_type, uint64_t start,
-                  uint64_t end, int64_t event_metadata1,
-                  int64_t event_metadata2) override {
-      if (!profiler_) return;
-      profiler_->AddEvent(tag, event_type, start, end, event_metadata1,
-                          subgraph_index_);
-    }
-
-   private:
-    // Not own the memory.
-    Profiler* const profiler_;
-    const int64_t subgraph_index_;
-  };
-
-  // Prevent 'context_' from accessing functions that are only available to
-  // delegated kernels.
-  void SwitchToKernelContext();
-
-  // Add delegate-only functions to 'context_'.
-  void SwitchToDelegateContext();
-
-  // Give 'op_reg' a chance to initialize itself using the contents of
-  // 'buffer'.
-  void* OpInit(const TfLiteRegistration& op_reg, const char* buffer,
-               size_t length) {
-    if (op_reg.init == nullptr) return nullptr;
-    return op_reg.init(&context_, buffer, length);
-  }
-
-  // Let 'op_reg' release any memory it might have allocated via 'OpInit'.
-  void OpFree(const TfLiteRegistration& op_reg, void* buffer) {
-    if (op_reg.free == nullptr) return;
-    if (buffer) {
-      op_reg.free(&context_, buffer);
-    }
-  }
-
-  // Prepare the given 'node' for execution.
-  TfLiteStatus OpPrepare(const TfLiteRegistration& op_reg, TfLiteNode* node);
-
-  // Invoke the operator represented by 'node'.
-  TfLiteStatus OpInvoke(const TfLiteRegistration& op_reg, TfLiteNode* node) {
-    if (op_reg.invoke == nullptr) return kTfLiteError;
-    return op_reg.invoke(&context_, node);
-  }
-
-  // Call OpPrepare() for as many ops as possible, allocating memory for their
-  // tensors. If an op containing dynamic tensors is found, preparation will be
-  // postponed until this function is called again. This allows the interpreter
-  // to wait until Invoke() to resolve the sizes of dynamic tensors.
-  TfLiteStatus PrepareOpsAndTensors();
-
-  // Call OpPrepare() for all ops starting at 'first_node'. Stop when a
-  // dynamic tensors is found or all ops have been prepared. Fill
-  // 'last_node_prepared' with the id of the op containing dynamic tensors, or
-  // the last in the graph.
-  TfLiteStatus PrepareOpsStartingAt(int first_execution_plan_index,
-                                    const std::vector& execution_plan,
-                                    int* last_execution_plan_index_prepared);
-
-  // Tensors needed by the interpreter. Use `AddTensors` to add more blank
-  // tensor entries. Note, `tensors_.data()` needs to be synchronized to the
-  // `context_` whenever this std::vector is reallocated. Currently this
-  // only happens in `AddTensors()`.
-  std::vector tensors_;
-
-  // Check if an array of tensor indices are valid with respect to the Tensor
-  // array.
-  // NOTE: this changes consistent_ to be false if indices are out of bounds.
-  TfLiteStatus CheckTensorIndices(const char* label, const int* indices,
-                                  int length);
-
-  // Check that the input indices and the output indices don't overlap.
-  // This is needed because same tensor must not be used both as input and
-  // output for an operator.
-  // NOTE: this changes consistent_ to be false if indices are out of bounds.
-  TfLiteStatus CheckInputAndOutputForOverlap(const int* input_indices,
-                                             int num_inputs,
-                                             const int* output_indices,
-                                             int num_outputs);
-
-  // Compute the number of bytes required to represent a tensor with dimensions
-  // specified by the array dims (of length dims_size). Returns the status code
-  // and bytes.
-  TfLiteStatus BytesRequired(TfLiteType type, const int* dims, size_t dims_size,
-                             size_t* bytes);
-
-  // Request an tensor be resized implementation. If the given tensor is of
-  // type kTfLiteDynamic it will also be allocated new memory.
-  TfLiteStatus ResizeTensorImpl(TfLiteTensor* tensor, TfLiteIntArray* new_size);
-
-  // Report a detailed error string (will be printed to stderr).
-  // TODO(aselle): allow user of class to provide alternative destinations.
-  void ReportErrorImpl(const char* format, va_list args);
-
-  // Entry point for C node plugin API to request an tensor be resized.
-  static TfLiteStatus ResizeTensor(TfLiteContext* context, TfLiteTensor* tensor,
-                                   TfLiteIntArray* new_size);
-  // Entry point for C node plugin API to report an error.
-  static void ReportErrorC(TfLiteContext* context, const char* format, ...);
-
-  // Entry point for C node plugin API to add new tensors.
-  static TfLiteStatus AddTensors(TfLiteContext* context, int tensors_to_add,
-                                 int* first_new_tensor_index);
-
-  // WARNING: This is an experimental API and subject to change.
-  // Entry point for C API ReplaceNodeSubsetsWithDelegateKernels
-  static TfLiteStatus ReplaceNodeSubsetsWithDelegateKernels(
-      TfLiteContext* context, TfLiteRegistration registration,
-      const TfLiteIntArray* nodes_to_replace, TfLiteDelegate* delegate);
-
-  // Update the execution graph to replace some of the nodes with stub
-  // nodes. Specifically any node index that has `nodes[index]==1` will be
-  // slated for replacement with a delegate kernel specified by registration.
-  // Ownership of 'nodes_to_replace' and 'delegate' remains with the caller.
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteStatus ReplaceNodeSubsetsWithDelegateKernels(
-      TfLiteRegistration registration, const TfLiteIntArray* nodes_to_replace,
-      TfLiteDelegate* delegate);
-
-  // WARNING: This is an experimental interface that is subject to change.
-  // Gets the internal pointer to a TensorFlow lite node by node_index.
-  TfLiteStatus GetNodeAndRegistration(int node_index, TfLiteNode** node,
-                                      TfLiteRegistration** registration);
-
-  // WARNING: This is an experimental interface that is subject to change.
-  // Entry point for C node plugin API to get a node by index.
-  static TfLiteStatus GetNodeAndRegistration(struct TfLiteContext*,
-                                             int node_index, TfLiteNode** node,
-                                             TfLiteRegistration** registration);
-
-  // WARNING: This is an experimental interface that is subject to change.
-  // Gets an TfLiteIntArray* representing the execution plan. The interpreter
-  // owns this memory and it is only guaranteed to exist during the invocation
-  // of the delegate prepare.
-  TfLiteStatus GetExecutionPlan(TfLiteIntArray** execution_plan);
-
-  // WARNING: This is an experimental interface that is subject to change.
-  // Entry point for C node plugin API to get the execution plan.
-  static TfLiteStatus GetExecutionPlan(struct TfLiteContext* context,
-                                       TfLiteIntArray** execution_plan);
-
-  // WARNING: This is an experimental interface that is subject to change.
-  // Provides a preview of post-delegation partitioning. Each
-  // TfLiteDelegateParams in the referenced array corresponds to one instance of
-  // the delegate kernel.
-  // nodes_to_replace should point to a valid array. partition_params_array &
-  // num_partitions should be non-null.
-  // Memory allocated by this method is automatically released with another call
-  // to PreviewDelegateParitioning, or after TfLiteDelegate::Prepare is done.
-  TfLiteStatus PreviewDelegatePartitioning(
-      const TfLiteIntArray* nodes_to_replace,
-      TfLiteDelegateParams** partition_params_array, int* num_partitions);
-
-  // WARNING: This is an experimental interface that is subject to change.
-  // Entry point for C node plugin API to preview delegation partitioning.
-  static TfLiteStatus PreviewDelegatePartitioning(
-      struct TfLiteContext* context, const TfLiteIntArray* nodes_to_replace,
-      TfLiteDelegateParams** partition_params_array, int* num_partitions);
-
-  // Used to clear partitioning_preview_cache_, in case
-  // PreviewDelegatePartitioning was called.
-  void FreeDelegatePartitioningData();
-
-  // Retrieve an existing external context by type.
-  TfLiteExternalContext* GetExternalContext(TfLiteExternalContextType type);
-  static TfLiteExternalContext* GetExternalContext(
-      struct TfLiteContext* context, TfLiteExternalContextType type);
-
-  // Set the value of an external context.
-  static void SetExternalContext(struct TfLiteContext* context,
-                                 TfLiteExternalContextType type,
-                                 TfLiteExternalContext* ctx);
-
-  // WARNING: This is an experimental API and subject to change.
-  // Allow a delegate to look at the graph and modify the graph to handle
-  // parts of the graph themselves. After this is called, the graph may
-  // contain new nodes that replace 1 more nodes.
-  // NOTE: If tensors were allocated prior to delegate application, they will
-  // be reallocated if the graph was modified (i.e., the caller does *not* need
-  // to explicitly call |AllocateTensors()| again). If tensors were unallocated,
-  // they will remain unallocated after delegate application.
-  // Returns one of the following status codes:
-  // 1. kTfLiteOk: Delegation succeeded
-  // 2. kTfLiteDelegateError: Delegation failed due to an error *in the
-  // delegate*. The Subgraph has been restored to its pre-delegation state.
-  // NOTE: This reverts all delegates previously applied to the Subgraph.
-  // 3. kTfLiteApplicationError : Delegation failed to be applied due to the
-  // incompatibility with the TfLite runtime, e.g., the model graph is already
-  // immutable when applying the delegate. However, the Subgraph is still in a
-  // invokable state.
-  // 4. kTfLiteError: Unexpected/runtime failure.
-  TfLiteStatus ModifyGraphWithDelegate(TfLiteDelegate* delegate);
-
-  // This un-applies all delegates that have been applied till now, but retains
-  // pointers to them.
-  // The old execution plan and nodes are restored.
-  TfLiteStatus UndoAllDelegates();
-
-  // This re-applies all delegates that were undone.
-  // Does nothing if UndoAllDelegates wasn't previously called.
-  TfLiteStatus RedoAllDelegates();
-
-  // This removes all delegates.
-  // The old execution plan and nodes are restored. The graph is invokable
-  // afterwards.
-  TfLiteStatus RemoveAllDelegates();
-
-  // Returns true if the subgraph has delegates applied.
-  bool HasDelegates();
-
-  // Cleanups up data reserved for the given node. Does not remove the {node,
-  // registration} pair from nodes_and_registrations_.
-  void CleanupNode(int node_index);
-
-  // Ensures that `tensors_` has at least `kTensorsCapacityHeadroom` extra
-  // capacity. Calling this function may invalidate existing pointers to
-  // tensors. After calling this function, adding `kTensorsCapacityHeadroom`
-  // more tensors won't invalidate the pointer to existing tensors.
-  void EnsureTensorsVectorCapacity();
-
-  // Ensures the memory required is planned and allocated.
-  TfLiteStatus EnsureMemoryAllocations();
-
-  // Returns true if cancellation function returns true.
-  bool IsCancelled();
-
-  // The state of the Interpreter.
-  enum State {
-    // The interpreter isn't ready to be invoked.
-    // `AllocateTensor` need to be called to enter an invokable state.
-    kStateUninvokable = 0,
-    // The interpreter is ready to be invoked.
-    kStateInvokable,
-    // The interpreter is ready to be invoked, and graph can't be further
-    // modified. The interpreter will enter this state when calling
-    // `ModifyGraphWithDelegate` and the delegate doesn't support dynamic
-    // tensors.
-    kStateInvokableAndImmutable,
-  };
-  State state_ = kStateUninvokable;
-
-  // A pure C data structure used to communicate with the pure C plugin
-  // interface. To avoid copying tensor metadata, this is also the definitive
-  // structure to store tensors.
-  TfLiteContext context_ = {};
-
-  // A pointer to the external contexts (kTfLiteMaxExternalContexts) array that
-  // sits inside the associated TFLite interpreter instance.
-  TfLiteExternalContext** external_contexts_;
-
-  // Node inputs/outputs are stored in TfLiteNode and TfLiteRegistration stores
-  // function pointers to actual implementation.
-  // Nodes should appear in the order in which they are instantiated at runtime.
-  // Delegated nodes are appended after all the original ones.
-  std::vector>
-      nodes_and_registration_;
-
-  // Whether the model is consistent. That is to say if the inputs and outputs
-  // of every node and the global inputs and outputs are valid indexes into
-  // the tensor array.
-  bool consistent_ = true;
-
-  // Array of indices representing the tensors that are inputs to the
-  // interpreter.
-  std::vector inputs_;
-
-  // Array of indices representing the tensors that are outputs to the
-  // interpreter.
-  std::vector outputs_;
-
-  // Array of indices representing the tensors that are variable tensors.
-  std::vector variables_;
-
-  // The error reporter delegate that tflite will forward queries errors to.
-  ErrorReporter* error_reporter_;
-
-  // Index of the next node to prepare.
-  // During Invoke(), Interpreter will allocate input tensors first, which are
-  // known to be fixed size. Then it will allocate outputs from nodes as many
-  // as possible. When there is a node that produces dynamic sized tensor.
-  // Interpreter will stop allocating tensors, set the value of next allocate
-  // node id, and execute the node to generate the output tensor before continue
-  // to allocate successors. This process repeats until all nodes are executed.
-  // NOTE: this relies on the order of nodes that is in topological order.
-  int next_execution_plan_index_to_prepare_;
-
-  // Only used in cases where a delegate supporting dynamic tensors is applied.
-  // This helps prepare the original execution before the post-delegation one,
-  // so that tensor shapes propagate.
-  int next_original_execution_plan_index_to_prepare_;
-
-  // This is similar to `next_execution_plan_index_to_prepare_`, but it tracks
-  // which nodes' allocation is planned with the arena planner.
-  //
-  // This is a workaround for b/127354079. It shouldn't be necessary if
-  // ArenaPlanner can "rewind" to a specific point.
-  // TODO(b/127354079): Improve ArenaPlanner and remove this mechanism.
-  int next_execution_plan_index_to_plan_allocation_;
-
-  // WARNING: This is an experimental interface that is subject to change.
-  // This is a list of node indices (to index into nodes_and_registration).
-  // This represents a valid topological sort (dependency ordered) execution
-  // plan. In particular, it is valid for this ordering to contain only a
-  // subset of the node indices.
-  std::vector execution_plan_;
-
-  // This is a copy of the first execution_plan_ before any delegates were
-  // applied. It is empty if no delegates were applied to this Subgraph.
-  std::vector pre_delegation_execution_plan_;
-
-  // Contains a list of delegates applied by the user so far, in order.
-  std::vector delegates_applied_;
-
-  // Set to true if UndoAllDelegates was called, and to false during
-  // RedoAllDelegates.
-  bool delegates_undone_ = false;
-
-  // In the future, we'd like a TfLiteIntArray compatible representation.
-  // TODO(aselle): replace execution_plan_ with this.
-  std::unique_ptr plan_cache_;
-
-  // Used by PreviewDelegateParitioning.
-  std::vector partitioning_preview_cache_;
-
-  // Whether to use delegate to modify the graph.
-  bool should_apply_nnapi_delegate_ = false;
-  bool applied_nnapi_delegate_ = false;
-
-  std::unique_ptr memory_planner_;
-
-  // Contains  pairs for all applicable tensors.
-  std::vector> custom_allocations_;
-
-  // Tracking bit for whether a tensor was resized in the course of an op
-  // invocation. This is a useful hint to ensure that dynamic tensor outputs
-  // trigger downstream reallocation after op invocation.
-  bool tensor_resized_since_op_invoke_ = false;
-
-  // Profiler for this interpreter instance.
-  std::unique_ptr profiler_;
-
-  // A pointer to vector of subgraphs. The vector is owned by the interpreter.
-  std::vector>* subgraphs_ = nullptr;
-
-  // True if all tensors in the graph has static size after calling
-  // `PrepareOpsStartingAt` function (which is called by the `AllocateTensors`
-  // public function).
-  // The value is invalid before `PrepareOpStartingAt` is called.
-  bool has_dynamic_tensors_ = true;
-
-  // Reference to cancellation function that can cancel a request in the middle
-  // of a call to Invoke(). When this function returns True, a kTfLiteError is
-  // thrown by Invoke().
-  bool (*check_cancelled_func_)(void*) = nullptr;
-
-  // Reference to data used by the cancellation function in
-  // `check_cancelled_func_`.
-  void* cancellation_data_ = nullptr;
-
-  // A map of resources. Owned by interpreter and shared by multiple subgraphs.
-  resource::ResourceMap* resources_ = nullptr;
-
-  // Whether the subgraph is currently in use (e.g. running the `Invoke`
-  // or `AllocateTensors` functions).
-  bool is_subgraph_in_use_ = false;
-};
-
-}  // namespace tflite
-#endif  // TENSORFLOW_LITE_CORE_SUBGRAPH_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/external/external_delegate.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/external/external_delegate.h
deleted file mode 100644
index 774c0f0..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/external/external_delegate.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_EXTERNAL_EXTERNAL_DELEGATE_H_
-#define TENSORFLOW_LITE_DELEGATES_EXTERNAL_EXTERNAL_DELEGATE_H_
-
-#include "tensorflow/lite/c/common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-// TfLiteExternalDelegateOptions is a structure of key/value options to create
-// an external delegate.
-const int kMaxOptions = 256;
-typedef struct TfLiteExternalDelegateOptions {
-  const char* lib_path;
-  int count;
-  const char* keys[kMaxOptions];
-  const char* values[kMaxOptions];
-  TfLiteStatus (*insert)(TfLiteExternalDelegateOptions* options,
-                         const char* key, const char* value);
-} TfLiteExternalDelegateOptions;
-
-// Populates TfLiteExternalDelegateOptions with the given shared library path.
-TfLiteExternalDelegateOptions TfLiteExternalDelegateOptionsDefault(
-    const char* lib_path);
-
-// Creates a new delegate instance that need to be destroyed with
-// `TfLiteExternalDelegateDelete` when delegate is no longer used by TFLite.
-TfLiteDelegate* TfLiteExternalDelegateCreate(
-    const TfLiteExternalDelegateOptions* options);
-
-// Destroys a delegate created with `TfLiteExternalDelegateCreate` call.
-void TfLiteExternalDelegateDelete(TfLiteDelegate* delegate);
-
-#ifdef __cplusplus
-}
-#endif  // __cplusplus
-
-#endif  // TENSORFLOW_LITE_DELEGATES_EXTERNAL_EXTERNAL_DELEGATE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/allowlisted_flex_ops.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/allowlisted_flex_ops.h
deleted file mode 100644
index 46b7068..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/allowlisted_flex_ops.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright 2018 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_FLEX_ALLOWLISTED_FLEX_OPS_H_
-#define TENSORFLOW_LITE_DELEGATES_FLEX_ALLOWLISTED_FLEX_OPS_H_
-
-#include 
-
-namespace tflite {
-namespace flex {
-
-// Whether the given op has been statically allowlisted for flex export.
-//
-// This static allowlist is formed by the intersection of ops supported by
-// TensorFlowMobile on both iOS and Android. As the converter is likely running
-// on a host that has the full suite of TensorFlow ops available, we use this
-// static allowlist to ensure compatibility when deploying to a mobile device.
-// TODO(b/118389105): Automate generation of the allowlisted flex ops.
-bool IsAllowlistedFlexOp(const std::string& tensorflow_op_name);
-
-}  // namespace flex
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_FLEX_ALLOWLISTED_FLEX_OPS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/allowlisted_flex_ops_internal.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/allowlisted_flex_ops_internal.h
deleted file mode 100644
index 59392ad..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/allowlisted_flex_ops_internal.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_FLEX_ALLOWLISTED_FLEX_OPS_INTERNAL_H_
-#define TENSORFLOW_LITE_DELEGATES_FLEX_ALLOWLISTED_FLEX_OPS_INTERNAL_H_
-
-#include 
-#include 
-
-namespace tflite {
-namespace flex {
-
-// Return the list of allowlisted flex ops.
-const std::set& GetFlexAllowlist();
-
-// Return true if op_name is a tf.text op need to be supported by flex delegate.
-bool IsAllowedTFTextOpForFlex(const std::string& op_name);
-
-}  // namespace flex
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_FLEX_ALLOWLISTED_FLEX_OPS_INTERNAL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/buffer_map.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/buffer_map.h
deleted file mode 100644
index 6a29c7f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/buffer_map.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Copyright 2018 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_FLEX_BUFFER_MAP_H_
-#define TENSORFLOW_LITE_DELEGATES_FLEX_BUFFER_MAP_H_
-
-#include 
-
-#include "tensorflow/core/framework/tensor.h"
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-namespace flex {
-
-// Maps a TF Lite tensor index into a TensorFlow tensor.
-//
-// The TF Lite interpreter assigns integer indices to each of its tensors, but
-// the Flex delegate deals in terms of TensorFlow tensors. This class maps
-// from indices to tensors and allows the creation of new tensors to be
-// associated with a given index.
-class BufferMap {
- public:
-  BufferMap();
-  ~BufferMap();
-
-  // Returns true if the given 'tensor_index' has a corresponding
-  // tensorflow::Tensor.
-  bool HasTensor(int tensor_index) const;
-
-  // Returns true if the given 'tensor_index' has a corresponding
-  // tensorflow::Tensor *and* the content is owned by TensorFlow (that is, the
-  // mapping was added by SetFromTensorFlow()).
-  bool IsTensorFlowTensor(int tensor_index) const;
-
-  // Returns the tensorflow::Tensor associated with the given 'tensor_index'.
-  // Precondition: HasTensor() is true.
-  tensorflow::Tensor GetTensor(int tensor_index) const;
-
-  // Returns the const pointer to tensorflow::Tensor associated with the given
-  // 'tensor_index'.
-  // Precondition: HasTensor() is true.
-  const tensorflow::Tensor* GetTensorPtr(int tensor_index) const;
-
-  // Associates the given tensorflow::Tensor with the given 'tensor_index'.
-  // Note that TensorFlow Tensors share data buffers, so this method is only a
-  // shallow copy.
-  void SetFromTensorFlow(int tensor_index, tensorflow::Tensor tensor);
-
-  // Same as above but creates a new tensorflow::Tensor with a copy of the
-  // given TfLiteTensor's data.
-  void SetFromTfLite(int tensor_index, const TfLiteTensor* tensor);
-
- private:
-  // Mapping from TL Lite tensor ID to TensorFlow's Tensor. All tensors that
-  // are inputs or outputs of a subgraph will be added here, irrespective of
-  // whether their data are managed by TF Lite or TensorFlow.
-  std::map id_to_tensor_;
-  // A list of tensors that are completely managed by TensorFlow. Most of the
-  // time, TF Lite will populate tensors that are inputs to subgraphs, while
-  // TensorFlow will populate output tensors. Occasionally, however, an input
-  // tensor is coming from a previous subgraph and could have been populated by
-  // TensorFlow. This set keeps track of all input or output tensors that have
-  // been populated by tensorflow.
-  std::set owned_by_tf_;
-};
-
-}  // namespace flex
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_FLEX_BUFFER_MAP_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/delegate.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/delegate.h
deleted file mode 100644
index baa0b15..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/delegate.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Copyright 2018 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_FLEX_DELEGATE_H_
-#define TENSORFLOW_LITE_DELEGATES_FLEX_DELEGATE_H_
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/delegates/flex/delegate_data.h"
-#include "tensorflow/lite/delegates/utils/simple_delegate.h"
-
-namespace tflite {
-
-namespace flex {
-namespace testing {
-class KernelTest;
-}  // namespace testing
-}  // namespace flex
-
-// WARNING: This is an experimental interface that is subject to change.
-// Delegate that can be used to extract parts of a graph that are designed to be
-// executed by TensorFlow's runtime via Eager.
-//
-// The interpreter must be constructed after the FlexDelegate and destructed
-// before the FlexDelegate. This delegate may be used with multiple
-// interpreters, but it is *not* thread-safe.
-//
-// Usage:
-//   auto delegate = FlexDelegate::Create();
-//   ... build interpreter ...
-//
-//   if (delegate) {
-//     interpreter->ModifyGraphWithDelegate(std::move(delegate));
-//   }
-//   ... run inference ...
-//   ... destroy interpreter ...
-class FlexDelegate : public SimpleDelegateInterface {
- public:
-  friend class flex::testing::KernelTest;
-
-  // Creates a delegate that supports TF ops.
-  static TfLiteDelegateUniquePtr Create() {
-    return Create(/*base_delegate*/ nullptr);
-  }
-
-  ~FlexDelegate() override {}
-
-  flex::DelegateData* mutable_data() { return &delegate_data_; }
-
- protected:
-  // We sometimes have to create certain stub data to test FlexDelegate. To
-  // achieve this, we will make a testing flex delegate class that inherits from
-  // FlexDelegate to override certain things for stub data creation. Therefore,
-  // this function accepts a FlexDelegate instance to initiliaze it properly for
-  // create a testing flex delegate in some cases, and it is only used in
-  // testing.
-  static TfLiteDelegateUniquePtr Create(
-      std::unique_ptr base_delegate);
-
-  FlexDelegate() {}
-
-  const char* Name() const override;
-
-  bool IsNodeSupportedByDelegate(const TfLiteRegistration* registration,
-                                 const TfLiteNode* node,
-                                 TfLiteContext* context) const override;
-
-  TfLiteStatus Initialize(TfLiteContext* context) override;
-
-  SimpleDelegateInterface::Options DelegateOptions() const override {
-    // Use default options.
-    return SimpleDelegateInterface::Options();
-  }
-
-  std::unique_ptr CreateDelegateKernelInterface()
-      override;
-
-  TfLiteStatus CopyFromBufferHandle(TfLiteContext* context,
-                                    TfLiteBufferHandle buffer_handle,
-                                    TfLiteTensor* output);
-
-  flex::DelegateData delegate_data_;
-};
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_FLEX_DELEGATE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/delegate_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/delegate_data.h
deleted file mode 100644
index 5f88cfb..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/delegate_data.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* Copyright 2018 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_FLEX_DELEGATE_DATA_H_
-#define TENSORFLOW_LITE_DELEGATES_FLEX_DELEGATE_DATA_H_
-
-#include "tensorflow/core/common_runtime/eager/context.h"
-#include "tensorflow/core/public/session_options.h"
-#include "tensorflow/lite/delegates/flex/buffer_map.h"
-
-namespace tflite {
-namespace flex {
-
-// Data kept by the Flex delegate for the lifetime of an Interpreter.
-//
-// Note: This class is *not* thread-safe; any dependent delegates should not be
-// used concurrently.
-class DelegateData {
- public:
-  DelegateData();
-  ~DelegateData();
-
-  // Prepare the necessary EagerContext and data for execution.
-  // This must be called at least once before execution. After preparation
-  // succeeds, redundant calls will be ignored (even if the session_options
-  // differ).
-  tensorflow::Status Prepare(const tensorflow::SessionOptions& session_options);
-
-  // The EagerContext that is required for execution of Flex Ops.
-  // Note: The context is lazily created after the first call to |Prepare()|.
-  tensorflow::EagerContext* GetEagerContext() { return eager_context_; }
-
-  // Map from TF Lite tensor index to TensorFlow tensor for a given context.
-  BufferMap* GetBufferMap(const TfLiteContext* context) {
-    return &buffer_map_[context];
-  }
-
- private:
-  // Will be null until Prepare() is called and completes successfully.
-  tensorflow::EagerContext* eager_context_ = nullptr;
-  // TODO(b/112439500): Clean up stale BufferMap instances after adding the
-  // necessary cleanup hook from a TfLiteContext to a TfLiteDelegate.
-  std::unordered_map buffer_map_;
-};
-
-}  // namespace flex
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_FLEX_DELEGATE_DATA_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/kernel.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/kernel.h
deleted file mode 100644
index b2ab485..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/kernel.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* Copyright 2018 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_FLEX_KERNEL_H_
-#define TENSORFLOW_LITE_DELEGATES_FLEX_KERNEL_H_
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/delegates/utils/simple_delegate.h"
-
-namespace tflite {
-namespace flex {
-
-struct OpData;
-class DelegateKernel : public SimpleDelegateKernelInterface {
- public:
-  DelegateKernel();
-  ~DelegateKernel() override;
-
-  TfLiteStatus Init(TfLiteContext* context,
-                    const TfLiteDelegateParams* params) override;
-  TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) override;
-  TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) override;
-
- private:
-  // Validate that the computed output tensor shape for the Flex node matches
-  // the existing output shape assigned to the output tensor.
-  TfLiteStatus ValidateOutputTensorShapeConsistency(
-      TfLiteContext* context) const;
-
-  std::unique_ptr op_data_;
-};
-
-}  // namespace flex
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_FLEX_KERNEL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/test_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/test_util.h
deleted file mode 100644
index c00adbf..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/test_util.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Copyright 2018 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_FLEX_TEST_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_FLEX_TEST_UTIL_H_
-
-#include "tensorflow/c/c_api_internal.h"
-#include "tensorflow/lite/kernels/test_util.h"
-
-namespace tflite {
-namespace flex {
-namespace testing {
-
-enum TfOpType {
-  kUnpack,
-  kIdentity,
-  kAdd,
-  kMul,
-  kRfft,
-  kImag,
-  // Represents an op that does not exist in TensorFlow.
-  kNonExistent,
-  // Represents an valid TensorFlow op where the NodeDef is incompatible.
-  kIncompatibleNodeDef,
-};
-
-// This class creates models with TF and TFLite ops. In order to use this class
-// to test the Flex delegate, implement a function that calls
-// interpreter->ModifyGraphWithDelegate.
-class FlexModelTest : public ::testing::Test {
- public:
-  FlexModelTest() {}
-  ~FlexModelTest() {}
-
-  bool Invoke();
-
-  // Sets the (typed) tensor's values at the given index.
-  template 
-  void SetTypedValues(int tensor_index, const std::vector& values) {
-    memcpy(interpreter_->typed_tensor(tensor_index), values.data(),
-           values.size() * sizeof(T));
-  }
-
-  // Returns the (typed) tensor's values at the given index.
-  template 
-  std::vector GetTypedValues(int tensor_index) {
-    const TfLiteTensor* t = interpreter_->tensor(tensor_index);
-    const T* tdata = interpreter_->typed_tensor(tensor_index);
-    return std::vector(tdata, tdata + t->bytes / sizeof(T));
-  }
-
-  // Sets the tensor's values at the given index.
-  void SetValues(int tensor_index, const std::vector& values) {
-    SetTypedValues(tensor_index, values);
-  }
-  void SetStringValues(int tensor_index, const std::vector& values);
-
-  // Returns the tensor's values at the given index.
-  std::vector GetValues(int tensor_index) {
-    return GetTypedValues(tensor_index);
-  }
-  std::vector GetStringValues(int tensor_index) const;
-
-  // Sets the tensor's shape at the given index.
-  void SetShape(int tensor_index, const std::vector& values);
-
-  // Returns the tensor's shape at the given index.
-  std::vector GetShape(int tensor_index);
-
-  // Returns the tensor's type at the given index.
-  TfLiteType GetType(int tensor_index);
-
-  // Returns if the tensor at the given index is dynamic.
-  bool IsDynamicTensor(int tensor_index);
-
-  const TestErrorReporter& error_reporter() const { return error_reporter_; }
-
-  // Adds `num_tensor` tensors to the model. `inputs` contains the indices of
-  // the input tensors and `outputs` contains the indices of the output
-  // tensors. All tensors are set to have `type` and `dims`.
-  void AddTensors(int num_tensors, const std::vector& inputs,
-                  const std::vector& outputs, TfLiteType type,
-                  const std::vector& dims);
-
-  // Set a constant tensor of the given shape, type and buffer at the given
-  // index.
-  void SetConstTensor(int tensor_index, const std::vector& values,
-                      TfLiteType type, const char* buffer, size_t bytes);
-
-  // Adds a TFLite Mul op. `inputs` contains the indices of the input tensors
-  // and `outputs` contains the indices of the output tensors.
-  void AddTfLiteMulOp(const std::vector& inputs,
-                      const std::vector& outputs);
-
-  // Adds a TensorFlow op. `inputs` contains the indices of the
-  // input tensors and `outputs` contains the indices of the output tensors.
-  // This function is limited to the set of ops defined in TfOpType.
-  void AddTfOp(TfOpType op, const std::vector& inputs,
-               const std::vector& outputs);
-
- protected:
-  std::unique_ptr interpreter_;
-  TestErrorReporter error_reporter_;
-  std::vector tf_ops_;
-
- private:
-  // Helper method to add a TensorFlow op. tflite_names needs to start with
-  // "Flex" in order to work with the Flex delegate.
-  void AddTfOp(const char* tflite_name, const string& tf_name,
-               const string& nodedef_str, const std::vector& inputs,
-               const std::vector& outputs);
-
-  std::vector> flexbuffers_;
-
-  int next_op_index_ = 0;
-};
-
-}  // namespace testing
-}  // namespace flex
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_FLEX_TEST_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/util.h
deleted file mode 100644
index f668727..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/flex/util.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* Copyright 2018 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_FLEX_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_FLEX_UTIL_H_
-
-#include "tensorflow/c/c_api_internal.h"
-#include "tensorflow/core/framework/tensor.h"
-#include "tensorflow/core/lib/core/status.h"
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-namespace flex {
-
-// Converts a tensorflow:Status into a TfLiteStatus. If the original status
-// represented an error, reports it using the given 'context'.
-TfLiteStatus ConvertStatus(TfLiteContext* context,
-                           const tensorflow::Status& status);
-
-// Copies the given shape and type of the TensorFlow 'src' tensor into a TF Lite
-// 'tensor'. Logs an error and returns kTfLiteError if the shape or type can't
-// be converted.
-TfLiteStatus CopyShapeAndType(TfLiteContext* context,
-                              const tensorflow::Tensor& src,
-                              TfLiteTensor* tensor);
-
-// Returns the TF C API Data type that corresponds to the given TfLiteType.
-TF_DataType GetTensorFlowDataType(TfLiteType type);
-
-// Returns the TfLiteType that corresponds to the given TF C API Data type.
-TfLiteType GetTensorFlowLiteType(TF_DataType);
-
-}  // namespace flex
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_FLEX_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/api.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/api.h
deleted file mode 100644
index 7892d0c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/api.h
+++ /dev/null
@@ -1,397 +0,0 @@
-/* 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_API_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_API_H_
-
-// Usage example:
-//
-//   // Builder is created from a model using GPU-specific parameters.
-//   std::unique_ptr builder = ...;
-//
-//   // input data is coming from a texture
-//   // output data goes to CPU
-//   builder->SetInputObjectDef(0, {DataType::FLOAT16, DataLayout::PHWC4,
-//                                  ObjectType::OPENGL_TEXTURE, true});
-//   builder->SetOutputObjectDef(0, {DataType::FLOAT32, DataLayout::BHWC,
-//                                  ObjectType::CPU_MEMORY, false});
-//   std::unique_ptr runner;
-//   RETURN_IF_ERROR(builder->Build(&runner));  // may take significant time.
-//   RETURN_IF_ERROR(
-//       runner->SetInputObject(0, OpenGlTexture{texture_ud, texture_format}));
-//   RETURN_IF_ERROR(runner->Run());
-
-#include 
-#include 
-#include 
-
-#include "absl/types/span.h"
-#include "absl/types/variant.h"
-#include 
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/util.h"
-#include 
-
-#define GL_NO_PROTOTYPES
-#define EGL_NO_PROTOTYPES
-#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
-#undef GL_NO_PROTOTYPES
-#undef EGL_NO_PROTOTYPES
-
-namespace tflite {
-namespace gpu {
-
-// Common abbreviations:
-//   B  - batch
-//   H  - height
-//   W  - width
-//   C  - channels
-//   D  - depth := DivideRoundUp(C, 4)
-//   C4 - is the constant = 4.
-enum class DataLayout {
-  UNKNOWN,
-  BHWC,
-  DHWC4,
-  HWDC4,
-  HDWC4,
-};
-
-enum class ObjectType {
-  UNKNOWN,
-  OPENGL_SSBO,
-  OPENGL_TEXTURE,
-  CPU_MEMORY,
-  OPENCL_TEXTURE,
-  OPENCL_BUFFER,
-  VULKAN_BUFFER,
-  VULKAN_TEXTURE
-};
-
-struct OpenGlBuffer {
-  OpenGlBuffer() = default;
-  explicit OpenGlBuffer(GLuint new_id) : id(new_id) {}
-
-  GLuint id = GL_INVALID_INDEX;
-};
-
-struct OpenGlTexture {
-  OpenGlTexture() = default;
-  OpenGlTexture(GLuint new_id, GLenum new_format)
-      : id(new_id), format(new_format) {}
-
-  GLuint id = GL_INVALID_INDEX;
-  GLenum format = GL_INVALID_ENUM;
-};
-
-struct OpenClBuffer {
-  OpenClBuffer() = default;
-  explicit OpenClBuffer(cl_mem new_memobj) : memobj(new_memobj) {}
-
-  cl_mem memobj = nullptr;
-};
-
-struct OpenClTexture {
-  OpenClTexture() = default;
-  explicit OpenClTexture(cl_mem new_memobj) : memobj(new_memobj) {}
-
-  cl_mem memobj = nullptr;
-  // TODO(akulik): should it specify texture format?
-};
-
-struct VulkanBuffer {
-  VulkanBuffer() = default;
-  explicit VulkanBuffer(VkBuffer buffer_, VkDeviceSize size_,
-                        VkDeviceMemory memory_, VkDeviceSize offset_)
-      : buffer(buffer_), size(size_), memory(memory_), offset(offset_) {}
-
-  VkBuffer buffer;
-  VkDeviceSize size;
-  VkDeviceMemory memory;
-  VkDeviceSize offset;
-};
-
-struct VulkanTexture {
-  VulkanTexture() = default;
-  explicit VulkanTexture(VkDeviceMemory new_memory) : memory(new_memory) {}
-
-  VkImage image;
-  VkImageView image_view;
-  VkFormat format;
-  VkExtent3D extent;
-  VkDeviceMemory memory;
-  VkDeviceSize offset;
-};
-
-struct VulkanMemory {
-  VulkanMemory() = default;
-  explicit VulkanMemory(VkDeviceMemory new_memory) : memory(new_memory) {}
-
-  VkDeviceMemory memory;
-  VkDeviceSize size;
-  VkDeviceSize offset;
-};
-
-struct CpuMemory {
-  CpuMemory() = default;
-  CpuMemory(void* new_data, size_t new_size_bytes)
-      : data(new_data), size_bytes(new_size_bytes) {}
-
-  void* data = nullptr;
-  size_t size_bytes = 0;
-};
-
-template 
-inline CpuMemory MakeCpuMemory(absl::Span t) {
-  CpuMemory m;
-  m.data = t.data();
-  m.size_bytes = t.size() * sizeof(T);
-  return m;
-}
-
-template 
-inline CpuMemory MakeReadableCpuMemory(absl::Span t) {
-  CpuMemory m;
-  m.data = const_cast(t.data());
-  m.size_bytes = t.size() * sizeof(T);
-  return m;
-}
-
-// Defines object representation.
-struct ObjectDef {
-  DataType data_type = DataType::UNKNOWN;
-  DataLayout data_layout = DataLayout::UNKNOWN;
-  ObjectType object_type = ObjectType::UNKNOWN;
-
-  // If true, then object is managed externally and needs to be provided to
-  // InferenceRunner by a user before running inference.
-  //
-  // User-provided objects will not be re-used internally for any purpose to
-  // lower overall memory usage.
-  bool user_provided = false;
-
-  bool operator==(const ObjectDef& other) const {
-    return data_type == other.data_type && data_layout == other.data_layout &&
-           object_type == other.object_type &&
-           user_provided == other.user_provided;
-  }
-};
-
-bool IsValid(const ObjectDef& def);
-
-struct Dimensions {
-  Dimensions() : b(1), h(1), w(1), c(1) {}
-
-  Dimensions(int32_t batch, int32_t height, int32_t width, int32_t channels)
-      : b(batch), h(height), w(width), c(channels) {}
-
-  int32_t d() const { return DivideRoundUp(c, 4); }
-
-  int32_t product() const { return b * h * w * c; }
-
-  bool operator==(const Dimensions& other) const {
-    return b == other.b && h == other.h && w == other.w && c == other.c;
-  }
-
-  int32_t b;
-  int32_t h;
-  int32_t w;
-  int32_t c;
-};
-
-// Connects tensor shape with corresponding object definition.
-struct TensorObjectDef {
-  // Dimensions semantic is defined by corresponding DataLayout.
-  Dimensions dimensions;
-  ObjectDef object_def;
-
-  bool operator==(const TensorObjectDef& other) const {
-    return dimensions == other.dimensions && object_def == other.object_def;
-  }
-};
-
-// @return true if tensor object def is defined.
-bool IsValid(const TensorObjectDef& def);
-
-// @return the number of elements in a tensor object.
-uint32_t NumElements(const TensorObjectDef& def);
-
-using TensorObject =
-    absl::variant;
-
-// @return true if object is set and corresponding values are defined.
-bool IsValid(const TensorObjectDef& def, const TensorObject& object);
-
-ObjectType GetType(const TensorObject& object);
-
-// @return true if corresponding object is set for the given type
-bool IsObjectPresent(ObjectType type, const TensorObject& obj);
-
-class InferenceRunner;
-
-// Allows to inspect and change input and output definitions before a graph is
-// prepared for the inference.
-class InferenceBuilder {
- public:
-  virtual ~InferenceBuilder() {}
-
-  // Returns inference graph inputs and outputs definitions.
-  virtual std::vector inputs() const = 0;
-  virtual std::vector outputs() const = 0;
-
-  // Sets new shape for the input if underlying implementation and graph
-  // structure allows dynamic tensors.
-  virtual absl::Status SetInputShape(int index,
-                                     const Dimensions& dimensions) = 0;
-
-  // Updates object definitions for the given index. Implementation may allow
-  // to use different layouts and/or data type conversions between objects
-  // defined in a graph and given objects, for example:
-  //   input '0' is DataType::FLOAT32, DataLayout::BHWC.
-  //   A user, however, has an input in DataType::FLOAT16, DataLayout::PHWC4.
-  //   An implementation may allow this transformation to happen automatically
-  //   under the hood.
-  virtual absl::Status SetInputObjectDef(int index, ObjectDef def) = 0;
-  virtual absl::Status SetOutputObjectDef(int index, ObjectDef def) = 0;
-  virtual absl::Status SetAllInputObjectDefsTo(ObjectDef def) {
-    auto input_defs = inputs();
-    for (int i = 0; i < input_defs.size(); ++i) {
-      RETURN_IF_ERROR(SetInputObjectDef(i, def));
-    }
-    return absl::OkStatus();
-  }
-  virtual absl::Status SetAllOutputObjectDefsTo(ObjectDef def) {
-    auto output_defs = outputs();
-    for (int i = 0; i < output_defs.size(); ++i) {
-      RETURN_IF_ERROR(SetOutputObjectDef(i, def));
-    }
-    return absl::OkStatus();
-  }
-
-  // Creates new instance of the inference runner. InferenceBuilder stays valid
-  // and could be used to create another inference runner if needed.
-  //
-  // This method may take significant time to prepare new inference runner. For
-  // example, it may require to compile OpenGL shaders.
-  virtual absl::Status Build(std::unique_ptr* runner) = 0;
-};
-
-// Runs prepared inference. Every object marked as external needs to be set
-// prior calling Run method.
-class InferenceRunner {
- public:
-  virtual ~InferenceRunner() {}
-
-  // Returns inference graph inputs and outputs definitions.
-  virtual std::vector inputs() const = 0;
-  virtual std::vector outputs() const = 0;
-
-  // Getters provide access to underlying objects for the given index.
-  // Setters allow to set or change external object for the given index. Note,
-  // object need to match object definition set before in InferenceBuilder.
-
-  virtual absl::Status GetInputObject(int index, TensorObject* object) = 0;
-  virtual absl::Status GetOutputObject(int index, TensorObject* object) = 0;
-  virtual absl::Status SetInputObject(int index, TensorObject object) = 0;
-  virtual absl::Status SetOutputObject(int index, TensorObject object) = 0;
-
-  virtual absl::Status Run() = 0;
-};
-
-// Encapsulated compilation/runtime tradeoffs.
-enum class InferenceUsage {
-  UNKNOWN,
-
-  // InferenceRunner will be used only once. Therefore, it is important to
-  // minimize bootstrap time as well.
-  FAST_SINGLE_ANSWER,
-
-  // Prefer maximizing the throughput. Same inference runner will be used
-  // repeatedly on different inputs.
-  SUSTAINED_SPEED,
-};
-
-// Defines aspects to control while instantiating a runner.
-enum class InferencePriority {
-  UNKNOWN,
-
-  AUTO,
-
-  MIN_LATENCY,
-
-  MAX_PRECISION,
-
-  MIN_MEMORY_USAGE,
-};
-
-struct InferenceOptions {
-  InferenceUsage usage = InferenceUsage::SUSTAINED_SPEED;
-
-  // Ordered priorities provide better understanding of desired semantics,
-  // where priority(n) is more important than priority(n+1).
-  // AUTO priority is needed when a single priority is the most important
-  // factor. For example, priority1 = InferencePriority::MIN_LATENCY and leaving
-  // everything else to AUTO would result in configuration that achieves maximum
-  // performance.
-  //
-  // AUTO priority can only be used when higher priorities are fully specified.
-  // For example:
-  //   VALID:   priority1 = MIN_LATENCY, priority2 = AUTO, priority3 = AUTO
-  //   VALID:   priority1 = MIN_LATENCY, priority2 = MAX_PRECISION,
-  //            priority3 = AUTO
-  //   INVALID: priority1 = AUTO, priority2 = MIN_LATENCY, priority3 = AUTO
-  //   INVALID: priority1 = MIN_LATENCY, priority2 = AUTO,
-  //            priority3 = MAX_PRECISION
-  // Invalid priorities will result in error.
-  InferencePriority priority1 = InferencePriority::MAX_PRECISION;
-
-  InferencePriority priority2 = InferencePriority::AUTO;
-
-  InferencePriority priority3 = InferencePriority::AUTO;
-};
-
-// Returns a position number for the priority. If priority is missing,
-// then it it would return 'max num priorities + 1'.
-int GetPosition(const InferenceOptions& options, InferencePriority p);
-
-// Return true if options are valid.
-bool IsValid(const InferenceOptions& options);
-
-// Resolves AUTO priorities and specifies them explicitly.
-// Note, no-one should assume that these mappings will not change.
-// Technically this function is declared here for code re-use purposes and
-// by no means it should be treated as canonical way to resolve AUTO.
-void ResolveAutoPriority(InferenceOptions* options);
-
-enum class PriorityImportance {
-  UNKNOWN,
-  HIGHER,
-  LOWER,
-};
-
-// If both p1 and p2 are not present in options, return UNKNOWN
-// If p1 is present, but p2 is not, return HIGHER
-// If p2 is present, but p1 is not, return LOWER
-// If both are present, and p1 is more important, return HIGHER, otherwise,
-// LOWER.
-PriorityImportance GetRelativeImportance(const InferenceOptions& options,
-                                         InferencePriority p1,
-                                         InferencePriority p2);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_API_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/api.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/api.h
deleted file mode 100644
index 6567111..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/api.h
+++ /dev/null
@@ -1,143 +0,0 @@
-/* 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_CL_API_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_API_H_
-
-#ifdef CL_DELEGATE_NO_GL
-#define EGL_NO_PROTOTYPES
-#endif
-
-#include 
-
-#include 
-#include 
-
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/api.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-// Usage example:
-//
-//   std::unique_ptr env;
-//   RETURN_IF_ERROR(NewInferenceEnvironment(option, &env));
-//
-//   InferenceOptions options;
-//
-//   std::unique_ptr builder;
-//   RETURN_IF_ERROR(env->NewInferenceBuilder(options, model, &builder));
-//   // now builder is ready to prepare inference runner.
-//
-// -----------------
-// Supported formats
-// -----------------
-//
-// OpenCL implementation uses 2D textures as the primary format.
-// Tensor in HWDC4 layout is {TEXTURE_2D, RGBA, width := W*D, height := H}.
-//
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-struct InferenceOptions : public tflite::gpu::InferenceOptions {};
-
-// Indicates environment
-struct InferenceEnvironmentProperties {
-  bool is_opencl_available = false;
-
-  // GL objects (buffers and textures) could be shared with CL context.
-  bool is_gl_sharing_supported = false;
-
-  // Indicates whether fast GL->CL synchronization is supported.
-  bool is_gl_to_cl_fast_sync_supported = false;
-
-  // Indicates whether fast CL->GL synchronization is supported.
-  bool is_cl_to_gl_fast_sync_supported = false;
-};
-
-// Environment manages all resources that need to stay until any inference is
-// running using OpenCL backend.
-class InferenceEnvironment {
- public:
-  virtual ~InferenceEnvironment() {}
-
-  // Converts GraphFloat32 into intermediate, device-specific representation.
-  // This serialized_model specific for device and InferenceOptions.
-  // serialized_model cannot be used with another device or InferenceOptions.
-  // Loading serialized_model is much faster than loading GraphFloat32.
-  // serialized_model must be used with appropriate NewInferenceBuilder
-  // method (see below).
-  virtual absl::Status BuildSerializedModel(
-      const InferenceOptions& options, GraphFloat32 model,
-      std::vector* serialized_model) = 0;
-
-  virtual absl::Status NewInferenceBuilder(
-      const std::vector& serialized_model,
-      std::unique_ptr* builder) = 0;
-
-  virtual absl::Status NewInferenceBuilder(
-      const InferenceOptions& options, GraphFloat32 model,
-      std::unique_ptr* builder) = 0;
-
-  // Returns opaque binary blob that contains a collection of already compiled
-  // OpenCL kernels present in a cache. Returned data could be re-used later
-  // to speed up compilation time when new environment is created for the same
-  // set of models.
-  // Returned data is valid only if used on the same device, otherwise it will
-  // not be compatible and will be discarded.
-  virtual std::vector GetSerializedBinaryCache() const = 0;
-};
-
-struct InferenceEnvironmentOptions {
-  // If any of these objects are set, created environment will use them instead
-  // of creating/choosing own instances.
-  cl_device_id device = nullptr;
-  cl_context context = nullptr;
-  cl_command_queue command_queue = nullptr;
-
-  // Whenever input and/or output is GL object, EGL display and context must be
-  // set to create GL aware OpenCL context. Do not set these variables whenever
-  // GL interoperability is not needed.
-  // It is the error to set egl_display, egl_context AND context at the same
-  // time. If egl_display and egl_context are set, they will be used to create
-  // GL-aware CL context.
-  EGLDisplay egl_display = EGL_NO_DISPLAY;
-  EGLContext egl_context = EGL_NO_CONTEXT;
-
-  // Should contain data returned from
-  // InferenceEnvironment::GetSerializedBinaryCache method.
-  // Invalid or incompatible data will be discarded. Compiled binary may become
-  // incompatible when GPU driver is updated.
-  absl::Span serialized_binary_cache;
-
-  bool IsGlAware() const {
-    return egl_context != EGL_NO_CONTEXT && egl_display != EGL_NO_DISPLAY;
-  }
-};
-
-// Creates new OpenCL environment that needs to stay around until all inference
-// runners are destroyed.
-absl::Status NewInferenceEnvironment(
-    const InferenceEnvironmentOptions& options,
-    std::unique_ptr* environment,
-    InferenceEnvironmentProperties* properties /* optional */);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_API_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/arguments.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/arguments.h
deleted file mode 100644
index a5435c4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/arguments.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_ARGUMENTS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_ARGUMENTS_H_
-
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/gpu_object.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/cl/serialization_generated.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/access_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/common/util.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class ArgumentsBinder {
- public:
-  virtual absl::Status SetInt(const std::string& name, int value) = 0;
-  virtual absl::Status SetFloat(const std::string& name, float value) = 0;
-  virtual absl::Status SetHalf(const std::string& name, half value) = 0;
-  virtual ~ArgumentsBinder() = default;
-};
-
-class Arguments : public ArgumentsBinder {
- public:
-  Arguments() = default;
-  void AddFloat(const std::string& name, float value = 0.0f);
-  void AddHalf(const std::string& name, half value = half(0.0f));
-  void AddInt(const std::string& name, int value = 0);
-  void AddObjectRef(const std::string& name, AccessType access_type,
-                    GPUObjectDescriptorPtr&& descriptor_ptr);
-  void AddObject(const std::string& name,
-                 GPUObjectDescriptorPtr&& descriptor_ptr);
-
-  absl::Status SetInt(const std::string& name, int value) override;
-  absl::Status SetFloat(const std::string& name, float value) override;
-  absl::Status SetHalf(const std::string& name, half value) override;
-  absl::Status SetObjectRef(const std::string& name, const GPUObject* object);
-
-  absl::Status Bind(cl_kernel kernel, int offset = 0);
-
-  void RenameArgs(const std::string& postfix, std::string* code) const;
-  absl::Status Merge(Arguments&& args, const std::string& postfix);
-
-  absl::Status AllocateObjects(CLContext* context);
-  void ReleaseCPURepresentation();
-  absl::Status TransformToCLCode(
-      const DeviceInfo& device_info,
-      const std::map& linkables, std::string* code);
-
-  // Move only
-  Arguments(Arguments&& args);
-  Arguments& operator=(Arguments&& args);
-  Arguments(const Arguments&) = delete;
-  Arguments& operator=(const Arguments&) = delete;
-
-  ~Arguments() override = default;
-
- private:
-  friend flatbuffers::Offset Encode(
-      const Arguments& args, flatbuffers::FlatBufferBuilder* builder);
-  friend absl::Status Decode(CLContext* context, const data::Arguments* fb_args,
-                             Arguments* args);
-
-  void AddBuffer(const std::string& name, const GPUBufferDescriptor& desc);
-  void AddImage2D(const std::string& name, const GPUImage2DDescriptor& desc);
-  void AddImage2DArray(const std::string& name,
-                       const GPUImage2DArrayDescriptor& desc);
-  void AddImage3D(const std::string& name, const GPUImage3DDescriptor& desc);
-  void AddImageBuffer(const std::string& name,
-                      const GPUImageBufferDescriptor& desc);
-  void AddCustomMemory(const std::string& name,
-                       const GPUCustomMemoryDescriptor& desc);
-
-  absl::Status SetImage2D(const std::string& name, cl_mem memory);
-  absl::Status SetBuffer(const std::string& name, cl_mem memory);
-  absl::Status SetImage2DArray(const std::string& name, cl_mem memory);
-  absl::Status SetImage3D(const std::string& name, cl_mem memory);
-  absl::Status SetImageBuffer(const std::string& name, cl_mem memory);
-  absl::Status SetCustomMemory(const std::string& name, cl_mem memory);
-
-  std::string GetListOfArgs();
-
-  std::string AddActiveArgument(const std::string& arg_name,
-                                bool use_f32_for_halfs);
-  void AddGPUResources(const std::string& name, const GPUResources& resources);
-
-  absl::Status SetGPUResources(const std::string& name,
-                               const GPUResourcesWithValue& resources);
-
-  absl::Status AddObjectArgs();
-
-  void ResolveArgsPass(const DeviceInfo& device_info, std::string* code);
-  absl::Status ResolveSelectorsPass(
-      const std::map& linkables, std::string* code);
-
-  absl::Status ResolveSelector(
-      const std::map& linkables,
-      const std::string& object_name, const std::string& selector,
-      const std::vector& args,
-      const std::vector& template_args, std::string* result);
-
-  void ResolveObjectNames(const std::string& object_name,
-                          const std::vector& member_names,
-                          std::string* code);
-
-  GPUObjectDescriptor* GetObjectDescriptor(
-      const std::string& object_name) const;
-
-  static constexpr char kArgsPrefix[] = "args.";
-
-  struct IntValue {
-    int value;
-
-    // many uniforms generated automatically and not used
-    // to reduce amount of data transferred we adding this optimization
-    bool active = false;
-
-    // offset to shared uniform storage.
-    uint32_t offset = -1;
-  };
-  std::map int_values_;
-  std::vector shared_int4s_data_;
-
-  struct FloatValue {
-    float value;
-
-    // many uniforms generated automatically and not used
-    // to reduce amount of data transferred we adding this optimization
-    bool active = false;
-
-    // offset to shared uniform storage.
-    uint32_t offset = -1;
-  };
-  std::map float_values_;
-  std::vector shared_float4s_data_;
-
-  struct HalfValue {
-    half value;
-
-    // many uniforms generated automatically and not used
-    // to reduce amount of data transferred we adding this optimization
-    bool active = false;
-
-    // some devices have issues with half parameters.
-    bool store_as_f32 = false;
-
-    // offset to shared uniform storage.
-    uint32_t offset = -1;
-  };
-  std::map half_values_;
-  std::vector shared_half4s_data_;
-
-  std::map buffers_;
-  std::map images2d_;
-  std::map image2d_arrays_;
-  std::map images3d_;
-  std::map image_buffers_;
-  std::map custom_memories_;
-
-  struct ObjectRefArg {
-    GPUObjectDescriptorPtr descriptor;
-  };
-  std::map object_refs_;
-
-  struct ObjectArg {
-    GPUObjectPtr obj_ptr;
-    GPUObjectDescriptorPtr descriptor;
-  };
-  std::map objects_;
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_ARGUMENTS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/buffer.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/buffer.h
deleted file mode 100644
index 60c4830..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/buffer.h
+++ /dev/null
@@ -1,144 +0,0 @@
-/* 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_CL_BUFFER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_BUFFER_H_
-
-#include "absl/strings/str_cat.h"
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_command_queue.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/gpu_object.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-struct BufferDescriptor : public GPUObjectDescriptor {
-  DataType element_type;
-  int element_size;
-  MemoryType memory_type = MemoryType::GLOBAL;
-  std::vector attributes;
-
-  // optional
-  int size = 0;
-  std::vector data;
-
-  BufferDescriptor() = default;
-  BufferDescriptor(const BufferDescriptor&) = default;
-  BufferDescriptor& operator=(const BufferDescriptor&) = default;
-  BufferDescriptor(BufferDescriptor&& desc);
-  BufferDescriptor& operator=(BufferDescriptor&& desc);
-
-  absl::Status PerformSelector(const std::string& selector,
-                               const std::vector& args,
-                               const std::vector& template_args,
-                               std::string* result) const override;
-
-  GPUResources GetGPUResources() const override;
-  absl::Status PerformReadSelector(const std::vector& args,
-                                   std::string* result) const;
-  absl::Status PerformGetPtrSelector(
-      const std::vector& args,
-      const std::vector& template_args, std::string* result) const;
-
-  absl::Status CreateGPUObject(CLContext* context,
-                               GPUObjectPtr* result) const override;
-  void Release() override;
-};
-
-// Buffer represent linear GPU data storage with arbitrary data format.
-// Buffer is moveable but not copyable.
-class Buffer : public GPUObject {
- public:
-  Buffer() {}  // just for using Buffer as a class members
-  Buffer(cl_mem buffer, size_t size_in_bytes);
-
-  // Move only
-  Buffer(Buffer&& buffer);
-  Buffer& operator=(Buffer&& buffer);
-  Buffer(const Buffer&) = delete;
-  Buffer& operator=(const Buffer&) = delete;
-
-  virtual ~Buffer() { Release(); }
-
-  // for profiling and memory statistics
-  uint64_t GetMemorySizeInBytes() const { return size_; }
-
-  cl_mem GetMemoryPtr() const { return buffer_; }
-
-  // Writes data to a buffer. Data should point to a region that
-  // has exact size in bytes as size_in_bytes(constructor parameter).
-  template 
-  absl::Status WriteData(CLCommandQueue* queue, const absl::Span data);
-
-  // Reads data from Buffer into CPU memory.
-  template 
-  absl::Status ReadData(CLCommandQueue* queue, std::vector* result) const;
-
-  absl::Status GetGPUResources(const GPUObjectDescriptor* obj_ptr,
-                               GPUResourcesWithValue* resources) const override;
-
-  absl::Status CreateFromBufferDescriptor(const BufferDescriptor& desc,
-                                          CLContext* context);
-
- private:
-  void Release();
-
-  cl_mem buffer_ = nullptr;
-  size_t size_;
-};
-
-absl::Status CreateReadOnlyBuffer(size_t size_in_bytes, CLContext* context,
-                                  Buffer* result);
-
-absl::Status CreateReadOnlyBuffer(size_t size_in_bytes, const void* data,
-                                  CLContext* context, Buffer* result);
-
-absl::Status CreateReadWriteBuffer(size_t size_in_bytes, CLContext* context,
-                                   Buffer* result);
-
-template 
-absl::Status Buffer::WriteData(CLCommandQueue* queue,
-                               const absl::Span data) {
-  if (size_ != sizeof(T) * data.size()) {
-    return absl::InvalidArgumentError(
-        "absl::Span data size is different from buffer allocated size.");
-  }
-  RETURN_IF_ERROR(queue->EnqueueWriteBuffer(buffer_, size_, data.data()));
-  return absl::OkStatus();
-}
-
-template 
-absl::Status Buffer::ReadData(CLCommandQueue* queue,
-                              std::vector* result) const {
-  if (size_ % sizeof(T) != 0) {
-    return absl::UnknownError("Wrong element size(typename T is not correct?");
-  }
-
-  const int elements_count = size_ / sizeof(T);
-  result->resize(elements_count);
-
-  return queue->EnqueueReadBuffer(buffer_, size_, result->data());
-}
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_BUFFER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_command_queue.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_command_queue.h
deleted file mode 100644
index 519b876..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_command_queue.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* 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_CL_CL_COMMAND_QUEUE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_COMMAND_QUEUE_H_
-
-#include 
-#include 
-#include 
-
-#include "absl/time/time.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_event.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-struct ProfilingInfo {
-  struct DispatchInfo {
-    std::string label;
-    absl::Duration duration;
-  };
-
-  std::vector dispatches;
-
-  absl::Duration GetTotalTime() const;
-
-  // Returns report (string of lines delimited by \n)
-  // This method uses GPU counters and measure GPU time only.
-  // Report has next structure:
-  // Per kernel timing(K kernels):
-  //   conv2d 3.2ms
-  //   ...
-  // --------------------
-  // Accumulated time per operation type:
-  //   conv2d - 14.5ms
-  //   ....
-  // --------------------
-  // Ideal total time: 23.4ms // Total time for all kernels
-  std::string GetDetailedReport() const;
-};
-
-// A wrapper around opencl command queue
-class CLCommandQueue {
- public:
-  CLCommandQueue() {}
-  CLCommandQueue(cl_command_queue queue, bool has_ownership);
-
-  // Move only
-  CLCommandQueue(CLCommandQueue&& queue);
-  CLCommandQueue& operator=(CLCommandQueue&& queue);
-  CLCommandQueue(const CLCommandQueue&) = delete;
-  CLCommandQueue& operator=(const CLCommandQueue&) = delete;
-
-  virtual ~CLCommandQueue();
-
-  cl_command_queue queue() const { return queue_; }
-
-  virtual absl::Status Dispatch(const CLKernel& kernel,
-                                const int3& work_groups_count,
-                                const int3& work_group_size);
-
-  absl::Status Dispatch(const CLKernel& kernel, const int3& work_groups_count,
-                        const int3& work_group_size, CLEvent* event);
-
-  absl::Status EnqueueEvent(CLEvent* event);
-
-  absl::Status EnqueueWriteImage(cl_mem memory, int3 region, const void* data);
-  absl::Status EnqueueReadImage(cl_mem memory, int3 region, void* data);
-
-  absl::Status EnqueueWriteBuffer(cl_mem memory, size_t size_in_bytes,
-                                  const void* data);
-  absl::Status EnqueueReadBuffer(cl_mem memory, size_t size_in_bytes,
-                                 void* data);
-
-  absl::Status WaitForCompletion();
-
- protected:
-  void Release();
-
-  cl_command_queue queue_ = nullptr;
-  bool has_ownership_ = false;
-};
-
-class ProfilingCommandQueue : public CLCommandQueue {
- public:
-  ProfilingCommandQueue() {}
-  explicit ProfilingCommandQueue(cl_command_queue queue);
-
-  // Move only
-  ProfilingCommandQueue(ProfilingCommandQueue&& queue);
-  ProfilingCommandQueue& operator=(ProfilingCommandQueue&& queue);
-  ProfilingCommandQueue(const ProfilingCommandQueue&) = delete;
-  ProfilingCommandQueue& operator=(const ProfilingCommandQueue&) = delete;
-
-  absl::Status Dispatch(const CLKernel& kernel, const int3& work_groups_count,
-                        const int3& work_group_size) override;
-
-  // will write index for fastest work_group among work_group_sizes
-  absl::Status GetBestWorkGroupIndex(const CLKernel& kernel,
-                                     const DeviceInfo& device_info,
-                                     const std::vector& work_groups_count,
-                                     const std::vector& work_group_sizes,
-                                     int* index);
-
-  // call ResetMeasurements() to start new seriese of measurements
-  void ResetMeasurements();
-
-  double GetQueueExecutionTimeMs() const;
-
-  // Difference from GetQueueExecutionTimeMs is that this number doesn't include
-  // time between kernels(kernels launches or preparing) on GPU. Usually, this
-  // time should be 5-10% better than GetQueueExecutionTimeMs, because 5-10%
-  // spend on something else(maybe kernels launches or preparing)
-  double GetSumOfEventsTimeMs() const;
-
-  // This label will be used for all subsequent dispatches.
-  void SetEventsLabel(const std::string& name);
-
-  ProfilingInfo GetProfilingInfo() const;
-
- private:
-  std::vector events_;
-  std::string current_label_;
-};
-
-absl::Status CreateCLCommandQueue(const CLDevice& device,
-                                  const CLContext& context,
-                                  CLCommandQueue* result);
-
-absl::Status CreateProfilingCommandQueue(const CLDevice& device,
-                                         const CLContext& context,
-                                         ProfilingCommandQueue* result);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_COMMAND_QUEUE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_context.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_context.h
deleted file mode 100644
index 11922bd..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_context.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 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_CL_CL_CONTEXT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_CONTEXT_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// A RAII wrapper around opencl context
-class CLContext {
- public:
-  CLContext() {}
-  CLContext(cl_context context, bool has_ownership);
-
-  // Move only
-  CLContext(CLContext&& context);
-  CLContext& operator=(CLContext&& context);
-  CLContext(const CLContext&) = delete;
-  CLContext& operator=(const CLContext&) = delete;
-
-  ~CLContext();
-
-  cl_context context() const { return context_; }
-
-  bool IsFloatTexture2DSupported(int num_channels, DataType data_type,
-                                 cl_mem_flags flags = CL_MEM_READ_WRITE) const;
-
- private:
-  void Release();
-
-  cl_context context_ = nullptr;
-  bool has_ownership_ = false;
-};
-
-absl::Status CreateCLContext(const CLDevice& device, CLContext* result);
-absl::Status CreateCLGLContext(const CLDevice& device,
-                               cl_context_properties egl_context,
-                               cl_context_properties egl_display,
-                               CLContext* result);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_CONTEXT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_device.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_device.h
deleted file mode 100644
index 79335a6..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_device.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* 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_CL_CL_DEVICE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_DEVICE_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/device_info.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// A wrapper around opencl device id
-class CLDevice {
- public:
-  CLDevice() = default;
-  CLDevice(cl_device_id id, cl_platform_id platform_id);
-
-  CLDevice(CLDevice&& device);
-  CLDevice& operator=(CLDevice&& device);
-  CLDevice(const CLDevice&);
-  CLDevice& operator=(const CLDevice&);
-
-  ~CLDevice() {}
-
-  cl_device_id id() const { return id_; }
-  cl_platform_id platform() const { return platform_id_; }
-  std::string GetPlatformVersion() const;
-
-  Vendor vendor() const { return info_.vendor; }
-  OpenCLVersion cl_version() const { return info_.cl_version; }
-  bool SupportsFP16() const;
-  bool SupportsTextureArray() const;
-  bool SupportsImageBuffer() const;
-  bool SupportsImage3D() const;
-  bool SupportsExtension(const std::string& extension) const;
-  bool SupportsFP32RTN() const;
-  bool SupportsFP16RTN() const;
-  bool IsCL20OrHigher() const;
-  bool SupportsSubGroupWithSize(int sub_group_size) const;
-  bool IsAdreno() const;
-  bool IsAdreno3xx() const;
-  bool IsAdreno4xx() const;
-  bool IsAdreno5xx() const;
-  bool IsAdreno6xx() const;
-  bool IsAdreno6xxOrHigher() const;
-  bool IsPowerVR() const;
-  bool IsNvidia() const;
-  bool IsMali() const;
-  bool IsAMD() const;
-  bool IsIntel() const;
-
-  // To track bug on some Adreno. b/131099086
-  bool SupportsOneLayerTextureArray() const;
-  void DisableOneLayerTextureArray();
-
-  const DeviceInfo& GetInfo() const { return info_; }
-  // We update device info during context creation, so as supported texture
-  // formats can be requested from context only.
-  mutable DeviceInfo info_;
-
- private:
-  cl_device_id id_ = nullptr;
-  cl_platform_id platform_id_ = nullptr;
-};
-
-absl::Status CreateDefaultGPUDevice(CLDevice* result);
-
-template 
-T GetDeviceInfo(cl_device_id id, cl_device_info info) {
-  T result;
-  cl_int error = clGetDeviceInfo(id, info, sizeof(T), &result, nullptr);
-  if (error != CL_SUCCESS) {
-    return -1;
-  }
-  return result;
-}
-
-template 
-absl::Status GetDeviceInfo(cl_device_id id, cl_device_info info, T* result) {
-  cl_int error = clGetDeviceInfo(id, info, sizeof(T), result, nullptr);
-  if (error != CL_SUCCESS) {
-    return absl::InvalidArgumentError(CLErrorCodeToString(error));
-  }
-  return absl::OkStatus();
-}
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_DEVICE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_errors.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_errors.h
deleted file mode 100644
index fb59766..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_errors.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* 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_CL_CL_ERRORS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_ERRORS_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// @return if error_code is success, then return OK status. Otherwise translates
-// error code into a message.
-inline absl::Status GetOpenCLError(cl_int error_code) {
-  if (error_code == CL_SUCCESS) {
-    return absl::OkStatus();
-  }
-  return absl::InternalError("OpenCL error: " +
-                             CLErrorCodeToString(error_code));
-}
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_ERRORS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_event.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_event.h
deleted file mode 100644
index 898e7a9..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_event.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* 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_CL_CL_EVENT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_EVENT_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// A RAII wrapper around opencl event
-class CLEvent {
- public:
-  CLEvent() {}
-  explicit CLEvent(cl_event event);
-
-  // Move only
-  CLEvent(CLEvent&& event);
-  CLEvent& operator=(CLEvent&& event);
-  CLEvent(const CLEvent&) = delete;
-  CLEvent& operator=(const CLEvent&) = delete;
-
-  ~CLEvent();
-
-  uint64_t GetStartedTimeNs() const;
-  uint64_t GetFinishedTimeNs() const;
-
-  double GetEventTimeMs() const;
-  uint64_t GetEventTimeNs() const;
-
-  void Wait() const;
-
-  cl_event event() const { return event_; }
-
-  bool is_valid() const { return event_ != nullptr; }
-
-  void SetName(const std::string& name);
-  std::string GetName() const { return name_; }
-
- private:
-  void Release();
-
-  cl_event event_ = nullptr;
-
-  std::string name_;  // optional, for profiling mostly
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_EVENT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_image_format.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_image_format.h
deleted file mode 100644
index b4d0044..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_image_format.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_CL_CL_IMAGE_FORMAT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_IMAGE_FORMAT_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-cl_channel_order ToChannelOrder(int num_channels);
-
-cl_channel_type ToImageChannelType(DataType data_type);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_IMAGE_FORMAT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_kernel.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_kernel.h
deleted file mode 100644
index 0af8052..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_kernel.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* 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_CL_CL_KERNEL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_KERNEL_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_program.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-struct KernelInfo {
-  int private_memory_size;
-  int max_work_group_size;
-};
-
-// Arguments binding to CLKernel can be manual or automatic
-// In manual you specify binding index explicitly
-// In automatic binding, index auto-incremented with every binding call
-// Also, if you use automatic mode you must call ResetBindingCounter
-//   before parameters binding
-class CLKernel {
- public:
-  CLKernel() {}
-
-  // Move only
-  CLKernel(CLKernel&& kernel);
-  CLKernel& operator=(CLKernel&& kernel);
-  CLKernel(const CLKernel&) = delete;
-  CLKernel& operator=(const CLKernel&) = delete;
-
-  ~CLKernel();
-
-  cl_kernel kernel() const { return kernel_; }
-
-  absl::Status CreateFromProgram(const CLProgram& program,
-                                 const std::string& function_name);
-
-  absl::Status SetMemory(int index, cl_mem memory);
-  absl::Status SetMemoryAuto(cl_mem memory);
-  template 
-  absl::Status SetBytes(int index, const T& value) const {
-    return SetBytes(index, static_cast(&value), sizeof(T));
-  }
-  template 
-  absl::Status SetBytesAuto(const T& value) {
-    return SetBytesAuto(static_cast(&value), sizeof(T));
-  }
-
-  int GetBindingCounter() const { return binding_counter_; }
-  void ResetBindingCounter() { binding_counter_ = 0; }
-
-  // Do not use this function
-  // workaround for Mali memory leak
-  absl::Status ReInit() const;
-
-  KernelInfo info_;
-
- private:
-  void Release();
-  absl::Status SetBytes(int index, const void* ptr, int length) const;
-  absl::Status SetBytesAuto(const void* ptr, int length);
-
-  int binding_counter_ = -1;
-
-  std::string function_name_;
-  // reference to program from which kernel was created
-  cl_program program_ = nullptr;
-  cl_kernel kernel_ = nullptr;
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_KERNEL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_memory.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_memory.h
deleted file mode 100644
index 9252a2f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_memory.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* 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_CL_CL_MEMORY_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_MEMORY_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/common/access_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// RAII wrapper for OpenCL memory object.
-//
-// Image is moveable but not copyable.
-class CLMemory {
- public:
-  // Creates invalid object.
-  CLMemory() : CLMemory(nullptr, false) {}
-
-  CLMemory(cl_mem memory, bool has_ownership)
-      : memory_(memory), has_ownership_(has_ownership) {}
-
-  // Move-only
-  CLMemory(const CLMemory&) = delete;
-  CLMemory& operator=(const CLMemory&) = delete;
-  CLMemory(CLMemory&& image)
-      : memory_(image.memory_), has_ownership_(image.has_ownership_) {
-    image.memory_ = nullptr;
-  }
-
-  ~CLMemory() { Invalidate(); }
-
-  CLMemory& operator=(CLMemory&& image) {
-    if (this != &image) {
-      Invalidate();
-      std::swap(memory_, image.memory_);
-      has_ownership_ = image.has_ownership_;
-    }
-    return *this;
-  }
-
-  cl_mem memory() const { return memory_; }
-
-  bool is_valid() const { return memory_ != nullptr; }
-
-  // @return true if this object actually owns corresponding CL memory
-  //         and manages it's lifetime.
-  bool has_ownership() const { return has_ownership_; }
-
-  cl_mem Release() {
-    cl_mem to_return = memory_;
-    memory_ = nullptr;
-    return to_return;
-  }
-
- private:
-  void Invalidate() {
-    if (memory_ && has_ownership_) {
-      clReleaseMemObject(memory_);
-    }
-    memory_ = nullptr;
-  }
-
-  cl_mem memory_ = nullptr;
-  bool has_ownership_ = false;
-};
-
-cl_mem_flags ToClMemFlags(AccessType access_type);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_MEMORY_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_program.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_program.h
deleted file mode 100644
index af8239a..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_program.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* 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_CL_CL_PROGRAM_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_PROGRAM_H_
-
-#include 
-#include 
-
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-enum class CompilerOptions {
-  // ADRENO_FULL_SIMD_LINE:
-  //   Adreno can have 2 sizes for SIMD size.
-  //   On Adreno 4xx/5xx it is 32/64, on Adreno6xx it is 64/128.
-  //   Some our algorithms actually rely on exact size, for example on full
-  //   SIMD size, so we need this define.
-  //   This define is actually -qcom-accelerate-16-bit, but it controls SIMD
-  //   size.
-  ADRENO_FULL_SIMD_LINE,
-  ADRENO_MORE_WAVES,
-  POWERVR_FP16,
-  CL_OPT_DISABLE,
-  CL_2_0,
-  CL_3_0,
-};
-
-std::string CompilerOptionsToString(
-    const CLDevice& device,
-    const std::vector& compiler_options);
-
-class CLProgram {
- public:
-  CLProgram() {}
-  CLProgram(cl_program program, cl_device_id device_id);
-
-  // Move only
-  CLProgram(CLProgram&& program);
-  CLProgram& operator=(CLProgram&& program);
-  CLProgram(const CLProgram&) = delete;
-  CLProgram& operator=(const CLProgram&) = delete;
-
-  ~CLProgram();
-
-  cl_program program() const { return program_; }
-
-  // Return the cl_device_id associated with the program object.
-  // This can be the device associated with context on which the program object
-  // has been created or can be device that was specified when a program object
-  // was created using clCreateProgramWithBinary.
-  cl_device_id GetDeviceId() const { return device_id_; }
-
-  absl::Status GetBinary(std::vector* result) const;
-
- private:
-  void Release();
-
-  cl_program program_ = nullptr;
-
-  // reference
-  cl_device_id device_id_ = nullptr;
-};
-
-absl::Status CreateCLProgram(const std::string& code,
-                             const std::string& compiler_options,
-                             const CLContext& context, const CLDevice& device,
-                             CLProgram* result);
-
-absl::Status CreateCLProgramFromBinary(const CLContext& context,
-                                       const CLDevice& device,
-                                       absl::Span binary,
-                                       CLProgram* result);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_PROGRAM_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_test.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_test.h
deleted file mode 100644
index 5d6e9dd..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/cl_test.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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_CL_CL_TEST_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_TEST_H_
-
-#include 
-
-#include 
-#include 
-#include "tensorflow/lite/delegates/gpu/cl/environment.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-#ifndef ASSERT_OK
-#define ASSERT_OK(x) ASSERT_TRUE(x.ok());
-#endif
-
-class OpenCLTest : public ::testing::Test {
- public:
-  void SetUp() override {
-    ASSERT_OK(LoadOpenCL());
-    ASSERT_OK(CreateEnvironment(&env_));
-  }
-
- protected:
-  Environment env_;
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_CL_TEST_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/compiled_program_cache_generated.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/compiled_program_cache_generated.h
deleted file mode 100644
index 8a12bf2..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/compiled_program_cache_generated.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* 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.
-==============================================================================*/
-// automatically generated by the FlatBuffers compiler, do not modify
-
-
-#ifndef FLATBUFFERS_GENERATED_COMPILEDPROGRAMCACHE_TFLITE_GPU_CL_DATA_H_
-#define FLATBUFFERS_GENERATED_COMPILEDPROGRAMCACHE_TFLITE_GPU_CL_DATA_H_
-
-#include "flatbuffers/flatbuffers.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-namespace data {
-
-struct Program;
-
-struct CompiledCache;
-
-struct Program FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
-  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
-    VT_FINGERPRINT = 4,
-    VT_BINARY = 6
-  };
-  uint64_t fingerprint() const {
-    return GetField(VT_FINGERPRINT, 0);
-  }
-  const flatbuffers::Vector *binary() const {
-    return GetPointer *>(VT_BINARY);
-  }
-  bool Verify(flatbuffers::Verifier &verifier) const {
-    return VerifyTableStart(verifier) &&
-           VerifyField(verifier, VT_FINGERPRINT) &&
-           VerifyOffset(verifier, VT_BINARY) &&
-           verifier.VerifyVector(binary()) &&
-           verifier.EndTable();
-  }
-};
-
-struct ProgramBuilder {
-  flatbuffers::FlatBufferBuilder &fbb_;
-  flatbuffers::uoffset_t start_;
-  void add_fingerprint(uint64_t fingerprint) {
-    fbb_.AddElement(Program::VT_FINGERPRINT, fingerprint, 0);
-  }
-  void add_binary(flatbuffers::Offset> binary) {
-    fbb_.AddOffset(Program::VT_BINARY, binary);
-  }
-  explicit ProgramBuilder(flatbuffers::FlatBufferBuilder &_fbb)
-        : fbb_(_fbb) {
-    start_ = fbb_.StartTable();
-  }
-  ProgramBuilder &operator=(const ProgramBuilder &);
-  flatbuffers::Offset Finish() {
-    const auto end = fbb_.EndTable(start_);
-    auto o = flatbuffers::Offset(end);
-    return o;
-  }
-};
-
-inline flatbuffers::Offset CreateProgram(
-    flatbuffers::FlatBufferBuilder &_fbb,
-    uint64_t fingerprint = 0,
-    flatbuffers::Offset> binary = 0) {
-  ProgramBuilder builder_(_fbb);
-  builder_.add_fingerprint(fingerprint);
-  builder_.add_binary(binary);
-  return builder_.Finish();
-}
-
-inline flatbuffers::Offset CreateProgramDirect(
-    flatbuffers::FlatBufferBuilder &_fbb,
-    uint64_t fingerprint = 0,
-    const std::vector *binary = nullptr) {
-  auto binary__ = binary ? _fbb.CreateVector(*binary) : 0;
-  return tflite::gpu::cl::data::CreateProgram(
-      _fbb,
-      fingerprint,
-      binary__);
-}
-
-struct CompiledCache FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table {
-  enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
-    VT_DRIVER_VERSION = 4,
-    VT_PROGRAMS = 6
-  };
-  const flatbuffers::String *driver_version() const {
-    return GetPointer(VT_DRIVER_VERSION);
-  }
-  const flatbuffers::Vector> *programs() const {
-    return GetPointer> *>(VT_PROGRAMS);
-  }
-  bool Verify(flatbuffers::Verifier &verifier) const {
-    return VerifyTableStart(verifier) &&
-           VerifyOffset(verifier, VT_DRIVER_VERSION) &&
-           verifier.VerifyString(driver_version()) &&
-           VerifyOffset(verifier, VT_PROGRAMS) &&
-           verifier.VerifyVector(programs()) &&
-           verifier.VerifyVectorOfTables(programs()) &&
-           verifier.EndTable();
-  }
-};
-
-struct CompiledCacheBuilder {
-  flatbuffers::FlatBufferBuilder &fbb_;
-  flatbuffers::uoffset_t start_;
-  void add_driver_version(flatbuffers::Offset driver_version) {
-    fbb_.AddOffset(CompiledCache::VT_DRIVER_VERSION, driver_version);
-  }
-  void add_programs(flatbuffers::Offset>> programs) {
-    fbb_.AddOffset(CompiledCache::VT_PROGRAMS, programs);
-  }
-  explicit CompiledCacheBuilder(flatbuffers::FlatBufferBuilder &_fbb)
-        : fbb_(_fbb) {
-    start_ = fbb_.StartTable();
-  }
-  CompiledCacheBuilder &operator=(const CompiledCacheBuilder &);
-  flatbuffers::Offset Finish() {
-    const auto end = fbb_.EndTable(start_);
-    auto o = flatbuffers::Offset(end);
-    return o;
-  }
-};
-
-inline flatbuffers::Offset CreateCompiledCache(
-    flatbuffers::FlatBufferBuilder &_fbb,
-    flatbuffers::Offset driver_version = 0,
-    flatbuffers::Offset>> programs = 0) {
-  CompiledCacheBuilder builder_(_fbb);
-  builder_.add_programs(programs);
-  builder_.add_driver_version(driver_version);
-  return builder_.Finish();
-}
-
-inline flatbuffers::Offset CreateCompiledCacheDirect(
-    flatbuffers::FlatBufferBuilder &_fbb,
-    const char *driver_version = nullptr,
-    const std::vector> *programs = nullptr) {
-  auto driver_version__ = driver_version ? _fbb.CreateString(driver_version) : 0;
-  auto programs__ = programs ? _fbb.CreateVector>(*programs) : 0;
-  return tflite::gpu::cl::data::CreateCompiledCache(
-      _fbb,
-      driver_version__,
-      programs__);
-}
-
-inline const tflite::gpu::cl::data::CompiledCache *GetCompiledCache(const void *buf) {
-  return flatbuffers::GetRoot(buf);
-}
-
-inline const tflite::gpu::cl::data::CompiledCache *GetSizePrefixedCompiledCache(const void *buf) {
-  return flatbuffers::GetSizePrefixedRoot(buf);
-}
-
-inline const char *CompiledCacheIdentifier() {
-  return "AFCM";
-}
-
-inline bool CompiledCacheBufferHasIdentifier(const void *buf) {
-  return flatbuffers::BufferHasIdentifier(
-      buf, CompiledCacheIdentifier());
-}
-
-inline bool VerifyCompiledCacheBuffer(
-    flatbuffers::Verifier &verifier) {
-  return verifier.VerifyBuffer(CompiledCacheIdentifier());
-}
-
-inline bool VerifySizePrefixedCompiledCacheBuffer(
-    flatbuffers::Verifier &verifier) {
-  return verifier.VerifySizePrefixedBuffer(CompiledCacheIdentifier());
-}
-
-inline const char *CompiledCacheExtension() {
-  return "jetbin";
-}
-
-inline void FinishCompiledCacheBuffer(
-    flatbuffers::FlatBufferBuilder &fbb,
-    flatbuffers::Offset root) {
-  fbb.Finish(root, CompiledCacheIdentifier());
-}
-
-inline void FinishSizePrefixedCompiledCacheBuffer(
-    flatbuffers::FlatBufferBuilder &fbb,
-    flatbuffers::Offset root) {
-  fbb.FinishSizePrefixed(root, CompiledCacheIdentifier());
-}
-
-}  // namespace data
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // FLATBUFFERS_GENERATED_COMPILEDPROGRAMCACHE_TFLITE_GPU_CL_DATA_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/device_info.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/device_info.h
deleted file mode 100644
index f28f471..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/device_info.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_DEVICE_INFO_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_DEVICE_INFO_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-
-// for use only in device_info.cc, but keep here to make tests
-int GetAdrenoGPUVersion(const std::string& gpu_version);
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-enum class Vendor {
-  kQualcomm,
-  kMali,
-  kPowerVR,
-  kNvidia,
-  kAMD,
-  kIntel,
-  kUnknown
-};
-std::string VendorToString(Vendor v);
-
-enum class OpenCLVersion {
-  CL_1_0,
-  CL_1_1,
-  CL_1_2,
-  CL_2_0,
-  CL_2_1,
-  CL_2_2,
-  CL_3_0
-};
-std::string OpenCLVersionToString(OpenCLVersion version);
-
-struct AdrenoInfo {
-  AdrenoInfo() = default;
-  explicit AdrenoInfo(const std::string& device_version);
-  int gpu_version = -1;  // can be, for example, 405/430/540/530/630 etc.
-
-  // This function returns some not very documented physical parameter of
-  // Adreno6xx GPU.
-  // We obtained it using Snapdragon Profiler.
-  int GetMaximumWavesCount() const;
-
-  // returns amount of register memory per CU(Compute Unit) in bytes.
-  int GetRegisterMemorySizePerComputeUnit() const;
-
-  // returns maximum possible amount of waves based on register usage.
-  int GetMaximumWavesCount(int register_footprint_per_tread,
-                           bool full_wave = true) const;
-
-  int GetWaveSize(bool full_wave) const;
-
-  // Not supported on some Adreno devices with specific driver version.
-  // b/131099086
-  bool support_one_layer_texture_array = true;
-};
-
-enum class MaliGPU {
-  T604,
-  T622,
-  T624,
-  T628,
-  T658,
-  T678,
-  T720,
-  T760,
-  T820,
-  T830,
-  T860,
-  T880,
-  G31,
-  G51,
-  G71,
-  G52,
-  G72,
-  G76,
-  G57,
-  G77,
-  G68,
-  G78,
-  UNKNOWN
-};
-
-struct MaliInfo {
-  MaliInfo() = default;
-  explicit MaliInfo(const std::string& device_name);
-  MaliGPU gpu_version;
-
-  bool IsMaliT6xx() const;
-  bool IsMaliT7xx() const;
-  bool IsMaliT8xx() const;
-  bool IsMidgard() const;
-  bool IsBifrostGen1() const;
-  bool IsBifrostGen2() const;
-  bool IsBifrostGen3() const;
-  bool IsBifrost() const;
-  bool IsValhall() const;
-};
-
-struct DeviceInfo {
-  DeviceInfo() = default;
-
-  bool IsAdreno() const;
-  bool IsAdreno3xx() const;
-  bool IsAdreno4xx() const;
-  bool IsAdreno5xx() const;
-  bool IsAdreno6xx() const;
-  bool IsAdreno6xxOrHigher() const;
-  bool IsPowerVR() const;
-  bool IsNvidia() const;
-  bool IsMali() const;
-  bool IsAMD() const;
-  bool IsIntel() const;
-
-  bool SupportsTextureArray() const;
-  bool SupportsImageBuffer() const;
-  bool SupportsImage3D() const;
-
-  bool SupportsFloatImage2D(DataType data_type, int channels) const;
-
-  // To track bug on some Adreno. b/131099086
-  bool SupportsOneLayerTextureArray() const;
-
-  bool SupportsExtension(const std::string& extension) const;
-  bool IsCL20OrHigher() const;
-  bool SupportsSubGroupWithSize(int sub_group_size) const;
-
-  std::vector extensions;
-  bool supports_fp16;
-  bool supports_image3d_writes;
-  Vendor vendor;
-  OpenCLVersion cl_version;
-  int compute_units_count;
-  uint64_t buffer_max_size;
-  uint64_t image2d_max_width;
-  uint64_t image2d_max_height;
-  uint64_t image_buffer_max_size;
-  uint64_t image_array_max_layers;
-  uint64_t image3d_max_width;
-  uint64_t image3d_max_height;
-  uint64_t image3d_max_depth;
-  int max_work_group_size_x;
-  int max_work_group_size_y;
-  int max_work_group_size_z;
-  std::vector supported_subgroup_sizes;
-
-  // rtn is ROUND_TO_NEAREST
-  // with rtn precision is much better then with rtz (ROUND_TO_ZERO)
-  // Adreno 3xx supports only rtz, Adreno 4xx and more support rtn
-  // Mali from T6xx supports rtn
-  // PowerVR supports only rtz
-  bool supports_fp32_rtn;
-  bool supports_fp16_rtn;
-
-  bool supports_r_f16_tex2d = false;
-  bool supports_rg_f16_tex2d = false;
-  bool supports_rgb_f16_tex2d = false;
-  bool supports_rgba_f16_tex2d = false;
-
-  bool supports_r_f32_tex2d = false;
-  bool supports_rg_f32_tex2d = false;
-  bool supports_rgb_f32_tex2d = false;
-  bool supports_rgba_f32_tex2d = false;
-
-  AdrenoInfo adreno_info;
-  MaliInfo mali_info;
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_DEVICE_INFO_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/egl_sync.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/egl_sync.h
deleted file mode 100644
index dbea243..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/egl_sync.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* 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_CL_EGL_SYNC_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_EGL_SYNC_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// RAII wrapper for EGL sync object.
-// EglSync is moveable but not copyable.
-class EglSync {
- public:
-  // Creates a fence in OpenGL command stream. This sync is enqueued and *not*
-  // flushed.
-  //
-  // Depends on EGL_KHR_fence_sync extension.
-  static absl::Status NewFence(EGLDisplay display, EglSync* sync);
-
-  // Creates invalid object.
-  EglSync() : EglSync(EGL_NO_DISPLAY, EGL_NO_SYNC_KHR) {}
-
-  EglSync(EGLDisplay display, EGLSyncKHR sync)
-      : display_(display), sync_(sync) {}
-
-  // Move-only
-  EglSync(EglSync&& sync);
-  EglSync& operator=(EglSync&& sync);
-  EglSync(const EglSync&) = delete;
-  EglSync& operator=(const EglSync&) = delete;
-
-  ~EglSync() { Invalidate(); }
-
-  // Causes GPU to block and wait until this sync has been signaled.
-  // This call does not block and returns immediately.
-  absl::Status ServerWait();
-
-  // Causes CPU to block and wait until this sync has been signaled.
-  absl::Status ClientWait();
-
-  // Returns the EGLDisplay on which this instance was created.
-  EGLDisplay display() const { return display_; }
-
-  // Returns the EGLSyncKHR wrapped by this instance.
-  EGLSyncKHR sync() const { return sync_; }
-
-  // Returns true if this instance wraps a valid EGLSync object.
-  bool is_valid() const { return sync_ != nullptr; }
-
- private:
-  void Invalidate();
-
-  EGLDisplay display_;
-  EGLSyncKHR sync_;
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_EGL_SYNC_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/environment.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/environment.h
deleted file mode 100644
index 1f5b4be..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/environment.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* 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_CL_ENVIRONMENT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_ENVIRONMENT_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_command_queue.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/device_info.h"
-#include "tensorflow/lite/delegates/gpu/cl/precision.h"
-#include "tensorflow/lite/delegates/gpu/cl/program_cache.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/tensor.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class Environment {
- public:
-  Environment() = default;
-  explicit Environment(CLDevice&& device, CLContext&& context,
-                       CLCommandQueue&& queue,
-                       ProfilingCommandQueue&& profiling_queue);
-  // Move only
-  Environment(Environment&& environment);
-  Environment& operator=(Environment&& environment);
-  Environment(const Environment&) = delete;
-  Environment& operator=(const Environment&) = delete;
-
-  const CLDevice& device() const { return device_; }
-  CLDevice* GetDevicePtr() { return &device_; }
-  const CLDevice* GetDevicePtr() const { return &device_; }
-  CLContext& context() { return context_; }
-  CLCommandQueue* queue() { return &queue_; }
-  ProfilingCommandQueue* profiling_queue() { return &profiling_queue_; }
-  ProgramCache* program_cache() { return &program_cache_; }
-  const ProgramCache* program_cache() const { return &program_cache_; }
-
-  std::vector GetSupportedPrecisions() const;
-  bool IsSupported(CalculationsPrecision precision) const;
-  std::vector GetSupportedStorages() const;
-  // returns storage types that support zero clamping when reading OOB in HW
-  // (Height/Width) dimensions.
-  std::vector GetSupportedStoragesWithHWZeroClampSupport()
-      const;
-  bool IsSupported(TensorStorageType storage_type) const;
-
-  absl::Status Init();
-
-  void SetHighPerformance() const;
-  void SetDefaultPerformance() const;
-  void SetLowPerformance() const;  // for energy saving
-
- private:
-  CLDevice device_;
-  CLContext context_;
-  CLCommandQueue queue_;
-  ProfilingCommandQueue profiling_queue_;
-  ProgramCache program_cache_;
-};
-
-TensorStorageType GetFastestStorageType(const DeviceInfo& gpu_info);
-TensorStorageType GetStorageTypeWithMinimalMemoryConsumption(
-    const DeviceInfo& gpu_info);
-
-absl::Status CreateEnvironment(Environment* result);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_ENVIRONMENT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/gl_interop.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/gl_interop.h
deleted file mode 100644
index aac769b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/gl_interop.h
+++ /dev/null
@@ -1,172 +0,0 @@
-/* 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_CL_GL_INTEROP_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_GL_INTEROP_H_
-
-#include 
-#include 
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_command_queue.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_event.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_memory.h"
-#include "tensorflow/lite/delegates/gpu/cl/egl_sync.h"
-#include "tensorflow/lite/delegates/gpu/cl/environment.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/common/access_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
-#include "tensorflow/lite/delegates/gpu/spi.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// Creates an EglSync from OpenCL event. Source event does not need to outlive
-// returned sync and could be safely destroyed.
-//
-// Depends on EGL 1.5.
-absl::Status CreateEglSyncFromClEvent(cl_event event, EGLDisplay display,
-                                      EglSync* sync);
-
-// Returns true if 'CreateEglSyncFromClEvent' is supported.
-bool IsEglSyncFromClEventSupported();
-
-// Creates CL event from EGL sync.
-// Created event could only be consumed by AcquiredGlObject::Acquire call as
-// a 'wait_event'.
-absl::Status CreateClEventFromEglSync(cl_context context,
-                                      const EglSync& egl_sync, CLEvent* event);
-
-// Returns true if 'CreateClEventFromEglSync' is supported.
-bool IsClEventFromEglSyncSupported(const CLDevice& device);
-
-// Creates new CL memory object from OpenGL buffer.
-absl::Status CreateClMemoryFromGlBuffer(GLuint gl_ssbo_id,
-                                        AccessType access_type,
-                                        CLContext* context, CLMemory* memory);
-
-// Creates new CL memory object from OpenGL texture.
-absl::Status CreateClMemoryFromGlTexture(GLenum texture_target,
-                                         GLuint texture_id,
-                                         AccessType access_type,
-                                         CLContext* context, CLMemory* memory);
-
-// Returns true if GL objects could be shared with OpenCL context.
-bool IsGlSharingSupported(const CLDevice& device);
-
-// RAII-wrapper for GL objects acquired into CL context.
-class AcquiredGlObjects {
- public:
-  static bool IsSupported(const CLDevice& device);
-
-  AcquiredGlObjects() : AcquiredGlObjects({}, nullptr) {}
-
-  // Quitely releases OpenGL objects. It is recommended to call Release()
-  // explicitly to properly handle potential errors.
-  ~AcquiredGlObjects();
-
-  // Acquires memory from the OpenGL context. Memory must be created by either
-  // CreateClMemoryFromGlBuffer or CreateClMemoryFromGlTexture calls.
-  // If 'acquire_event' is not nullptr, it will be signared once acquisition is
-  // complete.
-  static absl::Status Acquire(const std::vector& memory,
-                              cl_command_queue queue,
-                              const std::vector& wait_events,
-                              CLEvent* acquire_event /* optional */,
-                              AcquiredGlObjects* objects);
-
-  // Releases OpenCL memory back to OpenGL context. If 'release_event' is not
-  // nullptr, it will be signalled once release is complete.
-  absl::Status Release(const std::vector& wait_events,
-                       CLEvent* release_event /* optional */);
-
- private:
-  AcquiredGlObjects(const std::vector& memory, cl_command_queue queue)
-      : memory_(memory), queue_(queue) {}
-
-  std::vector memory_;
-  cl_command_queue queue_;
-};
-
-// Incapsulates all complicated GL-CL synchronization. It manages life time of
-// all appropriate events to ensure fast synchronization whenever possible.
-class GlInteropFabric {
- public:
-  GlInteropFabric(EGLDisplay egl_display, Environment* environment);
-
-  // Ensures proper GL->CL synchronization is in place before
-  // GL objects that are mapped to CL objects are used.
-  absl::Status Start();
-
-  // Puts appropriate CL->GL synchronization after all work is complete.
-  absl::Status Finish();
-
-  // Registers memory to be used from GL context. Such CL memory object must
-  // be created with CreateClMemoryFromGlBuffer or CreateClMemoryFromGlTexture
-  // call.
-  void RegisterMemory(cl_mem memory);
-
-  // Unregisters memory registered with RegisterMemory call.
-  void UnregisterMemory(cl_mem memory);
-
- private:
-  bool is_enabled() const { return egl_display_ && !memory_.empty(); }
-
-  bool is_egl_sync_supported_;
-  bool is_egl_to_cl_mapping_supported_;
-  bool is_cl_to_egl_mapping_supported_;
-
-  const EGLDisplay egl_display_;
-  cl_context context_;
-  cl_command_queue queue_;
-  CLEvent inbound_event_;
-  CLEvent outbound_event_;
-  std::vector memory_;
-  AcquiredGlObjects gl_objects_;  // transient during Start/Finish calls.
-};
-
-// Copies data from(to) GL buffer to(from) CL buffer using CPU.
-class GlClBufferCopier : public TensorObjectConverter {
- public:
-  static bool IsSupported(const ObjectDef& input, const ObjectDef& output) {
-    return input.data_type == output.data_type &&
-           input.data_layout == output.data_layout &&
-           ((input.object_type == ObjectType::OPENGL_SSBO &&
-             output.object_type == ObjectType::OPENCL_BUFFER) ||
-            (input.object_type == ObjectType::OPENCL_BUFFER &&
-             output.object_type == ObjectType::OPENGL_SSBO));
-  }
-
-  GlClBufferCopier(const TensorObjectDef& input_def,
-                   const TensorObjectDef& output_def, Environment* environment);
-
-  absl::Status Convert(const TensorObject& input_obj,
-                       const TensorObject& output_obj) override;
-
- private:
-  size_t size_in_bytes_;
-  CLCommandQueue* queue_ = nullptr;
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_GL_INTEROP_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/gpu_api_delegate.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/gpu_api_delegate.h
deleted file mode 100644
index 81d03a9..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/gpu_api_delegate.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* 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_CL_GPU_API_DELEGATE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_GPU_API_DELEGATE_H_
-
-#define GL_NO_PROTOTYPES
-#define EGL_NO_PROTOTYPES
-#include 
-#include 
-#undef GL_NO_PROTOTYPES
-#undef EGL_NO_PROTOTYPES
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/delegates/gpu/delegate.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-// Shader compilation options.
-typedef struct {
-  // When set to zero, computations are carried out in 32-bit floating point.
-  // Otherwise, the GPU may quantify tensors, downcast values, process in FP16
-  // (recommended).
-  int32_t precision_loss_allowed;
-
-  // Priority is defined in TfLiteGpuInferencePriority.
-  int32_t inference_priority;
-} TfLiteGpuCompileOptions_New;
-
-typedef struct {
-  TfLiteGpuCompileOptions_New compile_options;
-
-  // [Optional]
-  // Whenever EGL display and EGL context are set, corresponding OpenCL context
-  // will be created.
-  // These variables are required when using GL objects as inputs or outputs.
-  EGLDisplay egl_display;
-  EGLContext egl_context;
-
-  // [Optional]
-  // Contains data returned from TfLiteGpuDelegateGetSerializedBinaryCache call.
-  // Invalid or incompatible data will be discarded. Compiled binary may become
-  // incompatible when GPU driver is updated.
-  const uint8_t* serialized_binary_cache_data;
-  size_t serialized_binary_cache_size;
-} TfLiteGpuDelegateOptions_New;
-
-// Creates a new delegate instance that need to be destroyed with
-// TfLiteGpuDelegateDelete_New when delegate is no longer used by TFLite.
-// When `options` is set to `nullptr`, the following default values are used:
-// .compile_options = {
-//   .precision_loss_allowed = false,
-// }
-// .egl_display = EGL_NO_DISPLAY;
-// .egl_context = EGL_NO_CONTEXT;
-TFL_CAPI_EXPORT TfLiteDelegate* TfLiteGpuDelegateCreate_New(
-    const TfLiteGpuDelegateOptions_New* options);
-
-// Destroys a delegate created with `TfLiteGpuDelegateCreate_New` call.
-TFL_CAPI_EXPORT void TfLiteGpuDelegateDelete_New(TfLiteDelegate* delegate);
-
-typedef enum {
-  TFLITE_GPU_DATA_LAYOUT_BHWC = 0,
-  TFLITE_GPU_DATA_LAYOUT_DHWC4 = 1,
-} TfLiteGpuDataLayout;
-
-// Binds GL shader storage object to an input or an output tensor in the
-// initialized delegate. Bound buffer should have sufficient storage to
-// accommodate all elements of a tensor.
-//
-// Supports data of kTfliteFloat16 or kTfliteFloat32 types in BHWC or DHWC4 data
-// layouts.
-//
-// *** Must be called *before* `Interpreter::ModifyGraphWithDelegate`. ***
-TFL_CAPI_EXPORT TfLiteStatus TfLiteGpuDelegateBindGlBufferToTensor(
-    TfLiteDelegate* delegate, GLuint buffer_id, int tensor_index,
-    TfLiteType data_type, TfLiteGpuDataLayout data_layout);
-
-// Returns opaque binary blob that contains a collection of cached OpenCL
-// binaries. Returned data could be re-used later to speed up initialization
-// time when new delegate is created for the same model.
-// Returned data is valid only if used on the same device, otherwise it will
-// not be compatible and will be discarded.
-TFL_CAPI_EXPORT bool TfLiteGpuDelegateGetSerializedBinaryCache(
-    TfLiteDelegate* delegate, size_t* size, const uint8_t** data);
-
-#ifdef __cplusplus
-}
-#endif  // __cplusplus
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_GPU_API_DELEGATE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/gpu_object.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/gpu_object.h
deleted file mode 100644
index abd77a4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/gpu_object.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_GPU_OBJECT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_GPU_OBJECT_H_
-
-#include 
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/cl/serialization_generated.h"
-#include "tensorflow/lite/delegates/gpu/common/access_type.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-struct GPUImage2DDescriptor {
-  DataType data_type;
-  AccessType access_type;
-  cl_mem memory;
-};
-
-struct GPUImage3DDescriptor {
-  DataType data_type;
-  AccessType access_type;
-  cl_mem memory;
-};
-
-struct GPUImage2DArrayDescriptor {
-  DataType data_type;
-  AccessType access_type;
-  cl_mem memory;
-};
-
-struct GPUImageBufferDescriptor {
-  DataType data_type;
-  AccessType access_type;
-  cl_mem memory;
-};
-
-struct GPUCustomMemoryDescriptor {
-  std::string type_name;
-  cl_mem memory;
-};
-
-enum class MemoryType { GLOBAL, CONSTANT, LOCAL };
-
-std::string MemoryTypeToCLType(MemoryType type);
-
-struct GPUBufferDescriptor {
-  DataType data_type;
-  AccessType access_type;
-  int element_size;
-  MemoryType memory_type = MemoryType::GLOBAL;
-  std::vector attributes;
-  cl_mem memory;
-};
-
-struct GPUResources {
-  std::vector ints;
-  std::vector floats;
-  std::vector> buffers;
-  std::vector> images2d;
-  std::vector> image2d_arrays;
-  std::vector> images3d;
-  std::vector> image_buffers;
-  std::vector>
-      custom_memories;
-
-  std::vector GetNames() const {
-    std::vector names = ints;
-    names.insert(names.end(), floats.begin(), floats.end());
-    for (const auto& obj : buffers) {
-      names.push_back(obj.first);
-    }
-    for (const auto& obj : images2d) {
-      names.push_back(obj.first);
-    }
-    for (const auto& obj : image2d_arrays) {
-      names.push_back(obj.first);
-    }
-    for (const auto& obj : images3d) {
-      names.push_back(obj.first);
-    }
-    for (const auto& obj : image_buffers) {
-      names.push_back(obj.first);
-    }
-    for (const auto& obj : custom_memories) {
-      names.push_back(obj.first);
-    }
-    return names;
-  }
-};
-
-struct GPUResourcesWithValue {
-  std::vector> ints;
-  std::vector> floats;
-  std::vector> buffers;
-  std::vector> images2d;
-  std::vector> image2d_arrays;
-  std::vector> images3d;
-  std::vector> image_buffers;
-  std::vector> custom_memories;
-};
-
-class GPUObject;
-
-class GPUObjectDescriptor {
- public:
-  GPUObjectDescriptor() = default;
-  GPUObjectDescriptor(const GPUObjectDescriptor&) = default;
-  GPUObjectDescriptor& operator=(const GPUObjectDescriptor&) = default;
-  GPUObjectDescriptor(GPUObjectDescriptor&& obj_desc)
-      : state_vars_(std::move(obj_desc.state_vars_)) {}
-  GPUObjectDescriptor& operator=(GPUObjectDescriptor&& obj_desc) {
-    if (this != &obj_desc) {
-      state_vars_ = std::move(obj_desc.state_vars_);
-    }
-    return *this;
-  }
-  virtual ~GPUObjectDescriptor() = default;
-
-  void SetStateVar(const std::string& key, const std::string& value) const {
-    state_vars_[key] = value;
-  }
-
-  virtual std::string PerformConstExpr(const std::string& const_expr) const {
-    return "";
-  }
-
-  virtual absl::Status PerformSelector(
-      const std::string& selector, const std::vector& args,
-      const std::vector& template_args,
-      std::string* result) const {
-    *result = "";
-    return absl::OkStatus();
-  }
-  virtual GPUResources GetGPUResources() const { return GPUResources(); }
-
-  virtual absl::Status CreateGPUObject(
-      CLContext* context, std::unique_ptr* result) const {
-    return absl::OkStatus();
-  }
-  virtual void Release() {}
-
-  void SetAccess(AccessType access_type) { access_type_ = access_type; }
-  AccessType GetAccess() const { return access_type_; }
-
- protected:
-  friend flatbuffers::Offset Encode(
-      const GPUObjectDescriptor& desc, flatbuffers::FlatBufferBuilder* builder);
-  friend void Decode(const data::GPUObjectDescriptor* fb_obj,
-                     GPUObjectDescriptor* obj);
-  mutable std::map state_vars_;
-  AccessType access_type_;
-};
-
-using GPUObjectDescriptorPtr = std::unique_ptr;
-
-class GPUObject {
- public:
-  GPUObject() = default;
-  // Move only
-  GPUObject(GPUObject&& obj_desc) = default;
-  GPUObject& operator=(GPUObject&& obj_desc) = default;
-  GPUObject(const GPUObject&) = delete;
-  GPUObject& operator=(const GPUObject&) = delete;
-  virtual ~GPUObject() = default;
-  virtual absl::Status GetGPUResources(
-      const GPUObjectDescriptor* obj_ptr,
-      GPUResourcesWithValue* resources) const = 0;
-};
-
-using GPUObjectPtr = std::unique_ptr;
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_GPU_OBJECT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/inference_context.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/inference_context.h
deleted file mode 100644
index ec8055e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/inference_context.h
+++ /dev/null
@@ -1,233 +0,0 @@
-/* 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_CL_INFERENCE_CONTEXT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_INFERENCE_CONTEXT_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "absl/container/flat_hash_map.h"
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_command_queue.h"
-#include "tensorflow/lite/delegates/gpu/cl/environment.h"
-#include "tensorflow/lite/delegates/gpu/cl/gpu_object.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/model_hints.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/cl/precision.h"
-#include "tensorflow/lite/delegates/gpu/cl/serialization_generated.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/tensor.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-struct CLNode {
-  std::unique_ptr operation;
-  std::vector inputs;
-  std::vector outputs;
-
-  // Mostly for debug purposes.
-  std::string name;
-
-  CLNode() = default;
-
-  CLNode(CLNode&& node);
-  CLNode& operator=(CLNode&& node);
-  CLNode(const CLNode&) = delete;
-  CLNode& operator=(const CLNode&) = delete;
-};
-
-class InferenceContext {
- public:
-  struct CreateInferenceInfo {
-    CalculationsPrecision precision;
-    TensorStorageType storage_type;
-    ModelHints hints;
-  };
-
-  absl::Status InitFromGraph(const CreateInferenceInfo& create_info,
-                             const GraphFloat32& graph, Environment* env,
-                             std::vector* serialized_model = nullptr);
-
-  // Applies OpenCL-specific transformations to the graph before the
-  // initialization. These transformations are either impossible or useless in
-  // other backends.
-  absl::Status InitFromGraphWithTransforms(
-      const CreateInferenceInfo& create_info, GraphFloat32* graph,
-      Environment* env, std::vector* serialized_model = nullptr);
-
-  absl::Status AddToQueue(CLCommandQueue* queue);
-  absl::Status Profile(ProfilingCommandQueue* queue, ProfilingInfo* result);
-  // for profiling and memory statistics
-  uint64_t GetSizeOfMemoryAllocatedForIntermediateTensors() const;
-
-  absl::Status SetInputTensor(ValueId id, const TensorFloat32& tensor,
-                              CLCommandQueue* queue);
-
-  // It will work only with input/output tensor ids. For all other ids we don't
-  // have any guarantees.
-  Tensor* GetTensor(ValueId id);
-
-  absl::Status GetOutputTensor(ValueId id, CLCommandQueue* queue,
-                               TensorFloat32* result);
-
-  const std::vector& GetInputIds() const { return input_ids_; }
-  const std::vector& GetOutputIds() const { return output_ids_; }
-
-  absl::Status RestoreDeserialized(const std::vector& serialized_model,
-                                   Environment* env);
-
- private:
-  enum TensorMemoryType { STRONG_SHAPE = 0, BUFFER = 1, VARIABLE = 2 };
-
-  friend flatbuffers::Offset Encode(
-      const InferenceContext& inference,
-      flatbuffers::FlatBufferBuilder* builder);
-  friend absl::Status Decode(CLContext* context,
-                             const data::InferenceContext* fb_inference,
-                             InferenceContext* inference);
-
-  void CopyInAndOutIds(const GraphFloat32& graph);
-  absl::Status ConvertOperations(const DeviceInfo& device_info,
-                                 const GraphFloat32& graph, ModelHints hints);
-  void CreateLinks();
-  void ReserveGraphTensors(const CreateInferenceInfo& create_info,
-                           const DeviceInfo& device_info,
-                           const GraphFloat32& graph);
-  absl::Status Merge();
-  absl::Status AllocateMemory(CLContext* context);
-
-  absl::Status AllocateMemoryForVariableTensors(CLContext* context);
-
-  absl::Status AllocateMemoryForBuffers(CLContext* context);
-
-  absl::Status AllocateMemoryForStrongShapes(CLContext* context);
-
-  // utility function
-  void GetUsages(const std::function& functor,
-                 std::map* usages);
-
-  TensorMemoryType GetTensorMemoryType(ValueId id);
-
-  void BindMemoryToOperations();
-  absl::Status Compile(const CreationContext& creation_context);
-  absl::Status Tune(const TuningParameters& tuning_parameters);
-  absl::Status UpdateParams();
-
-  // performance hacks
-  bool need_flush_ = false;
-
-  bool flush_periodically_ = false;
-  int flush_period_ = 1;
-
-  // In order to reduce memory leak on Mali a pipeline needs to be synchronized
-  // with CPU to prevent growing internal global OpenCL kernel pool. One trick
-  // is to enqueue an event from a previous run. Most of the time is should
-  // already be executed on GPU and should not stall the pipeline.
-  bool need_manual_release_ = false;
-  CLEvent prev_enqueue_start_point_;
-
-  CalculationsPrecision precision_;
-  TensorStorageType storage_type_;
-
-  // Directly mapped nodes from graph, but some of them "inactive" due
-  //  to fusion (inactive = fused).
-  // Memory is allocated only once, in ConvertOperations, and is not modified
-  //  anywhere.
-  std::vector nodes_;
-
-  struct DummyTensor {
-    BHWC shape;
-    TensorDescriptor descriptor;
-
-    bool operator==(const DummyTensor& b) const {
-      return shape == b.shape && descriptor == b.descriptor;
-    }
-  };
-
-  class TensorReserver {
-   public:
-    ValueId Add(const DummyTensor& dummy) {
-      reservations_[next_] = dummy;
-      return next_++;
-    }
-    void Add(ValueId id, const DummyTensor& dummy) {
-      reservations_[id] = dummy;
-    }
-    void SetNext(ValueId id) { next_ = id; }
-    DummyTensor Get(ValueId id) { return reservations_[id]; }
-
-    std::vector> GetTensorDescs() const {
-      std::vector> result;
-      for (auto& v : reservations_) {
-        TensorDescriptor desc = v.second.descriptor;
-        desc.shape.b = v.second.shape.b;
-        desc.shape.h = v.second.shape.h;
-        desc.shape.w = v.second.shape.w;
-        desc.shape.d = 1;
-        desc.shape.c = v.second.shape.c;
-        result.push_back({v.first, desc});
-      }
-      return result;
-    }
-
-    void Add(const std::vector>& tensors) {
-      for (auto& v : tensors) {
-        DummyTensor dummy;
-        dummy.descriptor = v.second;
-        dummy.shape.b = v.second.shape.b;
-        dummy.shape.h = v.second.shape.h;
-        dummy.shape.w = v.second.shape.w;
-        dummy.shape.c = v.second.shape.c;
-        Add(v.first, dummy);
-      }
-    }
-
-   private:
-    absl::flat_hash_map reservations_;
-    ValueId next_;
-  };
-  TensorReserver tensor_reserver_;
-
-  std::map variable_tensors_;
-  std::vector shared_buffers_;
-  std::vector
-      shared_buffer_tensors_;  // use references to memory from shared_buffers_
-  std::map graph_ids_to_shared_buffer_tensors_;
-
-  std::map strong_shape_tensors_;
-  std::map graph_ids_to_strong_shape_tensors_;
-
-  std::vector input_ids_;
-  std::map variable_ids_and_refs_;
-  std::vector output_ids_;
-};
-
-// Runs OpenCL specific transforms for the graph.
-absl::Status RunGraphTransforms(GraphFloat32* graph);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_INFERENCE_CONTEXT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/add.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/add.h
deleted file mode 100644
index 0e9d7e0..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/add.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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_CL_KERNELS_ADD_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_ADD_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// Add operation supports not equal tensors on input (for possibility to
-// remove Padding operation with zeroes in channels dimension)
-GPUOperation CreateAdd(const OperationDef& definition,
-                       const std::vector& channels, int dst_channels);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_ADD_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/cl_test.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/cl_test.h
deleted file mode 100644
index 4d3636d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/cl_test.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* 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_CL_KERNELS_CL_TEST_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CL_TEST_H_
-
-#include 
-
-#include 
-#include 
-#include "tensorflow/lite/delegates/gpu/cl/environment.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.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"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-#ifndef ASSERT_OK
-#define ASSERT_OK(x) ASSERT_TRUE(x.ok());
-#endif
-
-class OpenCLOperationTest : public ::testing::Test {
- public:
-  void SetUp() override {
-    ASSERT_OK(LoadOpenCL());
-    ASSERT_OK(CreateEnvironment(&env_));
-    creation_context_.device = env_.GetDevicePtr();
-    creation_context_.context = &env_.context();
-    creation_context_.queue = env_.queue();
-    creation_context_.cache = env_.program_cache();
-  }
-
- protected:
-  Environment env_;
-  CreationContext creation_context_;
-};
-
-absl::Status ExecuteGPUOperation(const TensorFloat32& src_cpu,
-                                 const CreationContext& creation_context,
-                                 GPUOperation* operation, const BHWC& dst_size,
-                                 TensorFloat32* result);
-
-absl::Status ExecuteGPUOperation(const std::vector& src_cpu,
-                                 const CreationContext& creation_context,
-                                 GPUOperation* operation, const BHWC& dst_size,
-                                 TensorFloat32* result);
-
-absl::Status ExecuteGPUOperation(const std::vector& src_cpu,
-                                 const CreationContext& creation_context,
-                                 GPUOperation* operation,
-                                 const std::vector& dst_sizes,
-                                 const std::vector& dst_cpu);
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CL_TEST_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/concat_xy.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/concat_xy.h
deleted file mode 100644
index 9dd3fce..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/concat_xy.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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_CL_KERNELS_CONCAT_XY_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONCAT_XY_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreateConcatXY(const OperationDef& definition,
-                            const ConcatAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONCAT_XY_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/concat_z.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/concat_z.h
deleted file mode 100644
index b209d8f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/concat_z.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* 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_CL_KERNELS_CONCAT_Z_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONCAT_Z_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreateConcatZ(const OperationDef& definition,
-                           const std::vector& channels,
-                           const DeviceInfo& device_info);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONCAT_Z_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_buffer_1x1.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_buffer_1x1.h
deleted file mode 100644
index f0c75e1..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_buffer_1x1.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/* 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_CL_KERNELS_CONV_BUFFER_1X1_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_BUFFER_1X1_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/conv_common.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/util.h"
-#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
-#include "tensorflow/lite/delegates/gpu/cl/precision.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#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/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/common/winograd_util.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class ConvBuffer1x1 : public GPUOperation {
- public:
-  ConvBuffer1x1() = default;
-
-  // Move only
-  ConvBuffer1x1(ConvBuffer1x1&& operation);
-  ConvBuffer1x1& operator=(ConvBuffer1x1&& operation);
-  ConvBuffer1x1(const ConvBuffer1x1&) = delete;
-  ConvBuffer1x1& operator=(const ConvBuffer1x1&) = delete;
-
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override;
-  int3 GetGridSize() const override;
-
-  ConvWeightsDescription GetConvWeightsDescription() const {
-    ConvWeightsDescription desc;
-    desc.layout = ConvWeightsLayout::kOHWIOGroupI4O4;
-    desc.output_group_size = conv_params_.block_size.z;
-    return desc;
-  }
-
-  struct ConvParams {
-    int3 block_size = int3(1, 1, 1);
-    int element_size = 4;  // can be 4, 8 or 16
-
-    // By default in 2d convolution we have the same weights for WH dims, but in
-    // some cases we need separate weights for H dimension and convolution
-    // kernel requires very small modifications to support it.
-    bool different_weights_for_height = false;
-  };
-
- private:
-  ConvBuffer1x1(const OperationDef& definition, const ConvParams& conv_params);
-  friend ConvBuffer1x1 CreateConvBuffer1x1(const DeviceInfo& device_info,
-                                           const OperationDef& definition,
-                                           const Convolution2DAttributes& attr,
-                                           const BHWC* shape);
-  friend ConvBuffer1x1 CreateConvBuffer1x1(const DeviceInfo& device_info,
-                                           const OperationDef& definition,
-                                           const FullyConnectedAttributes& attr,
-                                           const BHWC* shape);
-  friend ConvBuffer1x1 CreateConvBuffer1x1Wino4x4To6x6(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const Convolution2DAttributes& attr, const BHWC* shape);
-  friend ConvBuffer1x1 CreateConvBuffer1x1DynamicWeights(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const Convolution2DAttributes& attr, const BHWC& weights_shape,
-      const BHWC* dst_shape);
-
-  template 
-  void UploadData(const tflite::gpu::Tensor& weights,
-                  const tflite::gpu::Tensor& biases);
-  template 
-  void UploadDataForWinograd4x4To6x6(
-      const tflite::gpu::Tensor& weights);
-
-  template 
-  void UploadWeights(const tflite::gpu::Tensor& weights);
-
-  template 
-  void UploadBiases(const tflite::gpu::Tensor& biases);
-
-  std::string GenerateConvBuffer1x1(
-      const OperationDef& op_def, const ConvBuffer1x1::ConvParams& conv_params,
-      Arguments* args);
-
-  ConvParams conv_params_;
-};
-
-template 
-void ConvBuffer1x1::UploadData(const tflite::gpu::Tensor& weights,
-                               const tflite::gpu::Tensor& biases) {
-  UploadWeights(weights);
-  UploadBiases(biases);
-}
-
-template 
-void ConvBuffer1x1::UploadDataForWinograd4x4To6x6(
-    const tflite::gpu::Tensor& weights) {
-  tflite::gpu::Tensor wino_weights;
-  RearrangeWeightsToWinograd4x4To6x6Weights(weights, &wino_weights);
-  UploadWeights(wino_weights);
-  tflite::gpu::Tensor bias;
-  bias.shape = Linear(weights.shape.o);
-  bias.data.resize(weights.shape.o, 0.0f);
-  UploadBiases(bias);
-}
-
-template 
-void ConvBuffer1x1::UploadWeights(const tflite::gpu::Tensor& weights) {
-  const int dst_depth = DivideRoundUp(weights.shape.o, 4);
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-
-  const bool f32_weights = definition_.precision == CalculationsPrecision::F32;
-  const int float4_size = f32_weights ? sizeof(float4) : sizeof(half4);
-
-  const int dst_depth_aligned = AlignByN(dst_depth, conv_params_.block_size.z);
-  const int elements_count =
-      weights.shape.h * weights.shape.w * src_depth * dst_depth_aligned * 4;
-
-  BufferDescriptor desc;
-  desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-  desc.element_size = 16;
-  desc.memory_type = MemoryType::GLOBAL;
-  desc.size = float4_size * elements_count;
-  desc.data.resize(desc.size);
-
-  if (f32_weights) {
-    float4* ptr = reinterpret_cast(desc.data.data());
-    RearrangeWeightsToOHWIOGroupI4O4(weights, conv_params_.block_size.z,
-                                     absl::MakeSpan(ptr, elements_count));
-  } else {
-    half4* ptr = reinterpret_cast(desc.data.data());
-    RearrangeWeightsToOHWIOGroupI4O4(weights, conv_params_.block_size.z,
-                                     absl::MakeSpan(ptr, elements_count));
-  }
-
-  args_.AddObject("weights",
-                  absl::make_unique(std::move(desc)));
-}
-
-template 
-void ConvBuffer1x1::UploadBiases(const tflite::gpu::Tensor& biases) {
-  TensorLinearDescriptor desc;
-  desc.storage_type = LinearStorageType::BUFFER;
-  desc.element_type = definition_.GetDataType();
-  int depth = AlignByN(biases.shape.v, 4 * conv_params_.block_size.z) / 4;
-  desc.UploadLinearData(biases, depth);
-  args_.AddObject("biases",
-                  absl::make_unique(std::move(desc)));
-}
-
-bool IsConvBuffer1x1Supported(const OperationDef& definition,
-                              const Convolution2DAttributes& attr);
-
-bool IsConvBuffer1x1Supported(const OperationDef& definition,
-                              const BHWC& weights_shape,
-                              const Convolution2DAttributes& attr);
-
-ConvBuffer1x1 CreateConvBuffer1x1(const DeviceInfo& device_info,
-                                  const OperationDef& definition,
-                                  const Convolution2DAttributes& attr,
-                                  const BHWC* shape = nullptr);
-
-ConvBuffer1x1 CreateConvBuffer1x1(const DeviceInfo& device_info,
-                                  const OperationDef& definition,
-                                  const FullyConnectedAttributes& attr,
-                                  const BHWC* shape = nullptr);
-
-ConvBuffer1x1 CreateConvBuffer1x1DynamicWeights(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const Convolution2DAttributes& attr, const BHWC& weights_shape,
-    const BHWC* dst_shape = nullptr);
-
-ConvBuffer1x1 CreateConvBuffer1x1Wino4x4To6x6(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const Convolution2DAttributes& attr, const BHWC* shape = nullptr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_BUFFER_1X1_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_common.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_common.h
deleted file mode 100644
index f630c9d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_common.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_COMMON_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_COMMON_H_
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-enum class ConvWeightsLayout {
-  kUnknown,
-  kOHWIOGroupI4O4,
-};
-
-struct ConvWeightsDescription {
-  ConvWeightsLayout layout;
-  int output_group_size;
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_COMMON_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_constants.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_constants.h
deleted file mode 100644
index c341ecb..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_constants.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* 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_CL_KERNELS_CONV_CONSTANTS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_CONSTANTS_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#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/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-template 
-void RearrangeWeightsForConvConstants(
-    const tflite::gpu::Tensor& weights, absl::Span dst) {
-  const int dst_depth = DivideRoundUp(weights.shape.o, 4);
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int kernel_x = weights.shape.w;
-  const int kernel_y = weights.shape.h;
-
-  int counter = 0;
-  for (int s = 0; s < src_depth; ++s) {
-    for (int y = 0; y < kernel_y; ++y) {
-      for (int x = 0; x < kernel_x; ++x) {
-        for (int d = 0; d < dst_depth; ++d) {
-          const int channels_count = std::min(4, weights.shape.i - s * 4);
-          T filters[4];
-          for (int i = 0; i < 4; ++i) {
-            for (int j = 0; j < channels_count; ++j) {
-              const int s_ch = s * 4 + j;
-              const int d_ch = d * 4 + i;
-              if (s_ch < weights.shape.i && d_ch < weights.shape.o) {
-                const int f_index =
-                    weights.shape.LinearIndex({d_ch, y, x, s_ch});
-                filters[i][j] = weights.data[f_index];
-              } else {
-                filters[i][j] = 0.0f;
-              }
-            }
-          }
-          T filters_new[4];
-          for (int i = 0; i < 4; ++i) {
-            for (int j = 0; j < 4; ++j) {
-              filters_new[i][j] = filters[j][i];
-            }
-          }
-          for (int i = 0; i < channels_count; ++i) {
-            dst[counter++] = filters_new[i];
-          }
-        }
-      }
-    }
-  }
-}
-
-template 
-void UploadWeightsForConvConstants(const tflite::gpu::Tensor& weights,
-                                   CalculationsPrecision precision,
-                                   GPUOperation* op) {
-  const int dst_depth = DivideRoundUp(weights.shape.o, 4);
-  const int kernel_x = weights.shape.w;
-  const int kernel_y = weights.shape.h;
-
-  const bool f32_weights = precision == CalculationsPrecision::F32;
-  const int float_size = f32_weights ? 4 : 2;
-  const int float_count = weights.shape.i * dst_depth * 4 * kernel_x * kernel_y;
-
-  BufferDescriptor desc;
-  desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-  desc.element_size = 4;
-  desc.memory_type = MemoryType::CONSTANT;
-  desc.size = float_size * float_count;
-  desc.data.resize(desc.size);
-
-  if (f32_weights) {
-    float4* ptr = reinterpret_cast(desc.data.data());
-    RearrangeWeightsForConvConstants(weights,
-                                     absl::MakeSpan(ptr, float_count / 4));
-  } else {
-    half4* ptr = reinterpret_cast(desc.data.data());
-    RearrangeWeightsForConvConstants(weights,
-                                     absl::MakeSpan(ptr, float_count / 4));
-  }
-
-  op->args_.AddObject("weigths",
-                      absl::make_unique(std::move(desc)));
-}
-
-bool IsConvConstantsSupported(const DeviceInfo& device_info,
-                              const OperationDef& definition,
-                              const Convolution2DAttributes& attr);
-
-GPUOperation CreateConvConstants(const DeviceInfo& device_info,
-                                 const OperationDef& definition,
-                                 const Convolution2DAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_CONSTANTS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_powervr.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_powervr.h
deleted file mode 100644
index 30e412c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_powervr.h
+++ /dev/null
@@ -1,405 +0,0 @@
-/* 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_CL_KERNELS_CONV_POWERVR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_POWERVR_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/conv_common.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/util.h"
-#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/cl/texture2d.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#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/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/common/winograd_util.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class ConvPowerVR : public GPUOperation {
- public:
-  ConvPowerVR() = default;
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override;
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-
-  ConvWeightsDescription GetConvWeightsDescription() const {
-    ConvWeightsDescription desc;
-    desc.layout = ConvWeightsLayout::kOHWIOGroupI4O4;
-    desc.output_group_size = conv_params_.block_size.w;
-    return desc;
-  }
-
-  // Move only
-  ConvPowerVR(ConvPowerVR&& operation);
-  ConvPowerVR& operator=(ConvPowerVR&& operation);
-  ConvPowerVR(const ConvPowerVR&) = delete;
-  ConvPowerVR& operator=(const ConvPowerVR&) = delete;
-
- private:
-  enum class WeightsUploadType {
-    LOCAL_MEM_ASYNC_SUBGROUP,  // we use it for PowerVR with workgroup size = 32
-    LOCAL_MEM_BY_THREADS,
-    GLOBAL_MEM,
-    CONSTANT_MEM,
-    PRIVATE_MEM_SIMD_BROADCAST,
-    TEXTURES_MEM_X4,  // 4 textures for weights
-  };
-
-  struct ConvParams {
-    // Usually we use this combinations for CalculationPrecision:
-    // F32: all F32
-    // F16: all F16
-    // F32_F16: all besides accumulator is F16, including weights
-    // But for PowerVR we can achieve better performance in F32_F16 with F32
-    // weights, so for PowerVR in this kernel we have F32 weights for
-    // F32_F16 precision mode
-    DataType weights_data_type;  // used for weights and biases
-    int4 block_size;             // WHDS
-    bool fixed_work_group_size;
-    bool linear_spatial;  // spatial dimensions are Width/Height/Depth
-    bool different_weights_for_height;
-    int src_depth_loop_size;
-    WeightsUploadType weights_upload_type;
-    bool x_kernel_is_1;
-    bool y_kernel_is_1;
-    bool z_kernel_is_1;
-
-    // used only with PRIVATE_MEM_SIMD_BROADCAST
-    int simd_size = 1;
-
-    bool AreWeightsBuffer() const {
-      return weights_upload_type != WeightsUploadType::TEXTURES_MEM_X4;
-    }
-
-    bool IsPrivateMemBroadcast() const {
-      return weights_upload_type ==
-             WeightsUploadType::PRIVATE_MEM_SIMD_BROADCAST;
-    }
-  };
-
-  ConvPowerVR(const OperationDef& definition,
-              const Convolution2DAttributes& attr,
-              const DeviceInfo& device_info, const BHWC* dst_shape = nullptr);
-  ConvPowerVR(const OperationDef& definition,
-              const Convolution2DAttributes& attr, const BHWC& weights_shape,
-              const DeviceInfo& device_info, const BHWC* dst_shape = nullptr);
-  ConvPowerVR(const OperationDef& definition,
-              const FullyConnectedAttributes& attr,
-              const DeviceInfo& device_info, const BHWC* dst_shape = nullptr);
-  explicit ConvPowerVR(const OperationDef& definition);
-  ConvPowerVR(const OperationDef& definition,
-              const Convolution3DAttributes& attr,
-              const DeviceInfo& device_info, const BHWDC* dst_shape = nullptr);
-
-  void GenerateCode(const DeviceInfo& device_info);
-
-  template 
-  void UploadData(const tflite::gpu::Tensor& weights,
-                  const tflite::gpu::Tensor& biases);
-  template 
-  void UploadDataForWinograd4x4To6x6(
-      const tflite::gpu::Tensor& weights);
-
-  template 
-  void UploadWeights(const tflite::gpu::Tensor& weights);
-
-  template 
-  void UploadWeights(const tflite::gpu::Tensor& weights);
-
-  template 
-  void UploadBias(const tflite::gpu::Tensor& bias);
-
-  friend ConvPowerVR CreateConvPowerVR(const DeviceInfo& device_info,
-                                       const OperationDef& definition,
-                                       const Convolution2DAttributes& attr,
-                                       const BHWC* dst_shape);
-
-  friend ConvPowerVR CreateConvPowerVR(const DeviceInfo& device_info,
-                                       const OperationDef& definition,
-                                       const FullyConnectedAttributes& attr,
-                                       const BHWC* dst_shape);
-
-  friend ConvPowerVR CreateConvPowerVRDynamicWeights(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const Convolution2DAttributes& attr, const BHWC& weights_shape,
-      const BHWC* dst_shape);
-
-  friend ConvPowerVR CreateConvPowerVRWino4x4To6x6(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const Convolution2DAttributes& attr, const BHWC* dst_shape);
-
-  friend ConvPowerVR CreateConvPowerVR3D(const DeviceInfo& device_info,
-                                         const OperationDef& definition,
-                                         const Convolution3DAttributes& attr,
-                                         const BHWDC* dst_shape);
-
-  ConvParams GuessBestParams(const DeviceInfo& device_info,
-                             const OperationDef& definition,
-                             const Convolution2DAttributes& attr,
-                             const BHWC* dst_shape = nullptr);
-  ConvParams GuessBestParams(const DeviceInfo& device_info,
-                             const OperationDef& definition,
-                             const Convolution2DAttributes& attr,
-                             const BHWC& weights_shape,
-                             const BHWC* dst_shape = nullptr);
-  ConvParams GuessBestParams(const DeviceInfo& device_info,
-                             const OperationDef& definition,
-                             const FullyConnectedAttributes& attr,
-                             const BHWC* dst_shape = nullptr);
-  ConvParams GuessBestParamsWinograd(const DeviceInfo& device_info,
-                                     const OperationDef& definition,
-                                     const Convolution2DAttributes& attr,
-                                     const BHWC* dst_shape = nullptr);
-  ConvParams GuessBestParams(const DeviceInfo& device_info,
-                             const OperationDef& definition,
-                             const Convolution3DAttributes& attr,
-                             const BHWDC* dst_shape = nullptr);
-  ConvParams GuessBestParams(const DeviceInfo& device_info,
-                             const OperationDef& definition, int src_depth,
-                             int dst_depth, bool x_kernel_is_1,
-                             bool y_kernel_is_1,
-                             bool different_weights_for_height,
-                             const BHWC* dst_shape = nullptr);
-
-  std::string GenerateConv(const DeviceInfo& device_info,
-                           const OperationDef& op_def, bool stride_correction,
-                           const ConvParams& conv_params);
-
-  int4 stride_;
-  int4 padding_;
-  int4 kernel_size_;
-  int4 dilation_;
-  ConvParams conv_params_;
-};
-
-template 
-void ConvPowerVR::UploadData(const tflite::gpu::Tensor& weights,
-                             const tflite::gpu::Tensor& biases) {
-  UploadWeights(weights);
-  UploadBias(biases);
-}
-
-template 
-void ConvPowerVR::UploadDataForWinograd4x4To6x6(
-    const tflite::gpu::Tensor& weights) {
-  tflite::gpu::Tensor wino_weights;
-  RearrangeWeightsToWinograd4x4To6x6Weights(weights, &wino_weights);
-  UploadWeights(wino_weights);
-  tflite::gpu::Tensor biases;
-  biases.shape = Linear(weights.shape.o);
-  biases.data.resize(weights.shape.o, 0.0f);
-  UploadBias(biases);
-}
-
-template 
-void ConvPowerVR::UploadBias(const tflite::gpu::Tensor& bias) {
-  BufferDescriptor desc;
-  desc.element_type = conv_params_.weights_data_type;
-  desc.element_size = 4;
-  desc.memory_type = conv_params_.weights_upload_type ==
-                             ConvPowerVR::WeightsUploadType::CONSTANT_MEM
-                         ? MemoryType::CONSTANT
-                         : MemoryType::GLOBAL;
-  const int float_size = conv_params_.weights_data_type == DataType::FLOAT32
-                             ? sizeof(float)
-                             : sizeof(half);
-  int aligned_channels = AlignByN(bias.shape.v, 4 * conv_params_.block_size.w);
-  desc.size = float_size * aligned_channels;
-  desc.data.resize(desc.size);
-  if (conv_params_.weights_data_type == DataType::FLOAT32) {
-    float* gpu_data = reinterpret_cast(desc.data.data());
-    for (int i = 0; i < aligned_channels; ++i) {
-      gpu_data[i] = i < bias.shape.v ? bias.data[i] : 0.0f;
-    }
-  } else {
-    half* gpu_data = reinterpret_cast(desc.data.data());
-    for (int i = 0; i < aligned_channels; ++i) {
-      gpu_data[i] = i < bias.shape.v ? bias.data[i] : 0.0f;
-    }
-  }
-  args_.AddObject("biases",
-                  absl::make_unique(std::move(desc)));
-}
-
-template 
-void ConvPowerVR::UploadWeights(const tflite::gpu::Tensor& weights) {
-  const int dst_slices =
-      AlignByN(DivideRoundUp(weights.shape.o, 4), conv_params_.block_size.w);
-  const int src_slices = DivideRoundUp(weights.shape.i, 4);
-
-  const bool f32_weights = conv_params_.weights_data_type == DataType::FLOAT32;
-  const int float4_size = f32_weights ? sizeof(float4) : sizeof(half4);
-
-  const int elements_count =
-      weights.shape.h * weights.shape.w * src_slices * dst_slices * 4;
-
-  std::vector data(float4_size * elements_count);
-
-  if (f32_weights) {
-    float4* ptr = reinterpret_cast(data.data());
-    if (conv_params_.AreWeightsBuffer()) {
-      RearrangeWeightsToOHWIOGroupI4O4(weights, conv_params_.block_size.w,
-                                       absl::MakeSpan(ptr, elements_count));
-    } else {
-      RearrangeWeightsToI4HWIOOGroupO4(weights, conv_params_.block_size.w,
-                                       absl::MakeSpan(ptr, elements_count));
-    }
-  } else {
-    half4* ptr = reinterpret_cast(data.data());
-    if (conv_params_.AreWeightsBuffer()) {
-      RearrangeWeightsToOHWIOGroupI4O4(weights, conv_params_.block_size.w,
-                                       absl::MakeSpan(ptr, elements_count));
-    } else {
-      RearrangeWeightsToI4HWIOOGroupO4(weights, conv_params_.block_size.w,
-                                       absl::MakeSpan(ptr, elements_count));
-    }
-  }
-  if (conv_params_.AreWeightsBuffer()) {
-    BufferDescriptor desc;
-    desc.element_type = conv_params_.weights_data_type;
-    desc.element_size = 4;
-    desc.memory_type = conv_params_.weights_upload_type ==
-                               ConvPowerVR::WeightsUploadType::CONSTANT_MEM
-                           ? MemoryType::CONSTANT
-                           : MemoryType::GLOBAL;
-    desc.size = float4_size * elements_count;
-    desc.data = std::move(data);
-    args_.AddObject("weights",
-                    absl::make_unique(std::move(desc)));
-  } else {
-    const int texture_width = dst_slices;
-    const int texture_height = src_slices * weights.shape.h * weights.shape.w;
-    const int sub_size = float4_size * texture_width * texture_height;
-    for (int i = 0; i < 4; ++i) {
-      Texture2DDescriptor desc;
-      desc.element_type = conv_params_.weights_data_type;
-      desc.size = int2(texture_width, texture_height);
-      desc.data.resize(sub_size);
-      std::memcpy(desc.data.data(), data.data() + sub_size * i, sub_size);
-      const std::string name = "weights" + std::to_string(i);
-      args_.AddObject(name,
-                      absl::make_unique(std::move(desc)));
-    }
-  }
-}
-
-template 
-void ConvPowerVR::UploadWeights(const tflite::gpu::Tensor& weights) {
-  const int block_size = conv_params_.block_size.w;
-  const int dst_slices =
-      AlignByN(DivideRoundUp(weights.shape.o, 4), block_size);
-  const int src_slices = DivideRoundUp(weights.shape.i, 4);
-
-  const int elements_count = weights.shape.d * weights.shape.h *
-                             weights.shape.w * src_slices * dst_slices * 4;
-  const bool f32_weights = definition_.precision == CalculationsPrecision::F32;
-
-  const int float4_size = f32_weights ? 16 : 8;
-
-  std::vector data(float4_size * elements_count);
-
-  if (f32_weights) {
-    float4* ptr = reinterpret_cast(data.data());
-    if (conv_params_.AreWeightsBuffer()) {
-      RearrangeWeightsToODHWIOGroupI4O4(weights, conv_params_.block_size.w,
-                                        absl::MakeSpan(ptr, elements_count));
-    } else {
-      RearrangeWeightsToI4DHWIOOGroupO4(weights, conv_params_.block_size.w,
-                                        absl::MakeSpan(ptr, elements_count));
-    }
-  } else {
-    half4* ptr = reinterpret_cast(data.data());
-    if (conv_params_.AreWeightsBuffer()) {
-      RearrangeWeightsToODHWIOGroupI4O4(weights, conv_params_.block_size.w,
-                                        absl::MakeSpan(ptr, elements_count));
-    } else {
-      RearrangeWeightsToI4DHWIOOGroupO4(weights, conv_params_.block_size.w,
-                                        absl::MakeSpan(ptr, elements_count));
-    }
-  }
-
-  if (conv_params_.AreWeightsBuffer()) {
-    BufferDescriptor desc;
-    desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.element_size = 4;
-    desc.size = float4_size * elements_count;
-    desc.data = std::move(data);
-    args_.AddObject("weights",
-                    absl::make_unique(std::move(desc)));
-  } else {
-    const int texture_width = dst_slices;
-    const int texture_height =
-        src_slices * weights.shape.d * weights.shape.h * weights.shape.w;
-    int sub_size = float4_size * texture_width * texture_height;
-    for (int i = 0; i < 4; ++i) {
-      Texture2DDescriptor desc;
-      desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-      desc.size = int2(texture_width, texture_height);
-      desc.data.resize(sub_size);
-      memcpy(desc.data.data(), data.data() + sub_size * i, sub_size);
-      const std::string name = "weights" + std::to_string(i);
-      args_.AddObject(name,
-                      absl::make_unique(std::move(desc)));
-    }
-  }
-}
-
-ConvPowerVR CreateConvPowerVR(const DeviceInfo& device_info,
-                              const OperationDef& definition,
-                              const Convolution2DAttributes& attr,
-                              const BHWC* dst_shape = nullptr);
-
-ConvPowerVR CreateConvPowerVR(const DeviceInfo& device_info,
-                              const OperationDef& definition,
-                              const FullyConnectedAttributes& attr,
-                              const BHWC* dst_shape = nullptr);
-
-ConvPowerVR CreateConvPowerVRDynamicWeights(const DeviceInfo& device_info,
-                                            const OperationDef& definition,
-                                            const Convolution2DAttributes& attr,
-                                            const BHWC& weights_shape,
-                                            const BHWC* dst_shape = nullptr);
-
-ConvPowerVR CreateConvPowerVRWino4x4To6x6(const DeviceInfo& device_info,
-                                          const OperationDef& definition,
-                                          const Convolution2DAttributes& attr,
-                                          const BHWC* dst_shape = nullptr);
-
-ConvPowerVR CreateConvPowerVR3D(const DeviceInfo& device_info,
-                                const OperationDef& definition,
-                                const Convolution3DAttributes& attr,
-                                const BHWDC* dst_shape = nullptr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_POWERVR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_weights_converter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_weights_converter.h
deleted file mode 100644
index 3c7314e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/conv_weights_converter.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_WEIGHTS_CONVERTER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_WEIGHTS_CONVERTER_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_command_queue.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/conv_common.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class ConverterToConvWeights : public GPUOperation {
- public:
-  ConverterToConvWeights(const OperationDef& definition,
-                         const ConvWeightsDescription& conv_weights_desc);
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-
-  // Move only
-  ConverterToConvWeights(ConverterToConvWeights&& operation);
-  ConverterToConvWeights& operator=(ConverterToConvWeights&& operation);
-  ConverterToConvWeights(const ConverterToConvWeights&) = delete;
-  ConverterToConvWeights& operator=(const ConverterToConvWeights&) = delete;
-
- private:
-  std::string GetConverterToConvWeightsCode(
-      const OperationDef& op_def,
-      const ConvWeightsDescription& conv_weights_desc);
-
-  ConvWeightsDescription conv_weights_desc_;
-};
-
-// We expect src BHWC tensor and we assume that B is O, H = H, W = W, C is I
-// as dst we expect Tensor with storage type BUFFER and
-// dst.b * dst.h * dst.w * dst.c = AlignByN(src.b, 4) * src.h * src.w
-// AlignByN(src.c, 4)
-ConverterToConvWeights CreateConverterToConvWeights(
-    const OperationDef& definition,
-    const ConvWeightsDescription& conv_weights_desc);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONV_WEIGHTS_CONVERTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/converter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/converter.h
deleted file mode 100644
index 83af85b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/converter.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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_CL_KERNELS_CONVERTER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVERTER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/environment.h"
-#include "tensorflow/lite/delegates/gpu/spi.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// Supports conversions from BHWC to internal OpenCL tensor representation and
-// back. Also supports F16/F32.
-std::unique_ptr NewConverterBuilder(
-    Environment* environment);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVERTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed.h
deleted file mode 100644
index 5aa86f3..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/* 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_CL_KERNELS_CONVOLUTION_TRANSPOSED_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVOLUTION_TRANSPOSED_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/util.h"
-#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/cl/texture2d.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#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/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class ConvolutionTransposed : public GPUOperation {
- public:
-  ConvolutionTransposed() = default;
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override;
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-
-  // Move only
-  ConvolutionTransposed(ConvolutionTransposed&& operation);
-  ConvolutionTransposed& operator=(ConvolutionTransposed&& operation);
-  ConvolutionTransposed(const ConvolutionTransposed&) = delete;
-  ConvolutionTransposed& operator=(const ConvolutionTransposed&) = delete;
-
- private:
-  friend ConvolutionTransposed CreateConvolutionTransposed(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const ConvolutionTransposedAttributes& attr);
-  friend ConvolutionTransposed CreateConvolutionTransposed3D(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const ConvolutionTransposed3DAttributes& attr);
-  ConvolutionTransposed(const OperationDef& definition,
-                        const ConvolutionTransposedAttributes& attr,
-                        const DeviceInfo& device_info);
-  ConvolutionTransposed(const OperationDef& definition,
-                        const ConvolutionTransposed3DAttributes& attr,
-                        const DeviceInfo& device_info);
-
-  template 
-  void UploadWeights(const tflite::gpu::Tensor& weights,
-                     bool weights_are_buffer);
-
-  template 
-  void UploadWeights(const tflite::gpu::Tensor& weights,
-                     bool weights_are_buffer);
-
-  std::string GenerateConvolutionTransposedCode(const OperationDef& op_def,
-                                                const DeviceInfo& device_info,
-                                                bool weights_are_buffer,
-                                                const int4& block_size);
-  int4 stride_;
-  int4 block_size_ = int4(1, 1, 1, 1);  // WHDS
-};
-
-template 
-void ConvolutionTransposed::UploadWeights(
-    const tflite::gpu::Tensor& weights, bool weights_are_buffer) {
-  const int dst_depth =
-      AlignByN(DivideRoundUp(weights.shape.o, 4), block_size_.w);
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int kernel_x = weights.shape.w;
-  const int kernel_y = weights.shape.h;
-
-  const int elements_count = kernel_x * kernel_y * src_depth * dst_depth * 4;
-  const bool f32_weights = definition_.precision == CalculationsPrecision::F32;
-
-  const int float4_size = f32_weights ? 16 : 8;
-  std::vector data(float4_size * elements_count);
-
-  if (f32_weights) {
-    float4* ptr = reinterpret_cast(data.data());
-    if (weights_are_buffer) {
-      RearrangeWeightsToOHWIOGroupI4O4(weights, block_size_.w,
-                                       absl::MakeSpan(ptr, elements_count));
-    } else {
-      RearrangeWeightsToI4HWIOOGroupO4(weights, block_size_.w,
-                                       absl::MakeSpan(ptr, elements_count));
-    }
-  } else {
-    half4* ptr = reinterpret_cast(data.data());
-    if (weights_are_buffer) {
-      RearrangeWeightsToOHWIOGroupI4O4(weights, block_size_.w,
-                                       absl::MakeSpan(ptr, elements_count));
-    } else {
-      RearrangeWeightsToI4HWIOOGroupO4(weights, block_size_.w,
-                                       absl::MakeSpan(ptr, elements_count));
-    }
-  }
-
-  if (weights_are_buffer) {
-    BufferDescriptor desc;
-    desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.element_size = 16;
-    desc.size = float4_size * elements_count;
-    desc.data = std::move(data);
-    args_.AddObject("weights",
-                    absl::make_unique(std::move(desc)));
-  } else {
-    int texture_width = dst_depth;
-    int texture_height = src_depth * kernel_x * kernel_y;
-    int sub_size = float4_size * texture_width * texture_height;
-    for (int i = 0; i < 4; ++i) {
-      Texture2DDescriptor desc;
-      desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-      desc.size = int2(texture_width, texture_height);
-      desc.data.resize(sub_size);
-      memcpy(desc.data.data(), data.data() + sub_size * i, sub_size);
-      const std::string name = "weights" + std::to_string(i);
-      args_.AddObject(name,
-                      absl::make_unique(std::move(desc)));
-    }
-  }
-}
-
-template 
-void ConvolutionTransposed::UploadWeights(
-    const tflite::gpu::Tensor& weights, bool weights_are_buffer) {
-  const int dst_depth =
-      AlignByN(DivideRoundUp(weights.shape.o, 4), block_size_.w);
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int kernel_x = weights.shape.w;
-  const int kernel_y = weights.shape.h;
-  const int kernel_z = weights.shape.d;
-
-  const int elements_count =
-      kernel_x * kernel_y * kernel_z * src_depth * dst_depth * 4;
-  const bool f32_weights = definition_.precision == CalculationsPrecision::F32;
-
-  const int float4_size = f32_weights ? 16 : 8;
-  std::vector data(float4_size * elements_count);
-
-  if (f32_weights) {
-    float4* ptr = reinterpret_cast(data.data());
-    if (weights_are_buffer) {
-      RearrangeWeightsToODHWIOGroupI4O4(weights, block_size_.w,
-                                        absl::MakeSpan(ptr, elements_count));
-    } else {
-      RearrangeWeightsToI4DHWIOOGroupO4(weights, block_size_.w,
-                                        absl::MakeSpan(ptr, elements_count));
-    }
-  } else {
-    half4* ptr = reinterpret_cast(data.data());
-    if (weights_are_buffer) {
-      RearrangeWeightsToODHWIOGroupI4O4(weights, block_size_.w,
-                                        absl::MakeSpan(ptr, elements_count));
-    } else {
-      RearrangeWeightsToI4DHWIOOGroupO4(weights, block_size_.w,
-                                        absl::MakeSpan(ptr, elements_count));
-    }
-  }
-
-  if (weights_are_buffer) {
-    BufferDescriptor desc;
-    desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.element_size = 16;
-    desc.size = float4_size * elements_count;
-    desc.data = std::move(data);
-    args_.AddObject("weights",
-                    absl::make_unique(std::move(desc)));
-  } else {
-    int texture_width = dst_depth;
-    int texture_height = src_depth * kernel_x * kernel_y * kernel_z;
-    int sub_size = float4_size * texture_width * texture_height;
-    for (int i = 0; i < 4; ++i) {
-      Texture2DDescriptor desc;
-      desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-      desc.size = int2(texture_width, texture_height);
-      desc.data.resize(sub_size);
-      memcpy(desc.data.data(), data.data() + sub_size * i, sub_size);
-      const std::string name = "weights" + std::to_string(i);
-      args_.AddObject(name,
-                      absl::make_unique(std::move(desc)));
-    }
-  }
-}
-
-ConvolutionTransposed CreateConvolutionTransposed(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const ConvolutionTransposedAttributes& attr);
-
-ConvolutionTransposed CreateConvolutionTransposed3D(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const ConvolutionTransposed3DAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVOLUTION_TRANSPOSED_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_3x3.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_3x3.h
deleted file mode 100644
index 074fc23..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_3x3.h
+++ /dev/null
@@ -1,184 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVOLUTION_TRANSPOSED_3X3_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVOLUTION_TRANSPOSED_3X3_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#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/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class ConvolutionTransposed3x3 : public GPUOperation {
- public:
-  ConvolutionTransposed3x3() = default;
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override;
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-
-  // Move only
-  ConvolutionTransposed3x3(ConvolutionTransposed3x3&& operation);
-  ConvolutionTransposed3x3& operator=(ConvolutionTransposed3x3&& operation);
-  ConvolutionTransposed3x3(const ConvolutionTransposed3x3&) = delete;
-  ConvolutionTransposed3x3& operator=(const ConvolutionTransposed3x3&) = delete;
-
-  enum class WeightsUploadType {
-    LOCAL_MEM_ASYNC,
-    LOCAL_MEM_BY_THREADS,
-    GLOBAL_MEM,
-    CONSTANT_MEM,
-  };
-
- private:
-  ConvolutionTransposed3x3(const OperationDef& definition,
-                           const DeviceInfo& device_info, int2 padding);
-  friend ConvolutionTransposed3x3 CreateConvolutionTransposed3x3(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const ConvolutionTransposedAttributes& attr);
-  template 
-  void UploadWeights(const tflite::gpu::Tensor& weights);
-
-  template 
-  void RearrangeWeightsData(const tflite::gpu::Tensor& weights,
-                            absl::Span dst);
-
-  std::string GenerateConvolutionTransposedCode(
-      const OperationDef& op_def,
-      ConvolutionTransposed3x3::WeightsUploadType weights_upload_type,
-      int2 padding, int3 work_group_launch_order);
-
-  int2 padding_;
-  WeightsUploadType weights_upload_type_;
-};
-
-template 
-void ConvolutionTransposed3x3::UploadWeights(
-    const tflite::gpu::Tensor& weights) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int dst_depth = DivideRoundUp(weights.shape.o, 4);
-  const int kernel_x = 3;  //  This operation support only 3x3 kernel
-  const int kernel_y = 3;
-  const int flt4_count = kernel_x * kernel_y * src_depth * dst_depth * 4;
-
-  const bool f32_weights = definition_.precision == CalculationsPrecision::F32;
-  const int flt4_size = f32_weights ? sizeof(float4) : sizeof(half4);
-
-  BufferDescriptor desc;
-  desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-  desc.element_size = 4;
-  desc.memory_type =
-      weights_upload_type_ ==
-              ConvolutionTransposed3x3::WeightsUploadType::CONSTANT_MEM
-          ? MemoryType::CONSTANT
-          : MemoryType::GLOBAL;
-  desc.size = flt4_size * flt4_count;
-  desc.data.resize(desc.size);
-
-  if (f32_weights) {
-    float4* ptr = reinterpret_cast(desc.data.data());
-    RearrangeWeightsData(weights, absl::MakeSpan(ptr, flt4_count));
-  } else {
-    half4* ptr = reinterpret_cast(desc.data.data());
-    RearrangeWeightsData(weights, absl::MakeSpan(ptr, flt4_count));
-  }
-
-  args_.AddObject("weights",
-                  absl::make_unique(std::move(desc)));
-}
-
-template 
-void ConvolutionTransposed3x3::RearrangeWeightsData(
-    const tflite::gpu::Tensor& weights, absl::Span dst) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int dst_depth = DivideRoundUp(weights.shape.o, 4);
-  const int kernel_x = 3;
-  const int kernel_y = 3;
-
-  const int padding_x_rem = abs(padding_.x) % 2;
-  const int padding_y_rem = abs(padding_.y) % 2;
-
-  // we are reorganizing weights to read them sequentially in kernel
-  std::vector remap;
-  if (padding_x_rem == 1 && padding_y_rem == 1) {
-    remap = {4, 5, 3, 7, 1, 8, 6, 2, 0};
-  } else if (padding_x_rem == 0 && padding_y_rem == 1) {
-    remap = {5, 3, 4, 8, 6, 2, 0, 7, 1};
-  } else if (padding_x_rem == 1 && padding_y_rem == 0) {
-    remap = {7, 1, 8, 6, 2, 0, 4, 5, 3};
-  } else {  // padding_x_rem == 0 && padding_y_rem == 0
-    remap = {8, 6, 2, 0, 7, 1, 5, 3, 4};
-  }
-
-  int counter = 0;
-  for (int d = 0; d < dst_depth; ++d) {
-    for (int s = 0; s < src_depth; ++s) {
-      for (int y = 0; y < kernel_y; ++y) {
-        for (int x = 0; x < kernel_x; ++x) {
-          const int kernel_index = remap[y * kernel_x + x];
-          const int kernel_index_x = kernel_index % kernel_x;
-          const int kernel_index_y = kernel_index / kernel_x;
-          T filters[4];
-          for (int j = 0; j < 4; ++j) {
-            for (int i = 0; i < 4; ++i) {
-              const int s_ch = s * 4 + i;
-              const int d_ch = d * 4 + j;
-              if (s_ch < weights.shape.i && d_ch < weights.shape.o) {
-                const int f_index = weights.shape.LinearIndex(
-                    {d_ch, kernel_index_y, kernel_index_x, s_ch});
-                filters[i][j] = weights.data[f_index];
-              } else {
-                filters[i][j] = 0.0f;
-              }
-            }
-          }
-          dst[counter++] = filters[0];
-          dst[counter++] = filters[1];
-          dst[counter++] = filters[2];
-          dst[counter++] = filters[3];
-        }
-      }
-    }
-  }
-}
-
-bool IsConvolutionTransposed3x3Supported(
-    const OperationDef& definition,
-    const ConvolutionTransposedAttributes& attr);
-
-ConvolutionTransposed3x3 CreateConvolutionTransposed3x3(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const ConvolutionTransposedAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVOLUTION_TRANSPOSED_3X3_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_3x3_thin.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_3x3_thin.h
deleted file mode 100644
index 5905f6f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_3x3_thin.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/* 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_CL_KERNELS_CONVOLUTION_TRANSPOSED_3X3_THIN_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVOLUTION_TRANSPOSED_3X3_THIN_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#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/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class ConvolutionTransposed3x3Thin : public GPUOperation {
- public:
-  ConvolutionTransposed3x3Thin() = default;
-  int3 GetGridSize() const override;
-
-  // Move only
-  ConvolutionTransposed3x3Thin(ConvolutionTransposed3x3Thin&& operation);
-  ConvolutionTransposed3x3Thin& operator=(
-      ConvolutionTransposed3x3Thin&& operation);
-  ConvolutionTransposed3x3Thin(const ConvolutionTransposed3x3Thin&) = delete;
-  ConvolutionTransposed3x3Thin& operator=(const ConvolutionTransposed3x3Thin&) =
-      delete;
-
- private:
-  friend ConvolutionTransposed3x3Thin CreateConvolutionTransposed3x3Thin(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const ConvolutionTransposedAttributes& attr);
-  explicit ConvolutionTransposed3x3Thin(
-      const OperationDef& definition,
-      const ConvolutionTransposedAttributes& attr);
-  template 
-  void UploadData(const tflite::gpu::Tensor& weights,
-                  const tflite::gpu::Tensor& biases);
-
-  template 
-  void RearrangeWeightsData(const tflite::gpu::Tensor& weights,
-                            absl::Span dst);
-
-  std::string GenerateConvolutionTransposedCode(const OperationDef& op_def,
-                                                int src_depth, int dst_depth);
-};
-
-template 
-void ConvolutionTransposed3x3Thin::UploadData(
-    const tflite::gpu::Tensor& weights,
-    const tflite::gpu::Tensor& biases) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int dst_depth = DivideRoundUp(weights.shape.o, 4);
-  const int kernel_x = 3;  //  This operation support only 3x3 kernel
-  const int kernel_y = 3;
-  const int flt4_count = kernel_x * kernel_y * src_depth * dst_depth * 4;
-
-  const bool f32_weights = definition_.precision == CalculationsPrecision::F32;
-  const int flt4_size = f32_weights ? sizeof(float4) : sizeof(half4);
-
-  BufferDescriptor desc;
-  desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-  desc.element_size = 4;
-  desc.memory_type = MemoryType::CONSTANT;
-  desc.size = flt4_size * (flt4_count + dst_depth);
-  desc.data.resize(desc.size);
-
-  if (f32_weights) {
-    float4* gpu_data = reinterpret_cast(desc.data.data());
-    RearrangeWeightsData(weights, absl::MakeSpan(gpu_data, flt4_count));
-    for (int i = 0; i < dst_depth; ++i) {
-      float4 bias_value(0.0f);
-      for (int c = 0; c < 4; ++c) {
-        int ch = i * 4 + c;
-        bias_value[c] = ch < weights.shape.o ? biases.data[ch] : 0.0f;
-      }
-      gpu_data[flt4_count + i] = bias_value;
-    }
-  } else {
-    half4* gpu_data = reinterpret_cast(desc.data.data());
-    RearrangeWeightsData(weights, absl::MakeSpan(gpu_data, flt4_count));
-    for (int i = 0; i < dst_depth; ++i) {
-      half4 bias_value(0.0f);
-      for (int c = 0; c < 4; ++c) {
-        int ch = i * 4 + c;
-        bias_value[c] = ch < weights.shape.o ? biases.data[ch] : 0.0f;
-      }
-      gpu_data[flt4_count + i] = bias_value;
-    }
-  }
-
-  args_.AddObject("weights",
-                  absl::make_unique(std::move(desc)));
-}
-
-template 
-void ConvolutionTransposed3x3Thin::RearrangeWeightsData(
-    const tflite::gpu::Tensor& weights, absl::Span dst) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int dst_depth = DivideRoundUp(weights.shape.o, 4);
-  const int kernel_x = 3;
-  const int kernel_y = 3;
-
-  const int remap[9] = {4, 5, 3, 7, 1, 8, 6, 2, 0};
-
-  int counter = 0;
-  for (int s = 0; s < src_depth; ++s) {
-    for (int d = 0; d < dst_depth; ++d) {
-      for (int y = 0; y < kernel_y; ++y) {
-        for (int x = 0; x < kernel_x; ++x) {
-          const int kernel_index = remap[y * kernel_x + x];
-          const int kernel_index_x = kernel_index % kernel_x;
-          const int kernel_index_y = kernel_index / kernel_x;
-          T filters[4];
-          for (int j = 0; j < 4; ++j) {
-            for (int i = 0; i < 4; ++i) {
-              const int s_ch = s * 4 + i;
-              const int d_ch = d * 4 + j;
-              if (s_ch < weights.shape.i && d_ch < weights.shape.o) {
-                const int f_index = weights.shape.LinearIndex(
-                    {d_ch, kernel_index_y, kernel_index_x, s_ch});
-                filters[i][j] = weights.data[f_index];
-              } else {
-                filters[i][j] = 0.0f;
-              }
-            }
-          }
-          dst[counter++] = filters[0];
-          dst[counter++] = filters[1];
-          dst[counter++] = filters[2];
-          dst[counter++] = filters[3];
-        }
-      }
-    }
-  }
-}
-
-bool IsConvolutionTransposed3x3ThinSupported(
-    const ConvolutionTransposedAttributes& attr);
-
-ConvolutionTransposed3x3Thin CreateConvolutionTransposed3x3Thin(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const ConvolutionTransposedAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVOLUTION_TRANSPOSED_3X3_THIN_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_4x4.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_4x4.h
deleted file mode 100644
index 17d6323..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_4x4.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* 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_CL_KERNELS_CONVOLUTION_TRANSPOSED_4X4_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVOLUTION_TRANSPOSED_4X4_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#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/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class ConvolutionTransposed4x4 : public GPUOperation {
- public:
-  ConvolutionTransposed4x4() = default;
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override {
-    work_groups->push_back(work_group_size_);
-  }
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-
-  // Move only
-  ConvolutionTransposed4x4(ConvolutionTransposed4x4&& operation);
-  ConvolutionTransposed4x4& operator=(ConvolutionTransposed4x4&& operation);
-  ConvolutionTransposed4x4(const ConvolutionTransposed4x4&) = delete;
-  ConvolutionTransposed4x4& operator=(const ConvolutionTransposed4x4&) = delete;
-
-  enum class WeightsUploadType {
-    LOCAL_MEM_ASYNC,
-    LOCAL_MEM_BY_THREADS,
-    GLOBAL_MEM,
-    CONSTANT_MEM,
-  };
-
- private:
-  ConvolutionTransposed4x4(const OperationDef& definition,
-                           const DeviceInfo& device_info,
-                           const ConvolutionTransposedAttributes& attr);
-  friend ConvolutionTransposed4x4 CreateConvolutionTransposed4x4(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const ConvolutionTransposedAttributes& attr);
-  template 
-  void UploadWeights(const tflite::gpu::Tensor& weights,
-                     WeightsUploadType weights_upload_type);
-
-  template 
-  void RearrangeWeightsData(const tflite::gpu::Tensor& weights,
-                            absl::Span dst);
-
-  std::string GenerateConvolutionTransposedCode(
-      const OperationDef& op_def, WeightsUploadType weights_upload_type);
-};
-
-template 
-void ConvolutionTransposed4x4::UploadWeights(
-    const tflite::gpu::Tensor& weights,
-    WeightsUploadType weights_upload_type) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int dst_depth = DivideRoundUp(weights.shape.o, 4);
-  const int kernel_x = 4;  //  This operation support only 4x4 kernel
-  const int kernel_y = 4;
-  const int flt4_count = kernel_x * kernel_y * src_depth * dst_depth * 4;
-
-  const bool f32_weights = definition_.precision == CalculationsPrecision::F32;
-  const int flt4_size = f32_weights ? sizeof(float4) : sizeof(half4);
-
-  BufferDescriptor desc;
-  desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-  desc.element_size = 4;
-  desc.memory_type =
-      weights_upload_type ==
-              ConvolutionTransposed4x4::WeightsUploadType::CONSTANT_MEM
-          ? MemoryType::CONSTANT
-          : MemoryType::GLOBAL;
-  desc.size = flt4_size * flt4_count;
-  desc.data.resize(desc.size);
-
-  if (f32_weights) {
-    float4* ptr = reinterpret_cast(desc.data.data());
-    RearrangeWeightsData(weights, absl::MakeSpan(ptr, flt4_count));
-  } else {
-    half4* ptr = reinterpret_cast(desc.data.data());
-    RearrangeWeightsData(weights, absl::MakeSpan(ptr, flt4_count));
-  }
-
-  args_.AddObject("weights",
-                  absl::make_unique(std::move(desc)));
-}
-
-template 
-void ConvolutionTransposed4x4::RearrangeWeightsData(
-    const tflite::gpu::Tensor& weights, absl::Span dst) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int dst_depth = DivideRoundUp(weights.shape.o, 4);
-  const int kernel_x = 4;
-  const int kernel_y = 4;
-
-  const int remap[16] = {10, 11, 14, 15, 8, 9, 12, 13, 2, 3, 6, 7, 0, 1, 4, 5};
-
-  int counter = 0;
-  for (int d = 0; d < dst_depth; ++d) {
-    for (int s = 0; s < src_depth; ++s) {
-      for (int y = 0; y < kernel_y; ++y) {
-        for (int x = 0; x < kernel_x; ++x) {
-          const int kernel_index = remap[y * kernel_x + x];
-          const int kernel_index_x = kernel_index % kernel_x;
-          const int kernel_index_y = kernel_index / kernel_x;
-          T filters[4];
-          for (int j = 0; j < 4; ++j) {
-            for (int i = 0; i < 4; ++i) {
-              const int s_ch = s * 4 + i;
-              const int d_ch = d * 4 + j;
-              if (s_ch < weights.shape.i && d_ch < weights.shape.o) {
-                const int f_index = weights.shape.LinearIndex(
-                    {d_ch, kernel_index_y, kernel_index_x, s_ch});
-                filters[i][j] = weights.data[f_index];
-              } else {
-                filters[i][j] = 0.0f;
-              }
-            }
-          }
-          dst[counter++] = filters[0];
-          dst[counter++] = filters[1];
-          dst[counter++] = filters[2];
-          dst[counter++] = filters[3];
-        }
-      }
-    }
-  }
-}
-
-bool IsConvolutionTransposed4x4Supported(
-    const OperationDef& definition,
-    const ConvolutionTransposedAttributes& attr);
-
-ConvolutionTransposed4x4 CreateConvolutionTransposed4x4(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const ConvolutionTransposedAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVOLUTION_TRANSPOSED_4X4_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_thin.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_thin.h
deleted file mode 100644
index 7599ad2..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/convolution_transposed_thin.h
+++ /dev/null
@@ -1,151 +0,0 @@
-/* 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_CL_KERNELS_CONVOLUTION_TRANSPOSED_THIN_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVOLUTION_TRANSPOSED_THIN_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/cl/texture2d.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#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/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class ConvolutionTransposedThin : public GPUOperation {
- public:
-  ConvolutionTransposedThin() = default;
-  int3 GetGridSize() const override;
-
-  // Move only
-  ConvolutionTransposedThin(ConvolutionTransposedThin&& operation);
-  ConvolutionTransposedThin& operator=(ConvolutionTransposedThin&& operation);
-  ConvolutionTransposedThin(const ConvolutionTransposedThin&) = delete;
-  ConvolutionTransposedThin& operator=(const ConvolutionTransposedThin&) =
-      delete;
-
- private:
-  friend ConvolutionTransposedThin CreateConvolutionTransposedThin(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const ConvolutionTransposedAttributes& attr);
-  ConvolutionTransposedThin(const OperationDef& definition,
-                            const ConvolutionTransposedAttributes& attr,
-                            const DeviceInfo& device_info);
-  template 
-  void UploadData(const tflite::gpu::Tensor& weights,
-                  const tflite::gpu::Tensor& biases);
-
-  template 
-  void RearrangeWeightsData(const tflite::gpu::Tensor& weights,
-                            absl::Span dst);
-  std::string GenerateConvolutionTransposedCode(const OperationDef& op_def,
-                                                int src_depth, int dst_channels,
-                                                const int2& kernel_size);
-};
-
-template 
-void ConvolutionTransposedThin::UploadData(
-    const tflite::gpu::Tensor& weights,
-    const tflite::gpu::Tensor& biases) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int flt4_count =
-      weights.shape.w * weights.shape.h * src_depth * weights.shape.o;
-
-  const bool f32_weights = definition_.precision == CalculationsPrecision::F32;
-  const int flt4_size = f32_weights ? sizeof(float4) : sizeof(half4);
-
-  BufferDescriptor desc;
-  desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-  desc.element_size = 4;
-  desc.memory_type = MemoryType::CONSTANT;
-  desc.size = flt4_size * (flt4_count + 1);
-  desc.data.resize(desc.size);
-
-  if (f32_weights) {
-    float4* gpu_data = reinterpret_cast(desc.data.data());
-    RearrangeWeightsData(weights, absl::MakeSpan(gpu_data, flt4_count));
-    float4 bias_value(0.0f);
-    for (int i = 0; i < weights.shape.o; ++i) {
-      bias_value[i] = biases.data[i];
-    }
-    gpu_data[flt4_count] = bias_value;
-  } else {
-    half4* gpu_data = reinterpret_cast(desc.data.data());
-    RearrangeWeightsData(weights, absl::MakeSpan(gpu_data, flt4_count));
-    half4 bias_value(0.0f);
-    for (int i = 0; i < weights.shape.o; ++i) {
-      bias_value[i] = biases.data[i];
-    }
-    gpu_data[flt4_count] = bias_value;
-  }
-
-  args_.AddObject("weights",
-                  absl::make_unique(std::move(desc)));
-}
-
-template 
-void ConvolutionTransposedThin::RearrangeWeightsData(
-    const tflite::gpu::Tensor& weights, absl::Span dst) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int kernel_x = weights.shape.w;
-  const int kernel_y = weights.shape.h;
-
-  int counter = 0;
-  for (int s = 0; s < src_depth; ++s) {
-    for (int y = 0; y < kernel_y; ++y) {
-      for (int x = 0; x < kernel_x; ++x) {
-        std::vector filters(weights.shape.o);
-        for (int j = 0; j < weights.shape.o; ++j) {
-          for (int i = 0; i < 4; ++i) {
-            const int s_ch = s * 4 + i;
-            const int d_ch = j;
-            if (s_ch < weights.shape.i && d_ch < weights.shape.o) {
-              const int f_index = weights.shape.LinearIndex({d_ch, y, x, s_ch});
-              filters[j][i] = weights.data[f_index];
-            } else {
-              filters[j][i] = 0.0f;
-            }
-          }
-        }
-        for (int j = 0; j < weights.shape.o; ++j) {
-          dst[counter++] = filters[j];
-        }
-      }
-    }
-  }
-}
-
-bool IsConvolutionTransposedThinSupported(
-    const ConvolutionTransposedAttributes& attr);
-
-ConvolutionTransposedThin CreateConvolutionTransposedThin(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const ConvolutionTransposedAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_CONVOLUTION_TRANSPOSED_THIN_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/depthwise_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/depthwise_conv.h
deleted file mode 100644
index 3bb0348..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/depthwise_conv.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/* 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_CL_KERNELS_DEPTHWISE_CONV_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_DEPTHWISE_CONV_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/cl/texture2d.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#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/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-template 
-void RearrangeWeightsForDWConv2D(const tflite::gpu::Tensor& weights,
-                                 absl::Span dst) {
-  const int dst_channels = weights.shape.i * weights.shape.o;
-  const int dst_depth = DivideRoundUp(dst_channels, 4);
-  const int kernel_x = weights.shape.w;
-  const int kernel_y = weights.shape.h;
-
-  int counter = 0;
-  for (int d = 0; d < dst_depth; ++d) {
-    for (int y = 0; y < kernel_y; ++y) {
-      for (int x = 0; x < kernel_x; ++x) {
-        T filter_val;
-        for (int i = 0; i < 4; ++i) {
-          const int d_ch = d * 4 + i;
-          if (d_ch < dst_channels) {
-            const int f_index = weights.shape.LinearIndex(
-                {d_ch % weights.shape.o, y, x, d_ch / weights.shape.o});
-            filter_val[i] = weights.data[f_index];
-          } else {
-            filter_val[i] = 0.0f;
-          }
-        }
-        dst[counter++] = filter_val;
-      }
-    }
-  }
-}
-
-template 
-void UploadWeightsForDWConv2D(const tflite::gpu::Tensor& weights,
-                              bool weights_are_buffer,
-                              CalculationsPrecision precision,
-                              GPUOperation* op) {
-  const int dst_channels = weights.shape.i * weights.shape.o;
-  const int dst_slices = DivideRoundUp(dst_channels, 4);
-  const int kernel_x = weights.shape.w;
-  const int kernel_y = weights.shape.h;
-
-  const int elements_count = kernel_x * kernel_y * dst_slices;
-
-  const bool fp32_weights = precision == CalculationsPrecision::F32;
-  const int float4_size = fp32_weights ? 16 : 8;
-
-  std::vector data(float4_size * elements_count);
-
-  if (fp32_weights) {
-    float4* ptr = reinterpret_cast(data.data());
-    RearrangeWeightsForDWConv2D(weights, absl::MakeSpan(ptr, elements_count));
-  } else {
-    half4* ptr = reinterpret_cast(data.data());
-    RearrangeWeightsForDWConv2D(weights, absl::MakeSpan(ptr, elements_count));
-  }
-
-  if (weights_are_buffer) {
-    BufferDescriptor desc;
-    desc.element_type = fp32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.element_size = 4;
-    desc.size = float4_size * elements_count;
-    desc.data = std::move(data);
-    op->args_.AddObject("weights", absl::make_unique(desc));
-  } else {
-    Texture2DDescriptor desc;
-    desc.element_type = fp32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.size = int2(kernel_x * kernel_y, dst_slices);
-    desc.data = std::move(data);
-    op->args_.AddObject("weights",
-                        absl::make_unique(desc));
-  }
-}
-
-template 
-void RearrangeWeightsForDWConv3D(const tflite::gpu::Tensor& weights,
-                                 absl::Span dst) {
-  const int dst_channels = weights.shape.i * weights.shape.o;
-  const int dst_slices = DivideRoundUp(dst_channels, 4);
-  const int kernel_x = weights.shape.w;
-  const int kernel_y = weights.shape.h;
-  const int kernel_z = weights.shape.d;
-
-  int counter = 0;
-  for (int d = 0; d < dst_slices; ++d) {
-    for (int z = 0; z < kernel_z; ++z) {
-      for (int y = 0; y < kernel_y; ++y) {
-        for (int x = 0; x < kernel_x; ++x) {
-          T filter_val;
-          for (int i = 0; i < 4; ++i) {
-            const int d_ch = d * 4 + i;
-            if (d_ch < dst_channels) {
-              const int f_index = weights.shape.LinearIndex(
-                  {d_ch % weights.shape.o, y, x, z, d_ch / weights.shape.o});
-              filter_val[i] = weights.data[f_index];
-            } else {
-              filter_val[i] = 0.0f;
-            }
-          }
-          dst[counter++] = filter_val;
-        }
-      }
-    }
-  }
-}
-
-template 
-void UploadWeightsForDWConv3D(const tflite::gpu::Tensor& weights,
-                              bool weights_are_buffer,
-                              CalculationsPrecision precision,
-                              GPUOperation* op) {
-  const int dst_channels = weights.shape.i * weights.shape.o;
-  const int dst_slices = DivideRoundUp(dst_channels, 4);
-  const int kernel_x = weights.shape.w;
-  const int kernel_y = weights.shape.h;
-  const int kernel_z = weights.shape.d;
-
-  const int elements_count = kernel_x * kernel_y * kernel_z * dst_slices;
-
-  const bool fp32_weights = precision == CalculationsPrecision::F32;
-  const int float4_size = fp32_weights ? 16 : 8;
-
-  std::vector data(float4_size * elements_count);
-
-  if (fp32_weights) {
-    float4* ptr = reinterpret_cast(data.data());
-    RearrangeWeightsForDWConv3D(weights, absl::MakeSpan(ptr, elements_count));
-  } else {
-    half4* ptr = reinterpret_cast(data.data());
-    RearrangeWeightsForDWConv3D(weights, absl::MakeSpan(ptr, elements_count));
-  }
-
-  if (weights_are_buffer) {
-    BufferDescriptor desc;
-    desc.element_type = fp32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.element_size = 4;
-    desc.size = float4_size * elements_count;
-    desc.data = std::move(data);
-    op->args_.AddObject("weights",
-                        absl::make_unique(std::move(desc)));
-  } else {
-    Texture2DDescriptor desc;
-    desc.element_type = fp32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.size = int2(kernel_x * kernel_y * kernel_z, dst_slices);
-    desc.data = std::move(data);
-    op->args_.AddObject(
-        "weights", absl::make_unique(std::move(desc)));
-  }
-}
-
-GPUOperation CreateDepthwiseConvolution2D(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const DepthwiseConvolution2DAttributes& attr);
-
-GPUOperation CreateDepthwiseConvolution2DDynamicWeights(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const DepthwiseConvolution2DAttributes& attr);
-
-GPUOperation CreateDepthwiseConvolution3D(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const DepthwiseConvolution3DAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_DEPTHWISE_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/depthwise_conv_3x3.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/depthwise_conv_3x3.h
deleted file mode 100644
index bbe759f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/depthwise_conv_3x3.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* 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_CL_KERNELS_DEPTHWISE_CONV_3X3_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_DEPTHWISE_CONV_3X3_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/cl/texture2d.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#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/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class DepthwiseConv3x3 : public GPUOperation {
- public:
-  DepthwiseConv3x3() = default;
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override;
-  int3 GetGridSize() const override;
-
-  // Move only
-  DepthwiseConv3x3(DepthwiseConv3x3&& operation);
-  DepthwiseConv3x3& operator=(DepthwiseConv3x3&& operation);
-  DepthwiseConv3x3(const DepthwiseConv3x3&) = delete;
-  DepthwiseConv3x3& operator=(const DepthwiseConv3x3&) = delete;
-
- private:
-  explicit DepthwiseConv3x3(const OperationDef& definition,
-                            bool weights_are_buffer, bool local_mem_uploads,
-                            const DeviceInfo& device_info);
-  template 
-  void UploadWeightsAndBiases(const tflite::gpu::Tensor& weights,
-                              const tflite::gpu::Tensor& biases,
-                              bool weights_are_buffer);
-
-  friend DepthwiseConv3x3 CreateDepthwiseConv3x3(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const DepthwiseConvolution2DAttributes& attr);
-
-  template 
-  void RearrangeWeightsAndBiasesData(
-      const tflite::gpu::Tensor& weights,
-      const tflite::gpu::Tensor& biases, absl::Span dst);
-
-  std::string GenerateDepthwiseConvCode(const OperationDef& op_def,
-                                        bool weights_are_buffer,
-                                        bool local_mem_uploads);
-
-  bool local_mem_uploads_;
-};
-
-template 
-void DepthwiseConv3x3::UploadWeightsAndBiases(
-    const tflite::gpu::Tensor& weights,
-    const tflite::gpu::Tensor& biases, bool weights_are_buffer) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  int texture_width = 10;  // 3x3 kernel + 1 bias
-  int texture_height = src_depth;
-  const int elements_count = texture_width * texture_height;
-  const bool fp32_weights = definition_.precision == CalculationsPrecision::F32;
-  const int float4_size = fp32_weights ? 16 : 8;
-
-  std::vector data(float4_size * elements_count);
-  if (fp32_weights) {
-    float4* ptr = reinterpret_cast(data.data());
-    RearrangeWeightsAndBiasesData(weights, biases,
-                                  absl::MakeSpan(ptr, elements_count));
-  } else {
-    half4* ptr = reinterpret_cast(data.data());
-    RearrangeWeightsAndBiasesData(weights, biases,
-                                  absl::MakeSpan(ptr, elements_count));
-  }
-
-  if (weights_are_buffer) {
-    BufferDescriptor desc;
-    desc.element_type = fp32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.element_size = 4;
-    desc.size = float4_size * elements_count;
-    desc.data = std::move(data);
-    args_.AddObject("weights",
-                    absl::make_unique(std::move(desc)));
-  } else {
-    Texture2DDescriptor desc;
-    desc.element_type = fp32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.size = int2(texture_width, texture_height);
-    desc.data = std::move(data);
-    args_.AddObject("weights",
-                    absl::make_unique(std::move(desc)));
-  }
-}
-
-template 
-void DepthwiseConv3x3::RearrangeWeightsAndBiasesData(
-    const tflite::gpu::Tensor& weights,
-    const tflite::gpu::Tensor& biases, absl::Span dst) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-
-  int counter = 0;
-  for (int s = 0; s < src_depth; ++s) {
-    for (int y = 0; y < 3; ++y) {
-      for (int x = 0; x < 3; ++x) {
-        T filter_val;
-        for (int i = 0; i < 4; ++i) {
-          const int s_ch = s * 4 + i;
-          if (s_ch < weights.shape.i) {
-            const int f_index = weights.shape.LinearIndex({0, y, x, s_ch});
-            filter_val[i] = weights.data[f_index];
-          } else {
-            filter_val[i] = 0.0f;
-          }
-        }
-        dst[counter++] = filter_val;
-      }
-    }
-
-    T bias_val;
-    for (int i = 0; i < 4; ++i) {
-      const int dst_ch = s * 4 + i;
-      bias_val[i] = dst_ch >= biases.shape.v ? 0.0f : biases.data[dst_ch];
-    }
-    dst[counter++] = bias_val;
-  }
-}
-
-bool IsDepthwiseConv3x3Supported(const DepthwiseConvolution2DAttributes& attr);
-
-DepthwiseConv3x3 CreateDepthwiseConv3x3(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const DepthwiseConvolution2DAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_DEPTHWISE_CONV_3X3_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/elementwise.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/elementwise.h
deleted file mode 100644
index c168990..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/elementwise.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* 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_CL_KERNELS_ELEMENTWISE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_ELEMENTWISE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// Creates simple one input operation without any parameters, for example
-// log, sin, cos, etc.
-GPUOperation CreateElementwiseOneInput(const OperationDef& definition,
-                                       const OperationType& op_type);
-
-// Creates simple two input(first input is runtime tensor and second input is
-// constant or linear/hwc tensor) operation, for example sub, div and etc.
-GPUOperation CreateElementwise(const DeviceInfo& device_info,
-                               const OperationDef& definition,
-                               const OperationType& op_type,
-                               const ElementwiseAttributes& attr);
-
-// Creates simple two input(2 runtime tensors) operation, for example
-// sub, div and etc.
-GPUOperation CreateElementwiseTwoInput(const OperationDef& definition,
-                                       const OperationType& op_type,
-                                       const BHWC& shape);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_ELEMENTWISE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/fully_connected.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/fully_connected.h
deleted file mode 100644
index ec572b2..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/fully_connected.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/* 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_CL_KERNELS_FULLY_CONNECTED_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_FULLY_CONNECTED_H_
-
-#include 
-
-#include 
-#include 
-#include 
-
-#include "absl/memory/memory.h"
-#include "tensorflow/lite/delegates/gpu/cl/arguments.h"
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/device_info.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/tuning_parameters.h"
-#include "tensorflow/lite/delegates/gpu/cl/precision.h"
-#include "tensorflow/lite/delegates/gpu/cl/texture2d.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.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"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-template 
-void RearrangeFCWeightsToIOO4I4(const tflite::gpu::Tensor& weights,
-                                S* dst) {
-  const int src_channels = weights.shape.i;
-  const int padded_src_channels = AlignByN(src_channels, 4);
-  const int dst_channels = weights.shape.o;
-  const int padded_dst_channels = AlignByN(dst_channels, 4);
-
-  // Change the travelsal order of the weight matrix in the following way:
-  // The matrix is segmented to blocks of 4x4. If (any) dimension of the matrix
-  // size is not divisible by 4, then pad with zeros. Each block is stored
-  // contigously. The 16 elements within a block are ordered as 4 elements of
-  // the first column, 4 elems of the second, etc. Blocks then traversed as
-  // columns first, rows last. As an example, an 8x8 matrix would be traversed
-  // as below.
-  //
-  //  |  0  4  8 12 32 36 40 44 |
-  //  |  1  5  9 13 33 37 41 45 |
-  //  |  2  6 10 14 34 38 42 46 |
-  //  |  3  7 11 15 35 39 43 47 |
-  //  | 16 20 24 28 48 52 56 60 |
-  //  | 17 21 25 29 49 53 57 61 |
-  //  | 18 22 26 30 50 54 58 62 |
-  //  | 19 23 27 31 51 55 59 63 |
-  //
-  // The benefit of doing this is that reading contigous 16 elements gives a 4x4
-  // block of the matrix, where the first 4 elements is the first row of the
-  // block, second 4 elements is the second row of the block, etc. Subsequent
-  // blocks contain elements of the same 4 columns.
-
-  for (int block_y = 0; 4 * block_y < padded_dst_channels; block_y++) {
-    for (int y_in_block = 0; y_in_block < 4; y_in_block++) {
-      for (int block_x = 0; 4 * block_x < padded_src_channels; block_x++) {
-        for (int x_in_block = 0; x_in_block < 4; x_in_block++) {
-          int y = 4 * block_y + y_in_block;
-          int x = 4 * block_x + x_in_block;
-          // Consider destination as an array with extents
-          // [padded_src_channels/4][padded_dst_channels/4][4][4]
-          int dst_index = block_x * padded_dst_channels * 4 + block_y * 16 +
-                          x_in_block * 4 + y_in_block;
-          if (x < src_channels && y < dst_channels) {
-            dst[dst_index] = weights.data[src_channels * y + x];
-          } else {
-            dst[dst_index] = 0.0f;
-          }
-        }
-      }
-    }
-  }
-}
-
-template 
-void RearrangeFCWeightsToOIO4I4(const tflite::gpu::Tensor& weights,
-                                S* dst) {
-  const int src_channels = weights.shape.i;
-  const int src_depth = DivideRoundUp(src_channels, 4);
-  const int dst_channels = weights.shape.o;
-  const int dst_depth = DivideRoundUp(dst_channels, 4);
-
-  int counter = 0;
-  for (int d = 0; d < dst_depth; ++d) {
-    for (int s = 0; s < src_depth; ++s) {
-      for (int i = 0; i < 4; ++i) {
-        const int src_ch = s * 4 + i;
-        for (int j = 0; j < 4; ++j) {
-          const int dst_ch = d * 4 + j;
-          if (src_ch < src_channels && dst_ch < dst_channels) {
-            dst[counter++] = weights.data[dst_ch * src_channels + src_ch];
-          } else {
-            dst[counter++] = 0.0f;
-          }
-        }
-      }
-    }
-  }
-}
-
-class FullyConnected : public GPUOperation {
- public:
-  FullyConnected() = default;
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override {
-    work_groups->push_back(work_group_size_);
-  }
-  int3 GetGridSize() const override;
-
-  // Move only
-  FullyConnected(FullyConnected&& kernel);
-  FullyConnected& operator=(FullyConnected&& kernel);
-  FullyConnected(const FullyConnected&) = delete;
-  FullyConnected& operator=(const FullyConnected&) = delete;
-
- private:
-  FullyConnected(const OperationDef& definition, const DeviceInfo& device_info);
-  friend FullyConnected CreateFullyConnected(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const FullyConnectedAttributes& attr);
-
-  template 
-  void UploadWeights(const tflite::gpu::Tensor& weights,
-                     bool weights_are_buffer);
-
-  std::string GetFullyConnectedKernelCode(const OperationDef& op_def,
-                                          const DeviceInfo& device_info);
-};
-
-template 
-void FullyConnected::UploadWeights(const tflite::gpu::Tensor& weights,
-                                   bool weights_are_buffer) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int dst_depth = DivideRoundUp(weights.shape.o, 4);
-
-  const int elements_count = src_depth * dst_depth * 4;
-  const bool f32_weights = definition_.precision == CalculationsPrecision::F32;
-
-  const int float4_size = f32_weights ? 16 : 8;
-
-  if (weights_are_buffer) {
-    BufferDescriptor desc;
-    desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.element_size = 16;
-    desc.size = float4_size * elements_count;
-    desc.data.resize(desc.size);
-
-    if (f32_weights) {
-      float* ptr = reinterpret_cast(desc.data.data());
-      RearrangeFCWeightsToIOO4I4(weights, ptr);
-    } else {
-      half* ptr = reinterpret_cast(desc.data.data());
-      RearrangeFCWeightsToIOO4I4(weights, ptr);
-    }
-
-    args_.AddObject("weights",
-                    absl::make_unique(std::move(desc)));
-  } else {
-    Texture2DDescriptor desc;
-    desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.size = int2(src_depth * 4, dst_depth);
-    desc.data.resize(float4_size * elements_count);
-
-    if (f32_weights) {
-      float* ptr = reinterpret_cast(desc.data.data());
-      RearrangeFCWeightsToOIO4I4(weights, ptr);
-    } else {
-      half* ptr = reinterpret_cast(desc.data.data());
-      RearrangeFCWeightsToOIO4I4(weights, ptr);
-    }
-
-    args_.AddObject("weights",
-                    absl::make_unique(std::move(desc)));
-  }
-}
-
-FullyConnected CreateFullyConnected(const DeviceInfo& device_info,
-                                    const OperationDef& definition,
-                                    const FullyConnectedAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_FULLY_CONNECTED_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h
deleted file mode 100644
index 57d8690..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/* 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_CL_KERNELS_GPU_OPERATION_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_GPU_OPERATION_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/arguments.h"
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_command_queue.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_program.h"
-#include "tensorflow/lite/delegates/gpu/cl/device_info.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/tuning_parameters.h"
-#include "tensorflow/lite/delegates/gpu/cl/precision.h"
-#include "tensorflow/lite/delegates/gpu/cl/program_cache.h"
-#include "tensorflow/lite/delegates/gpu/cl/serialization_generated.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// kCustom: default value
-//   GPUOperation::GetGridSize must be overloaded
-// kWBToX_HDToY_SToZ:
-//   grid_x = dst_[0]->Width() * dst_[0]->Batch();
-//   grid_y = dst_[0]->Height() * dst_[0]->Depth();
-//   grid_z = dst_[0]->Slices();
-// kWBToX_HDToY_ZIs1:
-//   grid_x = dst_[0]->Width() * dst_[0]->Batch();
-//   grid_y = dst_[0]->Height() * dst_[0]->Depth();
-//   grid_z = 1;
-// kWBToX_HToY_DToZ:
-//   grid_x = dst_[0]->Width() * dst_[0]->Batch();
-//   grid_y = dst_[0]->Height();
-//   grid_z = dst_[0]->Depth();
-// kBToX_YIs1_ZIs1:
-//   grid_x = dst_[0]->Batch();
-//   grid_y = 1;
-//   grid_z = 1;
-enum class TensorToGrid {
-  kCustom,
-  kWBToX_HDToY_SToZ,
-  kWBToX_HDToY_ZIs1,
-  kWBToX_HToY_DToZ,
-  kBToX_YIs1_ZIs1
-};
-
-struct CreationContext {
-  const CLDevice* device;
-  CLContext* context;
-  CLCommandQueue* queue;
-  ProgramCache* cache;
-
-  const DeviceInfo& GetDeviceInfo() const { return device->info_; }
-};
-
-struct OperationDef {
-  CalculationsPrecision precision;
-  std::vector src_tensors;
-  std::vector dst_tensors;
-
-  // returns FLOAT32 for F32 precision and FLOAT16 for F16 precision
-  DataType GetDataType() const;
-  // Primary means the first src tensor, because first tensor usually defines
-  // the structure of kernel, all other resources(biases) types and etc.
-  DataType GetPrimaryDataType() const;
-  TensorStorageType GetPrimaryStorageType() const;
-  bool IsBatchSupported() const;
-};
-
-// GPUOperation represents some implementation of neural network operation on
-// GPU. GPUOperation can contain another GPU operations with flag elementwise_.
-// When GPUOperation contains another GPU ops, this GPUoperation replaces
-// some sequence of operations Op + op0 + op1 + ...
-// Because of this abilities of GPUOperation, usage scenario is next:
-// Create instance of GPUOperation.
-// Create all instances of GPUOperations that we will(probably) attach
-// to GPUOperation. Attach all GPUOperations to GPUOperation. Call
-// GPUOperation.Compile(). Don't call GPUOperations.Compile() if it
-// attached, it useless(and may be error)
-class GPUOperation {
- public:
-  GPUOperation() = default;
-  explicit GPUOperation(const OperationDef& definition);
-  virtual ~GPUOperation() = default;
-  // Move only
-  GPUOperation(GPUOperation&& operation);
-  GPUOperation& operator=(GPUOperation&& operation);
-  GPUOperation(const GPUOperation&) = delete;
-  GPUOperation& operator=(const GPUOperation&) = delete;
-
-  absl::Status AddOperation(GPUOperation* operation);
-
-  void SetSrc(Tensor* ptr, int index = 0);
-  void SetDst(Tensor* ptr, int index = 0);
-
-  // should be called after changes of inputs/outputs.
-  absl::Status UpdateParams();
-
-  absl::Status AddToQueue(CLCommandQueue* queue) {
-    RETURN_IF_ERROR(args_.Bind(kernel_.kernel()));
-    return queue->Dispatch(kernel_, work_groups_count_, work_group_size_);
-  }
-
-  virtual void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info, std::vector* work_groups) const;
-
-  absl::Status Tune(const TuningParameters& params);
-
-  absl::Status AssembleCode(const DeviceInfo& device_info, CLContext* context);
-
-  absl::Status Compile(const CreationContext& creation_context);
-
-  absl::Status CompileDeserialized(const CreationContext& creation_context);
-
-  virtual absl::Status PostCompileCheck(const DeviceInfo& device_info,
-                                        const KernelInfo& kernel_info) {
-    return absl::OkStatus();
-  }
-
-  const OperationDef& GetDefinition() const { return definition_; }
-
-  void AddSrcTensor(const std::string& tensor_name,
-                    const TensorDescriptor& desc);
-  void AddSrcBuffer(const std::string& buffer_name,
-                    const BufferDescriptor& desc);
-  void AddDstTensor(const std::string& tensor_name,
-                    const TensorDescriptor& desc);
-
-  bool IsLinkable() const { return elementwise_ && linkable_; }
-
-  // for linking
-  void AddUniquePostfix(const std::string& unique_postfix);
-
-  Arguments args_;
-  std::string code_;
-  int3 work_group_size_ = int3(8, 4, 1);
-  std::vector compiler_options_;
-  // not applicable to elementwise
-  TensorToGrid tensor_to_grid_ = TensorToGrid::kCustom;
-
-  bool elementwise_ = false;
-  // applicable only with elementwise_ = true;
-  bool linkable_ = true;  // by default every elementwise is linkable
-  // applicable only with elementwise_ = true;
-  bool check_src_channels_size_ = false;
-
- protected:
-  friend flatbuffers::Offset Encode(
-      const GPUOperation& op, flatbuffers::FlatBufferBuilder* builder);
-  friend absl::Status Decode(CLContext* context,
-                             const data::GPUOperation* fb_op, GPUOperation* op);
-
-  virtual absl::Status BindArguments(ArgumentsBinder* args) {
-    return absl::OkStatus();
-  }
-  virtual int3 GetGridSize() const;
-
-  // Defines operation calculation precision and format of src/dst tensors.
-  OperationDef definition_;
-  std::vector src_;
-  std::vector dst_;
-  CLKernel kernel_;
-  int grid_dimension_ = 3;  // can be 1, 2 or 3
-  int3 work_group_launch_order_ = int3(0, 1, 2);
-  int3 grid_size_ = int3(0, 0, 0);
-  std::vector src_tensors_names_;
-  std::vector dst_tensors_names_;
-
- private:
-  int3 work_groups_count_ = int3(0, 0, 0);
-  int linkable_count_ = 0;
-  std::string elementwise_code_;  // temporary, used during op construction
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_GPU_OPERATION_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/lstm.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/lstm.h
deleted file mode 100644
index 5d827d4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/lstm.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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_CL_KERNELS_LSTM_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_LSTM_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreateLSTM(const OperationDef& definition,
-                        const DeviceInfo& device_info);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_LSTM_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/max_unpooling.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/max_unpooling.h
deleted file mode 100644
index c1b6cbf..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/max_unpooling.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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_CL_KERNELS_MAX_UNPOOLING_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_MAX_UNPOOLING_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreateMaxUnpooling(const OperationDef& definition,
-                                const MaxUnpooling2DAttributes& attr);
-
-GPUOperation CreateMaxUnpooling(const OperationDef& definition,
-                                const MaxUnpooling3DAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_MAX_UNPOOLING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/mean.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/mean.h
deleted file mode 100644
index 3bf2061..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/mean.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_MEAN_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_MEAN_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/precision.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class Mean : public GPUOperation {
- public:
-  Mean() = default;
-  Mean(const OperationDef& definition, const DeviceInfo& device_info);
-
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override {
-    work_groups->push_back(work_group_size_);
-  }
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-
-  // Move only
-  Mean(Mean&& operation);
-  Mean& operator=(Mean&& operation);
-  Mean(const Mean&) = delete;
-  Mean& operator=(const Mean&) = delete;
-
- private:
-  std::string GetMeanKernelCode(const OperationDef& op_def,
-                                const int3& work_group_size);
-};
-
-Mean CreateMean(const OperationDef& definition, const DeviceInfo& device_info);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_MEAN_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/mean_stddev_normalization.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/mean_stddev_normalization.h
deleted file mode 100644
index 3312d23..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/mean_stddev_normalization.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_LSTM_NORMALIZATION_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_LSTM_NORMALIZATION_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/device_info.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// Implements tensor_utils::MeanStddevNormalization
-class MeanStdDevNormalization : public GPUOperation {
- public:
-  explicit MeanStdDevNormalization(const OperationDef& definition,
-                                   const DeviceInfo& device_info,
-                                   const int tensor_slices);
-
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override {
-    work_groups->push_back(work_group_size_);
-  }
-  int3 GetGridSize() const override;
-
-  // Move only
-  MeanStdDevNormalization(MeanStdDevNormalization&& kernel) = default;
-  MeanStdDevNormalization& operator=(MeanStdDevNormalization&& kernel) =
-      default;
-  MeanStdDevNormalization(const MeanStdDevNormalization&) = delete;
-  MeanStdDevNormalization& operator=(const MeanStdDevNormalization&) = delete;
-
- private:
-  std::string GetNormalizationCode();
-};
-
-MeanStdDevNormalization CreateMeanStdDevNormalization(
-    const OperationDef& definition, const DeviceInfo& device_info,
-    const int tensor_slices);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_LSTM_NORMALIZATION_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/padding.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/padding.h
deleted file mode 100644
index 8104716..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/padding.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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_CL_KERNELS_PADDING_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_PADDING_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreatePadding(const OperationDef& definition,
-                           const PadAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_PADDING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/pooling.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/pooling.h
deleted file mode 100644
index 81a0dff..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/pooling.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* 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_CL_KERNELS_POOLING_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_POOLING_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreatePooling(const OperationDef& definition,
-                           const Pooling2DAttributes& attr);
-
-GPUOperation CreatePooling(const OperationDef& definition,
-                           const Pooling3DAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_POOLING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/prelu.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/prelu.h
deleted file mode 100644
index 5d2a41b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/prelu.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* 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_CL_KERNELS_PRELU_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_PRELU_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/tensor.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreatePReLU(const DeviceInfo& device_info,
-                         const OperationDef& definition,
-                         const PReLUAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_PRELU_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/quantize_and_dequantize.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/quantize_and_dequantize.h
deleted file mode 100644
index 1e37e42..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/quantize_and_dequantize.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_QUANTIZE_AND_DEQUANTIZE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_QUANTIZE_AND_DEQUANTIZE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/tensor.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// Performs the operation: {Quantize, Dequantize} on floating-point data.
-// We need this operation to emulate the error introduced by quantization
-// on the GPU, which cannot represent int8 tensors.
-//
-// Implemented as:
-// qvalue = round((min(qmax, max(qmin, src_val)) - qmin) * (1/qscale))
-// dq_value = qvalue * qscale + qmin
-// Here, qmin, qmax & qscale refer to the quantization values as implemented in
-// TensorFlow Lite's 'FakeQuant' kernel.
-//
-// NOTE: We do not need to nudge min/max values in this op, since they would
-// already be adjusted while generating the quantized model.
-GPUOperation CreateQuantizeAndDequantize(
-    const OperationDef& definition,
-    const QuantizeAndDequantizeAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_QUANTIZE_AND_DEQUANTIZE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/reduce.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/reduce.h
deleted file mode 100644
index def7ced..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/reduce.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_REDUCE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_REDUCE_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreateReduce(const OperationDef& definition,
-                          const ReduceAttributes& attr,
-                          const OperationType& op_type);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_REDUCE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/relu.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/relu.h
deleted file mode 100644
index 1b4e3a8..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/relu.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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_CL_KERNELS_RELU_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_RELU_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreateReLU(const OperationDef& definition,
-                        const ReLUAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_RELU_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/reshape.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/reshape.h
deleted file mode 100644
index 59cc5c1..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/reshape.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_CL_KERNELS_RESHAPE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_RESHAPE_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreateReshape(const OperationDef& definition);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_RESHAPE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/reshapex4.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/reshapex4.h
deleted file mode 100644
index 2052d45..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/reshapex4.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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_CL_KERNELS_RESHAPEX4_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_RESHAPEX4_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_command_queue.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// More optimized, but require src_channels % 4 == 0 and dst_channels % 4 == 0
-GPUOperation CreateReshapex4(const OperationDef& definition);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_RESHAPEX4_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/resize.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/resize.h
deleted file mode 100644
index 859d750..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/resize.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_RESIZE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_RESIZE_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class Resize : public GPUOperation {
- public:
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-
-  // Move only
-  Resize(Resize&& operation);
-  Resize& operator=(Resize&& operation);
-  Resize(const Resize&) = delete;
-  Resize& operator=(const Resize&) = delete;
-
-  friend Resize CreateResize(const OperationDef& definition,
-                             const Resize2DAttributes& attr);
-
- private:
-  Resize(const OperationDef& definition, const Resize2DAttributes& attr);
-
-  std::string GetResizeCode(const OperationDef& op_def,
-                            const Resize2DAttributes& attr);
-
-  Resize2DAttributes attr_;
-};
-
-Resize CreateResize(const OperationDef& definition,
-                    const Resize2DAttributes& attr);
-
-class Resize3D : public GPUOperation {
- public:
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-
-  // Move only
-  Resize3D(Resize3D&& operation);
-  Resize3D& operator=(Resize3D&& operation);
-  Resize3D(const Resize3D&) = delete;
-  Resize3D& operator=(const Resize3D&) = delete;
-
-  friend Resize3D CreateResize3D(const OperationDef& definition,
-                                 const Resize3DAttributes& attr);
-
- private:
-  Resize3D(const OperationDef& definition, const Resize3DAttributes& attr);
-
-  std::string GetResize3DCode(const OperationDef& op_def,
-                              const Resize3DAttributes& attr);
-
-  Resize3DAttributes attr_;
-};
-
-Resize3D CreateResize3D(const OperationDef& definition,
-                        const Resize3DAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_RESIZE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/softmax.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/softmax.h
deleted file mode 100644
index 17a2647..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/softmax.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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_CL_KERNELS_SOFTMAX_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SOFTMAX_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/precision.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreateSoftmax(const OperationDef& definition);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SOFTMAX_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/softmax1x1.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/softmax1x1.h
deleted file mode 100644
index 202f46d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/softmax1x1.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* 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_CL_KERNELS_SOFTMAX1X1_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SOFTMAX1X1_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/precision.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class Softmax1x1 : public GPUOperation {
- public:
-  Softmax1x1() = default;
-  explicit Softmax1x1(const OperationDef& definition);
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override {
-    work_groups->push_back(work_group_size_);
-  }
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-
-  // Move only
-  Softmax1x1(Softmax1x1&& kernel);
-  Softmax1x1& operator=(Softmax1x1&& kernel);
-  Softmax1x1(const Softmax1x1&) = delete;
-  Softmax1x1& operator=(const Softmax1x1&) = delete;
-
-  friend Softmax1x1 CreateSoftmax1x1();
-
- private:
-  std::string GetSoftmaxKernelCode(const OperationDef& op_def);
-};
-
-Softmax1x1 CreateSoftmax1x1(const OperationDef& definition);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SOFTMAX1X1_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/space_to_depth.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/space_to_depth.h
deleted file mode 100644
index 08aca30..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/space_to_depth.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SPACE_TO_DEPTH_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SPACE_TO_DEPTH_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreateSpaceToDepth(const OperationDef& op_def,
-                                const SpaceToDepthAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SPACE_TO_DEPTH_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/special/depthwise_conv_plus_1x1_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/special/depthwise_conv_plus_1x1_conv.h
deleted file mode 100644
index b870511..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/special/depthwise_conv_plus_1x1_conv.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SPECIAL_DEPTHWISE_CONV_PLUS_1X1_CONV_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SPECIAL_DEPTHWISE_CONV_PLUS_1X1_CONV_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/gpu_object.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#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/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-bool IsDepthwiseConvPlus1x1ConvSupported(
-    const OperationDef& definition,
-    const DepthwiseConvolution2DAttributes& dw_attr,
-    const Convolution2DAttributes& conv_attr);
-
-GPUOperation CreateDepthwiseConvPlus1x1Conv(
-    const OperationDef& definition,
-    const DepthwiseConvolution2DAttributes& dw_attr,
-    const Convolution2DAttributes& conv_attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SPECIAL_DEPTHWISE_CONV_PLUS_1X1_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/special/fc_fc_add.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/special/fc_fc_add.h
deleted file mode 100644
index fea9d1a..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/special/fc_fc_add.h
+++ /dev/null
@@ -1,189 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SPECIAL_FC_FC_ADD_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SPECIAL_FC_FC_ADD_H_
-
-#include 
-
-#include 
-#include 
-#include 
-
-#include "absl/memory/memory.h"
-#include "tensorflow/lite/delegates/gpu/cl/arguments.h"
-#include "tensorflow/lite/delegates/gpu/cl/buffer.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/device_info.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/tuning_parameters.h"
-#include "tensorflow/lite/delegates/gpu/cl/precision.h"
-#include "tensorflow/lite/delegates/gpu/cl/texture2d.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.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"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-template 
-void RearrangeFCWeightsToIOO4I4(const tflite::gpu::Tensor& weights,
-                                S* dst) {
-  const int src_channels = weights.shape.i;
-  const int padded_src_channels = AlignByN(src_channels, 4);
-  const int dst_channels = weights.shape.o;
-  const int padded_dst_channels = AlignByN(dst_channels, 4);
-
-  for (int block_y = 0; 4 * block_y < padded_dst_channels; block_y++) {
-    for (int y_in_block = 0; y_in_block < 4; y_in_block++) {
-      for (int block_x = 0; 4 * block_x < padded_src_channels; block_x++) {
-        for (int x_in_block = 0; x_in_block < 4; x_in_block++) {
-          int y = 4 * block_y + y_in_block;
-          int x = 4 * block_x + x_in_block;
-          int dst_index = block_x * padded_dst_channels * 4 + block_y * 16 +
-                          x_in_block * 4 + y_in_block;
-          if (x < src_channels && y < dst_channels) {
-            dst[dst_index] = weights.data[src_channels * y + x];
-          } else {
-            dst[dst_index] = 0.0f;
-          }
-        }
-      }
-    }
-  }
-}
-
-template 
-void RearrangeFCWeightsToOIO4I4(const tflite::gpu::Tensor& weights,
-                                S* dst) {
-  const int src_channels = weights.shape.i;
-  const int src_depth = DivideRoundUp(src_channels, 4);
-  const int dst_channels = weights.shape.o;
-  const int dst_depth = DivideRoundUp(dst_channels, 4);
-
-  int counter = 0;
-  for (int d = 0; d < dst_depth; ++d) {
-    for (int s = 0; s < src_depth; ++s) {
-      for (int i = 0; i < 4; ++i) {
-        const int src_ch = s * 4 + i;
-        for (int j = 0; j < 4; ++j) {
-          const int dst_ch = d * 4 + j;
-          if (src_ch < src_channels && dst_ch < dst_channels) {
-            dst[counter++] = weights.data[dst_ch * src_channels + src_ch];
-          } else {
-            dst[counter++] = 0.0f;
-          }
-        }
-      }
-    }
-  }
-}
-
-class FCFCAdd : public GPUOperation {
- public:
-  FCFCAdd() = default;
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override {
-    work_groups->push_back(work_group_size_);
-  }
-  int3 GetGridSize() const override;
-
-  // Move only
-  FCFCAdd(FCFCAdd&& kernel);
-  FCFCAdd& operator=(FCFCAdd&& kernel);
-  FCFCAdd(const FCFCAdd&) = delete;
-  FCFCAdd& operator=(const FCFCAdd&) = delete;
-
- private:
-  FCFCAdd(const OperationDef& definition, const DeviceInfo& device_info);
-  friend FCFCAdd CreateFCFCAdd(const DeviceInfo& device_info,
-                               const OperationDef& definition,
-                               const FullyConnectedAttributes& attr0,
-                               const FullyConnectedAttributes& attr1);
-
-  template 
-  void UploadWeights(const tflite::gpu::Tensor& weights,
-                     const std::string& name, bool weights_are_buffer);
-
-  std::string GetFCFCAddKernelCode(const OperationDef& op_def,
-                                   const DeviceInfo& device_info);
-};
-
-template 
-void FCFCAdd::UploadWeights(const tflite::gpu::Tensor& weights,
-                            const std::string& name, bool weights_are_buffer) {
-  const int src_depth = DivideRoundUp(weights.shape.i, 4);
-  const int dst_depth = DivideRoundUp(weights.shape.o, 4);
-
-  const int elements_count = src_depth * dst_depth * 4;
-  const bool f32_weights = definition_.precision == CalculationsPrecision::F32;
-
-  const int float4_size = f32_weights ? 16 : 8;
-
-  if (weights_are_buffer) {
-    BufferDescriptor desc;
-    desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    desc.element_size = 16;
-    desc.size = float4_size * elements_count;
-    desc.data.resize(desc.size);
-
-    if (f32_weights) {
-      float* ptr = reinterpret_cast(desc.data.data());
-      RearrangeFCWeightsToIOO4I4(weights, ptr);
-    } else {
-      half* ptr = reinterpret_cast(desc.data.data());
-      RearrangeFCWeightsToIOO4I4(weights, ptr);
-    }
-
-    args_.AddObject(name, absl::make_unique(std::move(desc)));
-  } else {
-    Texture2DDescriptor desc;
-    desc.element_type = f32_weights ? DataType::FLOAT32 : DataType::FLOAT16;
-    // desc.element_type = DataType::UINT8;
-    // desc.normalized = true;
-    // desc.normalized_type = f32_weights ? DataType::FLOAT32 :
-    // DataType::FLOAT16;
-    desc.size = int2(src_depth * 4, dst_depth);
-    desc.data.resize(float4_size * elements_count);
-
-    if (f32_weights) {
-      float* ptr = reinterpret_cast(desc.data.data());
-      RearrangeFCWeightsToOIO4I4(weights, ptr);
-    } else {
-      half* ptr = reinterpret_cast(desc.data.data());
-      RearrangeFCWeightsToOIO4I4(weights, ptr);
-    }
-
-    args_.AddObject(name,
-                    absl::make_unique(std::move(desc)));
-  }
-}
-
-FCFCAdd CreateFCFCAdd(const DeviceInfo& device_info,
-                      const OperationDef& definition,
-                      const FullyConnectedAttributes& attr0,
-                      const FullyConnectedAttributes& attr1);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_SPECIAL_FC_FC_ADD_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/strided_slice.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/strided_slice.h
deleted file mode 100644
index dddff2f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/strided_slice.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* 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_CL_KERNELS_STRIDED_SLICE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_STRIDED_SLICE_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class StridedSlice : public GPUOperation {
- public:
-  StridedSlice(const OperationDef& definition, const SliceAttributes& attr);
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-
-  // Move only
-  StridedSlice(StridedSlice&& operation);
-  StridedSlice& operator=(StridedSlice&& operation);
-  StridedSlice(const StridedSlice&) = delete;
-  StridedSlice& operator=(const StridedSlice&) = delete;
-
- private:
-  std::string GetStridedSliceCode(const OperationDef& op_def, bool alignedx4);
-
-  SliceAttributes attributes_;
-};
-
-StridedSlice CreateStridedSlice(const OperationDef& definition,
-                                const SliceAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_STRIDED_SLICE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/transpose.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/transpose.h
deleted file mode 100644
index 631d5dc..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/transpose.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_CL_KERNELS_TRANSPOSE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_TRANSPOSE_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-GPUOperation CreateTranspose(const OperationDef& definition,
-                             const TransposeAttributes& attr);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_TRANSPOSE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/tuning_parameters.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/tuning_parameters.h
deleted file mode 100644
index c57ccad..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/tuning_parameters.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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_CL_KERNELS_TUNING_PARAMETERS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_TUNING_PARAMETERS_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_command_queue.h"
-#include "tensorflow/lite/delegates/gpu/cl/device_info.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-enum class TuningType { EXHAUSTIVE, FAST };
-
-struct TuningParameters {
-  ProfilingCommandQueue* queue;
-  const DeviceInfo* info;
-  TuningType tuning_type = TuningType::EXHAUSTIVE;
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_TUNING_PARAMETERS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/util.h
deleted file mode 100644
index 69f6808..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/util.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* 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_CL_KERNELS_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_UTIL_H_
-
-#include 
-#include 
-
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/cl/device_info.h"
-#include "tensorflow/lite/delegates/gpu/cl/precision.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.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"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-std::string GetCommonDefines(CalculationsPrecision precision);
-
-// Calculates correct X coordinate when stride != 1 and batch != 1 for layouts
-// with B after W (for example HWBC4) and WB stored in one axis of GPU
-// resources.
-std::string GetXStrideCorrected(const std::string& src_x,
-                                const std::string& batch_size,
-                                const std::string& stride_x,
-                                const std::string& padding_x);
-
-// Calculates correct X coordinate when stride != 1 and batch != 1 for layouts
-// with B after W (for example HWBC4) and WB stored in one axis of GPU
-// resources.
-std::string GetXStrideCorrectedV2(const std::string& src_x,
-                                  const std::string& batch_size,
-                                  const std::string& stride_x,
-                                  const std::string& padding_x);
-
-template 
-void RearrangeWeightsToOHWIOGroupI4O4(
-    const tflite::gpu::Tensor& weights, int out_group_size,
-    absl::Span dst) {
-  const int dst_slices = DivideRoundUp(weights.shape.o, 4);
-  const int src_slices = DivideRoundUp(weights.shape.i, 4);
-  const int dst_groups = DivideRoundUp(dst_slices, out_group_size);
-
-  int counter = 0;
-  for (int d = 0; d < dst_groups; ++d) {
-    for (int y = 0; y < weights.shape.h; ++y) {
-      for (int x = 0; x < weights.shape.w; ++x) {
-        for (int s = 0; s < src_slices; ++s) {
-          for (int d_group = 0; d_group < out_group_size; ++d_group) {
-            for (int j = 0; j < 4; ++j) {
-              T filter;
-              for (int i = 0; i < 4; ++i) {
-                const int s_ch = s * 4 + j;
-                const int d_ch = (d * out_group_size + d_group) * 4 + i;
-                if (s_ch < weights.shape.i && d_ch < weights.shape.o) {
-                  const int f_index =
-                      weights.shape.LinearIndex({d_ch, y, x, s_ch});
-                  filter[i] = weights.data[f_index];
-                } else {
-                  filter[i] = 0.0f;
-                }
-              }
-              dst[counter++] = filter;
-            }
-          }
-        }
-      }
-    }
-  }
-}
-
-template 
-void RearrangeWeightsToODHWIOGroupI4O4(
-    const tflite::gpu::Tensor& weights, int out_group_size,
-    absl::Span dst) {
-  const int dst_slices = DivideRoundUp(weights.shape.o, 4);
-  const int src_slices = DivideRoundUp(weights.shape.i, 4);
-  const int dst_groups = DivideRoundUp(dst_slices, out_group_size);
-
-  int counter = 0;
-  for (int d = 0; d < dst_groups; ++d) {
-    for (int z = 0; z < weights.shape.d; ++z) {
-      for (int y = 0; y < weights.shape.h; ++y) {
-        for (int x = 0; x < weights.shape.w; ++x) {
-          for (int s = 0; s < src_slices; ++s) {
-            for (int d_group = 0; d_group < out_group_size; ++d_group) {
-              for (int j = 0; j < 4; ++j) {
-                T filter;
-                for (int i = 0; i < 4; ++i) {
-                  const int s_ch = s * 4 + j;
-                  const int d_ch = (d * out_group_size + d_group) * 4 + i;
-                  if (s_ch < weights.shape.i && d_ch < weights.shape.o) {
-                    const int f_index =
-                        weights.shape.LinearIndex({d_ch, y, x, z, s_ch});
-                    filter[i] = weights.data[f_index];
-                  } else {
-                    filter[i] = 0.0f;
-                  }
-                }
-                dst[counter++] = filter;
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-}
-
-template 
-void RearrangeWeightsToI4HWIOOGroupO4(
-    const tflite::gpu::Tensor& weights, int out_group_size,
-    absl::Span dst) {
-  const int dst_slices = DivideRoundUp(weights.shape.o, 4);
-  const int src_slices = DivideRoundUp(weights.shape.i, 4);
-  const int dst_groups = DivideRoundUp(dst_slices, out_group_size);
-
-  int counter = 0;
-  for (int j = 0; j < 4; ++j) {
-    for (int y = 0; y < weights.shape.h; ++y) {
-      for (int x = 0; x < weights.shape.w; ++x) {
-        for (int s = 0; s < src_slices; ++s) {
-          for (int d = 0; d < dst_groups; ++d) {
-            for (int d_group = 0; d_group < out_group_size; ++d_group) {
-              T filter;
-              for (int i = 0; i < 4; ++i) {
-                const int s_ch = s * 4 + j;
-                const int d_ch = (d * out_group_size + d_group) * 4 + i;
-                if (s_ch < weights.shape.i && d_ch < weights.shape.o) {
-                  const int f_index =
-                      weights.shape.LinearIndex({d_ch, y, x, s_ch});
-                  filter[i] = weights.data[f_index];
-                } else {
-                  filter[i] = 0.0f;
-                }
-              }
-              dst[counter++] = filter;
-            }
-          }
-        }
-      }
-    }
-  }
-}
-
-template 
-void RearrangeWeightsToI4DHWIOOGroupO4(
-    const tflite::gpu::Tensor& weights, int out_group_size,
-    absl::Span dst) {
-  const int dst_slices = DivideRoundUp(weights.shape.o, 4);
-  const int src_slices = DivideRoundUp(weights.shape.i, 4);
-  const int dst_groups = DivideRoundUp(dst_slices, out_group_size);
-
-  int counter = 0;
-  for (int j = 0; j < 4; ++j) {
-    for (int z = 0; z < weights.shape.d; ++z) {
-      for (int y = 0; y < weights.shape.h; ++y) {
-        for (int x = 0; x < weights.shape.w; ++x) {
-          for (int s = 0; s < src_slices; ++s) {
-            for (int d = 0; d < dst_groups; ++d) {
-              for (int d_group = 0; d_group < out_group_size; ++d_group) {
-                T filter;
-                for (int i = 0; i < 4; ++i) {
-                  const int s_ch = s * 4 + j;
-                  const int d_ch = (d * out_group_size + d_group) * 4 + i;
-                  if (s_ch < weights.shape.i && d_ch < weights.shape.o) {
-                    const int f_index =
-                        weights.shape.LinearIndex({d_ch, y, x, z, s_ch});
-                    filter[i] = weights.data[f_index];
-                  } else {
-                    filter[i] = 0.0f;
-                  }
-                }
-                dst[counter++] = filter;
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-}
-
-// Returns float4 mask for last plane(batch of 4 channels)
-// assumes that plane size is 4;
-// for example we have 7 channels, in our data structures we align it to 8
-// but 8s-channel will be empty, then last plane (batch of 4 channels) will
-// have this mask (1, 1, 1, 0).
-float4 GetMaskForLastPlane(int channels);
-
-// returns first work group from wgs that has size not bigger than max_wg_size
-// if no suitable groups among wgs, returns {1, 1, 1}
-int3 GetFirstSuitableWorkGroup(const std::vector& wgs, int max_wg_size);
-
-// task_size as amount of FLT4 processed elements.
-int GetRecommendedBlockSizeForConv(const DeviceInfo& device,
-                                   CalculationsPrecision precision,
-                                   int task_size);
-
-int3 GetWorkGroupsCount(const int3& grid_size, const int3& work_group_size);
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/winograd.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/winograd.h
deleted file mode 100644
index 609e38a..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/winograd.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_WINOGRAD_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_WINOGRAD_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/linear_storage.h"
-#include "tensorflow/lite/delegates/gpu/cl/precision.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// You can read https://arxiv.org/pdf/1509.09308.pdf for understanding of basic
-// principles. In this kernels used different matrices for transformations than
-// in original work.
-class Winograd4x4To36 : public GPUOperation {
- public:
-  Winograd4x4To36() = default;
-  Winograd4x4To36(const OperationDef& definition, const Padding2D& padding,
-                  const DeviceInfo& device_info);
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override;
-
-  // Move only
-  Winograd4x4To36(Winograd4x4To36&& operation);
-  Winograd4x4To36& operator=(Winograd4x4To36&& operation);
-  Winograd4x4To36(const Winograd4x4To36&) = delete;
-  Winograd4x4To36& operator=(const Winograd4x4To36&) = delete;
-
- private:
-  friend Winograd4x4To36 CreateWinograd4x4To36(const DeviceInfo& device_info,
-                                               const OperationDef& definition,
-                                               const Padding2D& padding);
-
-  void UploadBt();
-
-  std::string GetWinograd4x4To36Code(const OperationDef& op_def);
-
-  // Must be called after kernel compilation
-  int3 SelectBestWorkGroup(const KernelInfo& kernel_info) const;
-
-  Padding2D padding_;
-};
-
-Winograd4x4To36 CreateWinograd4x4To36(const DeviceInfo& device_info,
-                                      const OperationDef& definition,
-                                      const Padding2D& padding);
-
-class Winograd36To4x4 : public GPUOperation {
- public:
-  Winograd36To4x4() = default;
-  Winograd36To4x4(const OperationDef& definition,
-                  const DeviceInfo& device_info);
-  absl::Status BindArguments(ArgumentsBinder* args) override;
-  int3 GetGridSize() const override;
-  void GetPossibleKernelWorkGroups(
-      TuningType tuning_type, const DeviceInfo& device_info,
-      const KernelInfo& kernel_info,
-      std::vector* work_groups) const override;
-
-  // Move only
-  Winograd36To4x4(Winograd36To4x4&& operation);
-  Winograd36To4x4& operator=(Winograd36To4x4&& operation);
-  Winograd36To4x4(const Winograd36To4x4&) = delete;
-  Winograd36To4x4& operator=(const Winograd36To4x4&) = delete;
-
- private:
-  friend Winograd36To4x4 CreateWinograd36To4x4(
-      const DeviceInfo& device_info, const OperationDef& definition,
-      const tflite::gpu::Tensor& biases);
-
-  void UploadAt();
-
-  std::string GetWinograd36To4x4Code(const OperationDef& op_def);
-
-  // Must be called after kernel compilation
-  int3 SelectBestWorkGroup(const KernelInfo& kernel_info) const;
-};
-
-Winograd36To4x4 CreateWinograd36To4x4(
-    const DeviceInfo& device_info, const OperationDef& definition,
-    const tflite::gpu::Tensor& biases);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_WINOGRAD_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/work_group_picking.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/work_group_picking.h
deleted file mode 100644
index ea58ff2..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/kernels/work_group_picking.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* 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_CL_KERNELS_WORK_GROUP_PICKING_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_WORK_GROUP_PICKING_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/device_info.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/tuning_parameters.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/common/workgroup_selection.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-// multiplier can be power of two only
-void GetPossibleWorkGroupsXYMultipleOf(int multiplier,
-                                       const DeviceInfo& device_info,
-                                       const KernelInfo& kernel_info,
-                                       const int3& grid,
-                                       WorkGroupSizeAlignment z_alignment,
-                                       std::vector* work_groups);
-
-void GetPossibleWorkGroupsXMultipleOf(int multiplier,
-                                      const DeviceInfo& device_info,
-                                      const KernelInfo& kernel_info,
-                                      const int3& grid,
-                                      WorkGroupSizeAlignment z_alignment,
-                                      std::vector* work_groups);
-
-int3 GetWorkGroupXY128ConvLinear(const int3& grid);
-
-int3 GetWorkGroupXY128Simple(const int3& grid);
-int3 GetWorkGroupXY128Conv(const int3& grid);
-
-bool XY128RequiresMoreWorkGroupsThenXY128Linear(int width, int height);
-
-void GetPossibleWorkGroups(TuningType tuning_type,
-                           const DeviceInfo& device_info,
-                           const KernelInfo& kernel_info, const int3& grid,
-                           std::vector* work_groups);
-
-void GetPossibleWorkGroupsConv(TuningType tuning_type,
-                               const DeviceInfo& device_info,
-                               const KernelInfo& kernel_info, const int3& grid,
-                               std::vector* work_groups);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_KERNELS_WORK_GROUP_PICKING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/linear_storage.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/linear_storage.h
deleted file mode 100644
index 37e7f12..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/linear_storage.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* 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_CL_LINEAR_STORAGE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_LINEAR_STORAGE_H_
-
-#include 
-#include 
-
-#include "absl/strings/str_cat.h"
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/cl/gpu_object.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-enum class LinearStorageType { BUFFER, TEXTURE_2D };
-
-struct TensorLinearDescriptor : public GPUObjectDescriptor {
-  LinearStorageType storage_type;
-  DataType element_type;  // FLOAT32 or FLOAT16
-  MemoryType memory_type = MemoryType::GLOBAL;  // applicable for BUFFER
-
-  // optional
-  int size = 0;
-  std::vector data;
-
-  TensorLinearDescriptor() = default;
-  TensorLinearDescriptor(const TensorLinearDescriptor&) = default;
-  TensorLinearDescriptor& operator=(const TensorLinearDescriptor&) = default;
-  TensorLinearDescriptor(TensorLinearDescriptor&& desc);
-  TensorLinearDescriptor& operator=(TensorLinearDescriptor&& desc);
-
-  void UploadLinearData(
-      const tflite::gpu::Tensor& src,
-      int aligned_size = 0);
-
-  absl::Status PerformSelector(const std::string& selector,
-                               const std::vector& args,
-                               const std::vector& template_args,
-                               std::string* result) const override;
-
-  GPUResources GetGPUResources() const override;
-  absl::Status PerformReadSelector(const std::vector& args,
-                                   std::string* result) const;
-
-  absl::Status CreateGPUObject(CLContext* context,
-                               GPUObjectPtr* result) const override;
-  void Release() override;
-};
-
-LinearStorageType DeduceLinearStorageType(
-    TensorStorageType tensor_storage_type);
-
-// Represent GPU 1D-array of FLT4(float4/half4) values
-// Can use inside texture2d or buffer
-class LinearStorage : public GPUObject {
- public:
-  LinearStorage() {}
-  ~LinearStorage() override { Release(); }
-
-  // Move only
-  LinearStorage(LinearStorage&& storage);
-  LinearStorage& operator=(LinearStorage&& storage);
-  LinearStorage(const LinearStorage&) = delete;
-  LinearStorage& operator=(const LinearStorage&) = delete;
-
-  absl::Status GetGPUResources(const GPUObjectDescriptor* obj_ptr,
-                               GPUResourcesWithValue* resources) const override;
-
-  absl::Status CreateFromTensorLinearDescriptor(
-      const TensorLinearDescriptor& desc, CLContext* context);
-
- private:
-  void Release();
-
-  cl_mem memory_ = nullptr;
-  int depth_;
-  LinearStorageType storage_type_;
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_LINEAR_STORAGE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/model_hints.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/model_hints.h
deleted file mode 100644
index 7c0f4b5..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/model_hints.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 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_CL_MODEL_HINTS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_MODEL_HINTS_H_
-
-#include 
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-struct ModelHints {
-  using ModelHint = uint64_t;
-
-  // By default we want the fastest inference.
-  static constexpr ModelHint kFastestInference = 0x00000000;
-  // Can improve compilation time, but inference can be slower.
-  static constexpr ModelHint kReduceKernelsCount = 0x00000001;
-  // Can improve tuning time, but inference can be slower.
-  static constexpr ModelHint kFastTuning = 0x00000002;
-
-  // Experimental.
-  // Can improve performance and memory consumption, but slow down
-  // initialization a lot and create more kernels.
-  static constexpr ModelHint kAllowSpecialKernels = 0x00000004;
-
-  void Add(ModelHint hint) {
-    if (hint == kFastestInference) {
-      hints = kFastestInference;
-    } else {
-      hints |= hint;
-    }
-  }
-
-  bool Check(ModelHint hint) const { return hints & hint; }
-
-  uint64_t hints = kFastestInference;
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_MODEL_HINTS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h
deleted file mode 100644
index 11f0ef3..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h
+++ /dev/null
@@ -1,661 +0,0 @@
-/* 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_CL_OPENCL_WRAPPER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_OPENCL_WRAPPER_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-absl::Status LoadOpenCL();
-
-typedef cl_int(CL_API_CALL *PFN_clGetPlatformIDs)(
-    cl_uint /* num_entries */, cl_platform_id * /* platforms */,
-    cl_uint * /* num_platforms */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetPlatformInfo)(
-    cl_platform_id /* platform */, cl_platform_info /* param_name */,
-    size_t /* param_value_size */, void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetDeviceIDs)(
-    cl_platform_id /* platform */, cl_device_type /* device_type */,
-    cl_uint /* num_entries */, cl_device_id * /* devices */,
-    cl_uint * /* num_devices */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetDeviceInfo)(
-    cl_device_id /* device */, cl_device_info /* param_name */,
-    size_t /* param_value_size */, void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clCreateSubDevices)(
-    cl_device_id /* in_device */,
-    const cl_device_partition_property * /* properties */,
-    cl_uint /* num_devices */, cl_device_id * /* out_devices */,
-    cl_uint * /* num_devices_ret */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clRetainDevice)(cl_device_id /* device */)
-    CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clReleaseDevice)(cl_device_id /* device */)
-    CL_API_SUFFIX__VERSION_1_2;
-typedef cl_context(CL_API_CALL *PFN_clCreateContext)(
-    const cl_context_properties * /* properties */, cl_uint /* num_devices */,
-    const cl_device_id * /* devices */,
-    void(CL_CALLBACK * /* pfn_notify */)(const char *, const void *, size_t,
-                                         void *),
-    void * /* user_data */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_context(CL_API_CALL *PFN_clCreateContextFromType)(
-    const cl_context_properties * /* properties */,
-    cl_device_type /* device_type */,
-    void(CL_CALLBACK * /* pfn_notify*/)(const char *, const void *, size_t,
-                                        void *),
-    void * /* user_data */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clRetainContext)(cl_context /* context */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clReleaseContext)(cl_context /* context */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetContextInfo)(
-    cl_context /* context */, cl_context_info /* param_name */,
-    size_t /* param_value_size */, void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_command_queue(CL_API_CALL *PFN_clCreateCommandQueueWithProperties)(
-    cl_context /* context */, cl_device_id /* device */,
-    const cl_queue_properties * /* properties */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
-typedef cl_int(CL_API_CALL *PFN_clRetainCommandQueue)(
-    cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clReleaseCommandQueue)(
-    cl_command_queue /* command_queue */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetCommandQueueInfo)(
-    cl_command_queue /* command_queue */,
-    cl_command_queue_info /* param_name */, size_t /* param_value_size */,
-    void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_mem(CL_API_CALL *PFN_clCreateBuffer)(
-    cl_context /* context */, cl_mem_flags /* flags */, size_t /* size */,
-    void * /* host_ptr */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_mem(CL_API_CALL *PFN_clCreateSubBuffer)(
-    cl_mem /* buffer */, cl_mem_flags /* flags */,
-    cl_buffer_create_type /* buffer_create_type */,
-    const void * /* buffer_create_info */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_1;
-typedef cl_mem(CL_API_CALL *PFN_clCreateImage)(
-    cl_context /* context */, cl_mem_flags /* flags */,
-    const cl_image_format * /* image_format */,
-    const cl_image_desc * /* image_desc */, void * /* host_ptr */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_mem(CL_API_CALL *PFN_clCreatePipe)(
-    cl_context /* context */, cl_mem_flags /* flags */,
-    cl_uint /* pipe_packet_size */, cl_uint /* pipe_max_packets */,
-    const cl_pipe_properties * /* properties */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
-typedef cl_int(CL_API_CALL *PFN_clRetainMemObject)(cl_mem /* memobj */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clReleaseMemObject)(cl_mem /* memobj */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetSupportedImageFormats)(
-    cl_context /* context */, cl_mem_flags /* flags */,
-    cl_mem_object_type /* image_type */, cl_uint /* num_entries */,
-    cl_image_format * /* image_formats */,
-    cl_uint * /* num_image_formats */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetMemObjectInfo)(
-    cl_mem /* memobj */, cl_mem_info /* param_name */,
-    size_t /* param_value_size */, void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetImageInfo)(
-    cl_mem /* image */, cl_image_info /* param_name */,
-    size_t /* param_value_size */, void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetPipeInfo)(
-    cl_mem /* pipe */, cl_pipe_info /* param_name */,
-    size_t /* param_value_size */, void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_2_0;
-typedef cl_int(CL_API_CALL *PFN_clSetMemObjectDestructorCallback)(
-    cl_mem /* memobj */,
-    void(CL_CALLBACK * /*pfn_notify*/)(cl_mem /* memobj */,
-                                       void * /*user_data*/),
-    void * /*user_data */) CL_API_SUFFIX__VERSION_1_1;
-typedef void *(CL_API_CALL *PFN_clSVMAlloc)(
-    cl_context /* context */, cl_svm_mem_flags /* flags */, size_t /* size */,
-    cl_uint /* alignment */)CL_API_SUFFIX__VERSION_2_0;
-typedef void(CL_API_CALL *PFN_clSVMFree)(cl_context /* context */,
-                                         void * /* svm_pointer */)
-    CL_API_SUFFIX__VERSION_2_0;
-typedef cl_sampler(CL_API_CALL *PFN_clCreateSamplerWithProperties)(
-    cl_context /* context */,
-    const cl_sampler_properties * /* normalized_coords */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_2_0;
-typedef cl_int(CL_API_CALL *PFN_clRetainSampler)(cl_sampler /* sampler */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clReleaseSampler)(cl_sampler /* sampler */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetSamplerInfo)(
-    cl_sampler /* sampler */, cl_sampler_info /* param_name */,
-    size_t /* param_value_size */, void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_program(CL_API_CALL *PFN_clCreateProgramWithSource)(
-    cl_context /* context */, cl_uint /* count */, const char ** /* strings */,
-    const size_t * /* lengths */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_program(CL_API_CALL *PFN_clCreateProgramWithBinary)(
-    cl_context /* context */, cl_uint /* num_devices */,
-    const cl_device_id * /* device_list */, const size_t * /* lengths */,
-    const unsigned char ** /* binaries */, cl_int * /* binary_status */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_program(CL_API_CALL *PFN_clCreateProgramWithBuiltInKernels)(
-    cl_context /* context */, cl_uint /* num_devices */,
-    const cl_device_id * /* device_list */, const char * /* kernel_names */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clRetainProgram)(cl_program /* program */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clReleaseProgram)(cl_program /* program */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clBuildProgram)(
-    cl_program /* program */, cl_uint /* num_devices */,
-    const cl_device_id * /* device_list */, const char * /* options */,
-    void(CL_CALLBACK * /* pfn_notify */)(cl_program /* program */,
-                                         void * /* user_data */),
-    void * /* user_data */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clCompileProgram)(
-    cl_program /* program */, cl_uint /* num_devices */,
-    const cl_device_id * /* device_list */, const char * /* options */,
-    cl_uint /* num_input_headers */, const cl_program * /* input_headers */,
-    const char ** /* header_include_names */,
-    void(CL_CALLBACK * /* pfn_notify */)(cl_program /* program */,
-                                         void * /* user_data */),
-    void * /* user_data */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_program(CL_API_CALL *PFN_clLinkProgram)(
-    cl_context /* context */, cl_uint /* num_devices */,
-    const cl_device_id * /* device_list */, const char * /* options */,
-    cl_uint /* num_input_programs */, const cl_program * /* input_programs */,
-    void(CL_CALLBACK * /* pfn_notify */)(cl_program /* program */,
-                                         void * /* user_data */),
-    void * /* user_data */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clUnloadPlatformCompiler)(
-    cl_platform_id /* platform */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clGetProgramInfo)(
-    cl_program /* program */, cl_program_info /* param_name */,
-    size_t /* param_value_size */, void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetProgramBuildInfo)(
-    cl_program /* program */, cl_device_id /* device */,
-    cl_program_build_info /* param_name */, size_t /* param_value_size */,
-    void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_kernel(CL_API_CALL *PFN_clCreateKernel)(
-    cl_program /* program */, const char * /* kernel_name */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clCreateKernelsInProgram)(
-    cl_program /* program */, cl_uint /* num_kernels */,
-    cl_kernel * /* kernels */,
-    cl_uint * /* num_kernels_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clRetainKernel)(cl_kernel /* kernel */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clReleaseKernel)(cl_kernel /* kernel */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clSetKernelArg)(
-    cl_kernel /* kernel */, cl_uint /* arg_index */, size_t /* arg_size */,
-    const void * /* arg_value */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clSetKernelArgSVMPointer)(
-    cl_kernel /* kernel */, cl_uint /* arg_index */,
-    const void * /* arg_value */) CL_API_SUFFIX__VERSION_2_0;
-typedef cl_int(CL_API_CALL *PFN_clSetKernelExecInfo)(
-    cl_kernel /* kernel */, cl_kernel_exec_info /* param_name */,
-    size_t /* param_value_size */,
-    const void * /* param_value */) CL_API_SUFFIX__VERSION_2_0;
-typedef cl_int(CL_API_CALL *PFN_clGetKernelInfo)(
-    cl_kernel /* kernel */, cl_kernel_info /* param_name */,
-    size_t /* param_value_size */, void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetKernelArgInfo)(
-    cl_kernel /* kernel */, cl_uint /* arg_indx */,
-    cl_kernel_arg_info /* param_name */, size_t /* param_value_size */,
-    void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clGetKernelWorkGroupInfo)(
-    cl_kernel /* kernel */, cl_device_id /* device */,
-    cl_kernel_work_group_info /* param_name */, size_t /* param_value_size */,
-    void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clWaitForEvents)(
-    cl_uint /* num_events */,
-    const cl_event * /* event_list */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clGetEventInfo)(
-    cl_event /* event */, cl_event_info /* param_name */,
-    size_t /* param_value_size */, void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_event(CL_API_CALL *PFN_clCreateUserEvent)(cl_context /* context */,
-                                                     cl_int * /* errcode_ret */)
-    CL_API_SUFFIX__VERSION_1_1;
-typedef cl_int(CL_API_CALL *PFN_clRetainEvent)(cl_event /* event */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clReleaseEvent)(cl_event /* event */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clSetUserEventStatus)(
-    cl_event /* event */,
-    cl_int /* execution_status */) CL_API_SUFFIX__VERSION_1_1;
-typedef cl_int(CL_API_CALL *PFN_clSetEventCallback)(
-    cl_event /* event */, cl_int /* command_exec_callback_type */,
-    void(CL_CALLBACK * /* pfn_notify */)(cl_event, cl_int, void *),
-    void * /* user_data */) CL_API_SUFFIX__VERSION_1_1;
-typedef cl_int(CL_API_CALL *PFN_clGetEventProfilingInfo)(
-    cl_event /* event */, cl_profiling_info /* param_name */,
-    size_t /* param_value_size */, void * /* param_value */,
-    size_t * /* param_value_size_ret */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clFlush)(cl_command_queue /* command_queue */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clFinish)(cl_command_queue /* command_queue */)
-    CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueReadBuffer)(
-    cl_command_queue /* command_queue */, cl_mem /* buffer */,
-    cl_bool /* blocking_read */, size_t /* offset */, size_t /* size */,
-    void * /* ptr */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueReadBufferRect)(
-    cl_command_queue /* command_queue */, cl_mem /* buffer */,
-    cl_bool /* blocking_read */, const size_t * /* buffer_offset */,
-    const size_t * /* host_offset */, const size_t * /* region */,
-    size_t /* buffer_row_pitch */, size_t /* buffer_slice_pitch */,
-    size_t /* host_row_pitch */, size_t /* host_slice_pitch */,
-    void * /* ptr */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueWriteBuffer)(
-    cl_command_queue /* command_queue */, cl_mem /* buffer */,
-    cl_bool /* blocking_write */, size_t /* offset */, size_t /* size */,
-    const void * /* ptr */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueWriteBufferRect)(
-    cl_command_queue /* command_queue */, cl_mem /* buffer */,
-    cl_bool /* blocking_write */, const size_t * /* buffer_offset */,
-    const size_t * /* host_offset */, const size_t * /* region */,
-    size_t /* buffer_row_pitch */, size_t /* buffer_slice_pitch */,
-    size_t /* host_row_pitch */, size_t /* host_slice_pitch */,
-    const void * /* ptr */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueFillBuffer)(
-    cl_command_queue /* command_queue */, cl_mem /* buffer */,
-    const void * /* pattern */, size_t /* pattern_size */, size_t /* offset */,
-    size_t /* size */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueCopyBuffer)(
-    cl_command_queue /* command_queue */, cl_mem /* src_buffer */,
-    cl_mem /* dst_buffer */, size_t /* src_offset */, size_t /* dst_offset */,
-    size_t /* size */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueCopyBufferRect)(
-    cl_command_queue /* command_queue */, cl_mem /* src_buffer */,
-    cl_mem /* dst_buffer */, const size_t * /* src_origin */,
-    const size_t * /* dst_origin */, const size_t * /* region */,
-    size_t /* src_row_pitch */, size_t /* src_slice_pitch */,
-    size_t /* dst_row_pitch */, size_t /* dst_slice_pitch */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_1;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueReadImage)(
-    cl_command_queue /* command_queue */, cl_mem /* image */,
-    cl_bool /* blocking_read */, const size_t * /* origin[3] */,
-    const size_t * /* region[3] */, size_t /* row_pitch */,
-    size_t /* slice_pitch */, void * /* ptr */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueWriteImage)(
-    cl_command_queue /* command_queue */, cl_mem /* image */,
-    cl_bool /* blocking_write */, const size_t * /* origin[3] */,
-    const size_t * /* region[3] */, size_t /* input_row_pitch */,
-    size_t /* input_slice_pitch */, const void * /* ptr */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueFillImage)(
-    cl_command_queue /* command_queue */, cl_mem /* image */,
-    const void * /* fill_color */, const size_t * /* origin[3] */,
-    const size_t * /* region[3] */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueCopyImage)(
-    cl_command_queue /* command_queue */, cl_mem /* src_image */,
-    cl_mem /* dst_image */, const size_t * /* src_origin[3] */,
-    const size_t * /* dst_origin[3] */, const size_t * /* region[3] */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueCopyImageToBuffer)(
-    cl_command_queue /* command_queue */, cl_mem /* src_image */,
-    cl_mem /* dst_buffer */, const size_t * /* src_origin[3] */,
-    const size_t * /* region[3] */, size_t /* dst_offset */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueCopyBufferToImage)(
-    cl_command_queue /* command_queue */, cl_mem /* src_buffer */,
-    cl_mem /* dst_image */, size_t /* src_offset */,
-    const size_t * /* dst_origin[3] */, const size_t * /* region[3] */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-typedef void *(CL_API_CALL *PFN_clEnqueueMapBuffer)(
-    cl_command_queue /* command_queue */, cl_mem /* buffer */,
-    cl_bool /* blocking_map */, cl_map_flags /* map_flags */,
-    size_t /* offset */, size_t /* size */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */, cl_event * /* event */,
-    cl_int * /* errcode_ret */)CL_API_SUFFIX__VERSION_1_0;
-typedef void *(CL_API_CALL *PFN_clEnqueueMapImage)(
-    cl_command_queue /* command_queue */, cl_mem /* image */,
-    cl_bool /* blocking_map */, cl_map_flags /* map_flags */,
-    const size_t * /* origin[3] */, const size_t * /* region[3] */,
-    size_t * /* image_row_pitch */, size_t * /* image_slice_pitch */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */, cl_event * /* event */,
-    cl_int * /* errcode_ret */)CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueUnmapMemObject)(
-    cl_command_queue /* command_queue */, cl_mem /* memobj */,
-    void * /* mapped_ptr */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueMigrateMemObjects)(
-    cl_command_queue /* command_queue */, cl_uint /* num_mem_objects */,
-    const cl_mem * /* mem_objects */, cl_mem_migration_flags /* flags */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueNDRangeKernel)(
-    cl_command_queue /* command_queue */, cl_kernel /* kernel */,
-    cl_uint /* work_dim */, const size_t * /* global_work_offset */,
-    const size_t * /* global_work_size */, const size_t * /* local_work_size */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueNativeKernel)(
-    cl_command_queue /* command_queue */,
-    void(CL_CALLBACK * /*user_func*/)(void *), void * /* args */,
-    size_t /* cb_args */, cl_uint /* num_mem_objects */,
-    const cl_mem * /* mem_list */, const void ** /* args_mem_loc */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueMarkerWithWaitList)(
-    cl_command_queue /* command_queue */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueBarrierWithWaitList)(
-    cl_command_queue /* command_queue */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueSVMFree)(
-    cl_command_queue /* command_queue */, cl_uint /* num_svm_pointers */,
-    void *[] /* svm_pointers[] */,
-    void(CL_CALLBACK * /*pfn_free_func*/)(cl_command_queue /* queue */,
-                                          cl_uint /* num_svm_pointers */,
-                                          void *[] /* svm_pointers[] */,
-                                          void * /* user_data */),
-    void * /* user_data */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueSVMMemcpy)(
-    cl_command_queue /* command_queue */, cl_bool /* blocking_copy */,
-    void * /* dst_ptr */, const void * /* src_ptr */, size_t /* size */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueSVMMemFill)(
-    cl_command_queue /* command_queue */, void * /* svm_ptr */,
-    const void * /* pattern */, size_t /* pattern_size */, size_t /* size */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueSVMMap)(
-    cl_command_queue /* command_queue */, cl_bool /* blocking_map */,
-    cl_map_flags /* flags */, void * /* svm_ptr */, size_t /* size */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueSVMUnmap)(
-    cl_command_queue /* command_queue */, void * /* svm_ptr */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_2_0;
-typedef void *(CL_API_CALL *PFN_clGetExtensionFunctionAddressForPlatform)(
-    cl_platform_id /* platform */,
-    const char * /* func_name */)CL_API_SUFFIX__VERSION_1_2;
-typedef cl_mem(CL_API_CALL *PFN_clCreateImage2D)(
-    cl_context /* context */, cl_mem_flags /* flags */,
-    const cl_image_format * /* image_format */, size_t /* image_width */,
-    size_t /* image_height */, size_t /* image_row_pitch */,
-    void * /* host_ptr */, cl_int * /* errcode_ret */);
-typedef cl_mem(CL_API_CALL *PFN_clCreateImage3D)(
-    cl_context /* context */, cl_mem_flags /* flags */,
-    const cl_image_format * /* image_format */, size_t /* image_width */,
-    size_t /* image_height */, size_t /* image_depth */,
-    size_t /* image_row_pitch */, size_t /* image_slice_pitch */,
-    void * /* host_ptr */, cl_int * /* errcode_ret */);
-typedef cl_int(CL_API_CALL *PFN_clEnqueueMarker)(
-    cl_command_queue /* command_queue */, cl_event * /* event */);
-typedef cl_int(CL_API_CALL *PFN_clEnqueueWaitForEvents)(
-    cl_command_queue /* command_queue */, cl_uint /* num_events */,
-    const cl_event * /* event_list */);
-typedef cl_int(CL_API_CALL *PFN_clEnqueueBarrier)(
-    cl_command_queue /* command_queue */);
-typedef cl_int(CL_API_CALL *PFN_clUnloadCompiler)();
-typedef void *(CL_API_CALL *PFN_clGetExtensionFunctionAddress)(
-    const char * /* func_name */);
-typedef cl_command_queue(CL_API_CALL *PFN_clCreateCommandQueue)(
-    cl_context /* context */, cl_device_id /* device */,
-    cl_command_queue_properties /* properties */, cl_int * /* errcode_ret */);
-typedef cl_sampler(CL_API_CALL *PFN_clCreateSampler)(
-    cl_context /* context */, cl_bool /* normalized_coords */,
-    cl_addressing_mode /* addressing_mode */, cl_filter_mode /* filter_mode */,
-    cl_int * /* errcode_ret */);
-typedef cl_int(CL_API_CALL *PFN_clEnqueueTask)(
-    cl_command_queue /* command_queue */, cl_kernel /* kernel */,
-    cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */, cl_event * /* event */);
-
-// OpenGL sharing
-typedef cl_mem(CL_API_CALL *PFN_clCreateFromGLBuffer)(cl_context, cl_mem_flags,
-                                                      cl_GLuint, int *);
-typedef cl_mem(CL_API_CALL *PFN_clCreateFromGLTexture)(
-    cl_context /* context */, cl_mem_flags /* flags */, cl_GLenum /* target */,
-    cl_GLint /* miplevel */, cl_GLuint /* texture */,
-    cl_int * /* errcode_ret */) CL_API_SUFFIX__VERSION_1_2;
-typedef cl_int(CL_API_CALL *PFN_clEnqueueAcquireGLObjects)(
-    cl_command_queue /* command_queue */, cl_uint /* num_objects */,
-    const cl_mem * /* mem_objects */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */, cl_event * /* event */);
-typedef cl_int(CL_API_CALL *PFN_clEnqueueReleaseGLObjects)(
-    cl_command_queue /* command_queue */, cl_uint /* num_objects */,
-    const cl_mem * /* mem_objects */, cl_uint /* num_events_in_wait_list */,
-    const cl_event * /* event_wait_list */,
-    cl_event * /* event */) CL_API_SUFFIX__VERSION_1_0;
-
-// cl_khr_egl_event extension
-
-// CLeglDisplayKHR is an opaque handle to an EGLDisplay
-typedef void *CLeglDisplayKHR;
-
-// CLeglSyncKHR is an opaque handle to an EGLSync object
-typedef void *CLeglSyncKHR;
-
-typedef cl_event(CL_API_CALL *PFN_clCreateEventFromEGLSyncKHR)(
-    cl_context /* context */, CLeglSyncKHR /* sync */,
-    CLeglDisplayKHR /* display */, cl_int * /* errcode_ret */);
-
-// EGL sharing
-typedef cl_mem(CL_API_CALL *PFN_clCreateFromEGLImageKHR)(
-    cl_context /*context*/, CLeglDisplayKHR /*display*/,
-    CLeglImageKHR /*image*/, cl_mem_flags /*flags*/,
-    const cl_egl_image_properties_khr * /*properties*/,
-    cl_int * /*errcode_ret*/);
-typedef cl_int(CL_API_CALL *PFN_clEnqueueAcquireEGLObjectsKHR)(
-    cl_command_queue /*command_queue*/, cl_uint /*num_objects*/,
-    const cl_mem * /*mem_objects*/, cl_uint /*num_events_in_wait_list*/,
-    const cl_event * /*event_wait_list*/, cl_event * /*event*/);
-typedef cl_int(CL_API_CALL *PFN_clEnqueueReleaseEGLObjectsKHR)(
-    cl_command_queue /*command_queue*/, cl_uint /*num_objects*/,
-    const cl_mem * /*mem_objects*/, cl_uint /*num_events_in_wait_list*/,
-    const cl_event * /*event_wait_list*/, cl_event * /*event*/);
-
-extern PFN_clGetPlatformIDs clGetPlatformIDs;
-extern PFN_clGetPlatformInfo clGetPlatformInfo;
-extern PFN_clGetDeviceIDs clGetDeviceIDs;
-extern PFN_clGetDeviceInfo clGetDeviceInfo;
-extern PFN_clCreateSubDevices clCreateSubDevices;
-extern PFN_clRetainDevice clRetainDevice;
-extern PFN_clReleaseDevice clReleaseDevice;
-extern PFN_clCreateContext clCreateContext;
-extern PFN_clCreateContextFromType clCreateContextFromType;
-extern PFN_clRetainContext clRetainContext;
-extern PFN_clReleaseContext clReleaseContext;
-extern PFN_clGetContextInfo clGetContextInfo;
-extern PFN_clCreateCommandQueueWithProperties
-    clCreateCommandQueueWithProperties;
-extern PFN_clRetainCommandQueue clRetainCommandQueue;
-extern PFN_clReleaseCommandQueue clReleaseCommandQueue;
-extern PFN_clGetCommandQueueInfo clGetCommandQueueInfo;
-extern PFN_clCreateBuffer clCreateBuffer;
-extern PFN_clCreateSubBuffer clCreateSubBuffer;
-extern PFN_clCreateImage clCreateImage;
-extern PFN_clCreatePipe clCreatePipe;
-extern PFN_clRetainMemObject clRetainMemObject;
-extern PFN_clReleaseMemObject clReleaseMemObject;
-extern PFN_clGetSupportedImageFormats clGetSupportedImageFormats;
-extern PFN_clGetMemObjectInfo clGetMemObjectInfo;
-extern PFN_clGetImageInfo clGetImageInfo;
-extern PFN_clGetPipeInfo clGetPipeInfo;
-extern PFN_clSetMemObjectDestructorCallback clSetMemObjectDestructorCallback;
-extern PFN_clSVMAlloc clSVMAlloc;
-extern PFN_clSVMFree clSVMFree;
-extern PFN_clCreateSamplerWithProperties clCreateSamplerWithProperties;
-extern PFN_clRetainSampler clRetainSampler;
-extern PFN_clReleaseSampler clReleaseSampler;
-extern PFN_clGetSamplerInfo clGetSamplerInfo;
-extern PFN_clCreateProgramWithSource clCreateProgramWithSource;
-extern PFN_clCreateProgramWithBinary clCreateProgramWithBinary;
-extern PFN_clCreateProgramWithBuiltInKernels clCreateProgramWithBuiltInKernels;
-extern PFN_clRetainProgram clRetainProgram;
-extern PFN_clReleaseProgram clReleaseProgram;
-extern PFN_clBuildProgram clBuildProgram;
-extern PFN_clCompileProgram clCompileProgram;
-extern PFN_clLinkProgram clLinkProgram;
-extern PFN_clUnloadPlatformCompiler clUnloadPlatformCompiler;
-extern PFN_clGetProgramInfo clGetProgramInfo;
-extern PFN_clGetProgramBuildInfo clGetProgramBuildInfo;
-extern PFN_clCreateKernel clCreateKernel;
-extern PFN_clCreateKernelsInProgram clCreateKernelsInProgram;
-extern PFN_clRetainKernel clRetainKernel;
-extern PFN_clReleaseKernel clReleaseKernel;
-extern PFN_clSetKernelArg clSetKernelArg;
-extern PFN_clSetKernelArgSVMPointer clSetKernelArgSVMPointer;
-extern PFN_clSetKernelExecInfo clSetKernelExecInfo;
-extern PFN_clGetKernelInfo clGetKernelInfo;
-extern PFN_clGetKernelArgInfo clGetKernelArgInfo;
-extern PFN_clGetKernelWorkGroupInfo clGetKernelWorkGroupInfo;
-extern PFN_clWaitForEvents clWaitForEvents;
-extern PFN_clGetEventInfo clGetEventInfo;
-extern PFN_clCreateUserEvent clCreateUserEvent;
-extern PFN_clRetainEvent clRetainEvent;
-extern PFN_clReleaseEvent clReleaseEvent;
-extern PFN_clSetUserEventStatus clSetUserEventStatus;
-extern PFN_clSetEventCallback clSetEventCallback;
-extern PFN_clGetEventProfilingInfo clGetEventProfilingInfo;
-extern PFN_clFlush clFlush;
-extern PFN_clFinish clFinish;
-extern PFN_clEnqueueReadBuffer clEnqueueReadBuffer;
-extern PFN_clEnqueueReadBufferRect clEnqueueReadBufferRect;
-extern PFN_clEnqueueWriteBuffer clEnqueueWriteBuffer;
-extern PFN_clEnqueueWriteBufferRect clEnqueueWriteBufferRect;
-extern PFN_clEnqueueFillBuffer clEnqueueFillBuffer;
-extern PFN_clEnqueueCopyBuffer clEnqueueCopyBuffer;
-extern PFN_clEnqueueCopyBufferRect clEnqueueCopyBufferRect;
-extern PFN_clEnqueueReadImage clEnqueueReadImage;
-extern PFN_clEnqueueWriteImage clEnqueueWriteImage;
-extern PFN_clEnqueueFillImage clEnqueueFillImage;
-extern PFN_clEnqueueCopyImage clEnqueueCopyImage;
-extern PFN_clEnqueueCopyImageToBuffer clEnqueueCopyImageToBuffer;
-extern PFN_clEnqueueCopyBufferToImage clEnqueueCopyBufferToImage;
-extern PFN_clEnqueueMapBuffer clEnqueueMapBuffer;
-extern PFN_clEnqueueMapImage clEnqueueMapImage;
-extern PFN_clEnqueueUnmapMemObject clEnqueueUnmapMemObject;
-extern PFN_clEnqueueMigrateMemObjects clEnqueueMigrateMemObjects;
-extern PFN_clEnqueueNDRangeKernel clEnqueueNDRangeKernel;
-extern PFN_clEnqueueNativeKernel clEnqueueNativeKernel;
-extern PFN_clEnqueueMarkerWithWaitList clEnqueueMarkerWithWaitList;
-extern PFN_clEnqueueBarrierWithWaitList clEnqueueBarrierWithWaitList;
-extern PFN_clEnqueueSVMFree clEnqueueSVMFree;
-extern PFN_clEnqueueSVMMemcpy clEnqueueSVMMemcpy;
-extern PFN_clEnqueueSVMMemFill clEnqueueSVMMemFill;
-extern PFN_clEnqueueSVMMap clEnqueueSVMMap;
-extern PFN_clEnqueueSVMUnmap clEnqueueSVMUnmap;
-extern PFN_clGetExtensionFunctionAddressForPlatform
-    clGetExtensionFunctionAddressForPlatform;
-extern PFN_clCreateImage2D clCreateImage2D;
-extern PFN_clCreateImage3D clCreateImage3D;
-extern PFN_clEnqueueMarker clEnqueueMarker;
-extern PFN_clEnqueueWaitForEvents clEnqueueWaitForEvents;
-extern PFN_clEnqueueBarrier clEnqueueBarrier;
-extern PFN_clUnloadCompiler clUnloadCompiler;
-extern PFN_clGetExtensionFunctionAddress clGetExtensionFunctionAddress;
-extern PFN_clCreateCommandQueue clCreateCommandQueue;
-extern PFN_clCreateSampler clCreateSampler;
-extern PFN_clEnqueueTask clEnqueueTask;
-
-// OpenGL sharing
-extern PFN_clCreateFromGLBuffer clCreateFromGLBuffer;
-extern PFN_clCreateFromGLTexture clCreateFromGLTexture;
-extern PFN_clEnqueueAcquireGLObjects clEnqueueAcquireGLObjects;
-extern PFN_clEnqueueReleaseGLObjects clEnqueueReleaseGLObjects;
-
-// cl_khr_egl_event extension
-extern PFN_clCreateEventFromEGLSyncKHR clCreateEventFromEGLSyncKHR;
-
-// EGL sharing
-extern PFN_clCreateFromEGLImageKHR clCreateFromEGLImageKHR;
-extern PFN_clEnqueueAcquireEGLObjectsKHR clEnqueueAcquireEGLObjectsKHR;
-extern PFN_clEnqueueReleaseEGLObjectsKHR clEnqueueReleaseEGLObjectsKHR;
-
-// For convenient image creation
-// It uses clCreateImage if it available (clCreateImage available since cl 1.2)
-// otherwise it will use legacy clCreateImage2D
-cl_mem CreateImage2DLegacy(cl_context context, cl_mem_flags flags,
-                           const cl_image_format *image_format,
-                           const cl_image_desc *image_desc, void *host_ptr,
-                           cl_int *errcode_ret);
-
-// It uses clCreateImage if it available (clCreateImage available since cl 1.2)
-// otherwise it will use legacy clCreateImage3D
-cl_mem CreateImage3DLegacy(cl_context context, cl_mem_flags flags,
-                           const cl_image_format *image_format,
-                           const cl_image_desc *image_desc, void *host_ptr,
-                           cl_int *errcode_ret);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_OPENCL_WRAPPER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/precision.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/precision.h
deleted file mode 100644
index 10afcd6..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/precision.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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_CL_PRECISION_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_PRECISION_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-enum class CalculationsPrecision { F32, F32_F16, F16 };
-// F32 - all data and all math ops in F32
-// F16 - all data and all math ops in F16
-// F32_F16 - as F16, but some operations (Convolution,
-// DepthwiseConvolution, FullyConnected, ConvolutionTransposed)
-// have accumulator in F32 and usually it calculates 4 mads in F16, sum them,
-// than converts this partial sum to F32 and add to accumulator.
-
-DataType DeduceDataTypeFromPrecision(CalculationsPrecision precision);
-
-std::string ToString(CalculationsPrecision precision);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_PRECISION_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/program_cache.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/program_cache.h
deleted file mode 100644
index 81649d6..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/program_cache.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* 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_CL_PROGRAM_CACHE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_PROGRAM_CACHE_H_
-
-#include 
-#include 
-#include 
-
-#include "absl/container/flat_hash_map.h"
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_kernel.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_program.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class ProgramCache {
- public:
-  ProgramCache() = default;
-
-  ProgramCache(ProgramCache&& program_cache);
-  ProgramCache& operator=(ProgramCache&& program_cache);
-  ProgramCache(const ProgramCache&) = delete;
-  ProgramCache& operator=(const ProgramCache&) = delete;
-
-  absl::Status GetOrCreateCLKernel(
-      const std::string& code, const std::string& function_name,
-      const std::vector& compiler_options,
-      const CLContext& context, const CLDevice& device, CLKernel* result);
-
-  absl::Status GetOrCreateCLKernel(const std::string& code,
-                                   const std::string& function_name,
-                                   const CLContext& context,
-                                   const CLDevice& device, CLKernel* result);
-
-  absl::Status AddSerializedCache(const CLContext& context,
-                                  const CLDevice& device,
-                                  absl::Span serialized_cache);
-  absl::Status GetSerializedCache(const CLDevice& device,
-                                  std::vector* serialized_cache) const;
-
- private:
-  struct ProgramDescriptor {
-    ProgramDescriptor() = default;
-    ProgramDescriptor(const std::string& code_text, const std::string& options,
-                      bool use_fingerprint);
-    explicit ProgramDescriptor(uint64_t fingerprint);
-
-    std::string code;
-    std::string compiler_options;
-    uint64_t fingerprint;
-    bool use_fingerprint;
-  };
-  struct ProgramDescriptorHasher {
-    std::size_t operator()(const ProgramDescriptor& k) const {
-      if (k.use_fingerprint) {
-        return std::hash()(k.fingerprint);
-      } else {
-        return std::hash()(k.code) +
-               std::hash()(k.compiler_options);
-      }
-    }
-  };
-  struct ProgramDescriptorEqual {
-    bool operator()(const ProgramDescriptor& a,
-                    const ProgramDescriptor& b) const {
-      if (a.use_fingerprint && b.use_fingerprint) {
-        return a.fingerprint == b.fingerprint;
-      } else {
-        return a.compiler_options == b.compiler_options && a.code == b.code;
-      }
-    }
-  };
-
-  // There is a low probability of a hash collision when cache is deserialized
-  // because only fingerprints are serialized instead of full source code.
-  bool use_fingerprints_ = false;
-  absl::flat_hash_map
-      programs_;
-};
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_PROGRAM_CACHE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/convolution_selector.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/convolution_selector.h
deleted file mode 100644
index f2bacab..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/convolution_selector.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* 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_CL_SELECTORS_CONVOLUTION_SELECTOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_CONVOLUTION_SELECTOR_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/conv_common.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/model_hints.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-std::unique_ptr SelectConvolution(
-    const Convolution2DAttributes& attr, const BHWC& dst_shape,
-    const DeviceInfo& device_info, const OperationDef& op_def,
-    ModelHints hints);
-
-std::unique_ptr SelectConvolutionForWinograd(
-    const Convolution2DAttributes& attr, const BHWC& dst_shape,
-    const DeviceInfo& device_info, const OperationDef& op_def,
-    ModelHints hints);
-
-std::unique_ptr SelectConvolutionWithDynamicWeights(
-    const Convolution2DAttributes& attr, const BHWC& weights_shape,
-    const BHWC& dst_shape, const DeviceInfo& device_info,
-    const OperationDef& op_def, ModelHints hints,
-    ConvWeightsDescription* weights_desc);
-
-std::unique_ptr SelectConverterToConvWeights(
-    const ConvWeightsDescription& weights_desc, const OperationDef& op_def,
-    ModelHints hints);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_CONVOLUTION_SELECTOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/convolution_transposed_selector.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/convolution_transposed_selector.h
deleted file mode 100644
index fd24176..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/convolution_transposed_selector.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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_CL_SELECTORS_CONVOLUTION_TRANSPOSED_SELECTOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_CONVOLUTION_TRANSPOSED_SELECTOR_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-std::unique_ptr SelectConvolutionTransposed(
-    const ConvolutionTransposedAttributes& attr, const DeviceInfo& device_info,
-    const OperationDef& op_def);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_CONVOLUTION_TRANSPOSED_SELECTOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/default_selector.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/default_selector.h
deleted file mode 100644
index 790da1c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/default_selector.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_DEFAULT_SELECTOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_DEFAULT_SELECTOR_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/device_info.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/model_hints.h"
-#include "tensorflow/lite/delegates/gpu/cl/selectors/subgraph.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-absl::Status SelectDefault(const DeviceInfo& device_info,
-                           const OperationDef& op_def, ModelHints hints,
-                           const std::vector& inputs,
-                           const std::vector& outputs, const Node& node,
-                           GPUOperationsSubgraph* gpu_subgraph);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_DEFAULT_SELECTOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/dw_convolution_selector.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/dw_convolution_selector.h
deleted file mode 100644
index 2147b97..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/dw_convolution_selector.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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_CL_SELECTORS_DW_CONVOLUTION_SELECTOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_DW_CONVOLUTION_SELECTOR_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-std::unique_ptr SelectDWConvolution(
-    const DepthwiseConvolution2DAttributes& attr, const DeviceInfo& device_info,
-    const OperationDef& op_def);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_DW_CONVOLUTION_SELECTOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/fully_connected_selector.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/fully_connected_selector.h
deleted file mode 100644
index 197c243..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/fully_connected_selector.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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_CL_SELECTORS_FULLY_CONNECTED_SELECTOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_FULLY_CONNECTED_SELECTOR_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-std::unique_ptr SelectFullyConnected(
-    const FullyConnectedAttributes& attr, const DeviceInfo& device_info,
-    const OperationDef& op_def, int batch_size);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_FULLY_CONNECTED_SELECTOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/operation_selector.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/operation_selector.h
deleted file mode 100644
index 640432e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/operation_selector.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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_CL_SELECTORS_OPERATION_SELECTOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_OPERATION_SELECTOR_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/model_hints.h"
-#include "tensorflow/lite/delegates/gpu/cl/selectors/subgraph.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-absl::Status GPUOperationFromNode(const DeviceInfo& device_info,
-                                  const OperationDef& op_def, ModelHints hints,
-                                  const std::vector& inputs,
-                                  const std::vector& outputs,
-                                  const Node& node,
-                                  GPUOperationsSubgraph* gpu_subgraph);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_OPERATION_SELECTOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/simple_selectors.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/simple_selectors.h
deleted file mode 100644
index 0842984..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/simple_selectors.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_SIMPLE_SELECTORS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_SIMPLE_SELECTORS_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-std::unique_ptr SelectLSTM(const OperationDef& op_def,
-                                         const DeviceInfo& device_info);
-
-std::unique_ptr SelectReLU(const ReLUAttributes& attr,
-                                         const OperationDef& op_def);
-
-std::unique_ptr SelectPReLU(const PReLUAttributes& attr,
-                                          const DeviceInfo& device_info,
-                                          const OperationDef& op_def);
-
-std::unique_ptr SelectPooling(const Pooling2DAttributes& attr,
-                                            const OperationDef& op_def);
-
-std::unique_ptr SelectMaxUnpooling(
-    const MaxUnpooling2DAttributes& attr, const OperationDef& op_def);
-
-void SelectAdd(const OperationDef& op_def, const std::vector& channels,
-               int dst_channels, std::unique_ptr* ptr);
-
-absl::Status SelectResize(const Resize2DAttributes& attr,
-                          const OperationDef& op_def,
-                          std::unique_ptr* ptr);
-
-absl::Status SelectConcat(const ConcatAttributes& attr,
-                          const std::vector& channels,
-                          const OperationDef& op_def,
-                          const DeviceInfo& device_info,
-                          std::unique_ptr* ptr);
-
-std::unique_ptr SelectDWConvolutionDynamicWeights(
-    const DepthwiseConvolution2DAttributes& attr, const DeviceInfo& device_info,
-    const OperationDef& op_def);
-
-void SelectReshape(int src_channels, int dst_channels,
-                   const OperationDef& op_def,
-                   std::unique_ptr* ptr);
-
-void SelectPadding(const PadAttributes& attr, const OperationDef& op_def,
-                   std::unique_ptr* ptr);
-
-void SelectStridedSlice(const SliceAttributes& attr, const OperationDef& op_def,
-                        std::unique_ptr* ptr);
-
-absl::Status SelectMean(const MeanAttributes& attr, const OperationDef& op_def,
-                        const DeviceInfo& device_info,
-                        std::unique_ptr* ptr);
-
-void SelectSoftmax(const BHWC& shape, const OperationDef& op_def,
-                   std::unique_ptr* ptr);
-
-void SelectSpaceToDepth(const SpaceToDepthAttributes& attr,
-                        const OperationDef& op_def,
-                        std::unique_ptr* ptr);
-
-void SelectTranspose(const TransposeAttributes& attr,
-                     const OperationDef& op_def,
-                     std::unique_ptr* ptr);
-
-std::unique_ptr SelectWinograd4x4To36(
-    const DeviceInfo& device_info, const Padding2D& padding,
-    const OperationDef& op_def);
-
-std::unique_ptr SelectWinograd36To4x4(
-    const DeviceInfo& device_info, const OperationDef& op_def,
-    const tflite::gpu::Tensor& biases);
-
-std::unique_ptr SelectQuantizeAndDequantize(
-    const QuantizeAndDequantizeAttributes& attr, const OperationDef& op_def);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_SIMPLE_SELECTORS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/special_selector.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/special_selector.h
deleted file mode 100644
index 6091415..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/special_selector.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_SPECIAL_SELECTOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_SPECIAL_SELECTOR_H_
-
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/selectors/subgraph.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-absl::Status GPUSubgraphFromGraph(
-    const DeviceInfo& device_info, CalculationsPrecision precision,
-    const GraphFloat32& graph, NodeId first_node_id,
-    const std::map& tensor_descriptors,
-    std::set* consumed_nodes, GPUOperationsSubgraph* gpu_subgraph,
-    std::string* name);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_SPECIAL_SELECTOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/subgraph.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/subgraph.h
deleted file mode 100644
index 60e7fc5..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/selectors/subgraph.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_SUBGRAPH_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_SUBGRAPH_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/kernels/gpu_operation.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-struct GPUOperationWithRefs {
-  std::unique_ptr operation;
-
-  // input and output ids can be positive or negative.
-  // if we have positive id, we will use preallocated tensor from GraphFloat32
-  // otherwise, we will use ids for newly allocated tensors
-  std::vector input_ids;
-  std::vector output_ids;
-};
-
-struct GPUOperationsSubgraph {
-  std::vector operations;
-  std::vector> new_tensors;
-};
-
-std::unique_ptr* InitSingleOpSubgraph(
-    const std::vector& inputs, const std::vector& outputs,
-    GPUOperationsSubgraph* gpu_subgraph);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_SELECTORS_SUBGRAPH_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/serialization.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/serialization.h
deleted file mode 100644
index 1273e62..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/serialization.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_SERIALIZATION_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_SERIALIZATION_H_
-
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/inference_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/serialization_generated.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class InferenceContext;
-
-flatbuffers::Offset Encode(
-    const InferenceContext& inference, flatbuffers::FlatBufferBuilder* builder);
-
-absl::Status Decode(CLContext* context,
-                    const data::InferenceContext* fb_inference,
-                    InferenceContext* inference);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_SERIALIZATION_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/storage_type_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/storage_type_util.h
deleted file mode 100644
index a8a8200..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/storage_type_util.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_CL_STORAGE_TYPE_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_STORAGE_TYPE_UTIL_H_
-
-#include "tensorflow/lite/delegates/gpu/cl/device_info.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-bool CanCreateTensorWithShape(const DeviceInfo& device_info, const BHWDC& shape,
-                              const TensorDescriptor& descriptor);
-
-bool CanCreateTensorWithShape(const DeviceInfo& device_info, const BHWC& shape,
-                              const TensorDescriptor& descriptor);
-
-TensorStorageType SelectBestStorageType(const DeviceInfo& device_info,
-                                        const BHWC& shape,
-                                        const TensorStorageType& desired,
-                                        const DataType& data_type,
-                                        const Layout& layout);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_STORAGE_TYPE_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/tensor.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/tensor.h
deleted file mode 100644
index c6056db..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/tensor.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* 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_CL_TENSOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_TENSOR_H_
-
-#include 
-#include 
-
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_command_queue.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_device.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_memory.h"
-#include "tensorflow/lite/delegates/gpu/cl/gpu_object.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.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"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-class Tensor : public GPUObject {
- public:
-  Tensor()
-      : memory_(nullptr), image_buffer_memory_(nullptr), memory_owner_(true) {}
-  Tensor(cl_mem memory, bool memory_owner, const BHWC& shape,
-         const TensorDescriptor& descriptor);
-  Tensor(cl_mem memory, bool memory_owner, const BHWDC& shape,
-         const TensorDescriptor& descriptor);
-  Tensor(cl_mem memory, bool memory_owner, cl_mem image_buffer_memory,
-         const BHWC& shape, const TensorDescriptor& descriptor);
-  Tensor(cl_mem memory, bool memory_owner, cl_mem image_buffer_memory,
-         const BHWDC& shape, const TensorDescriptor& descriptor);
-
-  // Move only
-  Tensor(Tensor&& tensor);
-  Tensor& operator=(Tensor&& tensor);
-  Tensor(const Tensor&) = delete;
-  Tensor& operator=(const Tensor&) = delete;
-
-  virtual ~Tensor() { Release(); }
-
-  absl::Status GetGPUResources(const GPUObjectDescriptor* obj_ptr,
-                               GPUResourcesWithValue* resources) const override;
-
-  int Width() const { return shape_.w; }
-  int Height() const { return shape_.h; }
-  int Depth() const { return shape_.d; }
-  int Channels() const { return shape_.c; }
-  int Slices() const { return DivideRoundUp(shape_.c, 4); }
-  int Batch() const { return shape_.b; }
-
-  TensorDescriptor GetDescriptor() const { return descriptor_; }
-  DataType GetDataType() const { return descriptor_.data_type; }
-  TensorStorageType GetStorageType() const { return descriptor_.storage_type; }
-
-  // for profiling and memory statistics
-  uint64_t GetMemorySizeInBytes() const;
-
-  cl_mem GetMemoryPtr() const;
-
-  // This function returns buffer memory ptr for IMAGE_BUFFER instead of image
-  // memory ptr.
-  cl_mem GetMemoryPtrForWriting() const;
-
-  absl::Status WriteData(CLCommandQueue* queue, const TensorFloat32& src);
-  absl::Status WriteData(
-      CLCommandQueue* queue,
-      const tflite::gpu::Tensor& src);
-  absl::Status WriteData(
-      CLCommandQueue* queue,
-      const tflite::gpu::Tensor& src);
-  absl::Status WriteData(CLCommandQueue* queue, const Tensor5DFloat32& src);
-  absl::Status ReadData(CLCommandQueue* queue, TensorFloat32* dst) const;
-  absl::Status ReadData(CLCommandQueue* queue, Tensor5DFloat32* dst) const;
-
-  absl::Status CreateFromDescriptor(const TensorDescriptor& desc,
-                                    CLContext* context);
-
- private:
-  absl::Status IsValid(const BHWC& shape) const;
-  absl::Status IsValid(const BHWDC& shape) const;
-
-  int GetChannelsAlignment() const;
-  int GetAlignedChannels() const;
-
-  absl::Status WriteDataBHWDC(absl::Span in,
-                              CLCommandQueue* queue);
-  absl::Status ReadDataBHWDC(absl::Span out,
-                             CLCommandQueue* queue) const;
-
-  int3 GetFullTensorRegion() const;
-  void Release();
-
-  cl_mem memory_;
-  cl_mem image_buffer_memory_;  // for TensorStorageType::IMAGE_BUFFER only
-  bool memory_owner_;
-  BHWDC shape_;
-  TensorDescriptor descriptor_;
-};
-
-using TensorPtr = std::shared_ptr;
-
-absl::Status AllocateTensorMemory(const CLContext& context, const BHWC& shape,
-                                  const TensorDescriptor& descriptor,
-                                  CLMemory* result);
-
-absl::Status AllocateTensorMemory(const CLContext& context, const BHWDC& shape,
-                                  const TensorDescriptor& descriptor,
-                                  CLMemory* result);
-
-absl::Status CreateTensor(const CLContext& context, const BHWC& shape,
-                          const TensorDescriptor& descriptor, Tensor* result);
-
-absl::Status CreateTensor(const CLContext& context, const BHWDC& shape,
-                          const TensorDescriptor& descriptor, Tensor* result);
-
-absl::Status CreateSharedTensor(const CLContext& context, cl_mem memory,
-                                const BHWC& shape,
-                                const TensorDescriptor& descriptor,
-                                Tensor* result);
-
-absl::Status CreateSharedTensor(const CLContext& context, cl_mem memory,
-                                const BHWDC& shape,
-                                const TensorDescriptor& descriptor,
-                                Tensor* result);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_TENSOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/tensor_type.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/tensor_type.h
deleted file mode 100644
index 2157bf0..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/tensor_type.h
+++ /dev/null
@@ -1,192 +0,0 @@
-/* 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_CL_TENSOR_TYPE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_TENSOR_TYPE_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/cl/gpu_object.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-enum class TextureAddressMode {
-  DONT_CARE,  // translated to CLK_ADDRESS_NONE
-  ZERO,       // translated to CLK_ADDRESS_CLAMP
-};
-
-std::string TextureAddressModeToString(TextureAddressMode address_mode);
-
-enum class TensorStorageType {
-  UNKNOWN,
-  BUFFER,
-  IMAGE_BUFFER,
-  TEXTURE_2D,
-  TEXTURE_3D,
-  TEXTURE_ARRAY,
-  SINGLE_TEXTURE_2D
-};
-
-struct TensorDescriptor : public GPUObjectDescriptor {
-  TensorDescriptor() = default;
-  TensorDescriptor(DataType dt, TensorStorageType st, Layout l)
-      : data_type(dt), storage_type(st), layout(l) {}
-
-  TensorDescriptor(const TensorDescriptor&) = default;
-  TensorDescriptor& operator=(const TensorDescriptor&) = default;
-  TensorDescriptor(TensorDescriptor&& desc);
-  TensorDescriptor& operator=(TensorDescriptor&& desc);
-
-  bool operator==(const TensorDescriptor& d) const {
-    return data_type == d.data_type && storage_type == d.storage_type &&
-           layout == d.layout;
-  }
-
-  bool operator!=(const TensorDescriptor& d) const { return !(*this == d); }
-
-  absl::Status PerformSelector(const std::string& selector,
-                               const std::vector& args,
-                               const std::vector& template_args,
-                               std::string* result) const override;
-
-  GPUResources GetGPUResources() const override;
-
-  absl::Status CreateGPUObject(CLContext* context,
-                               GPUObjectPtr* result) const override;
-  void Release() override { data.clear(); }
-
-  bool HasAxis(Axis axis) const;
-  void SetTextureAddressMode(TextureAddressMode mode);
-
-  absl::Status GetLinkingContextFromWriteSelector(
-      const std::vector& args, std::string* value_name,
-      std::string* x_coord, std::string* y_coord, std::string* s_coord) const;
-
-  void UploadData(const tflite::gpu::Tensor& src);
-  void UploadData(const tflite::gpu::Tensor& src);
-
-  bool SupportsZeroClamp(const Axis& axis) const;
-  bool CanReadOutOfBorder(const Axis& axis) const;
-  bool IsLinear() const;
-
-  // applicable only for types that: IsLinear -> true.
-  // In this case for address we have 1d component - addr (int)
-  // If for addr == -1 this linear storage type returns FLT4(0.0), this function
-  // returns true, otherwise false
-  bool ReturnsZeroForNegOneRead() const;
-
-  DataType data_type = DataType::UNKNOWN;
-  TensorStorageType storage_type = TensorStorageType::UNKNOWN;
-  // This field describes logical layout, actual(physical) GPU layout can be
-  // totally different.
-  Layout layout =
-      Layout::UNKNOWN;  // Supported layouts is HWC, BHWC, HWDC, BHWDC
-
-  // optional
-  BHWDC shape;
-  std::vector data;
-
- private:
-  absl::Status PerformReadSelector(
-      const std::vector& args,
-      const std::vector& template_args, std::string* result) const;
-
-  absl::Status PerformGetAddressSelector(const std::vector& args,
-                                         std::string* result) const;
-
-  absl::Status PerformGetPtrWithSliceOffsetSelector(
-      const std::vector& args, std::string* result) const;
-
-  absl::Status PerformGetWHOffsetSelector(const std::vector& args,
-                                          std::string* result) const;
-
-  absl::Status PerformGetHandleSelector(const std::vector& args,
-                                        std::string* result) const;
-
-  std::string DeclareAddress(const std::string& var_name,
-                             const std::string& address) const;
-
-  std::string StorageTypeToAddressType() const;
-
-  absl::Status PerformWriteSelector(const std::vector& args,
-                                    std::string* result) const;
-
-  absl::Status PerformWriteLinearSelector(const std::vector& args,
-                                          std::string* result) const;
-
-  std::string Read(DataType read_as_type,
-                   const std::string& global_address) const;
-  std::string Write(const std::string& var_name,
-                    const std::string& global_address) const;
-
-  bool IsBatchedWidth() const;
-
-  std::string GetWidth() const;
-  std::string GetSliceStride() const;
-
-  TextureAddressMode ModeFromState() const;
-
-  absl::Status GetDataTypeFromTemplateArgs(const std::string& template_arg,
-                                           DataType* result) const;
-
-  std::string GetGlobalAddressNoDeclarationWHS(const std::string& x,
-                                               const std::string& y,
-                                               const std::string& s) const;
-  std::string GetGlobalAddressNoDeclarationWHSB(const std::string& x,
-                                                const std::string& y,
-                                                const std::string& s,
-                                                const std::string& b) const;
-  std::string GetGlobalAddressNoDeclarationWHDS(const std::string& x,
-                                                const std::string& y,
-                                                const std::string& z,
-                                                const std::string& s) const;
-  std::string GetGlobalAddressNoDeclarationWHDSB(const std::string& x,
-                                                 const std::string& y,
-                                                 const std::string& z,
-                                                 const std::string& s,
-                                                 const std::string& b) const;
-  std::string GetGlobalAddressNoDeclaration(const std::string& xc,
-                                            const std::string& yc,
-                                            const std::string& zc,
-                                            const std::string& sc,
-                                            const std::string& bc) const;
-
-  bool ParseCoordsFromArgs(const std::vector& args, int offset,
-                           std::string* xc, std::string* yc, std::string* zc,
-                           std::string* sc, std::string* bc) const;
-
-  void UploadData(absl::Span src);
-};
-
-template 
-void DataFromBHWDC(absl::Span src, const BHWDC& shape,
-                   const TensorDescriptor& desc, absl::Span dst);
-
-template 
-void DataToBHWDC(absl::Span src, const BHWDC& shape,
-                 const TensorDescriptor& desc, absl::Span dst);
-
-std::string ToString(TensorStorageType type);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_TENSOR_TYPE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/tensor_type_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/tensor_type_util.h
deleted file mode 100644
index bfc0bde..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/tensor_type_util.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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_CL_TENSOR_TYPE_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_TENSOR_TYPE_UTIL_H_
-
-#include "tensorflow/lite/delegates/gpu/api.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-ObjectType ToObjectType(TensorStorageType type);
-
-DataLayout ToDataLayout(TensorStorageType type);
-
-TensorStorageType ToTensorStorageType(ObjectType object_type,
-                                      DataLayout data_layout);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_TENSOR_TYPE_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/texture2d.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/texture2d.h
deleted file mode 100644
index 1586430..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/texture2d.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* 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_CL_TEXTURE2D_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_TEXTURE2D_H_
-
-#include "absl/strings/str_cat.h"
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_command_queue.h"
-#include "tensorflow/lite/delegates/gpu/cl/cl_context.h"
-#include "tensorflow/lite/delegates/gpu/cl/gpu_object.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/cl/tensor_type.h"
-#include "tensorflow/lite/delegates/gpu/cl/util.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-struct Texture2DDescriptor : public GPUObjectDescriptor {
-  DataType element_type;
-  bool normalized = false;   // used with INT data types, if normalized, we read
-                             // in kernel float data.
-  DataType normalized_type;  // can be FLOAT32 or FLOAT16, using with normalized
-                             // = true
-
-  // optional
-  int2 size = int2(0, 0);
-  std::vector data;
-
-  Texture2DDescriptor() = default;
-  Texture2DDescriptor(const Texture2DDescriptor&) = default;
-  Texture2DDescriptor& operator=(const Texture2DDescriptor&) = default;
-  Texture2DDescriptor(Texture2DDescriptor&& desc);
-  Texture2DDescriptor& operator=(Texture2DDescriptor&& desc);
-
-  absl::Status PerformSelector(const std::string& selector,
-                               const std::vector& args,
-                               const std::vector& template_args,
-                               std::string* result) const override;
-
-  GPUResources GetGPUResources() const override;
-  absl::Status PerformReadSelector(const std::vector& args,
-                                   std::string* result) const;
-
-  absl::Status CreateGPUObject(CLContext* context,
-                               GPUObjectPtr* result) const override;
-  void Release() override;
-};
-
-// Texture2D represent formatted GPU data storage.
-// Texture2D is moveable but not copyable.
-class Texture2D : public GPUObject {
- public:
-  Texture2D() {}  // just for using Texture2D as a class members
-  Texture2D(cl_mem texture, int width, int height, cl_channel_type type);
-
-  // Move only
-  Texture2D(Texture2D&& texture);
-  Texture2D& operator=(Texture2D&& texture);
-  Texture2D(const Texture2D&) = delete;
-  Texture2D& operator=(const Texture2D&) = delete;
-
-  virtual ~Texture2D() { Release(); }
-
-  cl_mem GetMemoryPtr() const { return texture_; }
-
-  // Writes data to a texture. Data should point to a region that
-  // has exact width * height * sizeof(pixel) bytes.
-  template 
-  absl::Status WriteData(CLCommandQueue* queue, const absl::Span data);
-
-  // Reads data from Texture2D into CPU memory.
-  template 
-  absl::Status ReadData(CLCommandQueue* queue, std::vector* result) const;
-
-  absl::Status GetGPUResources(const GPUObjectDescriptor* obj_ptr,
-                               GPUResourcesWithValue* resources) const override;
-
-  absl::Status CreateFromTexture2DDescriptor(const Texture2DDescriptor& desc,
-                                             CLContext* context);
-
- private:
-  void Release();
-
-  cl_mem texture_ = nullptr;
-  int width_;
-  int height_;
-  cl_channel_type channel_type_;
-};
-
-using Texture2DPtr = std::shared_ptr;
-
-// Creates new 4-channel 2D texture with f32 elements
-absl::Status CreateTexture2DRGBA32F(int width, int height, CLContext* context,
-                                    Texture2D* result);
-
-// Creates new 4-channel 2D texture with f16 elements
-absl::Status CreateTexture2DRGBA16F(int width, int height, CLContext* context,
-                                    Texture2D* result);
-
-absl::Status CreateTexture2DRGBA(DataType type, int width, int height,
-                                 CLContext* context, Texture2D* result);
-
-absl::Status CreateTexture2DRGBA(DataType type, int width, int height,
-                                 void* data, CLContext* context,
-                                 Texture2D* result);
-
-template 
-absl::Status Texture2D::WriteData(CLCommandQueue* queue,
-                                  const absl::Span data) {
-  const int element_size = ChannelTypeToSizeInBytes(channel_type_);
-  if (sizeof(T) % element_size != 0) {
-    return absl::InvalidArgumentError(
-        "Template type T has not suitable element type for created texture.");
-  }
-  if (4 * width_ * height_ * element_size != data.size() * sizeof(T)) {
-    return absl::InvalidArgumentError(
-        "absl::Span data size is different from texture allocated size.");
-  }
-
-  RETURN_IF_ERROR(queue->EnqueueWriteImage(texture_, int3(width_, height_, 1),
-                                           data.data()));
-
-  return absl::OkStatus();
-}
-
-template 
-absl::Status Texture2D::ReadData(CLCommandQueue* queue,
-                                 std::vector* result) const {
-  const int element_size = ChannelTypeToSizeInBytes(channel_type_);
-  if (sizeof(T) != element_size) {
-    return absl::InvalidArgumentError("Pixel format is different.");
-  }
-
-  const int elements_count = width_ * height_ * 4;
-  result->resize(elements_count);
-
-  return queue->EnqueueReadImage(texture_, int3(width_, height_, 1),
-                                 result->data());
-}
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_TEXTURE2D_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/util.h
deleted file mode 100644
index 54a6c74..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/cl/util.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 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_CL_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_CL_UTIL_H_
-
-#include 
-
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/cl/opencl_wrapper.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/tensor.h"
-#include "tensorflow/lite/delegates/gpu/common/util.h"
-
-namespace tflite {
-namespace gpu {
-namespace cl {
-
-std::string CLErrorCodeToString(cl_int error_code);
-
-int ChannelTypeToSizeInBytes(cl_channel_type type);
-
-bool OpenCLSupported();
-
-template 
-void CopyLinearFLT4(const tflite::gpu::Tensor& src,
-                    absl::Span dst) {
-  const int dst_depth = dst.size();
-  for (int d = 0; d < dst_depth; ++d) {
-    T val;
-    for (int i = 0; i < 4; ++i) {
-      const int dst_ch = d * 4 + i;
-      val[i] = dst_ch >= src.shape.v ? 0.0f : src.data[dst_ch];
-    }
-    dst[d] = val;
-  }
-}
-
-absl::Status CreateCLBuffer(cl_context context, int size_in_bytes,
-                            bool read_only, void* data, cl_mem* result);
-
-cl_channel_type DataTypeToChannelType(DataType type, bool normalized = false);
-absl::Status CreateRGBAImage2D(cl_context context, int width, int height,
-                               cl_channel_type channel_type, void* data,
-                               cl_mem* result);
-
-}  // namespace cl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_CL_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/access_type.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/access_type.h
deleted file mode 100644
index c54888f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/access_type.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* 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_COMMON_ACCESS_TYPE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_ACCESS_TYPE_H_
-
-namespace tflite {
-namespace gpu {
-
-enum class AccessType {
-  READ,
-  WRITE,
-  READ_WRITE,
-};
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_ACCESS_TYPE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/convert.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/convert.h
deleted file mode 100644
index c7a6c17..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/convert.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* 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_COMMON_CONVERT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_CONVERT_H_
-
-#include 
-
-#include 
-
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.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"
-
-namespace tflite {
-namespace gpu {
-
-// PHWC4 layout is where channels are grouped by 4 in a row and P stands for
-// a plane that was derived by dividing channels by 4.
-absl::Status ConvertToPHWC4(absl::Span in, const BHWC& shape,
-                            absl::Span out);
-absl::Status ConvertToPHWC4Half(absl::Span in, const BHWC& shape,
-                                absl::Span out);
-
-// @return number of elements when shape is converted into PHWC4.
-uint32_t GetElementsSizeForPHWC4(const BHWC& shape);
-
-// Operation is opposite to ConvertToPHWC4.
-absl::Status ConvertFromPHWC4(absl::Span in, const BHWC& shape,
-                              absl::Span out);
-absl::Status ConvertFromPHWC4Half(absl::Span in,
-                                  const BHWC& shape, absl::Span out);
-
-// Convenience wrapper around a method above.
-std::vector ConvertToPHWC4(
-    const Tensor& tensor);
-std::vector ConvertToPHWC4(const Tensor& tensor);
-
-// @return number of elements when shape is converted into PIOHW4.
-uint32_t GetElementsSizeForPIOHW4(const OHWI& shape);
-
-// PIOHW4 layout re-arranges weights in groups by 4, where outer dimension is
-// P which is OxI/4.
-absl::Status ConvertToPIOHW4(absl::Span in, const OHWI& shape,
-                             absl::Span out);
-
-// Convenience wrapper around a method above.
-std::vector ConvertToPIOHW4(
-    const Tensor& tensor);
-
-// @return number of elements when shape is converted into PHWO4I4.
-uint32_t GetElementsSizeForPHWO4I4(const OHWI& shape);
-
-// Convenience wrapper around a method above.
-std::vector ConvertToPHWO4I4(
-    const Tensor& tensor);
-
-// Convenience wrapper around a method above, for Transposed Convolution.
-std::vector ConvertToPHWO4I4Transposed(
-    const Tensor& tensor);
-
-// @return (x,y,z) size for PHWO4I4 to access elements where each element
-// consists of 4 values.
-uint3 Get3DSizeForPHWO4I4(const OHWI& shape);
-
-// @return number of elements when shape is converted into PHWO4I4.
-uint32_t GetElementsSizeForPHWO4I4(const IHWO& shape);
-
-// Layout is Po,H,W,OI4x4.
-absl::Status ConvertToPHWO4I4(absl::Span in, const IHWO& shape,
-                              absl::Span out);
-
-// Convenience wrapper around a method above.
-std::vector ConvertToPHWO4I4(
-    const Tensor& tensor);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_CONVERT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/custom_parsers.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/custom_parsers.h
deleted file mode 100644
index 2644864..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/custom_parsers.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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_COMMON_CUSTOM_PARSERS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_CUSTOM_PARSERS_H_
-
-#include 
-
-#include "absl/strings/string_view.h"
-#include "absl/types/any.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-
-// Matches the custom operation by the string name and parses attributes stored
-// as flexbuffers.
-absl::Status ParseCustomAttributes(absl::string_view op_name, int version,
-                                   const void* data, uint32_t data_size,
-                                   absl::any* attr, BHWC* output_shape);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_CUSTOM_PARSERS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/custom_transformations.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/custom_transformations.h
deleted file mode 100644
index 3ca73a0..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/custom_transformations.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_CUSTOM_TRANSFORMATIONS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_CUSTOM_TRANSFORMATIONS_H_
-
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-
-namespace tflite {
-namespace gpu {
-
-// Applies all implemented custom model transformations.
-bool ApplyCustomTransformations(ModelTransformer* transformer);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_CUSTOM_TRANSFORMATIONS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/data_type.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/data_type.h
deleted file mode 100644
index 82d55ec..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/data_type.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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_COMMON_DATA_TYPE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_DATA_TYPE_H_
-
-#include 
-#include 
-
-namespace tflite {
-namespace gpu {
-
-enum class DataType {
-  UNKNOWN = 0,
-  FLOAT16 = 1,
-  FLOAT32 = 2,
-  FLOAT64 = 3,
-  UINT8 = 4,
-  INT8 = 5,
-  UINT16 = 6,
-  INT16 = 7,
-  UINT32 = 8,
-  INT32 = 9,
-  UINT64 = 10,
-  INT64 = 11,
-};
-
-size_t SizeOf(DataType type);
-
-std::string ToString(DataType t);
-
-std::string ToCLDataType(DataType data_type, int vec_size = 1);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_DATA_TYPE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/gpu_info.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/gpu_info.h
deleted file mode 100644
index fa50dc9..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/gpu_info.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* 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_COMMON_GPU_INFO_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_GPU_INFO_H_
-
-#include 
-#include 
-
-namespace tflite {
-namespace gpu {
-
-// The VendorID returned by the GPU driver.
-enum class GpuType {
-  UNKNOWN,
-  APPLE,
-  MALI,
-  ADRENO,
-  POWERVR,
-  INTEL,
-  AMD,
-  NVIDIA,
-};
-enum class GpuModel {
-  UNKNOWN,
-  // Adreno 6xx series
-  ADRENO640,
-  ADRENO630,
-  ADRENO616,
-  ADRENO615,
-  ADRENO612,
-  ADRENO605,
-  // Adreno 5xx series
-  ADRENO540,
-  ADRENO530,
-  ADRENO512,
-  ADRENO510,
-  ADRENO509,
-  ADRENO508,
-  ADRENO506,
-  ADRENO505,
-  ADRENO504,
-  // Adreno 4xx series
-  ADRENO430,
-  ADRENO420,
-  ADRENO418,
-  ADRENO405,
-  // Adreno 3xx series
-  ADRENO330,
-  ADRENO320,
-  ADRENO308,
-  ADRENO306,
-  ADRENO305,
-  ADRENO304,
-  // Adreno 2xx series
-  ADRENO225,
-  ADRENO220,
-  ADRENO205,
-  ADRENO203,
-  ADRENO200,
-  // Adreno 1xx series
-  ADRENO130,
-};
-
-struct GpuInfo {
-  GpuType type = GpuType::UNKNOWN;
-  std::string renderer_name;
-  std::string vendor_name;
-  std::string version;
-  GpuModel gpu_model;
-  int major_version = -1;
-  int minor_version = -1;
-  std::vector extensions;
-  int max_ssbo_bindings = 0;
-  int max_image_bindings = 0;
-  std::vector max_work_group_size;
-  int max_work_group_invocations;
-  int max_texture_size = 0;
-  int max_image_units = 0;
-  int max_array_texture_layers = 0;
-};
-
-inline bool IsOpenGl31OrAbove(const GpuInfo& gpu_info) {
-  return (gpu_info.major_version == 3 && gpu_info.minor_version >= 1) ||
-         gpu_info.major_version > 3;
-}
-
-// Analyzes `renderer` and returns matching `GpuType` and `GpuModel`.
-void GetGpuModelAndType(const std::string& renderer, GpuModel* gpu_model,
-                        GpuType* gpu_type);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_GPU_INFO_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/lstm_parser.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/lstm_parser.h
deleted file mode 100644
index b7c3237..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/lstm_parser.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_LSTM_PARSER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_LSTM_PARSER_H_
-
-#include "absl/container/flat_hash_map.h"
-#include "tensorflow/lite/c/builtin_op_data.h"
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/object_reader.h"
-
-namespace tflite {
-namespace gpu {
-
-absl::Status ParseLSTMAttributes(
-    const TfLiteNode* tflite_node, const TfLiteRegistration* registration,
-    GraphFloat32* graph, ObjectReader* reader, const TfLiteLSTMParams* params,
-    absl::flat_hash_map* new_variable_input_values);
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_LSTM_PARSER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management.h
deleted file mode 100644
index 9f1adce..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* 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_COMMON_MEMORY_MANAGEMENT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_H_
-
-#include 
-
-#include 
-
-#include "absl/memory/memory.h"
-#include "tensorflow/lite/delegates/gpu/common/memory_management/equality_assignment.h"
-#include "tensorflow/lite/delegates/gpu/common/memory_management/naive_assignment.h"
-#include "tensorflow/lite/delegates/gpu/common/memory_management/types.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-
-using TaskId = size_t;
-
-// Converts given assignment of tensors to shared objects to the assignment of
-// the same tensors to offsets in continuous memory block.
-OffsetsAssignment ObjectsToOffsets(
-    const ObjectsAssignment& obj_assignment);
-
-enum class MemoryStrategy {
-  // Naive strategy is to allocate each object separately.
-  // Can be useful for debugging to see all intermediate outputs.
-  NAIVE,
-
-  // Equality strategy allows to reuse the same part of memory for several
-  // tensors with the same size, but non-intersecting usage intervals.
-  EQUALITY,
-
-  // Greedy strategy uses greedy algorithm, iterating through all the tensors in
-  // order of their first_task, to reuse memory from tensors, that
-  // won't be used anymore, for new ones.
-  GREEDY_IN_ORDER,
-
-  // Greedy by size strategy uses greedy algorithm, iterating through all the
-  // tasks in non-increasing of their breadth, and calculating allocations for
-  // tensors used in these tasks. By breadth of the task we understand sum of
-  // sizes of all tensors in its TaskProfile.
-  GREEDY_BY_BREADTH,
-
-  // Greedy by size strategy uses greedy algorithm, iterating through all the
-  // tensors in non-increasing of their size, to reuse memory from tensors, that
-  // won't be used anymore, for new ones.
-  GREEDY_BY_SIZE,
-
-  // Choose greedy strategy from several fast algorithms, that provides best
-  // memory allocation for the given usage records.
-  GREEDY_BEST,
-
-  // Mincostflow strategy consists of building auxiliary flow graph and solving
-  // the minimum-cost flow problem in it. In the end edges with zero residual
-  // capacity determine assignment of shared objects to tensors.
-  MINCOSTFLOW,
-};
-
-// Chooses greedy algorithm with the lowest memory consumption for given usage
-// records and returns corresponding shared objects assignment.
-absl::Status BestGreedy(
-    const std::vector>& usage_records,
-    ObjectsAssignment* assignment);
-
-// Calculates the assignment of shared objects to given tensors, including
-// objects' sizes. Below there are specializations for different types, that
-// support more memory strategies.
-// If reallocation_graph is provided, assignment of shared objects support
-// parallel order of operation execution, but memory consumption in this case
-// can be larger. Currently only GREEDY_IN_ORDER strategy can use this
-// reallocation_graph.
-template 
-absl::Status AssignObjectsToTensors(
-    const std::vector>& usage_records,
-    MemoryStrategy strategy, ObjectsAssignment* assignment,
-    const UsageGraph* reallocation_graph = nullptr) {
-  switch (strategy) {
-    case MemoryStrategy::NAIVE:
-      return NaiveAssignment(usage_records, assignment);
-    case MemoryStrategy::EQUALITY:
-      return EqualityAssignment(usage_records, assignment);
-    default:
-      return absl::InternalError(
-          "MemoryStrategy is not supported with current tensor size type.");
-  }
-  return absl::OkStatus();
-}
-
-template <>
-absl::Status AssignObjectsToTensors(
-    const std::vector>& usage_records,
-    MemoryStrategy strategy, ObjectsAssignment* assignment,
-    const UsageGraph* reallocation_graph);
-
-template <>
-absl::Status AssignObjectsToTensors(
-    const std::vector>& usage_records,
-    MemoryStrategy strategy, ObjectsAssignment* assignment,
-    const UsageGraph* reallocation_graph);
-
-template <>
-absl::Status AssignObjectsToTensors(
-    const std::vector>& usage_records,
-    MemoryStrategy strategy, ObjectsAssignment* assignment,
-    const UsageGraph* reallocation_graph);
-
-template <>
-absl::Status AssignObjectsToTensors(
-    const std::vector>& usage_records,
-    MemoryStrategy strategy, ObjectsAssignment* assignment,
-    const UsageGraph* reallocation_graph);
-
-// Calculates the assignment of tensors to offsets, considering those tensors
-// are going to be allocated in one continuous memory block.
-absl::Status AssignOffsetsToTensors(
-    const std::vector>& usage_records,
-    const MemoryStrategy& strategy, OffsetsAssignment* assignment,
-    const UsageGraph* reallocation_graph = nullptr);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/equality_assignment.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/equality_assignment.h
deleted file mode 100644
index 018e5a9..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/equality_assignment.h
+++ /dev/null
@@ -1,121 +0,0 @@
-/* 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_COMMON_MEMORY_MANAGEMENT_EQUALITY_ASSIGNMENT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_EQUALITY_ASSIGNMENT_H_
-
-#include 
-
-#include 
-#include 
-#include 
-
-#include "absl/container/flat_hash_map.h"
-#include "tensorflow/lite/delegates/gpu/common/memory_management/internal.h"
-#include "tensorflow/lite/delegates/gpu/common/memory_management/types.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-
-// Fast version of Equality Assignments for hashable types.
-template 
-absl::Status EqualityAssignmentWithHash(
-    const std::vector>& usage_records,
-    ObjectsAssignment* assignment) {
-  size_t num_records = usage_records.size();
-  assignment->object_sizes.clear();
-  assignment->object_ids.assign(num_records, kNotAssigned);
-
-  // Pool is a map with size as a key and vector with ids of free shared objects
-  // of this size as a value.
-  absl::flat_hash_map> pool;
-  std::priority_queue objects_in_use;
-  for (size_t i = 0; i < num_records; ++i) {
-    // Pop from the queue and add to the pool all objects that are no longer
-    // in use at the time of execution of the first_task of i-th intermediate
-    // tensor.
-    while (!objects_in_use.empty() &&
-           objects_in_use.top().last_task < usage_records[i].first_task) {
-      auto object_id = objects_in_use.top().object_id;
-      pool[assignment->object_sizes[object_id]].push_back(object_id);
-      objects_in_use.pop();
-    }
-
-    const TensorSizeT tensor_size = usage_records[i].tensor_size;
-    auto pool_it = pool.find(tensor_size);
-    if (pool_it == pool.end() || pool_it->second.empty()) {
-      // No free shared object with size equal to tensor_size. Create a new one,
-      // assign i-th tensor to it and add to the queue of objects in use.
-      assignment->object_ids[i] = assignment->object_sizes.size();
-      assignment->object_sizes.push_back(tensor_size);
-      objects_in_use.push(
-          {usage_records[i].last_task, assignment->object_ids[i]});
-    } else {
-      // Shared object with id it->second has size equal to tensor_size. Reuse
-      // this object: erase it from pool and add to the queue of objects in use.
-      assignment->object_ids[i] = pool_it->second.back();
-      pool_it->second.pop_back();
-      objects_in_use.push(
-          {usage_records[i].last_task, assignment->object_ids[i]});
-    }
-  }
-  return absl::OkStatus();
-}
-
-// Slower version of Equality Assignments for unhashable types.
-template 
-absl::Status EqualityAssignment(
-    const std::vector>& usage_records,
-    ObjectsAssignment* assignment) {
-  size_t num_records = usage_records.size();
-  assignment->object_sizes.clear();
-  assignment->object_ids.assign(num_records, kNotAssigned);
-
-  // Index of operation, after execution of which the shared object can be
-  // deallocated.
-  std::vector dealloc_task;
-  for (size_t i = 0; i < num_records; ++i) {
-    const TensorSizeT tensor_size = usage_records[i].tensor_size;
-    size_t best_obj = kNotAssigned;
-    for (size_t obj = 0; obj < assignment->object_sizes.size(); ++obj) {
-      // Find a shared object, that has equal size with current tensor and has
-      // been deallocated before the execution of its first_task.
-      if (dealloc_task[obj] < usage_records[i].first_task &&
-          assignment->object_sizes[obj] == tensor_size) {
-        best_obj = obj;
-        break;
-      }
-    }
-    if (best_obj == kNotAssigned) {
-      // No free shared object with size equal to tensor_size. Create a new one,
-      // assign i-th tensor to it and save its last task as deallocation task.
-      assignment->object_ids[i] = assignment->object_sizes.size();
-      assignment->object_sizes.push_back(tensor_size);
-      dealloc_task.push_back(usage_records[i].last_task);
-    } else {
-      // Shared object with id it->second has size equal to tensor_size. Reuse
-      // this object and update its deallocation task.
-      assignment->object_ids[i] = best_obj;
-      dealloc_task[best_obj] = usage_records[i].last_task;
-    }
-  }
-  return absl::OkStatus();
-}
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_EQUALITY_ASSIGNMENT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/greedy_by_breadth_assignment.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/greedy_by_breadth_assignment.h
deleted file mode 100644
index e207ab3..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/greedy_by_breadth_assignment.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* 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_COMMON_MEMORY_MANAGEMENT_GREEDY_BY_BREADTH_ASSIGNMENT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_GREEDY_BY_BREADTH_ASSIGNMENT_H_
-
-#include 
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/memory_management/types.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-
-// Assigns given tensors to shared objects, using the following greedy
-// algorithm:
-// - We have tensor usage records of all intermideate tensors as an input. Each
-// record consists of tensor size, first and last tasks, that use it. Let's call
-// [first_task..last_task] a tensor usage interval;
-// - For each task calculate its TaskProfile. By breadth of the task we
-// understand sum of sizes of all tensors in its TaskProfile;
-// - Iterate through all tasks in non-increasing order of breadth;
-// - For each of these tasks iterate through all tensors in its TaskProfile in
-// non-increasing order of tensor_size;
-// - For every such tensor usage record find a shared object, that is not
-// assigned to some tensors, which usage intervals intersect with usage interval
-// of current tensor;
-// - If there are no suitable shared objects, assign current tensor to the new
-// object with size equal to current tensor's size;
-// - If there are suitable objects with size greater than or equal to current
-// tensor’s size, assign current tensor to the smallest of them;
-// - If there are suitable objects only with size less than current tensor’s
-// size, assign current tensor to the largest of them and increase its size.
-absl::Status GreedyByBreadthAssignment(
-    const std::vector>& usage_records,
-    ObjectsAssignment* assignment);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_GREEDY_BY_BREADTH_ASSIGNMENT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/greedy_by_size_assignment.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/greedy_by_size_assignment.h
deleted file mode 100644
index 198a25c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/greedy_by_size_assignment.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* 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_COMMON_MEMORY_MANAGEMENT_GREEDY_BY_SIZE_ASSIGNMENT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_GREEDY_BY_SIZE_ASSIGNMENT_H_
-
-#include 
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/memory_management/types.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-
-// Assigns given tensors to offsets, using the following greedy algorithm:
-// - We have tensor usage records of all intermideate tensors as an input. Each
-// record consists of tensor size, first and last tasks, that use it. Let's call
-// [first_task..last_task] a tensor usage interval;
-// - Iterate through tensor usage records in non-increasing order of
-// corresponding tensor sizes;
-// - For each of these records consider already assigned tensors, which usage
-// intervals intersect with usage interval of current tensor, and find the
-// smallest gap in memory between them such, that current tensor fits into that
-// gap;
-// - If such a gap has been found, current tensor should be allocated into this
-// gap. Otherwise we can allocate it after the rightmost tensor, which usage
-// interval intersects with usage interval of current tensor. So we assign
-// corresponding offset to current tensor and the tensor becomes assigned.
-absl::Status GreedyBySizeAssignment(
-    const std::vector>& usage_records,
-    OffsetsAssignment* assignment);
-
-// Assigns given tensors to shared objects, using the following greedy
-// algorithm:
-// - We have tensor usage records of all intermideate tensors as an input. Each
-// record consists of tensor size, first and last tasks, that use it. Let's call
-// [first_task..last_task] a tensor usage interval;
-// - Distance between two usage intervals is the absolute difference between
-// closest tasks in their intervals. If two usage intervals don't intersect,
-// than the distance between them is positive;
-// - Calculate positional maximums vector, e.g. the vector of lower bounds on
-// size of each shared object;
-// - For each tensor find the rightmost positional maximum, that is greater or
-// equal, than current tensor's size (call it position);
-// - Iterate through all tensors in non-decreasing order of their
-// SizeDistPriority (described above);
-// - For every such tensor, assign it to the object, that already has tensor,
-// which usage interval has the smallest existing positive distance to the
-// current tensor's usage interval (this distance and object id are already
-// precalculated in its SizeDistPriority record). Size of the chosen object can
-// possible increase;
-// - If there are several such objects, use the largest one;
-// - If there are no suitable shared objects, assign current tensor to the new
-// object with size equal to current tensor's size;
-// - Modify SizeDistPriority records of tensors, that haven't been assigned yet,
-// to reflect distance changes after that assignment.
-absl::Status GreedyBySizeDistPriorityAssignment(
-    const std::vector>& usage_records,
-    ObjectsAssignment* assignment);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_GREEDY_BY_SIZE_ASSIGNMENT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/greedy_in_order_assignment.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/greedy_in_order_assignment.h
deleted file mode 100644
index 048ed38..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/greedy_in_order_assignment.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/* 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_COMMON_MEMORY_MANAGEMENT_GREEDY_IN_ORDER_ASSIGNMENT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_GREEDY_IN_ORDER_ASSIGNMENT_H_
-
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/memory_management/internal.h"
-#include "tensorflow/lite/delegates/gpu/common/memory_management/types.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-
-// Implements memory management with a greedy algorithm.
-//
-// The problem of memory management is NP-complete. This implements a
-// greedy algorithm that approximates an optimal solution with following
-// heuristic:
-//
-//   1. Iterates through all tensor usage records and for every object
-//   reference
-//      assigns shared object from the pool. When object reference is used
-//      for the last time, corresponding shared object is returned back to
-//      the pool.
-//
-//   2. Shared object pool grows when there are no free shared object
-//      available.
-//
-//   3. Shared object size may increase when tensor requests larger size.
-template 
-absl::Status GreedyInOrderAssignment(
-    const std::vector>& usage_records,
-    ObjectsAssignment* assignment,
-    const UsageGraph* reallocation_graph = nullptr) {
-  std::vector last_assigned_tensor;
-  size_t num_records = usage_records.size();
-  assignment->object_sizes.clear();
-  assignment->object_ids.assign(num_records, kNotAssigned);
-
-  // Pool of free shared objects is ordered by object size, because we perform
-  // lower_bound search in it.
-  std::set> pool;
-  // Queue of shared objects in use, ordered by their last_task.
-  std::priority_queue objects_in_use;
-  for (size_t i = 0; i < num_records; i++) {
-    // Pop from the queue and add to the pool all objects that are no longer
-    // in use at the time of execution of the first_task of i-th intermediate
-    // tensor.
-    while (!objects_in_use.empty() &&
-           objects_in_use.top().last_task < usage_records[i].first_task) {
-      auto object_id = objects_in_use.top().object_id;
-      pool.insert({assignment->object_sizes[object_id], object_id});
-      objects_in_use.pop();
-    }
-    TensorSizeT tensor_size = usage_records[i].tensor_size;
-    auto best_it = pool.end();
-    size_t best_size_diff = 0;
-    if (reallocation_graph) {
-      for (auto pool_it = pool.begin(); pool_it != pool.end(); ++pool_it) {
-        size_t size_diff = AbsDiffInElements(pool_it->object_size, tensor_size);
-        if (best_it == pool.end() || size_diff < best_size_diff) {
-          const std::vector& realloc_options =
-              (*reallocation_graph)[last_assigned_tensor[pool_it->object_id]];
-          size_t pos = std::lower_bound(realloc_options.begin(),
-                                        realloc_options.end(), i) -
-                       realloc_options.begin();
-          if (pos != realloc_options.size() && realloc_options[pos] == i) {
-            // We found, that memory of tensor, that was last assigned to
-            // object pool_it->object_id, can be reused for tensor i.
-            best_size_diff = size_diff;
-            best_it = pool_it;
-          }
-        }
-      }
-    } else if (!pool.empty()) {
-      // Find shared object from pool, that will waste the least possible
-      // amount of memory when reused for current tensor.
-      auto pool_it = pool.lower_bound({tensor_size, 0});
-      TensorSizeT size_diff = 0;
-      if (pool_it != pool.end()) {
-        // Try smallest shared object from pool with size >= tensor_size.
-        size_diff = pool_it->object_size - tensor_size;
-        best_it = pool_it;
-      }
-      if (pool_it != pool.begin()) {
-        // Try largest shared object from pool with size < tensor_size.
-        pool_it--;
-        if (best_it == pool.end() ||
-            tensor_size - pool_it->object_size < size_diff) {
-          size_diff = tensor_size - pool_it->object_size;
-          best_it = pool_it;
-        }
-      }
-      // best_it can't be equal to pool.end(), because pool is not empty
-      if (best_it == pool.end()) {
-        return absl::InternalError(
-            "No shared object is found in non-empty pool in "
-            "GreedyInOrderAssignment.");
-      }
-    }
-    if (best_it == pool.end()) {
-      // No free shared object, creating a new one, assign i-th tensor to
-      // it and add to the queue of objects in use.
-      assignment->object_ids[i] = assignment->object_sizes.size();
-      assignment->object_sizes.push_back(tensor_size);
-      last_assigned_tensor.push_back(i);
-      objects_in_use.push(
-          {usage_records[i].last_task, assignment->object_ids[i]});
-    } else {
-      size_t shared_id = best_it->object_id;
-      pool.erase(best_it);
-      assignment->object_ids[i] = shared_id;
-      assignment->object_sizes[shared_id] =
-          std::max(assignment->object_sizes[shared_id], tensor_size);
-      last_assigned_tensor[shared_id] = i;
-      objects_in_use.push(
-          {usage_records[i].last_task, assignment->object_ids[i]});
-    }
-  }
-  return absl::OkStatus();
-}
-
-// The same algorithm as above, but for multidimensional case. The only
-// difference is that shared object dimensions can't be increased to be reused
-// for tensor, that is larger (at least by one dimension).
-template 
-absl::Status GreedyInOrderAssignmentMultidimensional(
-    const std::vector>& usage_records,
-    ObjectsAssignment* assignment) {
-  size_t num_records = usage_records.size();
-  assignment->object_sizes.clear();
-  assignment->object_ids.assign(num_records, kNotAssigned);
-
-  // Pool of free shared objects is unordered in multidimensional version of the
-  // algorithm.
-  std::list pool;
-  // Queue of shared objects in use, ordered by their last_task.
-  std::priority_queue objects_in_use;
-  for (size_t i = 0; i < num_records; i++) {
-    // Pop from the queue and add to the pool all objects that are no longer
-    // in use at the time of execution of the first_task of i-th intermediate
-    // tensor.
-    while (!objects_in_use.empty() &&
-           objects_in_use.top().last_task < usage_records[i].first_task) {
-      auto object_id = objects_in_use.top().object_id;
-      pool.push_back(object_id);
-      objects_in_use.pop();
-    }
-    const TensorSizeT& tensor_size = usage_records[i].tensor_size;
-    auto best_it = pool.end();
-    size_t best_size_diff = 0;
-    // Find shared object from pool, that will waste the least possible
-    // amount of memory when reused for current tensor.
-    for (auto pool_it = pool.begin(); pool_it != pool.end(); ++pool_it) {
-      // Needed size of shared object to cover current tensor and all previous
-      // tensors assigned to it.
-      const TensorSizeT& shared_object_size =
-          assignment->object_sizes[*pool_it];
-      if (IsCoveringObject(shared_object_size, tensor_size)) {
-        // Prefer shared object that will waste less memory.
-        size_t size_diff = AbsDiffInElements(shared_object_size, tensor_size);
-        if (best_it == pool.end() || size_diff < best_size_diff) {
-          best_it = pool_it;
-          best_size_diff = size_diff;
-        }
-      }
-    }
-    if (best_it == pool.end()) {
-      // No free suitable shared object, creating a new one, assign i-th tensor
-      // to it and add to the queue of objects in use.
-      assignment->object_ids[i] = assignment->object_sizes.size();
-      assignment->object_sizes.push_back(tensor_size);
-      objects_in_use.push(
-          {usage_records[i].last_task, assignment->object_ids[i]});
-    } else {
-      size_t shared_id = *best_it;
-      pool.erase(best_it);
-      assignment->object_ids[i] = shared_id;
-      objects_in_use.push(
-          {usage_records[i].last_task, assignment->object_ids[i]});
-    }
-  }
-  return absl::OkStatus();
-}
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_GREEDY_IN_ORDER_ASSIGNMENT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/internal.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/internal.h
deleted file mode 100644
index 4d48f75..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/internal.h
+++ /dev/null
@@ -1,109 +0,0 @@
-/* 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_COMMON_MEMORY_MANAGEMENT_INTERNAL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_INTERNAL_H_
-
-#include 
-
-#include 
-#include 
-
-#include "absl/memory/memory.h"
-#include "tensorflow/lite/delegates/gpu/common/memory_management/types.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-
-const size_t kNotAssigned = std::numeric_limits::max();
-
-// This structure is used to save the initial indices of usage records after
-// they are sorted.
-template 
-struct TensorUsageWithIndex {
-  const TensorUsageRecord* usage_record;
-  size_t idx;
-
-  TensorUsageWithIndex(const TensorUsageRecord* usage_record,
-                       size_t idx)
-      : usage_record(usage_record), idx(idx) {}
-};
-
-bool CompareBySize(const TensorUsageWithIndex& first,
-                   const TensorUsageWithIndex& second);
-
-// TaskProfile is a vector with information about all intermediate tensors, that
-// should exist in memory during the execution of the task. Elements of the
-// vector must be sorted in non-increasing order of corresponding tensors sizes.
-using TaskProfile = std::vector>;
-
-// Size of object, that covers both input objects (2-dimensional case).
-bool IsCoveringObject(const uint2& first_object, const uint2& second_object);
-
-// Size of object, that covers both input objects (3-dimensional case).
-bool IsCoveringObject(const uint3& first_object, const uint3& second_object);
-
-// Difference between two objects in elements count (1-dimensional case).
-size_t AbsDiffInElements(const size_t first_size, const size_t second_size);
-
-// Difference between two objects in elements count (2-dimensional case).
-size_t AbsDiffInElements(const uint2& first_size, const uint2& second_size);
-
-// Difference between two objects in elements count (3-dimensional case).
-size_t AbsDiffInElements(const uint3& first_size, const uint3& second_size);
-
-template 
-struct PoolRecord {
-  PoolRecord(ObjectSizeT size, size_t obj_id)
-      : object_size(size), object_id(obj_id) {}
-
-  // Objects in pool are ordered by size.
-  bool operator<(const PoolRecord& other) const {
-    return (object_size < other.object_size) ||
-           (object_size == other.object_size && object_id < other.object_id);
-  }
-
-  ObjectSizeT object_size;
-  size_t object_id;
-};
-
-struct QueueRecord {
-  QueueRecord(TaskId task_id, size_t obj_id)
-      : last_task(task_id), object_id(obj_id) {}
-
-  // Objects in queue are ordered by last_task.
-  bool operator<(const QueueRecord& other) const {
-    return (last_task > other.last_task) ||
-           (last_task == other.last_task && object_id > other.object_id);
-  }
-
-  // Last task, where shared object is used.
-  TaskId last_task;
-  size_t object_id;
-};
-
-// Returns a vector that contains TaskProfile for each task.
-std::vector CalculateTaskProfiles(
-    const std::vector>& usage_records);
-
-// Iterates over all task profiles to calculate maximum at each position.
-std::vector CalculatePositionalMaximums(
-    const std::vector>& usage_records);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_INTERNAL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/min_cost_flow_assignment.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/min_cost_flow_assignment.h
deleted file mode 100644
index df734ad..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/min_cost_flow_assignment.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* 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_COMMON_MEMORY_MANAGEMENT_MIN_COST_FLOW_ASSIGNMENT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_MIN_COST_FLOW_ASSIGNMENT_H_
-
-#include 
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/memory_management/types.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-
-// Implements memory management with a Minimum-cost flow matching algorithm.
-//
-// The problem of memory management is NP-complete. This function creates
-// auxiliary flow graph, find minimum-cost flow in it and calculates the
-// assignment of shared objects to tensors, using the result of the flow
-// algorithm.
-absl::Status MinCostFlowAssignment(
-    const std::vector>& usage_records,
-    ObjectsAssignment* assignment);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_MIN_COST_FLOW_ASSIGNMENT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/naive_assignment.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/naive_assignment.h
deleted file mode 100644
index d700f62..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/naive_assignment.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* 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_COMMON_MEMORY_MANAGEMENT_NAIVE_ASSIGNMENT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_NAIVE_ASSIGNMENT_H_
-
-#include 
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/memory_management/internal.h"
-#include "tensorflow/lite/delegates/gpu/common/memory_management/types.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-
-// Implements memory management with a naive algorithm.
-//
-// The problem of memory management is NP-complete. This implements a
-// naive algorithm that assigns each tensor to a separate object in memory.
-template 
-absl::Status NaiveAssignment(
-    const std::vector>& usage_records,
-    ObjectsAssignment* assignment) {
-  assignment->object_sizes.resize(usage_records.size());
-  assignment->object_ids.assign(usage_records.size(), kNotAssigned);
-  for (size_t i = 0; i < usage_records.size(); i++) {
-    auto& record = usage_records[i];
-    assignment->object_ids[i] = i;
-    assignment->object_sizes[i] = record.tensor_size;
-  }
-  return absl::OkStatus();
-}
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_NAIVE_ASSIGNMENT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/types.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/types.h
deleted file mode 100644
index f3257fc..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/memory_management/types.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* 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_COMMON_MEMORY_MANAGEMENT_TYPES_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_TYPES_H_
-
-#include 
-
-#include 
-#include 
-
-namespace tflite {
-namespace gpu {
-
-using TaskId = size_t;
-using UsageGraph = std::vector>;
-
-// Record, containing tensor size/shape and IDs of the first and the last task,
-// that use this tensor as input or output. For example: tensor #3 with size
-// tensor_size=65536 is first introduced in program #2 (first_task=2) and used
-// for the last time in program #7 (last_task=7).
-template 
-struct TensorUsageRecord {
-  TensorSizeT tensor_size;
-  TaskId first_task;
-  TaskId last_task;
-
-  TensorUsageRecord(TensorSizeT size, TaskId first, TaskId last)
-      : tensor_size(size), first_task(first), last_task(last) {}
-
-  // Default order of tensor usage records is increasing order of first_task.
-  bool operator<(const TensorUsageRecord& other) const {
-    return first_task < other.first_task;
-  }
-};
-
-// Information about assignment of tensors to shared objects
-template 
-struct ObjectsAssignment {
-  // shared_object_ids_[i] is ID of shared object, that tensor i will be using.
-  std::vector object_ids;
-  // shared_object_sizes_[i] is a size of shared object with ID equal to i.
-  std::vector object_sizes;
-};
-
-// Information about assignment of tensors to offsets for the case, when all of
-// them are going to be allocated in one continuous memory block.
-struct OffsetsAssignment {
-  std::vector offsets;
-  size_t total_size;
-};
-
-// This function takes the graph of tensor dependencies as an input and returns
-// reallocation graph as an output. Tensor dependencies graph is a directed
-// graph, with edge x->y existing if and only if tensor x is used for
-// calculating of tensor y. This graph can be generated with following
-// pseudocode: for op in operations do
-//   for input_tensor in op.input_tensors do
-//       for output_tensor in op.output_tensors do
-//         if both input_tensor and output_tensor are intermediate tensors then
-//           deps_graph[input_tensor].push_back(output_tensor)
-// Reallocation graph is an undirected graph, that has edge x<->y if and only if
-// tensors x and y can share memory in ANY order of operations parallel
-// execution.
-UsageGraph ReallocationGraph(const UsageGraph& deps_graph);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MEMORY_MANAGEMENT_TYPES_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model.h
deleted file mode 100644
index 2e9aac8..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/* 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_COMMON_MODEL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MODEL_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "absl/memory/memory.h"
-#include "absl/types/any.h"
-#include "absl/types/optional.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"
-
-namespace tflite {
-namespace gpu {
-
-// There is yet another representation of CNN graph. The primary purpose of this
-// representation is to simplify graph manipulation.
-
-using ValueId = uint32_t;
-
-using NodeId = uint32_t;
-
-// Used to emulate quantized behavior.
-struct QuantizationParams {
-  float min = 0;
-  float max = 0;
-  float scale = 0;
-};
-
-// Connects tensor's producer and operation that depends on this tensor.
-struct Value {
-  const ValueId id;
-  TensorRef tensor;
-  absl::optional quant_params;
-};
-
-struct Operation {
-  std::string type;
-  absl::any attributes;
-};
-
-struct Node {
-  const NodeId id;
-  Operation operation;
-};
-
-// A DAG that consists of nodes and values. Each value may have a single
-// producer node and multiple consumer nodes. Therefore, each node may have
-// multiple input and output values.
-//
-// Value that does not have a producer is a graph's input. Value that does not
-// have a consumer is a graph's output.
-//
-// It keeps values and nodes referenced by their index in a vector. Therefore,
-// nodes and values are never deleted, but rather erased, where corresponding
-// index remains.
-//
-// It is possible to re-use removed indices, but it is not implemented yet.
-class GraphFloat32 {
- public:
-  // @return a collection of nodes in this graph.
-  std::vector nodes() const;
-
-  // @return a collection of values in this graph.
-  std::vector values() const;
-
-  // @return graph inputs, that are values without producers.
-  std::vector inputs() const;
-
-  // @return graph outputs, that are values without consumers.
-  std::vector outputs() const;
-
-  // @return values updated in place with a previously defined tensor reference.
-  std::vector variable_inputs() const;
-
-  // @return inputs into the given node. Returns empty vector for deleted node.
-  std::vector FindInputs(NodeId id) const;
-
-  // @return outputs from the given node. Returns empty vector for deleted node.
-  std::vector FindOutputs(NodeId id) const;
-
-  bool IsGraphInput(ValueId id) const;
-
-  bool IsGraphOutput(ValueId id) const;
-
-  // @return producer of the given value. Returns nullptr for deleted value.
-  Node* FindProducer(ValueId id) const;
-
-  // @return consumers of the given value. Returns empty vector for deleted
-  // value.
-  std::vector FindConsumers(ValueId id) const;
-
-  // @return a node or nullptr if node with the given id is not present.
-  Node* GetNode(NodeId id) const;
-
-  // @return a value or nullptr if value with the given id is not present.
-  Value* GetValue(ValueId id) const;
-
-  //////////////////////////////////////////////////////////////////////////////
-  // Graph manipulation functions are below
-  //////////////////////////////////////////////////////////////////////////////
-
-  // @return new node created in this graph
-  // NOTE: nodes should be created in the topological order, e.g. node A that
-  // depends on a value from node B should be created after node B.
-  Node* NewNode();
-
-  // Insert Node after another in the execution plan.
-  absl::Status InsertNodeAfter(NodeId id, Node** new_node);
-
-  // @return new value created in this graph
-  Value* NewValue();
-
-  // Sets a producer for the given value. There could be a single producer
-  // for a value. If a value had another producer, it will reassign producer
-  // appropriately. If a value didn't have a producer, it will be removed
-  // from a graph's input.
-  absl::Status SetProducer(NodeId producer, ValueId value);
-
-  // Removes a producer for the given value. Value becomes producer-less and
-  // therefore becomes graph's input.
-  absl::Status RemoveProducer(ValueId value);
-
-  // Sets a consumer for the given value. There could be multiple consumers
-  // for a value.
-  absl::Status AddConsumer(NodeId consumer, ValueId value);
-
-  // Replace input value for given node.
-  absl::Status ReplaceInput(NodeId node, ValueId old_value, ValueId new_value);
-
-  // Removes a consumer for the given value. If value does not have any
-  // consumers it becomes graph's output.
-  absl::Status RemoveConsumer(NodeId consumer, ValueId value);
-
-  // Removes node from this graph. For all input values this node will be
-  // removed from consumers and for all output values a producer will be
-  // removed.
-  absl::Status DeleteNode(NodeId id);
-
-  // Removes value from this graph. It will be removed from inputs for all
-  // dependent nodes. A node that was a producer of this value will loose its
-  // output.
-  absl::Status DeleteValue(ValueId id);
-
-  absl::Status MakeExactCopy(GraphFloat32* model) const;
-
- private:
-  struct NodeDef {
-    std::vector inputs;
-    std::vector outputs;
-    std::unique_ptr node;
-  };
-
-  struct ValueDef {
-    Node* producer = nullptr;
-    std::vector consumers;
-    std::unique_ptr value;
-  };
-
-  bool IsInput(NodeId node, ValueId value);
-
-  template 
-  static void Erase(std::vector* values, T value) {
-    values->erase(std::find(values->begin(), values->end(), value));
-  }
-
-  // @return non-nullptr NodeDef that has valid Node or an error
-  absl::Status LookupNode(NodeId id, NodeDef** node_def);
-
-  // @return non-nullptr ValueDef that has valid Value or an error
-  absl::Status LookupValue(ValueId id, ValueDef** value_def);
-
-  template 
-  std::vector FilterValues(const Pred& predicate) const {
-    std::vector values;
-    values.reserve(values_.size());
-    for (auto& v : values_) {
-      if (v.value != nullptr && predicate(v)) {
-        values.push_back(v.value.get());
-      }
-    }
-    return values;
-  }
-
-  template 
-  std::vector FilterNodes(const Pred& predicate) const {
-    std::vector nodes;
-    nodes.reserve(nodes_.size());
-    for (const auto id : execution_plan_) {
-      auto& n = nodes_.at(id);
-      if (n.node != nullptr && predicate(n)) {
-        nodes.push_back(n.node.get());
-      }
-    }
-    return nodes;
-  }
-
-  // There are two approaches possible: wrap entire NodeDef and ValueDef into
-  // unique_ptr and store it in values_ and nodes_ or store it by value.
-  // We store it by value here to make introspection calls cheaper.
-  std::vector values_;
-
-  std::map nodes_;
-  // Node Ids in order of execution.
-  std::vector execution_plan_;
-};
-
-// Removes to_remove node that precedes to_keep node only if to_remove has
-// outputs that are consumed only by to_keep. In such case to_keep inherits all
-// to_remove inputs.
-absl::Status RemovePrecedingNode(GraphFloat32* graph, const Node* to_remove,
-                                 const Node* to_keep);
-
-// Removes to_remove node that follows to_keep node only if to_remove has inputs
-// that are produced by to_keep. to_keep inherits all to_remove inputs.
-absl::Status RemoveFollowingNode(GraphFloat32* graph, const Node* to_remove,
-                                 const Node* to_keep);
-
-// Removes simple_node and its output value from the graph. Node is considered
-// simple if it has only one input and one output value. Input value is kept.
-absl::Status RemoveSimpleNodeKeepInput(GraphFloat32* graph,
-                                       const Node* simple_node);
-
-// Removes simple_node and its input value from the graph. Node is considered
-// simple if it has only one input and one output value. Output value is kept.
-// simple_node should be an exclusive consumer of its input value.
-absl::Status RemoveSimpleNodeKeepOutput(GraphFloat32* graph,
-                                        const Node* simple_node);
-
-absl::Status AddOutput(GraphFloat32* graph, const Node* from_node,
-                       Value** output);
-
-// Makes a direct connection between from_node and to_node. All input parameters
-// except output are expected to be initialized before passing to the function.
-// If from_node already has an output value, which is not yet consumed by
-// to_node, it may be passed as output parameter.
-absl::Status ConnectTwoNodes(GraphFloat32* graph, const Node* from_node,
-                             const Node* to_node, Value** output);
-
-// @return true if all tensors have same batch value or if model has no values.
-bool IsBatchMatchesForAllValues(const GraphFloat32& model);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MODEL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model_builder.h
deleted file mode 100644
index ab18f05..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model_builder.h
+++ /dev/null
@@ -1,73 +0,0 @@
-/* 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_COMMON_MODEL_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MODEL_BUILDER_H_
-
-#include "absl/container/flat_hash_map.h"
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/delegates/gpu/common/model.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"
-
-namespace tflite {
-namespace gpu {
-
-// Validates which operations are supported and returns array of operations to
-// replace with GPU kernels. The caller must free the pointer on TfLiteIntArray.
-// 'max_delegated_partitions' limits the maximum number of partitions to
-// delegate as a graph could possibly have multiple partitions (each partition
-// consists of a subset of ops) to be replaced.
-TfLiteIntArray* GetOpsToReplace(TfLiteContext* context,
-                                bool allow_quant_ops = false,
-                                int max_delegated_partitions = 1);
-
-// Extracts TFLite delegate execution plan from the input TFLite context and
-// converts it into generic graph format.
-//
-// If model is quantized, quant_conversion_map maps the dequantized tensor
-// (floating-point) to the original tensor (fixed-point) & vice-versa.
-// NOTE: Not all of these new tensors will have any data and need memory
-// allocated for them. We need to do that only for the overall GPU graph inputs
-// & outputs. This should be done by the delegate, by setting the appropriate
-// TfLiteNode->temporaries.
-absl::Status BuildModel(
-    TfLiteContext* context, const TfLiteDelegateParams* delegate_params,
-    GraphFloat32* graph,
-    absl::flat_hash_map* quant_conversion_map = nullptr);
-
-// Same as above but also apply all transformations on the final graph.
-// Prefer using this method instead of BuildModel.
-//
-// If model is quantized, quant_conversion_map maps the dequantized tensor
-// (floating-point) to the original TFLite tensor (fixed-point) & vice-versa.
-// NOTE: Not all of these new tensors will have any data and need memory
-// allocated for them. We need to do that only for the overall GPU graph inputs
-// & outputs. This should be done by the delegate, by setting the appropriate
-// TfLiteNode->temporaries.
-absl::Status BuildFinalModel(
-    TfLiteContext* context, const TfLiteDelegateParams* delegate_params,
-    GraphFloat32* graph,
-    absl::flat_hash_map* quant_conversion_map = nullptr);
-
-// Module-internal converter, exposed for unit testing purpose only.
-absl::Status ConvertTfLiteTensorToTensorRef(const TfLiteTensor& tflite_tensor,
-                                            TensorRef* tensor_ref);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MODEL_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model_builder_helper.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model_builder_helper.h
deleted file mode 100644
index 9388931..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model_builder_helper.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MODEL_BUILDER_HELPER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MODEL_BUILDER_HELPER_H_
-
-#include 
-#include 
-#include 
-
-#include 
-
-#include "absl/strings/str_cat.h"
-#include "tensorflow/lite/c/builtin_op_data.h"
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/model.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/kernels/internal/reference/dequantize.h"
-#include "tensorflow/lite/kernels/internal/tensor_ctypes.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace gpu {
-
-absl::Status GetNodeAndRegistration(TfLiteContext* context, int node_id,
-                                    TfLiteNode** tflite_node,
-                                    TfLiteRegistration** registration);
-
-DataType ToDataType(TfLiteType type);
-
-absl::Status ExtractTensorShape(const TfLiteTensor& tflite_tensor, BHWC* bhwc);
-
-absl::Status ExtractAxisFromIndex(const TfLiteTensor& tflite_tensor, int index,
-                                  Axis* axis);
-
-absl::Status ConvertTfLiteTensorToTensorRef(const TfLiteTensor& tflite_tensor,
-                                            TensorRef* tensor_ref);
-
-// Populates quantization parameters for non-constant UInt8/Int8 tensors.
-// This helps the delegate emulate quantized inference with
-// QuantizeAndDequantize.
-absl::Status PopulateQuantParams(const TfLiteTensor& tensor,
-                                 QuantizationParams* quant_params);
-
-int GetNumberOfRuntimeInputsForNode(const TfLiteContext* context,
-                                    const TfLiteNode* tflite_node);
-
-int GetNumberOfConstInputsForNode(const TfLiteContext* context,
-                                  const TfLiteNode* tflite_node);
-
-absl::Status CheckInputsOutputs(const TfLiteContext* context,
-                                const TfLiteNode* tflite_node,
-                                int runtime_inputs, int outputs);
-
-absl::Status CheckInputsConstsOutputs(const TfLiteContext* context,
-                                      const TfLiteNode* tflite_node,
-                                      int runtime_inputs, int const_inputs,
-                                      int outputs);
-
-void ConvertFloat16ToFloat32(size_t num_elements, const uint16_t* src,
-                             float* dst);
-
-template 
-inline void DequantizeConstantTensor(const TfLiteTensor& tensor,
-                                     const T* source_data,
-                                     float* dequantized_data) {
-  TfLiteAffineQuantization* quant_params =
-      static_cast(tensor.quantization.params);
-  if (quant_params->scale->size > 1) {
-    // Tensor is per-channel quantized.
-    PerChannelDequantizationParams op_params;
-    op_params.zero_point = quant_params->zero_point->data;
-    op_params.scale = quant_params->scale->data;
-    op_params.quantized_dimension = quant_params->quantized_dimension;
-    reference_ops::PerChannelDequantize(op_params, GetTensorShape(&tensor),
-                                        source_data, GetTensorShape(&tensor),
-                                        dequantized_data);
-  } else {
-    DequantizationParams op_params;
-    op_params.zero_point = tensor.params.zero_point;
-    op_params.scale = tensor.params.scale;
-    reference_ops::Dequantize(op_params, GetTensorShape(&tensor), source_data,
-                              GetTensorShape(&tensor), dequantized_data);
-  }
-}
-
-template 
-absl::Status CreateVectorCopyData(const TfLiteTensor& tensor, T* tensor_data) {
-  if (tensor.bytes % sizeof(T) != 0) {
-    return absl::InvalidArgumentError(
-        absl::StrCat("Input data size ", tensor.bytes,
-                     " is not aligned to expected type: ", sizeof(T)));
-  }
-  std::memcpy(tensor_data, tensor.data.uint8, tensor.bytes);
-  return absl::OkStatus();
-}
-
-template <>
-absl::Status CreateVectorCopyData(const TfLiteTensor& tensor,
-                                         float* tensor_data);
-
-absl::Status SetAllDimensions(const TfLiteIntArray* dimensions, Scalar* shape);
-
-absl::Status CheckIfLinearConvertible(const TfLiteIntArray* dimensions);
-
-absl::Status SetAllDimensions(const TfLiteIntArray* dimensions, Linear* shape);
-
-absl::Status SetAllDimensions(const TfLiteIntArray* dimensions, HWC* shape);
-
-absl::Status SetAllDimensions(const TfLiteIntArray* dimensions, HW* shape);
-
-absl::Status SetAllDimensions(const TfLiteIntArray* dimensions, OHWI* shape);
-
-absl::Status SetAllDimensions(const TfLiteIntArray* dimensions, BHWC* shape);
-
-absl::Status IsActivationSupported(TfLiteFusedActivation fused_activation);
-
-// If there is fused activation present, then there will be another node created
-// that will have identical output as the given node. New operation node will
-// depend on the given node output.
-absl::Status MaybeFuseActivation(TfLiteFusedActivation fused_activation,
-                                 GraphFloat32* graph, Node* node);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MODEL_BUILDER_HELPER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model_transformer.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model_transformer.h
deleted file mode 100644
index b640b14..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/model_transformer.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* 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_COMMON_MODEL_TRANSFORMER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MODEL_TRANSFORMER_H_
-
-#include 
-#include 
-#include 
-#include 
-
-#include "absl/container/flat_hash_set.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-
-namespace tflite {
-namespace gpu {
-
-class TransformationReporter;
-
-struct TransformationContext {
-  GraphFloat32* graph;
-  TransformationReporter* reporter;
-};
-
-enum class TransformStatus {
-  // Transformation was not applied due to trivial conditions mismatch.
-  //
-  // This is different from DECLINED code below that provides in-depth
-  // explanation why a transformation that could have been applied but was not
-  // due to some issues.
-  SKIPPED,
-
-  // Transformation was declined, therefore, a model was not modified.
-  DECLINED,
-
-  // Transformation was applied successfully
-  APPLIED,
-
-  // Transformation may partially be applied, but left a model in an invalid
-  // state. This error should be considered unrecoverable.
-  INVALID,
-};
-
-struct TransformResult {
-  TransformStatus status;
-  std::string message;
-};
-
-// Class responsible for applying a transformation to a single node.
-class NodeTransformation {
- public:
-  virtual ~NodeTransformation() = default;
-
-  virtual TransformResult ApplyToNode(Node* node, GraphFloat32* graph) = 0;
-};
-
-// Class responsible for applying a transformation to a sequence of nodes.
-// Nodes are guaranteed to depend on each other without extra dependents being
-// spilled.
-class SequenceTransformation {
- public:
-  virtual ~SequenceTransformation() = default;
-
-  // @return number of nodes in a sequence to apply this transformation.
-  virtual int ExpectedSequenceLength() const = 0;
-
-  // Applies transformations to a sequence of nodes. Transformation
-  // implementation is free manipulate with sequence nodes including adding
-  // and/or deleting nodes. if there were updates to nodes in the end and/or
-  // beginning of the sequence, then referential consistency should be
-  // maintained by updating relevant references in nodes that precede this
-  // sequence or depend on a last node of the sequence.
-  virtual TransformResult ApplyToNodesSequence(
-      const std::vector& sequence, GraphFloat32* graph) = 0;
-};
-
-// A class accumulated decisions or updates done by transformations.
-class TransformationReporter {
- public:
-  virtual ~TransformationReporter() = default;
-
-  virtual void DeclinedTransformation(const std::string& transformation,
-                                      const std::string& node_ids,
-                                      const std::string& message) = 0;
-
-  virtual void AppliedTransformation(const std::string& transformation,
-                                     const std::string& node_ids,
-                                     const std::string& message) = 0;
-};
-
-// A class is designed to perform model transformations.
-class ModelTransformer {
- public:
-  ModelTransformer(GraphFloat32* graph, TransformationReporter* reporter)
-      : graph_(graph), reporter_(reporter) {}
-
-  // @return false if a graph is in the broken states can not be used any more
-  bool Apply(const std::string& name, SequenceTransformation* transformation);
-
-  // @return false if a graph is in the broken states can not be used any more
-  bool Apply(const std::string& name, NodeTransformation* transformation);
-
- private:
-  bool ApplyStartingWithNode(const std::string& name,
-                             SequenceTransformation* transformation,
-                             Node* begin);
-
-  void AddNodeToProcess(Node* node) {
-    if (node && processed_.insert(node->id).second) {
-      to_process_.push_back(node->id);
-    }
-  }
-
-  GraphFloat32* graph_;
-  TransformationReporter* reporter_;
-
-  std::deque to_process_;
-  absl::flat_hash_set processed_;
-};
-
-class NullTransformationReporter : public TransformationReporter {
- public:
-  void DeclinedTransformation(const std::string& transformation,
-                              const std::string& nodes_id,
-                              const std::string& message) override {}
-
-  void AppliedTransformation(const std::string& transformation,
-                             const std::string& nodes_id,
-                             const std::string& message) override {}
-};
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_MODEL_TRANSFORMER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/object_reader.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/object_reader.h
deleted file mode 100644
index 3c7d7f6..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/object_reader.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_OBJECT_READER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_OBJECT_READER_H_
-
-#include 
-
-#include "absl/container/flat_hash_map.h"
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/model_builder_helper.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/kernels/kernel_util.h"
-
-namespace tflite {
-namespace gpu {
-
-// If quantized tensors exist in the graph & quant_conversion_map is non-null,
-// the mapping between the original tensors (fixed-point) & GPU values (fp) is
-// stored in quant_conversion_map.
-class ObjectReader {
- public:
-  static absl::Status ReadNonConstantTensor(
-      TfLiteContext* context, absl::flat_hash_map* tensor_to_value,
-      absl::flat_hash_map* quant_conversion_map, GraphFloat32* graph,
-      uint32_t tensor_idx, Value** value = nullptr);
-
-  ObjectReader(GraphFloat32* graph, TfLiteContext* context,
-               const TfLiteNode* node,
-               absl::flat_hash_map* tensor_to_value,
-               absl::flat_hash_map* quant_conversion_map = nullptr)
-      : graph_(graph),
-        context_(context),
-        node_(node),
-        tensor_to_value_(tensor_to_value),
-        quant_conversion_map_(quant_conversion_map) {}
-
-  absl::Status ReadValue(uint32_t idx, Value** value);
-
-  absl::Status ReadValueByTensorIdx(uint32_t tensor_idx, Value** value);
-
-  int GetNumberOfRuntimeInputs() const;
-
-  absl::Status GetTensorDims(uint32_t idx, TfLiteIntArray* dimensions) const;
-
-  template 
-  absl::Status ReadTensor(uint32_t idx, TensorT* t) const {
-    if (idx < 0 || idx >= node_->inputs->size) {
-      // If larger, this can be an older model with fewer input tensors than the
-      // current implementation.
-      return absl::OutOfRangeError("Invalid data index found.");
-    }
-    const int32_t tensor_idx = node_->inputs->data[idx];
-    if (tensor_idx < 0) {
-      return absl::InvalidArgumentError(
-          "Invalid data index found. Possibly an unset optional tensor is "
-          "being read.");
-    }
-
-    const TfLiteTensor* tflite_tensor = context_->tensors + tensor_idx;
-    t->data.resize(NumElements(tflite_tensor));
-    RETURN_IF_ERROR(CreateVectorCopyData(*tflite_tensor, &t->data[0]));
-
-    // Axis and data layout depend on operation this tensor is used in. So,
-    // postpone resolutions until operations are parsed.
-    t->id = tensor_idx;
-    return SetAllDimensions(tflite_tensor->dims, &t->shape);
-  }
-
-  absl::Status AddOutput(const Node* node, int id);
-
-  absl::Status AddOutputs(const Node* node);
-
-  absl::Status AddInput(const Node* node, uint32_t idx);
-
-  absl::Status AddUpdate(const Node* node, uint32_t idx);
-
-  TfLiteTensor* GetInputTensor(int index) const;
-
-  TfLiteTensor* GetOutputTensor(int index) const;
-
-  absl::Status VerifyInputsConstsOutputs(const TfLiteNode* node,
-                                         int runtime_inputs, int const_inputs,
-                                         int outputs);
-
- private:
-  GraphFloat32* graph_;
-  TfLiteContext* context_;
-  const TfLiteNode* node_;
-  absl::flat_hash_map* tensor_to_value_;
-  absl::flat_hash_map* quant_conversion_map_;
-};
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_OBJECT_READER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/operations.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/operations.h
deleted file mode 100644
index a93f63a..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/operations.h
+++ /dev/null
@@ -1,558 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_OPERATIONS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_OPERATIONS_H_
-
-#include 
-#include 
-#include 
-#include 
-
-#include "absl/types/variant.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.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"
-
-namespace tflite {
-namespace gpu {
-
-// Non exhaustive list of operations.
-enum class OperationType {
-  UNKNOWN = 0,
-  ABS,
-  ADD,
-  BATCH_TO_SPACE,
-  BATCH_NORMALIZATION,
-  BATCHED_MATMUL,
-  CONCAT,
-  CONST,
-  CONVOLUTION_2D,
-  CONVOLUTION_TRANSPOSED,
-  COPY,
-  COS,
-  DEPTHWISE_CONVOLUTION,
-  DIV,
-  ELU,
-  EQUAL,
-  EXP,
-  FULLY_CONNECTED,
-  GREATER,
-  GREATER_EQUAL,
-  HARD_SWISH,
-  LESS,
-  LESS_EQUAL,
-  LOG,
-  LSTM,
-  MAXIMUM,
-  MAX_UNPOOLING_2D,
-  MEAN,
-  MEAN_STDDEV_NORMALIZATION,
-  MINIMUM,
-  MUL,
-  NEG,
-  NOT_EQUAL,
-  PAD,
-  POOLING_2D,
-  POW,
-  PRELU,
-  // Used to accurately run inference on quantized models.
-  QUANTIZE_AND_DEQUANTIZE,
-  REDUCE_MAXIMUM,
-  REDUCE_MINIMUM,
-  REDUCE_PRODUCT,
-  REDUCE_SUM,
-  RELU,
-  RESHAPE,
-  RESIZE,
-  RSQRT,
-  SIGMOID,
-  SIN,
-  SLICE,
-  SOFTMAX,
-  SPACE_TO_BATCH,
-  SPACE_TO_DEPTH,
-  SQRT,
-  SQUARE,
-  SQUARED_DIFF,
-  SUB,
-  TANH,
-  TRANSPOSE,
-};
-
-std::string ToString(enum OperationType op);
-
-OperationType OperationTypeFromString(const std::string& name);
-
-typedef absl::variant,
-                      Tensor, float>
-    TensorOrScalar;
-
-struct Padding2D {
-  Padding2D() = default;
-  Padding2D& operator=(const Padding2D& value);
-  bool operator==(const Padding2D& value);
-  bool operator!=(const Padding2D& value);
-  Padding2D& operator-(const Padding2D& value);
-
-  // Padding values for every axis (if needed), where 'prepended' defines
-  // padding for the beginning of each axis and 'appended' represents end part
-  // of the corresponding axis.
-  HW prepended = HW(-1, -1);
-  HW appended = HW(-1, -1);
-};
-
-struct Padding3D {
-  Padding3D() = default;
-  Padding3D& operator=(const Padding3D& value);
-  bool operator==(const Padding3D& value);
-  bool operator!=(const Padding3D& value);
-  Padding3D& operator-(const Padding3D& value);
-
-  // Padding values for every axis (if needed), where 'prepended' defines
-  // padding for the beginning of each axis and 'appended' represents end part
-  // of the corresponding axis.
-  HWD prepended = HWD(0, 0, 0);
-  HWD appended = HWD(0, 0, 0);
-};
-
-struct Crop2D : public Padding2D {};
-
-struct SpaceToBatchAttributes {
-  HW block;
-  Padding2D padding;
-};
-
-struct BatchToSpaceAttributes {
-  HW block;
-  Crop2D crop;
-};
-
-enum class PoolingType {
-  UNDEFINED = 0,
-
-  // average pooling
-  AVERAGE = 1,
-
-  // max pooling
-  MAX = 2,
-};
-
-struct Pooling2DAttributes {
-  PoolingType type = PoolingType::UNDEFINED;
-  // Strides for every axis.
-  HW strides = HW(-1, -1);
-  HW kernel = HW(-1, -1);
-  Padding2D padding;
-  // NOTE(akulik): technically the number of outputs from Pooling node indicates
-  // whether indices are needed or not, but I decided to keep it inside
-  // attributes to simplify processing.
-  bool output_indices = false;
-};
-
-struct Pooling3DAttributes {
-  PoolingType type = PoolingType::UNDEFINED;
-  // Strides for every axis.
-  HWD strides = HWD(0, 0, 0);
-  HWD kernel = HWD(0, 0, 0);
-  Padding3D padding;
-  // NOTE(akulik): technically the number of outputs from Pooling node indicates
-  // whether indices are needed or not, but I decided to keep it inside
-  // attributes to simplify processing.
-  bool output_indices = false;
-};
-
-struct MaxUnpooling2DAttributes {
-  // Strides for every axis.
-  HW strides = HW(-1, -1);
-  HW kernel = HW(-1, -1);
-  Padding2D padding;
-};
-
-struct MaxUnpooling3DAttributes {
-  // Strides for every axis.
-  HWD strides = HWD(0, 0, 0);
-  HWD kernel = HWD(0, 0, 0);
-  Padding3D padding;
-};
-
-struct MeanAttributes {
-  // The vector of dimensions to calculate mean along.
-  std::set dims;
-};
-
-struct ConcatAttributes {
-  // Defines axis by which to concat on.
-  Axis axis = Axis::UNKNOWN;
-};
-
-// @return shape of a tensor after MaxUnpooling2D operation is applied to
-//         the given input.
-BHWC CalculateOutputShape(const BHWC& input,
-                          const MaxUnpooling2DAttributes& attr);
-
-// @return shape of a tensor after MaxUnpooling3D operation is applied to
-//         the given input.
-BHWDC CalculateOutputShape(const BHWDC& input,
-                           const MaxUnpooling3DAttributes& attr);
-
-// @return shape of a tensor after Pooling2D operation is applied to the given
-//         input.
-BHWC CalculateOutputShape(const BHWC& input, const Pooling2DAttributes& attr);
-
-// @return shape of a tensor after Pooling3D operation is applied to the given
-//         input.
-BHWDC CalculateOutputShape(const BHWDC& input, const Pooling3DAttributes& attr);
-
-// @return shape of a tensor after Concat operation is applied to the given
-//         input.
-absl::Status CalculateOutputShape(const std::vector& input,
-                                  const ConcatAttributes& attr,
-                                  BHWC* output_shape);
-
-// @return shape of a tensor after Concat operation is applied to the given
-//         input.
-absl::Status CalculateOutputShape(const std::vector& input,
-                                  const ConcatAttributes& attr,
-                                  BHWDC* output_shape);
-
-// @return padding for pooling operation to make sure output keep the same shape
-// as the given input.
-Padding2D CalculateSamePadding(const BHWC& input,
-                               const Pooling2DAttributes& attr);
-
-// @return padding for pooling operation to make sure output keep the same shape
-// as the given input.
-Padding3D CalculateSamePadding(const BHWDC& input,
-                               const Pooling3DAttributes& attr);
-
-// @return padding for max unpooling operation to make sure output keep the same
-// shape as the given input.
-Padding2D CalculateSamePadding(const BHWC& input,
-                               const MaxUnpooling2DAttributes& attr);
-
-// @return padding for max unpooling operation to make sure output keep the same
-// shape as the given input.
-Padding3D CalculateSamePadding(const BHWDC& input,
-                               const MaxUnpooling3DAttributes& attr);
-
-struct Convolution2DAttributes {
-  HW strides = HW(1, 1);    // Along each axis.
-  HW dilations = HW(1, 1);  // Along each axis.
-  Padding2D padding;
-
-  Tensor weights;
-  Tensor bias;  // optional
-};
-
-struct Convolution3DAttributes {
-  HWD strides = HWD(0, 0, 0);    // Along each axis.
-  HWD dilations = HWD(0, 0, 0);  // Along each axis.
-  Padding3D padding;
-
-  Tensor weights;
-  Tensor bias;  // optional
-};
-
-// @return shape of a tensor after Convolution2D operation is applied to
-//         the given input.
-BHWC CalculateOutputShape(const BHWC& input,
-                          const Convolution2DAttributes& attr);
-
-// @return shape of a tensor after Convolution3D operation is applied to
-//         the given input.
-BHWDC CalculateOutputShape(const BHWDC& input,
-                           const Convolution3DAttributes& attr);
-
-// @return padding for convolution operation to make sure output keep the same
-// shape as the given input.
-Padding2D CalculateSamePadding(const BHWC& input,
-                               const Convolution2DAttributes& attr);
-
-// @return padding for convolution operation to make sure output keep the same
-// shape as the given input.
-Padding3D CalculateSamePadding(const BHWDC& input,
-                               const Convolution3DAttributes& attr);
-
-struct ConvolutionTransposedAttributes {
-  HW stride = HW(1, 1);  // Along each axis.
-  HW adjacent;           // TODO(sorokin): No op on Flow.
-  Padding2D padding;
-
-  Tensor weights;
-  Tensor bias;  // optional
-};
-
-struct ConvolutionTransposed3DAttributes {
-  HWD stride = HWD(0, 0, 0);  // Along each axis.
-  Padding3D padding;
-
-  Tensor weights;
-  Tensor bias;  // optional
-};
-
-Padding2D CalculateSamePadding(const BHWC& input,
-                               const ConvolutionTransposedAttributes& attr);
-
-Padding3D CalculateSamePadding(const BHWDC& input,
-                               const ConvolutionTransposed3DAttributes& attr);
-
-// @return shape of a tensor after ConvolutionTransposed operation is applied to
-//         the given input.
-BHWC CalculateOutputShape(const BHWC& input,
-                          const ConvolutionTransposedAttributes& attr);
-
-// @return shape of a tensor after ConvolutionTransposed3D operation is applied
-// to
-//         the given input.
-BHWDC CalculateOutputShape(const BHWDC& input,
-                           const ConvolutionTransposed3DAttributes& attr);
-
-struct DepthwiseConvolution2DAttributes : public Convolution2DAttributes {};
-struct DepthwiseConvolution3DAttributes : public Convolution3DAttributes {};
-
-// @return shape of a tensor after DepthwiseConvolution2D operation is applied
-//         to the given input.
-BHWC CalculateOutputShape(const BHWC& input,
-                          const DepthwiseConvolution2DAttributes& attr);
-
-// @return shape of a tensor after DepthwiseConvolution3D operation is applied
-//         to the given input.
-BHWDC CalculateOutputShape(const BHWDC& input,
-                           const DepthwiseConvolution3DAttributes& attr);
-
-// @return padding for depthwise convolution operation to make sure output keep
-// the same shape as the given input.
-Padding2D CalculateSamePadding(const BHWC& input,
-                               const DepthwiseConvolution2DAttributes& attr);
-
-// @return padding for depthwise convolution operation to make sure output keep
-// the same shape as the given input.
-Padding3D CalculateSamePadding(const BHWDC& input,
-                               const DepthwiseConvolution3DAttributes& attr);
-
-// f(x):= {
-//   if x < 0  : x -> alpha * x
-//   if x >= 0 : x -> min(clip, x)
-// }
-//
-// Examples:
-//   - ReLU: clip = 0, alpha = 0
-//   - ReLU6: clip = 6, alpha = 0
-//   - Leaky ReLU: clip = 0, alpha = a
-struct ReLUAttributes {
-  // clip <= 0 mean it is not set.
-  float clip = 0;
-
-  float alpha = 0;
-};
-
-struct PReLUAttributes {
-  // clip <= 0 mean it is not set.
-  float clip = 0;
-
-  // If alpha is linear, then it is sharded across CHANNELS axis, otherwise
-  // full shape alpha is required.
-  absl::variant,
-                Tensor>
-      alpha;
-};
-
-struct ReduceAttributes {
-  Axis axis = Axis::UNKNOWN;
-};
-
-struct SoftmaxAttributes {
-  Axis axis = Axis::UNKNOWN;
-};
-
-enum LstmKernelType {
-  FULL = 0,
-  BASIC = 1,  // Currently, only basic is supported.
-};
-
-struct LstmAttributes {
-  LstmKernelType kernel_type = LstmKernelType::BASIC;
-};
-
-enum class SamplingType {
-  UNKNOWN = 0,
-  NEAREST = 1,
-  BILINEAR = 2,
-};
-
-struct Resize2DAttributes {
-  HW new_shape;
-
-  SamplingType type = SamplingType::UNKNOWN;
-
-  // If true, the centers of the 4 corner pixels of the input and output tensors
-  // are aligned, preserving the values at the corner pixels. Defaults to false.
-  bool align_corners = false;
-
-  bool half_pixel_centers = false;
-};
-
-// TODO(b/147771327): rename to Resize3D
-struct Resize3DAttributes {
-  HWD new_shape;
-
-  SamplingType type = SamplingType::NEAREST;
-
-  // If true, the centers of the 8 corner pixels of the input and output tensors
-  // are aligned, preserving the values at the corner pixels. Defaults to false.
-  bool align_corners = false;
-
-  bool half_pixel_centers = false;
-};
-
-float CalculateResizeScale(int32_t input_size, int32_t output_size,
-                           const Resize2DAttributes& attr);
-
-float CalculateResizeScale(int32_t input_size, int32_t output_size,
-                           const Resize3DAttributes& attr);
-
-// @return shape of a tensor after scale operation is applied to the given
-// input.
-BHWC CalculateOutputShape(const BHWC& input, const Resize2DAttributes& attr);
-
-// @return shape of a tensor after scale operation is applied to the given
-// input.
-BHWDC CalculateOutputShape(const BHWDC& input, const Resize3DAttributes& attr);
-
-enum class PaddingContentType {
-  ZEROS = 0,
-  REFLECT = 1,
-  EDGE = 2,
-};
-
-struct PadAttributes {
-  PaddingContentType type = PaddingContentType::ZEROS;
-
-  BHWC prepended;
-  BHWC appended;
-};
-
-// @return shape of a tensor after Pad operation is applied to the given input.
-BHWC CalculateOutputShape(const BHWC& input, const PadAttributes& attr);
-
-struct Pad3DAttributes {
-  PaddingContentType type = PaddingContentType::ZEROS;
-
-  BHWDC prepended;
-  BHWDC appended;
-};
-
-// @return shape of a tensor after Pad3D operation is applied to the given
-// input.
-BHWDC CalculateOutputShape(const BHWDC& input, const Pad3DAttributes& attr);
-
-struct ConstTensorAttributes {
-  Tensor tensor;
-};
-
-// Simple slicing without advanced support for shrinking, reverse slicing etc.
-struct SliceAttributes {
-  // Specifies start and end dimensions for slicing.
-  BHWC starts;
-  BHWC ends;
-
-  // Stride should be >= 1.
-  BHWC strides;
-};
-
-// @return shape of a tensor after Slice2D operation is applied to the given
-//         input.
-BHWC CalculateOutputShape(const BHWC& input, const SliceAttributes& attr);
-
-// Simple slicing without advanced support for shrinking, reverse slicing etc.
-struct Slice3DAttributes {
-  // Specifies start and end dimensions for slicing.
-  BHWDC starts;
-  BHWDC ends;
-
-  // Stride should be >= 1.
-  BHWDC strides;
-};
-
-// @return shape of a tensor after Slice3D operation is applied to the given
-//         input.
-BHWDC CalculateOutputShape(const BHWDC& input, const Slice3DAttributes& attr);
-
-struct FullyConnectedAttributes {
-  Tensor weights;
-  Tensor bias;
-};
-
-// @return shape of a tensor after FullyConnected operation is applied to
-// the given input.
-BHWC CalculateOutputShape(const BHWC& input,
-                          const FullyConnectedAttributes& attr);
-
-// @return shape of a tensor after Mean operation is applied to the given input.
-BHWC CalculateOutputShape(const BHWC& input, const MeanAttributes& attr);
-
-struct ElementwiseAttributes {
-  TensorOrScalar param;
-  // For elementwise operation with 2 inputs op(A, B), runtime_tensor_is_second
-  // true when runtime tensor is B(on second position). this is important for
-  // ops that non commutative, for example substract.
-  bool runtime_tensor_is_second = false;
-};
-
-struct ReshapeAttributes {
-  BHWC new_shape;
-};
-
-struct Reshape3DAttributes {
-  BHWDC new_shape;
-};
-
-struct TransposeAttributes {
-  // A permutation of the dimensions of input tensor
-  BHWC perm;
-};
-
-// @return shape of a tensor after Transpose operation is applied to
-// the given input.
-BHWC CalculateOutputShape(const BHWC& input, const TransposeAttributes& attr);
-
-struct Transpose3DAttributes {
-  // A permutation of the dimensions of input tensor
-  BHWDC perm;
-};
-
-// @return shape of a tensor after Transpose3D operation is applied to
-// the given input.
-BHWDC CalculateOutputShape(const BHWDC& input,
-                           const Transpose3DAttributes& attr);
-
-struct SpaceToDepthAttributes {
-  int block_size;
-};
-
-// These help perform a combination of Quantize & Dequantize to adjust float
-// values like quantized inference would.
-struct QuantizeAndDequantizeAttributes {
-  float min = 0;
-  float max = 0;
-  float scale = 0;
-};
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_OPERATIONS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/quantization_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/quantization_util.h
deleted file mode 100644
index 584f687..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/quantization_util.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_QUANTIZATION_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_QUANTIZATION_UTIL_H_
-
-#include 
-
-#include 
-
-#include "absl/container/flat_hash_map.h"
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-
-// Dequantizes input tensors pre-inference, leaving float tensors intact.
-// input_indices contains dequantized (fp32) outputs, that are used as
-// inputs to GPU delegate.
-// quant_conversion_map contains bidirectional mapping between dequantized
-// tensor and its original quantized one.
-absl::Status DequantizeInputs(
-    TfLiteContext* context, const std::vector& input_indices,
-    const absl::flat_hash_map& quant_conversion_map);
-
-absl::Status DequantizeInputs(
-    TfLiteContext* context, const std::vector& input_indices,
-    const absl::flat_hash_map& quant_conversion_map);
-
-// Quantizes output tensors post-inference, leaving float tensors intact.
-// output_indices contains (fp32) inputs to be quantized, which are outputs of
-// GPU delegate.
-// quant_conversion_map contains bidirectional mapping between dequantized
-// tensor and its original quantized one.
-absl::Status QuantizeOutputs(
-    TfLiteContext* context, const std::vector& output_indices,
-    const absl::flat_hash_map& quant_conversion_map);
-
-absl::Status QuantizeOutputs(
-    TfLiteContext* context, const std::vector& output_indices,
-    const absl::flat_hash_map& quant_conversion_map);
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_QUANTIZATION_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/shape.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/shape.h
deleted file mode 100644
index a017ff2..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/shape.h
+++ /dev/null
@@ -1,671 +0,0 @@
-/* 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_COMMON_SHAPE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_SHAPE_H_
-
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-namespace tflite {
-namespace gpu {
-
-enum class Axis {
-  UNKNOWN = 0,
-  CHANNELS = 1,
-  INPUT_CHANNELS = 2,
-  OUTPUT_CHANNELS = 3,
-  HEIGHT = 4,
-  WIDTH = 5,
-  BATCH = 6,
-  VALUE = 7,
-  DEPTH = 8,
-};
-
-std::string ToString(Axis t);
-
-// Layout represents axis order.
-enum class Layout {
-  UNKNOWN = 0,
-  SCALAR = 1,
-  LINEAR = 2,
-  HW = 3,
-  CHW = 4,
-  HWC = 5,
-  OIHW = 6,
-  OHWI = 7,
-  IHWO = 8,
-  IOHW = 9,
-  BHWC = 10,
-  HWDC = 11,
-  BHWDC = 12,
-  HWD = 13,
-  OHWDI = 14,
-};
-
-std::string ToString(Layout l);
-
-// Returns number of axis for the fixed layout.
-template 
-constexpr int Size();
-
-// Returns number of axis for the given layout.
-int Size(Layout layout);
-
-// Returns Axis for the given index and fixed layout.
-template 
-constexpr Axis GetAxis(int index);
-
-// Returns axis for the given layout and index.
-Axis GetAxis(Layout layout, int32_t index);
-
-// Returns axis index for the given axis and fixed layout.
-template 
-constexpr int GetAxisIndex(Axis axis);
-
-// Returns axis index for the given layout and axis.
-int GetAxisIndex(Layout layout, Axis axis);
-
-// Checks if fixed layout has given axis
-template 
-constexpr bool HasAxis(Axis axis);
-
-// Checks if given layout has given axis
-bool HasAxis(Layout layout, Axis axis);
-
-// Stores Layout(axis set and order) and value for dimensions.
-struct Shape {
-  Shape() : layout(Layout::UNKNOWN), dimensions() {}
-
-  explicit Shape(Layout t) : layout(t), dimensions(Size(t)) {}
-
-  Shape(Layout t, std::vector d)
-      : layout(t), dimensions(std::move(d)) {}
-
-  bool operator==(const Shape& other) const {
-    return (layout == other.layout) && (dimensions == other.dimensions);
-  }
-
-  bool operator!=(const Shape& other) const { return !operator==(other); }
-
-  // All methods below are matching same methods defined in StrongShape to
-  // make sure generic algorithms work both ways.
-
-  // Returns back a dimension or -1 if it is not found.
-  template 
-  int32_t get() const;
-  int32_t get(Axis axis) const;
-
-  template 
-  bool set(int32_t t);
-  bool set(Axis axis, int32_t t);
-
-  Axis axis(int index) const { return GetAxis(layout, index); }
-
-  int index(Axis axis) const { return GetAxisIndex(layout, axis); }
-
-  bool has(Axis axis) const { return HasAxis(layout, axis); }
-
-  int64_t DimensionsProduct() const {
-    return std::accumulate(dimensions.begin(), dimensions.end(), 1ll,
-                           std::multiplies());
-  }
-
-  Layout layout = Layout::UNKNOWN;
-
-  std::vector dimensions;
-};
-
-std::string ToString(const Shape& s);
-
-// StrongShape provides convenient explicit access to dimensions stored in
-// shape, e.g. StrongShape s; provides s.h and s.w accessors.
-//
-// There is a conversion possible both ways between Shape and StrongShape.
-//
-//   OIHW oihw;  // specific shape
-//   Shape l = oihw.ToShape();
-//
-//   OHWI other;  // notice not the same but compatible shape.
-//   if (!other.Adopt(l)) {
-//     // error handling
-//   }
-//
-// StrongShape supports the following set of operations:
-//
-//   // Returns number of axis in the shape class.
-//   static constexpr int size();
-//
-//   // Returns Axis for the given index or Axis::UNKNOWN if index
-//   // falls outside of the defined range in this shape.
-//   static constexpr Axis axis(int index);
-//
-//   // Returns index for the given axis or -1 if axis is not defined in this
-//   // shape.
-//   static constexpr int index(Axis axis);
-//
-//   // Getters
-//   int32_t get(int index) const;
-//   int32_t get(Axis axis) const;
-//   int32_t get() const;
-//
-//   // Setters that return false if set was not successful.
-//   bool set(int index, int32_t v);
-//   bool set(Axis axis, int32_t v);
-//   bool set(int32_t v);
-//
-//   // Returns shape's layout.
-//   static const Layout layout;
-//
-//   // Turns specific shape into generic shape.
-//   Shape ToShape() const;
-//
-//   // Copies all dimensions from the given shape.
-//   bool Adopt(const Shape&);
-//
-template 
-struct StrongShape;
-
-using Scalar = StrongShape;
-using Linear = StrongShape;
-using HW = StrongShape;
-using HWD = StrongShape;
-
-// Common tensor shape for CNN models working with images.
-using CHW = StrongShape;
-using HWC = StrongShape;
-using HWDC = StrongShape;
-using BHWC = StrongShape;
-using BHWDC = StrongShape;
-
-// Tensor shape used in convolution_2d weights.
-using OIHW = StrongShape;
-using OHWI = StrongShape;
-using IHWO = StrongShape;
-using IOHW = StrongShape;
-
-// Tensor shape used in convolution_3d weights.
-using OHWDI = StrongShape;
-
-// -----------------------------------------------------------------------------
-// Everything below are internal implementation details.
-// -----------------------------------------------------------------------------
-
-namespace internal_shape {
-
-template 
-struct AxisTraits;
-
-#define TFLITE_GPU_AXIS_TRAITS(AxisName, HolderName)    \
-  template <>                                           \
-  struct AxisTraits {                   \
-    struct Holder {                                     \
-      int32_t HolderName;                               \
-                                                        \
-     protected:                                         \
-      int32_t operator()() const { return HolderName; } \
-      void operator()(int32_t v) { HolderName = v; }    \
-    };                                                  \
-                                                        \
-    using dimension_holder_type = Holder;               \
-  }
-
-TFLITE_GPU_AXIS_TRAITS(CHANNELS, c);
-TFLITE_GPU_AXIS_TRAITS(HEIGHT, h);
-TFLITE_GPU_AXIS_TRAITS(WIDTH, w);
-TFLITE_GPU_AXIS_TRAITS(INPUT_CHANNELS, i);
-TFLITE_GPU_AXIS_TRAITS(OUTPUT_CHANNELS, o);
-TFLITE_GPU_AXIS_TRAITS(BATCH, b);
-TFLITE_GPU_AXIS_TRAITS(VALUE, v);
-TFLITE_GPU_AXIS_TRAITS(DEPTH, d);
-
-#undef TFLITE_GPU_AXIS_TRAITS
-
-template 
-struct StrongShapeImpl;
-
-template 
-struct StrongShapeImpl {
-  static constexpr int size() { return N; }
-
-  static constexpr Axis axis(int) { return Axis::UNKNOWN; }
-
-  static constexpr int index(Axis) { return -1; }
-
-  static constexpr bool has(Axis) { return false; }
-
-  int32_t get(Axis) const { return -1; }
-
-  int32_t get(int) const { return -1; }
-
-  template 
-  int32_t get() const {
-    return -1;
-  }
-
-  bool set(Axis, int32_t) { return false; }
-
-  bool set(int, int32_t) { return false; }
-
-  template 
-  bool set(int32_t) {
-    return false;
-  }
-};
-
-// Used to deduce number of axis, and to be a child of a proper holder to
-// provide access to the dimension by name
-template 
-struct StrongShapeImpl
-    : public AxisTraits::dimension_holder_type,
-      public StrongShapeImpl {
-  using dimension_holder_type = typename AxisTraits::dimension_holder_type;
-
-  using rest_type = StrongShapeImpl;
-
-  StrongShapeImpl() : dimension_holder_type{0}, rest_type() {}
-
-  template 
-  explicit StrongShapeImpl(int32_t t, Ts... ts)
-      : dimension_holder_type{t}, rest_type(ts...) {}
-
-  static constexpr Axis axis(int index) {
-    return index == N ? A : rest_type::axis(index);
-  }
-
-  static constexpr int index(Axis axis) {
-    return axis == A ? N : rest_type::index(axis);
-  }
-
-  static constexpr bool has(Axis axis) {
-    return axis == A ? true : rest_type::has(axis);
-  }
-
-  int32_t get(Axis axis) const {
-    return axis == A ? dimension_holder_type::operator()()
-                     : rest_type::get(axis);
-  }
-
-  template 
-  int32_t get() const {
-    return B == A ? dimension_holder_type::operator()()
-                  : rest_type::template get();
-  }
-
-  int32_t get(int index) const {
-    return index == N ? dimension_holder_type::operator()()
-                      : rest_type::get(index);
-  }
-
-  bool set(Axis axis, int32_t t) {
-    if (axis == A) {
-      dimension_holder_type::operator()(t);
-      return true;
-    }
-    return rest_type::set(axis, t);
-  }
-
-  bool set(int index, int32_t t) {
-    if (index == N) {
-      dimension_holder_type::operator()(t);
-      return true;
-    }
-    return rest_type::set(index, t);
-  }
-
-  template 
-  bool set(int32_t t) {
-    if (A == B) {
-      dimension_holder_type::operator()(t);
-      return true;
-    }
-    return rest_type::template set(t);
-  }
-};
-
-template 
-struct LayoutTraits;
-
-#define TFLITE_GPU_LAYOUT_TRAITS(LayoutName, ...)              \
-  template <>                                                  \
-  struct LayoutTraits {                    \
-    using strong_shape_type = StrongShapeImpl<0, __VA_ARGS__>; \
-  }
-
-TFLITE_GPU_LAYOUT_TRAITS(HW, Axis::HEIGHT, Axis::WIDTH);
-TFLITE_GPU_LAYOUT_TRAITS(HWD, Axis::HEIGHT, Axis::WIDTH, Axis::DEPTH);
-TFLITE_GPU_LAYOUT_TRAITS(OHWI, Axis::OUTPUT_CHANNELS, Axis::HEIGHT, Axis::WIDTH,
-                         Axis::INPUT_CHANNELS);
-TFLITE_GPU_LAYOUT_TRAITS(OIHW, Axis::OUTPUT_CHANNELS, Axis::INPUT_CHANNELS,
-                         Axis::HEIGHT, Axis::WIDTH);
-TFLITE_GPU_LAYOUT_TRAITS(IOHW, Axis::INPUT_CHANNELS, Axis::OUTPUT_CHANNELS,
-                         Axis::HEIGHT, Axis::WIDTH);
-TFLITE_GPU_LAYOUT_TRAITS(IHWO, Axis::INPUT_CHANNELS, Axis::HEIGHT, Axis::WIDTH,
-                         Axis::OUTPUT_CHANNELS);
-TFLITE_GPU_LAYOUT_TRAITS(CHW, Axis::CHANNELS, Axis::HEIGHT, Axis::WIDTH);
-TFLITE_GPU_LAYOUT_TRAITS(HWC, Axis::HEIGHT, Axis::WIDTH, Axis::CHANNELS);
-TFLITE_GPU_LAYOUT_TRAITS(HWDC, Axis::HEIGHT, Axis::WIDTH, Axis::DEPTH,
-                         Axis::CHANNELS);
-TFLITE_GPU_LAYOUT_TRAITS(LINEAR, Axis::VALUE);
-TFLITE_GPU_LAYOUT_TRAITS(SCALAR, Axis::VALUE);
-TFLITE_GPU_LAYOUT_TRAITS(BHWC, Axis::BATCH, Axis::HEIGHT, Axis::WIDTH,
-                         Axis::CHANNELS);
-TFLITE_GPU_LAYOUT_TRAITS(BHWDC, Axis::BATCH, Axis::HEIGHT, Axis::WIDTH,
-                         Axis::DEPTH, Axis::CHANNELS);
-TFLITE_GPU_LAYOUT_TRAITS(OHWDI, Axis::OUTPUT_CHANNELS, Axis::HEIGHT,
-                         Axis::WIDTH, Axis::DEPTH, Axis::INPUT_CHANNELS);
-
-#undef TFLITE_GPU_LAYOUT_TRAITS
-
-template <>
-struct LayoutTraits {
-  using strong_shape_type = StrongShapeImpl<0>;
-};
-
-template 
-struct DimensionGetterFixedAxisFunc {
-  template 
-  int32_t operator()() const {
-    constexpr int i = GetAxisIndex(A);
-    return i >= 0 && i < l->dimensions.size() ? l->dimensions[i] : -1;
-  }
-  const Shape* l;
-};
-
-struct DimensionGetterFunc {
-  template 
-  int32_t operator()() const {
-    int i = GetAxisIndex(axis);
-    return i >= 0 && i < l->dimensions.size() ? l->dimensions[i] : -1;
-  }
-  Axis axis;
-  const Shape* l;
-};
-
-template 
-struct DimensionSetterFixedAxisFunc {
-  template 
-  bool operator()() const {
-    constexpr int i = GetAxisIndex(A);
-    if (i >= 0 && i < l->dimensions.size()) {
-      l->dimensions[i] = v;
-      return true;
-    }
-    return false;
-  }
-  Shape* l;
-  int32_t v;
-};
-
-struct DimensionSetterFunc {
-  template 
-  bool operator()() const {
-    int i = GetAxisIndex(axis);
-    if (i >= 0 && i < l->dimensions.size()) {
-      l->dimensions[i] = v;
-      return true;
-    }
-    return false;
-  }
-  Axis axis;
-  Shape* l;
-  int32_t v;
-};
-
-template 
-struct ToShapeFunc {
-  template 
-  bool operator()() const {
-    for (int i = 0; i < StrongShape::size(); ++i) {
-      int index = GetAxisIndex(StrongShape::axis(i));
-      if (index < 0) return false;
-      shape->set(i, l.dimensions[index]);
-    }
-    return true;
-  }
-
-  StrongShape* shape;
-  const Shape& l;
-};
-
-}  // namespace internal_shape
-
-// template 
-template 
-struct StrongShape : public internal_shape::LayoutTraits::strong_shape_type {
-  using strong_shape_type =
-      typename internal_shape::LayoutTraits::strong_shape_type;
-  StrongShape() = default;
-
-  template 
-  explicit StrongShape(Ts... t) : strong_shape_type(t...) {}
-
-  constexpr static Layout layout = L;
-
-  bool operator==(const StrongShape& shape) const {
-    // TODO(akulik): implement better alternative.
-    return this->ToShape() == shape.ToShape();
-  }
-
-  bool operator!=(const StrongShape& shape) const {
-    // TODO(akulik): implement better alternative.
-    return this->ToShape() != shape.ToShape();
-  }
-  bool empty() const { return DimensionsProduct() == 0; }
-
-  // Turns StrongShape into generic shape.
-  Shape ToShape() const {
-    std::vector dimensions(StrongShape::size());
-    for (int i = 0; i < StrongShape::size(); ++i) {
-      dimensions[i] = StrongShape::get(i);
-    }
-    return Shape(L, std::move(dimensions));
-  }
-
-  // @return all dimensions multiplied
-  int64_t DimensionsProduct() const {
-    int64_t product = 1;
-    for (int i = 0; i < StrongShape::size(); ++i) {
-      product *= StrongShape::get(i);
-    }
-    return product;
-  }
-
-  // Translates given coordinates of the layout into a linear index assuming
-  // dimensions are sorted in tensor access order e.g. if you access
-  // foobar[i][j][k] order of coordinates should be i,j,k.
-  int64_t LinearIndex(
-      const std::array& coordinates) const {
-    int64_t index = coordinates[0];
-    for (int i = 1; i < StrongShape::size(); ++i) {
-      index = index * StrongShape::get(i) + coordinates[i];
-    }
-    return index;
-  }
-
-  // Copies all dimensions from the given generic shape into specific shape.
-  // It requires shape to have all axis defined in the given
-  // StrongShape. For example:
-  //   - If this shape is OHWI but given shape is OIHW, Adopt will copy all
-  //     dimensions and return true.
-  //   - If this shape is OIHW but input shape is HW, Adopt will copy H and W
-  //     dimensions and return true, but if this shape is HW and given shape
-  //     OIHW, then Adopt will return false because not all axis are present in
-  //     the input shape.
-  //
-  // @return false if generic shape is not compatible.
-  bool Adopt(const Shape& shape) {
-    return DispatchByLayout(shape.layout,
-                            internal_shape::ToShapeFunc{this, shape});
-  }
-
-  // For all axis defined in a given shape copies values to this shape.
-  // Therefore, it is possible to copy dimensions from CHW to BCHW, but not
-  // the other way around.
-  //
-  // BCHW bchw;
-  // CHW chw;
-  // bchw.CopyAllGivenAxis(chw);  --> true
-  // chw.CopyAllGivenAxis(bchw);  --> false
-  //
-  // @return false if axis in source shape is not defined here, thus value
-  //         was not copied.
-  template 
-  bool CopyAllGivenAxis(const StrongShape& source) {
-    for (int i = 0; i < source.size(); ++i) {
-      if (!StrongShape::set(source.axis(i), source.get(i))) {
-        return false;
-      }
-    }
-    return true;
-  }
-
-  // For all axis defined in this shape copies values from the given shape.
-  //
-  // BCHW bchw;
-  // CHW chw;
-  // bchw.CopyAllDefinedAxis(chw);  --> false
-  // chw.CopyAllDefinedAxis(bchw);  --> true
-  //
-  // @return false if given shape does not have axis defined here,
-  //         therefore a value was not copied.
-  template 
-  bool CopyAllDefinedAxis(const StrongShape& source) {
-    for (int i = 0; i < StrongShape::size(); ++i) {
-      int source_index = source.index(StrongShape::axis(i));
-      if (source_index < 0) {
-        return false;
-      }
-      StrongShape::set(i, source.get(source_index));  // always true
-    }
-    return true;
-  }
-
-  // Copies values only for matching axis.
-  template 
-  void CopyMatchingAxis(const StrongShape& source) {
-    for (int i = 0; i < StrongShape::size(); ++i) {
-      StrongShape::set(source.axis(i), source.get(i));
-    }
-  }
-
-  // AbslHash function for using in flat hash containers.
-  template 
-  friend H AbslHashValue(H hash_state, const StrongShape& strong_shape) {
-    for (size_t i = 0; i < strong_shape.size(); ++i) {
-      hash_state = H::combine(std::move(hash_state), strong_shape.get(i));
-    }
-    return hash_state;
-  }
-};
-
-template 
-inline std::string ToString(const StrongShape& s) {
-  return ToString(s.ToShape());
-}
-
-template 
-constexpr Layout StrongShape::layout;
-
-template 
-auto DispatchByLayout(Layout type, F f)
-    -> decltype(f.template operator()()) {
-  switch (type) {
-    case Layout::HW:
-      return f.template operator()();
-    case Layout::HWD:
-      return f.template operator()();
-    case Layout::HWC:
-      return f.template operator()();
-    case Layout::HWDC:
-      return f.template operator()();
-    case Layout::CHW:
-      return f.template operator()();
-    case Layout::OIHW:
-      return f.template operator()();
-    case Layout::IOHW:
-      return f.template operator()();
-    case Layout::OHWI:
-      return f.template operator()();
-    case Layout::IHWO:
-      return f.template operator()();
-    case Layout::LINEAR:
-      return f.template operator()();
-    case Layout::SCALAR:
-      return f.template operator()();
-    case Layout::BHWC:
-      return f.template operator()();
-    case Layout::BHWDC:
-      return f.template operator()();
-    case Layout::OHWDI:
-      return f.template operator()();
-    case Layout::UNKNOWN:
-      return f.template operator()();
-  }
-}
-
-template 
-constexpr int Size() {
-  return StrongShape::size();
-}
-
-template 
-constexpr Axis GetAxis(int index) {
-  return StrongShape::axis(index);
-}
-
-template 
-constexpr int GetAxisIndex(Axis axis) {
-  return StrongShape::index(axis);
-}
-
-template 
-constexpr bool HasAxis(Axis axis) {
-  return StrongShape::has(axis);
-}
-
-template 
-inline int32_t Shape::get() const {
-  return DispatchByLayout(
-      layout, internal_shape::DimensionGetterFixedAxisFunc{this});
-}
-
-inline int32_t Shape::get(Axis axis) const {
-  return DispatchByLayout(layout,
-                          internal_shape::DimensionGetterFunc{axis, this});
-}
-
-template 
-inline bool Shape::set(int32_t t) {
-  return DispatchByLayout(
-      layout, internal_shape::DimensionSetterFixedAxisFunc{this, t});
-}
-
-inline bool Shape::set(Axis axis, int32_t t) {
-  return DispatchByLayout(layout,
-                          internal_shape::DimensionSetterFunc{axis, this, t});
-}
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_SHAPE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/status.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/status.h
deleted file mode 100644
index 22dcc11..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/status.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_STATUS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_STATUS_H_
-
-#include "absl/status/status.h"  // IWYU pragma: export
-#define RETURN_IF_ERROR(s) {auto c=(s);if(!c.ok())return c;}         // IWYU pragma: export
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_STATUS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/tensor.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/tensor.h
deleted file mode 100644
index ba0fd48..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/tensor.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* 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_COMMON_TENSOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TENSOR_H_
-
-#include 
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-
-namespace tflite {
-namespace gpu {
-namespace internal_tensor {
-
-// Meta function given element type returns a type for Tensor data container.
-template 
-struct StorageType;
-
-template <>
-struct StorageType {
-  using value = std::vector;
-};
-
-template <>
-struct StorageType {
-  using value = std::vector;
-};
-
-}  // namespace internal_tensor
-
-template 
-struct Tensor {
-  using ShapeType = ShapeT;
-
-  constexpr static DataType kType = Type;
-
-  using TensorStorageType = typename internal_tensor::StorageType::value;
-
-  // Opaque id of a tensor.
-  int64_t id = -1;
-
-  ShapeType shape;
-
-  TensorStorageType data;
-};
-
-// TensorRef is a reference to another tensor. If an object should never hold
-// tensor data, then TensorRef should be used instead.
-template 
-struct TensorRef {
-  using ShapeType = ShapeT;
-
-  DataType type = DataType::UNKNOWN;
-
-  ShapeT shape;
-
-  // Opaque reference to a tensor. Upstream component is responsible for
-  // resolving this reference into an actual tensor.
-  int64_t ref = -1;
-
-  // Specifies if the tensor should be a variable input tensor that must be an
-  // output as well as an input to the graph.
-  bool is_variable_input = false;
-};
-
-template 
-constexpr DataType Tensor::kType;
-
-template 
-Tensor MakeZeroTensor(const ShapeT& shape) {
-  Tensor tensor;
-  tensor.shape = shape;
-  tensor.data = typename Tensor::TensorStorageType(
-      shape.DimensionsProduct(), 0);
-  return tensor;
-}
-
-using TensorFloat32 = Tensor;
-using Tensor5DFloat32 = Tensor;
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TENSOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/feature_parity/feature_parity.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/feature_parity/feature_parity.h
deleted file mode 100644
index dacb486..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/feature_parity/feature_parity.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_FEATURE_PARITY_FEATURE_PARITY_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_FEATURE_PARITY_FEATURE_PARITY_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/testing/feature_parity/generators/add.h"
-#include "tensorflow/lite/delegates/gpu/common/testing/feature_parity/utils.h"
-
-namespace tflite {
-
-// Specifies the common ops feature parity for all gpu delegates. NameModel
-// structure stores the model name and model itself.
-inline std::vector GetFeatureParity() {
-  return {Add2SameShapeTensors(), AddBroadcast()};
-}
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_FEATURE_PARITY_FEATURE_PARITY_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/feature_parity/generators/add.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/feature_parity/generators/add.h
deleted file mode 100644
index 228fd4b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/feature_parity/generators/add.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_FEATURE_PARITY_GENERATORS_ADD_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_FEATURE_PARITY_GENERATORS_ADD_H_
-
-#include "tensorflow/lite/delegates/gpu/common/testing/feature_parity/utils.h"
-
-namespace tflite {
-
-TestParams Add2SameShapeTensors();
-TestParams AddBroadcast();
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_FEATURE_PARITY_GENERATORS_ADD_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/feature_parity/utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/feature_parity/utils.h
deleted file mode 100644
index 20d43b8..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/feature_parity/utils.h
+++ /dev/null
@@ -1,223 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_FEATURE_PARITY_UTILS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_FEATURE_PARITY_UTILS_H_
-
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include "absl/status/status.h"
-#include "absl/types/span.h"
-#include "tensorflow/lite/interpreter.h"
-#include "tensorflow/lite/model.h"
-#include "tensorflow/lite/string_type.h"
-
-namespace tflite {
-
-// These two functions implement usability printing for TfLiteTensor dimensions
-// and coordinates. By default dimensions are interpreted depending on the size:
-// 1:Linear, 2:HW, 3: HWC, 4:BHWC. If there are more than 4 dimensions,
-// absl::nullopt will be returned.
-absl::optional ShapeToString(TfLiteIntArray* shape);
-absl::optional CoordinateToString(TfLiteIntArray* shape,
-                                               int linear);
-
-template 
-class TensorEqMatcher {
- public:
-  TensorEqMatcher(const TupleMatcher& tuple_matcher, const TfLiteTensor& rhs)
-      : tuple_matcher_(tuple_matcher), rhs_(rhs) {}
-
-  // Make TensorEqMatcher movable only (The copy operations are implicitly
-  // deleted).
-  TensorEqMatcher(TensorEqMatcher&& other) = default;
-  TensorEqMatcher& operator=(TensorEqMatcher&& other) = default;
-
-  template 
-  operator testing::Matcher() const {  // NOLINT
-    return testing::Matcher(new Impl(tuple_matcher_, rhs_));
-  }
-
-  class Impl : public testing::MatcherInterface {
-   public:
-    typedef ::std::tuple InnerMatcherArg;
-
-    Impl(const TupleMatcher& tuple_matcher, const TfLiteTensor& rhs)
-        : mono_tuple_matcher_(
-              testing::SafeMatcherCast(tuple_matcher)),
-          rhs_(rhs) {}
-
-    // Make Impl movable only (The copy operations are implicitly deleted).
-    Impl(Impl&& other) = default;
-    Impl& operator=(Impl&& other) = default;
-
-    // Define what gtest framework will print for the Expected field.
-    void DescribeTo(std::ostream* os) const override {
-      std::string shape;
-      absl::optional result = ShapeToString(rhs_.dims);
-      if (result.has_value()) {
-        shape = std::move(result.value());
-      } else {
-        shape = "[error: unsupported number of dimensions]";
-      }
-      *os << "tensor which has the shape of " << shape
-          << ", where each value and its corresponding expected value ";
-      mono_tuple_matcher_.DescribeTo(os);
-    }
-
-    bool MatchAndExplain(
-        TfLiteTensor lhs,
-        testing::MatchResultListener* listener) const override {
-      // 1. Check that TfLiteTensor data type is supported.
-      // Support for other data types will be added on demand.
-      if (lhs.type != kTfLiteFloat32 || rhs_.type != kTfLiteFloat32) {
-        *listener << "which data type is not float32, which is not currently "
-                     "supported.";
-        return false;
-      }
-
-      // 2. Check that dimensions' sizes match. Otherwise, we are not able to
-      // compare tensors.
-      if (lhs.dims->size != rhs_.dims->size) {
-        *listener << "which is different from the expected shape of size "
-                  << rhs_.dims->size;
-        return false;
-      }
-      // 3. Check that dimensions' values are equal as well. We are not able to
-      // compare tensors of different shapes, even if the total elements count
-      // matches.
-      bool dims_are_equal = true;
-      for (int i = 0; i < lhs.dims->size; i++) {
-        dims_are_equal &= lhs.dims->data[i] == rhs_.dims->data[i];
-      }
-      if (!dims_are_equal) {
-        std::string shape;
-        absl::optional result = ShapeToString(rhs_.dims);
-        if (result.has_value()) {
-          shape = std::move(result.value());
-        } else {
-          shape = "[error: unsupported number of dimensions]";
-        }
-        *listener << "which is different from the expected shape " << shape;
-        return false;
-      }
-
-      // 4. Proceed to data comparison. Iterate through elements as they lay
-      // flat. If some pair of elements don't match, deduct the coordinate
-      // basing on the dimensions, then return.
-      absl::Span lhs_span(lhs.data.f, lhs.bytes / sizeof(float));
-      absl::Span rhs_span(rhs_.data.f, rhs_.bytes / sizeof(float));
-
-      auto left = lhs_span.begin();
-      auto right = rhs_span.begin();
-      for (size_t i = 0; i != lhs_span.size(); ++i, ++left, ++right) {
-        if (listener->IsInterested()) {
-          testing::StringMatchResultListener inner_listener;
-          if (!mono_tuple_matcher_.MatchAndExplain({*left, *right},
-                                                   &inner_listener)) {
-            *listener << "where the value pair (";
-            testing::internal::UniversalPrint(*left, listener->stream());
-            *listener << ", ";
-            testing::internal::UniversalPrint(*right, listener->stream());
-            std::string coordinate;
-            absl::optional result =
-                CoordinateToString(lhs.dims, i);
-            if (result.has_value()) {
-              coordinate = std::move(result.value());
-            } else {
-              coordinate = "[error: unsupported number of dimensions]";
-            }
-            *listener << ") with coordinate " << coordinate << " don't match";
-            testing::internal::PrintIfNotEmpty(inner_listener.str(),
-                                               listener->stream());
-            return false;
-          }
-        } else {
-          if (!mono_tuple_matcher_.Matches({*left, *right})) return false;
-        }
-      }
-
-      return true;
-    }
-
-   private:
-    const testing::Matcher mono_tuple_matcher_;
-    const TfLiteTensor rhs_;
-  };
-
- private:
-  const TupleMatcher tuple_matcher_;
-  const TfLiteTensor rhs_;
-};
-
-// Builds interpreter for a model, allocates tensors.
-absl::Status BuildInterpreter(const Model* model,
-                              std::unique_ptr* interpreter);
-
-// Allocates tensors for a given interpreter.
-absl::Status AllocateTensors(std::unique_ptr* interpreter);
-
-// Modifies graph with given delegate.
-absl::Status ModifyGraphWithDelegate(std::unique_ptr* interpreter,
-                                     TfLiteDelegate* delegate);
-
-// Initializes inputs with consequent values of some fixed range.
-void InitializeInputs(int left, int right,
-                      std::unique_ptr* interpreter);
-
-// Invokes a prebuilt interpreter.
-absl::Status Invoke(std::unique_ptr* interpreter);
-
-// Usability structure, which is used to pass parameters data to parametrized
-// tests.
-struct TestParams {
-  // A gtest name, which will be used for a generated tests.
-  std::string name;
-
-  // Function, which returns a TFLite model, associated with this test name.
-  std::vector model;
-};
-
-// Defines how the TestParams should be printed into the command line if
-// something fails during testing.
-std::ostream& operator<<(std::ostream& os, const TestParams& param);
-
-}  // namespace tflite
-
-// Gtest framework uses this function to describe TfLiteTensor if something
-// fails. TfLiteTensor is defined in global namespace, same should be done for
-// streaming operator.
-std::ostream& operator<<(std::ostream& os, const TfLiteTensor& tensor);
-
-// Defines a matcher to compare two TfLiteTensors pointwise using the given
-// tuple matcher for comparing their values.
-template 
-inline tflite::TensorEqMatcher TensorEq(
-    const TupleMatcherT& matcher, const TfLiteTensor& rhs) {
-  return tflite::TensorEqMatcher(matcher, rhs);
-}
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_FEATURE_PARITY_UTILS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/interpreter_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/interpreter_utils.h
deleted file mode 100644
index 86656ab..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/interpreter_utils.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* 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_COMMON_TESTING_INTERPRETER_UTILS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_INTERPRETER_UTILS_H_
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/core/api/op_resolver.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/tensor.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-namespace gpu {
-namespace testing {
-
-// Runs Tensorflow Lite model using Tensorflow Lite with a delegate and
-// an appropriate operations resolver. If delegate is nullptr, inference will
-// be done only on CPU.
-absl::Status InterpreterInvokeWithOpResolver(
-    const ::tflite::Model* model, TfLiteDelegate* delegate,
-    const OpResolver& op_resolver, const std::vector& inputs,
-    std::vector* outputs);
-
-// Runs Tensorflow Lite model using Tensorflow Lite with a delegate and
-// builtin operations resolver. If delegate is nullptr, inference will
-// be done only on CPU.
-absl::Status InterpreterInvoke(const ::tflite::Model* model,
-                               TfLiteDelegate* delegate,
-                               const std::vector& inputs,
-                               std::vector* outputs);
-
-}  // namespace testing
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_INTERPRETER_UTILS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/tflite_model_reader.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/tflite_model_reader.h
deleted file mode 100644
index 1a22508..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/testing/tflite_model_reader.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_TFLITE_MODEL_READER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_TFLITE_MODEL_READER_H_
-
-#include "tensorflow/lite/core/api/op_resolver.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/model_builder.h"
-
-namespace tflite {
-namespace gpu {
-
-// Generates GraphFloat32 basing on the FlatBufferModel without specifying a
-// delegate.
-absl::Status BuildFromFlatBuffer(const tflite::FlatBufferModel& flatbuffer,
-                                 const tflite::OpResolver& op_resolver,
-                                 GraphFloat32* graph);
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TESTING_TFLITE_MODEL_READER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/add_bias.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/add_bias.h
deleted file mode 100644
index 1523c41..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/add_bias.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 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_COMMON_TRANSFORMATIONS_ADD_BIAS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_ADD_BIAS_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-
-namespace tflite {
-namespace gpu {
-
-// Makes optional bias(Conv/Deconv and etc) as not optional(always present)
-std::unique_ptr NewAddBias();
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_ADD_BIAS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/add_quant_adjustments.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/add_quant_adjustments.h
deleted file mode 100644
index 6eb4aaa..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/add_quant_adjustments.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_ADD_QUANT_ADJUSTMENTS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_ADD_QUANT_ADJUSTMENTS_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-
-namespace tflite {
-namespace gpu {
-
-// This pass is used to support inference on quantized models with the GPU
-// delegate.
-//
-// When delegating quantized models, we still run float-point inference on GPU
-// under-the-hood. This is done by dequantizing inputs (at runtime) & constants
-// (during delegation).
-// However, intermediate tensors can still deviate from the original quantized
-// inference, since activations may not follow the attributes set by the
-// original quantizion parameters.
-// To prevent this, we add "QuantizeAndDequantize" nodes for each node-output
-// that was originally fixed-point:
-// op1 -> op2
-// becomes
-// op1 -> QuantizeAndDequantize -> op2
-std::unique_ptr NewAddQuantAdjustments();
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_ADD_QUANT_ADJUSTMENTS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/fuse_add_to_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/fuse_add_to_conv.h
deleted file mode 100644
index 26f93dc..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/fuse_add_to_conv.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* 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_COMMON_TRANSFORMATIONS_FUSE_ADD_TO_CONV_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_FUSE_ADD_TO_CONV_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-
-namespace tflite {
-namespace gpu {
-
-// Fuse Add Scalar or Add Broadcast after Convolution(Convolution2D,
-// DepthWise, TransposedConvolution, FullyConnected) into biases of
-// convolution.
-std::unique_ptr NewMergeConvolutionWithAdd();
-
-// Modify Convolution2DAttributes so that after making convolution with
-// modified attributes we will have the same result as convolution
-// with old attributes and following add operation.
-void FuseConvolution2DWithAdd(const ElementwiseAttributes& add_attr,
-                              Convolution2DAttributes* attr);
-
-// Modify DepthwiseConvolution2DAttributes so that after making depth wise
-// convolution with modified attributes we will have the same result as depth
-// wise convolution with old attributes and following add operation.
-void FuseDepthwiseConvolution2DWithAdd(const ElementwiseAttributes& add_attr,
-                                       DepthwiseConvolution2DAttributes* attr);
-
-// Modify ConvolutionTransposedAttributes so that after making convolution
-// transposed with modified attributes we will have the same result as
-// convolution transposed with old attributes and following add operation.
-void FuseConvolutionTransposedWithAdd(const ElementwiseAttributes& add_attr,
-                                      ConvolutionTransposedAttributes* attr);
-
-// Modify FullyConnectedAttributes so that after making fully connected with
-// modified attributes we will have the same result as fully connected
-// with old attributes and following add operation.
-void FuseFullyConnectedWithAdd(const ElementwiseAttributes& add_attr,
-                               FullyConnectedAttributes* attr);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_FUSE_ADD_TO_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/fuse_mul_to_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/fuse_mul_to_conv.h
deleted file mode 100644
index 92fab45..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/fuse_mul_to_conv.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* 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_COMMON_TRANSFORMATIONS_FUSE_MUL_TO_CONV_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_FUSE_MUL_TO_CONV_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-
-namespace tflite {
-namespace gpu {
-
-// Fuse Multiply Scalar or Multiply Broadcast after Convolution(Convolution2D,
-// DepthWise, TransposedConvolution, FullyConnected) into weights and biases of
-// convolution.
-std::unique_ptr NewMergeConvolutionWithMul();
-
-// Fuse Multiply Scalar or Multiply Broadcast before Convolution(Convolution2D,
-// DepthWise, TransposedConvolution, FullyConnected) into weights and biases of
-// convolution.
-std::unique_ptr NewMergeMulWithConvolution();
-
-// Modify Convolution2DAttributes so that after making convolution with
-// modified attributes we will have the same result as convolution
-// with old attributes and following multiply operation.
-void FuseConvolution2DWithMultiply(const ElementwiseAttributes& mul_attr,
-                                   Convolution2DAttributes* attr);
-
-// Modify DepthwiseConvolution2DAttributes so that after making depth wise
-// convolution with modified attributes we will have the same result as depth
-// wise convolution with old attributes and following multiply operation.
-void FuseDepthwiseConvolution2DWithMultiply(
-    const ElementwiseAttributes& mul_attr,
-    DepthwiseConvolution2DAttributes* attr);
-
-// Modify ConvolutionTransposedAttributes so that after making convolution
-// transposed with modified attributes we will have the same result as
-// convolution transposed with old attributes and following multiply operation.
-void FuseConvolutionTransposedWithMultiply(
-    const ElementwiseAttributes& mul_attr,
-    ConvolutionTransposedAttributes* attr);
-
-// Modify FullyConnectedAttributes so that after making fully connected with
-// modified attributes we will have the same result as fully connected
-// with old attributes and following multiply operation.
-void FuseFullyConnectedWithMultiply(const ElementwiseAttributes& mul_attr,
-                                    FullyConnectedAttributes* attr);
-
-// Modify Convolution2DAttributes so that after making convolution with
-// modified attributes we will have the same result as multiply operation and
-// convolution with old attributes
-void FuseMultiplyWithConvolution2D(const ElementwiseAttributes& mul_attr,
-                                   Convolution2DAttributes* attr);
-
-// Modify DepthwiseConvolution2DAttributes so that after making depth wise
-// convolution with modified attributes we will have the same result as multiply
-// operation and depth wise convolution with old attributes
-void FuseMultiplyWithDepthwiseConvolution2D(
-    const ElementwiseAttributes& mul_attr,
-    DepthwiseConvolution2DAttributes* attr);
-
-// Modify ConvolutionTransposedAttributes so that after making convolution
-// transposed with modified attributes we will have the same result as multiply
-// operation and convolution transposed with old attributes
-void FuseMultiplyWithConvolutionTransposed(
-    const ElementwiseAttributes& mul_attr,
-    ConvolutionTransposedAttributes* attr);
-
-// Modify FullyConnectedAttributes so that after making fully connected
-// with modified attributes we will have the same result as multiply
-// operation and fully connected with old attributes
-void FuseMultiplyWithFullyConnected(const ElementwiseAttributes& mul_attr,
-                                    FullyConnectedAttributes* attr);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_FUSE_MUL_TO_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/make_fully_connected.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/make_fully_connected.h
deleted file mode 100644
index 9a62d0b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/make_fully_connected.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* 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_COMMON_TRANSFORMATIONS_MAKE_FULLY_CONNECTED_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_MAKE_FULLY_CONNECTED_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-
-namespace tflite {
-namespace gpu {
-
-// Turns convolution with kernel 1x1 and input tensor with h=1 and w=1 into
-// fully connected operation
-std::unique_ptr NewMakeFullyConnectedFromConvolution();
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_MAKE_FULLY_CONNECTED_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/make_padding.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/make_padding.h
deleted file mode 100644
index c7774eb..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/make_padding.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* 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_COMMON_TRANSFORMATIONS_MAKE_PADDING_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_MAKE_PADDING_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-
-namespace tflite {
-namespace gpu {
-
-// Turns concat that handles only two tensors, where one tensor is zeros, into
-// padding operation.
-std::unique_ptr NewMakePaddingFromConcat();
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_MAKE_PADDING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/matching.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/matching.h
deleted file mode 100644
index b28c8b0..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/matching.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* 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_COMMON_TRANSFORMATIONS_MATCHING_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_MATCHING_H_
-
-// A file provides predicates to match subgraphs.
-
-#include 
-#include 
-#include 
-#include 
-
-namespace tflite {
-namespace gpu {
-
-// Returns true if a container of nodes contains nodes that all match given
-// operation_types.
-template 
-bool MatchesByOperationType(const T& nodes,
-                            const std::vector& types) {
-  if (nodes.size() != types.size()) return false;
-  return std::mismatch(nodes.begin(), nodes.end(), types.begin(),
-                       [&](typename T::value_type a, const std::string& b) {
-                         return a->operation.type == b;
-                       })
-             .first == nodes.end();
-}
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_MATCHING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/merge_padding_with.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/merge_padding_with.h
deleted file mode 100644
index d28cdfb..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/merge_padding_with.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 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_COMMON_TRANSFORMATIONS_MERGE_PADDING_WITH_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_MERGE_PADDING_WITH_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-
-namespace tflite {
-namespace gpu {
-
-std::unique_ptr NewMergePaddingWithPooling();
-
-std::unique_ptr NewMergePaddingWithConvolution2D();
-
-std::unique_ptr
-NewMergePaddingWithDepthwiseConvolution();
-
-// This transform requires Add operation support of unequal tensors on input.
-// Padding should be with zeroes, and only appended in Z axis.
-// Also input tensor channels should be divisible by 4(aligned).
-// It should replace following pattern:
-// 1) some tensor padded with zeroes in Z dim, for example from 24 to 32
-//   channels
-// 2) than this tensor used only in Add operation and Add operation
-//   adds this useless zeroes on 24-32 channels.
-// It removes this useless addition
-// by using Add with unequal tensors on input. Instead of filling with zeroes
-// and adding this part in Add operation, Add operation makes additional check
-// for this tensor:
-//   if (channels < src_channels) {
-//     result += tensor_from_pad_operation.data[index];
-//   }
-std::unique_ptr NewMergePaddingWithAdd();
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_MERGE_PADDING_WITH_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/model_transformations.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/model_transformations.h
deleted file mode 100644
index 69592c9..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/model_transformations.h
+++ /dev/null
@@ -1,31 +0,0 @@
-/* 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_COMMON_TRANSFORMATIONS_GENERAL_TRANSFORMATIONS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_GENERAL_TRANSFORMATIONS_H_
-
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-
-namespace tflite {
-namespace gpu {
-
-// Applies custom and general transformations to the model in the proper order.
-// @return false when something went wrong that turned a graph in a broken state
-bool ApplyModelTransformations(ModelTransformer* transformer);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_GENERAL_TRANSFORMATIONS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/remove_noop.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/remove_noop.h
deleted file mode 100644
index ef1939b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/transformations/remove_noop.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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_COMMON_TRANSFORMATIONS_REMOVE_NOOP_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_REMOVE_NOOP_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-
-namespace tflite {
-namespace gpu {
-
-std::unique_ptr NewRemoveSingleInputConcat();
-
-std::unique_ptr NewRemoveSingleInputAdd();
-
-std::unique_ptr NewRemoveDegenerateUpsampling();
-
-// Removes reshape with input shape == output shape
-std::unique_ptr NewRemoveIdentityReshape();
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TRANSFORMATIONS_REMOVE_NOOP_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/types.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/types.h
deleted file mode 100644
index 4ddb46f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/types.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* 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_COMMON_TYPES_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TYPES_H_
-
-#include 
-#include 
-#include 
-
-#include 
-
-namespace tflite {
-namespace gpu {
-
-// TODO(akulik): make these types Google-style compliant.
-
-using HalfBits = uint16_t;
-
-class alignas(2) half {
- public:
-  HalfBits bits;
-
-  half() = default;
-
-  half(const half& f) : bits(f.bits) {}
-
-  explicit half(float other) { bits = fp16_ieee_from_fp32_value(other); }
-
-  void operator=(float f) { *this = half(f); }
-
-  operator float() const { return fp16_ieee_to_fp32_value(bits); }
-};
-
-template 
-struct alignas(sizeof(T)) Vec4 {
-  union {
-    struct {
-      T x, y, z, w;
-    };
-    std::array data_;
-  };
-
-  Vec4() : Vec4(T(0.0f)) {}
-
-  template 
-  Vec4(S x_, S y_, S z_, S w_) : x(x_), y(y_), z(z_), w(w_) {}
-  explicit Vec4(T v) : x(v), y(v), z(v), w(v) {}
-
-  template 
-  explicit Vec4(S v) : x(v), y(v), z(v), w(v) {}
-
-  Vec4(const Vec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {}
-
-  template 
-  Vec4(const Vec4& f) : x(f.x), y(f.y), z(f.z), w(f.w) {}
-
-  Vec4& operator=(const Vec4& other) {
-    x = other.x;
-    y = other.y;
-    z = other.z;
-    w = other.w;
-    return *this;
-  }
-
-  static constexpr int size() { return 4; }
-
-  T& operator[](size_t n) { return data_[n]; }
-  T operator[](size_t n) const { return data_[n]; }
-
-  bool operator==(const Vec4& value) const {
-    return data_[0] == value[0] && data_[1] == value[1] &&
-           data_[2] == value[2] && data_[3] == value[3];
-  }
-  bool operator!=(const Vec4& value) const {
-    return !(this->operator==(value));
-  }
-};
-
-template 
-struct alignas(sizeof(T)) Vec3 {
-  union {
-    struct {
-      T x, y, z;
-    };
-    std::array data_;
-  };
-
-  Vec3() : Vec3(T(0.0f)) {}
-
-  template 
-  constexpr Vec3(S x_, S y_, S z_) : x(x_), y(y_), z(z_) {}
-  explicit Vec3(T v) : x(v), y(v), z(v) {}
-
-  template 
-  explicit Vec3(S v) : x(v), y(v), z(v) {}
-
-  Vec3(const Vec3& f) : x(f.x), y(f.y), z(f.z) {}
-
-  template 
-  Vec3(const Vec3& f) : x(f.x), y(f.y), z(f.z) {}
-
-  Vec3& operator=(const Vec3& other) {
-    x = other.x;
-    y = other.y;
-    z = other.z;
-    return *this;
-  }
-
-  static constexpr int size() { return 3; }
-
-  T& operator[](size_t n) { return data_[n]; }
-  T operator[](size_t n) const { return data_[n]; }
-  bool operator==(const Vec3& value) const {
-    return data_[0] == value[0] && data_[1] == value[1] && data_[2] == value[2];
-  }
-  bool operator!=(const Vec3& value) const {
-    return !(this->operator==(value));
-  }
-};
-
-template 
-struct alignas(sizeof(T)) Vec2 {
-  union {
-    struct {
-      T x, y;
-    };
-    std::array data_;
-  };
-
-  Vec2() : Vec2(T(0.0f)) {}
-
-  template 
-  Vec2(S x_, S y_) : x(x_), y(y_) {}
-  explicit Vec2(T v) : x(v), y(v) {}
-
-  template 
-  explicit Vec2(S v) : x(v), y(v) {}
-
-  Vec2(const Vec2& f) : x(f.x), y(f.y) {}
-
-  template 
-  Vec2(const Vec2& f) : x(f.x), y(f.y) {}
-
-  Vec2& operator=(const Vec2& other) {
-    x = other.x;
-    y = other.y;
-    return *this;
-  }
-
-  bool operator==(const Vec2& value) const {
-    return data_[0] == value[0] && data_[1] == value[1];
-  }
-
-  bool operator!=(const Vec2& value) const {
-    return !(this->operator==(value));
-  }
-
-  static constexpr int size() { return 2; }
-
-  T& operator[](size_t n) { return data_[n]; }
-  T operator[](size_t n) const { return data_[n]; }
-};
-
-using float2 = Vec2;
-using half2 = Vec2;
-using byte2 = Vec2;
-using ubyte2 = Vec2;
-using short2 = Vec2;
-using ushort2 = Vec2;
-using int2 = Vec2;
-using uint2 = Vec2;
-
-using float3 = Vec3;
-using half3 = Vec3;
-using byte3 = Vec3;
-using ubyte3 = Vec3;
-using short3 = Vec3;
-using ushort3 = Vec3;
-using int3 = Vec3;
-using uint3 = Vec3;
-
-using float4 = Vec4;
-using half4 = Vec4;
-using byte4 = Vec4;
-using ubyte4 = Vec4;
-using short4 = Vec4;
-using ushort4 = Vec4;
-using int4 = Vec4;
-using uint4 = Vec4;
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_TYPES_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/util.h
deleted file mode 100644
index 6a1e793..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/util.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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_COMMON_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_UTIL_H_
-
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-
-// @param n must be non negative
-// @param divisor must be greater than zero
-template 
-T DivideRoundUp(T n, N divisor) {
-  const T div = static_cast(divisor);
-  const T q = n / div;
-  return n % div == 0 ? q : q + 1;
-}
-
-template <>
-inline uint3 DivideRoundUp(uint3 n, uint3 divisor) {
-  return uint3(DivideRoundUp(n.x, divisor.x), DivideRoundUp(n.y, divisor.y),
-               DivideRoundUp(n.z, divisor.z));
-}
-
-// @param number or its components must be greater than zero
-// @param n must be greater than zero
-template 
-T AlignByN(T number, N n) {
-  return DivideRoundUp(number, n) * n;
-}
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/winograd_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/winograd_util.h
deleted file mode 100644
index e88ceac..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/winograd_util.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_COMMON_WINOGRAD_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_WINOGRAD_UTIL_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/tensor.h"
-
-namespace tflite {
-namespace gpu {
-
-// Matrices for Winograd trasformations received with method described here
-// https://openreview.net/pdf?id=H1ZaRZVKg
-
-// returns A transposed matrix(6 * 4) as array (24 values) for Winograd4x4To6x6
-std::vector AtMatrixForWinograd4x4To6x6();
-
-// returns B transposed matrix(6 * 6) as array (36 values) for Winograd4x4To6x6
-std::vector BtMatrixForWinograd4x4To6x6();
-
-void RearrangeWeightsToWinograd4x4To6x6Weights(
-    const Tensor& src_weights,
-    Tensor* dst_weights);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_WINOGRAD_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/workgroup_selection.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/workgroup_selection.h
deleted file mode 100644
index 67c51b4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/common/workgroup_selection.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 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_COMMON_WORKGROUP_SELECTION_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_COMMON_WORKGROUP_SELECTION_H_
-
-#include 
-
-namespace tflite {
-namespace gpu {
-
-// PRECISE assume that WorkGroupSize * k = GridSize;
-// NO_ALIGNMENT no restrictions;
-// We need PRECISE when we don't have check in kernel for boundaries
-// If we have the check, we can use PRECISE or NO_ALIGNMENT as well.
-enum class WorkGroupSizeAlignment { PRECISE, NO_ALIGNMENT };
-
-std::vector GetPossibleSizes(int number,
-                                  WorkGroupSizeAlignment z_alignment);
-
-// Specializations exist for int3 and uint3 in the .cc file
-
-template 
-std::vector GenerateWorkGroupSizes(
-    const T& grid, int min_work_group_total_size, int max_work_group_total_size,
-    const T& max_work_group_sizes, WorkGroupSizeAlignment x_alignment,
-    WorkGroupSizeAlignment y_alignment, WorkGroupSizeAlignment z_alignment);
-
-template 
-void GenerateWorkGroupSizesAlignedToGrid(const T& grid,
-                                         const T& max_work_group_size,
-                                         const int max_work_group_invocations,
-                                         std::vector* work_groups);
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_COMMON_WORKGROUP_SELECTION_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/delegate.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/delegate.h
deleted file mode 100644
index 40a06bb..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/delegate.h
+++ /dev/null
@@ -1,133 +0,0 @@
-/* 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_DELEGATE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_DELEGATE_H_
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-// Encapsulated compilation/runtime tradeoffs.
-enum TfLiteGpuInferenceUsage {
-  // Delegate will be used only once, therefore, bootstrap/init time should
-  // be taken into account.
-  TFLITE_GPU_INFERENCE_PREFERENCE_FAST_SINGLE_ANSWER = 0,
-
-  // Prefer maximizing the throughput. Same delegate will be used repeatedly on
-  // multiple inputs.
-  TFLITE_GPU_INFERENCE_PREFERENCE_SUSTAINED_SPEED = 1,
-};
-
-enum TfLiteGpuInferencePriority {
-  // AUTO priority is needed when a single priority is the most important
-  // factor. For example,
-  // priority1 = MIN_LATENCY would result in the configuration that achieves
-  // maximum performance.
-  TFLITE_GPU_INFERENCE_PRIORITY_AUTO = 0,
-  TFLITE_GPU_INFERENCE_PRIORITY_MAX_PRECISION = 1,
-  TFLITE_GPU_INFERENCE_PRIORITY_MIN_LATENCY = 2,
-  TFLITE_GPU_INFERENCE_PRIORITY_MIN_MEMORY_USAGE = 3,
-};
-
-// Used to toggle experimental flags used in the delegate. Note that this is a
-// bitmask, so the values should be 1, 2, 4, 8, ...etc.
-enum TfLiteGpuExperimentalFlags {
-  TFLITE_GPU_EXPERIMENTAL_FLAGS_NONE = 0,
-  // Enables inference on quantized models with the delegate.
-  // NOTE: This is enabled in TfLiteGpuDelegateOptionsV2Default.
-  TFLITE_GPU_EXPERIMENTAL_FLAGS_ENABLE_QUANT = 1 << 0,
-  // Enforces execution with the provided backend.
-  TFLITE_GPU_EXPERIMENTAL_FLAGS_CL_ONLY = 1 << 1,
-  TFLITE_GPU_EXPERIMENTAL_FLAGS_GL_ONLY = 1 << 2
-};
-
-// IMPORTANT: Always use TfLiteGpuDelegateOptionsV2Default() method to create
-// new instance of TfLiteGpuDelegateOptionsV2, otherwise every new added option
-// may break inference.
-typedef struct {
-  // When set to zero, computations are carried out in maximal possible
-  // precision. Otherwise, the GPU may quantify tensors, downcast values,
-  // process in FP16 to increase performance. For most models precision loss is
-  // warranted.
-  // [OBSOLETE]: to be removed
-  int32_t is_precision_loss_allowed;
-
-  // Preference is defined in TfLiteGpuInferenceUsage.
-  int32_t inference_preference;
-
-  // Ordered priorities provide better control over desired semantics,
-  // where priority(n) is more important than priority(n+1), therefore,
-  // each time inference engine needs to make a decision, it uses
-  // ordered priorities to do so.
-  // For example:
-  //   MAX_PRECISION at priority1 would not allow to decrease precision,
-  //   but moving it to priority2 or priority3 would result in F16 calculation.
-  //
-  // Priority is defined in TfLiteGpuInferencePriority.
-  // AUTO priority can only be used when higher priorities are fully specified.
-  // For example:
-  //   VALID:   priority1 = MIN_LATENCY, priority2 = AUTO, priority3 = AUTO
-  //   VALID:   priority1 = MIN_LATENCY, priority2 = MAX_PRECISION,
-  //            priority3 = AUTO
-  //   INVALID: priority1 = AUTO, priority2 = MIN_LATENCY, priority3 = AUTO
-  //   INVALID: priority1 = MIN_LATENCY, priority2 = AUTO,
-  //            priority3 = MAX_PRECISION
-  // Invalid priorities will result in error.
-  int32_t inference_priority1;
-  int32_t inference_priority2;
-  int32_t inference_priority3;
-
-  // Bitmask flags. See the comments in TfLiteGpuExperimentalFlags.
-  int64_t experimental_flags;
-
-  // A graph could have multiple partitions that can be delegated to the GPU.
-  // This limits the maximum number of partitions to be delegated. By default,
-  // it's set to 1 in TfLiteGpuDelegateOptionsV2Default().
-  int32_t max_delegated_partitions;
-} TfLiteGpuDelegateOptionsV2;
-
-// Populates TfLiteGpuDelegateOptionsV2 as follows:
-//   is_precision_loss_allowed = false
-//   inference_preference = TFLITE_GPU_INFERENCE_PREFERENCE_FAST_SINGLE_ANSWER
-//   priority1 = TFLITE_GPU_INFERENCE_PRIORITY_MAX_PRECISION
-//   priority2 = TFLITE_GPU_INFERENCE_PRIORITY_AUTO
-//   priority3 = TFLITE_GPU_INFERENCE_PRIORITY_AUTO
-//   experimental_flags = TFLITE_GPU_EXPERIMENTAL_FLAGS_ENABLE_QUANT
-//   max_delegated_partitions = 1
-TFL_CAPI_EXPORT TfLiteGpuDelegateOptionsV2 TfLiteGpuDelegateOptionsV2Default();
-
-// Creates a new delegate instance that need to be destroyed with
-// TfLiteGpuDelegateV2Delete when delegate is no longer used by TFLite.
-//
-// This delegate encapsulates multiple GPU-acceleration APIs under the hood to
-// make use of the fastest available on a device.
-//
-// When `options` is set to `nullptr`, then default options are used.
-TFL_CAPI_EXPORT TfLiteDelegate* TfLiteGpuDelegateV2Create(
-    const TfLiteGpuDelegateOptionsV2* options);
-
-// Destroys a delegate created with `TfLiteGpuDelegateV2Create` call.
-TFL_CAPI_EXPORT void TfLiteGpuDelegateV2Delete(TfLiteDelegate* delegate);
-
-#ifdef __cplusplus
-}
-#endif  // __cplusplus
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_DELEGATE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/api.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/api.h
deleted file mode 100644
index 1149824..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/api.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* 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_GL_API_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_API_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/command_queue.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler_options.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-#include "tensorflow/lite/delegates/gpu/gl/object_manager.h"
-#include "tensorflow/lite/delegates/gpu/gl/runtime_options.h"
-#include "tensorflow/lite/delegates/gpu/gl/stats.h"
-#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-class InferenceContext;
-
-// Represents a model that was prepared for execution. It is stored in a format
-// most suitable for execution and optionally may include pre-generated or
-// pre-compiled GPU shaders or whatever is needed for efficient execution.
-class CompiledModel {
- public:
-  virtual ~CompiledModel() = default;
-
-  virtual CompilerStats stats() const = 0;
-
-  // Creates new inference context. Result can outlive @this.
-  //
-  // NewRun call as well as subsequent calls to InferenceContext methods should
-  // be done from the same EGL context.
-  virtual absl::Status NewRun(
-      const RuntimeOptions& options, const ObjectManager* objects,
-      CommandQueue* command_queue,
-      std::unique_ptr* inference_context) const = 0;
-
-#ifndef TFLITE_GPU_BINARY_RELEASE
-  // Serializes compiled model to a string.
-  // @return true if serialization finished successfully.
-  virtual absl::Status Serialize(
-      std::vector* serialized_compiled_model) const = 0;
-#endif  // TFLITE_GPU_BINARY_RELEASE
-};
-
-// Turns the given model into "compiled" form that is suitable for inference.
-absl::Status Compile(const CompilationOptions& options,
-                     const GraphFloat32& model,
-                     const std::unordered_set& tflite_graph_io,  // NOLINT
-                     const NodeShader& node_shader,
-                     const WorkgroupsCalculator& workgroup_calculator,
-                     std::unique_ptr* compiled_model);
-
-#ifndef TFLITE_GPU_BINARY_RELEASE
-// Reads serialized representation previously created with
-// CompiledModel::Serialize call.
-absl::Status ReadSerializedModel(
-    const std::vector& serialized_model,
-    std::unique_ptr* compiled_model);
-#endif  // TFLITE_GPU_BINARY_RELEASE
-
-// Encapsulates everything needed for one or more inference executions done
-// sequentially.
-//
-// Thread-safe.
-class InferenceContext {
- public:
-  virtual ~InferenceContext() = default;
-
-  virtual RuntimeStats stats() const = 0;
-
-  // Executes inference.
-  virtual absl::Status Execute() = 0;
-
-  // Asks context to reset it for another round. Keep in mind that does not
-  // affect inputs nor outputs which are not cleared, so it is possible to
-  // re-use them.
-  // It is an error to call Reset while previous run is still in progress.
-  virtual absl::Status Reset() = 0;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_API_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/api2.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/api2.h
deleted file mode 100644
index 0506206..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/api2.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 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_GL_API2_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_API2_H_
-
-#include 
-#include 
-
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/api.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/command_queue.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-struct InferenceOptions : public tflite::gpu::InferenceOptions {};
-
-struct InferenceEnvironmentProperties {
-  bool is_opengl_available = false;
-};
-
-// Manages all resources that need to stay around as long as any inference is
-// running using the OpenGL backend.
-class InferenceEnvironment {
- public:
-  virtual ~InferenceEnvironment() = default;
-
-  virtual absl::Status NewInferenceBuilder(
-      GraphFloat32&& model, const InferenceOptions& options,
-      std::unique_ptr* builder) = 0;
-};
-
-struct InferenceEnvironmentOptions {
-  CommandQueue* queue = nullptr;
-};
-
-// Creates a new OpenGL environment that needs to stay around until all
-// inference runners are destroyed.
-absl::Status NewInferenceEnvironment(
-    const InferenceEnvironmentOptions& options,
-    std::unique_ptr* environment,
-    InferenceEnvironmentProperties* properties /* optional */);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_API2_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/command_queue.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/command_queue.h
deleted file mode 100644
index d9bff04..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/command_queue.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* 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_GL_COMMAND_QUEUE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMMAND_QUEUE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_program.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// GL programs can be executed directly via dispatch call or using a queue
-// abstraction similar to one in OpenCL and Vulkan.
-// CommandQueue executes given programs in order as they come.
-class CommandQueue {
- public:
-  virtual ~CommandQueue() = default;
-
-  // Dispatches a program. It may or may not call glFlush.
-  virtual absl::Status Dispatch(const GlProgram& program,
-                                const uint3& workgroups) = 0;
-
-  // Called at the end of dispatching of all programs.
-  virtual absl::Status Flush() = 0;
-
-  // Waits until all programs dispatched prior this call are completed.
-  virtual absl::Status WaitForCompletion() = 0;
-};
-
-// By default memory barrier is inserted after every dispatch.
-std::unique_ptr NewCommandQueue(const GpuInfo& gpu_info);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMMAND_QUEUE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler.h
deleted file mode 100644
index 03ea3dd..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 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_GL_COMPILER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_H_
-
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler/shader_code.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler_options.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-using ShaderCodeCallback = std::function;
-
-class Compiler {
- public:
-  virtual ~Compiler() = default;
-
-  // Goes over a graph and generates OpenGL shaders for the given graph.
-  // Callback is called for every generated shader. Callback may execute shaders
-  // as they come or store them elsewhere to execute later.
-  virtual absl::Status Compile(
-      const GraphFloat32& graph,
-      const std::unordered_set& tflite_graph_io,  // NOLINT
-      const ShaderCodeCallback& callback) = 0;
-};
-
-std::unique_ptr NewCompiler(
-    const NodeShader* node_shader, const GpuInfo* gpu_info,
-    const CompilationOptions& options);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/compiled_node.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/compiled_node.h
deleted file mode 100644
index 8d36504..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/compiled_node.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* 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_GL_COMPILER_COMPILED_NODE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_COMPILED_NODE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-#include "tensorflow/lite/delegates/gpu/gl/object.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Contains compiler internal attributes for each node after it was processed by
-// NodeShader.
-struct CompiledNodeAttributes {
-  std::vector inputs;
-  std::vector outputs;
-
-  GeneratedCode code;
-
-  // nodes that are covered by the provided shader.
-  std::vector node_indices;
-};
-
-// Moves all code objects, parameters and node indices from attr to merged_attr.
-// Parameters and objects in attr.code.source_code are renamed to ensure
-// uniqueness.
-absl::Status MergeCode(CompiledNodeAttributes* attr,
-                       CompiledNodeAttributes* merged_attr);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_COMPILED_NODE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/fuse_auto_input.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/fuse_auto_input.h
deleted file mode 100644
index ff5ac5b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/fuse_auto_input.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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_GL_COMPILER_FUSE_AUTO_INPUT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_FUSE_AUTO_INPUT_H_
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Fuses nodes that have auto output with auto input node using the following
-// rules.
-//
-// Source graph:
-//   A B C
-//   \ | /
-//     D
-//
-// - A, B and C each have a single output marked as AUTO
-// - Each output is used only by D
-// - D has all inputs marked as AUTO
-//
-// Result: in the best case a single node that does (A,B,C)+D operations.
-//
-class FuseAutoInput : public NodeTransformation {
- public:
-  TransformResult ApplyToNode(Node* node, GraphFloat32* graph) final;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_FUSE_AUTO_INPUT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/fuse_inline.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/fuse_inline.h
deleted file mode 100644
index 09e2cc5..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/fuse_inline.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 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_GL_COMPILER_FUSE_INLINE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_FUSE_INLINE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Fuses every two nodes where first node does default output and second node
-// is INLINE.
-//
-// Generates code as follows:
-//   1. all uniforms are inlined
-//   2. source code is wrapped into {}
-// For example:
-//  value = clamp(value, 0.0, clip);
-//  +
-//  value = 1.0 / (1.0 + exp(-1.0 * value));
-// will turn into:
-//  {
-//    value = clamp(value, 0.0, clip);
-//  }
-//  {
-//    value = 1.0 / (1.0 + exp(-1.0 * value));
-//  }
-class FuseAutoOutputWithInline : public SequenceTransformation {
- public:
-  int ExpectedSequenceLength() const final { return 2; }
-
-  TransformResult ApplyToNodesSequence(const std::vector& sequence,
-                                       GraphFloat32* graph) final;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_FUSE_INLINE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/fuse_inplace.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/fuse_inplace.h
deleted file mode 100644
index 7b334d2..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/fuse_inplace.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* 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_GL_COMPILER_FUSE_INPLACE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_FUSE_INPLACE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/model_transformer.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Fuse two shaders where second shader is inline shader with the first.
-// First shader should have a special symbol that defines a place where such
-// fusion should be made and what variable needs to be changed.
-// Second shader needs to operation with 'value_0' variable.
-// Example:
-//
-//  First shader:
-//   vec4 result = input_data_0.data[gid.x, gid.y, gid.z];
-//   $inplace_update:result$
-//   ...
-//   output_data_0.data[1,2,3] = result;
-//
-//  Second shader:
-//   value_0 = max(value_0, 0);
-//
-//  Fused shader:
-//   vec4 result = input_data_0.data[gid.x, gid.y, gid.z];
-//   result = max(result, 0);
-//   ...
-//   output_data_0.data[1,2,3] = result;
-//
-class FuseInplaceUpdate : public SequenceTransformation {
- public:
-  int ExpectedSequenceLength() const final { return 2; }
-
-  TransformResult ApplyToNodesSequence(const std::vector& sequence,
-                                       GraphFloat32* graph) final;
-};
-
-// Removes all %inplace_update:XXX% strings from the code.
-class RemoveUnusedInplaceUpdates : public NodeTransformation {
- public:
-  TransformResult ApplyToNode(Node* node, GraphFloat32* graph) final;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_FUSE_INPLACE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/object_accessor.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/object_accessor.h
deleted file mode 100644
index 318709f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/object_accessor.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* 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_GL_COMPILER_OBJECT_ACCESSOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_OBJECT_ACCESSOR_H_
-
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/gl/compiler/preprocessor.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler/variable_accessor.h"
-#include "tensorflow/lite/delegates/gpu/gl/object.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// This rewrite handles access to objects both reads and writes.
-//
-// The following syntax is supported to access objects:
-//
-//   READ:
-//     vec4 value = $data[i]$;
-//       where data is a buffer or 1D texture
-//     vec4 value = $data[i,j]$;
-//       where data is 2D texture
-//     vec4 value = $data[i,j,k]$;
-//       where data is 3D texture
-//
-//   WRITE:
-//     $data[i] = value$;
-//       where data is a buffer or 1D texture
-//     $data[i,j] = value$;
-//       where data is 2D texture
-//     $data[i,j,k] = value$;
-//       where data is 3D texture
-//
-// Accessor supports all types (gvecN) as well as float16.
-//
-// TODO(akulik): support field in data[x,y,z].x
-//
-class ObjectAccessor : public InlineRewrite {
- public:
-  ObjectAccessor(bool is_mali, VariableAccessor* variable_accessor)
-      : ObjectAccessor(is_mali, /*sampler_textures=*/false, variable_accessor) {
-  }
-
-  ObjectAccessor(bool is_mali, bool sampler_textures,
-                 VariableAccessor* variable_accessor)
-      : is_mali_(is_mali),
-        sampler_textures_(sampler_textures),
-        variable_accessor_(variable_accessor) {}
-
-  RewriteStatus Rewrite(absl::string_view input, std::string* output) final;
-
-  // Return true if object was successfully added.
-  bool AddObject(const std::string& name, Object object);
-
-  // Returns objects declarations that need to be added in a shader's code.
-  std::string GetObjectDeclarations() const;
-
-  // Returns functions declarations that need to be added in a shader's code.
-  // These functions are used by code accessing objects.
-  std::string GetFunctionsDeclarations() const;
-
-  // Returns a collection of registered objects
-  std::vector GetObjects() const;
-
- private:
-  RewriteStatus RewriteRead(absl::string_view location, std::string* output);
-
-  RewriteStatus RewriteWrite(absl::string_view location,
-                             absl::string_view value, std::string* output);
-
-  std::map name_to_object_;
-
-  const bool is_mali_;
-  const bool sampler_textures_;
-  VariableAccessor* variable_accessor_;
-};
-
-// Implementation details below.
-
-namespace object_accessor_internal {
-
-// Refers to an element in an object.
-struct IndexedElement {
-  absl::string_view object_name;
-  std::vector indices;
-};
-
-// Splits name[index1, index2...] into 'name' and {'index1', 'index2'...}.
-IndexedElement ParseElement(absl::string_view input);
-
-}  // namespace object_accessor_internal
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_OBJECT_ACCESSOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/preprocessor.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/preprocessor.h
deleted file mode 100644
index 29fad00..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/preprocessor.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* 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_GL_COMPILER_PREPROCESSOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_PREPROCESSOR_H_
-
-#include 
-#include 
-#include 
-
-#include "absl/strings/string_view.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-enum class RewriteStatus {
-  SUCCESS = 0,
-  NOT_RECOGNIZED = 1,
-  ERROR = 2,
-};
-
-// Inline rewrite matches a string and rewrites it.
-class InlineRewrite {
- public:
-  virtual ~InlineRewrite() = default;
-
-  virtual RewriteStatus Rewrite(absl::string_view input,
-                                std::string* output) = 0;
-};
-
-// Text preprocessor runs a collection of registered rewrites.
-// It uses a single character prefix as inline delimiter that needs to quote
-// text to be rewritten.
-class TextPreprocessor {
- public:
-  // @param keep_unknown_rewrites if true, will keep unhandled rewrites as is
-  // instead of reporting an error.
-  TextPreprocessor(char inline_delimiter, bool keep_unknown_rewrites)
-      : inline_delimiter_(inline_delimiter),
-        keep_unknown_rewrites_(keep_unknown_rewrites) {}
-
-  void AddRewrite(InlineRewrite* rewrite) {
-    inline_rewrites_.push_back(rewrite);
-  }
-
-  // input and output may point to the same object.
-  absl::Status Rewrite(const std::string& input, std::string* output);
-
- private:
-  const char inline_delimiter_;
-  const bool keep_unknown_rewrites_;
-
-  std::vector inline_rewrites_;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_PREPROCESSOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/rename.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/rename.h
deleted file mode 100644
index e38ade1..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/rename.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 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_GL_COMPILER_RENAME_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_RENAME_H_
-
-#include 
-#include 
-
-#include "absl/strings/string_view.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Functor takes old name and returns new name.
-using NameFunctor = std::function;
-
-// Rewrites source code, objects and parameters with the new names supplied
-// by the given functor.
-absl::Status Rename(const NameFunctor& name_func, GeneratedCode* code);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_RENAME_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/shader_code.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/shader_code.h
deleted file mode 100644
index 3f3db37..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/shader_code.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* 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_GL_COMPILER_SHADER_CODE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_SHADER_CODE_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/gl/object.h"
-#include "tensorflow/lite/delegates/gpu/gl/variable.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-struct ShaderCode {
-  ShaderCode() = default;
-  ShaderCode(const std::vector& in_parameters,
-             const std::vector& in_objects, const uint3& in_workload,
-             const uint3& in_recommended_workgroup,
-             const std::string& in_source_code,
-             const std::vector& in_node_indices)
-      : parameters(in_parameters),
-        objects(in_objects),
-        workload(in_workload),
-        recommended_workgroup(in_recommended_workgroup),
-        source_code(in_source_code),
-        node_indices(in_node_indices) {}
-
-  // A list of uniform parameters to be set.
-  std::vector parameters;
-
-  // A list of objects to bind to opengl program.
-  std::vector objects;
-
-  uint3 workload;
-
-  // operation may specify recommended workgroup size
-  uint3 recommended_workgroup;
-
-  // Generated source code does not set local size, therefore it needs to be set
-  // elsewhere.
-  std::string source_code;
-
-  // nodes of the graph that are covered by the shader.
-  std::vector node_indices;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_SHADER_CODE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/shader_codegen.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/shader_codegen.h
deleted file mode 100644
index 12d2708..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/shader_codegen.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* 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_GL_COMPILER_SHADER_CODEGEN_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_SHADER_CODEGEN_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler/compiled_node.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler/object_accessor.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler/shader_code.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler_options.h"
-#include "tensorflow/lite/delegates/gpu/gl/object.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// This class is responsible for assembling a shader by putting together
-// objects, parameters declarations and main function.
-class ShaderCodegen {
- public:
-  ShaderCodegen(const CompilationOptions& options, const GpuInfo& gpu_info);
-
-  // Builds final program representation.
-  absl::Status Build(CompiledNodeAttributes attr,
-                     ShaderCode* shader_code) const;
-
- private:
-  const CompilationOptions options_;
-  const GpuType gpu_type_;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_SHADER_CODEGEN_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/variable_accessor.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/variable_accessor.h
deleted file mode 100644
index f6d5344..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler/variable_accessor.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* 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_GL_COMPILER_VARIABLE_ACCESSOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_VARIABLE_ACCESSOR_H_
-
-#include 
-#include 
-#include 
-
-#include "absl/container/flat_hash_map.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler/preprocessor.h"
-#include "tensorflow/lite/delegates/gpu/gl/variable.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// This rewrite handles access to variables. It may rewrite a variable with
-// actual values if 'inline_values' is set to true.
-//
-// The following syntax is supported to access variables:
-//  - simple variable: name
-//  - variable with field: name.(x|y|z|w)
-//  - variable with index: name[i]
-//  - variable with index and field: name[i].(x|y|z|w)
-//
-// If 'inline_values' is set to true, non-variable-length variables will be
-// inlined. For example, 'base.x' will be replaced with value of 'x' field from
-// 'base'. Variable-length variables are declared as const and accessed via
-// index. These declarations are returned by GetConstDeclarations.
-//
-// If 'inline_values' is set to false, all variables will be declared as
-// uniforms. Uniform declarations are returned by GetUniformDeclarations.
-class VariableAccessor : public InlineRewrite {
- public:
-  explicit VariableAccessor(bool inline_values, bool vulkan_support = false)
-      : inline_values_(inline_values), vulkan_support_(vulkan_support) {}
-
-  RewriteStatus Rewrite(absl::string_view input, std::string* output) final;
-
-  // Returns true if variable was successfully added.
-  bool AddSharedVariable(Variable&& variable);
-
-  // Returns true if variable was successfully added.
-  bool AddUniformParameter(Variable&& variable);
-
-  // Returns true if variable value is an empty vector.
-  bool IsEmptyVariableLength(const Variable& variable) const;
-
-  // Returns const variables that need to be inlined in the a shader's code.
-  std::string GetConstDeclarations() const;
-
-  // Returns shared variable declarations that need to be inlined.
-  std::string GetSharedVariableDeclarations() const;
-
-  // Returns uniform parameter declarations that need to be inlined.
-  std::string GetUniformParameterDeclarations() const;
-
-  // Returns a collection of uniform parameters.
-  std::vector GetUniformParameters() const;
-
- private:
-  const bool inline_values_;
-  const bool vulkan_support_;
-  absl::flat_hash_map name_to_variable_;
-  std::set shared_variables_;
-  std::set uniform_parameters_;
-};
-
-// Implementation details below.
-
-namespace variable_accessor_internal {
-
-struct VariableReference {
-  absl::string_view name;
-  absl::string_view index;
-  absl::string_view field;
-};
-
-// Parse the following regex manually
-// name(\[index\])?(\.field)?
-VariableReference Parse(absl::string_view input);
-
-}  // namespace variable_accessor_internal
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_VARIABLE_ACCESSOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler_options.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler_options.h
deleted file mode 100644
index 5ea22ea..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/compiler_options.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* 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_GL_COMPILER_OPTIONS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_OPTIONS_H_
-
-#include "tensorflow/lite/delegates/gpu/gl/object.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Default constructor for options turns on all optimizations.
-struct CompilationOptions {
-  // Allows to quantify tensors, downcast values, process in float16 etc.
-  bool allow_precision_loss = false;
-
-  // When set few operations are fused into a single shader. Therefore, there
-  // will be less shaders, but each shader will become larger.
-  bool fuse_operations = true;
-
-  // Parameters will be inlined into a shader. This in turn will generated more
-  // unique shaders where each will need to be compiled.
-  bool inline_parameters = false;
-
-  // If true, shaders, that have auto-input and auto-output, will use a single
-  // object for reading and writing.
-  bool inline_objects = true;  // TODO(akulik): unsupported
-
-  // Can be only Textures or Buffers
-  ObjectType preferred_obj_type = ObjectType::UNKNOWN;
-  // User has an option to choose between textures and buffers. Textures work
-  // better on Adreno and buffers are better for Mali.
-
-  // Chooses object type to represent intermediate tensors. Buffers have more
-  // efficient memory usage because they represent opaque memory blob, but
-  // textures work better on Adreno.
-  // TODO(akulik): may be better name?
-  ObjectType ref_obj_type = ObjectType::UNKNOWN;
-
-  // If true, a user may change BATCH dimension at runtime. Otherwise, static
-  // batch size will be fixed during compile time.
-  // Dynamic mode uses less memory, while static mode may yield better
-  // performance for small models.
-  bool dynamic_batch = false;
-
-  // Fuses consequent nodes which have auto output and auto input.
-  bool auto_input_fusion = true;
-
-  // If true sampler2D and texelFetch will be used to access read only textures.
-  // This feature is not supported yet by the OpenGL runtime.
-  bool sampler_textures = false;
-
-  // Generate GLSL code compatible with Vulkan.
-  bool vulkan_support = false;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_COMPILER_OPTIONS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/converters/bhwc_to_phwc4.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/converters/bhwc_to_phwc4.h
deleted file mode 100644
index 9f69943..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/converters/bhwc_to_phwc4.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 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_GL_CONVERTERS_BHWC_TO_PHWC4_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_CONVERTERS_BHWC_TO_PHWC4_H_
-
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/gl/command_queue.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_buffer.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_program.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-class ConverterBhwcToPhwc4 {
- public:
-  // Creates invalid object.
-  ConverterBhwcToPhwc4() : program_(), workgroup_size_() {}
-
-  static absl::Status Create(ConverterBhwcToPhwc4* converter);
-
-  absl::Status Convert(const BHWC& shape, const GlBuffer& source,
-                       CommandQueue* command_queue /* optional */,
-                       GlBuffer* destination);
-
- private:
-  explicit ConverterBhwcToPhwc4(GlProgram program, const uint3& workgroup_size)
-      : program_(std::move(program)), workgroup_size_(workgroup_size) {}
-
-  GlProgram program_;
-  uint3 workgroup_size_;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_CONVERTERS_BHWC_TO_PHWC4_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/converters/phwc4_to_bhwc.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/converters/phwc4_to_bhwc.h
deleted file mode 100644
index d9a4dd3..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/converters/phwc4_to_bhwc.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* 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_GL_CONVERTERS_PHWC4_TO_BHWC_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_CONVERTERS_PHWC4_TO_BHWC_H_
-
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/gl/command_queue.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_buffer.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_program.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-class ConverterPhwc4ToBhwc {
- public:
-  // Creates invalid object.
-  ConverterPhwc4ToBhwc() : program_(), workgroup_size_() {}
-
-  static absl::Status Create(ConverterPhwc4ToBhwc* converter);
-
-  absl::Status Convert(const BHWC& shape, const GlBuffer& source,
-                       CommandQueue* command_queue /* optional */,
-                       GlBuffer* destination);
-
- private:
-  explicit ConverterPhwc4ToBhwc(GlProgram program, const uint3& workgroup_size)
-      : program_(std::move(program)), workgroup_size_(workgroup_size) {}
-
-  GlProgram program_;
-  uint3 workgroup_size_;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_CONVERTERS_PHWC4_TO_BHWC_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/converters/util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/converters/util.h
deleted file mode 100644
index 67f3549..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/converters/util.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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_GL_CONVERTERS_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_CONVERTERS_UTIL_H_
-
-#include 
-#include 
-
-#include "absl/strings/str_cat.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/common/util.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-inline std::string GetShaderHeader(const uint3& localsize) {
-  return absl::StrCat("#version 310 es\nlayout(local_size_x = ", localsize.x,
-                      ", local_size_y = ", localsize.y,
-                      ", local_size_z = ", localsize.z, ") in;\n");
-}
-
-inline uint32_t BytesForPHWC4(const BHWC& shape) {
-  return shape.b * shape.h * shape.w * AlignByN(shape.c, 4) * sizeof(float);
-}
-
-inline uint32_t BytesForBHWC(const BHWC& shape) {
-  return shape.DimensionsProduct() * sizeof(float);
-}
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_CONVERTERS_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/egl_context.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/egl_context.h
deleted file mode 100644
index a93f1fd..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/egl_context.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* 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_GL_EGL_CONTEXT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_EGL_CONTEXT_H_
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/portable_egl.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// EglContext is an RAII wrapper for an EGLContext.
-//
-// EglContext is moveable but not copyable.
-//
-// See https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglIntro.xhtml for
-// more info.
-class EglContext {
- public:
-  // Creates an invalid EglContext.
-  EglContext()
-      : context_(EGL_NO_CONTEXT),
-        display_(EGL_NO_DISPLAY),
-        config_(EGL_NO_CONFIG_KHR),
-        has_ownership_(false) {}
-
-  EglContext(EGLContext context, EGLDisplay display, EGLConfig config,
-             bool has_ownership)
-      : context_(context),
-        display_(display),
-        config_(config),
-        has_ownership_(has_ownership) {}
-
-  // Move only
-  EglContext(EglContext&& other);
-  EglContext& operator=(EglContext&& other);
-  EglContext(const EglContext&) = delete;
-  EglContext& operator=(const EglContext&) = delete;
-
-  ~EglContext() { Invalidate(); }
-
-  EGLContext context() const { return context_; }
-
-  EGLDisplay display() const { return display_; }
-
-  EGLConfig config() const { return config_; }
-
-  // Make this EglContext the current EGL context on this thread, replacing
-  // the existing current.
-  absl::Status MakeCurrent(EGLSurface read, EGLSurface write);
-
-  absl::Status MakeCurrentSurfaceless() {
-    return MakeCurrent(EGL_NO_SURFACE, EGL_NO_SURFACE);
-  }
-
-  // Returns true if this is the currently bound EGL context.
-  bool IsCurrent() const;
-
-  // Returns true if this object actually owns corresponding EGL context
-  // and manages it's lifetime.
-  bool has_ownership() const { return has_ownership_; }
-
- private:
-  void Invalidate();
-
-  EGLContext context_;
-  EGLDisplay display_;
-  EGLConfig config_;
-
-  bool has_ownership_;
-};
-
-// It uses the EGL_KHR_no_config_context extension to create a no config context
-// since most modern hardware supports the extension.
-absl::Status CreateConfiglessContext(EGLDisplay display,
-                                     EGLContext shared_context,
-                                     EglContext* egl_context);
-
-absl::Status CreateSurfacelessContext(EGLDisplay display,
-                                      EGLContext shared_context,
-                                      EglContext* egl_context);
-
-absl::Status CreatePBufferContext(EGLDisplay display, EGLContext shared_context,
-                                  EglContext* egl_context);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_EGL_CONTEXT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/egl_environment.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/egl_environment.h
deleted file mode 100644
index cb66164..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/egl_environment.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* 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_GL_EGL_ENVIRONMENT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_EGL_ENVIRONMENT_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/egl_context.h"
-#include "tensorflow/lite/delegates/gpu/gl/egl_surface.h"
-#include "tensorflow/lite/delegates/gpu/gl/portable_egl.h"
-#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
-#include "tensorflow/lite/delegates/gpu/gl/request_gpu_info.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Class encapsulates creation of OpenGL objects needed before starting working
-// with OpenGL: binds OpenGL ES API, creates new EGL context, binds it to EGL
-// display and creates surfaces if needed.
-//
-// EGL environment needs to be created once per thread.
-class EglEnvironment {
- public:
-  static absl::Status NewEglEnvironment(
-      std::unique_ptr* egl_environment);
-
-  EglEnvironment() = default;
-  ~EglEnvironment();
-
-  const EglContext& context() const { return context_; }
-  EGLDisplay display() const { return display_; }
-  const GpuInfo& gpu_info() const { return gpu_info_; }
-
- private:
-  absl::Status Init();
-  absl::Status InitConfiglessContext();
-  absl::Status InitSurfacelessContext();
-  absl::Status InitPBufferContext();
-
-  EGLDisplay display_ = EGL_NO_DISPLAY;
-  EglSurface surface_draw_;
-  EglSurface surface_read_;
-  EglContext context_;
-  GpuInfo gpu_info_;
-
-  // Strange hack that helps on Mali GPUs
-  // without it glFinish and glFenceSync don't work
-  void ForceSyncTurning();
-  GLuint dummy_framebuffer_ = GL_INVALID_INDEX;
-  GLuint dummy_texture_ = GL_INVALID_INDEX;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_EGL_ENVIRONMENT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/egl_surface.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/egl_surface.h
deleted file mode 100644
index 5d39aed..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/egl_surface.h
+++ /dev/null
@@ -1,67 +0,0 @@
-/* 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_GL_EGL_SURFACE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_EGL_SURFACE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/portable_egl.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// An RAII wrapper for EGLSurface.
-// See https://www.khronos.org/registry/EGL/sdk/docs/man/html/eglIntro.xhtml for
-// an introduction to the concepts.
-//
-// EglSurface is moveable but not copyable.
-class EglSurface {
- public:
-  // Creates an invalid EglSurface.
-  EglSurface() : surface_(EGL_NO_SURFACE), display_(EGL_NO_DISPLAY) {}
-
-  EglSurface(EGLSurface surface, EGLDisplay display)
-      : surface_(surface), display_(display) {}
-
-  // Move-only
-  EglSurface(EglSurface&& other);
-  EglSurface& operator=(EglSurface&& other);
-  EglSurface(const EglSurface&) = delete;
-  EglSurface& operator=(const EglSurface&) = delete;
-
-  ~EglSurface() { Invalidate(); }
-
-  EGLSurface surface() const { return surface_; }
-
- private:
-  void Invalidate();
-
-  EGLSurface surface_;
-  EGLDisplay display_;
-};
-
-// Creates off-screen pbuffer-based surface of the given height and width.
-absl::Status CreatePbufferRGBSurface(EGLConfig config, EGLDisplay display,
-                                     uint32_t height, uint32_t width,
-                                     EglSurface* egl_surface);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_EGL_SURFACE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/float16_conversions.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/float16_conversions.h
deleted file mode 100644
index 304c2a2..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/float16_conversions.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 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_GL_FLOAT16_CONVERSIONS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_FLOAT16_CONVERSIONS_H_
-
-#include "tensorflow/lite/delegates/gpu/gl/object.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// If an object is float32, converts it to float16 representation.
-bool MaybeConvertToFloat16(Object* object);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_FLOAT16_CONVERSIONS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_buffer.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_buffer.h
deleted file mode 100644
index 1877fb1..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_buffer.h
+++ /dev/null
@@ -1,332 +0,0 @@
-/* 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_GL_GL_BUFFER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_BUFFER_H_
-
-#include 
-#include 
-#include 
-
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_call.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_errors.h"
-#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Buffer is an RAII wrapper for OpenGL buffer object.
-// See https://www.khronos.org/opengl/wiki/Buffer_Object for more information.
-//
-// Buffer is moveable but not copyable.
-class GlBuffer {
- public:
-  // @param has_ownership indicates that GlBuffer is responsible for
-  // corresponding GL buffer deletion.
-  GlBuffer(GLenum target, GLuint id, size_t bytes_size, size_t offset,
-           bool has_ownership)
-      : target_(target),
-        id_(id),
-        bytes_size_(bytes_size),
-        offset_(offset),
-        has_ownership_(has_ownership) {}
-
-  // Creates invalid buffer.
-  GlBuffer() : GlBuffer(GL_INVALID_ENUM, GL_INVALID_INDEX, 0, 0, false) {}
-
-  // Move-only
-  GlBuffer(GlBuffer&& buffer);
-  GlBuffer& operator=(GlBuffer&& buffer);
-  GlBuffer(const GlBuffer&) = delete;
-  GlBuffer& operator=(const GlBuffer&) = delete;
-
-  ~GlBuffer();
-
-  // Reads data from buffer into CPU memory. Data should point to a region that
-  // has at least bytes_size available.
-  template 
-  absl::Status Read(absl::Span data) const;
-
-  // Writes data to a buffer.
-  template 
-  absl::Status Write(absl::Span data);
-
-  // Maps GPU memory to CPU address space and calls reader that may read from
-  // that memory.
-  template 
-  absl::Status MappedRead(
-      const std::function)>& reader) const;
-
-  // Maps GPU memory to CPU address space and calls writer that may write into
-  // that memory.
-  template 
-  absl::Status MappedWrite(
-      const std::function)>& writer);
-
-  absl::Status MakeView(size_t offset, size_t bytes_size, GlBuffer* gl_buffer);
-
-  // Makes a copy without ownership of the buffer.
-  GlBuffer MakeRef();
-
-  // Binds a buffer to an index.
-  absl::Status BindToIndex(uint32_t index) const;
-
-  // Releases the ownership of the buffer object.
-  void Release() { has_ownership_ = false; }
-
-  size_t bytes_size() const { return bytes_size_; }
-
-  const GLenum target() const { return target_; }
-
-  const GLuint id() const { return id_; }
-
-  bool is_valid() const { return id_ != GL_INVALID_INDEX; }
-
-  size_t offset() const { return offset_; }
-
-  // @return true if this object actually owns corresponding GL buffer
-  //         and manages it's lifetime.
-  bool has_ownership() const { return has_ownership_; }
-
- private:
-  void Invalidate();
-
-  GLenum target_;
-  GLuint id_;
-  size_t bytes_size_;
-  size_t offset_;
-  bool has_ownership_;
-};
-
-absl::Status CopyBuffer(const GlBuffer& read_buffer,
-                        const GlBuffer& write_buffer);
-
-absl::Status GetSSBOSize(GLuint id, int64_t* size_bytes);
-
-// Creates new shader storage buffer that will be modified and used many
-// times.
-//
-// See https://www.khronos.org/opengl/wiki/Shader_Storage_Buffer_Object for
-// details.
-template 
-absl::Status CreateReadWriteShaderStorageBuffer(uint32_t num_elements,
-                                                GlBuffer* gl_buffer);
-
-// Creates new shader storage buffer that will be filled with data once which
-// will be used many times.
-template 
-absl::Status CreateReadOnlyShaderStorageBuffer(absl::Span data,
-                                               GlBuffer* gl_buffer);
-
-// Adapts raw Buffer::Read method to read data into a vector.
-template 
-absl::Status AppendFromBuffer(const GlBuffer& buffer, std::vector* data) {
-  if (buffer.bytes_size() % sizeof(T) != 0) {
-    return absl::InvalidArgumentError("Buffer is not aligned");
-  }
-  size_t num_elements = buffer.bytes_size() / sizeof(T);
-  data->resize(data->size() + num_elements);
-  return buffer.Read(
-      absl::MakeSpan(data->data() + data->size() - num_elements, num_elements));
-}
-
-// Persistent buffer provides CPU pointer to the buffer that is valid all the
-// time. A user should properly synchronize the access to the buffer on CPU and
-// GPU sides.
-class GlPersistentBuffer : public GlBuffer {
- public:
-  GlPersistentBuffer(GLenum target, GLuint id, size_t bytes_size, size_t offset,
-                     bool has_ownership, void* data);
-  GlPersistentBuffer();
-
-  // Move-only
-  GlPersistentBuffer(GlPersistentBuffer&& buffer);
-  GlPersistentBuffer& operator=(GlPersistentBuffer&& buffer);
-  GlPersistentBuffer(const GlPersistentBuffer&) = delete;
-  GlPersistentBuffer& operator=(const GlPersistentBuffer&) = delete;
-
-  ~GlPersistentBuffer();
-
-  void* data() { return data_; }
-
- private:
-  void* data_;
-};
-
-// Creates read-write persistent buffer with valid CPU pointer
-absl::Status CreatePersistentBuffer(size_t size, GlPersistentBuffer* gl_buffer);
-
-////////////////////////////////////////////////////////////////////////////////
-// Implementation details are below.
-
-namespace gl_buffer_internal {
-
-// RAII for creating and/or owning buffer id.
-class BufferId {
- public:
-  BufferId() : id_(GL_INVALID_INDEX) {
-    TFLITE_GPU_CALL_GL(glGenBuffers, 1 /* number of buffers */, &id_)
-        .IgnoreError();
-    // only possible error here is when a number of buffers is negative.
-  }
-
-  explicit BufferId(GLuint id) : id_(id) {}
-
-  ~BufferId() {
-    if (id_ != GL_INVALID_INDEX) {
-      TFLITE_GPU_CALL_GL(glDeleteBuffers, 1, &id_).IgnoreError();
-    }
-  }
-
-  GLuint id() const { return id_; }
-
-  GLuint Release() {
-    GLuint id = GL_INVALID_INDEX;
-    std::swap(id, id_);
-    return id;
-  }
-
- private:
-  GLuint id_;
-};
-
-// RAII for binding and unbinding a buffer.
-class BufferBinder {
- public:
-  BufferBinder(GLenum target, GLuint id) : target_(target), prev_id_(0) {
-    TFLITE_GPU_CALL_GL(glBindBuffer, target_, id).IgnoreError();
-  }
-
-  BufferBinder(GLenum target, GLuint id, GLuint prev_id)
-      : target_(target), prev_id_(prev_id) {
-    TFLITE_GPU_CALL_GL(glBindBuffer, target_, id).IgnoreError();
-  }
-
-  ~BufferBinder() {
-    TFLITE_GPU_CALL_GL(glBindBuffer, target_, prev_id_).IgnoreError();
-  }
-
- private:
-  const GLenum target_;
-  GLuint prev_id_;
-};
-
-// RAII for mapping and unmapping a buffer.
-class BufferMapper {
- public:
-  BufferMapper(GLenum target, size_t offset, size_t bytes, GLbitfield access);
-
-  ~BufferMapper();
-
-  void* data() { return data_; }
-
- private:
-  const GLenum target_;
-  void* data_;
-};
-
-}  // namespace gl_buffer_internal
-
-template 
-absl::Status CreateReadWriteShaderStorageBuffer(uint32_t num_elements,
-                                                GlBuffer* gl_buffer) {
-  gl_buffer_internal::BufferId id;
-  gl_buffer_internal::BufferBinder binder(GL_SHADER_STORAGE_BUFFER, id.id());
-  // TODO(akulik): benchmark DYNAMIC vs STREAM buffer
-  RETURN_IF_ERROR(TFLITE_GPU_CALL_GL(glBufferData, GL_SHADER_STORAGE_BUFFER,
-                                     num_elements * sizeof(T), nullptr,
-                                     GL_STREAM_COPY));
-  *gl_buffer = GlBuffer{GL_SHADER_STORAGE_BUFFER, id.Release(),
-                        num_elements * sizeof(T), 0, true};
-  return absl::OkStatus();
-}
-
-template 
-absl::Status CreateReadOnlyShaderStorageBuffer(absl::Span data,
-                                               GlBuffer* gl_buffer) {
-  gl_buffer_internal::BufferId id;
-  gl_buffer_internal::BufferBinder binder(GL_SHADER_STORAGE_BUFFER, id.id());
-  RETURN_IF_ERROR(TFLITE_GPU_CALL_GL(glBufferData, GL_SHADER_STORAGE_BUFFER,
-                                     data.size() * sizeof(T), data.data(),
-                                     GL_STATIC_READ));
-  *gl_buffer = GlBuffer{GL_SHADER_STORAGE_BUFFER, id.Release(),
-                        data.size() * sizeof(T), 0, true};
-  return absl::OkStatus();
-}
-
-template 
-absl::Status GlBuffer::Read(absl::Span data) const {
-  if (data.size() * sizeof(T) < bytes_size()) {
-    return absl::InvalidArgumentError(
-        "Read from buffer failed. Destination data is shorter than buffer.");
-  }
-  // TODO(akulik): glCopyBufferSubData is actually available in ES 3.1, try it.
-  return MappedRead([this, data](absl::Span src) {
-    std::memcpy(data.data(), src.data(), bytes_size());
-    return absl::OkStatus();
-  });
-}
-
-template 
-absl::Status GlBuffer::Write(absl::Span data) {
-  if (data.size() * sizeof(T) > bytes_size_) {
-    return absl::InvalidArgumentError(
-        "Write to buffer failed. Source data is larger than buffer.");
-  }
-  gl_buffer_internal::BufferBinder binder(target_, id_);
-  return TFLITE_GPU_CALL_GL(glBufferSubData, target_, offset_, bytes_size_,
-                            data.data());
-}
-
-template 
-absl::Status GlBuffer::MappedRead(
-    const std::function d)>& reader) const {
-  if (bytes_size_ % sizeof(T) != 0) {
-    return absl::InvalidArgumentError("Buffer is not aligned");
-  }
-  gl_buffer_internal::BufferBinder binder(target_, id_);
-  gl_buffer_internal::BufferMapper mapper(target_, offset_, bytes_size_,
-                                          GL_MAP_READ_BIT);
-  if (!mapper.data()) {
-    return GetOpenGlErrors();
-  }
-  return reader(absl::MakeSpan(reinterpret_cast(mapper.data()),
-                               bytes_size_ / sizeof(T)));
-}
-
-template 
-absl::Status GlBuffer::MappedWrite(
-    const std::function d)>& writer) {
-  if (bytes_size_ % sizeof(T) != 0) {
-    return absl::InvalidArgumentError("Buffer is not aligned");
-  }
-  gl_buffer_internal::BufferBinder binder(target_, id_);
-  gl_buffer_internal::BufferMapper mapper(target_, offset_, bytes_size_,
-                                          GL_MAP_WRITE_BIT);
-  if (!mapper.data()) {
-    return GetOpenGlErrors();
-  }
-  return writer(absl::MakeSpan(reinterpret_cast(mapper.data()),
-                               bytes_size_ / sizeof(T)));
-}
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_BUFFER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_call.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_call.h
deleted file mode 100644
index 1a392d6..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_call.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* 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_GL_GL_CALL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_CALL_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_errors.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Primary purpose of this file is to provide useful macro for calling GL
-// functions and checking errors. It also attaches a context to status in case
-// of a GL error.
-//
-// Use TFLITE_GPU_CALL_GL as follows:
-//
-//   For GL functions with a return value:
-//     Before:
-//       GLint result = glFunc(...);
-//       RETURN_IF_ERROR(GetOpenGlErrors());
-//     After:
-//       GLint result;
-//       RETURN_IF_ERROR(TFLITE_GPU_CALL_GL(glFunc, &result, ...));
-//
-//   For GL functions without a return value:
-//     Before:
-//       glFunc(...);
-//       RETURN_IF_ERROR(GetOpenGlErrors());
-//     After:
-//       RETURN_IF_ERROR(TFLITE_GPU_CALL_GL(glFunc, ...));
-
-namespace gl_call_internal {
-
-// For GL functions with a return value.
-template 
-struct Caller {
-  template 
-  absl::Status operator()(const std::string& context, F func, ErrorF error_func,
-                          T* result, Params&&... params) {
-    *result = func(std::forward(params)...);
-    const auto status = error_func();
-    if (status.ok()) return absl::OkStatus();
-    return absl::Status(status.code(),
-                        std::string(status.message()) + ": " + context);
-  }
-};
-
-// For GL functions without a return value.
-template<>
-struct Caller {
-  template 
-  absl::Status operator()(const std::string& context, F func, ErrorF error_func,
-                          Params&&... params) {
-    func(std::forward(params)...);
-    const auto status = error_func();
-    if (status.ok()) return absl::OkStatus();
-    return absl::Status(status.code(),
-                        std::string(status.message()) + ": " + context);
-  }
-};
-
-template 
-absl::Status CallAndCheckError(const std::string& context, F func,
-                               ErrorF error_func, ResultT* result,
-                               ParamsT&&... params) {
-  return Caller()(context, func, error_func, result,
-                           std::forward(params)...);
-}
-
-template 
-absl::Status CallAndCheckError(const std::string& context, F func,
-                               ErrorF error_func, Params&&... params) {
-  return Caller()(context, func, error_func,
-                        std::forward(params)...);
-}
-
-}  // namespace gl_call_internal
-
-// XX_STRINGIFY is a helper macro to effectively apply # operator to an
-// arbitrary value.
-#define TFLITE_GPU_INTERNAL_STRINGIFY_HELPER(x) #x
-#define TFLITE_GPU_INTERNAL_STRINGIFY(x) TFLITE_GPU_INTERNAL_STRINGIFY_HELPER(x)
-#define TFLITE_GPU_FILE_LINE \
-  __FILE__ ":" TFLITE_GPU_INTERNAL_STRINGIFY(__LINE__)
-
-#define TFLITE_GPU_CALL_GL(method, ...)                   \
-  ::tflite::gpu::gl::gl_call_internal::CallAndCheckError( \
-      #method " in " TFLITE_GPU_FILE_LINE, method,        \
-      ::tflite::gpu::gl::GetOpenGlErrors, __VA_ARGS__)
-
-#define TFLITE_GPU_CALL_EGL(method, ...)                  \
-  ::tflite::gpu::gl::gl_call_internal::CallAndCheckError( \
-      #method " in " TFLITE_GPU_FILE_LINE, method,        \
-      ::tflite::gpu::gl::GetEglError, __VA_ARGS__)
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_CALL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_errors.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_errors.h
deleted file mode 100644
index 761eddd..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_errors.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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_GL_GL_ERRORS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_ERRORS_H_
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// @return recent opengl errors and packs them into Status.
-absl::Status GetOpenGlErrors();
-
-// @return the error of the last called EGL function in the current thread.
-absl::Status GetEglError();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_ERRORS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_program.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_program.h
deleted file mode 100644
index 892cb8e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_program.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* 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_GL_GL_PROGRAM_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_PROGRAM_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_shader.h"
-#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
-#include "tensorflow/lite/delegates/gpu/gl/variable.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// A wrapper around opengl program id that needs to be recycled when not needed.
-// Encapsulates logic needed to bind parameters, link a program and execute it.
-class GlProgram {
- public:
-  // Creates invalid program.
-  GlProgram() : id_(0) {}
-
-  // Creates new program, initializes it, attaches the given shader and links
-  // a program. Thus, if this call returns a program, one may set parameters and
-  // finally execute a program.
-  // therefore it needs to be handled elsewhere.
-  static absl::Status CreateWithShader(const GlShader& shader,
-                                       GlProgram* gl_program);
-
-  // Same as CreateWithShader but takes compiled shader in a binary form,
-  // therefore compilation step is avoided.
-  static absl::Status CreateWithBinaryShader(const BinaryShader& shader,
-                                             GlProgram* gl_program);
-
-  // move-only
-  GlProgram(GlProgram&& program);
-  GlProgram& operator=(GlProgram&& program);
-  GlProgram(const GlProgram&) = delete;
-  GlProgram& operator=(const GlProgram&) = delete;
-
-  ~GlProgram();
-
-  GLuint id() const { return id_; }
-
-  // Returns a binary representation for a shader currently attached and linked
-  // into this program.
-  absl::Status GetBinary(BinaryShader* binary_shader);
-
-  absl::Status SetParameter(const Variable& param);
-
-  // Executes program
-  absl::Status Dispatch(const uint3& workgroups) const;
-
-  bool is_valid() const { return id_ != 0; }
-
- private:
-  explicit GlProgram(GLuint program_id) : id_(program_id) {}
-
-  void Invalidate();
-
-  GLint GetUniformId(const std::string& name);
-
-  GLuint id_;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_PROGRAM_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_shader.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_shader.h
deleted file mode 100644
index 45adc59..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_shader.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* 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_GL_GL_SHADER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_SHADER_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// A wrapper around opengl shader id that needs to be recycled when not needed.
-class GlShader {
- public:
-  // Creates and compiles a shader.
-  //
-  // @param shader_type is one of GL_VERTEX_SHADER, GL_FRAGMENT_SHADER, or
-  // GL_COMPUTE_SHADER.
-  static absl::Status CompileShader(GLenum shader_type,
-                                    const std::string& shader_source,
-                                    GlShader* gl_shader);
-
-  GlShader() : id_(0) {}
-
-  // move-only
-  GlShader(GlShader&& shader);
-  GlShader& operator=(GlShader&& shader);
-  GlShader(const GlShader&) = delete;
-  GlShader& operator=(const GlShader&) = delete;
-
-  ~GlShader();
-
-  GLuint id() const { return id_; }
-
- private:
-  explicit GlShader(GLuint id) : id_(id) {}
-
-  void Invalidate();
-
-  GLuint id_;
-};
-
-// Holds binary blob for compiled shader. It can be used to instantiate
-// a program instead of plain Shader that will need to be compiled first.
-//
-// Some OpenGL implementations allow to extract binary representation once it
-// is compiled. Call Program::GetBinary after program is successfully created
-// with a shader from sources.
-class BinaryShader {
- public:
-  BinaryShader(GLenum format, std::vector binary)
-      : format_(format), binary_(std::move(binary)) {}
-
-  GLenum format() const { return format_; }
-
-  const std::vector& binary() const { return binary_; }
-
- private:
-  GLenum format_;
-  std::vector binary_;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_SHADER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_sync.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_sync.h
deleted file mode 100644
index 8b5d910..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_sync.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* 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_GL_GL_SYNC_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_SYNC_H_
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_buffer.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_call.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_program.h"
-#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// RAII wrapper for OpenGL GLsync object.
-// See https://www.khronos.org/opengl/wiki/Sync_Object for more information.
-//
-// GlSync is moveable but not copyable.
-class GlSync {
- public:
-  static absl::Status NewSync(GlSync* gl_sync) {
-    GLsync sync;
-    RETURN_IF_ERROR(TFLITE_GPU_CALL_GL(glFenceSync, &sync,
-                                       GL_SYNC_GPU_COMMANDS_COMPLETE, 0));
-    *gl_sync = GlSync(sync);
-    return absl::OkStatus();
-  }
-
-  // Creates invalid object.
-  GlSync() : GlSync(nullptr) {}
-
-  // Move-only
-  GlSync(GlSync&& sync) : sync_(sync.sync_) { sync.sync_ = nullptr; }
-
-  GlSync& operator=(GlSync&& sync) {
-    if (this != &sync) {
-      Invalidate();
-      std::swap(sync_, sync.sync_);
-    }
-    return *this;
-  }
-
-  GlSync(const GlSync&) = delete;
-  GlSync& operator=(const GlSync&) = delete;
-
-  ~GlSync() { Invalidate(); }
-
-  const GLsync sync() const { return sync_; }
-
- private:
-  explicit GlSync(GLsync sync) : sync_(sync) {}
-
-  void Invalidate() {
-    if (sync_) {
-      glDeleteSync(sync_);
-      sync_ = nullptr;
-    }
-  }
-
-  GLsync sync_;
-};
-
-// Waits until GPU is done with processing.
-absl::Status GlSyncWait();
-
-// Waits until all commands are flushed and then performs active waiting by
-// spinning a thread and checking sync status. It leads to shorter wait time
-// (up to tens of ms) but consumes more CPU.
-absl::Status GlActiveSyncWait();
-
-// CPU checks the value in the buffer that is going to be written by GPU. The
-// persistent buffer is used for the simultaneous access to the buffer by GPU
-// and CPU. The instance remains invalid if persistent buffer OpenGL extension
-// is not supported by the device.
-class GlShaderSync {
- public:
-  static absl::Status NewSync(GlShaderSync* gl_sync);
-  GlShaderSync() {}
-  absl::Status Wait();
-
- private:
-  GlProgram flag_program_;
-  GlPersistentBuffer flag_buffer_;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_SYNC_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_texture.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_texture.h
deleted file mode 100644
index 60e22b4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/gl_texture.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/* 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_GL_GL_TEXTURE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_TEXTURE_H_
-
-#include "absl/types/span.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.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/gl/gl_call.h"
-#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Texture is an RAII wrapper for OpenGL texture object.
-// See https://www.khronos.org/opengl/wiki/Texture for more information.
-//
-// Texture is moveable but not copyable.
-class GlTexture {
- public:
-  // Creates invalid texture.
-  GlTexture()
-      : GlTexture(GL_INVALID_ENUM, GL_INVALID_INDEX, GL_INVALID_ENUM, 0, 0,
-                  false) {}
-
-  GlTexture(GLenum target, GLuint id, GLenum format, size_t bytes_size,
-            GLint layer, bool owned)
-      : id_(id),
-        target_(target),
-        format_(format),
-        bytes_size_(bytes_size),
-        layer_(layer),
-        owned_(owned) {}
-
-  // Move-only
-  GlTexture(GlTexture&& texture);
-  GlTexture& operator=(GlTexture&& texture);
-  GlTexture(const GlTexture&) = delete;
-  GlTexture& operator=(const GlTexture&) = delete;
-
-  ~GlTexture();
-
-  // Binds a texture as an image to the given index.
-  absl::Status BindAsReadonlyImage(uint32_t index) const;
-
-  // Bind texture as an image for write access at given index.
-  absl::Status BindAsWriteonlyImage(uint32_t index) const;
-
-  // Bind texture as an image for read-write access at given index.
-  absl::Status BindAsReadWriteImage(uint32_t index) const;
-
-  // Binds a texture as a sampler to the given index.
-  absl::Status BindAsSampler2D(uint32_t index) const;
-
-  GLenum target() const { return target_; }
-
-  GLuint id() const { return id_; }
-
-  GLenum format() const { return format_; }
-
-  GLint layer() const { return layer_; }
-
-  bool is_valid() const { return id_ != GL_INVALID_INDEX; }
-
-  size_t bytes_size() const { return bytes_size_; }
-
-  // @return true if this object actually owns corresponding GL buffer
-  //         and manages it's lifetime.
-  bool has_ownership() const { return owned_; }
-
- private:
-  void Invalidate();
-
-  absl::Status BindImage(uint32_t index, GLenum access) const;
-
-  GLuint id_;
-  GLenum target_;
-  GLenum format_;
-  size_t bytes_size_;
-  GLint layer_;
-  bool owned_;
-};
-
-// Creates new 2D image texture that will be filled with float32 data once which
-// will be used for reading.
-//
-// @param size defines 2D image texture size where each pixel is RGBA.
-absl::Status CreateReadOnlyImageTexture(const uint2& size,
-                                        absl::Span data,
-                                        GlTexture* gl_texture);
-
-// Creates new 2D image texture that will be filled with float16 data once which
-// will be used for reading.
-//
-// @param size defines 2D image texture size where each pixel is RGBA.
-absl::Status CreateReadOnlyImageTextureF16(const uint2& size,
-                                           absl::Span data,
-                                           GlTexture* gl_texture);
-
-// Creates new 2D image texture that will be filled with uint8 data once which
-// will be used for reading.
-//
-// @param size defines 2D image texture size where each pixel is RGBA.
-absl::Status CreateReadOnlyImageTextureU8(const uint2& size,
-                                          absl::Span data,
-                                          GlTexture* gl_texture);
-
-// Creates new 3D RGBA image texture that will be filled with float32 data once
-// which will be used for reading.
-//
-// @param size defines 3D image texture size where each pixel is RGBA.
-absl::Status CreateReadOnlyImageTexture(const uint3& size,
-                                        absl::Span data,
-                                        GlTexture* gl_texture);
-
-// Creates new 3D RGBA image texture that will be filled with float16 data once
-// which will be used for reading.
-//
-// @param size defines 3D image texture size where each pixel is RGBA.
-absl::Status CreateReadOnlyImageTextureF16(const uint3& size,
-                                           absl::Span data,
-                                           GlTexture* gl_texture);
-
-// Creates new RGBA 2D image texture
-//
-// @param size defines 2D image texture size where each pixel is RGBA.
-absl::Status CreateReadWriteRgbaImageTexture(DataType data_type,
-                                             const uint2& size,
-                                             GlTexture* gl_texture);
-
-// Creates new RGBA 3D image texture
-//
-// @param size defines 3D image texture size where each pixel is RGBA.
-absl::Status CreateReadWriteRgbaImageTexture(DataType data_type,
-                                             const uint3& size,
-                                             GlTexture* gl_texture);
-
-GLenum ToTextureFormat(DataType type);
-
-GLenum ToTextureInternalFormat(DataType type);
-
-GLenum ToTextureDataType(DataType type);
-
-namespace gl_texture_internal {
-
-// RAII for creating and/or owning texture id.
-class TextureId {
- public:
-  TextureId() : id_(GL_INVALID_INDEX) {
-    TFLITE_GPU_CALL_GL(glGenTextures, 1 /* number of textures*/, &id_)
-        .IgnoreError();
-  }
-
-  explicit TextureId(GLuint id) : id_(id) {}
-
-  ~TextureId() {
-    if (id_ != GL_INVALID_INDEX) {
-      TFLITE_GPU_CALL_GL(glDeleteTextures, 1, &id_).IgnoreError();
-    }
-  }
-
-  GLuint id() const { return id_; }
-
-  GLuint Release() {
-    GLuint id = GL_INVALID_INDEX;
-    std::swap(id, id_);
-    return id;
-  }
-
- private:
-  GLuint id_;
-};
-
-// RAII for binding and unbinding a texture.
-class TextureBinder {
- public:
-  TextureBinder(GLenum target, GLuint id) : target_(target) {
-    TFLITE_GPU_CALL_GL(glBindTexture, target_, id).IgnoreError();
-  }
-
-  ~TextureBinder() {
-    TFLITE_GPU_CALL_GL(glBindTexture, target_, 0).IgnoreError();
-  }
-
- private:
-  const GLenum target_;
-};
-
-}  // namespace gl_texture_internal
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_GL_TEXTURE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/add.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/add.h
deleted file mode 100644
index cfd6ce8..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/add.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_ADD_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_ADD_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewAddNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_ADD_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/concat.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/concat.h
deleted file mode 100644
index 34c027d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/concat.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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_GL_KERNELS_CONCAT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_CONCAT_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewAlignedConcatNodeShader();
-std::unique_ptr NewConcatNodeShader();
-std::unique_ptr NewFlatConcatNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_CONCAT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/conv.h
deleted file mode 100644
index c2f2d21..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/conv.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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_GL_KERNELS_CONV_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_CONV_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewConvolutionNodeShader();
-
-// Specialization for 1x1 convolutions.
-std::unique_ptr NewConvolution1x1NodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/converter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/converter.h
deleted file mode 100644
index c5f2ba2..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/converter.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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_GL_KERNELS_CONVERTER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_CONVERTER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/gl/command_queue.h"
-#include "tensorflow/lite/delegates/gpu/spi.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Supports conversions from DHWC4 to internal OpenGL tensor representation and
-// back. Supports F32 only.
-std::unique_ptr NewConverterBuilder(
-    CommandQueue* command_queue /* optional */);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_CONVERTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/custom_registry.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/custom_registry.h
deleted file mode 100644
index 7b2a841..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/custom_registry.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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_GL_KERNELS_CUSTOM_REGISTRY_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_CUSTOM_REGISTRY_H_
-
-#include 
-#include 
-#include 
-
-#include "absl/container/flat_hash_map.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Registers custom operations.
-void RegisterCustomOps(
-    absl::flat_hash_map>>*
-        shaders_);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_CUSTOM_REGISTRY_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/depthwise_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/depthwise_conv.h
deleted file mode 100644
index a953010..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/depthwise_conv.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_DEPTHWISE_CONV_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_DEPTHWISE_CONV_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewDepthwiseConvolutionNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_DEPTHWISE_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/elementwise.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/elementwise.h
deleted file mode 100644
index 42109d9..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/elementwise.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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_GL_KERNELS_ELEMENTWISE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_ELEMENTWISE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewElementwiseNodeShader(
-    OperationType operation_type);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_ELEMENTWISE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/fully_connected.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/fully_connected.h
deleted file mode 100644
index 3a137f4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/fully_connected.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_FULLY_CONNECTED_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_FULLY_CONNECTED_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewFullyConnectedNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_FULLY_CONNECTED_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/lstm.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/lstm.h
deleted file mode 100644
index fcc5acd..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/lstm.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_LSTM_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_LSTM_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewLstmNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_LSTM_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/max_unpooling.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/max_unpooling.h
deleted file mode 100644
index f4deb73..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/max_unpooling.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_MAX_UNPOOLING_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_MAX_UNPOOLING_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewMaxUnpoolingNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_MAX_UNPOOLING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/mean.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/mean.h
deleted file mode 100644
index af2628f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/mean.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_MEAN_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_MEAN_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewMeanNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_MEAN_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/mul.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/mul.h
deleted file mode 100644
index ff760f9..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/mul.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_MUL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_MUL_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewMultiplyNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_MUL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/pad.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/pad.h
deleted file mode 100644
index c6840df..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/pad.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* 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_GL_KERNELS_PAD_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_PAD_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewPadNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_PAD_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/pooling.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/pooling.h
deleted file mode 100644
index c4f650c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/pooling.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_POOLING_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_POOLING_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewPoolingNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_POOLING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/prelu.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/prelu.h
deleted file mode 100644
index 30d3019..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/prelu.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_PRELU_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_PRELU_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewPReLUNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_PRELU_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/quantize_and_dequantize.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/quantize_and_dequantize.h
deleted file mode 100644
index 46c4038..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/quantize_and_dequantize.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_QUANTIZE_AND_DEQUANTIZE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_QUANTIZE_AND_DEQUANTIZE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Performs the operation: {Quantize, Dequantize} on floating-point data.
-// We need this operation to emulate the error introduced by quantization
-// on the GPU, which cannot represent int8 tensors.
-//
-// Implemented as:
-// qvalue = round((min(qmax, max(qmin, src_val)) - qmin) * (1/qscale))
-// dq_value = qvalue * qscale + qmin
-// Here, qmin, qmax & qscale refer to the quantization values as implemented in
-// TensorFlow Lite's 'FakeQuant' kernel.
-//
-// NOTE: We do not need to nudge min/max values in this op, since they would
-// already be adjusted while generating the quantized model.
-std::unique_ptr NewQuantizeAndDequantizeNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_QUANTIZE_AND_DEQUANTIZE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/registry.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/registry.h
deleted file mode 100644
index 009a928..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/registry.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* 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_GL_KERNELS_REGISTRY_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_REGISTRY_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewNodeShaderRegistry();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_REGISTRY_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/relu.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/relu.h
deleted file mode 100644
index fdc812b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/relu.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_RELU_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_RELU_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewReLUNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_RELU_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/reshape.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/reshape.h
deleted file mode 100644
index b2b0914..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/reshape.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_RESHAPE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_RESHAPE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewReshapeNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_RESHAPE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/resize.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/resize.h
deleted file mode 100644
index 9d41404..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/resize.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_RESIZE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_RESIZE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewResizeNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_RESIZE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/slice.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/slice.h
deleted file mode 100644
index bf93043..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/slice.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_SLICE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_SLICE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewSliceNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_SLICE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/softmax.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/softmax.h
deleted file mode 100644
index 2b6c786..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/softmax.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_SOFTMAX_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_SOFTMAX_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewSoftmaxNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_SOFTMAX_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/space_to_depth.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/space_to_depth.h
deleted file mode 100644
index 3c52ef4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/space_to_depth.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_SPACE_TO_DEPTH_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_SPACE_TO_DEPTH_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewSpaceToDepthNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_SPACE_TO_DEPTH_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/test_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/test_util.h
deleted file mode 100644
index 42a7890..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/test_util.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* 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_GL_KERNELS_TEST_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_TEST_UTIL_H_
-
-#include 
-#include 
-
-#include 
-#include 
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/tensor.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler_options.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-#include "tensorflow/lite/delegates/gpu/gl/runtime_options.h"
-
-#ifndef ASSERT_OK
-#define ASSERT_OK(x) ASSERT_THAT(x.message(), testing::StrEq(""));
-#endif
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-class SingleOpModel {
- public:
-  SingleOpModel() = delete;
-  SingleOpModel(Operation&& operation,
-                const std::vector>& inputs,
-                const std::vector>& outputs);
-
-  virtual ~SingleOpModel() = default;
-
-  bool PopulateTensor(int index, std::vector&& data);
-
-  absl::Status Invoke(const NodeShader& shader);
-  absl::Status Invoke(const CompilationOptions& compile_options,
-                      const RuntimeOptions& runtime_options,
-                      const NodeShader& shader);
-
-  const std::vector& GetOutput(int index) const {
-    return outputs_[index].data;
-  }
-
- protected:
-  GraphFloat32 graph_;
-  std::vector inputs_;
-  std::vector outputs_;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_TEST_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/transpose_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/transpose_conv.h
deleted file mode 100644
index 553704b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/kernels/transpose_conv.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_KERNELS_TRANSPOSE_CONV_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_TRANSPOSE_CONV_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/gl/node_shader.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr NewConvolutionTransposedNodeShader();
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_KERNELS_TRANSPOSE_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/node_shader.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/node_shader.h
deleted file mode 100644
index 0575182..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/node_shader.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* 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_GL_NODE_SHADER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_NODE_SHADER_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "absl/types/any.h"
-#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler_options.h"
-#include "tensorflow/lite/delegates/gpu/gl/object.h"
-#include "tensorflow/lite/delegates/gpu/gl/variable.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-enum class IOStructure {
-  // Source code uses standard inputs or outputs that should be generated from
-  // node inputs/outputs. Compiler will generate them automatically as
-  // 'input_data_N'/'output_data_N', where N is an index of the input/output.
-  //
-  // Generated code should not return input objects.
-  ONLY_DEFINITIONS,
-
-  // For inputs:
-  //   Source code runs computations using 'vec4 value_N' declared by
-  //   the compiler, where where N is an index of the input. Each value comes
-  //   from inputs using coordinates set by GlobalInvocationID and a dispatch
-  //   method, therefore, source code should not explicitly read values.
-  //
-  // For outputs:
-  //   Source code runs computations and leaves results in 'vec4 value_N'
-  //   declared by the compiler, where N is an index of the output. Value will
-  //   be written to the output using coordinates set by GlobalInvocationID and
-  //   a dispatch method. Therefore, source code should not explicitly write
-  //   results.
-  AUTO,
-};
-
-struct GeneratedCode {
-  // A list of parameters to be set as uniform or hardcoded in a shader.
-  std::vector parameters;
-
-  // A list of objects to bind before shader could be executed.
-  std::vector> objects;
-
-  // A list of shared variables in the shader program.
-  std::vector shared_variables;
-
-  // Compute shader operate on an abstract concept of work groups, each
-  // three-dimensional. The number of work groups to be executed is defined by
-  // workload tuple. Therefore,
-  //   workload[x,y,z] := workgroup_size[x,y,z] X workgroup_count[x,y,z]
-  // where 'X' is element-wise multiplication.
-  //
-  // Zero workload is calculated as PHWC4 based on output tensor.
-  uint3 workload;
-
-  // operation may specify recommended workgroup size. If not set, runtime will
-  // figure it out automatically.
-  uint3 workgroup;
-
-  std::string source_code;
-
-  // Parameters below reveal additional information about source_code.
-
-  IOStructure input;
-  IOStructure output;
-};
-
-// A class handles shader generation and setting runtime shader parameters.
-class NodeShader {
- public:
-  virtual ~NodeShader() = default;
-
-  // A context for generating a code.
-  struct GenerationContext {
-    const GpuInfo* gpu_info;
-    CompilationOptions compiler_options;
-
-    // Information extracted & copied from compiled graph.
-    const std::string& op_type;
-    const absl::any& op_attr;
-    // Do NOT use StrongShape in preparation for
-    // RankedTensorType::getShape() which returns ArrayRef.
-    std::vector> input_shapes;
-    std::vector> output_shapes;
-  };
-
-  // Generates shader code for a node. The code should be just a function body.
-  virtual absl::Status GenerateCode(const GenerationContext& ctx,
-                                    GeneratedCode* generated_code) const = 0;
-
-  // Limit the size of the const offsets array
-  static constexpr int kMaxConstArraySize = 9;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_NODE_SHADER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/object.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/object.h
deleted file mode 100644
index 0c2a232..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/object.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* 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_GL_OBJECT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_OBJECT_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "absl/types/variant.h"
-#include "tensorflow/lite/delegates/gpu/common/access_type.h"
-#include "tensorflow/lite/delegates/gpu/common/data_type.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/common/util.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-using ObjectData = std::vector;
-
-// Generic identifier to be used to lookup an object.
-using ObjectRef = uint32_t;
-
-constexpr ObjectRef kInvalidObjectRef = ~0;
-
-enum class ObjectType : int {
-  UNKNOWN = 0,
-  TEXTURE = 1,
-  BUFFER = 2,
-};
-
-using ObjectSize = absl::variant;
-
-// An object represents a reference to or pre-defined constant OpenGL Buffer or
-// Texture. NodeShader is supposed to set all fields but leave binding = 0
-// that will be set later by a compiler.
-struct Object {
-  AccessType access;
-
-  DataType data_type;
-
-  ObjectType object_type;
-
-  // OpenGL-specific binding information
-  uint32_t binding;
-
-  // Indicates size of 1D, 2D or 3D object in elements, where single element
-  // consists of 4 values.
-  ObjectSize size;
-
-  absl::variant object;
-};
-
-// @return true if object is a reference.
-inline bool IsRef(const Object& object) {
-  return !absl::holds_alternative(object.object);
-}
-
-inline ObjectRef GetRef(const Object& object) {
-  auto ref = absl::get_if(&object.object);
-  return ref ? *ref : kInvalidObjectRef;
-}
-
-inline const ObjectData* GetData(const Object& object) {
-  return absl::get_if(&object.object);
-}
-
-inline size_t ByteSizeOf(const Object& object);
-
-// @return object that references an object created externally.
-inline Object MakeObjectRef(ObjectRef unique_id, const ObjectSize& size,
-                            AccessType access_type) {
-  return Object{access_type, DataType::FLOAT32, ObjectType::UNKNOWN, 0,
-                size,        unique_id};
-}
-
-namespace internal_object {
-
-template 
-std::vector ToBytesVector(const std::vector& data,
-                                   size_t alignment) {
-  std::vector t(AlignByN(data.size() * sizeof(T), alignment));
-  std::memcpy(t.data(), data.data(), data.size() * sizeof(T));
-  return t;
-}
-
-struct ObjectSizer {
-  size_t operator()(const uint3& size) const {
-    return size.x * size.y * size.z;
-  }
-
-  size_t operator()(const uint2& size) const { return size.x * size.y; }
-
-  size_t operator()(uint32_t size) const { return size; }
-};
-
-}  // namespace internal_object
-
-inline size_t NumElements(const ObjectSize& size) {
-  return absl::visit(internal_object::ObjectSizer{}, size);
-}
-
-inline size_t ByteSizeOf(const Object& object) {
-  return SizeOf(object.data_type) * /* vec4 */ 4 * NumElements(object.size);
-}
-
-inline Object MakeReadonlyObject(const ObjectSize& size,
-                                 const std::vector& data) {
-  return Object{AccessType::READ,
-                DataType::FLOAT32,
-                ObjectType::UNKNOWN,
-                0,
-                size,
-                internal_object::ToBytesVector(data, 16)};
-}
-
-inline Object MakeReadonlyTexture(const ObjectSize& size,
-                                  const std::vector& data) {
-  return Object{AccessType::READ,
-                DataType::FLOAT32,
-                ObjectType::TEXTURE,
-                0,
-                size,
-                internal_object::ToBytesVector(data, 16)};
-}
-
-inline Object MakeReadonlyBuffer(const ObjectSize& size,
-                                 const std::vector& data) {
-  return Object{AccessType::READ,
-                DataType::FLOAT32,
-                ObjectType::BUFFER,
-                0,
-                size,
-                internal_object::ToBytesVector(data, 16)};
-}
-
-inline Object MakeReadonlyObject(const std::vector& data) {
-  return MakeReadonlyObject(
-      DivideRoundUp(static_cast(data.size()), 4U), data);
-}
-
-inline Object MakeReadonlyTexture(const std::vector& data) {
-  return MakeReadonlyTexture(
-      DivideRoundUp(static_cast(data.size()), 4U), data);
-}
-
-inline Object MakeReadonlyBuffer(const std::vector& data) {
-  return MakeReadonlyBuffer(
-      DivideRoundUp(static_cast(data.size()), 4U), data);
-}
-
-// TODO(akulik): find better place for functions below.
-
-inline uint3 GetPHWC4Size(const BHWC& shape) {
-  uint3 size;
-  size.x = shape.w;
-  size.y = shape.h;
-  size.z = shape.b * DivideRoundUp(shape.c, 4);
-  return size;
-}
-
-inline Object MakePHWC4Ref(uint32_t global_id, const BHWC& shape) {
-  return MakeObjectRef(global_id, GetPHWC4Size(shape), AccessType::READ_WRITE);
-}
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_OBJECT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/object_manager.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/object_manager.h
deleted file mode 100644
index 0a7de28..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/object_manager.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* 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_GL_OBJECT_MANAGER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_OBJECT_MANAGER_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_buffer.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_texture.h"
-#include "tensorflow/lite/delegates/gpu/gl/stats.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// ObjectManager is a registry that owns corresponding objects and provides
-// discovery functionality. All objects are kept until manager is destroyed.
-//
-// All buffers and textures share the same id space, therefore, it is an error
-// to register two objects with the same id.
-// TODO(akulik): make ObjectManager templated by object type.
-class ObjectManager {
- public:
-  // Moves ownership over the given buffer to the manager.
-  absl::Status RegisterBuffer(uint32_t id, GlBuffer buffer);
-
-  void RemoveBuffer(uint32_t id);
-
-  // Return a permanent pointer to a buffer for the given id or nullptr.
-  GlBuffer* FindBuffer(uint32_t id) const;
-
-  // Moves ownership over the given texture to the manager.
-  absl::Status RegisterTexture(uint32_t id, GlTexture texture);
-
-  void RemoveTexture(uint32_t id);
-
-  // Return a permanent pointer to a texture for the given id or nullptr.
-  GlTexture* FindTexture(uint32_t id) const;
-
-  ObjectsStats stats() const;
-
- private:
-  std::vector> buffers_;
-  std::vector> textures_;
-};
-
-// TODO(akulik): find better place for functions below.
-
-// Creates read-only buffer from the given tensor. Tensor data is converted to
-// PHWC4 layout.
-absl::Status CreatePHWC4BufferFromTensor(const TensorFloat32& tensor,
-                                         GlBuffer* gl_buffer);
-
-// Creates read-write buffer for the given tensor shape, where data layout is
-// supposed to be PHWC4.
-absl::Status CreatePHWC4BufferFromTensorRef(const TensorRef& tensor_ref,
-                                            GlBuffer* gl_buffer);
-
-// Copies data from a buffer that holds data in PHWC4 layout to the given
-// tensor.
-absl::Status CopyFromPHWC4Buffer(const GlBuffer& buffer, TensorFloat32* tensor);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_OBJECT_MANAGER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/portable_egl.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/portable_egl.h
deleted file mode 100644
index 7be1985..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/portable_egl.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* 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_GL_PORTABLE_EGL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_PORTABLE_EGL_H_
-
-#include 
-#include 
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_PORTABLE_EGL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/portable_gl31.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/portable_gl31.h
deleted file mode 100644
index a3d03bf..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/portable_gl31.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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_GL_PORTABLE_GL31_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_PORTABLE_GL31_H_
-
-#define HAS_EGL 1
-
-#include 
-#include 
-#include 
-
-#ifdef __ANDROID__
-// Weak-link all GL APIs included from this point on.
-// TODO(camillol): Annotate these with availability attributes for the
-// appropriate versions of Android, by including gl{3,31,31}.h and resetting
-// GL_APICALL for each.
-#undef GL_APICALL
-#define GL_APICALL __attribute__((weak_import)) KHRONOS_APICALL
-#endif  // __ANDROID__
-
-#include 
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_PORTABLE_GL31_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/request_gpu_info.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/request_gpu_info.h
deleted file mode 100644
index f9d203e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/request_gpu_info.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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_GL_REQUEST_GPU_INFO_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_REQUEST_GPU_INFO_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// This method performs multiple GL calls, therefore, egl context needs to be
-// created upfront.
-absl::Status RequestGpuInfo(GpuInfo* gpu_info);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_REQUEST_GPU_INFO_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/runtime.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/runtime.h
deleted file mode 100644
index 97f0f73..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/runtime.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* 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_GL_RUNTIME_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_RUNTIME_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/gl/command_queue.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_buffer.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_program.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_shader.h"
-#include "tensorflow/lite/delegates/gpu/gl/object.h"
-#include "tensorflow/lite/delegates/gpu/gl/object_manager.h"
-#include "tensorflow/lite/delegates/gpu/gl/runtime/shared_buffer.h"
-#include "tensorflow/lite/delegates/gpu/gl/runtime_options.h"
-#include "tensorflow/lite/delegates/gpu/gl/stats.h"
-#include "tensorflow/lite/delegates/gpu/gl/variable.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Runtime compiles code and executes it once all code is compiled. It creates
-// intermediate objects and destroys them when runtime is destroyed.
-class Runtime {
- public:
-  Runtime(const RuntimeOptions& options, const GpuInfo& gpu_info,
-          CommandQueue* command_queue, const ObjectManager* external_objects);
-
-  // Takes parameters and objects and prepares GL program.
-  absl::Status AddProgram(const GlShader& shader,
-                          const std::vector& parameters,
-                          const std::vector& objects,
-                          const uint3& num_workgroups);
-
-  // Needs to be called once all programs and shaders has been added to runtime.
-  absl::Status PrepareForExecution();
-
-  // Executes all compiled programs.
-  // TODO(akulik): add more controls over execution. Execution policy?
-  absl::Status Execute();
-
-  // Gets access to objects created while executing generated code.
-  const ObjectManager* internal_objects() const { return &internal_objects_; }
-
-  CommandQueue* command_queue() { return command_queue_; }
-
-  RuntimeStats stats() const {
-    RuntimeStats stats;
-    stats.const_objects = const_objects_.stats();
-    stats.internal_objects = internal_objects_.stats();
-    if (external_objects_) {
-      stats.external_objects = external_objects_->stats();
-    }
-    return stats;
-  }
-
- private:
-  absl::Status AllocateInternalObject(const Object& object);
-
-  absl::Status AllocateConstObject(const Object& object, uint32_t* id);
-
-  // Goes over objects in programs and decides how to allocate them to
-  // minimize total allocated memory. Returns a collection of objects to be
-  // allocated and shared by internal objects.
-  absl::Status AssignInternalObjects(std::vector* objects);
-
-  const RuntimeOptions options_;
-  const GpuInfo gpu_info_;
-  const ObjectManager* external_objects_;
-  CommandQueue* command_queue_;
-
-  ObjectManager internal_objects_;
-  ObjectManager const_objects_;
-  uint32_t next_const_id_ = 0;  // id for const objects
-
-  std::unique_ptr shared_readonly_buffer_;
-
-  using BindFunc = std::function;
-
-  // Encapsulates a program and all object to bind before dispatch.
-  struct CompiledProgramDescriptor {
-    GlProgram program;
-    uint3 num_workgroups;
-
-    std::vector bindings;
-    std::vector refs;
-  };
-
-  std::vector programs_;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_RUNTIME_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/runtime/shared_buffer.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/runtime/shared_buffer.h
deleted file mode 100644
index 11b0946..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/runtime/shared_buffer.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* 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_GL_RUNTIME_SHARED_BUFFER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_RUNTIME_SHARED_BUFFER_H_
-
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/util.h"
-#include "tensorflow/lite/delegates/gpu/gl/gl_buffer.h"
-#include "tensorflow/lite/delegates/gpu/gl/object.h"
-#include "tensorflow/lite/delegates/gpu/gl/portable_gl31.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Class accumulates readonly data and creates a single buffer out of it.
-// User should call Add one or more times and complete shared buffer creation
-// with CreateSharedBuffer() call.
-class SharedBufferData {
- public:
-  SharedBufferData() {
-    glGetIntegerv(GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT, &alignment_);
-  }
-
-  // @return true if data was added to the shared buffer.
-  bool Add(const ObjectData& data, GlBuffer* buffer) {
-    // TODO(akulik): Does it make sense to bundle even big buffers > 1MB?
-
-    // align buffer's data.
-    shared_data_.resize(AlignByN(shared_data_.size(), alignment_), 0);
-    // Accumulate readonly data in a single shared buffer buffer.
-    *buffer = GlBuffer(GL_SHADER_STORAGE_BUFFER, buffer_id_.id(), data.size(),
-                       shared_data_.size(), /*has_ownership=*/false);
-    std::copy(data.begin(), data.end(), std::back_inserter(shared_data_));
-    return true;
-  }
-
-  bool empty() const { return shared_data_.empty(); }
-
-  // Returns a single GlBuffer that owns entire shared data.
-  absl::Status CreateSharedGlBuffer(GlBuffer* gl_buffer) {
-    // Upload data to a buffer
-    gl_buffer_internal::BufferBinder binder(GL_SHADER_STORAGE_BUFFER,
-                                            buffer_id_.id());
-    RETURN_IF_ERROR(TFLITE_GPU_CALL_GL(glBufferData, GL_SHADER_STORAGE_BUFFER,
-                                       shared_data_.size(), shared_data_.data(),
-                                       GL_STATIC_READ));
-    *gl_buffer = GlBuffer(GL_SHADER_STORAGE_BUFFER, buffer_id_.Release(),
-                          shared_data_.size(), 0, /*has_ownership=*/true);
-    return absl::OkStatus();
-  }
-
- private:
-  GLint alignment_ = 256;
-  gl_buffer_internal::BufferId buffer_id_;
-  ObjectData shared_data_;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_RUNTIME_SHARED_BUFFER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/runtime_options.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/runtime_options.h
deleted file mode 100644
index 44e054e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/runtime_options.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* 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_GL_RUNTIME_OPTIONS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_RUNTIME_OPTIONS_H_
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-struct RuntimeOptions {
-  RuntimeOptions()
-      : reuse_internal_objects(true), bundle_readonly_objects(true) {}
-
-  // If enabled triggers greedy algorithm to re-use internal buffers when
-  // possible.
-  // Keep this false when, for example, one need to analyze intermediate
-  // results for debugging purposes.
-  bool reuse_internal_objects;
-
-  // If enabled all readonly objects will be bundled to create as few buffers or
-  // textures as possible.
-  bool bundle_readonly_objects;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_RUNTIME_OPTIONS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/serialization.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/serialization.h
deleted file mode 100644
index 82b76a4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/serialization.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* 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_GL_SERIALIZATION_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_SERIALIZATION_H_
-
-#include 
-#include 
-#include 
-#include 
-
-#include "absl/types/span.h"
-#include "flatbuffers/flatbuffers.h"  // from @flatbuffers
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiled_model_generated.h"
-#include "tensorflow/lite/delegates/gpu/gl/object.h"
-#include "tensorflow/lite/delegates/gpu/gl/variable.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-struct CompiledModelOptions {
-  // If true, a model was compiled with dynamic batch size and therefore,
-  // a user may change BATCH dimension at runtime.
-  bool dynamic_batch = false;
-};
-
-// Accumulates shaders and programs and stores it in FlatBuffer format.
-class SerializedCompiledModelBuilder {
- public:
-  SerializedCompiledModelBuilder() : builder_(32 * 1024) {}
-
-  void AddShader(const std::string& shader_src);
-
-  void AddProgram(const std::vector& parameters,
-                  const std::vector& objects,
-                  const uint3& workgroup_size, const uint3& num_workgroups,
-                  size_t shader_index);
-
-  // Returns serialized data that will stay valid until this object is
-  // destroyed.
-  absl::Span Finalize(const CompiledModelOptions& options);
-
- private:
-  std::vector> shaders_;
-  std::vector> programs_;
-  ::flatbuffers::FlatBufferBuilder builder_;
-};
-
-// Handles deserialization events. it is guaranteed that shaders will be called
-// first in the appropriate order and programs come next.
-class DeserializationHandler {
- public:
-  virtual ~DeserializationHandler() = default;
-
-  virtual absl::Status OnShader(absl::Span shader_src) = 0;
-
-  virtual absl::Status OnProgram(const std::vector& parameters,
-                                 const std::vector& objects,
-                                 const uint3& workgroup_size,
-                                 const uint3& num_workgroups,
-                                 size_t shader_index) = 0;
-
-  virtual void OnOptions(const CompiledModelOptions& options) = 0;
-};
-
-absl::Status DeserializeCompiledModel(absl::Span serialized,
-                                      DeserializationHandler* handler);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_SERIALIZATION_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/stats.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/stats.h
deleted file mode 100644
index 198f9ed..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/stats.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* 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_GL_STATS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_STATS_H_
-
-#include 
-
-#include "absl/strings/str_cat.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// A collection of compile-time stats exposed via API.
-struct CompilerStats {};
-
-struct ObjectStats {
-  // Number of allocated objects.
-  int32_t count = 0;
-
-  // Total bytes allocated.
-  int64_t total_bytes = 0;
-};
-
-struct ObjectsStats {
-  ObjectStats buffers;
-
-  ObjectStats textures;
-};
-
-// A collection of runtime-time stats exposed via API.
-struct RuntimeStats {
-  ObjectsStats internal_objects;
-
-  ObjectsStats const_objects;
-
-  ObjectsStats external_objects;
-};
-
-inline std::string ToString(const ObjectStats& stats) {
-  return absl::StrCat("count = ", stats.count,
-                      ", total bytes = ", stats.total_bytes);
-}
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_STATS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/variable.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/variable.h
deleted file mode 100644
index 5237481..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/variable.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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_GL_VARIABLE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_VARIABLE_H_
-
-#include 
-#include 
-#include 
-#include 
-
-#include "absl/types/variant.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-struct Variable {
-  using ValueType =
-      absl::variant, std::vector>;
-
-  std::string name;
-  ValueType value;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_VARIABLE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/best_effort_calculator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/best_effort_calculator.h
deleted file mode 100644
index e277e45..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/best_effort_calculator.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/* 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_GL_WORKGROUPS_BEST_EFFORT_CALCULATOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_BEST_EFFORT_CALCULATOR_H_
-
-#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
-#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-std::unique_ptr BestEffortWorkgroupsCalculator(
-    const uint8_t* metadata, const GpuInfo& gpu_info);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_BEST_EFFORT_CALCULATOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h
deleted file mode 100644
index 1322474..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* 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_GL_WORKGROUPS_CALCULATOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_CALCULATOR_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/gl/compiler/shader_code.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-constexpr uint3 kEmptyWorkgroupSize(0, 0, 0);
-
-// Calculates workgroup size for the given shader code in a model graph.
-//
-// Potentially there are multiple implementations possible:
-//   - per-operation type hard-coded constants
-//   - statistic-based calculator that uses aggregated stats for all operations
-class WorkgroupsCalculator {
- public:
-  explicit WorkgroupsCalculator(const GpuInfo& gpu_info);
-
-  virtual ~WorkgroupsCalculator() = default;
-
-  // Uses shader code recommended work group size if available and doesn't
-  // exceed max work group invocations num, otherwise work group size from
-  // passed calculator.
-  uint3 Calculate(const ShaderCode& shader_code) const;
-
- protected:
-  virtual uint3 CalculateInternal(const ShaderCode& shader_code) const = 0;
-
- private:
-  GpuInfo gpu_info_;
-};
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_CALCULATOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/calculator_from_metadata.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/calculator_from_metadata.h
deleted file mode 100644
index 4c034b1..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/calculator_from_metadata.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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_GL_WORKGROUPS_CALCULATOR_FROM_METADATA_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_CALCULATOR_FROM_METADATA_H_
-
-#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
-#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Creates new workgroup calculator that uses extra information serialized in
-// metadata.
-std::unique_ptr NewWorkgroupsCalculatorFromMetadata(
-    const uint8_t* metadata, const GpuInfo& gpu_info);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_CALCULATOR_FROM_METADATA_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/default_calculator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/default_calculator.h
deleted file mode 100644
index 6053c9e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/default_calculator.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_GL_WORKGROUPS_DEFAULT_CALCULATOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_DEFAULT_CALCULATOR_H_
-
-#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
-#include "tensorflow/lite/delegates/gpu/gl/workgroups/calculator.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Creates new workgroups calculator for the general case or specificly for Mali
-std::unique_ptr NewDefaultWorkgroupsCalculator(
-    const GpuInfo& gpu_info);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_DEFAULT_CALCULATOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/ideal_workgroup_picker.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/ideal_workgroup_picker.h
deleted file mode 100644
index 34f628c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl/workgroups/ideal_workgroup_picker.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* 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_GL_WORKGROUPS_IDEAL_WORKGROUP_PICKER_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_IDEAL_WORKGROUP_PICKER_H_
-
-#include "tensorflow/lite/delegates/gpu/common/gpu_info.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace gl {
-
-// Picks up the ideal workgroup size for the given convolution case.
-// Ideal workgroup gives top 10% of the possible performance for the given case.
-// They are received after the workgroup performance research (b/117291356).
-uint3 GetIdealWorkgroupIfPossible(GpuModel gpu_model, OperationType op_type,
-                                  HW kernel, HW strides, OHWI workload);
-
-// Does the same as the function above. Use this one if your operation can
-// suggest some reasonable workgroup size. It's expected to give better
-// performance than the default workgroup calculator.
-uint3 GetIdealWorkgroupIfPossible(GpuModel gpu_model, OperationType op_type,
-                                  HW kernel, HW strides, uint3 default_wg,
-                                  OHWI workload);
-
-}  // namespace gl
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_WORKGROUPS_IDEAL_WORKGROUP_PICKER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl_delegate.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl_delegate.h
deleted file mode 100644
index e6efd64..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/gl_delegate.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* 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_GL_DELEGATE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_GL_DELEGATE_H_
-
-#include 
-#include 
-
-#include "absl/base/macros.h"
-#include "tensorflow/lite/c/common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-//
-// GPU delegate declared in this file is OBSOLETE and replaced with the delegate
-// declared in delegate.h. New delegate combines all GL, CL and soon
-// Vulkan-based implementations in one.
-// Please migrate before end of 2019.
-//
-// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
-
-// LINT.IfChange
-enum TfLiteGlObjectType {
-  TFLITE_GL_OBJECT_TYPE_FASTEST = 0,
-  TFLITE_GL_OBJECT_TYPE_TEXTURE = 1,
-  TFLITE_GL_OBJECT_TYPE_BUFFER = 2,
-};
-
-// Shader compilation options.
-// Always use TfLiteGlCompileOptionsDefault() method to create new instance
-// of TfLiteGlCompileOptions, otherwise every new added option may break
-// inference.
-// TODO(impjdi): Unify with opengl::CompilationOptions.
-typedef struct {
-  // When set to zero, computations are carried out in 32-bit floating point.
-  // Otherwise, the GPU may quantify tensors, downcast values, process in FP16
-  // (recommended).
-  int32_t precision_loss_allowed;
-
-  // User's preferred GL object to represent tensors.  When set to:
-  // * `TFLITE_GL_OBJECT_TYPE_FASTEST`, the delegate chooses a GL object type
-  //   automatically that will perform fastest (recommended).
-  // * `TFLITE_GL_OBJECT_TYPE_TEXTURE`: GL textures are used to represent
-  //   tensors which often work faster on Adreno-based devices, but may use more
-  //   memory.
-  // * `TFLITE_GL_OBJECT_TYPE_BUFFER`: GL shader storage buffer objects are used
-  //   to represent tensors.
-  int32_t preferred_gl_object_type;
-
-  // When set to zero, dynamic batching is disabled and input/output tensors
-  // must have a batch size of 1 (probably what you unless you use LSTMs).
-  // Otherwise, enables dynamic batching and input/output tensor can have a
-  // batch size greater than 1.
-  int32_t dynamic_batch_enabled;
-
-  // Parameters will be inlined into a shader. This in turn will generated more
-  // unique shaders where each will need to be compiled.
-  int32_t inline_parameters;
-} TfLiteGlCompileOptions;
-
-// Populates TfLiteGlCompileOptions as follows:
-//   precision_loss_allowed = 0;
-//   preferred_gl_object_type = TFLITE_GL_OBJECT_TYPE_FASTEST;
-//   dynamic_batch_enabled = 0;
-//   inline_parameters = 0;
-TFL_CAPI_EXPORT TfLiteGlCompileOptions TfLiteGlCompileOptionsDefault();
-
-// Always use TfLiteGpuDelegateOptionsDefault() method to create new instance
-// of TfLiteGpuDelegateOptions, otherwise every new added option may break
-// inference.
-typedef struct {
-  const uint8_t* metadata;  // Internal.
-  TfLiteGlCompileOptions compile_options;
-} TfLiteGpuDelegateOptions;
-
-// Populates TfLiteGlCompileOptions as follows:
-//   metadata = nullptr;
-//   compile_options = TfLiteGlCompileOptionsDefault();
-TFL_CAPI_EXPORT TfLiteGpuDelegateOptions TfLiteGpuDelegateOptionsDefault();
-
-// LINT.ThenChange(//tensorflow/lite/delegates/gpu/java/src/main/java/org/tensorflow/lite/gpu/GpuDelegate.java)
-
-// Creates a new delegate instance that need to be destroyed with
-// TfLiteGpuDelegateDelete when delegate is no longer used by TFLite.
-// When `options` is set to `nullptr`, the following default values are used:
-// .metadata = nullptr,
-// .compile_options = {
-//   .precision_loss_allowed = false,
-//   .preferred_gl_object_type = TFLITE_GL_OBJECT_TYPE_FASTEST,
-//   .dynamic_batch_enabled = false,
-// },
-ABSL_DEPRECATED("Use TfLiteGpuDelegateV2Create defined in delegate.h instead.")
-TFL_CAPI_EXPORT TfLiteDelegate* TfLiteGpuDelegateCreate(
-    const TfLiteGpuDelegateOptions* options);
-
-// Destroys a delegate created with `TfLiteGpuDelegateCreate` call.
-TFL_CAPI_EXPORT void TfLiteGpuDelegateDelete(TfLiteDelegate* delegate);
-
-// Binds GL shader storage object to an input or an output tensor in the
-// initialized delegate.  Bound buffer should have sufficient storage to
-// accommodate all elements of a tensor.
-//
-// *** Must be called *before* `Interpreter::ModifyGraphWithDelegate`. ***
-TFL_CAPI_EXPORT TfLiteStatus TfLiteGpuDelegateBindBufferToTensor(
-    TfLiteDelegate* delegate, GLuint buffer, int tensor_index);
-
-#ifndef TFLITE_GPU_BINARY_RELEASE
-// Returns the metadata of `tflite_model` if it has one, or `nullptr` otherwise.
-// Designed to be used with `TfLiteGpuDelegateOptions.metadata`.
-TFL_CAPI_EXPORT const uint8_t* TfLiteGpuDelegateGetModelMetadata(
-    const void* tflite_model);
-#endif  // TFLITE_GPU_BINARY_RELEASE
-
-#ifdef __cplusplus
-}
-#endif  // __cplusplus
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_GL_DELEGATE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/api.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/api.h
deleted file mode 100644
index e443528..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/api.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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_API_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_API_H_
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/metal/compiled_model.h"
-#include "tensorflow/lite/delegates/gpu/metal/environment.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-// Builds CompiledModel out of GraphFloat32 graph using provided RuntimeOptions.
-absl::Status Compile(const GraphFloat32& graph, const DeviceInfo& device_info,
-                     const RuntimeOptions& options,
-                     CompiledModel* compiled_model);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_API_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/arguments.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/arguments.h
deleted file mode 100644
index fbdcfef..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/arguments.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_METAL_ARGUMENTS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_ARGUMENTS_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-class Arguments {
- public:
-  Arguments() = default;
-
-  // Move only
-  Arguments(Arguments&& args) = default;
-  Arguments& operator=(Arguments&& args) = default;
-  Arguments(const Arguments&) = delete;
-  Arguments& operator=(const Arguments&) = delete;
-
-  void AddFloat(const std::string& name, float value = 0.0f);
-  void AddInt(const std::string& name, int value = 0);
-
- private:
-  friend class MetalArguments;
-  void GetActiveArguments(const std::string& code);
-
-  static constexpr char kArgsPrefix[] = "args.";
-  struct IntValue {
-    int value;
-
-    // many arguments generated automatically and not used
-    // this flag active if argument was used in kernel_code
-    // Will be filled after GetActiveArguments call
-    bool active = false;
-  };
-  std::map int_values_;
-
-  struct FloatValue {
-    float value;
-
-    // many arguments generated automatically and not used
-    // this flag active if argument was used in kernel_code
-    // Will be filled after GetActiveArguments call
-    bool active = false;
-  };
-  std::map float_values_;
-};
-
-class ArgumentsSetter {
- public:
-  virtual absl::Status SetInt(const std::string& name, int value) = 0;
-  virtual absl::Status SetFloat(const std::string& name, float value) = 0;
-  virtual ~ArgumentsSetter() = default;
-};
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_ARGUMENTS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/buffer_convert.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/buffer_convert.h
deleted file mode 100644
index 52738a9..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/buffer_convert.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 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_BUFFER_CONVERT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_BUFFER_CONVERT_H_
-
-#import 
-
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-
-@interface TFLBufferConvert : NSObject
-
-/// Constructs converter from/to BHWC <-> BPHWC4
-/// @param isFloat16 the BPHWC4 buffer is in float16 format.
-/// @param convertToPBHWC4 convert BHWC -> BPHWC4 if true or BPHWC4 -> BHWC instead.
-- (id)initWithDevice:(id)device
-           isFloat16:(bool)isFloat16
-     convertToPBHWC4:(bool)convertToPBHWC4;
-
-/// Converts from/to BHWC <-> BPHWC4
-/// @param shape shape of BHWC tensor.
-- (void)convertWithEncoder:(id)encoder
-                     shape:(const ::tflite::gpu::BHWC&)shape
-              sourceBuffer:(id)sourceBuffer
-           convertedBuffer:(id)convertedBuffer;
-
-@end
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_BUFFER_CONVERT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/common.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/common.h
deleted file mode 100644
index 6f4e94e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/common.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 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_COMMON_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_COMMON_H_
-
-#import 
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-/// Returns system default device on iOS or Intel GPU on macOS.
-id GetBestSupportedMetalDevice();
-
-/// Metal compute shader compilation
-/// @param device The device on which that shader program will be stored.
-/// @param code Shader source.
-/// @param functionName The name of the main shader function.
-/// @param macros Compile-time definitions.
-/// @param program A non-nil pointer to the program object that will be filled.
-/// @return Returns a valid program pointer or error string. At least one pointer is valid but not
-///     both.
-/// @discussion The function autoselects the maximum shader language version supported by the target
-///     OS. FastMath is enabled.
-absl::Status CreateComputeProgram(id device, NSString* code, NSString* functionName,
-                                  NSDictionary* macros,
-                                  id* program);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_COMMON_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/compiled_model.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/compiled_model.h
deleted file mode 100644
index 2225344..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/compiled_model.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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_COMPILED_MODEL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_COMPILED_MODEL_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-using CompiledModel = std::vector;
-
-// Receives input CompiledModel, validates, optimizes it and returns output
-// CompiledModel. No shader compilation or memory allocation happen here, this
-// function just does high-level operations fusion.
-absl::Status ValidateOptimizeModel(const std::vector& input_buffers,
-                                   const std::vector& output_buffers,
-                                   const CompiledModel& input,
-                                   CompiledModel* output);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_COMPILED_MODEL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/compute_task.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/compute_task.h
deleted file mode 100644
index b03a843..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/compute_task.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* 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_COMPUTE_TASK_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_COMPUTE_TASK_H_
-
-#import 
-
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-@interface TFLComputeTask : NSObject
-
-/// Returns empty string or error if shader can't be compiled.
-- (absl::Status)compileWithDevice:(id)device
-                   taskDescriptor:(::tflite::gpu::metal::ComputeTaskDescriptorPtr)desc
-                   runtimeOptions:(const ::tflite::gpu::metal::RuntimeOptions&)options;
-
-/// Updates dimensions for inputs/outputs/intermediate tensors
-- (absl::Status)
-    setInputDimensionsWithDevice:(id)device
-                      dimensions:(std::map<::tflite::gpu::ValueId, ::tflite::gpu::BHWC>*)dimensions;
-
-/// Updates buffers for intermediate tensors only. Returns error if out of memory or a buffer is
-/// larger than MTLDevice can support.
-/// @param buffers is a map from intermediate tensors' ValueId to metal handles with corresponding
-///        buffers.
-/// @param outputIDs must match the output of added operations.
-/// @param usageRecordIds is a map from intermediate tensors' ValueId to corresponding tensor usage
-/// records ids.
-/// @param sharedBufferIds contain shared buffer id for each tensor usage record id.
-/// @param sharedBuffers contain metal handles to the allocated buffers for each shared buffer id.
-/// TODO(ypisarchyk): probably we can decrease the number of parameters here
-- (absl::Status)assignBuffers:(std::map<::tflite::gpu::ValueId, id>*)buffers
-                    outputIds:(const std::vector<::tflite::gpu::ValueId>&)outputIds
-               usageRecordIds:(const std::map<::tflite::gpu::ValueId, size_t>&)usageRecordIds
-              sharedBufferIds:(const std::vector&)sharedBufferIds
-                sharedBuffers:(const std::vector>&)sharedBuffers;
-
-- (void)encodeWithEncoder:(id)encoder
-       inputOutputBuffers:
-           (const std::map<::tflite::gpu::ValueId, id>&)inputOutputBuffers;
-
-@end
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_COMPUTE_TASK_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h
deleted file mode 100644
index 7b65f2b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h
+++ /dev/null
@@ -1,149 +0,0 @@
-/* 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_COMPUTE_TASK_DESCRIPTOR_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_COMPUTE_TASK_DESCRIPTOR_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-#include "tensorflow/lite/delegates/gpu/metal/arguments.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-using OutputDimensions =
-    std::function& buffers)>;
-using UniformsFunction =
-    std::function(const std::map& buffers)>;
-using DispatchParamsFunction = std::function(
-    const std::map& buffers)>;
-
-// Compute task descriptor contains a linkable shader code or a code for
-// complete shader to which other linkable can be attached or not. An operation
-// can produce one or more descriptors and graph compiler uses descriptors as
-// building blocks. All required data like immutable operation parameters
-// (weights etc.) is attached to the descriptor.
-struct ComputeTaskDescriptor {
-  struct InputBufferDescriptor {
-    ValueId id;
-    // The declaration is inserted into the compute function arguments list.
-    // Example for non-linkable task: "device FLT4* const input_buffer"
-    // Example for linkable: "device FLT4* const"
-    std::string declaration;
-  };
-  struct OutputBufferDescriptor {
-    ValueId id;
-    // The declaration is inserted into the compute function arguments list.
-    // Example for non-linkable task: "device FLT4* output_buffer"
-    // Example for linkable: "device FLT4*"
-    std::string declaration;
-    // Multiple outputs are allowed from a linkable operation so after fusion
-    // each buffer's dimensions are calculated separately from different
-    // operations.
-    OutputDimensions dimensions_function;
-    // Fusion absorbs intermediate tensors. Keep this ids to properly store
-    // output dimensions.
-    std::vector alias;
-  };
-  struct ImmutableBufferDescriptor {
-    std::string declaration;
-    std::vector data;
-  };
-  // Uniforms are recalculated at any setInputDimensions call.
-  struct UniformBufferDescriptor {
-    // The declaration is inserted into the compute function arguments list.
-    // Example: "constant uint4& some_uniforms"
-    std::string declaration;
-    // This function re-calculates uniforms for specific input dimensions.
-    UniformsFunction data_function;
-  };
-
-  Arguments args;
-  // Unique ID to match the graph compilation errors.
-  int id;
-  bool is_linkable;
-  // A linkable function or a full shader source with 3 parameters $ for
-  // substitute function. Example of linkable: "(FLT4 linkable$0(FLT4 value, int
-  // linear_index) { return value; })" Example of non-linkable function:
-  // #include 
-  // using namespace metal;
-  // $0
-  // kernel void ComputeFunction(
-  //                             $1
-  //                             uint3 gid[[thread_position_in_grid]]) {
-  //   if (int(gid.x) >= size.x || int(gid.y) >= size.y) {
-  //     return;
-  //   }
-  //   const int linear_index = (gid.z * size.y + gid.y) * size.x + gid.x;
-  //   FLT4 value = input_buffer[linear_index] + 1.0f;
-  //   $2
-  //   output_buffer[linear_index] = value;
-  // }
-
-  // when operation associative, we can rearrange input tensors
-  // for example add is associative
-  bool is_associative_op = false;
-  std::string shader_source;
-  std::vector input_buffers;
-  // A single per-operation output is supported now.
-  OutputBufferDescriptor output_buffer;
-  std::vector immutable_buffers;
-  std::vector uniform_buffers;
-  // Dynamic resizing of input tensor is supported. User-defined functions to
-  // calculate new parameters for GPU compute task dispatching. A leading
-  // unlinkable task must provide this.
-  DispatchParamsFunction resize_function;
-  std::string description;
-};
-
-using ComputeTaskDescriptorPtr = std::shared_ptr;
-
-/// Helper function to convert buffer's content into stream of bytes
-template 
-std::vector GetByteBuffer(const std::vector& input_vector) {
-  std::vector result;
-  result.insert(result.begin(),
-                reinterpret_cast(input_vector.data()),
-                reinterpret_cast(input_vector.data()) +
-                    input_vector.size() * sizeof(*input_vector.data()));
-  return result;
-}
-
-/// Converts float to destination type (if needed) and stores as bytes array.
-std::vector GetByteBufferConverted(
-    const std::vector& input_vector,
-    RuntimeOptions::Precision destination_type);
-
-/// Resizes, Converts float to destination type (if needed) and stores as bytes
-/// array.
-std::vector GetByteBufferConvertedResized(
-    const std::vector& input_vector,
-    RuntimeOptions::Precision destination_type, size_t elements_count);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_COMPUTE_TASK_DESCRIPTOR_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/environment.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/environment.h
deleted file mode 100644
index 14c8860..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/environment.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* 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_ENVIRONMENT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_ENVIRONMENT_H_
-
-#include 
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-enum class Vendor {
-  kUnknown,
-  kApple,
-  kIntel,
-  kAMD,
-};
-
-enum class AppleGPU {
-  kUnknown,
-  kA7,
-  kA8,
-  kA8X,
-  kA9,
-  kA9X,
-  kA10,
-  kA10X,
-  kA11,
-  kA12,
-  kA12X,
-  kA12Z,
-  kA13,
-};
-
-struct AppleGPUInfo {
-  AppleGPUInfo() = default;
-  explicit AppleGPUInfo(const std::string& device_name);
-  AppleGPU gpu_type;
-
-  bool IsLocalMemoryPreferredOverGlobal() const;
-
-  bool IsBionic() const;
-
-  // floating point rounding mode
-  bool IsRoundToNearestSupported() const;
-
-  // returns true if device have fixed wave size equal to 32
-  bool IsWaveSizeEqualTo32() const;
-
-  int GetComputeUnitsCount() const;
-};
-
-struct DeviceInfo {
-  DeviceInfo() = default;
-  explicit DeviceInfo(const std::string& device_name);
-
-  Vendor vendor;
-
-  AppleGPUInfo apple_info;
-
-  bool IsIntelGPU() const;
-  bool IsAppleGPU() const;
-  bool IsAMDGPU() const;
-
-  // floating point rounding mode
-  bool IsRoundToNearestSupported() const;
-
-  // returns true if device have fixed wave size equal to 32
-  bool IsWaveSizeEqualTo32() const;
-
-  int GetComputeUnitsCount() const;
-};
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_ENVIRONMENT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/inference_context.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/inference_context.h
deleted file mode 100644
index 97a6f3b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/inference_context.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* 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_INFERENCE_CONTEXT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_INFERENCE_CONTEXT_H_
-
-#import 
-
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-/// Stages of model preprocessing:
-/// 1. Operations' initialization. All operations are initialized and added into
-///    model. Every operation is represented as a vector of
-///    ComputeTaskDescriptors.
-/// 2. Model compilation. Global list of ComputeTaskDescriptors is transformed
-///    into the sorted list of sets of descriptors. A set can be transformed
-///    later into a single GPU task.
-/// 3. GPU compute tasks generation. Shader code generation happens here.
-/// 4. Intermediate resource allocation.
-/// Inference.
-@interface TFLInferenceContext : NSObject
-
-/// Compiles model: groups operations to be fused; validates model structure.
-/// @param device Used to create resources: shaders, buffers. Also the device is used in
-///             consecutive call setInputDimensions().
-/// @param taskDescriptors The ordered vector of shader programs ready to be compiled for GPU and
-///             with all supplementary buffers data.
-/// @param outputBufferIDs IDs must match the output of added operations.
-/// @param runtimeOptions Options are used to specify data/calculations precision.
-/// @return Status signals whether model is compiled successfully or not.
-/// @discussion Previously added operations are distilled into sorted list of sets of
-///             ComputeTaskDescriptors, which can be fused into a single GPU task.
-- (absl::Status)compileModelWithDevice:(id)device
-                       taskDescriptors:
-                           (const std::vector<::tflite::gpu::metal::ComputeTaskDescriptorPtr>&)
-                               taskDescriptors
-                       outputBufferIDs:(const std::vector<::tflite::gpu::ValueId>&)outputBufferIDs
-                        runtimeOptions:(const ::tflite::gpu::metal::RuntimeOptions&)options;
-
-/// Creates intermediate buffers. The model is ready to be used after this call.
-/// @param inputDimensions Used to create resources: shaders, buffers.
-/// @param outputDimensions Will be initialized during this call.
-/// @return Status signals whether intermediate buffers are successfully created or not.
-/// @discussion The operation is intended to be lightweight with minimum overhead. A preceding call
-///             compileModelWithDevice() must be made with the proper device parameter set.
-- (absl::Status)
-    setInputDimensions:(const std::map<::tflite::gpu::ValueId, ::tflite::gpu::BHWC>&)inputDimensions
-      outputDimensions:(std::map<::tflite::gpu::ValueId, ::tflite::gpu::BHWC>*)outputDimensions
-       taskDescriptors:
-           (const std::vector<::tflite::gpu::metal::ComputeTaskDescriptorPtr>&)taskDescriptors;
-
-/// Inserts all GPU compute tasks into the command encoder.
-/// @param inputOutputBuffers Must be created and passed into the method with pairs ID:buffer
-/// @param encoderBlock User-defined block to take control over command encoder. Can be nil.
-///             The block can be used, for example, for fine-grained benchmarking where end encoding
-///             is performed and command buffer is committed with completion block. A new command
-///             buffer must be created and new command encoder must be returned by the block.
-///             The block is called after every dispatch encoding.
-/// @discussion No GPU synchronization functions are used inside. All GPU resources must be created
-///             with the same device which has been used in compileModelWithDevice() method.
-- (void)encodeWithEncoder:(id)commandEncoder
-       inputOutputBuffers:(const std::map<::tflite::gpu::ValueId, id>&)inputOutputBuffers
-             encoderBlock:(id (^)(bool isLast))encoderBlock;
-
-@end
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_INFERENCE_CONTEXT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/add.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/add.h
deleted file mode 100644
index 003dde4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/add.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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_ADD_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_ADD_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-std::vector Add(int id,
-                                          const std::vector input_ids,
-                                          ValueId output_id,
-                                          const RuntimeOptions& options);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_ADD_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/concat.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/concat.h
deleted file mode 100644
index 9fec8a3..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/concat.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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_CONCAT_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_CONCAT_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/common/shape.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-std::vector Concat(
-    int id, std::vector input_ids, ValueId output_id,
-    const ConcatAttributes& attr, const std::vector& input_shapes);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_CONCAT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/conv.h
deleted file mode 100644
index def4ba5..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/conv.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* 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_CONV_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_CONV_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/environment.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-std::vector ConvolutionGeneric(
-    int id, ValueId input_id, ValueId output_id, const BHWC& dst_shape,
-    const Convolution2DAttributes& attr, const DeviceInfo& device_info,
-    const RuntimeOptions& options);
-
-std::vector ConvolutionWino4x4To6x6(
-    int id, ValueId input_id, ValueId output_id, const BHWC& dst_shape,
-    const Convolution2DAttributes& attr, const DeviceInfo& device_info,
-    const RuntimeOptions& options);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/custom_registry.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/custom_registry.h
deleted file mode 100644
index eee1632..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/custom_registry.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* 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_CUSTOM_REGISTRY_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_CUSTOM_REGISTRY_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-// Registers custom operations.
-absl::Status RegisterCustomOps(const GraphFloat32& graph, const Node* node,
-                               const std::vector& inputs,
-                               const std::vector& outputs,
-                               const RuntimeOptions& options,
-                               std::vector* tasks);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_CUSTOM_REGISTRY_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/depthwise_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/depthwise_conv.h
deleted file mode 100644
index 488b883..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/depthwise_conv.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* 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_DEPTHWISE_CONV_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_DEPTHWISE_CONV_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-std::vector DepthWiseConvolution(
-    int id, ValueId input_id, ValueId output_id,
-    const DepthwiseConvolution2DAttributes& attr,
-    const RuntimeOptions& options);
-
-// Depth Wise Convolution for kernel 3x3
-// require:
-//   channels_multiplier = 1;
-//   kernel_size = 3x3;
-//   dilation = 1x1;
-//   stride = 1x1;
-std::vector DepthWiseConv3x3Stride1x1(
-    int id, ValueId input_id, ValueId output_id,
-    const DepthwiseConvolution2DAttributes& attr,
-    const RuntimeOptions& options);
-
-// TODO(impjdi): Move it inside module.
-bool CheckDepthWiseConv3x3Stride1x1Support(
-    const DepthwiseConvolution2DAttributes& attr);
-
-// Depth Wise Convolution for kernel 3x3
-// require:
-//   channels_multiplier = 1;
-//   kernel_size = 3x3;
-//   dilation.y = 1;
-//   stride.y = 2;
-std::vector DepthWiseConv3x3Stride2(
-    int id, ValueId input_id, ValueId output_id,
-    const DepthwiseConvolution2DAttributes& attr,
-    const RuntimeOptions& options);
-
-// TODO(impjdi): Move it inside module.
-bool CheckDepthWiseConv3x3Stride2Support(
-    const DepthwiseConvolution2DAttributes& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_DEPTHWISE_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/elementwise.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/elementwise.h
deleted file mode 100644
index dea466b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/elementwise.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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_ELEMENTWISE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_ELEMENTWISE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-// One input is one runtime tensor
-std::vector ElementwiseWithOneInput(
-    int id, ValueId input_id, ValueId output_id, OperationType op_type);
-
-// Two inputs are two runtime tensors
-std::vector ElementwiseWithTwoInputs(
-    int id, std::vector input_ids, ValueId output_id,
-    const BHWC& second_shape, OperationType op_type);
-
-// First input is one runtime tensor and second input is constant argument
-std::vector ElementwiseWithOneInputAndConstantArguent(
-    int id, ValueId input_id, ValueId output_id, const RuntimeOptions& options,
-    OperationType op_type, const TensorOrScalar& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_ELEMENTWISE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/fully_connected.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/fully_connected.h
deleted file mode 100644
index 3e1f26f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/fully_connected.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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_FULLY_CONNECTED_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_FULLY_CONNECTED_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/environment.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-// creates TaskDescriptor for FullyConnected
-// FullyConnected is equivalent to matrix-vector multiplication
-// Also this operation can be replaced with convolution 1x1, but it
-//   will be inefficient
-std::vector FullyConnected(
-    int id, ValueId input_id, ValueId output_id,
-    const FullyConnectedAttributes& attr, const DeviceInfo& device_info,
-    const RuntimeOptions& options);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_FULLY_CONNECTED_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/max_unpooling.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/max_unpooling.h
deleted file mode 100644
index 6cf5865..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/max_unpooling.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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_MAX_UNPOOLING_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_MAX_UNPOOLING_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-std::vector MaxUnpooling(
-    int id, ValueId input_id, ValueId input_indices_id, ValueId output_id,
-    const MaxUnpooling2DAttributes& params);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_MAX_UNPOOLING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/mean.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/mean.h
deleted file mode 100644
index 5f6a049..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/mean.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_MEAN_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_MEAN_H_
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-std::vector Mean(int id, ValueId input_id,
-                                           ValueId output_id,
-                                           const MeanAttributes& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_MEAN_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/padding.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/padding.h
deleted file mode 100644
index 177cc40..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/padding.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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_PADDING_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_PADDING_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-// creates TaskDescriptor for Padding operation
-std::vector Padding(int id, ValueId input_id,
-                                              ValueId output_id,
-                                              const PadAttributes& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_PADDING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/pooling.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/pooling.h
deleted file mode 100644
index c2b3ff7..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/pooling.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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_POOLING_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_POOLING_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-std::vector Pooling(
-    int id, ValueId input_id, const std::vector& output_id,
-    const Pooling2DAttributes& params);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_POOLING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/prelu.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/prelu.h
deleted file mode 100644
index cfb5fb8..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/prelu.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* 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_PRELU_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_PRELU_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-// Parametric Rectified Linear Unit.
-std::vector PReLU(int id, ValueId input_id,
-                                            ValueId output_id,
-                                            const PReLUAttributes& attr,
-                                            const RuntimeOptions& options);
-// Parametric Rectified 3D Linear Unit.
-std::vector PReLUFull(int id, ValueId input_id,
-                                                ValueId output_id,
-                                                const PReLUAttributes& attr,
-                                                const RuntimeOptions& options);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_PRELU_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/quantize_and_dequantize.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/quantize_and_dequantize.h
deleted file mode 100644
index d43f659..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/quantize_and_dequantize.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_QUANTIZE_AND_DEQUANTIZE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_QUANTIZE_AND_DEQUANTIZE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-// Performs the operation: {Quantize, Dequantize} on floating-point data.
-// We need this operation to emulate the error introduced by quantization
-// on the GPU, which cannot represent int8 tensors.
-//
-// Implemented as:
-// qvalue = round((min(qmax, max(qmin, src_val)) - qmin) * (1/qscale))
-// dq_value = qvalue * qscale + qmin
-// Here, qmin, qmax & qscale refer to the quantization values as implemented in
-// TensorFlow Lite's 'FakeQuant' kernel.
-//
-// NOTE: We do not need to nudge min/max values in this op, since they would
-// already be adjusted while generating the quantized model.
-std::vector QuantizeAndDequantize(
-    int id, ValueId input_id, ValueId output_id,
-    const QuantizeAndDequantizeAttributes& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_QUANTIZE_AND_DEQUANTIZE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/relu.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/relu.h
deleted file mode 100644
index a6b8dfa..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/relu.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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_RELU_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_RELU_H_
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-// Rectified Linear Unit
-std::vector ReLU(int id, ValueId input_id,
-                                           ValueId output_id,
-                                           const ReLUAttributes& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_RELU_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/reshape.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/reshape.h
deleted file mode 100644
index 650cfc1..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/reshape.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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_RESHAPE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_RESHAPE_H_
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-// Reshapes a tensor.
-// Given tensor, this operation returns a tensor that has the same values
-// as tensor with shape dst_shape.
-std::vector Reshape(int id, ValueId input_id,
-                                              ValueId output_id,
-                                              const ReshapeAttributes& attr);
-
-// This specialization performs faster for the case
-// src_channels % 4 == 0 and dst_channels % 4 == 0
-std::vector Reshapex4(int id, ValueId input_id,
-                                                ValueId output_id,
-                                                const ReshapeAttributes& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_RESHAPE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/resize.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/resize.h
deleted file mode 100644
index aabd2c3..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/resize.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_RESIZE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_RESIZE_H_
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-std::vector Resize(int id, ValueId input_id,
-                                             ValueId output_id,
-                                             const Resize2DAttributes& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_RESIZE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/slice.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/slice.h
deleted file mode 100644
index 4941700..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/slice.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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_SLICE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_SLICE_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-// Extracts a strided slice of a tensor
-std::vector Slice(int id, ValueId input_id,
-                                            ValueId output_id,
-                                            const SliceAttributes& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_SLICE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/softmax.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/softmax.h
deleted file mode 100644
index 2745d1f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/softmax.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* 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_SOFTMAX_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_SOFTMAX_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/environment.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-std::vector Softmax(int id, ValueId input_id,
-                                              ValueId output_id,
-                                              int channels_count);
-
-// Softmax for case when width = height = 1 and AXIS = CHANNELS
-// We have this case in MobilenetV1/V2.
-std::vector Softmax1x1(int id, ValueId input_id,
-                                                 ValueId output_id,
-                                                 const DeviceInfo& device_info,
-                                                 int channels_count);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_SOFTMAX_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/space_to_depth.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/space_to_depth.h
deleted file mode 100644
index c46a2df..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/space_to_depth.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_SPACE_TO_DEPTH_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_SPACE_TO_DEPTH_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-std::vector SpaceToDepth(
-    int id, ValueId input_id, ValueId output_id,
-    const SpaceToDepthAttributes& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_SPACE_TO_DEPTH_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/test_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/test_util.h
deleted file mode 100644
index ffa567a..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/test_util.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* 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_
-
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.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/metal/compiled_model.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/inference_context.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-class SingleOpModel {
- public:
-  SingleOpModel() = delete;
-  SingleOpModel(Operation&& operation,
-                const std::vector>& inputs,
-                const std::vector>& outputs);
-  virtual ~SingleOpModel() = default;
-
-  bool PopulateTensor(int index, std::vector&& data) {
-    inputs_[index].data = data;
-    return true;
-  }
-
-  absl::Status Invoke();
-
-  const std::vector& GetOutput(int index) const {
-    return outputs_[index].data;
-  }
-
- protected:
-  GraphFloat32 graph_;
-  std::vector inputs_;
-  std::vector outputs_;
-};
-
-absl::Status CompareVectors(const std::vector& reference,
-                            const std::vector& output, float max_error);
-
-/// Helper function that compiles previously configured graph (with added
-/// tasks), initializes graph with specified inputs, invokes and fills specified
-/// outputs
-absl::Status RunGraph(const std::vector& graph,
-                      id device,
-                      const std::map& inputs,
-                      std::map* outputs);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_TEST_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/transpose_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/transpose_conv.h
deleted file mode 100644
index 54dd2f9..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/transpose_conv.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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_TRANSPOSE_CONV_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_TRANSPOSE_CONV_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/environment.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-std::vector ConvolutionTransposed(
-    int id, ValueId input_id, ValueId output_id,
-    const ConvolutionTransposedAttributes& params,
-    const DeviceInfo& device_info, const RuntimeOptions& options);
-
-std::vector ConvolutionTransposed4x4(
-    int id, ValueId input_id, ValueId output_id,
-    const ConvolutionTransposedAttributes& params,
-    const DeviceInfo& device_info, const RuntimeOptions& options);
-
-bool CheckConvolutionTransposed4x4Support(
-    const ConvolutionTransposedAttributes& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_TRANSPOSE_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/util.h
deleted file mode 100644
index a1028ee..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/util.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* 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_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_UTIL_H_
-
-#include "tensorflow/lite/delegates/gpu/common/types.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-// returns work-group size for grid that tries to cover grid optimaly
-// If you use work-group size generated by this method you MUST check
-// all three dimensions of thread on out of border in your kernel.
-uint3 GetWorkGroupSizeForGrid(const uint3& grid_size);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/winograd.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/winograd.h
deleted file mode 100644
index e231e1e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/kernels/winograd.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_WINOGRAD_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_WINOGRAD_H_
-
-#include "tensorflow/lite/delegates/gpu/common/model.h"
-#include "tensorflow/lite/delegates/gpu/common/operations.h"
-#include "tensorflow/lite/delegates/gpu/metal/compute_task_descriptor.h"
-#include "tensorflow/lite/delegates/gpu/metal/runtime_options.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-struct Winograd4x4To36Attributes {
-  Padding2D padding;
-};
-
-std::vector Winograd4x4To36(
-    int id, ValueId input_id, ValueId output_id,
-    const Winograd4x4To36Attributes& attr);
-
-std::vector Winograd4x4To36TileX6(
-    int id, ValueId input_id, ValueId output_id,
-    const Winograd4x4To36Attributes& attr, const RuntimeOptions& options);
-
-struct Winograd36To4x4Attributes {
-  BHWC output_shape;
-  tflite::gpu::Tensor biases;
-};
-
-std::vector Winograd36To4x4(
-    int id, ValueId input_id, ValueId output_id, const RuntimeOptions& options,
-    const Winograd36To4x4Attributes& attr);
-
-std::vector Winograd36To4x4Tile4x1(
-    int id, ValueId input_id, ValueId output_id, const RuntimeOptions& options,
-    const Winograd36To4x4Attributes& attr);
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_KERNELS_WINOGRAD_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/metal_arguments.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/metal_arguments.h
deleted file mode 100644
index 496287c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/metal_arguments.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_GPU_METAL_METAL_ARGUMENTS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_METAL_ARGUMENTS_H_
-
-#import 
-
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-#include "tensorflow/lite/delegates/gpu/metal/arguments.h"
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-class MetalArguments : public ArgumentsSetter {
- public:
-  MetalArguments() = default;
-
-  absl::Status Init(int buffer_offset, Arguments* args, std::string* code);
-
-  // Move only
-  MetalArguments(MetalArguments&& args) = default;
-  MetalArguments& operator=(MetalArguments&& args) = default;
-  MetalArguments(const MetalArguments&) = delete;
-  MetalArguments& operator=(const MetalArguments&) = delete;
-
-  absl::Status SetInt(const std::string& name, int value) override;
-  absl::Status SetFloat(const std::string& name, float value) override;
-
-  void Encode(id encoder, int buffer_offset) const;
-
- private:
-  static constexpr char kArgsPrefix[] = "args.";
-  struct IntValue {
-    int value;
-
-    // many arguments generated automatically and not used
-    // to reduce amount of data transferred we adding this optimization
-    bool active = false;
-
-    // offset to shared storage.
-    uint32_t bytes_offset = -1;
-  };
-  std::map int_values_;
-
-  struct FloatValue {
-    float value;
-
-    // many arguments generated automatically and not used
-    // to reduce amount of data transferred we adding this optimization
-    bool active = false;
-
-    // offset to shared storage.
-    uint32_t bytes_offset = -1;
-  };
-  std::map float_values_;
-  std::vector const_data_;
-};
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_METAL_ARGUMENTS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/runtime_options.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/runtime_options.h
deleted file mode 100644
index d8e8fe3..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal/runtime_options.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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_RUNTIME_OPTIONS_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_RUNTIME_OPTIONS_H_
-
-namespace tflite {
-namespace gpu {
-namespace metal {
-
-struct RuntimeOptions {
-  enum class Precision {
-    FP16,
-    FP32,
-  };
-  // Buffer storage format. If FP32 then accumulator must be FP32.
-  Precision storage_precision = Precision::FP32;
-  // Accumulator precision. Defines the precision for convolutions.
-  Precision accumulator_precision = Precision::FP32;
-};
-
-}  // namespace metal
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_RUNTIME_OPTIONS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal_delegate.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal_delegate.h
deleted file mode 100644
index e1e2ed7..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal_delegate.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* 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_DELEGATE_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_DELEGATE_H_
-
-#include "tensorflow/lite/c/common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#else
-// For "C" 'bool' is not built-in type.
-#include 
-#endif  // __cplusplus
-
-typedef struct TfLiteDelegate TfLiteDelegate;
-
-typedef enum {
-  // waitUntilCompleted
-  TFLGpuDelegateWaitTypePassive,
-  // Minimize latency. It uses active spinning instead of mutex and consumes
-  // additional CPU resources.
-  TFLGpuDelegateWaitTypeActive,
-  // Useful when the output is used with GPU pipeline then or if external
-  // command encoder is set.
-  TFLGpuDelegateWaitTypeDoNotWait,
-  // Tries to avoid GPU sleep mode.
-  TFLGpuDelegateWaitTypeAggressive,
-} TFLGpuDelegateWaitType;
-
-// Creates a new delegate instance that need to be destroyed with
-// DeleteFlowDelegate when delegate is no longer used by tflite.
-typedef struct {
-  // Allows to quantify tensors, downcast values, process in float16 etc.
-  bool allow_precision_loss;
-  TFLGpuDelegateWaitType wait_type;
-  // Allows execution of integer quantized models
-  bool enable_quantization;
-} TFLGpuDelegateOptions;
-
-// Populates TFLGpuDelegateOptions as follows:
-//   allow_precision_loss = false;
-//   wait_type = TFLGpuDelegateWaitType::TFLGpuDelegateWaitTypePassive;
-//   enable_quantization = true;
-TFL_CAPI_EXPORT extern TFLGpuDelegateOptions TFLGpuDelegateOptionsDefault(void);
-
-// Creates a new delegate instance that need to be destroyed with
-// `TFLDeleteTfLiteGpuDelegate` when delegate is no longer used by TFLite.
-// When `options` is set to `nullptr`, the following default values are used:
-// .precision_loss_allowed = false,
-// .wait_type = kPassive,
-TFL_CAPI_EXPORT extern TfLiteDelegate* TFLGpuDelegateCreate(
-    const TFLGpuDelegateOptions* options);
-
-// Destroys a delegate created with `TFLGpuDelegateCreate` call.
-TFL_CAPI_EXPORT extern void TFLGpuDelegateDelete(TfLiteDelegate* delegate);
-
-#ifdef __cplusplus
-}  // extern "C"
-#endif  // __cplusplus
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_DELEGATE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal_delegate_internal.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal_delegate_internal.h
deleted file mode 100644
index 82bc720..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/metal_delegate_internal.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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_DELEGATE_INTERNAL_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_METAL_DELEGATE_INTERNAL_H_
-
-#import 
-
-#include 
-
-struct TfLiteDelegate;
-
-// Binds Metal buffer to an input or an output tensor in the initialized
-// delegate. Bound buffer should have sufficient storage to accommodate all
-// elements of a tensor. For quantized model, the buffer is bound to internal
-// dequantized float32 tensor.
-// Returns non-zero on success, or zero otherwise.
-//
-// *** Must be called *after* `Interpreter::ModifyGraphWithDelegate`. ***
-bool TFLGpuDelegateBindMetalBufferToTensor(TfLiteDelegate* delegate,
-                                           int tensor_index,
-                                           id metal_buffer);
-
-// Binds user-defined MTLComputeCommandEncoder. The delegate puts all GPU tasks
-// into this encoder instead of the internal encoder.
-// The callback is a user-defined function to take control over encoder and
-// command buffer. Can be nullptr.
-bool TFLGpuDelegateSetCommandEncoder(
-    TfLiteDelegate* delegate, id encoder,
-    std::function(bool is_last)> control_encoder);
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_METAL_DELEGATE_INTERNAL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/spi.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/spi.h
deleted file mode 100644
index a70f8db..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/gpu/spi.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* 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_SPI_H_
-#define TENSORFLOW_LITE_DELEGATES_GPU_SPI_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/gpu/api.h"
-#include "tensorflow/lite/delegates/gpu/common/access_type.h"
-#include "tensorflow/lite/delegates/gpu/common/status.h"
-
-// Contains only service provider-related interfaces. Users should not use them
-// directly.
-
-namespace tflite {
-namespace gpu {
-
-// Converts a tensor object into another one.
-class TensorObjectConverter {
- public:
-  virtual ~TensorObjectConverter() = default;
-
-  virtual absl::Status Convert(const TensorObject& input,
-                               const TensorObject& output) = 0;
-};
-
-class TensorObjectConverterBuilder {
- public:
-  virtual ~TensorObjectConverterBuilder() = default;
-
-  virtual bool IsSupported(const TensorObjectDef& input,
-                           const TensorObjectDef& output) const = 0;
-
-  virtual absl::Status MakeConverter(
-      const TensorObjectDef& input, const TensorObjectDef& output,
-      std::unique_ptr* converter) = 0;
-};
-
-// Connects tensor definition provided by a user (external) with tensor
-// definition used by the inference engine (internal).
-struct TensorTieDef {
-  uint32_t id;
-  AccessType access_type;
-  TensorObjectDef internal_def;
-  TensorObjectDef external_def;
-};
-
-// Connects external tensor object to internal tensor object and provides
-// functionality to copy data to/from external object to internal.
-class TensorTie {
- public:
-  explicit TensorTie(const TensorTieDef& def) : def_(def) {}
-
-  virtual ~TensorTie() = default;
-
-  virtual absl::Status SetExternalObject(TensorObject obj) = 0;
-
-  virtual TensorObject GetExternalObject() = 0;
-
-  virtual absl::Status CopyToExternalObject() = 0;
-
-  virtual absl::Status CopyFromExternalObject() = 0;
-
-  const TensorTieDef& def() const { return def_; }
-
- private:
-  const TensorTieDef def_;
-};
-
-}  // namespace gpu
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_GPU_SPI_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/activation_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/activation_builder.h
deleted file mode 100644
index 4537cd4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/activation_builder.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* 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_HEXAGON_BUILDERS_ACTIVATION_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_ACTIVATION_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class ActivationOpBuilder : public OpBuilder {
- public:
-  explicit ActivationOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  explicit ActivationOpBuilder(GraphBuilder* graph_builder, int op_type,
-                               int relu_value)
-      : OpBuilder(graph_builder, op_type), relu_value_(relu_value) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~ActivationOpBuilder() override;
-
- private:
-  TensorID node_output_;
-  float relu_value_ = 6;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_ACTIVATION_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/arg_min_max_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/arg_min_max_builder.h
deleted file mode 100644
index 54d85b5..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/arg_min_max_builder.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* 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_HEXAGON_BUILDERS_ARG_MIN_MAX_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_ARG_MIN_MAX_BUILDER_H_
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class ArgMinMaxOpBuilder : public OpBuilder {
- public:
-  explicit ArgMinMaxOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~ArgMinMaxOpBuilder() override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_ARG_MIN_MAX_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/arithmetic_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/arithmetic_builder.h
deleted file mode 100644
index cc17a5c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/arithmetic_builder.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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_HEXAGON_BUILDERS_ARITHMETIC_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_ARITHMETIC_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class ArithmeticOpBuilder : public OpBuilder {
- public:
-  explicit ArithmeticOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~ArithmeticOpBuilder() override;
-
- private:
-  TensorID node_output_;
-  float output_min_, output_max_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_ARITHMETIC_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/batch_seq_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/batch_seq_builder.h
deleted file mode 100644
index 9975b30..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/batch_seq_builder.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_BATCH_SEQ_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_BATCH_SEQ_BUILDER_H_
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class BatchSeqBuilder : public OpBuilder {
- public:
-  explicit BatchSeqBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override {
-    // BatchSeqConfig doesn't have any outputs.
-    return kTfLiteOk;
-  }
-
-  void SetMaxSizeForBatch(int max_size_for_batch) {
-    max_size_for_batch_ = max_size_for_batch;
-  }
-
-  void SetInputBatchDimensions(TfLiteIntArray* input_batch_dimensions) {
-    input_batch_dims_ = input_batch_dimensions;
-  }
-
-  void SetOutputBatchDimensions(TfLiteIntArray* output_batch_dimensions) {
-    output_batch_dims_ = output_batch_dimensions;
-  }
-
- private:
-  // Maximum size for the batch dimension in a single run.
-  // The graph can have input with larger batch, internally
-  // multiple runs will happen each won't have more than 'max_size_for_batch_'
-  // in batch dimension.
-  int max_size_for_batch_ = 1;
-  // Input dimension for each input in the graph.
-  // Input with fixed batch should have -1.
-  TfLiteIntArray* input_batch_dims_;
-  // Output dimension for each output in the graph.
-  // Output with fixed batch should have -1.
-  TfLiteIntArray* output_batch_dims_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_BATCH_SEQ_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/cast_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/cast_builder.h
deleted file mode 100644
index 901318b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/cast_builder.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_CAST_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_CAST_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-// This builder is used to cast int8 input or output tensors to & from uint8
-// respectively. No TFLite op converts to this.
-// NOTE: There are no explicit tests for this, but is required for all int8 unit
-// tests.
-class CastOpBuilder : public OpBuilder {
- public:
-  explicit CastOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  // inputs & outputs should contain the *same* (one) TFLite tensor-id, since
-  // tensors are cast in-place. The tensor will point to a different Hexagon
-  // TensorID after this runs.
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~CastOpBuilder() override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_CAST_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/concat_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/concat_builder.h
deleted file mode 100644
index 0146c91..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/concat_builder.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 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_HEXAGON_BUILDERS_CONCAT_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_CONCAT_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class ConcatOpBuilder : public OpBuilder {
- public:
-  explicit ConcatOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~ConcatOpBuilder() override;
-
- private:
-  TensorID node_output_;
-  std::vector input_minima_;
-  std::vector input_maxima_;
-  float output_min_, output_max_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_CONCAT_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/conv_2d_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/conv_2d_builder.h
deleted file mode 100644
index 1407f06..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/conv_2d_builder.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* 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_HEXAGON_BUILDERS_CONV_2D_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_CONV_2D_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class Conv2dOpBuilder : public OpBuilder {
- public:
-  explicit Conv2dOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~Conv2dOpBuilder() override;
-
- private:
-  // TODO(b/142009955): Combine into common util for all types of Conv.
-  TfLiteStatus ProcessPerChannelQuantizedWeights(const TfLiteIntArray* inputs,
-                                                 const TfLiteIntArray* outputs,
-                                                 TfLiteContext* context,
-                                                 float* weights_min,
-                                                 float* weights_max);
-
-  TfLiteStatus InitializeWeightsNodes(const TfLiteIntArray* inputs,
-                                      const TfLiteIntArray* outputs,
-                                      TfLiteContext* context,
-                                      const int input_depth);
-
-  TfLiteStatus ProcessPerChannelQuantizedBias(const TfLiteIntArray* inputs,
-                                              const TfLiteIntArray* outputs,
-                                              TfLiteContext* context,
-                                              float* bias_min, float* bias_max);
-
-  TfLiteStatus InitializeBiasNodes(const TfLiteIntArray* inputs,
-                                   const TfLiteIntArray* outputs,
-                                   TfLiteContext* context);
-
-  TensorID node_output_;
-  std::vector transposed_weights_;
-  std::vector stride_shape_;
-  std::vector weight_shape_;
-  OpBuilder* weights_min_node_ = nullptr;
-  OpBuilder* weights_max_node_ = nullptr;
-  OpBuilder* bias_min_node_ = nullptr;
-  OpBuilder* bias_max_node_ = nullptr;
-
-  // Non-null only if node has per-channel quantized weights/biases.
-  OpBuilder* channel_scales_node_ = nullptr;
-  float* scales_data_ = nullptr;
-  int num_scale_values_ = 1;
-
-  // Only used for dilated Depthwise Conv.
-  std::vector dilation_factors_h_w_;
-  std::vector space_to_batch_paddings_;
-  std::vector batch_to_space_crops_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_CONV_2D_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/hardswish_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/hardswish_builder.h
deleted file mode 100644
index a48b0b0..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/hardswish_builder.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_HARDSWISH_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_HARDSWISH_BUILDER_H_
-
-#include 
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class HardSwishOpBuilder : public OpBuilder {
- public:
-  explicit HardSwishOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~HardSwishOpBuilder() override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_HARDSWISH_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/l2_normalization_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/l2_normalization_builder.h
deleted file mode 100644
index 7a534cc..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/l2_normalization_builder.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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_HEXAGON_BUILDERS_L2_NORMALIZATION_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_L2_NORMALIZATION_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class L2NormalizationOpBuilder : public OpBuilder {
- public:
-  explicit L2NormalizationOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~L2NormalizationOpBuilder() override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_L2_NORMALIZATION_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/matmul_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/matmul_builder.h
deleted file mode 100644
index d891208..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/matmul_builder.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* 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_HEXAGON_BUILDERS_MATMUL_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_MATMUL_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-// Builder for FullyConnected op in Hexagon with weights as const.
-class MatMulWithConstWeightsOpBuilder : public OpBuilder {
- public:
-  explicit MatMulWithConstWeightsOpBuilder(GraphBuilder* graph_builder,
-                                           int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
- private:
-  TensorID node_output_;
-  std::vector weights_shape_, bias_shape_;
-  std::vector transposed_weights_;
-  float weights_min_, weights_max_;
-};
-
-// Builder for FullyConnected op in Hexagon with non const weights.
-class MatMulOpBuilder : public OpBuilder {
- public:
-  explicit MatMulOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
- private:
-  // Adds Fully connected op related ops to the graph.
-  TfLiteStatus AddFullyConnected(const TfLiteIntArray* inputs,
-                                 const TfLiteIntArray* outputs,
-                                 const TensorID weights_id,
-                                 const TensorID weights_min_id,
-                                 const TensorID weights_max_id,
-                                 TfLiteContext* context, OpBuilder* matmul_op);
-
-  TensorID node_output_;
-  std::vector weights_shape_, bias_shape_;
-  std::vector transposed_weights_;
-  float weights_min_, weights_max_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_MATMUL_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/min_max_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/min_max_builder.h
deleted file mode 100644
index 5683f33..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/min_max_builder.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_MIN_MAX_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_MIN_MAX_BUILDER_H_
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class MinMaxOpBuilder : public OpBuilder {
- public:
-  explicit MinMaxOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_MIN_MAX_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/mirror_pad_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/mirror_pad_builder.h
deleted file mode 100644
index 3afbac2..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/mirror_pad_builder.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_MIRROR_PAD_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_MIRROR_PAD_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class MirrorPadOpBuilder : public OpBuilder {
- public:
-  explicit MirrorPadOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~MirrorPadOpBuilder() override;
-
- private:
-  TensorID node_output_;
-  std::vector paddings_shape_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_MIRROR_PAD_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/neg_op_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/neg_op_builder.h
deleted file mode 100644
index 578447e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/neg_op_builder.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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_HEXAGON_BUILDERS_NEG_OP_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_NEG_OP_BUILDER_H_
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class NegOpBuilder : public OpBuilder {
- public:
-  explicit NegOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_NEG_OP_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/op_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/op_builder.h
deleted file mode 100644
index c2a2889..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/op_builder.h
+++ /dev/null
@@ -1,410 +0,0 @@
-/* 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_HEXAGON_BUILDERS_OP_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_OP_BUILDER_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "hexagon/hexagon_nn_ops.h"
-#include "tensorflow/lite/builtin_ops.h"
-#include "tensorflow/lite/c/builtin_op_data.h"
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/delegates/hexagon/hexagon_implementation.h"
-#include "tensorflow/lite/delegates/hexagon/hexagon_nn/hexagon_nn.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-// Wrapper that holds all data representing a single node in the Hexagon graph.
-struct OpNode {
-  std::vector inputs;
-  std::vector outputs;
-  // Value from the Enum of Ops in hexagon_nn_ops
-  int op_type;
-  hexagon_nn_padding_type padding_type = NN_PAD_NA;
-  // Id of node in the Hexagon graph.
-  int node_id = -1;
-  // Index/ID of node in the tflite graph.
-  // This ID can be duplicate if one TFLite node creates multiple Hexagon op
-  // nodes.
-  int tflite_node_index = -1;
-};
-
-class GraphBuilder;
-
-// Represents a single Op in the TFLite graph.
-// For each op in TFLite there should be an OpBuidler, this builder is
-// responsible for constructing equivalent node(s) in the hexagon graph. A
-// single builder can create one or more ops in the hexagon graph. When adding
-// new op* users should inherit from this class and implement
-// - PopulateSubgraph: which given inputs/outputs should construct the
-// equivalent hexagon nodes.
-// - RegisterOutputs: Which should have logic that maps final outputs from a
-// given node to the equivalent in Hexagon graph.
-class OpBuilder {
- public:
-  // Const representing the shape of a scalar value.
-  static constexpr int kScalarShape[] = {1, 1, 1, 1};
-
-  OpBuilder(GraphBuilder* graph_builder, int hexagon_op_type)
-      : graph_builder_(graph_builder) {
-    op_node_.op_type = hexagon_op_type;
-  }
-  // A tensor is identified in the graph using a pair of IDs
-  // (Node ID, output Tensor ID)
-  // Node producing this tensor, and the index of the tensor in this
-  // node output list.
-  using TensorID = std::pair;
-
-  virtual ~OpBuilder() {}
-
-  // Sets the op type in the hexagon graph.
-  void SetOpType(int op_type) { op_node_.op_type = op_type; }
-
-  // Sets the node id in the hexagon graph.
-  void SetNodeId(int node_id) { op_node_.node_id = node_id; }
-
-  // Sets the TfLite node index in the TfLite graph.
-  void SetTFLiteNodeId(int node_index) {
-    op_node_.tflite_node_index = node_index;
-  }
-
-  // Marks this node as Const node.
-  void SetConstNode() { op_node_.op_type = OP_Const; }
-
-  // Sets the padding type of the current node.
-  void SetPaddingType(hexagon_nn_padding_type padding_type) {
-    op_node_.padding_type = padding_type;
-  }
-
-  // Sets the builtin_data of TFLite node that this Builder is responsible for.
-  void SetBuiltinData(void* builtin_data) { builtin_data_ = builtin_data; }
-
-  // Returns true if the current op is a const Op.
-  bool IsConstNode() const { return op_node_.op_type == OP_Const; }
-
-  // Subclasses should override it and have logic which handles initializing
-  // hexagon node(s) for the current op, given 'inputs' 'outputs'
-  virtual TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                        const TfLiteIntArray* outputs,
-                                        TfLiteContext* context) {
-    return kTfLiteOk;
-  }
-
-  // Subclasses should override it and register the final output(s) from the
-  // node to the equivalent in hexagon graph.
-  virtual TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                                       TfLiteContext* context) {
-    return kTfLiteOk;
-  }
-
-  // Constructs OpNode which represents a node in the Hexagon graph.
-  const OpNode* Build();
-
-  // Returns the Node index in TFLite graph.
-  int GetTFLiteNodeID() const { return op_node_.tflite_node_index; }
-
-  // Returns the Op type of the current Op (in Hexagon graph)
-  int GetOpType() const { return op_node_.op_type; }
-
-  // Returns the node id in the hexagon graph.
-  int GetID() const { return op_node_.node_id; }
-
-  // Adds tensor identified by 'tensor_id' as input to the current Op.
-  void AddInput(const TensorID& tensor_id) { input_ids_.push_back(tensor_id); }
-
-  // Adds Output to the current node, the output has shape defined in 'dims'.
-  // The size of each element is defined using 'element_size'.
-  // Returns the TensorID identifying this output in the graph.
-  TensorID AddOutput(const TfLiteIntArray* dims, int element_size);
-
-  // Adds Output to the current node, each element in the output has
-  // size 'elementsize' and rank 'rank' and for each dimension in the output
-  // the maximum size is max_sizes[i].
-  // Returns the TensorID identifying this output in the graph.
-  TensorID AddOutput(int elementsize, int rank,
-                     const std::vector& max_sizes);
-
-  // Same as above but accepts pointer instead of std::vector.
-  TensorID AddOutput(int elementsize, int rank, const int* max_sizes_vect);
-
-  // Sets the node that corresponds to this builder in TFLite graph.
-  void SetTfLiteNode(const TfLiteNode* node) { tflite_node_ = node; }
-
-  // Static
-  // Computes the min/max values of 'tensor' and sets the values in
-  // the out params 'min' and 'max'.
-  // Returns kTfLiteOk on success.
-  static TfLiteStatus ComputeMinAndMaxQuantValues(const TfLiteTensor& tensor,
-                                                  float* min, float* max) {
-    if (tensor.type == kTfLiteUInt8) {
-      return ComputeMinAndMaxQuantValues(tensor, min, max,
-                                         std::numeric_limits::min(),
-                                         std::numeric_limits::max());
-    } else if (tensor.type == kTfLiteInt8) {
-      return ComputeMinAndMaxQuantValues(tensor, min, max,
-                                         std::numeric_limits::min(),
-                                         std::numeric_limits::max());
-    } else if (tensor.type == kTfLiteInt32) {
-      return ComputeMinAndMaxQuantValues(tensor, min, max,
-                                         std::numeric_limits::min(),
-                                         std::numeric_limits::max());
-    }
-    return kTfLiteError;
-  }
-
- protected:
-  // Helper method to fetch dimensions.
-  // TODO(karimnosseir): Move to a shared place.
-  void GetDims(int* batch_size, int* height_size, int* width_size,
-               int* depth_size, const TfLiteIntArray* dims) {
-    int* dim[] = {batch_size, height_size, width_size, depth_size};
-    for (int i = 0; i < 4; ++i) *(dim[i]) = 1;
-    for (int i = 4 - dims->size; i < 4; ++i) {
-      *dim[i] = dims->data[i - (4 - dims->size)];
-    }
-  }
-
-  // Computes the min and max for 'tensor' and adds them as input
-  // to the node.
-  TfLiteStatus ComputeAndAddMinAndMax(TfLiteContext* context,
-                                      const TfLiteTensor& tensor);
-
-  // Computes the float min and max for 'tensor', given 'min_value' and
-  // 'max_value' data range. The float min and max will be set in 'min' and
-  // 'max' params
-  template 
-  static TfLiteStatus ComputeMinAndMaxQuantValues(const TfLiteTensor& tensor,
-                                                  float* min, float* max,
-                                                  T min_value, T max_value) {
-    *min = 0;
-    *max = 0;
-    const TfLiteQuantization& quant = tensor.quantization;
-    if (quant.type != TfLiteQuantizationType::kTfLiteAffineQuantization) {
-      printf("Tensor not quantized: %s\n", tensor.name);
-      return kTfLiteError;
-    }
-    const TfLiteAffineQuantization* params =
-        static_cast(quant.params);
-    float scale = params->scale->data[0];
-    float zero_point = static_cast(params->zero_point->data[0]);
-    *min = scale * (static_cast(min_value) - zero_point);
-    *max = scale * (static_cast(max_value) - zero_point);
-
-    return kTfLiteOk;
-  }
-
-  OpNode op_node_;
-  // inputs to the current op. Each pair identifies a single output from
-  // another node (node_id, output_id).
-  std::vector input_ids_;
-  // Pointer to the graph builder.
-  GraphBuilder* graph_builder_ = nullptr;
-  // Data needed by this node.
-  void* builtin_data_ = nullptr;
-  // TODO(karimnosseir): Currently we only use it for getting output
-  // size. Can we avoid passing it ?
-  const TfLiteNode* tflite_node_ = nullptr;
-};
-
-class GraphBuilder {
- public:
-  GraphBuilder(const HexagonNN* hexagon_nn, TfLiteContext* context,
-               int graph_id)
-      : hexagon_nn_(hexagon_nn), context_(context), graph_id_(graph_id) {}
-
-  // Returns per OP builder. 'op_type' is the TfLite builtinOperator.
-  OpBuilder* AddNodeFromTfLiteOp(int op_type, TfLiteNode* node,
-                                 int tflite_node_index);
-
-  // Add node to the graph. The caller responsible for setting correct
-  // data in the Op.
-  // 'tflite_node_index' is the node index in TFLite that creates this op.
-  OpBuilder* AddNode(int tflite_node_index = -1);
-
-  // Add const node that provides the data held by 'tensor'.
-  // If `int8_to_uint8` is true, then the data will be casted to uint8 from
-  // int8.
-  OpBuilder* AddConstNodeWithData(int tensor_id, const TfLiteTensor& tensor,
-                                  bool int8_to_uint8 = false);
-
-  // Same as above but takes shape of the tensor that will holds the data.
-  OpBuilder* AddConstNodeWithData(const int shape[], char* data, int data_size);
-
-  OpBuilder* CreateOpBuilderFromTfLiteOp(int op_type, TfLiteNode* node);
-
-  // Construct Input node with 'input_tensors' as output.
-  TfLiteStatus AddInputTensors(const TfLiteIntArray* input_tensors,
-                               TfLiteContext* context);
-
-  // Construct Output node with 'output_tensors' as input.
-  TfLiteStatus AddOutputTensors(const TfLiteIntArray* output_tensors,
-                                TfLiteContext* context);
-
-  // Adds BatchSeqConfig node to the graph. This is configuration
-  // for a dynamic batch size for the graph.
-  // A graph can have only one node of this type.
-  void AddBatchSeqConfig(int max_size_for_batch,
-                         TfLiteIntArray* input_batch_dimensions,
-                         TfLiteIntArray* output_batch_dimensions);
-
-  // Returns tensor id inside Hexagon graph.
-  OpBuilder::TensorID GetHexagonTensorId(int tflite_tensor_index) {
-    if (!HasTensor(tflite_tensor_index)) {
-      // Return invalid ID.
-      return OpBuilder::TensorID(-1, -1);
-    }
-    return tensors_[tflite_tensor_index];
-  }
-
-  // Return true if this tensor was added before to the graph.
-  bool HasTensor(int tflite_tensor_index) {
-    if (tensors_.size() <= tflite_tensor_index) {
-      return false;
-    }
-    // the first field is node ID and id = 0 is reserved
-    // so anything > 0 is correctly initialized.
-    return tensors_[tflite_tensor_index].first != 0;
-  }
-
-  void AddDebugNode() {}
-
-  void Build() {
-    for (int i = 0; i < builders_.size(); ++i) {
-      if (builders_[i]->IsConstNode()) {
-        continue;
-      }
-      const OpNode* op_node = builders_[i]->Build();
-      int error = hexagon_nn_->hexagon_nn_append_node(
-          graph_id_, op_node->node_id, op_node->op_type, op_node->padding_type,
-          op_node->inputs.data(), op_node->inputs.size(),
-          op_node->outputs.data(), op_node->outputs.size());
-      if (error != 0) {
-        printf("Error adding node: id:%d, op_type:%d\n", op_node->node_id,
-               op_node->op_type);
-      }
-    }
-  }
-
-  void print() {
-    printf("------------------------------\n");
-    std::vector buf(10000);
-    hexagon_nn_->hexagon_nn_snpprint(graph_id_, buf.data(), buf.size());
-    printf("%s", buf.data());
-    printf("------------------------------\n");
-    fflush(stdout);
-  }
-
-  // Add new tensor mapping to the tensor list.
-  bool AddTensorWithID(int tflite_tensor_id, int hexagon_node_id,
-                       int hexagon_node_output_id, bool overwrite = false) {
-    if (!overwrite && HasTensor(tflite_tensor_id)) {
-      TF_LITE_KERNEL_LOG(
-          context_,
-          "Trying to add duplicate tensor without overwrite, tflite_tensor_id "
-          "%d, hexagon_node_id %d, hexagon_node_output_id %d",
-          tflite_tensor_id, hexagon_node_id, hexagon_node_output_id);
-      return false;
-    }
-    if (tensors_.size() <= tflite_tensor_id) {
-      tensors_.resize(tflite_tensor_id + 1);
-    }
-    if (hexagon_node_id == -1 || hexagon_node_output_id == -1)
-      TF_LITE_KERNEL_LOG(context_,
-                         "Trying to add invalid id, tflite_tensor_id "
-                         "%d, hexagon_node_id %d, hexagon_node_output_id %d",
-                         tflite_tensor_id, hexagon_node_id,
-                         hexagon_node_output_id);
-    tensors_[tflite_tensor_id] =
-        OpBuilder::TensorID(hexagon_node_id, hexagon_node_output_id);
-    return true;
-  }
-
-  int GetOpTypeId(int node_id) {
-    if (node_id > builders_.size()) {
-      return -1;
-    }
-    return builders_[node_id - 1]->GetOpType();
-  }
-
-  int GetTFLiteNodeID(int node_id) const {
-    if (node_id > builders_.size()) {
-      return -1;
-    }
-    return builders_[node_id - 1]->GetTFLiteNodeID();
-  }
-
-  // Returns true if the graph supports dynamic batch. False otherwise.
-  bool GraphHasDynamicBatch() const { return max_size_for_batch_ != -1; }
-
-  // Returns the maximum value for batch dimension the graph supports.
-  // -1 if the graph doesn't support dynamic batch.
-  int GetMaxBatchSize() const { return max_size_for_batch_; }
-
- private:
-  // Lookup in cache if data with key 'cache_key' is present.
-  // Return OpBuilder* for the data if found, nullptr otherwise.
-  OpBuilder* LookupConstData(uint64_t cache_key);
-
-  // Inserts 'value' in cache, with key equals 'cache_key'.
-  // If data in cache with same key then it will be overwritten.
-  void AddToCache(uint64_t cache_key, OpBuilder* value);
-
-  // Helper method to fetch dimensions.
-  // TODO(karimnosseir): Move this method to shared place.
-  void GetDims(int* batch_size, int* height_size, int* width_size,
-               int* depth_size, const TfLiteIntArray* dims) {
-    int* dim[] = {batch_size, height_size, width_size, depth_size};
-    for (int i = 0; i < 4; ++i) *(dim[i]) = 1;
-    for (int i = 4 - dims->size; i < 4; ++i) {
-      *dim[i] = dims->data[i - (4 - dims->size)];
-    }
-  }
-
-  // Adds a Cast op to convert a tensor from int8 to uint8 (or vice versa).
-  // The builder which has the casting operator is filled in 'cast_op_builder'
-  // if not nullptr.
-  TfLiteStatus AddCastOp(TfLiteContext* context, int op_type, int tensor_id,
-                         OpBuilder** cast_op_builder);
-
-  const HexagonNN* hexagon_nn_ = nullptr;
-  TfLiteContext* context_ = nullptr;
-  int graph_id_ = -1;
-  std::vector> builders_;
-  // Index in the vector is the tflite_tensor_index, the value
-  // is the ID in the hexgon graph.
-  std::vector tensors_;
-
-  // If the graph being built supports dynamic batch, this represents
-  // the maximum value for batch.
-  int max_size_for_batch_ = -1;
-
-  // Cache for const data in the graph.
-  // Key is hash of the data, value is pointer to the OpBuilder* for the added
-  // data.
-  std::map cache_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_OP_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/op_factory.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/op_factory.h
deleted file mode 100644
index 7f75725..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/op_factory.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* 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_HEXAGON_BUILDERS_OP_FACTORY_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_OP_FACTORY_H_
-
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-class GraphBuilder;
-class OpBuilder;
-
-OpBuilder* CreateArgMinMaxOpBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateActivationBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateArithmeticBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateMatMulWithConstWeightsOpBuilder(GraphBuilder* graph_builder,
-                                                 int op_type);
-OpBuilder* CreateConcatBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateConv2DBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateTransposeConv2DBuilder(GraphBuilder* graph_builder,
-                                        int op_type);
-OpBuilder* CreatePool2DBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateReshapeBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateSoftmaxBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateReduceBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateMirrorPadBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreatePadBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateResizeNearestNeighborBuilder(GraphBuilder* graph_builder,
-                                              int op_type);
-OpBuilder* CreateL2NormalizationBuilder(GraphBuilder* graph_builder,
-                                        int op_type);
-OpBuilder* CreateSplitBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateResizeBilinearOpBuilder(GraphBuilder* graph_builder,
-                                         int op_type);
-OpBuilder* CreateNegOpBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateTransposeBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateSpaceToDepthBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateBatchSeqBuilder(GraphBuilder* graph_builder, int op_type,
-                                 int max_size_for_batch,
-                                 TfLiteIntArray* input_batch_dimensions,
-                                 TfLiteIntArray* output_batch_dimensions);
-OpBuilder* CreateQuantizeBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateHardSwishBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateCastBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateMinMaxBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateSliceOpBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreatePackBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateMatMulOpBuilder(GraphBuilder* graph_builder, int op_type);
-OpBuilder* CreateStridedSliceBuilder(GraphBuilder* graph_builder, int op_type);
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_OP_FACTORY_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/pack_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/pack_builder.h
deleted file mode 100644
index 895a0d6..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/pack_builder.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_PACK_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_PACK_BUILDER_H_
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class PackOpBuilder : public OpBuilder {
- public:
-  explicit PackOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
- private:
-  TensorID node_output_;
-  // Min/max for all inputs.
-  std::vector minima_, maxima_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_PACK_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/pad_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/pad_builder.h
deleted file mode 100644
index 62bfaa8..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/pad_builder.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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_HEXAGON_BUILDERS_PAD_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_PAD_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class PadOpBuilder : public OpBuilder {
- public:
-  explicit PadOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~PadOpBuilder() override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_PAD_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/pool_2d_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/pool_2d_builder.h
deleted file mode 100644
index 470ea07..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/pool_2d_builder.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 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_HEXAGON_BUILDERS_POOL_2D_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_POOL_2D_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class Pool2dOpBuilder : public OpBuilder {
- public:
-  explicit Pool2dOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~Pool2dOpBuilder();
-
- private:
-  TensorID node_output_;
-  std::vector stride_shape_;
-  std::vector filter_shape_;
-  float output_min_, output_max_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_POOL_2D_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/quantize_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/quantize_builder.h
deleted file mode 100644
index 446d1e3..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/quantize_builder.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_QUANTIZE_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_QUANTIZE_BUILDER_H_
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class QuantizeOpBuilder : public OpBuilder {
- public:
-  explicit QuantizeOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  explicit QuantizeOpBuilder(GraphBuilder* graph_builder, int op_type,
-                             int relu_value)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~QuantizeOpBuilder() override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_QUANTIZE_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/reduce_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/reduce_builder.h
deleted file mode 100644
index ef860db..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/reduce_builder.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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_HEXAGON_BUILDERS_REDUCE_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_REDUCE_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class ReduceOpBuilder : public OpBuilder {
- public:
-  explicit ReduceOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~ReduceOpBuilder() override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_REDUCE_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/reshape_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/reshape_builder.h
deleted file mode 100644
index b5514e5..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/reshape_builder.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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_HEXAGON_BUILDERS_RESHAPE_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_RESHAPE_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class ReshapeOpBuilder : public OpBuilder {
- public:
-  explicit ReshapeOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~ReshapeOpBuilder() override;
-
- private:
-  TensorID node_output_;
-  std::vector output_shape_;
-  std::vector output_shape_shape_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_RESHAPE_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/resize_bilinear_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/resize_bilinear_builder.h
deleted file mode 100644
index 3e8891e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/resize_bilinear_builder.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* 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_HEXAGON_BUILDERS_RESIZE_BILINEAR_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_RESIZE_BILINEAR_BUILDER_H_
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class ResizeBilinearOpBuilder : public OpBuilder {
- public:
-  explicit ResizeBilinearOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~ResizeBilinearOpBuilder() override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_RESIZE_BILINEAR_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/resize_nearest_neighbor_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/resize_nearest_neighbor_builder.h
deleted file mode 100644
index 2c16eff..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/resize_nearest_neighbor_builder.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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_HEXAGON_BUILDERS_RESIZE_NEAREST_NEIGHBOR_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_RESIZE_NEAREST_NEIGHBOR_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class ResizeNearestNeighborOpBuilder : public OpBuilder {
- public:
-  explicit ResizeNearestNeighborOpBuilder(GraphBuilder* graph_builder,
-                                          int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~ResizeNearestNeighborOpBuilder() override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_RESIZE_NEAREST_NEIGHBOR_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/slice_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/slice_builder.h
deleted file mode 100644
index 9bb0c58..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/slice_builder.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_SLICE_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_SLICE_BUILDER_H_
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class SliceOpBuilder : public OpBuilder {
- public:
-  explicit SliceOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_SLICE_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/softmax_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/softmax_builder.h
deleted file mode 100644
index cb35a2f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/softmax_builder.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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_HEXAGON_BUILDERS_SOFTMAX_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_SOFTMAX_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class SoftmaxOpBuilder : public OpBuilder {
- public:
-  explicit SoftmaxOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~SoftmaxOpBuilder();
-
- private:
-  TensorID node_output_;
-  float beta_value_ = 1.0f;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_SOFTMAX_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/space_to_depth_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/space_to_depth_builder.h
deleted file mode 100644
index 347c0aa..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/space_to_depth_builder.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_SPACE_TO_DEPTH_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_SPACE_TO_DEPTH_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-// Supports both ways:
-// Space -> Depth & Depth -> Space.
-class SpaceToDepthOpBuilder : public OpBuilder {
- public:
-  explicit SpaceToDepthOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~SpaceToDepthOpBuilder() override;
-
- private:
-  TensorID node_output_;
-  int block_size_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_SPACE_TO_DEPTH_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/split_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/split_builder.h
deleted file mode 100644
index e3ec45e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/split_builder.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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_HEXAGON_BUILDERS_SPLIT_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_SPLIT_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class SplitOpBuilder : public OpBuilder {
- public:
-  explicit SplitOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~SplitOpBuilder() override;
-
- private:
-  std::vector node_outputs_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_SPLIT_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/strided_slice_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/strided_slice_builder.h
deleted file mode 100644
index b7f042d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/strided_slice_builder.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_STRIDED_SLICE_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_STRIDED_SLICE_BUILDER_H_
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class StridedSliceOpBuilder : public OpBuilder {
- public:
-  explicit StridedSliceOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
- private:
-  TensorID node_output_;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_STRIDED_SLICE_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/tests/hexagon_delegate_op_model.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/tests/hexagon_delegate_op_model.h
deleted file mode 100644
index 25b2d2b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/tests/hexagon_delegate_op_model.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_TESTS_HEXAGON_DELEGATE_OP_MODEL_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_TESTS_HEXAGON_DELEGATE_OP_MODEL_H_
-
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/delegates/hexagon/hexagon_delegate.h"
-#include "tensorflow/lite/interpreter.h"
-#include "tensorflow/lite/kernels/internal/reference/reference_ops.h"
-#include "tensorflow/lite/kernels/internal/tensor.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-#include "tensorflow/lite/kernels/register.h"
-#include "tensorflow/lite/kernels/test_util.h"
-#include "tensorflow/lite/model.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-class SingleOpModelWithHexagon : public SingleOpModel {
- public:
-  SingleOpModelWithHexagon() : delegate_(nullptr, [](TfLiteDelegate*) {}) {}
-
-  void ApplyDelegateAndInvoke() {
-    static const char kDelegateName[] = "TfLiteHexagonDelegate";
-
-    // Make sure we set the environment.
-    setenv(
-        "ADSP_LIBRARY_PATH",
-        "/data/local/tmp/hexagon_delegate_test;/system/lib/rfsa/adsp;/system/"
-        "vendor/lib/rfsa/adsp;/dsp",
-        1 /*overwrite*/);
-
-    // For tests, we use one-op-models.
-    params_.min_nodes_per_partition = 1;
-    auto* delegate_ptr = TfLiteHexagonDelegateCreate(¶ms_);
-    ASSERT_TRUE(delegate_ptr != nullptr);
-    delegate_ = Interpreter::TfLiteDelegatePtr(
-        delegate_ptr, [](TfLiteDelegate* delegate) {
-          TfLiteHexagonDelegateDelete(delegate);
-          // Turn off the fast rpc and cleanup.
-          // Any communication with the DSP will fail unless new
-          // HexagonDelegateInit called.
-          TfLiteHexagonTearDown();
-        });
-    TfLiteHexagonInit();
-    // Make sure we have valid interpreter.
-    ASSERT_TRUE(interpreter_ != nullptr);
-    // Add delegate.
-    EXPECT_TRUE(interpreter_->ModifyGraphWithDelegate(delegate_.get()) !=
-                kTfLiteError);
-    // Make sure graph has one Op which is the delegate node.
-    ASSERT_EQ(1, interpreter_->execution_plan().size());
-    const int node = interpreter_->execution_plan()[0];
-    const auto* node_and_reg = interpreter_->node_and_registration(node);
-    ASSERT_TRUE(node_and_reg != nullptr);
-    ASSERT_TRUE(node_and_reg->second.custom_name != nullptr);
-    ASSERT_STREQ(kDelegateName, node_and_reg->second.custom_name);
-
-    Invoke();
-  }
-
- protected:
-  using SingleOpModel::builder_;
-
- private:
-  Interpreter::TfLiteDelegatePtr delegate_;
-  TfLiteHexagonDelegateOptions params_ = {0};
-};
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_TESTS_HEXAGON_DELEGATE_OP_MODEL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/transpose_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/transpose_builder.h
deleted file mode 100644
index f941830..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/transpose_builder.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* 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_HEXAGON_BUILDERS_TRANSPOSE_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_TRANSPOSE_BUILDER_H_
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class TransposeOpBuilder : public OpBuilder {
- public:
-  explicit TransposeOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
- private:
-  TensorID node_output_;
-};
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_TRANSPOSE_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/transpose_conv_2d_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/transpose_conv_2d_builder.h
deleted file mode 100644
index 4afab98..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/builders/transpose_conv_2d_builder.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* 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_HEXAGON_BUILDERS_TRANSPOSE_CONV_2D_BUILDER_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_TRANSPOSE_CONV_2D_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-
-namespace tflite {
-namespace delegates {
-namespace hexagon {
-
-class TransposeConv2dOpBuilder : public OpBuilder {
- public:
-  explicit TransposeConv2dOpBuilder(GraphBuilder* graph_builder, int op_type)
-      : OpBuilder(graph_builder, op_type) {}
-  TfLiteStatus PopulateSubGraph(const TfLiteIntArray* inputs,
-                                const TfLiteIntArray* outputs,
-                                TfLiteContext* context) override;
-
-  TfLiteStatus RegisterOutputs(const TfLiteIntArray* outputs,
-                               TfLiteContext* context) override;
-
-  ~TransposeConv2dOpBuilder();
-
- private:
-  // TODO(b/142009955): Combine into common util for all types of Conv.
-  TfLiteStatus ProcessPerChannelQuantizedWeights(const TfLiteIntArray* inputs,
-                                                 const TfLiteIntArray* outputs,
-                                                 TfLiteContext* context,
-                                                 float* weights_min,
-                                                 float* weights_max);
-
-  TensorID node_output_;
-  std::vector transposed_weights_;
-  std::vector stride_shape_;
-  std::vector bias_shape_;
-  std::vector bias_data_;
-
-  // Non-null only if node has per-channel quantized weights/biases.
-  OpBuilder* channel_scales_node_ = nullptr;
-  float* scales_data_ = nullptr;
-  int num_scale_values_ = 1;
-};
-
-}  // namespace hexagon
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_BUILDERS_TRANSPOSE_CONV_2D_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_delegate.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_delegate.h
deleted file mode 100644
index 931b02e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_delegate.h
+++ /dev/null
@@ -1,122 +0,0 @@
-/* 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_HEXAGON_HEXAGON_DELEGATE_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_DELEGATE_H_
-
-#include "tensorflow/lite/c/common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-// Use TfLiteHexagonDelegateOptionsDefault() for Default options.
-struct TFL_CAPI_EXPORT TfLiteHexagonDelegateOptions {
-  // This corresponds to the debug level in the hexagon SDK. 0 (default)
-  // means no debug.
-  int debug_level;
-
-  // This corresponds to powersave_level in the hexagon SDK.
-  // where 0 (default) means high performance which means more power
-  // consumption.
-  int powersave_level;
-
-  // If set to true, performance information about the graph will be dumped
-  // to Standard output, this includes cpu cycles.
-  // WARNING: Experimental and subject to change anytime.
-  bool print_graph_profile;
-
-  // If set to true, graph structure will be dumped to Standard output.
-  // This is usually beneficial to see what actual nodes executed on
-  // the DSP. Combining with 'debug_level' more information will be printed.
-  // WARNING: Experimental and subject to change anytime.
-  bool print_graph_debug;
-
-  // This sets the maximum number of Hexagon graphs created with
-  // hexagon_nn_init. Each graph corresponds to one delegated node subset in the
-  // TFLite model.
-  int max_delegated_partitions;
-  // This sets the minimum number of nodes per graph created with
-  // hexagon_nn_init. Defaults to 2.
-  int min_nodes_per_partition;
-
-  // If true, then the hexagon graph will adapt for inputs with dynamic batch.
-  // See below options are needed to be set.
-  // Currently, Only supported when the whole graph is delegated, and
-  // with batch as index 0.
-  // WARNING: Experimental and subject to change anytime.
-  bool enable_dynamic_batch_size;
-
-  // Maximum value for a batch dimension when evaluating graphs with
-  // dynamic batch. The input to the graph can have value for batch bigger than
-  // this number, internally the graph will run multiple times each with
-  // batch dimension <= max_batch_size. you should decide the value of this
-  // based on memory/latency tradeoffs.
-  // This needs to be set only if 'enable_dynamic_batch_size' is true.
-  // Not needed for fixed graphs.
-  // WARNING: Experimental and subject to change anytime.
-  int max_batch_size;
-
-  // Each element identifies the index of the batch dimension in a single input.
-  // input_batch_dimensions->data[i] is the index of the batch dimension for
-  // input[i]. If the graph has 1 input then the size of the array should be 1,
-  // and so on. This needs to be set only if 'enable_dynamic_batch_size' is
-  // true. Not needed for fixed graphs.
-  // If input[i] doesn't have dynamic batch, then input_batch_dimensions[i]
-  // should be -1.
-  // Delegate will take ownership of the pointer.
-  // WARNING: Experimental and subject to change anytime.
-  TfLiteIntArray* input_batch_dimensions;
-
-  // Each element identifies the index of the batch dimension in a single
-  // output. output_batch_dimensions->data[i] is the index of the batch
-  // dimension for output[i]. If the graph has 1 output then the size of the
-  // array should be 1, and so on. This needs to be set only if
-  // 'enable_dynamic_batch_size' is true. Not needed for fixed graphs. If
-  // output[i] has doesn't have dynamic batch, then output_batch_dimensions[i]
-  // should be -1. Delegate will take ownership of the pointer. WARNING:
-  // Experimental and subject to change anytime.
-  TfLiteIntArray* output_batch_dimensions;
-};
-
-// Return a delegate that uses Hexagon SDK for ops execution.
-// Must outlive the interpreter.
-TfLiteDelegate* TFL_CAPI_EXPORT
-TfLiteHexagonDelegateCreate(const TfLiteHexagonDelegateOptions* options);
-
-// Returns TfLiteHexagonDelegateOptions populated with default values.
-TFL_CAPI_EXPORT TfLiteHexagonDelegateOptions
-TfLiteHexagonDelegateOptionsDefault();
-
-// Do any needed cleanup and delete 'delegate'.
-void TFL_CAPI_EXPORT TfLiteHexagonDelegateDelete(TfLiteDelegate* delegate);
-
-// Initializes the DSP connection.
-// This should be called before doing any usage of the delegate.
-// "lib_directory_path": Path to the directory which holds the
-// shared libraries for the Hexagon NN libraries on the device.
-void TFL_CAPI_EXPORT TfLiteHexagonInitWithPath(const char* lib_directory_path);
-
-// Same as above method but doesn't accept the path params.
-// Assumes the environment setup is already done. Only initialize Hexagon.
-void TFL_CAPI_EXPORT TfLiteHexagonInit();
-
-// Clean up and switch off the DSP connection.
-// This should be called after all processing is done and delegate is deleted.
-void TFL_CAPI_EXPORT TfLiteHexagonTearDown();
-#ifdef __cplusplus
-}
-#endif  // __cplusplus
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_DELEGATE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_delegate_kernel.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_delegate_kernel.h
deleted file mode 100644
index e7ba5e4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_delegate_kernel.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* 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_HEXAGON_HEXAGON_DELEGATE_KERNEL_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_DELEGATE_KERNEL_H_
-
-#include 
-
-#include 
-#include 
-#include 
-#include 
-
-#include "hexagon/hexagon_nn_ops.h"
-#include "tensorflow/lite/builtin_ops.h"
-#include "tensorflow/lite/c/builtin_op_data.h"
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/core/api/profiler.h"
-#include "tensorflow/lite/delegates/hexagon/builders/op_builder.h"
-#include "tensorflow/lite/delegates/hexagon/hexagon_delegate.h"
-#include "tensorflow/lite/delegates/hexagon/hexagon_implementation.h"
-#include "tensorflow/lite/delegates/hexagon/hexagon_nn/hexagon_nn.h"
-#include "tensorflow/lite/delegates/utils/simple_delegate.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-
-// Represents an abstraction of a Hexagon NNLib graph with functionality to
-// initialize, prepare and invoke it based on the TFLite subgraph to be
-// delegated.
-class HexagonDelegateKernel : public SimpleDelegateKernelInterface {
- public:
-  explicit HexagonDelegateKernel(const ::TfLiteHexagonDelegateOptions& params)
-      : params_(params) {}
-
-  // Initialize the Hexagon graph and add required nodes.
-  TfLiteStatus Init(TfLiteContext* context,
-                    const TfLiteDelegateParams* params) override;
-
-  // Prepare the Hexagon graph with hexagon_nn_prepare.
-  TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) override;
-
-  // Allocate Hexagon tensordefs for graph I/O & execute it.
-  TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) override;
-
-  ~HexagonDelegateKernel() override;
-
-  // Sets the environment required for Hexagon execution: DSP attributes,
-  // rpcmem, etc.
-  static void InitState();
-
-  // Teardown the environment initialized in InitState.
-  static void Teardown();
-
- private:
-  // Builds the Hexagon graph based on delegated TFLite subgraph.
-  TfLiteStatus BuildGraph(TfLiteContext* context,
-                          const TfLiteIntArray* input_tensors,
-                          const TfLiteIntArray* output_tensors);
-
-  void ReportError(TfLiteContext* context, const std::string& msg);
-
-  // Resizes output tensors in case the delegate has dynamic batch enabled.
-  // Returns Error otherwise or if the requested size is invalid.
-  TfLiteStatus ResizeOutputTensors(TfLiteContext* context, TfLiteNode* node);
-
-  void PrintLog();
-
-  // Prints performance information about the graph including cycles per node.
-  // If 'profiler' is not nullptr data will be added to it.
-  void PrintPerformanceData(Profiler* profiler);
-
-  // Print debugging information about the graph constructed.
-  // Amount of information can be increased with debug level.
-  void PrintDebuggingGraph();
-
-  const HexagonNN* hexagon_nn_ = nullptr;  // Not owned.
-  std::unique_ptr builder_;
-  hexagon_nn_nn_id graph_id_ = -1;
-  // Indices of nodes in the delegated TfLite subgraph.
-  std::vector nodes_;
-  ::TfLiteHexagonDelegateOptions params_;
-
-  // Whether the Hexagon graph is prepared or not.
-  bool graph_prepared_ = false;
-};
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_DELEGATE_KERNEL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_implementation.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_implementation.h
deleted file mode 100644
index c65d936..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_implementation.h
+++ /dev/null
@@ -1,142 +0,0 @@
-/* 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_HEXAGON_HEXAGON_IMPLEMENTATION_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_IMPLEMENTATION_H_
-
-#include "tensorflow/lite/delegates/hexagon/hexagon_nn_interface.h"
-
-namespace tflite {
-// Holds the methods to use to Construct/Execute NN graph using Hexagon NNLib.
-struct HexagonNN {
-  // Call this function before creating a graph. It allows the environment on
-  // the DSP to configure some settings.
-  hexagon_nn_config_fn* hexagon_nn_config;
-
-  //   Creates a new graph and returns an identifier to refer to the new graph.
-  //   After a graph is
-  // initialized, nodes can be added to it.
-  // The returned graph is empty and cannot be executed until all nodes have
-  // been added and the graph is finalized with hexagon_nn_prepare(). Multiple
-  // graphs can be created and can be kept alive in the DSP environment
-  // simultaneously.
-  hexagon_nn_init_fn* hexagon_nn_init;
-
-  // Provides a simple parameter between 0 and 255 to control the power saving
-  // mode.
-  // A level of 255 indicates that preference should be given to minimizing
-  // power consumption. A level of 0 indicates that preference should be given
-  // to executing as fast as possible.
-  //
-  // Returns 0 on success, otherwise failure.
-  hexagon_nn_set_powersave_level_fn* hexagon_nn_set_powersave_level;
-
-  // Changes the debug verbosity level for messages.
-  hexagon_nn_set_debug_level_fn* hexagon_nn_set_debug_level;
-
-  // Prepares a network for execution.
-  // This function is required after all the nodes have been appended and before
-  // execution.
-  // This call provides a hook where memory can be allocated, data
-  // can be rearranged, inputs and outputs can be linked up, and things in the
-  // graph can be optimized.
-  // Once a network has been prepared, it can no longer
-  // be appended to, but it can be executed.
-  //
-  // Returns 0 on success, otherwise failure.
-  hexagon_nn_prepare_fn* hexagon_nn_prepare;
-
-  // Adds an ordinary (non-constant) node to the graph.
-  // Non-constant nodes can have zero or more inputs and zero or more outputs.
-  // An input is described as a source node ID as well as an output index to
-  // refer to which one of several outputs a node may have.
-  // An output is described with a maximum size. The true size of an output can
-  // be computed dynamically, but the caller must define the maximum amount of
-  // data storage required by the output during node creation.
-  //
-  // Returns 0 on success, otherwise failure.
-  hexagon_nn_append_node_fn* hexagon_nn_append_node;
-
-  // Adds constant nodes to a graph.
-  // Constant nodes produce a single output that can be connected to one graph
-  // node input. Unique node_ids are required for referencing nodes when
-  // connecting the graph (for example, specifying which outputs of earlier
-  // nodes will be used as inputs to particular subsequent nodes). Node_ids are
-  // selected by the caller, but node_id=0 and node_id>0xF0000000 are reserved.
-  // Node_ids must be unique.
-  // *** NOTE: On SDM835 and older targets,
-  // hexagon_nn_append_const_node() will not work properly for arrays larger
-  // than 32 MB. Instead, use hexagon_nn_append_empty_const_node_large_array(),
-  // which expects the same arguments.
-  //
-  // Returns 0 on success, otherwise failure.
-  hexagon_nn_append_const_node_fn* hexagon_nn_append_const_node;
-
-  // Executes a network, with provided input data and returning output data.
-  // Execution will fail if the network has not been prepared.
-  // Input is provided to the INPUT node, and output is returned from the OUTPUT
-  // node.
-  //
-  // Returns 0 on success, otherwise failure.
-  hexagon_nn_execute_fn* hexagon_nn_execute;
-
-  // Newer version of hexagon_nn_execute that utilizes hexagon_nn_tensordefs to
-  // represent inputs & outputs. Executes a network with provided input tensors
-  // and returns output tensors. Execution will fail if the network has not
-  // been prepared.
-  //
-  // Returns 0 on success, otherwise failure.
-  hexagon_nn_execute_new_fn* hexagon_nn_execute_new;
-
-  // Tears down and frees an NN graph. This can be done at any time after
-  // hexagon_nn_init(). After this function has been invoked, the nn_id id is
-  // invalid.
-  //
-  // Returns 0 on success, otherwise failure.
-  hexagon_nn_teardown_fn* hexagon_nn_teardown;
-
-  hexagon_nn_snpprint_fn* hexagon_nn_snpprint;
-
-  hexagon_nn_getlog_fn* hexagon_nn_getlog;
-
-  hexagon_nn_get_perfinfo_fn* hexagon_nn_get_perfinfo;
-
-  hexagon_nn_reset_perfinfo_fn* hexagon_nn_reset_perfinfo;
-
-  hexagon_nn_op_id_to_name_fn* hexagon_nn_op_id_to_name;
-
-  // Should be called once to shutdown DSP and cleanup.
-  hexagon_nn_global_teardown_fn* hexagon_nn_global_teardown;
-
-  // Should be called once to initialize DSP.
-  hexagon_nn_global_init_fn* hexagon_nn_global_init;
-
-  // Returns true if the device SoC is supported by hexagon library. False
-  // Otherwise.
-  hexagon_nn_is_device_supported_fn* hexagon_nn_is_device_supported;
-
-  // Returns the version number of the interface library.
-  hexagon_nn_hexagon_interface_version_fn* hexagon_nn_hexagon_interface_version;
-
-  hexagon_nn_version_fn* hexagon_nn_version = nullptr;
-
-  bool interface_loaded = false;
-};
-
-// Returns an instance of HexagonNN.
-const HexagonNN* HexagonNNImplementation();
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_IMPLEMENTATION_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_nn/hexagon_nn.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_nn/hexagon_nn.h
deleted file mode 100644
index 2d7e37d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_nn/hexagon_nn.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* 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_HEXAGON_HEXAGON_NN_HEXAGON_NN_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_NN_HEXAGON_NN_H_
-
-#include "hexagon/hexagon_nn.h"
-#include "tensorflow/lite/delegates/hexagon/hexagon_nn/hexagon_nn_init.h"
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_NN_HEXAGON_NN_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_nn/hexagon_nn_init.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_nn/hexagon_nn_init.h
deleted file mode 100644
index 370f36f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_nn/hexagon_nn_init.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* 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_HEXAGON_HEXAGON_NN_HEXAGON_NN_INIT_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_NN_HEXAGON_NN_INIT_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-void hexagon_nn_global_teardown(void);
-void hexagon_nn_global_init(void);
-bool hexagon_nn_is_device_supported();
-int hexagon_nn_hexagon_interface_version(void);
-#ifdef __cplusplus
-}
-#endif
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_NN_HEXAGON_NN_INIT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_nn_interface.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_nn_interface.h
deleted file mode 100644
index 9942b9d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/hexagon_nn_interface.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* 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_HEXAGON_HEXAGON_NN_INTERFACE_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_NN_INTERFACE_H_
-
-#include "tensorflow/lite/delegates/hexagon/hexagon_nn/hexagon_nn.h"
-
-using hexagon_nn_config_fn = decltype(hexagon_nn_config);
-using hexagon_nn_init_fn = decltype(hexagon_nn_init);
-
-using hexagon_nn_set_powersave_level_fn =
-    decltype(hexagon_nn_set_powersave_level);
-
-using hexagon_nn_set_debug_level_fn = decltype(hexagon_nn_set_debug_level);
-
-using hexagon_nn_prepare_fn = decltype(hexagon_nn_prepare);
-
-using hexagon_nn_append_node_fn = decltype(hexagon_nn_append_node);
-
-using hexagon_nn_append_const_node_fn = decltype(hexagon_nn_append_const_node);
-
-using hexagon_nn_execute_fn = decltype(hexagon_nn_execute);
-
-using hexagon_nn_execute_new_fn = decltype(hexagon_nn_execute_new);
-
-using hexagon_nn_teardown_fn = decltype(hexagon_nn_teardown);
-
-using hexagon_nn_snpprint_fn = decltype(hexagon_nn_snpprint);
-
-using hexagon_nn_getlog_fn = decltype(hexagon_nn_getlog);
-
-using hexagon_nn_get_perfinfo_fn = decltype(hexagon_nn_get_perfinfo);
-
-using hexagon_nn_reset_perfinfo_fn = decltype(hexagon_nn_reset_perfinfo);
-
-using hexagon_nn_op_id_to_name_fn = decltype(hexagon_nn_op_id_to_name);
-
-using hexagon_nn_global_teardown_fn = decltype(hexagon_nn_global_teardown);
-
-using hexagon_nn_global_init_fn = decltype(hexagon_nn_global_init);
-
-using hexagon_nn_is_device_supported_fn =
-    decltype(hexagon_nn_is_device_supported);
-
-using hexagon_nn_version_fn = decltype(hexagon_nn_version);
-
-using hexagon_nn_hexagon_interface_version_fn =
-    decltype(hexagon_nn_hexagon_interface_version);
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_HEXAGON_NN_INTERFACE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/utils.h
deleted file mode 100644
index 54ef205..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/hexagon/utils.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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_HEXAGON_UTILS_H_
-#define TENSORFLOW_LITE_DELEGATES_HEXAGON_UTILS_H_
-
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-
-// Interpretes data from 'dims' as a 4D shape {batch, height, width, depth} and
-// populates the corresponding values. If dims->size < 4, the shape is prefixed
-// with 1s.
-// For example, dims {2, 3} is interpreted as: {1, 1, 2, 3}.
-// Returns kTfLiteError if dims->size > 4, kTfLiteOk otherwise.
-TfLiteStatus Get4DShape(unsigned int* batch_size, unsigned int* height_size,
-                        unsigned int* width_size, unsigned int* depth_size,
-                        TfLiteIntArray* dims);
-
-// Returns true if provided node is supported by Hexagon NNLib in the current
-// context.
-bool IsNodeSupportedByHexagon(const TfLiteRegistration* registration,
-                              const TfLiteNode* node, TfLiteContext* context);
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_HEXAGON_UTILS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/interpreter_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/interpreter_utils.h
deleted file mode 100644
index fa55046..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/interpreter_utils.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_INTERPRETER_UTILS_H_
-#define TENSORFLOW_LITE_DELEGATES_INTERPRETER_UTILS_H_
-
-#include "tensorflow/lite/interpreter.h"
-
-// Utility functions and classes for using delegates.
-
-namespace tflite {
-namespace delegates {
-class InterpreterUtils {
- public:
-  /// Invokes an interpreter with automatic fallback from delegation to CPU.
-  ///
-  /// If using the delegate fails, the delegate is automatically undone and an
-  /// attempt made to return the interpreter to an invokable state.
-  ///
-  /// Allowing the fallback is suitable only if both of the following hold:
-  /// - The caller is known not to cache pointers to tensor data across Invoke()
-  ///   calls.
-  /// - The model is not stateful (no variables, no LSTMs) or the state isn't
-  ///   needed between batches.
-  ///
-  /// Returns one of the following three status codes:
-  /// 1. kTfLiteOk: Success. Output is valid.
-  /// 2. kTfLiteDelegateError: Delegate error but fallback succeeded. Output is
-  /// valid.
-  /// NOTE: This undoes all delegates previously applied to the Interpreter.
-  /// 3. kTfLiteError: Unexpected/runtime failure. Output is invalid.
-  /// WARNING: This is an experimental API and subject to change.
-  static TfLiteStatus InvokeWithCPUFallback(Interpreter* interpreter);
-};
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_INTERPRETER_UTILS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/acceleration_test_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/acceleration_test_util.h
deleted file mode 100644
index 042cb41..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/acceleration_test_util.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* 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_NNAPI_ACCELERATION_TEST_UTIL_H_
-#define TENSORFLOW_LITE_DELEGATES_NNAPI_ACCELERATION_TEST_UTIL_H_
-
-#include 
-#include "absl/types/optional.h"
-#include "tensorflow/lite/delegates/nnapi/nnapi_delegate_kernel.h"
-
-namespace tflite {
-
-// NNAPI specific configuration for the validation allowlist.
-class NnapiAccelerationTestParams {
- public:
-  // Content in nnapi_acceleration_test_list.cc.
-  static const char* const kAccelerationTestConfig;
-
-  static NnapiAccelerationTestParams ParseConfigurationLine(
-      const std::string& conf_line);
-
-  explicit NnapiAccelerationTestParams(int min_android_sdk_version)
-      : min_android_sdk_version_{min_android_sdk_version} {};
-
-  NnapiAccelerationTestParams()
-      : min_android_sdk_version_{delegate::nnapi::kMinSdkVersionForNNAPI} {};
-
-  // Minimum SDK version to apply the acceleration validation to.
-  int MinAndroidSdkVersion() { return min_android_sdk_version_; }
-
- private:
-  int min_android_sdk_version_;
-};
-
-// Returns the NNAPI acceleration test configuration for the given test id.
-absl::optional GetNnapiAccelerationTestParam(
-    std::string test_id);
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_NNAPI_ACCELERATION_TEST_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/nnapi_delegate.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/nnapi_delegate.h
deleted file mode 100644
index bd4165d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/nnapi_delegate.h
+++ /dev/null
@@ -1,323 +0,0 @@
-/* Copyright 2017 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_NNAPI_NNAPI_DELEGATE_H_
-#define TENSORFLOW_LITE_DELEGATES_NNAPI_NNAPI_DELEGATE_H_
-
-#include 
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/nnapi/NeuralNetworksTypes.h"
-#include "tensorflow/lite/nnapi/nnapi_implementation.h"
-
-typedef struct ANeuralNetworksMemory ANeuralNetworksMemory;
-
-namespace tflite {
-
-namespace delegate {
-namespace nnapi {
-class NNAPIDelegateKernel;
-}  // namespace nnapi
-}  // namespace delegate
-
-using tflite::delegate::nnapi::NNAPIDelegateKernel;
-
-// TFliteDelegate to interface with NNAPI.
-class StatefulNnApiDelegate : public TfLiteDelegate {
- public:
-  // Encapsulates all options that are specific to NNAPI delegate.
-  struct Options {
-    // Preferred Power/perf trade-off. For more details please see
-    // ANeuralNetworksCompilation_setPreference documentation in :
-    // https://developer.android.com/ndk/reference/group/neural-networks.html
-    enum ExecutionPreference {
-      kUndefined = -1,
-      kLowPower = 0,
-      kFastSingleAnswer = 1,
-      kSustainedSpeed = 2,
-    };
-
-    // Preferred Power/perf trade-off.
-    ExecutionPreference execution_preference = kUndefined;
-
-    // Selected NNAPI accelerator with nul-terminated name.
-    // Default to nullptr, which implies the NNAPI default behavior: NNAPI
-    // runtime is allowed to use all available accelerators. If the selected
-    // accelerator cannot be found, NNAPI will not be used.
-    // It is the caller's responsibility to ensure the string is valid for the
-    // duration of the Options object lifetime.
-    const char* accelerator_name = nullptr;
-
-    // The nul-terminated cache dir for NNAPI model.
-    // Default to nullptr, which implies the NNAPI will not try caching the
-    // compilation.
-    const char* cache_dir = nullptr;
-
-    // The unique nul-terminated token string for NNAPI model.
-    // Default to nullptr, which implies the NNAPI will not try caching the
-    // compilation. It is the caller's responsibility to ensure there is no
-    // clash of the tokens.
-    // NOTE: when using compilation caching, it is not recommended to use the
-    // same delegate instance for multiple models.
-    const char* model_token = nullptr;
-
-    // Whether to disallow NNAPI CPU usage. Only effective on Android 10 and
-    // above. The NNAPI CPU typically performs less well than built-in TfLite
-    // kernels, but allowing CPU allows partial acceleration of models. If this
-    // is set to true, NNAPI is only used if the whole model is accelerated.
-    bool disallow_nnapi_cpu = false;
-
-    // Specifies the max number of partitions to delegate. A value <= 0 means
-    // no limit.
-    // If the delegation of the full set of supported nodes would generate a
-    // number of partition greater than this parameter, only
-    //  of them will be actually accelerated.
-    // The selection is currently done sorting partitions in decreasing order
-    // of number of nodes and selecting them until the limit is reached.
-    int max_number_delegated_partitions = 3;
-
-    // allow fp32 compuation to be run in fp16.
-    bool allow_fp16 = false;
-
-    // Specifies the relative priority for executions of the model.
-    // Available values are {ANEURALNETWORKS_PRIORITY_LOW,
-    // ANEURALNETWORKS_PRIORITY_MEDIUM, ANEURALNETWORKS_PRIORITY_HIGH,
-    // ANEURALNETWORKS_PRIORITY_DEFAULT}.
-    int execution_priority = ANEURALNETWORKS_PRIORITY_DEFAULT;
-
-    // Specifies the maximum expected duration in nanosecond for compiling the
-    // model. If the device is not able to complete the compilation within the
-    // specified duration, the compilation may be aborted. If set to 0, the
-    // timeout duration is considered infinite.
-    uint64_t max_compilation_timeout_duration_ns = 0;
-
-    // Specifies the maximum expected duration in nanosecond for executing the
-    // model. If the device is not able to complete the execution within the
-    // specified duration, the execution may be aborted. If set to 0, the
-    // timeout duration is considered infinite.
-    uint64_t max_execution_timeout_duration_ns = 0;
-
-    // Specifies the maximum expected duration in nanosecond for WHILE loops in
-    // the execution. If a WHILE loop condition model does not output false
-    // within the specified duration, the execution will be aborted. If set to
-    // 0, the default timeout for loops will be used.
-    uint64_t max_execution_loop_timeout_duration_ns = 0;
-
-    // Whether to allow dynamic dimension sizes without re-compilation.
-    // A tensor of with dynamic dimension must have a valid dim_signature
-    // defined.
-    // Only supported in NNAPI 1.1 and newer versions.
-    // WARNING: Setting this flag to true may result in model being rejected by
-    // accelerator. This should only be enabled if the target device supports
-    // dynamic dimensions of the model.
-    bool allow_dynamic_dimensions = false;
-  };
-
-  // Uses default options.
-  StatefulNnApiDelegate();
-
-  explicit StatefulNnApiDelegate(const NnApi* nnapi);
-
-  // The constructor that accepts options from user.
-  explicit StatefulNnApiDelegate(Options options);
-
-  StatefulNnApiDelegate(const NnApi* nnapi, Options options);
-
-  ~StatefulNnApiDelegate() = default;
-
-  // Returns the delegate options.
-  static const Options GetOptions(TfLiteDelegate* delegate);
-
-  // Callback function which copies data from ANeuralNetworksMemory to host
-  // tensor CPU buffer. It is the users responsibility to implement these
-  // callbacks for the specific types of shared memory they intend to use.
-  // WARNING: This is an experimental interface that is subject to change.
-  typedef TfLiteStatus (*CopyToHostTensorFnPtr)(TfLiteTensor* tensor,
-                                                ANeuralNetworksMemory* memory,
-                                                size_t memory_offset,
-                                                size_t byte_size,
-                                                void* callback_context);
-
-  // Encapsulates all fields related to memory registration for internal
-  // bookkeeping only.
-  struct MemoryRegistration {
-    ANeuralNetworksMemory* memory;
-    CopyToHostTensorFnPtr callback;
-    void* callback_context;
-  };
-
-  // Register the ANeuralNetworksMemory handle with the delegate. A
-  // TfLiteBufferHandle will be returned to be used with
-  // Interpreter::SetBufferHandle. The callback_context will be passed to the
-  // callback function when invoked.
-  // Note: the returned TfLiteBufferHandle can only be used with a single
-  // Interpreter instance. However, the caller can register the same memory
-  // multiple times to get different handles to use with difference Interpreter
-  // instances
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteBufferHandle RegisterNnapiMemory(ANeuralNetworksMemory* memory,
-                                         CopyToHostTensorFnPtr callback,
-                                         void* callback_context);
-
-  // Returns the vector of known ANeuralNetworksMemory handles.
-  // Note: this function is not intended to be called by developers.
-  // WARNING: This is an experimental interface that is subject to change.
-  static const std::vector& GetTensorMemoryMap(
-      TfLiteDelegate* delegate);
-
-  // Returns the int value of the ResultCode returned by the latest
-  // failed call to NNAPI, if any. Zero only in case of NO failed calls since
-  // the construction of this instance of StatefulNnApiDelegate.
-  // The error code is reset when the delegate is re-initialized
-  // (i.e. when calling interpreter.ModifyGraphWithDelegate(delegate)).
-  int GetNnApiErrno() const;
-
- private:
-  // Encapsulates all delegate data.
-  struct Data {
-    // Pointer to NNAPI implementation to be used by this delegate as
-    // set when building the StatefulNnApiDelegate instance.
-    // Will generally be the NnApiInstance() singleton but can be overridden
-    // for testing or for users needing to wrap or stub parts of NNAPI.
-    // The ownership of the nnapi instance is left to the caller of
-    // the StatefulNnApiDelegate constructor.
-    const NnApi* nnapi;
-    // Preferred Power/perf trade-off.
-    Options::ExecutionPreference execution_preference;
-    // Selected NNAPI accelerator name.
-    std::string accelerator_name;
-    // The cache dir for NNAPI model.
-    std::string cache_dir;
-    // The unique token string for NNAPI model.
-    std::string model_token;
-    // Whether to disallow NNAPI CPU.
-    bool disallow_nnapi_cpu;
-    // Tensor to ANeuralNetworksMemory mapping.
-    std::vector tensor_memory_map;
-    // Contains a non zero value if any NNAPI method call
-    // operation returned a non zero result code.
-    int nnapi_errno = ANEURALNETWORKS_NO_ERROR;
-    // Cache of kernels already built in StatefulNnApiDelegate::DoPrepare
-    // when trying to understand if all nodes are supported by the target
-    // accelerators.
-    // The key is the index of the first node in the partition.
-    // Couldn't use unique_ptr because of problems building on gcc
-    std::unordered_map delegate_state_cache;
-    // Maximum number of NNAPI partition to delegate. Zero or negative means
-    // no limit. Copied from StatefulNnApiDelegate::Options
-    int max_number_delegated_partitions;
-    // allow fp32 computation to be run in fp16.
-    bool allow_fp16;
-    // Specifies the relative priority for executions of the model.
-    int execution_priority = ANEURALNETWORKS_PRIORITY_DEFAULT;
-    // Specifies the maximum expected duration in nanosecond for compiling the
-    // model.
-    uint64_t max_compilation_timeout_duration_ns = 0;
-    // Specifies the maximum expected duration in nanosecond for executing the
-    // model.
-    uint64_t max_execution_timeout_duration_ns = 0;
-    // Specifies the maximum expected duration in nanosecond for WHILE loops in
-    // the execution
-    uint64_t max_execution_loop_timeout_duration_ns = 0;
-    // Whether to allow dynamic dimension sizes without re-compilation.
-    bool allow_dynamic_dimensions = false;
-
-    explicit Data(const NnApi* nnapi);
-    ~Data();
-
-    // Caches an initialised NNAPIDelegateKernel.
-    void CacheDelegateKernel(const TfLiteDelegateParams* delegate_params,
-                             NNAPIDelegateKernel* delegate_state);
-    // Returns a cached NNAPIDelegateKernel if available and removes it
-    // from the cache transferring the ownership to the caller.
-    NNAPIDelegateKernel* MaybeGetCachedDelegateKernel(
-        const TfLiteDelegateParams* delegate_params);
-  };
-
-  // Implements TfLiteDelegate::Prepare. Please refer to TFLiteDelegate
-  // documentation for more info.
-  static TfLiteStatus DoPrepare(TfLiteContext* context,
-                                TfLiteDelegate* delegate);
-
-  // Copy the data from delegate buffer handle into raw memory of the given
-  // 'tensor'. The delegate is allowed to allocate the raw
-  // bytes as long as it follows the rules for kTfLiteDynamic tensors.
-  static TfLiteStatus DoCopyFromBufferHandle(TfLiteContext* context,
-                                             TfLiteDelegate* delegate,
-                                             TfLiteBufferHandle buffer_handle,
-                                             TfLiteTensor* tensor);
-
-  // Copy the data from raw memory of the given 'tensor' to delegate buffer
-  // handle. Currently this function is not supported, and calling the function
-  // will result in an error.
-  static TfLiteStatus DoCopyToBufferHandle(TfLiteContext* context,
-                                           TfLiteDelegate* delegate,
-                                           TfLiteBufferHandle buffer_handle,
-                                           TfLiteTensor* tensor);
-
-  // Free the Delegate Buffer Handle. Note: This only frees the handle, but
-  // this doesn't release the underlying resource (e.g. textures). The
-  // resources are either owned by application layer or the delegate.
-  static void DoFreeBufferHandle(TfLiteContext* context,
-                                 TfLiteDelegate* delegate,
-                                 TfLiteBufferHandle* handle);
-
-  // Returns the nodes that can be delegated via NNAPI to the accelerator
-  // specified in the delegate options and information about the way the
-  // graph will be partitioned if the supported nodes will be delegated.
-  // Partition information is composed by the number of partitions and
-  // the delegate parameters associated to each partition.
-  // The method also caches in delegate->data the NNApiDelegateKernel instances
-  // that have been created during the device evaluation.
-  // All arguments are expected to be non-null.
-  static TfLiteStatus GetNodesSupportedByAccelerator(
-      TfLiteContext* context, TfLiteDelegate* delegate, const NnApi* nnapi,
-      const std::vector& supported_nodes,
-      std::vector* device_supported_nodes, int* num_partitions,
-      TfLiteDelegateParams** params_array, int* nnapi_errno);
-
-  // Alters the given array of nodes_to_delegate to limit the number of NNAPI
-  // owned partition to be less or equal than num_partitions. If num_partitions
-  // is less or equal to zero the input is left unaltered.
-  // The nodes_to_delegate array is expected to contain at element 0 the number
-  // of nodes to delegate and in remaining elements the set of nodes
-  // that would be delegated to NNAPI if this function wouldn't be
-  // called. It will be altered storing in the first element the count of
-  // nodes to actually delegate and in the remainder of the array the indexes.
-  // The params_array params might be altered during the functions execution.
-  static TfLiteStatus LimitDelegatedPartitions(
-      int max_partitions,
-      std::vector partition_params_array,
-      std::vector* nodes_to_delegate);
-
-  // Delegate data presented through TfLiteDelegate::data_.
-  Data delegate_data_;
-};
-
-// DEPRECATED: Please use StatefulNnApiDelegate class instead.
-//
-// Returns a singleton delegate that can be used to use the NN API.
-// e.g.
-//   NnApiDelegate* delegate = NnApiDelegate();
-//   interpreter->ModifyGraphWithDelegate(&delegate);
-// NnApiDelegate() returns a singleton, so you should not free this
-// pointer or worry about its lifetime.
-TfLiteDelegate* NnApiDelegate();
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_NNAPI_NNAPI_DELEGATE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/nnapi_delegate_kernel.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/nnapi_delegate_kernel.h
deleted file mode 100644
index 36c1dd3..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/nnapi_delegate_kernel.h
+++ /dev/null
@@ -1,371 +0,0 @@
-/* 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_NNAPI_NNAPI_DELEGATE_KERNEL_H_
-#define TENSORFLOW_LITE_DELEGATES_NNAPI_NNAPI_DELEGATE_KERNEL_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/allocation.h"
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/delegates/nnapi/nnapi_delegate.h"
-#include "tensorflow/lite/nnapi/nnapi_implementation.h"
-
-namespace tflite {
-namespace delegate {
-namespace nnapi {
-
-constexpr int32_t kMinSdkVersionForNNAPI = 27;
-constexpr int32_t kMinSdkVersionForNNAPI11 = 28;
-constexpr int32_t kMinSdkVersionForNNAPI12 = 29;
-constexpr int32_t kMinSdkVersionForNNAPI13 = 30;
-
-// Track tensor indices to NN API tensor indices mapping.
-class OperandMapping {
- public:
-  // Given a TFLite index return the ANN index. If it doesn't exist
-  // return -1.
-  int lite_index_to_ann(int index) const {
-    const int64_t max_size = lite_tensor_to_ann_tensor_.size();
-    if (index >= 0 && index < max_size)
-      return lite_tensor_to_ann_tensor_[index];
-    else
-      return -1;
-  }
-
-  // NN API uses non tensor operands instead of structs. This creates one
-  // and returns the index. It uses a std::vector and resizes it as needed
-  // keeping -1 to unmapped values. Intermediate tensors likely will not
-  // be mapped.
-  int add_new_non_tensor_operand() { return next_ann_tensor_index_++; }
-
-  // This call is necessary for input operands generated by the delegate
-  // to map constant inputs not present in TFLite but required by NNAPI,
-  // for example when splitting one input in several ones.
-  int add_delegate_generated_input_ann_tensors_operand() {
-    return next_ann_tensor_index_++;
-  }
-
-  // Add a new mapping from `tflite_index` and return the NN API tensor index.
-  int add_new_ann_tensor_index(int tflite_index) {
-    const int64_t current_size = lite_tensor_to_ann_tensor_.size();
-    if (tflite_index >= current_size) {
-      lite_tensor_to_ann_tensor_.resize(tflite_index + 1, -1);
-    }
-    const int new_tensor_index = next_ann_tensor_index_++;
-    lite_tensor_to_ann_tensor_[tflite_index] = new_tensor_index;
-    return new_tensor_index;
-  }
-
-  // Given a TFLite index returns a TFLite type to which a tensor must be
-  // converted during copying the data to the memory allocated for NN API.
-  // kTfLiteNoType means no conversion is needed.
-  TfLiteType lite_index_to_ann_type_conversion(int index) const {
-    const int64_t max_size = index_to_type_conversion_.size();
-    if (index >= 0 && index < max_size)
-      return index_to_type_conversion_[index];
-    else
-      return kTfLiteNoType;
-  }
-
-  // Add a new mapping from TFLite index to a type conversion.
-  void add_type_conversion(int tflite_index, TfLiteType tflite_type) {
-    const int64_t current_size = index_to_type_conversion_.size();
-    if (tflite_index >= current_size) {
-      index_to_type_conversion_.resize(tflite_index + 1, kTfLiteNoType);
-    }
-    index_to_type_conversion_[tflite_index] = tflite_type;
-  }
-
- private:
-  // Next index of ann tensor
-  int next_ann_tensor_index_ = 0;
-
-  // Mapping from lite index. Use a std::vector for speed and code size
-  // rather than a map.
-  std::vector lite_tensor_to_ann_tensor_;
-  // Mapping from lite index to a type which tensor must be converted to during
-  // the copying of the data to the memory allocated for NN API. kTfLiteNoType
-  // means no conversion is needed. Use an std::vector for speed and code size
-  // rather than a map.
-  std::vector index_to_type_conversion_;
-};
-
-class NNAPIOpBuilder;
-
-// The kernel that represents the node sub set of TF Lite being run on NN API.
-struct NNAPIOpMappingArgs {
-  TfLiteContext* context;
-  NNAPIOpBuilder* builder;
-  TfLiteNode* node;
-  int node_index;
-  std::vector* model_state_outputs;
-  std::vector* model_state_tfl_inputs;
-  std::vector>* feedback_loops;
-  int* nnapi_errno;
-};
-
-// RAII NN API Model Destructor for use with std::unique_ptr
-class NNFreeModel {
- public:
-  explicit NNFreeModel(const NnApi* nnapi) : nnapi_(nnapi) {}
-  void operator()(ANeuralNetworksModel* model) {
-    nnapi_->ANeuralNetworksModel_free(model);
-  }
-
- private:
-  // NnApi instance to use. Not owned by this object.
-  const NnApi* nnapi_;
-};
-// RAII NN API Compilation Destructor for use with std::unique_ptr
-class NNFreeCompilation {
- public:
-  explicit NNFreeCompilation(const NnApi* nnapi) : nnapi_(nnapi) {}
-  void operator()(ANeuralNetworksCompilation* model) {
-    nnapi_->ANeuralNetworksCompilation_free(model);
-  }
-
- private:
-  // NnApi instance to use. Not owned by this object.
-  const NnApi* nnapi_;
-};
-// RAII NN API Execution Destructor for use with std::unique_ptr
-class NNFreeExecution {
- public:
-  explicit NNFreeExecution(const NnApi* nnapi) : nnapi_(nnapi) {}
-  void operator()(ANeuralNetworksExecution* execution) {
-    nnapi_->ANeuralNetworksExecution_free(execution);
-  }
-
- private:
-  // NnApi instance to use. Not owned by this object.
-  const NnApi* nnapi_;
-};
-
-// Manage NNAPI shared memory handle
-class NNMemory {
- public:
-  NNMemory(const NnApi* nnapi, const char* name, size_t size);
-
-  ~NNMemory();
-
-  ANeuralNetworksMemory* get_handle() { return nn_memory_handle_; }
-  uint8_t* get_data_ptr() { return data_ptr_; }
-  size_t get_byte_size() { return byte_size_; }
-
- private:
-  // NnApi instance to use. Not owned by this object.
-  const NnApi* nnapi_;
-  int fd_ = 0;
-  size_t byte_size_ = 0;
-  uint8_t* data_ptr_ = nullptr;
-  ANeuralNetworksMemory* nn_memory_handle_ = nullptr;
-};
-
-
-enum class NNAPIValidationFailureType : int {
-  // The operator is not supported by either NNAPI or the NNAPI Delegate.
-  kUnsupportedOperator = 0,
-  // The given operation or operands are not supported on the specified
-  // Android SDK version. The min supported version is specified in the
-  // validation failure message.
-  kUnsupportedAndroidVersion = 1,
-  // The version of the operator (value of TfLiteRegistration::version)
-  // for the given op is not supported. The max supported version
-  // is specified in the validation failure message.
-  // For more details on each operator version see
-  // the GetBuiltinOperatorVersion function in
-  // third_party/tensorflow/lite/tools/versioning/op_version.cc.
-  kUnsupportedOperatorVersion = 2,
-  // The given input operand type is not supported for the current combination
-  // of operator type and sdk version.
-  kUnsupportedInputType = 3,
-  // When using NN API version 1.0 or 1.1, the condition
-  //   input_scale * filter_scale < output_scale
-  // must be true for quantized versions of the following ops:
-  // * CONV_2D
-  // * DEPTHWISE_CONV_2D
-  // * FULLY_CONNECTED (where filter actually stands for weights)
-  // The condition is relaxed and no longer required since version 1.2.
-  kNotRestrictedScaleCompliant = 4,
-  // The given output operand type is not supported for the current combination
-  // of operator type and sdk version.
-  kUnsupportedOutputType = 5,
-  // The size of the operand tensor is too large.
-  kUnsupportedOperandSize = 6,
-  // The value of one of the operands or of a combination of operands is
-  // not supported. Details are provided in the failure message.
-  kUnsupportedOperandValue = 7,
-  // The combination of float inputs and quantized weights or filters
-  // is not supported
-  kUnsupportedHybridOperator = 8,
-  // The quantization type (for example per-channel quantization) is not
-  // supported.
-  kUnsupportedQuantizationType = 9,
-  // The accelerated version of operation requires a specific operand to be
-  // specified.
-  kMissingRequiredOperand = 10,
-  // The rank of the operand is not supported. Details in the failure message.
-  kUnsupportedOperandRank = 11,
-  // The input tensor cannot be dynamically-sized.
-  kInputTensorShouldHaveConstantShape = 12,
-  // The operator has a different number of inputs of the one or ones that
-  // are supported by NNAPI.
-  kUnsupportedOperatorVariant = 13,
-  // The accelerated version of the operator cannot specify an activation
-  // function.
-  kNoActivationExpected = 14,
-  // Quantization scale and/or zero point are not in the supported value(s)
-  // for the accelerated operation.
-  kUnsupportedQuantizationParameters = 15,
-};
-
-
-struct NNAPIValidationFailure {
-  NNAPIValidationFailureType type;
-  std::string message;
-
-  NNAPIValidationFailure(NNAPIValidationFailureType type, const char* message)
-      : type(type), message(message) {}
-};
-
-// The kernel that represents the node sub set of TF Lite being run on NN API.
-class NNAPIDelegateKernel {
- public:
-  explicit NNAPIDelegateKernel(const NnApi* nnapi)
-      : initialised_(false),
-        nnapi_(nnapi),
-        nn_model_(nullptr, NNFreeModel(nnapi_)),
-        nn_compilation_(nullptr, NNFreeCompilation(nnapi_)) {}
-  NNAPIDelegateKernel() : NNAPIDelegateKernel(NnApiImplementation()) {}
-  ~NNAPIDelegateKernel() {
-    for (auto content : allocation_memory_mapping_) {
-      nnapi_->ANeuralNetworksMemory_free(content.second);
-    }
-  }
-
-  // Translate a node into its operands
-  // It assumes that the call to Validate for has been successful for
-  // the operation.
-  // In case of success it returns kTfLiteOk and stores in n_op_type the
-  // NNAPI Operation code.
-  // Returns kTfLiteError in case of failures during mapping.
-  static TfLiteStatus Map(TfLiteContext* context, int builtin_code, int version,
-                          int android_sdk_version,
-                          const NNAPIOpMappingArgs& mapping_args,
-                          ANeuralNetworksOperationType* nn_op_type);
-
-  // Returns true if the node can be accelerated with NNAPI.
-  static bool Validate(
-      const TfLiteContext* context, int builtin_code, int version,
-      int android_sdk_version, const TfLiteNode* node,
-      bool is_accelerator_specified,
-      // Collects lists of failures collected during
-      // the validation of the possibility of accelerating
-      // the given node
-      std::vector* map_failures = nullptr);
-
-  // Initialize the kernel (a NN model) and builds the NN Model.
-  // Any NNAPI Related error causing this method to fail will have the
-  // associated error number stored in nnapi_errno
-  TfLiteStatus Init(TfLiteContext* context, const TfLiteDelegateParams* params,
-                    int* nnapi_errno);
-
-  // Creates the NNAPI Compilation for the NN model. It assumes that Init has
-  // been called and completed successfully.
-  // Any NNAPI Related error causing this method to fail will have the
-  // associated error number stored in nnapi_errno
-  TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node,
-                       int* nnapi_errno);
-
-  // Invoke the NN Model. Expects Init and Prepare to have been completed
-  // successfully.
-  // Any NNAPI Related error causing this method to fail will have the
-  // associated error number stored in nnapi_errno
-  TfLiteStatus Invoke(TfLiteContext* context, TfLiteNode* node,
-                      int* nnapi_errno);
-
-  // Returns the list of operations supported by the current NNAPI model as
-  // built in Prepare. Every operation is identified by the index as provided
-  // in the delegate parameters given to the delegate during the Init call.
-  // It expects the Init method has been called and completed successfully and
-  // returns kTfLiteError if not. Returns an error if any of the NNAPI
-  // operations fails or if the
-  // ANeuralNetworksModel_getSupportedOperationsForDevices function is not
-  // available in the NnApi object.
-  TfLiteStatus GetOperationsSupportedByTargetNnApiDevices(
-      TfLiteContext* context, std::vector* supported_nodes,
-      int* nnapi_errno);
-
- private:
-  // True if initialization has been completed successfully
-  bool initialised_;
-  // Access to NNApi.
-  const NnApi* nnapi_;
-  // ANN device handle.
-  std::vector nnapi_devices_;
-  // Name of the nnapi device, empty if nnapi_devices_ is empty;
-  std::string device_name_;
-  // ANN API state.
-  std::unique_ptr nn_model_;
-  std::unique_ptr
-      nn_compilation_;
-  // Node indices that this delegate is responsible for. Indices here
-  // indexes into the nodes array in the TfLiteContext.
-  std::vector nodes_;
-  // Track indices we use
-  OperandMapping operand_mapping_;
-  std::map
-      allocation_memory_mapping_;
-  // Track memory map
-  const std::vector*
-      tensor_memory_map_;
-  std::vector model_state_outputs_;
-  std::vector model_state_tfl_inputs_;
-  // This is the equivalent of the pair model_state_outputs_,
-  // model_state_tfl_inputs_ for all tensors where we have to keep the output
-  // data available for TFLite model users
-  std::vector> feedback_loops_;
-
-  std::unique_ptr nn_input_memory_;
-  std::unique_ptr nn_output_memory_;
-
-  std::vector nn_compilation_cache_token_;
-
-  std::vector nnapi_to_tflite_op_mapping_;
-
-  // Fully initialized in NNAPIDelegateKernel::AddOpsAndTensors
-  int target_sdk_version_ = 27;  // kMinSdkVersionForNNAPI13
-
-  void AddDequantizeOperatorsWhereNeeded(
-      const TfLiteContext* context, int builtin_code, const TfLiteNode* node,
-      int tflite_node_index, NNAPIOpBuilder* builder, int* nnapi_errno);
-
-  TfLiteStatus AddOpsAndTensors(TfLiteContext* context, int* nnapi_errno,
-                                bool allow_dynamic_dimensions);
-
-  TfLiteStatus BuildGraph(TfLiteContext* context,
-                          const StatefulNnApiDelegate::Options& options,
-                          const TfLiteIntArray* input_tensors,
-                          const TfLiteIntArray* output_tensors,
-                          int* nnapi_errno);
-};
-
-}  // namespace nnapi
-}  // namespace delegate
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_NNAPI_NNAPI_DELEGATE_KERNEL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/nnapi_delegate_mock_test.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/nnapi_delegate_mock_test.h
deleted file mode 100644
index 5dbe411..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/nnapi_delegate_mock_test.h
+++ /dev/null
@@ -1,101 +0,0 @@
-/* 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_NNAPI_NNAPI_DELEGATE_MOCK_TEST_H_
-#define TENSORFLOW_LITE_DELEGATES_NNAPI_NNAPI_DELEGATE_MOCK_TEST_H_
-
-// Cannot mock the delegate when using the disabled version
-// (see the condition in the BUILD file).
-#ifndef NNAPI_DELEGATE_DISABLED
-
-#include 
-#include 
-#include 
-
-#include 
-
-#include 
-#include "absl/memory/memory.h"
-#include "tensorflow/lite/delegates/nnapi/nnapi_delegate.h"
-#include "tensorflow/lite/nnapi/NeuralNetworksTypes.h"
-#include "tensorflow/lite/nnapi/nnapi_handler.h"
-#include "tensorflow/lite/nnapi/nnapi_implementation.h"
-
-namespace tflite {
-namespace delegate {
-namespace nnapi {
-
-class NnApiMock : public ::tflite::nnapi::NnApiHandler {
- public:
-  explicit NnApiMock(NnApi* nnapi, int android_sdk_version = 29)
-      : ::tflite::nnapi::NnApiHandler(nnapi) {
-    nnapi_->nnapi_exists = true;
-    nnapi_->android_sdk_version = android_sdk_version;
-
-    nnapi_->ANeuralNetworksCompilation_free =
-        [](ANeuralNetworksCompilation* compilation) {};
-    nnapi_->ANeuralNetworksMemory_free = [](ANeuralNetworksMemory* memory) {};
-    nnapi_->ANeuralNetworksModel_free = [](ANeuralNetworksModel* model) {};
-    nnapi_->ANeuralNetworksExecution_free =
-        [](ANeuralNetworksExecution* execution) {};
-    nnapi_->ASharedMemory_create = [](const char* name, size_t size) -> int {
-      return open("/dev/zero", O_RDWR);
-    };
-    nnapi_->ANeuralNetworksEvent_free = [](ANeuralNetworksEvent* event) {};
-
-    ModelCreateReturns();
-    AddOperandReturns();
-    SetOperandValueReturns();
-    AddOperationReturns();
-    IdentifyInputAndOutputsReturns();
-    RelaxComputationFloatReturns();
-    ModelFinishReturns();
-    MemoryCreateFromFdReturns();
-    CompilationCreateReturns();
-    CompilationCreateForDevicesReturns();
-    CompilationFinishReturns();
-    ExecutionCreateReturns();
-    ExecutionSetInputFromMemoryReturns();
-    ExecutionSetOutputFromMemoryReturns();
-    ExecutionComputeReturns();
-    ExecutionStartComputeReturns();
-    EventWaitReturns();
-    SetPriorityReturns();
-    SetOperandSymmPerChannelQuantParamsReturns();
-    SetNnapiSupportedDevice("test-device", android_sdk_version);
-  }
-
-  ~NnApiMock() { Reset(); }
-};
-
-class NnApiDelegateMockTest : public ::testing::Test {
- protected:
-  void SetUp() override {
-    nnapi_ = *NnApiImplementation();
-    nnapi_mock_ = absl::make_unique(&nnapi_);
-  }
-
-  std::unique_ptr nnapi_mock_;
-
- private:
-  NnApi nnapi_;
-};
-
-}  // namespace nnapi
-}  // namespace delegate
-}  // namespace tflite
-
-#endif  // #ifndef NNAPI_DELEGATE_DISABLED
-
-#endif  // TENSORFLOW_LITE_DELEGATES_NNAPI_NNAPI_DELEGATE_MOCK_TEST_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/quant_lstm_sup.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/quant_lstm_sup.h
deleted file mode 100644
index 0b3a234..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/nnapi/quant_lstm_sup.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* 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_NNAPI_QUANT_LSTM_SUP_H_
-#define TENSORFLOW_LITE_DELEGATES_NNAPI_QUANT_LSTM_SUP_H_
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-namespace delegate {
-namespace nnapi {
-
-void ExtractQuantLstmWeightsSubmatrix(const TfLiteIntArray* submatrix_dims,
-                                      const int32_t offset_row,
-                                      const int32_t offset_column,
-                                      const TfLiteIntArray* weight_dims,
-                                      const uint8_t* weights,
-                                      std::vector* submatrix);
-
-void DecomposeQuantLstmWeightsTensor(const uint8_t* concat_weights,
-                                     const TfLiteIntArray* weight_dims,
-                                     std::vector* recurrent_to_input,
-                                     std::vector* input_to_input,
-                                     std::vector* recurrent_to_cell,
-                                     std::vector* input_to_cell,
-                                     std::vector* recurrent_to_forget,
-                                     std::vector* input_to_forget,
-                                     std::vector* recurrent_to_output,
-                                     std::vector* input_to_output);
-
-void SetWeightSubmatrixDims(const TfLiteIntArray* weight_dims,
-                            TfLiteIntArray* recurrent_submatrix_dims,
-                            TfLiteIntArray* input_submatrix_dims);
-
-void DecomposeBiasTensor(const int32_t* biases, int bias_size,
-                         std::vector* input_bias,
-                         std::vector* cell_bias,
-                         std::vector* forget_bias,
-                         std::vector* output_bias);
-
-}  // namespace nnapi
-}  // namespace delegate
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_NNAPI_QUANT_LSTM_SUP_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/status.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/status.h
deleted file mode 100644
index e56bf7c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/status.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_DELEGATES_STATUS_H_
-#define TENSORFLOW_LITE_DELEGATES_STATUS_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/c/common.h"
-
-// This file defines data structures to represent detailed TFLite delegate
-// status, e.g. NNAPI delegate application failure because of a driver issue
-// etc. Such status is ONLY to be used for internal APIs.
-// Note, we simply use TfLiteStatus to represent high-level status while
-// delegate-specific status codes are defined with DelegateStatus.
-// WARNING: This is an experimental feature that is subject to change.
-namespace tflite {
-namespace delegates {
-
-// Defines the source of the code where it is generated from. We list all TFLite
-// delegates that're officially implemented and available as of April, 2020
-// (i.e. w/ 'TFLITE_' prefix to imply this).
-enum class DelegateStatusSource {
-  NONE = 0,
-  TFLITE_GPU = 1,
-  TFLITE_NNAPI = 2,
-  TFLITE_HEXAGON = 3,
-  TFLITE_XNNPACK = 4,
-  TFLITE_COREML = 5,
-  MAX_NUM_SOURCES = std::numeric_limits::max(),
-};
-
-// Defines the detailed status that combines a DelegateStatusSource and a
-// status int32_t code.
-class DelegateStatus {
- public:
-  DelegateStatus() : DelegateStatus(DelegateStatusSource::NONE, 0) {}
-  explicit DelegateStatus(int32_t code)
-      : DelegateStatus(DelegateStatusSource::NONE, code) {}
-  explicit DelegateStatus(int64_t full_status)
-      : DelegateStatus(
-            static_cast(
-                full_status >> 32 &
-                static_cast(DelegateStatusSource::MAX_NUM_SOURCES)),
-            static_cast(full_status &
-                                 std::numeric_limits::max())) {}
-  DelegateStatus(DelegateStatusSource source, int32_t code)
-      : source_(static_cast(source)), code_(code) {}
-
-  // Return the detailed full status encoded as a int64_t value.
-  int64_t full_status() const {
-    return static_cast(source_) << 32 | code_;
-  }
-
-  DelegateStatusSource source() const {
-    return static_cast(source_);
-  }
-
-  int32_t code() const { return code_; }
-
- private:
-  // value of a DelegateStatusSource, like DelegateStatusSource::TFLITE_GPU
-  int32_t source_;
-  // value of a status code, like kTfLiteOk.
-  int32_t code_;
-};
-
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_STATUS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/utils.h
deleted file mode 100644
index a9fb673..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/utils.h
+++ /dev/null
@@ -1,181 +0,0 @@
-/* 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_UTILS_H_
-#define TENSORFLOW_LITE_DELEGATES_UTILS_H_
-
-// Utility functions and classes for implementing delegates.
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/util.h"
-
-namespace tflite {
-namespace delegates {
-
-// Creates a new Read/Write tensor having the same shape as the original, but
-// with a different type. Note that this might void existing references to
-// tensors.
-TfLiteStatus CreateNewTensorWithDifferentType(TfLiteContext* context,
-                                              const int original_tensor_index,
-                                              TfLiteType new_type,
-                                              TfLiteTensor** new_tensor,
-                                              int* new_tensor_index);
-
-using IsNodeSupportedFn =
-    std::function;
-
-// A utility class to help model graph parition.
-// Note the class *needs* to be used in TfLiteDelegate::Prepare.
-class GraphPartitionHelper {
- public:
-  GraphPartitionHelper(TfLiteContext* context,
-                       IsNodeSupportedFn is_node_supported_fn)
-      : context_(context), is_node_supported_fn_(is_node_supported_fn) {}
-
-  GraphPartitionHelper(TfLiteContext* context,
-                       const std::vector& supported_node_indices)
-      : context_(context),
-        num_total_nodes_(supported_node_indices.size()),
-        supported_nodes_(
-            ConvertVectorToTfLiteIntArray(supported_node_indices)) {}
-
-  virtual ~GraphPartitionHelper() { TfLiteIntArrayFree(supported_nodes_); }
-
-  // Partition the graph into node subsets such that each subset could be
-  // replaced with one delegate kernel (i.e. a kTfLiteBuiltinDelegate op).
-  // If 'unsupported_nodes_info' is provided, it will be populated with
-  // information about all different unsupported nodes.
-  virtual TfLiteStatus Partition(std::set* unsupported_nodes_info);
-
-  // Returns the first n largest partitions or all if #partitions is less than
-  // 'n' and each parition has at least (>=) 'min_nodes_per_partition' nodes.
-  // Note that partitions are ranked according to the number of nodes that
-  // a partition has, and the returned TfLiteDelegateParams objects are *owned*
-  // by the TfLite runtime.
-  // TODO(b/156707497): remove this and use GetNodesOfFirstNLargestPartitions
-  std::vector GetFirstNLargestPartitions(
-      int n = std::numeric_limits::max(),
-      int min_nodes_per_partition = 0) const;
-
-  // Returns a list of node indices of all nodes from the first n largest
-  // partitions. If there are fewer paritions than n, all nodes will be
-  // returned. The partition is ranked according to the number of nodes.
-  std::vector GetNodesOfFirstNLargestPartitions(
-      int n = std::numeric_limits::max(),
-      int min_nodes_per_partition = 0) {
-    // Separated implementation that can be overrided, to preserve default value
-    return GetNodesOfFirstNLargestPartitionsImpl(n, min_nodes_per_partition);
-  }
-
-  int num_total_nodes() const { return num_total_nodes_; }
-  int num_partitions() const { return partitions_.size(); }
-
- protected:
-  virtual bool IsNodeSupported(TfLiteContext* context, TfLiteNode* node,
-                               TfLiteRegistration* registration, int node_id,
-                               std::string* unsupported_details) {
-    return is_node_supported_fn_(context, node, registration,
-                                 unsupported_details);
-  }
-  virtual std::vector GetNodesOfFirstNLargestPartitionsImpl(
-      int n, int min_nodes_per_partition);
-
-  TfLiteContext* const context_ = nullptr;
-
-  // Doesn't own the memory of each TfLiteDelegateParams object as it's
-  // managed by the TfLite runtime itself. See
-  // TfLiteContext::PreviewDelegatePartitioning for details.
-  std::vector partitions_;
-
- private:
-  // Generate a list of supported nodes (i.e. populating 'supported_nodes_') by
-  // iterating over all nodes (i,e. those listed in the execution_plan
-  // associated w/ 'context_').
-  // If 'unsupported_nodes_info' is provided, it will be populated with
-  // information about all different unsupported nodes.
-  TfLiteStatus PrepareSupportedNodes(
-      std::set* unsupported_nodes_info = nullptr);
-
-  // The number of total nodes passed in for partitioning (i.e. the
-  // execution_plan size associated w/ 'context_')
-  int num_total_nodes_ = 0;
-
-  // Tells if a node is supported as it could be delegated.
-  const IsNodeSupportedFn is_node_supported_fn_ = nullptr;
-
-  // Contains an array of supported node indices.
-  TfLiteIntArray* supported_nodes_ = nullptr;  // owns the memory
-};
-
-// Specialized partitioner for graphs that possibly contain fp16 tensors.
-//
-// From nodes that accept fp16 inputs, this delegates the following:
-// 1. All nodes (except DEQUANTIZE) that are supported with fp16 inputs by the
-// delegate (in the TFLite graph, these nodes take in dequantized FP32
-// outputs).
-// 2. All fp16 DEQUANTIZE nodes that have *all* their consumers in the *first*
-// delegated partition. This is because TFLite's partitioning algorithm
-// greedily puts all such nodes in the first partition.
-class FP16GraphPartitionHelper : public GraphPartitionHelper {
- public:
-  FP16GraphPartitionHelper(TfLiteContext* context,
-                           IsNodeSupportedFn is_node_supported_fn)
-      : GraphPartitionHelper(context, std::move(is_node_supported_fn)) {}
-
- protected:
-  // Specialized function to handle fp16 nodes.
-  bool IsNodeSupported(TfLiteContext* context, TfLiteNode* node,
-                       TfLiteRegistration* registration, int node_id,
-                       std::string* unsupported_details) override;
-
-  // This will remap input tensors by removing FP16 to FP32 dequantized tensors.
-  std::vector GetNodesOfFirstNLargestPartitionsImpl(
-      int n, int min_nodes_per_partition) override;
-
- private:
-  // This remaps fp32 inputs of the given node to their corresponding fp16
-  // version, if applicable. Can be summarized as:
-  // fp16 -> DEQUANTIZE -> fp32 -> OP -> output
-  // becomes
-  // fp16 -> OP -> output
-  void RemapFp16InputTensors(TfLiteNode* node,
-                             std::vector* orig_inputs) const;
-
-  // Performs the above remapping for all nodes in the given list, without
-  // tracking the original inputs.
-  void RemapFp16InputTensors(const std::vector& nodes) const;
-
-  // ('dequantize' here refers to fp16 DEQUANTIZE)
-  // Mapping of dequantize nodes' output tensor-id to its node id.
-  std::unordered_map dequant_nodes_;
-  // Mapping of DEQUANTIZE node's output (fp32) to its input (fp16).
-  std::unordered_map dequant_map_;
-  // mapping of DEQUANTIZE output tensor-id to its number of consumers.
-  std::unordered_map dequant_consumers_;
-};
-
-}  // namespace delegates
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_UTILS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/utils/dummy_delegate/dummy_delegate.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/utils/dummy_delegate/dummy_delegate.h
deleted file mode 100644
index 94023aa..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/utils/dummy_delegate/dummy_delegate.h
+++ /dev/null
@@ -1,60 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_UTILS_DUMMY_DELEGATE_DUMMY_DELEGATE_H_
-#define TENSORFLOW_LITE_DELEGATES_UTILS_DUMMY_DELEGATE_DUMMY_DELEGATE_H_
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-typedef struct {
-  // Allowed ops to delegate.
-  int allowed_builtin_code;
-  // Report error during init.
-  bool error_during_init;
-  // Report error during prepare.
-  bool error_during_prepare;
-  // Report error during invoke.
-  bool error_during_invoke;
-} DummyDelegateOptions;
-
-// Returns a structure with the default delegate options.
-DummyDelegateOptions TfLiteDummyDelegateOptionsDefault();
-
-// Creates a new delegate instance that needs to be destroyed with
-// `TfLiteDummyDelegateDelete` when delegate is no longer used by TFLite.
-// When `options` is set to `nullptr`, the above default values are used:
-TfLiteDelegate* TfLiteDummyDelegateCreate(const DummyDelegateOptions* options);
-
-// Destroys a delegate created with `TfLiteDummyDelegateCreate` call.
-void TfLiteDummyDelegateDelete(TfLiteDelegate* delegate);
-#ifdef __cplusplus
-}
-#endif  // __cplusplus
-
-// A convenient wrapper that returns C++ std::unique_ptr for automatic memory
-// management.
-inline std::unique_ptr
-TfLiteDummyDelegateCreateUnique(const DummyDelegateOptions* options) {
-  return std::unique_ptr(
-      TfLiteDummyDelegateCreate(options), TfLiteDummyDelegateDelete);
-}
-
-#endif  // TENSORFLOW_LITE_DELEGATES_UTILS_DUMMY_DELEGATE_DUMMY_DELEGATE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/utils/simple_delegate.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/utils/simple_delegate.h
deleted file mode 100644
index 338633d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/utils/simple_delegate.h
+++ /dev/null
@@ -1,136 +0,0 @@
-/* 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.
-==============================================================================*/
-
-// This file has utilities that facilitates creating new delegates.
-// - SimpleDelegateKernelInterface: Represents a Kernel which handles a subgraph
-// to be delegated. It has Init/Prepare/Invoke which are going to be called
-// during inference, similar to TFLite Kernels. Delegate owner should implement
-// this interface to build/prepare/invoke the delegated subgraph.
-// - SimpleDelegateInterface:
-// This class wraps TFLiteDelegate and users need to implement the interface and
-// then call TfLiteDelegateFactory::CreateSimpleDelegate(...) to get
-// TfLiteDelegate* that can be passed to ModifyGraphWithDelegate and free it via
-// TfLiteDelegateFactory::DeleteSimpleDelegate(...).
-// or call TfLiteDelegateFactory::Create(...) to get a std::unique_ptr
-// TfLiteDelegate that can also be passed to ModifyGraphWithDelegate, in which
-// case TfLite interpereter takes the memory ownership of the delegate.
-#ifndef TENSORFLOW_LITE_DELEGATES_UTILS_SIMPLE_DELEGATE_H_
-#define TENSORFLOW_LITE_DELEGATES_UTILS_SIMPLE_DELEGATE_H_
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-
-using TfLiteDelegateUniquePtr =
-    std::unique_ptr;
-
-// Users should inherit from this class and implement the interface below.
-// Each instance represents a single part of the graph (subgraph).
-class SimpleDelegateKernelInterface {
- public:
-  virtual ~SimpleDelegateKernelInterface() {}
-
-  // Initializes a delegated subgraph.
-  // The nodes in the subgraph are inside TfLiteDelegateParams->nodes_to_replace
-  virtual TfLiteStatus Init(TfLiteContext* context,
-                            const TfLiteDelegateParams* params) = 0;
-
-  // Will be called by the framework. Should handle any needed preparation
-  // for the subgraph e.g. allocating buffers, compiling model.
-  // Returns status, and signalling any errors.
-  virtual TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) = 0;
-
-  // Actual subgraph inference should happen on this call.
-  // Returns status, and signalling any errors.
-  virtual TfLiteStatus Eval(TfLiteContext* context, TfLiteNode* node) = 0;
-};
-
-// Pure Interface that clients should implement.
-// The Interface represents a delegate capabilities and provide factory
-// for SimpleDelegateKernelInterface
-//
-// Clients should implement the following methods:
-// - IsNodeSupportedByDelegate
-// - Initialize
-// - name
-// - CreateDelegateKernelInterface
-class SimpleDelegateInterface {
- public:
-  // Options for configuring a delegate.
-  struct Options {
-    // Maximum number of delegated subgraph, values <=0 means unlimited.
-    int max_delegated_partitions = 0;
-
-    // The minimum number of nodes allowed in a delegated graph, values <=0
-    // means unlimited.
-    int min_nodes_per_partition = 0;
-  };
-
-  virtual ~SimpleDelegateInterface() {}
-
-  // Returns true if 'node' is supported by the delegate. False otherwise.
-  virtual bool IsNodeSupportedByDelegate(const TfLiteRegistration* registration,
-                                         const TfLiteNode* node,
-                                         TfLiteContext* context) const = 0;
-
-  // Initialize the delegate before finding and replacing TfLite nodes with
-  // delegate kernels, for example, retrieving some TFLite settings from
-  // 'context'.
-  virtual TfLiteStatus Initialize(TfLiteContext* context) = 0;
-
-  // Returns a name that identifies the delegate.
-  // This name is used for debugging/logging/profiling.
-  virtual const char* Name() const = 0;
-
-  // Returns instance of an object that implements the interface
-  // SimpleDelegateKernelInterface.
-  // An instance of SimpleDelegateKernelInterface represents one subgraph to
-  // be delegated.
-  // Caller takes ownership of the returned object.
-  virtual std::unique_ptr
-  CreateDelegateKernelInterface() = 0;
-
-  // Returns SimpleDelegateInterface::Options which has the delegate options.
-  virtual SimpleDelegateInterface::Options DelegateOptions() const = 0;
-};
-
-// Factory class that provides static methods to deal with SimpleDelegate
-// creation and deletion.
-class TfLiteDelegateFactory {
- public:
-  // Creates TfLiteDelegate from the provided SimpleDelegateInterface.
-  // The returned TfLiteDelegate should be deleted using DeleteSimpleDelegate.
-  static TfLiteDelegate* CreateSimpleDelegate(
-      std::unique_ptr simple_delegate);
-
-  // Deletes 'delegate' the passed pointer must be the one returned
-  // from CreateSimpleDelegate.
-  // This function will destruct the SimpleDelegate object too.
-  static void DeleteSimpleDelegate(TfLiteDelegate* delegate);
-
-  // A convenient function wrapping the above two functions and returning a
-  // std::unique_ptr type for auto memory management.
-  inline static TfLiteDelegateUniquePtr Create(
-      std::unique_ptr simple_delegate) {
-    return TfLiteDelegateUniquePtr(
-        CreateSimpleDelegate(std::move(simple_delegate)), DeleteSimpleDelegate);
-  }
-};
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_UTILS_SIMPLE_DELEGATE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/binary_elementwise_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/binary_elementwise_tester.h
deleted file mode 100644
index 3d476ba..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/binary_elementwise_tester.h
+++ /dev/null
@@ -1,140 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_BINARY_ELEMENTWISE_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_BINARY_ELEMENTWISE_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class BinaryElementwiseTester {
- public:
-  BinaryElementwiseTester() = default;
-  BinaryElementwiseTester(const BinaryElementwiseTester&) = delete;
-  BinaryElementwiseTester& operator=(const BinaryElementwiseTester&) = delete;
-
-  inline BinaryElementwiseTester& Input1Shape(
-      std::initializer_list shape) {
-    for (auto it = shape.begin(); it != shape.end(); ++it) {
-      EXPECT_GT(*it, 0);
-    }
-    input1_shape_ = std::vector(shape.begin(), shape.end());
-    return *this;
-  }
-
-  inline const std::vector& Input1Shape() const {
-    return input1_shape_;
-  }
-
-  inline BinaryElementwiseTester& Input2Shape(
-      std::initializer_list shape) {
-    for (auto it = shape.begin(); it != shape.end(); ++it) {
-      EXPECT_GT(*it, 0);
-    }
-    input2_shape_ = std::vector(shape.begin(), shape.end());
-    return *this;
-  }
-
-  inline const std::vector& Input2Shape() const {
-    return input2_shape_;
-  }
-
-  std::vector OutputShape() const;
-
-  inline BinaryElementwiseTester& Input1Static(bool is_static) {
-    input1_static_ = is_static;
-    return *this;
-  }
-
-  inline bool Input1Static() const { return input1_static_; }
-
-  inline BinaryElementwiseTester& Input2Static(bool is_static) {
-    input2_static_ = is_static;
-    return *this;
-  }
-
-  inline bool Input2Static() const { return input2_static_; }
-
-  inline BinaryElementwiseTester& FP16Weights() {
-    fp16_weights_ = true;
-    return *this;
-  }
-
-  inline bool FP16Weights() const { return fp16_weights_; }
-
-  inline BinaryElementwiseTester& SparseWeights() {
-    sparse_weights_ = true;
-    return *this;
-  }
-
-  inline bool SparseWeights() const { return sparse_weights_; }
-
-  inline BinaryElementwiseTester& ReluActivation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU;
-    return *this;
-  }
-
-  inline BinaryElementwiseTester& Relu6Activation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU6;
-    return *this;
-  }
-
-  inline BinaryElementwiseTester& ReluMinus1To1Activation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU_N1_TO_1;
-    return *this;
-  }
-
-  inline BinaryElementwiseTester& TanhActivation() {
-    activation_ = ::tflite::ActivationFunctionType_TANH;
-    return *this;
-  }
-
-  inline BinaryElementwiseTester& SignBitActivation() {
-    activation_ = ::tflite::ActivationFunctionType_SIGN_BIT;
-    return *this;
-  }
-
-  void Test(tflite::BuiltinOperator binary_op, TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel(tflite::BuiltinOperator binary_op) const;
-
-  inline ::tflite::ActivationFunctionType Activation() const {
-    return activation_;
-  }
-
-  static int32_t ComputeSize(const std::vector& shape);
-
-  std::vector input1_shape_;
-  std::vector input2_shape_;
-  bool input1_static_ = false;
-  bool input2_static_ = false;
-  bool fp16_weights_ = false;
-  bool sparse_weights_ = false;
-  ::tflite::ActivationFunctionType activation_ =
-      ::tflite::ActivationFunctionType_NONE;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_BINARY_ELEMENTWISE_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/conv_2d_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/conv_2d_tester.h
deleted file mode 100644
index d0a021c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/conv_2d_tester.h
+++ /dev/null
@@ -1,232 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_CONV_2D_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_CONV_2D_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class Conv2DTester {
- public:
-  Conv2DTester() = default;
-  Conv2DTester(const Conv2DTester&) = delete;
-  Conv2DTester& operator=(const Conv2DTester&) = delete;
-
-  inline Conv2DTester& BatchSize(int32_t batch_size) {
-    EXPECT_GT(batch_size, 0);
-    batch_size_ = batch_size;
-    return *this;
-  }
-
-  inline int32_t BatchSize() const { return batch_size_; }
-
-  inline Conv2DTester& InputChannels(int32_t input_channels) {
-    EXPECT_GT(input_channels, 0);
-    input_channels_ = input_channels;
-    return *this;
-  }
-
-  inline int32_t InputChannels() const { return input_channels_; }
-
-  inline Conv2DTester& OutputChannels(int32_t output_channels) {
-    EXPECT_GT(output_channels, 0);
-    output_channels_ = output_channels;
-    return *this;
-  }
-
-  inline int32_t OutputChannels() const { return output_channels_; }
-
-  inline Conv2DTester& InputHeight(int32_t input_height) {
-    EXPECT_GT(input_height, 0);
-    input_height_ = input_height;
-    return *this;
-  }
-
-  inline int32_t InputHeight() const { return input_height_; }
-
-  inline Conv2DTester& InputWidth(int32_t input_width) {
-    EXPECT_GT(input_width, 0);
-    input_width_ = input_width;
-    return *this;
-  }
-
-  inline int32_t InputWidth() const { return input_width_; }
-
-  inline int32_t OutputWidth() const {
-    if (Padding() == ::tflite::Padding_SAME) {
-      EXPECT_GE(InputWidth(), 1);
-      return (InputWidth() - 1) / StrideWidth() + 1;
-    } else {
-      EXPECT_GE(InputWidth(), DilatedKernelWidth());
-      return 1 + (InputWidth() - DilatedKernelWidth()) / StrideWidth();
-    }
-  }
-
-  inline int32_t OutputHeight() const {
-    if (Padding() == ::tflite::Padding_SAME) {
-      EXPECT_GE(InputHeight(), 1);
-      return (InputHeight() - 1) / StrideHeight() + 1;
-    } else {
-      EXPECT_GE(InputHeight(), DilatedKernelHeight());
-      return 1 + (InputHeight() - DilatedKernelHeight()) / StrideHeight();
-    }
-  }
-
-  inline Conv2DTester& KernelHeight(int32_t kernel_height) {
-    EXPECT_GT(kernel_height, 0);
-    kernel_height_ = kernel_height;
-    return *this;
-  }
-
-  inline int32_t KernelHeight() const { return kernel_height_; }
-
-  inline Conv2DTester& KernelWidth(int32_t kernel_width) {
-    EXPECT_GT(kernel_width, 0);
-    kernel_width_ = kernel_width;
-    return *this;
-  }
-
-  inline int32_t KernelWidth() const { return kernel_width_; }
-
-  inline Conv2DTester& StrideHeight(int32_t stride_height) {
-    EXPECT_GT(stride_height, 0);
-    stride_height_ = stride_height;
-    return *this;
-  }
-
-  inline int32_t StrideHeight() const { return stride_height_; }
-
-  inline Conv2DTester& StrideWidth(int32_t stride_width) {
-    EXPECT_GT(stride_width, 0);
-    stride_width_ = stride_width;
-    return *this;
-  }
-
-  inline int32_t StrideWidth() const { return stride_width_; }
-
-  inline Conv2DTester& DilationHeight(int32_t dilation_height) {
-    EXPECT_GT(dilation_height, 0);
-    dilation_height_ = dilation_height;
-    return *this;
-  }
-
-  inline int32_t DilationHeight() const { return dilation_height_; }
-
-  inline Conv2DTester& DilationWidth(int32_t dilation_width) {
-    EXPECT_GT(dilation_width, 0);
-    dilation_width_ = dilation_width;
-    return *this;
-  }
-
-  inline int32_t DilationWidth() const { return dilation_width_; }
-
-  inline int32_t DilatedKernelHeight() const {
-    return (KernelHeight() - 1) * DilationHeight() + 1;
-  }
-
-  inline int32_t DilatedKernelWidth() const {
-    return (KernelWidth() - 1) * DilationWidth() + 1;
-  }
-
-  inline Conv2DTester& FP16Weights() {
-    fp16_weights_ = true;
-    return *this;
-  }
-
-  inline bool FP16Weights() const { return fp16_weights_; }
-
-  inline Conv2DTester& SparseWeights() {
-    sparse_weights_ = true;
-    return *this;
-  }
-
-  inline bool SparseWeights() const { return sparse_weights_; }
-
-  inline Conv2DTester& SamePadding() {
-    padding_ = ::tflite::Padding_SAME;
-    return *this;
-  }
-
-  inline Conv2DTester& ValidPadding() {
-    padding_ = ::tflite::Padding_VALID;
-    return *this;
-  }
-
-  inline Conv2DTester& ReluActivation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU;
-    return *this;
-  }
-
-  inline Conv2DTester& Relu6Activation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU6;
-    return *this;
-  }
-
-  inline Conv2DTester& ReluMinus1To1Activation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU_N1_TO_1;
-    return *this;
-  }
-
-  inline Conv2DTester& TanhActivation() {
-    activation_ = ::tflite::ActivationFunctionType_TANH;
-    return *this;
-  }
-
-  inline Conv2DTester& SignBitActivation() {
-    activation_ = ::tflite::ActivationFunctionType_SIGN_BIT;
-    return *this;
-  }
-
-  void Test(TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel() const;
-
-  inline ::tflite::Padding Padding() const { return padding_; }
-
-  inline ::tflite::ActivationFunctionType Activation() const {
-    return activation_;
-  }
-
-  int32_t batch_size_ = 1;
-  int32_t input_channels_ = 1;
-  int32_t output_channels_ = 1;
-  int32_t input_height_ = 1;
-  int32_t input_width_ = 1;
-  int32_t kernel_height_ = 1;
-  int32_t kernel_width_ = 1;
-  int32_t stride_height_ = 1;
-  int32_t stride_width_ = 1;
-  int32_t dilation_height_ = 1;
-  int32_t dilation_width_ = 1;
-  bool fp16_weights_ = false;
-  bool sparse_weights_ = false;
-  ::tflite::Padding padding_ = ::tflite::Padding_VALID;
-  ::tflite::ActivationFunctionType activation_ =
-      ::tflite::ActivationFunctionType_NONE;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_CONV_2D_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/depthwise_conv_2d_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/depthwise_conv_2d_tester.h
deleted file mode 100644
index acc82ed..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/depthwise_conv_2d_tester.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_DEPTHWISE_CONV_2D_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_DEPTHWISE_CONV_2D_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class DepthwiseConv2DTester {
- public:
-  DepthwiseConv2DTester() = default;
-  DepthwiseConv2DTester(const DepthwiseConv2DTester&) = delete;
-  DepthwiseConv2DTester& operator=(const DepthwiseConv2DTester&) = delete;
-
-  inline DepthwiseConv2DTester& BatchSize(int32_t batch_size) {
-    EXPECT_GT(batch_size, 0);
-    batch_size_ = batch_size;
-    return *this;
-  }
-
-  inline int32_t BatchSize() const { return batch_size_; }
-
-  inline DepthwiseConv2DTester& InputChannels(int32_t input_channels) {
-    EXPECT_GT(input_channels, 0);
-    input_channels_ = input_channels;
-    return *this;
-  }
-
-  inline int32_t InputChannels() const { return input_channels_; }
-
-  inline DepthwiseConv2DTester& DepthMultiplier(int32_t depth_multiplier) {
-    EXPECT_GT(depth_multiplier, 0);
-    depth_multiplier_ = depth_multiplier;
-    return *this;
-  }
-
-  inline int32_t DepthMultiplier() const { return depth_multiplier_; }
-
-  inline int32_t OutputChannels() const {
-    return DepthMultiplier() * InputChannels();
-  }
-
-  inline DepthwiseConv2DTester& InputHeight(int32_t input_height) {
-    EXPECT_GT(input_height, 0);
-    input_height_ = input_height;
-    return *this;
-  }
-
-  inline int32_t InputHeight() const { return input_height_; }
-
-  inline DepthwiseConv2DTester& InputWidth(int32_t input_width) {
-    EXPECT_GT(input_width, 0);
-    input_width_ = input_width;
-    return *this;
-  }
-
-  inline int32_t InputWidth() const { return input_width_; }
-
-  inline int32_t OutputWidth() const {
-    if (Padding() == ::tflite::Padding_SAME) {
-      EXPECT_GE(InputWidth(), 1);
-      return (InputWidth() - 1) / StrideWidth() + 1;
-    } else {
-      EXPECT_GE(InputWidth(), DilatedKernelWidth());
-      return 1 + (InputWidth() - DilatedKernelWidth()) / StrideWidth();
-    }
-  }
-
-  inline int32_t OutputHeight() const {
-    if (Padding() == ::tflite::Padding_SAME) {
-      EXPECT_GE(InputHeight(), 1);
-      return (InputHeight() - 1) / StrideHeight() + 1;
-    } else {
-      EXPECT_GE(InputHeight(), DilatedKernelHeight());
-      return 1 + (InputHeight() - DilatedKernelHeight()) / StrideHeight();
-    }
-  }
-
-  inline DepthwiseConv2DTester& KernelHeight(int32_t kernel_height) {
-    EXPECT_GT(kernel_height, 0);
-    kernel_height_ = kernel_height;
-    return *this;
-  }
-
-  inline int32_t KernelHeight() const { return kernel_height_; }
-
-  inline DepthwiseConv2DTester& KernelWidth(int32_t kernel_width) {
-    EXPECT_GT(kernel_width, 0);
-    kernel_width_ = kernel_width;
-    return *this;
-  }
-
-  inline int32_t KernelWidth() const { return kernel_width_; }
-
-  inline DepthwiseConv2DTester& StrideHeight(int32_t stride_height) {
-    EXPECT_GT(stride_height, 0);
-    stride_height_ = stride_height;
-    return *this;
-  }
-
-  inline int32_t StrideHeight() const { return stride_height_; }
-
-  inline DepthwiseConv2DTester& StrideWidth(int32_t stride_width) {
-    EXPECT_GT(stride_width, 0);
-    stride_width_ = stride_width;
-    return *this;
-  }
-
-  inline int32_t StrideWidth() const { return stride_width_; }
-
-  inline DepthwiseConv2DTester& DilationHeight(int32_t dilation_height) {
-    EXPECT_GT(dilation_height, 0);
-    dilation_height_ = dilation_height;
-    return *this;
-  }
-
-  inline int32_t DilationHeight() const { return dilation_height_; }
-
-  inline DepthwiseConv2DTester& DilationWidth(int32_t dilation_width) {
-    EXPECT_GT(dilation_width, 0);
-    dilation_width_ = dilation_width;
-    return *this;
-  }
-
-  inline int32_t DilationWidth() const { return dilation_width_; }
-
-  inline int32_t DilatedKernelHeight() const {
-    return (KernelHeight() - 1) * DilationHeight() + 1;
-  }
-
-  inline int32_t DilatedKernelWidth() const {
-    return (KernelWidth() - 1) * DilationWidth() + 1;
-  }
-
-  inline DepthwiseConv2DTester& FP16Weights() {
-    fp16_weights_ = true;
-    return *this;
-  }
-
-  inline bool FP16Weights() const { return fp16_weights_; }
-
-  inline DepthwiseConv2DTester& SparseWeights() {
-    sparse_weights_ = true;
-    return *this;
-  }
-
-  inline bool SparseWeights() const { return sparse_weights_; }
-
-  inline DepthwiseConv2DTester& SamePadding() {
-    padding_ = ::tflite::Padding_SAME;
-    return *this;
-  }
-
-  inline DepthwiseConv2DTester& ValidPadding() {
-    padding_ = ::tflite::Padding_VALID;
-    return *this;
-  }
-
-  inline DepthwiseConv2DTester& ReluActivation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU;
-    return *this;
-  }
-
-  inline DepthwiseConv2DTester& Relu6Activation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU6;
-    return *this;
-  }
-
-  inline DepthwiseConv2DTester& ReluMinus1To1Activation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU_N1_TO_1;
-    return *this;
-  }
-
-  inline DepthwiseConv2DTester& TanhActivation() {
-    activation_ = ::tflite::ActivationFunctionType_TANH;
-    return *this;
-  }
-
-  inline DepthwiseConv2DTester& SignBitActivation() {
-    activation_ = ::tflite::ActivationFunctionType_SIGN_BIT;
-    return *this;
-  }
-
-  void Test(TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel() const;
-
-  inline ::tflite::Padding Padding() const { return padding_; }
-
-  inline ::tflite::ActivationFunctionType Activation() const {
-    return activation_;
-  }
-
-  int32_t batch_size_ = 1;
-  int32_t input_channels_ = 1;
-  int32_t depth_multiplier_ = 1;
-  int32_t input_height_ = 1;
-  int32_t input_width_ = 1;
-  int32_t kernel_height_ = 1;
-  int32_t kernel_width_ = 1;
-  int32_t stride_height_ = 1;
-  int32_t stride_width_ = 1;
-  int32_t dilation_height_ = 1;
-  int32_t dilation_width_ = 1;
-  bool fp16_weights_ = false;
-  bool sparse_weights_ = false;
-  ::tflite::Padding padding_ = ::tflite::Padding_VALID;
-  ::tflite::ActivationFunctionType activation_ =
-      ::tflite::ActivationFunctionType_NONE;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_DEPTHWISE_CONV_2D_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/fully_connected_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/fully_connected_tester.h
deleted file mode 100644
index 6350bc8..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/fully_connected_tester.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_FULLY_CONNECTED_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_FULLY_CONNECTED_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class FullyConnectedTester {
- public:
-  FullyConnectedTester() = default;
-  FullyConnectedTester(const FullyConnectedTester&) = delete;
-  FullyConnectedTester& operator=(const FullyConnectedTester&) = delete;
-
-  inline FullyConnectedTester& InputShape(
-      std::initializer_list shape) {
-    for (auto it = shape.begin(); it != shape.end(); ++it) {
-      EXPECT_GT(*it, 0);
-    }
-    input_shape_ = std::vector(shape.begin(), shape.end());
-    input_size_ = ComputeSize(input_shape_);
-    return *this;
-  }
-
-  inline const std::vector& InputShape() const { return input_shape_; }
-
-  inline int32_t InputSize() const { return input_size_; }
-
-  inline FullyConnectedTester& InputChannels(int32_t input_channels) {
-    EXPECT_GT(input_channels, 0);
-    input_channels_ = input_channels;
-    return *this;
-  }
-
-  inline int32_t InputChannels() const { return input_channels_; }
-
-  inline FullyConnectedTester& OutputChannels(int32_t output_channels) {
-    EXPECT_GT(output_channels, 0);
-    output_channels_ = output_channels;
-    return *this;
-  }
-
-  inline int32_t OutputChannels() const { return output_channels_; }
-
-  std::vector OutputShape() const;
-
-  inline FullyConnectedTester& KeepDims(bool keep_dims) {
-    keep_dims_ = keep_dims;
-    return *this;
-  }
-
-  inline bool KeepDims() const { return keep_dims_; }
-
-  inline FullyConnectedTester& FP16Weights() {
-    fp16_weights_ = true;
-    return *this;
-  }
-
-  inline bool FP16Weights() const { return fp16_weights_; }
-
-  inline FullyConnectedTester& ReluActivation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU;
-    return *this;
-  }
-
-  inline FullyConnectedTester& Relu6Activation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU6;
-    return *this;
-  }
-
-  inline FullyConnectedTester& ReluMinus1To1Activation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU_N1_TO_1;
-    return *this;
-  }
-
-  void Test(TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel() const;
-
-  inline ::tflite::ActivationFunctionType Activation() const {
-    return activation_;
-  }
-
-  static int32_t ComputeSize(const std::vector& shape);
-
-  std::vector input_shape_;
-  int32_t input_size_ = 1;
-  int32_t input_channels_ = 1;
-  int32_t output_channels_ = 1;
-  bool keep_dims_ = false;
-  bool fp16_weights_ = false;
-  ::tflite::ActivationFunctionType activation_ =
-      ::tflite::ActivationFunctionType_NONE;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_FULLY_CONNECTED_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/leaky_relu_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/leaky_relu_tester.h
deleted file mode 100644
index 191dc93..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/leaky_relu_tester.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_LEAKY_RELU_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_LEAKY_RELU_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class LeakyReluTester {
- public:
-  LeakyReluTester() = default;
-  LeakyReluTester(const LeakyReluTester&) = delete;
-  LeakyReluTester& operator=(const LeakyReluTester&) = delete;
-
-  inline LeakyReluTester& Shape(std::initializer_list shape) {
-    for (auto it = shape.begin(); it != shape.end(); ++it) {
-      EXPECT_GT(*it, 0);
-    }
-    shape_ = std::vector(shape.begin(), shape.end());
-    size_ = LeakyReluTester::ComputeSize(shape_);
-    return *this;
-  }
-
-  inline const std::vector& Shape() const { return shape_; }
-
-  inline int32_t Size() const { return size_; }
-
-  inline LeakyReluTester& NegativeSlope(float negative_slope) {
-    negative_slope_ = negative_slope;
-    return *this;
-  }
-
-  inline float NegativeSlope() const { return negative_slope_; }
-
-  void Test(TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel() const;
-
-  static int32_t ComputeSize(const std::vector& shape);
-
-  std::vector shape_;
-  int32_t size_;
-  float negative_slope_ = 0.5f;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_LEAKY_RELU_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/pad_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/pad_tester.h
deleted file mode 100644
index a6951fd..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/pad_tester.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_PAD_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_PAD_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class PadTester {
- public:
-  PadTester() = default;
-  PadTester(const PadTester&) = delete;
-  PadTester& operator=(const PadTester&) = delete;
-
-  inline PadTester& InputShape(std::initializer_list shape) {
-    for (auto it = shape.begin(); it != shape.end(); ++it) {
-      EXPECT_GT(*it, 0);
-    }
-    input_shape_ = std::vector(shape.begin(), shape.end());
-    return *this;
-  }
-
-  inline const std::vector& InputShape() const { return input_shape_; }
-
-  inline PadTester& InputPrePaddings(std::initializer_list paddings) {
-    for (auto it = paddings.begin(); it != paddings.end(); ++it) {
-      EXPECT_GE(*it, 0);
-    }
-    input_pre_paddings_ =
-        std::vector(paddings.begin(), paddings.end());
-    return *this;
-  }
-
-  inline const std::vector InputPrePaddings() const {
-    return input_pre_paddings_;
-  }
-
-  inline PadTester& InputPostPaddings(std::initializer_list paddings) {
-    for (auto it = paddings.begin(); it != paddings.end(); ++it) {
-      EXPECT_GE(*it, 0);
-    }
-    input_post_paddings_ =
-        std::vector(paddings.begin(), paddings.end());
-    return *this;
-  }
-
-  inline const std::vector InputPostPaddings() const {
-    return input_post_paddings_;
-  }
-
-  std::vector OutputShape() const;
-
-  void Test(TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel() const;
-
-  static int32_t ComputeSize(const std::vector& shape);
-
-  std::vector input_shape_;
-  std::vector input_pre_paddings_;
-  std::vector input_post_paddings_;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_PAD_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/pool_2d_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/pool_2d_tester.h
deleted file mode 100644
index a84be10..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/pool_2d_tester.h
+++ /dev/null
@@ -1,177 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_POOL_2D_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_POOL_2D_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class Pool2DTester {
- public:
-  Pool2DTester() = default;
-  Pool2DTester(const Pool2DTester&) = delete;
-  Pool2DTester& operator=(const Pool2DTester&) = delete;
-
-  inline Pool2DTester& BatchSize(int32_t batch_size) {
-    EXPECT_GT(batch_size, 0);
-    batch_size_ = batch_size;
-    return *this;
-  }
-
-  inline int32_t BatchSize() const { return batch_size_; }
-
-  inline Pool2DTester& Channels(int32_t channels) {
-    EXPECT_GT(channels, 0);
-    channels_ = channels;
-    return *this;
-  }
-
-  inline int32_t Channels() const { return channels_; }
-
-  inline Pool2DTester& InputHeight(int32_t input_height) {
-    EXPECT_GT(input_height, 0);
-    input_height_ = input_height;
-    return *this;
-  }
-
-  inline int32_t InputHeight() const { return input_height_; }
-
-  inline Pool2DTester& InputWidth(int32_t input_width) {
-    EXPECT_GT(input_width, 0);
-    input_width_ = input_width;
-    return *this;
-  }
-
-  inline int32_t InputWidth() const { return input_width_; }
-
-  inline int32_t OutputWidth() const {
-    if (Padding() == ::tflite::Padding_SAME) {
-      return (InputWidth() - 1) / StrideWidth() + 1;
-    } else {
-      return (InputWidth() - PoolingWidth()) / StrideWidth() + 1;
-    }
-  }
-
-  inline int32_t OutputHeight() const {
-    if (Padding() == ::tflite::Padding_SAME) {
-      return (InputHeight() - 1) / StrideHeight() + 1;
-    } else {
-      return (InputHeight() - PoolingHeight()) / StrideHeight() + 1;
-    }
-  }
-
-  inline Pool2DTester& PoolingHeight(int32_t pooling_height) {
-    EXPECT_GT(pooling_height, 0);
-    pooling_height_ = pooling_height;
-    return *this;
-  }
-
-  inline int32_t PoolingHeight() const { return pooling_height_; }
-
-  inline Pool2DTester& PoolingWidth(int32_t pooling_width) {
-    EXPECT_GT(pooling_width, 0);
-    pooling_width_ = pooling_width;
-    return *this;
-  }
-
-  inline int32_t PoolingWidth() const { return pooling_width_; }
-
-  inline Pool2DTester& StrideHeight(int32_t stride_height) {
-    EXPECT_GT(stride_height, 0);
-    stride_height_ = stride_height;
-    return *this;
-  }
-
-  inline int32_t StrideHeight() const { return stride_height_; }
-
-  inline Pool2DTester& StrideWidth(int32_t stride_width) {
-    EXPECT_GT(stride_width, 0);
-    stride_width_ = stride_width;
-    return *this;
-  }
-
-  inline int32_t StrideWidth() const { return stride_width_; }
-
-  inline Pool2DTester& SamePadding() {
-    padding_ = ::tflite::Padding_SAME;
-    return *this;
-  }
-
-  inline Pool2DTester& ValidPadding() {
-    padding_ = ::tflite::Padding_VALID;
-    return *this;
-  }
-
-  inline Pool2DTester& ReluActivation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU;
-    return *this;
-  }
-
-  inline Pool2DTester& Relu6Activation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU6;
-    return *this;
-  }
-
-  inline Pool2DTester& ReluMinus1To1Activation() {
-    activation_ = ::tflite::ActivationFunctionType_RELU_N1_TO_1;
-    return *this;
-  }
-
-  inline Pool2DTester& TanhActivation() {
-    activation_ = ::tflite::ActivationFunctionType_TANH;
-    return *this;
-  }
-
-  inline Pool2DTester& SignBitActivation() {
-    activation_ = ::tflite::ActivationFunctionType_SIGN_BIT;
-    return *this;
-  }
-
-  void Test(tflite::BuiltinOperator pool_op, TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel(tflite::BuiltinOperator pool_op) const;
-
-  inline ::tflite::Padding Padding() const { return padding_; }
-
-  inline ::tflite::ActivationFunctionType Activation() const {
-    return activation_;
-  }
-
-  int32_t batch_size_ = 1;
-  int32_t channels_ = 1;
-  int32_t input_height_ = 1;
-  int32_t input_width_ = 1;
-  int32_t pooling_height_ = 1;
-  int32_t pooling_width_ = 1;
-  int32_t stride_height_ = 1;
-  int32_t stride_width_ = 1;
-  ::tflite::Padding padding_ = ::tflite::Padding_VALID;
-  ::tflite::ActivationFunctionType activation_ =
-      ::tflite::ActivationFunctionType_NONE;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_POOL_2D_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/prelu_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/prelu_tester.h
deleted file mode 100644
index e89bae6..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/prelu_tester.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_PRELU_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_PRELU_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class PreluTester {
- public:
-  PreluTester() = default;
-  PreluTester(const PreluTester&) = delete;
-  PreluTester& operator=(const PreluTester&) = delete;
-
-  inline PreluTester& InputShape(std::initializer_list shape) {
-    for (auto it = shape.begin(); it != shape.end(); ++it) {
-      EXPECT_GT(*it, 0);
-    }
-    input_shape_ = std::vector(shape.begin(), shape.end());
-    return *this;
-  }
-
-  inline const std::vector& InputShape() const { return input_shape_; }
-
-  inline PreluTester& SlopeShape(std::initializer_list shape) {
-    for (auto it = shape.begin(); it != shape.end(); ++it) {
-      EXPECT_GT(*it, 0);
-    }
-    slope_shape_ = std::vector(shape.begin(), shape.end());
-    return *this;
-  }
-
-  inline const std::vector& SlopeShape() const { return slope_shape_; }
-
-  inline const std::vector& OutputShape() const {
-    return InputShape();
-  }
-
-  inline PreluTester& FP16Weights() {
-    fp16_weights_ = true;
-    return *this;
-  }
-
-  inline bool FP16Weights() const { return fp16_weights_; }
-
-  inline PreluTester& SparseWeights() {
-    sparse_weights_ = true;
-    return *this;
-  }
-
-  inline bool SparseWeights() const { return sparse_weights_; }
-
-  void Test(TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel() const;
-
-  static int32_t ComputeSize(const std::vector& shape);
-
-  std::vector input_shape_;
-  std::vector slope_shape_;
-  bool fp16_weights_ = false;
-  bool sparse_weights_ = false;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_PRELU_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/reduce_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/reduce_tester.h
deleted file mode 100644
index 63ce194..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/reduce_tester.h
+++ /dev/null
@@ -1,117 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_REDUCE_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_REDUCE_TESTER_H_
-
-#include 
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class ReduceTester {
- public:
-  ReduceTester() = default;
-  ReduceTester(const ReduceTester&) = delete;
-  ReduceTester& operator=(const ReduceTester&) = delete;
-
-  inline ReduceTester& InputShape(std::initializer_list shape) {
-    for (auto it = shape.begin(); it != shape.end(); ++it) {
-      EXPECT_GT(*it, 0);
-    }
-    input_shape_ = std::vector(shape.begin(), shape.end());
-    input_size_ = ReduceTester::ComputeSize(input_shape_);
-    return *this;
-  }
-
-  inline const std::vector& InputShape() const { return input_shape_; }
-
-  inline int32_t InputSize() const { return input_size_; }
-
-  inline ReduceTester& Axes(std::initializer_list axes) {
-    for (auto it = axes.begin(); it != axes.end(); ++it) {
-      EXPECT_GE(*it, 0);
-    }
-    axes_ = std::vector(axes.begin(), axes.end());
-    return *this;
-  }
-
-  inline const std::vector& Axes() const { return axes_; }
-
-  inline ReduceTester& KeepDims(bool keep_dims) {
-    keep_dims_ = keep_dims;
-    return *this;
-  }
-
-  inline bool KeepDims() const { return keep_dims_; }
-
-  inline std::vector OutputShape() const {
-    std::vector output_shape;
-    output_shape.reserve(InputShape().size());
-    std::unordered_set axes_set(Axes().cbegin(), Axes().cend());
-    for (int32_t i = 0; i < InputShape().size(); i++) {
-      if (axes_set.count(i) != 0) {
-        if (KeepDims()) {
-          output_shape.push_back(1);
-        }
-      } else {
-        output_shape.push_back(InputShape()[i]);
-      }
-    }
-    return output_shape;
-  }
-
-  inline int32_t OutputSize() const {
-    int32_t output_size = 1;
-    std::unordered_set axes_set(Axes().cbegin(), Axes().cend());
-    for (int32_t i = 0; i < InputShape().size(); i++) {
-      if (axes_set.count(i) == 0) {
-        output_size *= InputShape()[i];
-      }
-    }
-    return output_size;
-  }
-
-  inline ReduceTester& RelativeTolerance(float relative_tolerance) {
-    relative_tolerance_ = relative_tolerance;
-    return *this;
-  }
-
-  inline float RelativeTolerance() const { return relative_tolerance_; }
-
-  void Test(tflite::BuiltinOperator reduce_op, TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel(tflite::BuiltinOperator reduce_op) const;
-
-  static int32_t ComputeSize(const std::vector& shape);
-
-  std::vector input_shape_;
-  std::vector axes_;
-  int32_t input_size_;
-  bool keep_dims_ = true;
-  float relative_tolerance_ = 10.0f;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_REDUCE_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/reshape_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/reshape_tester.h
deleted file mode 100644
index 2265da8..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/reshape_tester.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_RESHAPE_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_RESHAPE_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class ReshapeTester {
- public:
-  ReshapeTester() = default;
-  ReshapeTester(const ReshapeTester&) = delete;
-  ReshapeTester& operator=(const ReshapeTester&) = delete;
-
-  inline ReshapeTester& InputShape(const std::vector& input_shape) {
-    for (int32_t input_dim : input_shape) {
-      EXPECT_GT(input_dim, 0);
-    }
-    input_shape_ = std::vector(input_shape.begin(), input_shape.end());
-    input_size_ = ReshapeTester::ComputeSize(input_shape);
-    return *this;
-  }
-
-  inline const std::vector& InputShape() const { return input_shape_; }
-
-  inline ReshapeTester& OutputShape(const std::vector& output_shape) {
-    for (int32_t output_dim : output_shape) {
-      EXPECT_GT(output_dim, 0);
-    }
-    output_shape_ =
-        std::vector(output_shape.begin(), output_shape.end());
-    output_size_ = ReshapeTester::ComputeSize(output_shape);
-    return *this;
-  }
-
-  inline const std::vector& OutputShape() const {
-    return output_shape_;
-  }
-
-  inline int32_t InputSize() const { return input_size_; }
-
-  inline int32_t OutputSize() const { return output_size_; }
-
-  inline ReshapeTester& OutputShapeAsInput(bool shape_as_input) {
-    shape_as_input_ = shape_as_input;
-    return *this;
-  }
-
-  inline bool OutputShapeAsInput() const { return shape_as_input_; }
-
-  void Test(TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel() const;
-
-  static int32_t ComputeSize(const std::vector& shape);
-
-  std::vector input_shape_;
-  std::vector output_shape_;
-  int32_t input_size_ = 1;
-  int32_t output_size_ = 1;
-  bool shape_as_input_ = false;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_RESHAPE_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/resize_bilinear_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/resize_bilinear_tester.h
deleted file mode 100644
index 6885fcf..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/resize_bilinear_tester.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_RESIZE_BILINEAR_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_RESIZE_BILINEAR_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class ResizeBilinearTester {
- public:
-  ResizeBilinearTester() = default;
-  ResizeBilinearTester(const ResizeBilinearTester&) = delete;
-  ResizeBilinearTester& operator=(const ResizeBilinearTester&) = delete;
-
-  inline ResizeBilinearTester& BatchSize(int32_t batch_size) {
-    EXPECT_GT(batch_size, 0);
-    batch_size_ = batch_size;
-    return *this;
-  }
-
-  inline int32_t BatchSize() const { return batch_size_; }
-
-  inline ResizeBilinearTester& Channels(int32_t channels) {
-    EXPECT_GT(channels, 0);
-    channels_ = channels;
-    return *this;
-  }
-
-  inline int32_t Channels() const { return channels_; }
-
-  inline ResizeBilinearTester& InputHeight(int32_t input_height) {
-    EXPECT_GT(input_height, 0);
-    input_height_ = input_height;
-    return *this;
-  }
-
-  inline int32_t InputHeight() const { return input_height_; }
-
-  inline ResizeBilinearTester& InputWidth(int32_t input_width) {
-    EXPECT_GT(input_width, 0);
-    input_width_ = input_width;
-    return *this;
-  }
-
-  inline int32_t InputWidth() const { return input_width_; }
-
-  inline ResizeBilinearTester& OutputHeight(int32_t output_height) {
-    EXPECT_GT(output_height, 0);
-    output_height_ = output_height;
-    return *this;
-  }
-
-  inline int32_t OutputHeight() const { return output_height_; }
-
-  inline ResizeBilinearTester& OutputWidth(int32_t output_width) {
-    EXPECT_GT(output_width, 0);
-    output_width_ = output_width;
-    return *this;
-  }
-
-  inline int32_t OutputWidth() const { return output_width_; }
-
-  ResizeBilinearTester& AlignCorners(bool align_corners) {
-    align_corners_ = align_corners;
-    return *this;
-  }
-
-  bool AlignCorners() const { return align_corners_; }
-
-  ResizeBilinearTester& HalfPixelCenters(bool half_pixel_centers) {
-    half_pixel_centers_ = half_pixel_centers;
-    return *this;
-  }
-
-  bool HalfPixelCenters() const { return half_pixel_centers_; }
-
-  void Test(TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel() const;
-
-  int32_t batch_size_ = 1;
-  int32_t channels_ = 1;
-  int32_t input_height_ = 1;
-  int32_t input_width_ = 1;
-  int32_t output_height_ = 1;
-  int32_t output_width_ = 1;
-  bool align_corners_ = false;
-  bool half_pixel_centers_ = false;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_RESIZE_BILINEAR_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/softmax_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/softmax_tester.h
deleted file mode 100644
index 674dc9a..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/softmax_tester.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_SOFTMAX_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_SOFTMAX_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class SoftmaxTester {
- public:
-  SoftmaxTester() = default;
-  SoftmaxTester(const SoftmaxTester&) = delete;
-  SoftmaxTester& operator=(const SoftmaxTester&) = delete;
-
-  inline SoftmaxTester& Shape(std::initializer_list shape) {
-    EXPECT_GT(shape.size(), 0);
-    for (auto it = shape.begin(); it != shape.end(); ++it) {
-      EXPECT_GT(*it, 0);
-    }
-    shape_ = std::vector(shape.begin(), shape.end());
-    size_ = SoftmaxTester::ComputeSize(shape_);
-    return *this;
-  }
-
-  const std::vector& Shape() const { return shape_; }
-
-  int32_t Size() const { return size_; }
-
-  inline SoftmaxTester& Beta(float beta) {
-    beta_ = beta;
-    return *this;
-  }
-
-  float Beta() const { return beta_; }
-
-  void Test(TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel() const;
-
-  static int32_t ComputeSize(const std::vector& shape);
-
-  std::vector shape_;
-  int32_t size_;
-  float beta_ = 1.0f;
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_SOFTMAX_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/unary_elementwise_tester.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/unary_elementwise_tester.h
deleted file mode 100644
index e3c210f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/unary_elementwise_tester.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_UNARY_ELEMENTWISE_TESTER_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_UNARY_ELEMENTWISE_TESTER_H_
-
-#include 
-#include 
-
-#include 
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-namespace xnnpack {
-
-class UnaryElementwiseTester {
- public:
-  UnaryElementwiseTester() = default;
-  UnaryElementwiseTester(const UnaryElementwiseTester&) = delete;
-  UnaryElementwiseTester& operator=(const UnaryElementwiseTester&) = delete;
-
-  inline UnaryElementwiseTester& Shape(std::initializer_list shape) {
-    for (auto it = shape.begin(); it != shape.end(); ++it) {
-      EXPECT_GT(*it, 0);
-    }
-    shape_ = std::vector(shape.begin(), shape.end());
-    size_ = UnaryElementwiseTester::ComputeSize(shape_);
-    return *this;
-  }
-
-  const std::vector& Shape() const { return shape_; }
-
-  int32_t Size() const { return size_; }
-
-  inline UnaryElementwiseTester& RelativeTolerance(float relative_tolerance) {
-    relative_tolerance_ = relative_tolerance;
-    return *this;
-  }
-
-  float RelativeTolerance() const { return relative_tolerance_; }
-
-  void Test(tflite::BuiltinOperator unary_op, TfLiteDelegate* delegate) const;
-
- private:
-  std::vector CreateTfLiteModel(tflite::BuiltinOperator unary_op) const;
-
-  static int32_t ComputeSize(const std::vector& shape);
-
-  std::vector shape_;
-  int32_t size_;
-  float relative_tolerance_{10.0f};
-};
-
-}  // namespace xnnpack
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_UNARY_ELEMENTWISE_TESTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h
deleted file mode 100644
index 983a22a..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/delegates/xnnpack/xnnpack_delegate.h
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_DELEGATES_XNNPACK_XNNPACK_DELEGATE_H_
-#define TENSORFLOW_LITE_DELEGATES_XNNPACK_XNNPACK_DELEGATE_H_
-
-#include "tensorflow/lite/c/common.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif  // __cplusplus
-
-typedef struct {
-  // Number of threads to use in the thread pool.
-  // 0 or negative value means no thread pool used.
-  int32_t num_threads;
-} TfLiteXNNPackDelegateOptions;
-
-// Returns a structure with the default XNNPack delegate options.
-TfLiteXNNPackDelegateOptions TfLiteXNNPackDelegateOptionsDefault();
-
-// Creates a new delegate instance that need to be destroyed with
-// `TfLiteXNNPackDelegateDelete` when delegate is no longer used by TFLite.
-// When `options` is set to `nullptr`, the following default values are used:
-TfLiteDelegate* TfLiteXNNPackDelegateCreate(
-    const TfLiteXNNPackDelegateOptions* options);
-
-// Destroys a delegate created with `TfLiteXNNPackDelegateCreate` call.
-void TfLiteXNNPackDelegateDelete(TfLiteDelegate* delegate);
-
-#ifdef __cplusplus
-}
-#endif  // __cplusplus
-
-#endif  // TENSORFLOW_LITE_DELEGATES_XNNPACK_XNNPACK_DELEGATE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/error_reporter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/error_reporter.h
deleted file mode 100644
index 38518d6..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/error_reporter.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/* Copyright 2017 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.
-==============================================================================*/
-// Compatibility shim for moved header location.
-#ifndef TENSORFLOW_LITE_ERROR_REPORTER_H_
-#define TENSORFLOW_LITE_ERROR_REPORTER_H_
-
-#include "tensorflow/lite/core/api/error_reporter.h"
-#include "tensorflow/lite/stderr_reporter.h"
-
-#endif  // TENSORFLOW_LITE_ERROR_REPORTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/lookup_interfaces.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/lookup_interfaces.h
deleted file mode 100644
index cc62aaf..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/lookup_interfaces.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* 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_EXPERIMENTAL_RESOURCE_LOOKUP_INTERFACES_H_
-#define TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_LOOKUP_INTERFACES_H_
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/experimental/resource/lookup_util.h"
-#include "tensorflow/lite/experimental/resource/resource_base.h"
-#include "tensorflow/lite/kernels/internal/tensor_ctypes.h"
-#include "tensorflow/lite/string_util.h"
-
-namespace tflite {
-namespace resource {
-
-/// WARNING: Experimental interface, subject to change.
-// A resource hash table interface. It's similar to TensorFlow core's
-// LookupInterface class. But it's identified with int32 ID in TFLite (instead
-// of using Resource handle like TensorFlow).
-class LookupInterface : public ResourceBase {
- public:
-  virtual TfLiteStatus Lookup(TfLiteContext* context, const TfLiteTensor* keys,
-                              TfLiteTensor* values,
-                              const TfLiteTensor* default_value) = 0;
-  virtual TfLiteStatus Import(TfLiteContext* context, const TfLiteTensor* keys,
-                              const TfLiteTensor* values) = 0;
-  virtual size_t Size() = 0;
-
-  virtual TfLiteType GetKeyType() const = 0;
-  virtual TfLiteType GetValueType() const = 0;
-  virtual TfLiteStatus CheckKeyAndValueTypes(TfLiteContext* context,
-                                             const TfLiteTensor* keys,
-                                             const TfLiteTensor* values) = 0;
-};
-
-// Creates an resource hash table, shared among all the subgraphs with the
-// given resource id if there is an existing one.
-// WARNING: Experimental interface, subject to change.
-void CreateHashtableResourceIfNotAvailable(ResourceMap* resources,
-                                           int resource_id,
-                                           TfLiteType key_dtype,
-                                           TfLiteType value_dtype);
-
-// Returns the corresponding resource hash table, or nullptr if none.
-// WARNING: Experimental interface, subject to change.
-LookupInterface* GetHashtableResource(ResourceMap* resources, int resource_id);
-
-}  // namespace resource
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_LOOKUP_INTERFACES_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/lookup_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/lookup_util.h
deleted file mode 100644
index 3bf53d7..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/lookup_util.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* 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_EXPERIMENTAL_RESOURCE_LOOKUP_UTIL_H_
-#define TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_LOOKUP_UTIL_H_
-
-#include "tensorflow/lite/kernels/internal/tensor_ctypes.h"
-#include "tensorflow/lite/string_util.h"
-
-namespace tflite {
-namespace resource {
-namespace internal {
-
-/// Helper class for accessing TFLite tensor data.
-template 
-class TensorReader {
- public:
-  explicit TensorReader(const TfLiteTensor* input) {
-    input_data_ = GetTensorData(input);
-  }
-
-  // Returns the corresponding scalar data at the given index position.
-  // In here, it does not check the validity of the index should be guaranteed
-  // in order not to harm the performance. Caller should take care of it.
-  T GetData(int index) { return input_data_[index]; }
-
- private:
-  const T* input_data_;
-};
-
-/// Helper class for accessing TFLite tensor data. This specialized class is for
-/// std::string type.
-template <>
-class TensorReader {
- public:
-  explicit TensorReader(const TfLiteTensor* input) : input_(input) {}
-
-  // Returns the corresponding string data at the given index position.
-  // In here, it does not check the validity of the index should be guaranteed
-  // in order not to harm the performance. Caller should take care of it.
-  std::string GetData(int index) {
-    auto string_ref = GetString(input_, index);
-    return std::string(string_ref.str, string_ref.len);
-  }
-
- private:
-  const TfLiteTensor* input_;
-};
-
-/// WARNING: Experimental interface, subject to change.
-/// Helper class for writing TFLite tensor data.
-template 
-class TensorWriter {
- public:
-  explicit TensorWriter(TfLiteTensor* values) {
-    output_data_ = GetTensorData(values);
-  }
-
-  // Sets the given value to the given index position of the tensor storage.
-  // In here, it does not check the validity of the index should be guaranteed
-  // in order not to harm the performance. Caller should take care of it.
-  void SetData(int index, ValueType& value) { output_data_[index] = value; }
-
-  // Commit updates. In this case, it does nothing since the SetData method
-  // writes data directly.
-  void Commit() {
-    // Noop.
-  }
-
- private:
-  ValueType* output_data_;
-};
-
-/// WARNING: Experimental interface, subject to change.
-/// Helper class for writing TFLite tensor data. This specialized class is for
-/// std::string type.
-template <>
-class TensorWriter {
- public:
-  explicit TensorWriter(TfLiteTensor* values) : values_(values) {}
-
-  // Queues the given string value to the buffer regardless of the provided
-  // index.
-  // In here, it does not check the validity of the index should be guaranteed
-  // in order not to harm the performance. Caller should take care of it.
-  void SetData(int index, const std::string& value) {
-    buf_.AddString(value.data(), value.length());
-  }
-
-  // Commit updates. The stored data in DynamicBuffer will be written into the
-  // tensor storage.
-  void Commit() { buf_.WriteToTensor(values_, nullptr); }
-
- private:
-  TfLiteTensor* values_;
-  DynamicBuffer buf_;
-};
-
-}  // namespace internal
-}  // namespace resource
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_LOOKUP_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/resource_base.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/resource_base.h
deleted file mode 100644
index ff69c3a..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/resource_base.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* 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_EXPERIMENTAL_RESOURCE_RESOURCE_BASE_H_
-#define TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_RESOURCE_BASE_H_
-
-#include 
-#include 
-#include 
-
-namespace tflite {
-namespace resource {
-
-// ResourceBase is an abstract base class for resources.
-/// WARNING: Experimental interface, subject to change.
-class ResourceBase {
- public:
-  explicit ResourceBase() {}
-  virtual ~ResourceBase() {}
-
-  // Returns true if it is initialized.
-  virtual bool IsInitialized() = 0;
-};
-
-/// WARNING: Experimental interface, subject to change.
-using ResourceMap =
-    std::unordered_map>;
-
-}  // namespace resource
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_RESOURCE_BASE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/resource_variable.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/resource_variable.h
deleted file mode 100644
index c48134d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/resource_variable.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* 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_EXPERIMENTAL_RESOURCE_RESOURCE_VARIABLE_H_
-#define TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_RESOURCE_VARIABLE_H_
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/experimental/resource/resource_base.h"
-
-namespace tflite {
-namespace resource {
-
-/// WARNING: Experimental interface, subject to change.
-// A resource variable class. It's similar to TensorFlow Resource
-// Variable, but it's identified with int32 ID in TFLite (instead of
-// using Resource handle like TensorFlow).
-//
-// TODO(b/137042749): TFLite converter cannot convert variables yet.
-// Variable functionalities are only tested with unit tests now.
-class ResourceVariable : public ResourceBase {
- public:
-  ResourceVariable();
-  ResourceVariable(ResourceVariable&& other);
-
-  ResourceVariable(const ResourceVariable&) = delete;
-  ResourceVariable& operator=(const ResourceVariable&) = delete;
-
-  ~ResourceVariable() override;
-
-  // Assigns data from a tensor. Copies its type, shape and data over.
-  TfLiteStatus AssignFrom(const TfLiteTensor* tensor);
-
-  // Get the data tensor stored in the resource variable.
-  // Returns `nullptr` if the variable is never initialized by calling
-  // `AssignFrom`.
-  TfLiteTensor* GetTensor() { return is_initialized_ ? &tensor_ : nullptr; }
-
-  // Returns true if this resource variable is initialized.
-  bool IsInitialized() override { return is_initialized_; }
-
- private:
-  // The tensor (and its buffer stored in `tensor_.data` is fully owned by
-  // the `ResourceVariable` object.
-  TfLiteTensor tensor_;
-  // True if `AssignFrom` function is every called.
-  // False if and only if `tensor_` is filled with zeros.
-  bool is_initialized_ = false;
-};
-
-// Creates a resource variable, shared among all the subgraphs with the given
-// resource id if there is an existing one.
-// WARNING: Experimental interface, subject to change.
-void CreateResourceVariableIfNotAvailable(ResourceMap* resources,
-                                          int resource_id);
-
-// Returns the corresponding resource variable, or nullptr if none.
-// WARNING: Experimental interface, subject to change.
-ResourceVariable* GetResourceVariable(ResourceMap* resources, int resource_id);
-
-}  // namespace resource
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_RESOURCE_VARIABLE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/static_hashtable.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/static_hashtable.h
deleted file mode 100644
index 9df0217..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/experimental/resource/static_hashtable.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* 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_EXPERIMENTAL_RESOURCE_STATIC_HASHTABLE_H_
-#define TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_STATIC_HASHTABLE_H_
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/experimental/resource/lookup_interfaces.h"
-#include "tensorflow/lite/experimental/resource/lookup_util.h"
-#include "tensorflow/lite/experimental/resource/resource_base.h"
-#include "tensorflow/lite/kernels/internal/tensor_ctypes.h"
-#include "tensorflow/lite/string_util.h"
-
-namespace tflite {
-namespace resource {
-namespace internal {
-
-// A static hash table class. This hash table allows initialization one time in
-// its life cycle. This hash table implements Tensorflow core's HashTableV2 op.
-template 
-class StaticHashtable : public tflite::resource::LookupInterface {
- public:
-  explicit StaticHashtable(TfLiteType key_type, TfLiteType value_type)
-      : key_type_(key_type), value_type_(value_type) {}
-  ~StaticHashtable() override {}
-
-  // Finds the corresponding value of the given keys tensor in the map and
-  // copies the result data to the given values tensor. If there is no matching
-  // value, it will write the default value into the matched position instead.
-  TfLiteStatus Lookup(TfLiteContext* context, const TfLiteTensor* keys,
-                      TfLiteTensor* values,
-                      const TfLiteTensor* default_value) override;
-
-  // Inserts the given key and value tensor data into the hash table.
-  TfLiteStatus Import(TfLiteContext* context, const TfLiteTensor* keys,
-                      const TfLiteTensor* values) override;
-
-  // Returns the item size of the hash table.
-  size_t Size() override { return map_.size(); }
-
-  TfLiteType GetKeyType() const override { return key_type_; }
-  TfLiteType GetValueType() const override { return value_type_; }
-
-  TfLiteStatus CheckKeyAndValueTypes(TfLiteContext* context,
-                                     const TfLiteTensor* keys,
-                                     const TfLiteTensor* values) override {
-    TF_LITE_ENSURE_EQ(context, keys->type, key_type_);
-    TF_LITE_ENSURE_EQ(context, values->type, value_type_);
-    return kTfLiteOk;
-  }
-
-  // Returns true if the hash table is initialized.
-  bool IsInitialized() override { return is_initialized_; }
-
- private:
-  TfLiteType key_type_;
-  TfLiteType value_type_;
-
-  std::unordered_map map_;
-  bool is_initialized_ = false;
-};
-
-::tflite::resource::LookupInterface* CreateStaticHashtable(
-    TfLiteType key_type, TfLiteType value_type);
-
-}  // namespace internal
-
-}  // namespace resource
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_EXPERIMENTAL_RESOURCE_STATIC_HASHTABLE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/external_cpu_backend_context.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/external_cpu_backend_context.h
deleted file mode 100644
index 662734c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/external_cpu_backend_context.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* 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_EXTERNAL_CPU_BACKEND_CONTEXT_H_
-#define TENSORFLOW_LITE_EXTERNAL_CPU_BACKEND_CONTEXT_H_
-
-#include 
-#include 
-
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-
-// This is the base class for TF Lite internal backend contexts (like a
-// RUY-based cpu backend context class). A derived internal backend context is
-// generally a collection of utilities (i.e. a thread pool etc.) for TF Lite to
-// use certain kernel libraries, such as Gemmlowp, RUY, etc., to implement TF
-// Lite operators.
-class TfLiteInternalBackendContext {
- public:
-  virtual ~TfLiteInternalBackendContext() {}
-
-  // Set the maximum number of threads that could be used for parallelizing
-  // TfLite computation.
-  virtual void SetMaxNumThreads(int max_num_threads) = 0;
-
-  // A context may internally cache prepacked versions of constant tensors for
-  // faster computation. This function will clear any caches on the context.
-  virtual void ClearCaches() = 0;
-};
-
-// This TfLiteExternalContext-derived class is the default
-// 'kTfLiteCpuBackendContext'-typed context that's used internally in TF Lite
-// framework. The primary purpose of having this class is to allow the same cpu
-// backend context to be sharable among a set of TF Lite interpreters so that
-// certain system costs are saved, like saving the cost of having multiple
-// thread pools in each separate cpu backend context etc..
-//
-// Note: as of 2019/07/19, such context sharing among a set of interpreters will
-// break the execution if these interpreters are invoked simultaneously. It
-// works only when these context-sharing interpreters are invoked in a
-// serialized way. Here's an example to illustrate the context sharing among 2
-// TF Lite interpreters:
-//
-//  TfLiteExternalContext* global_ctxt = new ExternalCpuBackendContext();
-//  interpreter1 = /*...*/;
-//  interpreter1->SetExternalContext(kTfLiteCpuBackendContext, global_ctxt);
-//  interpreter2 = /*...*/;
-//  interpreter2->SetExternalContext(kTfLiteCpuBackendContext, global_ctxt);
-//
-//  interpreter1->SetNumThreads(2);
-//  interpreter1->Invoke();
-//
-//  interpreter2->SetNumThreads(4);
-//  interpreter2->Invoke();
-//
-// After sharing the context, calling 'SetNumThreads' on any of the
-// context-sharing interpreters will have the global impact as it also refreshes
-// the #thread info in the global cpu backend context (i.e. 'global_ctxt' above)
-// that affects how much parallelism an interpreter invocation will use.
-// Therefore, if different number of threads are used among different
-// interpreters, don't call 'SetNumThreads' consecutively but call it
-// separately between each interpreter's invocation as illustrated above.
-//
-// Note: it is the responsibility of the user of this context (i.e. a
-// TFLiteInterpreter) to clear any state from the internal backend
-// context if/when the interpreter no longer needs the shared context.
-// See, e.g., TFLiteInterpreter destructor clears caches in the case of a
-// shared ExternalCpuBackendContext.
-class ExternalCpuBackendContext : public TfLiteExternalContext {
- public:
-  ExternalCpuBackendContext();
-  ~ExternalCpuBackendContext() {}
-
-  void set_internal_backend_context(
-      std::unique_ptr internal_backend_context) {
-    internal_backend_context_ = std::move(internal_backend_context);
-  }
-
-  TfLiteInternalBackendContext* internal_backend_context() const {
-    return internal_backend_context_.get();
-  }
-
- private:
-  // Note the actual internal backend context object is lazily initialized.
-  std::unique_ptr internal_backend_context_;
-
-  ExternalCpuBackendContext(const ExternalCpuBackendContext&) = delete;
-  ExternalCpuBackendContext& operator=(const ExternalCpuBackendContext&) =
-      delete;
-};
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_EXTERNAL_CPU_BACKEND_CONTEXT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/graph_info.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/graph_info.h
deleted file mode 100644
index 2236f99..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/graph_info.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright 2017 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_GRAPH_INFO_H_
-#define TENSORFLOW_LITE_GRAPH_INFO_H_
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-
-// Basic information about an inference graph, where execution nodes
-// are connected via tensors.
-class GraphInfo {
- public:
-  virtual ~GraphInfo() {}
-
-  // Total number of tensors in the graph.
-  virtual size_t num_tensors() const = 0;
-
-  // Returns a tensor given its index which is expected to be between 0 and
-  // num_tensors().
-  virtual TfLiteTensor* tensor(size_t index) = 0;
-
-  // Number of nodes in the current execution plan.
-  virtual size_t num_execution_nodes() const = 0;
-
-  // Total number of known nodes, which may include nodes that are no longer in
-  // the execution plan. This happens in case of applying multiple delegates.
-  // Should be >= num_execution_nodes()
-  virtual size_t num_total_nodes() const = 0;
-
-  // Returns a node given its index in the execution plan, which is expected to
-  // be between 0 and num_execution_nodes().
-  virtual const TfLiteNode& node(size_t index) const = 0;
-
-  // Returns an implementation-specific node index which may be different from
-  // execution-plan index.
-  // Expected to be between 0 and num_total_nodes().
-  virtual size_t node_index(size_t index) const = 0;
-
-  // Returns the indices of the input tensors.
-  virtual const std::vector& inputs() const = 0;
-
-  // Returns the indices of the output tensors.
-  virtual const std::vector& outputs() const = 0;
-
-  // Returns the indices of the variable tensors.
-  virtual const std::vector& variables() const = 0;
-};
-
-// Represents a subset of nodes in a TensorFlow Lite graph.
-struct NodeSubset {
-  enum Type {
-    kTfUnexplored = 0,  // temporarily used during creation
-    kTfPartition,
-    kTfNonPartition
-  };
-  Type type = kTfUnexplored;
-  // Nodes within the node sub set
-  std::vector nodes;
-  // Tensors that stride output from another node sub set that this depends on,
-  // or global inputs to the TensorFlow Lite full graph.
-  std::vector input_tensors;
-  // Outputs that are consumed by other node sub sets or are global output
-  // tensors. All output tensors of the nodes in the node sub set that do not
-  // appear in this list are intermediate results that can be potentially
-  // elided.
-  std::vector output_tensors;
-};
-
-// Partitions a list of node indices `nodes_to_partition` into node sub sets.
-// Each node sub set is in dependency order (i.e. all members of the node sub
-// sets). `node_subsets` is assumed to be empty.
-TfLiteStatus PartitionGraphIntoIndependentNodeSubsets(
-    const GraphInfo* info, const TfLiteIntArray* nodes_to_partition,
-    std::vector* node_subsets);
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_GRAPH_INFO_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/interpreter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/interpreter.h
deleted file mode 100644
index 65febd4..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/interpreter.h
+++ /dev/null
@@ -1,667 +0,0 @@
-/* Copyright 2017 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.
-==============================================================================*/
-/// \file
-/// Main abstraction controlling the tflite interpreter.
-/// See context.h for the API for defining operations (TfLiteRegistration).
-#ifndef TENSORFLOW_LITE_INTERPRETER_H_
-#define TENSORFLOW_LITE_INTERPRETER_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/allocation.h"
-#include "tensorflow/lite/c/common.h"  // IWYU pragma: export
-#include "tensorflow/lite/core/api/error_reporter.h"
-#include "tensorflow/lite/core/api/profiler.h"
-#include "tensorflow/lite/core/subgraph.h"
-#include "tensorflow/lite/experimental/resource/resource_base.h"
-#include "tensorflow/lite/external_cpu_backend_context.h"
-#include "tensorflow/lite/memory_planner.h"
-#include "tensorflow/lite/stderr_reporter.h"
-#include "tensorflow/lite/type_to_tflitetype.h"
-
-namespace tflite {
-
-class InterpreterTest;
-class TestDelegate;
-namespace delegates {
-class InterpreterUtils;  // Class for friend declarations.
-}  // namespace delegates
-
-/// An interpreter for a graph of nodes that input and output from tensors.
-/// Each node of the graph processes a set of input tensors and produces a
-/// set of output Tensors. All inputs/output tensors are referenced by index.
-///
-/// Usage:
-///
-/// 

-/// // Create model from file. Note that the model instance must outlive the
-/// // interpreter instance.
-/// auto model = tflite::FlatBufferModel::BuildFromFile(...);
-/// if (model == nullptr) {
-///   // Return error.
-/// }
-/// // Create an Interpreter with an InterpreterBuilder.
-/// std::unique_ptr interpreter;
-/// tflite::ops::builtin::BuiltinOpResolver resolver;
-/// if (InterpreterBuilder(*model, resolver)(&interpreter) != kTfLiteOk) {
-///   // Return failure.
-/// }
-/// interpreter->AllocateTensors();
-///
-/// auto input = interpreter->typed_tensor(0);
-/// for (int i = 0; i < input_size; i++) {
-///   input[i] = ...;
-//  }
-/// interpreter.Invoke();
-/// 
-///
-/// Note: for nearly all practical use cases, one should not directly construct
-/// an Interpreter object, but rather use the InterpreterBuilder.
-
-class Interpreter {
- public:
-  // Instantiate an interpreter. All errors associated with reading and
-  // processing this model will be forwarded to the error_reporter object.
-  //
-  // Note, if error_reporter is nullptr, then a default StderrReporter is
-  // used. Ownership of 'error_reporter' remains with the caller.
-  // WARNING: Use of this constructor outside of an InterpreterBuilder is not
-  // recommended.
-  explicit Interpreter(ErrorReporter* error_reporter = DefaultErrorReporter());
-
-  ~Interpreter();
-
-  // Interpreters are not copyable as they have non-trivial memory semantics.
-  Interpreter(const Interpreter&) = delete;
-  Interpreter& operator=(const Interpreter&) = delete;
-
-  // Functions to build interpreter
-#ifndef DOXYGEN_SKIP
-  /// Provide a list of tensor indexes that are inputs to the model.
-  /// Each index is bound check and this modifies the consistent_ flag of the
-  /// interpreter.
-  TfLiteStatus SetInputs(std::vector inputs);
-
-  /// Provide a list of tensor indexes that are outputs to the model
-  /// Each index is bound check and this modifies the consistent_ flag of the
-  /// interpreter.
-  TfLiteStatus SetOutputs(std::vector outputs);
-
-  /// Provide a list of tensor indexes that are variable tensors.
-  /// Each index is bound check and this modifies the consistent_ flag of the
-  /// interpreter.
-  TfLiteStatus SetVariables(std::vector variables);
-
-  /// Ensure the internal node storage memory allocates at least `count`
-  /// spots for node. NOTE, this doesn't actually add operators. This is an
-  /// efficiency optimization that is subject to change.
-  void ReserveNodes(int count);
-
-  /// Adds a node with the given parameters and returns the index of the new
-  /// node in `node_index` (optionally). Interpreter will take ownership of
-  /// `builtin_data` and destroy it with `free`. Ownership of 'init_data'
-  /// remains with the caller.
-  TfLiteStatus AddNodeWithParameters(const std::vector& inputs,
-                                     const std::vector& outputs,
-                                     const char* init_data,
-                                     size_t init_data_size, void* builtin_data,
-                                     const TfLiteRegistration* registration,
-                                     int* node_index = nullptr);
-
-  /// Adds `tensors_to_add` tensors, preserving pre-existing Tensor entries.
-  /// The value pointed to by `first_new_tensor_index` will be set to the
-  /// index of the first new tensor if `first_new_tensor_index` is non-null.
-  TfLiteStatus AddTensors(int tensors_to_add,
-                          int* first_new_tensor_index = nullptr);
-
-  /// Set description of inputs/outputs/data/fptrs for node `node_index`.
-  /// This variant assumes an external buffer has been allocated of size
-  /// bytes. The lifetime of buffer must be ensured to be greater or equal
-  /// to Interpreter.
-  TfLiteStatus SetTensorParametersReadOnly(
-      int tensor_index, TfLiteType type, const char* name,
-      const std::vector& dims, TfLiteQuantization quantization,
-      const char* buffer, size_t bytes, const Allocation* allocation = nullptr);
-
-  /// Legacy. Deprecated in favor of above.
-  inline TfLiteStatus SetTensorParametersReadOnly(
-      int tensor_index, TfLiteType type, const char* name,
-      const std::vector& dims, TfLiteQuantizationParams quantization,
-      const char* buffer, size_t bytes,
-      const Allocation* allocation = nullptr) {
-    return SetTensorParametersReadOnly(tensor_index, type, name, dims.size(),
-                                       dims.data(), quantization, buffer, bytes,
-                                       allocation);
-  }
-
-  TfLiteStatus SetTensorParametersReadOnly(
-      int tensor_index, TfLiteType type, const char* name, const size_t rank,
-      const int* dims, TfLiteQuantizationParams quantization,
-      const char* buffer, size_t bytes, const Allocation* allocation = nullptr);
-
-  /// Set description of inputs/outputs/data/fptrs for node `node_index`.
-  /// This variant assumes an external buffer has been allocated of size
-  /// bytes. The lifetime of buffer must be ensured to be greater or equal
-  /// to Interpreter.
-  TfLiteStatus SetTensorParametersReadWrite(int tensor_index, TfLiteType type,
-                                            const char* name,
-                                            const std::vector& dims,
-                                            TfLiteQuantization quantization,
-                                            bool is_variable = false);
-
-  /// Legacy. Deprecated in favor of above.
-  inline TfLiteStatus SetTensorParametersReadWrite(
-      int tensor_index, TfLiteType type, const char* name,
-      const std::vector& dims, TfLiteQuantizationParams quantization,
-      bool is_variable = false,
-      const std::vector* dims_signature = nullptr) {
-    size_t rank_dims_signature = 0;
-    const int* dims_signature_pointer = nullptr;
-    if (dims_signature) {
-      rank_dims_signature = dims_signature->size();
-      dims_signature_pointer = dims_signature->data();
-    }
-    return SetTensorParametersReadWrite(
-        tensor_index, type, name, dims.size(), dims.data(), quantization,
-        is_variable, rank_dims_signature, dims_signature_pointer);
-  }
-  TfLiteStatus SetTensorParametersReadWrite(
-      int tensor_index, TfLiteType type, const char* name, const size_t rank,
-      const int* dims, TfLiteQuantizationParams quantization,
-      bool is_variable = false, const size_t rank_dims_signature = 0,
-      const int* dims_signature = nullptr);
-#endif  // DOXYGEN_SKIP
-  // Functions to access tensor data
-
-  /// Read only access to list of inputs.
-  const std::vector& inputs() const { return primary_subgraph().inputs(); }
-
-  /// Return the name of a given input. The given index must be between 0 and
-  /// inputs().size().
-  const char* GetInputName(int index) const {
-    return context_->tensors[inputs()[index]].name;
-  }
-
-  /// Read only access to list of outputs.
-  const std::vector& outputs() const {
-    return primary_subgraph().outputs();
-  }
-
-  /// Read only access to list of variable tensors.
-  const std::vector& variables() const {
-    return primary_subgraph().variables();
-  }
-
-  /// Return the name of a given output. The given index must be between 0 and
-  /// outputs().size().
-  const char* GetOutputName(int index) const {
-    return context_->tensors[outputs()[index]].name;
-  }
-
-  /// Return the number of tensors in the model.
-  size_t tensors_size() const { return context_->tensors_size; }
-
-  /// Return the number of ops in the model.
-  size_t nodes_size() const { return primary_subgraph().nodes_size(); }
-
-  /// WARNING: Experimental interface, subject to change
-  const std::vector& execution_plan() const {
-    return primary_subgraph().execution_plan();
-  }
-
-#ifndef DOXYGEN_
-  /// WARNING: Experimental interface, subject to change
-  /// Overrides execution plan. This bounds checks indices sent in.
-  TfLiteStatus SetExecutionPlan(const std::vector& new_plan);
-#endif  // DOXYGEN_SKIP
-
-  /// Get a mutable tensor data structure.
-  // TODO(aselle): Create a safe ArrayHandle interface to avoid exposing this
-  // read/write access to structure
-  TfLiteTensor* tensor(int tensor_index) {
-    return primary_subgraph().tensor(tensor_index);
-  }
-
-  /// Get an immutable tensor data structure.
-  const TfLiteTensor* tensor(int tensor_index) const {
-    return primary_subgraph().tensor(tensor_index);
-  }
-
-  /// Get a pointer to an operation and registration data structure if in
-  /// bounds.
-  const std::pair* node_and_registration(
-      int node_index) const {
-    return primary_subgraph().node_and_registration(node_index);
-  }
-
-  /// Perform a checked cast to the appropriate tensor type (mutable pointer
-  /// version).
-  template 
-  T* typed_tensor(int tensor_index) {
-    if (TfLiteTensor* tensor_ptr = tensor(tensor_index)) {
-      if (tensor_ptr->type == typeToTfLiteType()) {
-        return reinterpret_cast(tensor_ptr->data.raw);
-      }
-    }
-    return nullptr;
-  }
-
-  /// Perform a checked cast to the appropriate tensor type (immutable pointer
-  /// version).
-  template 
-  const T* typed_tensor(int tensor_index) const {
-    if (const TfLiteTensor* tensor_ptr = tensor(tensor_index)) {
-      if (tensor_ptr->type == typeToTfLiteType()) {
-        return reinterpret_cast(tensor_ptr->data.raw);
-      }
-    }
-    return nullptr;
-  }
-
-  /// Return a mutable pointer to the given input tensor. The given index must
-  /// be between 0 and inputs().size().
-  TfLiteTensor* input_tensor(size_t index) { return tensor(inputs()[index]); }
-
-  /// Return an immutable pointerto the given input tensor. The given index must
-  /// be between 0 and inputs().size().
-  const TfLiteTensor* input_tensor(size_t index) const {
-    return tensor(inputs()[index]);
-  }
-
-  /// Return a mutable pointer into the data of a given input tensor. The given
-  /// index must be between 0 and inputs().size().
-  template 
-  T* typed_input_tensor(int index) {
-    return typed_tensor(inputs()[index]);
-  }
-
-  /// Return an immutable pointer into the data of a given input tensor. The
-  /// given index must be between 0 and inputs().size().
-  template 
-  const T* typed_input_tensor(int index) const {
-    return typed_tensor(inputs()[index]);
-  }
-
-  /// Return a mutable pointer to the given output tensor. The given index must
-  /// be between 0 and outputs().size().
-  TfLiteTensor* output_tensor(size_t index) { return tensor(outputs()[index]); }
-
-  /// Return an immutable pointer to the given output tensor. The given index
-  /// must be between 0 and outputs().size().
-  const TfLiteTensor* output_tensor(size_t index) const {
-    return tensor(outputs()[index]);
-  }
-
-  /// Return a mutable pointer into the data of a given output tensor. The given
-  /// index must be between 0 and outputs().size().
-  template 
-  T* typed_output_tensor(int index) {
-    return typed_tensor(outputs()[index]);
-  }
-
-  /// Return an immutable pointer into the data of a given output tensor. The
-  /// given index must be between 0 and outputs().size().
-  template 
-  const T* typed_output_tensor(int index) const {
-    return typed_tensor(outputs()[index]);
-  }
-
-  /// Change the dimensionality of a given tensor. Note, this is only acceptable
-  /// for tensor indices that are inputs or variables.
-  /// Returns status of failure or success. Note that this doesn't actually
-  /// resize any existing buffers. A call to AllocateTensors() is required to
-  /// change the tensor input buffer.
-  TfLiteStatus ResizeInputTensor(int tensor_index,
-                                 const std::vector& dims);
-
-  // WARNING: Experimental interface, subject to change
-  // Change the dimensionality of a given tensor. This is only acceptable for
-  // tensor indices that are inputs or variables. Only unknown dimensions can be
-  // resized with this function. Unknown dimensions are indicated as `-1` in the
-  // `dims_signature` attribute of a `TfLiteTensor`. Returns status of failure
-  // or success.  Note that this doesn't actually resize any existing buffers.
-  /// A call to AllocateTensors() is required to change the tensor input buffer.
-  TfLiteStatus ResizeInputTensorStrict(int tensor_index,
-                                       const std::vector& dims);
-
-  // This releases memory held by non-persistent tensors. It does NOT re-perform
-  // memory planning.
-  // AllocateTensors needs to be called before next invocation.
-  /// WARNING: Experimental interface, subject to change
-  TfLiteStatus ReleaseNonPersistentMemory();
-
-  // Update allocations for all tensors. This will redim dependent tensors
-  // using the input tensor dimensionality as given. This is relatively
-  // expensive. This *must be* called after the interpreter has been created
-  // and before running inference (and accessing tensor buffers), and *must be*
-  // called again if (and only if) an input tensor is resized. Returns status of
-  // success or failure.
-  TfLiteStatus AllocateTensors();
-
-  /// Invoke the interpreter (run the whole graph in dependency order).
-  ///
-  /// NOTE: It is possible that the interpreter is not in a ready state
-  /// to evaluate (i.e. if a ResizeTensor() has been performed without an
-  /// AllocateTensors().
-  /// Returns status of success or failure.
-  TfLiteStatus Invoke();
-
-  /// Enable or disable NNAPI (true to enable). Disabled by default.
-  ///
-  /// WARNING: NNAPI cannot be disabled after the graph has been prepared
-  /// (via `AllocateTensors`) with NNAPI enabled.
-  ///
-  /// WARNING: This API is deprecated, prefer using the NNAPI delegate directly.
-  /// This method will be removed in a future release.
-  void UseNNAPI(bool enable);
-
-  /// Set the number of threads available to the interpreter.
-  ///
-  /// NOTE: num_threads should be >= -1.
-  /// User may pass -1 to let the TFLite interpreter set the no of threads
-  /// available to itself.
-  TfLiteStatus SetNumThreads(int num_threads);
-
-  /// Allow float16 precision for FP32 calculation when possible.
-  /// Default: not allow.
-  ///
-  /// WARNING: This API is deprecated: prefer controlling this via delegate
-  /// options, e.g. `tflite::StatefulNnApiDelegate::Options::allow_fp16' or
-  /// `TfLiteGpuDelegateOptionsV2::is_precision_loss_allowed`.
-  /// This method will be removed in a future release.
-  void SetAllowFp16PrecisionForFp32(bool allow);
-
-  /// Get the half precision flag.
-  /// WARNING: This is an experimental API and subject to change.
-  bool GetAllowFp16PrecisionForFp32() const {
-    return context_->allow_fp32_relax_to_fp16;
-  }
-
-  /// Sets the cancellation function pointer in order to cancel a request in the
-  /// middle of a call to Invoke(). The interpreter queries this function during
-  /// inference, between op invocations; when it returns true, the interpreter
-  /// will abort execution and return `kTfLiteError`. The `data` parameter
-  /// contains any data used by the cancellation function, and if non-null,
-  /// remains owned by the caller.
-  /// WARNING: This is an experimental API and subject to change.
-  void SetCancellationFunction(void* data, bool (*check_cancelled_func)(void*));
-
-  /// Allow a delegate to look at the graph and modify the graph to handle
-  /// parts of the graph themselves. After this is called, the graph may
-  /// contain new nodes that replace 1 more nodes.
-  /// 'delegate' must outlive the interpreter.
-  /// Returns one of the following three status codes:
-  /// 1. kTfLiteOk: Success.
-  /// 2. kTfLiteDelegateError: Delegation failed due to an error in the
-  /// delegate. The Interpreter has been restored to its pre-delegation state.
-  /// NOTE: This undoes all delegates previously applied to the Interpreter.
-  /// 3. kTfLiteApplicationError : Delegation failed to be applied due to the
-  /// incompatibility with the TfLite runtime, e.g., the model graph is already
-  /// immutable when applying the delegate. However, the interpreter could still
-  /// be invoked.
-  /// 4. kTfLiteError: Unexpected/runtime failure.
-  /// WARNING: This is an experimental API and subject to change.
-  TfLiteStatus ModifyGraphWithDelegate(TfLiteDelegate* delegate);
-
-  // Owning handle to a TfLiteDelegate instance.
-  using TfLiteDelegatePtr =
-      std::unique_ptr;
-
-  /// Same as ModifyGraphWithDelegate except this interpreter takes
-  /// ownership of the provided delegate.
-  /// WARNING: This is an experimental API and subject to change.
-  template 
-  inline TfLiteStatus ModifyGraphWithDelegate(
-      std::unique_ptr delegate) {
-    Deleter deleter = std::move(delegate.get_deleter());
-
-    // Note that we retain ownership of the delegate even if graph modification
-    // fails, as delegate use will be in an indeterminate state at that point.
-    owned_delegates_.emplace_back(
-        delegate.release(), [deleter](TfLiteDelegate* delegate_to_delete) {
-          deleter(
-              static_cast::pointer>(
-                  delegate_to_delete));
-        });
-    return ModifyGraphWithDelegate(owned_delegates_.back().get());
-  }
-
-  /// This overload is *never* OK. TfLiteDelegate is a C structure, so it has no
-  /// virtual destructor. The default deleter of the unique_ptr does not know
-  /// how to delete C++ objects deriving from TfLiteDelegate.
-  TfLiteStatus ModifyGraphWithDelegate(
-      std::unique_ptr delegate) = delete;
-
-  /// Ensure the data in `tensor.data` is readable. In case delegate is used,
-  /// it might require to copy the data from delegate buffer to raw memory.
-  /// WARNING: This is an experimental API and subject to change.
-  TfLiteStatus EnsureTensorDataIsReadable(int tensor_index) {
-    return primary_subgraph().EnsureTensorDataIsReadable(tensor_index);
-  }
-
-  /// Set the delegate buffer handle to a tensor. It can be called in the
-  /// following cases:
-  /// 1. Set the buffer handle to a tensor that's not being written by a
-  ///    delegate. For example, feeding an OpenGL texture as the input of the
-  ///    inference graph.
-  /// 2. Set the buffer handle to a tensor that uses the same delegate.
-  ///    For example, set an OpenGL texture as the output of inference, while
-  ///    the node which produces output is an OpenGL delegate node.
-  /// WARNING: This is an experimental API and subject to change.
-  TfLiteStatus SetBufferHandle(int tensor_index,
-                               TfLiteBufferHandle buffer_handle,
-                               TfLiteDelegate* delegate);
-
-  /// Get the delegate buffer handle, and the delegate which can process the
-  /// buffer handle.
-  /// WARNING: This is an experimental API and subject to change.
-  TfLiteStatus GetBufferHandle(int tensor_index,
-                               TfLiteBufferHandle* buffer_handle,
-                               TfLiteDelegate** delegate);
-
-  /// Sets the profiler to tracing execution. The caller retains ownership
-  /// of the profiler and must ensure its validity.
-  /// WARNING: This is an experimental API and subject to change.
-  void SetProfiler(Profiler* profiler);
-
-  /// Same as SetProfiler except this interpreter takes ownership
-  /// of the provided profiler.
-  /// WARNING: This is an experimental API and subject to change.
-  void SetProfiler(std::unique_ptr profiler);
-
-  /// Gets the profiler used for op tracing.
-  /// WARNING: This is an experimental API and subject to change.
-  Profiler* GetProfiler();
-
-  // The default capacity of `tensors_` vector.
-  static constexpr int kTensorsReservedCapacity = 128;
-  /// The capacity headroom of `tensors_` vector before calling ops'
-  /// `prepare` and `invoke` function. In these functions, it's guaranteed
-  /// allocating up to `kTensorsCapacityHeadroom` more tensors won't invalidate
-  /// pointers to existing tensors.
-  static constexpr int kTensorsCapacityHeadroom = 16;
-
-  /// Set if buffer handle output is allowed.
-  //
-  /// When using hardware delegation, Interpreter will make the data of output
-  /// tensors available in `tensor->data` by default. If the application can
-  /// consume the buffer handle directly (e.g. reading output from OpenGL
-  /// texture), it can set this flag to false, so Interpreter won't copy the
-  /// data from buffer handle to CPU memory. WARNING: This is an experimental
-  /// API and subject to change.
-  void SetAllowBufferHandleOutput(bool allow_buffer_handle_output) {
-    allow_buffer_handle_output_ = allow_buffer_handle_output;
-  }
-
-  /// Reset all variable tensors to the default value.
-  /// If a variable tensor doesn't have a buffer, reset it to zero.
-  /// TODO(b/115961645): Implement - If a variable tensor has a buffer, reset it
-  /// to the value of the buffer.
-  /// WARNING: This is an experimental API and subject to change.
-  TfLiteStatus ResetVariableTensors();
-
-  /// Retrieve an operator's description of its work, for profiling purposes.
-  const char* OpProfilingString(const TfLiteRegistration& op_reg,
-                                const TfLiteNode* node) const {
-    if (op_reg.profiling_string == nullptr) return nullptr;
-    return op_reg.profiling_string(context_, node);
-  }
-
-  // Set the value of an external context. TFLite interpreter doesn't take the
-  // memory ownership of this external context 'ctx', and the context should
-  // outlive the TFLite interpreter.
-  void SetExternalContext(TfLiteExternalContextType type,
-                          TfLiteExternalContext* ctx);
-
-  // Assigns (or reassigns) a custom memory allocation for the given tensor.
-  // If AllocateTensors() is called after this, the runtime does not consider
-  // the tensor during internal memory planning and will continue using the
-  // provided allocation for the tensor (assuming it satisfies the expected
-  // tensor byte length).
-  // The runtime does NOT take ownership of the underlying memory.
-  // Note that while this function can be called again to set a new allocation
-  // for the tensor, it can no longer be reset to the TFLite arena memory.
-  //
-  // Parameters should satisfy the following conditions:
-  // 1. tensor->allocation_type == kTfLiteArenaRw or kTfLiteArenaRwPersistent
-  //    In general, this is true for I/O tensors & variable tensors.
-  // 2. allocation->data has the appropriate permissions for runtime access
-  //    (Read-only for inputs, Read-Write for others), and outlives Interpreter.
-  // 3. allocation->bytes >= tensor->bytes.
-  //    This condition is checked again if any tensors are resized.
-  // 4. allocation->data should be aligned to kDefaultTensorAlignment
-  //    defined in lite/util.h. (Currently 64 bytes)
-  //
-  // WARNING: This is an experimental interface that is subject to change.
-  TfLiteStatus SetCustomAllocationForTensor(
-      int tensor_index, const TfLiteCustomAllocation& allocation);
-
-#ifndef DOXYGEN_SKIP
-  /// Adds `subgraphs_to_add` subgraphs, preserving pre-existing Subgraph
-  /// entries. The value pointed to by `first_new_subgraph_index` will be set to
-  /// the index of the first new subgraph if `first_new_subgraph_index` is
-  /// non-null.
-  /// WARNING: This is an experimental API and subject to change.
-  void AddSubgraphs(int subgraphs_to_add,
-                    int* first_new_subgraph_index = nullptr);
-
-  /// Return the number of subgraphs in the model.
-  /// WARNING: This is an experimental API and subject to change.
-  size_t subgraphs_size() const { return subgraphs_.size(); }
-
-  /// Get a pointer to a subgraph if in bounds.
-  /// WARNING: This is an experimental API and subject to change.
-  Subgraph* subgraph(int subgraph_index) {
-    if (subgraph_index < 0 ||
-        static_cast(subgraph_index) >= subgraphs_size())
-      return nullptr;
-    return &*subgraphs_[subgraph_index];
-  }
-
-  /// WARNING: Experimental interface, subject to change
-  Subgraph& primary_subgraph() {
-    return *subgraphs_.front();  /// Safe as subgraphs_ always has 1 entry.
-  }
-
-  /// WARNING: Experimental interface, subject to change
-  const Subgraph& primary_subgraph() const {
-    return *subgraphs_.front();  // Safe as subgraphs_ always has 1 entry.
-  }
-
-  /// WARNING: Experimental interface, subject to change
-  // Get the error reporter associated with this interpreter.
-  ErrorReporter* error_reporter() const { return error_reporter_; }
-
-#endif  // DOXYGEN_SKIP
-
- private:
-  friend class InterpreterBuilder;
-  friend class tflite::InterpreterTest;
-  friend class tflite::TestDelegate;
-  friend class tflite::delegates::InterpreterUtils;
-
-  /// Set the value of an external context.
-  static void SetExternalContext(struct TfLiteContext* context,
-                                 TfLiteExternalContextType type,
-                                 TfLiteExternalContext* ctx);
-
-  // Sets the profiler to all subgraphs.
-  void SetSubgraphProfiler();
-
-  // Remove delegates (for fallback behaviour). The interpreter is invokable
-  // afterwards.
-  TfLiteStatus RemoveAllDelegates();
-
-  // Returns true if delegates have been applied.
-  bool HasDelegates();
-
-  // Returns true if cancellation function returns true.
-  bool IsCancelled();
-
-  // A pure C data structure used to communicate with the pure C plugin
-  // interface. To avoid copying tensor metadata, this is also the definitive
-  // structure to store tensors.
-  // This is the primary subgraph context.
-  TfLiteContext* context_ = nullptr;
-
-  // The error reporter delegate that tflite will forward queries errors to.
-  ErrorReporter* error_reporter_ = nullptr;
-
-  // List of delegates that have been installed and are owned by this
-  // interpreter instance. Useful if client delegate ownership is burdensome.
-  // WARNING: This is an experimental API and subject to change.
-  // TODO(b/116667551): Use TfLiteExternalContext for storing state.
-  std::vector<
-      std::unique_ptr>>
-      owned_delegates_;
-
-  // Profiler that has been installed and is owned by this interpreter instance.
-  // Useful if client profiler ownership is burdensome.
-  std::unique_ptr owned_profiler_;
-
-  // Points to the installed Profiler instance.
-  Profiler* installed_profiler_ = nullptr;
-
-  bool allow_buffer_handle_output_ = false;
-
-  // List of active external contexts.
-  TfLiteExternalContext* external_contexts_[kTfLiteMaxExternalContexts];
-
-  // The default external cpu backend context. After an TFLite interpreter is
-  // initialized, 'external_contexts_[kTfLiteCpuBackendContext]' is set to point
-  // to this object. However, if this element value is overwritten via calling
-  // 'SetExternalContext(kTfLiteCpuBackendContext, ...)', we will reset this to
-  // nullptr if necessary.
-  std::unique_ptr own_external_cpu_backend_context_;
-
-  // Subgraphs
-  std::vector> subgraphs_;
-
-  // A map of resources. Owned by interpreter and shared by multiple subgraphs.
-  resource::ResourceMap resources_;
-
-  // Indicating delegates that the TFLite interpreter will apply by default.
-  // An empty one means there's no delegate to be applied by default or
-  // delegates have been applied and doesn't need to be applied again.
-  std::vector lazy_delegate_providers_;
-};
-
-}  // namespace tflite
-#endif  // TENSORFLOW_LITE_INTERPRETER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/interpreter_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/interpreter_builder.h
deleted file mode 100644
index 4b0052f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/interpreter_builder.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Copyright 2017 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.
-==============================================================================*/
-/// \file
-/// Provides functionality to construct an interpreter for a model.
-///
-#ifndef TENSORFLOW_LITE_INTERPRETER_BUILDER_H_
-#define TENSORFLOW_LITE_INTERPRETER_BUILDER_H_
-
-#include 
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/core/api/error_reporter.h"
-#include "tensorflow/lite/core/api/op_resolver.h"
-#include "tensorflow/lite/interpreter.h"
-#include "tensorflow/lite/model_builder.h"
-#include "tensorflow/lite/mutable_op_resolver.h"
-#include "tensorflow/lite/schema/schema_generated.h"
-
-namespace tflite {
-
-/// Build an interpreter capable of interpreting `model`.
-///
-/// `model`: A model whose lifetime must be at least as long as any
-///   interpreter(s) created by the builder. In principle multiple interpreters
-///   can be made from a single model.
-/// `op_resolver`: An instance that implements the `OpResolver` interface, which
-///   maps custom op names and builtin op codes to op registrations. The
-///   lifetime of the provided `op_resolver` object must be at least as long as
-///   the `InterpreterBuilder`; unlike `model` and `error_reporter`, the
-///   `op_resolver` does not need to exist for the duration of any created
-///   `Interpreter` objects.
-/// `error_reporter`: a functor that is called to report errors that handles
-///   printf var arg semantics. The lifetime of the `error_reporter` object must
-///   be greater than or equal to the `Interpreter` created by `operator()`.
-///
-/// Returns a kTfLiteOk when successful and sets interpreter to a valid
-/// Interpreter. Note: The user must ensure the lifetime of the model (and error
-/// reporter, if provided) is at least as long as interpreter's lifetime.
-class InterpreterBuilder {
- public:
-  InterpreterBuilder(const FlatBufferModel& model,
-                     const OpResolver& op_resolver);
-  /// Builds an interpreter given only the raw flatbuffer Model object (instead
-  /// of a FlatBufferModel). Mostly used for testing.
-  /// If `error_reporter` is null, then DefaultErrorReporter() is used.
-  InterpreterBuilder(const ::tflite::Model* model,
-                     const OpResolver& op_resolver,
-                     ErrorReporter* error_reporter = DefaultErrorReporter());
-  ~InterpreterBuilder();
-  InterpreterBuilder(const InterpreterBuilder&) = delete;
-  InterpreterBuilder& operator=(const InterpreterBuilder&) = delete;
-  TfLiteStatus operator()(std::unique_ptr* interpreter);
-  TfLiteStatus operator()(std::unique_ptr* interpreter,
-                          int num_threads);
-
- private:
-  TfLiteStatus BuildLocalIndexToRegistrationMapping();
-  TfLiteStatus ParseNodes(
-      const flatbuffers::Vector>* operators,
-      Subgraph* subgraph);
-  TfLiteStatus ParseTensors(
-      const flatbuffers::Vector>* buffers,
-      const flatbuffers::Vector>* tensors,
-      Subgraph* subgraph);
-  TfLiteStatus ApplyDelegates(Interpreter* interpreter, int num_threads);
-  TfLiteStatus ParseQuantization(const QuantizationParameters* src_quantization,
-                                 TfLiteQuantization* quantization,
-                                 const std::vector& dims);
-  TfLiteStatus ParseSparsity(const SparsityParameters* src_sparsity,
-                             TfLiteSparsity** sparsity);
-
-  const ::tflite::Model* model_;
-  const OpResolver& op_resolver_;
-  ErrorReporter* error_reporter_;
-
-  std::vector flatbuffer_op_index_to_registration_;
-  std::vector unresolved_custom_ops_;
-  std::vector flatbuffer_op_index_to_registration_types_;
-  const Allocation* allocation_ = nullptr;
-
-  bool has_flex_op_ = false;
-  int num_fp32_tensors_ = 0;
-};
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_INTERPRETER_BUILDER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/acceleration_test_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/acceleration_test_util.h
deleted file mode 100644
index 78e4d01..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/acceleration_test_util.h
+++ /dev/null
@@ -1,28 +0,0 @@
-/* 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_KERNELS_ACCELERATION_TEST_UTIL_H_
-#define TENSORFLOW_LITE_KERNELS_ACCELERATION_TEST_UTIL_H_
-
-#include 
-
-namespace tflite {
-
-// Returns the test id to use to retrieve the acceleration configuration
-// in the acceleration allowlist.
-std::string GetCurrentTestId();
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_ACCELERATION_TEST_UTIL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/acceleration_test_util_internal.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/acceleration_test_util_internal.h
deleted file mode 100644
index 857a2da..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/acceleration_test_util_internal.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* 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_KERNELS_ACCELERATION_TEST_UTIL_INTERNAL_H_
-#define TENSORFLOW_LITE_KERNELS_ACCELERATION_TEST_UTIL_INTERNAL_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "absl/types/optional.h"
-#include "re2/re2.h"
-
-namespace tflite {
-
-// Reads the acceleration configuration, handles comments and empty lines and
-// the basic data conversion format (split into key, value, recognition of
-// the line being a white or black list entry) and gives the data to the
-// consumer to be inserted into the target collection.
-void ReadAccelerationConfig(
-    const char* config,
-    const std::function& consumer);
-
-template 
-class ConfigurationEntry {
- public:
-  ConfigurationEntry(const std::string& test_id_rex, T test_config,
-                     bool is_denylist)
-      : test_id_rex_(test_id_rex),
-        test_config_(test_config),
-        is_denylist_(is_denylist) {}
-
-  bool Matches(const std::string& test_id) {
-    return RE2::FullMatch(test_id, test_id_rex_);
-  }
-  bool IsDenylistEntry() const { return is_denylist_; }
-  const T& TestConfig() const { return test_config_; }
-
-  const std::string& TestIdRex() const { return test_id_rex_; }
-
- private:
-  std::string test_id_rex_;
-  T test_config_;
-  bool is_denylist_;
-};
-
-// Returns the acceleration test configuration for the given test id and
-// the given acceleration configuration type.
-// The configuration type is responsible of providing the test configuration
-// and the parse function to convert configuration lines into configuration
-// objects.
-template 
-absl::optional GetAccelerationTestParam(std::string test_id) {
-  static std::atomic>*> test_config_ptr;
-
-  if (test_config_ptr.load() == nullptr) {
-    auto config = new std::vector>();
-
-    auto consumer = [&config](std::string key, std::string value_str,
-                              bool is_denylist) mutable {
-      T value = T::ParseConfigurationLine(value_str);
-      config->push_back(ConfigurationEntry(key, value, is_denylist));
-    };
-
-    ReadAccelerationConfig(T::kAccelerationTestConfig, consumer);
-
-    // Even if it has been already set, it would be just replaced with the
-    // same value, just freeing the old value to avoid leaks
-    auto* prev_val = test_config_ptr.exchange(config);
-    delete prev_val;
-  }
-
-  const std::vector>* test_config =
-      test_config_ptr.load();
-
-  const auto test_config_iter = std::find_if(
-      test_config->begin(), test_config->end(),
-      [&test_id](ConfigurationEntry elem) { return elem.Matches(test_id); });
-  if (test_config_iter != test_config->end() &&
-      !test_config_iter->IsDenylistEntry()) {
-    return absl::optional(test_config_iter->TestConfig());
-  } else {
-    return absl::optional();
-  }
-}
-
-}  //  namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_ACCELERATION_TEST_UTIL_INTERNAL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/builtin_op_kernels.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/builtin_op_kernels.h
deleted file mode 100644
index b6e73c2..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/builtin_op_kernels.h
+++ /dev/null
@@ -1,161 +0,0 @@
-/* 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_KERNELS_BUILTIN_OP_KERNELS_H_
-#define TENSORFLOW_LITE_KERNELS_BUILTIN_OP_KERNELS_H_
-
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-namespace ops {
-namespace builtin {
-
-// Forward declaration of all builtin op kernel registration methods. These
-// registrations are included with the standard `BuiltinOpResolver`.
-//
-// This header is particularly useful in cases where only a subset of ops are
-// needed. In such cases, the client can selectively add only the registrations
-// their model requires, using a custom `OpResolver` or `MutableOpResolver`.
-// Selective registration in turn allows the linker to strip unused kernels.
-
-TfLiteRegistration* Register_ABS();
-TfLiteRegistration* Register_ADD();
-TfLiteRegistration* Register_ADD_N();
-TfLiteRegistration* Register_ARG_MAX();
-TfLiteRegistration* Register_ARG_MIN();
-TfLiteRegistration* Register_AVERAGE_POOL_2D();
-TfLiteRegistration* Register_BATCH_TO_SPACE_ND();
-TfLiteRegistration* Register_BATCH_MATMUL();
-TfLiteRegistration* Register_BIDIRECTIONAL_SEQUENCE_LSTM();
-TfLiteRegistration* Register_BIDIRECTIONAL_SEQUENCE_RNN();
-TfLiteRegistration* Register_CAST();
-TfLiteRegistration* Register_CEIL();
-TfLiteRegistration* Register_CONCATENATION();
-TfLiteRegistration* Register_CONV_2D();
-TfLiteRegistration* Register_COS();
-TfLiteRegistration* Register_CUMSUM();
-TfLiteRegistration* Register_DENSIFY();
-TfLiteRegistration* Register_DEPTH_TO_SPACE();
-TfLiteRegistration* Register_DEPTHWISE_CONV_2D();
-TfLiteRegistration* Register_DEQUANTIZE();
-TfLiteRegistration* Register_DIV();
-TfLiteRegistration* Register_ELU();
-TfLiteRegistration* Register_EMBEDDING_LOOKUP();
-TfLiteRegistration* Register_EMBEDDING_LOOKUP_SPARSE();
-TfLiteRegistration* Register_EQUAL();
-TfLiteRegistration* Register_EXP();
-TfLiteRegistration* Register_EXPAND_DIMS();
-TfLiteRegistration* Register_FAKE_QUANT();
-TfLiteRegistration* Register_FILL();
-TfLiteRegistration* Register_FLOOR();
-TfLiteRegistration* Register_FLOOR_DIV();
-TfLiteRegistration* Register_FLOOR_MOD();
-TfLiteRegistration* Register_FULLY_CONNECTED();
-TfLiteRegistration* Register_GATHER();
-TfLiteRegistration* Register_GATHER_ND();
-TfLiteRegistration* Register_GREATER();
-TfLiteRegistration* Register_GREATER_EQUAL();
-TfLiteRegistration* Register_HARD_SWISH();
-TfLiteRegistration* Register_HASHTABLE_LOOKUP();
-TfLiteRegistration* Register_IF();
-TfLiteRegistration* Register_L2_NORMALIZATION();
-TfLiteRegistration* Register_L2_POOL_2D();
-TfLiteRegistration* Register_LEAKY_RELU();
-TfLiteRegistration* Register_LESS();
-TfLiteRegistration* Register_LESS_EQUAL();
-TfLiteRegistration* Register_LOCAL_RESPONSE_NORMALIZATION();
-TfLiteRegistration* Register_LOG();
-TfLiteRegistration* Register_LOGICAL_AND();
-TfLiteRegistration* Register_LOGICAL_NOT();
-TfLiteRegistration* Register_LOGICAL_OR();
-TfLiteRegistration* Register_LOGISTIC();
-TfLiteRegistration* Register_LOG_SOFTMAX();
-TfLiteRegistration* Register_LSH_PROJECTION();
-TfLiteRegistration* Register_LSTM();
-TfLiteRegistration* Register_MATRIX_DIAG();
-TfLiteRegistration* Register_MATRIX_SET_DIAG();
-TfLiteRegistration* Register_MAXIMUM();
-TfLiteRegistration* Register_MAX_POOL_2D();
-TfLiteRegistration* Register_MEAN();
-TfLiteRegistration* Register_MINIMUM();
-TfLiteRegistration* Register_MIRROR_PAD();
-TfLiteRegistration* Register_MUL();
-TfLiteRegistration* Register_NEG();
-TfLiteRegistration* Register_NON_MAX_SUPPRESSION_V4();
-TfLiteRegistration* Register_NON_MAX_SUPPRESSION_V5();
-TfLiteRegistration* Register_NOT_EQUAL();
-TfLiteRegistration* Register_ONE_HOT();
-TfLiteRegistration* Register_PACK();
-TfLiteRegistration* Register_PAD();
-TfLiteRegistration* Register_PADV2();
-TfLiteRegistration* Register_POW();
-TfLiteRegistration* Register_PRELU();
-TfLiteRegistration* Register_QUANTIZE();
-TfLiteRegistration* Register_RANGE();
-TfLiteRegistration* Register_RANK();
-TfLiteRegistration* Register_REDUCE_ANY();
-TfLiteRegistration* Register_REDUCE_MAX();
-TfLiteRegistration* Register_REDUCE_MIN();
-TfLiteRegistration* Register_REDUCE_PROD();
-TfLiteRegistration* Register_RELU();
-TfLiteRegistration* Register_RELU6();
-TfLiteRegistration* Register_RELU_N1_TO_1();
-TfLiteRegistration* Register_RESHAPE();
-TfLiteRegistration* Register_RESIZE_BILINEAR();
-TfLiteRegistration* Register_RESIZE_NEAREST_NEIGHBOR();
-TfLiteRegistration* Register_REVERSE_SEQUENCE();
-TfLiteRegistration* Register_REVERSE_V2();
-TfLiteRegistration* Register_RNN();
-TfLiteRegistration* Register_ROUND();
-TfLiteRegistration* Register_RSQRT();
-TfLiteRegistration* Register_SCATTER_ND();
-TfLiteRegistration* Register_SEGMENT_SUM();
-TfLiteRegistration* Register_SELECT();
-TfLiteRegistration* Register_SELECT_V2();
-TfLiteRegistration* Register_SHAPE();
-TfLiteRegistration* Register_SIN();
-TfLiteRegistration* Register_SKIP_GRAM();
-TfLiteRegistration* Register_SLICE();
-TfLiteRegistration* Register_SOFTMAX();
-TfLiteRegistration* Register_SPACE_TO_BATCH_ND();
-TfLiteRegistration* Register_SPACE_TO_DEPTH();
-TfLiteRegistration* Register_SPARSE_TO_DENSE();
-TfLiteRegistration* Register_SPLIT();
-TfLiteRegistration* Register_SPLIT_V();
-TfLiteRegistration* Register_SQRT();
-TfLiteRegistration* Register_SQUARE();
-TfLiteRegistration* Register_SQUARED_DIFFERENCE();
-TfLiteRegistration* Register_SQUEEZE();
-TfLiteRegistration* Register_STRIDED_SLICE();
-TfLiteRegistration* Register_SUB();
-TfLiteRegistration* Register_SUM();
-TfLiteRegistration* Register_SVDF();
-TfLiteRegistration* Register_TANH();
-TfLiteRegistration* Register_TILE();
-TfLiteRegistration* Register_TOPK_V2();
-TfLiteRegistration* Register_TRANSPOSE();
-TfLiteRegistration* Register_TRANSPOSE_CONV();
-TfLiteRegistration* Register_UNIDIRECTIONAL_SEQUENCE_LSTM();
-TfLiteRegistration* Register_UNIDIRECTIONAL_SEQUENCE_RNN();
-TfLiteRegistration* Register_UNIQUE();
-TfLiteRegistration* Register_UNPACK();
-TfLiteRegistration* Register_WHERE();
-TfLiteRegistration* Register_WHILE();
-TfLiteRegistration* Register_ZEROS_LIKE();
-
-}  // namespace builtin
-}  // namespace ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_BUILTIN_OP_KERNELS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_context.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_context.h
deleted file mode 100644
index e020717..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_context.h
+++ /dev/null
@@ -1,114 +0,0 @@
-/* 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_KERNELS_CPU_BACKEND_CONTEXT_H_
-#define TENSORFLOW_LITE_KERNELS_CPU_BACKEND_CONTEXT_H_
-
-#include 
-
-#include "public/gemmlowp.h"
-#include "ruy/context.h"  // from @ruy
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/external_cpu_backend_context.h"
-
-namespace tflite {
-
-class CpuBackendContext final : public TfLiteInternalBackendContext {
- public:
-  static CpuBackendContext* GetFromContext(TfLiteContext* context);
-
-  CpuBackendContext();
-  ~CpuBackendContext() override;
-
-  ruy::Context* ruy_context() const { return ruy_context_.get(); }
-
-  gemmlowp::GemmContext* gemmlowp_context() const {
-    return gemmlowp_context_.get();
-  }
-
-  // Sets the maximum-number-of-threads-to-use parameter, only as a means of
-  // passing around this information.
-  void SetMaxNumThreads(int max_num_threads) override;
-
-  int max_num_threads() const { return max_num_threads_; }
-
-  void SetUseCaching(bool flag);
-
-  bool use_caching() const { return use_caching_; }
-
-  void ClearCaches() override { ruy_context_->ClearPrepackedCache(); }
-
-  bool HasAvxOrAbove();
-
- private:
-  // Copy the wrapper class for cpuinfo from Ruy.
-  class CpuInfo final {
-   public:
-    CpuInfo() {}
-    ~CpuInfo();
-
-    // X86 features
-    bool Avx();
-    bool Avx2Fma();
-    bool Avx512();
-
-   private:
-    enum class InitStatus {
-      kNotYetAttempted,
-      kInitialized,
-      kFailed,
-    };
-
-    InitStatus init_status_ = InitStatus::kNotYetAttempted;
-
-    bool EnsureInitialized();
-    InitStatus Initialize();
-    CpuInfo(const CpuInfo&) = delete;
-    CpuInfo& operator=(const CpuInfo&) = delete;
-  };
-
-  // To enable a smooth transition from the current direct usage
-  // of the underlying gemmlowp context to going through abstractions
-  // (see :cpu_backend_gemm), for now a CpuBackendContext always
-  // stores both a gemmlowp context and a ruy context.
-  // TODO(b/131416458): Once call sites all go through abstractions,
-  // elide what can be elided based on TFLITE_WITH_RUY.
-  const std::unique_ptr ruy_context_;
-  const std::unique_ptr gemmlowp_context_;
-  CpuInfo cpuinfo_;
-
-  // The maximum of threads used for parallelizing TfLite ops. However,
-  // cpu_backend_threadpool::Execute creates as many threads as it's
-  // asked to, regardless of this. Typically a call site would query
-  // cpu_backend_context->max_num_threads() and used that to determine
-  // the number of tasks to create and to give to
-  // cpu_backend_threadpool::Execute.
-  //
-  // This value also gets propagated to back-ends, where it plays the same
-  // information-only role.
-  int max_num_threads_;
-  // For matrix muliplications with constants parameters (i.e. weights), we can
-  // sometimes provide speedups by caching the "prepacked" data, for some
-  // additional memory cost. This flag permits the user to route all
-  // CpuBackendGem operations to a library that permits such an optimization
-  // (currently the Ruy library only).
-  bool use_caching_;
-
-  CpuBackendContext(const CpuBackendContext&) = delete;
-};
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_CPU_BACKEND_CONTEXT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm.h
deleted file mode 100644
index 6950e18..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/* 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_KERNELS_CPU_BACKEND_GEMM_H_
-#define TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_H_
-
-#include 
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_custom_gemv.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_ruy.h"
-
-#ifndef TFLITE_WITH_RUY
-#include "tensorflow/lite/kernels/cpu_backend_gemm_eigen.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_gemmlowp.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_x86.h"
-#endif
-
-namespace tflite {
-
-namespace cpu_backend_gemm {
-
-// The main entry point for CpuBackendGemm::Gemm.
-//
-// If TFLITE_WITH_RUY is set, CpuBackendGemm::Gemm will always go to Ruy aka
-// GemmImplUsingRuy. Other cases are as follows:
-//
-//                    |Quantized (uint8)|Quantized (int8)| Float |
-// TFLITE_WITH_RUY    |      Ruy        |      Ruy       | Ruy   |
-// !TFLITE_WITH_RUY   |      gemmlowp   |  Ruy/gemmlowp* | eigen |
-// * - Ruy if NEON is not available.
-
-//  On x86 platforms:
-//  (default)         |      gemmlowp   |     Ruy        | eigen |
-//  TFLITE_X86_RUY_\  |      Ruy        |     Ruy        | Ruy   |
-//  ENABLED && (AVX
-//  or above available)
-
-
-#if (defined(__i386) || defined(_M_IX86) || defined(__x86_64__) || \
-     defined(_M_X64))
-#define TFLITE_X86_PLATFORM
-#endif
-
-// TODO(b/168923364)  Set TFLITE_X86_RUY_ENABLED default 'on' when ready.
-#if defined(TFLITE_X86_PLATFORM) && defined(TFLITE_X86_RUY_ENABLED)
-/* GEMM dispatch implementation for x86.
- */
-template 
-struct GemmImpl : detail::GemmImplX86 {};
-#else
-/* Generic implementation using ruy.
- * Non-ruy implementation will be partial specializations of this template.
- */
-template 
-struct GemmImpl : detail::GemmImplUsingRuy {};
-#endif
-
-#if !defined(TFLITE_WITH_RUY) && !defined(TFLITE_X86_RUY_ENABLED)
-
-/* Specializations using gemmlowp */
-
-template 
-struct GemmImpl
-    : detail::GemmImplUsingGemmlowp {};
-
-// When SrcScalar=int8 or DstScalar=int8, gemmlowp fails to compile
-// outside of NEON. We avoid the compilation failure by subspecializing these
-// cases, rerouting it back to ruy.
-#if !defined(GEMMLOWP_NEON)
-template 
-struct GemmImpl
-    : detail::GemmImplUsingRuy {};
-
-template 
-struct GemmImpl
-    : detail::GemmImplUsingRuy {};
-
-template 
-struct GemmImpl
-    : detail::GemmImplUsingRuy {};
-#endif  // not GEMMLOWP_NEON
-
-/* Specializations using Eigen */
-
-template <>
-struct GemmImpl
-    : detail::GemmImplUsingEigen {};
-
-#endif  // not TFLITE_WITH_RUY && not TFLITE_X86_RUY_ENABLED
-
-/* Public entry point */
-
-template 
-void Gemm(const MatrixParams& lhs_params, const LhsScalar* lhs_data,
-          const MatrixParams& rhs_params, const RhsScalar* rhs_data,
-          const MatrixParams& dst_params, DstScalar* dst_data,
-          const GemmParams& params,
-          CpuBackendContext* context) {
-  ruy::profiler::ScopeLabel label("cpu_backend_gemm::Gemm");
-  ValidateParams(lhs_params, rhs_params, dst_params, params);
-  // In some cases we want to unconditionally use ruy as the backend, overriding
-  // the `tflite_with_ruy` setting and the platform default.
-  bool must_use_ruy = false;
-  if (context->use_caching()) {
-    // Only ruy supports caching of pre-packed matrices. Due to the large
-    // performance impact in the cases where it's typically used, this overrides
-    // the default.
-    must_use_ruy = true;
-  }
-  if (lhs_params.order != Order::kRowMajor ||
-      rhs_params.order != Order::kColMajor ||
-      dst_params.order != Order::kColMajor) {
-    // ruy supports all 2^3=8 combinations of storage orders with comparable
-    // performance. In ruy, it's only a runtime switch. In other backends
-    // (gemmlowp, Eigen), storage orders are template parameters, supporting
-    // all 8 combinations would be up to a 8-fold code size increase, so we
-    // prefer to force usage of ruy in these cases.
-    must_use_ruy = true;
-  }
-  if (must_use_ruy) {
-    detail::GemmImplUsingRuy::Run(lhs_params, lhs_data,
-                                                       rhs_params, rhs_data,
-                                                       dst_params, dst_data,
-                                                       params, context);
-    return;
-  }
-  // If we did not choose to force usage of ruy above, then we may now consider
-  // using custom GEMV code for the matrix*vector cases.
-  const bool try_custom_gemv = (dst_params.cols == 1);
-  if (try_custom_gemv) {
-    // GEMV case: try a custom fast GEMV path. It will return true if it
-    // actually handled it.
-    if (detail::CustomGemv(lhs_params, lhs_data, rhs_params, rhs_data,
-                           dst_params, dst_data, params, context)) {
-      return;
-    }
-  }
-  // Generic case: dispatch to any backend as a general GEMM.
-  GemmImpl::Run(lhs_params, lhs_data, rhs_params, rhs_data,
-                                     dst_params, dst_data, params, context);
-}
-
-// Special path for gemm with raw accumulator case. i.e. AccumScalar ==
-// DstScalar == int32 case.
-template 
-void Gemm(const MatrixParams& lhs_params, const LhsScalar* lhs_data,
-          const MatrixParams& rhs_params, const RhsScalar* rhs_data,
-          const MatrixParams& dst_params, int32_t* dst_data,
-          const GemmParams& params,
-          CpuBackendContext* context) {
-  ruy::profiler::ScopeLabel label("cpu_backend_gemm::Gemm");
-  ValidateParams(lhs_params, rhs_params, dst_params, params);
-
-  // Currently, only Ruy backend supports get raw accumulator, so we use ruy
-  // only.
-  ruy::profiler::ScopeLabel label2("cpu_backend_gemm::Gemm: general GEMM");
-  detail::GemmImplUsingRuy::Run(lhs_params, lhs_data,
-                                                     rhs_params, rhs_data,
-                                                     dst_params, dst_data,
-                                                     params, context);
-}
-
-}  // namespace cpu_backend_gemm
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_custom_gemv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_custom_gemv.h
deleted file mode 100644
index 2712d7d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_custom_gemv.h
+++ /dev/null
@@ -1,789 +0,0 @@
-/* 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.
-==============================================================================*/
-
-// Fast Gemv (i.e. matrix*vector multiplication) paths.
-// TODO(b/132094390): remove when GEMM performance is good enough on GEMV cases.
-
-// TFLite's runtime ops concentrate as much as possible the matrix*vector
-// use cases on the (matrix) * (column-vector) case, as opposed to
-// (row-vector) * (matrix).  So that is what we focus on optimizing here.
-// Accordingly, the public cpu_backend_gemm::Gemm() entry point checks
-// if we are in this (matrix) * (column-vector) case, and if so calls
-// CustomGemv.
-//
-// cpu_backend_gemm::Gemm is also currently restricted (as enforced in
-// ValidateParams) to the case where the left-hand side matrix is row-major.
-//
-// So the current scope of this CustomGemv function really is:
-// (row-major matrix) * (column-vector).
-
-#ifndef TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_CUSTOM_GEMV_H_
-#define TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_CUSTOM_GEMV_H_
-
-#include 
-
-#include 
-#include 
-#include 
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
-#include "tensorflow/lite/kernels/cpu_backend_threadpool.h"
-#include "tensorflow/lite/kernels/internal/common.h"
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-#include "tensorflow/lite/kernels/internal/optimized/neon_check.h"
-
-namespace tflite {
-namespace cpu_backend_gemm {
-namespace detail {
-
-// CustomGemvImpl is what needs to be specialized for each custom GEMV path.
-//
-// It does not deal with any multi-threaded implementation detail. Rather,
-// it provides the single-thread implementation to be run by each thread.
-template 
-struct CustomGemvImpl {
-  // The number of rows of the left-hand-side matrix (and equivalently of the
-  // destination column-vector) that the kernel processes at a time.
-  // This will also be the minimum required number of rows for a Gemv shape
-  // to be supported by this path.
-  //
-  // Gemv implementations are expected to be able to deal with numbers of
-  // rows that aren't multiples of kKernelRows by possibly running the kernel
-  // again at an odd row_start, e.g. if kKernelRows==4, Run() should still
-  // support running on 7 rows by running twice: once with row_start=0 and then
-  // another time with row_start=3.
-  //
-  // On the other hand, gemv implementations are not expected to support
-  // running on fewer than kKernelRows rows. There is no interest in
-  // optimizing such narrow Gemv's that they are just a few dot-products.
-  // Supporting that would require custom kernel code only for that case.
-  static constexpr int kKernelRows = 1;
-
-  // Returns true if the Gemv shape is supported by Run(), provided that
-  // (row_end - row_start) > kKernelRows.
-  static bool IsSupportedGivenSufficientlyManyRows(
-      const MatrixParams& lhs_params,
-      const MatrixParams& rhs_params,
-      const MatrixParams& dst_params,
-      const GemmParams& params) {
-    return false;
-  }
-
-  // Performs the Gemv.
-  static void Run(
-      const MatrixParams& lhs_params, const LhsScalar* lhs_data,
-      const MatrixParams& rhs_params, const RhsScalar* rhs_data,
-      const MatrixParams& dst_params, DstScalar* dst_data,
-      const GemmParams& params,
-      int row_start, int row_end) {}
-};
-
-// Wraps CustomGemvImpl for multi-threaded operation.
-template 
-class CustomGemvTask : public cpu_backend_threadpool::Task {
- public:
-  CustomGemvTask(
-      const MatrixParams& lhs_params, const LhsScalar* lhs_data,
-      const MatrixParams& rhs_params, const RhsScalar* rhs_data,
-      const MatrixParams& dst_params, DstScalar* dst_data,
-      const GemmParams& params,
-      int row_start, int row_end)
-      : lhs_params_(lhs_params),
-        lhs_data_(lhs_data),
-        rhs_params_(rhs_params),
-        rhs_data_(rhs_data),
-        dst_params_(dst_params),
-        dst_data_(dst_data),
-        params_(params),
-        row_start_(row_start),
-        row_end_(row_end) {}
-
-  void Run() override {
-    using Impl = CustomGemvImpl;
-    Impl::Run(lhs_params_, lhs_data_, rhs_params_, rhs_data_, dst_params_,
-              dst_data_, params_, row_start_, row_end_);
-  }
-
- private:
-  const MatrixParams& lhs_params_;
-  const LhsScalar* lhs_data_;
-  const MatrixParams& rhs_params_;
-  const RhsScalar* rhs_data_;
-  const MatrixParams& dst_params_;
-  DstScalar* dst_data_;
-  const GemmParams& params_;
-  int row_start_;
-  int row_end_;
-};
-
-// Either performs the requested Gemv operation and returns true,
-// or immediately returns false.
-//
-// See the comment at the top of the file for the scope of what this handles.
-// In summary: (row-major matrix) * (column-vector).
-//
-// Here is only high-level logic.
-// The actual implementation details are in specializations of
-// CustomGemvImpl.
-template 
-bool CustomGemv(
-    const MatrixParams& lhs_params, const LhsScalar* lhs_data,
-    const MatrixParams& rhs_params, const RhsScalar* rhs_data,
-    const MatrixParams& dst_params, DstScalar* dst_data,
-    const GemmParams& params,
-    CpuBackendContext* context) {
-  ruy::profiler::ScopeLabel label("cpu_backend_gemm::Gemm: CustomGemv");
-  using Impl = CustomGemvImpl;
-  if (lhs_params.rows < Impl::kKernelRows) {
-    return false;
-  }
-  if (!Impl::IsSupportedGivenSufficientlyManyRows(lhs_params, rhs_params,
-                                                  dst_params, params)) {
-    return false;
-  }
-  TFLITE_DCHECK_GE(lhs_params.rows, Impl::kKernelRows);
-  int thread_count = LegacyHowManyThreads(
-      context->max_num_threads(), dst_params.rows, dst_params.cols,
-      lhs_params.cols);
-  if (thread_count == 1) {
-    Impl::Run(lhs_params, lhs_data, rhs_params, rhs_data, dst_params, dst_data,
-              params, 0, lhs_params.rows);
-  } else {
-    using Task = CustomGemvTask;
-    std::vector tasks;
-    tasks.reserve(thread_count);
-    const int kRowsPerThread =
-        RoundUp(CeilQuotient(dst_params.rows, thread_count));
-    int row_start = 0;
-    for (int i = 0; i < thread_count; i++) {
-      int row_end = std::min(dst_params.rows, row_start + kRowsPerThread);
-      tasks.emplace_back(lhs_params, lhs_data, rhs_params, rhs_data, dst_params,
-                         dst_data, params, row_start, row_end);
-      row_start = row_end;
-    }
-    cpu_backend_threadpool::Execute(tasks.size(), tasks.data(), context);
-  }
-  return true;
-}
-
-// USE_NEON still allows for x86 where we may be using the arm_neon_sse.h
-// wrapper implementing NEON intrinsics on top of SSE4 intrinsics.
-#ifdef USE_NEON
-
-// Some NEON helper functions used by CustomGemvImpl specializations below,
-// allowing for some type genericity in them.
-
-inline int16x8x2_t Load16AndSubtractZeroPoint(const std::uint8_t* src,
-                                              std::uint8_t zero_point) {
-  uint8x16_t src_u8 = vld1q_u8(src);
-  int16x8_t src_s16_0 = vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(src_u8)));
-  int16x8_t src_s16_1 = vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(src_u8)));
-  int16x8x2_t result;
-  int16x8_t zero_point_vec = vdupq_n_s16(zero_point);
-  result.val[0] = vsubq_s16(src_s16_0, zero_point_vec);
-  result.val[1] = vsubq_s16(src_s16_1, zero_point_vec);
-  return result;
-}
-
-inline int16x8x2_t Load16AndSubtractZeroPoint(const std::int8_t* src,
-                                              std::int8_t zero_point) {
-  int8x16_t src_s8 = vld1q_s8(src);
-  int16x8_t src_s16_0 = vmovl_s8(vget_low_s8(src_s8));
-  int16x8_t src_s16_1 = vmovl_s8(vget_high_s8(src_s8));
-  int16x8x2_t result;
-  int16x8_t zero_point_vec = vdupq_n_s16(zero_point);
-  result.val[0] = vsubq_s16(src_s16_0, zero_point_vec);
-  result.val[1] = vsubq_s16(src_s16_1, zero_point_vec);
-  return result;
-}
-
-inline int16x8_t Load8AndSubtractZeroPoint(const std::uint8_t* src,
-                                           std::uint8_t zero_point) {
-  uint8x8_t src_u8 = vld1_u8(src);
-  int16x8_t src_s16 = vreinterpretq_s16_u16(vmovl_u8(src_u8));
-  int16x8_t zero_point_vec = vdupq_n_s16(zero_point);
-  return vsubq_s16(src_s16, zero_point_vec);
-}
-
-inline int16x8_t Load8AndSubtractZeroPoint(const std::int8_t* src,
-                                           std::int8_t zero_point) {
-  int8x8_t src_s8 = vld1_s8(src);
-  int16x8_t src_s16 = vmovl_s8(src_s8);
-  int16x8_t zero_point_vec = vdupq_n_s16(zero_point);
-  return vsubq_s16(src_s16, zero_point_vec);
-}
-
-inline void ClampAndStore(int32x4_t src, std::uint8_t clamp_min,
-                          std::uint8_t clamp_max, std::uint8_t* dst) {
-  // Narrow values down to 16 bit signed.
-  const int16x4_t res16 = vqmovn_s32(src);
-  // Narrow values down to 8 bit unsigned, saturating.
-  uint8x8_t res8 = vqmovun_s16(vcombine_s16(res16, res16));
-  // Apply the clamping from the activation function
-  res8 = vmax_u8(res8, vdup_n_u8(clamp_min));
-  res8 = vmin_u8(res8, vdup_n_u8(clamp_max));
-  // Store results to destination.
-  vst1_lane_u8(dst + 0, res8, 0);
-  vst1_lane_u8(dst + 1, res8, 1);
-  vst1_lane_u8(dst + 2, res8, 2);
-  vst1_lane_u8(dst + 3, res8, 3);
-}
-
-inline void ClampAndStore(int32x4_t src, std::int8_t clamp_min,
-                          std::int8_t clamp_max, std::int8_t* dst) {
-  // Narrow values down to 16 bit signed.
-  const int16x4_t res16 = vqmovn_s32(src);
-  // Narrow values down to 8 bit unsigned, saturating.
-  int8x8_t res8 = vqmovn_s16(vcombine_s16(res16, res16));
-  // Apply the clamping from the activation function
-  res8 = vmax_s8(res8, vdup_n_s8(clamp_min));
-  res8 = vmin_s8(res8, vdup_n_s8(clamp_max));
-  // Store results to destination.
-  vst1_lane_s8(dst + 0, res8, 0);
-  vst1_lane_s8(dst + 1, res8, 1);
-  vst1_lane_s8(dst + 2, res8, 2);
-  vst1_lane_s8(dst + 3, res8, 3);
-}
-
-inline void ClampAndStore(int32x4_t src, std::int16_t clamp_min,
-                          std::int16_t clamp_max, std::int16_t* dst) {
-  // Narrow values down to 16 bit signed.
-  int16x4_t res16 = vqmovn_s32(src);
-  // Apply the clamping from the activation function
-  res16 = vmax_s16(res16, vdup_n_s16(clamp_min));
-  res16 = vmin_s16(res16, vdup_n_s16(clamp_max));
-  // Store results to destination.
-  vst1_lane_s16(dst + 0, res16, 0);
-  vst1_lane_s16(dst + 1, res16, 1);
-  vst1_lane_s16(dst + 2, res16, 2);
-  vst1_lane_s16(dst + 3, res16, 3);
-}
-
-template 
-struct CustomGemvImpl {
-  // This partial template specialization is less generic than its declaration
-  // implies: it assumes the following constraints on its free template
-  // parameters. We guard these assumptions in the following static_assert's.
-  static_assert(std::is_same::value ||
-                    std::is_same::value,
-                "");
-  static_assert(std::is_same::value ||
-                    std::is_same::value,
-                "");
-  static_assert(std::is_same::value ||
-                    std::is_same::value ||
-                    std::is_same::value,
-                "");
-  static_assert(quantization_flavor ==
-                        QuantizationFlavor::kIntegerWithUniformMultiplier ||
-                    quantization_flavor ==
-                        QuantizationFlavor::kIntegerWithPerRowMultiplier,
-                "");
-
-  // This implementation's inner loop processes 4 rows of the left-hand side
-  // matrix at a time.
-  static constexpr int kKernelRows = 4;
-
-  static bool IsSupportedGivenSufficientlyManyRows(
-      const MatrixParams& lhs_params,
-      const MatrixParams& rhs_params,
-      const MatrixParams& dst_params,
-      const GemmParams& params) {
-    // The kernel processes at least 8 LHS columns at once to fill NEON
-    // registers. The leftovers-handling code at the end works by loading a
-    // partially overlapping final register by walking back by a few (<8) values
-    // to avoid running past the row's end. This relies on there being
-    // at least 8 LHS columns.
-    return lhs_params.cols >= 8;
-  }
-
-  static void Run(
-      const MatrixParams& lhs_params, const LhsScalar* lhs_data,
-      const MatrixParams& rhs_params, const RhsScalar* rhs_data,
-      const MatrixParams& dst_params, DstScalar* dst_data,
-      const GemmParams& params,
-      int row_start, int row_end) {
-    // Handle kKernelRows ( == 4) rows of the left-hand side matrix at each
-    // iteration of this for loop.
-    TFLITE_DCHECK_GE(row_end - row_start, kKernelRows);
-    for (int row = row_start; row < row_end; row += kKernelRows) {
-      // Here is the magic where we allow this kernel to handle any odd number
-      // of rows as long as it's >= kKernelRows: the last group of `kKernelRows`
-      // rows will be nudged to fit, possibly by starting at an odd value of
-      // `row`.
-      row = std::min(row, row_end - kKernelRows);
-      const LhsScalar* filter_ptr = lhs_data + row * lhs_params.cols;
-
-      static constexpr int kCacheLineSize = 64;
-      for (int k = 0; k < rhs_params.rows;
-           k += kCacheLineSize / sizeof(RhsScalar)) {
-        optimized_ops_preload_l1_keep(rhs_data + k);
-      }
-
-      // kPreloadAhead is empirically determined.
-      // End-to-end latency (ms) on mobilenet_v2_0.35_96_8bit, 1 thread,
-      // on Qualcomm S855:
-      //
-      // kPreloadAhead | big core | little core
-      // --------------+----------+------------
-      // 64            | 1.26     | 5.45
-      // 128           | 1.23     | 5.01
-      // 256           | 1.18     | 4.9
-      // 512           | 1.18     | 5.45
-      // 1024          | 1.18     | 6.5
-      // no prefetch   | 1.25     | 8.1
-      static constexpr int kPreloadAhead = 256;
-
-      // 4 accumulator registers, one for each row being processed.
-      // Each has 4 int32 lanes that corresponds to columns modulo 4, and
-      // will need to be horizontally reduced at the end.
-      int32x4_t acc0 = vdupq_n_s32(0);
-      int32x4_t acc1 = acc0;
-      int32x4_t acc2 = acc0;
-      int32x4_t acc3 = acc0;
-      int in = 0;
-      // As much as possible, handle 16 columns of the left-hand side matrix
-      // at a time. This allows for decent NEON implementation.
-      for (; in <= lhs_params.cols - 16; in += 16) {
-        const LhsScalar* local_filter_ptr = filter_ptr;
-        int16x8x2_t input_val =
-            Load16AndSubtractZeroPoint(rhs_data + in, rhs_params.zero_point);
-        int16x8x2_t filter_val_0 =
-            Load16AndSubtractZeroPoint(local_filter_ptr, lhs_params.zero_point);
-        optimized_ops_preload_l1_stream(local_filter_ptr +
-                                        kPreloadAhead / sizeof(LhsScalar));
-        local_filter_ptr += lhs_params.cols;
-        int16x8x2_t filter_val_1 =
-            Load16AndSubtractZeroPoint(local_filter_ptr, lhs_params.zero_point);
-        optimized_ops_preload_l1_stream(local_filter_ptr +
-                                        kPreloadAhead / sizeof(LhsScalar));
-        local_filter_ptr += lhs_params.cols;
-        int16x8x2_t filter_val_2 =
-            Load16AndSubtractZeroPoint(local_filter_ptr, lhs_params.zero_point);
-        optimized_ops_preload_l1_stream(local_filter_ptr +
-                                        kPreloadAhead / sizeof(LhsScalar));
-        local_filter_ptr += lhs_params.cols;
-        int16x8x2_t filter_val_3 =
-            Load16AndSubtractZeroPoint(local_filter_ptr, lhs_params.zero_point);
-        optimized_ops_preload_l1_stream(local_filter_ptr +
-                                        kPreloadAhead / sizeof(LhsScalar));
-        filter_ptr += 16;
-        acc0 = vmlal_s16(acc0, vget_low_s16(filter_val_0.val[0]),
-                         vget_low_s16(input_val.val[0]));
-        acc1 = vmlal_s16(acc1, vget_low_s16(filter_val_1.val[0]),
-                         vget_low_s16(input_val.val[0]));
-        acc2 = vmlal_s16(acc2, vget_low_s16(filter_val_2.val[0]),
-                         vget_low_s16(input_val.val[0]));
-        acc3 = vmlal_s16(acc3, vget_low_s16(filter_val_3.val[0]),
-                         vget_low_s16(input_val.val[0]));
-        acc0 = vmlal_s16(acc0, vget_low_s16(filter_val_0.val[1]),
-                         vget_low_s16(input_val.val[1]));
-        acc1 = vmlal_s16(acc1, vget_low_s16(filter_val_1.val[1]),
-                         vget_low_s16(input_val.val[1]));
-        acc2 = vmlal_s16(acc2, vget_low_s16(filter_val_2.val[1]),
-                         vget_low_s16(input_val.val[1]));
-        acc3 = vmlal_s16(acc3, vget_low_s16(filter_val_3.val[1]),
-                         vget_low_s16(input_val.val[1]));
-        acc0 = vmlal_s16(acc0, vget_high_s16(filter_val_0.val[0]),
-                         vget_high_s16(input_val.val[0]));
-        acc1 = vmlal_s16(acc1, vget_high_s16(filter_val_1.val[0]),
-                         vget_high_s16(input_val.val[0]));
-        acc2 = vmlal_s16(acc2, vget_high_s16(filter_val_2.val[0]),
-                         vget_high_s16(input_val.val[0]));
-        acc3 = vmlal_s16(acc3, vget_high_s16(filter_val_3.val[0]),
-                         vget_high_s16(input_val.val[0]));
-        acc0 = vmlal_s16(acc0, vget_high_s16(filter_val_0.val[1]),
-                         vget_high_s16(input_val.val[1]));
-        acc1 = vmlal_s16(acc1, vget_high_s16(filter_val_1.val[1]),
-                         vget_high_s16(input_val.val[1]));
-        acc2 = vmlal_s16(acc2, vget_high_s16(filter_val_2.val[1]),
-                         vget_high_s16(input_val.val[1]));
-        acc3 = vmlal_s16(acc3, vget_high_s16(filter_val_3.val[1]),
-                         vget_high_s16(input_val.val[1]));
-      }
-      // Less that 16 values remain. Try to handle 8 more.
-      if (in <= lhs_params.cols - 8) {
-        int16x8_t input_val =
-            Load8AndSubtractZeroPoint(rhs_data + in, rhs_params.zero_point);
-        int16x8_t filter_val_0 = Load8AndSubtractZeroPoint(
-            filter_ptr + 0 * lhs_params.cols, lhs_params.zero_point);
-        int16x8_t filter_val_1 = Load8AndSubtractZeroPoint(
-            filter_ptr + 1 * lhs_params.cols, lhs_params.zero_point);
-        int16x8_t filter_val_2 = Load8AndSubtractZeroPoint(
-            filter_ptr + 2 * lhs_params.cols, lhs_params.zero_point);
-        int16x8_t filter_val_3 = Load8AndSubtractZeroPoint(
-            filter_ptr + 3 * lhs_params.cols, lhs_params.zero_point);
-        filter_ptr += 8;
-        acc0 = vmlal_s16(acc0, vget_low_s16(filter_val_0),
-                         vget_low_s16(input_val));
-        acc1 = vmlal_s16(acc1, vget_low_s16(filter_val_1),
-                         vget_low_s16(input_val));
-        acc2 = vmlal_s16(acc2, vget_low_s16(filter_val_2),
-                         vget_low_s16(input_val));
-        acc3 = vmlal_s16(acc3, vget_low_s16(filter_val_3),
-                         vget_low_s16(input_val));
-        acc0 = vmlal_s16(acc0, vget_high_s16(filter_val_0),
-                         vget_high_s16(input_val));
-        acc1 = vmlal_s16(acc1, vget_high_s16(filter_val_1),
-                         vget_high_s16(input_val));
-        acc2 = vmlal_s16(acc2, vget_high_s16(filter_val_2),
-                         vget_high_s16(input_val));
-        acc3 = vmlal_s16(acc3, vget_high_s16(filter_val_3),
-                         vget_high_s16(input_val));
-        in += 8;
-      }
-      // Less than 8 values remain. Handle the remaining values
-      // in one more copy of the above code handling 8, where we
-      // walk back a few values to be able to load 8 values without
-      // overrunning the buffer. This is where we make use of the requirement
-      // (see IsSupportedGivenSufficientlyManyRows) that there at least
-      // 8 LHS columns.
-      if (in < lhs_params.cols) {
-        // `back` is how many entries to walk back by.
-        // Its value is necessarily between 1 and 7.
-        const int back = in + 8 - lhs_params.cols;
-        TFLITE_DCHECK_GE(back, 1);
-        TFLITE_DCHECK_LE(back, 7);
-        // Load 8 values as usual.
-        int16x8_t input_val = Load8AndSubtractZeroPoint(
-            rhs_data + lhs_params.cols - 8, rhs_params.zero_point);
-        const LhsScalar* local_filter_ptr = filter_ptr - back;
-        filter_ptr += lhs_params.cols - in;
-        int16x8_t filter_val_0 =
-            Load8AndSubtractZeroPoint(local_filter_ptr, lhs_params.zero_point);
-        local_filter_ptr += lhs_params.cols;
-        int16x8_t filter_val_1 =
-            Load8AndSubtractZeroPoint(local_filter_ptr, lhs_params.zero_point);
-        local_filter_ptr += lhs_params.cols;
-        int16x8_t filter_val_2 =
-            Load8AndSubtractZeroPoint(local_filter_ptr, lhs_params.zero_point);
-        local_filter_ptr += lhs_params.cols;
-        int16x8_t filter_val_3 =
-            Load8AndSubtractZeroPoint(local_filter_ptr, lhs_params.zero_point);
-        // Now zero out the `back` first entries of input_val.
-        // vsetq_lane_s16 takes a literal index, so we need unrolled code.
-        switch (back) {
-          case 7:
-            input_val = vsetq_lane_s16(0, input_val, 6);
-            [[clang::fallthrough]];
-          case 6:
-            input_val = vsetq_lane_s16(0, input_val, 5);
-            [[clang::fallthrough]];
-          case 5:
-            input_val = vsetq_lane_s16(0, input_val, 4);
-            [[clang::fallthrough]];
-          case 4:
-            input_val = vsetq_lane_s16(0, input_val, 3);
-            [[clang::fallthrough]];
-          case 3:
-            input_val = vsetq_lane_s16(0, input_val, 2);
-            [[clang::fallthrough]];
-          case 2:
-            input_val = vsetq_lane_s16(0, input_val, 1);
-            [[clang::fallthrough]];
-          default:
-            input_val = vsetq_lane_s16(0, input_val, 0);
-        }
-        // Multiply-accumulate 8 values as usual. The `back` first lanes
-        // of filter_val_* are junk, but it doesn't matter since they get
-        // multiplied by the zeros that we just wrote in the corresponding
-        // lanes of input_val.
-        acc0 = vmlal_s16(acc0, vget_low_s16(filter_val_0),
-                         vget_low_s16(input_val));
-        acc1 = vmlal_s16(acc1, vget_low_s16(filter_val_1),
-                         vget_low_s16(input_val));
-        acc2 = vmlal_s16(acc2, vget_low_s16(filter_val_2),
-                         vget_low_s16(input_val));
-        acc3 = vmlal_s16(acc3, vget_low_s16(filter_val_3),
-                         vget_low_s16(input_val));
-        acc0 = vmlal_s16(acc0, vget_high_s16(filter_val_0),
-                         vget_high_s16(input_val));
-        acc1 = vmlal_s16(acc1, vget_high_s16(filter_val_1),
-                         vget_high_s16(input_val));
-        acc2 = vmlal_s16(acc2, vget_high_s16(filter_val_2),
-                         vget_high_s16(input_val));
-        acc3 = vmlal_s16(acc3, vget_high_s16(filter_val_3),
-                         vget_high_s16(input_val));
-      }
-
-      // Horizontally reduce accumulators
-      int32x2_t pairwise_reduced_acc_0 =
-          vpadd_s32(vget_low_s32(acc0), vget_high_s32(acc0));
-      int32x2_t pairwise_reduced_acc_1 =
-          vpadd_s32(vget_low_s32(acc1), vget_high_s32(acc1));
-      int32x2_t pairwise_reduced_acc_2 =
-          vpadd_s32(vget_low_s32(acc2), vget_high_s32(acc2));
-      int32x2_t pairwise_reduced_acc_3 =
-          vpadd_s32(vget_low_s32(acc3), vget_high_s32(acc3));
-      const int32x2_t reduced_lo =
-          vpadd_s32(pairwise_reduced_acc_0, pairwise_reduced_acc_1);
-      const int32x2_t reduced_hi =
-          vpadd_s32(pairwise_reduced_acc_2, pairwise_reduced_acc_3);
-      int32x4_t reduced = vcombine_s32(reduced_lo, reduced_hi);
-      // End of horizontal reduction: now `reduced` is a single int32x4
-      // containing the 4 int32 accumulators corresponding to the 4 rows
-      // being processed.
-
-      // Add bias values.
-      if (params.bias) {
-        int32x4_t bias_vec = vld1q_s32(params.bias + row);
-        reduced = vaddq_s32(reduced, bias_vec);
-      }
-
-      // Get multiplier parameters.
-      int32x4_t multiplier_fixedpoint;
-      int32x4_t multiplier_exponent;
-      if (quantization_flavor ==
-          QuantizationFlavor::kIntegerWithPerRowMultiplier) {
-        multiplier_exponent =
-            vld1q_s32(params.multiplier_exponent_perchannel + row);
-        multiplier_fixedpoint =
-            vld1q_s32(params.multiplier_fixedpoint_perchannel + row);
-      } else {
-        multiplier_exponent = vdupq_n_s32(params.multiplier_exponent);
-        multiplier_fixedpoint = vdupq_n_s32(params.multiplier_fixedpoint);
-      }
-
-      // If positive exponent, shift left.
-      int32x4_t exponent_positive_part =
-          vmaxq_s32(multiplier_exponent, vdupq_n_s32(0));
-      reduced = vshlq_s32(reduced, exponent_positive_part);
-      // Multiply by the fixed-point multiplier.
-      reduced = vqrdmulhq_s32(reduced, multiplier_fixedpoint);
-      // If negative exponent, rounding-shift-right.
-      int32x4_t exponent_negative_part =
-          vminq_s32(multiplier_exponent, vdupq_n_s32(0));
-      reduced = vrshlq_s32(reduced, exponent_negative_part);
-
-      // Add the output offset.
-      const int32x4_t output_offset_vec = vdupq_n_s32(dst_params.zero_point);
-      reduced = vaddq_s32(reduced, output_offset_vec);
-
-      // Finally, clamp and store to the destination.
-      ClampAndStore(reduced, params.clamp_min, params.clamp_max,
-                    dst_data + row);
-    }
-  }
-};
-
-// The float specialization below is unconditionally faster than ruy
-// because ruy does not currently have any Gemv path.
-// But it is not unconditionally faster than Eigen, which is what is used
-// unless TFLITE_WITH_RUY is defined. Indeed, Eigen has decently efficient
-// Gemv paths, and they may use AVX instructions, while the present
-// NEON intrinsics code maps at best to SSE4 on x86.
-#ifdef TFLITE_WITH_RUY
-
-// We want to use fused multiply-add when it's available (that is, on A64
-// unconditionally and on A32 with VFPv4) because it's often faster, and
-// because non-fused seems not to be available in A64 so a conscientious
-// compiler might emit slow code (separate mul and add instructions) in order to
-// implement the vmlaq_f32 intrinsic with strict bit-for-bit exactness on A64.
-// (Compilers seem to be generating a fused fmla instruction at the moment,
-// but that could change).
-//
-// We still want to support building for A32 without VFPv4.
-inline float32x4_t mul_add(float32x4_t acc, float32x4_t lhs, float32x4_t rhs) {
-#ifdef __ARM_FEATURE_FMA
-  return vfmaq_f32(acc, lhs, rhs);
-#else
-  return vmlaq_f32(acc, lhs, rhs);
-#endif
-}
-
-template <>
-struct CustomGemvImpl {
-  // This implementation's inner loop processes 4 rows of the left-hand side
-  // matrix at a time.
-  static constexpr int kKernelRows = 4;
-
-  static bool IsSupportedGivenSufficientlyManyRows(
-      const MatrixParams& lhs_params,
-      const MatrixParams& rhs_params,
-      const MatrixParams& dst_params,
-      const GemmParams& params) {
-    // The kernel processes 4 LHS columns at once to fill float32x4 registers.
-    // The leftovers-handling code at the end works by loading a partially
-    // overlapping final register by walking back by a few (<4) floats
-    // to avoid running past the row's end. This relies on there being
-    // at least 4 LHS columns.
-    return lhs_params.cols >= 4;
-  }
-  static void Run(const MatrixParams& lhs_params, const float* lhs_data,
-                  const MatrixParams& rhs_params, const float* rhs_data,
-                  const MatrixParams& dst_params, float* dst_data,
-                  const GemmParams& params, int row_start,
-                  int row_end) {
-    // Handle kKernelRows ( == 4) rows of the left-hand side matrix at each
-    // iteration of this for loop.
-    TFLITE_DCHECK_GE(row_end - row_start, kKernelRows);
-    for (int row = row_start; row < row_end; row += kKernelRows) {
-      // Here is the magic where we allow this kernel to handle any odd number
-      // of rows as long as it's >= kKernelRows: the last group of `kKernelRows`
-      // rows will be nudged to fit, possibly by starting at an odd value of
-      // `row`.
-      row = std::min(row, row_end - kKernelRows);
-      const float* filter_ptr = lhs_data + row * lhs_params.cols;
-
-      static constexpr int kCacheLineSize = 64;
-      for (int k = 0; k < rhs_params.rows;
-           k += kCacheLineSize / sizeof(float)) {
-        optimized_ops_preload_l1_keep(rhs_data + k);
-      }
-
-      // kPreloadAhead is empirically determined.
-      // End-to-end latency (ms) on mobilenet_v2_0.35_96_float, 1 thread,
-      // on Qualcomm S855:
-      //
-      // kPreloadAhead | big core | little core
-      // --------------+----------+------------
-      // 64            | 2.4      | 15.2
-      // 128           | 2.15     | 12.9
-      // 256           | 2        | 12.9
-      // 512           | 2.08     | 13.3
-      // 1024          | 2.05     | 14.7
-      // no prefetch   | 2.1      | 28
-      static constexpr int kPreloadAhead = 256;
-
-      // 4 accumulator registers, one for each row being processed.
-      // Each has 4 float32 lanes that corresponds to columns modulo 4, and
-      // will need to be horizontally reduced at the end.
-      float32x4_t acc0 = vdupq_n_f32(0);
-      float32x4_t acc1 = acc0;
-      float32x4_t acc2 = acc0;
-      float32x4_t acc3 = acc0;
-      int in = 0;
-      // As much as possible, handle 4 columns of the left-hand side matrix
-      // at a time. This allows for decent NEON implementation.
-      for (; in <= lhs_params.cols - 4; in += 4) {
-        float32x4_t input_val = vld1q_f32(rhs_data + in);
-        const float* local_filter_ptr = filter_ptr;
-        float32x4_t filter_val_0 = vld1q_f32(local_filter_ptr);
-        optimized_ops_preload_l1_stream(local_filter_ptr +
-                                        kPreloadAhead / sizeof(float));
-        local_filter_ptr += lhs_params.cols;
-        float32x4_t filter_val_1 = vld1q_f32(local_filter_ptr);
-        optimized_ops_preload_l1_stream(local_filter_ptr +
-                                        kPreloadAhead / sizeof(float));
-        local_filter_ptr += lhs_params.cols;
-        float32x4_t filter_val_2 = vld1q_f32(local_filter_ptr);
-        optimized_ops_preload_l1_stream(local_filter_ptr +
-                                        kPreloadAhead / sizeof(float));
-        local_filter_ptr += lhs_params.cols;
-        float32x4_t filter_val_3 = vld1q_f32(local_filter_ptr);
-        optimized_ops_preload_l1_stream(local_filter_ptr +
-                                        kPreloadAhead / sizeof(float));
-        filter_ptr += 4;
-        acc0 = mul_add(acc0, filter_val_0, input_val);
-        acc1 = mul_add(acc1, filter_val_1, input_val);
-        acc2 = mul_add(acc2, filter_val_2, input_val);
-        acc3 = mul_add(acc3, filter_val_3, input_val);
-      }
-      // Less than 4 values remain. Handle the remaining values
-      // in one more copy of the above code handling 4, where we
-      // walk back a few values to be able to load 4 values without
-      // overrunning the buffer. This is where we make use of the requirement
-      // (see IsSupportedGivenSufficientlyManyRows) that there at least
-      // 4 LHS columns.
-      if (in < lhs_params.cols) {
-        // `back` is how many entries to walk back by.
-        // Its value is necessarily between 1 and 3.
-        const int back = in + 4 - lhs_params.cols;
-        TFLITE_DCHECK_GE(back, 1);
-        TFLITE_DCHECK_LE(back, 3);
-        // Load 4 values as usual.
-        float32x4_t input_val = vld1q_f32(rhs_data + lhs_params.cols - 4);
-        const float* local_filter_ptr = filter_ptr - back;
-        filter_ptr += lhs_params.cols - in;
-        float32x4_t filter_val_0 = vld1q_f32(local_filter_ptr);
-        local_filter_ptr += lhs_params.cols;
-        float32x4_t filter_val_1 = vld1q_f32(local_filter_ptr);
-        local_filter_ptr += lhs_params.cols;
-        float32x4_t filter_val_2 = vld1q_f32(local_filter_ptr);
-        local_filter_ptr += lhs_params.cols;
-        float32x4_t filter_val_3 = vld1q_f32(local_filter_ptr);
-        // Now zero out the `back` first entries of input_val.
-        // vsetq_lane_f32 takes a literal index, so we need unrolled code.
-        switch (back) {
-          case 3:
-            input_val = vsetq_lane_f32(0, input_val, 2);
-            [[clang::fallthrough]];
-          case 2:
-            input_val = vsetq_lane_f32(0, input_val, 1);
-            [[clang::fallthrough]];
-          default:
-            input_val = vsetq_lane_f32(0, input_val, 0);
-        }
-        // Multiply-accumulate 4 values as usual. The `back` first lanes
-        // of filter_val_* are junk, but it doesn't matter since they get
-        // multiplied by the zeros that we just wrote in the corresponding
-        // lanes of input_val.
-        acc0 = mul_add(acc0, filter_val_0, input_val);
-        acc1 = mul_add(acc1, filter_val_1, input_val);
-        acc2 = mul_add(acc2, filter_val_2, input_val);
-        acc3 = mul_add(acc3, filter_val_3, input_val);
-      }
-
-      // Horizontally reduce accumulators
-      float32x2_t pairwise_reduced_acc_0 =
-          vpadd_f32(vget_low_f32(acc0), vget_high_f32(acc0));
-      float32x2_t pairwise_reduced_acc_1 =
-          vpadd_f32(vget_low_f32(acc1), vget_high_f32(acc1));
-      float32x2_t pairwise_reduced_acc_2 =
-          vpadd_f32(vget_low_f32(acc2), vget_high_f32(acc2));
-      float32x2_t pairwise_reduced_acc_3 =
-          vpadd_f32(vget_low_f32(acc3), vget_high_f32(acc3));
-      float32x2_t reduced_lo =
-          vpadd_f32(pairwise_reduced_acc_0, pairwise_reduced_acc_1);
-      float32x2_t reduced_hi =
-          vpadd_f32(pairwise_reduced_acc_2, pairwise_reduced_acc_3);
-      float32x4_t reduced = vcombine_f32(reduced_lo, reduced_hi);
-      // End of horizontal reduction: now `reduced` is a single float32x4
-      // containing the 4 float32 accumulators corresponding to the 4 rows
-      // being processed.
-
-      if (params.bias) {
-        // Add bias values.
-        reduced = vaddq_f32(reduced, vld1q_f32(params.bias + row));
-      }
-
-      // Clamp and store to destination.
-      reduced = vminq_f32(reduced, vdupq_n_f32(params.clamp_max));
-      reduced = vmaxq_f32(reduced, vdupq_n_f32(params.clamp_min));
-      vst1q_f32(dst_data + row, reduced);
-    }
-  }
-};
-
-#endif  // TFLITE_WITH_RUY
-
-#endif  // USE_NEON
-
-}  // namespace detail
-}  // namespace cpu_backend_gemm
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_CUSTOM_GEMV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_eigen.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_eigen.h
deleted file mode 100644
index bd4733d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_eigen.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/* 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_KERNELS_CPU_BACKEND_GEMM_EIGEN_H_
-#define TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_EIGEN_H_
-
-#ifndef TFLITE_WITH_RUY
-
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
-
-namespace tflite {
-namespace cpu_backend_gemm {
-namespace detail {
-
-struct GemmImplUsingEigen {
-  static void Run(const MatrixParams& lhs_params, const float* lhs_data,
-                  const MatrixParams& rhs_params, const float* rhs_data,
-                  const MatrixParams& dst_params, float* dst_data,
-                  const GemmParams& params,
-                  CpuBackendContext* /* context */);
-};
-
-}  // namespace detail
-}  // namespace cpu_backend_gemm
-}  // namespace tflite
-
-#endif  // not TFLITE_WITH_RUY
-
-#endif  // TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_EIGEN_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_gemmlowp.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_gemmlowp.h
deleted file mode 100644
index b792667..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_gemmlowp.h
+++ /dev/null
@@ -1,195 +0,0 @@
-/* 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_KERNELS_CPU_BACKEND_GEMM_GEMMLOWP_H_
-#define TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_GEMMLOWP_H_
-
-#include 
-
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-#ifndef TFLITE_WITH_RUY
-
-#include 
-#include 
-
-#include "public/gemmlowp.h"
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_ruy.h"
-
-namespace tflite {
-namespace cpu_backend_gemm {
-namespace detail {
-
-template 
-struct GemmlowpSaturatingCastStage {};
-
-template <>
-struct GemmlowpSaturatingCastStage {
-  using Type = gemmlowp::OutputStageSaturatingCastToUint8;
-};
-
-template <>
-struct GemmlowpSaturatingCastStage {
-  using Type = gemmlowp::OutputStageSaturatingCastToInt8;
-};
-
-template <>
-struct GemmlowpSaturatingCastStage {
-  using Type = gemmlowp::OutputStageSaturatingCastToInt16;
-};
-
-template 
-struct GemmlowpBitDepthParams {};
-
-template <>
-struct GemmlowpBitDepthParams {
-  using Type = gemmlowp::L8R8WithLhsNonzeroBitDepthParams;
-};
-
-template <>
-struct GemmlowpBitDepthParams {
-  using Type = gemmlowp::SignedL8R8WithLhsNonzeroBitDepthParams;
-};
-
-template 
-struct GemmImplUsingGemmlowp {};
-
-template 
-struct GemmImplUsingGemmlowp<
-    LhsScalar, RhsScalar, AccumScalar, DstScalar,
-    QuantizationFlavor::kIntegerWithUniformMultiplier> {
-  static_assert(std::is_same::value, "");
-  static_assert(std::is_same::value, "");
-  using SrcScalar = LhsScalar;
-
-  static void Run(
-      const MatrixParams& lhs_params, const SrcScalar* lhs_data,
-      const MatrixParams& rhs_params, const SrcScalar* rhs_data,
-      const MatrixParams& dst_params, DstScalar* dst_data,
-      const GemmParams&
-          params,
-      CpuBackendContext* context) {
-    gemmlowp::MatrixMap
-        gemmlowp_lhs(lhs_data, lhs_params.rows, lhs_params.cols);
-    gemmlowp::MatrixMap
-        gemmlowp_rhs(rhs_data, rhs_params.rows, rhs_params.cols);
-    gemmlowp::MatrixMap gemmlowp_dst(
-        dst_data, dst_params.rows, dst_params.cols);
-
-    using ColVectorMap =
-        gemmlowp::VectorMap;
-    gemmlowp::OutputStageScaleInt32ByFixedPointAndExponent scale_stage;
-    scale_stage.result_offset_after_shift = dst_params.zero_point;
-    scale_stage.result_fixedpoint_multiplier = params.multiplier_fixedpoint;
-    scale_stage.result_exponent = params.multiplier_exponent;
-    using SaturatingCastStageType =
-        typename GemmlowpSaturatingCastStage::Type;
-    gemmlowp::OutputStageClamp clamp_stage;
-    clamp_stage.min = params.clamp_min;
-    clamp_stage.max = params.clamp_max;
-    SaturatingCastStageType saturating_cast_stage;
-    using BitDepthParams = typename GemmlowpBitDepthParams::Type;
-    if (params.bias) {
-      ColVectorMap bias_vector(params.bias, lhs_params.rows);
-      gemmlowp::OutputStageBiasAddition bias_addition_stage;
-      bias_addition_stage.bias_vector = bias_vector;
-      auto output_pipeline = std::make_tuple(
-          bias_addition_stage, scale_stage, clamp_stage, saturating_cast_stage);
-      gemmlowp::GemmWithOutputPipeline(
-          context->gemmlowp_context(), gemmlowp_lhs, gemmlowp_rhs,
-          &gemmlowp_dst, -lhs_params.zero_point, -rhs_params.zero_point,
-          output_pipeline);
-    } else {
-      auto output_pipeline =
-          std::make_tuple(scale_stage, clamp_stage, saturating_cast_stage);
-      gemmlowp::GemmWithOutputPipeline(
-          context->gemmlowp_context(), gemmlowp_lhs, gemmlowp_rhs,
-          &gemmlowp_dst, -lhs_params.zero_point, -rhs_params.zero_point,
-          output_pipeline);
-    }
-  }
-};
-
-template 
-struct GemmImplUsingGemmlowp {
-  static_assert(std::is_same::value, "");
-  static_assert(std::is_same::value, "");
-  using SrcScalar = LhsScalar;
-
-  static void Run(
-      const MatrixParams& lhs_params, const SrcScalar* lhs_data,
-      const MatrixParams& rhs_params, const SrcScalar* rhs_data,
-      const MatrixParams& dst_params, DstScalar* dst_data,
-      const GemmParams&
-          params,
-      CpuBackendContext* context) {
-    // gemmlowp support for this per-channel path is limited to NEON.
-    // We fall back to ruy outside of NEON.
-#ifdef GEMMLOWP_NEON
-    gemmlowp::MatrixMap
-        gemmlowp_lhs(lhs_data, lhs_params.rows, lhs_params.cols);
-    gemmlowp::MatrixMap
-        gemmlowp_rhs(rhs_data, rhs_params.rows, rhs_params.cols);
-    gemmlowp::MatrixMap gemmlowp_dst(
-        dst_data, dst_params.rows, dst_params.cols);
-
-    using ColVectorMap =
-        gemmlowp::VectorMap;
-    ColVectorMap bias_vector(params.bias, lhs_params.rows);
-    gemmlowp::OutputStageBiasAddition bias_addition_stage;
-    bias_addition_stage.bias_vector = bias_vector;
-    gemmlowp::OutputStageScaleInt32ByFixedPointAndExponentPC<
-        gemmlowp::VectorShape::Col>
-        scale_stage;
-    scale_stage.result_offset_after_shift = dst_params.zero_point;
-    scale_stage.result_fixedpoint_multiplier =
-        ColVectorMap(params.multiplier_fixedpoint_perchannel, dst_params.rows);
-    scale_stage.result_exponent =
-        ColVectorMap(params.multiplier_exponent_perchannel, dst_params.rows);
-    using SaturatingCastStageType =
-        typename GemmlowpSaturatingCastStage::Type;
-    gemmlowp::OutputStageClamp clamp_stage;
-    clamp_stage.min = params.clamp_min;
-    clamp_stage.max = params.clamp_max;
-    SaturatingCastStageType saturating_cast_stage;
-    auto output_pipeline = std::make_tuple(bias_addition_stage, scale_stage,
-                                           clamp_stage, saturating_cast_stage);
-    using BitDepthParams = typename GemmlowpBitDepthParams::Type;
-    gemmlowp::GemmWithOutputPipeline(
-        context->gemmlowp_context(), gemmlowp_lhs, gemmlowp_rhs, &gemmlowp_dst,
-        -lhs_params.zero_point, -rhs_params.zero_point, output_pipeline);
-#else
-    GemmImplUsingRuy::
-        Run(lhs_params, lhs_data, rhs_params, rhs_data, dst_params, dst_data,
-            params, context);
-#endif
-  }
-};
-
-}  // namespace detail
-}  // namespace cpu_backend_gemm
-}  // namespace tflite
-
-#endif  // not TFLITE_WITH_RUY
-
-#endif  // TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_GEMMLOWP_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_params.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_params.h
deleted file mode 100644
index ef06d97..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_params.h
+++ /dev/null
@@ -1,245 +0,0 @@
-/* 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_KERNELS_CPU_BACKEND_GEMM_PARAMS_H_
-#define TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_PARAMS_H_
-
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-
-namespace tflite {
-
-namespace cpu_backend_gemm {
-
-// Matrix storage order: column-major or row-major.
-enum class Order { kColMajor, kRowMajor };
-
-enum class CachePolicy : std::uint8_t {
-  kNeverCache,
-  kCacheIfLargeSpeedup,
-  kAlwaysCache,
-};
-
-inline CachePolicy DefaultCachePolicy(bool is_constant_data) {
-  return is_constant_data ? CachePolicy::kCacheIfLargeSpeedup
-                          : CachePolicy::kNeverCache;
-}
-
-// MatrixParams encapsulates the parameters that Gemm needs about each
-// matrix, besides the buffer data pointer.
-// Compare to ruy::Matrix, which also encapsulates the data pointer.
-// Rationale for leaving the data pointer out of here: doing so
-// requires complicated const-correctness mechanics. See
-// ruy::ConstCheckingPtr.
-template 
-struct MatrixParams {
-  // Storage layout order. For now we only do plain linear non-strided
-  // layout. It would be easy to support a stride if needed.
-  Order order = Order::kColMajor;
-  // Number of rows of the matrix.
-  int rows = 0;
-  // Number of columns of the matrix.
-  int cols = 0;
-  // The zero_point, i.e. which Scalar value is to be interpreted as zero.
-  // When Scalar is floating-point, this must be 0.
-  Scalar zero_point = 0;
-  // When the data pointed to by this matrix is constant data, so that it is
-  // valid to assume that equality of pointers implies equality of data,
-  // a CachePolicy may be used instead of the default kNeverCache,
-  // which will enable ruy to take advantage of this constancy of the data to
-  // cache the packing work, which can be a large speedup in matrix*vector
-  // and other narrow shapes.
-  CachePolicy cache_policy = CachePolicy::kNeverCache;
-};
-
-// Enumeration of broad categories of Gemm.
-//
-// The primary reason for this to exist is to allow Gemm to compile
-// only uniform-quantized or only per-channel-quantized code paths.
-// This is unneeded with ruy as the back-end, as this is only a runtime
-// difference in ruy, but with gemmlowp these really are separate code
-// paths and templatizing in a QuantizationFlavor is necessary to avoid
-// compiling unused gemmlowp code. Indeed, TFLite currently uses
-// uint8 with uniform quantization and int8 with per-channel quantization,
-// and does not use uint8 with per-channel. We want to avoid compiling
-// the gemmlowp uint8 per-channel path when gemmlowp is the back-end.
-//
-// It's possible to drop this in the future if gemmlowp goes away and no
-// other then-relevant backend library handles quantized paths in a way that
-// requires knowing this at compile-time.
-enum class QuantizationFlavor {
-  // Floating-point Gemm: the accumulators are not multiplied by any
-  // 'multiplier'.
-  kFloatingPoint,
-  // Quantized Gemm using a single multiplier for all accumulators.
-  kIntegerWithUniformMultiplier,
-  // Quantized Gemm using a separate multipliers for accumulators of each
-  // row of the destination matrix. This is what is called 'per-channel'
-  // in GemmParams. Here we use the more specific 'per-row' terminology
-  // to allow for the possibility of 'per-column' in the future, and to
-  // allow for that to be a separate code path in some back-end such as
-  // gemmlowp.
-  kIntegerWithPerRowMultiplier
-};
-
-// Additional parameters that Gemm needs, beyond what falls into
-// the MatrixParams that it takes. Compare to ruy::Spec.
-//
-// Decoupling AccumScalar from DstScalar (rather than deducing it from that)
-// is useful future-proofing. Think of a float16 path using float32 accum.
-//
-// QuantizationFlavor is passed here even though it's technically not used
-// in this class. This is so that we retain the ability in the future to
-// specialize this class for quantization flavor, and this allows for
-// Gemm to be templatized in quantization_flavor via the GemmParams that it
-// takes, allowing for automatic template parameter deduction to take place,
-// so that most call sites don't need to specify a QuantizationFlavor
-// (only those that need perchannel quantization do).
-template ::value
-                  ? QuantizationFlavor::kFloatingPoint
-                  : QuantizationFlavor::kIntegerWithUniformMultiplier>
-struct GemmParams {
-  // Only for non-floating-point cases. The fixed-point part (i.e. the mantissa)
-  // of the multiplier by which accumulators are multiplied before being casted
-  // to the destination type.
-  AccumScalar multiplier_fixedpoint = 0;
-  // Only for non-floating-point cases. The exponent part of the aforementioned
-  // multiplier.
-  int multiplier_exponent = 0;
-  // Per-channel variant of multiplier_fixedpoint. If not nullptr, this must
-  // point to a buffer of as many values as there are rows in the destination
-  // matrix. Each row of the destination matrix will use the corresponding
-  // buffer element instead of multiplier_fixedpoint.
-  const AccumScalar* multiplier_fixedpoint_perchannel = nullptr;
-  // Per-channel variant of multiplier_exponent. If not nullptr, this must
-  // point to a buffer of as many values as there are rows in the destination
-  // matrix. Each row of the destination matrix will use the corresponding
-  // buffer element instead of multiplier_exponent.
-  //
-  // Either none or both of multiplier_exponent_perchannel and
-  // multiplier_fixedpoint_perchannel must be nullptr.
-  const int* multiplier_exponent_perchannel = nullptr;
-  // The bias vector data, if not null.
-  const AccumScalar* bias = nullptr;
-  // min clamp bound of destination values.
-  DstScalar clamp_min = std::is_floating_point::value
-                            ? -std::numeric_limits::infinity()
-                            : std::numeric_limits::lowest();
-  // max clamp bound of destination values.
-  DstScalar clamp_max = std::is_floating_point::value
-                            ? std::numeric_limits::infinity()
-                            : std::numeric_limits::max();
-};
-
-/* Convenience typedefs */
-
-template 
-using QuantizedGemmParams = GemmParams;
-
-using FloatGemmParams = GemmParams;
-
-/* Validation functions */
-
-// Note that this uses TFLITE_DCHECK from kernels/internal/compatibility.h
-// and not TF_LITE_ASSERT from op_macros.h. We want this to be explicitly
-// debug-build-only assertions so that there's not reason not to
-// generously validate, and TF_LITE_ASSERT is actually at the moment
-// a release-build assertion. See b/131587258.
-
-// Validates self-consistency of GemmParams.
-template 
-void ValidateGemmParams(
-    const GemmParams& params) {
-  // Guard consistency of the quantized multiplier fields.
-  if (quantization_flavor == QuantizationFlavor::kFloatingPoint) {
-    TFLITE_DCHECK(!params.multiplier_fixedpoint);
-    TFLITE_DCHECK(!params.multiplier_exponent);
-    TFLITE_DCHECK(!params.multiplier_fixedpoint_perchannel);
-    TFLITE_DCHECK(!params.multiplier_exponent_perchannel);
-  } else if (quantization_flavor ==
-                 QuantizationFlavor::kIntegerWithUniformMultiplier &&
-             !std::is_same::value) {
-    TFLITE_DCHECK(params.multiplier_fixedpoint);
-    // Nothing to check about multiplier_exponent
-    TFLITE_DCHECK(!params.multiplier_fixedpoint_perchannel);
-    TFLITE_DCHECK(!params.multiplier_exponent_perchannel);
-  } else if (quantization_flavor ==
-                 QuantizationFlavor::kIntegerWithPerRowMultiplier &&
-             !std::is_same::value) {
-    TFLITE_DCHECK(!params.multiplier_fixedpoint);
-    TFLITE_DCHECK(!params.multiplier_exponent);
-    TFLITE_DCHECK(params.multiplier_fixedpoint_perchannel);
-    TFLITE_DCHECK(params.multiplier_exponent_perchannel);
-  } else {
-    // For the get raw accumulator case, we should make sure none of the
-    // quantization params are set.
-    TFLITE_DCHECK(!params.multiplier_fixedpoint);
-    TFLITE_DCHECK(!params.multiplier_exponent);
-    TFLITE_DCHECK(!params.multiplier_fixedpoint_perchannel);
-    TFLITE_DCHECK(!params.multiplier_exponent_perchannel);
-  }
-}
-
-namespace detail {
-
-template 
-struct ValidateTypes {
-  // This generic implementation is for quantized flavors.
-  // kFloatingPoint will be a specialization below.
-  static_assert(!std::is_floating_point::value, "");
-  static_assert(!std::is_floating_point::value, "");
-  static_assert(!std::is_floating_point::value, "");
-  // No requirement on DstScalar --- we might in the future allow it
-  // to be floating point even in a quantized Gemm.
-};
-
-template 
-struct ValidateTypes {
-  static_assert(std::is_floating_point::value, "");
-  static_assert(std::is_floating_point::value, "");
-  static_assert(std::is_floating_point::value, "");
-  static_assert(std::is_floating_point::value, "");
-};
-
-}  // namespace detail
-
-// Validates overall consistency of all the parameters taken by a Gemm call:
-// the 3 MatrixParams and the GemmParams.
-template 
-void ValidateParams(
-    const MatrixParams& lhs_params,
-    const MatrixParams& rhs_params,
-    const MatrixParams& dst_params,
-    const GemmParams& params) {
-  (void)detail::ValidateTypes();
-  ValidateGemmParams(params);
-}
-
-}  // namespace cpu_backend_gemm
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_PARAMS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_ruy.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_ruy.h
deleted file mode 100644
index 6a81883..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_ruy.h
+++ /dev/null
@@ -1,150 +0,0 @@
-/* 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_KERNELS_CPU_BACKEND_GEMM_RUY_H_
-#define TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_RUY_H_
-
-#include "ruy/matrix.h"  // from @ruy
-#include "ruy/mul_params.h"  // from @ruy
-#include "ruy/ruy.h"  // from @ruy
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-
-namespace tflite {
-namespace cpu_backend_gemm {
-namespace detail {
-
-inline ruy::CachePolicy ToRuyCachePolicy(CachePolicy cache_policy) {
-  switch (cache_policy) {
-    case CachePolicy::kNeverCache:
-      return ruy::CachePolicy::kNeverCache;
-    case CachePolicy::kCacheIfLargeSpeedup:
-      return ruy::CachePolicy::kCacheIfLargeSpeedup;
-    case CachePolicy::kAlwaysCache:
-      return ruy::CachePolicy::kAlwaysCache;
-    default:
-      TFLITE_DCHECK(false);
-      return ruy::CachePolicy::kNeverCache;
-  }
-}
-
-template 
-void MakeRuyMatrix(const MatrixParams& params, DataPointer data_ptr,
-                   ruy::Matrix* dst, bool use_caching = false) {
-  ruy::Order ruy_order = params.order == Order::kColMajor
-                             ? ruy::Order::kColMajor
-                             : ruy::Order::kRowMajor;
-  ruy::MakeSimpleLayout(params.rows, params.cols, ruy_order,
-                        dst->mutable_layout());
-  // Note that ruy::Matrix::data is a ConstCheckingPtr, not a plain pointer.
-  // It does care whether we assign to it a Scalar* or a const Scalar*.
-  dst->set_data(data_ptr);
-  dst->set_zero_point(params.zero_point);
-  if (use_caching) {
-    dst->set_cache_policy(ToRuyCachePolicy(params.cache_policy));
-  }
-}
-
-// Floating-point case.
-template 
-struct MakeRuyMulParamsImpl final {
-  static void Run(
-      const GemmParams& params,
-      ruy::MulParams* ruy_mul_params) {
-    static_assert(quantization_flavor == QuantizationFlavor::kFloatingPoint,
-                  "");
-    ruy_mul_params->set_bias(params.bias);
-    ruy_mul_params->set_clamp_min(params.clamp_min);
-    ruy_mul_params->set_clamp_max(params.clamp_max);
-  }
-};
-
-// Integer-quantized case with destination type narrower than int32
-template 
-struct MakeRuyMulParamsImpl
-    final {
-  static void Run(
-      const GemmParams& params,
-      ruy::MulParams* ruy_mul_params) {
-    static_assert(sizeof(DstScalar) < sizeof(std::int32_t), "");
-    if (quantization_flavor ==
-        QuantizationFlavor::kIntegerWithUniformMultiplier) {
-      ruy_mul_params->set_multiplier_fixedpoint(params.multiplier_fixedpoint);
-      ruy_mul_params->set_multiplier_exponent(params.multiplier_exponent);
-    }
-    if (quantization_flavor ==
-        QuantizationFlavor::kIntegerWithPerRowMultiplier) {
-      ruy_mul_params->set_multiplier_fixedpoint_perchannel(
-          params.multiplier_fixedpoint_perchannel);
-      ruy_mul_params->set_multiplier_exponent_perchannel(
-          params.multiplier_exponent_perchannel);
-    }
-    ruy_mul_params->set_bias(params.bias);
-    ruy_mul_params->set_clamp_min(params.clamp_min);
-    ruy_mul_params->set_clamp_max(params.clamp_max);
-  }
-};
-
-// Raw-integer case with destination type int32.
-template 
-struct MakeRuyMulParamsImpl
-    final {
-  static void Run(
-      const GemmParams& params,
-      ruy::MulParams* ruy_mul_params) {
-    ruy_mul_params->set_bias(params.bias);
-  }
-};
-
-template 
-void MakeRuyMulParams(
-    const GemmParams& params,
-    ruy::MulParams* ruy_mul_params) {
-  MakeRuyMulParamsImpl::Run(
-      params, ruy_mul_params);
-}
-
-template 
-struct GemmImplUsingRuy {
-  static void Run(
-      const MatrixParams& lhs_params, const LhsScalar* lhs_data,
-      const MatrixParams& rhs_params, const RhsScalar* rhs_data,
-      const MatrixParams& dst_params, DstScalar* dst_data,
-      const GemmParams& params,
-      CpuBackendContext* context) {
-    ruy::Matrix ruy_lhs;
-    ruy::Matrix ruy_rhs;
-    ruy::Matrix ruy_dst;
-    MakeRuyMatrix(lhs_params, lhs_data, &ruy_lhs, context->use_caching());
-    MakeRuyMatrix(rhs_params, rhs_data, &ruy_rhs, context->use_caching());
-    MakeRuyMatrix(dst_params, dst_data, &ruy_dst);
-
-    ruy::MulParams ruy_mul_params;
-    MakeRuyMulParams(params, &ruy_mul_params);
-
-    ruy::Mul(ruy_lhs, ruy_rhs, ruy_mul_params, context->ruy_context(),
-             &ruy_dst);
-  }
-};
-
-}  // namespace detail
-}  // namespace cpu_backend_gemm
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_CPU_BACKEND_GEMM_RUY_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_x86.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_x86.h
deleted file mode 100644
index 20af953..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_gemm_x86.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* 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_KERNELS_CPU_BACKEND_X86_H_
-#define TENSORFLOW_LITE_KERNELS_CPU_BACKEND_X86_H_
-
-// If TFLITE_WITH_RUY is set, Ruy is the only GEMM option. In this header
-// we select either Ruy or an alternative based on the SIMD extentions
-// available on the given x86 platform.
-#ifndef TFLITE_WITH_RUY
-
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_eigen.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_gemmlowp.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_ruy.h"
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-
-namespace tflite {
-namespace cpu_backend_gemm {
-namespace detail {
-
-template 
-struct GemmImplX86 {
-  static void Run(
-      const MatrixParams& lhs_params, const LhsScalar* lhs_data,
-      const MatrixParams& rhs_params, const RhsScalar* rhs_data,
-      const MatrixParams& dst_params, DstScalar* dst_data,
-      const GemmParams& params,
-      CpuBackendContext* context) {
-    // Run-time dispatch to Ruy for platforms with AVX or above.
-    if (context->HasAvxOrAbove()) {
-      detail::GemmImplUsingRuy::Run(lhs_params, lhs_data,
-                                                         rhs_params, rhs_data,
-                                                         dst_params, dst_data,
-                                                         params, context);
-    } else {
-      // Dispatch to gemmlowp for SSE.
-      detail::GemmImplUsingGemmlowp<
-          LhsScalar, RhsScalar, AccumScalar, DstScalar,
-          quantization_flavor>::Run(lhs_params, lhs_data, rhs_params, rhs_data,
-                                    dst_params, dst_data, params, context);
-    }
-  }
-};
-
-// For float, again prefer Ruy in all cases, but defer to eigen if no flavor of
-// AVX is present.
-template <>
-struct GemmImplX86 {
-  static void Run(const MatrixParams& lhs_params, const float* lhs_data,
-                  const MatrixParams& rhs_params, const float* rhs_data,
-                  const MatrixParams& dst_params, float* dst_data,
-                  const GemmParams& params,
-                  CpuBackendContext* context) {
-    // Run-time dispatch to Ruy for platforms with AVX or above.
-    if (context->HasAvxOrAbove()) {
-      detail::GemmImplUsingRuy<
-          float, float, float, float,
-          QuantizationFlavor::kFloatingPoint>::Run(lhs_params, lhs_data,
-                                                   rhs_params, rhs_data,
-                                                   dst_params, dst_data, params,
-                                                   context);
-    } else {
-      // Dispatch to gemmlowp for SSE.
-      GemmImplUsingEigen::Run(lhs_params, lhs_data, rhs_params, rhs_data,
-                              dst_params, dst_data, params, context);
-    }
-  }
-};
-
-// gemmlowp requires NEON for certain quantization cases. See note in
-// cpu_backend_gemm.h
-#if !defined(GEMMLOWP_NEON)
-template 
-struct GemmImplX86
-    : detail::GemmImplUsingRuy {};
-
-template 
-struct GemmImplX86
-    : detail::GemmImplUsingRuy {};
-
-template 
-struct GemmImplX86
-    : detail::GemmImplUsingRuy {};
-#endif  // not GEMMLOWP_NEON
-}  // namespace detail
-}  // namespace cpu_backend_gemm
-}  // namespace tflite
-
-#endif  // not TFLITE_WITH_RUY
-
-#endif  // TENSORFLOW_LITE_KERNELS_CPU_BACKEND_X86_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_threadpool.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_threadpool.h
deleted file mode 100644
index 39eafd5..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/cpu_backend_threadpool.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* 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_KERNELS_CPU_BACKEND_THREADPOOL_H_
-#define TENSORFLOW_LITE_KERNELS_CPU_BACKEND_THREADPOOL_H_
-
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-
-#ifdef TFLITE_WITH_RUY
-#include "ruy/context.h"  // from @ruy
-#include "ruy/thread_pool.h"  // from @ruy
-#else
-#include "public/gemmlowp.h"
-#endif
-
-namespace tflite {
-namespace cpu_backend_threadpool {
-
-#ifdef TFLITE_WITH_RUY
-
-using Task = ruy::Task;
-
-template 
-void Execute(int tasks_count, TaskType* tasks,
-             CpuBackendContext* cpu_backend_context) {
-  TFLITE_DCHECK_LE(tasks_count, cpu_backend_context->max_num_threads());
-  cpu_backend_context->ruy_context()->mutable_thread_pool()->Execute(
-      tasks_count, tasks);
-}
-
-#else  // not TFLITE_WITH_RUY
-
-using Task = gemmlowp::Task;
-
-template 
-void Execute(int tasks_count, TaskType* tasks,
-             CpuBackendContext* cpu_backend_context) {
-  TFLITE_DCHECK_LE(tasks_count, cpu_backend_context->max_num_threads());
-  cpu_backend_context->gemmlowp_context()->workers_pool()->Execute(tasks_count,
-                                                                   tasks);
-}
-
-#endif
-
-}  // namespace cpu_backend_threadpool
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_CPU_BACKEND_THREADPOOL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/custom_ops_register.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/custom_ops_register.h
deleted file mode 100644
index a24c062..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/custom_ops_register.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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_KERNELS_CUSTOM_OPS_REGISTER_H_
-#define TENSORFLOW_LITE_KERNELS_CUSTOM_OPS_REGISTER_H_
-
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-namespace ops {
-namespace custom {
-
-TfLiteRegistration* Register_HASHTABLE();
-TfLiteRegistration* Register_HASHTABLE_FIND();
-TfLiteRegistration* Register_HASHTABLE_IMPORT();
-TfLiteRegistration* Register_HASHTABLE_SIZE();
-TfLiteRegistration* Register_IMAG();
-TfLiteRegistration* Register_MULTINOMIAL();
-TfLiteRegistration* Register_RANDOM_STANDARD_NORMAL();
-TfLiteRegistration* Register_REAL();
-TfLiteRegistration* Register_RFFT2D();
-
-}  // namespace custom
-}  // namespace ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_CUSTOM_OPS_REGISTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/dequantize.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/dequantize.h
deleted file mode 100644
index 30739eb..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/dequantize.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* 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_KERNELS_DEQUANTIZE_H_
-#define TENSORFLOW_LITE_KERNELS_DEQUANTIZE_H_
-
-#include 
-
-#include "third_party/eigen3/Eigen/Core"
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/kernels/internal/optimized/optimized_ops.h"
-#include "tensorflow/lite/kernels/internal/reference/dequantize.h"
-#include "tensorflow/lite/kernels/internal/reference/integer_ops/dequantize.h"
-#include "tensorflow/lite/kernels/internal/reference/reference_ops.h"
-#include "tensorflow/lite/kernels/internal/tensor.h"
-#include "tensorflow/lite/kernels/internal/tensor_ctypes.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace ops {
-namespace builtin {
-namespace dequantize {
-
-// This file has two implementation of Dequantize.
-enum KernelType {
-  kReference,
-  kGenericOptimized,
-};
-
-template 
-TfLiteStatus DequantizeImpl(TfLiteContext* context, TfLiteNode* node,
-                            const TfLiteTensor* input, TfLiteTensor* output) {
-  DequantizationParams op_params;
-  op_params.zero_point = input->params.zero_point;
-  op_params.scale = input->params.scale;
-  switch (input->type) {
-    case kTfLiteUInt8:
-      if (kernel_type == kReference) {
-        reference_ops::Dequantize(
-            op_params, GetTensorShape(input), GetTensorData(input),
-            GetTensorShape(output), GetTensorData(output));
-      } else {
-        optimized_ops::Dequantize(
-            op_params, GetTensorShape(input), GetTensorData(input),
-            GetTensorShape(output), GetTensorData(output));
-      }
-      break;
-    case kTfLiteInt8:
-      if (kernel_type == kReference) {
-        reference_integer_ops::Dequantize(
-            op_params, GetTensorShape(input), GetTensorData(input),
-            GetTensorShape(output), GetTensorData(output));
-      } else {
-        optimized_ops::Dequantize(
-            op_params, GetTensorShape(input), GetTensorData(input),
-            GetTensorShape(output), GetTensorData(output));
-      }
-      break;
-    case kTfLiteInt16:
-      if (kernel_type == kReference) {
-        reference_integer_ops::Dequantize(
-            op_params, GetTensorShape(input), GetTensorData(input),
-            GetTensorShape(output), GetTensorData(output));
-      } else {
-        optimized_ops::Dequantize(
-            op_params, GetTensorShape(input), GetTensorData(input),
-            GetTensorShape(output), GetTensorData(output));
-      }
-      break;
-    case kTfLiteFloat16: {
-      const Eigen::half* half_data = reinterpret_cast(
-          GetTensorData(input));
-      reference_ops::Dequantize(GetTensorShape(input), half_data,
-                                GetTensorShape(output),
-                                GetTensorData(output));
-      break;
-    }
-    default:
-      context->ReportError(context, "Type %d not supported.", input->type);
-      return kTfLiteError;
-  }
-
-  return kTfLiteOk;
-}
-
-}  // namespace dequantize
-}  // namespace builtin
-}  // namespace ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_DEQUANTIZE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/eigen_support.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/eigen_support.h
deleted file mode 100644
index 4110932..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/eigen_support.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Copyright 2018 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_KERNELS_EIGEN_SUPPORT_H_
-#define TENSORFLOW_LITE_KERNELS_EIGEN_SUPPORT_H_
-
-#include "tensorflow/lite/c/common.h"
-
-namespace EigenForTFLite {
-struct ThreadPoolDevice;
-}
-
-namespace tflite {
-namespace eigen_support {
-
-// Let the framework know that the op will be using Eigen. If necessary a set of
-// temporary Eigen objects might be created and placed in 'context'.
-void IncrementUsageCounter(TfLiteContext* context);
-
-// Let the framework know that the op stopped using Eigen. If there are no more
-// usages all temporary Eigen objects will be deleted.
-void DecrementUsageCounter(TfLiteContext* context);
-
-// Fetch the ThreadPoolDevice associated with the provided context.
-//
-// Note: The caller must ensure that |IncrementUsageCounter()| has already been
-// called. Moreover, it is *not* safe to cache the returned device; it may be
-// invalidated if the context thread count changes.
-const EigenForTFLite::ThreadPoolDevice* GetThreadPoolDevice(
-    TfLiteContext* context);
-
-}  // namespace eigen_support
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_EIGEN_SUPPORT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/fully_connected.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/fully_connected.h
deleted file mode 100644
index badc9e7..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/fully_connected.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Copyright 2017 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.
-==============================================================================*/
-
-// Forward declares registrations for specific FC layer implementations. Do not
-// include this header if you are fine with any FC implementation, include
-// builtin_op_kernels.h instead. This implementation-specific registration is
-// only available for FC, as these versions are explicitly tested and supported.
-
-#ifndef TENSORFLOW_LITE_KERNELS_FULLY_CONNECTED_H_
-#define TENSORFLOW_LITE_KERNELS_FULLY_CONNECTED_H_
-
-#include "tensorflow/lite/c/common.h"
-
-namespace tflite {
-namespace ops {
-namespace builtin {
-TfLiteRegistration* Register_FULLY_CONNECTED_REF();
-TfLiteRegistration* Register_FULLY_CONNECTED_GENERIC_OPT();
-TfLiteRegistration* Register_FULLY_CONNECTED_PIE();
-TfLiteRegistration* Register_FULLY_CONNECTED_SPARSE_REF();
-TfLiteRegistration* Register_FULLY_CONNECTED_SPARSE_OPT();
-}  // namespace builtin
-}  // namespace ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_FULLY_CONNECTED_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/hashtable/hashtable_ops.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/hashtable/hashtable_ops.h
deleted file mode 100644
index 7ed4ab3..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/hashtable/hashtable_ops.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* 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.
-==============================================================================*/
-
-#ifndef TENSORFLOW_LITE_KERNELS_HASHTABLE_HASHTABLE_OPS_H_
-#define TENSORFLOW_LITE_KERNELS_HASHTABLE_HASHTABLE_OPS_H_
-
-#include "tensorflow/lite/mutable_op_resolver.h"
-
-namespace tflite {
-namespace ops {
-namespace custom {
-
-TfLiteRegistration* Register_HASHTABLE();
-TfLiteRegistration* Register_HASHTABLE_FIND();
-TfLiteRegistration* Register_HASHTABLE_IMPORT();
-TfLiteRegistration* Register_HASHTABLE_SIZE();
-
-extern "C" void AddHashtableOps(::tflite::MutableOpResolver* resolver);
-
-}  // namespace custom
-}  // namespace ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_HASHTABLE_HASHTABLE_OPS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/common.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/common.h
deleted file mode 100644
index dec6c97..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/common.h
+++ /dev/null
@@ -1,988 +0,0 @@
-/* Copyright 2017 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_KERNELS_INTERNAL_COMMON_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_COMMON_H_
-
-#ifndef ALLOW_SLOW_GENERIC_DEPTHWISECONV_FALLBACK
-#ifdef GEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK
-#define ALLOW_SLOW_GENERIC_DEPTHWISECONV_FALLBACK
-#endif
-#endif
-
-#include 
-
-#include "fixedpoint/fixedpoint.h"
-#include "tensorflow/lite/kernels/internal/cppmath.h"
-#include "tensorflow/lite/kernels/internal/optimized/neon_check.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-
-constexpr int kReverseShift = -1;
-
-inline void GetActivationMinMax(FusedActivationFunctionType ac,
-                                float* output_activation_min,
-                                float* output_activation_max) {
-  switch (ac) {
-    case FusedActivationFunctionType::kNone:
-      *output_activation_min = std::numeric_limits::lowest();
-      *output_activation_max = std::numeric_limits::max();
-      break;
-    case FusedActivationFunctionType::kRelu:
-      *output_activation_min = 0.f;
-      *output_activation_max = std::numeric_limits::max();
-      break;
-    case FusedActivationFunctionType::kRelu1:
-      *output_activation_min = -1.f;
-      *output_activation_max = 1.f;
-      break;
-    case FusedActivationFunctionType::kRelu6:
-      *output_activation_min = 0.f;
-      *output_activation_max = 6.f;
-      break;
-  }
-}
-
-template 
-inline T ActivationFunctionWithMinMax(T x, T output_activation_min,
-                                      T output_activation_max) {
-  using std::max;
-  using std::min;
-  return min(max(x, output_activation_min), output_activation_max);
-}
-
-// Legacy function, left for compatibility only.
-template 
-float ActivationFunction(float x) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-  return ActivationFunctionWithMinMax(x, output_activation_min,
-                                      output_activation_max);
-}
-
-inline void BiasAndClamp(float clamp_min, float clamp_max, int bias_size,
-                         const float* bias_data, int array_size,
-                         float* array_data) {
-  // Note: see b/132215220: in May 2019 we thought it would be OK to replace
-  // this with the Eigen one-liner:
-  //   return (array.colwise() + bias).cwiseMin(clamp_max).cwiseMin(clamp_max).
-  // This turned out to severely regress performance: +4ms (i.e. 8%) on
-  // MobileNet v2 / 1.0 / 224. So we keep custom NEON code for now.
-  TFLITE_DCHECK_EQ((array_size % bias_size), 0);
-#ifdef USE_NEON
-  float* array_ptr = array_data;
-  float* array_end_ptr = array_ptr + array_size;
-  const auto clamp_min_vec = vdupq_n_f32(clamp_min);
-  const auto clamp_max_vec = vdupq_n_f32(clamp_max);
-  for (; array_ptr != array_end_ptr; array_ptr += bias_size) {
-    int i = 0;
-    for (; i <= bias_size - 16; i += 16) {
-      auto b0 = vld1q_f32(bias_data + i);
-      auto b1 = vld1q_f32(bias_data + i + 4);
-      auto b2 = vld1q_f32(bias_data + i + 8);
-      auto b3 = vld1q_f32(bias_data + i + 12);
-      auto a0 = vld1q_f32(array_ptr + i);
-      auto a1 = vld1q_f32(array_ptr + i + 4);
-      auto a2 = vld1q_f32(array_ptr + i + 8);
-      auto a3 = vld1q_f32(array_ptr + i + 12);
-      auto x0 = vaddq_f32(a0, b0);
-      auto x1 = vaddq_f32(a1, b1);
-      auto x2 = vaddq_f32(a2, b2);
-      auto x3 = vaddq_f32(a3, b3);
-      x0 = vmaxq_f32(clamp_min_vec, x0);
-      x1 = vmaxq_f32(clamp_min_vec, x1);
-      x2 = vmaxq_f32(clamp_min_vec, x2);
-      x3 = vmaxq_f32(clamp_min_vec, x3);
-      x0 = vminq_f32(clamp_max_vec, x0);
-      x1 = vminq_f32(clamp_max_vec, x1);
-      x2 = vminq_f32(clamp_max_vec, x2);
-      x3 = vminq_f32(clamp_max_vec, x3);
-      vst1q_f32(array_ptr + i, x0);
-      vst1q_f32(array_ptr + i + 4, x1);
-      vst1q_f32(array_ptr + i + 8, x2);
-      vst1q_f32(array_ptr + i + 12, x3);
-    }
-    for (; i <= bias_size - 4; i += 4) {
-      auto b = vld1q_f32(bias_data + i);
-      auto a = vld1q_f32(array_ptr + i);
-      auto x = vaddq_f32(a, b);
-      x = vmaxq_f32(clamp_min_vec, x);
-      x = vminq_f32(clamp_max_vec, x);
-      vst1q_f32(array_ptr + i, x);
-    }
-    for (; i < bias_size; i++) {
-      array_ptr[i] = ActivationFunctionWithMinMax(array_ptr[i] + bias_data[i],
-                                                  clamp_min, clamp_max);
-    }
-  }
-#else  // not NEON
-  for (int array_offset = 0; array_offset < array_size;
-       array_offset += bias_size) {
-    for (int i = 0; i < bias_size; i++) {
-      array_data[array_offset + i] = ActivationFunctionWithMinMax(
-          array_data[array_offset + i] + bias_data[i], clamp_min, clamp_max);
-    }
-  }
-#endif
-}
-
-inline int32_t MultiplyByQuantizedMultiplierSmallerThanOneExp(
-    int32_t x, int32_t quantized_multiplier, int left_shift) {
-  using gemmlowp::RoundingDivideByPOT;
-  using gemmlowp::SaturatingRoundingDoublingHighMul;
-  return RoundingDivideByPOT(
-      SaturatingRoundingDoublingHighMul(x, quantized_multiplier), -left_shift);
-}
-
-inline int32_t MultiplyByQuantizedMultiplierGreaterThanOne(
-    int32_t x, int32_t quantized_multiplier, int left_shift) {
-  using gemmlowp::SaturatingRoundingDoublingHighMul;
-  return SaturatingRoundingDoublingHighMul(x * (1 << left_shift),
-                                           quantized_multiplier);
-}
-
-inline int32_t MultiplyByQuantizedMultiplier(int32_t x,
-                                             int32_t quantized_multiplier,
-                                             int shift) {
-  using gemmlowp::RoundingDivideByPOT;
-  using gemmlowp::SaturatingRoundingDoublingHighMul;
-  int left_shift = shift > 0 ? shift : 0;
-  int right_shift = shift > 0 ? 0 : -shift;
-  return RoundingDivideByPOT(SaturatingRoundingDoublingHighMul(
-                                 x * (1 << left_shift), quantized_multiplier),
-                             right_shift);
-}
-
-inline int32_t MultiplyByQuantizedMultiplier(int64_t x,
-                                             int32_t quantized_multiplier,
-                                             int shift) {
-  // Inputs:
-  // - quantized_multiplier has fixed point at bit 31
-  // - shift is -31 to +7 (negative for right shift)
-  //
-  // Assumptions: The following input ranges are assumed
-  // - quantize_scale>=0  (the usual range is (1<<30) to (1>>31)-1)
-  // - scaling is chosen so final scaled result fits in int32_t
-  // - input x is in the range -(1<<47) <= x < (1<<47)
-  assert(quantized_multiplier >= 0);
-  assert(shift >= -31 && shift < 8);
-
-  int32_t reduced_multiplier = (quantized_multiplier + (1 << 15)) >> 16;
-  int total_shift = 15 - shift;
-  x = (x * (int64_t)reduced_multiplier) + ((int64_t)1 << (total_shift - 1));
-  int32_t result = x >> total_shift;
-  return result;
-}
-
-template 
-int CountLeadingZeros(T integer_input) {
-  static_assert(std::is_unsigned::value,
-                "Only unsigned integer types handled.");
-#if defined(__GNUC__)
-  return integer_input ? __builtin_clz(integer_input)
-                       : std::numeric_limits::digits;
-#else
-  if (integer_input == 0) {
-    return std::numeric_limits::digits;
-  }
-
-  const T one_in_leading_positive = static_cast(1)
-                                    << (std::numeric_limits::digits - 1);
-  int leading_zeros = 0;
-  while (integer_input < one_in_leading_positive) {
-    integer_input <<= 1;
-    ++leading_zeros;
-  }
-  return leading_zeros;
-#endif
-}
-
-template 
-inline int CountLeadingSignBits(T integer_input) {
-  static_assert(std::is_signed::value, "Only signed integer types handled.");
-#if defined(__GNUC__) && !defined(__clang__)
-  return integer_input ? __builtin_clrsb(integer_input)
-                       : std::numeric_limits::digits;
-#else
-  using U = typename std::make_unsigned::type;
-  return integer_input >= 0
-             ? CountLeadingZeros(static_cast(integer_input)) - 1
-         : integer_input != std::numeric_limits::min()
-             ? CountLeadingZeros(2 * static_cast(-integer_input) - 1)
-             : 0;
-#endif
-}
-
-// Use "count leading zeros" helper functions to do a fast Floor(log_2(x)).
-template 
-inline Integer FloorLog2(Integer n) {
-  static_assert(std::is_integral::value, "");
-  static_assert(std::is_signed::value, "");
-  static_assert(sizeof(Integer) == 4 || sizeof(Integer) == 8, "");
-  TFLITE_CHECK_GT(n, 0);
-  if (sizeof(Integer) == 4) {
-    return 30 - CountLeadingSignBits(n);
-  } else {
-    return 62 - CountLeadingSignBits(n);
-  }
-}
-
-// generate INT16 LUT for function(), e.g., table exp(x) and 1/(1+x) used in
-// softmax
-// func - the function to build the LUT for (e.g exp(x))
-// min,max - table limits
-// table - pointer to buffer
-// num - number of elements in the LUT
-inline void gen_lut(double (*func)(double), double min, double max,
-                    int16_t* table, const int num) {
-  // size of table should equal to num + 1
-  // last element only for slope calculation
-  double step = (max - min) / (num - 1);
-  double half_step = step / 2.0;
-  for (int i = 0; i < num - 1; i++) {
-    double sample_val = TfLiteRound(func(min + i * step) * 32768.0);
-    double midpoint_interp_val =
-        TfLiteRound((func(min + (i + 1) * step) * 32768.0 +
-                     TfLiteRound(func(min + i * step) * 32768.0)) /
-                    2.0);
-    double midpoint_val =
-        TfLiteRound(func(min + i * step + half_step) * 32768.0);
-    double midpoint_err = midpoint_interp_val - midpoint_val;
-    double bias = TfLiteRound(midpoint_err / 2.0);
-    table[i] = std::min(std::max(sample_val - bias, -32768.0), 32767.0);
-  }
-  table[num - 1] =
-      std::min(std::max(TfLiteRound(func(max) * 32768.0), -32768.0), 32767.0);
-}
-
-// generate INT16 LUT for function(), e.g., table exp(x) and 1/(1+x) used in
-// softmax
-// func - the function to build the LUT for (e.g exp(x))
-// min,max - table limits
-// table - pointer to buffer
-// num - number of elements in the LUT
-inline void gen_lut(float (*func)(float), float min, float max, int16_t* table,
-                    const int num) {
-  // size of table should equal to num + 1
-  // last element only for slope calculation
-  float step = (max - min) / (num - 1);
-  float half_step = step / 2.0f;
-  for (int i = 0; i < num - 1; i++) {
-    float sample_val = TfLiteRound(func(min + i * step) * 32768.0f);
-    float midpoint_interp_val =
-        TfLiteRound((func(min + (i + 1) * step) * 32768.0f +
-                     TfLiteRound(func(min + i * step) * 32768.0f)) /
-                    2.0f);
-    float midpoint_val =
-        TfLiteRound(func(min + i * step + half_step) * 32768.0f);
-    float midpoint_err = midpoint_interp_val - midpoint_val;
-    float bias = TfLiteRound(midpoint_err / 2.0f);
-    table[i] = std::min(std::max(sample_val - bias, -32768.0f), 32767.0f);
-  }
-  table[num - 1] = std::min(
-      std::max(TfLiteRound(func(max) * 32768.0f), -32768.0f), 32767.0f);
-}
-
-// int16_t func table lookup, e.g., lookup exp() and 1/(1+x) used in softmax
-inline int16_t generic_int16_table_lookup(int16_t value, const int16_t* lut) {
-  // 512 base value, lut[513] only for calculate slope
-  uint16_t index = static_cast(256 + (value >> 7));
-  assert(index < 512 && "LUT index out of range.");
-  int16_t offset = value & 0x7f;
-
-  // base and slope are Q0.15
-  int16_t base = lut[index];
-  int16_t slope = lut[index + 1] - lut[index];
-
-  // Q0.15 * Q0.7 = Q0.22
-  // Round and convert from Q0.22 to Q0.15
-  int32_t delta = (static_cast(slope) * offset + 64) >> 7;
-
-  // Q0.15 + Q0.15
-  return base + delta;
-}
-
-// Table of sigmoid(i/24) at 0.16 format - 256 elements.
-
-// We use combined sigmoid and tanh look-up table, since
-// tanh(x) = 2*sigmoid(2*x) -1.
-// Both functions are symmetric, so the LUT table is only needed
-// for the absolute value of the input.
-static const uint16_t sigmoid_table_uint16[256] = {
-    32768, 33451, 34133, 34813, 35493, 36169, 36843, 37513, 38180, 38841, 39498,
-    40149, 40794, 41432, 42064, 42688, 43304, 43912, 44511, 45102, 45683, 46255,
-    46817, 47369, 47911, 48443, 48964, 49475, 49975, 50464, 50942, 51409, 51865,
-    52311, 52745, 53169, 53581, 53983, 54374, 54755, 55125, 55485, 55834, 56174,
-    56503, 56823, 57133, 57433, 57724, 58007, 58280, 58544, 58800, 59048, 59288,
-    59519, 59743, 59959, 60168, 60370, 60565, 60753, 60935, 61110, 61279, 61441,
-    61599, 61750, 61896, 62036, 62172, 62302, 62428, 62549, 62666, 62778, 62886,
-    62990, 63090, 63186, 63279, 63368, 63454, 63536, 63615, 63691, 63765, 63835,
-    63903, 63968, 64030, 64090, 64148, 64204, 64257, 64308, 64357, 64405, 64450,
-    64494, 64536, 64576, 64614, 64652, 64687, 64721, 64754, 64786, 64816, 64845,
-    64873, 64900, 64926, 64950, 64974, 64997, 65019, 65039, 65060, 65079, 65097,
-    65115, 65132, 65149, 65164, 65179, 65194, 65208, 65221, 65234, 65246, 65258,
-    65269, 65280, 65291, 65301, 65310, 65319, 65328, 65337, 65345, 65352, 65360,
-    65367, 65374, 65381, 65387, 65393, 65399, 65404, 65410, 65415, 65420, 65425,
-    65429, 65433, 65438, 65442, 65445, 65449, 65453, 65456, 65459, 65462, 65465,
-    65468, 65471, 65474, 65476, 65479, 65481, 65483, 65485, 65488, 65489, 65491,
-    65493, 65495, 65497, 65498, 65500, 65501, 65503, 65504, 65505, 65507, 65508,
-    65509, 65510, 65511, 65512, 65513, 65514, 65515, 65516, 65517, 65517, 65518,
-    65519, 65520, 65520, 65521, 65522, 65522, 65523, 65523, 65524, 65524, 65525,
-    65525, 65526, 65526, 65526, 65527, 65527, 65528, 65528, 65528, 65529, 65529,
-    65529, 65529, 65530, 65530, 65530, 65530, 65531, 65531, 65531, 65531, 65531,
-    65532, 65532, 65532, 65532, 65532, 65532, 65533, 65533, 65533, 65533, 65533,
-    65533, 65533, 65533, 65534, 65534, 65534, 65534, 65534, 65534, 65534, 65534,
-    65534, 65534, 65535};
-
-// TODO(b/77858996): Add these to gemmlowp.
-template 
-IntegerType SaturatingAddNonGemmlowp(IntegerType a, IntegerType b) {
-  static_assert(std::is_same::value, "unimplemented");
-  return a;
-}
-
-template <>
-inline std::int32_t SaturatingAddNonGemmlowp(std::int32_t a, std::int32_t b) {
-  std::int64_t a64 = a;
-  std::int64_t b64 = b;
-  std::int64_t sum = a64 + b64;
-  return static_cast(std::min(
-      static_cast(std::numeric_limits::max()),
-      std::max(
-          static_cast(std::numeric_limits::min()),
-          sum)));
-}
-
-template 
-gemmlowp::FixedPoint SaturatingAddNonGemmlowp(
-    gemmlowp::FixedPoint a,
-    gemmlowp::FixedPoint b) {
-  return gemmlowp::FixedPoint::FromRaw(
-      SaturatingAddNonGemmlowp(a.raw(), b.raw()));
-}
-
-template 
-IntegerType SaturatingSub(IntegerType a, IntegerType b) {
-  static_assert(std::is_same::value, "unimplemented");
-  return a;
-}
-
-template <>
-inline std::int16_t SaturatingSub(std::int16_t a, std::int16_t b) {
-  std::int32_t a32 = a;
-  std::int32_t b32 = b;
-  std::int32_t diff = a32 - b32;
-  return static_cast(
-      std::min(static_cast(32767),
-               std::max(static_cast(-32768), diff)));
-}
-
-template <>
-inline std::int32_t SaturatingSub(std::int32_t a, std::int32_t b) {
-  std::int64_t a64 = a;
-  std::int64_t b64 = b;
-  std::int64_t diff = a64 - b64;
-  return static_cast(std::min(
-      static_cast(std::numeric_limits::max()),
-      std::max(
-          static_cast(std::numeric_limits::min()),
-          diff)));
-}
-
-template 
-gemmlowp::FixedPoint SaturatingSub(
-    gemmlowp::FixedPoint a,
-    gemmlowp::FixedPoint b) {
-  return gemmlowp::FixedPoint::FromRaw(
-      SaturatingSub(a.raw(), b.raw()));
-}
-// End section to be moved to gemmlowp.
-
-template 
-IntegerType SaturatingRoundingMultiplyByPOTParam(IntegerType x, int exponent) {
-  if (exponent == 0) {
-    return x;
-  }
-  using ScalarIntegerType =
-      typename gemmlowp::FixedPointRawTypeTraits::ScalarRawType;
-  const IntegerType min =
-      gemmlowp::Dup(std::numeric_limits::min());
-  const IntegerType max =
-      gemmlowp::Dup(std::numeric_limits::max());
-  const int ScalarIntegerTypeBits = 8 * sizeof(ScalarIntegerType);
-
-  const std::int32_t threshold =
-      ((1 << (ScalarIntegerTypeBits - 1 - exponent)) - 1);
-  const IntegerType positive_mask =
-      gemmlowp::MaskIfGreaterThan(x, gemmlowp::Dup(threshold));
-  const IntegerType negative_mask =
-      gemmlowp::MaskIfLessThan(x, gemmlowp::Dup(-threshold));
-
-  IntegerType result = gemmlowp::ShiftLeft(x, exponent);
-  result = gemmlowp::SelectUsingMask(positive_mask, max, result);
-  result = gemmlowp::SelectUsingMask(negative_mask, min, result);
-  return result;
-}
-
-// If we want to leave IntegerBits fixed, then multiplication
-// by a power of two has to be saturating/rounding, not exact anymore.
-template 
-gemmlowp::FixedPoint
-SaturatingRoundingMultiplyByPOTParam(
-    gemmlowp::FixedPoint a, int exponent) {
-  return gemmlowp::FixedPoint::FromRaw(
-      SaturatingRoundingMultiplyByPOTParam(a.raw(), exponent));
-}
-
-// Convert int32_t multiplier to int16_t with rounding.
-inline void DownScaleInt32ToInt16Multiplier(int32_t multiplier_int32_t,
-                                            int16_t* multiplier_int16_t) {
-  TFLITE_DCHECK_GE(multiplier_int32_t, 0);
-  static constexpr int32_t kRoundingOffset = 1 << 15;
-  if (multiplier_int32_t >=
-      std::numeric_limits::max() - kRoundingOffset) {
-    *multiplier_int16_t = std::numeric_limits::max();
-    return;
-  }
-  const int32_t result = (multiplier_int32_t + kRoundingOffset) >> 16;
-  TFLITE_DCHECK_LE(result << 16, multiplier_int32_t + kRoundingOffset);
-  TFLITE_DCHECK_GT(result << 16, multiplier_int32_t - kRoundingOffset);
-  *multiplier_int16_t = result;
-  TFLITE_DCHECK_EQ(*multiplier_int16_t, result);
-}
-
-// Minimum output bits to accommodate log of maximum input range.  It actually
-// does not matter if one considers, say, [-64,64] or [-64,64).
-//
-// For example, run this through Octave:
-// [0:127; ...
-//  ceil(log(abs( log(2.^(0:127))+1 ))/log(2)); ...
-//  ceil(log(abs( log(2.^(0:127))+1 ))/log(2))]
-constexpr int min_log_x_output_bits(int input_bits) {
-  return input_bits > 90   ? 7
-         : input_bits > 44 ? 6
-         : input_bits > 21 ? 5
-         : input_bits > 10 ? 4
-         : input_bits > 4  ? 3
-         : input_bits > 1  ? 2
-                           : 1;
-}
-
-// Although currently the name of this function says that it cannot handle
-// values less than 1, in practice it can handle as low as 1/x_max, where
-// x_max is the largest representable input.  In other words, the output range
-// is symmetric.
-template 
-inline gemmlowp::FixedPoint
-log_x_for_x_greater_than_or_equal_to_1_impl(
-    gemmlowp::FixedPoint input_val) {
-  // assert(__builtin_clz(0u) >= std::numeric_limits::digits - 1);
-  // assert(__builtin_clz(0u) <= std::numeric_limits::digits);
-  using FixedPoint0 = gemmlowp::FixedPoint;
-  // The reason for accumulating the result with an extra bit of headroom is
-  // that z_pow_2_adj * log_2 might be saturated, and adding num_scaled *
-  // recip_denom will otherwise introduce an error.
-  static constexpr int kAccumIntegerBits = OutputIntegerBits + 1;
-  using FixedPointAccum = gemmlowp::FixedPoint;
-
-  const FixedPoint0 log_2 = GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(
-      FixedPoint0, 1488522236, std::log(2.0));
-  const FixedPoint0 sqrt_sqrt_half = GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(
-      FixedPoint0, 1805811301, std::sqrt(std::sqrt(0.5)));
-  const FixedPoint0 sqrt_half = GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(
-      FixedPoint0, 1518500250, std::sqrt(0.5));
-  const FixedPoint0 one_quarter =
-      GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(FixedPoint0, 536870912, 1.0 / 4.0);
-
-  const FixedPoint0 alpha_n = GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(
-      FixedPoint0, 117049297, 11.0 / 240.0 * std::sqrt(std::sqrt(2.0)));
-  const FixedPoint0 alpha_d = GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(
-      FixedPoint0, 127690142, 1.0 / 20.0 * std::sqrt(std::sqrt(2.0)));
-  const FixedPoint0 alpha_i = GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(
-      FixedPoint0, 1057819769,
-      2.0 / std::sqrt(std::sqrt(2.0)) - std::sqrt(std::sqrt(2.0)));
-  const FixedPoint0 alpha_f = GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(
-      FixedPoint0, 638450708, 1.0 / 4.0 * std::sqrt(std::sqrt(2.0)));
-
-  const FixedPointAccum shifted_quarter =
-      gemmlowp::Rescale(one_quarter);
-
-  // Reinterpret the input value as Q0.31, because we will figure out the
-  // required shift "ourselves" instead of using, say, Rescale.
-  FixedPoint0 z_a = FixedPoint0::FromRaw(input_val.raw());
-  // z_a_pow_2 = input_integer_bits - z_a_headroom;
-  int z_a_headroom_plus_1 = CountLeadingZeros(static_cast(z_a.raw()));
-  FixedPoint0 r_a_tmp =
-      SaturatingRoundingMultiplyByPOTParam(z_a, (z_a_headroom_plus_1 - 1));
-  const int32_t r_a_raw =
-      SaturatingRoundingMultiplyByPOTParam((r_a_tmp * sqrt_half).raw(), 1);
-  // z_pow_2_adj = max(z_pow_2_a - 0.75, z_pow_2_b - 0.25);
-  // z_pow_2_adj = max(InputIntegerBits - z_a_headroom_plus_1 + 0.25,
-  //                   InputIntegerBits - z_b_headroom - 0.25);
-  const FixedPointAccum z_a_pow_2_adj = SaturatingAddNonGemmlowp(
-      FixedPointAccum::FromRaw(SaturatingRoundingMultiplyByPOTParam(
-          InputIntegerBits - z_a_headroom_plus_1, 31 - kAccumIntegerBits)),
-      shifted_quarter);
-
-  // z_b is treated like z_a, but premultiplying by sqrt(0.5).
-  FixedPoint0 z_b = z_a * sqrt_half;
-  int z_b_headroom = CountLeadingZeros(static_cast(z_b.raw())) - 1;
-  const int32_t r_b_raw =
-      SaturatingRoundingMultiplyByPOTParam(z_a.raw(), z_b_headroom);
-  const FixedPointAccum z_b_pow_2_adj = SaturatingSub(
-      FixedPointAccum::FromRaw(SaturatingRoundingMultiplyByPOTParam(
-          InputIntegerBits - z_b_headroom, 31 - kAccumIntegerBits)),
-      shifted_quarter);
-
-  const FixedPoint0 r = FixedPoint0::FromRaw(std::min(r_a_raw, r_b_raw));
-  const FixedPointAccum z_pow_2_adj = FixedPointAccum::FromRaw(
-      std::max(z_a_pow_2_adj.raw(), z_b_pow_2_adj.raw()));
-
-  const FixedPoint0 p = gemmlowp::RoundingHalfSum(r, sqrt_sqrt_half);
-  FixedPoint0 q = r - sqrt_sqrt_half;
-  q = q + q;
-
-  const FixedPoint0 common_sq = q * q;
-  const FixedPoint0 num = q * r + q * common_sq * alpha_n;
-  const FixedPoint0 denom_minus_one_0 =
-      p * (alpha_i + q + alpha_d * common_sq) + alpha_f * q;
-  const FixedPoint0 recip_denom =
-      one_over_one_plus_x_for_x_in_0_1(denom_minus_one_0);
-
-  const FixedPointAccum num_scaled = gemmlowp::Rescale(num);
-  return gemmlowp::Rescale(z_pow_2_adj * log_2 +
-                                              num_scaled * recip_denom);
-}
-
-template 
-inline gemmlowp::FixedPoint
-log_x_for_x_greater_than_or_equal_to_1(
-    gemmlowp::FixedPoint input_val) {
-  static_assert(
-      OutputIntegerBits >= min_log_x_output_bits(InputIntegerBits),
-      "Output integer bits must be sufficient to accommodate logs of inputs.");
-  return log_x_for_x_greater_than_or_equal_to_1_impl(
-      input_val);
-}
-
-inline int32_t GetReciprocal(int32_t x, int x_integer_digits,
-                             int* num_bits_over_unit) {
-  int headroom_plus_one = CountLeadingZeros(static_cast(x));
-  // This is the number of bits to the left of the binary point above 1.0.
-  // Consider x=1.25.  In that case shifted_scale=0.8 and
-  // no later adjustment will be needed.
-  *num_bits_over_unit = x_integer_digits - headroom_plus_one;
-  const int32_t shifted_sum_minus_one =
-      static_cast((static_cast(x) << headroom_plus_one) -
-                           (static_cast(1) << 31));
-
-  gemmlowp::FixedPoint shifted_scale =
-      gemmlowp::one_over_one_plus_x_for_x_in_0_1(
-          gemmlowp::FixedPoint::FromRaw(shifted_sum_minus_one));
-  return shifted_scale.raw();
-}
-
-inline void GetInvSqrtQuantizedMultiplierExp(int32_t input, int reverse_shift,
-                                             int32_t* output_inv_sqrt,
-                                             int* output_shift) {
-  TFLITE_DCHECK_GE(input, 0);
-  if (input <= 1) {
-    // Handle the input value 1 separately to avoid overflow in that case
-    // in the general computation below (b/143972021). Also handle 0 as if it
-    // were a 1. 0 is an invalid input here (divide by zero) and 1 is a valid
-    // but rare/unrealistic input value. We can expect both to occur in some
-    // incompletely trained models, but probably not in fully trained models.
-    *output_inv_sqrt = std::numeric_limits::max();
-    *output_shift = 0;
-    return;
-  }
-  TFLITE_DCHECK_GT(input, 1);
-  *output_shift = 11;
-  while (input >= (1 << 29)) {
-    input /= 4;
-    ++*output_shift;
-  }
-  const unsigned max_left_shift_bits =
-      CountLeadingZeros(static_cast(input)) - 1;
-  const unsigned max_left_shift_bit_pairs = max_left_shift_bits / 2;
-  const unsigned left_shift_bit_pairs = max_left_shift_bit_pairs - 1;
-  *output_shift -= left_shift_bit_pairs;
-  input <<= 2 * left_shift_bit_pairs;
-  TFLITE_DCHECK_GE(input, (1 << 27));
-  TFLITE_DCHECK_LT(input, (1 << 29));
-  using gemmlowp::FixedPoint;
-  using gemmlowp::Rescale;
-  using gemmlowp::SaturatingRoundingMultiplyByPOT;
-  // Using 3 integer bits gives us enough room for the internal arithmetic in
-  // this Newton-Raphson iteration.
-  using F3 = FixedPoint;
-  using F0 = FixedPoint;
-  const F3 fixedpoint_input = F3::FromRaw(input >> 1);
-  const F3 fixedpoint_half_input =
-      SaturatingRoundingMultiplyByPOT<-1>(fixedpoint_input);
-  const F3 fixedpoint_half_three =
-      GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(F3, (1 << 28) + (1 << 27), 1.5);
-  // Newton-Raphson iteration
-  // Naive unoptimized starting guess: x = 1
-  F3 x = F3::One();
-  // Naive unoptimized number of iterations: 5
-  for (int i = 0; i < 5; i++) {
-    const F3 x3 = Rescale<3>(x * x * x);
-    x = Rescale<3>(fixedpoint_half_three * x - fixedpoint_half_input * x3);
-  }
-  const F0 fixedpoint_half_sqrt_2 =
-      GEMMLOWP_CHECKED_FIXEDPOINT_CONSTANT(F0, 1518500250, std::sqrt(2.) / 2.);
-  x = x * fixedpoint_half_sqrt_2;
-  *output_inv_sqrt = x.raw();
-  if (*output_shift < 0) {
-    *output_inv_sqrt <<= -*output_shift;
-    *output_shift = 0;
-  }
-  // Convert right shift (right is positive) to left shift.
-  *output_shift *= reverse_shift;
-}
-
-// DO NOT USE THIS STRUCT FOR NEW FUNCTIONALITY BEYOND IMPLEMENTING
-// BROADCASTING.
-//
-// NdArrayDesc describes the shape and memory layout of an N-dimensional
-// rectangular array of numbers.
-//
-// NdArrayDesc is basically identical to Dims defined in types.h.
-// However, as Dims is to be deprecated, this class exists as an adaptor
-// to enable simple unoptimized implementations of element-wise broadcasting
-// operations.
-template 
-struct NdArrayDesc {
-  // The "extent" of each dimension. Indices along dimension d must be in the
-  // half-open interval [0, extents[d]).
-  int extents[N];
-
-  // The number of *elements* (not bytes) between consecutive indices of each
-  // dimension.
-  int strides[N];
-};
-
-// DO NOT USE THIS FUNCTION FOR NEW FUNCTIONALITY BEYOND IMPLEMENTING
-// BROADCASTING.
-//
-// Same as Offset(), except takes as NdArrayDesc instead of Dims.
-inline int SubscriptToIndex(const NdArrayDesc<4>& desc, int i0, int i1, int i2,
-                            int i3) {
-  TFLITE_DCHECK(i0 >= 0 && i0 < desc.extents[0]);
-  TFLITE_DCHECK(i1 >= 0 && i1 < desc.extents[1]);
-  TFLITE_DCHECK(i2 >= 0 && i2 < desc.extents[2]);
-  TFLITE_DCHECK(i3 >= 0 && i3 < desc.extents[3]);
-  return i0 * desc.strides[0] + i1 * desc.strides[1] + i2 * desc.strides[2] +
-         i3 * desc.strides[3];
-}
-
-inline int SubscriptToIndex(const NdArrayDesc<5>& desc, int indexes[5]) {
-  return indexes[0] * desc.strides[0] + indexes[1] * desc.strides[1] +
-         indexes[2] * desc.strides[2] + indexes[3] * desc.strides[3] +
-         indexes[4] * desc.strides[4];
-}
-
-// Given the dimensions of the operands for an element-wise binary broadcast,
-// adjusts them so that they can be directly iterated over with simple loops.
-// Returns the adjusted dims as instances of NdArrayDesc in 'desc0_out' and
-// 'desc1_out'. 'desc0_out' and 'desc1_out' cannot be nullptr.
-//
-// This function assumes that the two input shapes are compatible up to
-// broadcasting and the shorter one has already been prepended with 1s to be the
-// same length. E.g., if shape0 is (1, 16, 16, 64) and shape1 is (1, 64),
-// shape1 must already have been prepended to be (1, 1, 1, 64). Recall that
-// Dims refer to shapes in reverse order. In this case, input0_dims will be
-// (64, 16, 16, 1) and input1_dims will be (64, 1, 1, 1).
-//
-// When two shapes are compatible up to broadcasting, for each dimension d,
-// the input extents are either equal, or one of them is 1.
-//
-// This function performs the following for each dimension d:
-// - If the extents are equal, then do nothing since the loop that walks over
-//   both of the input arrays is correct.
-// - Otherwise, one (and only one) of the extents must be 1. Say extent0 is 1
-//   and extent1 is e1. Then set extent0 to e1 and stride0 *to 0*. This allows
-//   array0 to be referenced *at any index* in dimension d and still access the
-//   same slice.
-template 
-inline void NdArrayDescsForElementwiseBroadcast(const Dims& input0_dims,
-                                                const Dims& input1_dims,
-                                                NdArrayDesc* desc0_out,
-                                                NdArrayDesc* desc1_out) {
-  TFLITE_DCHECK(desc0_out != nullptr);
-  TFLITE_DCHECK(desc1_out != nullptr);
-
-  // Copy dims to desc.
-  for (int i = 0; i < N; ++i) {
-    desc0_out->extents[i] = input0_dims.sizes[i];
-    desc0_out->strides[i] = input0_dims.strides[i];
-    desc1_out->extents[i] = input1_dims.sizes[i];
-    desc1_out->strides[i] = input1_dims.strides[i];
-  }
-
-  // Walk over each dimension. If the extents are equal do nothing.
-  // Otherwise, set the desc with extent 1 to have extent equal to the other and
-  // stride 0.
-  for (int i = 0; i < N; ++i) {
-    const int extent0 = ArraySize(input0_dims, i);
-    const int extent1 = ArraySize(input1_dims, i);
-    if (extent0 != extent1) {
-      if (extent0 == 1) {
-        desc0_out->strides[i] = 0;
-        desc0_out->extents[i] = extent1;
-      } else {
-        TFLITE_DCHECK_EQ(extent1, 1);
-        desc1_out->strides[i] = 0;
-        desc1_out->extents[i] = extent0;
-      }
-    }
-  }
-}
-
-// Copies dims to desc, calculating strides.
-template 
-inline void CopyDimsToDesc(const RuntimeShape& input_shape,
-                           NdArrayDesc* desc_out) {
-  int desc_stride = 1;
-  for (int i = N - 1; i >= 0; --i) {
-    desc_out->extents[i] = input_shape.Dims(i);
-    desc_out->strides[i] = desc_stride;
-    desc_stride *= input_shape.Dims(i);
-  }
-}
-
-template 
-inline void NdArrayDescsForElementwiseBroadcast(
-    const RuntimeShape& input0_shape, const RuntimeShape& input1_shape,
-    NdArrayDesc* desc0_out, NdArrayDesc* desc1_out) {
-  TFLITE_DCHECK(desc0_out != nullptr);
-  TFLITE_DCHECK(desc1_out != nullptr);
-
-  auto extended_input0_shape = RuntimeShape::ExtendedShape(N, input0_shape);
-  auto extended_input1_shape = RuntimeShape::ExtendedShape(N, input1_shape);
-
-  // Copy dims to desc, calculating strides.
-  CopyDimsToDesc(extended_input0_shape, desc0_out);
-  CopyDimsToDesc(extended_input1_shape, desc1_out);
-
-  // Walk over each dimension. If the extents are equal do nothing.
-  // Otherwise, set the desc with extent 1 to have extent equal to the other and
-  // stride 0.
-  for (int i = 0; i < N; ++i) {
-    const int extent0 = extended_input0_shape.Dims(i);
-    const int extent1 = extended_input1_shape.Dims(i);
-    if (extent0 != extent1) {
-      if (extent0 == 1) {
-        desc0_out->strides[i] = 0;
-        desc0_out->extents[i] = extent1;
-      } else {
-        TFLITE_DCHECK_EQ(extent1, 1);
-        desc1_out->strides[i] = 0;
-        desc1_out->extents[i] = extent0;
-      }
-    }
-  }
-}
-
-template 
-inline void NdArrayDescsForElementwiseBroadcast(
-    const RuntimeShape& input0_shape, const RuntimeShape& input1_shape,
-    const RuntimeShape& input2_shape, NdArrayDesc* desc0_out,
-    NdArrayDesc* desc1_out, NdArrayDesc* desc2_out) {
-  TFLITE_DCHECK(desc0_out != nullptr);
-  TFLITE_DCHECK(desc1_out != nullptr);
-  TFLITE_DCHECK(desc2_out != nullptr);
-
-  auto extended_input0_shape = RuntimeShape::ExtendedShape(N, input0_shape);
-  auto extended_input1_shape = RuntimeShape::ExtendedShape(N, input1_shape);
-  auto extended_input2_shape = RuntimeShape::ExtendedShape(N, input2_shape);
-
-  // Copy dims to desc, calculating strides.
-  CopyDimsToDesc(extended_input0_shape, desc0_out);
-  CopyDimsToDesc(extended_input1_shape, desc1_out);
-  CopyDimsToDesc(extended_input2_shape, desc2_out);
-
-  // Walk over each dimension. If the extents are equal do nothing.
-  // Otherwise, set the desc with extent 1 to have extent equal to the other and
-  // stride 0.
-  for (int i = 0; i < N; ++i) {
-    const int extent0 = extended_input0_shape.Dims(i);
-    const int extent1 = extended_input1_shape.Dims(i);
-    const int extent2 = extended_input2_shape.Dims(i);
-
-    int extent = extent0;
-    if (extent1 != 1) extent = extent1;
-    if (extent2 != 1) extent = extent2;
-
-    TFLITE_DCHECK(extent0 == 1 || extent0 == extent);
-    TFLITE_DCHECK(extent1 == 1 || extent1 == extent);
-    TFLITE_DCHECK(extent2 == 1 || extent2 == extent);
-
-    if (!(extent0 == extent1 && extent1 == extent2)) {
-      if (extent0 == 1) {
-        desc0_out->strides[i] = 0;
-        desc0_out->extents[i] = extent;
-      }
-      if (extent1 == 1) {
-        desc1_out->strides[i] = 0;
-        desc1_out->extents[i] = extent;
-      }
-      if (extent2 == 1) {
-        desc2_out->strides[i] = 0;
-        desc2_out->extents[i] = extent;
-      }
-    }
-  }
-}
-
-// Detailed implementation of NDOpsHelper, the indexes must be a zero array.
-// This implementation is equivalent to N nested loops. Ex, if N=4, it can be
-// re-writen as:
-// for (int b = 0; b < output.extents[0]; ++b) {
-//   for (int y = 0; y < output.extents[1]; ++y) {
-//     for (int x = 0; x < output.extents[2]; ++x) {
-//       for (int c = 0; c < output.extents[3]; ++c) {
-//           calc({b,y,x,c});
-//       }
-//     }
-//   }
-// }
-template 
-typename std::enable_if::type NDOpsHelperImpl(
-    const NdArrayDesc& output, const Calc& calc, int indexes[N]) {
-  for (indexes[DIM] = 0; indexes[DIM] < output.extents[DIM]; ++indexes[DIM]) {
-    NDOpsHelperImpl(output, calc, indexes);
-  }
-}
-
-template 
-typename std::enable_if::type NDOpsHelperImpl(
-    const NdArrayDesc& output, const Calc& calc, int indexes[N]) {
-  for (indexes[DIM] = 0; indexes[DIM] < output.extents[DIM]; ++indexes[DIM]) {
-    calc(indexes);
-  }
-}
-
-// Execute the calc function in the innermost iteration based on the shape of
-// the output. The calc function should take a single argument of type int[N].
-template 
-inline void NDOpsHelper(const NdArrayDesc& output, const Calc& calc) {
-  int indexes[N] = {0};
-  NDOpsHelperImpl(output, calc, indexes);
-}
-// Copied from gemmlowp::RoundDown when we dropped direct dependency on
-// gemmlowp.
-//
-// Returns the runtime argument rounded down to the nearest multiple of
-// the fixed Modulus.
-template 
-Integer RoundDown(Integer i) {
-  return i - (i % Modulus);
-}
-
-// Copied from gemmlowp::RoundUp when we dropped direct dependency on
-// gemmlowp.
-//
-// Returns the runtime argument rounded up to the nearest multiple of
-// the fixed Modulus.
-template 
-Integer RoundUp(Integer i) {
-  return RoundDown(i + Modulus - 1);
-}
-
-// Copied from gemmlowp::CeilQuotient when we dropped direct dependency on
-// gemmlowp.
-//
-// Returns the quotient a / b rounded up ('ceil') to the nearest integer.
-template 
-Integer CeilQuotient(Integer a, Integer b) {
-  return (a + b - 1) / b;
-}
-
-// This function is a copy of gemmlowp::HowManyThreads, copied when we dropped
-// the direct dependency of internal/optimized/ on gemmlowp.
-//
-// It computes a reasonable number of threads to use for a GEMM of shape
-// (rows, cols, depth).
-//
-// TODO(b/131910176): get rid of this function by switching each call site
-// to its own more sensible logic for its own workload.
-template 
-inline int LegacyHowManyThreads(int max_num_threads, int rows, int cols,
-                                int depth) {
-  // Early-exit in the default case where multi-threading is disabled.
-  if (max_num_threads == 1) {
-    return 1;
-  }
-
-  // Ensure that each thread has KernelRows rows to process, if at all possible.
-  int thread_count = std::min(max_num_threads, rows / KernelRows);
-
-  // Limit the number of threads according to the overall size of the problem.
-  if (thread_count > 1) {
-    // Empirically determined value.
-    static constexpr std::uint64_t min_cubic_size_per_thread = 64 * 1024;
-
-    // We can only multiply two out of three sizes without risking overflow
-    const std::uint64_t cubic_size =
-        std::uint64_t(rows) * std::uint64_t(cols) * std::uint64_t(depth);
-
-    thread_count = std::min(
-        thread_count, static_cast(cubic_size / min_cubic_size_per_thread));
-  }
-
-  if (thread_count < 1) {
-    thread_count = 1;
-  }
-
-  assert(thread_count > 0 && thread_count <= max_num_threads);
-  return thread_count;
-}
-
-template 
-void optimized_ops_preload_l1_stream(const T* ptr) {
-#ifdef __GNUC__
-  // builtin offered by GCC-compatible compilers including clang
-  __builtin_prefetch(ptr, /* 0 means read */ 0, /* 0 means no locality */ 0);
-#else
-  (void)ptr;
-#endif
-}
-
-template 
-void optimized_ops_preload_l1_keep(const T* ptr) {
-#ifdef __GNUC__
-  // builtin offered by GCC-compatible compilers including clang
-  __builtin_prefetch(ptr, /* 0 means read */ 0, /* 3 means high locality */ 3);
-#else
-  (void)ptr;
-#endif
-}
-
-template 
-void optimized_ops_prefetch_write_l1_keep(const T* ptr) {
-#ifdef __GNUC__
-  // builtin offered by GCC-compatible compilers including clang
-  __builtin_prefetch(ptr, /* 1 means write */ 1, /* 3 means high locality */ 3);
-#else
-  (void)ptr;
-#endif
-}
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_COMMON_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/compatibility.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/compatibility.h
deleted file mode 100644
index 61becad..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/compatibility.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* Copyright 2017 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_KERNELS_INTERNAL_COMPATIBILITY_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_COMPATIBILITY_H_
-
-#include 
-
-#include "tensorflow/lite/kernels/op_macros.h"
-
-#ifndef TFLITE_DCHECK
-#define TFLITE_DCHECK(condition) (condition) ? (void)0 : TFLITE_ASSERT_FALSE
-#endif
-
-#ifndef TFLITE_DCHECK_EQ
-#define TFLITE_DCHECK_EQ(x, y) ((x) == (y)) ? (void)0 : TFLITE_ASSERT_FALSE
-#endif
-
-#ifndef TFLITE_DCHECK_NE
-#define TFLITE_DCHECK_NE(x, y) ((x) != (y)) ? (void)0 : TFLITE_ASSERT_FALSE
-#endif
-
-#ifndef TFLITE_DCHECK_GE
-#define TFLITE_DCHECK_GE(x, y) ((x) >= (y)) ? (void)0 : TFLITE_ASSERT_FALSE
-#endif
-
-#ifndef TFLITE_DCHECK_GT
-#define TFLITE_DCHECK_GT(x, y) ((x) > (y)) ? (void)0 : TFLITE_ASSERT_FALSE
-#endif
-
-#ifndef TFLITE_DCHECK_LE
-#define TFLITE_DCHECK_LE(x, y) ((x) <= (y)) ? (void)0 : TFLITE_ASSERT_FALSE
-#endif
-
-#ifndef TFLITE_DCHECK_LT
-#define TFLITE_DCHECK_LT(x, y) ((x) < (y)) ? (void)0 : TFLITE_ASSERT_FALSE
-#endif
-
-// TODO(ahentz): Clean up: We should stick to the DCHECK versions.
-#ifndef TFLITE_CHECK
-#define TFLITE_CHECK(condition) (condition) ? (void)0 : TFLITE_ABORT
-#endif
-
-#ifndef TFLITE_CHECK_EQ
-#define TFLITE_CHECK_EQ(x, y) ((x) == (y)) ? (void)0 : TFLITE_ABORT
-#endif
-
-#ifndef TFLITE_CHECK_NE
-#define TFLITE_CHECK_NE(x, y) ((x) != (y)) ? (void)0 : TFLITE_ABORT
-#endif
-
-#ifndef TFLITE_CHECK_GE
-#define TFLITE_CHECK_GE(x, y) ((x) >= (y)) ? (void)0 : TFLITE_ABORT
-#endif
-
-#ifndef TFLITE_CHECK_GT
-#define TFLITE_CHECK_GT(x, y) ((x) > (y)) ? (void)0 : TFLITE_ABORT
-#endif
-
-#ifndef TFLITE_CHECK_LE
-#define TFLITE_CHECK_LE(x, y) ((x) <= (y)) ? (void)0 : TFLITE_ABORT
-#endif
-
-#ifndef TFLITE_CHECK_LT
-#define TFLITE_CHECK_LT(x, y) ((x) < (y)) ? (void)0 : TFLITE_ABORT
-#endif
-
-#ifndef TF_LITE_STATIC_MEMORY
-// TODO(b/162019032): Consider removing these type-aliases.
-using int8 = std::int8_t;
-using uint8 = std::uint8_t;
-using int16 = std::int16_t;
-using uint16 = std::uint16_t;
-using int32 = std::int32_t;
-using uint32 = std::uint32_t;
-#endif  // !defined(TF_LITE_STATIC_MEMORY)
-
-// TFLITE_DEPRECATED()
-//
-// Duplicated from absl/base/macros.h to avoid pulling in that library.
-// Marks a deprecated class, struct, enum, function, method and variable
-// declarations. The macro argument is used as a custom diagnostic message (e.g.
-// suggestion of a better alternative).
-//
-// Example:
-//
-//   class TFLITE_DEPRECATED("Use Bar instead") Foo {...};
-//   TFLITE_DEPRECATED("Use Baz instead") void Bar() {...}
-//
-// Every usage of a deprecated entity will trigger a warning when compiled with
-// clang's `-Wdeprecated-declarations` option. This option is turned off by
-// default, but the warnings will be reported by clang-tidy.
-#if defined(__clang__) && __cplusplus >= 201103L
-#define TFLITE_DEPRECATED(message) __attribute__((deprecated(message)))
-#endif
-
-#ifndef TFLITE_DEPRECATED
-#define TFLITE_DEPRECATED(message)
-#endif
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_COMPATIBILITY_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/cppmath.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/cppmath.h
deleted file mode 100644
index 24a3aec..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/cppmath.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_
-
-#include 
-
-namespace tflite {
-
-#if defined(TF_LITE_USE_GLOBAL_CMATH_FUNCTIONS) ||                           \
-    (defined(__ANDROID__) && !defined(__NDK_MAJOR__)) || defined(ARDUINO) || \
-    defined(__ZEPHYR__)
-#define TF_LITE_GLOBAL_STD_PREFIX
-#else
-#define TF_LITE_GLOBAL_STD_PREFIX std
-#endif
-
-#define DECLARE_STD_GLOBAL_SWITCH1(tf_name, std_name) \
-  template                                   \
-  inline T tf_name(const T x) {                       \
-    return TF_LITE_GLOBAL_STD_PREFIX::std_name(x);    \
-  }
-
-DECLARE_STD_GLOBAL_SWITCH1(TfLiteRound, round);
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_CPPMATH_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/kernel_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/kernel_utils.h
deleted file mode 100644
index 2f55157..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/kernel_utils.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Copyright 2018 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_KERNELS_INTERNAL_KERNEL_UTILS_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_KERNEL_UTILS_H_
-
-#include "tensorflow/lite/c/builtin_op_data.h"
-
-namespace tflite {
-namespace kernel_utils {
-
-// Performs an RNN batch inference step for inputs specified by input_ptr_batch.
-// The RNN cell is specified by the pointers to its input and recurrent weights,
-// and biases, along with the input size, number of units, activation.
-//
-// The pointers to the hidden state and the output are updated as a result.
-//
-// The pointers with the suffix "_batch" point to data aligned in batch_major
-// order, and each step processes batch_size many inputs from input_ptr_batch,
-// and updates batch_size many outputs and hidden states.
-//
-// The output_batch_dim is output.shape[-1], i.e. the outermost dimension of the
-// output tensor, and in most cases will be equal to num_units. It is usually
-// not when we want to store the RNN output into a slice of the output tensor,
-// e.g. for bidirectional RNNs with merge_outputs. In this case, the batched
-// operations cannot be used since they assume that the batched outputs are
-// contiguous, and we manually loop over the batched outputs.
-void RnnBatchStep(const float* input_ptr_batch, const float* input_weights_ptr,
-                  const float* recurrent_weights_ptr, const float* bias_ptr,
-                  int input_size, int num_units, int batch_size,
-                  int output_batch_leading_dim,
-                  TfLiteFusedActivation activation,
-                  float* hidden_state_ptr_batch, float* output_ptr_batch);
-
-// Same as above but includes an auxiliary input with the corresponding weights.
-void RnnBatchStep(const float* input_ptr_batch, const float* input_weights_ptr,
-                  const float* aux_input_ptr_batch,
-                  const float* aux_input_weights_ptr,
-                  const float* recurrent_weights_ptr, const float* bias_ptr,
-                  int input_size, int aux_input_size, int num_units,
-                  int batch_size, int output_batch_leading_dim,
-                  TfLiteFusedActivation activation,
-                  float* hidden_state_ptr_batch, float* output_ptr_batch);
-
-// Performs a quantized RNN batch inference step. Same as above, but for
-// quantization purposes, we also pass in quantized_hidden_state_ptr_batch and
-// quantized_input_ptr_batch pointers for temporary storage of the quantized
-// values of hidden_state_ptr_batch and input_ptr_batch, respectively.
-// These temporary storages are expected to be preallocated to the same size as
-// the respective pointers.
-// An additional preallocated temporary storage 'scaling_factors' (of size
-// batch_size) is used to store the scaling factors of the quantization (used
-// for recovery).
-// {input,recurrent}_weights_scale params are used for dequantization/recovery.
-void RnnBatchStep(
-    const float* input_ptr_batch, const int8_t* input_weights_ptr,
-    float input_weights_scale, const int8_t* recurrent_weights_ptr,
-    float recurrent_weights_scale, const float* bias_ptr, int input_size,
-    int num_units, int batch_size, int output_batch_leading_dim,
-    TfLiteFusedActivation activation, int8_t* quantized_input_ptr_batch,
-    int8_t* quantized_hidden_state_ptr_batch, float* scaling_factors,
-    float* hidden_state_ptr_batch, float* output_ptr_batch,
-    bool asymmetric_quantize_inputs, int32_t* zero_points,
-    int32_t* accum_scratch, int32_t* row_sums, bool* compute_row_sums);
-
-void RnnBatchStep(
-    const float* input_ptr_batch, const int8_t* input_weights_ptr,
-    float input_weights_scale, const float* aux_input_ptr_batch,
-    const int8_t* aux_input_weights_ptr, float aux_input_weights_scale,
-    const int8_t* recurrent_weights_ptr, float recurrent_weights_scale,
-    const float* bias_ptr, int input_size, int aux_input_size, int num_units,
-    int batch_size, int output_batch_leading_dim,
-    TfLiteFusedActivation activation, int8_t* quantized_input_ptr_batch,
-    int8_t* aux_quantized_input_ptr_batch,
-    int8_t* quantized_hidden_state_ptr_batch, float* scaling_factors,
-    float* hidden_state_ptr_batch, float* output_ptr_batch,
-    bool asymmetric_quantize_inputs, int32_t* zero_points,
-    int32_t* accum_scratch, int32_t* row_sums, bool* compute_row_sums);
-
-}  // namespace kernel_utils
-}  // namespace tflite
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_KERNEL_UTILS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/legacy_types.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/legacy_types.h
deleted file mode 100644
index c19a1ad..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/legacy_types.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright 2018 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_KERNELS_INTERNAL_LEGACY_TYPES_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_LEGACY_TYPES_H_
-
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-
-// TODO(b/116772710): Insert legacy Dims<> code in here.
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_LEGACY_TYPES_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/max.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/max.h
deleted file mode 100644
index c181002..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/max.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_
-
-#include 
-
-namespace tflite {
-
-#if defined(TF_LITE_USE_GLOBAL_MAX) || defined(__ZEPHYR__)
-inline float TfLiteMax(const float& x, const float& y) {
-  return std::max(x, y);
-}
-#else
-template 
-inline T TfLiteMax(const T& x, const T& y) {
-  return std::fmax(x, y);
-}
-#endif
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_MAX_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/mfcc.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/mfcc.h
deleted file mode 100644
index 8dae91e..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/mfcc.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* Copyright 2018 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.
-==============================================================================*/
-
-// Basic class for computing MFCCs from spectrogram slices.
-
-#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_MFCC_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_MFCC_H_
-
-#include 
-
-#include "tensorflow/lite/kernels/internal/mfcc_dct.h"
-#include "tensorflow/lite/kernels/internal/mfcc_mel_filterbank.h"
-
-namespace tflite {
-namespace internal {
-
-class Mfcc {
- public:
-  Mfcc();
-  bool Initialize(int input_length, double input_sample_rate);
-
-  // Input is a single squared-magnitude spectrogram frame. The input spectrum
-  // is converted to linear magnitude and weighted into bands using a
-  // triangular mel filterbank, and a discrete cosine transform (DCT) of the
-  // values is taken. Output is populated with the lowest dct_coefficient_count
-  // of these values.
-  void Compute(const std::vector& spectrogram_frame,
-               std::vector* output) const;
-
-  void set_upper_frequency_limit(double upper_frequency_limit) {
-    // CHECK(!initialized_) << "Set frequency limits before calling
-    // Initialize.";
-    upper_frequency_limit_ = upper_frequency_limit;
-  }
-
-  void set_lower_frequency_limit(double lower_frequency_limit) {
-    // CHECK(!initialized_) << "Set frequency limits before calling
-    // Initialize.";
-    lower_frequency_limit_ = lower_frequency_limit;
-  }
-
-  void set_filterbank_channel_count(int filterbank_channel_count) {
-    /// CHECK(!initialized_) << "Set channel count before calling Initialize.";
-    filterbank_channel_count_ = filterbank_channel_count;
-  }
-
-  void set_dct_coefficient_count(int dct_coefficient_count) {
-    // CHECK(!initialized_) << "Set coefficient count before calling
-    // Initialize.";
-    dct_coefficient_count_ = dct_coefficient_count;
-  }
-
- private:
-  MfccMelFilterbank mel_filterbank_;
-  MfccDct dct_;
-  bool initialized_;
-  double lower_frequency_limit_;
-  double upper_frequency_limit_;
-  int filterbank_channel_count_;
-  int dct_coefficient_count_;
-};
-
-}  // namespace internal
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_MFCC_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/mfcc_dct.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/mfcc_dct.h
deleted file mode 100644
index f2947b5..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/mfcc_dct.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* Copyright 2018 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.
-==============================================================================*/
-
-// Basic minimal DCT class for MFCC speech processing.
-
-#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_MFCC_DCT_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_MFCC_DCT_H_
-
-#include 
-
-namespace tflite {
-namespace internal {
-
-class MfccDct {
- public:
-  MfccDct();
-  bool Initialize(int input_length, int coefficient_count);
-  void Compute(const std::vector& input,
-               std::vector* output) const;
-
- private:
-  bool initialized_;
-  int coefficient_count_;
-  int input_length_;
-  std::vector > cosines_;
-};
-
-}  // namespace internal
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_MFCC_DCT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/mfcc_mel_filterbank.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/mfcc_mel_filterbank.h
deleted file mode 100644
index 53d05bf..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/mfcc_mel_filterbank.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright 2018 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.
-==============================================================================*/
-
-// Basic class for applying a mel-scale mapping to a power spectrum.
-
-#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_MFCC_MEL_FILTERBANK_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_MFCC_MEL_FILTERBANK_H_
-
-#include 
-
-namespace tflite {
-namespace internal {
-
-class MfccMelFilterbank {
- public:
-  MfccMelFilterbank();
-  bool Initialize(int input_length,  // Number of unique FFT bins fftsize/2+1.
-                  double input_sample_rate, int output_channel_count,
-                  double lower_frequency_limit, double upper_frequency_limit);
-
-  // Takes a squared-magnitude spectrogram slice as input, computes a
-  // triangular-mel-weighted linear-magnitude filterbank, and places the result
-  // in output.
-  void Compute(const std::vector& input,
-               std::vector* output) const;
-
- private:
-  double FreqToMel(double freq) const;
-  bool initialized_;
-  int num_channels_;
-  double sample_rate_;
-  int input_length_;
-  std::vector center_frequencies_;  // In mel, for each mel channel.
-
-  // Each FFT bin b contributes to two triangular mel channels, with
-  // proportion weights_[b] going into mel channel band_mapper_[b], and
-  // proportion (1 - weights_[b]) going into channel band_mapper_[b] + 1.
-  // Thus, weights_ contains the weighting applied to each FFT bin for the
-  // upper-half of the triangular band.
-  std::vector weights_;  // Right-side weight for this fft  bin.
-
-  // FFT bin i contributes to the upper side of mel channel band_mapper_[i]
-  std::vector band_mapper_;
-  int start_index_;  // Lowest FFT bin used to calculate mel spectrum.
-  int end_index_;    // Highest FFT bin used to calculate mel spectrum.
-};
-
-}  // namespace internal
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_MFCC_MEL_FILTERBANK_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/min.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/min.h
deleted file mode 100644
index 62035dc..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/min.h
+++ /dev/null
@@ -1,35 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_
-
-#include 
-
-namespace tflite {
-
-#if defined(TF_LITE_USE_GLOBAL_MIN) || defined(__ZEPHYR__)
-inline float TfLiteMin(const float& x, const float& y) {
-  return std::min(x, y);
-}
-#else
-template 
-inline T TfLiteMin(const T& x, const T& y) {
-  return std::fmin(x, y);
-}
-#endif
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_MIN_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/batch_matmul.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/batch_matmul.h
deleted file mode 100644
index 5e62215..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/batch_matmul.h
+++ /dev/null
@@ -1,384 +0,0 @@
-/* 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.
-==============================================================================*/
-#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_BATCH_MATMUL_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_BATCH_MATMUL_H_
-
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
-#include "tensorflow/lite/kernels/internal/common.h"
-#include "tensorflow/lite/kernels/internal/tensor_utils.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_ops {
-
-inline void BatchMatMul(const RuntimeShape& lhs_shape, const float* lhs_data,
-                        const RuntimeShape& rhs_shape, const float* rhs_data,
-                        const RuntimeShape& output_shape, float* output_data,
-                        CpuBackendContext* context) {
-  using ::tflite::cpu_backend_gemm::Gemm;
-  using ::tflite::cpu_backend_gemm::GemmParams;
-  using ::tflite::cpu_backend_gemm::MatrixParams;
-  const RuntimeShape extended_lhs_shape =
-      RuntimeShape::ExtendedShape(5, lhs_shape);
-  const RuntimeShape extended_rhs_shape =
-      RuntimeShape::ExtendedShape(5, rhs_shape);
-
-  // Determine which dimension is the broadcast dimension.
-  auto broadcast_dim = [](int lhs_dim, int rhs_dim) {
-    if (lhs_dim == rhs_dim) return lhs_dim;
-    if (lhs_dim == 1) return rhs_dim;
-    TFLITE_DCHECK_EQ(rhs_dim, 1);
-    return lhs_dim;
-  };
-
-  // Compute the "extent" for iterating on this dimension.
-  // If we are broadcasting, then don't advance (i.e return 0).
-  auto extent = [](const RuntimeShape& shape, int x) {
-    if (shape.Dims(x) == 1) {
-      return 0;
-    }
-    int prod = 1;
-    for (int i = x + 1; i < shape.DimensionsCount(); ++i) {
-      prod *= shape.Dims(i);
-    }
-    return prod;
-  };
-
-  const int batch_dim0 =
-      broadcast_dim(extended_lhs_shape.Dims(0), extended_rhs_shape.Dims(0));
-  const int batch_dim1 =
-      broadcast_dim(extended_lhs_shape.Dims(1), extended_rhs_shape.Dims(1));
-  const int batch_dim2 =
-      broadcast_dim(extended_lhs_shape.Dims(2), extended_rhs_shape.Dims(2));
-
-  const int lhs_ext0 = extent(extended_lhs_shape, 0);
-  const int lhs_ext1 = extent(extended_lhs_shape, 1);
-  const int lhs_ext2 = extent(extended_lhs_shape, 2);
-  const int rhs_ext0 = extent(extended_rhs_shape, 0);
-  const int rhs_ext1 = extent(extended_rhs_shape, 1);
-  const int rhs_ext2 = extent(extended_rhs_shape, 2);
-
-  // Set params for each matrix multiply.
-  const int lhs_rows = extended_lhs_shape.Dims(3);
-  const int rhs_cols = extended_rhs_shape.Dims(4);
-  const int accum_depth = extended_lhs_shape.Dims(4);
-
-  MatrixParams lhs_params;
-  lhs_params.order = cpu_backend_gemm::Order::kRowMajor;
-  lhs_params.rows = lhs_rows;
-  lhs_params.cols = accum_depth;
-
-  MatrixParams rhs_params;
-  rhs_params.order = cpu_backend_gemm::Order::kColMajor;
-  rhs_params.rows = accum_depth;
-  rhs_params.cols = rhs_cols;
-
-  MatrixParams dst_params;
-  dst_params.order = cpu_backend_gemm::Order::kColMajor;
-  dst_params.rows = lhs_rows;
-  dst_params.cols = rhs_cols;
-
-  for (int b0 = 0; b0 < batch_dim0; ++b0) {
-    const float* lhs_ptr0 = lhs_data + (b0 * lhs_ext0);
-    const float* rhs_ptr0 = rhs_data + (b0 * rhs_ext0);
-    for (int b1 = 0; b1 < batch_dim1; ++b1) {
-      const float* lhs_ptr1 = lhs_ptr0 + b1 * lhs_ext1;
-      const float* rhs_ptr1 = rhs_ptr0 + b1 * rhs_ext1;
-      for (int b2 = 0; b2 < batch_dim2; ++b2) {
-        const float* lhs_ptr2 = lhs_ptr1 + b2 * lhs_ext2;
-        const float* rhs_ptr2 = rhs_ptr1 + b2 * rhs_ext2;
-        float* out_ptr = output_data + ((b0 * batch_dim1 * batch_dim2) +
-                                        b1 * batch_dim2 + b2) *
-                                           lhs_rows * rhs_cols;
-        GemmParams gemm_params;
-        cpu_backend_gemm::Gemm(lhs_params, lhs_ptr2, rhs_params, rhs_ptr2,
-                               dst_params, out_ptr, gemm_params, context);
-      }
-    }
-  }
-}
-
-inline void BatchMatMul(const RuntimeShape& lhs_shape, const int8_t* lhs_data,
-                        const RuntimeShape& rhs_shape, const int8_t* rhs_data,
-                        const float* scaling_factors,
-                        const int32_t* input_offset, int32_t* row_sums,
-                        const RuntimeShape& output_shape,
-                        int32_t* accum_scratch, float* output_data,
-                        bool* compute_row_sums, CpuBackendContext* context) {
-  using ::tflite::cpu_backend_gemm::Gemm;
-  using ::tflite::cpu_backend_gemm::GemmParams;
-  using ::tflite::cpu_backend_gemm::MatrixParams;
-
-  const RuntimeShape extended_lhs_shape =
-      RuntimeShape::ExtendedShape(5, lhs_shape);
-  const RuntimeShape extended_rhs_shape =
-      RuntimeShape::ExtendedShape(5, rhs_shape);
-
-  // Determine which dimension is the broadcast dimension.
-  auto broadcast_dim = [](int lhs_dim, int rhs_dim) {
-    if (lhs_dim == rhs_dim) return lhs_dim;
-    if (lhs_dim == 1) return rhs_dim;
-    TFLITE_DCHECK_EQ(rhs_dim, 1);
-    return lhs_dim;
-  };
-
-  // Compute the "extent" for iterating on this dimension.
-  // If we are broadcasting, then don't advance (i.e return 0).
-  auto extent = [](const RuntimeShape& shape, int x) {
-    if (shape.Dims(x) == 1) {
-      return 0;
-    }
-    int prod = 1;
-    for (int i = x + 1; i < shape.DimensionsCount(); ++i) {
-      prod *= shape.Dims(i);
-    }
-    return prod;
-  };
-
-  const int batch_dim0 =
-      broadcast_dim(extended_lhs_shape.Dims(0), extended_rhs_shape.Dims(0));
-  const int batch_dim1 =
-      broadcast_dim(extended_lhs_shape.Dims(1), extended_rhs_shape.Dims(1));
-  const int batch_dim2 =
-      broadcast_dim(extended_lhs_shape.Dims(2), extended_rhs_shape.Dims(2));
-
-  const int lhs_ext0 = extent(extended_lhs_shape, 0);
-  const int lhs_ext1 = extent(extended_lhs_shape, 1);
-  const int lhs_ext2 = extent(extended_lhs_shape, 2);
-  const int rhs_ext0 = extent(extended_rhs_shape, 0);
-  const int rhs_ext1 = extent(extended_rhs_shape, 1);
-  const int rhs_ext2 = extent(extended_rhs_shape, 2);
-
-  // Set params for each matrix multiply.
-  const int lhs_rows = extended_lhs_shape.Dims(3);
-  const int rhs_cols = extended_rhs_shape.Dims(4);
-  const int accum_depth = extended_lhs_shape.Dims(4);
-
-  const int ioff_ext0 = rhs_ext0 == 0 ? 0 : rhs_cols;
-  const int ioff_ext1 = rhs_ext1 == 0 ? 0 : rhs_cols;
-  const int ioff_ext2 = rhs_ext2 == 0 ? 0 : rhs_cols;
-  const int woff_ext0 = lhs_ext0 == 0 ? 0 : lhs_rows;
-  const int woff_ext1 = lhs_ext1 == 0 ? 0 : lhs_rows;
-  const int woff_ext2 = lhs_ext2 == 0 ? 0 : lhs_rows;
-
-  if (!compute_row_sums || *compute_row_sums) {
-    int num_weights_matrices = 1;
-    for (int i = 1; i < extended_lhs_shape.DimensionsCount() - 2; ++i) {
-      num_weights_matrices *= extended_lhs_shape.Dims(i);
-    }
-    memset(row_sums, 0, sizeof(int32_t) * lhs_rows * num_weights_matrices);
-    for (int j = 0; j < num_weights_matrices; ++j) {
-      tensor_utils::ReductionSumVector(lhs_data + j * lhs_rows * accum_depth,
-                                       row_sums + j * lhs_rows, lhs_rows,
-                                       accum_depth);
-    }
-    if (compute_row_sums) {
-      *compute_row_sums = false;
-    }
-  }
-
-  MatrixParams lhs_params;
-  lhs_params.order = cpu_backend_gemm::Order::kRowMajor;
-  lhs_params.rows = lhs_rows;
-  lhs_params.cols = accum_depth;
-
-  MatrixParams rhs_params;
-  rhs_params.order = cpu_backend_gemm::Order::kColMajor;
-  rhs_params.rows = accum_depth;
-  rhs_params.cols = rhs_cols;
-
-  MatrixParams dst_params;
-  dst_params.order = cpu_backend_gemm::Order::kColMajor;
-  dst_params.rows = lhs_rows;
-  dst_params.cols = rhs_cols;
-
-  for (int b0 = 0; b0 < batch_dim0; ++b0) {
-    const int8_t* lhs_ptr0 = lhs_data + (b0 * lhs_ext0);
-    const int8_t* rhs_ptr0 = rhs_data + (b0 * rhs_ext0);
-    const int32_t* ioff_ptr0 = input_offset + (b0 * ioff_ext0);
-    const float* scale_ptr0 = scaling_factors + (b0 * ioff_ext0);
-    const int32_t* woff_ptr0 = row_sums + (b0 * woff_ext0);
-    for (int b1 = 0; b1 < batch_dim1; ++b1) {
-      const int8_t* lhs_ptr1 = lhs_ptr0 + b1 * lhs_ext1;
-      const int8_t* rhs_ptr1 = rhs_ptr0 + b1 * rhs_ext1;
-      const int32_t* ioff_ptr1 = ioff_ptr0 + (b1 * ioff_ext1);
-      const float* scale_ptr1 = scale_ptr0 + (b1 * ioff_ext1);
-      const int32_t* woff_ptr1 = woff_ptr0 + (b1 * woff_ext1);
-      for (int b2 = 0; b2 < batch_dim2; ++b2) {
-        const int8_t* lhs_ptr2 = lhs_ptr1 + b2 * lhs_ext2;
-        const int8_t* rhs_ptr2 = rhs_ptr1 + b2 * rhs_ext2;
-        const int32_t* ioff_ptr2 = ioff_ptr1 + (b2 * ioff_ext2);
-        const float* scale_ptr2 = scale_ptr1 + (b2 * ioff_ext2);
-        const int32_t* woff_ptr2 = woff_ptr1 + (b2 * woff_ext2);
-        float* out_ptr = output_data + ((b0 * batch_dim1 * batch_dim2) +
-                                        b1 * batch_dim2 + b2) *
-                                           lhs_rows * rhs_cols;
-        GemmParams gemm_params;
-        cpu_backend_gemm::Gemm(lhs_params, lhs_ptr2, rhs_params, rhs_ptr2,
-                               dst_params, accum_scratch, gemm_params, context);
-        for (int j = 0; j < rhs_cols; ++j) {
-          const float batch_scaling_factor = scale_ptr2[j];
-          const float batch_offset = static_cast(ioff_ptr2[j]);
-          int i = 0;
-#ifdef USE_NEON
-          const float32x4_t scaling_factor0 = vdupq_n_f32(batch_scaling_factor);
-          const float32x4_t scaling_factor1 = vdupq_n_f32(batch_scaling_factor);
-          const int32x4_t input_offset0 = vdupq_n_s32(-batch_offset);
-          const int32x4_t input_offset1 = vdupq_n_s32(-batch_offset);
-          for (; i < lhs_rows - 8; i += 8) {
-            // Load the row sums;
-            const int32x4_t row_sum0 = vld1q_s32(woff_ptr2 + i);
-            const int32x4_t row_sum1 = vld1q_s32(woff_ptr2 + i + 4);
-            // Load the accumulated values.
-            int idx = lhs_rows * j + i;
-            const int32x4_t scratch_val0 = vld1q_s32(accum_scratch + idx);
-            const int32x4_t scratch_val1 = vld1q_s32(accum_scratch + idx + 4);
-            const int32x4_t dotprod0 =
-                vmlaq_s32(scratch_val0, row_sum0, input_offset0);
-            const int32x4_t dotprod1 =
-                vmlaq_s32(scratch_val1, row_sum1, input_offset1);
-            const float32x4_t float_val0 = vcvtq_f32_s32(dotprod0);
-            const float32x4_t float_val1 = vcvtq_f32_s32(dotprod1);
-            const float32x4_t result0 = vmlaq_f32(vld1q_f32(out_ptr + idx),
-                                                  float_val0, scaling_factor0);
-            const float32x4_t result1 = vmlaq_f32(vld1q_f32(out_ptr + idx + 4),
-                                                  float_val1, scaling_factor1);
-            vst1q_f32(out_ptr + idx, result0);
-            vst1q_f32(out_ptr + idx + 4, result1);
-          }
-#endif  // USE_NEON
-          for (; i < lhs_rows; ++i) {
-            int idx = lhs_rows * j + i;
-            accum_scratch[idx] -= woff_ptr2[i] * batch_offset;
-            out_ptr[idx] += batch_scaling_factor * accum_scratch[idx];
-          }
-        }
-      }
-    }
-  }
-}
-
-inline void BatchMatMul(const FullyConnectedParams& params,
-                        const RuntimeShape& lhs_shape, const int8_t* lhs_data,
-                        const RuntimeShape& rhs_shape, const int8_t* rhs_data,
-                        const RuntimeShape& output_shape, int8_t* output_data,
-                        CpuBackendContext* context) {
-  using ::tflite::cpu_backend_gemm::Gemm;
-  using ::tflite::cpu_backend_gemm::GemmParams;
-  using ::tflite::cpu_backend_gemm::MatrixParams;
-
-  const RuntimeShape extended_lhs_shape =
-      RuntimeShape::ExtendedShape(5, lhs_shape);
-  const RuntimeShape extended_rhs_shape =
-      RuntimeShape::ExtendedShape(5, rhs_shape);
-
-  // Determine which dimension is the broadcast dimension.
-  auto broadcast_dim = [](int lhs_dim, int rhs_dim) {
-    if (lhs_dim == rhs_dim) return lhs_dim;
-    if (lhs_dim == 1) return rhs_dim;
-    TFLITE_DCHECK_EQ(rhs_dim, 1);
-    return lhs_dim;
-  };
-
-  // Compute the "extent" for iterating on this dimension.
-  // If we are broadcasting, then don't advance (i.e return 0).
-  auto extent = [](const RuntimeShape& shape, int x) {
-    if (shape.Dims(x) == 1) {
-      return 0;
-    }
-    int prod = 1;
-    for (int i = x + 1; i < shape.DimensionsCount(); ++i) {
-      prod *= shape.Dims(i);
-    }
-    return prod;
-  };
-
-  const int batch_dim0 =
-      broadcast_dim(extended_lhs_shape.Dims(0), extended_rhs_shape.Dims(0));
-  const int batch_dim1 =
-      broadcast_dim(extended_lhs_shape.Dims(1), extended_rhs_shape.Dims(1));
-  const int batch_dim2 =
-      broadcast_dim(extended_lhs_shape.Dims(2), extended_rhs_shape.Dims(2));
-
-  const int lhs_ext0 = extent(extended_lhs_shape, 0);
-  const int lhs_ext1 = extent(extended_lhs_shape, 1);
-  const int lhs_ext2 = extent(extended_lhs_shape, 2);
-  const int rhs_ext0 = extent(extended_rhs_shape, 0);
-  const int rhs_ext1 = extent(extended_rhs_shape, 1);
-  const int rhs_ext2 = extent(extended_rhs_shape, 2);
-
-  // Set params for each matrix multiply.
-  const int lhs_rows = extended_lhs_shape.Dims(3);
-  const int rhs_cols = extended_rhs_shape.Dims(4);
-  const int accum_depth = extended_lhs_shape.Dims(4);
-
-  const int32 input_offset = params.input_offset;
-  const int32 filter_offset = params.weights_offset;
-  const int32 output_offset = params.output_offset;
-  const int32 output_multiplier = params.output_multiplier;
-  const int output_shift = params.output_shift;
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  TFLITE_DCHECK_LE(output_activation_min, output_activation_max);
-
-  MatrixParams lhs_params;
-  lhs_params.order = cpu_backend_gemm::Order::kRowMajor;
-  lhs_params.rows = lhs_rows;
-  lhs_params.cols = accum_depth;
-  lhs_params.zero_point = -filter_offset;
-
-  MatrixParams rhs_params;
-  rhs_params.order = cpu_backend_gemm::Order::kColMajor;
-  rhs_params.rows = accum_depth;
-  rhs_params.cols = rhs_cols;
-  rhs_params.zero_point = -input_offset;
-
-  MatrixParams dst_params;
-  dst_params.order = cpu_backend_gemm::Order::kColMajor;
-  dst_params.rows = lhs_rows;
-  dst_params.cols = rhs_cols;
-  dst_params.zero_point = output_offset;
-
-  for (int b0 = 0; b0 < batch_dim0; ++b0) {
-    const int8_t* lhs_ptr0 = lhs_data + (b0 * lhs_ext0);
-    const int8_t* rhs_ptr0 = rhs_data + (b0 * rhs_ext0);
-    for (int b1 = 0; b1 < batch_dim1; ++b1) {
-      const int8_t* lhs_ptr1 = lhs_ptr0 + b1 * lhs_ext1;
-      const int8_t* rhs_ptr1 = rhs_ptr0 + b1 * rhs_ext1;
-      for (int b2 = 0; b2 < batch_dim2; ++b2) {
-        const int8_t* lhs_ptr2 = lhs_ptr1 + b2 * lhs_ext2;
-        const int8_t* rhs_ptr2 = rhs_ptr1 + b2 * rhs_ext2;
-        int8_t* out_ptr = output_data + ((b0 * batch_dim1 * batch_dim2) +
-                                         b1 * batch_dim2 + b2) *
-                                            lhs_rows * rhs_cols;
-
-        GemmParams gemm_params;
-        gemm_params.clamp_min = output_activation_min;
-        gemm_params.clamp_max = output_activation_max;
-        gemm_params.multiplier_fixedpoint = output_multiplier;
-        gemm_params.multiplier_exponent = output_shift;
-        cpu_backend_gemm::Gemm(lhs_params, lhs_ptr2, rhs_params, rhs_ptr2,
-                               dst_params, out_ptr, gemm_params, context);
-      }
-    }
-  }
-}
-
-}  // namespace optimized_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_BATCH_MATMUL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/cpu_check.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/cpu_check.h
deleted file mode 100644
index b39371a..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/cpu_check.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Copyright 2017 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_KERNELS_INTERNAL_OPTIMIZED_CPU_CHECK_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_CPU_CHECK_H_
-
-// This include is superfluous. However, it's been here for a while, and a
-// number of files have been relying on it to include neon_check.h for them.
-// This should be removed, but with a global run of presubmits to catch
-// any such issues. This requires running more than just TFLite presubmits.
-#include "tensorflow/lite/kernels/internal/optimized/neon_check.h"
-
-namespace tflite {
-
-// On A64, returns true if the dotprod extension is present.
-// On other architectures, returns false unconditionally.
-bool DetectArmNeonDotprod();
-
-struct CpuFlags {
-  bool neon_dotprod = false;
-};
-
-inline void GetCpuFlags(CpuFlags* cpu_flags) {
-  cpu_flags->neon_dotprod = DetectArmNeonDotprod();
-}
-
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_CPU_CHECK_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h
deleted file mode 100644
index 916edd5..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h
+++ /dev/null
@@ -1,589 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_3X3_FILTER_COMMON_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_3X3_FILTER_COMMON_H_
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_ops {
-namespace depthwise_conv {
-
-constexpr int kDepthwiseConvScratchWorkspaceSize = 10 * 10 * 64;
-constexpr int kDepthwiseConvAdjustedBiasLimit = 64;
-// In cases such as depth multiplication, we want to be able to load data from
-// the workspace that is beyond the valid range. Macro-block sizes are adjusted
-// to allow for this.
-constexpr int kWorkspaceExtension = 16;
-
-#ifdef USE_NEON
-
-#ifndef __aarch64__
-inline int8x16_t vqtbl4q_s8(int8x16x4_t a, int8x16_t b) {
-  const uint8x16_t mask = vtstq_s8(b, vdupq_n_s8(8));
-
-  // Delete bit 3 from the indices.
-  const int8x16_t high_bits = vshrq_n_s8(b, 4);
-  int8x16_t deleted_bit_3 = b;
-  deleted_bit_3 = vsliq_n_s8(deleted_bit_3, high_bits, 3);
-
-  int8x8x4_t repacked_data;
-
-  // Calculate for lower indices.
-  repacked_data.val[0] = vget_low_s8(a.val[0]);
-  repacked_data.val[1] = vget_low_s8(a.val[1]);
-  repacked_data.val[2] = vget_low_s8(a.val[2]);
-  repacked_data.val[3] = vget_low_s8(a.val[3]);
-  const int8x16_t output_for_lower =
-      vcombine_s8(vtbl4_s8(repacked_data, vget_low_s8(deleted_bit_3)),
-                  vtbl4_s8(repacked_data, vget_high_s8(deleted_bit_3)));
-
-  // Calculate for high indices.
-  repacked_data.val[0] = vget_high_s8(a.val[0]);
-  repacked_data.val[1] = vget_high_s8(a.val[1]);
-  repacked_data.val[2] = vget_high_s8(a.val[2]);
-  repacked_data.val[3] = vget_high_s8(a.val[3]);
-  const int8x16_t output_for_higher =
-      vcombine_s8(vtbl4_s8(repacked_data, vget_low_s8(deleted_bit_3)),
-                  vtbl4_s8(repacked_data, vget_high_s8(deleted_bit_3)));
-
-  // Merge.
-  int8x16_t output = vbslq_s8(mask, output_for_higher, output_for_lower);
-  return output;
-}
-#endif  // !__aarch64__
-
-// Convenience-compatibility functions.
-// Compatibility: Intrinsics reflect a mixture of older and newer ARM
-//     instructions. This actually results in ZIP1 / ZIP2 asm instructions, but
-//     one intrinsic is provided. Also older instructions operated in place,
-//     and it seems more defensive to assume that some versions of intrinsics
-//     might reflect this
-// Convenience: Callers in these kernels want both ZIP1 and ZIP2, and we do not
-//     want the calling code to get cluttered with unpacking int8x16x2_t.
-inline void vzipq_s8_in_place(int8x16_t* a, int8x16_t* b) {
-  int8x16x2_t r8x16;
-  r8x16 = vzipq_s8(*a, *b);
-  *a = r8x16.val[0];
-  *b = r8x16.val[1];
-}
-
-inline void vzipq_s8x2_in_place(int8x16_t* a, int8x16_t* b) {
-  int16x8x2_t r16x8;
-  r16x8 = vzipq_s16(vreinterpretq_s16_s8(*a), vreinterpretq_s16_s8(*b));
-  *a = vreinterpretq_s8_s16(r16x8.val[0]);
-  *b = vreinterpretq_s8_s16(r16x8.val[1]);
-}
-
-// Similar rationale to the zip-in_place functions, but callers only actually
-// need the TRN1 asm instruction result.
-inline void vtrn1_s8x2_in_place(int8x16_t* a, int8x16_t* b) {
-  int16x8x2_t r16x8;
-  r16x8 = vtrnq_s16(vreinterpretq_s16_s8(*a), vreinterpretq_s16_s8(*b));
-  *a = vreinterpretq_s8_s16(r16x8.val[0]);
-}
-
-// Similar rationale to the zip-in_place functions, but callers only actually
-// need the ZIP1 or ZIP2 asm instruction results.
-inline int8x16_t vzip1q_s8(int8x16_t a, int8x16_t b) {
-  return vzipq_s8(a, b).val[0];
-}
-inline int8x16_t vzip2q_s8(int8x16_t a, int8x16_t b) {
-  return vzipq_s8(a, b).val[1];
-}
-
-inline void biregister_rotate_8(int8x16_t* left, int8x16_t* right) {
-  *left = vreinterpretq_s8_u32(vshrq_n_u32(vreinterpretq_u32_s8(*left), 8));
-  *left = vreinterpretq_s8_u32(vsliq_n_u32(vreinterpretq_u32_s8(*left),
-                                           vreinterpretq_u32_s8(*right), 24));
-  *right = vreinterpretq_s8_u32(vshrq_n_u32(vreinterpretq_u32_s8(*right), 8));
-}
-
-#ifndef __aarch64__
-inline int32x4_t vpaddq_s32(int32x4_t a, int32x4_t b) {
-  int32x4x2_t deinterleaved = vuzpq_s32(a, b);
-  return vqaddq_s32(deinterleaved.val[0], deinterleaved.val[1]);
-}
-#endif  // !__aarch64__
-
-#ifdef __ARM_FEATURE_DOTPROD
-// The vdotq_lane_s32 takes int8x8t for the rhs parameter, whereas the actual
-// instruction selects from between 4 32-bit (4x8-bit packed) sub-registers, an
-// unusual interpretation of "lane".
-inline int32x4_t vdotq_four_lane_s32(int32x4_t acc, int8x16_t lhs,
-                                     int8x16_t rhs, const int lane) {
-  switch (lane) {
-    case 0:
-      return vdotq_lane_s32(acc, lhs, vreinterpret_s32_s8(vget_low_s8(rhs)), 0);
-    case 1:
-      return vdotq_lane_s32(acc, lhs, vreinterpret_s32_s8(vget_low_s8(rhs)), 1);
-    case 2:
-      return vdotq_lane_s32(acc, lhs, vreinterpret_s32_s8(vget_high_s8(rhs)),
-                            0);
-    case 3:
-    default:
-      return vdotq_lane_s32(acc, lhs, vreinterpret_s32_s8(vget_high_s8(rhs)),
-                            1);
-  }
-}
-
-#else
-
-inline int32x4_t vdotq_s32(int32x4_t acc, int8x16_t lhs, int8x16_t rhs) {
-  int32x4_t sum0 = vpaddlq_s16(vmull_s8(vget_low_s8(lhs), vget_low_s8(rhs)));
-  int32x4_t sum1 = vpaddlq_s16(vmull_s8(vget_high_s8(lhs), vget_high_s8(rhs)));
-  int32x4_t sum = vpaddq_s32(sum0, sum1);
-  return vaddq_s32(acc, sum);
-}
-
-inline int32x4_t vdotq_four_lane_s32(int32x4_t acc, int8x16_t lhs,
-                                     int8x16_t rhs, int lane) {
-  int8x8_t lane_rhs;
-  if (lane == 0) {
-    lane_rhs = vreinterpret_s8_s32(
-        vdup_lane_s32(vreinterpret_s32_s8(vget_low_s8(rhs)), 0));
-  } else if (lane == 1) {
-    lane_rhs = vreinterpret_s8_s32(
-        vdup_lane_s32(vreinterpret_s32_s8(vget_low_s8(rhs)), 1));
-  } else if (lane == 2) {
-    lane_rhs = vreinterpret_s8_s32(
-        vdup_lane_s32(vreinterpret_s32_s8(vget_high_s8(rhs)), 0));
-  } else {
-    lane_rhs = vreinterpret_s8_s32(
-        vdup_lane_s32(vreinterpret_s32_s8(vget_high_s8(rhs)), 1));
-  }
-  int32x4_t sum0 = vpaddlq_s16(vmull_s8(vget_low_s8(lhs), lane_rhs));
-  int32x4_t sum1 = vpaddlq_s16(vmull_s8(vget_high_s8(lhs), lane_rhs));
-  int32x4_t sum = vpaddq_s32(sum0, sum1);
-  return vaddq_s32(acc, sum);
-}
-
-#endif  // !__ARM_FEATURE_DOTPROD
-#endif  // ARM NEON
-
-//  This structure is typically used for reducing the magnitude of outputs, and
-//  the historical name reflects that.
-template 
-struct DivideByPOT {};
-
-template <>
-struct DivideByPOT {
-  template 
-  static inline IntegerType Run(IntegerType x, int exponent) {
-    return RoundingDivideByPOT(x, exponent);
-  }
-  // Mult versions use the exponents directly, rather than negated.
-  template 
-  static inline IntegerType RunMult(IntegerType x, int exponent) {
-    return RoundingDivideByPOT(x, -exponent);
-  }
-};
-
-#ifdef USE_NEON
-template <>
-struct DivideByPOT {
-  template 
-  static inline IntegerType Run(IntegerType x, int exponent) {
-    return vqrshlq_s32(x, vdupq_n_s32(static_cast(-exponent)));
-  }
-  template 
-  static inline IntegerType RunMult(IntegerType x, IntegerType exponent) {
-    return vqrshlq_s32(x, exponent);
-  }
-  template 
-  static inline IntegerType RunMult(IntegerType x, int exponent) {
-    return vqrshlq_s32(x, vdupq_n_s32(static_cast(exponent)));
-  }
-};
-#endif  // ARM NEON
-
-// See CategorizeDotProductKernel for definitive taxonomy.
-enum class DotProduct3x3KernelType {
-  kNone = 0,  // Parameter combination is not supported for dot product kernels.
-  kPlain,
-  kWithDepthMultiplicationStride1,
-  kWithDepthMultiplicationStride2,
-  kStride2,
-};
-
-enum class QuantizationType {
-  kNonPerChannelUint8 = 0,
-  kPerChannelInt8 = 1,
-};
-
-template 
-struct QuantizationTypeImpl {};
-
-template <>
-struct QuantizationTypeImpl {
-  typedef uint8 ExternalType;
-
-  static constexpr int kIntSymmetricZeroPoint = 128;
-  static constexpr uint8 kUint8SignBit = 0x80;
-};
-
-template <>
-struct QuantizationTypeImpl {
-  typedef int8 ExternalType;
-
-  static constexpr int kIntSymmetricZeroPoint = 0;
-  static constexpr uint8 kUint8SignBit = 0x0;
-};
-
-template <
-    QuantizationType quantization_type = QuantizationType::kNonPerChannelUint8>
-inline DotProduct3x3KernelType CategorizeDotProductKernel(
-    const RuntimeShape& input_shape, const RuntimeShape& filter_shape,
-    const RuntimeShape& output_shape, const DepthwiseParams& params,
-    const int32* output_shift_ptr = nullptr) {
-  constexpr int kSymmetricZeroPoint =
-      QuantizationTypeImpl::kIntSymmetricZeroPoint;
-  const int padding =
-      std::max(params.padding_values.width, params.padding_values.height);
-  const int stride = params.stride_width;
-  const int32 input_depth = input_shape.Dims(3);
-  const int32 depth_multiplier = params.depth_multiplier;
-  const int32 filter_height = filter_shape.Dims(1);
-  const int32 filter_width = filter_shape.Dims(2);
-
-  bool supported = stride == params.stride_height && stride <= 2 &&
-                   padding <= 1 && filter_width == 3 && filter_height == 3 &&
-                   params.dilation_width_factor == 1 &&
-                   params.dilation_height_factor == 1 &&
-                   (((input_depth % 8) == 0 && depth_multiplier == 1) ||
-                    (input_depth == 1 && depth_multiplier > 1));
-
-  if (!supported) {
-    return DotProduct3x3KernelType::kNone;
-  }
-
-  if (params.weights_offset != -kSymmetricZeroPoint) {
-    return DotProduct3x3KernelType::kNone;
-  }
-
-  if (quantization_type == QuantizationType::kPerChannelInt8) {
-    if (output_shift_ptr == nullptr) {
-      return DotProduct3x3KernelType::kNone;
-    }
-  } else if (params.output_shift > 0) {
-    return DotProduct3x3KernelType::kNone;
-  }
-
-  if (params.depth_multiplier == 1) {
-    if (stride == 1) {
-      return DotProduct3x3KernelType::kPlain;
-    } else if (stride == 2) {
-      return DotProduct3x3KernelType::kStride2;
-    } else {
-      return DotProduct3x3KernelType::kNone;
-    }
-  } else {
-    if (stride == 1) {
-      return DotProduct3x3KernelType::kWithDepthMultiplicationStride1;
-    } else if (stride == 2) {
-      return DotProduct3x3KernelType::kWithDepthMultiplicationStride2;
-    } else {
-      return DotProduct3x3KernelType::kNone;
-    }
-  }
-}
-
-// Encapsulates constant parameters used in DepthwiseConv.
-// 64-bit is used for types that will be added to 64-bit addresses in asm.
-struct DepthwiseConvParams {
-  int64_t input_depth;
-  int64_t input_row_size;
-  int64_t output_depth;
-  int64_t output_row_size;
-  int64_t filter_row_size;
-  int32 input_offset;
-  int32 output_offset;
-  int32 filter_offset;
-  int32 output_multiplier;
-  int32 output_activation_min;
-  int32 output_activation_max;
-  int32 output_right_shift;
-  int32 input_width;
-  int32 input_height;
-  int32 stride_width;
-  int32 stride_height;
-  int32 output_width;
-  int32 output_height;
-  float float_output_activation_min;
-  float float_output_activation_max;
-};
-
-// Encapsulates constant parameters used in DepthwiseConv using dot-product ops.
-// 64-bit is used for types that will be added to 64-bit addresses in asm.
-//
-// This structure is specifically designed for use in asm.
-struct DepthwiseConvDotProdParams {
-  int64_t input_depth;
-  int64_t output_depth;
-  int32 stride;
-  int32 bias_increment;
-  //
-  int32 input_offset;
-  int32 output_offset;
-  int32 output_multiplier;
-  int32 output_shift;
-  int32 quantized_activation_min;
-  int32 quantized_activation_max;
-  //
-  int32 padding_left;
-  int32 padding_right;
-  int32 padding_top;
-  int32 padding_bottom;
-  //
-  int32 depth_micro_repeats;
-  //
-  int32 width_macro_count;
-  int32 input_width_overall_micro_repeats;
-  int32 input_width_micro_repeats;
-  int32 residual_width;
-  int32 output_width_overall_micro_repeats;
-  int32 output_width_micro_repeats;
-  int32 output_residual_width;
-  int32 workspace_width_micro_repeats;
-  //
-  int32 height_macro_count;
-  int32 inbound_block_height;
-  int32 outbound_block_height;
-  int32 input_height_stride;
-  int32 output_height_stride;
-  int32 workspace_height_stride;
-  //
-  int32 four_over_stride;
-  //
-  const int32* output_multiplier_per_channel;
-  const int32* output_shift_per_channel;
-};
-
-template 
-struct DepthwiseConvWindow {};
-
-template 
-struct DepthwiseConvWindowPerChannel {};
-
-enum class EdgeType { kCorner, kHorizontal, kVertical, kCenter };
-
-template 
-struct DepthwiseConvPartial {};
-
-template 
-struct DepthwiseConvPartialPerChannel {};
-
-// Copies a subset of the input designated by |input_ptr| into |output_ptr|
-// with the specified output dimensions. Supports output depths of 64 only as
-// this is the cache line size.
-template 
-inline void ShuffleInput(const T* input_ptr, int64_t input_depth,
-                         int32 input_width, int32 input_height,
-                         int64_t output_depth, int32 output_width,
-                         int32 output_height, T* output_ptr) {
-  const int64_t input_row_size = input_depth * input_width;
-  for (int32 y = 0; y < output_height; y++) {
-    const T* ptr = input_ptr;
-    for (int32 x = 0; x < output_width; x++) {
-      memcpy(output_ptr, ptr, output_depth);
-      output_ptr += output_depth;
-      ptr += input_depth;
-    }
-    input_ptr += input_row_size;
-  }
-}
-
-// Calculates the input size depending on stride and output.
-inline int32 get_shuffle_input_size(int32 stride, int32 output) {
-  return stride * (output - 1) + 3;
-}
-
-// Indicates the input and output dimensions used when shuffling input
-// activations.
-struct ShuffleParams {
-  int32 output_width;
-  int32 output_height;
-  int32 input_width;
-  int32 input_height;
-
-  ShuffleParams() = default;
-  ShuffleParams(int32 output_width, int32 output_height, int32 stride_width,
-                int32 stride_height)
-      : output_width(output_width),
-        output_height(output_height),
-        input_width(get_shuffle_input_size(stride_width, output_width)),
-        input_height(get_shuffle_input_size(stride_height, output_height)) {}
-};
-
-template <
-    QuantizationType quantization_type = QuantizationType::kNonPerChannelUint8>
-inline bool Fast3x3FilterKernelSupported(
-    const RuntimeShape& input_shape, const RuntimeShape& filter_shape,
-    int32 stride_width, int32 stride_height, int32 dilation_width_factor,
-    int32 dilation_height_factor, int32 pad_width, int32 pad_height,
-    int32 depth_multiplier, const RuntimeShape& output_shape,
-    int32 output_shift, const int32* output_shift_ptr = nullptr) {
-  const int32 input_height = input_shape.Dims(1);
-  const int32 input_width = input_shape.Dims(2);
-  const int32 input_depth = input_shape.Dims(3);
-  const int32 filter_height = filter_shape.Dims(1);
-  const int32 filter_width = filter_shape.Dims(2);
-  const int32 output_height = output_shape.Dims(1);
-  const int32 output_width = output_shape.Dims(2);
-
-  bool supported =
-      filter_width == 3 && filter_height == 3 && depth_multiplier == 1 &&
-      (stride_width == 1 || stride_width == 2) &&
-      (stride_height == 1 || stride_height == 2) &&
-      (stride_width == stride_height) && (pad_width == 0 || pad_width == 1) &&
-      (pad_height == 0 || pad_height == 1) && (pad_width == pad_height) &&
-      (input_depth % 8) == 0 && (output_shift <= 0) &&
-      dilation_width_factor == 1 && dilation_height_factor == 1;
-
-  if (!supported) {
-    return false;
-  }
-
-  // Handle case where padding is zero but padding type is not kValid.
-  // This would require special boundary case handling that is not supported.
-
-  const int32 out_x = output_width - 1;
-  const int32 out_y = output_height - 1;
-
-  const int32 in_x_origin = (out_x * stride_width) - pad_width;
-  const int32 in_y_origin = (out_y * stride_height) - pad_height;
-
-  const int32 in_x_end = in_x_origin + filter_width;
-  const int32 in_y_end = in_y_origin + filter_height;
-
-  // Supported only if filter on the right and bottom boundary lies completely
-  // within the input if padding is zero.
-  if (pad_width == 0 && pad_height == 0) {
-    return in_x_end <= input_width && in_y_end <= input_height;
-  }
-
-  // Else if padding is 1, supported if bottom right filter lies +1 past input
-  // width and height.
-  supported = in_x_end <= (input_width + 1) && in_y_end <= (input_height + 1);
-
-  if (!supported) {
-    return false;
-  }
-
-  // Shapes with width 1 and height > 1, and vice versa are not supported yet.
-  if (input_width == 1) {
-    supported = (input_width == input_height);
-  } else if (input_height == 1) {
-    supported = (input_width == input_height);
-  }
-  return supported;
-}
-
-// Permute filter data, and adjust bias data to account for symmetric input
-// offset. Details are provided in the implementation of the
-// kUseCModel3x3DotProduct version.
-//
-// See the comments preceding DepthwiseConvDotProduct3x3() for further notes.
-template 
-struct ProcessPerDepth {
-  // Routine is contained in a static Run() method. No default template version
-  // is supplied, so that all implementations are deliberate choices of template
-  // specialization.
-  //
-  // Note that the signature of the Run() method will be designed for the asm
-  // implementation rather than conforming to style.
-};
-
-// Copy a macro block of data from the input buffer into the workspace,
-// permuting data within each micro block.
-//
-// (a) Copy a macro block of data, padding as required along the width and
-//     height.
-// (b) Transpose the data within each micro block.
-//
-// See the comments preceding DepthwiseConvDotProduct3x3() for further notes.
-template 
-struct PackMacroBlock {
-  // Routine is contained in a static Run() method. No default template version
-  // is supplied, so that all implementations are deliberate choices of template
-  // specialization.
-  //
-  // Note that the signature of the Run() method will be designed for the asm
-  // implementation rather than conforming to style.
-};
-
-// Apply filter to macro block of input data and store results. Details are
-// provided in the implementation of the kUseCModel3x3DotProduct version.
-//
-// Parameters for repeats and residual sizes are in terms of outputs.
-//
-// See the comments preceding DepthwiseConvDotProduct3x3() for further notes.
-template 
-struct KernelMacroBlock {
-  // Routine is contained in a static Run() method. No default template version
-  // is supplied, so that all implementations are deliberate choices of template
-  // specialization.
-  //
-  // Note that the signature of the Run() method will be designed for the asm
-  // implementation rather than conforming to style.
-};
-
-#if defined(__aarch64__)
-// Experiments suggest that a modest performance improvement is seen, at least
-// on 855 chipset big cores, with cache hints.
-template 
-inline void PreloadInputBlock(
-    const T* input_block_data,
-    const DepthwiseConvDotProdParams* function_params) {
-  // Preload.
-  const int input_width_micro_repeats =
-      function_params->input_width_micro_repeats;
-  const int block_height = function_params->inbound_block_height;
-  const int residual_width = function_params->residual_width;
-  const int input_height_stride = function_params->input_height_stride;
-  const int input_depth = function_params->input_depth;
-
-  const int total_width = 4 * input_width_micro_repeats + residual_width;
-  const T* row_ptr = input_block_data;
-  for (int k_height = 0; k_height < block_height; ++k_height) {
-    const T* ptr = row_ptr;
-    for (int j = 0; j < total_width; ++j) {
-      // Input data is loaded once.
-      optimized_ops_preload_l1_keep(ptr);
-      ptr += input_depth;
-    }
-    row_ptr += input_height_stride;
-  }
-}
-#endif  // __aarch64__
-
-}  // namespace depthwise_conv
-}  // namespace optimized_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_3X3_FILTER_COMMON_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h
deleted file mode 100644
index a8903c1..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h
+++ /dev/null
@@ -1,1115 +0,0 @@
-/* Copyright 2017 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_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_FLOAT_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_FLOAT_H_
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_ops {
-
-// Implementation of float DepthwiseConv
-
-template 
-struct FloatDepthwiseConvKernel {};
-
-#ifdef USE_NEON
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    // Load the filters
-    float32x4_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      filter[i] = vld1q_f32(filter_ptr + 4 * i);
-    }
-    int outp = 0;
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the inputs
-      float32x4_t input[4];
-      for (int i = 0; i < 4; i++) {
-        input[i] = vld1q_f32(input_ptr + 4 * i);
-      }
-      input_ptr += 16;
-      // Load the accumulators from acc_buffer
-      float32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_f32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      acc[0] = vmlaq_f32(acc[0], input[0], filter[0]);
-      acc[1] = vmlaq_f32(acc[1], input[1], filter[1]);
-      acc[2] = vmlaq_f32(acc[2], input[2], filter[0]);
-      acc[3] = vmlaq_f32(acc[3], input[3], filter[1]);
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_f32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the inputs
-      float32x4_t input[2];
-      for (int i = 0; i < 2; i++) {
-        input[i] = vld1q_f32(input_ptr + 4 * i);
-      }
-      input_ptr += 8;
-      // Load the accumulators from acc_buffer
-      float32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_f32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vmlaq_f32(acc[i], input[i], filter[i]);
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_f32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    const float32x2_t filters = vld1_f32(filter_ptr);
-    const float32x4_t filters_dup2 = vcombine_f32(filters, filters);
-    int outp = 0;
-    // Handle 8 output pixels at a time.
-    for (; outp <= num_output_pixels - 8; outp += 8) {
-      // Load the inputs
-      float32x4_t input[4];
-      for (int i = 0; i < 4; i++) {
-        input[i] = vld1q_f32(input_ptr + 4 * i);
-      }
-      input_ptr += 16;
-      // Load the accumulators from acc_buffer
-      float32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_f32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vmlaq_f32(acc[i], input[i], filters_dup2);
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_f32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle 4 output pixels at a time.
-    for (; outp <= num_output_pixels - 4; outp += 4) {
-      // Load the inputs
-      float32x4_t input[2];
-      for (int i = 0; i < 2; i++) {
-        input[i] = vld1q_f32(input_ptr + 4 * i);
-      }
-      input_ptr += 8;
-      // Load the accumulators from acc_buffer
-      float32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_f32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vmlaq_f32(acc[i], input[i], filters_dup2);
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_f32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-    }
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the inputs
-      const float32x4_t input = vld1q_f32(input_ptr);
-      input_ptr += 4;
-      // Load the accumulators from acc_buffer
-      float32x4_t acc = vld1q_f32(acc_buffer_ptr);
-      // Multiply-accumulate
-      acc = vmlaq_f32(acc, input, filters_dup2);
-      // Store the accumulators back to acc_buffer
-      vst1q_f32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-    // Handle 1 output pixel at a time
-    for (; outp < num_output_pixels; outp++) {
-      // Load the inputs
-      const float32x2_t input = vld1_f32(input_ptr);
-      input_ptr += 2;
-      // Load the accumulators from acc_buffer
-      float32x2_t acc = vld1_f32(acc_buffer_ptr);
-      // Multiply-accumulate
-      acc = vmla_f32(acc, input, filters);
-      // Store the accumulators back to acc_buffer
-      vst1_f32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 2;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      const float* local_filter_ptr = filter_ptr;
-      const float* local_input_ptr = input_ptr;
-      int ic = 0;
-      // Handle 16 input channels at a time.
-      for (; ic <= input_depth - 16; ic += 16) {
-        // Load the filters
-        float32x4_t filter_0 = vld1q_f32(local_filter_ptr + 4 * 0);
-        float32x4_t filter_1 = vld1q_f32(local_filter_ptr + 4 * 1);
-        float32x4_t filter_2 = vld1q_f32(local_filter_ptr + 4 * 2);
-        float32x4_t filter_3 = vld1q_f32(local_filter_ptr + 4 * 3);
-        local_filter_ptr += 16;
-        // Load the inputs
-        float32x4_t input_0 = vld1q_f32(local_input_ptr + 4 * 0);
-        float32x4_t input_1 = vld1q_f32(local_input_ptr + 4 * 1);
-        float32x4_t input_2 = vld1q_f32(local_input_ptr + 4 * 2);
-        float32x4_t input_3 = vld1q_f32(local_input_ptr + 4 * 3);
-        local_input_ptr += 16;
-        // Load the accumulators from acc_buffer
-        float32x4_t acc_0 = vld1q_f32(acc_buffer_ptr + 4 * 0);
-        float32x4_t acc_1 = vld1q_f32(acc_buffer_ptr + 4 * 1);
-        float32x4_t acc_2 = vld1q_f32(acc_buffer_ptr + 4 * 2);
-        float32x4_t acc_3 = vld1q_f32(acc_buffer_ptr + 4 * 3);
-        // Multiply-accumulate
-        acc_0 = vmlaq_f32(acc_0, input_0, filter_0);
-        acc_1 = vmlaq_f32(acc_1, input_1, filter_1);
-        acc_2 = vmlaq_f32(acc_2, input_2, filter_2);
-        acc_3 = vmlaq_f32(acc_3, input_3, filter_3);
-        // Store the accumulators back to acc_buffer
-        vst1q_f32(acc_buffer_ptr + 4 * 0, acc_0);
-        vst1q_f32(acc_buffer_ptr + 4 * 1, acc_1);
-        vst1q_f32(acc_buffer_ptr + 4 * 2, acc_2);
-        vst1q_f32(acc_buffer_ptr + 4 * 3, acc_3);
-        acc_buffer_ptr += 16;
-      }
-      // Handle 4 input channels at a time.
-      for (; ic <= input_depth - 4; ic += 4) {
-        // Load the filters
-        float32x4_t filter;
-        filter = vld1q_f32(local_filter_ptr);
-        local_filter_ptr += 4;
-        // Load the inputs
-        float32x4_t input;
-        input = vld1q_f32(local_input_ptr);
-        local_input_ptr += 4;
-        // Load the accumulators from acc_buffer
-        float32x4_t acc;
-        acc = vld1q_f32(acc_buffer_ptr);
-        // Multiply-accumulate
-        acc = vmlaq_f32(acc, input, filter);
-        // Store the accumulators back to acc_buffer
-        vst1q_f32(acc_buffer_ptr, acc);
-        acc_buffer_ptr += 4;
-      }
-      // Handle one input channel at a time.
-      for (; ic < input_depth; ic++) {
-        const float input_val = *local_input_ptr++;
-        const float filter_val = *local_filter_ptr++;
-        *acc_buffer_ptr++ += filter_val * input_val;
-      }
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      const float* local_filter_ptr = filter_ptr;
-      const float* local_input_ptr = input_ptr;
-      int ic = 0;
-      // Handle 2 input channels at a time.
-      for (; ic <= input_depth - 2; ic += 2) {
-        // Load the filters
-        float32x4_t filter[4];
-        for (int i = 0; i < 4; i++) {
-          filter[i] = vld1q_f32(local_filter_ptr + 4 * i);
-        }
-        local_filter_ptr += 16;
-        // Load the inputs
-        const float32x2_t input = vld1_f32(local_input_ptr);
-        local_input_ptr += 2;
-        // Load the accumulators from acc_buffer
-        float32x4_t acc[4];
-        for (int i = 0; i < 4; i++) {
-          acc[i] = vld1q_f32(acc_buffer_ptr + 4 * i);
-        }
-        // Multiply-accumulate
-        acc[0] = vmlaq_lane_f32(acc[0], filter[0], input, 0);
-        acc[1] = vmlaq_lane_f32(acc[1], filter[1], input, 0);
-        acc[2] = vmlaq_lane_f32(acc[2], filter[2], input, 1);
-        acc[3] = vmlaq_lane_f32(acc[3], filter[3], input, 1);
-        // Store the accumulators back to acc_buffer
-        for (int i = 0; i < 4; i++) {
-          vst1q_f32(acc_buffer_ptr + 4 * i, acc[i]);
-        }
-        acc_buffer_ptr += 16;
-      }
-      // Handle one input channel at a time.
-      for (; ic < input_depth; ic++) {
-        // Load the filters
-        float32x4_t filter[2];
-        for (int i = 0; i < 2; i++) {
-          filter[i] = vld1q_f32(local_filter_ptr + 4 * i);
-        }
-        local_filter_ptr += 8;
-        // Load the inputs
-        const float input_val = *local_input_ptr++;
-        // Load the accumulators from acc_buffer
-        float32x4_t acc[2];
-        for (int i = 0; i < 2; i++) {
-          acc[i] = vld1q_f32(acc_buffer_ptr + 4 * i);
-        }
-        // Multiply-accumulate
-        for (int i = 0; i < 2; i++) {
-          acc[i] = vmlaq_n_f32(acc[i], filter[i], input_val);
-        }
-        // Store the accumulators back to acc_buffer
-        for (int i = 0; i < 2; i++) {
-          vst1q_f32(acc_buffer_ptr + 4 * i, acc[i]);
-        }
-        acc_buffer_ptr += 8;
-      }
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-// Note this implementation is very slow for input_depths < 8
-// (e.g. comparable to reference implementation) see, specializations for
-// input_depth=3 below.
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      const float* local_filter_ptr = filter_ptr;
-      const float* local_input_ptr = input_ptr;
-      int ic = 0;
-      // Handle 8 input channels at a time.
-      for (; ic <= input_depth - 8; ic += 8) {
-        // Load the filters
-        float32x4_t filter[4];
-        for (int i = 0; i < 4; i++) {
-          filter[i] = vld1q_f32(local_filter_ptr + 4 * i);
-        }
-        local_filter_ptr += 16;
-        // Load the inputs
-        float32x4x2_t input_dup2[2];
-        for (int i = 0; i < 2; i++) {
-          const float32x4_t input = vld1q_f32(local_input_ptr + 4 * i);
-          input_dup2[i] = vzipq_f32(input, input);
-        }
-        local_input_ptr += 8;
-        // Load the accumulators from acc_buffer
-        float32x4_t acc[4];
-        for (int i = 0; i < 4; i++) {
-          acc[i] = vld1q_f32(acc_buffer_ptr + 4 * i);
-        }
-        // Multiply-accumulate
-        acc[0] = vmlaq_f32(acc[0], filter[0], input_dup2[0].val[0]);
-        acc[1] = vmlaq_f32(acc[1], filter[1], input_dup2[0].val[1]);
-        acc[2] = vmlaq_f32(acc[2], filter[2], input_dup2[1].val[0]);
-        acc[3] = vmlaq_f32(acc[3], filter[3], input_dup2[1].val[1]);
-        // Store the accumulators back to acc_buffer
-        for (int i = 0; i < 4; i++) {
-          vst1q_f32(acc_buffer_ptr + 4 * i, acc[i]);
-        }
-        acc_buffer_ptr += 16;
-      }
-      // Handle 4 input channels at a time.
-      for (; ic <= input_depth - 4; ic += 4) {
-        // Load the filters
-        float32x2_t filter[4];
-        for (int i = 0; i < 4; i++) {
-          filter[i] = vld1_f32(local_filter_ptr + 2 * i);
-        }
-        local_filter_ptr += 8;
-        // Load the inputs
-        const float32x4_t input = vld1q_f32(local_input_ptr);
-        local_input_ptr += 4;
-        // Load the accumulators from acc_buffer
-        float32x2_t acc[4];
-        for (int i = 0; i < 4; i++) {
-          acc[i] = vld1_f32(acc_buffer_ptr + 2 * i);
-        }
-        // Multiply-accumulate
-        acc[0] = vmla_lane_f32(acc[0], filter[0], vget_low_f32(input), 0);
-        acc[1] = vmla_lane_f32(acc[1], filter[1], vget_low_f32(input), 1);
-        acc[2] = vmla_lane_f32(acc[2], filter[2], vget_high_f32(input), 0);
-        acc[3] = vmla_lane_f32(acc[3], filter[3], vget_high_f32(input), 1);
-        // Store the accumulators back to acc_buffer
-        for (int i = 0; i < 4; i++) {
-          vst1_f32(acc_buffer_ptr + 2 * i, acc[i]);
-        }
-        acc_buffer_ptr += 8;
-      }
-      // Handle 2 input channels at a time.
-      for (; ic <= input_depth - 2; ic += 2) {
-        // Load the filters
-        const float32x4_t filter = vld1q_f32(local_filter_ptr);
-        local_filter_ptr += 4;
-        // Load the inputs
-        const float32x2_t input = vld1_f32(local_input_ptr);
-        local_input_ptr += 2;
-        // Load the accumulators from acc_buffer
-        float32x2_t acc[2];
-        for (int i = 0; i < 2; i++) {
-          acc[i] = vld1_f32(acc_buffer_ptr + 2 * i);
-        }
-        // Multiply-accumulate
-        acc[0] = vmla_lane_f32(acc[0], vget_low_f32(filter), input, 0);
-        acc[1] = vmla_lane_f32(acc[1], vget_high_f32(filter), input, 1);
-        // Store the accumulators back to acc_buffer
-        for (int i = 0; i < 2; i++) {
-          vst1_f32(acc_buffer_ptr + 2 * i, acc[i]);
-        }
-        acc_buffer_ptr += 4;
-      }
-      // Handle one input channel at a time.
-      for (; ic < input_depth; ic++) {
-        // Load the inputs
-        const float input_val = *local_input_ptr++;
-        // Multiply-accumulate
-        for (int i = 0; i < 2; i++) {
-          acc_buffer_ptr[i] += local_filter_ptr[i] * input_val;
-        }
-        local_filter_ptr += 2;
-        acc_buffer_ptr += 2;
-      }
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    // Load the filters
-    float32x2_t filter[3];
-    for (int i = 0; i < 3; i++) {
-      filter[i] = vld1_f32(filter_ptr + 2 * i);
-    }
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      const float32x2_t input01 = vld1_f32(input_ptr);
-      const float32x2_t input2 = vld1_dup_f32(input_ptr + 2);
-      // Load the accumulators from acc_buffer
-      float32x2_t acc[3];
-      for (int i = 0; i < 3; i++) {
-        acc[i] = vld1_f32(acc_buffer_ptr + 2 * i);
-      }
-      // Multiply-accumulate for each input channel there 2 outputs
-      acc[0] = vmla_lane_f32(acc[0], filter[0], input01, 0);
-      acc[1] = vmla_lane_f32(acc[1], filter[1], input01, 1);
-      acc[2] = vmla_lane_f32(acc[2], filter[2], input2, 0);
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 3; i++) {
-        vst1_f32(acc_buffer_ptr + 2 * i, acc[i]);
-      }
-      acc_buffer_ptr += 6;
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    // Load the filters
-    float32x4_t filter[3];
-    for (int i = 0; i < 3; i++) {
-      filter[i] = vld1q_f32(filter_ptr + 4 * i);
-    }
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // NOTE: we only want 3 values, so we read it as two ops where
-      // the second op just duplicates the lane
-      const float32x2_t input01 = vld1_f32(input_ptr);
-      const float32x2_t input2 = vld1_dup_f32(input_ptr + 2);
-      // Load the accumulators from acc_buffer
-      float32x4_t acc[3];
-      for (int i = 0; i < 3; i++) {
-        acc[i] = vld1q_f32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate all outputs.
-      acc[0] = vmlaq_lane_f32(acc[0], filter[0], input01, 0);
-      acc[1] = vmlaq_lane_f32(acc[1], filter[1], input01, 1);
-      acc[2] = vmlaq_lane_f32(acc[2], filter[2], input2, 0);
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 3; i++) {
-        vst1q_f32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 12;
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    // Load the filters
-    float32x4_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      filter[i] = vld1q_f32(filter_ptr + 4 * i);
-    }
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the inputs
-      const float input_val = *input_ptr;
-      input_ptr += input_ptr_increment;
-      // Load the accumulators from acc_buffer
-      float32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_f32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vmlaq_n_f32(acc[i], filter[i], input_val);
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_f32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    // Load the filters
-    float32x4_t filter_0 = vld1q_f32(filter_ptr + 4 * 0);
-    float32x4_t filter_1 = vld1q_f32(filter_ptr + 4 * 1);
-    float32x4_t filter_2 = vld1q_f32(filter_ptr + 4 * 2);
-    float32x4_t filter_3 = vld1q_f32(filter_ptr + 4 * 3);
-    float32x4_t filter_4 = vld1q_f32(filter_ptr + 4 * 4);
-    float32x4_t filter_5 = vld1q_f32(filter_ptr + 4 * 5);
-    float32x4_t filter_6 = vld1q_f32(filter_ptr + 4 * 6);
-    float32x4_t filter_7 = vld1q_f32(filter_ptr + 4 * 7);
-
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the inputs
-      const float input_val = *input_ptr;
-      input_ptr += input_ptr_increment;
-      // Load the accumulators from acc_buffer
-      float32x4_t acc_0 = vld1q_f32(acc_buffer_ptr + 4 * 0);
-      float32x4_t acc_1 = vld1q_f32(acc_buffer_ptr + 4 * 1);
-      float32x4_t acc_2 = vld1q_f32(acc_buffer_ptr + 4 * 2);
-      float32x4_t acc_3 = vld1q_f32(acc_buffer_ptr + 4 * 3);
-      float32x4_t acc_4 = vld1q_f32(acc_buffer_ptr + 4 * 4);
-      float32x4_t acc_5 = vld1q_f32(acc_buffer_ptr + 4 * 5);
-      float32x4_t acc_6 = vld1q_f32(acc_buffer_ptr + 4 * 6);
-      float32x4_t acc_7 = vld1q_f32(acc_buffer_ptr + 4 * 7);
-      // Multiply-accumulate
-      acc_0 = vmlaq_n_f32(acc_0, filter_0, input_val);
-      acc_1 = vmlaq_n_f32(acc_1, filter_1, input_val);
-      acc_2 = vmlaq_n_f32(acc_2, filter_2, input_val);
-      acc_3 = vmlaq_n_f32(acc_3, filter_3, input_val);
-      acc_4 = vmlaq_n_f32(acc_4, filter_4, input_val);
-      acc_5 = vmlaq_n_f32(acc_5, filter_5, input_val);
-      acc_6 = vmlaq_n_f32(acc_6, filter_6, input_val);
-      acc_7 = vmlaq_n_f32(acc_7, filter_7, input_val);
-      // Store the accumulators back to acc_buffer
-      vst1q_f32(acc_buffer_ptr + 4 * 0, acc_0);
-      vst1q_f32(acc_buffer_ptr + 4 * 1, acc_1);
-      vst1q_f32(acc_buffer_ptr + 4 * 2, acc_2);
-      vst1q_f32(acc_buffer_ptr + 4 * 3, acc_3);
-      vst1q_f32(acc_buffer_ptr + 4 * 4, acc_4);
-      vst1q_f32(acc_buffer_ptr + 4 * 5, acc_5);
-      vst1q_f32(acc_buffer_ptr + 4 * 6, acc_6);
-      vst1q_f32(acc_buffer_ptr + 4 * 7, acc_7);
-      acc_buffer_ptr += 32;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    // Load the filters
-    float32x4_t filter_0 = vld1q_f32(filter_ptr + 4 * 0);
-    float32x4_t filter_1 = vld1q_f32(filter_ptr + 4 * 1);
-    float32x4_t filter_2 = vld1q_f32(filter_ptr + 4 * 2);
-    float32x4_t filter_3 = vld1q_f32(filter_ptr + 4 * 3);
-    float32x4_t filter_4 = vld1q_f32(filter_ptr + 4 * 4);
-
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the inputs
-      const float input_val = *input_ptr;
-      input_ptr += input_ptr_increment;
-      // Load the accumulators from acc_buffer
-      float32x4_t acc_0 = vld1q_f32(acc_buffer_ptr + 4 * 0);
-      float32x4_t acc_1 = vld1q_f32(acc_buffer_ptr + 4 * 1);
-      float32x4_t acc_2 = vld1q_f32(acc_buffer_ptr + 4 * 2);
-      float32x4_t acc_3 = vld1q_f32(acc_buffer_ptr + 4 * 3);
-      float32x4_t acc_4 = vld1q_f32(acc_buffer_ptr + 4 * 4);
-      // Multiply-accumulate
-      acc_0 = vmlaq_n_f32(acc_0, filter_0, input_val);
-      acc_1 = vmlaq_n_f32(acc_1, filter_1, input_val);
-      acc_2 = vmlaq_n_f32(acc_2, filter_2, input_val);
-      acc_3 = vmlaq_n_f32(acc_3, filter_3, input_val);
-      acc_4 = vmlaq_n_f32(acc_4, filter_4, input_val);
-      // Store the accumulators back to acc_buffer
-      vst1q_f32(acc_buffer_ptr + 4 * 0, acc_0);
-      vst1q_f32(acc_buffer_ptr + 4 * 1, acc_1);
-      vst1q_f32(acc_buffer_ptr + 4 * 2, acc_2);
-      vst1q_f32(acc_buffer_ptr + 4 * 3, acc_3);
-      vst1q_f32(acc_buffer_ptr + 4 * 4, acc_4);
-      acc_buffer_ptr += 20;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      const float* local_filter_ptr = filter_ptr;
-      const float* local_input_ptr = input_ptr;
-      for (int ic = 0; ic < input_depth; ic++) {
-        // Load the filters
-        float32x4_t filter[4];
-        for (int i = 0; i < 4; i++) {
-          filter[i] = vld1q_f32(local_filter_ptr + 4 * i);
-        }
-        local_filter_ptr += 16;
-        // Load the inputs
-        const float input_val = *local_input_ptr++;
-        // Load the accumulators from acc_buffer
-        float32x4_t acc[4];
-        for (int i = 0; i < 4; i++) {
-          acc[i] = vld1q_f32(acc_buffer_ptr + 4 * i);
-        }
-        // Multiply-accumulate
-        for (int i = 0; i < 4; i++) {
-          acc[i] = vmlaq_n_f32(acc[i], filter[i], input_val);
-        }
-        // Store the accumulators back to acc_buffer
-        for (int i = 0; i < 4; i++) {
-          vst1q_f32(acc_buffer_ptr + 4 * i, acc[i]);
-        }
-        acc_buffer_ptr += 16;
-      }
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    // Load the filters
-    float32x4_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      filter[i] = vld1q_f32(filter_ptr + 4 * i);
-    }
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the inputs
-      float32x4_t input[2];
-      for (int i = 0; i < 2; i++) {
-        input[i] = vld1q_f32(input_ptr + 4 * i);
-      }
-      // Load the accumulators from acc_buffer
-      float32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_f32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vmlaq_f32(acc[i], input[i], filter[i]);
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_f32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    float32x2_t filter = vld1_f32(filter_ptr);
-    float32x4_t filter_x4 = vcombine_f32(filter, filter);
-    int outp = 0;
-
-    // Handle two output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the inputs
-      float32x2_t input_1 = vld1_f32(input_ptr);
-      input_ptr += input_ptr_increment;
-      float32x2_t input_2 = vld1_f32(input_ptr);
-      input_ptr += input_ptr_increment;
-      float32x4_t input = vcombine_f32(input_1, input_2);
-
-      // Load the accumulators from acc_buffer
-      float32x4_t acc = vld1q_f32(acc_buffer_ptr);
-
-      // Multiply-accumulate
-      acc = vmlaq_f32(acc, input, filter_x4);
-
-      // Store the accumulators back to acc_buffer
-      vst1q_f32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the inputs
-      float32x2_t input = vld1_f32(input_ptr);
-      input_ptr += input_ptr_increment;
-
-      // Load the accumulators from acc_buffer
-      float32x2_t acc = vld1_f32(acc_buffer_ptr);
-
-      // Multiply-accumulate
-      acc = vmla_f32(acc, input, filter);
-
-      // Store the accumulators back to acc_buffer
-      vst1_f32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 2;
-    }
-  }
-};
-
-template <>
-struct FloatDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const float* input_ptr, int input_ptr_increment,
-                  const float* filter_ptr, float* acc_buffer_ptr) {
-    float32x4_t filter = vld1q_f32(filter_ptr);
-
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the inputs
-      float32x4_t input = vld1q_f32(input_ptr);
-      // Load the accumulators from acc_buffer
-      float32x4_t acc = vld1q_f32(acc_buffer_ptr);
-      // Multiply-accumulate
-      acc = vmlaq_f32(acc, input, filter);
-      // Store the accumulators back to acc_buffer
-      vst1q_f32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-#endif
-
-// Accumulates the effect of one row of the filter, on a segment of one row
-// of the output, accessing the corresponding one row of the input.
-template 
-void FloatDepthwiseConvAccumRow(int stride, int dilation_factor,
-                                int input_depth, int input_width,
-                                const float* input_data, int pad_width,
-                                int depth_multiplier, int filter_width,
-                                const float* filter_data,
-                                int out_x_buffer_start, int out_x_buffer_end,
-                                int output_depth, float* acc_buffer) {
-  ruy::profiler::ScopeLabel label(__PRETTY_FUNCTION__);
-  // Consistency check parameters. This is important in particular to ensure
-  // that we keep the number of template instantiations minimal, so we don't
-  // increase binary size unnecessarily.
-  static_assert(kFixedDepthMultiplier || !kFixedInputDepth, "");
-  static_assert(kFixedInputDepth || kAllowStrided, "");
-  TFLITE_DCHECK(stride == 1 || kAllowStrided);
-  if (kFixedInputDepth) {
-    TFLITE_DCHECK_EQ(input_depth, kFixedInputDepth);
-  }
-  if (kFixedDepthMultiplier) {
-    TFLITE_DCHECK_EQ(depth_multiplier, kFixedDepthMultiplier);
-  }
-  TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier);
-  const int input_ptr_increment = stride * input_depth;
-  const float* filter_base_ptr = filter_data;
-  for (int filter_x = 0; filter_x < filter_width; ++filter_x) {
-    // For the current (filter_x, filter_y) point in the filter,
-    // compute the boundaries of the corresponding output row segment.
-    int out_x_loop_start_unclamped = 0;
-    int out_x_loop_end_unclamped = 0;
-    if (kAllowStrided) {
-      if (stride == 2) {
-        out_x_loop_start_unclamped =
-            (pad_width - dilation_factor * filter_x + 1) / 2;
-        out_x_loop_end_unclamped =
-            (pad_width + input_width - dilation_factor * filter_x + 1) / 2;
-      } else if (stride == 4) {
-        out_x_loop_start_unclamped =
-            (pad_width - dilation_factor * filter_x + 3) / 4;
-        out_x_loop_end_unclamped =
-            (pad_width + input_width - dilation_factor * filter_x + 3) / 4;
-      } else {
-        out_x_loop_start_unclamped =
-            (pad_width - dilation_factor * filter_x + stride - 1) / stride;
-        out_x_loop_end_unclamped = (pad_width + input_width -
-                                    dilation_factor * filter_x + stride - 1) /
-                                   stride;
-      }
-    } else {
-      out_x_loop_start_unclamped = pad_width - dilation_factor * filter_x;
-      out_x_loop_end_unclamped =
-          pad_width + input_width - dilation_factor * filter_x;
-    }
-    // The kernel will have to iterate on the segment of the
-    // output row that starts at out_x_loop_start and out_x_loop_end.
-    const int out_x_loop_start =
-        std::max(out_x_buffer_start, out_x_loop_start_unclamped);
-    const int out_x_loop_end =
-        std::min(out_x_buffer_end, out_x_loop_end_unclamped);
-
-    float* acc_buffer_ptr =
-        acc_buffer + (out_x_loop_start - out_x_buffer_start) * output_depth;
-    const int in_x_origin =
-        (out_x_loop_start * stride) - pad_width + dilation_factor * filter_x;
-    const float* input_ptr = input_data + in_x_origin * input_depth;
-    const int num_output_pixels = out_x_loop_end - out_x_loop_start;
-    FloatDepthwiseConvKernel::Run(num_output_pixels,
-                                                         input_depth,
-                                                         depth_multiplier,
-                                                         input_ptr,
-                                                         input_ptr_increment,
-                                                         filter_base_ptr,
-                                                         acc_buffer_ptr);
-    filter_base_ptr += output_depth;
-  }
-}
-
-// generic fallback of FloatDepthwiseConvAccumRow, portable, non-templatized.
-inline void FloatDepthwiseConvAccumRowGeneric(
-    int stride, int dilation_factor, int input_depth, int input_width,
-    const float* input_data, int pad_width, int depth_multiplier,
-    int filter_width, const float* filter_data, int out_x_buffer_start,
-    int out_x_buffer_end, int output_depth, float* acc_buffer) {
-  ruy::profiler::ScopeLabel label("DepthwiseConvAccumRowGeneric (slow)");
-  const float* filter_base_ptr = filter_data;
-  for (int filter_x = 0; filter_x < filter_width; ++filter_x) {
-    const int out_x_loop_start = std::max(
-        out_x_buffer_start,
-        (pad_width - dilation_factor * filter_x + stride - 1) / stride);
-    const int out_x_loop_end = std::min(
-        out_x_buffer_end,
-        (pad_width + input_width - dilation_factor * filter_x + stride - 1) /
-            stride);
-
-    float* acc_buffer_ptr =
-        acc_buffer + (out_x_loop_start - out_x_buffer_start) * output_depth;
-    const int in_x_origin =
-        (out_x_loop_start * stride) - pad_width + dilation_factor * filter_x;
-    const float* input_ptr = input_data + in_x_origin * input_depth;
-    const int input_ptr_increment = (stride - 1) * input_depth;
-    for (int out_x = out_x_loop_start; out_x < out_x_loop_end; out_x++) {
-      const float* filter_ptr = filter_base_ptr;
-      for (int ic = 0; ic < input_depth; ++ic) {
-        const float input_val = *input_ptr++;
-        for (int m = 0; m < depth_multiplier; m++) {
-          const float filter_val = *filter_ptr++;
-          *acc_buffer_ptr++ += filter_val * input_val;
-        }
-      }
-      input_ptr += input_ptr_increment;
-    }
-    filter_base_ptr += output_depth;
-  }
-}
-
-// Initializes the accumulator buffer with bias values.
-inline void DepthwiseConvInitAccBuffer(int num_output_pixels, int output_depth,
-                                       const float* bias_data,
-                                       float* acc_buffer) {
-  // TODO(benoitjacob): This might need optimized specializations
-  // for small output_depth values, if that ever becomes an important
-  // case (like it was for some quantized DepthwiseConv cases).
-  for (int i = 0; i < num_output_pixels; i++) {
-    memcpy(acc_buffer + i * output_depth, bias_data,
-           sizeof(acc_buffer[0]) * output_depth);
-  }
-}
-
-// DepthwiseConv can run with multi threads on the dim specified by thread_dim.
-// Each thread processes output elements on dim, thread_dim, in the range of
-// [thread_start, thread_end).
-// For example, assume thread_start = 2, thread_end = 6, and thread_dim = 1, it
-// means that it will calculate DepthwiseConv for output_data[:, 2:5, :, :].
-//
-// The cpu_flags is currently unused. This
-// parameter is included so that the signature matches that required by a
-// templated function. Other versions, such as quantized, need this parameter.
-inline void DepthwiseConvImpl(
-    const DepthwiseParams& params, const RuntimeShape& input_shape,
-    const float* input_data, const RuntimeShape& filter_shape,
-    const float* filter_data, const RuntimeShape& bias_shape,
-    const float* bias_data, const RuntimeShape& output_shape,
-    float* output_data, const CpuFlags& /* cpu_flags */, int thread_start,
-    int thread_end, int thread_dim) {
-  ruy::profiler::ScopeLabel label("DepthwiseConv/float/DepthwiseConvImpl");
-
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-  const int depth_multiplier = params.depth_multiplier;
-  const float output_activation_min = params.float_activation_min;
-  const float output_activation_max = params.float_activation_max;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK(thread_dim == 0 || thread_dim == 1);
-
-  const int batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  const int input_height = input_shape.Dims(1);
-  const int input_width = input_shape.Dims(2);
-  const int input_depth = input_shape.Dims(3);
-  const int filter_height = filter_shape.Dims(1);
-  const int filter_width = filter_shape.Dims(2);
-  const int output_height = output_shape.Dims(1);
-  const int output_width = output_shape.Dims(2);
-  TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier);
-  TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth);
-
-  static const int kAccBufferMaxSize = 4832;
-  float acc_buffer[kAccBufferMaxSize];
-  TFLITE_DCHECK_GE(kAccBufferMaxSize, output_depth);
-  const int kOutputPixelsInAccBuffer = kAccBufferMaxSize / output_depth;
-  const int kAccBufferActualSize = kOutputPixelsInAccBuffer * output_depth;
-  TFLITE_DCHECK_LE(kOutputPixelsInAccBuffer * output_depth,
-                   kAccBufferActualSize);
-  TFLITE_DCHECK_LE(kAccBufferActualSize, kAccBufferMaxSize);
-  TFLITE_DCHECK_GE(kOutputPixelsInAccBuffer, 1);
-
-  // row_accum_func will point to the core accumulation function to be used
-  // for this DepthwiseConv op.
-  using row_accum_func_t = decltype(&FloatDepthwiseConvAccumRowGeneric);
-  row_accum_func_t row_accum_func = nullptr;
-
-#define TFMINI_USE_DEPTHWISECONV_KERNEL(ALLOW_STRIDED, FIXED_INPUT_DEPTH, \
-                                        FIXED_DEPTH_MULTIPLIER)           \
-  if (!row_accum_func && (stride_width == 1 || ALLOW_STRIDED) &&          \
-      (input_depth == FIXED_INPUT_DEPTH || FIXED_INPUT_DEPTH == 0) &&     \
-      depth_multiplier == FIXED_DEPTH_MULTIPLIER) {                       \
-    row_accum_func =                                                      \
-        FloatDepthwiseConvAccumRow;               \
-  }
-
-#ifdef USE_NEON
-  // We go over our list of kernels by decreasing order of preference
-  // for the cases where multiple kernels could apply.
-
-  // Start with the fastest kernels: AllowStrided=false, fixed input depth.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 8, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 2, 1)
-
-  // Next come the strided kernels: AllowStrided=true, fixed input depth.
-  // They are a bit less efficient, but allow stride!=1.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 8, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 8)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 20)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 32)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 2, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 3, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 3, 4)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 4, 1)
-
-  // Finally, the kernels allowing a variable input depth,
-  // these are the least efficient but most general kernels.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 8)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 16)
-
-#endif  // USE_NEON
-
-#undef TFMINI_USE_DEPTHWISECONV_KERNEL
-
-  // No matching fast kernel found, use slow fallback.
-  if (!row_accum_func) {
-    row_accum_func = FloatDepthwiseConvAccumRowGeneric;
-  }
-
-  const int input_height_stride = input_shape.Dims(3) * input_shape.Dims(2);
-  const int input_batch_stride = input_height_stride * input_shape.Dims(1);
-  const int filter_height_stride = filter_shape.Dims(3) * filter_shape.Dims(2);
-
-  // Now that we have determined row_accum_func, we can start work.
-  int batch_start = 0;
-  int batch_end = batches;
-  int row_start = 0;
-  int row_end = output_height;
-  int output_ptr_offset = 0;
-
-  switch (thread_dim) {
-    case 0:
-      // Multithread along with the batch axis
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, batches);
-      batch_start = thread_start;
-      batch_end = thread_end;
-      output_ptr_offset = batch_start * FlatSizeSkipDim(output_shape, 0);
-      break;
-    case 1:
-      // Multithread along with the row axis
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, output_height);
-      row_start = thread_start;
-      row_end = thread_end;
-      output_ptr_offset = row_start * output_width * output_depth;
-      break;
-  }
-
-  float* output_ptr = output_data + output_ptr_offset;
-  int batch_step =
-      (output_height + row_start - row_end) * output_width * output_depth;
-
-  for (int b = batch_start; b < batch_end; ++b) {
-    for (int out_y = row_start; out_y < row_end; ++out_y) {
-      const int in_y_origin = (out_y * stride_height) - pad_height;
-      const int filter_y_start =
-          std::max(0, (-in_y_origin + dilation_height_factor - 1) /
-                          dilation_height_factor);
-      const int filter_y_end =
-          std::min(filter_height,
-                   (input_height - in_y_origin + dilation_height_factor - 1) /
-                       dilation_height_factor);
-      for (int out_x_buffer_start = 0; out_x_buffer_start < output_width;
-           out_x_buffer_start += kOutputPixelsInAccBuffer) {
-        const int out_x_buffer_end = std::min(
-            output_width, out_x_buffer_start + kOutputPixelsInAccBuffer);
-        // We call a 'pixel' a group of activation that share all but the
-        // 'depth'/'channel' coordinate. num_output_pixels is the number of
-        // output pixels that we will accumulate in this loop iteration.
-        const int num_output_pixels = out_x_buffer_end - out_x_buffer_start;
-        // Initialize our local accumulator with the bias values, so we don't
-        // have to add them later.
-        DepthwiseConvInitAccBuffer(num_output_pixels, output_depth, bias_data,
-                                   acc_buffer);
-        // Accumulation loop. Most of the time should be spent in here.
-        for (int filter_y = filter_y_start; filter_y < filter_y_end;
-             ++filter_y) {
-          const int in_y = in_y_origin + dilation_height_factor * filter_y;
-          row_accum_func(
-              stride_width, dilation_width_factor, input_depth, input_width,
-              input_data + in_y * input_height_stride + b * input_batch_stride,
-              pad_width, depth_multiplier, filter_width,
-              filter_data + filter_y * filter_height_stride, out_x_buffer_start,
-              out_x_buffer_end, output_depth, acc_buffer);
-        }
-        // Finished accumulating. Now store to destination.
-        const int num_output_values = output_depth * num_output_pixels;
-        int i = 0;
-// TODO(benoitjacob) optimized code goes here
-#ifdef USE_NEON
-        // Handle 16 values at a time
-        for (; i <= num_output_values - 16; i += 16) {
-          float32x4_t acc[4];
-          for (int k = 0; k < 4; k++) {
-            acc[k] = vld1q_f32(acc_buffer + i + 4 * k);
-          }
-          for (int k = 0; k < 4; k++) {
-            acc[k] = vmaxq_f32(
-                vdupq_n_f32(output_activation_min),
-                vminq_f32(vdupq_n_f32(output_activation_max), acc[k]));
-          }
-          for (int k = 0; k < 4; k++) {
-            vst1q_f32(output_ptr + 4 * k, acc[k]);
-          }
-          output_ptr += 16;
-        }
-        // Handle 4 values at a time
-        for (; i <= num_output_values - 4; i += 4) {
-          float32x4_t acc = vld1q_f32(acc_buffer + i);
-
-          acc = vmaxq_f32(vdupq_n_f32(output_activation_min),
-                          vminq_f32(vdupq_n_f32(output_activation_max), acc));
-
-          vst1q_f32(output_ptr, acc);
-          output_ptr += 4;
-        }
-#endif
-        // Handle leftover values, one by one. This is very slow.
-        for (; i < num_output_values; i++) {
-          float acc = acc_buffer[i];
-          acc = std::max(output_activation_min,
-                         std::min(output_activation_max, acc));
-
-          *output_ptr++ = acc;
-        }
-      }
-    }
-    output_ptr += batch_step;
-  }
-}
-
-
-}  // namespace optimized_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_FLOAT_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_multithread.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_multithread.h
deleted file mode 100644
index 7d8838a..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_multithread.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_MULTITHREAD_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_MULTITHREAD_H_
-
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_threadpool.h"
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h"
-
-namespace tflite {
-namespace optimized_ops {
-
-// TODO(luwa): add multithread to per-channel depthwise_conv
-// DepthwiseConv can run with multi threads on the dim specified by thread_dim.
-// Each thread processes output elements on dim, thread_dim, in the range of
-// [thread_start, thread_end).
-// For example, assume thread_start = 2, thread_end = 6, and thread_dim = 1, it
-// means that it will calculate DepthwiseConv for output_data[:, 2:5, :, :].
-template 
-struct DepthwiseConvWorkerTask : cpu_backend_threadpool::Task {
-  DepthwiseConvWorkerTask(const DepthwiseParams& params,
-                          const RuntimeShape& input_shape, const T* input_data,
-                          const RuntimeShape& filter_shape,
-                          const T* filter_data, const RuntimeShape& bias_shape,
-                          const TS* bias_data, const RuntimeShape& output_shape,
-                          T* output_data, const CpuFlags& cpu_flags,
-                          int thread_start, int thread_end, int thread_dim)
-      : params_(params),
-        input_shape_(input_shape),
-        input_data_(input_data),
-        filter_shape_(filter_shape),
-        filter_data_(filter_data),
-        bias_shape_(bias_shape),
-        bias_data_(bias_data),
-        output_shape_(output_shape),
-        output_data_(output_data),
-        cpu_flags_(cpu_flags),
-        thread_start_(thread_start),
-        thread_end_(thread_end),
-        thread_dim_(thread_dim) {}
-
-  void Run() override {
-    DepthwiseConvImpl(params_, input_shape_, input_data_, filter_shape_,
-                      filter_data_, bias_shape_, bias_data_, output_shape_,
-                      output_data_, cpu_flags_, thread_start_, thread_end_,
-                      thread_dim_);
-  }
-
- private:
-  const DepthwiseParams& params_;
-  const RuntimeShape& input_shape_;
-  const T* input_data_;
-  const RuntimeShape& filter_shape_;
-  const T* filter_data_;
-  const RuntimeShape& bias_shape_;
-  const TS* bias_data_;
-  const RuntimeShape& output_shape_;
-  T* output_data_;
-  const CpuFlags& cpu_flags_;
-  int thread_start_;
-  int thread_end_;
-  int thread_dim_;
-};
-
-inline int HowManyConvThreads(const RuntimeShape& output_shape,
-                              const RuntimeShape& filter_shape) {
-  // How many scalar multiplications are needed to make it worth using one
-  // more thread
-  static constexpr int kMinMulPerThread = 1 << 13;  // 8k
-  const int filter_height = filter_shape.Dims(1);
-  const int filter_width = filter_shape.Dims(2);
-  const int num_muls = output_shape.FlatSize() * filter_height * filter_width;
-  // Try to avoid real runtime divisions if possible by dividing by a
-  // compile-time constant.
-  int thread_count = std::max(1, num_muls / kMinMulPerThread);
-  return thread_count;
-}
-
-inline bool MultithreadAlongBatches(int thread_count, int batches) {
-  TFLITE_DCHECK_GE(thread_count, 2);
-  // If there are fewer batch entries than the number of threads we want to use,
-  // then better do intra-batch-entry multithreading.
-  if (batches < thread_count) {
-    return false;
-  }
-  // If there are at least 2 batch entries to be handed to each thread, then
-  // it's safe to proceed with batch-wise multithreading: each thread will have
-  // approximately equal number of batch entries to handle, so the load
-  // balancing will be reasonable, and the amount to which the load is not
-  // perfectly balanced will be offset by the inherent advantages of
-  // batch-wise multithreading (each thread is more efficient thanks to working
-  // on larger buffers with less boundary-handling overhead).
-  if (batches >= 2 * thread_count) {
-    return true;
-  }
-  // In the limit case were there are at least 1 but not much more than 1
-  // batch entries per thread, it may be a good idea to do per-batch
-  // multithreading if the number of batch entries is a multiple of the number
-  // of threads, so that each thread will have the same number of batch entries
-  // to process.
-  return ((batches % thread_count) == 0);
-}
-
-template 
-inline void DepthwiseConv(const DepthwiseParams& params,
-                          const RuntimeShape& input_shape, const T* input_data,
-                          const RuntimeShape& filter_shape,
-                          const T* filter_data, const RuntimeShape& bias_shape,
-                          const TS* bias_data, const RuntimeShape& output_shape,
-                          T* output_data,
-                          CpuBackendContext* cpu_backend_context) {
-  ruy::profiler::ScopeLabel label("DepthwiseConv");
-
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  int thread_count = HowManyConvThreads(output_shape, filter_shape);
-  const int max_threads = cpu_backend_context->max_num_threads();
-  thread_count = std::max(1, std::min(thread_count, max_threads));
-#ifndef TFLITE_WITH_RUY
-  // Cap the number of threads to 2 for float path to avoid regression in
-  // performance (b/132294857).
-  if (std::is_floating_point::value) {
-    thread_count = std::min(thread_count, 2);
-  }
-#endif
-
-  const int output_batches = output_shape.Dims(0);
-  const int output_height = output_shape.Dims(1);
-
-  CpuFlags cpu_flags;
-  GetCpuFlags(&cpu_flags);
-
-  if (thread_count == 1) {
-    DepthwiseConvImpl(params, input_shape, input_data, filter_shape,
-                      filter_data, bias_shape, bias_data, output_shape,
-                      output_data, cpu_flags, /*thread_start=*/0,
-                      /*thread_end=*/output_height, /*thread_dim=*/1);
-    return;
-  }
-
-  int thread_dim, thread_dim_size;
-  if (MultithreadAlongBatches(thread_count, output_batches)) {
-    thread_dim = 0;
-    thread_dim_size = output_batches;
-  } else {
-    thread_dim = 1;
-    thread_dim_size = output_height;
-  }
-
-  std::vector> tasks;
-  // TODO(b/131746020) don't create new heap allocations every time.
-  // At least we make it a single heap allocation by using reserve().
-  tasks.reserve(thread_count);
-  int thread_start = 0;
-  for (int i = 0; i < thread_count; ++i) {
-    int thread_end =
-        thread_start + (thread_dim_size - thread_start) / (thread_count - i);
-    tasks.emplace_back(params, input_shape, input_data, filter_shape,
-                       filter_data, bias_shape, bias_data, output_shape,
-                       output_data, cpu_flags, thread_start, thread_end,
-                       thread_dim);
-    thread_start = thread_end;
-  }
-  cpu_backend_threadpool::Execute(tasks.size(), tasks.data(),
-                                  cpu_backend_context);
-}
-
-}  // namespace optimized_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_MULTITHREAD_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h
deleted file mode 100644
index 8ec4af7..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h
+++ /dev/null
@@ -1,2086 +0,0 @@
-/* Copyright 2017 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_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_UINT8_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_UINT8_H_
-
-#include 
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h"
-#include "tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_ops {
-namespace depthwise_conv {
-
-// Implementation of quantized DepthwiseConv
-
-template 
-struct QuantizedDepthwiseConvKernel {};
-
-#ifdef USE_NEON
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    uint8x8x2_t filter_u8;
-    filter_u8.val[0] = vld1_u8(filter_ptr);
-    filter_u8.val[1] = vld1_u8(filter_ptr + 8);
-    int16x8_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      filter[i] = vaddq_s16(vreinterpretq_s16_u16(vmovl_u8(filter_u8.val[i])),
-                            vdupq_n_s16(filter_offset));
-    }
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4x2_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i].val[0] = vld1q_s32(acc_buffer_ptr + 4 * i);
-        acc[i].val[1] = vld1q_s32(acc_buffer_ptr + 4 * i + 8);
-      }
-      // Load the inputs, add input_offset.
-      const uint8x8_t input_u8 = vld1_u8(input_ptr);
-      input_ptr += input_ptr_increment;
-      const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x8x2_t input_dup2 = vzipq_s16(input, input);
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[0].val[i] = vmlal_s16(acc[0].val[i], vget_low_s16(filter[i]),
-                                  vget_low_s16(input_dup2.val[i]));
-        acc[1].val[i] = vmlal_s16(acc[1].val[i], vget_high_s16(filter[i]),
-                                  vget_high_s16(input_dup2.val[i]));
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i].val[0]);
-        vst1q_s32(acc_buffer_ptr + 4 * i + 8, acc[i].val[1]);
-      }
-      acc_buffer_ptr += 16;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    const uint8x8_t filter_u8 = vld1_u8(filter_ptr);
-    const int16x8_t filter_s16 = vreinterpretq_s16_u16(vmovl_u8(filter_u8));
-    const int16x8_t filter = vaddq_s16(filter_s16, vdupq_n_s16(filter_offset));
-
-    int outp = 0;
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8[2];
-      for (int i = 0; i < 2; i++) {
-        input_u8[i] = vld1_u8(input_ptr + 8 * i);
-      }
-      input_ptr += 16;
-      int16x8_t input[2];
-      for (int i = 0; i < 2; i++) {
-        input[i] = vreinterpretq_s16_u16(vmovl_u8(input_u8[i]));
-      }
-      for (int i = 0; i < 2; i++) {
-        input[i] = vaddq_s16(input[i], vdupq_n_s16(input_offset));
-      }
-      // Multiply-accumulate.
-      acc[0] = vmlal_s16(acc[0], vget_low_s16(filter), vget_low_s16(input[0]));
-      acc[1] =
-          vmlal_s16(acc[1], vget_high_s16(filter), vget_high_s16(input[0]));
-      acc[2] = vmlal_s16(acc[2], vget_low_s16(filter), vget_low_s16(input[1]));
-      acc[3] =
-          vmlal_s16(acc[3], vget_high_s16(filter), vget_high_s16(input[1]));
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle 1 output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[2];
-      acc[0] = vld1q_s32(acc_buffer_ptr);
-      acc[1] = vld1q_s32(acc_buffer_ptr + 4);
-
-      // Load the inputs, add input_offset.
-      const uint8x8_t input_u8 = vld1_u8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Multiply-accumulate.
-      acc[0] = vmlal_s16(acc[0], vget_low_s16(filter), vget_low_s16(input));
-      acc[1] = vmlal_s16(acc[1], vget_high_s16(filter), vget_high_s16(input));
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr, acc[0]);
-      vst1q_s32(acc_buffer_ptr + 4, acc[1]);
-      acc_buffer_ptr += 8;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    const uint8x8_t filter_u8 = vld1_u8(filter_ptr);
-    const int16x8_t filter_s16 = vreinterpretq_s16_u16(vmovl_u8(filter_u8));
-    const int16x8_t filter = vaddq_s16(filter_s16, vdupq_n_s16(filter_offset));
-
-    int outp = 0;
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      const uint8x8_t input_u8 = vld1_u8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x8x2_t input_dup2 = vzipq_s16(input, input);
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[2 * i + 0] = vmlal_s16(acc[2 * i + 0], vget_low_s16(filter),
-                                   vget_low_s16(input_dup2.val[i]));
-        acc[2 * i + 1] = vmlal_s16(acc[2 * i + 1], vget_high_s16(filter),
-                                   vget_high_s16(input_dup2.val[i]));
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vdup_n_u8(0);
-      input_u8 = vset_lane_u8(input_ptr[0], input_u8, 0);
-      input_u8 = vset_lane_u8(input_ptr[1], input_u8, 1);
-      input_u8 = vset_lane_u8(input_ptr[2], input_u8, 2);
-      input_u8 = vset_lane_u8(input_ptr[3], input_u8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 =
-          vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x4x2_t input_dup2 = vzip_s16(input, input);
-      // Multiply-accumulate
-      acc[0] = vmlal_s16(acc[0], vget_low_s16(filter), input_dup2.val[0]);
-      acc[1] = vmlal_s16(acc[1], vget_high_s16(filter), input_dup2.val[1]);
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    int16x8_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      const uint8x8_t filter_u8 = vld1_u8(filter_ptr + 8 * i);
-      const int16x8_t filter_s16 = vreinterpretq_s16_u16(vmovl_u8(filter_u8));
-      filter[i] = vaddq_s16(filter_s16, vdupq_n_s16(filter_offset));
-    }
-    int outp = 0;
-    // Handle two output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[8];
-      for (int i = 0; i < 8; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vdup_n_u8(0);
-      input_u8 = vset_lane_u8(input_ptr[0], input_u8, 0);
-      input_u8 = vset_lane_u8(input_ptr[1], input_u8, 1);
-      input_u8 = vset_lane_u8(input_ptr[2], input_u8, 2);
-      input_u8 = vset_lane_u8(input_ptr[3], input_u8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 =
-          vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-      // Multiply-accumulate.
-      acc[0] = vmlal_lane_s16(acc[0], vget_low_s16(filter[0]), input, 0);
-      acc[1] = vmlal_lane_s16(acc[1], vget_high_s16(filter[0]), input, 0);
-      acc[2] = vmlal_lane_s16(acc[2], vget_low_s16(filter[1]), input, 1);
-      acc[3] = vmlal_lane_s16(acc[3], vget_high_s16(filter[1]), input, 1);
-      acc[4] = vmlal_lane_s16(acc[4], vget_low_s16(filter[0]), input, 2);
-      acc[5] = vmlal_lane_s16(acc[5], vget_high_s16(filter[0]), input, 2);
-      acc[6] = vmlal_lane_s16(acc[6], vget_low_s16(filter[1]), input, 3);
-      acc[7] = vmlal_lane_s16(acc[7], vget_high_s16(filter[1]), input, 3);
-      // Store the accumulators back to acc_buffer.
-      for (int i = 0; i < 8; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 32;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vdup_n_u8(0);
-      input_u8 = vset_lane_u8(input_ptr[0], input_u8, 0);
-      input_u8 = vset_lane_u8(input_ptr[1], input_u8, 1);
-      input_ptr += 2;
-      const int16x4_t input_s16 =
-          vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc[0] = vmlal_lane_s16(acc[0], vget_low_s16(filter[0]), input, 0);
-      acc[1] = vmlal_lane_s16(acc[1], vget_high_s16(filter[0]), input, 0);
-      acc[2] = vmlal_lane_s16(acc[2], vget_low_s16(filter[1]), input, 1);
-      acc[3] = vmlal_lane_s16(acc[3], vget_high_s16(filter[1]), input, 1);
-
-      // Store the accumulators back to acc_buffer.
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    uint8x8_t filter_u8 = vdup_n_u8(0);
-    filter_u8 = vset_lane_u8(filter_ptr[0], filter_u8, 0);
-    filter_u8 = vset_lane_u8(filter_ptr[1], filter_u8, 1);
-    filter_u8 = vset_lane_u8(filter_ptr[2], filter_u8, 2);
-    filter_u8 = vset_lane_u8(filter_ptr[3], filter_u8, 3);
-    const int16x4_t filter_s16 =
-        vreinterpret_s16_u16(vget_low_u16(vmovl_u8(filter_u8)));
-    const int16x4_t filter = vadd_s16(filter_s16, vdup_n_s16(filter_offset));
-
-    int outp = 0;
-    // Handle 4 output pixels at a time.
-    for (; outp <= num_output_pixels - 4; outp += 4) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      const uint8x8_t input_u8 = vld1_u8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x8x2_t input_dup2 = vzipq_s16(input, input);
-      // Multiply-accumulate
-      acc[0] = vmlal_s16(acc[0], filter, vget_low_s16(input_dup2.val[0]));
-      acc[1] = vmlal_s16(acc[1], filter, vget_high_s16(input_dup2.val[0]));
-      acc[2] = vmlal_s16(acc[2], filter, vget_low_s16(input_dup2.val[1]));
-      acc[3] = vmlal_s16(acc[3], filter, vget_high_s16(input_dup2.val[1]));
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc = vld1q_s32(acc_buffer_ptr);
-
-      uint8x8_t input_u8 = vdup_n_u8(0);
-      input_u8 = vset_lane_u8(input_ptr[0], input_u8, 0);
-      input_u8 = vset_lane_u8(input_ptr[1], input_u8, 1);
-      input_ptr += 2;
-      const int16x4_t input_s16 =
-          vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x4_t input_dup2 = vzip_s16(input, input).val[0];
-      // Multiply-accumulate
-      acc = vmlal_s16(acc, filter, input_dup2);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    uint8x8_t filter_u8 = vdup_n_u8(0);
-    filter_u8 = vset_lane_u8(filter_ptr[0], filter_u8, 0);
-    filter_u8 = vset_lane_u8(filter_ptr[1], filter_u8, 1);
-    filter_u8 = vset_lane_u8(filter_ptr[0], filter_u8, 2);
-    filter_u8 = vset_lane_u8(filter_ptr[1], filter_u8, 3);
-    const int16x4_t filter_s16 =
-        vreinterpret_s16_u16(vget_low_u16(vmovl_u8(filter_u8)));
-    const int16x4_t filter = vadd_s16(filter_s16, vdup_n_s16(filter_offset));
-
-    int outp = 0;
-    // Handle 8 output pixels at a time.
-    for (; outp <= num_output_pixels - 8; outp += 8) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8[2];
-      for (int i = 0; i < 2; i++) {
-        input_u8[i] = vld1_u8(input_ptr + 8 * i);
-      }
-      input_ptr += 16;
-      int16x8_t input[2];
-      for (int i = 0; i < 2; i++) {
-        input[i] = vreinterpretq_s16_u16(vmovl_u8(input_u8[i]));
-      }
-      for (int i = 0; i < 2; i++) {
-        input[i] = vaddq_s16(input[i], vdupq_n_s16(input_offset));
-      }
-
-      // Multiply-accumulate.
-      acc[0] = vmlal_s16(acc[0], filter, vget_low_s16(input[0]));
-      acc[1] = vmlal_s16(acc[1], filter, vget_high_s16(input[0]));
-      acc[2] = vmlal_s16(acc[2], filter, vget_low_s16(input[1]));
-      acc[3] = vmlal_s16(acc[3], filter, vget_high_s16(input[1]));
-      // Store the accumulators back to acc_buffer.
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle 4 output pixels at a time.
-    for (; outp <= num_output_pixels - 4; outp += 4) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      const uint8x8_t input_u8 = vld1_u8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc[0] = vmlal_s16(acc[0], filter, vget_low_s16(input));
-      acc[1] = vmlal_s16(acc[1], filter, vget_high_s16(input));
-      // Store the accumulators back to acc_buffer.
-      for (int i = 0; i < 2; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-    }
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc = vld1q_s32(acc_buffer_ptr);
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vdup_n_u8(0);
-      input_u8 = vset_lane_u8(input_ptr[0], input_u8, 0);
-      input_u8 = vset_lane_u8(input_ptr[1], input_u8, 1);
-      input_u8 = vset_lane_u8(input_ptr[2], input_u8, 2);
-      input_u8 = vset_lane_u8(input_ptr[3], input_u8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 =
-          vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc = vmlal_s16(acc, filter, input);
-      // Store the accumulators back to acc_buffer.
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-    // Handle 1 output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer.
-      int32x2_t acc = vld1_s32(acc_buffer_ptr);
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vdup_n_u8(0);
-      input_u8 = vset_lane_u8(input_ptr[0], input_u8, 0);
-      input_u8 = vset_lane_u8(input_ptr[1], input_u8, 1);
-      input_ptr += 2;
-      const int16x4_t input_s16 =
-          vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc = vget_low_s32(vmlal_s16(vcombine_s32(acc, acc), filter, input));
-      // Store the accumulators back to acc_buffer.
-      vst1_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 2;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    uint8x8_t filter_u8 = vdup_n_u8(0);
-    filter_u8 = vset_lane_u8(filter_ptr[0], filter_u8, 0);
-    filter_u8 = vset_lane_u8(filter_ptr[1], filter_u8, 1);
-    filter_u8 = vset_lane_u8(filter_ptr[0], filter_u8, 2);
-    filter_u8 = vset_lane_u8(filter_ptr[1], filter_u8, 3);
-    const int16x4_t filter_s16 =
-        vreinterpret_s16_u16(vget_low_u16(vmovl_u8(filter_u8)));
-    const int16x4_t filter = vadd_s16(filter_s16, vdup_n_s16(filter_offset));
-
-    int outp = 0;
-    // Handle 8 output pixels at a time.
-    for (; outp <= num_output_pixels - 8; outp += 8) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      const uint8x8_t input_u8 = vld1_u8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x8x2_t input_dup2 = vzipq_s16(input, input);
-      // Multiply-accumulate
-      acc[0] = vmlal_s16(acc[0], filter, vget_low_s16(input_dup2.val[0]));
-      acc[1] = vmlal_s16(acc[1], filter, vget_high_s16(input_dup2.val[0]));
-      acc[2] = vmlal_s16(acc[2], filter, vget_low_s16(input_dup2.val[1]));
-      acc[3] = vmlal_s16(acc[3], filter, vget_high_s16(input_dup2.val[1]));
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x2_t acc = vld1_s32(acc_buffer_ptr);
-
-      // Load the inputs, add input_offset.
-      const uint32 input = *input_ptr++ + input_offset;
-
-      // Multiply-accumulate
-      acc = vget_low_s32(vmlal_n_s16(vcombine_s32(acc, acc), filter, input));
-      // Store the accumulators back to acc_buffer
-      vst1_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 2;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    uint8x8_t filter_u8 = vdup_n_u8(0);
-    filter_u8 = vset_lane_u8(filter_ptr[0], filter_u8, 0);
-    filter_u8 = vset_lane_u8(filter_ptr[1], filter_u8, 1);
-    filter_u8 = vset_lane_u8(filter_ptr[2], filter_u8, 2);
-    filter_u8 = vset_lane_u8(filter_ptr[3], filter_u8, 3);
-    const int16x4_t filter_s16 =
-        vreinterpret_s16_u16(vget_low_u16(vmovl_u8(filter_u8)));
-    const int16x4_t filter = vadd_s16(filter_s16, vdup_n_s16(filter_offset));
-
-    int outp = 0;
-    // Handle 8 output pixels at a time.
-    for (; outp <= num_output_pixels - 8; outp += 8) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[8];
-      for (int i = 0; i < 8; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vld1_u8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-
-      // Multiply-accumulate
-      acc[0] = vmlal_lane_s16(acc[0], filter, vget_low_s16(input), 0);
-      acc[1] = vmlal_lane_s16(acc[1], filter, vget_low_s16(input), 1);
-      acc[2] = vmlal_lane_s16(acc[2], filter, vget_low_s16(input), 2);
-      acc[3] = vmlal_lane_s16(acc[3], filter, vget_low_s16(input), 3);
-      acc[4] = vmlal_lane_s16(acc[4], filter, vget_high_s16(input), 0);
-      acc[5] = vmlal_lane_s16(acc[5], filter, vget_high_s16(input), 1);
-      acc[6] = vmlal_lane_s16(acc[6], filter, vget_high_s16(input), 2);
-      acc[7] = vmlal_lane_s16(acc[7], filter, vget_high_s16(input), 3);
-
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 8; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 32;
-    }
-    // Handle 4 output pixels at a time.
-    for (; outp <= num_output_pixels - 4; outp += 4) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vdup_n_u8(0);
-      input_u8 = vset_lane_u8(input_ptr[0], input_u8, 0);
-      input_u8 = vset_lane_u8(input_ptr[1], input_u8, 1);
-      input_u8 = vset_lane_u8(input_ptr[2], input_u8, 2);
-      input_u8 = vset_lane_u8(input_ptr[3], input_u8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 =
-          vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate
-      acc[0] = vmlal_lane_s16(acc[0], filter, input, 0);
-      acc[1] = vmlal_lane_s16(acc[1], filter, input, 1);
-      acc[2] = vmlal_lane_s16(acc[2], filter, input, 2);
-      acc[3] = vmlal_lane_s16(acc[3], filter, input, 3);
-
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc = vld1q_s32(acc_buffer_ptr);
-
-      // Load the inputs, add input_offset.
-      const uint32 input = *input_ptr++ + input_offset;
-
-      // Multiply-accumulate
-      acc = vmlal_n_s16(acc, filter, input);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    uint8x8_t filter_u8 = vdup_n_u8(0);
-    filter_u8 = vset_lane_u8(filter_ptr[0], filter_u8, 0);
-    filter_u8 = vset_lane_u8(filter_ptr[1], filter_u8, 1);
-    filter_u8 = vset_lane_u8(filter_ptr[2], filter_u8, 2);
-    filter_u8 = vset_lane_u8(filter_ptr[3], filter_u8, 3);
-    const int16x4_t filter_s16 =
-        vreinterpret_s16_u16(vget_low_u16(vmovl_u8(filter_u8)));
-    const int16x4_t filter = vadd_s16(filter_s16, vdup_n_s16(filter_offset));
-
-    int outp = 0;
-    // Handle 4 output pixels at a time.
-    for (; outp <= num_output_pixels - 4; outp += 4) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      int16x8_t input[2];
-      for (int i = 0; i < 2; i++) {
-        const uint8x8_t input_u8 = vld1_u8(input_ptr + 8 * i);
-        const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-        input[i] = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      }
-      input_ptr += 16;
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[2 * i + 0] =
-            vmlal_s16(acc[2 * i + 0], filter, vget_low_s16(input[i]));
-        acc[2 * i + 1] =
-            vmlal_s16(acc[2 * i + 1], filter, vget_high_s16(input[i]));
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc;
-      acc = vld1q_s32(acc_buffer_ptr);
-
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vdup_n_u8(0);
-      input_u8 = vset_lane_u8(input_ptr[0], input_u8, 0);
-      input_u8 = vset_lane_u8(input_ptr[1], input_u8, 1);
-      input_u8 = vset_lane_u8(input_ptr[2], input_u8, 2);
-      input_u8 = vset_lane_u8(input_ptr[3], input_u8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 =
-          vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-      // Multiply-accumulate
-      acc = vmlal_s16(acc, filter, input);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    int16x8_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      const uint8x8_t filter_u8 = vld1_u8(filter_ptr + 8 * i);
-      const int16x8_t filter_s16 = vreinterpretq_s16_u16(vmovl_u8(filter_u8));
-      filter[i] = vaddq_s16(filter_s16, vdupq_n_s16(filter_offset));
-    }
-
-    int outp = 0;
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[8];
-      for (int i = 0; i < 8; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vld1_u8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-
-      // Multiply-accumulate
-      acc[0] = vmlal_lane_s16(acc[0], vget_low_s16(filter[0]),
-                              vget_low_s16(input), 0);
-      acc[1] = vmlal_lane_s16(acc[1], vget_high_s16(filter[0]),
-                              vget_low_s16(input), 1);
-      acc[2] = vmlal_lane_s16(acc[2], vget_low_s16(filter[1]),
-                              vget_low_s16(input), 2);
-      acc[3] = vmlal_lane_s16(acc[3], vget_high_s16(filter[1]),
-                              vget_low_s16(input), 3);
-      acc[4] = vmlal_lane_s16(acc[4], vget_low_s16(filter[0]),
-                              vget_high_s16(input), 0);
-      acc[5] = vmlal_lane_s16(acc[5], vget_high_s16(filter[0]),
-                              vget_high_s16(input), 1);
-      acc[6] = vmlal_lane_s16(acc[6], vget_low_s16(filter[1]),
-                              vget_high_s16(input), 2);
-      acc[7] = vmlal_lane_s16(acc[7], vget_high_s16(filter[1]),
-                              vget_high_s16(input), 3);
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 8; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 32;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vdup_n_u8(0);
-      input_u8 = vset_lane_u8(input_ptr[0], input_u8, 0);
-      input_u8 = vset_lane_u8(input_ptr[1], input_u8, 1);
-      input_u8 = vset_lane_u8(input_ptr[2], input_u8, 2);
-      input_u8 = vset_lane_u8(input_ptr[3], input_u8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 =
-          vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate
-      acc[0] = vmlal_lane_s16(acc[0], vget_low_s16(filter[0]), input, 0);
-      acc[1] = vmlal_lane_s16(acc[1], vget_high_s16(filter[0]), input, 1);
-      acc[2] = vmlal_lane_s16(acc[2], vget_low_s16(filter[1]), input, 2);
-      acc[3] = vmlal_lane_s16(acc[3], vget_high_s16(filter[1]), input, 3);
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // We will have to duplicate bytes in a NEON register, 3-fold.
-    // We will do that by register-level table-look-up using VTBL instructions.
-    // Here we prepare the registers containing the table-lookup indices.
-    static const uint8 dup3_indices_array[3][8] = {{0, 0, 0, 1, 1, 1, 2, 2},
-                                                   {2, 3, 3, 3, 4, 4, 4, 5},
-                                                   {5, 5, 6, 6, 6, 7, 7, 7}};
-    uint8x8_t dup3_indices[3];
-    for (int i = 0; i < 3; i++) {
-      dup3_indices[i] = vld1_u8(dup3_indices_array[i]);
-    }
-
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      const uint8* local_filter_ptr = filter_ptr;
-      const uint8* local_input_ptr = input_ptr;
-      int ic = 0;
-      // Handle 8 input channels at a time.
-      for (; ic <= input_depth - 8; ic += 8) {
-        // Load the filters, add filter_offset.
-        int16x8_t filter[3];
-        uint8x8x3_t filter_u8;
-        filter_u8.val[0] = vld1_u8(local_filter_ptr);
-        filter_u8.val[1] = vld1_u8(local_filter_ptr + 8);
-        filter_u8.val[2] = vld1_u8(local_filter_ptr + 16);
-        local_filter_ptr += 24;
-        for (int i = 0; i < 3; i++) {
-          const int16x8_t filter_s16 =
-              vreinterpretq_s16_u16(vmovl_u8(filter_u8.val[i]));
-          filter[i] = vaddq_s16(filter_s16, vdupq_n_s16(filter_offset));
-        }
-        // Load the inputs, duplicate 3-fold, add input_offset.
-        const uint8x8_t input_u8 = vld1_u8(local_input_ptr);
-        local_input_ptr += 8;
-
-        uint8x8_t input_u8_dup3[3];
-        for (int i = 0; i < 3; i++) {
-          input_u8_dup3[i] = vtbl1_u8(input_u8, dup3_indices[i]);
-        }
-        int16x8_t input_dup3[3];
-        for (int i = 0; i < 3; i++) {
-          const int16x8_t input_s16_dup3 =
-              vreinterpretq_s16_u16(vmovl_u8(input_u8_dup3[i]));
-          input_dup3[i] = vaddq_s16(input_s16_dup3, vdupq_n_s16(input_offset));
-        }
-        // Load the accumulators from acc_buffer
-        int32x4x3_t acc[2];
-        for (int i = 0; i < 2; i++) {
-          acc[i].val[0] = vld1q_s32(acc_buffer_ptr + 4 * i);
-          acc[i].val[1] = vld1q_s32(acc_buffer_ptr + 4 * i + 8);
-          acc[i].val[2] = vld1q_s32(acc_buffer_ptr + 4 * i + 16);
-        }
-        // Multiply-accumulate
-        for (int j = 0; j < 3; j++) {
-          acc[0].val[j] = vmlal_s16(acc[0].val[j], vget_low_s16(input_dup3[j]),
-                                    vget_low_s16(filter[j]));
-          acc[1].val[j] = vmlal_s16(acc[1].val[j], vget_high_s16(input_dup3[j]),
-                                    vget_high_s16(filter[j]));
-        }
-        // Store the accumulators back to acc_buffer
-        for (int i = 0; i < 2; i++) {
-          vst1q_s32(acc_buffer_ptr + 4 * i, acc[i].val[0]);
-          vst1q_s32(acc_buffer_ptr + 4 * i + 8, acc[i].val[1]);
-          vst1q_s32(acc_buffer_ptr + 4 * i + 16, acc[i].val[2]);
-        }
-        acc_buffer_ptr += 24;
-      }
-      // Handle one input channel at a time.
-      for (; ic < input_depth; ic++) {
-        const int16 input_val = *local_input_ptr++ + input_offset;
-        for (int i = 0; i < 3; i++) {
-          const int16 filter_val = local_filter_ptr[i] + filter_offset;
-          *acc_buffer_ptr++ += static_cast(filter_val) * input_val;
-        }
-        local_filter_ptr += 3;
-      }
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      const uint8* local_filter_ptr = filter_ptr;
-      const uint8* local_input_ptr = input_ptr;
-      int ic = 0;
-      // Handle 8 input channels at a time.
-      for (; ic <= input_depth - 8; ic += 8) {
-        // Load the filters, add filter_offset.
-        int16x8_t filter[2];
-        uint8x8x2_t filter_u8;
-        filter_u8.val[0] = vld1_u8(local_filter_ptr);
-        filter_u8.val[1] = vld1_u8(local_filter_ptr + 8);
-        local_filter_ptr += 16;
-        for (int i = 0; i < 2; i++) {
-          const int16x8_t filter_s16 =
-              vreinterpretq_s16_u16(vmovl_u8(filter_u8.val[i]));
-          filter[i] = vaddq_s16(filter_s16, vdupq_n_s16(filter_offset));
-        }
-        // Load the inputs, add input_offset, duplicate 2-fold.
-        const uint8x8_t input_u8 = vld1_u8(local_input_ptr);
-        local_input_ptr += 8;
-        const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-        const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-        const int16x8x2_t input_dup2 = vzipq_s16(input, input);
-        // Load the accumulators from acc_buffer.
-        int32x4x2_t acc[2];
-        for (int i = 0; i < 2; i++) {
-          acc[i].val[0] = vld1q_s32(acc_buffer_ptr + 4 * i);
-          acc[i].val[1] = vld1q_s32(acc_buffer_ptr + 4 * i + 8);
-        }
-        // Multiply-accumulate.
-        for (int j = 0; j < 2; j++) {
-          acc[0].val[j] = vmlal_s16(acc[0].val[j], vget_low_s16(filter[j]),
-                                    vget_low_s16(input_dup2.val[j]));
-          acc[1].val[j] = vmlal_s16(acc[1].val[j], vget_high_s16(filter[j]),
-                                    vget_high_s16(input_dup2.val[j]));
-        }
-        // Store the accumulators back to acc_buffer.
-        for (int i = 0; i < 2; i++) {
-          vst1q_s32(acc_buffer_ptr + 4 * i, acc[i].val[0]);
-          vst1q_s32(acc_buffer_ptr + 4 * i + 8, acc[i].val[1]);
-        }
-        acc_buffer_ptr += 16;
-      }
-      // Handle one input channel at a time.
-      for (; ic < input_depth; ic++) {
-        // Load the inputs.
-        const int16 input_val = *local_input_ptr++ + input_offset;
-        for (int i = 0; i < 2; i++) {
-          const int16 filter_val = local_filter_ptr[i] + filter_offset;
-          *acc_buffer_ptr++ += static_cast(filter_val) * input_val;
-        }
-        local_filter_ptr += 2;
-      }
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      const uint8* local_filter_ptr = filter_ptr;
-      const uint8* local_input_ptr = input_ptr;
-      int ic = 0;
-      // Handle 16 input channels at a time.
-      for (; ic <= input_depth - 16; ic += 16) {
-        // Load the filters, add filter_offset.
-        uint8x8_t filter_u8_0 = vld1_u8(local_filter_ptr + 8 * 0);
-        uint8x8_t filter_u8_1 = vld1_u8(local_filter_ptr + 8 * 1);
-        local_filter_ptr += 16;
-        int16x8_t filter_0 = vreinterpretq_s16_u16(vmovl_u8(filter_u8_0));
-        int16x8_t filter_1 = vreinterpretq_s16_u16(vmovl_u8(filter_u8_1));
-        filter_0 = vaddq_s16(filter_0, vdupq_n_s16(filter_offset));
-        filter_1 = vaddq_s16(filter_1, vdupq_n_s16(filter_offset));
-        // Load the inputs, add input_offset.
-        uint8x8_t input_u8_0 = vld1_u8(local_input_ptr + 8 * 0);
-        uint8x8_t input_u8_1 = vld1_u8(local_input_ptr + 8 * 1);
-        local_input_ptr += 16;
-        int16x8_t input_0 = vreinterpretq_s16_u16(vmovl_u8(input_u8_0));
-        int16x8_t input_1 = vreinterpretq_s16_u16(vmovl_u8(input_u8_1));
-        input_0 = vaddq_s16(input_0, vdupq_n_s16(input_offset));
-        input_1 = vaddq_s16(input_1, vdupq_n_s16(input_offset));
-        // Load the accumulators from acc_buffer
-        int32x4_t acc_0 = vld1q_s32(acc_buffer_ptr + 4 * 0);
-        int32x4_t acc_1 = vld1q_s32(acc_buffer_ptr + 4 * 1);
-        int32x4_t acc_2 = vld1q_s32(acc_buffer_ptr + 4 * 2);
-        int32x4_t acc_3 = vld1q_s32(acc_buffer_ptr + 4 * 3);
-        acc_0 = vmlal_s16(acc_0, vget_low_s16(input_0), vget_low_s16(filter_0));
-        acc_1 =
-            vmlal_s16(acc_1, vget_high_s16(input_0), vget_high_s16(filter_0));
-        acc_2 = vmlal_s16(acc_2, vget_low_s16(input_1), vget_low_s16(filter_1));
-        acc_3 =
-            vmlal_s16(acc_3, vget_high_s16(input_1), vget_high_s16(filter_1));
-        // Store the accumulators back to acc_buffer
-        vst1q_s32(acc_buffer_ptr + 4 * 0, acc_0);
-        vst1q_s32(acc_buffer_ptr + 4 * 1, acc_1);
-        vst1q_s32(acc_buffer_ptr + 4 * 2, acc_2);
-        vst1q_s32(acc_buffer_ptr + 4 * 3, acc_3);
-        acc_buffer_ptr += 16;
-      }
-      // Handle 8 input channels at a time.
-      for (; ic <= input_depth - 8; ic += 8) {
-        // Load the filters, add filter_offset.
-        const uint8x8_t filter_u8 = vld1_u8(local_filter_ptr);
-        local_filter_ptr += 8;
-        const int16x8_t filter_s16 = vreinterpretq_s16_u16(vmovl_u8(filter_u8));
-        const int16x8_t filter =
-            vaddq_s16(filter_s16, vdupq_n_s16(filter_offset));
-        // Load the inputs, add input_offset.
-        const uint8x8_t input_u8 = vld1_u8(local_input_ptr);
-        local_input_ptr += 8;
-        const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-        const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-        // Load the accumulators from acc_buffer
-        int32x4_t acc[2];
-        for (int i = 0; i < 2; i++) {
-          acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-        }
-        // Multiply-accumulate
-        acc[0] = vmlal_s16(acc[0], vget_low_s16(input), vget_low_s16(filter));
-        acc[1] = vmlal_s16(acc[1], vget_high_s16(input), vget_high_s16(filter));
-        // Store the accumulators back to acc_buffer
-        for (int i = 0; i < 2; i++) {
-          vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-        }
-        acc_buffer_ptr += 8;
-      }
-      // Handle one input channel at a time.
-      for (; ic < input_depth; ic++) {
-        const int16 input_val = *local_input_ptr++ + input_offset;
-        const int16 filter_val = *local_filter_ptr++ + filter_offset;
-        *acc_buffer_ptr++ += static_cast(filter_val) * input_val;
-      }
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    uint8x8_t filter_u8[2];
-    for (int i = 0; i < 2; i++) {
-      filter_u8[i] = vld1_u8(filter_ptr + 8 * i);
-    }
-    int16x8_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      filter[i] = vreinterpretq_s16_u16(vmovl_u8(filter_u8[i]));
-    }
-    for (int i = 0; i < 2; i++) {
-      filter[i] = vaddq_s16(filter[i], vdupq_n_s16(filter_offset));
-    }
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8[2];
-      for (int i = 0; i < 2; i++) {
-        input_u8[i] = vld1_u8(input_ptr + 8 * i);
-      }
-      input_ptr += input_ptr_increment;
-      int16x8_t input[2];
-      for (int i = 0; i < 2; i++) {
-        input[i] = vreinterpretq_s16_u16(vmovl_u8(input_u8[i]));
-      }
-      for (int i = 0; i < 2; i++) {
-        input[i] = vaddq_s16(input[i], vdupq_n_s16(input_offset));
-      }
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[2 * i + 0] = vmlal_s16(acc[2 * i + 0], vget_low_s16(input[i]),
-                                   vget_low_s16(filter[i]));
-        acc[2 * i + 1] = vmlal_s16(acc[2 * i + 1], vget_high_s16(input[i]),
-                                   vget_high_s16(filter[i]));
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    const uint8x8_t filter_u8 = vld1_u8(filter_ptr);
-    const int16x8_t filter_s16 = vreinterpretq_s16_u16(vmovl_u8(filter_u8));
-    const int16x8_t filter = vaddq_s16(filter_s16, vdupq_n_s16(filter_offset));
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the inputs, add input_offset.
-      const uint8x8_t input_u8 = vld1_u8(input_ptr);
-      const int16x8_t input_s16 = vreinterpretq_s16_u16(vmovl_u8(input_u8));
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      acc[0] = vmlal_s16(acc[0], vget_low_s16(input), vget_low_s16(filter));
-      acc[1] = vmlal_s16(acc[1], vget_high_s16(input), vget_high_s16(filter));
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    uint8x8_t filter_u8[2];
-    for (int i = 0; i < 2; i++) {
-      filter_u8[i] = vld1_u8(filter_ptr + 8 * i);
-    }
-    int16x8_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      filter[i] = vreinterpretq_s16_u16(vmovl_u8(filter_u8[i]));
-    }
-    for (int i = 0; i < 2; i++) {
-      filter[i] = vaddq_s16(filter[i], vdupq_n_s16(filter_offset));
-    }
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      uint8 input_u8 = *input_ptr;
-      input_ptr += input_ptr_increment;
-      int16 input = static_cast(input_u8 + input_offset);
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[2 * i + 0] =
-            vmlal_n_s16(acc[2 * i + 0], vget_low_s16(filter[i]), input);
-        acc[2 * i + 1] =
-            vmlal_n_s16(acc[2 * i + 1], vget_high_s16(filter[i]), input);
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    uint8x8_t filter_u8_0 = vld1_u8(filter_ptr + 8 * 0);
-    uint8x8_t filter_u8_1 = vld1_u8(filter_ptr + 8 * 1);
-    uint8x8_t filter_u8_2 = vld1_u8(filter_ptr + 8 * 2);
-    uint8x8_t filter_u8_3 = vld1_u8(filter_ptr + 8 * 3);
-    int16x8_t filter_0 = vreinterpretq_s16_u16(vmovl_u8(filter_u8_0));
-    int16x8_t filter_1 = vreinterpretq_s16_u16(vmovl_u8(filter_u8_1));
-    int16x8_t filter_2 = vreinterpretq_s16_u16(vmovl_u8(filter_u8_2));
-    int16x8_t filter_3 = vreinterpretq_s16_u16(vmovl_u8(filter_u8_3));
-    filter_0 = vaddq_s16(filter_0, vdupq_n_s16(filter_offset));
-    filter_1 = vaddq_s16(filter_1, vdupq_n_s16(filter_offset));
-    filter_2 = vaddq_s16(filter_2, vdupq_n_s16(filter_offset));
-    filter_3 = vaddq_s16(filter_3, vdupq_n_s16(filter_offset));
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      uint8 input_u8 = *input_ptr;
-      input_ptr += input_ptr_increment;
-      int16 input = static_cast(input_u8 + input_offset);
-      // Load the accumulators from acc_buffer
-      int32x4_t acc_0 = vld1q_s32(acc_buffer_ptr + 4 * 0);
-      int32x4_t acc_1 = vld1q_s32(acc_buffer_ptr + 4 * 1);
-      int32x4_t acc_2 = vld1q_s32(acc_buffer_ptr + 4 * 2);
-      int32x4_t acc_3 = vld1q_s32(acc_buffer_ptr + 4 * 3);
-      int32x4_t acc_4 = vld1q_s32(acc_buffer_ptr + 4 * 4);
-      int32x4_t acc_5 = vld1q_s32(acc_buffer_ptr + 4 * 5);
-      int32x4_t acc_6 = vld1q_s32(acc_buffer_ptr + 4 * 6);
-      int32x4_t acc_7 = vld1q_s32(acc_buffer_ptr + 4 * 7);
-      // Multiply-accumulate
-      acc_0 = vmlal_n_s16(acc_0, vget_low_s16(filter_0), input);
-      acc_1 = vmlal_n_s16(acc_1, vget_high_s16(filter_0), input);
-      acc_2 = vmlal_n_s16(acc_2, vget_low_s16(filter_1), input);
-      acc_3 = vmlal_n_s16(acc_3, vget_high_s16(filter_1), input);
-      acc_4 = vmlal_n_s16(acc_4, vget_low_s16(filter_2), input);
-      acc_5 = vmlal_n_s16(acc_5, vget_high_s16(filter_2), input);
-      acc_6 = vmlal_n_s16(acc_6, vget_low_s16(filter_3), input);
-      acc_7 = vmlal_n_s16(acc_7, vget_high_s16(filter_3), input);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr + 4 * 0, acc_0);
-      vst1q_s32(acc_buffer_ptr + 4 * 1, acc_1);
-      vst1q_s32(acc_buffer_ptr + 4 * 2, acc_2);
-      vst1q_s32(acc_buffer_ptr + 4 * 3, acc_3);
-      vst1q_s32(acc_buffer_ptr + 4 * 4, acc_4);
-      vst1q_s32(acc_buffer_ptr + 4 * 5, acc_5);
-      vst1q_s32(acc_buffer_ptr + 4 * 6, acc_6);
-      vst1q_s32(acc_buffer_ptr + 4 * 7, acc_7);
-      acc_buffer_ptr += 32;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    // NEON wants to load 8 bytes at a time, but 20 is not divisible by 8.
-    // We load the first 16 bytes into filter_u8_{0,1} as usual.
-    // Then we load the 8 last bytes into filter_u8_x  (x for 'extra').
-    // This is redundant: the first 4 bytes of filter_u8_x are the same
-    // as the last 4 bytes of filter_u8_x.
-    uint8x8_t filter_u8_0 = vld1_u8(filter_ptr + 8 * 0);
-    uint8x8_t filter_u8_1 = vld1_u8(filter_ptr + 8 * 1);
-    uint8x8_t filter_u8_x = vld1_u8(filter_ptr + 8 * 1 + 4);
-    int16x8_t filter_0 = vreinterpretq_s16_u16(vmovl_u8(filter_u8_0));
-    int16x8_t filter_1 = vreinterpretq_s16_u16(vmovl_u8(filter_u8_1));
-    int16x8_t filter_x = vreinterpretq_s16_u16(vmovl_u8(filter_u8_x));
-    filter_0 = vaddq_s16(filter_0, vdupq_n_s16(filter_offset));
-    filter_1 = vaddq_s16(filter_1, vdupq_n_s16(filter_offset));
-    filter_x = vaddq_s16(filter_x, vdupq_n_s16(filter_offset));
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      uint8 input_u8 = *input_ptr;
-      input_ptr += input_ptr_increment;
-      int16 input = static_cast(input_u8 + input_offset);
-      // Load the accumulators from acc_buffer
-      int32x4_t acc_0 = vld1q_s32(acc_buffer_ptr + 4 * 0);
-      int32x4_t acc_1 = vld1q_s32(acc_buffer_ptr + 4 * 1);
-      int32x4_t acc_2 = vld1q_s32(acc_buffer_ptr + 4 * 2);
-      int32x4_t acc_3 = vld1q_s32(acc_buffer_ptr + 4 * 3);
-      int32x4_t acc_4 = vld1q_s32(acc_buffer_ptr + 4 * 4);
-      // Multiply-accumulate
-      acc_0 = vmlal_n_s16(acc_0, vget_low_s16(filter_0), input);
-      acc_1 = vmlal_n_s16(acc_1, vget_high_s16(filter_0), input);
-      acc_2 = vmlal_n_s16(acc_2, vget_low_s16(filter_1), input);
-      acc_3 = vmlal_n_s16(acc_3, vget_high_s16(filter_1), input);
-      acc_4 = vmlal_n_s16(acc_4, vget_high_s16(filter_x), input);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr + 4 * 0, acc_0);
-      vst1q_s32(acc_buffer_ptr + 4 * 1, acc_1);
-      vst1q_s32(acc_buffer_ptr + 4 * 2, acc_2);
-      vst1q_s32(acc_buffer_ptr + 4 * 3, acc_3);
-      vst1q_s32(acc_buffer_ptr + 4 * 4, acc_4);
-      acc_buffer_ptr += 20;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    const uint8x8_t filter_u8 = vld1_u8(filter_ptr);
-    const int16x8_t filter = vaddq_s16(
-        vreinterpretq_s16_u16(vmovl_u8(filter_u8)), vdupq_n_s16(filter_offset));
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      uint8 input_u8 = *input_ptr;
-      input_ptr += input_ptr_increment;
-      int16 input = static_cast(input_u8 + input_offset);
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      acc[0] = vmlal_n_s16(acc[0], vget_low_s16(filter), input);
-      acc[1] = vmlal_n_s16(acc[1], vget_high_s16(filter), input);
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    uint8x8_t filter_u8 = vdup_n_u8(0);
-    filter_u8 = vset_lane_u8(filter_ptr[0], filter_u8, 0);
-    filter_u8 = vset_lane_u8(filter_ptr[1], filter_u8, 1);
-    filter_u8 = vset_lane_u8(filter_ptr[0], filter_u8, 2);
-    filter_u8 = vset_lane_u8(filter_ptr[1], filter_u8, 3);
-    const int16x4_t filter_s16 =
-        vreinterpret_s16_u16(vget_low_u16(vmovl_u8(filter_u8)));
-    const int16x4_t filter = vadd_s16(filter_s16, vdup_n_s16(filter_offset));
-
-    int outp = 0;
-
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc = vld1q_s32(acc_buffer_ptr);
-      // Load the inputs, add input_offset.
-      uint16x4_t input_u16 = vdup_n_u16(0);
-      input_u16 = vset_lane_u16((reinterpret_cast(input_ptr))[0],
-                                input_u16, 0);
-      input_ptr += input_ptr_increment;
-      input_u16 = vset_lane_u16((reinterpret_cast(input_ptr))[0],
-                                input_u16, 1);
-      input_ptr += input_ptr_increment;
-      const int16x4_t input_s16 = vreinterpret_s16_u16(
-          vget_low_u16(vmovl_u8(vreinterpret_u8_u16(input_u16))));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc = vmlal_s16(acc, filter, input);
-      // Store the accumulators back to acc_buffer.
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-
-    // Handle 1 output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer.
-      int32x2_t acc = vld1_s32(acc_buffer_ptr);
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vdup_n_u8(0);
-      input_u8 = vset_lane_u8(input_ptr[0], input_u8, 0);
-      input_u8 = vset_lane_u8(input_ptr[1], input_u8, 1);
-      input_ptr += input_ptr_increment;
-      const int16x4_t input_s16 =
-          vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc = vget_low_s32(vmlal_s16(vcombine_s32(acc, acc), filter, input));
-      // Store the accumulators back to acc_buffer.
-      vst1_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 2;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    if (num_output_pixels <= 0) {
-      return;
-    }
-
-    // Load the filters, add filter_offset.
-    uint8x8_t filter_u8 = vdup_n_u8(0);
-    filter_u8 = vset_lane_u8(filter_ptr[0], filter_u8, 0);
-    filter_u8 = vset_lane_u8(filter_ptr[1], filter_u8, 1);
-    filter_u8 = vset_lane_u8(filter_ptr[2], filter_u8, 2);
-    filter_u8 = vset_lane_u8(filter_ptr[3], filter_u8, 3);
-    const int16x4_t filter_s16 =
-        vreinterpret_s16_u16(vget_low_u16(vmovl_u8(filter_u8)));
-    const int16x4_t filter = vadd_s16(filter_s16, vdup_n_s16(filter_offset));
-
-    int outp = 0;
-
-    // Handle one output pixel at a time until second to the last pixel. Second
-    // to the last because we read eight input pixels while only processing
-    // four.
-    for (; outp < num_output_pixels - 1; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc;
-      acc = vld1q_s32(acc_buffer_ptr);
-
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8 = vld1_u8(input_ptr);
-      input_ptr += input_ptr_increment;
-      const int16x4_t input_s16 =
-          vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-      // Multiply-accumulate
-      acc = vmlal_s16(acc, filter, input);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-
-    // Handle the last output pixel.
-    // Load the accumulators from acc_buffer
-    int32x4_t acc;
-    acc = vld1q_s32(acc_buffer_ptr);
-
-    // Load the inputs, add input_offset.
-    uint8x8_t input_u8 = vdup_n_u8(0);
-    input_u8 = vset_lane_u8(input_ptr[0], input_u8, 0);
-    input_u8 = vset_lane_u8(input_ptr[1], input_u8, 1);
-    input_u8 = vset_lane_u8(input_ptr[2], input_u8, 2);
-    input_u8 = vset_lane_u8(input_ptr[3], input_u8, 3);
-    const int16x4_t input_s16 =
-        vreinterpret_s16_u16(vget_low_u16(vmovl_u8(input_u8)));
-    const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-    // Multiply-accumulate
-    acc = vmlal_s16(acc, filter, input);
-    // Store the accumulators back to acc_buffer
-    vst1q_s32(acc_buffer_ptr, acc);
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const uint8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const uint8* filter_ptr,
-                  int16 filter_offset, int32* acc_buffer_ptr) {
-    // Load the filters, add filter_offset.
-    uint8x8_t filter_u8_0 = vld1_u8(filter_ptr);
-    uint8x8_t filter_u8_1 = vld1_u8(filter_ptr + 4);
-    int16x8_t filter_s16_0 = vreinterpretq_s16_u16(vmovl_u8(filter_u8_0));
-    int16x8_t filter_s16_1 = vreinterpretq_s16_u16(vmovl_u8(filter_u8_1));
-    filter_s16_0 = vaddq_s16(filter_s16_0, vdupq_n_s16(filter_offset));
-    filter_s16_1 = vaddq_s16(filter_s16_1, vdupq_n_s16(filter_offset));
-    int16x4_t filter_0 = vget_low_s16(filter_s16_0);
-    int16x4_t filter_1 = vget_high_s16(filter_s16_0);
-    int16x4_t filter_2 = vget_high_s16(filter_s16_1);
-
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the inputs, add input_offset.
-      uint8x8_t input_u8_0 = vld1_u8(input_ptr);
-      uint8x8_t input_u8_1 = vld1_u8(input_ptr + 4);
-      input_ptr += input_ptr_increment;
-      int16x8_t input_0 = vreinterpretq_s16_u16(vmovl_u8(input_u8_0));
-      int16x8_t input_1 = vreinterpretq_s16_u16(vmovl_u8(input_u8_1));
-      input_0 = vaddq_s16(input_0, vdupq_n_s16(input_offset));
-      input_1 = vaddq_s16(input_1, vdupq_n_s16(input_offset));
-
-      // Load the accumulators from acc_buffer
-      int32x4_t acc_0 = vld1q_s32(acc_buffer_ptr + 4 * 0);
-      int32x4_t acc_1 = vld1q_s32(acc_buffer_ptr + 4 * 1);
-      int32x4_t acc_2 = vld1q_s32(acc_buffer_ptr + 4 * 2);
-
-      // Multiply-accumulate
-      acc_0 = vmlal_s16(acc_0, vget_low_s16(input_0), filter_0);
-      acc_1 = vmlal_s16(acc_1, vget_high_s16(input_0), filter_1);
-      acc_2 = vmlal_s16(acc_2, vget_high_s16(input_1), filter_2);
-
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr + 4 * 0, acc_0);
-      vst1q_s32(acc_buffer_ptr + 4 * 1, acc_1);
-      vst1q_s32(acc_buffer_ptr + 4 * 2, acc_2);
-
-      acc_buffer_ptr += 12;
-    }
-  }
-};
-#endif
-
-// Accumulates the effect of one row of the filter, on a segment of one row
-// of the output, accessing the corresponding one row of the input.
-template 
-void QuantizedDepthwiseConvAccumRow(int stride, int dilation_factor,
-                                    int input_depth, int input_width,
-                                    const uint8* input_data, int16 input_offset,
-                                    int pad_width, int depth_multiplier,
-                                    int filter_width, const uint8* filter_data,
-                                    int16 filter_offset, int out_x_buffer_start,
-                                    int out_x_buffer_end, int output_depth,
-                                    int32* acc_buffer) {
-  ruy::profiler::ScopeLabel label(__PRETTY_FUNCTION__);
-  // Consistency check parameters. This is important in particular to ensure
-  // that we keep the number of template instantiations minimal, so we don't
-  // increase binary size unnecessarily.
-  static_assert(kFixedDepthMultiplier || !kFixedInputDepth, "");
-  static_assert(kFixedInputDepth || kAllowStrided, "");
-  TFLITE_DCHECK(stride == 1 || kAllowStrided);
-  if (kFixedInputDepth) {
-    TFLITE_DCHECK_EQ(input_depth, kFixedInputDepth);
-  }
-  if (kFixedDepthMultiplier) {
-    TFLITE_DCHECK_EQ(depth_multiplier, kFixedDepthMultiplier);
-  }
-  TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier);
-  const int input_ptr_increment = stride * input_depth;
-  const uint8* filter_base_ptr = filter_data;
-  for (int filter_x = 0; filter_x < filter_width; ++filter_x) {
-    // For the current (filter_x, filter_y) point in the filter,
-    // compute the boundaries of the corresponding output row segment.
-    int out_x_loop_start_unclamped = 0;
-    int out_x_loop_end_unclamped = 0;
-    if (kAllowStrided) {
-      if (stride == 2) {
-        out_x_loop_start_unclamped =
-            (pad_width - dilation_factor * filter_x + 1) / 2;
-        out_x_loop_end_unclamped =
-            (pad_width + input_width - dilation_factor * filter_x + 1) / 2;
-      } else if (stride == 4) {
-        out_x_loop_start_unclamped =
-            (pad_width - dilation_factor * filter_x + 3) / 4;
-        out_x_loop_end_unclamped =
-            (pad_width + input_width - dilation_factor * filter_x + 3) / 4;
-      } else {
-        out_x_loop_start_unclamped =
-            (pad_width - dilation_factor * filter_x + stride - 1) / stride;
-        out_x_loop_end_unclamped = (pad_width + input_width -
-                                    dilation_factor * filter_x + stride - 1) /
-                                   stride;
-      }
-    } else {
-      out_x_loop_start_unclamped = pad_width - dilation_factor * filter_x;
-      out_x_loop_end_unclamped =
-          pad_width + input_width - dilation_factor * filter_x;
-    }
-    // The kernel will have to iterate on the segment of the
-    // output row that starts at out_x_loop_start and out_x_loop_end.
-    const int out_x_loop_start =
-        std::max(out_x_buffer_start, out_x_loop_start_unclamped);
-    const int out_x_loop_end =
-        std::min(out_x_buffer_end, out_x_loop_end_unclamped);
-
-    int32* acc_buffer_ptr =
-        acc_buffer + (out_x_loop_start - out_x_buffer_start) * output_depth;
-    const int in_x_origin =
-        (out_x_loop_start * stride) - pad_width + dilation_factor * filter_x;
-    const uint8* input_ptr = input_data + in_x_origin * input_depth;
-    const int num_output_pixels = out_x_loop_end - out_x_loop_start;
-    QuantizedDepthwiseConvKernel<
-        kAllowStrided, kFixedInputDepth,
-        kFixedDepthMultiplier>::Run(num_output_pixels, input_depth,
-                                    depth_multiplier, input_ptr, input_offset,
-                                    input_ptr_increment, filter_base_ptr,
-                                    filter_offset, acc_buffer_ptr);
-    filter_base_ptr += output_depth;
-  }
-}
-
-// generic fallback of DepthwiseConvAccumRow, portable, non-templatized.
-inline void QuantizedDepthwiseConvAccumRowGeneric(
-    int stride, int dilation_factor, int input_depth, int input_width,
-    const uint8* input_data, int16 input_offset, int pad_width,
-    int depth_multiplier, int filter_width, const uint8* filter_data,
-    int16 filter_offset, int out_x_buffer_start, int out_x_buffer_end,
-    int output_depth, int32* acc_buffer) {
-  ruy::profiler::ScopeLabel label("DepthwiseConvAccumRowGeneric (slow)");
-  const uint8* filter_base_ptr = filter_data;
-  for (int filter_x = 0; filter_x < filter_width; ++filter_x) {
-    const int out_x_loop_start = std::max(
-        out_x_buffer_start,
-        (pad_width - dilation_factor * filter_x + stride - 1) / stride);
-    const int out_x_loop_end = std::min(
-        out_x_buffer_end,
-        (pad_width + input_width - dilation_factor * filter_x + stride - 1) /
-            stride);
-
-    int32* acc_buffer_ptr =
-        acc_buffer + (out_x_loop_start - out_x_buffer_start) * output_depth;
-    const int in_x_origin =
-        (out_x_loop_start * stride) - pad_width + dilation_factor * filter_x;
-    const uint8* input_ptr = input_data + in_x_origin * input_depth;
-    const int input_ptr_increment = (stride - 1) * input_depth;
-    for (int out_x = out_x_loop_start; out_x < out_x_loop_end; out_x++) {
-      const uint8* filter_ptr = filter_base_ptr;
-      for (int ic = 0; ic < input_depth; ++ic) {
-        const int16 input_val = *input_ptr++ + input_offset;
-        for (int m = 0; m < depth_multiplier; m++) {
-          const int16 filter_val = *filter_ptr++ + filter_offset;
-          *acc_buffer_ptr++ += static_cast(filter_val) * input_val;
-        }
-      }
-      input_ptr += input_ptr_increment;
-    }
-    filter_base_ptr += output_depth;
-  }
-}
-
-// Initializes the accumulator buffer with bias values.
-inline void DepthwiseConvInitAccBuffer(int num_output_pixels, int output_depth,
-                                       const int32* bias_data,
-                                       int32* acc_buffer) {
-  int i = 0;
-#ifdef USE_NEON
-  if (output_depth == 1) {
-    const int32x4_t b = vdupq_n_s32(bias_data[0]);
-    for (; i <= num_output_pixels - 16; i += 16) {
-      vst1q_s32(acc_buffer + i + 0, b);
-      vst1q_s32(acc_buffer + i + 4, b);
-      vst1q_s32(acc_buffer + i + 8, b);
-      vst1q_s32(acc_buffer + i + 12, b);
-    }
-    for (; i <= num_output_pixels - 4; i += 4) {
-      vst1q_s32(acc_buffer + i, b);
-    }
-  } else if (output_depth == 2) {
-    int32x4_t b = vdupq_n_s32(bias_data[0]);
-    b = vsetq_lane_s32(bias_data[1], b, 1);
-    b = vsetq_lane_s32(bias_data[1], b, 3);
-    for (; i <= num_output_pixels - 8; i += 8) {
-      vst1q_s32(acc_buffer + 2 * i + 0, b);
-      vst1q_s32(acc_buffer + 2 * i + 4, b);
-      vst1q_s32(acc_buffer + 2 * i + 8, b);
-      vst1q_s32(acc_buffer + 2 * i + 12, b);
-    }
-    for (; i <= num_output_pixels - 2; i += 2) {
-      vst1q_s32(acc_buffer + 2 * i, b);
-    }
-  } else if (output_depth == 4) {
-    const int32x4_t b = vld1q_s32(bias_data);
-    for (; i <= num_output_pixels - 4; i += 4) {
-      vst1q_s32(acc_buffer + 4 * i + 0, b);
-      vst1q_s32(acc_buffer + 4 * i + 4, b);
-      vst1q_s32(acc_buffer + 4 * i + 8, b);
-      vst1q_s32(acc_buffer + 4 * i + 12, b);
-    }
-    for (; i < num_output_pixels; i++) {
-      vst1q_s32(acc_buffer + 4 * i, b);
-    }
-  } else if (output_depth == 8) {
-    const int32x4_t b0 = vld1q_s32(bias_data);
-    const int32x4_t b1 = vld1q_s32(bias_data + 4);
-    for (; i <= num_output_pixels - 2; i += 2) {
-      vst1q_s32(acc_buffer + 8 * i + 0, b0);
-      vst1q_s32(acc_buffer + 8 * i + 4, b1);
-      vst1q_s32(acc_buffer + 8 * i + 8, b0);
-      vst1q_s32(acc_buffer + 8 * i + 12, b1);
-    }
-    for (; i < num_output_pixels; i++) {
-      vst1q_s32(acc_buffer + 8 * i + 0, b0);
-      vst1q_s32(acc_buffer + 8 * i + 4, b1);
-    }
-  } else if (output_depth == 16) {
-    const int32x4_t b0 = vld1q_s32(bias_data);
-    const int32x4_t b1 = vld1q_s32(bias_data + 4);
-    const int32x4_t b2 = vld1q_s32(bias_data + 8);
-    const int32x4_t b3 = vld1q_s32(bias_data + 12);
-    for (; i < num_output_pixels; i++) {
-      vst1q_s32(acc_buffer + 16 * i + 0, b0);
-      vst1q_s32(acc_buffer + 16 * i + 4, b1);
-      vst1q_s32(acc_buffer + 16 * i + 8, b2);
-      vst1q_s32(acc_buffer + 16 * i + 12, b3);
-    }
-  }
-#endif
-  for (; i < num_output_pixels; i++) {
-    memcpy(acc_buffer + i * output_depth, bias_data,
-           sizeof(acc_buffer[0]) * output_depth);
-  }
-}
-
-inline void DepthwiseConvGeneral(
-    const DepthwiseParams& params, const RuntimeShape& input_shape,
-    const uint8* input_data, const RuntimeShape& filter_shape,
-    const uint8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape,
-    uint8* output_data, int thread_start, int thread_end, int thread_dim) {
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-  const int depth_multiplier = params.depth_multiplier;
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  const int32 input_offset = params.input_offset;
-  const int32 filter_offset = params.weights_offset;
-  const int32 output_offset = params.output_offset;
-  const int32 output_multiplier = params.output_multiplier;
-  const int output_shift = params.output_shift;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  const int batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  const int input_height = input_shape.Dims(1);
-  const int input_width = input_shape.Dims(2);
-  const int input_depth = input_shape.Dims(3);
-  const int filter_height = filter_shape.Dims(1);
-  const int filter_width = filter_shape.Dims(2);
-  const int output_height = output_shape.Dims(1);
-  const int output_width = output_shape.Dims(2);
-#ifdef USE_NEON
-  const bool shift_left = (output_shift > 0);
-  const int32 multiplier_power_of_two = shift_left ? (1 << output_shift) : 1;
-#endif
-
-  // The default Accbuffer size is 2048, will allocate a bigger memory if it's
-  // not enough.
-  // TODO(b/136089667): If output_depth > 2048 happens a lot, we should just use
-  // a scratch tensor.
-  static const int kStackAccBufferSize = 2048;
-  int acc_buffer_size = kStackAccBufferSize;
-  int32 stack_acc_buffer[kStackAccBufferSize];
-  int32* acc_buffer = stack_acc_buffer;
-  std::unique_ptr heap_acc_buffer;
-  if (kStackAccBufferSize < output_depth) {
-    heap_acc_buffer.reset(new int32[output_depth]);
-    acc_buffer = heap_acc_buffer.get();
-    acc_buffer_size = output_depth;
-  }
-  const int kOutputPixelsInAccBuffer = acc_buffer_size / output_depth;
-  const int acc_buffer_size_actually_used =
-      kOutputPixelsInAccBuffer * output_depth;
-  TFLITE_DCHECK_LE(kOutputPixelsInAccBuffer * output_depth,
-                   acc_buffer_size_actually_used);
-  TFLITE_DCHECK_LE(acc_buffer_size_actually_used, acc_buffer_size);
-  TFLITE_DCHECK_GE(kOutputPixelsInAccBuffer, 1);
-  TFLITE_DCHECK(thread_dim == 0 || thread_dim == 1);
-
-  // row_accum_func will point to the core accumulation function to be used
-  // for this DepthwiseConv op.
-  using row_accum_func_t = decltype(&QuantizedDepthwiseConvAccumRowGeneric);
-  row_accum_func_t row_accum_func = nullptr;
-
-#define TFMINI_USE_DEPTHWISECONV_KERNEL(ALLOW_STRIDED, FIXED_INPUT_DEPTH, \
-                                        FIXED_DEPTH_MULTIPLIER)           \
-  if (!row_accum_func && (stride_width == 1 || ALLOW_STRIDED) &&          \
-      (input_depth == FIXED_INPUT_DEPTH || FIXED_INPUT_DEPTH == 0) &&     \
-      depth_multiplier == FIXED_DEPTH_MULTIPLIER) {                       \
-    row_accum_func =                                                      \
-        QuantizedDepthwiseConvAccumRow;           \
-  }
-
-#ifdef USE_NEON
-  // We go over our list of kernels by decreasing order of preference
-  // for the cases where multiple kernels could apply.
-
-  // Start with the fastest kernels: AllowStrided=false, fixed input depth.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 1, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 2, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 4, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 1, 4)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 4, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 4, 4)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 8, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 2, 8)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 2, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 12, 1)
-
-  // Next come the strided kernels: AllowStrided=true, fixed input depth.
-  // They are a bit less efficient, but allow stride!=1.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 8, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 16, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 16)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 20)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 32)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 8)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 8, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 2, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 4, 1)
-
-  // Finally, the kernels allowing a variable input depth,
-  // these are the least efficient but most general kernels.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 3)
-#endif  // USE_NEON
-
-  // No matching fast kernel found, use slow fallback.
-  if (!row_accum_func) {
-    row_accum_func = QuantizedDepthwiseConvAccumRowGeneric;
-  }
-
-#undef TFMINI_USE_DEPTHWISECONV_KERNEL
-
-  const int input_height_stride = input_shape.Dims(3) * input_shape.Dims(2);
-  const int input_batch_stride = input_height_stride * input_shape.Dims(1);
-  const int filter_height_stride = filter_shape.Dims(3) * filter_shape.Dims(2);
-
-  // Now that we have determined row_accum_func, we can start work.
-  int batch_start = 0;
-  int batch_end = batches;
-  int row_start = 0;
-  int row_end = output_height;
-  int output_ptr_offset = 0;
-
-  switch (thread_dim) {
-    case 0:
-      // Multithread along with the batch axis
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, batches);
-      batch_start = thread_start;
-      batch_end = thread_end;
-      output_ptr_offset = batch_start * FlatSizeSkipDim(output_shape, 0);
-      break;
-    case 1:
-      // Multithread along with the row axis
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, output_height);
-      row_start = thread_start;
-      row_end = thread_end;
-      output_ptr_offset = row_start * output_width * output_depth;
-      break;
-  }
-
-  uint8* output_ptr = output_data + output_ptr_offset;
-  int batch_step =
-      (output_height + row_start - row_end) * output_width * output_depth;
-  for (int b = batch_start; b < batch_end; ++b) {
-    for (int out_y = row_start; out_y < row_end; ++out_y) {
-      const int in_y_origin = (out_y * stride_height) - pad_height;
-      const int filter_y_start =
-          std::max(0, (-in_y_origin + dilation_height_factor - 1) /
-                          dilation_height_factor);
-      const int filter_y_end =
-          std::min(filter_height,
-                   (input_height - in_y_origin + dilation_height_factor - 1) /
-                       dilation_height_factor);
-      for (int out_x_buffer_start = 0; out_x_buffer_start < output_width;
-           out_x_buffer_start += kOutputPixelsInAccBuffer) {
-        const int out_x_buffer_end = std::min(
-            output_width, out_x_buffer_start + kOutputPixelsInAccBuffer);
-        // We call a 'pixel' a group of activation that share all but the
-        // 'depth'/'channel' coordinate. num_output_pixels is the number of
-        // output pixels that we will accumulate in this loop iteration.
-        const int num_output_pixels = out_x_buffer_end - out_x_buffer_start;
-        // Initialize our local accumulator with the bias values, so we don't
-        // have to add them later.
-        DepthwiseConvInitAccBuffer(num_output_pixels, output_depth, bias_data,
-                                   acc_buffer);
-        // Accumulation loop. Most of the time should be spent in here.
-        for (int filter_y = filter_y_start; filter_y < filter_y_end;
-             ++filter_y) {
-          const int in_y = in_y_origin + dilation_height_factor * filter_y;
-          row_accum_func(
-              stride_width, dilation_width_factor, input_depth, input_width,
-              input_data + in_y * input_height_stride + b * input_batch_stride,
-              input_offset, pad_width, depth_multiplier, filter_width,
-              filter_data + filter_y * filter_height_stride, filter_offset,
-              out_x_buffer_start, out_x_buffer_end, output_depth, acc_buffer);
-        }
-        // Finished accumulating int32 values. Now need to convert them to
-        // the final 8bit form and store them.
-        ruy::profiler::ScopeLabel label("downquantize+store");
-        const int num_output_values = output_depth * num_output_pixels;
-        int i = 0;
-#ifdef USE_NEON
-        using gemmlowp::RoundingDivideByPOT;
-        const int32x4_t output_offset_vec = vdupq_n_s32(output_offset);
-        const int32x4_t output_activation_min_vec =
-            vdupq_n_s32(output_activation_min);
-        const int32x4_t output_activation_max_vec =
-            vdupq_n_s32(output_activation_max);
-        // Handle 16 values at once.
-        // This allows us to issue 4 mutually independent int32
-        // multiplications (vqrdmulh), which should alleviate most of their
-        // high latency.
-        for (; i <= num_output_values - 16; i += 16) {
-          int32x4_t acc[4];
-          for (int j = 0; j < 4; j++) {
-            acc[j] = vld1q_s32(acc_buffer + i + 4 * j);
-          }
-
-          if (!shift_left) {
-            // Fixed-point multiplication.
-            for (int j = 0; j < 4; j++) {
-              acc[j] = vqrdmulhq_n_s32(acc[j], output_multiplier);
-            }
-            for (int j = 0; j < 4; j++) {
-              acc[j] = RoundingDivideByPOT(acc[j], -output_shift);
-            }
-          } else {
-            // Fixed-point multiplication.
-            for (int j = 0; j < 4; j++) {
-              acc[j] = vmulq_n_s32(acc[j], multiplier_power_of_two);
-              acc[j] = vqrdmulhq_n_s32(acc[j], output_multiplier);
-            }
-          }
-          // Add the output offset.
-          for (int j = 0; j < 4; j++) {
-            acc[j] = vaddq_s32(acc[j], output_offset_vec);
-          }
-          // Apply the activation function.
-          for (int j = 0; j < 4; j++) {
-            acc[j] = vmaxq_s32(acc[j], output_activation_min_vec);
-          }
-          for (int j = 0; j < 4; j++) {
-            acc[j] = vminq_s32(acc[j], output_activation_max_vec);
-          }
-          // Saturating cast to uint8 and store to destination.
-          int16x4_t acc_s16[4];
-          for (int j = 0; j < 4; j++) {
-            acc_s16[j] = vqmovn_s32(acc[j]);
-          }
-          const int16x8_t res_s16_0 = vcombine_s16(acc_s16[0], acc_s16[1]);
-          const int16x8_t res_s16_1 = vcombine_s16(acc_s16[2], acc_s16[3]);
-          const uint8x8_t res_u8_0 = vqmovun_s16(res_s16_0);
-          const uint8x8_t res_u8_1 = vqmovun_s16(res_s16_1);
-          vst1q_u8(output_ptr, vcombine_u8(res_u8_0, res_u8_1));
-          output_ptr += 16;
-        }
-        // Handle 8 values at once.
-        // Not as good as 16 (now we're only issuing 2 mutually independent
-        // vqrdmulh instructions, so we're probably paying for their high
-        // latency).
-        for (; i <= num_output_values - 8; i += 8) {
-          int32x4_t acc0 = vld1q_s32(acc_buffer + i);
-          int32x4_t acc1 = vld1q_s32(acc_buffer + i + 4);
-          if (!shift_left) {
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-            acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-            // Rounding right shift.
-            acc0 = RoundingDivideByPOT(acc0, -output_shift);
-            acc1 = RoundingDivideByPOT(acc1, -output_shift);
-          } else {
-            // Fixed-point multiplication.
-            acc0 = vmulq_n_s32(acc0, multiplier_power_of_two);
-            acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-
-            acc1 = vmulq_n_s32(acc1, multiplier_power_of_two);
-            acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-          }
-          // Add the output offset.
-          acc0 = vaddq_s32(acc0, output_offset_vec);
-          acc1 = vaddq_s32(acc1, output_offset_vec);
-          // Apply the activation function.
-          acc0 = vmaxq_s32(acc0, output_activation_min_vec);
-          acc1 = vmaxq_s32(acc1, output_activation_min_vec);
-          acc0 = vminq_s32(acc0, output_activation_max_vec);
-          acc1 = vminq_s32(acc1, output_activation_max_vec);
-          // Saturating cast to uint8 and store to destination.
-          const int16x4_t acc0_s16 = vqmovn_s32(acc0);
-          const int16x4_t acc1_s16 = vqmovn_s32(acc1);
-          const int16x8_t res_s16 = vcombine_s16(acc0_s16, acc1_s16);
-          const uint8x8_t res_u8 = vqmovun_s16(res_s16);
-          vst1_u8(output_ptr, res_u8);
-          output_ptr += 8;
-        }
-        // Handle 4 values at once. Now we're paying the full price of the
-        // high latency of vqrdmulh. Also, storing only 4 bytes at the end
-        // (without any alignment) can only be done 1 byte at a time.
-        // Yet, that is still worth doing to minimize the amount of leftover
-        // that will have to go through the very slow scalar code.
-        for (; i <= num_output_values - 4; i += 4) {
-          int32x4_t acc = vld1q_s32(acc_buffer + i);
-          if (!shift_left) {
-            // Fixed-point multiplication.
-            acc = vqrdmulhq_n_s32(acc, output_multiplier);
-            // Rounding right shift.
-            acc = RoundingDivideByPOT(acc, -output_shift);
-          } else {
-            // Fixed-point multiplication.
-            acc = vmulq_n_s32(acc, multiplier_power_of_two);
-            acc = vqrdmulhq_n_s32(acc, output_multiplier);
-          }
-          // Add the output offset.
-          acc = vaddq_s32(acc, output_offset_vec);
-          // Apply the activation function.
-          acc = vmaxq_s32(acc, output_activation_min_vec);
-          acc = vminq_s32(acc, output_activation_max_vec);
-          // Saturating cast to uint8 and store to destination.
-          const int16x4_t acc_s16 = vqmovn_s32(acc);
-          const int16x8_t res_s16 = vcombine_s16(acc_s16, acc_s16);
-          const uint8x8_t res_u8 = vqmovun_s16(res_s16);
-          vst1_lane_u8(output_ptr + 0, res_u8, 0);
-          vst1_lane_u8(output_ptr + 1, res_u8, 1);
-          vst1_lane_u8(output_ptr + 2, res_u8, 2);
-          vst1_lane_u8(output_ptr + 3, res_u8, 3);
-          output_ptr += 4;
-        }
-#endif  // USE_NEON
-
-        // Handle leftover values, one by one. This is very slow.
-        for (; i < num_output_values; i++) {
-          int32 acc = acc_buffer[i];
-          acc = MultiplyByQuantizedMultiplier(acc, output_multiplier,
-                                              output_shift);
-          acc += output_offset;
-          acc = std::max(acc, output_activation_min);
-          acc = std::min(acc, output_activation_max);
-          *output_ptr++ = static_cast(acc);
-        }
-      }
-    }
-    output_ptr += batch_step;
-  }
-}
-
-}  // namespace depthwise_conv
-
-template 
-inline void DepthwiseConvWithRounding(
-    const DepthwiseParams& params, const RuntimeShape& input_shape,
-    const uint8* input_data, const RuntimeShape& filter_shape,
-    const uint8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape,
-    uint8* output_data, const CpuFlags& cpu_flags, int thread_start,
-    int thread_end, int thread_dim) {
-  ruy::profiler::ScopeLabel label("DepthwiseConv/8bit");
-  const int depth_multiplier = params.depth_multiplier;
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  TFLITE_DCHECK_GE(dilation_width_factor, 1);
-  TFLITE_DCHECK_GE(dilation_height_factor, 1);
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(output_activation_min, output_activation_max);
-  const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  const int input_depth = input_shape.Dims(3);
-  TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier);
-  TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth);
-
-// Enable for arm64 except for the Nvidia Linux 4 Tegra (L4T) running on
-// Jetson TX-2. This compiler does not support the offsetof() macro.
-#if defined(__aarch64__) && !defined(GOOGLE_L4T)
-#if defined(__ANDROID__) && defined(__clang__)
-  // Dispatch to dot-product 3x3 kernels when supported.
-  if (cpu_flags.neon_dotprod) {
-    using optimized_ops::depthwise_conv::DotProduct3x3KernelType;
-    DotProduct3x3KernelType kernel_type =
-        optimized_ops::depthwise_conv::CategorizeDotProductKernel(
-            input_shape, filter_shape, output_shape, params);
-    if (kernel_type != DotProduct3x3KernelType::kNone) {
-      ruy::profiler::ScopeLabel specialized_label(
-          "DepthwiseConv/8bit/3x3XDotProduct");
-      optimized_ops::depthwise_conv::DepthwiseConvDotProduct3x3<
-          DepthwiseConvImplementation::kUseNeon3x3DotProduct>(
-          params, input_shape, input_data, filter_shape, filter_data,
-          bias_shape, bias_data, output_shape, output_data, thread_start,
-          thread_end, thread_dim);
-      return;
-    }
-  }
-
-#endif
-  // Dispatch to non-dot-product 3x3 kernels when supported.
-
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-  const int output_shift = params.output_shift;
-
-  // Call kernel optimized for depthwise convolutions using 3x3 filters if
-  // parameters are supported.
-  if (depthwise_conv::Fast3x3FilterKernelSupported(
-          input_shape, filter_shape, stride_width, stride_height,
-          dilation_width_factor, dilation_height_factor, pad_width, pad_height,
-          depth_multiplier, output_shape, output_shift)) {
-    ruy::profiler::ScopeLabel specialized_label("DepthwiseConv/8bit/3x3");
-    depthwise_conv::DepthwiseConv3x3Filter(
-        params, input_shape, input_data, filter_shape, filter_data, bias_shape,
-        bias_data, output_shape, output_data, thread_start, thread_end,
-        thread_dim);
-    return;
-  }
-#endif
-
-  ruy::profiler::ScopeLabel specialized_label("DepthwiseConv/8bit/General");
-  depthwise_conv::DepthwiseConvGeneral(params, input_shape, input_data,
-                                       filter_shape, filter_data, bias_shape,
-                                       bias_data, output_shape, output_data,
-                                       thread_start, thread_end, thread_dim);
-}
-
-inline void DepthwiseConvImpl(
-    const DepthwiseParams& params, const RuntimeShape& input_shape,
-    const uint8* input_data, const RuntimeShape& filter_shape,
-    const uint8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape,
-    uint8* output_data, const CpuFlags& cpu_flags, int thread_start,
-    int thread_end, int thread_dim) {
-  return DepthwiseConvWithRounding(
-      params, input_shape, input_data, filter_shape, filter_data, bias_shape,
-      bias_data, output_shape, output_data, cpu_flags, thread_start, thread_end,
-      thread_dim);
-}
-
-}  // namespace optimized_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_UINT8_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h
deleted file mode 100644
index 73acbcf..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h
+++ /dev/null
@@ -1,13436 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_UINT8_3X3_FILTER_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_UINT8_3X3_FILTER_H_
-
-#include 
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h"
-#include "tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_ops {
-namespace depthwise_conv {
-
-#ifdef USE_NEON
-inline int8x16_t util_vld1q_x8(const uint8* data_addr) {
-  return vreinterpretq_s8_u8(vld1q_u8(data_addr));
-}
-inline int8x16_t util_vld1q_x8(const int8* data_addr) {
-  return vld1q_s8(data_addr);
-}
-inline int8x8_t util_vld1_x8(const uint8* data_addr) {
-  return vreinterpret_s8_u8(vld1_u8(data_addr));
-}
-inline int8x8_t util_vld1_x8(const int8* data_addr) {
-  return vld1_s8(data_addr);
-}
-#endif
-
-#define STR(s) STR_UNEXPANDED(s)
-#define STR_UNEXPANDED(s) #s
-
-// Enable for arm64 except for the Nvidia Linux 4 Tegra (L4T) running on
-// Jetson TX-2. This compiler does not support the offsetof() macro.
-#if defined(__aarch64__) && !defined(GOOGLE_L4T)
-#include 
-
-// Lane operations are for clarity and convenience. We want to load and store
-// 4 8-bit lanes together. So these are treated much like 32-bit loads and
-// 32-bit stores. Stores require 32-bit alignment.
-
-#define vst1_lane_8x4(dst, reg, lane_num)                                  \
-  TFLITE_DCHECK_EQ(reinterpret_cast(dst) % 4, 0);          \
-  vst1_lane_s32(reinterpret_cast(dst), vreinterpret_s32_s8(reg), \
-                lane_num)
-#define vst1q_lane_8x4(dst, reg, lane_num)                        \
-  TFLITE_DCHECK_EQ(reinterpret_cast(dst) % 4, 0); \
-  vst1q_lane_u32(reinterpret_cast(dst), reg, lane_num)
-
-// Important! Most compilation configurations will compile and run without
-// reinterpret_cast. Sanitizers may fail silently on lane-loading, with an
-// obscure bug or mis-feature probably in unhygienic macro expansion.
-#define vld1q_lane_s8x8(src, reg, lane_num)                                  \
-  vreinterpretq_s8_s64(vld1q_lane_s64(reinterpret_cast(src), \
-                                      vreinterpretq_s64_s8(reg), lane_num))
-#define vld1_lane_8x4(src, reg, lane_num)                                \
-  vreinterpret_s8_s32(vld1_lane_s32(reinterpret_cast(src), \
-                                    vreinterpret_s32_s8(reg), lane_num))
-#define vld1q_lane_8x4(src, reg, lane_num) \
-  vld1q_lane_s32(reinterpret_cast(src), reg, lane_num)
-#define vld1q_dup_s8x4(src) vld1q_dup_s32(reinterpret_cast(src))
-
-// Represents the number of bytes offset from the start of the
-// DepthwiseConvParams struct. This is used in the asm to load parameters.
-// Keep these values in sync with the static_asserts below.
-#define OFFSET_INPUT_DEPTH 0
-#define OFFSET_INPUT_ROW_SIZE 8
-#define OFFSET_OUTPUT_DEPTH 16
-#define OFFSET_OUTPUT_ROW_SIZE 24
-#define OFFSET_FILTER_ROW_SIZE 32
-#define OFFSET_INPUT_OFFSET 40
-#define OFFSET_OUTPUT_OFFSET 44
-#define OFFSET_FILTER_OFFSET 48
-#define OFFSET_OUTPUT_MULTIPLIER 52
-#define OFFSET_OUTPUT_ACTIVATION_MIN 56
-#define OFFSET_OUTPUT_ACTIVATION_MAX 60
-#define OFFSET_OUTPUT_RIGHT_SHIFT 64
-#define OFFSET_INPUT_WIDTH 68
-#define OFFSET_INPUT_HEIGHT 72
-#define OFFSET_STRIDE_WIDTH 76
-#define OFFSET_STRIDE_HEIGHT 80
-#define OFFSET_OUTPUT_WIDTH 84
-#define OFFSET_OUTPUT_HEIGHT 88
-
-static_assert(offsetof(DepthwiseConvParams, input_depth) == OFFSET_INPUT_DEPTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_row_size) ==
-                  OFFSET_INPUT_ROW_SIZE,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_depth) ==
-                  OFFSET_OUTPUT_DEPTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_row_size) ==
-                  OFFSET_OUTPUT_ROW_SIZE,
-              "");
-static_assert(offsetof(DepthwiseConvParams, filter_row_size) ==
-                  OFFSET_FILTER_ROW_SIZE,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_offset) ==
-                  OFFSET_INPUT_OFFSET,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_offset) ==
-                  OFFSET_OUTPUT_OFFSET,
-              "");
-static_assert(offsetof(DepthwiseConvParams, filter_offset) ==
-                  OFFSET_FILTER_OFFSET,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_multiplier) ==
-                  OFFSET_OUTPUT_MULTIPLIER,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_activation_min) ==
-                  OFFSET_OUTPUT_ACTIVATION_MIN,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_activation_max) ==
-                  OFFSET_OUTPUT_ACTIVATION_MAX,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_right_shift) ==
-                  OFFSET_OUTPUT_RIGHT_SHIFT,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_width) == OFFSET_INPUT_WIDTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_height) ==
-                  OFFSET_INPUT_HEIGHT,
-              "");
-static_assert(offsetof(DepthwiseConvParams, stride_width) ==
-                  OFFSET_STRIDE_WIDTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, stride_height) ==
-                  OFFSET_STRIDE_HEIGHT,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_width) ==
-                  OFFSET_OUTPUT_WIDTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_height) ==
-                  OFFSET_OUTPUT_HEIGHT,
-              "");
-
-// Dot product ops hard-coded
-
-// Represents the number of bytes offset from the start of the
-// DepthwiseConvDotProdParams struct. This is used in the asm to load
-// parameters. Keep these values in sync with the static_asserts below.
-
-#define DP_OFFSET_INPUT_DEPTH 0
-#define DP_OFFSET_OUTPUT_DEPTH DP_OFFSET_INPUT_DEPTH + 8
-#define DP_OFFSET_STRIDE DP_OFFSET_OUTPUT_DEPTH + 8
-#define DP_OFFSET_BIAS_INCREMENT DP_OFFSET_STRIDE + 4
-//
-#define DP_OFFSET_INPUT_OFFSET 24
-#define DP_OFFSET_OUTPUT_OFFSET DP_OFFSET_INPUT_OFFSET + 4
-#define DP_OFFSET_OUTPUT_MULTIPLIER DP_OFFSET_OUTPUT_OFFSET + 4
-#define DP_OFFSET_OUTPUT_SHIFT DP_OFFSET_OUTPUT_MULTIPLIER + 4
-#define DP_OFFSET_QUANTIZED_ACTIVATION_MIN DP_OFFSET_OUTPUT_SHIFT + 4
-#define DP_OFFSET_QUANTIZED_ACTIVATION_MAX \
-  DP_OFFSET_QUANTIZED_ACTIVATION_MIN + 4
-//
-#define DP_OFFSET_PADDING_LEFT 48
-#define DP_OFFSET_PADDING_RIGHT DP_OFFSET_PADDING_LEFT + 4
-#define DP_OFFSET_PADDING_TOP DP_OFFSET_PADDING_RIGHT + 4
-#define DP_OFFSET_PADDING_BOTTOM DP_OFFSET_PADDING_TOP + 4
-//
-#define DP_OFFSET_DEPTH_MICRO_REPEATS DP_OFFSET_PADDING_BOTTOM + 4
-//
-#define DP_OFFSET_WIDTH_MACRO_COUNT 68
-#define DP_OFFSET_INPUT_WIDTH_OVERALL_MICRO_REPEATS \
-  DP_OFFSET_WIDTH_MACRO_COUNT + 4
-#define DP_OFFSET_INPUT_WIDTH_MICRO_REPEATS \
-  DP_OFFSET_INPUT_WIDTH_OVERALL_MICRO_REPEATS + 4
-#define DP_OFFSET_RESIDUAL_WIDTH DP_OFFSET_INPUT_WIDTH_MICRO_REPEATS + 4
-#define DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS \
-  DP_OFFSET_RESIDUAL_WIDTH + 4
-#define DP_OFFSET_OUTPUT_WIDTH_MICRO_REPEATS \
-  DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS + 4
-#define DP_OFFSET_OUTPUT_RESIDUAL_WIDTH DP_OFFSET_OUTPUT_WIDTH_MICRO_REPEATS + 4
-#define DP_OFFSET_WORKSPACE_WIDTH_MICRO_REPEATS \
-  DP_OFFSET_OUTPUT_RESIDUAL_WIDTH + 4
-//
-#define DP_OFFSET_HEIGHT_MACRO_COUNT 100
-#define DP_OFFSET_INBOUND_BLOCK_HEIGHT DP_OFFSET_HEIGHT_MACRO_COUNT + 4
-#define DP_OFFSET_OUTBOUND_BLOCK_HEIGHT DP_OFFSET_INBOUND_BLOCK_HEIGHT + 4
-#define DP_OFFSET_INPUT_HEIGHT_STRIDE DP_OFFSET_OUTBOUND_BLOCK_HEIGHT + 4
-#define DP_OFFSET_OUTPUT_HEIGHT_STRIDE DP_OFFSET_INPUT_HEIGHT_STRIDE + 4
-#define DP_OFFSET_WORKSPACE_HEIGHT_STRIDE DP_OFFSET_OUTPUT_HEIGHT_STRIDE + 4
-//
-#define DP_OFFSET_FOUR_OVER_STRIDE DP_OFFSET_WORKSPACE_HEIGHT_STRIDE + 4
-//
-#define DP_OFFSET_OUTPUT_MULTPLIPLIER_PER_CHANNEL DP_OFFSET_FOUR_OVER_STRIDE + 4
-#define DP_OFFSET_OUTPUT_SHIFT_PER_CHANNEL \
-  DP_OFFSET_OUTPUT_MULTPLIPLIER_PER_CHANNEL + 8
-
-static_assert(offsetof(DepthwiseConvDotProdParams, input_depth) ==
-                  DP_OFFSET_INPUT_DEPTH,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, output_depth) ==
-                  DP_OFFSET_OUTPUT_DEPTH,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, stride) == DP_OFFSET_STRIDE,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, bias_increment) ==
-                  DP_OFFSET_BIAS_INCREMENT,
-              "");
-//
-static_assert(offsetof(DepthwiseConvDotProdParams, input_offset) ==
-                  DP_OFFSET_INPUT_OFFSET,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, output_offset) ==
-                  DP_OFFSET_OUTPUT_OFFSET,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, output_multiplier) ==
-                  DP_OFFSET_OUTPUT_MULTIPLIER,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, output_shift) ==
-                  DP_OFFSET_OUTPUT_SHIFT,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, quantized_activation_min) ==
-                  DP_OFFSET_QUANTIZED_ACTIVATION_MIN,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, quantized_activation_max) ==
-                  DP_OFFSET_QUANTIZED_ACTIVATION_MAX,
-              "");
-//
-static_assert(offsetof(DepthwiseConvDotProdParams, padding_left) ==
-                  DP_OFFSET_PADDING_LEFT,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, padding_right) ==
-                  DP_OFFSET_PADDING_RIGHT,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, padding_top) ==
-                  DP_OFFSET_PADDING_TOP,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, padding_bottom) ==
-                  DP_OFFSET_PADDING_BOTTOM,
-              "");
-//
-static_assert(offsetof(DepthwiseConvDotProdParams, depth_micro_repeats) ==
-                  DP_OFFSET_DEPTH_MICRO_REPEATS,
-              "");
-//
-static_assert(offsetof(DepthwiseConvDotProdParams, width_macro_count) ==
-                  DP_OFFSET_WIDTH_MACRO_COUNT,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams,
-                       input_width_overall_micro_repeats) ==
-                  DP_OFFSET_INPUT_WIDTH_OVERALL_MICRO_REPEATS,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, input_width_micro_repeats) ==
-                  DP_OFFSET_INPUT_WIDTH_MICRO_REPEATS,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, residual_width) ==
-                  DP_OFFSET_RESIDUAL_WIDTH,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams,
-                       output_width_overall_micro_repeats) ==
-                  DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams,
-                       output_width_micro_repeats) ==
-                  DP_OFFSET_OUTPUT_WIDTH_MICRO_REPEATS,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, output_residual_width) ==
-                  DP_OFFSET_OUTPUT_RESIDUAL_WIDTH,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams,
-                       workspace_width_micro_repeats) ==
-                  DP_OFFSET_WORKSPACE_WIDTH_MICRO_REPEATS,
-              "");
-//
-static_assert(offsetof(DepthwiseConvDotProdParams, height_macro_count) ==
-                  DP_OFFSET_HEIGHT_MACRO_COUNT,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, inbound_block_height) ==
-                  DP_OFFSET_INBOUND_BLOCK_HEIGHT,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, outbound_block_height) ==
-                  DP_OFFSET_OUTBOUND_BLOCK_HEIGHT,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, input_height_stride) ==
-                  DP_OFFSET_INPUT_HEIGHT_STRIDE,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, output_height_stride) ==
-                  DP_OFFSET_OUTPUT_HEIGHT_STRIDE,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, workspace_height_stride) ==
-                  DP_OFFSET_WORKSPACE_HEIGHT_STRIDE,
-              "");
-//
-static_assert(offsetof(DepthwiseConvDotProdParams, four_over_stride) ==
-                  DP_OFFSET_FOUR_OVER_STRIDE,
-              "");
-//
-static_assert(offsetof(DepthwiseConvDotProdParams,
-                       output_multiplier_per_channel) ==
-                  DP_OFFSET_OUTPUT_MULTPLIPLIER_PER_CHANNEL,
-              "");
-static_assert(offsetof(DepthwiseConvDotProdParams, output_shift_per_channel) ==
-                  DP_OFFSET_OUTPUT_SHIFT_PER_CHANNEL,
-              "");
-
-#endif  // __aarch64__ && !GOOGLE_L4T - Dot product ops hard-coded
-
-#if defined(__aarch64__) && !defined(GOOGLE_L4T)
-
-template <>
-struct DepthwiseConvWindow {
- public:
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         int64_t input_depth, int64_t input_row_size,
-                         int32 output_window_height, int32 output_window_width,
-                         const DepthwiseConvParams* params_ptr) {
-    const int64_t input_width_increment = 2 * input_depth;
-    const int64_t input_height_increment = 2 * input_row_size;
-    const int64_t output_height_increment = 2 * params_ptr->output_row_size;
-
-#define DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "1"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "2"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "3"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "4"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "5"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "6"
-#define DEPTHWISECONV_LABEL_HEIGHT_1 "7"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "8"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "9"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "10"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_END "11"
-
-    asm volatile(
-        // Performs depthwise convolutions for a window specified by
-        // |output_window_height| and |output_window_width|. The inner-most loop
-        // processes 2x2 outputs, and any leftovers at the end.
-        //
-        // Algorithm works as follows:
-        //
-        //   1. Load filters of 8 depth (8x3x3). Registers v0--v8 hold filter
-        //      values.
-        //   2. For 2 output heights at a time:
-        //        i.  For 2 output widths at a time, load inputs for a 2x1 (2
-        //            height, 1 width) output window (4x3 input window).
-        //            Registers v9--v20 hold input values. Mul-add with
-        //            accumulators v21--v24. Then run activation, downquantize
-        //            and store. Repeat for the next 2x1 output window,
-        //            leveraging overlapping inputs.
-        //        ii. Handle single leftover width if exists.
-        //   3. Handle single leftover height if exists.
-        //        i.  For 2 output widths at a time, load inputs for a 1x2 (1
-        //            height, 2 width) output window (3x4 input window).
-        //            Registers v9--v20 hold input values. Mul-add with
-        //            accumulators v21--v24. Then run activation, downquantize
-        //            and store. Repeat for the next 1x2 output window,
-        //            leveraging overlapping inputs.
-        //        ii. Handle single leftover width if exists.
-        //
-        // Loads are placed as soon as the register is no longer needed and
-        // interleaved with arithmetic operations to take advantage of
-        // dual-issue pipelines. We also add input offsets as far from the loads
-        // as possible to give loads enough cycles to fetch data from memory.
-
-        // Set "constant" registers. These registers may be replaced with temp
-        // values from time to time when there are not enough NEON registers.
-        // We use x9--x15 general purpose registers as they are caller-saved
-        // temporary registers (see
-        // http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf).  // NOLINT
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr x3, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "cmp %w[output_window_height], #2\n"
-        "dup v26.8h, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "ldr w2, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "dup v29.8h, w2\n"
-        "ldr w4, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v30.16b, w4\n"
-        "ldr w0, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v31.16b, w0\n"
-        "dup v28.4s, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-        "add x10, %[bias_ptr], #16\n"
-        "ldr x1, [%[params_ptr], #" STR(OFFSET_OUTPUT_ROW_SIZE) "]\n"
-        "dup v9.8h, w9\n"
-
-        // Load filters and add offsets.
-        "ld1 {v0.8b}, [%[filter_ptr]], x3\n"
-        "ld1 {v1.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v0.8h, v9.8h, v0.8b\n"
-        "ld1 {v2.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v1.8h, v9.8h, v1.8b\n"
-        "ld1 {v3.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v2.8h, v9.8h, v2.8b\n"
-        "ld1 {v4.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v3.8h, v9.8h, v3.8b\n"
-        "ld1 {v5.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v4.8h, v9.8h, v4.8b\n"
-        "ld1 {v6.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v5.8h, v9.8h, v5.8b\n"
-        "ld1 {v7.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v6.8h, v9.8h, v6.8b\n"
-        "ld1 {v8.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v7.8h, v9.8h, v7.8b\n"
-        "uaddw v8.8h, v9.8h, v8.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_2_LOOP ":\n"
-          // This loop processes 2x2 outputs. To avoid register exhaustion,
-          // inputs for the left 2 outputs are loaded first, then the right
-          // two outputs.
-          "mov x11, %[input_ptr]\n"
-          "mov x12, x11\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "add x13, x11, %[input_row_size]\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "add x14, x13, %[input_row_size]\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x15, x14, %[input_row_size]\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "mov w5, %w[output_window_width]\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "mov x6, %[output_ptr]\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "add x7, %[output_ptr], x1\n"
-          "ld1 {v15.8b}, [x14], %[input_depth]\n"
-          // The height 2 / width 2 loop loads an extra 2x1 outputs (2 height,
-          // 1 width) in anticipation for the next iteration. Make sure
-          // |output_window_width| is large enough to handle the additional
-          // loads, otherwise jump to specific the appropriate label to handle
-          // smaller widths.
-          "cmp w5, #2\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "ld1 {v16.8b}, [x14], %[input_depth]\n"
-          "uaddw v10.8h, v26.8h, v10.8b\n"
-          "ld1 {v17.8b}, [x14], %[input_depth]\n"
-          "uaddw v11.8h, v26.8h, v11.8b\n"
-          "ld1 {v18.8b}, [x15], %[input_depth]\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "ld1 {v19.8b}, [x15], %[input_depth]\n"
-          "uaddw v13.8h, v26.8h, v13.8b\n"
-          "ld1 {v20.8b}, [x15], %[input_depth]\n"
-          "uaddw v14.8h, v26.8h, v14.8b\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "uaddw v15.8h, v26.8h, v15.8b\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "uaddw v16.8h, v26.8h, v16.8b\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-          "uaddw v17.8h, v26.8h, v17.8b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "uaddw v18.8h, v26.8h, v18.8b\n"
-          "uaddw v19.8h, v26.8h, v19.8b\n"
-          "uaddw v20.8h, v26.8h, v20.8b\n"
-
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "f\n"
-          "cmp w5, #1\n"
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          //"loop_%=:\n"
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP ":\n"
-            // Mul-add left outputs.
-            "smlal v21.4s, v0.4h, v9.4h\n"
-            "subs w5, w5, #2\n"
-            "smlal2 v22.4s, v0.8h, v9.8h\n"
-            "cmp w5, #3\n"
-            "smlal v23.4s, v0.4h, v12.4h\n"
-            "ld1 {v9.8b}, [x12]\n"
-            "smlal2 v24.4s, v0.8h, v12.8h\n"
-            "smlal v21.4s, v1.4h, v10.4h\n"
-            "smlal2 v22.4s, v1.8h, v10.8h\n"
-            "smlal v23.4s, v1.4h, v13.4h\n"
-            "smlal2 v24.4s, v1.8h, v13.8h\n"
-            "smlal v21.4s, v2.4h, v11.4h\n"
-            "smlal2 v22.4s, v2.8h, v11.8h\n"
-            "smlal v23.4s, v2.4h, v14.4h\n"
-            "smlal2 v24.4s, v2.8h, v14.8h\n"
-            "smlal v21.4s, v3.4h, v12.4h\n"
-            "smlal2 v22.4s, v3.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x13]\n"
-            "smlal v23.4s, v3.4h, v15.4h\n"
-            "smlal2 v24.4s, v3.8h, v15.8h\n"
-            "smlal v21.4s, v4.4h, v13.4h\n"
-            "smlal2 v22.4s, v4.8h, v13.8h\n"
-            "smlal v23.4s, v4.4h, v16.4h\n"
-            "smlal2 v24.4s, v4.8h, v16.8h\n"
-            "smlal v21.4s, v5.4h, v14.4h\n"
-            "smlal2 v22.4s, v5.8h, v14.8h\n"
-            "smlal v23.4s, v5.4h, v17.4h\n"
-            "smlal2 v24.4s, v5.8h, v17.8h\n"
-            "smlal v21.4s, v6.4h, v15.4h\n"
-            "smlal2 v22.4s, v6.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x14]\n"
-            "smlal v23.4s, v6.4h, v18.4h\n"
-            "smlal2 v24.4s, v6.8h, v18.8h\n"
-            "ld1 {v18.8b}, [x15]\n"
-            "smlal v21.4s, v7.4h, v16.4h\n"
-            "smlal2 v22.4s, v7.8h, v16.8h\n"
-            "smlal v23.4s, v7.4h, v19.4h\n"
-            "smlal2 v24.4s, v7.8h, v19.8h\n"
-            "smlal v21.4s, v8.4h, v17.4h\n"
-            "smlal2 v22.4s, v8.8h, v17.8h\n"
-            "smlal v23.4s, v8.4h, v20.4h\n"
-            "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-            "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-            "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-            "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-            "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-            "and v25.16b, v21.16b, v28.16b\n"
-            "and v29.16b, v22.16b, v28.16b\n"
-            "and v30.16b, v23.16b, v28.16b\n"
-            "and v31.16b, v24.16b, v28.16b\n"
-            "sshr v25.4s, v25.4s, #31\n"
-            "sshr v29.4s, v29.4s, #31\n"
-            "sshr v30.4s, v30.4s, #31\n"
-            "sshr v31.4s, v31.4s, #31\n"
-            "sqadd v21.4s, v21.4s, v25.4s\n"
-            "sqadd v22.4s, v22.4s, v29.4s\n"
-            "dup v29.8h, w2\n"
-            "sqadd v23.4s, v23.4s, v30.4s\n"
-            "dup v30.16b, w4\n"
-            "sqadd v24.4s, v24.4s, v31.4s\n"
-            "dup v31.16b, w0\n"
-            "srshl v21.4s, v21.4s, v28.4s\n"
-            "srshl v22.4s, v22.4s, v28.4s\n"
-            "srshl v23.4s, v23.4s, v28.4s\n"
-            "srshl v24.4s, v24.4s, v28.4s\n"
-            "sqxtn v21.4h, v21.4s\n"
-            "sqxtn2 v21.8h, v22.4s\n"
-            "sqxtn v23.4h, v23.4s\n"
-            "sqxtn2 v23.8h, v24.4s\n"
-            "sqadd v21.8h, v21.8h, v29.8h\n"
-            "sqadd v23.8h, v23.8h, v29.8h\n"
-            "sqxtun v21.8b, v21.8h\n"
-            "sqxtun2 v21.16b, v23.8h\n"
-            "ld1 {v22.4s}, [x10]\n"
-            "umax v21.16b, v21.16b, v30.16b\n"
-            "umin v21.16b, v21.16b, v31.16b\n"
-            "ld1 {v24.4s}, [x10]\n"
-            "uaddw v9.8h, v26.8h, v9.8b\n"
-            "st1 {v21.8b}, [x6], x3\n"
-            "uaddw v12.8h, v26.8h, v12.8b\n"
-            "mov v23.d[0], v21.d[1]\n"
-            "st1 {v23.8b}, [x7], x3\n"
-            "uaddw v15.8h, v26.8h, v15.8b\n"
-            "ld1 {v21.4s}, [%[bias_ptr]]\n"
-            "uaddw v18.8h, v26.8h, v18.8b\n"
-            "ld1 {v23.4s}, [%[bias_ptr]]\n"
-
-            // Mul-add right outputs.
-            "smlal v21.4s, v0.4h, v10.4h\n"
-            "add x11, x11, %[input_width_increment]\n"
-            "smlal2 v22.4s, v0.8h, v10.8h\n"
-            "mov x12, x11\n"
-            "smlal v23.4s, v0.4h, v13.4h\n"
-            "add x13, x11, %[input_row_size]\n"
-            "smlal2 v24.4s, v0.8h, v13.8h\n"
-            "add x14, x13, %[input_row_size]\n"
-            "smlal v21.4s, v1.4h, v11.4h\n"
-            "add x15, x14, %[input_row_size]\n"
-            "smlal2 v22.4s, v1.8h, v11.8h\n"
-            "smlal v23.4s, v1.4h, v14.4h\n"
-            "smlal2 v24.4s, v1.8h, v14.8h\n"
-            "smlal v21.4s, v2.4h, v9.4h\n"
-            "smlal2 v22.4s, v2.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v2.4h, v12.4h\n"
-            "ld1 {v10.8b}, [x12], %[input_depth]\n"
-            "smlal2 v24.4s, v2.8h, v12.8h\n"
-            "ld1 {v11.8b}, [x12], %[input_depth]\n"
-            "smlal v21.4s, v3.4h, v13.4h\n"
-            "smlal2 v22.4s, v3.8h, v13.8h\n"
-            "smlal v23.4s, v3.4h, v16.4h\n"
-            "smlal2 v24.4s, v3.8h, v16.8h\n"
-            "smlal v21.4s, v4.4h, v14.4h\n"
-            "smlal2 v22.4s, v4.8h, v14.8h\n"
-            "smlal v23.4s, v4.4h, v17.4h\n"
-            "smlal2 v24.4s, v4.8h, v17.8h\n"
-            "smlal v21.4s, v5.4h, v12.4h\n"
-            "smlal2 v22.4s, v5.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v5.4h, v15.4h\n"
-            "ld1 {v13.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v5.8h, v15.8h\n"
-            "ld1 {v14.8b}, [x13], %[input_depth]\n"
-            "smlal v21.4s, v6.4h, v16.4h\n"
-            "smlal2 v22.4s, v6.8h, v16.8h\n"
-            "smlal v23.4s, v6.4h, v19.4h\n"
-            "smlal2 v24.4s, v6.8h, v19.8h\n"
-            "smlal v21.4s, v7.4h, v17.4h\n"
-            "smlal2 v22.4s, v7.8h, v17.8h\n"
-            "smlal v23.4s, v7.4h, v20.4h\n"
-            "smlal2 v24.4s, v7.8h, v20.8h\n"
-            "smlal v21.4s, v8.4h, v15.4h\n"
-            "smlal2 v22.4s, v8.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x14], %[input_depth]\n"
-            "smlal v23.4s, v8.4h, v18.4h\n"
-            "ld1 {v16.8b}, [x14], %[input_depth]\n"
-            "smlal2 v24.4s, v8.8h, v18.8h\n"
-            "ld1 {v17.8b}, [x14], %[input_depth]\n"
-
-            "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-            "ld1 {v18.8b}, [x15], %[input_depth]\n"
-            "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-            "ld1 {v19.8b}, [x15], %[input_depth]\n"
-            "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-            "ld1 {v20.8b}, [x15], %[input_depth]\n"
-            "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-            "and v25.16b, v21.16b, v28.16b\n"
-            "and v29.16b, v22.16b, v28.16b\n"
-            "and v30.16b, v23.16b, v28.16b\n"
-            "and v31.16b, v24.16b, v28.16b\n"
-            "sshr v25.4s, v25.4s, #31\n"
-            "sshr v29.4s, v29.4s, #31\n"
-            "sshr v30.4s, v30.4s, #31\n"
-            "sshr v31.4s, v31.4s, #31\n"
-            "sqadd v21.4s, v21.4s, v25.4s\n"
-            "sqadd v22.4s, v22.4s, v29.4s\n"
-            "dup v29.8h, w2\n"
-            "sqadd v23.4s, v23.4s, v30.4s\n"
-            "dup v30.16b, w4\n"
-            "sqadd v24.4s, v24.4s, v31.4s\n"
-            "dup v31.16b, w0\n"
-            "srshl v21.4s, v21.4s, v28.4s\n"
-            "srshl v22.4s, v22.4s, v28.4s\n"
-            "srshl v23.4s, v23.4s, v28.4s\n"
-            "srshl v24.4s, v24.4s, v28.4s\n"
-            "sqxtn v21.4h, v21.4s\n"
-            "sqxtn2 v21.8h, v22.4s\n"
-            "sqxtn v23.4h, v23.4s\n"
-            "sqxtn2 v23.8h, v24.4s\n"
-            "sqadd v21.8h, v21.8h, v29.8h\n"
-            "sqadd v23.8h, v23.8h, v29.8h\n"
-            "sqxtun v21.8b, v21.8h\n"
-            "sqxtun2 v21.16b, v23.8h\n"
-            "ld1 {v22.4s}, [x10]\n"
-            "umax v21.16b, v21.16b, v30.16b\n"
-            "umin v21.16b, v21.16b, v31.16b\n"
-            "ld1 {v24.4s}, [x10]\n"
-            "uaddw v9.8h, v26.8h, v9.8b\n"
-            "st1 {v21.8b}, [x6], x3\n"
-            "uaddw v10.8h, v26.8h, v10.8b\n"
-            "mov v23.d[0], v21.d[1]\n"
-            "st1 {v23.8b}, [x7], x3\n"
-            "uaddw v11.8h, v26.8h, v11.8b\n"
-            "uaddw v12.8h, v26.8h, v12.8b\n"
-            "uaddw v13.8h, v26.8h, v13.8b\n"
-            "uaddw v14.8h, v26.8h, v14.8b\n"
-            "uaddw v15.8h, v26.8h, v15.8b\n"
-            "ld1 {v21.4s}, [%[bias_ptr]]\n"
-            "uaddw v16.8h, v26.8h, v16.8b\n"
-            "ld1 {v23.4s}, [%[bias_ptr]]\n"
-            "uaddw v17.8h, v26.8h, v17.8b\n"
-            "uaddw v18.8h, v26.8h, v18.8b\n"
-            "uaddw v19.8h, v26.8h, v19.8b\n"
-            "uaddw v20.8h, v26.8h, v20.8b\n"
-
-            "bge " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "b\n"
-
-          // At this point, there will be one of 2 width or 1 width leftover,
-          // not both.
-          "cmp w5, #2\n"
-          "blt " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          // Handle last 2 columns if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER ":\n"
-          // Mul-add left outputs.
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "ld1 {v9.8b}, [x12]\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "smlal v23.4s, v2.4h, v14.4h\n"
-          "smlal2 v24.4s, v2.8h, v14.8h\n"
-          "smlal v21.4s, v3.4h, v12.4h\n"
-          "smlal2 v22.4s, v3.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x13]\n"
-          "smlal v23.4s, v3.4h, v15.4h\n"
-          "smlal2 v24.4s, v3.8h, v15.8h\n"
-          "smlal v21.4s, v4.4h, v13.4h\n"
-          "smlal2 v22.4s, v4.8h, v13.8h\n"
-          "smlal v23.4s, v4.4h, v16.4h\n"
-          "smlal2 v24.4s, v4.8h, v16.8h\n"
-          "smlal v21.4s, v5.4h, v14.4h\n"
-          "smlal2 v22.4s, v5.8h, v14.8h\n"
-          "smlal v23.4s, v5.4h, v17.4h\n"
-          "smlal2 v24.4s, v5.8h, v17.8h\n"
-          "smlal v21.4s, v6.4h, v15.4h\n"
-          "smlal2 v22.4s, v6.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x14]\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x15]\n"
-          "smlal v21.4s, v7.4h, v16.4h\n"
-          "smlal2 v22.4s, v7.8h, v16.8h\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "and v25.16b, v21.16b, v28.16b\n"
-          "and v29.16b, v22.16b, v28.16b\n"
-          "and v30.16b, v23.16b, v28.16b\n"
-          "and v31.16b, v24.16b, v28.16b\n"
-          "sshr v25.4s, v25.4s, #31\n"
-          "sshr v29.4s, v29.4s, #31\n"
-          "sshr v30.4s, v30.4s, #31\n"
-          "sshr v31.4s, v31.4s, #31\n"
-          "sqadd v21.4s, v21.4s, v25.4s\n"
-          "sqadd v22.4s, v22.4s, v29.4s\n"
-          "dup v29.8h, w2\n"
-          "sqadd v23.4s, v23.4s, v30.4s\n"
-          "dup v30.16b, w4\n"
-          "sqadd v24.4s, v24.4s, v31.4s\n"
-          "dup v31.16b, w0\n"
-          "srshl v21.4s, v21.4s, v28.4s\n"
-          "srshl v22.4s, v22.4s, v28.4s\n"
-          "srshl v23.4s, v23.4s, v28.4s\n"
-          "srshl v24.4s, v24.4s, v28.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "sqxtun2 v21.16b, v23.8h\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "umax v21.16b, v21.16b, v30.16b\n"
-          "umin v21.16b, v21.16b, v31.16b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "st1 {v21.8b}, [x6], x3\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "st1 {v23.8b}, [x7], x3\n"
-          "uaddw v15.8h, v26.8h, v15.8b\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "uaddw v18.8h, v26.8h, v18.8b\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-
-          // Mul-add right outputs.
-          "smlal v21.4s, v0.4h, v10.4h\n"
-          "smlal2 v22.4s, v0.8h, v10.8h\n"
-          "smlal v23.4s, v0.4h, v13.4h\n"
-          "smlal2 v24.4s, v0.8h, v13.8h\n"
-          "smlal v21.4s, v1.4h, v11.4h\n"
-          "smlal2 v22.4s, v1.8h, v11.8h\n"
-          "smlal v23.4s, v1.4h, v14.4h\n"
-          "smlal2 v24.4s, v1.8h, v14.8h\n"
-          "smlal v21.4s, v2.4h, v9.4h\n"
-          "smlal2 v22.4s, v2.8h, v9.8h\n"
-          "smlal v23.4s, v2.4h, v12.4h\n"
-          "smlal2 v24.4s, v2.8h, v12.8h\n"
-          "smlal v21.4s, v3.4h, v13.4h\n"
-          "smlal2 v22.4s, v3.8h, v13.8h\n"
-          "smlal v23.4s, v3.4h, v16.4h\n"
-          "smlal2 v24.4s, v3.8h, v16.8h\n"
-          "smlal v21.4s, v4.4h, v14.4h\n"
-          "smlal2 v22.4s, v4.8h, v14.8h\n"
-          "smlal v23.4s, v4.4h, v17.4h\n"
-          "smlal2 v24.4s, v4.8h, v17.8h\n"
-          "smlal v21.4s, v5.4h, v12.4h\n"
-          "smlal2 v22.4s, v5.8h, v12.8h\n"
-          "smlal v23.4s, v5.4h, v15.4h\n"
-          "smlal2 v24.4s, v5.8h, v15.8h\n"
-          "smlal v21.4s, v6.4h, v16.4h\n"
-          "smlal2 v22.4s, v6.8h, v16.8h\n"
-          "smlal v23.4s, v6.4h, v19.4h\n"
-          "smlal2 v24.4s, v6.8h, v19.8h\n"
-          "smlal v21.4s, v7.4h, v17.4h\n"
-          "smlal2 v22.4s, v7.8h, v17.8h\n"
-          "smlal v23.4s, v7.4h, v20.4h\n"
-          "smlal2 v24.4s, v7.8h, v20.8h\n"
-          "smlal v21.4s, v8.4h, v15.4h\n"
-          "smlal2 v22.4s, v8.8h, v15.8h\n"
-          "smlal v23.4s, v8.4h, v18.4h\n"
-          "smlal2 v24.4s, v8.8h, v18.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "and v25.16b, v21.16b, v28.16b\n"
-          "and v29.16b, v22.16b, v28.16b\n"
-          "and v30.16b, v23.16b, v28.16b\n"
-          "and v31.16b, v24.16b, v28.16b\n"
-          "sshr v25.4s, v25.4s, #31\n"
-          "sshr v29.4s, v29.4s, #31\n"
-          "sshr v30.4s, v30.4s, #31\n"
-          "sshr v31.4s, v31.4s, #31\n"
-          "sqadd v21.4s, v21.4s, v25.4s\n"
-          "sqadd v22.4s, v22.4s, v29.4s\n"
-          "dup v29.8h, w2\n"
-          "sqadd v23.4s, v23.4s, v30.4s\n"
-          "dup v30.16b, w4\n"
-          "sqadd v24.4s, v24.4s, v31.4s\n"
-          "dup v31.16b, w0\n"
-          "srshl v21.4s, v21.4s, v28.4s\n"
-          "srshl v22.4s, v22.4s, v28.4s\n"
-          "srshl v23.4s, v23.4s, v28.4s\n"
-          "srshl v24.4s, v24.4s, v28.4s\n"
-
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "sqxtun2 v21.16b, v23.8h\n"
-          "umax v21.16b, v21.16b, v30.16b\n"
-          "umin v21.16b, v21.16b, v31.16b\n"
-          "st1 {v21.8b}, [x6], x3\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [x7], x3\n"
-          "b " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "f\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER ":\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "smlal v23.4s, v2.4h, v14.4h\n"
-          "smlal2 v24.4s, v2.8h, v14.8h\n"
-          "smlal v21.4s, v3.4h, v12.4h\n"
-          "smlal2 v22.4s, v3.8h, v12.8h\n"
-          "smlal v23.4s, v3.4h, v15.4h\n"
-          "smlal2 v24.4s, v3.8h, v15.8h\n"
-          "smlal v21.4s, v4.4h, v13.4h\n"
-          "smlal2 v22.4s, v4.8h, v13.8h\n"
-          "smlal v23.4s, v4.4h, v16.4h\n"
-          "smlal2 v24.4s, v4.8h, v16.8h\n"
-          "smlal v21.4s, v5.4h, v14.4h\n"
-          "smlal2 v22.4s, v5.8h, v14.8h\n"
-          "smlal v23.4s, v5.4h, v17.4h\n"
-          "smlal2 v24.4s, v5.8h, v17.8h\n"
-          "smlal v21.4s, v6.4h, v15.4h\n"
-          "smlal2 v22.4s, v6.8h, v15.8h\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "smlal v21.4s, v7.4h, v16.4h\n"
-          "smlal2 v22.4s, v7.8h, v16.8h\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "and v9.16b, v21.16b, v28.16b\n"
-          "and v12.16b, v22.16b, v28.16b\n"
-          "and v15.16b, v23.16b, v28.16b\n"
-          "and v18.16b, v24.16b, v28.16b\n"
-          "sshr v9.4s, v9.4s, #31\n"
-          "sshr v12.4s, v12.4s, #31\n"
-          "sshr v15.4s, v15.4s, #31\n"
-          "sshr v18.4s, v18.4s, #31\n"
-          "sqadd v21.4s, v21.4s, v9.4s\n"
-          "sqadd v22.4s, v22.4s, v12.4s\n"
-          "sqadd v23.4s, v23.4s, v15.4s\n"
-          "sqadd v24.4s, v24.4s, v18.4s\n"
-          "srshl v21.4s, v21.4s, v28.4s\n"
-          "srshl v22.4s, v22.4s, v28.4s\n"
-          "srshl v23.4s, v23.4s, v28.4s\n"
-          "srshl v24.4s, v24.4s, v28.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "sqxtun2 v21.16b, v23.8h\n"
-          "umax v21.16b, v21.16b, v30.16b\n"
-          "umin v21.16b, v21.16b, v31.16b\n"
-          "st1 {v21.8b}, [x6], x3\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [x7], x3\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP ":\n"
-          "subs %w[output_window_height], %w[output_window_height], #2\n"
-          "add %[input_ptr], %[input_ptr], %[input_height_increment]\n"
-          "cmp %w[output_window_height], #2\n"
-          "add %[output_ptr], %[output_ptr], %[output_height_increment]\n"
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP ":\n"
-        "cmp %w[output_window_height], #1\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_1 ":\n"
-        "mov x12, %[input_ptr]\n"
-        "ld1 {v9.8b}, [x12], %[input_depth]\n"
-        "add x13, %[input_ptr], %[input_row_size]\n"
-        "ld1 {v10.8b}, [x12], %[input_depth]\n"
-        "add x14, x13, %[input_row_size]\n"
-        "ld1 {v11.8b}, [x12], %[input_depth]\n"
-        "add x15, x14, %[input_row_size]\n"
-        "mov w5, %w[output_window_width]\n"
-        "ld1 {v13.8b}, [x13], %[input_depth]\n"
-        "mov x6, %[output_ptr]\n"
-        "ld1 {v14.8b}, [x13], %[input_depth]\n"
-        "add x7, %[output_ptr], x1\n"
-        "ld1 {v15.8b}, [x13], %[input_depth]\n"
-        // The height 1 / width 2 loop loads an extra 1x1 output in anticipation
-        // for the next iteration. Make sure |output_window_width| is large
-        // enough to handle the additional load, otherwise jump to the
-        // appropriate label to handle smaller widths.
-        "cmp w5, #2\n"
-        "ld1 {v17.8b}, [x14], %[input_depth]\n"
-        "ld1 {v18.8b}, [x14], %[input_depth]\n"
-        "ld1 {v19.8b}, [x14], %[input_depth]\n"
-        "ld1 {v21.4s}, [%[bias_ptr]]\n"
-        "ld1 {v22.4s}, [x10]\n"
-        "ld1 {v23.4s}, [%[bias_ptr]]\n"
-        "ld1 {v24.4s}, [x10]\n"
-
-        "uaddw v9.8h, v26.8h, v9.8b\n"
-        "uaddw v10.8h, v26.8h, v10.8b\n"
-        "uaddw v11.8h, v26.8h, v11.8b\n"
-        "uaddw v13.8h, v26.8h, v13.8b\n"
-        "uaddw v14.8h, v26.8h, v14.8b\n"
-        "uaddw v15.8h, v26.8h, v15.8b\n"
-        "uaddw v17.8h, v26.8h, v17.8b\n"
-        "uaddw v18.8h, v26.8h, v18.8b\n"
-        "uaddw v19.8h, v26.8h, v19.8b\n"
-
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "f\n"
-        "cmp w5, #1\n"
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP ":\n"
-          // Load inputs for 3x4 input window which corresponds to a 1x2 output
-          // window.
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v12.8b}, [x12]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v16.8b}, [x13]\n"
-          "smlal v23.4s, v0.4h, v10.4h\n"
-          "ld1 {v20.8b}, [x14]\n"
-          "smlal2 v24.4s, v0.8h, v10.8h\n"
-          "subs w5, w5, #2\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "cmp w5, #3\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "add %[input_ptr], %[input_ptr], %[input_width_increment]\n"
-          "smlal v23.4s, v1.4h, v11.4h\n"
-          "mov x12, %[input_ptr]\n"
-          "smlal2 v24.4s, v1.8h, v11.8h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x13, %[input_ptr], %[input_row_size]\n"
-          "smlal v23.4s, v2.4h, v12.4h\n"
-          "add x14, x13, %[input_row_size]\n"
-          "smlal2 v24.4s, v2.8h, v12.8h\n"
-          "smlal v21.4s, v3.4h, v13.4h\n"
-          "add x15, x14, %[input_row_size]\n"
-          "smlal2 v22.4s, v3.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v3.4h, v14.4h\n"
-          "smlal2 v24.4s, v3.8h, v14.8h\n"
-          "smlal v21.4s, v4.4h, v14.4h\n"
-          "smlal2 v22.4s, v4.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v4.4h, v15.4h\n"
-          "smlal2 v24.4s, v4.8h, v15.8h\n"
-          "smlal v21.4s, v5.4h, v15.4h\n"
-          "uaddw v16.8h, v26.8h, v16.8b\n"
-          "smlal2 v22.4s, v5.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v5.4h, v16.4h\n"
-          "smlal2 v24.4s, v5.8h, v16.8h\n"
-          "smlal v21.4s, v6.4h, v17.4h\n"
-          "smlal2 v22.4s, v6.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "smlal v21.4s, v7.4h, v18.4h\n"
-          "smlal2 v22.4s, v7.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v19.4h\n"
-          "uaddw v20.8h, v26.8h, v20.8b\n"
-          "smlal2 v22.4s, v8.8h, v19.8h\n"
-          "ld1 {v19.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "and v25.16b, v21.16b, v28.16b\n"
-          "and v29.16b, v22.16b, v28.16b\n"
-          "and v30.16b, v23.16b, v28.16b\n"
-          "and v31.16b, v24.16b, v28.16b\n"
-          "sshr v25.4s, v25.4s, #31\n"
-          "sshr v29.4s, v29.4s, #31\n"
-          "sshr v30.4s, v30.4s, #31\n"
-          "sshr v31.4s, v31.4s, #31\n"
-          "sqadd v21.4s, v21.4s, v25.4s\n"
-          "sqadd v22.4s, v22.4s, v29.4s\n"
-          "dup v29.8h, w2\n"
-          "sqadd v23.4s, v23.4s, v30.4s\n"
-          "dup v30.16b, w4\n"
-          "sqadd v24.4s, v24.4s, v31.4s\n"
-          "dup v31.16b, w0\n"
-          "srshl v21.4s, v21.4s, v28.4s\n"
-          "srshl v22.4s, v22.4s, v28.4s\n"
-          "srshl v23.4s, v23.4s, v28.4s\n"
-          "srshl v24.4s, v24.4s, v28.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "sqxtun2 v21.16b, v23.8h\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "umax v21.16b, v21.16b, v30.16b\n"
-          "umin v21.16b, v21.16b, v31.16b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "st1 {v21.8b}, [%[output_ptr]], x3\n"
-          "uaddw v10.8h, v26.8h, v10.8b\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [%[output_ptr]], x3\n"
-          "uaddw v11.8h, v26.8h, v11.8b\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "uaddw v13.8h, v26.8h, v13.8b\n"
-          "uaddw v14.8h, v26.8h, v14.8b\n"
-          "uaddw v15.8h, v26.8h, v15.8b\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "uaddw v16.8h, v26.8h, v16.8b\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-          "uaddw v17.8h, v26.8h, v17.8b\n"
-          "uaddw v18.8h, v26.8h, v18.8b\n"
-          "uaddw v19.8h, v26.8h, v19.8b\n"
-          "uaddw v20.8h, v26.8h, v20.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "b\n"
-
-        // At this point, there will be one of 2 width or 1 width leftover,
-        // not both.
-        "cmp w5, #2\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        // Handle last two horizontal outputs if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER ":\n"
-        "smlal v21.4s, v0.4h, v9.4h\n"
-        "ld1 {v12.8b}, [x12], %[input_depth]\n"
-        "smlal2 v22.4s, v0.8h, v9.8h\n"
-        "ld1 {v16.8b}, [x13], %[input_depth]\n"
-        "smlal v23.4s, v0.4h, v10.4h\n"
-        "ld1 {v20.8b}, [x14], %[input_depth]\n"
-        "smlal2 v24.4s, v0.8h, v10.8h\n"
-        "smlal v21.4s, v1.4h, v10.4h\n"
-        "smlal2 v22.4s, v1.8h, v10.8h\n"
-        "smlal v23.4s, v1.4h, v11.4h\n"
-        "smlal2 v24.4s, v1.8h, v11.8h\n"
-        "smlal v21.4s, v2.4h, v11.4h\n"
-        "uaddw v12.8h, v26.8h, v12.8b\n"
-        "smlal2 v22.4s, v2.8h, v11.8h\n"
-        "smlal v23.4s, v2.4h, v12.4h\n"
-        "smlal2 v24.4s, v2.8h, v12.8h\n"
-        "smlal v21.4s, v3.4h, v13.4h\n"
-        "smlal2 v22.4s, v3.8h, v13.8h\n"
-        "smlal v23.4s, v3.4h, v14.4h\n"
-        "smlal2 v24.4s, v3.8h, v14.8h\n"
-        "smlal v21.4s, v4.4h, v14.4h\n"
-        "smlal2 v22.4s, v4.8h, v14.8h\n"
-        "smlal v23.4s, v4.4h, v15.4h\n"
-        "smlal2 v24.4s, v4.8h, v15.8h\n"
-        "smlal v21.4s, v5.4h, v15.4h\n"
-        "uaddw v16.8h, v26.8h, v16.8b\n"
-        "smlal2 v22.4s, v5.8h, v15.8h\n"
-        "smlal v23.4s, v5.4h, v16.4h\n"
-        "smlal2 v24.4s, v5.8h, v16.8h\n"
-        "smlal v21.4s, v6.4h, v17.4h\n"
-        "smlal2 v22.4s, v6.8h, v17.8h\n"
-        "smlal v23.4s, v6.4h, v18.4h\n"
-        "smlal2 v24.4s, v6.8h, v18.8h\n"
-        "smlal v21.4s, v7.4h, v18.4h\n"
-        "smlal2 v22.4s, v7.8h, v18.8h\n"
-        "smlal v23.4s, v7.4h, v19.4h\n"
-        "smlal2 v24.4s, v7.8h, v19.8h\n"
-        "smlal v21.4s, v8.4h, v19.4h\n"
-        "uaddw v20.8h, v26.8h, v20.8b\n"
-        "smlal2 v22.4s, v8.8h, v19.8h\n"
-        "smlal v23.4s, v8.4h, v20.4h\n"
-        "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-        "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-        "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-        "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-        "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-        "and v25.16b, v21.16b, v28.16b\n"
-        "and v29.16b, v22.16b, v28.16b\n"
-        "and v30.16b, v23.16b, v28.16b\n"
-        "and v31.16b, v24.16b, v28.16b\n"
-        "sshr v25.4s, v25.4s, #31\n"
-        "sshr v29.4s, v29.4s, #31\n"
-        "sshr v30.4s, v30.4s, #31\n"
-        "sshr v31.4s, v31.4s, #31\n"
-        "sqadd v21.4s, v21.4s, v25.4s\n"
-        "sqadd v22.4s, v22.4s, v29.4s\n"
-        "dup v29.8h, w2\n"
-        "sqadd v23.4s, v23.4s, v30.4s\n"
-        "dup v30.16b, w4\n"
-        "sqadd v24.4s, v24.4s, v31.4s\n"
-        "dup v31.16b, w0\n"
-        "srshl v21.4s, v21.4s, v28.4s\n"
-        "srshl v22.4s, v22.4s, v28.4s\n"
-        "srshl v23.4s, v23.4s, v28.4s\n"
-        "srshl v24.4s, v24.4s, v28.4s\n"
-        "sqxtn v21.4h, v21.4s\n"
-        "sqxtn2 v21.8h, v22.4s\n"
-        "sqxtn v23.4h, v23.4s\n"
-        "sqxtn2 v23.8h, v24.4s\n"
-        "sqadd v21.8h, v21.8h, v29.8h\n"
-        "sqadd v23.8h, v23.8h, v29.8h\n"
-        "sqxtun v21.8b, v21.8h\n"
-        "sqxtun2 v21.16b, v23.8h\n"
-        "umax v21.16b, v21.16b, v30.16b\n"
-        "umin v21.16b, v21.16b, v31.16b\n"
-        "st1 {v21.8b}, [%[output_ptr]], x3\n"
-        "mov v23.d[0], v21.d[1]\n"
-        "st1 {v23.8b}, [%[output_ptr]], x3\n"
-        "b " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        // Handle bottom right output if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER ":\n"
-        "smlal v21.4s, v0.4h, v9.4h\n"
-        "smlal2 v22.4s, v0.8h, v9.8h\n"
-        "smlal v21.4s, v1.4h, v10.4h\n"
-        "smlal2 v22.4s, v1.8h, v10.8h\n"
-        "smlal v21.4s, v2.4h, v11.4h\n"
-        "smlal2 v22.4s, v2.8h, v11.8h\n"
-        "smlal v21.4s, v3.4h, v13.4h\n"
-        "smlal2 v22.4s, v3.8h, v13.8h\n"
-        "smlal v21.4s, v4.4h, v14.4h\n"
-        "smlal2 v22.4s, v4.8h, v14.8h\n"
-        "smlal v21.4s, v5.4h, v15.4h\n"
-        "smlal2 v22.4s, v5.8h, v15.8h\n"
-        "smlal v21.4s, v6.4h, v17.4h\n"
-        "smlal2 v22.4s, v6.8h, v17.8h\n"
-        "smlal v21.4s, v7.4h, v18.4h\n"
-        "smlal2 v22.4s, v7.8h, v18.8h\n"
-        "smlal v21.4s, v8.4h, v19.4h\n"
-        "smlal2 v22.4s, v8.8h, v19.8h\n"
-
-        "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-        "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-        "and v9.16b, v21.16b, v28.16b\n"
-        "and v12.16b, v22.16b, v28.16b\n"
-        "sshr v9.4s, v9.4s, #31\n"
-        "sshr v12.4s, v12.4s, #31\n"
-        "sqadd v21.4s, v21.4s, v9.4s\n"
-        "sqadd v22.4s, v22.4s, v12.4s\n"
-        "srshl v21.4s, v21.4s, v28.4s\n"
-        "srshl v22.4s, v22.4s, v28.4s\n"
-        "sqxtn v21.4h, v21.4s\n"
-        "sqxtn2 v21.8h, v22.4s\n"
-        "sqadd v21.8h, v21.8h, v29.8h\n"
-        "sqxtun v21.8b, v21.8h\n"
-        "umax v21.8b, v21.8b, v30.8b\n"
-        "umin v21.8b, v21.8b, v31.8b\n"
-        "st1 {v21.8b}, [%[output_ptr]]\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_END ":\n"
-    :
-    // Outputs.
-    [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-    [output_ptr] "+r"(output_ptr),
-    [output_window_height] "+r"(output_window_height)
-    :
-    // Inputs.
-    [bias_ptr] "r"(bias_ptr), [input_row_size] "r"(input_row_size),
-    [input_depth] "r"(input_depth),
-    [output_window_width] "r"(output_window_width),
-    [input_width_increment] "r"(input_width_increment),
-    [input_height_increment] "r"(input_height_increment),
-    [output_height_increment] "r"(output_height_increment),
-    [params_ptr] "r"(params_ptr)
-    :
-    // Clobbers.
-    "cc", "memory",
-    // We use these NEON registers.
-    "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
-    "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-    "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29",
-    "v30", "v31",
-    // We use these general-purpose registers.
-    "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
-    "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_END
-  }
-};
-
-template <>
-struct DepthwiseConvWindow {
- public:
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         int64_t input_depth, int64_t input_row_size,
-                         int32 output_window_height, int32 output_window_width,
-                         const DepthwiseConvParams* params_ptr) {
-    const int64_t input_width_increment = 2 * input_depth;
-    const int64_t input_height_increment = 2 * input_row_size;
-    const int64_t output_height_increment = 2 * params_ptr->output_row_size;
-
-#define DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "1"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "2"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "3"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "4"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "5"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "6"
-#define DEPTHWISECONV_LABEL_HEIGHT_1 "7"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "8"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "9"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "10"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_END "11"
-
-    asm volatile(
-        // Performs depthwise convolutions for a window specified by
-        // |output_window_height| and |output_window_width|. The inner-most loop
-        // processes 2x2 outputs, and any leftovers at the end.
-        //
-        // Algorithm works as follows:
-        //
-        //   1. Load filters of 8 depth (8x3x3). Registers v0--v8 hold filter
-        //      values.
-        //   2. For 2 output heights at a time:
-        //        i.  For 2 output widths at a time, load inputs for a 2x1 (2
-        //            height, 1 width) output window (4x3 input window).
-        //            Registers v9--v20 hold input values. Mul-add with
-        //            accumulators v21--v24. Then run activation, downquantize
-        //            and store. Repeat for the next 2x1 output window,
-        //            leveraging overlapping inputs.
-        //        ii. Handle single leftover width if exists.
-        //   3. Handle single leftover height if exists.
-        //        i.  For 2 output widths at a time, load inputs for a 1x2 (1
-        //            height, 2 width) output window (3x4 input window).
-        //            Registers v9--v20 hold input values. Mul-add with
-        //            accumulators v21--v24. Then run activation, downquantize
-        //            and store. Repeat for the next 1x2 output window,
-        //            leveraging overlapping inputs.
-        //        ii. Handle single leftover width if exists.
-        //
-        // Loads are placed as soon as the register is no longer needed and
-        // interleaved with arithmetic operations to take advantage of
-        // dual-issue pipelines. We also add input offsets as far from the loads
-        // as possible to give loads enough cycles to fetch data from memory.
-
-        // Set "constant" registers. These registers may be replaced with temp
-        // values from time to time when there are not enough NEON registers.
-        // We use x9--x15 general purpose registers as they are caller-saved
-        // temporary registers (see
-        // http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf).  // NOLINT
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr x3, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "cmp %w[output_window_height], #2\n"
-        "dup v26.8h, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "ldr w2, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "dup v29.8h, w2\n"
-        "ldr w4, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v30.16b, w4\n"
-        "ldr w0, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v31.16b, w0\n"
-        "dup v28.4s, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-        "add x10, %[bias_ptr], #16\n"
-        "ldr x1, [%[params_ptr], #" STR(OFFSET_OUTPUT_ROW_SIZE) "]\n"
-        "dup v9.8h, w9\n"
-
-        // Load filters and add offsets.
-        "ld1 {v0.8b}, [%[filter_ptr]], x3\n"
-        "ld1 {v1.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v0.8h, v9.8h, v0.8b\n"
-        "ld1 {v2.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v1.8h, v9.8h, v1.8b\n"
-        "ld1 {v3.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v2.8h, v9.8h, v2.8b\n"
-        "ld1 {v4.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v3.8h, v9.8h, v3.8b\n"
-        "ld1 {v5.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v4.8h, v9.8h, v4.8b\n"
-        "ld1 {v6.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v5.8h, v9.8h, v5.8b\n"
-        "ld1 {v7.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v6.8h, v9.8h, v6.8b\n"
-        "ld1 {v8.8b}, [%[filter_ptr]], x3\n"
-        "uaddw v7.8h, v9.8h, v7.8b\n"
-        "uaddw v8.8h, v9.8h, v8.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_2_LOOP ":\n"
-          // This loop processes 2x2 outputs. To avoid register exhaustion,
-          // inputs for the left 2 outputs are loaded first, then the right
-          // two outputs.
-          "mov x11, %[input_ptr]\n"
-          "mov x12, x11\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "add x13, x11, %[input_row_size]\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "add x14, x13, %[input_row_size]\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x15, x14, %[input_row_size]\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "mov w5, %w[output_window_width]\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "mov x6, %[output_ptr]\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "add x7, %[output_ptr], x1\n"
-          "ld1 {v15.8b}, [x14], %[input_depth]\n"
-          // The height 2 / width 2 loop loads an extra 2x1 outputs (2 height,
-          // 1 width) in anticipation for the next iteration. Make sure
-          // |output_window_width| is large enough to handle the additional
-          // loads, otherwise jump to specific the appropriate label to handle
-          // smaller widths.
-          "cmp w5, #2\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "ld1 {v16.8b}, [x14], %[input_depth]\n"
-          "uaddw v10.8h, v26.8h, v10.8b\n"
-          "ld1 {v17.8b}, [x14], %[input_depth]\n"
-          "uaddw v11.8h, v26.8h, v11.8b\n"
-          "ld1 {v18.8b}, [x15], %[input_depth]\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "ld1 {v19.8b}, [x15], %[input_depth]\n"
-          "uaddw v13.8h, v26.8h, v13.8b\n"
-          "ld1 {v20.8b}, [x15], %[input_depth]\n"
-          "uaddw v14.8h, v26.8h, v14.8b\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "uaddw v15.8h, v26.8h, v15.8b\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "uaddw v16.8h, v26.8h, v16.8b\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-          "uaddw v17.8h, v26.8h, v17.8b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "uaddw v18.8h, v26.8h, v18.8b\n"
-          "uaddw v19.8h, v26.8h, v19.8b\n"
-          "uaddw v20.8h, v26.8h, v20.8b\n"
-
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "f\n"
-          "cmp w5, #1\n"
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          //"loop_%=:\n"
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP ":\n"
-            // Mul-add left outputs.
-            "smlal v21.4s, v0.4h, v9.4h\n"
-            "subs w5, w5, #2\n"
-            "smlal2 v22.4s, v0.8h, v9.8h\n"
-            "cmp w5, #3\n"
-            "smlal v23.4s, v0.4h, v12.4h\n"
-            "ld1 {v9.8b}, [x12]\n"
-            "smlal2 v24.4s, v0.8h, v12.8h\n"
-            "smlal v21.4s, v1.4h, v10.4h\n"
-            "smlal2 v22.4s, v1.8h, v10.8h\n"
-            "smlal v23.4s, v1.4h, v13.4h\n"
-            "smlal2 v24.4s, v1.8h, v13.8h\n"
-            "smlal v21.4s, v2.4h, v11.4h\n"
-            "smlal2 v22.4s, v2.8h, v11.8h\n"
-            "smlal v23.4s, v2.4h, v14.4h\n"
-            "smlal2 v24.4s, v2.8h, v14.8h\n"
-            "smlal v21.4s, v3.4h, v12.4h\n"
-            "smlal2 v22.4s, v3.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x13]\n"
-            "smlal v23.4s, v3.4h, v15.4h\n"
-            "smlal2 v24.4s, v3.8h, v15.8h\n"
-            "smlal v21.4s, v4.4h, v13.4h\n"
-            "smlal2 v22.4s, v4.8h, v13.8h\n"
-            "smlal v23.4s, v4.4h, v16.4h\n"
-            "smlal2 v24.4s, v4.8h, v16.8h\n"
-            "smlal v21.4s, v5.4h, v14.4h\n"
-            "smlal2 v22.4s, v5.8h, v14.8h\n"
-            "smlal v23.4s, v5.4h, v17.4h\n"
-            "smlal2 v24.4s, v5.8h, v17.8h\n"
-            "smlal v21.4s, v6.4h, v15.4h\n"
-            "smlal2 v22.4s, v6.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x14]\n"
-            "smlal v23.4s, v6.4h, v18.4h\n"
-            "smlal2 v24.4s, v6.8h, v18.8h\n"
-            "ld1 {v18.8b}, [x15]\n"
-            "smlal v21.4s, v7.4h, v16.4h\n"
-            "smlal2 v22.4s, v7.8h, v16.8h\n"
-            "smlal v23.4s, v7.4h, v19.4h\n"
-            "smlal2 v24.4s, v7.8h, v19.8h\n"
-            "smlal v21.4s, v8.4h, v17.4h\n"
-            "smlal2 v22.4s, v8.8h, v17.8h\n"
-            "smlal v23.4s, v8.4h, v20.4h\n"
-            "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-            "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-            "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-            "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-            "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-            "sqrshl v21.4s, v21.4s, v28.4s\n"
-            "sqrshl v22.4s, v22.4s, v28.4s\n"
-            "sqrshl v23.4s, v23.4s, v28.4s\n"
-            "sqrshl v24.4s, v24.4s, v28.4s\n"
-            "sqxtn v21.4h, v21.4s\n"
-            "sqxtn2 v21.8h, v22.4s\n"
-            "sqxtn v23.4h, v23.4s\n"
-            "sqxtn2 v23.8h, v24.4s\n"
-            "sqadd v21.8h, v21.8h, v29.8h\n"
-            "sqadd v23.8h, v23.8h, v29.8h\n"
-            "sqxtun v21.8b, v21.8h\n"
-            "sqxtun2 v21.16b, v23.8h\n"
-            "ld1 {v22.4s}, [x10]\n"
-            "umax v21.16b, v21.16b, v30.16b\n"
-            "umin v21.16b, v21.16b, v31.16b\n"
-            "ld1 {v24.4s}, [x10]\n"
-            "uaddw v9.8h, v26.8h, v9.8b\n"
-            "st1 {v21.8b}, [x6], x3\n"
-            "uaddw v12.8h, v26.8h, v12.8b\n"
-            "mov v23.d[0], v21.d[1]\n"
-            "st1 {v23.8b}, [x7], x3\n"
-            "uaddw v15.8h, v26.8h, v15.8b\n"
-            "ld1 {v21.4s}, [%[bias_ptr]]\n"
-            "uaddw v18.8h, v26.8h, v18.8b\n"
-            "ld1 {v23.4s}, [%[bias_ptr]]\n"
-
-            // Mul-add right outputs.
-            "smlal v21.4s, v0.4h, v10.4h\n"
-            "add x11, x11, %[input_width_increment]\n"
-            "smlal2 v22.4s, v0.8h, v10.8h\n"
-            "mov x12, x11\n"
-            "smlal v23.4s, v0.4h, v13.4h\n"
-            "add x13, x11, %[input_row_size]\n"
-            "smlal2 v24.4s, v0.8h, v13.8h\n"
-            "add x14, x13, %[input_row_size]\n"
-            "smlal v21.4s, v1.4h, v11.4h\n"
-            "add x15, x14, %[input_row_size]\n"
-            "smlal2 v22.4s, v1.8h, v11.8h\n"
-            "smlal v23.4s, v1.4h, v14.4h\n"
-            "smlal2 v24.4s, v1.8h, v14.8h\n"
-            "smlal v21.4s, v2.4h, v9.4h\n"
-            "smlal2 v22.4s, v2.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v2.4h, v12.4h\n"
-            "ld1 {v10.8b}, [x12], %[input_depth]\n"
-            "smlal2 v24.4s, v2.8h, v12.8h\n"
-            "ld1 {v11.8b}, [x12], %[input_depth]\n"
-            "smlal v21.4s, v3.4h, v13.4h\n"
-            "smlal2 v22.4s, v3.8h, v13.8h\n"
-            "smlal v23.4s, v3.4h, v16.4h\n"
-            "smlal2 v24.4s, v3.8h, v16.8h\n"
-            "smlal v21.4s, v4.4h, v14.4h\n"
-            "smlal2 v22.4s, v4.8h, v14.8h\n"
-            "smlal v23.4s, v4.4h, v17.4h\n"
-            "smlal2 v24.4s, v4.8h, v17.8h\n"
-            "smlal v21.4s, v5.4h, v12.4h\n"
-            "smlal2 v22.4s, v5.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v5.4h, v15.4h\n"
-            "ld1 {v13.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v5.8h, v15.8h\n"
-            "ld1 {v14.8b}, [x13], %[input_depth]\n"
-            "smlal v21.4s, v6.4h, v16.4h\n"
-            "smlal2 v22.4s, v6.8h, v16.8h\n"
-            "smlal v23.4s, v6.4h, v19.4h\n"
-            "smlal2 v24.4s, v6.8h, v19.8h\n"
-            "smlal v21.4s, v7.4h, v17.4h\n"
-            "smlal2 v22.4s, v7.8h, v17.8h\n"
-            "smlal v23.4s, v7.4h, v20.4h\n"
-            "smlal2 v24.4s, v7.8h, v20.8h\n"
-            "smlal v21.4s, v8.4h, v15.4h\n"
-            "smlal2 v22.4s, v8.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x14], %[input_depth]\n"
-            "smlal v23.4s, v8.4h, v18.4h\n"
-            "ld1 {v16.8b}, [x14], %[input_depth]\n"
-            "smlal2 v24.4s, v8.8h, v18.8h\n"
-            "ld1 {v17.8b}, [x14], %[input_depth]\n"
-
-            "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-            "ld1 {v18.8b}, [x15], %[input_depth]\n"
-            "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-            "ld1 {v19.8b}, [x15], %[input_depth]\n"
-            "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-            "ld1 {v20.8b}, [x15], %[input_depth]\n"
-            "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-            "sqrshl v21.4s, v21.4s, v28.4s\n"
-            "sqrshl v22.4s, v22.4s, v28.4s\n"
-            "sqrshl v23.4s, v23.4s, v28.4s\n"
-            "sqrshl v24.4s, v24.4s, v28.4s\n"
-            "sqxtn v21.4h, v21.4s\n"
-            "sqxtn2 v21.8h, v22.4s\n"
-            "sqxtn v23.4h, v23.4s\n"
-            "sqxtn2 v23.8h, v24.4s\n"
-            "sqadd v21.8h, v21.8h, v29.8h\n"
-            "sqadd v23.8h, v23.8h, v29.8h\n"
-            "sqxtun v21.8b, v21.8h\n"
-            "sqxtun2 v21.16b, v23.8h\n"
-            "ld1 {v22.4s}, [x10]\n"
-            "umax v21.16b, v21.16b, v30.16b\n"
-            "umin v21.16b, v21.16b, v31.16b\n"
-            "ld1 {v24.4s}, [x10]\n"
-            "uaddw v9.8h, v26.8h, v9.8b\n"
-            "st1 {v21.8b}, [x6], x3\n"
-            "uaddw v10.8h, v26.8h, v10.8b\n"
-            "mov v23.d[0], v21.d[1]\n"
-            "st1 {v23.8b}, [x7], x3\n"
-            "uaddw v11.8h, v26.8h, v11.8b\n"
-            "uaddw v12.8h, v26.8h, v12.8b\n"
-            "uaddw v13.8h, v26.8h, v13.8b\n"
-            "uaddw v14.8h, v26.8h, v14.8b\n"
-            "uaddw v15.8h, v26.8h, v15.8b\n"
-            "ld1 {v21.4s}, [%[bias_ptr]]\n"
-            "uaddw v16.8h, v26.8h, v16.8b\n"
-            "ld1 {v23.4s}, [%[bias_ptr]]\n"
-            "uaddw v17.8h, v26.8h, v17.8b\n"
-            "uaddw v18.8h, v26.8h, v18.8b\n"
-            "uaddw v19.8h, v26.8h, v19.8b\n"
-            "uaddw v20.8h, v26.8h, v20.8b\n"
-
-            "bge " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "b\n"
-
-          // At this point, there will be one of 2 width or 1 width leftover,
-          // not both.
-          "cmp w5, #2\n"
-          "blt " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          // Handle last 2 columns if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER ":\n"
-          // Mul-add left outputs.
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "ld1 {v9.8b}, [x12]\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "smlal v23.4s, v2.4h, v14.4h\n"
-          "smlal2 v24.4s, v2.8h, v14.8h\n"
-          "smlal v21.4s, v3.4h, v12.4h\n"
-          "smlal2 v22.4s, v3.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x13]\n"
-          "smlal v23.4s, v3.4h, v15.4h\n"
-          "smlal2 v24.4s, v3.8h, v15.8h\n"
-          "smlal v21.4s, v4.4h, v13.4h\n"
-          "smlal2 v22.4s, v4.8h, v13.8h\n"
-          "smlal v23.4s, v4.4h, v16.4h\n"
-          "smlal2 v24.4s, v4.8h, v16.8h\n"
-          "smlal v21.4s, v5.4h, v14.4h\n"
-          "smlal2 v22.4s, v5.8h, v14.8h\n"
-          "smlal v23.4s, v5.4h, v17.4h\n"
-          "smlal2 v24.4s, v5.8h, v17.8h\n"
-          "smlal v21.4s, v6.4h, v15.4h\n"
-          "smlal2 v22.4s, v6.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x14]\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x15]\n"
-          "smlal v21.4s, v7.4h, v16.4h\n"
-          "smlal2 v22.4s, v7.8h, v16.8h\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "sqrshl v21.4s, v21.4s, v28.4s\n"
-          "sqrshl v22.4s, v22.4s, v28.4s\n"
-          "sqrshl v23.4s, v23.4s, v28.4s\n"
-          "sqrshl v24.4s, v24.4s, v28.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "sqxtun2 v21.16b, v23.8h\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "umax v21.16b, v21.16b, v30.16b\n"
-          "umin v21.16b, v21.16b, v31.16b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "st1 {v21.8b}, [x6], x3\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "st1 {v23.8b}, [x7], x3\n"
-          "uaddw v15.8h, v26.8h, v15.8b\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "uaddw v18.8h, v26.8h, v18.8b\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-
-          // Mul-add right outputs.
-          "smlal v21.4s, v0.4h, v10.4h\n"
-          "smlal2 v22.4s, v0.8h, v10.8h\n"
-          "smlal v23.4s, v0.4h, v13.4h\n"
-          "smlal2 v24.4s, v0.8h, v13.8h\n"
-          "smlal v21.4s, v1.4h, v11.4h\n"
-          "smlal2 v22.4s, v1.8h, v11.8h\n"
-          "smlal v23.4s, v1.4h, v14.4h\n"
-          "smlal2 v24.4s, v1.8h, v14.8h\n"
-          "smlal v21.4s, v2.4h, v9.4h\n"
-          "smlal2 v22.4s, v2.8h, v9.8h\n"
-          "smlal v23.4s, v2.4h, v12.4h\n"
-          "smlal2 v24.4s, v2.8h, v12.8h\n"
-          "smlal v21.4s, v3.4h, v13.4h\n"
-          "smlal2 v22.4s, v3.8h, v13.8h\n"
-          "smlal v23.4s, v3.4h, v16.4h\n"
-          "smlal2 v24.4s, v3.8h, v16.8h\n"
-          "smlal v21.4s, v4.4h, v14.4h\n"
-          "smlal2 v22.4s, v4.8h, v14.8h\n"
-          "smlal v23.4s, v4.4h, v17.4h\n"
-          "smlal2 v24.4s, v4.8h, v17.8h\n"
-          "smlal v21.4s, v5.4h, v12.4h\n"
-          "smlal2 v22.4s, v5.8h, v12.8h\n"
-          "smlal v23.4s, v5.4h, v15.4h\n"
-          "smlal2 v24.4s, v5.8h, v15.8h\n"
-          "smlal v21.4s, v6.4h, v16.4h\n"
-          "smlal2 v22.4s, v6.8h, v16.8h\n"
-          "smlal v23.4s, v6.4h, v19.4h\n"
-          "smlal2 v24.4s, v6.8h, v19.8h\n"
-          "smlal v21.4s, v7.4h, v17.4h\n"
-          "smlal2 v22.4s, v7.8h, v17.8h\n"
-          "smlal v23.4s, v7.4h, v20.4h\n"
-          "smlal2 v24.4s, v7.8h, v20.8h\n"
-          "smlal v21.4s, v8.4h, v15.4h\n"
-          "smlal2 v22.4s, v8.8h, v15.8h\n"
-          "smlal v23.4s, v8.4h, v18.4h\n"
-          "smlal2 v24.4s, v8.8h, v18.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "sqrshl v21.4s, v21.4s, v28.4s\n"
-          "sqrshl v22.4s, v22.4s, v28.4s\n"
-          "sqrshl v23.4s, v23.4s, v28.4s\n"
-          "sqrshl v24.4s, v24.4s, v28.4s\n"
-
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "sqxtun2 v21.16b, v23.8h\n"
-          "umax v21.16b, v21.16b, v30.16b\n"
-          "umin v21.16b, v21.16b, v31.16b\n"
-          "st1 {v21.8b}, [x6], x3\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [x7], x3\n"
-          "b " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "f\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER ":\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "smlal v23.4s, v2.4h, v14.4h\n"
-          "smlal2 v24.4s, v2.8h, v14.8h\n"
-          "smlal v21.4s, v3.4h, v12.4h\n"
-          "smlal2 v22.4s, v3.8h, v12.8h\n"
-          "smlal v23.4s, v3.4h, v15.4h\n"
-          "smlal2 v24.4s, v3.8h, v15.8h\n"
-          "smlal v21.4s, v4.4h, v13.4h\n"
-          "smlal2 v22.4s, v4.8h, v13.8h\n"
-          "smlal v23.4s, v4.4h, v16.4h\n"
-          "smlal2 v24.4s, v4.8h, v16.8h\n"
-          "smlal v21.4s, v5.4h, v14.4h\n"
-          "smlal2 v22.4s, v5.8h, v14.8h\n"
-          "smlal v23.4s, v5.4h, v17.4h\n"
-          "smlal2 v24.4s, v5.8h, v17.8h\n"
-          "smlal v21.4s, v6.4h, v15.4h\n"
-          "smlal2 v22.4s, v6.8h, v15.8h\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "smlal v21.4s, v7.4h, v16.4h\n"
-          "smlal2 v22.4s, v7.8h, v16.8h\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "sqrshl v21.4s, v21.4s, v28.4s\n"
-          "sqrshl v22.4s, v22.4s, v28.4s\n"
-          "sqrshl v23.4s, v23.4s, v28.4s\n"
-          "sqrshl v24.4s, v24.4s, v28.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "sqxtun2 v21.16b, v23.8h\n"
-          "umax v21.16b, v21.16b, v30.16b\n"
-          "umin v21.16b, v21.16b, v31.16b\n"
-          "st1 {v21.8b}, [x6], x3\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [x7], x3\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP ":\n"
-          "subs %w[output_window_height], %w[output_window_height], #2\n"
-          "add %[input_ptr], %[input_ptr], %[input_height_increment]\n"
-          "cmp %w[output_window_height], #2\n"
-          "add %[output_ptr], %[output_ptr], %[output_height_increment]\n"
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP ":\n"
-        "cmp %w[output_window_height], #1\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_1 ":\n"
-        "mov x12, %[input_ptr]\n"
-        "ld1 {v9.8b}, [x12], %[input_depth]\n"
-        "add x13, %[input_ptr], %[input_row_size]\n"
-        "ld1 {v10.8b}, [x12], %[input_depth]\n"
-        "add x14, x13, %[input_row_size]\n"
-        "ld1 {v11.8b}, [x12], %[input_depth]\n"
-        "add x15, x14, %[input_row_size]\n"
-        "mov w5, %w[output_window_width]\n"
-        "ld1 {v13.8b}, [x13], %[input_depth]\n"
-        "mov x6, %[output_ptr]\n"
-        "ld1 {v14.8b}, [x13], %[input_depth]\n"
-        "add x7, %[output_ptr], x1\n"
-        "ld1 {v15.8b}, [x13], %[input_depth]\n"
-        // The height 1 / width 2 loop loads an extra 1x1 output in anticipation
-        // for the next iteration. Make sure |output_window_width| is large
-        // enough to handle the additional load, otherwise jump to the
-        // appropriate label to handle smaller widths.
-        "cmp w5, #2\n"
-        "ld1 {v17.8b}, [x14], %[input_depth]\n"
-        "ld1 {v18.8b}, [x14], %[input_depth]\n"
-        "ld1 {v19.8b}, [x14], %[input_depth]\n"
-        "ld1 {v21.4s}, [%[bias_ptr]]\n"
-        "ld1 {v22.4s}, [x10]\n"
-        "ld1 {v23.4s}, [%[bias_ptr]]\n"
-        "ld1 {v24.4s}, [x10]\n"
-
-        "uaddw v9.8h, v26.8h, v9.8b\n"
-        "uaddw v10.8h, v26.8h, v10.8b\n"
-        "uaddw v11.8h, v26.8h, v11.8b\n"
-        "uaddw v13.8h, v26.8h, v13.8b\n"
-        "uaddw v14.8h, v26.8h, v14.8b\n"
-        "uaddw v15.8h, v26.8h, v15.8b\n"
-        "uaddw v17.8h, v26.8h, v17.8b\n"
-        "uaddw v18.8h, v26.8h, v18.8b\n"
-        "uaddw v19.8h, v26.8h, v19.8b\n"
-
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "f\n"
-        "cmp w5, #1\n"
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP ":\n"
-          // Load inputs for 3x4 input window which corresponds to a 1x2 output
-          // window.
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v12.8b}, [x12]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v16.8b}, [x13]\n"
-          "smlal v23.4s, v0.4h, v10.4h\n"
-          "ld1 {v20.8b}, [x14]\n"
-          "smlal2 v24.4s, v0.8h, v10.8h\n"
-          "subs w5, w5, #2\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "cmp w5, #3\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "add %[input_ptr], %[input_ptr], %[input_width_increment]\n"
-          "smlal v23.4s, v1.4h, v11.4h\n"
-          "mov x12, %[input_ptr]\n"
-          "smlal2 v24.4s, v1.8h, v11.8h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x13, %[input_ptr], %[input_row_size]\n"
-          "smlal v23.4s, v2.4h, v12.4h\n"
-          "add x14, x13, %[input_row_size]\n"
-          "smlal2 v24.4s, v2.8h, v12.8h\n"
-          "smlal v21.4s, v3.4h, v13.4h\n"
-          "add x15, x14, %[input_row_size]\n"
-          "smlal2 v22.4s, v3.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v3.4h, v14.4h\n"
-          "smlal2 v24.4s, v3.8h, v14.8h\n"
-          "smlal v21.4s, v4.4h, v14.4h\n"
-          "smlal2 v22.4s, v4.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v4.4h, v15.4h\n"
-          "smlal2 v24.4s, v4.8h, v15.8h\n"
-          "smlal v21.4s, v5.4h, v15.4h\n"
-          "uaddw v16.8h, v26.8h, v16.8b\n"
-          "smlal2 v22.4s, v5.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v5.4h, v16.4h\n"
-          "smlal2 v24.4s, v5.8h, v16.8h\n"
-          "smlal v21.4s, v6.4h, v17.4h\n"
-          "smlal2 v22.4s, v6.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "smlal v21.4s, v7.4h, v18.4h\n"
-          "smlal2 v22.4s, v7.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v19.4h\n"
-          "uaddw v20.8h, v26.8h, v20.8b\n"
-          "smlal2 v22.4s, v8.8h, v19.8h\n"
-          "ld1 {v19.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "sqrshl v21.4s, v21.4s, v28.4s\n"
-          "sqrshl v22.4s, v22.4s, v28.4s\n"
-          "sqrshl v23.4s, v23.4s, v28.4s\n"
-          "sqrshl v24.4s, v24.4s, v28.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "sqxtun2 v21.16b, v23.8h\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "umax v21.16b, v21.16b, v30.16b\n"
-          "umin v21.16b, v21.16b, v31.16b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "st1 {v21.8b}, [%[output_ptr]], x3\n"
-          "uaddw v10.8h, v26.8h, v10.8b\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [%[output_ptr]], x3\n"
-          "uaddw v11.8h, v26.8h, v11.8b\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "uaddw v13.8h, v26.8h, v13.8b\n"
-          "uaddw v14.8h, v26.8h, v14.8b\n"
-          "uaddw v15.8h, v26.8h, v15.8b\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "uaddw v16.8h, v26.8h, v16.8b\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-          "uaddw v17.8h, v26.8h, v17.8b\n"
-          "uaddw v18.8h, v26.8h, v18.8b\n"
-          "uaddw v19.8h, v26.8h, v19.8b\n"
-          "uaddw v20.8h, v26.8h, v20.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "b\n"
-
-        // At this point, there will be one of 2 width or 1 width leftover,
-        // not both.
-        "cmp w5, #2\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        // Handle last two horizontal outputs if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER ":\n"
-        "smlal v21.4s, v0.4h, v9.4h\n"
-        "ld1 {v12.8b}, [x12], %[input_depth]\n"
-        "smlal2 v22.4s, v0.8h, v9.8h\n"
-        "ld1 {v16.8b}, [x13], %[input_depth]\n"
-        "smlal v23.4s, v0.4h, v10.4h\n"
-        "ld1 {v20.8b}, [x14], %[input_depth]\n"
-        "smlal2 v24.4s, v0.8h, v10.8h\n"
-        "smlal v21.4s, v1.4h, v10.4h\n"
-        "smlal2 v22.4s, v1.8h, v10.8h\n"
-        "smlal v23.4s, v1.4h, v11.4h\n"
-        "smlal2 v24.4s, v1.8h, v11.8h\n"
-        "smlal v21.4s, v2.4h, v11.4h\n"
-        "uaddw v12.8h, v26.8h, v12.8b\n"
-        "smlal2 v22.4s, v2.8h, v11.8h\n"
-        "smlal v23.4s, v2.4h, v12.4h\n"
-        "smlal2 v24.4s, v2.8h, v12.8h\n"
-        "smlal v21.4s, v3.4h, v13.4h\n"
-        "smlal2 v22.4s, v3.8h, v13.8h\n"
-        "smlal v23.4s, v3.4h, v14.4h\n"
-        "smlal2 v24.4s, v3.8h, v14.8h\n"
-        "smlal v21.4s, v4.4h, v14.4h\n"
-        "smlal2 v22.4s, v4.8h, v14.8h\n"
-        "smlal v23.4s, v4.4h, v15.4h\n"
-        "smlal2 v24.4s, v4.8h, v15.8h\n"
-        "smlal v21.4s, v5.4h, v15.4h\n"
-        "uaddw v16.8h, v26.8h, v16.8b\n"
-        "smlal2 v22.4s, v5.8h, v15.8h\n"
-        "smlal v23.4s, v5.4h, v16.4h\n"
-        "smlal2 v24.4s, v5.8h, v16.8h\n"
-        "smlal v21.4s, v6.4h, v17.4h\n"
-        "smlal2 v22.4s, v6.8h, v17.8h\n"
-        "smlal v23.4s, v6.4h, v18.4h\n"
-        "smlal2 v24.4s, v6.8h, v18.8h\n"
-        "smlal v21.4s, v7.4h, v18.4h\n"
-        "smlal2 v22.4s, v7.8h, v18.8h\n"
-        "smlal v23.4s, v7.4h, v19.4h\n"
-        "smlal2 v24.4s, v7.8h, v19.8h\n"
-        "smlal v21.4s, v8.4h, v19.4h\n"
-        "uaddw v20.8h, v26.8h, v20.8b\n"
-        "smlal2 v22.4s, v8.8h, v19.8h\n"
-        "smlal v23.4s, v8.4h, v20.4h\n"
-        "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-        "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-        "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-        "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-        "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-        "sqrshl v21.4s, v21.4s, v28.4s\n"
-        "sqrshl v22.4s, v22.4s, v28.4s\n"
-        "sqrshl v23.4s, v23.4s, v28.4s\n"
-        "sqrshl v24.4s, v24.4s, v28.4s\n"
-        "sqxtn v21.4h, v21.4s\n"
-        "sqxtn2 v21.8h, v22.4s\n"
-        "sqxtn v23.4h, v23.4s\n"
-        "sqxtn2 v23.8h, v24.4s\n"
-        "sqadd v21.8h, v21.8h, v29.8h\n"
-        "sqadd v23.8h, v23.8h, v29.8h\n"
-        "sqxtun v21.8b, v21.8h\n"
-        "sqxtun2 v21.16b, v23.8h\n"
-        "umax v21.16b, v21.16b, v30.16b\n"
-        "umin v21.16b, v21.16b, v31.16b\n"
-        "st1 {v21.8b}, [%[output_ptr]], x3\n"
-        "mov v23.d[0], v21.d[1]\n"
-        "st1 {v23.8b}, [%[output_ptr]], x3\n"
-        "b " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        // Handle bottom right output if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER ":\n"
-        "smlal v21.4s, v0.4h, v9.4h\n"
-        "smlal2 v22.4s, v0.8h, v9.8h\n"
-        "smlal v21.4s, v1.4h, v10.4h\n"
-        "smlal2 v22.4s, v1.8h, v10.8h\n"
-        "smlal v21.4s, v2.4h, v11.4h\n"
-        "smlal2 v22.4s, v2.8h, v11.8h\n"
-        "smlal v21.4s, v3.4h, v13.4h\n"
-        "smlal2 v22.4s, v3.8h, v13.8h\n"
-        "smlal v21.4s, v4.4h, v14.4h\n"
-        "smlal2 v22.4s, v4.8h, v14.8h\n"
-        "smlal v21.4s, v5.4h, v15.4h\n"
-        "smlal2 v22.4s, v5.8h, v15.8h\n"
-        "smlal v21.4s, v6.4h, v17.4h\n"
-        "smlal2 v22.4s, v6.8h, v17.8h\n"
-        "smlal v21.4s, v7.4h, v18.4h\n"
-        "smlal2 v22.4s, v7.8h, v18.8h\n"
-        "smlal v21.4s, v8.4h, v19.4h\n"
-        "smlal2 v22.4s, v8.8h, v19.8h\n"
-
-        "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-        "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-        "sqrshl v21.4s, v21.4s, v28.4s\n"
-        "sqrshl v22.4s, v22.4s, v28.4s\n"
-        "sqxtn v21.4h, v21.4s\n"
-        "sqxtn2 v21.8h, v22.4s\n"
-        "sqadd v21.8h, v21.8h, v29.8h\n"
-        "sqxtun v21.8b, v21.8h\n"
-        "umax v21.8b, v21.8b, v30.8b\n"
-        "umin v21.8b, v21.8b, v31.8b\n"
-        "st1 {v21.8b}, [%[output_ptr]]\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_END ":\n"
-    :
-    // Outputs.
-    [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-    [output_ptr] "+r"(output_ptr),
-    [output_window_height] "+r"(output_window_height)
-    :
-    // Inputs.
-    [bias_ptr] "r"(bias_ptr), [input_row_size] "r"(input_row_size),
-    [input_depth] "r"(input_depth),
-    [output_window_width] "r"(output_window_width),
-    [input_width_increment] "r"(input_width_increment),
-    [input_height_increment] "r"(input_height_increment),
-    [output_height_increment] "r"(output_height_increment),
-    [params_ptr] "r"(params_ptr)
-    :
-    // Clobbers.
-    "cc", "memory",
-    // We use these NEON registers.
-    "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
-    "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-    "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29",
-    "v30", "v31",
-    // We use these general-purpose registers.
-    "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
-    "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_END
-  }
-};
-
-template <>
-struct DepthwiseConvWindow {
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         int64_t input_depth, int64_t input_row_size,
-                         int32 output_window_height, int32 output_window_width,
-                         const DepthwiseConvParams* params_ptr) {
-    const int64_t input_width_increment = 4 * input_depth;
-    const int64_t input_height_increment = 4 * input_row_size;
-    const int64_t output_height_increment = 2 * params_ptr->output_row_size;
-
-#define DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "1"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "2"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "3"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "4"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "5"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "6"
-#define DEPTHWISECONV_LABEL_HEIGHT_1 "7"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "8"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "9"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "10"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_END "11"
-
-    asm volatile(
-        // Performs depthwise convolutions for a window specified by
-        // |output_window_height| and |output_window_width|. The inner-most loop
-        // processes 2x2 outputs, and any leftovers at the end.
-        //
-        // Algorithm works as follows:
-        //
-        //   1. Load filters of 8 depth (8x3x3). Registers v0--v8 hold filter
-        //      values.
-        //   2. For 2 output heights at a time:
-        //        i.  For 2 output widths at a time at stride 2, a 5x5 input
-        //            window is required. To avoid register exhaustion, we load
-        //            the first 2 rows of the 5x5 input window into registers
-        //            v9--v18, and use the same registers to load the next 2
-        //            rows, and finally v9--v13 to load the last row.
-        //            Accumulators for all 2x2 outputs are reserved by registers
-        //            v21-v22 (top left output), v23-v24 (top right output),
-        //            v19-v20 (bottom left output), v25-v26 (bottom right
-        //            output).
-        //        ii. Handle single leftover width if exists.
-        //   3. Handle single leftover height if exists.
-        //        i.  For 2 output widths at a time at stride 2, load inputs for
-        //            a 1x2 (1 height, 2 width) output window (3x5 input
-        //            window). Registers v9--v24 hold input values. Mul-add with
-        //            accumulators v24--v27.
-        //        ii. Handle single leftover width if exists.
-        //
-        // Loads are placed as soon as the register is no longer needed and
-        // interleaved with arithmetic operations to take advantage of
-        // dual-issue pipelines. We also add input offsets as far from the loads
-        // as possible to give loads enough cycles to fetch data from memory.
-
-        // Set "constant" registers. These registers may be replaced with temp
-        // values from time to time when there are not enough NEON registers.
-        // We use x9--x15 general purpose registers as they are caller-saved
-        // temporary registers (see http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf).  // NOLINT
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "ldr w0, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "cmp %w[output_window_height], #2\n"
-        "dup v28.8h, w0\n"
-        "ldr w1, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "dup v26.4s, w9\n"
-        "ldr w2, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w1\n"
-        "ldr w3, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v29.8h, w2\n"
-        "ldr w4, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.16b, w3\n"
-        "ldr x5, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "dup v31.16b, w4\n"
-        "ldr x19, [%[params_ptr], #" STR(OFFSET_OUTPUT_ROW_SIZE) "]\n"
-        "ldr w20, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-
-        // Load filters and add offsets.
-        "add x10, %[bias_ptr], #16\n"
-        "ld1 {v0.8b}, [%[filter_ptr]], x5\n"
-        "dup v9.8h, w20\n"
-        "ld1 {v1.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v0.8h, v9.8h, v0.8b\n"
-        "ld1 {v2.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v1.8h, v9.8h, v1.8b\n"
-        "ld1 {v3.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v2.8h, v9.8h, v2.8b\n"
-        "ld1 {v4.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v3.8h, v9.8h, v3.8b\n"
-        "ld1 {v5.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v4.8h, v9.8h, v4.8b\n"
-        "ld1 {v6.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v5.8h, v9.8h, v5.8b\n"
-        "ld1 {v7.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v6.8h, v9.8h, v6.8b\n"
-        "ld1 {v8.8b}, [%[filter_ptr]]\n"
-        "uaddw v7.8h, v9.8h, v7.8b\n"
-        "uaddw v8.8h, v9.8h, v8.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_2_LOOP ":\n"
-          // Load the first two rows of the 5x5 input window, then reuse the
-          // same registers to load subsequent rows as they become available.
-          "mov x11, %[input_ptr]\n"
-          "mov x12, x11\n"
-          "add x13, x12, %[input_row_size]\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "mov w14, %w[output_window_width]\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          // The height 2 / width 2 loop loads an extra 1 output horizontally in
-          // anticipation for the next iteration. Make sure
-          // |output_window_width| is large enough to handle the additional
-          // load, otherwise jump to the appropriate label to handle smaller
-          // widths.
-          "cmp w14, #2\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x15, x13, %[input_row_size]\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "mov x6, %[output_ptr]\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "add x7, %[output_ptr], x19\n"
-          "ld1 {v16.8b}, [x13], %[input_depth]\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-          "uaddw v9.8h, v28.8h, v9.8b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "uaddw v10.8h, v28.8h, v10.8b\n"
-          "ld1 {v19.4s}, [%[bias_ptr]]\n"
-          "uaddw v11.8h, v28.8h, v11.8b\n"
-          "ld1 {v20.4s}, [x10]\n"
-          "uaddw v14.8h, v28.8h, v14.8b\n"
-          "ld1 {v25.4s}, [%[bias_ptr]]\n"
-          "uaddw v15.8h, v28.8h, v15.8b\n"
-          "ld1 {v26.4s}, [x10]\n"
-          "uaddw v16.8h, v28.8h, v16.8b\n"
-
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "f\n"
-          "cmp w14, #1\n"
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          //"loop_%=:\n"
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP ":\n"
-            "smlal v21.4s, v0.4h, v9.4h\n"
-            "ld1 {v12.8b}, [x12], %[input_depth]\n"
-            "smlal2 v22.4s, v0.8h, v9.8h\n"
-            "ld1 {v13.8b}, [x12]\n"
-            "add x12, x15, %[input_row_size]\n"
-            "smlal v23.4s, v0.4h, v11.4h\n"
-            "ld1 {v17.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v0.8h, v11.8h\n"
-            "ld1 {v18.8b}, [x13]\n"
-            "add x13, x12, %[input_row_size]\n"
-            "smlal v21.4s, v1.4h, v10.4h\n"
-            "ld1 {v9.8b}, [x15], %[input_depth]\n"
-            "smlal2 v22.4s, v1.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x15], %[input_depth]\n"
-            "smlal v21.4s, v2.4h, v11.4h\n"
-            "smlal2 v22.4s, v2.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x15], %[input_depth]\n"
-            "smlal v21.4s, v3.4h, v14.4h\n"
-            "smlal2 v22.4s, v3.8h, v14.8h\n"
-            "ld1 {v14.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v3.4h, v16.4h\n"
-            "subs w14, w14, #2\n"
-            "smlal2 v24.4s, v3.8h, v16.8h\n"
-            "cmp w14, #3\n"
-            "smlal v21.4s, v4.4h, v15.4h\n"
-            "uaddw v12.8h, v28.8h, v12.8b\n"
-            "smlal2 v22.4s, v4.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x12], %[input_depth]\n"
-            "smlal v21.4s, v5.4h, v16.4h\n"
-            "uaddw v13.8h, v28.8h, v13.8b\n"
-            "smlal2 v22.4s, v5.8h, v16.8h\n"
-            "ld1 {v16.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v1.4h, v12.4h\n"
-            "uaddw v17.8h, v28.8h, v17.8b\n"
-            "smlal2 v24.4s, v1.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x15], %[input_depth]\n"
-            "smlal v23.4s, v2.4h, v13.4h\n"
-            "uaddw v18.8h, v28.8h, v18.8b\n"
-            "smlal2 v24.4s, v2.8h, v13.8h\n"
-            "ld1 {v13.8b}, [x15]\n"
-            "smlal v23.4s, v4.4h, v17.4h\n"
-            "uaddw v9.8h, v28.8h, v9.8b\n"
-            "smlal2 v24.4s, v4.8h, v17.8h\n"
-            "ld1 {v17.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v5.4h, v18.4h\n"
-            "uaddw v10.8h, v28.8h, v10.8b\n"
-            "smlal2 v24.4s, v5.8h, v18.8h\n"
-            "ld1 {v18.8b}, [x12]\n"
-
-            "smlal v21.4s, v6.4h, v9.4h\n"
-            "smlal2 v22.4s, v6.8h, v9.8h\n"
-            "smlal v19.4s, v0.4h, v9.4h\n"
-            "uaddw v11.8h, v28.8h, v11.8b\n"
-            "smlal2 v20.4s, v0.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v6.4h, v11.4h\n"
-            "smlal2 v24.4s, v6.8h, v11.8h\n"
-            "smlal v21.4s, v7.4h, v10.4h\n"
-            "smlal2 v22.4s, v7.8h, v10.8h\n"
-            "uaddw v12.8h, v28.8h, v12.8b\n"
-            "smlal v19.4s, v1.4h, v10.4h\n"
-            "smlal2 v20.4s, v1.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v7.4h, v12.4h\n"
-            "smlal2 v24.4s, v7.8h, v12.8h\n"
-            "smlal v25.4s, v1.4h, v12.4h\n"
-            "smlal2 v26.4s, v1.8h, v12.8h\n"
-            "smlal v21.4s, v8.4h, v11.4h\n"
-            "smlal2 v22.4s, v8.8h, v11.8h\n"
-            "add x11, x11, %[input_width_increment]\n"
-            "smlal v19.4s, v2.4h, v11.4h\n"
-            "mov x12, x11\n"
-            "smlal2 v20.4s, v2.8h, v11.8h\n"
-            "uaddw v13.8h, v28.8h, v13.8b\n"
-            "smlal v25.4s, v0.4h, v11.4h\n"
-            "smlal2 v26.4s, v0.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v8.4h, v13.4h\n"
-            "ld1 {v12.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v8.8h, v13.8h\n"
-            "smlal v25.4s, v2.4h, v13.4h\n"
-            "smlal2 v26.4s, v2.8h, v13.8h\n"
-            "ld1 {v13.8b}, [x13]\n"
-            "add x13, x12, %[input_row_size]\n"
-            "add x15, x13, %[input_row_size]\n"
-
-            "dup v28.4s, w9\n"
-            "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-            "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-            "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-            "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-            "and v27.16b, v21.16b, v28.16b\n"
-            "and v29.16b, v22.16b, v28.16b\n"
-            "and v30.16b, v23.16b, v28.16b\n"
-            "and v31.16b, v24.16b, v28.16b\n"
-            "sshr v27.4s, v27.4s, #31\n"
-            "sshr v29.4s, v29.4s, #31\n"
-            "sshr v30.4s, v30.4s, #31\n"
-            "sshr v31.4s, v31.4s, #31\n"
-            "sqadd v21.4s, v21.4s, v27.4s\n"
-            "dup v27.4s, w1\n"
-            "sqadd v22.4s, v22.4s, v29.4s\n"
-            "dup v29.8h, w2\n"
-            "sqadd v23.4s, v23.4s, v30.4s\n"
-            "dup v30.16b, w3\n"
-            "sqadd v24.4s, v24.4s, v31.4s\n"
-            "dup v31.16b, w4\n"
-            "srshl v21.4s, v21.4s, v28.4s\n"
-            "srshl v22.4s, v22.4s, v28.4s\n"
-            "srshl v23.4s, v23.4s, v28.4s\n"
-            "srshl v24.4s, v24.4s, v28.4s\n"
-            "dup v28.8h, w0\n"
-            "sqxtn v21.4h, v21.4s\n"
-            "sqxtn2 v21.8h, v22.4s\n"
-            "sqxtn v23.4h, v23.4s\n"
-            "sqxtn2 v23.8h, v24.4s\n"
-            "sqadd v21.8h, v21.8h, v29.8h\n"
-            "sqadd v23.8h, v23.8h, v29.8h\n"
-            "sqxtun v21.8b, v21.8h\n"
-            "sqxtun2 v21.16b, v23.8h\n"
-            "ld1 {v22.4s}, [x10]\n"
-            "umax v21.16b, v21.16b, v30.16b\n"
-            "umin v21.16b, v21.16b, v31.16b\n"
-            "ld1 {v24.4s}, [x10]\n"
-            "uaddw v9.8h, v28.8h, v9.8b\n"
-            "st1 {v21.8b}, [x6], x5\n"
-            "uaddw v10.8h, v28.8h, v10.8b\n"
-            "mov v23.d[0], v21.d[1]\n"
-            "st1 {v23.8b}, [x6], x5\n"
-            "uaddw v11.8h, v28.8h, v11.8b\n"
-
-            "smlal v19.4s, v6.4h, v9.4h\n"
-            "smlal2 v20.4s, v6.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v6.4h, v11.4h\n"
-            "smlal2 v26.4s, v6.8h, v11.8h\n"
-            "smlal v19.4s, v7.4h, v10.4h\n"
-            "uaddw v12.8h, v28.8h, v12.8b\n"
-            "smlal2 v20.4s, v7.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v7.4h, v12.4h\n"
-            "smlal2 v26.4s, v7.8h, v12.8h\n"
-            "smlal v19.4s, v8.4h, v11.4h\n"
-            "uaddw v13.8h, v28.8h, v13.8b\n"
-            "smlal2 v20.4s, v8.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v8.4h, v13.4h\n"
-            "uaddw v14.8h, v28.8h, v14.8b\n"
-            "smlal2 v26.4s, v8.8h, v13.8h\n"
-            "uaddw v16.8h, v28.8h, v16.8b\n"
-            "smlal v19.4s, v3.4h, v14.4h\n"
-            "uaddw v15.8h, v28.8h, v15.8b\n"
-            "smlal2 v20.4s, v3.8h, v14.8h\n"
-            "ld1 {v14.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v3.4h, v16.4h\n"
-            "ld1 {v21.4s}, [%[bias_ptr]]\n"
-            "smlal2 v26.4s, v3.8h, v16.8h\n"
-            "ld1 {v23.4s}, [%[bias_ptr]]\n"
-            "smlal v19.4s, v4.4h, v15.4h\n"
-            "uaddw v17.8h, v28.8h, v17.8b\n"
-            "smlal2 v20.4s, v4.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v4.4h, v17.4h\n"
-            "smlal2 v26.4s, v4.8h, v17.8h\n"
-            "smlal v19.4s, v5.4h, v16.4h\n"
-            "uaddw v18.8h, v28.8h, v18.8b\n"
-            "smlal2 v20.4s, v5.8h, v16.8h\n"
-            "ld1 {v16.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v5.4h, v18.4h\n"
-            "smlal2 v26.4s, v5.8h, v18.8h\n"
-
-            "dup v28.4s, w9\n"
-            "sqrdmulh v19.4s, v19.4s, v27.4s\n"
-            "sqrdmulh v20.4s, v20.4s, v27.4s\n"
-            "sqrdmulh v25.4s, v25.4s, v27.4s\n"
-            "sqrdmulh v26.4s, v26.4s, v27.4s\n"
-            "and v27.16b, v19.16b, v28.16b\n"
-            "and v29.16b, v20.16b, v28.16b\n"
-            "and v30.16b, v25.16b, v28.16b\n"
-            "and v31.16b, v26.16b, v28.16b\n"
-            "sshr v27.4s, v27.4s, #31\n"
-            "sshr v29.4s, v29.4s, #31\n"
-            "sshr v30.4s, v30.4s, #31\n"
-            "sshr v31.4s, v31.4s, #31\n"
-            "sqadd v19.4s, v19.4s, v27.4s\n"
-            "dup v27.4s, w1\n"
-            "sqadd v20.4s, v20.4s, v29.4s\n"
-            "dup v29.8h, w2\n"
-            "sqadd v25.4s, v25.4s, v30.4s\n"
-            "dup v30.16b, w3\n"
-            "sqadd v26.4s, v26.4s, v31.4s\n"
-            "dup v31.16b, w4\n"
-            "srshl v19.4s, v19.4s, v28.4s\n"
-            "srshl v20.4s, v20.4s, v28.4s\n"
-            "srshl v25.4s, v25.4s, v28.4s\n"
-            "srshl v26.4s, v26.4s, v28.4s\n"
-            "dup v28.8h, w0\n"
-            "sqxtn v19.4h, v19.4s\n"
-            "sqxtn2 v19.8h, v20.4s\n"
-            "sqxtn v25.4h, v25.4s\n"
-            "sqxtn2 v25.8h, v26.4s\n"
-            "sqadd v19.8h, v19.8h, v29.8h\n"
-            "sqadd v25.8h, v25.8h, v29.8h\n"
-            "sqxtun v19.8b, v19.8h\n"
-            "sqxtun2 v19.16b, v25.8h\n"
-            "ld1 {v20.4s}, [x10]\n"
-            "umax v19.16b, v19.16b, v30.16b\n"
-            "umin v19.16b, v19.16b, v31.16b\n"
-            "ld1 {v26.4s}, [x10]\n"
-            "uaddw v9.8h, v28.8h, v9.8b\n"
-            "st1 {v19.8b}, [x7], x5\n"
-            "uaddw v10.8h, v28.8h, v10.8b\n"
-            "mov v25.d[0], v19.d[1]\n"
-            "st1 {v25.8b}, [x7], x5\n"
-            "uaddw v11.8h, v28.8h, v11.8b\n"
-            "ld1 {v19.4s}, [%[bias_ptr]]\n"
-            "uaddw v14.8h, v28.8h, v14.8b\n"
-            "ld1 {v25.4s}, [%[bias_ptr]]\n"
-            "uaddw v15.8h, v28.8h, v15.8b\n"
-            "uaddw v16.8h, v28.8h, v16.8b\n"
-
-            "bge " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "b\n"
-
-          // At this point, there will be one of 2 width or 1 width leftover,
-          // not both.
-          "cmp w14, #2\n"
-          "blt " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          // Handle last 2 columns if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER ":\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v12.8b}, [x12], %[input_depth]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v13.8b}, [x12]\n"
-          "add x12, x15, %[input_row_size]\n"
-          "smlal v23.4s, v0.4h, v11.4h\n"
-          "ld1 {v17.8b}, [x13], %[input_depth]\n"
-          "smlal2 v24.4s, v0.8h, v11.8h\n"
-          "ld1 {v18.8b}, [x13]\n"
-          "add x13, x12, %[input_row_size]\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "ld1 {v9.8b}, [x15], %[input_depth]\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v3.4h, v14.4h\n"
-          "smlal2 v22.4s, v3.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v3.4h, v16.4h\n"
-          "smlal2 v24.4s, v3.8h, v16.8h\n"
-          "smlal v21.4s, v4.4h, v15.4h\n"
-          "uaddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v22.4s, v4.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v5.4h, v16.4h\n"
-          "uaddw v13.8h, v28.8h, v13.8b\n"
-          "smlal2 v22.4s, v5.8h, v16.8h\n"
-          "ld1 {v16.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v1.4h, v12.4h\n"
-          "uaddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v24.4s, v1.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x15], %[input_depth]\n"
-          "smlal v23.4s, v2.4h, v13.4h\n"
-          "uaddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v24.4s, v2.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x15]\n"
-          "smlal v23.4s, v4.4h, v17.4h\n"
-          "uaddw v9.8h, v28.8h, v9.8b\n"
-          "smlal2 v24.4s, v4.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v5.4h, v18.4h\n"
-          "uaddw v10.8h, v28.8h, v10.8b\n"
-          "smlal2 v24.4s, v5.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x12]\n"
-
-          "smlal v21.4s, v6.4h, v9.4h\n"
-          "smlal2 v22.4s, v6.8h, v9.8h\n"
-          "smlal v19.4s, v0.4h, v9.4h\n"
-          "uaddw v11.8h, v28.8h, v11.8b\n"
-          "smlal2 v20.4s, v0.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v6.4h, v11.4h\n"
-          "smlal2 v24.4s, v6.8h, v11.8h\n"
-          "smlal v21.4s, v7.4h, v10.4h\n"
-          "smlal2 v22.4s, v7.8h, v10.8h\n"
-          "uaddw v12.8h, v28.8h, v12.8b\n"
-          "smlal v19.4s, v1.4h, v10.4h\n"
-          "smlal2 v20.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v7.4h, v12.4h\n"
-          "smlal2 v24.4s, v7.8h, v12.8h\n"
-          "smlal v25.4s, v1.4h, v12.4h\n"
-          "smlal2 v26.4s, v1.8h, v12.8h\n"
-          "smlal v21.4s, v8.4h, v11.4h\n"
-          "smlal2 v22.4s, v8.8h, v11.8h\n"
-          "smlal v19.4s, v2.4h, v11.4h\n"
-          "smlal2 v20.4s, v2.8h, v11.8h\n"
-          "uaddw v13.8h, v28.8h, v13.8b\n"
-          "smlal v25.4s, v0.4h, v11.4h\n"
-          "smlal2 v26.4s, v0.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v8.4h, v13.4h\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "smlal2 v24.4s, v8.8h, v13.8h\n"
-          "smlal v25.4s, v2.4h, v13.4h\n"
-          "smlal2 v26.4s, v2.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13]\n"
-
-          "dup v28.4s, w9\n"
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "and v27.16b, v21.16b, v28.16b\n"
-          "and v29.16b, v22.16b, v28.16b\n"
-          "and v30.16b, v23.16b, v28.16b\n"
-          "and v31.16b, v24.16b, v28.16b\n"
-          "sshr v27.4s, v27.4s, #31\n"
-          "sshr v29.4s, v29.4s, #31\n"
-          "sshr v30.4s, v30.4s, #31\n"
-          "sshr v31.4s, v31.4s, #31\n"
-          "sqadd v21.4s, v21.4s, v27.4s\n"
-          "dup v27.4s, w1\n"
-          "sqadd v22.4s, v22.4s, v29.4s\n"
-          "dup v29.8h, w2\n"
-          "sqadd v23.4s, v23.4s, v30.4s\n"
-          "dup v30.16b, w3\n"
-          "sqadd v24.4s, v24.4s, v31.4s\n"
-          "dup v31.16b, w4\n"
-          "srshl v21.4s, v21.4s, v28.4s\n"
-          "srshl v22.4s, v22.4s, v28.4s\n"
-          "srshl v23.4s, v23.4s, v28.4s\n"
-          "srshl v24.4s, v24.4s, v28.4s\n"
-          "dup v28.8h, w0\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "sqxtun2 v21.16b, v23.8h\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "umax v21.16b, v21.16b, v30.16b\n"
-          "umin v21.16b, v21.16b, v31.16b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "uaddw v9.8h, v28.8h, v9.8b\n"
-          "st1 {v21.8b}, [x6], x5\n"
-          "uaddw v10.8h, v28.8h, v10.8b\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [x6]\n"
-          "uaddw v11.8h, v28.8h, v11.8b\n"
-
-          "smlal v19.4s, v6.4h, v9.4h\n"
-          "smlal2 v20.4s, v6.8h, v9.8h\n"
-          "smlal v25.4s, v6.4h, v11.4h\n"
-          "smlal2 v26.4s, v6.8h, v11.8h\n"
-          "smlal v19.4s, v7.4h, v10.4h\n"
-          "uaddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v20.4s, v7.8h, v10.8h\n"
-          "smlal v25.4s, v7.4h, v12.4h\n"
-          "smlal2 v26.4s, v7.8h, v12.8h\n"
-          "smlal v19.4s, v8.4h, v11.4h\n"
-          "uaddw v13.8h, v28.8h, v13.8b\n"
-          "smlal2 v20.4s, v8.8h, v11.8h\n"
-          "smlal v25.4s, v8.4h, v13.4h\n"
-          "uaddw v14.8h, v28.8h, v14.8b\n"
-          "smlal2 v26.4s, v8.8h, v13.8h\n"
-          "uaddw v16.8h, v28.8h, v16.8b\n"
-          "smlal v19.4s, v3.4h, v14.4h\n"
-          "uaddw v15.8h, v28.8h, v15.8b\n"
-          "smlal2 v20.4s, v3.8h, v14.8h\n"
-          "smlal v25.4s, v3.4h, v16.4h\n"
-          "smlal2 v26.4s, v3.8h, v16.8h\n"
-          "smlal v19.4s, v4.4h, v15.4h\n"
-          "uaddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v20.4s, v4.8h, v15.8h\n"
-          "smlal v25.4s, v4.4h, v17.4h\n"
-          "smlal2 v26.4s, v4.8h, v17.8h\n"
-          "smlal v19.4s, v5.4h, v16.4h\n"
-          "uaddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v20.4s, v5.8h, v16.8h\n"
-          "smlal v25.4s, v5.4h, v18.4h\n"
-          "smlal2 v26.4s, v5.8h, v18.8h\n"
-
-          "dup v28.4s, w9\n"
-          "sqrdmulh v19.4s, v19.4s, v27.4s\n"
-          "sqrdmulh v20.4s, v20.4s, v27.4s\n"
-          "sqrdmulh v25.4s, v25.4s, v27.4s\n"
-          "sqrdmulh v26.4s, v26.4s, v27.4s\n"
-          "and v27.16b, v19.16b, v28.16b\n"
-          "and v29.16b, v20.16b, v28.16b\n"
-          "and v30.16b, v25.16b, v28.16b\n"
-          "and v31.16b, v26.16b, v28.16b\n"
-          "sshr v27.4s, v27.4s, #31\n"
-          "sshr v29.4s, v29.4s, #31\n"
-          "sshr v30.4s, v30.4s, #31\n"
-          "sshr v31.4s, v31.4s, #31\n"
-          "sqadd v19.4s, v19.4s, v27.4s\n"
-          "dup v27.4s, w1\n"
-          "sqadd v20.4s, v20.4s, v29.4s\n"
-          "dup v29.8h, w2\n"
-          "sqadd v25.4s, v25.4s, v30.4s\n"
-          "dup v30.16b, w3\n"
-          "sqadd v26.4s, v26.4s, v31.4s\n"
-          "dup v31.16b, w4\n"
-          "srshl v19.4s, v19.4s, v28.4s\n"
-          "srshl v20.4s, v20.4s, v28.4s\n"
-          "srshl v25.4s, v25.4s, v28.4s\n"
-          "srshl v26.4s, v26.4s, v28.4s\n"
-          "dup v28.8h, w0\n"
-          "sqxtn v19.4h, v19.4s\n"
-          "sqxtn2 v19.8h, v20.4s\n"
-          "sqxtn v25.4h, v25.4s\n"
-          "sqxtn2 v25.8h, v26.4s\n"
-          "sqadd v19.8h, v19.8h, v29.8h\n"
-          "sqadd v25.8h, v25.8h, v29.8h\n"
-          "sqxtun v19.8b, v19.8h\n"
-          "sqxtun2 v19.16b, v25.8h\n"
-          "umax v19.16b, v19.16b, v30.16b\n"
-          "umin v19.16b, v19.16b, v31.16b\n"
-          "st1 {v19.8b}, [x7], x5\n"
-          "mov v25.d[0], v19.d[1]\n"
-          "st1 {v25.8b}, [x7]\n"
-          "b " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "f\n"
-
-          // Handle last column if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER ":\n"
-          // Registers v9, v10, v11, v14, v15, and v16 have already been loaded
-          // with the correct values at this point. This corresponds to the
-          // first two input rows of the top left output. Now load the last
-          // input row for this output. Once these inputs are no longer needed,
-          // load the input rows for the bottom left output.
-          "add x12, x15, %[input_row_size]\n"
-          "add x13, x12, %[input_row_size]\n"
-
-          "ld1 {v12.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v13.8b}, [x15], %[input_depth]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v17.8b}, [x15]\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x12]\n"
-          "smlal v21.4s, v3.4h, v14.4h\n"
-          "smlal2 v22.4s, v3.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v21.4s, v4.4h, v15.4h\n"
-          "smlal2 v22.4s, v4.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "smlal v21.4s, v5.4h, v16.4h\n"
-          "uaddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v22.4s, v5.8h, v16.8h\n"
-          "uaddw v13.8h, v28.8h, v13.8b\n"
-          "ld1 {v16.8b}, [x13]\n"
-
-          "smlal v21.4s, v6.4h, v12.4h\n"
-          "smlal2 v22.4s, v6.8h, v12.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "uaddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v7.4h, v13.4h\n"
-          "smlal2 v22.4s, v7.8h, v13.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v2.4h, v17.4h\n"
-          "smlal2 v24.4s, v2.8h, v17.8h\n"
-
-          "dup v26.4s, w9\n"
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "and v18.16b, v21.16b, v26.16b\n"
-          "and v19.16b, v22.16b, v26.16b\n"
-          "sshr v18.4s, v18.4s, #31\n"
-          "sshr v19.4s, v19.4s, #31\n"
-          "sqadd v21.4s, v21.4s, v18.4s\n"
-          "sqadd v22.4s, v22.4s, v19.4s\n"
-          "srshl v21.4s, v21.4s, v26.4s\n"
-          "srshl v22.4s, v22.4s, v26.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "umax v21.8b, v21.8b, v30.8b\n"
-          "umin v21.8b, v21.8b, v31.8b\n"
-          "uaddw v9.8h, v28.8h, v9.8b\n"
-          "st1 {v21.8b}, [x6]\n"
-          "uaddw v10.8h, v28.8h, v10.8b\n"
-
-          "smlal v23.4s, v3.4h, v9.4h\n"
-          "uaddw v11.8h, v28.8h, v11.8b\n"
-          "smlal2 v24.4s, v3.8h, v9.8h\n"
-          "uaddw v14.8h, v28.8h, v14.8b\n"
-          "smlal v23.4s, v4.4h, v10.4h\n"
-          "uaddw v15.8h, v28.8h, v15.8b\n"
-          "smlal2 v24.4s, v4.8h, v10.8h\n"
-          "uaddw v16.8h, v28.8h, v16.8b\n"
-          "smlal v23.4s, v5.4h, v11.4h\n"
-          "smlal2 v24.4s, v5.8h, v11.8h\n"
-
-          "smlal v23.4s, v6.4h, v14.4h\n"
-          "smlal2 v24.4s, v6.8h, v14.8h\n"
-          "smlal v23.4s, v7.4h, v15.4h\n"
-          "smlal2 v24.4s, v7.8h, v15.8h\n"
-          "smlal v23.4s, v8.4h, v16.4h\n"
-          "smlal2 v24.4s, v8.8h, v16.8h\n"
-
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "and v18.16b, v23.16b, v26.16b\n"
-          "and v19.16b, v24.16b, v26.16b\n"
-          "sshr v18.4s, v18.4s, #31\n"
-          "sshr v19.4s, v19.4s, #31\n"
-          "sqadd v23.4s, v23.4s, v18.4s\n"
-          "sqadd v24.4s, v24.4s, v19.4s\n"
-          "srshl v23.4s, v23.4s, v26.4s\n"
-          "srshl v24.4s, v24.4s, v26.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v23.8b, v23.8h\n"
-          "umax v23.8b, v23.8b, v30.8b\n"
-          "umin v23.8b, v23.8b, v31.8b\n"
-          "st1 {v23.8b}, [x7]\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP ":\n"
-          "subs %w[output_window_height], %w[output_window_height], #2\n"
-          "add %[input_ptr], %[input_ptr], %[input_height_increment]\n"
-          "cmp %w[output_window_height], #2\n"
-          "add %[output_ptr], %[output_ptr], %[output_height_increment]\n"
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP ":\n"
-        "cmp %w[output_window_height], #1\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_1 ":\n"
-        "mov x11, %[input_ptr]\n"
-        "mov x12, x11\n"
-        "add x13, x12, %[input_row_size]\n"
-        "ld1 {v9.8b}, [x12], %[input_depth]\n"
-        "add x15, x13, %[input_row_size]\n"
-        "ld1 {v10.8b}, [x12], %[input_depth]\n"
-        "mov x6, %[output_ptr]\n"
-        "ld1 {v11.8b}, [x12], %[input_depth]\n"
-        "mov w14, %w[output_window_width]\n"
-        // The height 1 / width 2 loop loads an extra 1x1 output in anticipation
-        // for the next iteration. Make sure |output_window_width| is large
-        // enough to handle the additional load, otherwise jump to the
-        // appropriate label to handle smaller widths.
-        "cmp w14, #2\n"
-        "ld1 {v12.8b}, [x13], %[input_depth]\n"
-        "ld1 {v13.8b}, [x13], %[input_depth]\n"
-        "ld1 {v14.8b}, [x13], %[input_depth]\n"
-        "ld1 {v15.8b}, [x15], %[input_depth]\n"
-        "ld1 {v16.8b}, [x15], %[input_depth]\n"
-        "ld1 {v17.8b}, [x15], %[input_depth]\n"
-
-        "uaddw v9.8h, v28.8h, v9.8b\n"
-        "ld1 {v24.4s}, [%[bias_ptr]]\n"
-        "uaddw v10.8h, v28.8h, v10.8b\n"
-        "ld1 {v25.4s}, [x10]\n"
-        "uaddw v11.8h, v28.8h, v11.8b\n"
-        "ld1 {v26.4s}, [%[bias_ptr]]\n"
-        "ld1 {v27.4s}, [x10]\n"
-        "uaddw v12.8h, v28.8h, v12.8b\n"
-        "uaddw v13.8h, v28.8h, v13.8b\n"
-        "uaddw v14.8h, v28.8h, v14.8b\n"
-        "uaddw v15.8h, v28.8h, v15.8b\n"
-        "uaddw v16.8h, v28.8h, v16.8b\n"
-        "uaddw v17.8h, v28.8h, v17.8b\n"
-
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "f\n"
-        "cmp w14, #1\n"
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP ":\n"
-          "smlal v24.4s, v0.4h, v9.4h\n"
-          "ld1 {v18.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v0.8h, v9.8h\n"
-          "ld1 {v19.8b}, [x12]\n"
-          "smlal v26.4s, v0.4h, v11.4h\n"
-          "ld1 {v20.8b}, [x13], %[input_depth]\n"
-          "smlal2 v27.4s, v0.8h, v11.8h\n"
-          "ld1 {v21.8b}, [x13]\n"
-          "smlal v24.4s, v1.4h, v10.4h\n"
-          "ld1 {v22.8b}, [x15], %[input_depth]\n"
-          "smlal2 v25.4s, v1.8h, v10.8h\n"
-          "ld1 {v23.8b}, [x15]\n"
-          "smlal v24.4s, v2.4h, v11.4h\n"
-          "subs w14, w14, #2\n"
-          "smlal2 v25.4s, v2.8h, v11.8h\n"
-          "cmp w14, #3\n"
-          "smlal v24.4s, v3.4h, v12.4h\n"
-          "add x11, x11, %[input_width_increment]\n"
-          "smlal2 v25.4s, v3.8h, v12.8h\n"
-          "mov x12, x11\n"
-          "smlal v26.4s, v3.4h, v14.4h\n"
-          "add x13, x12, %[input_row_size]\n"
-          "smlal2 v27.4s, v3.8h, v14.8h\n"
-          "add x15, x13, %[input_row_size]\n"
-          "smlal v24.4s, v4.4h, v13.4h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v4.8h, v13.8h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "smlal v24.4s, v5.4h, v14.4h\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v5.8h, v14.8h\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "smlal v24.4s, v6.4h, v15.4h\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "smlal2 v25.4s, v6.8h, v15.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v26.4s, v6.4h, v17.4h\n"
-          "ld1 {v15.8b}, [x15], %[input_depth]\n"
-          "smlal2 v27.4s, v6.8h, v17.8h\n"
-          "smlal v24.4s, v7.4h, v16.4h\n"
-          "smlal2 v25.4s, v7.8h, v16.8h\n"
-          "ld1 {v16.8b}, [x15], %[input_depth]\n"
-          "smlal v24.4s, v8.4h, v17.4h\n"
-          "uaddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v25.4s, v8.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x15], %[input_depth]\n"
-          "uaddw v19.8h, v28.8h, v19.8b\n"
-
-          "smlal v26.4s, v1.4h, v18.4h\n"
-          "uaddw v20.8h, v28.8h, v20.8b\n"
-          "smlal2 v27.4s, v1.8h, v18.8h\n"
-          "smlal v26.4s, v2.4h, v19.4h\n"
-          "uaddw v21.8h, v28.8h, v21.8b\n"
-          "smlal2 v27.4s, v2.8h, v19.8h\n"
-          "smlal v26.4s, v4.4h, v20.4h\n"
-          "smlal v26.4s, v5.4h, v21.4h\n"
-          "smlal2 v27.4s, v4.8h, v20.8h\n"
-          "uaddw v22.8h, v28.8h, v22.8b\n"
-          "smlal2 v27.4s, v5.8h, v21.8h\n"
-          "uaddw v23.8h, v28.8h, v23.8b\n"
-          "smlal v26.4s, v7.4h, v22.4h\n"
-          "smlal2 v27.4s, v7.8h, v22.8h\n"
-          "smlal v26.4s, v8.4h, v23.4h\n"
-          "smlal2 v27.4s, v8.8h, v23.8h\n"
-
-          "dup v28.4s, w1\n"
-          "dup v29.4s, w9\n"
-          "sqrdmulh v24.4s, v24.4s, v28.4s\n"
-          "sqrdmulh v25.4s, v25.4s, v28.4s\n"
-          "sqrdmulh v26.4s, v26.4s, v28.4s\n"
-          "sqrdmulh v27.4s, v27.4s, v28.4s\n"
-          "dup v28.8h, w2\n"
-          "and v30.16b, v24.16b, v29.16b\n"
-          "and v31.16b, v25.16b, v29.16b\n"
-          "sshr v30.4s, v30.4s, #31\n"
-          "sshr v31.4s, v31.4s, #31\n"
-          "sqadd v24.4s, v24.4s, v30.4s\n"
-          "sqadd v25.4s, v25.4s, v31.4s\n"
-          "and v30.16b, v26.16b, v29.16b\n"
-          "and v31.16b, v27.16b, v29.16b\n"
-          "sshr v30.4s, v30.4s, #31\n"
-          "sshr v31.4s, v31.4s, #31\n"
-          "sqadd v26.4s, v26.4s, v30.4s\n"
-          "dup v30.16b, w3\n"
-          "sqadd v27.4s, v27.4s, v31.4s\n"
-          "dup v31.16b, w4\n"
-          "srshl v24.4s, v24.4s, v29.4s\n"
-          "srshl v25.4s, v25.4s, v29.4s\n"
-          "srshl v26.4s, v26.4s, v29.4s\n"
-          "srshl v27.4s, v27.4s, v29.4s\n"
-          "sqxtn v24.4h, v24.4s\n"
-          "sqxtn2 v24.8h, v25.4s\n"
-          "sqxtn v26.4h, v26.4s\n"
-          "sqxtn2 v26.8h, v27.4s\n"
-          "sqadd v24.8h, v24.8h, v28.8h\n"
-          "sqadd v26.8h, v26.8h, v28.8h\n"
-          "sqxtun v24.8b, v24.8h\n"
-          "sqxtun2 v24.16b, v26.8h\n"
-          "dup v28.8h, w0\n"
-          "ld1 {v25.4s}, [x10]\n"
-          "umax v24.16b, v24.16b, v30.16b\n"
-          "umin v24.16b, v24.16b, v31.16b\n"
-          "ld1 {v27.4s}, [x10]\n"
-          "uaddw v9.8h, v28.8h, v9.8b\n"
-          "st1 {v24.8b}, [x6], x5\n"
-          "uaddw v10.8h, v28.8h, v10.8b\n"
-          "mov v26.d[0], v24.d[1]\n"
-          "st1 {v26.8b}, [x6], x5\n"
-          "uaddw v11.8h, v28.8h, v11.8b\n"
-          "uaddw v12.8h, v28.8h, v12.8b\n"
-          "uaddw v13.8h, v28.8h, v13.8b\n"
-          "uaddw v14.8h, v28.8h, v14.8b\n"
-          "ld1 {v24.4s}, [%[bias_ptr]]\n"
-          "uaddw v15.8h, v28.8h, v15.8b\n"
-          "ld1 {v26.4s}, [%[bias_ptr]]\n"
-          "uaddw v16.8h, v28.8h, v16.8b\n"
-          "uaddw v17.8h, v28.8h, v17.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "b\n"
-
-        // At this point, there will be one of 2 width or 1 width leftover,
-        // not both.
-        "cmp w14, #2\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        // Handle last two horizontal outputs if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER ":\n"
-        "smlal v24.4s, v0.4h, v9.4h\n"
-        "ld1 {v18.8b}, [x12], %[input_depth]\n"
-        "smlal2 v25.4s, v0.8h, v9.8h\n"
-        "ld1 {v19.8b}, [x12]\n"
-        "smlal v26.4s, v0.4h, v11.4h\n"
-        "ld1 {v20.8b}, [x13], %[input_depth]\n"
-        "smlal2 v27.4s, v0.8h, v11.8h\n"
-        "ld1 {v21.8b}, [x13]\n"
-        "smlal v24.4s, v1.4h, v10.4h\n"
-        "ld1 {v22.8b}, [x15], %[input_depth]\n"
-        "smlal2 v25.4s, v1.8h, v10.8h\n"
-        "ld1 {v23.8b}, [x15]\n"
-        "smlal v24.4s, v2.4h, v11.4h\n"
-        "smlal2 v25.4s, v2.8h, v11.8h\n"
-        "smlal v24.4s, v3.4h, v12.4h\n"
-        "smlal2 v25.4s, v3.8h, v12.8h\n"
-        "smlal v26.4s, v3.4h, v14.4h\n"
-        "smlal2 v27.4s, v3.8h, v14.8h\n"
-        "smlal v24.4s, v4.4h, v13.4h\n"
-        "smlal2 v25.4s, v4.8h, v13.8h\n"
-        "smlal v24.4s, v5.4h, v14.4h\n"
-        "smlal2 v25.4s, v5.8h, v14.8h\n"
-        "smlal v24.4s, v6.4h, v15.4h\n"
-        "smlal2 v25.4s, v6.8h, v15.8h\n"
-        "smlal v26.4s, v6.4h, v17.4h\n"
-        "smlal2 v27.4s, v6.8h, v17.8h\n"
-        "smlal v24.4s, v7.4h, v16.4h\n"
-        "smlal2 v25.4s, v7.8h, v16.8h\n"
-        "smlal v24.4s, v8.4h, v17.4h\n"
-        "uaddw v18.8h, v28.8h, v18.8b\n"
-        "smlal2 v25.4s, v8.8h, v17.8h\n"
-        "uaddw v19.8h, v28.8h, v19.8b\n"
-
-        "smlal v26.4s, v1.4h, v18.4h\n"
-        "uaddw v20.8h, v28.8h, v20.8b\n"
-        "smlal2 v27.4s, v1.8h, v18.8h\n"
-        "smlal v26.4s, v2.4h, v19.4h\n"
-        "uaddw v21.8h, v28.8h, v21.8b\n"
-        "smlal2 v27.4s, v2.8h, v19.8h\n"
-        "smlal v26.4s, v4.4h, v20.4h\n"
-        "smlal v26.4s, v5.4h, v21.4h\n"
-        "smlal2 v27.4s, v4.8h, v20.8h\n"
-        "uaddw v22.8h, v28.8h, v22.8b\n"
-        "smlal2 v27.4s, v5.8h, v21.8h\n"
-        "uaddw v23.8h, v28.8h, v23.8b\n"
-        "smlal v26.4s, v7.4h, v22.4h\n"
-        "smlal2 v27.4s, v7.8h, v22.8h\n"
-        "smlal v26.4s, v8.4h, v23.4h\n"
-        "smlal2 v27.4s, v8.8h, v23.8h\n"
-
-        "dup v28.4s, w1\n"
-        "dup v29.4s, w9\n"
-        "sqrdmulh v24.4s, v24.4s, v28.4s\n"
-        "sqrdmulh v25.4s, v25.4s, v28.4s\n"
-        "sqrdmulh v26.4s, v26.4s, v28.4s\n"
-        "sqrdmulh v27.4s, v27.4s, v28.4s\n"
-        "dup v28.8h, w2\n"
-        "and v30.16b, v24.16b, v29.16b\n"
-        "and v31.16b, v25.16b, v29.16b\n"
-        "sshr v30.4s, v30.4s, #31\n"
-        "sshr v31.4s, v31.4s, #31\n"
-        "sqadd v24.4s, v24.4s, v30.4s\n"
-        "sqadd v25.4s, v25.4s, v31.4s\n"
-        "and v30.16b, v26.16b, v29.16b\n"
-        "and v31.16b, v27.16b, v29.16b\n"
-        "sshr v30.4s, v30.4s, #31\n"
-        "sshr v31.4s, v31.4s, #31\n"
-        "sqadd v26.4s, v26.4s, v30.4s\n"
-        "dup v30.16b, w3\n"
-        "sqadd v27.4s, v27.4s, v31.4s\n"
-        "dup v31.16b, w4\n"
-        "srshl v24.4s, v24.4s, v29.4s\n"
-        "srshl v25.4s, v25.4s, v29.4s\n"
-        "srshl v26.4s, v26.4s, v29.4s\n"
-        "srshl v27.4s, v27.4s, v29.4s\n"
-        "sqxtn v24.4h, v24.4s\n"
-        "sqxtn2 v24.8h, v25.4s\n"
-        "sqxtn v26.4h, v26.4s\n"
-        "sqxtn2 v26.8h, v27.4s\n"
-        "sqadd v24.8h, v24.8h, v28.8h\n"
-        "sqadd v26.8h, v26.8h, v28.8h\n"
-        "sqxtun v24.8b, v24.8h\n"
-        "sqxtun2 v24.16b, v26.8h\n"
-        "dup v28.8h, w0\n"
-        "umax v24.16b, v24.16b, v30.16b\n"
-        "umin v24.16b, v24.16b, v31.16b\n"
-        "st1 {v24.8b}, [x6], x5\n"
-        "mov v26.d[0], v24.d[1]\n"
-        "st1 {v26.8b}, [x6]\n"
-        "b " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        // Handle bottom right output if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER ":\n"
-        "dup v26.4s, w9\n"
-        "dup v27.4s, w1\n"
-        "dup v29.8h, w2\n"
-
-        "smlal v24.4s, v0.4h, v9.4h\n"
-        "smlal2 v25.4s, v0.8h, v9.8h\n"
-        "smlal v24.4s, v1.4h, v10.4h\n"
-        "smlal2 v25.4s, v1.8h, v10.8h\n"
-        "smlal v24.4s, v2.4h, v11.4h\n"
-        "smlal2 v25.4s, v2.8h, v11.8h\n"
-        "smlal v24.4s, v3.4h, v12.4h\n"
-        "smlal2 v25.4s, v3.8h, v12.8h\n"
-        "smlal v24.4s, v4.4h, v13.4h\n"
-        "smlal2 v25.4s, v4.8h, v13.8h\n"
-        "smlal v24.4s, v5.4h, v14.4h\n"
-        "smlal2 v25.4s, v5.8h, v14.8h\n"
-        "smlal v24.4s, v6.4h, v15.4h\n"
-        "smlal2 v25.4s, v6.8h, v15.8h\n"
-        "smlal v24.4s, v7.4h, v16.4h\n"
-        "smlal2 v25.4s, v7.8h, v16.8h\n"
-        "smlal v24.4s, v8.4h, v17.4h\n"
-        "smlal2 v25.4s, v8.8h, v17.8h\n"
-
-        "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-        "sqrdmulh v25.4s, v25.4s, v27.4s\n"
-        "and v18.16b, v24.16b, v26.16b\n"
-        "and v19.16b, v25.16b, v26.16b\n"
-        "sshr v18.4s, v18.4s, #31\n"
-        "sshr v19.4s, v19.4s, #31\n"
-        "sqadd v24.4s, v24.4s, v18.4s\n"
-        "sqadd v25.4s, v25.4s, v19.4s\n"
-        "srshl v24.4s, v24.4s, v26.4s\n"
-        "srshl v25.4s, v25.4s, v26.4s\n"
-        "sqxtn v24.4h, v24.4s\n"
-        "sqxtn2 v24.8h, v25.4s\n"
-        "sqadd v24.8h, v24.8h, v29.8h\n"
-        "sqxtun v24.8b, v24.8h\n"
-        "umax v24.8b, v24.8b, v30.8b\n"
-        "umin v24.8b, v24.8b, v31.8b\n"
-        "st1 {v24.8b}, [x6]\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_1_END ":\n"
-    :
-    // Outputs.
-    [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-    [output_ptr] "+r"(output_ptr),
-    [output_window_height] "+r"(output_window_height)
-    :
-    // Inputs.
-    [bias_ptr] "r"(bias_ptr), [input_row_size] "r"(input_row_size),
-    [input_depth] "r"(input_depth),
-    [output_window_width] "r"(output_window_width),
-    [input_width_increment] "r"(input_width_increment),
-    [input_height_increment] "r"(input_height_increment),
-    [output_height_increment] "r"(output_height_increment),
-    [params_ptr] "r"(params_ptr)
-    :
-    // Clobbers.
-    "cc", "memory",
-    // We use these NEON registers.
-    "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
-    "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-    "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29",
-    "v30", "v31",
-    // We use these general-purpose registers.
-    "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
-    "x9", "x10", "x11", "x12", "x13", "x14", "x15",
-    "x19", "x20");
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_END
-  }
-};
-
-template <>
-struct DepthwiseConvWindow {
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         int64_t input_depth, int64_t input_row_size,
-                         int32 output_window_height, int32 output_window_width,
-                         const DepthwiseConvParams* params_ptr) {
-    const int64_t input_width_increment = 4 * input_depth;
-    const int64_t input_height_increment = 4 * input_row_size;
-    const int64_t output_height_increment = 2 * params_ptr->output_row_size;
-
-#define DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "1"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "2"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "3"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "4"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "5"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "6"
-#define DEPTHWISECONV_LABEL_HEIGHT_1 "7"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "8"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "9"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "10"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_END "11"
-
-    asm volatile(
-        // Performs depthwise convolutions for a window specified by
-        // |output_window_height| and |output_window_width|. The inner-most loop
-        // processes 2x2 outputs, and any leftovers at the end.
-        //
-        // Algorithm works as follows:
-        //
-        //   1. Load filters of 8 depth (8x3x3). Registers v0--v8 hold filter
-        //      values.
-        //   2. For 2 output heights at a time:
-        //        i.  For 2 output widths at a time at stride 2, a 5x5 input
-        //            window is required. To avoid register exhaustion, we load
-        //            the first 2 rows of the 5x5 input window into registers
-        //            v9--v18, and use the same registers to load the next 2
-        //            rows, and finally v9--v13 to load the last row.
-        //            Accumulators for all 2x2 outputs are reserved by registers
-        //            v21-v22 (top left output), v23-v24 (top right output),
-        //            v19-v20 (bottom left output), v25-v26 (bottom right
-        //            output).
-        //        ii. Handle single leftover width if exists.
-        //   3. Handle single leftover height if exists.
-        //        i.  For 2 output widths at a time at stride 2, load inputs for
-        //            a 1x2 (1 height, 2 width) output window (3x5 input
-        //            window). Registers v9--v24 hold input values. Mul-add with
-        //            accumulators v24--v27.
-        //        ii. Handle single leftover width if exists.
-        //
-        // Loads are placed as soon as the register is no longer needed and
-        // interleaved with arithmetic operations to take advantage of
-        // dual-issue pipelines. We also add input offsets as far from the loads
-        // as possible to give loads enough cycles to fetch data from memory.
-
-        // Set "constant" registers. These registers may be replaced with temp
-        // values from time to time when there are not enough NEON registers.
-        // We use x9--x15 general purpose registers as they are caller-saved
-        // temporary registers (see http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf).  // NOLINT
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "ldr w0, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "cmp %w[output_window_height], #2\n"
-        "dup v28.8h, w0\n"
-        "ldr w1, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "dup v26.4s, w9\n"
-        "ldr w2, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w1\n"
-        "ldr w3, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v29.8h, w2\n"
-        "ldr w4, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.16b, w3\n"
-        "ldr x5, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "dup v31.16b, w4\n"
-        "ldr x19, [%[params_ptr], #" STR(OFFSET_OUTPUT_ROW_SIZE) "]\n"
-        "ldr w20, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-
-        // Load filters and add offsets.
-        "add x10, %[bias_ptr], #16\n"
-        "ld1 {v0.8b}, [%[filter_ptr]], x5\n"
-        "dup v9.8h, w20\n"
-        "ld1 {v1.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v0.8h, v9.8h, v0.8b\n"
-        "ld1 {v2.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v1.8h, v9.8h, v1.8b\n"
-        "ld1 {v3.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v2.8h, v9.8h, v2.8b\n"
-        "ld1 {v4.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v3.8h, v9.8h, v3.8b\n"
-        "ld1 {v5.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v4.8h, v9.8h, v4.8b\n"
-        "ld1 {v6.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v5.8h, v9.8h, v5.8b\n"
-        "ld1 {v7.8b}, [%[filter_ptr]], x5\n"
-        "uaddw v6.8h, v9.8h, v6.8b\n"
-        "ld1 {v8.8b}, [%[filter_ptr]]\n"
-        "uaddw v7.8h, v9.8h, v7.8b\n"
-        "uaddw v8.8h, v9.8h, v8.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_2_LOOP ":\n"
-          // Load the first two rows of the 5x5 input window, then reuse the
-          // same registers to load subsequent rows as they become available.
-          "mov x11, %[input_ptr]\n"
-          "mov x12, x11\n"
-          "add x13, x12, %[input_row_size]\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "mov w14, %w[output_window_width]\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          // The height 2 / width 2 loop loads an extra 1 output horizontally in
-          // anticipation for the next iteration. Make sure
-          // |output_window_width| is large enough to handle the additional
-          // load, otherwise jump to the appropriate label to handle smaller
-          // widths.
-          "cmp w14, #2\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x15, x13, %[input_row_size]\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "mov x6, %[output_ptr]\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "add x7, %[output_ptr], x19\n"
-          "ld1 {v16.8b}, [x13], %[input_depth]\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-          "uaddw v9.8h, v28.8h, v9.8b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "uaddw v10.8h, v28.8h, v10.8b\n"
-          "ld1 {v19.4s}, [%[bias_ptr]]\n"
-          "uaddw v11.8h, v28.8h, v11.8b\n"
-          "ld1 {v20.4s}, [x10]\n"
-          "uaddw v14.8h, v28.8h, v14.8b\n"
-          "ld1 {v25.4s}, [%[bias_ptr]]\n"
-          "uaddw v15.8h, v28.8h, v15.8b\n"
-          "ld1 {v26.4s}, [x10]\n"
-          "uaddw v16.8h, v28.8h, v16.8b\n"
-
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "f\n"
-          "cmp w14, #1\n"
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          //"loop_%=:\n"
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP ":\n"
-            "smlal v21.4s, v0.4h, v9.4h\n"
-            "ld1 {v12.8b}, [x12], %[input_depth]\n"
-            "smlal2 v22.4s, v0.8h, v9.8h\n"
-            "ld1 {v13.8b}, [x12]\n"
-            "add x12, x15, %[input_row_size]\n"
-            "smlal v23.4s, v0.4h, v11.4h\n"
-            "ld1 {v17.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v0.8h, v11.8h\n"
-            "ld1 {v18.8b}, [x13]\n"
-            "add x13, x12, %[input_row_size]\n"
-            "smlal v21.4s, v1.4h, v10.4h\n"
-            "ld1 {v9.8b}, [x15], %[input_depth]\n"
-            "smlal2 v22.4s, v1.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x15], %[input_depth]\n"
-            "smlal v21.4s, v2.4h, v11.4h\n"
-            "smlal2 v22.4s, v2.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x15], %[input_depth]\n"
-            "smlal v21.4s, v3.4h, v14.4h\n"
-            "smlal2 v22.4s, v3.8h, v14.8h\n"
-            "ld1 {v14.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v3.4h, v16.4h\n"
-            "subs w14, w14, #2\n"
-            "smlal2 v24.4s, v3.8h, v16.8h\n"
-            "cmp w14, #3\n"
-            "smlal v21.4s, v4.4h, v15.4h\n"
-            "uaddw v12.8h, v28.8h, v12.8b\n"
-            "smlal2 v22.4s, v4.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x12], %[input_depth]\n"
-            "smlal v21.4s, v5.4h, v16.4h\n"
-            "uaddw v13.8h, v28.8h, v13.8b\n"
-            "smlal2 v22.4s, v5.8h, v16.8h\n"
-            "ld1 {v16.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v1.4h, v12.4h\n"
-            "uaddw v17.8h, v28.8h, v17.8b\n"
-            "smlal2 v24.4s, v1.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x15], %[input_depth]\n"
-            "smlal v23.4s, v2.4h, v13.4h\n"
-            "uaddw v18.8h, v28.8h, v18.8b\n"
-            "smlal2 v24.4s, v2.8h, v13.8h\n"
-            "ld1 {v13.8b}, [x15]\n"
-            "smlal v23.4s, v4.4h, v17.4h\n"
-            "uaddw v9.8h, v28.8h, v9.8b\n"
-            "smlal2 v24.4s, v4.8h, v17.8h\n"
-            "ld1 {v17.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v5.4h, v18.4h\n"
-            "uaddw v10.8h, v28.8h, v10.8b\n"
-            "smlal2 v24.4s, v5.8h, v18.8h\n"
-            "ld1 {v18.8b}, [x12]\n"
-
-            "smlal v21.4s, v6.4h, v9.4h\n"
-            "smlal2 v22.4s, v6.8h, v9.8h\n"
-            "smlal v19.4s, v0.4h, v9.4h\n"
-            "uaddw v11.8h, v28.8h, v11.8b\n"
-            "smlal2 v20.4s, v0.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v6.4h, v11.4h\n"
-            "smlal2 v24.4s, v6.8h, v11.8h\n"
-            "smlal v21.4s, v7.4h, v10.4h\n"
-            "smlal2 v22.4s, v7.8h, v10.8h\n"
-            "uaddw v12.8h, v28.8h, v12.8b\n"
-            "smlal v19.4s, v1.4h, v10.4h\n"
-            "smlal2 v20.4s, v1.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v7.4h, v12.4h\n"
-            "smlal2 v24.4s, v7.8h, v12.8h\n"
-            "smlal v25.4s, v1.4h, v12.4h\n"
-            "smlal2 v26.4s, v1.8h, v12.8h\n"
-            "smlal v21.4s, v8.4h, v11.4h\n"
-            "smlal2 v22.4s, v8.8h, v11.8h\n"
-            "add x11, x11, %[input_width_increment]\n"
-            "smlal v19.4s, v2.4h, v11.4h\n"
-            "mov x12, x11\n"
-            "smlal2 v20.4s, v2.8h, v11.8h\n"
-            "uaddw v13.8h, v28.8h, v13.8b\n"
-            "smlal v25.4s, v0.4h, v11.4h\n"
-            "smlal2 v26.4s, v0.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v8.4h, v13.4h\n"
-            "ld1 {v12.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v8.8h, v13.8h\n"
-            "smlal v25.4s, v2.4h, v13.4h\n"
-            "smlal2 v26.4s, v2.8h, v13.8h\n"
-            "ld1 {v13.8b}, [x13]\n"
-            "add x13, x12, %[input_row_size]\n"
-            "add x15, x13, %[input_row_size]\n"
-
-            "dup v28.4s, w9\n"
-            "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-            "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-            "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-            "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-            "sqrshl v21.4s, v21.4s, v28.4s\n"
-            "sqrshl v22.4s, v22.4s, v28.4s\n"
-            "sqrshl v23.4s, v23.4s, v28.4s\n"
-            "sqrshl v24.4s, v24.4s, v28.4s\n"
-            "dup v28.8h, w0\n"
-            "sqxtn v21.4h, v21.4s\n"
-            "sqxtn2 v21.8h, v22.4s\n"
-            "sqxtn v23.4h, v23.4s\n"
-            "sqxtn2 v23.8h, v24.4s\n"
-            "sqadd v21.8h, v21.8h, v29.8h\n"
-            "sqadd v23.8h, v23.8h, v29.8h\n"
-            "sqxtun v21.8b, v21.8h\n"
-            "sqxtun2 v21.16b, v23.8h\n"
-            "ld1 {v22.4s}, [x10]\n"
-            "umax v21.16b, v21.16b, v30.16b\n"
-            "umin v21.16b, v21.16b, v31.16b\n"
-            "ld1 {v24.4s}, [x10]\n"
-            "uaddw v9.8h, v28.8h, v9.8b\n"
-            "st1 {v21.8b}, [x6], x5\n"
-            "uaddw v10.8h, v28.8h, v10.8b\n"
-            "mov v23.d[0], v21.d[1]\n"
-            "st1 {v23.8b}, [x6], x5\n"
-            "uaddw v11.8h, v28.8h, v11.8b\n"
-
-            "smlal v19.4s, v6.4h, v9.4h\n"
-            "smlal2 v20.4s, v6.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v6.4h, v11.4h\n"
-            "smlal2 v26.4s, v6.8h, v11.8h\n"
-            "smlal v19.4s, v7.4h, v10.4h\n"
-            "uaddw v12.8h, v28.8h, v12.8b\n"
-            "smlal2 v20.4s, v7.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v7.4h, v12.4h\n"
-            "smlal2 v26.4s, v7.8h, v12.8h\n"
-            "smlal v19.4s, v8.4h, v11.4h\n"
-            "uaddw v13.8h, v28.8h, v13.8b\n"
-            "smlal2 v20.4s, v8.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v8.4h, v13.4h\n"
-            "uaddw v14.8h, v28.8h, v14.8b\n"
-            "smlal2 v26.4s, v8.8h, v13.8h\n"
-            "uaddw v16.8h, v28.8h, v16.8b\n"
-            "smlal v19.4s, v3.4h, v14.4h\n"
-            "uaddw v15.8h, v28.8h, v15.8b\n"
-            "smlal2 v20.4s, v3.8h, v14.8h\n"
-            "ld1 {v14.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v3.4h, v16.4h\n"
-            "ld1 {v21.4s}, [%[bias_ptr]]\n"
-            "smlal2 v26.4s, v3.8h, v16.8h\n"
-            "ld1 {v23.4s}, [%[bias_ptr]]\n"
-            "smlal v19.4s, v4.4h, v15.4h\n"
-            "uaddw v17.8h, v28.8h, v17.8b\n"
-            "smlal2 v20.4s, v4.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v4.4h, v17.4h\n"
-            "smlal2 v26.4s, v4.8h, v17.8h\n"
-            "smlal v19.4s, v5.4h, v16.4h\n"
-            "uaddw v18.8h, v28.8h, v18.8b\n"
-            "smlal2 v20.4s, v5.8h, v16.8h\n"
-            "ld1 {v16.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v5.4h, v18.4h\n"
-            "smlal2 v26.4s, v5.8h, v18.8h\n"
-
-            "dup v28.4s, w9\n"
-            "sqrdmulh v19.4s, v19.4s, v27.4s\n"
-            "sqrdmulh v20.4s, v20.4s, v27.4s\n"
-            "sqrdmulh v25.4s, v25.4s, v27.4s\n"
-            "sqrdmulh v26.4s, v26.4s, v27.4s\n"
-            "sqrshl v19.4s, v19.4s, v28.4s\n"
-            "sqrshl v20.4s, v20.4s, v28.4s\n"
-            "sqrshl v25.4s, v25.4s, v28.4s\n"
-            "sqrshl v26.4s, v26.4s, v28.4s\n"
-            "dup v28.8h, w0\n"
-            "sqxtn v19.4h, v19.4s\n"
-            "sqxtn2 v19.8h, v20.4s\n"
-            "sqxtn v25.4h, v25.4s\n"
-            "sqxtn2 v25.8h, v26.4s\n"
-            "sqadd v19.8h, v19.8h, v29.8h\n"
-            "sqadd v25.8h, v25.8h, v29.8h\n"
-            "sqxtun v19.8b, v19.8h\n"
-            "sqxtun2 v19.16b, v25.8h\n"
-            "ld1 {v20.4s}, [x10]\n"
-            "umax v19.16b, v19.16b, v30.16b\n"
-            "umin v19.16b, v19.16b, v31.16b\n"
-            "ld1 {v26.4s}, [x10]\n"
-            "uaddw v9.8h, v28.8h, v9.8b\n"
-            "st1 {v19.8b}, [x7], x5\n"
-            "uaddw v10.8h, v28.8h, v10.8b\n"
-            "mov v25.d[0], v19.d[1]\n"
-            "st1 {v25.8b}, [x7], x5\n"
-            "uaddw v11.8h, v28.8h, v11.8b\n"
-            "ld1 {v19.4s}, [%[bias_ptr]]\n"
-            "uaddw v14.8h, v28.8h, v14.8b\n"
-            "ld1 {v25.4s}, [%[bias_ptr]]\n"
-            "uaddw v15.8h, v28.8h, v15.8b\n"
-            "uaddw v16.8h, v28.8h, v16.8b\n"
-
-            "bge " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "b\n"
-
-          // At this point, there will be one of 2 width or 1 width leftover,
-          // not both.
-          "cmp w14, #2\n"
-          "blt " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          // Handle last 2 columns if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER ":\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v12.8b}, [x12], %[input_depth]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v13.8b}, [x12]\n"
-          "add x12, x15, %[input_row_size]\n"
-          "smlal v23.4s, v0.4h, v11.4h\n"
-          "ld1 {v17.8b}, [x13], %[input_depth]\n"
-          "smlal2 v24.4s, v0.8h, v11.8h\n"
-          "ld1 {v18.8b}, [x13]\n"
-          "add x13, x12, %[input_row_size]\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "ld1 {v9.8b}, [x15], %[input_depth]\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v3.4h, v14.4h\n"
-          "smlal2 v22.4s, v3.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v3.4h, v16.4h\n"
-          "smlal2 v24.4s, v3.8h, v16.8h\n"
-          "smlal v21.4s, v4.4h, v15.4h\n"
-          "uaddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v22.4s, v4.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v5.4h, v16.4h\n"
-          "uaddw v13.8h, v28.8h, v13.8b\n"
-          "smlal2 v22.4s, v5.8h, v16.8h\n"
-          "ld1 {v16.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v1.4h, v12.4h\n"
-          "uaddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v24.4s, v1.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x15], %[input_depth]\n"
-          "smlal v23.4s, v2.4h, v13.4h\n"
-          "uaddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v24.4s, v2.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x15]\n"
-          "smlal v23.4s, v4.4h, v17.4h\n"
-          "uaddw v9.8h, v28.8h, v9.8b\n"
-          "smlal2 v24.4s, v4.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v5.4h, v18.4h\n"
-          "uaddw v10.8h, v28.8h, v10.8b\n"
-          "smlal2 v24.4s, v5.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x12]\n"
-
-          "smlal v21.4s, v6.4h, v9.4h\n"
-          "smlal2 v22.4s, v6.8h, v9.8h\n"
-          "smlal v19.4s, v0.4h, v9.4h\n"
-          "uaddw v11.8h, v28.8h, v11.8b\n"
-          "smlal2 v20.4s, v0.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v6.4h, v11.4h\n"
-          "smlal2 v24.4s, v6.8h, v11.8h\n"
-          "smlal v21.4s, v7.4h, v10.4h\n"
-          "smlal2 v22.4s, v7.8h, v10.8h\n"
-          "uaddw v12.8h, v28.8h, v12.8b\n"
-          "smlal v19.4s, v1.4h, v10.4h\n"
-          "smlal2 v20.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v7.4h, v12.4h\n"
-          "smlal2 v24.4s, v7.8h, v12.8h\n"
-          "smlal v25.4s, v1.4h, v12.4h\n"
-          "smlal2 v26.4s, v1.8h, v12.8h\n"
-          "smlal v21.4s, v8.4h, v11.4h\n"
-          "smlal2 v22.4s, v8.8h, v11.8h\n"
-          "smlal v19.4s, v2.4h, v11.4h\n"
-          "smlal2 v20.4s, v2.8h, v11.8h\n"
-          "uaddw v13.8h, v28.8h, v13.8b\n"
-          "smlal v25.4s, v0.4h, v11.4h\n"
-          "smlal2 v26.4s, v0.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v8.4h, v13.4h\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "smlal2 v24.4s, v8.8h, v13.8h\n"
-          "smlal v25.4s, v2.4h, v13.4h\n"
-          "smlal2 v26.4s, v2.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13]\n"
-
-          "dup v28.4s, w9\n"
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "sqrshl v21.4s, v21.4s, v28.4s\n"
-          "sqrshl v22.4s, v22.4s, v28.4s\n"
-          "sqrshl v23.4s, v23.4s, v28.4s\n"
-          "sqrshl v24.4s, v24.4s, v28.4s\n"
-          "dup v28.8h, w0\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "sqxtun2 v21.16b, v23.8h\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "umax v21.16b, v21.16b, v30.16b\n"
-          "umin v21.16b, v21.16b, v31.16b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "uaddw v9.8h, v28.8h, v9.8b\n"
-          "st1 {v21.8b}, [x6], x5\n"
-          "uaddw v10.8h, v28.8h, v10.8b\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [x6]\n"
-          "uaddw v11.8h, v28.8h, v11.8b\n"
-
-          "smlal v19.4s, v6.4h, v9.4h\n"
-          "smlal2 v20.4s, v6.8h, v9.8h\n"
-          "smlal v25.4s, v6.4h, v11.4h\n"
-          "smlal2 v26.4s, v6.8h, v11.8h\n"
-          "smlal v19.4s, v7.4h, v10.4h\n"
-          "uaddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v20.4s, v7.8h, v10.8h\n"
-          "smlal v25.4s, v7.4h, v12.4h\n"
-          "smlal2 v26.4s, v7.8h, v12.8h\n"
-          "smlal v19.4s, v8.4h, v11.4h\n"
-          "uaddw v13.8h, v28.8h, v13.8b\n"
-          "smlal2 v20.4s, v8.8h, v11.8h\n"
-          "smlal v25.4s, v8.4h, v13.4h\n"
-          "uaddw v14.8h, v28.8h, v14.8b\n"
-          "smlal2 v26.4s, v8.8h, v13.8h\n"
-          "uaddw v16.8h, v28.8h, v16.8b\n"
-          "smlal v19.4s, v3.4h, v14.4h\n"
-          "uaddw v15.8h, v28.8h, v15.8b\n"
-          "smlal2 v20.4s, v3.8h, v14.8h\n"
-          "smlal v25.4s, v3.4h, v16.4h\n"
-          "smlal2 v26.4s, v3.8h, v16.8h\n"
-          "smlal v19.4s, v4.4h, v15.4h\n"
-          "uaddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v20.4s, v4.8h, v15.8h\n"
-          "smlal v25.4s, v4.4h, v17.4h\n"
-          "smlal2 v26.4s, v4.8h, v17.8h\n"
-          "smlal v19.4s, v5.4h, v16.4h\n"
-          "uaddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v20.4s, v5.8h, v16.8h\n"
-          "smlal v25.4s, v5.4h, v18.4h\n"
-          "smlal2 v26.4s, v5.8h, v18.8h\n"
-
-          "dup v28.4s, w9\n"
-          "sqrdmulh v19.4s, v19.4s, v27.4s\n"
-          "sqrdmulh v20.4s, v20.4s, v27.4s\n"
-          "sqrdmulh v25.4s, v25.4s, v27.4s\n"
-          "sqrdmulh v26.4s, v26.4s, v27.4s\n"
-          "sqrshl v19.4s, v19.4s, v28.4s\n"
-          "sqrshl v20.4s, v20.4s, v28.4s\n"
-          "sqrshl v25.4s, v25.4s, v28.4s\n"
-          "sqrshl v26.4s, v26.4s, v28.4s\n"
-          "dup v28.8h, w0\n"
-          "sqxtn v19.4h, v19.4s\n"
-          "sqxtn2 v19.8h, v20.4s\n"
-          "sqxtn v25.4h, v25.4s\n"
-          "sqxtn2 v25.8h, v26.4s\n"
-          "sqadd v19.8h, v19.8h, v29.8h\n"
-          "sqadd v25.8h, v25.8h, v29.8h\n"
-          "sqxtun v19.8b, v19.8h\n"
-          "sqxtun2 v19.16b, v25.8h\n"
-          "umax v19.16b, v19.16b, v30.16b\n"
-          "umin v19.16b, v19.16b, v31.16b\n"
-          "st1 {v19.8b}, [x7], x5\n"
-          "mov v25.d[0], v19.d[1]\n"
-          "st1 {v25.8b}, [x7]\n"
-          "b " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "f\n"
-
-          // Handle last column if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER ":\n"
-          // Registers v9, v10, v11, v14, v15, and v16 have already been loaded
-          // with the correct values at this point. This corresponds to the
-          // first two input rows of the top left output. Now load the last
-          // input row for this output. Once these inputs are no longer needed,
-          // load the input rows for the bottom left output.
-          "add x12, x15, %[input_row_size]\n"
-          "add x13, x12, %[input_row_size]\n"
-
-          "ld1 {v12.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v13.8b}, [x15], %[input_depth]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v17.8b}, [x15]\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x12]\n"
-          "smlal v21.4s, v3.4h, v14.4h\n"
-          "smlal2 v22.4s, v3.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v21.4s, v4.4h, v15.4h\n"
-          "smlal2 v22.4s, v4.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "smlal v21.4s, v5.4h, v16.4h\n"
-          "uaddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v22.4s, v5.8h, v16.8h\n"
-          "uaddw v13.8h, v28.8h, v13.8b\n"
-          "ld1 {v16.8b}, [x13]\n"
-
-          "smlal v21.4s, v6.4h, v12.4h\n"
-          "smlal2 v22.4s, v6.8h, v12.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "uaddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v7.4h, v13.4h\n"
-          "smlal2 v22.4s, v7.8h, v13.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v2.4h, v17.4h\n"
-          "smlal2 v24.4s, v2.8h, v17.8h\n"
-
-          "dup v26.4s, w9\n"
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v27.4s\n"
-          "sqrshl v21.4s, v21.4s, v26.4s\n"
-          "sqrshl v22.4s, v22.4s, v26.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqxtun v21.8b, v21.8h\n"
-          "umax v21.8b, v21.8b, v30.8b\n"
-          "umin v21.8b, v21.8b, v31.8b\n"
-          "uaddw v9.8h, v28.8h, v9.8b\n"
-          "st1 {v21.8b}, [x6]\n"
-          "uaddw v10.8h, v28.8h, v10.8b\n"
-
-          "smlal v23.4s, v3.4h, v9.4h\n"
-          "uaddw v11.8h, v28.8h, v11.8b\n"
-          "smlal2 v24.4s, v3.8h, v9.8h\n"
-          "uaddw v14.8h, v28.8h, v14.8b\n"
-          "smlal v23.4s, v4.4h, v10.4h\n"
-          "uaddw v15.8h, v28.8h, v15.8b\n"
-          "smlal2 v24.4s, v4.8h, v10.8h\n"
-          "uaddw v16.8h, v28.8h, v16.8b\n"
-          "smlal v23.4s, v5.4h, v11.4h\n"
-          "smlal2 v24.4s, v5.8h, v11.8h\n"
-
-          "smlal v23.4s, v6.4h, v14.4h\n"
-          "smlal2 v24.4s, v6.8h, v14.8h\n"
-          "smlal v23.4s, v7.4h, v15.4h\n"
-          "smlal2 v24.4s, v7.8h, v15.8h\n"
-          "smlal v23.4s, v8.4h, v16.4h\n"
-          "smlal2 v24.4s, v8.8h, v16.8h\n"
-
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-          "sqrshl v23.4s, v23.4s, v26.4s\n"
-          "sqrshl v24.4s, v24.4s, v26.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtun v23.8b, v23.8h\n"
-          "umax v23.8b, v23.8b, v30.8b\n"
-          "umin v23.8b, v23.8b, v31.8b\n"
-          "st1 {v23.8b}, [x7]\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP ":\n"
-          "subs %w[output_window_height], %w[output_window_height], #2\n"
-          "add %[input_ptr], %[input_ptr], %[input_height_increment]\n"
-          "cmp %w[output_window_height], #2\n"
-          "add %[output_ptr], %[output_ptr], %[output_height_increment]\n"
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP ":\n"
-        "cmp %w[output_window_height], #1\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_1 ":\n"
-        "mov x11, %[input_ptr]\n"
-        "mov x12, x11\n"
-        "add x13, x12, %[input_row_size]\n"
-        "ld1 {v9.8b}, [x12], %[input_depth]\n"
-        "add x15, x13, %[input_row_size]\n"
-        "ld1 {v10.8b}, [x12], %[input_depth]\n"
-        "mov x6, %[output_ptr]\n"
-        "ld1 {v11.8b}, [x12], %[input_depth]\n"
-        "mov w14, %w[output_window_width]\n"
-        // The height 1 / width 2 loop loads an extra 1x1 output in anticipation
-        // for the next iteration. Make sure |output_window_width| is large
-        // enough to handle the additional load, otherwise jump to the
-        // appropriate label to handle smaller widths.
-        "cmp w14, #2\n"
-        "ld1 {v12.8b}, [x13], %[input_depth]\n"
-        "ld1 {v13.8b}, [x13], %[input_depth]\n"
-        "ld1 {v14.8b}, [x13], %[input_depth]\n"
-        "ld1 {v15.8b}, [x15], %[input_depth]\n"
-        "ld1 {v16.8b}, [x15], %[input_depth]\n"
-        "ld1 {v17.8b}, [x15], %[input_depth]\n"
-
-        "uaddw v9.8h, v28.8h, v9.8b\n"
-        "ld1 {v24.4s}, [%[bias_ptr]]\n"
-        "uaddw v10.8h, v28.8h, v10.8b\n"
-        "ld1 {v25.4s}, [x10]\n"
-        "uaddw v11.8h, v28.8h, v11.8b\n"
-        "ld1 {v26.4s}, [%[bias_ptr]]\n"
-        "ld1 {v27.4s}, [x10]\n"
-        "uaddw v12.8h, v28.8h, v12.8b\n"
-        "uaddw v13.8h, v28.8h, v13.8b\n"
-        "uaddw v14.8h, v28.8h, v14.8b\n"
-        "uaddw v15.8h, v28.8h, v15.8b\n"
-        "uaddw v16.8h, v28.8h, v16.8b\n"
-        "uaddw v17.8h, v28.8h, v17.8b\n"
-
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "f\n"
-        "cmp w14, #1\n"
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP ":\n"
-          "smlal v24.4s, v0.4h, v9.4h\n"
-          "ld1 {v18.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v0.8h, v9.8h\n"
-          "ld1 {v19.8b}, [x12]\n"
-          "smlal v26.4s, v0.4h, v11.4h\n"
-          "ld1 {v20.8b}, [x13], %[input_depth]\n"
-          "smlal2 v27.4s, v0.8h, v11.8h\n"
-          "ld1 {v21.8b}, [x13]\n"
-          "smlal v24.4s, v1.4h, v10.4h\n"
-          "ld1 {v22.8b}, [x15], %[input_depth]\n"
-          "smlal2 v25.4s, v1.8h, v10.8h\n"
-          "ld1 {v23.8b}, [x15]\n"
-          "smlal v24.4s, v2.4h, v11.4h\n"
-          "subs w14, w14, #2\n"
-          "smlal2 v25.4s, v2.8h, v11.8h\n"
-          "cmp w14, #3\n"
-          "smlal v24.4s, v3.4h, v12.4h\n"
-          "add x11, x11, %[input_width_increment]\n"
-          "smlal2 v25.4s, v3.8h, v12.8h\n"
-          "mov x12, x11\n"
-          "smlal v26.4s, v3.4h, v14.4h\n"
-          "add x13, x12, %[input_row_size]\n"
-          "smlal2 v27.4s, v3.8h, v14.8h\n"
-          "add x15, x13, %[input_row_size]\n"
-          "smlal v24.4s, v4.4h, v13.4h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v4.8h, v13.8h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "smlal v24.4s, v5.4h, v14.4h\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v5.8h, v14.8h\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "smlal v24.4s, v6.4h, v15.4h\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "smlal2 v25.4s, v6.8h, v15.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v26.4s, v6.4h, v17.4h\n"
-          "ld1 {v15.8b}, [x15], %[input_depth]\n"
-          "smlal2 v27.4s, v6.8h, v17.8h\n"
-          "smlal v24.4s, v7.4h, v16.4h\n"
-          "smlal2 v25.4s, v7.8h, v16.8h\n"
-          "ld1 {v16.8b}, [x15], %[input_depth]\n"
-          "smlal v24.4s, v8.4h, v17.4h\n"
-          "uaddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v25.4s, v8.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x15], %[input_depth]\n"
-          "uaddw v19.8h, v28.8h, v19.8b\n"
-
-          "smlal v26.4s, v1.4h, v18.4h\n"
-          "uaddw v20.8h, v28.8h, v20.8b\n"
-          "smlal2 v27.4s, v1.8h, v18.8h\n"
-          "smlal v26.4s, v2.4h, v19.4h\n"
-          "uaddw v21.8h, v28.8h, v21.8b\n"
-          "smlal2 v27.4s, v2.8h, v19.8h\n"
-          "smlal v26.4s, v4.4h, v20.4h\n"
-          "smlal v26.4s, v5.4h, v21.4h\n"
-          "smlal2 v27.4s, v4.8h, v20.8h\n"
-          "uaddw v22.8h, v28.8h, v22.8b\n"
-          "smlal2 v27.4s, v5.8h, v21.8h\n"
-          "uaddw v23.8h, v28.8h, v23.8b\n"
-          "smlal v26.4s, v7.4h, v22.4h\n"
-          "smlal2 v27.4s, v7.8h, v22.8h\n"
-          "smlal v26.4s, v8.4h, v23.4h\n"
-          "smlal2 v27.4s, v8.8h, v23.8h\n"
-
-          "dup v28.4s, w1\n"
-          "dup v29.4s, w9\n"
-          "sqrdmulh v24.4s, v24.4s, v28.4s\n"
-          "sqrdmulh v25.4s, v25.4s, v28.4s\n"
-          "sqrdmulh v26.4s, v26.4s, v28.4s\n"
-          "sqrdmulh v27.4s, v27.4s, v28.4s\n"
-          "dup v28.8h, w2\n"
-          "sqrshl v24.4s, v24.4s, v29.4s\n"
-          "sqrshl v25.4s, v25.4s, v29.4s\n"
-          "sqrshl v26.4s, v26.4s, v29.4s\n"
-          "sqrshl v27.4s, v27.4s, v29.4s\n"
-          "sqxtn v24.4h, v24.4s\n"
-          "sqxtn2 v24.8h, v25.4s\n"
-          "sqxtn v26.4h, v26.4s\n"
-          "sqxtn2 v26.8h, v27.4s\n"
-          "sqadd v24.8h, v24.8h, v28.8h\n"
-          "sqadd v26.8h, v26.8h, v28.8h\n"
-          "sqxtun v24.8b, v24.8h\n"
-          "sqxtun2 v24.16b, v26.8h\n"
-          "dup v28.8h, w0\n"
-          "ld1 {v25.4s}, [x10]\n"
-          "umax v24.16b, v24.16b, v30.16b\n"
-          "umin v24.16b, v24.16b, v31.16b\n"
-          "ld1 {v27.4s}, [x10]\n"
-          "uaddw v9.8h, v28.8h, v9.8b\n"
-          "st1 {v24.8b}, [x6], x5\n"
-          "uaddw v10.8h, v28.8h, v10.8b\n"
-          "mov v26.d[0], v24.d[1]\n"
-          "st1 {v26.8b}, [x6], x5\n"
-          "uaddw v11.8h, v28.8h, v11.8b\n"
-          "uaddw v12.8h, v28.8h, v12.8b\n"
-          "uaddw v13.8h, v28.8h, v13.8b\n"
-          "uaddw v14.8h, v28.8h, v14.8b\n"
-          "ld1 {v24.4s}, [%[bias_ptr]]\n"
-          "uaddw v15.8h, v28.8h, v15.8b\n"
-          "ld1 {v26.4s}, [%[bias_ptr]]\n"
-          "uaddw v16.8h, v28.8h, v16.8b\n"
-          "uaddw v17.8h, v28.8h, v17.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "b\n"
-
-        // At this point, there will be one of 2 width or 1 width leftover,
-        // not both.
-        "cmp w14, #2\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        // Handle last two horizontal outputs if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER ":\n"
-        "smlal v24.4s, v0.4h, v9.4h\n"
-        "ld1 {v18.8b}, [x12], %[input_depth]\n"
-        "smlal2 v25.4s, v0.8h, v9.8h\n"
-        "ld1 {v19.8b}, [x12]\n"
-        "smlal v26.4s, v0.4h, v11.4h\n"
-        "ld1 {v20.8b}, [x13], %[input_depth]\n"
-        "smlal2 v27.4s, v0.8h, v11.8h\n"
-        "ld1 {v21.8b}, [x13]\n"
-        "smlal v24.4s, v1.4h, v10.4h\n"
-        "ld1 {v22.8b}, [x15], %[input_depth]\n"
-        "smlal2 v25.4s, v1.8h, v10.8h\n"
-        "ld1 {v23.8b}, [x15]\n"
-        "smlal v24.4s, v2.4h, v11.4h\n"
-        "smlal2 v25.4s, v2.8h, v11.8h\n"
-        "smlal v24.4s, v3.4h, v12.4h\n"
-        "smlal2 v25.4s, v3.8h, v12.8h\n"
-        "smlal v26.4s, v3.4h, v14.4h\n"
-        "smlal2 v27.4s, v3.8h, v14.8h\n"
-        "smlal v24.4s, v4.4h, v13.4h\n"
-        "smlal2 v25.4s, v4.8h, v13.8h\n"
-        "smlal v24.4s, v5.4h, v14.4h\n"
-        "smlal2 v25.4s, v5.8h, v14.8h\n"
-        "smlal v24.4s, v6.4h, v15.4h\n"
-        "smlal2 v25.4s, v6.8h, v15.8h\n"
-        "smlal v26.4s, v6.4h, v17.4h\n"
-        "smlal2 v27.4s, v6.8h, v17.8h\n"
-        "smlal v24.4s, v7.4h, v16.4h\n"
-        "smlal2 v25.4s, v7.8h, v16.8h\n"
-        "smlal v24.4s, v8.4h, v17.4h\n"
-        "uaddw v18.8h, v28.8h, v18.8b\n"
-        "smlal2 v25.4s, v8.8h, v17.8h\n"
-        "uaddw v19.8h, v28.8h, v19.8b\n"
-
-        "smlal v26.4s, v1.4h, v18.4h\n"
-        "uaddw v20.8h, v28.8h, v20.8b\n"
-        "smlal2 v27.4s, v1.8h, v18.8h\n"
-        "smlal v26.4s, v2.4h, v19.4h\n"
-        "uaddw v21.8h, v28.8h, v21.8b\n"
-        "smlal2 v27.4s, v2.8h, v19.8h\n"
-        "smlal v26.4s, v4.4h, v20.4h\n"
-        "smlal v26.4s, v5.4h, v21.4h\n"
-        "smlal2 v27.4s, v4.8h, v20.8h\n"
-        "uaddw v22.8h, v28.8h, v22.8b\n"
-        "smlal2 v27.4s, v5.8h, v21.8h\n"
-        "uaddw v23.8h, v28.8h, v23.8b\n"
-        "smlal v26.4s, v7.4h, v22.4h\n"
-        "smlal2 v27.4s, v7.8h, v22.8h\n"
-        "smlal v26.4s, v8.4h, v23.4h\n"
-        "smlal2 v27.4s, v8.8h, v23.8h\n"
-
-        "dup v28.4s, w1\n"
-        "dup v29.4s, w9\n"
-        "sqrdmulh v24.4s, v24.4s, v28.4s\n"
-        "sqrdmulh v25.4s, v25.4s, v28.4s\n"
-        "sqrdmulh v26.4s, v26.4s, v28.4s\n"
-        "sqrdmulh v27.4s, v27.4s, v28.4s\n"
-        "dup v28.8h, w2\n"
-        "sqrshl v24.4s, v24.4s, v29.4s\n"
-        "sqrshl v25.4s, v25.4s, v29.4s\n"
-        "sqrshl v26.4s, v26.4s, v29.4s\n"
-        "sqrshl v27.4s, v27.4s, v29.4s\n"
-        "sqxtn v24.4h, v24.4s\n"
-        "sqxtn2 v24.8h, v25.4s\n"
-        "sqxtn v26.4h, v26.4s\n"
-        "sqxtn2 v26.8h, v27.4s\n"
-        "sqadd v24.8h, v24.8h, v28.8h\n"
-        "sqadd v26.8h, v26.8h, v28.8h\n"
-        "sqxtun v24.8b, v24.8h\n"
-        "sqxtun2 v24.16b, v26.8h\n"
-        "dup v28.8h, w0\n"
-        "umax v24.16b, v24.16b, v30.16b\n"
-        "umin v24.16b, v24.16b, v31.16b\n"
-        "st1 {v24.8b}, [x6], x5\n"
-        "mov v26.d[0], v24.d[1]\n"
-        "st1 {v26.8b}, [x6]\n"
-        "b " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        // Handle bottom right output if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER ":\n"
-        "dup v26.4s, w9\n"
-        "dup v27.4s, w1\n"
-        "dup v29.8h, w2\n"
-
-        "smlal v24.4s, v0.4h, v9.4h\n"
-        "smlal2 v25.4s, v0.8h, v9.8h\n"
-        "smlal v24.4s, v1.4h, v10.4h\n"
-        "smlal2 v25.4s, v1.8h, v10.8h\n"
-        "smlal v24.4s, v2.4h, v11.4h\n"
-        "smlal2 v25.4s, v2.8h, v11.8h\n"
-        "smlal v24.4s, v3.4h, v12.4h\n"
-        "smlal2 v25.4s, v3.8h, v12.8h\n"
-        "smlal v24.4s, v4.4h, v13.4h\n"
-        "smlal2 v25.4s, v4.8h, v13.8h\n"
-        "smlal v24.4s, v5.4h, v14.4h\n"
-        "smlal2 v25.4s, v5.8h, v14.8h\n"
-        "smlal v24.4s, v6.4h, v15.4h\n"
-        "smlal2 v25.4s, v6.8h, v15.8h\n"
-        "smlal v24.4s, v7.4h, v16.4h\n"
-        "smlal2 v25.4s, v7.8h, v16.8h\n"
-        "smlal v24.4s, v8.4h, v17.4h\n"
-        "smlal2 v25.4s, v8.8h, v17.8h\n"
-
-        "sqrdmulh v24.4s, v24.4s, v27.4s\n"
-        "sqrdmulh v25.4s, v25.4s, v27.4s\n"
-        "sqrshl v24.4s, v24.4s, v26.4s\n"
-        "sqrshl v25.4s, v25.4s, v26.4s\n"
-        "sqxtn v24.4h, v24.4s\n"
-        "sqxtn2 v24.8h, v25.4s\n"
-        "sqadd v24.8h, v24.8h, v29.8h\n"
-        "sqxtun v24.8b, v24.8h\n"
-        "umax v24.8b, v24.8b, v30.8b\n"
-        "umin v24.8b, v24.8b, v31.8b\n"
-        "st1 {v24.8b}, [x6]\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_1_END ":\n"
-    :
-    // Outputs.
-    [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-    [output_ptr] "+r"(output_ptr),
-    [output_window_height] "+r"(output_window_height)
-    :
-    // Inputs.
-    [bias_ptr] "r"(bias_ptr), [input_row_size] "r"(input_row_size),
-    [input_depth] "r"(input_depth),
-    [output_window_width] "r"(output_window_width),
-    [input_width_increment] "r"(input_width_increment),
-    [input_height_increment] "r"(input_height_increment),
-    [output_height_increment] "r"(output_height_increment),
-    [params_ptr] "r"(params_ptr)
-    :
-    // Clobbers.
-    "cc", "memory",
-    // We use these NEON registers.
-    "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
-    "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-    "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29",
-    "v30", "v31",
-    // We use these general-purpose registers.
-    "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
-    "x9", "x10", "x11", "x12", "x13", "x14", "x15",
-    "x19", "x20");
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_END
-  }
-};
-
-template <>
-struct DepthwiseConvPartial {
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 1x1 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the 1x1 input and filter values.
-        "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "ldr w10, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "dup v26.8h, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w10\n"
-        "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-        "cmp x11, #16\n"
-        "ldr w10, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "dup v28.8h, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v29.4s, w10\n"
-        "ldr w10, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.16b, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-        "dup v31.16b, w10\n"
-        "dup v25.8h, w9\n"
-
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v0.8h, v25.8h, v0.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "subs x11, x11, #8\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-          "cmp x11, #16\n"
-          "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-
-          "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-          "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-          "and v18.16b, v16.16b, v29.16b\n"
-          "and v19.16b, v17.16b, v29.16b\n"
-          "sshr v18.4s, v18.4s, #31\n"
-          "sshr v19.4s, v19.4s, #31\n"
-          "sqadd v16.4s, v16.4s, v18.4s\n"
-          "sqadd v17.4s, v17.4s, v19.4s\n"
-          "srshl v16.4s, v16.4s, v29.4s\n"
-          "srshl v17.4s, v17.4s, v29.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtun v16.8b, v16.8h\n"
-          "umax v16.8b, v16.8b, v30.8b\n"
-          "umin v16.8b, v16.8b, v31.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "uaddw v8.8h, v26.8h, v8.8b\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v0.8h, v25.8h, v0.8b\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-        "and v18.16b, v16.16b, v29.16b\n"
-        "and v19.16b, v17.16b, v29.16b\n"
-        "sshr v18.4s, v18.4s, #31\n"
-        "sshr v19.4s, v19.4s, #31\n"
-        "sqadd v16.4s, v16.4s, v18.4s\n"
-        "sqadd v17.4s, v17.4s, v19.4s\n"
-        "srshl v16.4s, v16.4s, v29.4s\n"
-        "srshl v17.4s, v17.4s, v29.4s\n"
-
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtun v16.8b, v16.8h\n"
-        "umax v16.8b, v16.8b, v30.8b\n"
-        "umin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v8", "v16", "v17", "v18", "v19", "v25", "v26", "v27", "v28",
-        "v29", "v30", "v31",
-        // We use these general-purpose registers.
-        "x9", "x10", "x11");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-template <>
-struct DepthwiseConvPartial {
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 1x1 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the 1x1 input and filter values.
-        "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "ldr w10, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "dup v26.8h, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w10\n"
-        "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-        "cmp x11, #16\n"
-        "ldr w10, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "dup v28.8h, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v29.4s, w10\n"
-        "ldr w10, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.16b, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-        "dup v31.16b, w10\n"
-        "dup v25.8h, w9\n"
-
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v0.8h, v25.8h, v0.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "subs x11, x11, #8\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-          "cmp x11, #16\n"
-          "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-
-          "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-          "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-          "sqrshl v16.4s, v16.4s, v29.4s\n"
-          "sqrshl v17.4s, v17.4s, v29.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtun v16.8b, v16.8h\n"
-          "umax v16.8b, v16.8b, v30.8b\n"
-          "umin v16.8b, v16.8b, v31.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "uaddw v8.8h, v26.8h, v8.8b\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v0.8h, v25.8h, v0.8b\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-        "sqrshl v16.4s, v16.4s, v29.4s\n"
-        "sqrshl v17.4s, v17.4s, v29.4s\n"
-
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtun v16.8b, v16.8h\n"
-        "umax v16.8b, v16.8b, v30.8b\n"
-        "umin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v8", "v16", "v17", "v18", "v19", "v25", "v26", "v27", "v28",
-        "v29", "v30", "v31",
-        // We use these general-purpose registers.
-        "x9", "x10", "x11");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-template <>
-struct DepthwiseConvPartial {
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 2x2 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 2x2 input and
-        // filter values.
-
-        // Load input and filter values.
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "ldr x9, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "cmp x15, #16\n"
-        "add x12, %[input_ptr], x15\n"
-        "add x13, %[input_ptr], x9\n"
-        "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-        "add x14, x13, x15\n"
-        "ld1 {v9.8b}, [x12], #8\n"
-        "ldr x6, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-
-        "add x9, %[filter_ptr], x15\n"
-        "ld1 {v10.8b}, [x13], #8\n"
-        "add x10, %[filter_ptr], x6\n"
-        "ld1 {v11.8b}, [x14], #8\n"
-        "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-        "add x11, x10, x15\n"
-        "ld1 {v1.8b}, [x9], #8\n"
-        "ld1 {v2.8b}, [x10], #8\n"
-        "ld1 {v3.8b}, [x11], #8\n"
-
-        // Load constants.
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr w7, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "dup v26.8h, w6\n"
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w7\n"
-        "ldr w7, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "dup v28.8h, w6\n"
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v29.4s, w7\n"
-        "ldr w7, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.16b, w6\n"
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-        "dup v31.16b, w7\n"
-        "dup v25.8h, w6\n"
-
-        // Add input and filter offsets.
-        "uaddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v9.8h, v26.8h, v9.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v10.8h, v26.8h, v10.8b\n"
-        "uaddw v11.8h, v26.8h, v11.8b\n"
-
-        "uaddw v0.8h, v25.8h, v0.8b\n"
-        "uaddw v1.8h, v25.8h, v1.8b\n"
-        "uaddw v2.8h, v25.8h, v2.8b\n"
-        "uaddw v3.8h, v25.8h, v3.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "subs x15, x15, #8\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-          "cmp x15, #16\n"
-          "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x12], #8\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "ld1 {v1.8b}, [x9], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], #8\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v2.8b}, [x10], #8\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x14], #8\n"
-          "ld1 {v3.8b}, [x11], #8\n"
-
-          "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-          "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-          "and v18.16b, v16.16b, v29.16b\n"
-          "and v19.16b, v17.16b, v29.16b\n"
-          "sshr v18.4s, v18.4s, #31\n"
-          "sshr v19.4s, v19.4s, #31\n"
-          "sqadd v16.4s, v16.4s, v18.4s\n"
-          "sqadd v17.4s, v17.4s, v19.4s\n"
-          "srshl v16.4s, v16.4s, v29.4s\n"
-          "srshl v17.4s, v17.4s, v29.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtun v16.8b, v16.8h\n"
-          "umax v16.8b, v16.8b, v30.8b\n"
-          "umin v16.8b, v16.8b, v31.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "uaddw v8.8h, v26.8h, v8.8b\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v10.8h, v26.8h, v10.8b\n"
-          "uaddw v11.8h, v26.8h, v11.8b\n"
-          "uaddw v0.8h, v25.8h, v0.8b\n"
-          "uaddw v1.8h, v25.8h, v1.8b\n"
-          "uaddw v2.8h, v25.8h, v2.8b\n"
-          "uaddw v3.8h, v25.8h, v3.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-        "and v18.16b, v16.16b, v29.16b\n"
-        "and v19.16b, v17.16b, v29.16b\n"
-        "sshr v18.4s, v18.4s, #31\n"
-        "sshr v19.4s, v19.4s, #31\n"
-        "sqadd v16.4s, v16.4s, v18.4s\n"
-        "sqadd v17.4s, v17.4s, v19.4s\n"
-        "srshl v16.4s, v16.4s, v29.4s\n"
-        "srshl v17.4s, v17.4s, v29.4s\n"
-
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtun v16.8b, v16.8h\n"
-        "umax v16.8b, v16.8b, v30.8b\n"
-        "umin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", "v16", "v17", "v18",
-        "v19", "v25", "v26", "v27", "v28", "v29", "v30", "v31",
-        // We use these general-purpose registers.
-        "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-template <>
-struct DepthwiseConvPartial {
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 2x2 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 2x2 input and
-        // filter values.
-
-        // Load input and filter values.
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "ldr x9, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "cmp x15, #16\n"
-        "add x12, %[input_ptr], x15\n"
-        "add x13, %[input_ptr], x9\n"
-        "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-        "add x14, x13, x15\n"
-        "ld1 {v9.8b}, [x12], #8\n"
-        "ldr x6, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-
-        "add x9, %[filter_ptr], x15\n"
-        "ld1 {v10.8b}, [x13], #8\n"
-        "add x10, %[filter_ptr], x6\n"
-        "ld1 {v11.8b}, [x14], #8\n"
-        "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-        "add x11, x10, x15\n"
-        "ld1 {v1.8b}, [x9], #8\n"
-        "ld1 {v2.8b}, [x10], #8\n"
-        "ld1 {v3.8b}, [x11], #8\n"
-
-        // Load constants.
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr w7, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "dup v26.8h, w6\n"
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w7\n"
-        "ldr w7, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "dup v28.8h, w6\n"
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v29.4s, w7\n"
-        "ldr w7, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.16b, w6\n"
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-        "dup v31.16b, w7\n"
-        "dup v25.8h, w6\n"
-
-        // Add input and filter offsets.
-        "uaddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v9.8h, v26.8h, v9.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v10.8h, v26.8h, v10.8b\n"
-        "uaddw v11.8h, v26.8h, v11.8b\n"
-
-        "uaddw v0.8h, v25.8h, v0.8b\n"
-        "uaddw v1.8h, v25.8h, v1.8b\n"
-        "uaddw v2.8h, v25.8h, v2.8b\n"
-        "uaddw v3.8h, v25.8h, v3.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "subs x15, x15, #8\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-          "cmp x15, #16\n"
-          "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x12], #8\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "ld1 {v1.8b}, [x9], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], #8\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v2.8b}, [x10], #8\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x14], #8\n"
-          "ld1 {v3.8b}, [x11], #8\n"
-
-          "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-          "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-          "sqrshl v16.4s, v16.4s, v29.4s\n"
-          "sqrshl v17.4s, v17.4s, v29.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtun v16.8b, v16.8h\n"
-          "umax v16.8b, v16.8b, v30.8b\n"
-          "umin v16.8b, v16.8b, v31.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "uaddw v8.8h, v26.8h, v8.8b\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v10.8h, v26.8h, v10.8b\n"
-          "uaddw v11.8h, v26.8h, v11.8b\n"
-          "uaddw v0.8h, v25.8h, v0.8b\n"
-          "uaddw v1.8h, v25.8h, v1.8b\n"
-          "uaddw v2.8h, v25.8h, v2.8b\n"
-          "uaddw v3.8h, v25.8h, v3.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-        "sqrshl v16.4s, v16.4s, v29.4s\n"
-        "sqrshl v17.4s, v17.4s, v29.4s\n"
-
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtun v16.8b, v16.8h\n"
-        "umax v16.8b, v16.8b, v30.8b\n"
-        "umin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v8", "v9", "v10", "v11", "v16", "v17", "v18",
-        "v19", "v25", "v26", "v27", "v28", "v29", "v30", "v31",
-        // We use these general-purpose registers.
-        "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-template <>
-struct DepthwiseConvPartial {
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 2x3 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 2x3 input and
-        // filter values.
-
-        // Load input and filter values.
-        "ldr x7, [%[params_ptr], #" STR(OFFSET_INPUT_DEPTH) "]\n"
-        "mov x12, %[input_ptr]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "mov x9, %[filter_ptr]\n"
-        "ldr x14, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-        "add x13, x12, x11\n"
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-
-        "ld1 {v8.8b}, [x12], x7\n"
-        "add x10, x9, x14\n"
-        "ld1 {v9.8b}, [x12], x7\n"
-        "cmp x15, #16\n"
-        "ld1 {v10.8b}, [x12]\n"
-        "add %[input_ptr], %[input_ptr], #8\n"
-        "ld1 {v11.8b}, [x13], x7\n"
-        "add %[filter_ptr], %[filter_ptr], #8\n"
-        "ld1 {v12.8b}, [x13], x7\n"
-        "ld1 {v13.8b}, [x13]\n"
-
-        "ld1 {v0.8b}, [x9], x7\n"
-        "ld1 {v1.8b}, [x9], x7\n"
-        "ld1 {v2.8b}, [x9]\n"
-        "ld1 {v3.8b}, [x10], x7\n"
-        "ld1 {v4.8b}, [x10], x7\n"
-        "ld1 {v5.8b}, [x10]\n"
-
-        // Load constants.
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "dup v26.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w13\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "dup v28.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v29.4s, w13\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.8b, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-        "dup v31.8b, w13\n"
-        "dup v25.8h, w12\n"
-
-        // Add input and filter offsets.
-        "uaddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v9.8h, v26.8h, v9.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v10.8h, v26.8h, v10.8b\n"
-        "uaddw v11.8h, v26.8h, v11.8b\n"
-        "uaddw v12.8h, v26.8h, v12.8b\n"
-        "uaddw v13.8h, v26.8h, v13.8b\n"
-
-        "uaddw v0.8h, v25.8h, v0.8b\n"
-        "uaddw v1.8h, v25.8h, v1.8b\n"
-        "uaddw v2.8h, v25.8h, v2.8b\n"
-        "uaddw v3.8h, v25.8h, v3.8b\n"
-        "uaddw v4.8h, v25.8h, v4.8b\n"
-        "uaddw v5.8h, v25.8h, v5.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "mov x12, %[input_ptr]\n"
-          "subs x15, x15, #8\n"
-          "add x13, x12, x11\n"
-          "cmp x15, #16\n"
-          "add %[input_ptr], %[input_ptr], #8\n"
-
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "mov x9, %[filter_ptr]\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [x12], x7\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "add x10, x9, x14\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x12], x7\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "add %[filter_ptr], %[filter_ptr], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x12]\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v0.8b}, [x9], x7\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13], x7\n"
-          "smlal v16.4s, v4.4h, v12.4h\n"
-          "ld1 {v1.8b}, [x9], x7\n"
-          "smlal2 v17.4s, v4.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x13], x7\n"
-          "smlal v16.4s, v5.4h, v13.4h\n"
-          "ld1 {v2.8b}, [x9]\n"
-          "smlal2 v17.4s, v5.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13]\n"
-
-          "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-          "ld1 {v3.8b}, [x10], x7\n"
-          "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-          "ld1 {v4.8b}, [x10], x7\n"
-          "and v18.16b, v16.16b, v29.16b\n"
-          "ld1 {v5.8b}, [x10]\n"
-          "and v19.16b, v17.16b, v29.16b\n"
-          "sshr v18.4s, v18.4s, #31\n"
-          "sshr v19.4s, v19.4s, #31\n"
-          "sqadd v16.4s, v16.4s, v18.4s\n"
-          "sqadd v17.4s, v17.4s, v19.4s\n"
-          "srshl v16.4s, v16.4s, v29.4s\n"
-          "srshl v17.4s, v17.4s, v29.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtun v16.8b, v16.8h\n"
-          "umax v16.8b, v16.8b, v30.8b\n"
-          "umin v16.8b, v16.8b, v31.8b\n"
-          "uaddw v8.8h, v26.8h, v8.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "uaddw v10.8h, v26.8h, v10.8b\n"
-          "uaddw v11.8h, v26.8h, v11.8b\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "uaddw v13.8h, v26.8h, v13.8b\n"
-
-          "uaddw v0.8h, v25.8h, v0.8b\n"
-          "uaddw v1.8h, v25.8h, v1.8b\n"
-          "uaddw v2.8h, v25.8h, v2.8b\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v3.8h, v25.8h, v3.8b\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v4.8h, v25.8h, v4.8b\n"
-          "uaddw v5.8h, v25.8h, v5.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-        "smlal v16.4s, v4.4h, v12.4h\n"
-        "smlal2 v17.4s, v4.8h, v12.8h\n"
-        "smlal v16.4s, v5.4h, v13.4h\n"
-        "smlal2 v17.4s, v5.8h, v13.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-        "and v18.16b, v16.16b, v29.16b\n"
-        "and v19.16b, v17.16b, v29.16b\n"
-        "sshr v18.4s, v18.4s, #31\n"
-        "sshr v19.4s, v19.4s, #31\n"
-        "sqadd v16.4s, v16.4s, v18.4s\n"
-        "sqadd v17.4s, v17.4s, v19.4s\n"
-        "srshl v16.4s, v16.4s, v29.4s\n"
-        "srshl v17.4s, v17.4s, v29.4s\n"
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtun v16.8b, v16.8h\n"
-        "umax v16.8b, v16.8b, v30.8b\n"
-        "umin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v8", "v9", "v10", "v11", "v12",
-        "v13", "v16", "v17", "v18", "v19", "v25", "v26", "v27", "v28", "v29",
-        "v30", "v31",
-        // We use these general-purpose registers.
-        "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-template <>
-struct DepthwiseConvPartial {
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 2x3 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 2x3 input and
-        // filter values.
-
-        // Load input and filter values.
-        "ldr x7, [%[params_ptr], #" STR(OFFSET_INPUT_DEPTH) "]\n"
-        "mov x12, %[input_ptr]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "mov x9, %[filter_ptr]\n"
-        "ldr x14, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-        "add x13, x12, x11\n"
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-
-        "ld1 {v8.8b}, [x12], x7\n"
-        "add x10, x9, x14\n"
-        "ld1 {v9.8b}, [x12], x7\n"
-        "cmp x15, #16\n"
-        "ld1 {v10.8b}, [x12]\n"
-        "add %[input_ptr], %[input_ptr], #8\n"
-        "ld1 {v11.8b}, [x13], x7\n"
-        "add %[filter_ptr], %[filter_ptr], #8\n"
-        "ld1 {v12.8b}, [x13], x7\n"
-        "ld1 {v13.8b}, [x13]\n"
-
-        "ld1 {v0.8b}, [x9], x7\n"
-        "ld1 {v1.8b}, [x9], x7\n"
-        "ld1 {v2.8b}, [x9]\n"
-        "ld1 {v3.8b}, [x10], x7\n"
-        "ld1 {v4.8b}, [x10], x7\n"
-        "ld1 {v5.8b}, [x10]\n"
-
-        // Load constants.
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "dup v26.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w13\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "dup v28.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v29.4s, w13\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.8b, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-        "dup v31.8b, w13\n"
-        "dup v25.8h, w12\n"
-
-        // Add input and filter offsets.
-        "uaddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v9.8h, v26.8h, v9.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v10.8h, v26.8h, v10.8b\n"
-        "uaddw v11.8h, v26.8h, v11.8b\n"
-        "uaddw v12.8h, v26.8h, v12.8b\n"
-        "uaddw v13.8h, v26.8h, v13.8b\n"
-
-        "uaddw v0.8h, v25.8h, v0.8b\n"
-        "uaddw v1.8h, v25.8h, v1.8b\n"
-        "uaddw v2.8h, v25.8h, v2.8b\n"
-        "uaddw v3.8h, v25.8h, v3.8b\n"
-        "uaddw v4.8h, v25.8h, v4.8b\n"
-        "uaddw v5.8h, v25.8h, v5.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "mov x12, %[input_ptr]\n"
-          "subs x15, x15, #8\n"
-          "add x13, x12, x11\n"
-          "cmp x15, #16\n"
-          "add %[input_ptr], %[input_ptr], #8\n"
-
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "mov x9, %[filter_ptr]\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [x12], x7\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "add x10, x9, x14\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x12], x7\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "add %[filter_ptr], %[filter_ptr], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x12]\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v0.8b}, [x9], x7\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13], x7\n"
-          "smlal v16.4s, v4.4h, v12.4h\n"
-          "ld1 {v1.8b}, [x9], x7\n"
-          "smlal2 v17.4s, v4.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x13], x7\n"
-          "smlal v16.4s, v5.4h, v13.4h\n"
-          "ld1 {v2.8b}, [x9]\n"
-          "smlal2 v17.4s, v5.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13]\n"
-
-          "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-          "ld1 {v3.8b}, [x10], x7\n"
-          "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-          "ld1 {v4.8b}, [x10], x7\n"
-          "sqrshl v16.4s, v16.4s, v29.4s\n"
-          "ld1 {v5.8b}, [x10]\n"
-          "sqrshl v17.4s, v17.4s, v29.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtun v16.8b, v16.8h\n"
-          "umax v16.8b, v16.8b, v30.8b\n"
-          "umin v16.8b, v16.8b, v31.8b\n"
-          "uaddw v8.8h, v26.8h, v8.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "uaddw v10.8h, v26.8h, v10.8b\n"
-          "uaddw v11.8h, v26.8h, v11.8b\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "uaddw v13.8h, v26.8h, v13.8b\n"
-
-          "uaddw v0.8h, v25.8h, v0.8b\n"
-          "uaddw v1.8h, v25.8h, v1.8b\n"
-          "uaddw v2.8h, v25.8h, v2.8b\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v3.8h, v25.8h, v3.8b\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v4.8h, v25.8h, v4.8b\n"
-          "uaddw v5.8h, v25.8h, v5.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-        "smlal v16.4s, v4.4h, v12.4h\n"
-        "smlal2 v17.4s, v4.8h, v12.8h\n"
-        "smlal v16.4s, v5.4h, v13.4h\n"
-        "smlal2 v17.4s, v5.8h, v13.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-        "sqrshl v16.4s, v16.4s, v29.4s\n"
-        "sqrshl v17.4s, v17.4s, v29.4s\n"
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtun v16.8b, v16.8h\n"
-        "umax v16.8b, v16.8b, v30.8b\n"
-        "umin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v8", "v9", "v10", "v11", "v12",
-        "v13", "v16", "v17", "v18", "v19", "v25", "v26", "v27", "v28", "v29",
-        "v30", "v31",
-        // We use these general-purpose registers.
-        "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-template <>
-struct DepthwiseConvPartial {
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 3x2 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 3x2 input and
-        // filter values.
-
-        // Load input and filter values.
-        "ldr x6, [%[params_ptr], #" STR(OFFSET_INPUT_DEPTH) "]\n"
-        "mov x12, %[input_ptr]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "mov x7, %[filter_ptr]\n"
-        "ldr x5, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-        "add x13, x12, x11\n"
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "add x14, x13, x11\n"
-
-        "ld1 {v8.8b}, [x12], x6\n"
-        "add x9, x7, x5\n"
-        "ld1 {v9.8b}, [x12]\n"
-        "cmp x15, #16\n"
-        "add x10, x9, x5\n"
-        "ld1 {v10.8b}, [x13], x6\n"
-        "add %[input_ptr], %[input_ptr], #8\n"
-        "ld1 {v11.8b}, [x13]\n"
-        "add %[filter_ptr], %[filter_ptr], #8\n"
-        "ld1 {v12.8b}, [x14], x6\n"
-        "ld1 {v13.8b}, [x14]\n"
-
-        "ld1 {v0.8b}, [x7], x6\n"
-        "ld1 {v1.8b}, [x7]\n"
-        "ld1 {v2.8b}, [x9], x6\n"
-        "ld1 {v3.8b}, [x9]\n"
-        "ld1 {v4.8b}, [x10], x6\n"
-        "ld1 {v5.8b}, [x10]\n"
-
-        // Load constants.
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "dup v26.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w13\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "dup v28.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v29.4s, w13\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.8b, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-        "dup v31.8b, w13\n"
-        "dup v25.8h, w12\n"
-
-        // Add input and filter offsets.
-        "uaddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v9.8h, v26.8h, v9.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v10.8h, v26.8h, v10.8b\n"
-        "uaddw v11.8h, v26.8h, v11.8b\n"
-        "uaddw v12.8h, v26.8h, v12.8b\n"
-        "uaddw v13.8h, v26.8h, v13.8b\n"
-
-        "uaddw v0.8h, v25.8h, v0.8b\n"
-        "uaddw v1.8h, v25.8h, v1.8b\n"
-        "uaddw v2.8h, v25.8h, v2.8b\n"
-        "uaddw v3.8h, v25.8h, v3.8b\n"
-        "uaddw v4.8h, v25.8h, v4.8b\n"
-        "uaddw v5.8h, v25.8h, v5.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "mov x12, %[input_ptr]\n"
-          "subs x15, x15, #8\n"
-          "add x13, x12, x11\n"
-          "cmp x15, #16\n"
-          "add x14, x13, x11\n"
-          "add %[input_ptr], %[input_ptr], #8\n"
-
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "mov x7, %[filter_ptr]\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [x12], x6\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "add x9, x7, x5\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "add x10, x9, x5\n"
-          "ld1 {v9.8b}, [x12]\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "add %[filter_ptr], %[filter_ptr], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], x6\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v0.8b}, [x7], x6\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13]\n"
-          "smlal v16.4s, v4.4h, v12.4h\n"
-          "ld1 {v1.8b}, [x7]\n"
-          "smlal2 v17.4s, v4.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x14], x6\n"
-          "smlal v16.4s, v5.4h, v13.4h\n"
-          "ld1 {v2.8b}, [x9], x6\n"
-          "smlal2 v17.4s, v5.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x14]\n"
-
-          "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-          "ld1 {v3.8b}, [x9]\n"
-          "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-          "ld1 {v4.8b}, [x10], x6\n"
-          "and v18.16b, v16.16b, v29.16b\n"
-          "ld1 {v5.8b}, [x10]\n"
-          "and v19.16b, v17.16b, v29.16b\n"
-          "sshr v18.4s, v18.4s, #31\n"
-          "sshr v19.4s, v19.4s, #31\n"
-          "sqadd v16.4s, v16.4s, v18.4s\n"
-          "sqadd v17.4s, v17.4s, v19.4s\n"
-          "srshl v16.4s, v16.4s, v29.4s\n"
-          "srshl v17.4s, v17.4s, v29.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtun v16.8b, v16.8h\n"
-          "umax v16.8b, v16.8b, v30.8b\n"
-          "umin v16.8b, v16.8b, v31.8b\n"
-          "uaddw v8.8h, v26.8h, v8.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "uaddw v10.8h, v26.8h, v10.8b\n"
-          "uaddw v11.8h, v26.8h, v11.8b\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "uaddw v13.8h, v26.8h, v13.8b\n"
-
-          "uaddw v0.8h, v25.8h, v0.8b\n"
-          "uaddw v1.8h, v25.8h, v1.8b\n"
-          "uaddw v2.8h, v25.8h, v2.8b\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v3.8h, v25.8h, v3.8b\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v4.8h, v25.8h, v4.8b\n"
-          "uaddw v5.8h, v25.8h, v5.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-        "smlal v16.4s, v4.4h, v12.4h\n"
-        "smlal2 v17.4s, v4.8h, v12.8h\n"
-        "smlal v16.4s, v5.4h, v13.4h\n"
-        "smlal2 v17.4s, v5.8h, v13.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-        "and v18.16b, v16.16b, v29.16b\n"
-        "and v19.16b, v17.16b, v29.16b\n"
-        "sshr v18.4s, v18.4s, #31\n"
-        "sshr v19.4s, v19.4s, #31\n"
-        "sqadd v16.4s, v16.4s, v18.4s\n"
-        "sqadd v17.4s, v17.4s, v19.4s\n"
-        "srshl v16.4s, v16.4s, v29.4s\n"
-        "srshl v17.4s, v17.4s, v29.4s\n"
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtun v16.8b, v16.8h\n"
-        // TODO(b/129852264): Improve testing coverage.
-        "umax v16.8b, v16.8b, v30.8b\n"
-        "umin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v8", "v9", "v10", "v11", "v12",
-        "v13", "v16", "v17", "v18", "v19", "v25", "v26", "v27", "v28", "v29",
-        "v30", "v31",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-template <>
-struct DepthwiseConvPartial {
-  static inline void Run(const uint8* input_ptr, const uint8* filter_ptr,
-                         const int32* bias_ptr, uint8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 3x2 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 3x2 input and
-        // filter values.
-
-        // Load input and filter values.
-        "ldr x6, [%[params_ptr], #" STR(OFFSET_INPUT_DEPTH) "]\n"
-        "mov x12, %[input_ptr]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "mov x7, %[filter_ptr]\n"
-        "ldr x5, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-        "add x13, x12, x11\n"
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "add x14, x13, x11\n"
-
-        "ld1 {v8.8b}, [x12], x6\n"
-        "add x9, x7, x5\n"
-        "ld1 {v9.8b}, [x12]\n"
-        "cmp x15, #16\n"
-        "add x10, x9, x5\n"
-        "ld1 {v10.8b}, [x13], x6\n"
-        "add %[input_ptr], %[input_ptr], #8\n"
-        "ld1 {v11.8b}, [x13]\n"
-        "add %[filter_ptr], %[filter_ptr], #8\n"
-        "ld1 {v12.8b}, [x14], x6\n"
-        "ld1 {v13.8b}, [x14]\n"
-
-        "ld1 {v0.8b}, [x7], x6\n"
-        "ld1 {v1.8b}, [x7]\n"
-        "ld1 {v2.8b}, [x9], x6\n"
-        "ld1 {v3.8b}, [x9]\n"
-        "ld1 {v4.8b}, [x10], x6\n"
-        "ld1 {v5.8b}, [x10]\n"
-
-        // Load constants.
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_MULTIPLIER) "]\n"
-        "dup v26.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v27.4s, w13\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_RIGHT_SHIFT) "]\n"
-        "dup v28.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v29.4s, w13\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.8b, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_FILTER_OFFSET) "]\n"
-        "dup v31.8b, w13\n"
-        "dup v25.8h, w12\n"
-
-        // Add input and filter offsets.
-        "uaddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v9.8h, v26.8h, v9.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "uaddw v10.8h, v26.8h, v10.8b\n"
-        "uaddw v11.8h, v26.8h, v11.8b\n"
-        "uaddw v12.8h, v26.8h, v12.8b\n"
-        "uaddw v13.8h, v26.8h, v13.8b\n"
-
-        "uaddw v0.8h, v25.8h, v0.8b\n"
-        "uaddw v1.8h, v25.8h, v1.8b\n"
-        "uaddw v2.8h, v25.8h, v2.8b\n"
-        "uaddw v3.8h, v25.8h, v3.8b\n"
-        "uaddw v4.8h, v25.8h, v4.8b\n"
-        "uaddw v5.8h, v25.8h, v5.8b\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "mov x12, %[input_ptr]\n"
-          "subs x15, x15, #8\n"
-          "add x13, x12, x11\n"
-          "cmp x15, #16\n"
-          "add x14, x13, x11\n"
-          "add %[input_ptr], %[input_ptr], #8\n"
-
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "mov x7, %[filter_ptr]\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [x12], x6\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "add x9, x7, x5\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "add x10, x9, x5\n"
-          "ld1 {v9.8b}, [x12]\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "add %[filter_ptr], %[filter_ptr], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], x6\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v0.8b}, [x7], x6\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13]\n"
-          "smlal v16.4s, v4.4h, v12.4h\n"
-          "ld1 {v1.8b}, [x7]\n"
-          "smlal2 v17.4s, v4.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x14], x6\n"
-          "smlal v16.4s, v5.4h, v13.4h\n"
-          "ld1 {v2.8b}, [x9], x6\n"
-          "smlal2 v17.4s, v5.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x14]\n"
-
-          "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-          "ld1 {v3.8b}, [x9]\n"
-          "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-          "ld1 {v4.8b}, [x10], x6\n"
-          "sqrshl v16.4s, v16.4s, v29.4s\n"
-          "ld1 {v5.8b}, [x10]\n"
-          "sqrshl v17.4s, v17.4s, v29.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtun v16.8b, v16.8h\n"
-          "umax v16.8b, v16.8b, v30.8b\n"
-          "umin v16.8b, v16.8b, v31.8b\n"
-          "uaddw v8.8h, v26.8h, v8.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "uaddw v9.8h, v26.8h, v9.8b\n"
-          "uaddw v10.8h, v26.8h, v10.8b\n"
-          "uaddw v11.8h, v26.8h, v11.8b\n"
-          "uaddw v12.8h, v26.8h, v12.8b\n"
-          "uaddw v13.8h, v26.8h, v13.8b\n"
-
-          "uaddw v0.8h, v25.8h, v0.8b\n"
-          "uaddw v1.8h, v25.8h, v1.8b\n"
-          "uaddw v2.8h, v25.8h, v2.8b\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v3.8h, v25.8h, v3.8b\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-          "uaddw v4.8h, v25.8h, v4.8b\n"
-          "uaddw v5.8h, v25.8h, v5.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-        "smlal v16.4s, v4.4h, v12.4h\n"
-        "smlal2 v17.4s, v4.8h, v12.8h\n"
-        "smlal v16.4s, v5.4h, v13.4h\n"
-        "smlal2 v17.4s, v5.8h, v13.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v27.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v27.4s\n"
-        "sqrshl v16.4s, v16.4s, v29.4s\n"
-        "sqrshl v17.4s, v17.4s, v29.4s\n"
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtun v16.8b, v16.8h\n"
-        // TODO(b/129852264): Improve testing coverage.
-        "umax v16.8b, v16.8b, v30.8b\n"
-        "umin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v8", "v9", "v10", "v11", "v12",
-        "v13", "v16", "v17", "v18", "v19", "v25", "v26", "v27", "v28", "v29",
-        "v30", "v31",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-#undef OFFSET_INPUT_DEPTH
-#undef OFFSET_INPUT_ROW_SIZE
-#undef OFFSET_OUTPUT_DEPTH
-#undef OFFSET_OUTPUT_ROW_SIZE
-#undef OFFSET_INPUT_OFFSET
-#undef OFFSET_OUTPUT_OFFSET
-#undef OFFSET_FILTER_OFFSET
-#undef OFFSET_OUTPUT_MULTIPLIER
-#undef OFFSET_OUTPUT_ACTIVATION_MIN
-#undef OFFSET_OUTPUT_ACTIVATION_MAX
-#undef OFFSET_OUTPUT_RIGHT_SHIFT
-#undef OFFSET_INPUT_WIDTH
-#undef OFFSET_INPUT_HEIGHT
-#undef OFFSET_OUTPUT_WIDTH
-#undef OFFSET_OUTPUT_HEIGHT
-
-template 
-struct DepthwiseConvThroughDepth {
-  // Runs the DepthwiseConvWindow kernels through the depth dimension from
-  // |start_depth| to |end_depth|. Keep this not inlined to maintain a small
-  // binary size. We use a DepthwiseConvParams struct for read only params
-  // to minimize call overhead.
-  static void __attribute__((noinline))
-  Run(const uint8* input_ptr, const uint8* filter_ptr, const int32* bias_ptr,
-      uint8* output_ptr, int64_t start_depth, int64_t end_depth,
-      int64_t input_depth, int64_t input_row_size, int32 output_window_height,
-      int32 output_window_width, const DepthwiseConvParams& params) {
-    for (; start_depth <= end_depth - 8; start_depth += 8) {
-      DepthwiseConvWindow::Run(
-          input_ptr, filter_ptr, bias_ptr, output_ptr, input_depth,
-          input_row_size, output_window_height, output_window_width, ¶ms);
-      input_ptr += 8;
-      output_ptr += 8;
-      filter_ptr += 8;
-      bias_ptr += 8;
-    }
-  }
-};
-
-template 
-struct DepthwiseConvMultiRow {
-  using ConvKernel =
-      DepthwiseConvThroughDepth;
-
-  static inline void Run(const uint8* input_data, int32 start_x, int32 end_x,
-                         const uint8* filter_data, const int32* bias_data,
-                         uint8* output_data, const DepthwiseConvParams& params,
-                         const ShuffleParams& shuffle_params,
-                         uint8* shuffle_workspace) {
-    TFLITE_DCHECK(
-        shuffle_params.input_height ==
-        get_shuffle_input_size(kStrideHeight, shuffle_params.output_height));
-    TFLITE_DCHECK(
-        shuffle_params.input_width ==
-        get_shuffle_input_size(kStrideWidth, shuffle_params.output_width));
-    TFLITE_DCHECK_LE(
-        64 * shuffle_params.input_width * shuffle_params.input_height,
-        kDepthwiseConvScratchWorkspaceSize);
-
-    int32 out_x = start_x;
-
-    // Run shuffling on inputs with sufficiently large depth and width. When
-    // these parameters are large enough, more time is taken to load inputs
-    // from memory. At this point, it becomes useful to prefetch and
-    // preshuffle the input data to maximize locality.
-    if (params.output_depth > 64 ||
-        (params.output_depth <= 64 && params.input_width > 150)) {
-      for (; out_x <= (end_x - shuffle_params.output_width);
-           out_x += shuffle_params.output_width) {
-        const uint8* input_ptr = input_data;
-        const int32* bias_ptr = bias_data;
-        const uint8* filter_ptr = filter_data;
-        uint8* output_ptr = output_data;
-        int64_t depth = 0;
-        const int64_t shuffle_row_size = 64 * shuffle_params.input_width;
-
-        for (; depth <= params.output_depth - 64; depth += 64) {
-          // Preload.
-          const uint8* h_ptr = input_ptr;
-          for (int32 i = 0; i < shuffle_params.input_height; i++) {
-            const uint8* ptr = h_ptr;
-            for (int32 j = 0; j < shuffle_params.input_width; j++) {
-              asm volatile("prfm pldl1keep, [%[ptr]]\n" ::[ptr] "r"(ptr) :);
-              ptr += params.input_depth;
-            }
-            h_ptr += params.input_row_size;
-          }
-
-          // For a large enough input, shuffle into buckets.
-          ShuffleInput(input_ptr, params.input_depth, params.input_width,
-                       params.input_height, 64, shuffle_params.input_width,
-                       shuffle_params.input_height, shuffle_workspace);
-          ConvKernel::Run(shuffle_workspace, filter_ptr, bias_ptr, output_ptr,
-                          0, 64, 64, shuffle_row_size,
-                          shuffle_params.output_height,
-                          shuffle_params.output_width, params);
-          input_ptr += 64;
-          output_ptr += 64;
-          filter_ptr += 64;
-          bias_ptr += 64;
-        }
-
-        // Preload.
-        const uint8* h_ptr = input_ptr;
-        for (int32 i = 0; i < shuffle_params.input_height; i++) {
-          const uint8* ptr = h_ptr;
-          for (int32 j = 0; j < shuffle_params.input_width; j++) {
-            asm volatile("prfm pldl1keep, [%[ptr]]\n" ::[ptr] "r"(ptr) :);
-            ptr += params.input_depth;
-          }
-          h_ptr += params.input_row_size;
-        }
-
-        // Handle leftover depth.
-        ConvKernel::Run(input_ptr, filter_ptr, bias_ptr, output_ptr, depth,
-                        params.output_depth, params.input_depth,
-                        params.input_row_size, shuffle_params.output_height,
-                        shuffle_params.output_width, params);
-
-        input_data +=
-            shuffle_params.output_width * kStrideWidth * params.input_depth;
-        output_data += shuffle_params.output_width * params.output_depth;
-      }
-    }
-
-    const int32 output_leftover_width = end_x - out_x;
-    if (output_leftover_width > 0) {
-      ConvKernel::Run(input_data, filter_data, bias_data, output_data, 0,
-                      params.output_depth, params.input_depth,
-                      params.input_row_size, shuffle_params.output_height,
-                      output_leftover_width, params);
-    }
-  }
-};
-
-// Processes the borders of the input for pad_width and pad_height = 1.
-// Calls 4 asm kernels:
-//   * 1x1 input shape.
-//   * Corner edges.
-//   * Horizontal edges.
-//   * Vertical edges.
-template 
-inline void DepthwiseConvHandlePadding(const uint8* input_data,
-                                       const uint8* filter_data,
-                                       const int32* bias_data,
-                                       uint8* output_data,
-                                       const DepthwiseConvParams& params) {
-  if (params.input_width == 1 && params.input_height == 1) {
-    const uint8* filter_ptr =
-        filter_data + params.filter_row_size + params.output_depth;
-    DepthwiseConvPartial::Run(
-        input_data, filter_ptr, bias_data, output_data, ¶ms);
-    return;
-  }
-
-  const int32 out_x_start_corner = 0;
-  const int32 out_x_end_corner = params.output_width - 1;
-  const int32 out_y_start_corner = 0;
-  const int32 out_y_end_corner = params.output_height - 1;
-
-  // Handle top row.
-  const uint8* input_ptr = input_data;
-  const uint8* filter_ptr =
-      filter_data + params.filter_row_size + params.output_depth;
-  uint8* output_ptr = output_data;
-
-  DepthwiseConvPartial::Run(
-      input_ptr, filter_ptr, bias_data, output_ptr, ¶ms);
-
-  input_ptr += (params.stride_width - 1) * params.input_depth;
-  filter_ptr = filter_data + params.filter_row_size;
-  output_ptr += params.output_depth;
-
-  for (int32 out_x = out_x_start_corner + 1; out_x < out_x_end_corner;
-       out_x++) {
-    DepthwiseConvPartial::Run(
-        input_ptr, filter_ptr, bias_data, output_ptr, ¶ms);
-    input_ptr += params.stride_width * params.input_depth;
-    output_ptr += params.output_depth;
-  }
-
-  DepthwiseConvPartial::Run(
-      input_ptr, filter_ptr, bias_data, output_ptr, ¶ms);
-
-  // Handle left side.
-  input_ptr = input_data + (params.stride_width - 1) * params.input_row_size;
-  filter_ptr = filter_data + params.input_depth;
-  output_ptr = output_data + params.output_row_size;
-
-  for (int32 out_y = out_y_start_corner + 1; out_y < out_y_end_corner;
-       out_y++) {
-    DepthwiseConvPartial::Run(
-        input_ptr, filter_ptr, bias_data, output_ptr, ¶ms);
-    input_ptr += params.stride_width * params.input_row_size;
-    output_ptr += params.output_row_size;
-  }
-
-  // Handle right side.
-  input_ptr = input_data + (params.input_width - 2) * params.input_depth +
-              (params.stride_width - 1) * params.input_row_size;
-  filter_ptr = filter_data;
-  output_ptr = output_data + params.output_row_size +
-               (params.output_width - 1) * params.output_depth;
-
-  for (int32 out_y = out_y_start_corner + 1; out_y < out_y_end_corner;
-       out_y++) {
-    DepthwiseConvPartial::Run(
-        input_ptr, filter_ptr, bias_data, output_ptr, ¶ms);
-    input_ptr += params.stride_width * params.input_row_size;
-    output_ptr += params.output_row_size;
-  }
-
-  // Handle bottom row.
-  input_ptr = input_data + (params.input_height - 2) * params.input_row_size;
-  filter_ptr = filter_data + params.output_depth;
-  output_ptr =
-      output_data + (params.output_height - 1) * params.output_row_size;
-
-  DepthwiseConvPartial::Run(
-      input_ptr, filter_ptr, bias_data, output_ptr, ¶ms);
-
-  input_ptr += (params.stride_width == 1) ? 0 : params.input_depth;
-  filter_ptr = filter_data;
-  output_ptr += params.output_depth;
-
-  for (int32 out_x = out_x_start_corner + 1; out_x < out_x_end_corner;
-       out_x++) {
-    DepthwiseConvPartial::Run(
-        input_ptr, filter_ptr, bias_data, output_ptr, ¶ms);
-    input_ptr += params.stride_width * params.input_depth;
-    output_ptr += params.output_depth;
-  }
-
-  DepthwiseConvPartial::Run(
-      input_ptr, filter_ptr, bias_data, output_ptr, ¶ms);
-}
-
-template 
-inline void DepthwiseConv3x3Filter(
-    const DepthwiseParams& rt_params, const RuntimeShape& input_shape,
-    const uint8* input_data, const RuntimeShape& filter_shape,
-    const uint8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape,
-    uint8* output_data, int thread_start, int thread_end, int thread_dim) {
-  DepthwiseConvParams params;
-
-  const int32 stride_width = rt_params.stride_width;
-  const int32 stride_height = rt_params.stride_height;
-  const int32 pad_width = rt_params.padding_values.width;
-  const int32 pad_height = rt_params.padding_values.height;
-  const int32 depth_multiplier = rt_params.depth_multiplier;
-  const int32 output_activation_min = rt_params.quantized_activation_min;
-  const int32 output_activation_max = rt_params.quantized_activation_max;
-  const int32 input_offset = rt_params.input_offset;
-  const int32 filter_offset = rt_params.weights_offset;
-  const int32 output_offset = rt_params.output_offset;
-  const int32 output_multiplier = rt_params.output_multiplier;
-  const int32 output_shift = rt_params.output_shift;
-
-  params.input_depth = input_shape.Dims(3);
-  params.input_width = input_shape.Dims(2);
-  params.input_height = input_shape.Dims(1);
-  params.input_row_size = params.input_depth * params.input_width;
-  params.input_offset = input_offset;
-  params.stride_width = stride_width;
-  params.stride_height = stride_height;
-  params.output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  params.output_width = output_shape.Dims(2);
-  params.output_height = output_shape.Dims(1);
-  params.output_row_size = params.output_depth * params.output_width;
-  params.output_offset = output_offset;
-  params.filter_offset = filter_offset;
-  params.output_multiplier = output_multiplier;
-  params.output_right_shift = output_shift;
-  params.output_activation_min = output_activation_min;
-  params.output_activation_max = output_activation_max;
-
-  const int32 filter_height = filter_shape.Dims(1);
-  const int32 filter_width = filter_shape.Dims(2);
-  params.filter_row_size = params.output_depth * filter_width;
-
-  // Algorithm assumes below constraints. It is optimized for depth
-  // multiplier of 1, 3x3 filter, no padding and strides 1 and 2.
-  TFLITE_DCHECK(params.output_depth == params.input_depth * depth_multiplier);
-  TFLITE_DCHECK(depth_multiplier == 1);
-  TFLITE_DCHECK(filter_height == 3);
-  TFLITE_DCHECK(filter_width == 3);
-  TFLITE_DCHECK(stride_height == 1 || stride_height == 2);
-  TFLITE_DCHECK(stride_width == 1 || stride_width == 2);
-  TFLITE_DCHECK(stride_width == stride_height);
-  TFLITE_DCHECK(pad_height == 0 || pad_height == 1);
-  TFLITE_DCHECK(pad_width == 0 || pad_width == 1);
-  TFLITE_DCHECK(pad_width == pad_height);
-  TFLITE_DCHECK(thread_dim == 0 || thread_dim == 1);
-
-  const int32 batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int64_t input_batch_size = params.input_row_size * params.input_height;
-  const int64_t output_batch_size =
-      params.output_row_size * params.output_height;
-
-  ShuffleParams one_row_shuffle_params, two_row_shuffle_params,
-      four_row_shuffle_params, eight_row_shuffle_params;
-  if (stride_width == 1) {
-    one_row_shuffle_params = ShuffleParams(30, 1, 1, 1);
-    two_row_shuffle_params = ShuffleParams(22, 2, 1, 1);
-    four_row_shuffle_params = ShuffleParams(14, 4, 1, 1);
-    eight_row_shuffle_params = ShuffleParams(8, 8, 1, 1);
-  } else {
-    one_row_shuffle_params = ShuffleParams(14, 1, 2, 2);
-    two_row_shuffle_params = ShuffleParams(8, 2, 2, 2);
-    four_row_shuffle_params = ShuffleParams(4, 4, 2, 2);
-    eight_row_shuffle_params = ShuffleParams(2, 8, 2, 2);
-  }
-
-  using conv_multirow_func_t =
-      decltype(&DepthwiseConvMultiRow::Run);
-  conv_multirow_func_t conv_multirow_func =
-      DepthwiseConvMultiRow::Run;
-  if (stride_width == 2) {
-    conv_multirow_func = DepthwiseConvMultiRow::Run;
-  }
-
-  // Allocate maximum memory needed for shuffled input.
-  // TODO(mariewhite): The size of this workspace is small enough to be
-  // allocated on the stack. Eventually we will want to move it to the heap
-  // and have it allocated outside of this function, like the im2col_array
-  // used in gemmlowp.
-  uint8 shuffle_workspace[kDepthwiseConvScratchWorkspaceSize];
-
-  int batch_start = 0;
-  int batch_end = batches;
-  int row_start = 0;
-  int row_end = params.output_height;
-
-  switch (thread_dim) {
-    case 0:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, batches);
-      batch_start = thread_start;
-      batch_end = thread_end;
-      break;
-    case 1:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, params.output_height);
-      row_start = thread_start;
-      row_end = thread_end;
-      break;
-  }
-
-  for (int32 b = batch_start; b < batch_end; ++b) {
-    // input_ptr and output_ptr point to the start of each batch
-    const uint8* input_ptr = input_data + b * input_batch_size;
-    uint8* output_ptr = output_data + b * output_batch_size;
-
-    int32 out_x = 0;
-    int32 out_y = row_start;
-    int32 end_x = params.output_width;
-    int32 end_y = row_end;
-
-    if (pad_width == 1 && pad_height == 1) {
-      DepthwiseConvHandlePadding(
-          input_ptr, filter_data, bias_data, output_ptr, params);
-
-      // Update extents now that the edges have been handled.
-      out_x = 1;
-      end_x = params.output_width - 1;
-      out_y = std::max(1, out_y);
-      end_y = std::min(params.output_height - 1, end_y);
-    }
-
-    // pad_width and pad_height can both be 0 or 1, depending on padding option,
-    // such as Padding_VALID / Padding_SAME.
-    const int in_x = (out_x * stride_width) - pad_width;
-    const int in_y = (out_y * stride_height) - pad_height;
-
-    // input_ptr and output_ptr point to (in_y, in_x) and (out_y, out_x),
-    // respectively. (in_y, in_x) and (out_y, out_x) change along with
-    // row_start.
-    input_ptr += in_y * params.input_row_size + in_x * params.input_depth;
-    output_ptr += out_y * params.output_row_size + out_x * params.output_depth;
-
-    // Shuffling shapes that maximize width over the shuffle workspace size
-    // perform better since the inputs are closer together, minimizing
-    // shuffling time.
-    //
-    // If the input shape has width large enough for the 2 row kernels,
-    // we prefer to use this. The innermost loop of the kernels handle
-    // 2 height x 2 width so this is the fastest path.
-    //
-    // If the input shape has smaller width but larger height, shuffling is
-    // still useful and can benefit from kernels 4 row and 8 row kernels.
-
-    // Handle 8 rows at a time.
-    if (params.input_width < four_row_shuffle_params.input_width) {
-      for (; out_y <= end_y - 8; out_y += 8) {
-        conv_multirow_func(input_ptr, out_x, end_x, filter_data, bias_data,
-                           output_ptr, params, eight_row_shuffle_params,
-                           shuffle_workspace);
-        input_ptr += 8 * stride_height * params.input_row_size;
-        output_ptr += 8 * params.output_row_size;
-      }
-    }
-
-    // Handle 4 rows at a time.
-    if (params.input_width < two_row_shuffle_params.input_width) {
-      for (; out_y <= end_y - 4; out_y += 4) {
-        conv_multirow_func(input_ptr, out_x, end_x, filter_data, bias_data,
-                           output_ptr, params, four_row_shuffle_params,
-                           shuffle_workspace);
-        input_ptr += 4 * stride_height * params.input_row_size;
-        output_ptr += 4 * params.output_row_size;
-      }
-    }
-
-    // Handle 2 rows at a time.
-    for (; out_y <= end_y - 2; out_y += 2) {
-      conv_multirow_func(input_ptr, out_x, end_x, filter_data, bias_data,
-                         output_ptr, params, two_row_shuffle_params,
-                         shuffle_workspace);
-      input_ptr += 2 * stride_height * params.input_row_size;
-      output_ptr += 2 * params.output_row_size;
-    }
-
-    // Handle one row at a time.
-    for (; out_y < end_y; out_y++) {
-      conv_multirow_func(input_ptr, out_x, end_x, filter_data, bias_data,
-                         output_ptr, params, one_row_shuffle_params,
-                         shuffle_workspace);
-      input_ptr += stride_height * params.input_row_size;
-      output_ptr += params.output_row_size;
-    }
-  }
-}
-#endif  // __aarch64__
-
-// Perform any necessary cache hinting and pre-writing.
-template 
-struct WorkspacePrefetchWrite {
-  static inline void Run(int8 fill_data, int size, int8* workspace) {}
-};
-
-#if defined(__aarch64__)
-// Encourage the processor to keep the workspace in cache. Both the cache hint
-// and some memory writes are required.
-//
-// This code is extremely fragile.
-// Do not edit without extensive comparative performance testing.
-// Do not inline without great care.
-// Do not rely on results before and after getting coffee: non-thermal changes
-//    of more than 10% can occur with hidden underlying processor state changes.
-template <>
-struct WorkspacePrefetchWrite<
-    DepthwiseConvImplementation::kUseNeon3x3DotProduct> {
-  static void __attribute__((noinline))
-  Run(int8 fill_data, int size, int8* workspace) {
-    const int8x8_t fill_data_vec_int8 = vdup_n_s8(fill_data);
-    const uint32x2_t fill_data_vec = vreinterpret_u32_s8(fill_data_vec_int8);
-    for (int i = 0; i < (size - 15); i += 64) {
-      int8* ptr = workspace + i;
-      asm volatile("prfm pstl1keep, [%[ptr]]\n" ::[ptr] "r"(ptr) :);
-      vst1_lane_u32(reinterpret_cast(ptr), fill_data_vec, 0);
-    }
-    vst1_lane_u32(reinterpret_cast(workspace + size - 4),
-                  fill_data_vec, 0);
-  }
-};
-
-#endif  // __aarch64__
-
-#if defined(__aarch64__) && !defined(GOOGLE_L4T) && defined(__ANDROID__) && \
-    defined(__clang__)
-// Dot product ops hard-coded
-
-template <>
-struct ProcessPerDepth {
-  static inline void ProcessPerDepthNeon(
-      const uint8* filter_data, const int32* bias_data,
-      int8* shuffled_filter_data, int32* adjusted_bias_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Note that argument registers may be reused after parameter loading.
-    // x0 %[filter_data]
-    // x1 %[bias_data]
-    // x2 %[shuffled_filter_data]
-    // x3 %[adjusted_bias_data]
-    // x4 %[function_params]
-#define DC_PER_DEPTH_1 "1"
-#define DC_PER_DEPTH_2 "2"
-
-    asm volatile(
-        "ldp    w12, w11, [%[function_params], #" STR(DP_OFFSET_BIAS_INCREMENT) "]\n"
-        "ldrsw  x9, [%[function_params], #" STR(DP_OFFSET_OUTPUT_DEPTH) "]\n"
-        "ldr    w10, [%[function_params], #" STR(DP_OFFSET_DEPTH_MICRO_REPEATS) "]\n"
-        "mov    x8, xzr\n"
-        "add    w11, w11, #128\n"  // =128
-        "sxtw   x12, w12\n"
-        "movi   v0.16b, #128\n"
-        "dup    v1.4s, w11\n"
-        "lsl    x11, x12, #3\n"
-        "lsl    x12, x12, #2\n"
-        "movi   v2.16b, #1\n"
-        // implicit-def: $q3
-        // implicit-def: $q4
-        // implicit-def: $q5
-        // implicit-def: $q6
-        // implicit-def: $q7
-        // implicit-def: $q16
-        // implicit-def: $q17
-        // implicit-def: $q18
-        // implicit-def: $q19
-        "b      " DC_PER_DEPTH_2 "f\n"
-        DC_PER_DEPTH_1 ":\n"  // in Loop: Header=BB177_2 Depth=1
-        "add    x13, %[filter_data], x8, lsl #3\n"
-        "ld1    { v19.d }[0], [x13], x9\n"
-        "movi   v21.16b, #0\n"
-        "movi   v20.16b, #0\n"
-        "add    x8, x8, #1\n"  // =1
-        "ld1    { v18.d }[0], [x13], x9\n"
-        "ld1    { v17.d }[0], [x13], x9\n"
-        "zip1   v22.16b, v19.16b, v18.16b\n"
-        "eor    v22.16b, v22.16b, v0.16b\n"
-        "ld1    { v16.d }[0], [x13], x9\n"
-        "zip1   v23.16b, v17.16b, v0.16b\n"
-        "eor    v23.16b, v23.16b, v0.16b\n"
-        "zip1   v24.8h, v22.8h, v23.8h\n"
-        "ld1    { v7.d }[0], [x13], x9\n"
-        "zip2   v22.8h, v22.8h, v23.8h\n"
-        ".word 0x4e8296d5  // sdot   v21.4s, v22.16b, v2.16b\n"
-        ".word 0x4e829714  // sdot   v20.4s, v24.16b, v2.16b\n"
-        "ld1    { v6.d }[0], [x13], x9\n"
-        "zip1   v23.16b, v16.16b, v7.16b\n"
-        "eor    v23.16b, v23.16b, v0.16b\n"
-        "ld1    { v5.d }[0], [x13], x9\n"
-        "zip1   v25.16b, v6.16b, v0.16b\n"
-        "eor    v25.16b, v25.16b, v0.16b\n"
-        "zip1   v26.8h, v23.8h, v25.8h\n"
-        "ld1    { v4.d }[0], [x13], x9\n"
-        "zip2   v23.8h, v23.8h, v25.8h\n"
-        ".word 0x4e8296f5  // sdot   v21.4s, v23.16b, v2.16b\n"
-        ".word 0x4e829754  // sdot   v20.4s, v26.16b, v2.16b\n"
-        "ld1    { v3.d }[0], [x13]\n"
-        "zip1   v25.16b, v5.16b, v4.16b\n"
-        "stp    q26, q23, [%[shuffled_filter_data], #32]\n"
-        "stp    q24, q22, [%[shuffled_filter_data]]\n"
-        "zip1   v23.16b, v3.16b, v0.16b\n"
-        "eor    v22.16b, v25.16b, v0.16b\n"
-        "eor    v23.16b, v23.16b, v0.16b\n"
-        "zip1   v24.8h, v22.8h, v23.8h\n"
-        "zip2   v22.8h, v22.8h, v23.8h\n"
-        "stp    q24, q22, [%[shuffled_filter_data], #64]\n"
-        ".word 0x4e8296d5  // sdot   v21.4s, v22.16b, v2.16b\n"
-        "ldr    q22, [%[bias_data]]\n"
-        "ldr    q23, [%[bias_data], x12]\n"
-        ".word 0x4e829714  // sdot   v20.4s, v24.16b, v2.16b\n"
-        "add    %[shuffled_filter_data], x2, #96\n"  // =96
-        "mla    v22.4s, v20.4s, v1.4s\n"
-        "mla    v23.4s, v21.4s, v1.4s\n"
-        "add    %[bias_data], x1, x11\n"
-        "stp    q22, q23, [%[adjusted_bias_data]], #32\n"
-        DC_PER_DEPTH_2 ":\n"  // =>This Inner Loop Header: Depth=1
-        "cmp    w8, w10\n"
-        "b.lt   " DC_PER_DEPTH_1 "b\n"
-        :
-        // Outputs.
-        [ filter_data ] "+r"(filter_data),
-        [ bias_data ] "+r"(bias_data),
-        [ shuffled_filter_data ] "+r"(shuffled_filter_data),
-        [ adjusted_bias_data ] "+r"(adjusted_bias_data)
-        :
-        // Inputs.
-        [ function_params ] "r"(function_params)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v16", "v17", "v18",
-        "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26",
-        // We use these general-purpose registers.
-        "x8", "x9", "x10", "x11", "x12", "x13");
-#undef DC_PER_DEPTH_1
-#undef DC_PER_DEPTH_2
-  }
-
-  static void __attribute__((noinline))
-  Run(const uint8* filter_data, const int32* bias_data,
-      int8* shuffled_filter_data, int32* adjusted_bias_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    ProcessPerDepthNeon(filter_data, bias_data, shuffled_filter_data,
-                        adjusted_bias_data, function_params);
-  }
-};
-
-template <>
-struct ProcessPerDepth {
-  static inline void ProcessPerDepthNeon(
-      const int8* filter_data, const int32* bias_data,
-      int8* shuffled_filter_data, int32* adjusted_bias_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Note that argument registers may be reused after parameter loading.
-    // x0 %[filter_data]
-    // x1 %[bias_data]
-    // x2 %[shuffled_filter_data]
-    // x3 %[adjusted_bias_data]
-    // x4 %[function_params]
-#define DC_PER_DEPTH_1 "1"
-#define DC_PER_DEPTH_2 "2"
-#define DC_PER_DEPTH_3 "3"
-
-    asm volatile(        // %bb.0:
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_DEPTH_MICRO_REPEATS) "]\n"
-        "cmp    w8, #1\n"  // =1
-        "b.lt   " DC_PER_DEPTH_3 "f\n"
-        // %bb.1:
-        "add    x10, %[function_params], #" STR(DP_OFFSET_INPUT_OFFSET) "\n"  // =24
-        "ldrsw  x11, [%[function_params], #" STR(DP_OFFSET_BIAS_INCREMENT) "]\n"
-        "ldrsw  x9, [%[function_params], #" STR(DP_OFFSET_OUTPUT_DEPTH) "]\n"
-        "ld1r   { v1.4s }, [x10]\n"
-        "movi   v0.16b, #0\n"
-        "lsl    x10, x11, #2\n"
-        "lsl    x11, x11, #3\n"
-        "movi   v2.16b, #1\n"
-        "mov    x12, %[filter_data]\n"
-        // implicit-def: $q3
-        // implicit-def: $q4
-        // implicit-def: $q5
-        // implicit-def: $q6
-        // implicit-def: $q7
-        // implicit-def: $q16
-        // implicit-def: $q17
-        // implicit-def: $q18
-        // implicit-def: $q19
-        DC_PER_DEPTH_2 ":\n"  // =>This Inner Loop Header: Depth=1
-        "add    x13, %[filter_data], x9\n"
-        "ld1    { v3.d }[0], [x12], #8\n"
-        "ld1    { v4.d }[0], [x13], x9\n"
-        "movi   v21.16b, #0\n"
-        "movi   v20.16b, #0\n"
-        "subs   w8, w8, #1\n"  // =1
-        "ld1    { v5.d }[0], [x13], x9\n"
-        "zip1   v22.16b, v3.16b, v4.16b\n"
-        "mov    %[filter_data], x12\n"
-        "ld1    { v6.d }[0], [x13], x9\n"
-        "zip1   v23.16b, v5.16b, v0.16b\n"
-        "zip1   v24.8h, v22.8h, v23.8h\n"
-        "zip2   v22.8h, v22.8h, v23.8h\n"
-        "ld1    { v7.d }[0], [x13], x9\n"
-        ".word 0x4e8296d5  // sdot   v21.4s, v22.16b, v2.16b\n"
-        ".word 0x4e829714  // sdot   v20.4s, v24.16b, v2.16b\n"
-        "ld1    { v16.d }[0], [x13], x9\n"
-        "zip1   v23.16b, v6.16b, v7.16b\n"
-        "ld1    { v17.d }[0], [x13], x9\n"
-        "zip1   v25.16b, v16.16b, v0.16b\n"
-        "zip1   v26.8h, v23.8h, v25.8h\n"
-        "zip2   v23.8h, v23.8h, v25.8h\n"
-        "ld1    { v18.d }[0], [x13], x9\n"
-        ".word 0x4e8296f5  // sdot   v21.4s, v23.16b, v2.16b\n"
-        ".word 0x4e829754  // sdot   v20.4s, v26.16b, v2.16b\n"
-        "ld1    { v19.d }[0], [x13]\n"
-        "zip1   v25.16b, v17.16b, v18.16b\n"
-        "stp    q24, q22, [%[shuffled_filter_data]]\n"
-        "stp    q26, q23, [%[shuffled_filter_data], #32]\n"
-        "zip1   v22.16b, v19.16b, v0.16b\n"
-        "zip1   v23.8h, v25.8h, v22.8h\n"
-        "zip2   v22.8h, v25.8h, v22.8h\n"
-        "stp    q23, q22, [%[shuffled_filter_data], #64]\n"
-        ".word 0x4e8296f4  // sdot   v20.4s, v23.16b, v2.16b\n"
-        ".word 0x4e8296d5  // sdot   v21.4s, v22.16b, v2.16b\n"
-        "ldr    q22, [%[bias_data]]\n"
-        "ldr    q23, [%[bias_data], x10]\n"
-        "add    %[shuffled_filter_data], x2, #96\n"  // =96
-        "add    %[bias_data], x1, x11\n"
-        "mla    v22.4s, v20.4s, v1.4s\n"
-        "mla    v23.4s, v21.4s, v1.4s\n"
-        "stp    q22, q23, [%[adjusted_bias_data]], #32\n"
-        "b.ne   " DC_PER_DEPTH_2 "b\n"
-        DC_PER_DEPTH_3 ":\n"
-        :
-        // Outputs.
-        [ filter_data ] "+r"(filter_data),
-        [ bias_data ] "+r"(bias_data),
-        [ shuffled_filter_data ] "+r"(shuffled_filter_data),
-        [ adjusted_bias_data ] "+r"(adjusted_bias_data)
-        :
-        // Inputs.
-        [ function_params ] "r"(function_params)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v16", "v17", "v18",
-        "v19", "v20", "v21", "v22", "v23", "v24", "v25", "v26",
-        // We use these general-purpose registers.
-        "x8", "x9", "x10", "x11", "x12", "x13");
-#undef DC_PER_DEPTH_1
-#undef DC_PER_DEPTH_2
-#undef DC_PER_DEPTH_3
-  }
-
-  static void __attribute__((noinline))
-  Run(const int8* filter_data, const int32* bias_data,
-      int8* shuffled_filter_data, int32* adjusted_bias_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    ProcessPerDepthNeon(filter_data, bias_data, shuffled_filter_data,
-                        adjusted_bias_data, function_params);
-  }
-};
-template 
-struct PackMacroBlock {
-  static inline void PackMacroBlockNeon(
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    TFLITE_DCHECK_EQ(function_params->padding_bottom, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_top, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_left, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_right, 0);
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int input_width_micro_repeats =
-        function_params->input_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int block_height = function_params->inbound_block_height;
-    const int residual_width = function_params->residual_width;
-    const int input_height_stride = function_params->input_height_stride;
-    const int input_depth = function_params->input_depth;
-
-    TFLITE_DCHECK_GE(depth_micro_repeats, 0);
-    constexpr uint8 kSignBit =
-        QuantizationTypeImpl::kUint8SignBit;
-    const int micro_block_size = 4 * 8;
-    const int depth_advance = width_overall_micro_repeats * micro_block_size;
-    const int width_advance =
-        micro_block_size *
-        (1 - depth_micro_repeats * width_overall_micro_repeats);
-    const int height_advance = workspace_height_stride -
-                               width_overall_micro_repeats * micro_block_size;
-    const int input_depth_skip = 4 * input_depth - 8 * depth_micro_repeats;
-
-    // Transpositions are 4x4, but doing 2 at a time is more efficient in NEON
-    // code. Note the blocks of 4x4 are still interleaved down the depth.
-    int8x16_t work_reg_a;
-    int8x16_t work_reg_b;
-
-    // Effect subtraction of zero-point = 128 by XOR of sign bit.
-    const uint8x16_t sign_bit = vdupq_n_u8(kSignBit);
-
-    // Work through one slice, by row, at a time.
-    int8* scratch_data_0 = scratch_block_data;
-
-    for (int k_height = 0; k_height < block_height; ++k_height) {
-      const typename QuantizationTypeImpl::ExternalType*
-          input_data_0 = input_block_data;
-      int8x16_t input_data_a;
-      int8x16_t input_data_b;
-      int8x16_t input_data_c;
-      int8x16_t input_data_d;
-
-      // Traverse the width one point at a time, but the depth in (micro) blocks
-      // of size 8.
-      //
-      // The depth and width margins, which are filled with "zeros", may be
-      // larger than is strictly needed to calculate output. This is because the
-      // conv calculation is performed across complete micro blocks.
-      for (int j_width = 0; j_width < input_width_micro_repeats; ++j_width) {
-        int8x16_t work_reg_a_sp;
-        int8x16_t work_reg_b_sp;
-
-        int i_depth = 0;
-
-        if (depth_micro_repeats >= 2) {
-          i_depth += 2;
-
-          input_data_a = util_vld1q_x8(input_data_0);
-          input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-          input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-          input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-          input_data_0 += 16;
-
-          for (; i_depth < depth_micro_repeats - 1; i_depth += 2) {
-            work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-            work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-            vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-            if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-              work_reg_a = veorq_s8(work_reg_a, sign_bit);
-              work_reg_b = veorq_s8(work_reg_b, sign_bit);
-            }
-
-            work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-            work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-            vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-
-            input_data_a = util_vld1q_x8(input_data_0);
-            input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-            optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-            optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-            vst1q_s8(scratch_data_0, work_reg_a);
-            vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-            scratch_data_0 += depth_advance;
-
-            if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-              work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-              work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-            }
-
-            input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-            input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-            optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-            optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-            vst1q_s8(scratch_data_0, work_reg_a_sp);
-            vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-            scratch_data_0 += depth_advance;
-            input_data_0 += 16;
-          }
-
-          work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-          work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-          vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg_a = veorq_s8(work_reg_a, sign_bit);
-            work_reg_b = veorq_s8(work_reg_b, sign_bit);
-          }
-          optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-          vst1q_s8(scratch_data_0, work_reg_a);
-          vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-          scratch_data_0 += depth_advance;
-
-          work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-          work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-          vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-            work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-          }
-
-          optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-          vst1q_s8(scratch_data_0, work_reg_a_sp);
-          vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-          scratch_data_0 += depth_advance;
-        }
-        for (; i_depth < depth_micro_repeats; ++i_depth) {
-          input_data_a = vld1q_lane_s8x8(input_data_0, input_data_a, 0);
-          input_data_b =
-              vld1q_lane_s8x8(input_data_0 + 1 * input_depth, input_data_b, 0);
-          input_data_c =
-              vld1q_lane_s8x8(input_data_0 + 2 * input_depth, input_data_c, 0);
-          input_data_d =
-              vld1q_lane_s8x8(input_data_0 + 3 * input_depth, input_data_d, 0);
-          work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-          work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-          input_data_0 += 8;
-
-          vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg_a = veorq_s8(work_reg_a, sign_bit);
-            work_reg_b = veorq_s8(work_reg_b, sign_bit);
-          }
-
-          optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-          vst1q_s8(scratch_data_0, work_reg_a);
-          vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-          scratch_data_0 += depth_advance;
-        }
-        scratch_data_0 += width_advance;
-        input_data_0 += input_depth_skip;
-      }
-      if (width_overall_micro_repeats > input_width_micro_repeats) {
-        TFLITE_DCHECK_EQ(width_overall_micro_repeats,
-                         input_width_micro_repeats + 1);
-        TFLITE_DCHECK_GT(residual_width, 0);
-        TFLITE_DCHECK_LT(residual_width, 4);
-        for (int i_depth = 0; i_depth < depth_micro_repeats; ++i_depth) {
-          input_data_c = vdupq_n_u8(kSignBit);
-          input_data_a = vld1q_lane_s8x8(input_data_0, input_data_a, 0);
-          input_data_d = vdupq_n_u8(kSignBit);
-          if (residual_width > 1) {
-            input_data_b =
-                vld1q_lane_s8x8(input_data_0 + input_depth, input_data_b, 0);
-            if (residual_width == 3) {
-              input_data_c = vld1q_lane_s8x8(input_data_0 + 2 * input_depth,
-                                             input_data_c, 0);
-            }
-          }
-          work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-          work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg_a = veorq_s8(work_reg_a, sign_bit);
-            work_reg_b = veorq_s8(work_reg_b, sign_bit);
-          }
-          vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-
-          optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-          vst1q_s8(scratch_data_0, work_reg_a);
-          vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-          scratch_data_0 += depth_advance;
-          input_data_0 += 8;
-        }
-        scratch_data_0 += width_advance;
-        input_data_0 += input_depth_skip;
-      }
-
-      scratch_data_0 += height_advance;
-      input_block_data += input_height_stride;
-    }
-    TFLITE_DCHECK_EQ(
-        scratch_data_0,
-        scratch_block_data + block_height * workspace_height_stride);
-  }
-
-  static void __attribute__((noinline))
-  Run(int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    PreloadInputBlock(input_block_data, function_params);
-    PackMacroBlockNeon(input_block_data, scratch_block_data, function_params);
-  }
-};
-
-template 
-struct PackMacroBlock {
-  static inline void PackMacroBlockNeon(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    constexpr uint8 kSignBit =
-        QuantizationTypeImpl::kUint8SignBit;
-
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int input_width_micro_repeats =
-        function_params->input_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int block_height = function_params->inbound_block_height;
-    const int residual_width = function_params->residual_width;
-    const int input_height_stride = function_params->input_height_stride;
-    const int input_depth = function_params->input_depth;
-
-    const int padding_left = function_params->padding_left;
-    const int padding_right = function_params->padding_right;
-    const int padding_top = function_params->padding_top;
-    const int padding_bottom = function_params->padding_bottom;
-
-    TFLITE_DCHECK_GT(depth_micro_repeats, 0);
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-
-    const int micro_block_size = 4 * 8;
-    const int depth_advance = width_overall_micro_repeats * micro_block_size;
-    const int width_advance =
-        micro_block_size *
-        (1 - depth_micro_repeats * width_overall_micro_repeats);
-    const int height_advance = workspace_height_stride -
-                               width_overall_micro_repeats * micro_block_size;
-    const int input_depth_skip = 4 * input_depth - 8 * depth_micro_repeats;
-
-    const bool leading_width_padding =
-        padding_left > 0 && width_block_number == 0;
-    const bool trailing_width_padding =
-        padding_right > 0 &&
-        width_block_number == (function_params->width_macro_count - 1);
-    const bool leading_height_padding =
-        padding_top > 0 && height_block_number < 0;
-    const bool trailing_height_padding =
-        padding_bottom > 0 &&
-        height_block_number == (function_params->height_macro_count - 1);
-
-    const int32 input_offset = function_params->input_offset;
-    const int32 input_offset_difference = input_offset + kSymmetricZeroPoint;
-
-    // Transpositions are 4x4, but doing 2 at a time is more efficient in NEON
-    // code. Note the blocks of 4x4 are still interleaved down the depth.
-    int8x16_t work_reg_a;
-    int8x16_t work_reg_b;
-
-    // Effect subtraction of zero-point = 128 by XOR of sign bit.
-    const uint8x16_t sign_bit = vdupq_n_u8(kSignBit);
-
-    // Work through one slice, by row, at a time.
-    int8* scratch_data_0 = scratch_block_data;
-
-    int copy_block_height = block_height;
-    if (leading_height_padding) {
-      copy_block_height -= 1;
-      memset(scratch_data_0, -input_offset_difference, workspace_height_stride);
-      scratch_data_0 += workspace_height_stride;
-      input_block_data += input_height_stride;
-    }
-    if (trailing_height_padding) {
-      copy_block_height -= 1;
-    }
-
-    for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-      const typename QuantizationTypeImpl::ExternalType*
-          input_data_0 = input_block_data;
-      int8x16_t input_data_a;
-      int8x16_t input_data_b;
-      int8x16_t input_data_c;
-      int8x16_t input_data_d;
-
-      // Traverse the width one point at a time, but the depth in (micro) blocks
-      // of size 8.
-      //
-      // The depth and width margins, which are filled with "zeros", may be
-      // larger than is strictly needed to calculate output. This is because the
-      // conv calculation is performed across complete micro blocks.
-      for (int j_width = 0; j_width < width_overall_micro_repeats; ++j_width) {
-        // Figure out division of work (available input vs zero-ed).
-        int adjusted_residual_width =
-            j_width == (input_width_micro_repeats) ? residual_width : 4;
-
-        if (trailing_width_padding &&
-            j_width == (width_overall_micro_repeats - 1)) {
-          adjusted_residual_width -= 1;
-        }
-        int start_width = 0;
-        if (leading_width_padding && j_width == 0) {
-          start_width = 1;
-        }
-        if (start_width == 0) {
-          if (adjusted_residual_width == 4) {
-            int8x16_t work_reg_a_sp;
-            int8x16_t work_reg_b_sp;
-
-            int i_depth = 0;
-
-            if (depth_micro_repeats >= 2) {
-              i_depth += 2;
-
-              input_data_a = util_vld1q_x8(input_data_0);
-              input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-              input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-              input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-              input_data_0 += 16;
-
-              for (; i_depth < depth_micro_repeats - 1; i_depth += 2) {
-                work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-                work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-                vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-                if (quantization_type ==
-                    QuantizationType::kNonPerChannelUint8) {
-                  work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                  work_reg_b = veorq_s8(work_reg_b, sign_bit);
-                }
-
-                work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-                work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-                vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-
-                input_data_a = util_vld1q_x8(input_data_0);
-                input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-                optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-                optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-                vst1q_s8(scratch_data_0, work_reg_a);
-                vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-                scratch_data_0 += depth_advance;
-
-                if (quantization_type ==
-                    QuantizationType::kNonPerChannelUint8) {
-                  work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-                  work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-                }
-
-                input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-                input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-                optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-                optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-                vst1q_s8(scratch_data_0, work_reg_a_sp);
-                vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-                scratch_data_0 += depth_advance;
-                input_data_0 += 16;
-              }
-
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-
-              work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-              work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-              vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-                work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-              }
-
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-              vst1q_s8(scratch_data_0, work_reg_a_sp);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-              scratch_data_0 += depth_advance;
-            }
-            for (; i_depth < depth_micro_repeats; ++i_depth) {
-              input_data_a = vld1q_lane_s8x8(input_data_0, input_data_a, 0);
-              input_data_b = vld1q_lane_s8x8(input_data_0 + 1 * input_depth,
-                                             input_data_b, 0);
-              input_data_c = vld1q_lane_s8x8(input_data_0 + 2 * input_depth,
-                                             input_data_c, 0);
-              input_data_d = vld1q_lane_s8x8(input_data_0 + 3 * input_depth,
-                                             input_data_d, 0);
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-              input_data_0 += 8;
-
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-            }
-            scratch_data_0 += width_advance;
-            input_data_0 += input_depth_skip;
-          } else {
-            TFLITE_DCHECK_LT(adjusted_residual_width, 4);
-            for (int i_depth = 0; i_depth < depth_micro_repeats; ++i_depth) {
-              input_data_a = vdupq_n_u8(-input_offset);
-              input_data_b = vdupq_n_u8(-input_offset);
-              input_data_c = vdupq_n_u8(-input_offset);
-              input_data_d = vdupq_n_u8(-input_offset);
-              if (adjusted_residual_width > 0) {
-                input_data_a = vld1q_lane_s8x8(input_data_0, input_data_a, 0);
-                if (adjusted_residual_width > 1) {
-                  input_data_b = vld1q_lane_s8x8(input_data_0 + input_depth,
-                                                 input_data_b, 0);
-                  if (adjusted_residual_width == 3) {
-                    input_data_c = vld1q_lane_s8x8(
-                        input_data_0 + 2 * input_depth, input_data_c, 0);
-                  }
-                }
-              }
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-              input_data_0 += 8;
-            }
-            scratch_data_0 += width_advance;
-            input_data_0 += input_depth_skip;
-          }
-        } else {
-          if (adjusted_residual_width == 4) {
-            int8x16_t work_reg_a_sp;
-            int8x16_t work_reg_b_sp;
-
-            int i_depth = 0;
-
-            if (depth_micro_repeats >= 2) {
-              i_depth += 2;
-
-              input_data_a = vdupq_n_u8(-input_offset);
-              input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-              input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-              input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-              input_data_0 += 16;
-
-              for (; i_depth < depth_micro_repeats - 1; i_depth += 2) {
-                work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-                work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-                vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-                if (quantization_type ==
-                    QuantizationType::kNonPerChannelUint8) {
-                  work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                  work_reg_b = veorq_s8(work_reg_b, sign_bit);
-                }
-
-                work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-                work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-                vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-
-                input_data_a = vdupq_n_u8(-input_offset);
-                input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-                optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-                optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-                vst1q_s8(scratch_data_0, work_reg_a);
-                vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-                scratch_data_0 += depth_advance;
-
-                if (quantization_type ==
-                    QuantizationType::kNonPerChannelUint8) {
-                  work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-                  work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-                }
-
-                input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-                input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-                optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-                optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-                vst1q_s8(scratch_data_0, work_reg_a_sp);
-                vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-                scratch_data_0 += depth_advance;
-                input_data_0 += 16;
-              }
-
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-
-              work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-              work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-              vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-                work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-              }
-
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-              vst1q_s8(scratch_data_0, work_reg_a_sp);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-              scratch_data_0 += depth_advance;
-            }
-            for (; i_depth < depth_micro_repeats; ++i_depth) {
-              input_data_a = vdupq_n_u8(-input_offset);
-              input_data_b = vld1q_lane_s8x8(input_data_0 + 1 * input_depth,
-                                             input_data_b, 0);
-              input_data_c = vld1q_lane_s8x8(input_data_0 + 2 * input_depth,
-                                             input_data_c, 0);
-              input_data_d = vld1q_lane_s8x8(input_data_0 + 3 * input_depth,
-                                             input_data_d, 0);
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-              input_data_0 += 8;
-
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-            }
-            scratch_data_0 += width_advance;
-            input_data_0 += input_depth_skip;
-          } else {
-            TFLITE_DCHECK_LT(adjusted_residual_width, 4);
-
-            for (int i_depth = 0; i_depth < depth_micro_repeats; ++i_depth) {
-              input_data_a = vdupq_n_u8(-input_offset);
-              input_data_b = vdupq_n_u8(-input_offset);
-              input_data_c = vdupq_n_u8(-input_offset);
-              input_data_d = vdupq_n_u8(-input_offset);
-              // Skip loading first column.
-              if (adjusted_residual_width > 1) {
-                input_data_b = vld1q_lane_s8x8(input_data_0 + input_depth,
-                                               input_data_b, 0);
-                if (adjusted_residual_width == 3) {
-                  input_data_c = vld1q_lane_s8x8(input_data_0 + 2 * input_depth,
-                                                 input_data_c, 0);
-                }
-              }
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0);
-              optimized_ops_prefetch_write_l1_keep(scratch_data_0 + 16);
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-              input_data_0 += 8;
-            }
-            scratch_data_0 += width_advance;
-            input_data_0 += input_depth_skip;
-          }
-        }
-      }
-      scratch_data_0 += height_advance;
-      input_block_data += input_height_stride;
-    }
-
-    if (trailing_height_padding) {
-      memset(scratch_data_0, -input_offset_difference, workspace_height_stride);
-      scratch_data_0 += workspace_height_stride;
-    }
-
-    TFLITE_DCHECK_EQ(
-        scratch_data_0,
-        scratch_block_data + block_height * workspace_height_stride);
-  }
-
-  static void __attribute__((noinline))
-  Run(int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    PreloadInputBlock(input_block_data, function_params);
-    PackMacroBlockNeon(height_block_number, width_block_number,
-                       input_block_data, scratch_block_data, function_params);
-  }
-};
-
-template 
-struct PackMacroBlock {
-  static inline void PackMacroBlockNeon(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int input_width_micro_repeats =
-        function_params->input_width_micro_repeats;
-    const int block_height = function_params->inbound_block_height;
-    const int residual_width = function_params->residual_width;
-    const int input_height_stride = function_params->input_height_stride;
-
-    const int padding_left = function_params->padding_left;
-    const int padding_right = function_params->padding_right;
-    const int padding_top = function_params->padding_top;
-    const int padding_bottom = function_params->padding_bottom;
-
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-
-    TFLITE_DCHECK_GE(workspace_height_stride, 4 * width_overall_micro_repeats);
-
-    const bool leading_width_padding =
-        padding_left > 0 && width_block_number == 0;
-    const bool trailing_width_padding =
-        padding_right > 0 &&
-        width_block_number == (function_params->width_macro_count - 1);
-    const bool leading_height_padding =
-        padding_top > 0 && height_block_number < 0;
-    const bool trailing_height_padding =
-        padding_bottom > 0 &&
-        height_block_number == (function_params->height_macro_count - 1);
-
-    const int32 input_offset = function_params->input_offset;
-    const int32 input_offset_difference = input_offset + kSymmetricZeroPoint;
-
-    // Work through one slice, by row, at a time.
-    int8* scratch_data_base = scratch_block_data;
-
-    int copy_block_height = block_height;
-    if (leading_height_padding) {
-      copy_block_height -= 1;
-      memset(scratch_data_base, -input_offset_difference,
-             workspace_height_stride + kWorkspaceExtension);
-      scratch_data_base += workspace_height_stride;
-      input_block_data += input_height_stride;
-    }
-    if (trailing_height_padding) {
-      copy_block_height -= 1;
-    }
-
-    int adjusted_residual_width =
-        input_width_micro_repeats < width_overall_micro_repeats ? residual_width
-                                                                : 4;
-
-    if (trailing_width_padding) {
-      adjusted_residual_width -= 1;
-    }
-    int start_width = 0;
-    if (leading_width_padding) {
-      start_width = 1;
-      input_block_data += 1;
-    }
-
-    const int copy_size = (width_overall_micro_repeats - 1) * 4 +
-                          adjusted_residual_width - start_width;
-    // Adjusted so that later conditionals are simplified.
-    const int copy_size_adjusted =
-        trailing_width_padding ? copy_size + 1 : copy_size;
-
-    TFLITE_DCHECK_LE(
-        copy_size,
-        input_height_stride - width_block_number * input_width_micro_repeats);
-    // We may drop up to stride-1 of trailing input.
-    TFLITE_DCHECK_GE(copy_size, input_height_stride - 1);
-
-    int scratch_data_offset = 0;
-    int input_block_offset = 0;
-
-    constexpr uint8 kSignBit =
-        QuantizationTypeImpl::kUint8SignBit;
-
-    // Transpositions are 4x4, but doing 2 at a time is more efficient in NEON
-    // code. Note the blocks of 4x4 are still interleaved down the depth.
-    int8x16_t work_reg;
-    int8x8_t half_work_reg;
-    int8x8_t padding_mask;
-
-    // Effect subtraction of zero-point = 128 by XOR of sign bit.
-    const uint8x16_t sign_bit = vdupq_n_u8(kSignBit);
-    const uint8x16_t padding_reg = vdupq_n_u8(-input_offset);
-    padding_mask = vdup_n_s8(-1);
-    half_work_reg = vdup_n_s8(0);
-
-    if (copy_size >= 16) {
-      const int copy_remaining = (copy_size + start_width) & 0x7;
-      padding_mask = vreinterpret_s8_s64(vshl_s64(
-          vreinterpret_s64_s8(padding_mask), vdup_n_s64(8 * copy_remaining)));
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Work through one slice, by row, at a time.
-        int8* scratch_data = scratch_data_base + scratch_data_offset;
-
-        int copy_done = 0;
-
-        // The surrounding condition ensures that we always need at least one
-        // iteration of the main copy loop. In the case of leading width
-        // padding, we unroll this specially.
-        if (leading_width_padding) {
-          work_reg = util_vld1q_x8(input_block_data + input_block_offset);
-          work_reg = vextq_s8(padding_reg, work_reg, 15);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg = veorq_s8(work_reg, sign_bit);
-          }
-          optimized_ops_prefetch_write_l1_keep(scratch_data);
-          vst1q_s8(scratch_data, work_reg);
-          copy_done += 15;
-        }
-
-        // Main copy loop.
-        for (; (copy_done + 16) <= copy_size; copy_done += 16) {
-          work_reg =
-              util_vld1q_x8(input_block_data + input_block_offset + copy_done);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg = veorq_s8(work_reg, sign_bit);
-          }
-          TFLITE_DCHECK_EQ((start_width + copy_done) % 16, 0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data + start_width +
-                                               copy_done);
-          vst1q_s8(scratch_data + start_width + copy_done, work_reg);
-        }
-
-        if (copy_done + 8 <= copy_size) {
-          half_work_reg =
-              util_vld1_x8(input_block_data + input_block_offset + copy_done);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ((start_width + copy_done) % 8, 0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data + start_width +
-                                               copy_done);
-          vst1_s8(scratch_data + start_width + copy_done, half_work_reg);
-          copy_done += 8;
-        }
-
-        TFLITE_DCHECK_EQ(copy_remaining, copy_size - copy_done);
-        // Total amount
-        // = copy_size - copy_done + 4 - adjusted_residual_width
-        // = width_overall_micro_repeats * 4 - start_width - copy_done.
-        // Undone micro blocks
-        // = width_overall_micro_repeats - (start_width + copy_done) / 4.
-
-        // Conditional is (copy_remaining > 0 || trailing_width_padding).
-        if (copy_done < copy_size_adjusted) {
-          // Employ overlapping-load strategy in order to load full register,
-          // but use only part.
-          // This has the advantage of resulting in zeros after shifting.
-          half_work_reg = util_vld1_x8(input_block_data + input_block_offset +
-                                       copy_size - 8);
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_s64(vreinterpret_s64_s8(half_work_reg),
-                       vdup_n_s64(-8 * (8 - copy_remaining))));
-          half_work_reg = vbsl_s8(vreinterpret_u8_s8(padding_mask),
-                                  vget_low_s8(padding_reg), half_work_reg);
-
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ((start_width + copy_done) % 8, 0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data + start_width +
-                                               copy_done);
-          vst1_s8(scratch_data + start_width + copy_done, half_work_reg);
-        }
-
-        // Trailing guard.
-        optimized_ops_prefetch_write_l1_keep(scratch_data + start_width +
-                                             copy_done);
-        optimized_ops_prefetch_write_l1_keep(scratch_data + start_width +
-                                             copy_done + 8);
-        vst1_s8(scratch_data + start_width + copy_done, half_work_reg);
-        vst1_s8(scratch_data + start_width + copy_done + 8, half_work_reg);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else if (copy_size >= 4) {
-      const int copy_remaining = (copy_size + start_width) & 0x3;
-      padding_mask = vreinterpret_s8_s64(vshl_s64(
-          vreinterpret_s64_s8(padding_mask), vdup_n_s64(8 * copy_remaining)));
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Work through one slice, by row, at a time.
-        int8* scratch_data = scratch_data_base + scratch_data_offset;
-
-        int copy_done = 0;
-
-        // The surrounding condition ensures that we always need at least one
-        // iteration of the main copy loop. In the case of leading width
-        // padding, we unroll this specially.
-        if (leading_width_padding) {
-          half_work_reg = vld1_lane_8x4(input_block_data + input_block_offset,
-                                        half_work_reg, 0);
-          half_work_reg = vext_s8(vget_low_s8(padding_reg), half_work_reg, 7);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          optimized_ops_prefetch_write_l1_keep(scratch_data);
-          vst1_lane_8x4(scratch_data, half_work_reg, 0);
-          copy_done += 3;
-        }
-
-        // Main copy loop.
-        for (; (copy_done + 4) <= copy_size; copy_done += 4) {
-          half_work_reg =
-              vld1_lane_8x4(input_block_data + input_block_offset + copy_done,
-                            half_work_reg, 0);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ((start_width + copy_done) % 4, 0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data + start_width +
-                                               copy_done);
-          vst1_lane_8x4(scratch_data + start_width + copy_done, half_work_reg,
-                        0);
-        }
-
-        TFLITE_DCHECK_EQ(copy_remaining, copy_size - copy_done);
-        // Total amount
-        // = copy_size - copy_done + 4 - adjusted_residual_width
-        // = width_overall_micro_repeats * 4 - start_width - copy_done.
-        // Undone micro blocks
-        // = width_overall_micro_repeats - (start_width + copy_done) / 4.
-
-        // Conditional is (copy_remaining > 0 || trailing_width_padding).
-        if (copy_done < copy_size_adjusted) {
-          TFLITE_DCHECK_LT(copy_remaining, 4);
-          // Employ overlapping-load strategy in order to load full register,
-          // but use only part.
-          // This has the advantage of resulting in zeros after shifting.
-          half_work_reg = vld1_lane_8x4(
-              input_block_data + input_block_offset + copy_size - 4,
-              half_work_reg, 0);
-
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_s64(vreinterpret_s64_s8(half_work_reg),
-                       vdup_n_s64(-8 * (4 - copy_remaining))));
-          half_work_reg = vbsl_s8(vreinterpret_u8_s8(padding_mask),
-                                  vget_low_s8(padding_reg), half_work_reg);
-
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ((start_width + copy_done) % 4, 0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data + start_width +
-                                               copy_done);
-          vst1_lane_8x4(scratch_data + start_width + copy_done, half_work_reg,
-                        0);
-          copy_done += 4;
-        }
-        // Trailing guard.
-        optimized_ops_prefetch_write_l1_keep(scratch_data + start_width +
-                                             copy_done);
-        optimized_ops_prefetch_write_l1_keep(scratch_data + start_width +
-                                             copy_done + 12);
-        vst1_lane_8x4(scratch_data + start_width + copy_done, half_work_reg, 0);
-        vst1_lane_8x4(scratch_data + start_width + copy_done + 4, half_work_reg,
-                      0);
-        vst1_lane_8x4(scratch_data + start_width + copy_done + 8, half_work_reg,
-                      0);
-        vst1_lane_8x4(scratch_data + start_width + copy_done + 12,
-                      half_work_reg, 0);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else if (width_overall_micro_repeats == 2) {
-      // Special case of 1 + 3 + 1, padding + copy + padding.
-      // This is rarely executed in practice.
-      TFLITE_DCHECK_EQ(copy_size, 3);
-      TFLITE_DCHECK_EQ(start_width, 1);
-      TFLITE_DCHECK(leading_width_padding);
-      TFLITE_DCHECK(trailing_width_padding);
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        half_work_reg = vdup_n_u8(-input_offset);
-        half_work_reg = vld1_lane_s8(reinterpret_cast(
-                                         input_block_data + input_block_offset),
-                                     half_work_reg, 1);
-        half_work_reg =
-            vld1_lane_s8(reinterpret_cast(input_block_data +
-                                                       input_block_offset + 1),
-                         half_work_reg, 2);
-        half_work_reg =
-            vld1_lane_s8(reinterpret_cast(input_block_data +
-                                                       input_block_offset + 2),
-                         half_work_reg, 3);
-
-        if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-          half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-        }
-        TFLITE_DCHECK_EQ(scratch_data_offset % 8, 0);
-        optimized_ops_prefetch_write_l1_keep(scratch_data_base +
-                                             scratch_data_offset);
-        vst1_s8(scratch_data_base + scratch_data_offset, half_work_reg);
-
-        // Trailing guard.
-        optimized_ops_prefetch_write_l1_keep(scratch_data_base +
-                                             scratch_data_offset + 4);
-        optimized_ops_prefetch_write_l1_keep(scratch_data_base +
-                                             scratch_data_offset + 16);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 4,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 8,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 12,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 16,
-                      half_work_reg, 0);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else {
-      TFLITE_DCHECK_EQ(width_overall_micro_repeats, 1);
-      const int copy_remaining = (copy_size + start_width) & 0x3;
-      padding_mask = vreinterpret_s8_s64(vshl_s64(
-          vreinterpret_s64_s8(padding_mask), vdup_n_s64(8 * copy_remaining)));
-      if (leading_width_padding) {
-        padding_mask = vset_lane_u8(255, padding_mask, 0);
-      }
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        for (int i = 0; i < copy_size; ++i) {
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_n_s64(vreinterpret_s64_s8(half_work_reg), 8));
-          half_work_reg = vld1_lane_s8(
-              reinterpret_cast(
-                  input_block_data + input_block_offset + copy_size - 1 - i),
-              half_work_reg, 0);
-        }
-        if (leading_width_padding) {
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_n_s64(vreinterpret_s64_s8(half_work_reg), 8));
-        }
-        half_work_reg = vbsl_s8(vreinterpret_u8_s8(padding_mask),
-                                vget_low_s8(padding_reg), half_work_reg);
-
-        if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-          half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-        }
-        TFLITE_DCHECK_EQ(scratch_data_offset % 4, 0);
-        optimized_ops_prefetch_write_l1_keep(scratch_data_base +
-                                             scratch_data_offset);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset, half_work_reg,
-                      0);
-
-        // Trailing guard.
-        optimized_ops_prefetch_write_l1_keep(scratch_data_base +
-                                             scratch_data_offset + 4);
-        optimized_ops_prefetch_write_l1_keep(scratch_data_base +
-                                             scratch_data_offset + 16);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 4,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 8,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 12,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 16,
-                      half_work_reg, 0);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    }
-
-    scratch_data_base += copy_block_height * workspace_height_stride;
-
-    if (trailing_height_padding) {
-      memset(scratch_data_base, -input_offset_difference,
-             workspace_height_stride + kWorkspaceExtension);
-      scratch_data_base += workspace_height_stride;
-    }
-
-    TFLITE_DCHECK_EQ(
-        scratch_data_base,
-        scratch_block_data + block_height * workspace_height_stride);
-  }
-
-  static void __attribute__((noinline))
-  Run(int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    PreloadInputBlock(input_block_data, function_params);
-    PackMacroBlockNeon(height_block_number, width_block_number,
-                       input_block_data, scratch_block_data, function_params);
-  }
-};
-
-template 
-struct PackMacroBlock {
-  static inline void PackMacroBlockNeon(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int input_width_micro_repeats =
-        function_params->input_width_micro_repeats;
-    const int block_height = function_params->inbound_block_height;
-    const int residual_width = function_params->residual_width;
-    const int input_height_stride = function_params->input_height_stride;
-
-    TFLITE_DCHECK_EQ(function_params->padding_left, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_right, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_top, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_bottom, 0);
-
-    TFLITE_DCHECK_GE(workspace_height_stride, 4 * width_overall_micro_repeats);
-
-    // Work through one slice, by row, at a time.
-    int8* scratch_data_base = scratch_block_data;
-
-    const int copy_block_height = block_height;
-
-    int adjusted_residual_width =
-        input_width_micro_repeats < width_overall_micro_repeats ? residual_width
-                                                                : 4;
-
-    const int copy_size =
-        (width_overall_micro_repeats - 1) * 4 + adjusted_residual_width;
-
-    TFLITE_DCHECK_LE(
-        copy_size,
-        input_height_stride - width_block_number * input_width_micro_repeats);
-    // We may drop up to stride-1 of trailing input.
-    TFLITE_DCHECK_GE(copy_size, input_height_stride - 1);
-
-    int scratch_data_offset = 0;
-    int input_block_offset = 0;
-
-    constexpr uint8 kSignBit =
-        QuantizationTypeImpl::kUint8SignBit;
-
-    // Transpositions are 4x4, but doing 2 at a time is more efficient in NEON
-    // code. Note the blocks of 4x4 are still interleaved down the depth.
-    int8x16_t work_reg;
-    int8x8_t half_work_reg;
-
-    // Effect subtraction of zero-point = 128 by XOR of sign bit.
-    const uint8x16_t sign_bit = vdupq_n_u8(kSignBit);
-    half_work_reg = vdup_n_s8(0);
-
-    if (copy_size >= 16) {
-      const int copy_remaining = copy_size & 0x7;
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Work through one slice, by row, at a time.
-        int8* scratch_data = scratch_data_base + scratch_data_offset;
-
-        int copy_done = 0;
-
-        // Main copy loop.
-        for (; (copy_done + 16) <= copy_size; copy_done += 16) {
-          work_reg =
-              util_vld1q_x8(input_block_data + input_block_offset + copy_done);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg = veorq_s8(work_reg, sign_bit);
-          }
-          TFLITE_DCHECK_EQ(copy_done % 16, 0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data + copy_done);
-          vst1q_s8(scratch_data + copy_done, work_reg);
-        }
-
-        if (copy_done + 8 <= copy_size) {
-          half_work_reg =
-              util_vld1_x8(input_block_data + input_block_offset + copy_done);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ(copy_done % 8, 0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data + copy_done);
-          vst1_s8(scratch_data + copy_done, half_work_reg);
-          copy_done += 8;
-        }
-
-        TFLITE_DCHECK_EQ(copy_remaining, copy_size - copy_done);
-        // Total amount
-        // = copy_size - copy_done + 4 - adjusted_residual_width
-        // = width_overall_micro_repeats * 4 - start_width - copy_done.
-        // Undone micro blocks
-        // = width_overall_micro_repeats - (start_width + copy_done) / 4.
-
-        // Conditional is (copy_remaining > 0 || trailing_width_padding).
-        if (copy_done < copy_size) {
-          // Employ overlapping-load strategy in order to load full register,
-          // but use only part.
-          // This has the advantage of resulting in zeros after shifting.
-          half_work_reg = util_vld1_x8(input_block_data + input_block_offset +
-                                       copy_size - 8);
-
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_s64(vreinterpret_s64_s8(half_work_reg),
-                       vdup_n_s64(-8 * (8 - copy_remaining))));
-
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ(copy_done % 8, 0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data + copy_done);
-          vst1_s8(scratch_data + copy_done, half_work_reg);
-          copy_done += 8;
-        }
-
-        // Trailing guard.
-        optimized_ops_prefetch_write_l1_keep(scratch_data + copy_done);
-        optimized_ops_prefetch_write_l1_keep(scratch_data + copy_done + 8);
-        vst1_s8(scratch_data + copy_done, half_work_reg);
-        vst1_s8(scratch_data + copy_done + 8, half_work_reg);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else if (copy_size >= 4) {
-      const int copy_remaining = copy_size & 0x3;
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Work through one slice, by row, at a time.
-        int8* scratch_data = scratch_data_base + scratch_data_offset;
-
-        int copy_done = 0;
-
-        // Main copy loop.
-        for (; (copy_done + 4) <= copy_size; copy_done += 4) {
-          half_work_reg =
-              vld1_lane_8x4(input_block_data + input_block_offset + copy_done,
-                            half_work_reg, 0);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ(copy_done % 4, 0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data + copy_done);
-          vst1_lane_8x4(scratch_data + copy_done, half_work_reg, 0);
-        }
-
-        TFLITE_DCHECK_EQ(copy_remaining, copy_size - copy_done);
-        // Total amount
-        // = copy_size - copy_done + 4 - adjusted_residual_width
-        // = width_overall_micro_repeats * 4 - start_width - copy_done.
-        // Undone micro blocks
-        // = width_overall_micro_repeats - (start_width + copy_done) / 4.
-
-        // Conditional is (copy_remaining > 0 || trailing_width_padding).
-        if (copy_done < copy_size) {
-          TFLITE_DCHECK_LT(copy_remaining, 4);
-          // Employ overlapping-load strategy in order to load full register,
-          // but use only part.
-          // This has the advantage of resulting in zeros after shifting.
-          half_work_reg = vld1_lane_8x4(
-              input_block_data + input_block_offset + copy_size - 4,
-              half_work_reg, 0);
-
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_s64(vreinterpret_s64_s8(half_work_reg),
-                       vdup_n_s64(-8 * (4 - copy_remaining))));
-
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ(copy_done % 4, 0);
-          optimized_ops_prefetch_write_l1_keep(scratch_data + copy_done);
-          vst1_lane_8x4(scratch_data + copy_done, half_work_reg, 0);
-          copy_done += 4;
-        }
-        // Trailing guard.
-        optimized_ops_prefetch_write_l1_keep(scratch_data + copy_done);
-        optimized_ops_prefetch_write_l1_keep(scratch_data + copy_done + 12);
-        vst1_lane_8x4(scratch_data + copy_done, half_work_reg, 0);
-        vst1_lane_8x4(scratch_data + copy_done + 4, half_work_reg, 0);
-        vst1_lane_8x4(scratch_data + copy_done + 8, half_work_reg, 0);
-        vst1_lane_8x4(scratch_data + copy_done + 12, half_work_reg, 0);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else {
-      TFLITE_DCHECK_EQ(width_overall_micro_repeats, 1);
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        for (int i = 0; i < copy_size; ++i) {
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_n_s64(vreinterpret_s64_s8(half_work_reg), 8));
-          half_work_reg = vld1_lane_s8(
-              reinterpret_cast(
-                  input_block_data + input_block_offset + copy_size - 1 - i),
-              half_work_reg, 0);
-        }
-
-        half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-        TFLITE_DCHECK_EQ(scratch_data_offset % 4, 0);
-        optimized_ops_prefetch_write_l1_keep(scratch_data_base +
-                                             scratch_data_offset);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset, half_work_reg,
-                      0);
-
-        // Trailing guard.
-        optimized_ops_prefetch_write_l1_keep(scratch_data_base +
-                                             scratch_data_offset + 8);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 4,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 8,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 12,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 16,
-                      half_work_reg, 0);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    }
-
-    scratch_data_base += copy_block_height * workspace_height_stride;
-
-    TFLITE_DCHECK_EQ(
-        scratch_data_base,
-        scratch_block_data + block_height * workspace_height_stride);
-  }
-
-  static void __attribute__((noinline))
-  Run(int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    PreloadInputBlock(input_block_data, function_params);
-    PackMacroBlockNeon(height_block_number, width_block_number,
-                       input_block_data, scratch_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock {
-  static inline void KernelMacroBlockNeon(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Note that argument registers may be reused after parameter loading.
-    // x0 %[scratch_block_data]
-    // x1 %[filter_workspace]
-    // x2 %[bias_data]
-    // x3 %[output_block_data]
-    // x4 %[function_params]
-#define DC_KERNEL_NO_MULT_1 "1"
-#define DC_KERNEL_NO_MULT_2 "2"
-#define DC_KERNEL_NO_MULT_3 "3"
-#define DC_KERNEL_NO_MULT_4 "4"
-#define DC_KERNEL_NO_MULT_5 "5"
-#define DC_KERNEL_NO_MULT_6 "6"
-#define DC_KERNEL_NO_MULT_7 "7"
-#define DC_KERNEL_NO_MULT_8 "8"
-#define DC_KERNEL_NO_MULT_9 "9"
-#define DC_KERNEL_NO_MULT_10 "10"
-#define DC_KERNEL_NO_MULT_11 "11"
-#define DC_KERNEL_NO_MULT_12 "12"
-#define DC_KERNEL_NO_MULT_13 "13"
-#define DC_KERNEL_NO_MULT_14 "14"
-#define DC_KERNEL_NO_MULT_15 "15"
-#define DC_KERNEL_NO_MULT_16 "16"
-#define DC_KERNEL_NO_MULT_17 "17"
-#define DC_KERNEL_NO_MULT_18 "18"
-#define DC_KERNEL_NO_MULT_19 "19"
-#define DC_KERNEL_NO_MULT_20 "20"
-#define DC_KERNEL_NO_MULT_21 "21"
-#define DC_KERNEL_NO_MULT_22 "22"
-#define DC_KERNEL_NO_MULT_23 "23"
-#define DC_KERNEL_NO_MULT_24 "24"
-#define DC_KERNEL_NO_MULT_25 "25"
-#define DC_KERNEL_NO_MULT_26 "26"
-#define DC_KERNEL_NO_MULT_27 "27"
-#define DC_KERNEL_NO_MULT_28 "28"
-#define DC_KERNEL_NO_MULT_29 "29"
-#define DC_KERNEL_NO_MULT_30 "30"
-#define DC_KERNEL_NO_MULT_31 "31"
-#define DC_KERNEL_NO_MULT_32 "32"
-#define DC_KERNEL_NO_MULT_33 "33"
-#define DC_KERNEL_NO_MULT_34 "34"
-#define DC_KERNEL_NO_MULT_35 "35"
-
-    asm volatile(
-        // Compiled code used block of 320 for spill out of total stack of 464.
-        "sub    sp, sp, #320\n"  // =464
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_DEPTH_MICRO_REPEATS) "]\n"
-        "cmp    w8, #1\n"  // =1
-        "str    w8, [sp, #36]\n"  // 4-byte Folded Spill
-        "b.lt   " DC_KERNEL_NO_MULT_35 "f\n"
-        // %bb.1:
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "str    xzr, [sp, #64]\n"  // 8-byte Folded Spill
-        "str    wzr, [sp, #60]\n"  // 4-byte Folded Spill
-        "ldpsw  x21, x14, [%[function_params], #" STR(DP_OFFSET_OUTPUT_HEIGHT_STRIDE) "]\n"
-        "str    w8, [sp, #276]\n"  // 4-byte Folded Spill
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_OUTPUT_WIDTH_MICRO_REPEATS) "]\n"
-        "ldrsw  x13, [%[function_params], #" STR(DP_OFFSET_INPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "ldrb   w9, [%[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MAX) "]\n"
-        "ldrsw  x5, [%[function_params]]\n"
-        "str    w8, [sp, #280]\n"  // 4-byte Folded Spill
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_OUTPUT_RESIDUAL_WIDTH) "]\n"
-        "add    x11, %[function_params], #" STR(DP_OFFSET_OUTPUT_SHIFT) "\n"  // =36
-        "add    x12, %[function_params], #" STR(DP_OFFSET_OUTPUT_MULTIPLIER) "\n"  // =32
-        "add    x10, %[function_params], #" STR(DP_OFFSET_OUTPUT_OFFSET) "\n"  // =28
-        "str    w8, [sp, #284]\n"  // 4-byte Folded Spill
-        "ldrb   w8, [%[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MIN) "]\n"
-        "ld1r   { v1.4s }, [x12]\n"
-        "ld1r   { v2.4s }, [x11]\n"
-        "lsl    x12, x14, #2\n"
-        "dup    v7.16b, w8\n"
-        "fmov   s5, w8\n"
-        "lsl    x8, x13, #5\n"
-        "add    x13, x14, x14, lsl #1\n"
-        "add    x11, x14, x14, lsl #2\n"
-        "mov    x26, %[output_block_data]\n"
-        "mov    %[output_block_data], %[filter_workspace]\n"
-        "ldr    w7, [%[function_params], #" STR(DP_OFFSET_OUTBOUND_BLOCK_HEIGHT) "]\n"
-        "ld1r   { v0.8h }, [x10]\n"
-        "dup    v16.16b, w9\n"
-        "fmov   s6, w9\n"
-        "lsl    x15, x14, #1\n"
-        "lsl    %[filter_workspace], x21, #1\n"
-        "add    x27, x21, x21, lsl #1\n"
-        "lsl    x9, x5, #1\n"
-        "add    x10, x21, x5\n"
-        "stp    x11, x12, [sp, #208]\n"  // 16-byte Folded Spill
-        "add    x11, x11, %[scratch_block_data]\n"
-        "add    x12, x12, %[scratch_block_data]\n"
-        "str    x13, [sp, #224]\n"  // 8-byte Folded Spill
-        "add    x13, x13, %[scratch_block_data]\n"
-        "str    x8, [sp, #24]\n"  // 8-byte Folded Spill
-        "stp    x15, x14, [sp, #256]\n"  // 16-byte Folded Spill
-        "add    x8, x14, %[scratch_block_data]\n"
-        "add    x14, x15, %[scratch_block_data]\n"
-        "add    x15, x9, x5\n"
-        "add    x16, x9, x27\n"
-        "add    x17, x9, %[filter_workspace]\n"
-        "add    x6, x9, x21\n"
-        "add    %[function_params], x26, x9\n"
-        "add    x9, x26, x10\n"
-        "add    x10, x11, #32\n"  // =32
-        "add    x11, x12, #32\n"  // =32
-        "add    x12, x13, #32\n"  // =32
-        "str    x12, [sp, #312]\n"  // 8-byte Folded Spill
-        "add    x12, x14, #32\n"  // =32
-        "str    x12, [sp, #304]\n"  // 8-byte Folded Spill
-        "add    x12, x15, x27\n"
-        "add    x13, x15, %[filter_workspace]\n"
-        "add    x23, x15, x21\n"
-        "add    x14, x26, x15\n"
-        "add    x15, x27, x5\n"
-        "add    x20, x26, x17\n"
-        "mov    w17, w7\n"
-        "add    x19, x26, x15\n"
-        "add    x15, %[filter_workspace], x5\n"
-        "mov    x22, xzr\n"
-        "str    x14, [sp, #296]\n"  // 8-byte Folded Spill
-        "add    x14, x26, x16\n"
-        "add    x7, x26, x6\n"
-        "add    x16, x26, x15\n"
-        "add    x15, x26, x13\n"
-        "add    x6, x26, x23\n"
-        "and    w13, w17, #0xfffffffe\n"
-        "lsl    x23, x5, #2\n"
-        "dup    v17.8b, v5.b[0]\n"
-        "dup    v14.8b, v6.b[0]\n"
-        "add    x8, x8, #32\n"  // =32
-        "str    x14, [sp, #288]\n"  // 8-byte Folded Spill
-        "add    x14, x26, x12\n"
-        "mov    x12, xzr\n"
-        "str    w13, [sp, #12]\n"  // 4-byte Folded Spill
-        "mov    x13, x16\n"
-        "stp    x26, x23, [sp, #80]\n"  // 16-byte Folded Spill
-        "add    x23, x26, x21\n"
-        "add    x22, x26, x5\n"
-        "mov    x28, %[filter_workspace]\n"
-        "add    %[filter_workspace], x26, x1\n"
-        "add    x25, x26, x27\n"
-        "str    %[scratch_block_data], [sp, #184]\n"  // 8-byte Folded Spill
-        "str    x21, [sp, #136]\n"  // 8-byte Folded Spill
-        "str    w17, [sp, #76]\n"  // 4-byte Folded Spill
-        "str    x26, [sp, #16]\n"  // 8-byte Folded Spill
-        "stp    d14, d17, [sp, #96]\n"  // 16-byte Folded Spill
-        "stp    x6, x23, [sp, #240]\n"  // 16-byte Folded Spill
-        "b      " DC_KERNEL_NO_MULT_4 "f\n"
-        DC_KERNEL_NO_MULT_2 ":\n"  // in Loop: Header=BB225_4 Depth=1
-        "mov    %[bias_data], x16\n"
-        DC_KERNEL_NO_MULT_3 ":\n"  // in Loop: Header=BB225_4 Depth=1
-        "ldr    %[output_block_data], [sp, #24]\n"  // 8-byte Folded Reload
-        "ldr    x12, [sp, #184]\n"  // 8-byte Folded Reload
-        "ldr    w17, [sp, #60]\n"  // 4-byte Folded Reload
-        "add    x12, x12, %[output_block_data]\n"
-        "str    x12, [sp, #184]\n"  // 8-byte Folded Spill
-        "ldr    x12, [sp, #80]\n"  // 8-byte Folded Reload
-        "add    w17, w17, #1\n"  // =1
-        "str    w17, [sp, #60]\n"  // 4-byte Folded Spill
-        "add    x12, x12, #8\n"  // =8
-        "str    x12, [sp, #80]\n"  // 8-byte Folded Spill
-        "ldr    x12, [sp, #64]\n"  // 8-byte Folded Reload
-        "add    x12, x12, %[output_block_data]\n"
-        "str    x12, [sp, #64]\n"  // 8-byte Folded Spill
-        "ldr    w12, [sp, #36]\n"  // 4-byte Folded Reload
-        "cmp    w17, w12\n"
-        "ldp    x12, %[output_block_data], [sp, #40]\n"  // 16-byte Folded Reload
-        "ldr    w17, [sp, #76]\n"  // 4-byte Folded Reload
-        "add    x12, x12, #8\n"  // =8
-        "b.eq   " DC_KERNEL_NO_MULT_35 "f\n"
-        DC_KERNEL_NO_MULT_4 ":\n"  // =>This Loop Header: Depth=1
-        // Child Loop BB225_31 Depth 2
-        // Child Loop BB225_34 Depth 2
-        // Child Loop BB225_20 Depth 2
-        // Child Loop BB225_23 Depth 3
-        // Child Loop BB225_27 Depth 4
-        // Child Loop BB225_7 Depth 2
-        // Child Loop BB225_9 Depth 3
-        // Child Loop BB225_15 Depth 3
-        "ldp    q18, q15, [%[output_block_data]]\n"
-        "ldp    q19, q5, [%[output_block_data], #32]\n"
-        "ldp    q20, q6, [%[output_block_data], #64]\n"
-        "cmp    w17, #4\n"  // =4
-        "add    %[output_block_data], x3, #96\n"  // =96
-        "stp    x12, %[output_block_data], [sp, #40]\n"  // 16-byte Folded Spill
-        "b.ne   " DC_KERNEL_NO_MULT_16 "f\n"
-        // %bb.5:        // in Loop: Header=BB225_4 Depth=1
-        "mov    x24, x12\n"
-        "ldr    x12, [sp, #64]\n"  // 8-byte Folded Reload
-        "mov    x16, xzr\n"
-        "stp    q6, q5, [sp, #144]\n"  // 32-byte Folded Spill
-        "str    q15, [sp, #112]\n"  // 16-byte Folded Spill
-        "str    x12, [sp, #232]\n"  // 8-byte Folded Spill
-        "b      " DC_KERNEL_NO_MULT_7 "f\n"
-        DC_KERNEL_NO_MULT_6 ":\n"  // in Loop: Header=BB225_7 Depth=2
-        "ldr    x12, [sp, #232]\n"  // 8-byte Folded Reload
-        "ldp    q20, q19, [sp, #144]\n"  // 32-byte Folded Reload
-        "add    x16, x16, #1\n"  // =1
-        "cmp    x16, #2\n"  // =2
-        "add    x12, x12, #16\n"  // =16
-        "add    x24, x24, #4\n"  // =4
-        "mov    v18.16b, v15.16b\n"
-        "str    x12, [sp, #232]\n"  // 8-byte Folded Spill
-        "b.eq   " DC_KERNEL_NO_MULT_3 "b\n"
-        DC_KERNEL_NO_MULT_7 ":\n"  // Parent Loop BB225_4 Depth=1
-        // =>  This Loop Header: Depth=2
-        // Child Loop BB225_9 Depth 3
-        // Child Loop BB225_15 Depth 3
-        "ldr    x12, [sp, #184]\n"  // 8-byte Folded Reload
-        "ldr    q21, [%[bias_data]], #16\n"
-        "add    %[output_block_data], x12, x16, lsl #4\n"
-        "ldr    w12, [sp, #280]\n"  // 4-byte Folded Reload
-        "ldr    q22, [%[output_block_data]]\n"
-        "mov    v31.16b, v21.16b\n"
-        "mov    v8.16b, v21.16b\n"
-        "cmp    w12, #1\n"  // =1
-        "ldr    x12, [sp, #264]\n"  // 8-byte Folded Reload
-        "mov    v9.16b, v21.16b\n"
-        "mov    v10.16b, v21.16b\n"
-        "ldr    q27, [%[output_block_data], x12]\n"
-        "ldr    x12, [sp, #256]\n"  // 8-byte Folded Reload
-        "ldr    q26, [%[output_block_data], x12]\n"
-        "ldr    x12, [sp, #224]\n"  // 8-byte Folded Reload
-        ".word 0x4e9a969f  // sdot   v31.4s, v20.16b, v26.16b\n"
-        "ldr    q25, [%[output_block_data], x12]\n"
-        "ldr    x12, [sp, #216]\n"  // 8-byte Folded Reload
-        ".word 0x4e9a9668  // sdot   v8.4s, v19.16b, v26.16b\n"
-        ".word 0x4e9a9649  // sdot   v9.4s, v18.16b, v26.16b\n"
-        ".word 0x4e99964a  // sdot   v10.4s, v18.16b, v25.16b\n"
-        "ldr    q24, [%[output_block_data], x12]\n"
-        "ldr    x12, [sp, #208]\n"  // 8-byte Folded Reload
-        "ldr    q23, [%[output_block_data], x12]\n"
-        "b.lt   " DC_KERNEL_NO_MULT_11 "f\n"
-        // %bb.8:        // in Loop: Header=BB225_7 Depth=2
-        "stp    x24, x16, [sp, #192]\n"  // 16-byte Folded Spill
-        "ldr    w12, [sp, #280]\n"  // 4-byte Folded Reload
-        "mov    x17, x24\n"
-        "ldr    x21, [sp, #232]\n"  // 8-byte Folded Reload
-        "mov    x24, x25\n"
-        "mov    x25, %[filter_workspace]\n"
-        "mov    %[filter_workspace], x22\n"
-        "mov    x22, x23\n"
-        "ldr    x23, [sp, #88]\n"  // 8-byte Folded Reload
-        "shl    v28.4s, v18.4s, #8\n"
-        "shl    v29.4s, v19.4s, #8\n"
-        "shl    v30.4s, v20.4s, #8\n"
-        "mov    v11.16b, v23.16b\n"
-        "mov    v12.16b, v24.16b\n"
-        "mov    v13.16b, v27.16b\n"
-        "mov    v14.16b, v22.16b\n"
-        DC_KERNEL_NO_MULT_9 ":\n"  // Parent Loop BB225_4 Depth=1
-        // Parent Loop BB225_7 Depth=2
-        // =>  This Inner Loop Header: Depth=3
-        ".word 0x4e8e965f  // sdot   v31.4s, v18.16b, v14.16b\n"
-        ".word 0x4e8d9648  // sdot   v8.4s, v18.16b, v13.16b\n"
-        ".word 0x4e999669  // sdot   v9.4s, v19.16b, v25.16b\n"
-        ".word 0x4e8d967f  // sdot   v31.4s, v19.16b, v13.16b\n"
-        ".word 0x4e8c966a  // sdot   v10.4s, v19.16b, v12.16b\n"
-        ".word 0x4e999688  // sdot   v8.4s, v20.16b, v25.16b\n"
-        ".word 0x4e8c9689  // sdot   v9.4s, v20.16b, v12.16b\n"
-        "sqrdmulh        v31.4s, v31.4s, v1.4s\n"
-        ".word 0x4e8b968a  // sdot   v10.4s, v20.16b, v11.16b\n"
-        "sqrdmulh        v8.4s, v8.4s, v1.4s\n"
-        "sqrdmulh        v9.4s, v9.4s, v1.4s\n"
-        "sqrshl v31.4s, v31.4s, v2.4s\n"
-        "sqrdmulh        v10.4s, v10.4s, v1.4s\n"
-        "sqrshl v8.4s, v8.4s, v2.4s\n"
-        "sqrshl v9.4s, v9.4s, v2.4s\n"
-        "sqxtn  v31.4h, v31.4s\n"
-        "sqrshl v10.4s, v10.4s, v2.4s\n"
-        "sqxtn  v9.4h, v9.4s\n"
-        "sqxtn2 v31.8h, v8.4s\n"
-        "sqxtn2 v9.8h, v10.4s\n"
-        "sqadd  v31.8h, v31.8h, v0.8h\n"
-        "sqadd  v8.8h, v9.8h, v0.8h\n"
-        "sqxtun v31.8b, v31.8h\n"
-        "sqxtun2        v31.16b, v8.8h\n"
-        "umax   v31.16b, v31.16b, v7.16b\n"
-        "add    %[output_block_data], x22, x17\n"
-        "umin   v31.16b, v31.16b, v16.16b\n"
-        "str    s31, [x26, x17]\n"
-        "st1    { v31.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], x25, x17\n"
-        "st1    { v31.s }[2], [%[output_block_data]]\n"
-        "add    %[output_block_data], x24, x17\n"
-        "mov    v10.16b, v21.16b\n"
-        "st1    { v31.s }[3], [%[output_block_data]]\n"
-        "mov    v31.16b, v21.16b\n"
-        "mov    v8.16b, v21.16b\n"
-        ".word 0x4e99978a  // sdot   v10.4s, v28.16b, v25.16b\n"
-        "mov    x16, x26\n"
-        "ldr    x26, [sp, #304]\n"  // 8-byte Folded Reload
-        ".word 0x4e8e979f  // sdot   v31.4s, v28.16b, v14.16b\n"
-        ".word 0x4e8d9788  // sdot   v8.4s, v28.16b, v13.16b\n"
-        ".word 0x4e8c97aa  // sdot   v10.4s, v29.16b, v12.16b\n"
-        "mov    v9.16b, v21.16b\n"
-        ".word 0x4e8d97bf  // sdot   v31.4s, v29.16b, v13.16b\n"
-        ".word 0x4e9a97a8  // sdot   v8.4s, v29.16b, v26.16b\n"
-        ".word 0x4e8b97ca  // sdot   v10.4s, v30.16b, v11.16b\n"
-        "rev32  v4.8h, v26.8h\n"
-        ".word 0x4e9a9789  // sdot   v9.4s, v28.16b, v26.16b\n"
-        ".word 0x4e9a97df  // sdot   v31.4s, v30.16b, v26.16b\n"
-        ".word 0x4e9997c8  // sdot   v8.4s, v30.16b, v25.16b\n"
-        "sqrdmulh        v26.4s, v10.4s, v1.4s\n"
-        "rev32  v6.8h, v24.8h\n"
-        ".word 0x4e9997a9  // sdot   v9.4s, v29.16b, v25.16b\n"
-        "sqrdmulh        v24.4s, v8.4s, v1.4s\n"
-        "sqrshl v8.4s, v26.4s, v2.4s\n"
-        "ldr    q26, [x26, x21]\n"
-        "ldr    x26, [sp, #312]\n"  // 8-byte Folded Reload
-        "mov    v17.16b, v16.16b\n"
-        "mov    v16.16b, v7.16b\n"
-        "rev32  v7.8h, v23.8h\n"
-        ".word 0x4e8c97c9  // sdot   v9.4s, v30.16b, v12.16b\n"
-        "sqrdmulh        v23.4s, v31.4s, v1.4s\n"
-        "rev32  v5.8h, v25.8h\n"
-        "sqrdmulh        v25.4s, v9.4s, v1.4s\n"
-        "sqrshl v23.4s, v23.4s, v2.4s\n"
-        "add    %[output_block_data], %[scratch_block_data], x21\n"
-        "sqrshl v31.4s, v24.4s, v2.4s\n"
-        "sqrshl v24.4s, v25.4s, v2.4s\n"
-        "sqxtn  v9.4h, v23.4s\n"
-        "rev32  v15.8h, v22.8h\n"
-        "ldr    q22, [%[output_block_data], #32]\n"
-        "rev32  v3.8h, v27.8h\n"
-        "sqxtn  v10.4h, v24.4s\n"
-        "ldr    q27, [x8, x21]\n"
-        "ldr    q25, [x26, x21]\n"
-        "ldr    q24, [x11, x21]\n"
-        "ldr    q23, [x10, x21]\n"
-        "sqxtn2 v9.8h, v31.4s\n"
-        "sqxtn2 v10.8h, v8.4s\n"
-        "sqadd  v31.8h, v9.8h, v0.8h\n"
-        "sqadd  v8.8h, v10.8h, v0.8h\n"
-        "sqxtun v31.8b, v31.8h\n"
-        "sqxtun2        v31.16b, v8.8h\n"
-        "umax   v31.16b, v31.16b, v16.16b\n"
-        "add    %[output_block_data], x9, x17\n"
-        "umin   v31.16b, v31.16b, v17.16b\n"
-        "str    s31, [%[filter_workspace], x17]\n"
-        "st1    { v31.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], x13, x17\n"
-        "st1    { v31.s }[2], [%[output_block_data]]\n"
-        "add    %[output_block_data], x19, x17\n"
-        "mov    v8.16b, v21.16b\n"
-        "st1    { v31.s }[3], [%[output_block_data]]\n"
-        "trn1   v31.8h, v15.8h, v22.8h\n"
-        "mov    v9.16b, v21.16b\n"
-        "mov    v10.16b, v21.16b\n"
-        "trn1   v3.8h, v3.8h, v27.8h\n"
-        "trn1   v4.8h, v4.8h, v26.8h\n"
-        ".word 0x4e9f9648  // sdot   v8.4s, v18.16b, v31.16b\n"
-        "mov    v11.16b, v21.16b\n"
-        "trn1   v5.8h, v5.8h, v25.8h\n"
-        ".word 0x4e839649  // sdot   v9.4s, v18.16b, v3.16b\n"
-        ".word 0x4e84964a  // sdot   v10.4s, v18.16b, v4.16b\n"
-        ".word 0x4e839668  // sdot   v8.4s, v19.16b, v3.16b\n"
-        "trn1   v6.8h, v6.8h, v24.8h\n"
-        ".word 0x4e85964b  // sdot   v11.4s, v18.16b, v5.16b\n"
-        ".word 0x4e849669  // sdot   v9.4s, v19.16b, v4.16b\n"
-        ".word 0x4e85966a  // sdot   v10.4s, v19.16b, v5.16b\n"
-        ".word 0x4e849688  // sdot   v8.4s, v20.16b, v4.16b\n"
-        "trn1   v7.8h, v7.8h, v23.8h\n"
-        ".word 0x4e86966b  // sdot   v11.4s, v19.16b, v6.16b\n"
-        ".word 0x4e859689  // sdot   v9.4s, v20.16b, v5.16b\n"
-        ".word 0x4e86968a  // sdot   v10.4s, v20.16b, v6.16b\n"
-        "sqrdmulh        v8.4s, v8.4s, v1.4s\n"
-        ".word 0x4e87968b  // sdot   v11.4s, v20.16b, v7.16b\n"
-        "sqrdmulh        v9.4s, v9.4s, v1.4s\n"
-        "sqrdmulh        v10.4s, v10.4s, v1.4s\n"
-        "sqrshl v8.4s, v8.4s, v2.4s\n"
-        "sqrdmulh        v11.4s, v11.4s, v1.4s\n"
-        "sqrshl v9.4s, v9.4s, v2.4s\n"
-        "sqrshl v10.4s, v10.4s, v2.4s\n"
-        "sqxtn  v8.4h, v8.4s\n"
-        "sqrshl v11.4s, v11.4s, v2.4s\n"
-        "sqxtn  v10.4h, v10.4s\n"
-        "sqxtn2 v8.8h, v9.4s\n"
-        "sqxtn2 v10.8h, v11.4s\n"
-        "sqadd  v8.8h, v8.8h, v0.8h\n"
-        "sqadd  v9.8h, v10.8h, v0.8h\n"
-        "sqxtun v8.8b, v8.8h\n"
-        "sqxtun2        v8.16b, v9.8h\n"
-        "mov    v9.16b, v21.16b\n"
-        "mov    v10.16b, v21.16b\n"
-        "mov    v11.16b, v21.16b\n"
-        ".word 0x4e9f9789  // sdot   v9.4s, v28.16b, v31.16b\n"
-        "mov    x26, x16\n"
-        "ldr    x16, [sp, #288]\n"  // 8-byte Folded Reload
-        "mov    v12.16b, v21.16b\n"
-        ".word 0x4e83978a  // sdot   v10.4s, v28.16b, v3.16b\n"
-        ".word 0x4e84978b  // sdot   v11.4s, v28.16b, v4.16b\n"
-        ".word 0x4e8397a9  // sdot   v9.4s, v29.16b, v3.16b\n"
-        "umax   v8.16b, v8.16b, v16.16b\n"
-        ".word 0x4e85978c  // sdot   v12.4s, v28.16b, v5.16b\n"
-        ".word 0x4e8497aa  // sdot   v10.4s, v29.16b, v4.16b\n"
-        ".word 0x4e8597ab  // sdot   v11.4s, v29.16b, v5.16b\n"
-        ".word 0x4e8497c9  // sdot   v9.4s, v30.16b, v4.16b\n"
-        "add    %[output_block_data], x7, x17\n"
-        "umin   v8.16b, v8.16b, v17.16b\n"
-        ".word 0x4e8697ac  // sdot   v12.4s, v29.16b, v6.16b\n"
-        ".word 0x4e8597ca  // sdot   v10.4s, v30.16b, v5.16b\n"
-        ".word 0x4e8697cb  // sdot   v11.4s, v30.16b, v6.16b\n"
-        "sqrdmulh        v3.4s, v9.4s, v1.4s\n"
-        "str    s8, [%[function_params], x17]\n"
-        "st1    { v8.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], x20, x17\n"
-        ".word 0x4e8797cc  // sdot   v12.4s, v30.16b, v7.16b\n"
-        "sqrdmulh        v4.4s, v10.4s, v1.4s\n"
-        "sqrdmulh        v5.4s, v11.4s, v1.4s\n"
-        "sqrshl v3.4s, v3.4s, v2.4s\n"
-        "st1    { v8.s }[2], [%[output_block_data]]\n"
-        "add    %[output_block_data], x16, x17\n"
-        "sqrdmulh        v6.4s, v12.4s, v1.4s\n"
-        "sqrshl v4.4s, v4.4s, v2.4s\n"
-        "sqrshl v5.4s, v5.4s, v2.4s\n"
-        "sqxtn  v3.4h, v3.4s\n"
-        "st1    { v8.s }[3], [%[output_block_data]]\n"
-        "sqrshl v6.4s, v6.4s, v2.4s\n"
-        "sqxtn  v5.4h, v5.4s\n"
-        "sqxtn2 v3.8h, v4.4s\n"
-        "sqxtn2 v5.8h, v6.4s\n"
-        "sqadd  v3.8h, v3.8h, v0.8h\n"
-        "sqadd  v4.8h, v5.8h, v0.8h\n"
-        "sqxtun v3.8b, v3.8h\n"
-        "sqxtun2        v3.16b, v4.8h\n"
-        "ldr    x16, [sp, #296]\n"  // 8-byte Folded Reload
-        "mov    v7.16b, v16.16b\n"
-        "umax   v3.16b, v3.16b, v7.16b\n"
-        "add    %[output_block_data], x6, x17\n"
-        "umin   v3.16b, v3.16b, v17.16b\n"
-        "str    s3, [x16, x17]\n"
-        "st1    { v3.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], x15, x17\n"
-        "mov    v31.16b, v21.16b\n"
-        "mov    v8.16b, v21.16b\n"
-        "mov    v9.16b, v21.16b\n"
-        "mov    v10.16b, v21.16b\n"
-        "mov    v16.16b, v17.16b\n"
-        "st1    { v3.s }[2], [%[output_block_data]]\n"
-        "add    %[output_block_data], x14, x17\n"
-        "subs   w12, w12, #1\n"  // =1
-        "add    x21, x21, #32\n"  // =32
-        ".word 0x4e9a969f  // sdot   v31.4s, v20.16b, v26.16b\n"
-        ".word 0x4e9a9668  // sdot   v8.4s, v19.16b, v26.16b\n"
-        ".word 0x4e9a9649  // sdot   v9.4s, v18.16b, v26.16b\n"
-        ".word 0x4e99964a  // sdot   v10.4s, v18.16b, v25.16b\n"
-        "add    x17, x17, x23\n"
-        "mov    v11.16b, v23.16b\n"
-        "mov    v12.16b, v24.16b\n"
-        "mov    v13.16b, v27.16b\n"
-        "mov    v14.16b, v22.16b\n"
-        "st1    { v3.s }[3], [%[output_block_data]]\n"
-        "b.ne   " DC_KERNEL_NO_MULT_9 "b\n"
-        // %bb.10:        // in Loop: Header=BB225_7 Depth=2
-        "add    %[output_block_data], %[scratch_block_data], x21\n"
-        "ldr    x21, [sp, #136]\n"  // 8-byte Folded Reload
-        "ldp    d14, d17, [sp, #96]\n"  // 16-byte Folded Reload
-        "mov    x23, x22\n"
-        "mov    x22, %[filter_workspace]\n"
-        "mov    %[filter_workspace], x25\n"
-        "mov    x25, x24\n"
-        "ldr    q15, [sp, #112]\n"  // 16-byte Folded Reload
-        "ldp    x24, x16, [sp, #192]\n"  // 16-byte Folded Reload
-        "add    x12, x26, x17\n"
-        "ldr    w17, [sp, #284]\n"  // 4-byte Folded Reload
-        "cmp    w17, #0\n"  // =0
-        "b.gt   " DC_KERNEL_NO_MULT_12 "f\n"
-        "b      " DC_KERNEL_NO_MULT_6 "b\n"
-        DC_KERNEL_NO_MULT_11 ":\n"  // in Loop: Header=BB225_7 Depth=2
-        "ldr    x12, [sp, #80]\n"  // 8-byte Folded Reload
-        "add    x12, x12, x16, lsl #2\n"
-        "ldr    w17, [sp, #284]\n"  // 4-byte Folded Reload
-        "cmp    w17, #0\n"  // =0
-        "b.le   " DC_KERNEL_NO_MULT_6 "b\n"
-        DC_KERNEL_NO_MULT_12 ":\n"  // in Loop: Header=BB225_7 Depth=2
-        "ldr    w17, [sp, #284]\n"  // 4-byte Folded Reload
-        "movi   v28.16b, #0\n"
-        "movi   v29.16b, #0\n"
-        "movi   v30.16b, #0\n"
-        "cmp    w17, #3\n"  // =3
-        "movi   v11.16b, #0\n"
-        "movi   v12.16b, #0\n"
-        "movi   v13.16b, #0\n"
-        "b.lt   " DC_KERNEL_NO_MULT_14 "f\n"
-        // %bb.13:        // in Loop: Header=BB225_7 Depth=2
-        "add    x17, %[output_block_data], #32\n"  // =32
-        "ldr    %[output_block_data], [sp, #264]\n"  // 8-byte Folded Reload
-        "ldr    q13, [x17]\n"
-        "ldr    q12, [x17, %[output_block_data]]\n"
-        "ldr    %[output_block_data], [sp, #256]\n"  // 8-byte Folded Reload
-        "ldr    q11, [x17, %[output_block_data]]\n"
-        "ldr    %[output_block_data], [sp, #224]\n"  // 8-byte Folded Reload
-        "ldr    q30, [x17, %[output_block_data]]\n"
-        "ldr    %[output_block_data], [sp, #216]\n"  // 8-byte Folded Reload
-        "ldr    q29, [x17, %[output_block_data]]\n"
-        "ldr    %[output_block_data], [sp, #208]\n"  // 8-byte Folded Reload
-        "ldr    q28, [x17, %[output_block_data]]\n"
-        DC_KERNEL_NO_MULT_14 ":\n"  // in Loop: Header=BB225_7 Depth=2
-        "ldr    w17, [sp, #284]\n"  // 4-byte Folded Reload
-        DC_KERNEL_NO_MULT_15 ":\n"  // Parent Loop BB225_4 Depth=1
-        // Parent Loop BB225_7 Depth=2
-        // =>  This Inner Loop Header: Depth=3
-        ".word 0x4e96965f  // sdot   v31.4s, v18.16b, v22.16b\n"
-        ".word 0x4e9b9648  // sdot   v8.4s, v18.16b, v27.16b\n"
-        ".word 0x4e999669  // sdot   v9.4s, v19.16b, v25.16b\n"
-        ".word 0x4e9b967f  // sdot   v31.4s, v19.16b, v27.16b\n"
-        ".word 0x4e98966a  // sdot   v10.4s, v19.16b, v24.16b\n"
-        ".word 0x4e999688  // sdot   v8.4s, v20.16b, v25.16b\n"
-        ".word 0x4e989689  // sdot   v9.4s, v20.16b, v24.16b\n"
-        "sqrdmulh        v3.4s, v31.4s, v1.4s\n"
-        ".word 0x4e97968a  // sdot   v10.4s, v20.16b, v23.16b\n"
-        "sqrdmulh        v4.4s, v8.4s, v1.4s\n"
-        "sqrdmulh        v5.4s, v9.4s, v1.4s\n"
-        "sqrshl v3.4s, v3.4s, v2.4s\n"
-        "sqrdmulh        v6.4s, v10.4s, v1.4s\n"
-        "sqrshl v4.4s, v4.4s, v2.4s\n"
-        "sqrshl v5.4s, v5.4s, v2.4s\n"
-        "sqxtn  v3.4h, v3.4s\n"
-        "sqrshl v6.4s, v6.4s, v2.4s\n"
-        "sqxtn  v5.4h, v5.4s\n"
-        "sqxtn2 v3.8h, v4.4s\n"
-        "sqxtn2 v5.8h, v6.4s\n"
-        "sqadd  v3.8h, v3.8h, v0.8h\n"
-        "sqadd  v4.8h, v5.8h, v0.8h\n"
-        "sqxtun v3.8b, v3.8h\n"
-        "sqxtun2        v3.16b, v4.8h\n"
-        "umax   v3.16b, v3.16b, v7.16b\n"
-        "add    %[output_block_data], x12, x21\n"
-        "umin   v3.16b, v3.16b, v16.16b\n"
-        "ushr   v26.4s, v26.4s, #8\n"
-        "ushr   v25.4s, v25.4s, #8\n"
-        "str    s3, [x12]\n"
-        "st1    { v3.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], x12, x28\n"
-        "ushr   v22.4s, v22.4s, #8\n"
-        "ushr   v27.4s, v27.4s, #8\n"
-        "sli    v26.4s, v11.4s, #24\n"
-        "ushr   v24.4s, v24.4s, #8\n"
-        "ushr   v23.4s, v23.4s, #8\n"
-        "sli    v25.4s, v30.4s, #24\n"
-        "mov    v31.16b, v21.16b\n"
-        "mov    v8.16b, v21.16b\n"
-        "mov    v9.16b, v21.16b\n"
-        "mov    v10.16b, v21.16b\n"
-        "st1    { v3.s }[2], [%[output_block_data]]\n"
-        "add    %[output_block_data], x12, x27\n"
-        "subs   w17, w17, #1\n"  // =1
-        "sli    v22.4s, v13.4s, #24\n"
-        "ushr   v13.4s, v13.4s, #8\n"
-        "ushr   v11.4s, v11.4s, #8\n"
-        "sli    v27.4s, v12.4s, #24\n"
-        "ushr   v12.4s, v12.4s, #8\n"
-        "ushr   v30.4s, v30.4s, #8\n"
-        "sli    v24.4s, v29.4s, #24\n"
-        "ushr   v29.4s, v29.4s, #8\n"
-        "sli    v23.4s, v28.4s, #24\n"
-        "ushr   v28.4s, v28.4s, #8\n"
-        ".word 0x4e9a969f  // sdot   v31.4s, v20.16b, v26.16b\n"
-        ".word 0x4e9a9668  // sdot   v8.4s, v19.16b, v26.16b\n"
-        ".word 0x4e9a9649  // sdot   v9.4s, v18.16b, v26.16b\n"
-        "add    x12, x12, x5\n"
-        ".word 0x4e99964a  // sdot   v10.4s, v18.16b, v25.16b\n"
-        "st1    { v3.s }[3], [%[output_block_data]]\n"
-        "b.ne   " DC_KERNEL_NO_MULT_15 "b\n"
-        "b      " DC_KERNEL_NO_MULT_6 "b\n"
-        DC_KERNEL_NO_MULT_16 ":\n"  // in Loop: Header=BB225_4 Depth=1
-        "cmp    w17, #1\n"  // =1
-        "add    x16, %[bias_data], #32\n"  // =32
-        "b.lt   " DC_KERNEL_NO_MULT_2 "b\n"
-        // %bb.17:        // in Loop: Header=BB225_4 Depth=1
-        "ldr    w23, [sp, #276]\n"  // 4-byte Folded Reload
-        "cmp    w23, #1\n"  // =1
-        "b.lt   " DC_KERNEL_NO_MULT_29 "f\n"
-        // %bb.18:        // in Loop: Header=BB225_4 Depth=1
-        "str    x16, [sp, #192]\n"  // 8-byte Folded Spill
-        "ldp    q21, q22, [%[bias_data]]\n"
-        "ldr    x17, [sp, #184]\n"  // 8-byte Folded Reload
-        "ldr    x12, [sp, #80]\n"  // 8-byte Folded Reload
-        "ldr    x23, [sp, #248]\n"  // 8-byte Folded Reload
-        "mov    w24, wzr\n"
-        "b      " DC_KERNEL_NO_MULT_20 "f\n"
-        DC_KERNEL_NO_MULT_19 ":\n"  // in Loop: Header=BB225_20 Depth=2
-        "ldr    w12, [sp, #76]\n"  // 4-byte Folded Reload
-        "add    w24, w24, #1\n"  // =1
-        "ldr    x21, [sp, #136]\n"  // 8-byte Folded Reload
-        "ldr    x17, [sp, #200]\n"  // 8-byte Folded Reload
-        "cmp    w24, w12\n"
-        "ldr    x12, [sp, #232]\n"  // 8-byte Folded Reload
-        "add    x12, x12, x21\n"
-        "b.eq   " DC_KERNEL_NO_MULT_28 "f\n"
-        DC_KERNEL_NO_MULT_20 ":\n"  // Parent Loop BB225_4 Depth=1
-        // =>  This Loop Header: Depth=2
-        // Child Loop BB225_23 Depth 3
-        // Child Loop BB225_27 Depth 4
-        "ldr    %[output_block_data], [sp, #264]\n"  // 8-byte Folded Reload
-        "ldp    q23, q24, [x17]\n"
-        "mov    x21, x12\n"
-        "mov    w12, wzr\n"
-        "add    x16, x17, %[output_block_data]\n"
-        "ldr    %[output_block_data], [sp, #256]\n"  // 8-byte Folded Reload
-        "ldp    q25, q26, [x16]\n"
-        "str    x16, [sp, #200]\n"  // 8-byte Folded Spill
-        "add    %[output_block_data], x17, x3\n"
-        "ldp    q27, q28, [%[output_block_data]]\n"
-        "str    x21, [sp, #232]\n"  // 8-byte Folded Spill
-        "b      " DC_KERNEL_NO_MULT_23 "f\n"
-        DC_KERNEL_NO_MULT_21 ":\n"  // in Loop: Header=BB225_23 Depth=3
-        "mov    %[filter_workspace], x26\n"
-        DC_KERNEL_NO_MULT_22 ":\n"  // in Loop: Header=BB225_23 Depth=3
-        "ldr    w17, [sp, #276]\n"  // 4-byte Folded Reload
-        "add    w12, w12, #1\n"  // =1
-        "cmp    w12, w17\n"
-        "mov    x17, x16\n"
-        "b.eq   " DC_KERNEL_NO_MULT_19 "b\n"
-        DC_KERNEL_NO_MULT_23 ":\n"  // Parent Loop BB225_4 Depth=1
-        // Parent Loop BB225_20 Depth=2
-        // =>  This Loop Header: Depth=3
-        // Child Loop BB225_27 Depth 4
-        "mov    x26, %[filter_workspace]\n"
-        "ldr    w1, [sp, #280]\n"  // 4-byte Folded Reload
-        "ldr    w3, [sp, #284]\n"  // 4-byte Folded Reload
-        "add    x16, x17, #32\n"  // =32
-        "cmp    w12, w1\n"
-        "mov    w1, #4\n"
-        "csel   w3, w3, w1, eq\n"
-        "cmp    w3, #3\n"  // =3
-        "b.ge   " DC_KERNEL_NO_MULT_25 "f\n"
-        // %bb.24:        // in Loop: Header=BB225_23 Depth=3
-        "movi   v29.16b, #0\n"
-        "cmp    w3, #1\n"  // =1
-        "movi   v30.16b, #0\n"
-        "movi   v31.16b, #0\n"
-        "movi   v9.16b, #0\n"
-        "movi   v10.16b, #0\n"
-        "movi   v8.16b, #0\n"
-        "b.ge   " DC_KERNEL_NO_MULT_26 "f\n"
-        "b      " DC_KERNEL_NO_MULT_21 "b\n"
-        DC_KERNEL_NO_MULT_25 ":\n"  // in Loop: Header=BB225_23 Depth=3
-        "ldr    x23, [sp, #264]\n"  // 8-byte Folded Reload
-        "mov    %[filter_workspace], x22\n"
-        "mov    x22, x15\n"
-        "mov    x15, x14\n"
-        "add    x23, x16, x23\n"
-        "mov    x14, x13\n"
-        "mov    x13, x20\n"
-        "mov    x20, x16\n"
-        "mov    x16, x25\n"
-        "ldr    x25, [sp, #256]\n"  // 8-byte Folded Reload
-        "ldp    q8, q31, [x17, #32]\n"
-        "ldp    q10, q30, [x23]\n"
-        "ldp    x6, x23, [sp, #240]\n"  // 16-byte Folded Reload
-        "add    x25, x20, x25\n"
-        "ldp    q9, q29, [x25]\n"
-        "mov    x25, x16\n"
-        "mov    x16, x20\n"
-        "mov    x20, x13\n"
-        "mov    x13, x14\n"
-        "mov    x14, x15\n"
-        "mov    x15, x22\n"
-        "mov    x22, %[filter_workspace]\n"
-        "mov    %[bias_data], x7\n"
-        DC_KERNEL_NO_MULT_26 ":\n"  // in Loop: Header=BB225_23 Depth=3
-        "mov    %[filter_workspace], x26\n"
-        DC_KERNEL_NO_MULT_27 ":\n"  // Parent Loop BB225_4 Depth=1
-        // Parent Loop BB225_20 Depth=2
-        // Parent Loop BB225_23 Depth=3
-        // =>  This Inner Loop Header: Depth=4
-        "mov    v3.16b, v21.16b\n"
-        "mov    v4.16b, v22.16b\n"
-        ".word 0x4e979643  // sdot   v3.4s, v18.16b, v23.16b\n"
-        ".word 0x4e9895e4  // sdot   v4.4s, v15.16b, v24.16b\n"
-        ".word 0x4e999663  // sdot   v3.4s, v19.16b, v25.16b\n"
-        ".word 0x4e9a94a4  // sdot   v4.4s, v5.16b, v26.16b\n"
-        ".word 0x4e9b9683  // sdot   v3.4s, v20.16b, v27.16b\n"
-        ".word 0x4e9c94c4  // sdot   v4.4s, v6.16b, v28.16b\n"
-        "sqrdmulh        v3.4s, v3.4s, v1.4s\n"
-        "sqrdmulh        v4.4s, v4.4s, v1.4s\n"
-        "sqrshl v3.4s, v3.4s, v2.4s\n"
-        "sqrshl v4.4s, v4.4s, v2.4s\n"
-        "sqxtn  v3.4h, v3.4s\n"
-        "sqxtn2 v3.8h, v4.4s\n"
-        "sqadd  v3.8h, v3.8h, v0.8h\n"
-        "sqxtun v3.8b, v3.8h\n"
-        "umax   v3.8b, v3.8b, v17.8b\n"
-        "ushr   v23.4s, v23.4s, #8\n"
-        "ushr   v24.4s, v24.4s, #8\n"
-        "ushr   v25.4s, v25.4s, #8\n"
-        "ushr   v26.4s, v26.4s, #8\n"
-        "ushr   v27.4s, v27.4s, #8\n"
-        "ushr   v28.4s, v28.4s, #8\n"
-        "umin   v3.8b, v3.8b, v14.8b\n"
-        "subs   w3, w3, #1\n"  // =1
-        "sli    v23.4s, v8.4s, #24\n"
-        "ushr   v8.4s, v8.4s, #8\n"
-        "sli    v24.4s, v31.4s, #24\n"
-        "ushr   v31.4s, v31.4s, #8\n"
-        "sli    v25.4s, v10.4s, #24\n"
-        "ushr   v10.4s, v10.4s, #8\n"
-        "sli    v26.4s, v30.4s, #24\n"
-        "ushr   v30.4s, v30.4s, #8\n"
-        "sli    v27.4s, v9.4s, #24\n"
-        "ushr   v9.4s, v9.4s, #8\n"
-        "sli    v28.4s, v29.4s, #24\n"
-        "ushr   v29.4s, v29.4s, #8\n"
-        "str    d3, [x21]\n"
-        "add    x21, x21, x5\n"
-        "b.ne   " DC_KERNEL_NO_MULT_27 "b\n"
-        "b      " DC_KERNEL_NO_MULT_22 "b\n"
-        DC_KERNEL_NO_MULT_28 ":\n"  // in Loop: Header=BB225_4 Depth=1
-        "ldr    %[bias_data], [sp, #192]\n"  // 8-byte Folded Reload
-        "ldr    x26, [sp, #16]\n"  // 8-byte Folded Reload
-        "b      " DC_KERNEL_NO_MULT_3 "b\n"
-        DC_KERNEL_NO_MULT_29 ":\n"  // in Loop: Header=BB225_4 Depth=1
-        "ldr    w12, [sp, #12]\n"  // 4-byte Folded Reload
-        "cmp    w17, #2\n"  // =2
-        "b.hs   " DC_KERNEL_NO_MULT_31 "f\n"
-        // %bb.30:        // in Loop: Header=BB225_4 Depth=1
-        "ldr    x23, [sp, #248]\n"  // 8-byte Folded Reload
-        "mov    w12, wzr\n"
-        "b      " DC_KERNEL_NO_MULT_33 "f\n"
-        DC_KERNEL_NO_MULT_31 ":\n"  // Parent Loop BB225_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "subs   w12, w12, #2\n"  // =2
-        "b.ne   " DC_KERNEL_NO_MULT_31 "b\n"
-        // %bb.32:        // in Loop: Header=BB225_4 Depth=1
-        "ldr    w12, [sp, #12]\n"  // 4-byte Folded Reload
-        "ldr    x23, [sp, #248]\n"  // 8-byte Folded Reload
-        "cmp    w17, w12\n"
-        "b.eq   " DC_KERNEL_NO_MULT_2 "b\n"
-        DC_KERNEL_NO_MULT_33 ":\n"  // in Loop: Header=BB225_4 Depth=1
-        "sub    w12, w17, w12\n"
-        DC_KERNEL_NO_MULT_34 ":\n"  // Parent Loop BB225_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "subs   w12, w12, #1\n"  // =1
-        "b.ne   " DC_KERNEL_NO_MULT_34 "b\n"
-        "b      " DC_KERNEL_NO_MULT_2 "b\n"
-        DC_KERNEL_NO_MULT_35 ":\n"
-        // Compiled intrinsics total stack 464, now 320 for spillage only.
-        "add    sp, sp, #320\n"  // =464
-        :
-        // Outputs.
-        [ scratch_block_data ] "+r"(scratch_block_data),
-        [ filter_workspace ] "+r"(filter_workspace),
-        [ bias_data ] "+r"(bias_data),
-        [ output_block_data ] "+r"(output_block_data)
-        :
-        // Inputs.
-        [ function_params ] "r"(function_params)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20",
-        "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
-        "v31",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
-        "x16", "x17", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26",
-        "x27", "x28");
-#undef DC_KERNEL_NO_MULT_1
-#undef DC_KERNEL_NO_MULT_2
-#undef DC_KERNEL_NO_MULT_3
-#undef DC_KERNEL_NO_MULT_4
-#undef DC_KERNEL_NO_MULT_5
-#undef DC_KERNEL_NO_MULT_6
-#undef DC_KERNEL_NO_MULT_7
-#undef DC_KERNEL_NO_MULT_8
-#undef DC_KERNEL_NO_MULT_9
-#undef DC_KERNEL_NO_MULT_10
-#undef DC_KERNEL_NO_MULT_11
-#undef DC_KERNEL_NO_MULT_12
-#undef DC_KERNEL_NO_MULT_13
-#undef DC_KERNEL_NO_MULT_14
-#undef DC_KERNEL_NO_MULT_15
-#undef DC_KERNEL_NO_MULT_16
-#undef DC_KERNEL_NO_MULT_17
-#undef DC_KERNEL_NO_MULT_18
-#undef DC_KERNEL_NO_MULT_19
-#undef DC_KERNEL_NO_MULT_20
-#undef DC_KERNEL_NO_MULT_21
-#undef DC_KERNEL_NO_MULT_22
-#undef DC_KERNEL_NO_MULT_23
-#undef DC_KERNEL_NO_MULT_24
-#undef DC_KERNEL_NO_MULT_25
-#undef DC_KERNEL_NO_MULT_26
-#undef DC_KERNEL_NO_MULT_27
-#undef DC_KERNEL_NO_MULT_28
-#undef DC_KERNEL_NO_MULT_29
-#undef DC_KERNEL_NO_MULT_30
-#undef DC_KERNEL_NO_MULT_31
-#undef DC_KERNEL_NO_MULT_32
-#undef DC_KERNEL_NO_MULT_33
-#undef DC_KERNEL_NO_MULT_34
-#undef DC_KERNEL_NO_MULT_35
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static void __attribute__((noinline))
-  Run(const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockNeon(scratch_block_data, filter_workspace, bias_data,
-                         output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock {
-  static inline void KernelMacroBlockNeon(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Note that argument registers may be reused after parameter loading.
-    // x0 %[scratch_block_data]
-    // x1 %[filter_workspace]
-    // x2 %[bias_data]
-    // x3 %[output_block_data]
-    // x4 %[function_params]
-#define DC_KERNEL_NO_MULT_STRIDE_1 "1"
-#define DC_KERNEL_NO_MULT_STRIDE_2 "2"
-#define DC_KERNEL_NO_MULT_STRIDE_3 "3"
-#define DC_KERNEL_NO_MULT_STRIDE_4 "4"
-#define DC_KERNEL_NO_MULT_STRIDE_5 "5"
-#define DC_KERNEL_NO_MULT_STRIDE_6 "6"
-#define DC_KERNEL_NO_MULT_STRIDE_7 "7"
-#define DC_KERNEL_NO_MULT_STRIDE_8 "8"
-#define DC_KERNEL_NO_MULT_STRIDE_9 "9"
-#define DC_KERNEL_NO_MULT_STRIDE_10 "10"
-#define DC_KERNEL_NO_MULT_STRIDE_11 "11"
-#define DC_KERNEL_NO_MULT_STRIDE_12 "12"
-#define DC_KERNEL_NO_MULT_STRIDE_13 "13"
-#define DC_KERNEL_NO_MULT_STRIDE_14 "14"
-#define DC_KERNEL_NO_MULT_STRIDE_15 "15"
-#define DC_KERNEL_NO_MULT_STRIDE_16 "16"
-#define DC_KERNEL_NO_MULT_STRIDE_17 "17"
-#define DC_KERNEL_NO_MULT_STRIDE_18 "18"
-#define DC_KERNEL_NO_MULT_STRIDE_19 "19"
-#define DC_KERNEL_NO_MULT_STRIDE_20 "20"
-#define DC_KERNEL_NO_MULT_STRIDE_21 "21"
-#define DC_KERNEL_NO_MULT_STRIDE_22 "22"
-#define DC_KERNEL_NO_MULT_STRIDE_23 "23"
-#define DC_KERNEL_NO_MULT_STRIDE_24 "24"
-#define DC_KERNEL_NO_MULT_STRIDE_25 "25"
-#define DC_KERNEL_NO_MULT_STRIDE_26 "26"
-#define DC_KERNEL_NO_MULT_STRIDE_27 "27"
-#define DC_KERNEL_NO_MULT_STRIDE_28 "28"
-#define DC_KERNEL_NO_MULT_STRIDE_29 "29"
-#define DC_KERNEL_NO_MULT_STRIDE_30 "30"
-#define DC_KERNEL_NO_MULT_STRIDE_31 "31"
-#define DC_KERNEL_NO_MULT_STRIDE_32 "32"
-#define DC_KERNEL_NO_MULT_STRIDE_33 "33"
-#define DC_KERNEL_NO_MULT_STRIDE_34 "34"
-#define DC_KERNEL_NO_MULT_STRIDE_35 "35"
-
-    asm volatile(
-        // Compiled code used block of 160 for spill out of total stack of 304.
-        "sub    sp, sp, #160\n"  // =304
-        "stp    %[output_block_data], %[filter_workspace], [sp, #144]\n"  // 16-byte Folded Spill
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_DEPTH_MICRO_REPEATS) "]\n"
-        "cmp    w8, #1\n"  // =1
-        "b.lt   " DC_KERNEL_NO_MULT_STRIDE_35 "f\n"
-        // %bb.1:
-        "ldr    x14, [%[function_params]]\n"
-        "ldpsw  x11, x12, [%[function_params], #" STR(DP_OFFSET_OUTPUT_HEIGHT_STRIDE) "]\n"
-        "ldp    w13, w3, [%[function_params], #" STR(DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "add    x15, %[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MIN) "\n"  // =40
-        "add    x17, %[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MAX) "\n"  // =44
-        "add    x5, %[function_params], #" STR(DP_OFFSET_OUTPUT_OFFSET) "\n"  // =28
-        "add    x6, %[function_params], #" STR(DP_OFFSET_OUTPUT_SHIFT) "\n"  // =36
-        "add    x7, %[function_params], #" STR(DP_OFFSET_OUTPUT_MULTIPLIER) "\n"  // =32
-        "ldrsw  x19, [%[function_params], #" STR(DP_OFFSET_INPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "ldr    w1, [%[function_params], #" STR(DP_OFFSET_OUTBOUND_BLOCK_HEIGHT) "]\n"
-        "ldp    w16, w4, [%[function_params], #" STR(DP_OFFSET_OUTPUT_RESIDUAL_WIDTH) "]\n"
-        "ld1r   { v1.8b }, [x15]\n"
-        "lsl    w15, w14, #1\n"
-        "sxtw   x20, w15\n"
-        "cmp    w16, #1\n"  // =1
-        "ldr    x15, [sp, #144]\n"  // 8-byte Folded Reload
-        "ccmp   w3, w13, #0, eq\n"
-        "ld1r   { v0.8h }, [x5]\n"
-        "ld1r   { v2.8b }, [x17]\n"
-        "ld1r   { v3.4s }, [x7]\n"
-        "ld1r   { v4.4s }, [x6]\n"
-        "csel   w23, w3, w13, lt\n"
-        "sxtw   x6, w14\n"
-        "bic    w14, w23, w23, asr #31\n"
-        "lsl    x5, x12, #1\n"
-        "madd   x15, x20, x14, x15\n"
-        "sub    x14, x13, x14\n"
-        "mov    x9, xzr\n"
-        "mov    x10, xzr\n"
-        "str    w4, [sp, #84]\n"  // 4-byte Folded Spill
-        "lsl    %[function_params], x19, #5\n"
-        "lsl    x7, x12, #2\n"
-        "add    x19, x5, x12\n"
-        "str    x14, [sp, #136]\n"  // 8-byte Folded Spill
-        "add    x14, x15, #4\n"  // =4
-        "str    %[output_block_data], [sp, #72]\n"  // 8-byte Folded Spill
-        "str    x15, [sp, #88]\n"  // 8-byte Folded Spill
-        "str    x14, [sp, #8]\n"  // 8-byte Folded Spill
-        // implicit-def: $q16
-        // implicit-def: $q7
-        // implicit-def: $q22
-        // implicit-def: $q18
-        // implicit-def: $q17
-        // implicit-def: $q6
-        // implicit-def: $q11
-        // implicit-def: $q13
-        // implicit-def: $q14
-        // implicit-def: $q15
-        // implicit-def: $q20
-        "b      " DC_KERNEL_NO_MULT_STRIDE_4 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_2 ":\n"  // in Loop: Header=BB227_4 Depth=1
-        "add    x25, %[bias_data], #32\n"  // =32
-        "mov    v22.16b, v12.16b\n"
-        DC_KERNEL_NO_MULT_STRIDE_3 ":\n"  // in Loop: Header=BB227_4 Depth=1
-        "add    x10, x10, #1\n"  // =1
-        "cmp    x10, x8\n"
-        "add    x9, x9, #8\n"  // =8
-        "mov    %[bias_data], x25\n"
-        "b.eq   " DC_KERNEL_NO_MULT_STRIDE_35 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_4 ":\n"  // =>This Loop Header: Depth=1
-        // Child Loop BB227_30 Depth 2
-        // Child Loop BB227_22 Depth 2
-        // Child Loop BB227_7 Depth 2
-        // Child Loop BB227_10 Depth 2
-        // Child Loop BB227_13 Depth 2
-        // Child Loop BB227_26 Depth 2
-        "ldr    x15, [sp, #152]\n"  // 8-byte Folded Reload
-        "add    w14, w10, w10, lsl #1\n"
-        "lsl    w14, w14, #5\n"
-        "cmp    w1, #2\n"  // =2
-        "add    x27, x15, x14\n"
-        "madd   x26, x10, %[function_params], %[scratch_block_data]\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_15 "f\n"
-        // %bb.5:        // in Loop: Header=BB227_4 Depth=1
-        "ubfx   x14, x9, #3, #29\n"
-        "lsl    x25, x14, #3\n"
-        "ldr    x14, [sp, #88]\n"  // 8-byte Folded Reload
-        "ldr    q24, [x27]\n"
-        "ldr    q25, [x27, #32]\n"
-        "ldr    q26, [x27, #64]\n"
-        "add    x24, x14, x25\n"
-        "ldr    x14, [sp, #144]\n"  // 8-byte Folded Reload
-        "ldr    q27, [%[bias_data]]\n"
-        "ldr    q31, [x26]\n"
-        "ldr    q8, [x26, x12]\n"
-        "ldr    q30, [x26, x5]\n"
-        "ldr    q29, [x26, x19]\n"
-        "ldr    q28, [x26, x7]\n"
-        "lsl    w15, w10, #3\n"
-        "cmp    w23, #1\n"  // =1
-        "add    x28, x14, x15\n"
-        "mov    v12.16b, v22.16b\n"
-        "mov    w14, wzr\n"
-        "b.lt   " DC_KERNEL_NO_MULT_STRIDE_9 "f\n"
-        // %bb.6:        // in Loop: Header=BB227_4 Depth=1
-        "mov    x17, xzr\n"
-        "add    x22, x26, #32\n"  // =32
-        "mov    x21, x23\n"
-        "mov    v19.16b, v30.16b\n"
-        DC_KERNEL_NO_MULT_STRIDE_7 ":\n"  // Parent Loop BB227_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v20.16b, v27.16b\n"
-        "mov    v21.16b, v27.16b\n"
-        ".word 0x4e9f9714  // sdot   v20.4s, v24.16b, v31.16b\n"
-        ".word 0x4e939715  // sdot   v21.4s, v24.16b, v19.16b\n"
-        ".word 0x4e889734  // sdot   v20.4s, v25.16b, v8.16b\n"
-        ".word 0x4e9d9735  // sdot   v21.4s, v25.16b, v29.16b\n"
-        ".word 0x4e939754  // sdot   v20.4s, v26.16b, v19.16b\n"
-        ".word 0x4e9c9755  // sdot   v21.4s, v26.16b, v28.16b\n"
-        "sqrdmulh        v20.4s, v20.4s, v3.4s\n"
-        "and    %[output_block_data], x17, #0xffffffe0\n"
-        "sqrdmulh        v21.4s, v21.4s, v3.4s\n"
-        "sqrshl v20.4s, v20.4s, v4.4s\n"
-        "add    %[output_block_data], x22, x3\n"
-        "sqrshl v21.4s, v21.4s, v4.4s\n"
-        "sqxtn  v20.4h, v20.4s\n"
-        "rev32  v22.8h, v31.8h\n"
-        "rev32  v23.8h, v8.8h\n"
-        "rev32  v9.8h, v30.8h\n"
-        "rev32  v10.8h, v29.8h\n"
-        "ldr    q31, [%[output_block_data]]\n"
-        "ldr    q8, [%[output_block_data], x12]\n"
-        "ldr    q30, [%[output_block_data], x5]\n"
-        "ldr    q29, [%[output_block_data], x19]\n"
-        "rev32  v19.8h, v28.8h\n"
-        "ldr    q28, [%[output_block_data], x7]\n"
-        "sqxtn2 v20.8h, v21.4s\n"
-        "sqadd  v20.8h, v20.8h, v0.8h\n"
-        "sqxtun v20.8b, v20.8h\n"
-        "add    x15, x28, w14, sxtw\n"
-        "umax   v20.8b, v20.8b, v1.8b\n"
-        "add    %[output_block_data], x15, x11\n"
-        "umin   v20.8b, v20.8b, v2.8b\n"
-        "mov    v11.16b, v27.16b\n"
-        "str    s20, [x15]\n"
-        "st1    { v20.s }[1], [%[output_block_data]]\n"
-        "trn1   v20.8h, v22.8h, v31.8h\n"
-        "mov    v21.16b, v27.16b\n"
-        "trn1   v22.8h, v23.8h, v8.8h\n"
-        "trn1   v23.8h, v9.8h, v30.8h\n"
-        ".word 0x4e94970b  // sdot   v11.4s, v24.16b, v20.16b\n"
-        "trn1   v9.8h, v10.8h, v29.8h\n"
-        ".word 0x4e979715  // sdot   v21.4s, v24.16b, v23.16b\n"
-        ".word 0x4e96972b  // sdot   v11.4s, v25.16b, v22.16b\n"
-        "trn1   v19.8h, v19.8h, v28.8h\n"
-        ".word 0x4e899735  // sdot   v21.4s, v25.16b, v9.16b\n"
-        ".word 0x4e97974b  // sdot   v11.4s, v26.16b, v23.16b\n"
-        ".word 0x4e939755  // sdot   v21.4s, v26.16b, v19.16b\n"
-        "sqrdmulh        v19.4s, v11.4s, v3.4s\n"
-        "sqrdmulh        v20.4s, v21.4s, v3.4s\n"
-        "sqrshl v19.4s, v19.4s, v4.4s\n"
-        "sqrshl v20.4s, v20.4s, v4.4s\n"
-        "sqxtn  v19.4h, v19.4s\n"
-        "sqxtn2 v19.8h, v20.4s\n"
-        "sqadd  v19.8h, v19.8h, v0.8h\n"
-        "sqxtun v19.8b, v19.8h\n"
-        "add    x15, x15, x6\n"
-        "umax   v19.8b, v19.8b, v1.8b\n"
-        "add    %[output_block_data], x15, x11\n"
-        "umin   v19.8b, v19.8b, v2.8b\n"
-        "add    x17, x17, #32\n"  // =32
-        "subs   x21, x21, #1\n"  // =1
-        "str    s19, [x15]\n"
-        "st1    { v19.s }[1], [%[output_block_data]]\n"
-        "add    w14, w14, w20\n"
-        "mov    v19.16b, v30.16b\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_7 "b\n"
-        // %bb.8:        // in Loop: Header=BB227_4 Depth=1
-        "mov    v20.16b, v31.16b\n"
-        "mov    v15.16b, v8.16b\n"
-        "mov    v14.16b, v30.16b\n"
-        "mov    v13.16b, v29.16b\n"
-        "mov    v11.16b, v28.16b\n"
-        "mov    w14, w23\n"
-        DC_KERNEL_NO_MULT_STRIDE_9 ":\n"  // in Loop: Header=BB227_4 Depth=1
-        "cmp    w14, w13\n"
-        "ldr    x14, [sp, #136]\n"  // 8-byte Folded Reload
-        "b.ge   " DC_KERNEL_NO_MULT_STRIDE_11 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_10 ":\n"  // Parent Loop BB227_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v9.16b, v27.16b\n"
-        "mov    v10.16b, v27.16b\n"
-        ".word 0x4e9f9709  // sdot   v9.4s, v24.16b, v31.16b\n"
-        ".word 0x4e889729  // sdot   v9.4s, v25.16b, v8.16b\n"
-        ".word 0x4e9e970a  // sdot   v10.4s, v24.16b, v30.16b\n"
-        ".word 0x4e9e9749  // sdot   v9.4s, v26.16b, v30.16b\n"
-        ".word 0x4e9d972a  // sdot   v10.4s, v25.16b, v29.16b\n"
-        ".word 0x4e9c974a  // sdot   v10.4s, v26.16b, v28.16b\n"
-        "sqrdmulh        v9.4s, v9.4s, v3.4s\n"
-        "sqrdmulh        v10.4s, v10.4s, v3.4s\n"
-        "sqrshl v9.4s, v9.4s, v4.4s\n"
-        "sqrshl v10.4s, v10.4s, v4.4s\n"
-        "sqxtn  v9.4h, v9.4s\n"
-        "sqxtn2 v9.8h, v10.4s\n"
-        "sqadd  v9.8h, v9.8h, v0.8h\n"
-        "sqxtun v9.8b, v9.8h\n"
-        "umax   v9.8b, v9.8b, v1.8b\n"
-        "rev32  v31.8h, v31.8h\n"
-        "rev32  v8.8h, v8.8h\n"
-        "rev32  v30.8h, v30.8h\n"
-        "rev32  v29.8h, v29.8h\n"
-        "rev32  v28.8h, v28.8h\n"
-        "umin   v9.8b, v9.8b, v2.8b\n"
-        "add    x15, x24, x11\n"
-        "subs   x14, x14, #1\n"  // =1
-        "trn1   v31.8h, v31.8h, v20.8h\n"
-        "trn1   v8.8h, v8.8h, v15.8h\n"
-        "trn1   v29.8h, v29.8h, v13.8h\n"
-        "trn1   v30.8h, v30.8h, v14.8h\n"
-        "trn1   v28.8h, v28.8h, v11.8h\n"
-        "str    s9, [x24]\n"
-        "add    x24, x24, x20\n"
-        "st1    { v9.s }[1], [x15]\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_10 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_11 ":\n"  // in Loop: Header=BB227_4 Depth=1
-        "ldr    q24, [x27, #16]\n"
-        "ldr    q25, [x27, #48]\n"
-        "ldr    q26, [x27, #80]\n"
-        "ldr    q30, [x26, #16]!\n"
-        "ldr    q27, [%[bias_data], #16]\n"
-        "cmp    w23, #0\n"  // =0
-        "ldr    q8, [x26, x12]\n"
-        "ldr    q31, [x26, x5]\n"
-        "ldr    q29, [x26, x19]\n"
-        "ldr    q28, [x26, x7]\n"
-        "b.le   " DC_KERNEL_NO_MULT_STRIDE_24 "f\n"
-        // %bb.12:        // in Loop: Header=BB227_4 Depth=1
-        "mov    w14, wzr\n"
-        "mov    x17, xzr\n"
-        "add    x22, x26, #32\n"  // =32
-        "add    x24, x28, #4\n"  // =4
-        "mov    x21, x23\n"
-        "mov    v19.16b, v31.16b\n"
-        DC_KERNEL_NO_MULT_STRIDE_13 ":\n"  // Parent Loop BB227_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v5.16b, v27.16b\n"
-        "mov    v20.16b, v27.16b\n"
-        ".word 0x4e9e9705  // sdot   v5.4s, v24.16b, v30.16b\n"
-        ".word 0x4e939714  // sdot   v20.4s, v24.16b, v19.16b\n"
-        ".word 0x4e889725  // sdot   v5.4s, v25.16b, v8.16b\n"
-        ".word 0x4e9d9734  // sdot   v20.4s, v25.16b, v29.16b\n"
-        ".word 0x4e939745  // sdot   v5.4s, v26.16b, v19.16b\n"
-        ".word 0x4e9c9754  // sdot   v20.4s, v26.16b, v28.16b\n"
-        "sqrdmulh        v5.4s, v5.4s, v3.4s\n"
-        "and    %[output_block_data], x17, #0xffffffe0\n"
-        "sqrdmulh        v20.4s, v20.4s, v3.4s\n"
-        "sqrshl v5.4s, v5.4s, v4.4s\n"
-        "add    %[output_block_data], x22, x3\n"
-        "sqrshl v20.4s, v20.4s, v4.4s\n"
-        "sqxtn  v5.4h, v5.4s\n"
-        "rev32  v21.8h, v30.8h\n"
-        "rev32  v22.8h, v8.8h\n"
-        "rev32  v23.8h, v31.8h\n"
-        "rev32  v9.8h, v29.8h\n"
-        "ldr    q30, [%[output_block_data]]\n"
-        "ldr    q8, [%[output_block_data], x12]\n"
-        "ldr    q31, [%[output_block_data], x5]\n"
-        "ldr    q29, [%[output_block_data], x19]\n"
-        "rev32  v19.8h, v28.8h\n"
-        "ldr    q28, [%[output_block_data], x7]\n"
-        "sqxtn2 v5.8h, v20.4s\n"
-        "sqadd  v5.8h, v5.8h, v0.8h\n"
-        "sqxtun v5.8b, v5.8h\n"
-        "add    x15, x24, w14, sxtw\n"
-        "umax   v5.8b, v5.8b, v1.8b\n"
-        "add    %[output_block_data], x15, x11\n"
-        "umin   v5.8b, v5.8b, v2.8b\n"
-        "mov    v10.16b, v27.16b\n"
-        "str    s5, [x15]\n"
-        "st1    { v5.s }[1], [%[output_block_data]]\n"
-        "trn1   v5.8h, v21.8h, v30.8h\n"
-        "mov    v20.16b, v27.16b\n"
-        "trn1   v21.8h, v22.8h, v8.8h\n"
-        "trn1   v22.8h, v23.8h, v31.8h\n"
-        ".word 0x4e85970a  // sdot   v10.4s, v24.16b, v5.16b\n"
-        "trn1   v23.8h, v9.8h, v29.8h\n"
-        ".word 0x4e969714  // sdot   v20.4s, v24.16b, v22.16b\n"
-        ".word 0x4e95972a  // sdot   v10.4s, v25.16b, v21.16b\n"
-        "trn1   v19.8h, v19.8h, v28.8h\n"
-        ".word 0x4e979734  // sdot   v20.4s, v25.16b, v23.16b\n"
-        ".word 0x4e96974a  // sdot   v10.4s, v26.16b, v22.16b\n"
-        ".word 0x4e939754  // sdot   v20.4s, v26.16b, v19.16b\n"
-        "sqrdmulh        v5.4s, v10.4s, v3.4s\n"
-        "sqrdmulh        v19.4s, v20.4s, v3.4s\n"
-        "sqrshl v5.4s, v5.4s, v4.4s\n"
-        "sqrshl v19.4s, v19.4s, v4.4s\n"
-        "sqxtn  v5.4h, v5.4s\n"
-        "sqxtn2 v5.8h, v19.4s\n"
-        "sqadd  v5.8h, v5.8h, v0.8h\n"
-        "sqxtun v5.8b, v5.8h\n"
-        "add    x15, x15, x6\n"
-        "umax   v5.8b, v5.8b, v1.8b\n"
-        "add    x17, x17, #32\n"  // =32
-        "subs   x21, x21, #1\n"  // =1
-        "add    %[output_block_data], x15, x11\n"
-        "umin   v5.8b, v5.8b, v2.8b\n"
-        "add    w14, w14, w20\n"
-        "mov    v19.16b, v31.16b\n"
-        "str    s5, [x15]\n"
-        "st1    { v5.s }[1], [%[output_block_data]]\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_13 "b\n"
-        // %bb.14:        // in Loop: Header=BB227_4 Depth=1
-        "mov    v20.16b, v30.16b\n"
-        "mov    v15.16b, v8.16b\n"
-        "mov    v14.16b, v31.16b\n"
-        "mov    v13.16b, v29.16b\n"
-        "mov    v11.16b, v28.16b\n"
-        "mov    w14, w23\n"
-        "cmp    w14, w13\n"
-        "b.ge   " DC_KERNEL_NO_MULT_STRIDE_2 "b\n"
-        "b      " DC_KERNEL_NO_MULT_STRIDE_25 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_15 ":\n"  // in Loop: Header=BB227_4 Depth=1
-        "cmp    w13, #1\n"  // =1
-        "add    x25, %[bias_data], #32\n"  // =32
-        "b.lt   " DC_KERNEL_NO_MULT_STRIDE_3 "b\n"
-        // %bb.16:        // in Loop: Header=BB227_4 Depth=1
-        "stp    q13, q11, [sp, #96]\n"  // 32-byte Folded Spill
-        "add    x15, x26, x12\n"
-        "ldp    q9, q10, [x15]\n"
-        "ldr    x15, [sp, #144]\n"  // 8-byte Folded Reload
-        "lsl    w14, w10, #3\n"
-        "ldp    q30, q31, [%[bias_data]]\n"
-        "add    x17, x26, x5\n"
-        "add    %[bias_data], x15, x14\n"
-        "ldr    w14, [sp, #84]\n"  // 4-byte Folded Reload
-        "ldp    q24, q25, [x27]\n"
-        "ldp    q26, q27, [x27, #32]\n"
-        "ldp    q28, q29, [x27, #64]\n"
-        "ldp    q12, q11, [x26], #32\n"
-        "ldp    q8, q13, [x17]\n"
-        "cmp    w13, w14\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_27 "f\n"
-        // %bb.17:        // in Loop: Header=BB227_4 Depth=1
-        "ldr    x14, [sp, #72]\n"  // 8-byte Folded Reload
-        "mov    x24, xzr\n"
-        "mov    w27, wzr\n"
-        "mov    x28, x13\n"
-        "mov    v19.16b, v15.16b\n"
-        "mov    v5.16b, v14.16b\n"
-        "cbnz   x14,    " DC_KERNEL_NO_MULT_STRIDE_21 "f\n"
-        "b      " DC_KERNEL_NO_MULT_STRIDE_22 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_18 ":\n"  // in Loop: Header=BB227_22 Depth=2
-        "mov    v14.16b, v30.16b\n"
-        ".word 0x4e8c970e  // sdot   v14.4s, v24.16b, v12.16b\n"
-        "mov    v12.16b, v31.16b\n"
-        ".word 0x4e8b972c  // sdot   v12.4s, v25.16b, v11.16b\n"
-        ".word 0x4e89974e  // sdot   v14.4s, v26.16b, v9.16b\n"
-        ".word 0x4e8a976c  // sdot   v12.4s, v27.16b, v10.16b\n"
-        ".word 0x4e88978e  // sdot   v14.4s, v28.16b, v8.16b\n"
-        ".word 0x4e8d97ac  // sdot   v12.4s, v29.16b, v13.16b\n"
-        "sqrdmulh        v8.4s, v14.4s, v3.4s\n"
-        "sqrdmulh        v9.4s, v12.4s, v3.4s\n"
-        "sqrshl v8.4s, v8.4s, v4.4s\n"
-        "sqrshl v9.4s, v9.4s, v4.4s\n"
-        "sqxtn  v8.4h, v8.4s\n"
-        "sqxtn2 v8.8h, v9.4s\n"
-        "sqadd  v8.8h, v8.8h, v0.8h\n"
-        "sqxtun v8.8b, v8.8h\n"
-        "umax   v8.8b, v8.8b, v1.8b\n"
-        "umin   v8.8b, v8.8b, v2.8b\n"
-        "str    d8, [x15, x6]\n"
-        "mov    v12.16b, v6.16b\n"
-        "mov    v9.16b, v17.16b\n"
-        "mov    v8.16b, v18.16b\n"
-        "mov    v11.16b, v22.16b\n"
-        "mov    v10.16b, v7.16b\n"
-        "mov    v13.16b, v16.16b\n"
-        DC_KERNEL_NO_MULT_STRIDE_19 ":\n"  // in Loop: Header=BB227_22 Depth=2
-        "mov    v14.16b, v5.16b\n"
-        "mov    v15.16b, v19.16b\n"
-        "add    w27, w27, w20\n"
-        "add    x24, x24, #32\n"  // =32
-        "subs   x28, x28, #1\n"  // =1
-        "sub    x14, x14, #1\n"  // =1
-        "b.eq   " DC_KERNEL_NO_MULT_STRIDE_33 "f\n"
-        // %bb.20:        // in Loop: Header=BB227_22 Depth=2
-        "mov    v19.16b, v15.16b\n"
-        "mov    v5.16b, v14.16b\n"
-        "cbz    x14,    " DC_KERNEL_NO_MULT_STRIDE_22 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_21 ":\n"  // in Loop: Header=BB227_4 Depth=1
-        "and    x15, x24, #0xffffffe0\n"
-        "add    x15, x26, x15\n"
-        "add    x17, x15, x12\n"
-        "add    %[output_block_data], x15, x5\n"
-        "ldp    q6, q22, [x15]\n"
-        "ldp    q17, q7, [x17]\n"
-        "ldp    q18, q16, [%[output_block_data]]\n"
-        DC_KERNEL_NO_MULT_STRIDE_22 ":\n"  // Parent Loop BB227_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v14.16b, v30.16b\n"
-        "mov    v15.16b, v31.16b\n"
-        ".word 0x4e8c970e  // sdot   v14.4s, v24.16b, v12.16b\n"
-        ".word 0x4e89974e  // sdot   v14.4s, v26.16b, v9.16b\n"
-        ".word 0x4e8b972f  // sdot   v15.4s, v25.16b, v11.16b\n"
-        ".word 0x4e88978e  // sdot   v14.4s, v28.16b, v8.16b\n"
-        ".word 0x4e8a976f  // sdot   v15.4s, v27.16b, v10.16b\n"
-        ".word 0x4e8d97af  // sdot   v15.4s, v29.16b, v13.16b\n"
-        "sqrdmulh        v14.4s, v14.4s, v3.4s\n"
-        "sqrdmulh        v15.4s, v15.4s, v3.4s\n"
-        "sqrshl v14.4s, v14.4s, v4.4s\n"
-        "sqrshl v15.4s, v15.4s, v4.4s\n"
-        "sqxtn  v14.4h, v14.4s\n"
-        "sqxtn2 v14.8h, v15.4s\n"
-        "sqadd  v14.8h, v14.8h, v0.8h\n"
-        "sqxtun v14.8b, v14.8h\n"
-        "rev32  v12.8h, v12.8h\n"
-        "rev32  v9.8h, v9.8h\n"
-        "rev32  v8.8h, v8.8h\n"
-        "rev32  v11.8h, v11.8h\n"
-        "rev32  v10.8h, v10.8h\n"
-        "rev32  v13.8h, v13.8h\n"
-        "umax   v14.8b, v14.8b, v1.8b\n"
-        "add    x15, %[bias_data], w27, sxtw\n"
-        "cmp    w16, #1\n"  // =1
-        "trn1   v12.8h, v12.8h, v6.8h\n"
-        "trn1   v11.8h, v11.8h, v22.8h\n"
-        "trn1   v9.8h, v9.8h, v17.8h\n"
-        "trn1   v10.8h, v10.8h, v7.8h\n"
-        "trn1   v8.8h, v8.8h, v18.8h\n"
-        "umin   v14.8b, v14.8b, v2.8b\n"
-        "trn1   v13.8h, v13.8h, v16.8h\n"
-        "str    d14, [x15]\n"
-        "b.gt   " DC_KERNEL_NO_MULT_STRIDE_18 "b\n"
-        // %bb.23:        // in Loop: Header=BB227_22 Depth=2
-        "cbz    x14,    " DC_KERNEL_NO_MULT_STRIDE_19 "b\n"
-        "b      " DC_KERNEL_NO_MULT_STRIDE_18 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_24 ":\n"  // in Loop: Header=BB227_4 Depth=1
-        "mov    w14, wzr\n"
-        "cmp    w14, w13\n"
-        "b.ge   " DC_KERNEL_NO_MULT_STRIDE_2 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_25 ":\n"  // in Loop: Header=BB227_4 Depth=1
-        "ldr    x14, [sp, #8]\n"  // 8-byte Folded Reload
-        "ldr    x15, [sp, #136]\n"  // 8-byte Folded Reload
-        "add    x14, x14, x25\n"
-        DC_KERNEL_NO_MULT_STRIDE_26 ":\n"  // Parent Loop BB227_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v5.16b, v27.16b\n"
-        "mov    v19.16b, v27.16b\n"
-        ".word 0x4e9e9705  // sdot   v5.4s, v24.16b, v30.16b\n"
-        ".word 0x4e889725  // sdot   v5.4s, v25.16b, v8.16b\n"
-        ".word 0x4e9f9713  // sdot   v19.4s, v24.16b, v31.16b\n"
-        ".word 0x4e9f9745  // sdot   v5.4s, v26.16b, v31.16b\n"
-        ".word 0x4e9d9733  // sdot   v19.4s, v25.16b, v29.16b\n"
-        ".word 0x4e9c9753  // sdot   v19.4s, v26.16b, v28.16b\n"
-        "sqrdmulh        v5.4s, v5.4s, v3.4s\n"
-        "sqrdmulh        v19.4s, v19.4s, v3.4s\n"
-        "sqrshl v5.4s, v5.4s, v4.4s\n"
-        "sqrshl v19.4s, v19.4s, v4.4s\n"
-        "sqxtn  v5.4h, v5.4s\n"
-        "sqxtn2 v5.8h, v19.4s\n"
-        "sqadd  v5.8h, v5.8h, v0.8h\n"
-        "sqxtun v5.8b, v5.8h\n"
-        "umax   v5.8b, v5.8b, v1.8b\n"
-        "mov    v9.16b, v20.16b\n"
-        "rev32  v20.8h, v30.8h\n"
-        "rev32  v21.8h, v8.8h\n"
-        "rev32  v22.8h, v31.8h\n"
-        "rev32  v23.8h, v29.8h\n"
-        "rev32  v28.8h, v28.8h\n"
-        "umin   v5.8b, v5.8b, v2.8b\n"
-        "add    x17, x14, x11\n"
-        "subs   x15, x15, #1\n"  // =1
-        "trn1   v30.8h, v20.8h, v9.8h\n"
-        "mov    v20.16b, v9.16b\n"
-        "trn1   v8.8h, v21.8h, v15.8h\n"
-        "trn1   v29.8h, v23.8h, v13.8h\n"
-        "trn1   v31.8h, v22.8h, v14.8h\n"
-        "trn1   v28.8h, v28.8h, v11.8h\n"
-        "str    s5, [x14]\n"
-        "add    x14, x14, x20\n"
-        "st1    { v5.s }[1], [x17]\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_26 "b\n"
-        "b      " DC_KERNEL_NO_MULT_STRIDE_2 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_27 ":\n"  // in Loop: Header=BB227_4 Depth=1
-        "ldr    x28, [sp, #72]\n"  // 8-byte Folded Reload
-        "mov    w14, wzr\n"
-        "mov    x24, xzr\n"
-        "mov    x27, x13\n"
-        "stp    q20, q15, [sp, #16]\n"  // 32-byte Folded Spill
-        "str    q14, [sp, #48]\n"  // 16-byte Folded Spill
-        "b      " DC_KERNEL_NO_MULT_STRIDE_30 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_28 ":\n"  // in Loop: Header=BB227_30 Depth=2
-        "mov    v5.16b, v30.16b\n"
-        ".word 0x4e8c9705  // sdot   v5.4s, v24.16b, v12.16b\n"
-        "mov    v19.16b, v31.16b\n"
-        ".word 0x4e8b9733  // sdot   v19.4s, v25.16b, v11.16b\n"
-        ".word 0x4e899745  // sdot   v5.4s, v26.16b, v9.16b\n"
-        ".word 0x4e8a9773  // sdot   v19.4s, v27.16b, v10.16b\n"
-        ".word 0x4e889785  // sdot   v5.4s, v28.16b, v8.16b\n"
-        ".word 0x4e8d97b3  // sdot   v19.4s, v29.16b, v13.16b\n"
-        "sqrdmulh        v5.4s, v5.4s, v3.4s\n"
-        "sqrdmulh        v19.4s, v19.4s, v3.4s\n"
-        "sqrshl v5.4s, v5.4s, v4.4s\n"
-        "sqrshl v19.4s, v19.4s, v4.4s\n"
-        "sqxtn  v5.4h, v5.4s\n"
-        "sqxtn2 v5.8h, v19.4s\n"
-        "sqadd  v5.8h, v5.8h, v0.8h\n"
-        "sqxtun v5.8b, v5.8h\n"
-        "umax   v5.8b, v5.8b, v1.8b\n"
-        "umin   v5.8b, v5.8b, v2.8b\n"
-        "mov    v6.16b, v14.16b\n"
-        "mov    v12.16b, v14.16b\n"
-        "mov    v9.16b, v17.16b\n"
-        "mov    v8.16b, v18.16b\n"
-        "mov    v11.16b, v22.16b\n"
-        "mov    v10.16b, v7.16b\n"
-        "mov    v13.16b, v16.16b\n"
-        "str    d5, [x15, x6]\n"
-        DC_KERNEL_NO_MULT_STRIDE_29 ":\n"  // in Loop: Header=BB227_30 Depth=2
-        "add    x24, x24, #32\n"  // =32
-        "sub    x28, x28, #1\n"  // =1
-        "subs   x27, x27, #1\n"  // =1
-        "add    w14, w14, w20\n"
-        "b.eq   " DC_KERNEL_NO_MULT_STRIDE_34 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_30 ":\n"  // Parent Loop BB227_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v14.16b, v30.16b\n"
-        "mov    v15.16b, v31.16b\n"
-        ".word 0x4e8c970e  // sdot   v14.4s, v24.16b, v12.16b\n"
-        "and    x17, x24, #0xffffffe0\n"
-        ".word 0x4e8b972f  // sdot   v15.4s, v25.16b, v11.16b\n"
-        ".word 0x4e89974e  // sdot   v14.4s, v26.16b, v9.16b\n"
-        "add    x17, x26, x17\n"
-        ".word 0x4e8a976f  // sdot   v15.4s, v27.16b, v10.16b\n"
-        ".word 0x4e88978e  // sdot   v14.4s, v28.16b, v8.16b\n"
-        "rev32  v21.8h, v8.8h\n"
-        "rev32  v6.8h, v11.8h\n"
-        "ldp    q11, q22, [x17]\n"
-        ".word 0x4e8d97af  // sdot   v15.4s, v29.16b, v13.16b\n"
-        "sqrdmulh        v8.4s, v14.4s, v3.4s\n"
-        "rev32  v20.8h, v9.8h\n"
-        "sqrdmulh        v9.4s, v15.4s, v3.4s\n"
-        "sqrshl v8.4s, v8.4s, v4.4s\n"
-        "rev32  v5.8h, v13.8h\n"
-        "add    %[output_block_data], x17, x12\n"
-        "add    x17, x17, x5\n"
-        "sqrshl v9.4s, v9.4s, v4.4s\n"
-        "sqxtn  v13.4h, v8.4s\n"
-        "rev32  v19.8h, v12.8h\n"
-        "ldp    q17, q7, [%[output_block_data]]\n"
-        "ldp    q18, q16, [x17]\n"
-        "sqxtn2 v13.8h, v9.4s\n"
-        "trn1   v12.8h, v19.8h, v11.8h\n"
-        "sqadd  v19.8h, v13.8h, v0.8h\n"
-        "sqxtun v19.8b, v19.8h\n"
-        "rev32  v23.8h, v10.8h\n"
-        "umax   v19.8b, v19.8b, v1.8b\n"
-        "add    x15, %[bias_data], w14, sxtw\n"
-        "cmp    w16, #1\n"  // =1
-        "mov    v14.16b, v11.16b\n"
-        "trn1   v11.8h, v6.8h, v22.8h\n"
-        "trn1   v9.8h, v20.8h, v17.8h\n"
-        "trn1   v8.8h, v21.8h, v18.8h\n"
-        "trn1   v10.8h, v23.8h, v7.8h\n"
-        "umin   v19.8b, v19.8b, v2.8b\n"
-        "trn1   v13.8h, v5.8h, v16.8h\n"
-        "str    d19, [x15]\n"
-        "b.gt   " DC_KERNEL_NO_MULT_STRIDE_28 "b\n"
-        // %bb.31:        // in Loop: Header=BB227_30 Depth=2
-        "cbnz   x28,    " DC_KERNEL_NO_MULT_STRIDE_28 "b\n"
-        // %bb.32:        // in Loop: Header=BB227_30 Depth=2
-        "mov    v6.16b, v14.16b\n"
-        "b      " DC_KERNEL_NO_MULT_STRIDE_29 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_33 ":\n"  // in Loop: Header=BB227_4 Depth=1
-        "ldp    q13, q11, [sp, #96]\n"  // 32-byte Folded Reload
-        "b      " DC_KERNEL_NO_MULT_STRIDE_3 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_34 ":\n"  // in Loop: Header=BB227_4 Depth=1
-        "ldp    q13, q11, [sp, #96]\n"  // 32-byte Folded Reload
-        "ldp    q15, q14, [sp, #32]\n"  // 32-byte Folded Reload
-        "ldr    q20, [sp, #16]\n"  // 16-byte Folded Reload
-        "b      " DC_KERNEL_NO_MULT_STRIDE_3 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_35 ":\n"
-        // Compiled intrinsics total stack 304, now 160 for spillage only.
-        "add    sp, sp, #160\n"  // =304
-        :
-        // Outputs.
-        [ scratch_block_data ] "+r"(scratch_block_data),
-        [ filter_workspace ] "+r"(filter_workspace),
-        [ bias_data ] "+r"(bias_data),
-        [ output_block_data ] "+r"(output_block_data)
-        :
-        // Inputs.
-        [ function_params ] "r"(function_params)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20",
-        "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
-        "v31",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
-        "x16", "x17", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26",
-        "x27", "x28");
-
-#undef DC_KERNEL_NO_MULT_STRIDE_1
-#undef DC_KERNEL_NO_MULT_STRIDE_2
-#undef DC_KERNEL_NO_MULT_STRIDE_3
-#undef DC_KERNEL_NO_MULT_STRIDE_4
-#undef DC_KERNEL_NO_MULT_STRIDE_5
-#undef DC_KERNEL_NO_MULT_STRIDE_6
-#undef DC_KERNEL_NO_MULT_STRIDE_7
-#undef DC_KERNEL_NO_MULT_STRIDE_8
-#undef DC_KERNEL_NO_MULT_STRIDE_9
-#undef DC_KERNEL_NO_MULT_STRIDE_10
-#undef DC_KERNEL_NO_MULT_STRIDE_11
-#undef DC_KERNEL_NO_MULT_STRIDE_12
-#undef DC_KERNEL_NO_MULT_STRIDE_13
-#undef DC_KERNEL_NO_MULT_STRIDE_14
-#undef DC_KERNEL_NO_MULT_STRIDE_15
-#undef DC_KERNEL_NO_MULT_STRIDE_16
-#undef DC_KERNEL_NO_MULT_STRIDE_17
-#undef DC_KERNEL_NO_MULT_STRIDE_18
-#undef DC_KERNEL_NO_MULT_STRIDE_19
-#undef DC_KERNEL_NO_MULT_STRIDE_20
-#undef DC_KERNEL_NO_MULT_STRIDE_21
-#undef DC_KERNEL_NO_MULT_STRIDE_22
-#undef DC_KERNEL_NO_MULT_STRIDE_23
-#undef DC_KERNEL_NO_MULT_STRIDE_24
-#undef DC_KERNEL_NO_MULT_STRIDE_25
-#undef DC_KERNEL_NO_MULT_STRIDE_26
-#undef DC_KERNEL_NO_MULT_STRIDE_27
-#undef DC_KERNEL_NO_MULT_STRIDE_28
-#undef DC_KERNEL_NO_MULT_STRIDE_29
-#undef DC_KERNEL_NO_MULT_STRIDE_30
-#undef DC_KERNEL_NO_MULT_STRIDE_31
-#undef DC_KERNEL_NO_MULT_STRIDE_32
-#undef DC_KERNEL_NO_MULT_STRIDE_33
-#undef DC_KERNEL_NO_MULT_STRIDE_34
-#undef DC_KERNEL_NO_MULT_STRIDE_35
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static void __attribute__((noinline))
-  Run(const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockNeon(scratch_block_data, filter_workspace, bias_data,
-                         output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock {
-  static inline void KernelMacroBlockNeon(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Note that argument registers may be reused after parameter loading.
-    // x0 %[scratch_block_data]
-    // x1 %[filter_workspace]
-    // x2 %[bias_data]
-    // x3 %[output_block_data]
-    // x4 %[function_params]
-#define DC_KERNEL_MULT_1 "1"
-#define DC_KERNEL_MULT_2 "2"
-#define DC_KERNEL_MULT_3 "3"
-#define DC_KERNEL_MULT_4 "4"
-#define DC_KERNEL_MULT_5 "5"
-#define DC_KERNEL_MULT_6 "6"
-#define DC_KERNEL_MULT_7 "7"
-#define DC_KERNEL_MULT_8 "8"
-#define DC_KERNEL_MULT_9 "9"
-#define DC_KERNEL_MULT_10 "10"
-#define DC_KERNEL_MULT_11 "11"
-#define DC_KERNEL_MULT_12 "12"
-#define DC_KERNEL_MULT_13 "13"
-#define DC_KERNEL_MULT_14 "14"
-#define DC_KERNEL_MULT_15 "15"
-#define DC_KERNEL_MULT_16 "16"
-#define DC_KERNEL_MULT_17 "17"
-#define DC_KERNEL_MULT_18 "18"
-#define DC_KERNEL_MULT_19 "19"
-#define DC_KERNEL_MULT_20 "20"
-#define DC_KERNEL_MULT_21 "21"
-#define DC_KERNEL_MULT_22 "22"
-
-    asm volatile(
-        // Compiled code used block of 288 for spill out of total stack of 400.
-        // However, an 8-byte spill was sneaked in to #296.
-        // Spillage increased to 304 and these are mapped to #288.
-        "sub    sp, sp, #304\n"  // =400
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_DEPTH_MICRO_REPEATS) "]\n"
-        "str    %[filter_workspace], [sp, #32]\n"  // 8-byte Folded Spill
-        "cmp    w8, #1\n"  // =1
-        "str    w8, [sp, #12]\n"  // 4-byte Folded Spill
-        "b.lt   " DC_KERNEL_MULT_22 "f\n"
-        // %bb.1:
-        "str    wzr, [sp, #28]\n"  // 4-byte Folded Spill
-        "ldpsw  x21, x5, [%[function_params], #" STR(DP_OFFSET_OUTPUT_HEIGHT_STRIDE) "]\n"
-        "ldrb   w8, [%[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MIN) "]\n"
-        "ldrsw  x17, [%[function_params], #" STR(DP_OFFSET_OUTPUT_DEPTH) "]\n"
-        "ldr    w13, [%[function_params], #" STR(DP_OFFSET_OUTPUT_RESIDUAL_WIDTH) "]\n"
-        "add    x11, %[function_params], #" STR(DP_OFFSET_OUTPUT_SHIFT) "\n"  // =36
-        "ldp    w1, w15, [%[function_params], #" STR(DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "add    x10, %[function_params], #" STR(DP_OFFSET_OUTPUT_OFFSET) "\n"  // =28
-        "add    x12, %[function_params], #" STR(DP_OFFSET_OUTPUT_MULTIPLIER) "\n"  // =32
-        "ld1r   { v2.4s }, [x11]\n"
-        "dup    v3.16b, w8\n"
-        "fmov   s5, w8\n"
-        "lsl    x11, x21, #1\n"
-        "add    x7, x21, x21, lsl #1\n"
-        "lsl    x8, x17, #1\n"
-        "ldr    w16, [%[function_params], #" STR(DP_OFFSET_OUTBOUND_BLOCK_HEIGHT) "]\n"
-        "ld1r   { v0.8h }, [x10]\n"
-        "ld1r   { v1.4s }, [x12]\n"
-        "str    w13, [sp, #272]\n"  // 4-byte Folded Spill
-        "cmp    w13, #4\n"  // =4
-        "add    x10, x8, x17\n"
-        "add    x6, x8, x7\n"
-        "add    x12, x8, x11\n"
-        "add    x13, x8, x21\n"
-        "add    x8, %[output_block_data], x8\n"
-        "str    x8, [sp, #176]\n"  // 8-byte Folded Spill
-        "add    x8, x7, x17\n"
-        "add    x14, x11, x17\n"
-        "add    x24, %[output_block_data], x8\n"
-        "add    x8, %[output_block_data], x14\n"
-        "add    x14, x5, #4\n"  // =4
-        "ccmp   w15, w1, #0, lt\n"
-        "str    x14, [sp, #136]\n"  // 8-byte Folded Spill
-        "lsl    x14, x17, #2\n"
-        "ldrb   w9, [%[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MAX) "]\n"
-        "csel   w25, w15, w1, lt\n"
-        "cmp    w16, #1\n"  // =1
-        "str    x14, [sp, #128]\n"  // 8-byte Folded Spill
-        "add    x14, %[output_block_data], x21\n"
-        "add    x22, x5, x5, lsl #2\n"
-        "str    x16, [sp, #56]\n"  // 8-byte Folded Spill
-        "cset   w16, lt\n"
-        "cmp    w1, #1\n"  // =1
-        "str    x14, [sp, #120]\n"  // 8-byte Folded Spill
-        "add    x14, %[output_block_data], x17\n"
-        "lsl    x20, x5, #2\n"
-        "str    w1, [sp, #276]\n"  // 4-byte Folded Spill
-        "cset   w1, lt\n"
-        "str    x14, [sp, #112]\n"  // 8-byte Folded Spill
-        "add    x14, x22, #4\n"  // =4
-        "add    x19, x5, x5, lsl #1\n"
-        "orr    w16, w16, w1\n"
-        "str    x14, [sp, #104]\n"  // 8-byte Folded Spill
-        "add    x14, x20, #4\n"  // =4
-        "dup    v4.16b, w9\n"
-        "fmov   s6, w9\n"
-        "lsl    %[function_params], x5, #1\n"
-        "add    x9, x21, x17\n"
-        "str    w16, [sp, #8]\n"  // 4-byte Folded Spill
-        "add    x16, x10, x21\n"
-        "str    x14, [sp, #96]\n"  // 8-byte Folded Spill
-        "add    x14, x19, #4\n"  // =4
-        "mov    x23, xzr\n"
-        "add    x9, %[output_block_data], x9\n"
-        "str    w15, [sp, #268]\n"  // 4-byte Folded Spill
-        "add    x15, x10, x11\n"
-        "add    x27, %[output_block_data], x12\n"
-        "add    x12, %[output_block_data], x16\n"
-        "str    x14, [sp, #88]\n"  // 8-byte Folded Spill
-        "add    x14, %[function_params], #4\n"  // =4
-        "stp    x11, x21, [sp, #184]\n"  // 16-byte Folded Spill
-        "add    x11, %[output_block_data], x11\n"
-        "str    x9, [sp, #168]\n"  // 8-byte Folded Spill
-        "add    x9, x10, x7\n"
-        "add    x26, %[output_block_data], x6\n"
-        "add    x28, %[output_block_data], x13\n"
-        "mov    x13, x23\n"
-        "str    x12, [sp, #144]\n"  // 8-byte Folded Spill
-        "mov    x12, x7\n"
-        "stp    x7, %[output_block_data], [sp, #40]\n"  // 16-byte Folded Spill
-        "stp    x19, x5, [sp, #248]\n"  // 16-byte Folded Spill
-        "stp    x22, x20, [sp, #232]\n"  // 16-byte Folded Spill
-        "stp    x11, x14, [sp, #72]\n"  // 16-byte Folded Spill
-        "add    x11, %[output_block_data], x7\n"
-        "ldp    x7, x6, [sp, #120]\n"  // 16-byte Folded Reload
-        "ldr    x23, [sp, #112]\n"  // 8-byte Folded Reload
-        "ldp    x22, x19, [sp, #88]\n"  // 16-byte Folded Reload
-        "add    x10, %[output_block_data], x10\n"
-        "dup    v5.8b, v5.b[0]\n"
-        "dup    v6.8b, v6.b[0]\n"
-        "str    x10, [sp, #152]\n"  // 8-byte Folded Spill
-        "add    x9, %[output_block_data], x9\n"
-        "add    x10, %[output_block_data], x15\n"
-        "mov    w15, #4\n"
-        "mov    x20, x14\n"
-        "str    %[function_params], [sp, #280]\n"  // 8-byte Folded Spill
-        "str    x11, [sp, #64]\n"  // 8-byte Folded Spill
-        "str    %[scratch_block_data], [sp, #200]\n"  // 8-byte Folded Spill
-        "str    w25, [sp, #164]\n"  // 4-byte Folded Spill
-        "str    x9, [sp, #288]\n"  // 8-byte Folded Spill
-        "b      " DC_KERNEL_MULT_4 "f\n"
-        DC_KERNEL_MULT_2 ":\n"  // in Loop: Header=BB205_4 Depth=1
-        "mov    %[bias_data], x11\n"
-        DC_KERNEL_MULT_3 ":\n"  // in Loop: Header=BB205_4 Depth=1
-        "ldr    w13, [sp, #28]\n"  // 4-byte Folded Reload
-        "ldr    w12, [sp, #12]\n"  // 4-byte Folded Reload
-        "ldr    x11, [sp, #48]\n"  // 8-byte Folded Reload
-        "add    w13, w13, #1\n"  // =1
-        "str    w13, [sp, #28]\n"  // 4-byte Folded Spill
-        "cmp    w13, w12\n"
-        "ldr    x13, [sp, #16]\n"  // 8-byte Folded Reload
-        "add    x11, x11, #8\n"  // =8
-        "str    x11, [sp, #48]\n"  // 8-byte Folded Spill
-        "add    x13, x13, #8\n"  // =8
-        "b.eq   " DC_KERNEL_MULT_22 "f\n"
-        DC_KERNEL_MULT_4 ":\n"  // =>This Loop Header: Depth=1
-        // Child Loop BB205_18 Depth 2
-        // Child Loop BB205_20 Depth 3
-        // Child Loop BB205_21 Depth 4
-        // Child Loop BB205_7 Depth 2
-        // Child Loop BB205_9 Depth 3
-        // Child Loop BB205_13 Depth 3
-        "ldr    x12, [sp, #32]\n"  // 8-byte Folded Reload
-        "ldr    x14, [sp, #56]\n"  // 8-byte Folded Reload
-        "ldp    q20, q7, [x12]\n"
-        "ldp    q19, q16, [x12, #32]\n"
-        "ldp    q18, q17, [x12, #64]\n"
-        "cmp    w14, #4\n"  // =4
-        "add    x12, x12, #96\n"  // =96
-        "str    x12, [sp, #32]\n"  // 8-byte Folded Spill
-        "str    x13, [sp, #16]\n"  // 8-byte Folded Spill
-        "b.ne   " DC_KERNEL_MULT_15 "f\n"
-        // %bb.5:        // in Loop: Header=BB205_4 Depth=1
-        "mov    %[filter_workspace], xzr\n"
-        "mov    x5, x13\n"
-        "b      " DC_KERNEL_MULT_7 "f\n"
-        DC_KERNEL_MULT_6 ":\n"  // in Loop: Header=BB205_7 Depth=2
-        "add    %[filter_workspace], x1, #1\n"  // =1
-        "cmp    %[filter_workspace], #2\n"  // =2
-        "add    x5, x5, #4\n"  // =4
-        "mov    v18.16b, v17.16b\n"
-        "mov    v19.16b, v16.16b\n"
-        "mov    v20.16b, v7.16b\n"
-        "b.eq   " DC_KERNEL_MULT_3 "b\n"
-        DC_KERNEL_MULT_7 ":\n"  // Parent Loop BB205_4 Depth=1
-        // =>  This Loop Header: Depth=2
-        // Child Loop BB205_9 Depth 3
-        // Child Loop BB205_13 Depth 3
-        "ldr    q21, [%[bias_data]], #16\n"
-        "ldr    w12, [%[scratch_block_data]]\n"
-        "ldp    %[function_params], x13, [sp, #248]\n"  // 16-byte Folded Reload
-        "ldr    x16, [sp, #240]\n"  // 8-byte Folded Reload
-        "ldr    x14, [sp, #280]\n"  // 8-byte Folded Reload
-        "fmov   s22, w12\n"
-        "add    x13, %[scratch_block_data], x13\n"
-        "ldr    w16, [%[scratch_block_data], x16]\n"
-        "mov    v22.s[1], w12\n"
-        "ld1    { v22.s }[2], [x13]\n"
-        "ldr    x13, [sp, #232]\n"  // 8-byte Folded Reload
-        "ldr    w14, [%[scratch_block_data], x14]\n"
-        "fmov   s23, w16\n"
-        "ldr    w4, [%[scratch_block_data], %[function_params]]\n"
-        "add    x13, %[scratch_block_data], x13\n"
-        "mov    v23.s[1], w16\n"
-        "ld1    { v23.s }[2], [x13]\n"
-        "fmov   s24, w14\n"
-        "mov    v24.s[1], w14\n"
-        "dup    v25.4s, w14\n"
-        "mov    v28.16b, v21.16b\n"
-        "mov    v29.16b, v21.16b\n"
-        "mov    v30.16b, v21.16b\n"
-        "dup    v26.4s, w4\n"
-        "mov    v31.16b, v21.16b\n"
-        "mov    v24.s[2], w4\n"
-        "cmp    w25, #1\n"  // =1
-        ".word 0x4e99965c  // sdot   v28.4s, v18.16b, v25.16b\n"
-        ".word 0x4e99967d  // sdot   v29.4s, v19.16b, v25.16b\n"
-        ".word 0x4e99969e  // sdot   v30.4s, v20.16b, v25.16b\n"
-        "mov    v24.s[3], w14\n"
-        "mov    v22.s[3], w12\n"
-        "mov    v23.s[3], w16\n"
-        ".word 0x4e9a969f  // sdot   v31.4s, v20.16b, v26.16b\n"
-        "b.lt   " DC_KERNEL_MULT_14 "f\n"
-        // %bb.8:        // in Loop: Header=BB205_7 Depth=2
-        "stp    %[filter_workspace], %[bias_data], [sp, #216]\n"  // 16-byte Folded Spill
-        "mov    w13, w25\n"
-        "str    x5, [sp, #208]\n"  // 8-byte Folded Spill
-        "mov    x16, x5\n"
-        "mov    x14, %[scratch_block_data]\n"
-        "ldp    x25, %[scratch_block_data], [sp, #168]\n"  // 16-byte Folded Reload
-        "mov    x15, x10\n"
-        "mov    x9, x8\n"
-        "mov    x8, x24\n"
-        "mov    x24, x28\n"
-        "mov    x28, x27\n"
-        "ldp    %[filter_workspace], x27, [sp, #144]\n"  // 16-byte Folded Reload
-        "ldr    x5, [sp, #136]\n"  // 8-byte Folded Reload
-        "ldr    %[bias_data], [sp, #104]\n"  // 8-byte Folded Reload
-        "ldp    x10, x11, [sp, #64]\n"  // 16-byte Folded Reload
-        "shl    v25.4s, v20.4s, #8\n"
-        "shl    v26.4s, v19.4s, #8\n"
-        "shl    v27.4s, v18.4s, #8\n"
-        DC_KERNEL_MULT_9 ":\n"  // Parent Loop BB205_4 Depth=1
-        // Parent Loop BB205_7 Depth=2
-        // =>  This Inner Loop Header: Depth=3
-        ".word 0x4f96e29c  // sdot   v28.4s, v20.16b, v22.4b[0]\n"
-        ".word 0x4f96ea9d  // sdot   v29.4s, v20.16b, v22.4b[2]\n"
-        ".word 0x4f98ea7e  // sdot   v30.4s, v19.16b, v24.4b[2]\n"
-        ".word 0x4f96ea7c  // sdot   v28.4s, v19.16b, v22.4b[2]\n"
-        ".word 0x4f97e27f  // sdot   v31.4s, v19.16b, v23.4b[0]\n"
-        ".word 0x4f98ea5d  // sdot   v29.4s, v18.16b, v24.4b[2]\n"
-        ".word 0x4f97e25e  // sdot   v30.4s, v18.16b, v23.4b[0]\n"
-        "sqrdmulh        v28.4s, v28.4s, v1.4s\n"
-        ".word 0x4f97ea5f  // sdot   v31.4s, v18.16b, v23.4b[2]\n"
-        "sqrdmulh        v29.4s, v29.4s, v1.4s\n"
-        "sqrdmulh        v30.4s, v30.4s, v1.4s\n"
-        "sqrshl v28.4s, v28.4s, v2.4s\n"
-        "sqrdmulh        v31.4s, v31.4s, v1.4s\n"
-        "sqrshl v29.4s, v29.4s, v2.4s\n"
-        "sqrshl v30.4s, v30.4s, v2.4s\n"
-        "sqxtn  v28.4h, v28.4s\n"
-        "sqrshl v31.4s, v31.4s, v2.4s\n"
-        "sqxtn  v30.4h, v30.4s\n"
-        "sqxtn2 v28.8h, v29.4s\n"
-        "sqxtn2 v30.8h, v31.4s\n"
-        "sqadd  v28.8h, v28.8h, v0.8h\n"
-        "sqadd  v29.8h, v30.8h, v0.8h\n"
-        "sqxtun v28.8b, v28.8h\n"
-        "sqxtun2        v28.16b, v29.8h\n"
-        "umax   v28.16b, v28.16b, v3.16b\n"
-        "add    %[function_params], x7, x16\n"
-        "umin   v28.16b, v28.16b, v4.16b\n"
-        "add    x21, x11, x16\n"
-        "str    s28, [%[output_block_data], x16]\n"
-        "st1    { v28.s }[1], [%[function_params]]\n"
-        "add    %[function_params], x10, x16\n"
-        "st1    { v28.s }[2], [x21]\n"
-        "st1    { v28.s }[3], [%[function_params]]\n"
-        "mov    x12, x14\n"
-        "add    x21, x14, x20\n"
-        "ldr    w4, [x14, #4]!\n"
-        "ld1    { v24.s }[1], [x21]\n"
-        "add    x21, x12, x19\n"
-        "ld1    { v23.s }[1], [x21]\n"
-        "mov    v22.s[1], w4\n"
-        "add    %[function_params], x12, x22\n"
-        "ld1    { v24.s }[3], [%[function_params]]\n"
-        "add    %[function_params], x12, x5\n"
-        "ld1    { v22.s }[3], [%[function_params]]\n"
-        "add    x12, x12, %[bias_data]\n"
-        "mov    v28.16b, v21.16b\n"
-        "ld1    { v23.s }[3], [x12]\n"
-        "mov    v29.16b, v21.16b\n"
-        "mov    v30.16b, v21.16b\n"
-        ".word 0x4f96e33c  // sdot   v28.4s, v25.16b, v22.4b[0]\n"
-        "mov    v31.16b, v21.16b\n"
-        ".word 0x4f98e33e  // sdot   v30.4s, v25.16b, v24.4b[0]\n"
-        ".word 0x4f96eb3d  // sdot   v29.4s, v25.16b, v22.4b[2]\n"
-        ".word 0x4f96eb5c  // sdot   v28.4s, v26.16b, v22.4b[2]\n"
-        ".word 0x4f98eb3f  // sdot   v31.4s, v25.16b, v24.4b[2]\n"
-        ".word 0x4f98eb5e  // sdot   v30.4s, v26.16b, v24.4b[2]\n"
-        ".word 0x4f98e35d  // sdot   v29.4s, v26.16b, v24.4b[0]\n"
-        ".word 0x4f98e37c  // sdot   v28.4s, v27.16b, v24.4b[0]\n"
-        ".word 0x4f97e35f  // sdot   v31.4s, v26.16b, v23.4b[0]\n"
-        ".word 0x4f97e37e  // sdot   v30.4s, v27.16b, v23.4b[0]\n"
-        ".word 0x4f98eb7d  // sdot   v29.4s, v27.16b, v24.4b[2]\n"
-        "sqrdmulh        v28.4s, v28.4s, v1.4s\n"
-        ".word 0x4f97eb7f  // sdot   v31.4s, v27.16b, v23.4b[2]\n"
-        "sqrdmulh        v30.4s, v30.4s, v1.4s\n"
-        "sqrdmulh        v29.4s, v29.4s, v1.4s\n"
-        "sqrshl v28.4s, v28.4s, v2.4s\n"
-        "sqrdmulh        v31.4s, v31.4s, v1.4s\n"
-        "sqrshl v30.4s, v30.4s, v2.4s\n"
-        "sqrshl v29.4s, v29.4s, v2.4s\n"
-        "sqxtn  v28.4h, v28.4s\n"
-        "sqrshl v31.4s, v31.4s, v2.4s\n"
-        "sqxtn  v30.4h, v30.4s\n"
-        "sqxtn2 v28.8h, v29.4s\n"
-        "sqxtn2 v30.8h, v31.4s\n"
-        "sqadd  v28.8h, v28.8h, v0.8h\n"
-        "sqadd  v29.8h, v30.8h, v0.8h\n"
-        "sqxtun v28.8b, v28.8h\n"
-        "sqxtun2        v28.16b, v29.8h\n"
-        "umax   v28.16b, v28.16b, v3.16b\n"
-        "add    x12, x25, x16\n"
-        "umin   v28.16b, v28.16b, v4.16b\n"
-        "add    %[function_params], x9, x16\n"
-        "str    s28, [x23, x16]\n"
-        "st1    { v28.s }[1], [x12]\n"
-        "add    x12, x8, x16\n"
-        "mov    v29.16b, v21.16b\n"
-        "ushr   v10.2d, v22.2d, #16\n"
-        "mov    v30.16b, v21.16b\n"
-        "mov    v31.16b, v21.16b\n"
-        "st1    { v28.s }[2], [%[function_params]]\n"
-        "st1    { v28.s }[3], [x12]\n"
-        "ushr   v28.2d, v24.2d, #16\n"
-        ".word 0x4f8ae29d  // sdot   v29.4s, v20.16b, v10.4b[0]\n"
-        "mov    v8.16b, v21.16b\n"
-        ".word 0x4f9ce29f  // sdot   v31.4s, v20.16b, v28.4b[0]\n"
-        ".word 0x4f8aea9e  // sdot   v30.4s, v20.16b, v10.4b[2]\n"
-        ".word 0x4f8aea7d  // sdot   v29.4s, v19.16b, v10.4b[2]\n"
-        "ushr   v9.2d, v23.2d, #16\n"
-        ".word 0x4f9cea88  // sdot   v8.4s, v20.16b, v28.4b[2]\n"
-        ".word 0x4f9cea7f  // sdot   v31.4s, v19.16b, v28.4b[2]\n"
-        ".word 0x4f9ce27e  // sdot   v30.4s, v19.16b, v28.4b[0]\n"
-        ".word 0x4f9ce25d  // sdot   v29.4s, v18.16b, v28.4b[0]\n"
-        ".word 0x4f89e268  // sdot   v8.4s, v19.16b, v9.4b[0]\n"
-        ".word 0x4f89e25f  // sdot   v31.4s, v18.16b, v9.4b[0]\n"
-        ".word 0x4f9cea5e  // sdot   v30.4s, v18.16b, v28.4b[2]\n"
-        "sqrdmulh        v29.4s, v29.4s, v1.4s\n"
-        ".word 0x4f89ea48  // sdot   v8.4s, v18.16b, v9.4b[2]\n"
-        "sqrdmulh        v31.4s, v31.4s, v1.4s\n"
-        "sqrdmulh        v30.4s, v30.4s, v1.4s\n"
-        "sqrshl v29.4s, v29.4s, v2.4s\n"
-        "sqrdmulh        v8.4s, v8.4s, v1.4s\n"
-        "sqrshl v31.4s, v31.4s, v2.4s\n"
-        "sqrshl v30.4s, v30.4s, v2.4s\n"
-        "sqxtn  v29.4h, v29.4s\n"
-        "sqrshl v8.4s, v8.4s, v2.4s\n"
-        "sqxtn  v31.4h, v31.4s\n"
-        "sqxtn2 v29.8h, v30.4s\n"
-        "sqxtn2 v31.8h, v8.4s\n"
-        "sqadd  v29.8h, v29.8h, v0.8h\n"
-        "sqadd  v30.8h, v31.8h, v0.8h\n"
-        "sqxtun v29.8b, v29.8h\n"
-        "sqxtun2        v29.16b, v30.8h\n"
-        "umax   v29.16b, v29.16b, v3.16b\n"
-        "add    %[function_params], x24, x16\n"
-        "umin   v29.16b, v29.16b, v4.16b\n"
-        "mov    v30.16b, v21.16b\n"
-        "add    x12, x28, x16\n"
-        "str    s29, [%[scratch_block_data], x16]\n"
-        "st1    { v29.s }[1], [%[function_params]]\n"
-        "add    %[function_params], x26, x16\n"
-        "mov    v31.16b, v21.16b\n"
-        "mov    v8.16b, v21.16b\n"
-        ".word 0x4f8ae33e  // sdot   v30.4s, v25.16b, v10.4b[0]\n"
-        "st1    { v29.s }[2], [x12]\n"
-        "st1    { v29.s }[3], [%[function_params]]\n"
-        "mov    v29.16b, v21.16b\n"
-        ".word 0x4f9ce328  // sdot   v8.4s, v25.16b, v28.4b[0]\n"
-        ".word 0x4f8aeb3f  // sdot   v31.4s, v25.16b, v10.4b[2]\n"
-        ".word 0x4f8aeb5e  // sdot   v30.4s, v26.16b, v10.4b[2]\n"
-        ".word 0x4f9ceb3d  // sdot   v29.4s, v25.16b, v28.4b[2]\n"
-        ".word 0x4f9ceb48  // sdot   v8.4s, v26.16b, v28.4b[2]\n"
-        ".word 0x4f9ce35f  // sdot   v31.4s, v26.16b, v28.4b[0]\n"
-        ".word 0x4f9ce37e  // sdot   v30.4s, v27.16b, v28.4b[0]\n"
-        ".word 0x4f89e35d  // sdot   v29.4s, v26.16b, v9.4b[0]\n"
-        ".word 0x4f89e368  // sdot   v8.4s, v27.16b, v9.4b[0]\n"
-        ".word 0x4f9ceb7f  // sdot   v31.4s, v27.16b, v28.4b[2]\n"
-        "sqrdmulh        v30.4s, v30.4s, v1.4s\n"
-        ".word 0x4f89eb7d  // sdot   v29.4s, v27.16b, v9.4b[2]\n"
-        "sqrdmulh        v28.4s, v8.4s, v1.4s\n"
-        "sqrdmulh        v31.4s, v31.4s, v1.4s\n"
-        "sqrshl v30.4s, v30.4s, v2.4s\n"
-        "sqrdmulh        v29.4s, v29.4s, v1.4s\n"
-        "sqrshl v28.4s, v28.4s, v2.4s\n"
-        "sqrshl v31.4s, v31.4s, v2.4s\n"
-        "sqxtn  v30.4h, v30.4s\n"
-        "sqrshl v29.4s, v29.4s, v2.4s\n"
-        "sqxtn  v28.4h, v28.4s\n"
-        "sqxtn2 v30.8h, v31.4s\n"
-        "sqxtn2 v28.8h, v29.4s\n"
-        "sqadd  v29.8h, v30.8h, v0.8h\n"
-        "sqadd  v28.8h, v28.8h, v0.8h\n"
-        "sqxtun v29.8b, v29.8h\n"
-        "sqxtun2        v29.16b, v28.8h\n"
-        "umax   v28.16b, v29.16b, v3.16b\n"
-        "add    x12, %[filter_workspace], x16\n"
-        "umin   v8.16b, v28.16b, v4.16b\n"
-        "str    s8, [x27, x16]\n"
-        "st1    { v8.s }[1], [x12]\n"
-        "ldr    x12, [sp, #288]\n"  // 8-byte Folded Reload
-        "mov    v28.16b, v21.16b\n"
-        "mov    v29.16b, v21.16b\n"
-        "mov    v30.16b, v21.16b\n"
-        "mov    v31.16b, v21.16b\n"
-        "ushr   v24.2d, v24.2d, #32\n"
-        "add    %[function_params], x15, x16\n"
-        "add    x12, x12, x16\n"
-        "subs   w13, w13, #1\n"  // =1
-        "ushr   v22.2d, v22.2d, #32\n"
-        "ushr   v23.2d, v23.2d, #32\n"
-        ".word 0x4f98e25c  // sdot   v28.4s, v18.16b, v24.4b[0]\n"
-        ".word 0x4f98e27d  // sdot   v29.4s, v19.16b, v24.4b[0]\n"
-        ".word 0x4f98e29e  // sdot   v30.4s, v20.16b, v24.4b[0]\n"
-        ".word 0x4f98ea9f  // sdot   v31.4s, v20.16b, v24.4b[2]\n"
-        "add    x16, x16, x6\n"
-        "st1    { v8.s }[2], [%[function_params]]\n"
-        "st1    { v8.s }[3], [x12]\n"
-        "b.ne   " DC_KERNEL_MULT_9 "b\n"
-        // %bb.10:        // in Loop: Header=BB205_7 Depth=2
-        "ldr    w25, [sp, #164]\n"  // 4-byte Folded Reload
-        "ldp    x21, %[scratch_block_data], [sp, #192]\n"  // 16-byte Folded Reload
-        "ldr    %[function_params], [sp, #184]\n"  // 8-byte Folded Reload
-        "ldp    %[filter_workspace], %[bias_data], [sp, #216]\n"  // 16-byte Folded Reload
-        "ldr    x5, [sp, #208]\n"  // 8-byte Folded Reload
-        "add    x13, %[output_block_data], x16\n"
-        "mov    w12, w25\n"
-        "mov    x27, x28\n"
-        "mov    x28, x24\n"
-        "mov    x24, x8\n"
-        "mov    x8, x9\n"
-        "mov    x10, x15\n"
-        "mov    w15, #4\n"
-        "ldr    w16, [sp, #276]\n"  // 4-byte Folded Reload
-        "cmp    w12, w16\n"
-        "b.ge   " DC_KERNEL_MULT_6 "b\n"
-        DC_KERNEL_MULT_11 ":\n"  // in Loop: Header=BB205_7 Depth=2
-        "ldr    w12, [sp, #272]\n"  // 4-byte Folded Reload
-        "cmp    w12, #1\n"  // =1
-        "b.lt   " DC_KERNEL_MULT_6 "b\n"
-        // %bb.12:        // in Loop: Header=BB205_7 Depth=2
-        "add    x12, x14, #4\n"  // =4
-        "ldr    x14, [sp, #240]\n"  // 8-byte Folded Reload
-        "ldr    x16, [sp, #280]\n"  // 8-byte Folded Reload
-        "add    x14, x12, x14\n"
-        "ld1    { v23.s }[1], [x14]\n"
-        "ldr    x14, [sp, #232]\n"  // 8-byte Folded Reload
-        "add    x16, x12, x16\n"
-        "ld1    { v24.s }[1], [x16]\n"
-        "add    x14, x12, x14\n"
-        "ld1    { v23.s }[3], [x14]\n"
-        "ldp    x16, x14, [sp, #248]\n"  // 16-byte Folded Reload
-        "add    x16, x12, x16\n"
-        "ld1    { v24.s }[3], [x16]\n"
-        "ldr    x16, [sp, #40]\n"  // 8-byte Folded Reload
-        "ld1    { v22.s }[1], [x12], x14\n"
-        "ld1    { v22.s }[3], [x12]\n"
-        "ldr    w12, [sp, #272]\n"  // 4-byte Folded Reload
-        DC_KERNEL_MULT_13 ":\n"  // Parent Loop BB205_4 Depth=1
-        // Parent Loop BB205_7 Depth=2
-        // =>  This Inner Loop Header: Depth=3
-        ".word 0x4f96e29c  // sdot   v28.4s, v20.16b, v22.4b[0]\n"
-        ".word 0x4f96ea9d  // sdot   v29.4s, v20.16b, v22.4b[2]\n"
-        ".word 0x4f98ea7e  // sdot   v30.4s, v19.16b, v24.4b[2]\n"
-        ".word 0x4f96ea7c  // sdot   v28.4s, v19.16b, v22.4b[2]\n"
-        ".word 0x4f97e27f  // sdot   v31.4s, v19.16b, v23.4b[0]\n"
-        ".word 0x4f98ea5d  // sdot   v29.4s, v18.16b, v24.4b[2]\n"
-        ".word 0x4f97e25e  // sdot   v30.4s, v18.16b, v23.4b[0]\n"
-        "sqrdmulh        v25.4s, v28.4s, v1.4s\n"
-        ".word 0x4f97ea5f  // sdot   v31.4s, v18.16b, v23.4b[2]\n"
-        "sqrdmulh        v26.4s, v29.4s, v1.4s\n"
-        "sqrdmulh        v27.4s, v30.4s, v1.4s\n"
-        "sqrshl v25.4s, v25.4s, v2.4s\n"
-        "sqrdmulh        v28.4s, v31.4s, v1.4s\n"
-        "sqrshl v26.4s, v26.4s, v2.4s\n"
-        "sqrshl v27.4s, v27.4s, v2.4s\n"
-        "sqxtn  v25.4h, v25.4s\n"
-        "sqrshl v28.4s, v28.4s, v2.4s\n"
-        "sqxtn  v27.4h, v27.4s\n"
-        "sqxtn2 v25.8h, v26.4s\n"
-        "sqxtn2 v27.8h, v28.4s\n"
-        "sqadd  v25.8h, v25.8h, v0.8h\n"
-        "sqadd  v26.8h, v27.8h, v0.8h\n"
-        "sqxtun v25.8b, v25.8h\n"
-        "sqxtun2        v25.16b, v26.8h\n"
-        "umax   v25.16b, v25.16b, v3.16b\n"
-        "add    x14, x13, x21\n"
-        "umin   v25.16b, v25.16b, v4.16b\n"
-        "str    s25, [x13]\n"
-        "st1    { v25.s }[1], [x14]\n"
-        "add    x14, x13, %[function_params]\n"
-        "ushr   v24.2d, v24.2d, #8\n"
-        "mov    v28.16b, v21.16b\n"
-        "mov    v29.16b, v21.16b\n"
-        "mov    v30.16b, v21.16b\n"
-        "mov    v31.16b, v21.16b\n"
-        "st1    { v25.s }[2], [x14]\n"
-        "add    x14, x13, x16\n"
-        "subs   w12, w12, #1\n"  // =1
-        "ushr   v22.2d, v22.2d, #8\n"
-        "ushr   v23.2d, v23.2d, #8\n"
-        ".word 0x4f98e25c  // sdot   v28.4s, v18.16b, v24.4b[0]\n"
-        ".word 0x4f98e27d  // sdot   v29.4s, v19.16b, v24.4b[0]\n"
-        ".word 0x4f98e29e  // sdot   v30.4s, v20.16b, v24.4b[0]\n"
-        "add    x13, x13, x17\n"
-        ".word 0x4f98ea9f  // sdot   v31.4s, v20.16b, v24.4b[2]\n"
-        "st1    { v25.s }[3], [x14]\n"
-        "b.ne   " DC_KERNEL_MULT_13 "b\n"
-        "b      " DC_KERNEL_MULT_6 "b\n"
-        DC_KERNEL_MULT_14 ":\n"  // in Loop: Header=BB205_7 Depth=2
-        "ldr    x11, [sp, #48]\n"  // 8-byte Folded Reload
-        "ldr    %[function_params], [sp, #184]\n"  // 8-byte Folded Reload
-        "mov    w12, wzr\n"
-        "mov    x14, %[scratch_block_data]\n"
-        "add    x13, x11, %[filter_workspace], lsl #2\n"
-        "ldr    w16, [sp, #276]\n"  // 4-byte Folded Reload
-        "cmp    w12, w16\n"
-        "b.ge   " DC_KERNEL_MULT_6 "b\n"
-        "b      " DC_KERNEL_MULT_11 "b\n"
-        DC_KERNEL_MULT_15 ":\n"  // in Loop: Header=BB205_4 Depth=1
-        "ldr    w14, [sp, #8]\n"  // 4-byte Folded Reload
-        "add    x11, %[bias_data], #32\n"  // =32
-        "tbnz   w14, #0,    " DC_KERNEL_MULT_2 "b\n"
-        // %bb.16:        // in Loop: Header=BB205_4 Depth=1
-        "ldp    q21, q22, [%[bias_data]]\n"
-        "ldr    %[filter_workspace], [sp, #48]\n"  // 8-byte Folded Reload
-        "mov    x14, xzr\n"
-        "b      " DC_KERNEL_MULT_18 "f\n"
-        DC_KERNEL_MULT_17 ":\n"  // in Loop: Header=BB205_18 Depth=2
-        "ldr    x12, [sp, #56]\n"  // 8-byte Folded Reload
-        "ldp    x21, %[scratch_block_data], [sp, #192]\n"  // 16-byte Folded Reload
-        "add    x14, x14, #1\n"  // =1
-        "cmp    x14, x12\n"
-        "add    %[filter_workspace], x1, x21\n"
-        "b.eq   " DC_KERNEL_MULT_2 "b\n"
-        DC_KERNEL_MULT_18 ":\n"  // Parent Loop BB205_4 Depth=1
-        // =>  This Loop Header: Depth=2
-        // Child Loop BB205_20 Depth 3
-        // Child Loop BB205_21 Depth 4
-        "ldr    x16, [sp, #256]\n"  // 8-byte Folded Reload
-        "mov    w13, wzr\n"
-        "madd   x12, x14, x16, %[scratch_block_data]\n"
-        "mov    %[scratch_block_data], x16\n"
-        "ldr    w16, [x12]\n"
-        "add    %[function_params], x12, %[scratch_block_data]\n"
-        "fmov   s23, w16\n"
-        "mov    v23.s[1], w16\n"
-        "ld1    { v23.s }[2], [%[function_params]]\n"
-        "ldr    %[function_params], [sp, #280]\n"  // 8-byte Folded Reload
-        "mov    v23.s[3], w16\n"
-        "add    %[function_params], x12, %[function_params]\n"
-        "ld1r   { v24.4s }, [%[function_params]]\n"
-        "mov    x16, %[filter_workspace]\n"
-        "b      " DC_KERNEL_MULT_20 "f\n"
-        DC_KERNEL_MULT_19 ":\n"  // in Loop: Header=BB205_20 Depth=3
-        "ldr    w4, [sp, #276]\n"  // 4-byte Folded Reload
-        "add    w13, w13, #1\n"  // =1
-        "cmp    w13, w4\n"
-        "b.eq   " DC_KERNEL_MULT_17 "b\n"
-        DC_KERNEL_MULT_20 ":\n"  // Parent Loop BB205_4 Depth=1
-        // Parent Loop BB205_18 Depth=2
-        // =>  This Loop Header: Depth=3
-        // Child Loop BB205_21 Depth 4
-        "ldr    x21, [sp, #280]\n"  // 8-byte Folded Reload
-        "add    x12, x12, #4\n"  // =4
-        "mov    %[function_params], x12\n"
-        "ld1    { v23.s }[1], [%[function_params]], x21\n"
-        "ldr    w21, [sp, #268]\n"  // 4-byte Folded Reload
-        "ld1    { v24.s }[1], [%[function_params]]\n"
-        "ldr    w4, [sp, #272]\n"  // 4-byte Folded Reload
-        "cmp    w13, w21\n"
-        "add    x21, x12, %[scratch_block_data]\n"
-        "ld1    { v23.s }[3], [x21]\n"
-        "csel   w4, w4, w15, eq\n"
-        "cmp    w4, #1\n"  // =1
-        "b.lt   " DC_KERNEL_MULT_19 "b\n"
-        DC_KERNEL_MULT_21 ":\n"  // Parent Loop BB205_4 Depth=1
-        // Parent Loop BB205_18 Depth=2
-        // Parent Loop BB205_20 Depth=3
-        // =>  This Inner Loop Header: Depth=4
-        "mov    v25.16b, v21.16b\n"
-        "mov    v26.16b, v22.16b\n"
-        ".word 0x4f97e299  // sdot   v25.4s, v20.16b, v23.4b[0]\n"
-        ".word 0x4f97e0fa  // sdot   v26.4s, v7.16b, v23.4b[0]\n"
-        ".word 0x4f97ea79  // sdot   v25.4s, v19.16b, v23.4b[2]\n"
-        ".word 0x4f97ea1a  // sdot   v26.4s, v16.16b, v23.4b[2]\n"
-        ".word 0x4f98e259  // sdot   v25.4s, v18.16b, v24.4b[0]\n"
-        ".word 0x4f98e23a  // sdot   v26.4s, v17.16b, v24.4b[0]\n"
-        "sqrdmulh        v25.4s, v25.4s, v1.4s\n"
-        "sqrdmulh        v26.4s, v26.4s, v1.4s\n"
-        "sqrshl v25.4s, v25.4s, v2.4s\n"
-        "sqrshl v26.4s, v26.4s, v2.4s\n"
-        "sqxtn  v25.4h, v25.4s\n"
-        "sqxtn2 v25.8h, v26.4s\n"
-        "sqadd  v25.8h, v25.8h, v0.8h\n"
-        "sqxtun v25.8b, v25.8h\n"
-        "umax   v25.8b, v25.8b, v5.8b\n"
-        "umin   v25.8b, v25.8b, v6.8b\n"
-        "subs   w4, w4, #1\n"  // =1
-        "ushr   v23.2d, v23.2d, #8\n"
-        "ushr   v24.2d, v24.2d, #8\n"
-        "str    d25, [x16]\n"
-        "add    x16, x16, x17\n"
-        "b.ne   " DC_KERNEL_MULT_21 "b\n"
-        "b      " DC_KERNEL_MULT_19 "b\n"
-        DC_KERNEL_MULT_22 ":\n"
-        // Compiled intrinsics total stack 400, now 304 for spillage only.
-        "add    sp, sp, #304\n"  // =400
-        :
-        // Outputs.
-        [ scratch_block_data ] "+r"(scratch_block_data),
-        [ filter_workspace ] "+r"(filter_workspace),
-        [ bias_data ] "+r"(bias_data),
-        [ output_block_data ] "+r"(output_block_data)
-        :
-        // Inputs.
-        [ function_params ] "r"(function_params)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20",
-        "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
-        "v31",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
-        "x16", "x17", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26",
-        "x27", "x28");
-
-#undef DC_KERNEL_MULT_1
-#undef DC_KERNEL_MULT_2
-#undef DC_KERNEL_MULT_3
-#undef DC_KERNEL_MULT_4
-#undef DC_KERNEL_MULT_5
-#undef DC_KERNEL_MULT_6
-#undef DC_KERNEL_MULT_7
-#undef DC_KERNEL_MULT_8
-#undef DC_KERNEL_MULT_9
-#undef DC_KERNEL_MULT_10
-#undef DC_KERNEL_MULT_11
-#undef DC_KERNEL_MULT_12
-#undef DC_KERNEL_MULT_13
-#undef DC_KERNEL_MULT_14
-#undef DC_KERNEL_MULT_15
-#undef DC_KERNEL_MULT_16
-#undef DC_KERNEL_MULT_17
-#undef DC_KERNEL_MULT_18
-#undef DC_KERNEL_MULT_19
-#undef DC_KERNEL_MULT_20
-#undef DC_KERNEL_MULT_21
-#undef DC_KERNEL_MULT_22
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static void __attribute__((noinline))
-  Run(const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockNeon(scratch_block_data, filter_workspace, bias_data,
-                         output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock {
-  static inline void KernelMacroBlockNeon(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Note that argument registers may be reused after parameter loading.
-    // x0 %[scratch_block_data]
-    // x1 %[filter_workspace]
-    // x2 %[bias_data]
-    // x3 %[output_block_data]
-    // x4 %[function_params]
-#define DC_KERNEL_MULT_STRIDE_1 "1"
-#define DC_KERNEL_MULT_STRIDE_2 "2"
-#define DC_KERNEL_MULT_STRIDE_3 "3"
-#define DC_KERNEL_MULT_STRIDE_4 "4"
-#define DC_KERNEL_MULT_STRIDE_5 "5"
-#define DC_KERNEL_MULT_STRIDE_6 "6"
-#define DC_KERNEL_MULT_STRIDE_7 "7"
-#define DC_KERNEL_MULT_STRIDE_8 "8"
-#define DC_KERNEL_MULT_STRIDE_9 "9"
-#define DC_KERNEL_MULT_STRIDE_10 "10"
-#define DC_KERNEL_MULT_STRIDE_11 "11"
-#define DC_KERNEL_MULT_STRIDE_12 "12"
-#define DC_KERNEL_MULT_STRIDE_13 "13"
-
-    asm volatile(
-        "ldr    w15, [%[function_params], #" STR(DP_OFFSET_OUTPUT_RESIDUAL_WIDTH) "]\n"
-        "ldp    w11, w6, [%[function_params], #" STR(DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "ldpsw  x9, x10, [%[function_params], #" STR(DP_OFFSET_OUTPUT_HEIGHT_STRIDE) "]\n"
-        "ldrsw  x12, [%[function_params], #" STR(DP_OFFSET_DEPTH_MICRO_REPEATS) "]\n"
-        "ldrsw  x13, [%[function_params], #" STR(DP_OFFSET_OUTPUT_DEPTH) "]\n"
-        "ldr    w14, [%[function_params], #" STR(DP_OFFSET_OUTBOUND_BLOCK_HEIGHT) "]\n"
-        "add    x17, %[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MIN) "\n"  // =40
-        "add    x5, %[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MAX) "\n"  // =44
-        "add    x7, %[function_params], #" STR(DP_OFFSET_OUTPUT_MULTIPLIER) "\n"  // =32
-        "add    x19, %[function_params], #" STR(DP_OFFSET_OUTPUT_SHIFT) "\n"  // =36
-        "add    %[function_params], %[function_params], #" STR(DP_OFFSET_OUTPUT_OFFSET) "\n"  // =28
-        "sxtw   x11, w11\n"
-        "ld1r   { v0.8h }, [%[function_params]]\n"
-        "ld1r   { v1.4s }, [x7]\n"
-        "ld1r   { v2.4s }, [x19]\n"
-        "ld1r   { v3.8b }, [x17]\n"
-        "ld1r   { v4.8b }, [x5]\n"
-        "cmp    w15, #2\n"  // =2
-        "ccmp   w6, w11, #0, lt\n"
-        "lsl    x5, x6, #2\n"
-        "csel   w6, w6, w11, lt\n"
-        "mov    x8, xzr\n"
-        "add    x16, %[scratch_block_data], #4\n"  // =4
-        "lsl    x17, x10, #1\n"
-        "add    %[function_params], x10, x10, lsl #1\n"
-        "sxtw   x6, w6\n"
-        "add    x7, x9, x13\n"
-        "b      " DC_KERNEL_MULT_STRIDE_13 "f\n"
-        DC_KERNEL_MULT_STRIDE_1 ":\n"  // in Loop: Header=BB206_13 Depth=1
-        "ldr    w20, [%[scratch_block_data]]\n"
-        "add    x21, %[scratch_block_data], x10\n"
-        "ldp    q5, q6, [%[filter_workspace]]\n"
-        "ldp    q7, q16, [%[filter_workspace], #32]\n"
-        "fmov   s21, w20\n"
-        "mov    v21.s[1], w20\n"
-        "ld1    { v21.s }[2], [x21]\n"
-        "ldp    q17, q18, [%[filter_workspace], #64]\n"
-        "ldp    q19, q20, [%[bias_data]], #32\n"
-        "ldr    s22, [%[scratch_block_data], x17]\n"
-        "ubfiz  x19, x8, #3, #29\n"
-        "add    %[filter_workspace], %[filter_workspace], #96\n"  // =96
-        "add    x19, %[output_block_data], x19\n"
-        "cmp    w14, #2\n"  // =2
-        "mov    v21.s[3], w20\n"
-        "mov    x20, xzr\n"
-        "b.ne   " DC_KERNEL_MULT_STRIDE_7 "f\n"
-        // %bb.2:        // in Loop: Header=BB206_13 Depth=1
-        "dup    v22.4s, v22.s[0]\n"
-        "add    x21, %[scratch_block_data], %[function_params]\n"
-        "add    x22, %[scratch_block_data], x10, lsl #2\n"
-        "ld1    { v22.s }[2], [x21]\n"
-        "ld1r   { v23.4s }, [x22]\n"
-        "mov    x21, xzr\n"
-        "b      " DC_KERNEL_MULT_STRIDE_4 "f\n"
-        DC_KERNEL_MULT_STRIDE_3 ":\n"  // in Loop: Header=BB206_4 Depth=2
-        "and    x22, x20, #0xfffffffc\n"
-        "add    x23, x16, x22\n"
-        "lsl    x24, x10, #2\n"
-        "mov    x22, x23\n"
-        "ld1    { v21.s }[1], [x22], x24\n"
-        "add    x24, x23, x17\n"
-        "ld1    { v22.s }[1], [x24]\n"
-        "add    x24, x23, x10\n"
-        "ld1    { v21.s }[3], [x24]\n"
-        "add    x23, x23, %[function_params]\n"
-        "ld1    { v22.s }[3], [x23]\n"
-        "mov    v25.16b, v19.16b\n"
-        "mov    v27.16b, v20.16b\n"
-        "ld1    { v23.s }[1], [x22]\n"
-        "ushr   v29.2d, v21.2d, #16\n"
-        ".word 0x4f9de0b9  // sdot   v25.4s, v5.16b, v29.4b[0]\n"
-        ".word 0x4f9de0db  // sdot   v27.4s, v6.16b, v29.4b[0]\n"
-        "mov    v26.16b, v19.16b\n"
-        "mov    v28.16b, v20.16b\n"
-        ".word 0x4f9de8f9  // sdot   v25.4s, v7.16b, v29.4b[2]\n"
-        ".word 0x4f9dea1b  // sdot   v27.4s, v16.16b, v29.4b[2]\n"
-        "ushr   v29.2d, v22.2d, #16\n"
-        ".word 0x4f9de0ba  // sdot   v26.4s, v5.16b, v29.4b[0]\n"
-        ".word 0x4f9de0dc  // sdot   v28.4s, v6.16b, v29.4b[0]\n"
-        "mov    v24.16b, v19.16b\n"
-        ".word 0x4f9de8fa  // sdot   v26.4s, v7.16b, v29.4b[2]\n"
-        ".word 0x4f9dea1c  // sdot   v28.4s, v16.16b, v29.4b[2]\n"
-        ".word 0x4f9de239  // sdot   v25.4s, v17.16b, v29.4b[0]\n"
-        ".word 0x4f9de25b  // sdot   v27.4s, v18.16b, v29.4b[0]\n"
-        "ushr   v29.2d, v23.2d, #16\n"
-        ".word 0x4f9de23a  // sdot   v26.4s, v17.16b, v29.4b[0]\n"
-        ".word 0x4f9de25c  // sdot   v28.4s, v18.16b, v29.4b[0]\n"
-        "mov    v29.16b, v19.16b\n"
-        ".word 0x4f95e0b8  // sdot   v24.4s, v5.16b, v21.4b[0]\n"
-        ".word 0x4f96e0bd  // sdot   v29.4s, v5.16b, v22.4b[0]\n"
-        ".word 0x4f95e8f8  // sdot   v24.4s, v7.16b, v21.4b[2]\n"
-        ".word 0x4f96e8fd  // sdot   v29.4s, v7.16b, v22.4b[2]\n"
-        ".word 0x4f96e238  // sdot   v24.4s, v17.16b, v22.4b[0]\n"
-        ".word 0x4f97e23d  // sdot   v29.4s, v17.16b, v23.4b[0]\n"
-        "sqrdmulh        v24.4s, v24.4s, v1.4s\n"
-        "sqrdmulh        v29.4s, v29.4s, v1.4s\n"
-        "sqrshl v24.4s, v24.4s, v2.4s\n"
-        "sqrshl v29.4s, v29.4s, v2.4s\n"
-        "sqxtn  v24.4h, v24.4s\n"
-        "sqxtn2 v24.8h, v29.4s\n"
-        "sqadd  v24.8h, v24.8h, v0.8h\n"
-        "sqxtun v24.8b, v24.8h\n"
-        "umax   v24.8b, v24.8b, v3.8b\n"
-        "add    x22, x19, x9\n"
-        "mov    v29.16b, v20.16b\n"
-        "umin   v24.8b, v24.8b, v4.8b\n"
-        "str    s24, [x19]\n"
-        "st1    { v24.s }[1], [x22]\n"
-        "mov    v24.16b, v20.16b\n"
-        ".word 0x4f95e0dd  // sdot   v29.4s, v6.16b, v21.4b[0]\n"
-        ".word 0x4f96e0d8  // sdot   v24.4s, v6.16b, v22.4b[0]\n"
-        ".word 0x4f95ea1d  // sdot   v29.4s, v16.16b, v21.4b[2]\n"
-        ".word 0x4f96ea18  // sdot   v24.4s, v16.16b, v22.4b[2]\n"
-        ".word 0x4f96e25d  // sdot   v29.4s, v18.16b, v22.4b[0]\n"
-        ".word 0x4f97e258  // sdot   v24.4s, v18.16b, v23.4b[0]\n"
-        "sqrdmulh        v29.4s, v29.4s, v1.4s\n"
-        "sqrdmulh        v24.4s, v24.4s, v1.4s\n"
-        "sqrshl v29.4s, v29.4s, v2.4s\n"
-        "sqrshl v24.4s, v24.4s, v2.4s\n"
-        "sqxtn  v29.4h, v29.4s\n"
-        "sqxtn2 v29.8h, v24.4s\n"
-        "sqadd  v24.8h, v29.8h, v0.8h\n"
-        "sqxtun v24.8b, v24.8h\n"
-        "sqrdmulh        v25.4s, v25.4s, v1.4s\n"
-        "umax   v24.8b, v24.8b, v3.8b\n"
-        "sqrdmulh        v26.4s, v26.4s, v1.4s\n"
-        "sqrshl v25.4s, v25.4s, v2.4s\n"
-        "add    x22, x22, #4\n"  // =4
-        "umin   v24.8b, v24.8b, v4.8b\n"
-        "sqrshl v26.4s, v26.4s, v2.4s\n"
-        "sqxtn  v25.4h, v25.4s\n"
-        "str    s24, [x19, #4]\n"
-        "st1    { v24.s }[1], [x22]\n"
-        "sqxtn2 v25.8h, v26.4s\n"
-        "sqadd  v24.8h, v25.8h, v0.8h\n"
-        "sqrdmulh        v27.4s, v27.4s, v1.4s\n"
-        "sqxtun v24.8b, v24.8h\n"
-        "sqrdmulh        v28.4s, v28.4s, v1.4s\n"
-        "sqrshl v27.4s, v27.4s, v2.4s\n"
-        "umax   v24.8b, v24.8b, v3.8b\n"
-        "add    x23, x19, x13\n"
-        "add    x24, x19, x7\n"
-        "sqrshl v28.4s, v28.4s, v2.4s\n"
-        "sqxtn  v27.4h, v27.4s\n"
-        "umin   v24.8b, v24.8b, v4.8b\n"
-        "str    s24, [x23]\n"
-        "st1    { v24.s }[1], [x24]\n"
-        "sqxtn2 v27.8h, v28.4s\n"
-        "sqadd  v24.8h, v27.8h, v0.8h\n"
-        "sqxtun v24.8b, v24.8h\n"
-        "umax   v24.8b, v24.8b, v3.8b\n"
-        "add    x25, x24, #4\n"  // =4
-        "umin   v24.8b, v24.8b, v4.8b\n"
-        "add    x21, x21, #1\n"  // =1
-        "ushr   v21.2d, v21.2d, #32\n"
-        "ushr   v22.2d, v22.2d, #32\n"
-        "ushr   v23.2d, v23.2d, #32\n"
-        "add    x19, x23, x13\n"
-        "str    s24, [x23, #4]\n"
-        "st1    { v24.s }[1], [x25]\n"
-        "add    x20, x20, #4\n"  // =4
-        DC_KERNEL_MULT_STRIDE_4 ":\n"  // Parent Loop BB206_13 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "cmp    x21, x6\n"
-        "b.lt   " DC_KERNEL_MULT_STRIDE_3 "b\n"
-        "b      " DC_KERNEL_MULT_STRIDE_6 "f\n"
-        DC_KERNEL_MULT_STRIDE_5 ":\n"  // in Loop: Header=BB206_6 Depth=2
-        "and    x22, x20, #0xfffffffc\n"
-        "add    x22, x16, x22\n"
-        "lsl    x23, x10, #2\n"
-        "mov    x25, x22\n"
-        "add    x24, x22, x17\n"
-        "ld1    { v21.s }[1], [x25], x23\n"
-        "ld1    { v22.s }[1], [x24]\n"
-        "add    x23, x22, x10\n"
-        "add    x22, x22, %[function_params]\n"
-        "ld1    { v21.s }[3], [x23]\n"
-        "ld1    { v22.s }[3], [x22]\n"
-        "mov    v24.16b, v19.16b\n"
-        "ld1    { v23.s }[1], [x25]\n"
-        "mov    v25.16b, v19.16b\n"
-        ".word 0x4f95e0b8  // sdot   v24.4s, v5.16b, v21.4b[0]\n"
-        ".word 0x4f96e0b9  // sdot   v25.4s, v5.16b, v22.4b[0]\n"
-        ".word 0x4f95e8f8  // sdot   v24.4s, v7.16b, v21.4b[2]\n"
-        ".word 0x4f96e8f9  // sdot   v25.4s, v7.16b, v22.4b[2]\n"
-        ".word 0x4f96e238  // sdot   v24.4s, v17.16b, v22.4b[0]\n"
-        ".word 0x4f97e239  // sdot   v25.4s, v17.16b, v23.4b[0]\n"
-        "sqrdmulh        v24.4s, v24.4s, v1.4s\n"
-        "sqrdmulh        v25.4s, v25.4s, v1.4s\n"
-        "sqrshl v24.4s, v24.4s, v2.4s\n"
-        "sqrshl v25.4s, v25.4s, v2.4s\n"
-        "sqxtn  v24.4h, v24.4s\n"
-        "sqxtn2 v24.8h, v25.4s\n"
-        "sqadd  v24.8h, v24.8h, v0.8h\n"
-        "sqxtun v24.8b, v24.8h\n"
-        "umax   v24.8b, v24.8b, v3.8b\n"
-        "add    x22, x19, x9\n"
-        "mov    v25.16b, v20.16b\n"
-        "umin   v24.8b, v24.8b, v4.8b\n"
-        "str    s24, [x19]\n"
-        "st1    { v24.s }[1], [x22]\n"
-        "mov    v24.16b, v20.16b\n"
-        ".word 0x4f95e0d9  // sdot   v25.4s, v6.16b, v21.4b[0]\n"
-        ".word 0x4f96e0d8  // sdot   v24.4s, v6.16b, v22.4b[0]\n"
-        ".word 0x4f95ea19  // sdot   v25.4s, v16.16b, v21.4b[2]\n"
-        ".word 0x4f96ea18  // sdot   v24.4s, v16.16b, v22.4b[2]\n"
-        ".word 0x4f96e259  // sdot   v25.4s, v18.16b, v22.4b[0]\n"
-        ".word 0x4f97e258  // sdot   v24.4s, v18.16b, v23.4b[0]\n"
-        "sqrdmulh        v25.4s, v25.4s, v1.4s\n"
-        "sqrdmulh        v24.4s, v24.4s, v1.4s\n"
-        "sqrshl v25.4s, v25.4s, v2.4s\n"
-        "sqrshl v24.4s, v24.4s, v2.4s\n"
-        "sqxtn  v25.4h, v25.4s\n"
-        "sqxtn2 v25.8h, v24.4s\n"
-        "sqadd  v24.8h, v25.8h, v0.8h\n"
-        "sqxtun v24.8b, v24.8h\n"
-        "umax   v24.8b, v24.8b, v3.8b\n"
-        "add    x22, x22, #4\n"  // =4
-        "umin   v24.8b, v24.8b, v4.8b\n"
-        "add    x21, x21, #1\n"  // =1
-        "ushr   v21.2d, v21.2d, #16\n"
-        "ushr   v22.2d, v22.2d, #16\n"
-        "ushr   v23.2d, v23.2d, #16\n"
-        "str    s24, [x19, #4]\n"
-        "st1    { v24.s }[1], [x22]\n"
-        "add    x19, x19, x13\n"
-        "add    x20, x20, #4\n"  // =4
-        DC_KERNEL_MULT_STRIDE_6 ":\n"  // Parent Loop BB206_13 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "cmp    x21, x11\n"
-        "b.lt   " DC_KERNEL_MULT_STRIDE_5 "b\n"
-        "b      " DC_KERNEL_MULT_STRIDE_12 "f\n"
-        DC_KERNEL_MULT_STRIDE_7 ":\n"  // in Loop: Header=BB206_13 Depth=1
-        "mov    x21, xzr\n"
-        "dup    v22.4s, v22.s[0]\n"
-        "b      " DC_KERNEL_MULT_STRIDE_11 "f\n"
-        DC_KERNEL_MULT_STRIDE_8 ":\n"  // in Loop: Header=BB206_11 Depth=2
-        "and    x22, x20, #0xfffffffc\n"
-        "add    x22, x16, x22\n"
-        "mov    x23, x22\n"
-        "ld1    { v21.s }[1], [x23], x17\n"
-        "add    x22, x22, x10\n"
-        "mov    v23.16b, v19.16b\n"
-        "mov    v24.16b, v20.16b\n"
-        "ld1    { v22.s }[1], [x23]\n"
-        "ld1    { v21.s }[3], [x22]\n"
-        "cmp    w15, #2\n"  // =2
-        "ccmp   x5, x20, #0, ne\n"
-        ".word 0x4f96e237  // sdot   v23.4s, v17.16b, v22.4b[0]\n"
-        ".word 0x4f96e258  // sdot   v24.4s, v18.16b, v22.4b[0]\n"
-        ".word 0x4f95e0b7  // sdot   v23.4s, v5.16b, v21.4b[0]\n"
-        ".word 0x4f95e0d8  // sdot   v24.4s, v6.16b, v21.4b[0]\n"
-        ".word 0x4f95e8f7  // sdot   v23.4s, v7.16b, v21.4b[2]\n"
-        ".word 0x4f95ea18  // sdot   v24.4s, v16.16b, v21.4b[2]\n"
-        "sqrdmulh        v23.4s, v23.4s, v1.4s\n"
-        "sqrdmulh        v24.4s, v24.4s, v1.4s\n"
-        "sqrshl v23.4s, v23.4s, v2.4s\n"
-        "sqrshl v24.4s, v24.4s, v2.4s\n"
-        "sqxtn  v25.4h, v23.4s\n"
-        "sqxtn2 v25.8h, v24.4s\n"
-        "sqadd  v24.8h, v25.8h, v0.8h\n"
-        "sqxtun v24.8b, v24.8h\n"
-        "umax   v24.8b, v24.8b, v3.8b\n"
-        "umin   v24.8b, v24.8b, v4.8b\n"
-        "ushr   v23.2d, v21.2d, #16\n"
-        "str    d24, [x19]\n"
-        "ushr   v24.2d, v22.2d, #16\n"
-        "add    x19, x19, x13\n"
-        "b.eq   " DC_KERNEL_MULT_STRIDE_10 "f\n"
-        // %bb.9:        // in Loop: Header=BB206_11 Depth=2
-        "mov    v25.16b, v19.16b\n"
-        "mov    v26.16b, v20.16b\n"
-        ".word 0x4f98e239  // sdot   v25.4s, v17.16b, v24.4b[0]\n"
-        ".word 0x4f98e25a  // sdot   v26.4s, v18.16b, v24.4b[0]\n"
-        ".word 0x4f97e0b9  // sdot   v25.4s, v5.16b, v23.4b[0]\n"
-        ".word 0x4f97e0da  // sdot   v26.4s, v6.16b, v23.4b[0]\n"
-        ".word 0x4f97e8f9  // sdot   v25.4s, v7.16b, v23.4b[2]\n"
-        ".word 0x4f97ea1a  // sdot   v26.4s, v16.16b, v23.4b[2]\n"
-        "ushr   v23.2d, v21.2d, #32\n"
-        "sqrdmulh        v21.4s, v25.4s, v1.4s\n"
-        "ushr   v24.2d, v22.2d, #32\n"
-        "sqrdmulh        v22.4s, v26.4s, v1.4s\n"
-        "sqrshl v21.4s, v21.4s, v2.4s\n"
-        "sqrshl v22.4s, v22.4s, v2.4s\n"
-        "sqxtn  v21.4h, v21.4s\n"
-        "sqxtn2 v21.8h, v22.4s\n"
-        "sqadd  v21.8h, v21.8h, v0.8h\n"
-        "sqxtun v21.8b, v21.8h\n"
-        "umax   v21.8b, v21.8b, v3.8b\n"
-        "umin   v21.8b, v21.8b, v4.8b\n"
-        "str    d21, [x19]\n"
-        "add    x19, x19, x13\n"
-        DC_KERNEL_MULT_STRIDE_10 ":\n"  // in Loop: Header=BB206_11 Depth=2
-        "add    x21, x21, #1\n"  // =1
-        "add    x20, x20, #4\n"  // =4
-        "mov    v22.16b, v24.16b\n"
-        "mov    v21.16b, v23.16b\n"
-        DC_KERNEL_MULT_STRIDE_11 ":\n"  // Parent Loop BB206_13 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "cmp    x21, x11\n"
-        "b.lt   " DC_KERNEL_MULT_STRIDE_8 "b\n"
-        DC_KERNEL_MULT_STRIDE_12 ":\n"  // in Loop: Header=BB206_13 Depth=1
-        "add    x8, x8, #1\n"  // =1
-        DC_KERNEL_MULT_STRIDE_13 ":\n"  // =>This Loop Header: Depth=1
-        // Child Loop BB206_11 Depth 2
-        // Child Loop BB206_4 Depth 2
-        // Child Loop BB206_6 Depth 2
-        "cmp    x8, x12\n"
-        "b.lt   " DC_KERNEL_MULT_STRIDE_1 "b\n"
-        :
-        // Outputs.
-        [ scratch_block_data ] "+r"(scratch_block_data),
-        [ filter_workspace ] "+r"(filter_workspace),
-        [ bias_data ] "+r"(bias_data),
-        [ output_block_data ] "+r"(output_block_data)
-        :
-        // Inputs.
-        [ function_params ] "r"(function_params)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20",
-        "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
-        "x16", "x17", "x19", "x20", "x21", "x22", "x23", "x24", "x25");
-
-#undef DC_KERNEL_MULT_STRIDE_1
-#undef DC_KERNEL_MULT_STRIDE_2
-#undef DC_KERNEL_MULT_STRIDE_3
-#undef DC_KERNEL_MULT_STRIDE_4
-#undef DC_KERNEL_MULT_STRIDE_5
-#undef DC_KERNEL_MULT_STRIDE_6
-#undef DC_KERNEL_MULT_STRIDE_7
-#undef DC_KERNEL_MULT_STRIDE_8
-#undef DC_KERNEL_MULT_STRIDE_9
-#undef DC_KERNEL_MULT_STRIDE_10
-#undef DC_KERNEL_MULT_STRIDE_11
-#undef DC_KERNEL_MULT_STRIDE_12
-#undef DC_KERNEL_MULT_STRIDE_13
-  }
-
-  static void __attribute__((noinline))
-  Run(const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockNeon(scratch_block_data, filter_workspace, bias_data,
-                         output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock {
-  static inline void KernelMacroBlockNeon(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, int8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Note that argument registers may be reused after parameter loading.
-    // x0 %[scratch_block_data]
-    // x1 %[filter_workspace]
-    // x2 %[bias_data]
-    // x3 %[output_block_data]
-    // x4 %[function_params]
-#define DC_KERNEL_NO_MULT_1 "1"
-#define DC_KERNEL_NO_MULT_2 "2"
-#define DC_KERNEL_NO_MULT_3 "3"
-#define DC_KERNEL_NO_MULT_4 "4"
-#define DC_KERNEL_NO_MULT_5 "5"
-#define DC_KERNEL_NO_MULT_6 "6"
-#define DC_KERNEL_NO_MULT_7 "7"
-#define DC_KERNEL_NO_MULT_8 "8"
-#define DC_KERNEL_NO_MULT_9 "9"
-#define DC_KERNEL_NO_MULT_10 "10"
-#define DC_KERNEL_NO_MULT_11 "11"
-#define DC_KERNEL_NO_MULT_12 "12"
-#define DC_KERNEL_NO_MULT_13 "13"
-#define DC_KERNEL_NO_MULT_14 "14"
-#define DC_KERNEL_NO_MULT_15 "15"
-#define DC_KERNEL_NO_MULT_16 "16"
-#define DC_KERNEL_NO_MULT_17 "17"
-#define DC_KERNEL_NO_MULT_18 "18"
-#define DC_KERNEL_NO_MULT_19 "19"
-#define DC_KERNEL_NO_MULT_20 "20"
-#define DC_KERNEL_NO_MULT_21 "21"
-#define DC_KERNEL_NO_MULT_22 "22"
-#define DC_KERNEL_NO_MULT_23 "23"
-#define DC_KERNEL_NO_MULT_24 "24"
-#define DC_KERNEL_NO_MULT_25 "25"
-#define DC_KERNEL_NO_MULT_26 "26"
-#define DC_KERNEL_NO_MULT_27 "27"
-#define DC_KERNEL_NO_MULT_28 "28"
-#define DC_KERNEL_NO_MULT_29 "29"
-#define DC_KERNEL_NO_MULT_30 "30"
-#define DC_KERNEL_NO_MULT_31 "31"
-#define DC_KERNEL_NO_MULT_32 "32"
-#define DC_KERNEL_NO_MULT_33 "33"
-
-    asm volatile(
-        // Compiled code used block of 384 for spill out of total stack of 528.
-        "sub    sp, sp, #384\n"  // =528
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_DEPTH_MICRO_REPEATS) "]\n"
-        "str    %[scratch_block_data], [sp, #376]\n"  // 8-byte Folded Spill
-        "cmp    w8, #1\n"  // =1
-        "str    x8, [sp, #56]\n"  // 8-byte Folded Spill
-        "b.lt   " DC_KERNEL_NO_MULT_33 "f\n"
-        // %bb.1:
-        "stp    xzr, xzr, [sp, #72]\n"  // 16-byte Folded Spill
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "str    xzr, [sp, #88]\n"  // 8-byte Folded Spill
-        "ldpsw  x22, x5, [%[function_params], #" STR(DP_OFFSET_OUTPUT_HEIGHT_STRIDE) "]\n"
-        "ldr    x11, [%[function_params], #" STR(DP_OFFSET_OUTPUT_MULTPLIPLIER_PER_CHANNEL) "]\n"
-        "str    w8, [sp, #340]\n"  // 4-byte Folded Spill
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_OUTPUT_WIDTH_MICRO_REPEATS) "]\n"
-        "ldrb   w9, [%[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MAX) "]\n"
-        "str    x11, [sp, #40]\n"  // 8-byte Folded Spill
-        "ldr    x11, [%[function_params], #" STR(DP_OFFSET_OUTPUT_SHIFT_PER_CHANNEL) "]\n"
-        "str    w8, [sp, #344]\n"  // 4-byte Folded Spill
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_OUTPUT_RESIDUAL_WIDTH) "]\n"
-        "ldrsw  x7, [%[function_params]]\n"
-        "str    x11, [sp, #32]\n"  // 8-byte Folded Spill
-        "ldrsw  x11, [%[function_params], #" STR(DP_OFFSET_INPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "str    w8, [sp, #348]\n"  // 4-byte Folded Spill
-        "ldrb   w8, [%[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MIN) "]\n"
-        "ldr    x26, [sp, #376]\n"  // 8-byte Folded Reload
-        "mov    x23, %[output_block_data]\n"
-        "add    x10, %[function_params], #" STR(DP_OFFSET_OUTPUT_OFFSET) "\n"  // =28
-        "dup    v5.16b, w8\n"
-        "fmov   s3, w8\n"
-        "lsl    x8, x11, #5\n"
-        "dup    v6.16b, w9\n"
-        "fmov   s4, w9\n"
-        "str    x8, [sp, #48]\n"  // 8-byte Folded Spill
-        "add    x8, x5, x26\n"
-        "lsl    x9, x7, #1\n"
-        "ld1r   { v0.8h }, [x10]\n"
-        "add    x13, x5, x5, lsl #1\n"
-        "add    x10, x22, x7\n"
-        "add    x28, x8, #32\n"  // =32
-        "add    x8, x23, x9\n"
-        "str    x13, [sp, #312]\n"  // 8-byte Folded Spill
-        "add    x13, x13, x26\n"
-        "str    x8, [sp, #360]\n"  // 8-byte Folded Spill
-        "add    x8, x23, x10\n"
-        "str    x8, [sp, #352]\n"  // 8-byte Folded Spill
-        "add    x8, x13, #32\n"  // =32
-        "ldr    w6, [%[function_params], #" STR(DP_OFFSET_OUTBOUND_BLOCK_HEIGHT) "]\n"
-        "lsl    x12, x5, #2\n"
-        "add    x11, x5, x5, lsl #2\n"
-        "add    x24, x22, x22, lsl #1\n"
-        "str    x8, [sp, #368]\n"  // 8-byte Folded Spill
-        "lsl    x8, x5, #1\n"
-        "mov    %[output_block_data], %[filter_workspace]\n"
-        "lsl    %[filter_workspace], x22, #1\n"
-        "stp    x11, x12, [sp, #296]\n"  // 16-byte Folded Spill
-        "add    x11, x11, x26\n"
-        "add    x12, x12, x26\n"
-        "add    x14, x9, x7\n"
-        "add    x15, x9, x24\n"
-        "stp    x8, x5, [sp, #320]\n"  // 16-byte Folded Spill
-        "add    x8, x8, x26\n"
-        "add    x10, x11, #32\n"  // =32
-        "add    x11, x12, #32\n"  // =32
-        "add    x19, x8, #32\n"  // =32
-        "add    x12, x14, x24\n"
-        "add    x13, x14, %[filter_workspace]\n"
-        "add    x8, x14, x22\n"
-        "add    x25, x23, x14\n"
-        "add    x14, x23, x15\n"
-        "add    x17, x9, x22\n"
-        "mov    %[scratch_block_data], x19\n"
-        "mov    x19, x14\n"
-        "add    x14, x24, x7\n"
-        "add    x21, x23, x17\n"
-        "mov    w17, w6\n"
-        "add    x15, x23, x14\n"
-        "add    x14, %[filter_workspace], x7\n"
-        "add    x6, x23, x12\n"
-        "add    x12, x23, x13\n"
-        "add    %[function_params], x23, x14\n"
-        "mov    x14, x12\n"
-        "and    w12, w17, #0xfffffffe\n"
-        "str    w12, [sp, #20]\n"  // 4-byte Folded Spill
-        "lsl    x12, x7, #2\n"
-        "str    x12, [sp, #152]\n"  // 8-byte Folded Spill
-        "add    x12, x23, x22\n"
-        "str    x12, [sp, #144]\n"  // 8-byte Folded Spill
-        "add    x12, x23, x7\n"
-        "add    x16, x9, %[filter_workspace]\n"
-        "str    x12, [sp, #136]\n"  // 8-byte Folded Spill
-        "add    x12, x23, %[filter_workspace]\n"
-        "dup    v7.8b, v3.b[0]\n"
-        "dup    v14.8b, v4.b[0]\n"
-        "add    x20, x23, x16\n"
-        "mov    x13, x15\n"
-        "add    x15, x23, x8\n"
-        "mov    x5, %[filter_workspace]\n"
-        "str    x12, [sp, #128]\n"  // 8-byte Folded Spill
-        "mov    x8, x24\n"
-        "add    x12, x23, x24\n"
-        "mov    w1, #4\n"
-        "stp    x23, x12, [sp, #112]\n"  // 16-byte Folded Spill
-        "str    x26, [sp, #264]\n"  // 8-byte Folded Spill
-        "str    x22, [sp, #200]\n"  // 8-byte Folded Spill
-        "str    w17, [sp, #108]\n"  // 4-byte Folded Spill
-        "str    %[scratch_block_data], [sp, #96]\n"  // 8-byte Folded Spill
-        "str    x23, [sp, #24]\n"  // 8-byte Folded Spill
-        "stp    d14, d7, [sp, #160]\n"  // 16-byte Folded Spill
-        "b      " DC_KERNEL_NO_MULT_4 "f\n"
-        DC_KERNEL_NO_MULT_2 ":\n"  // in Loop: Header=BB111_4 Depth=1
-        "mov    %[bias_data], x9\n"
-        DC_KERNEL_NO_MULT_3 ":\n"  // in Loop: Header=BB111_4 Depth=1
-        "ldr    %[output_block_data], [sp, #48]\n"  // 8-byte Folded Reload
-        "ldr    x12, [sp, #264]\n"  // 8-byte Folded Reload
-        "ldr    x17, [sp, #88]\n"  // 8-byte Folded Reload
-        "add    x12, x12, %[output_block_data]\n"
-        "str    x12, [sp, #264]\n"  // 8-byte Folded Spill
-        "ldr    x12, [sp, #112]\n"  // 8-byte Folded Reload
-        "add    x17, x17, #1\n"  // =1
-        "add    x12, x12, #8\n"  // =8
-        "str    x12, [sp, #112]\n"  // 8-byte Folded Spill
-        "ldr    x12, [sp, #72]\n"  // 8-byte Folded Reload
-        "add    x12, x12, %[output_block_data]\n"
-        "str    x12, [sp, #72]\n"  // 8-byte Folded Spill
-        "ldp    x12, %[output_block_data], [sp, #56]\n"  // 16-byte Folded Reload
-        "cmp    x17, x12\n"
-        "ldr    x12, [sp, #80]\n"  // 8-byte Folded Reload
-        "add    x12, x12, #8\n"  // =8
-        "stp    x12, x17, [sp, #80]\n"  // 16-byte Folded Spill
-        "ldr    w17, [sp, #108]\n"  // 4-byte Folded Reload
-        "b.eq   " DC_KERNEL_NO_MULT_33 "f\n"
-        DC_KERNEL_NO_MULT_4 ":\n"  // =>This Loop Header: Depth=1
-        // Child Loop BB111_29 Depth 2
-        // Child Loop BB111_32 Depth 2
-        // Child Loop BB111_20 Depth 2
-        // Child Loop BB111_22 Depth 3
-        // Child Loop BB111_25 Depth 4
-        // Child Loop BB111_7 Depth 2
-        // Child Loop BB111_9 Depth 3
-        // Child Loop BB111_15 Depth 3
-        "ldp    q16, q15, [%[output_block_data]]\n"
-        "ldp    q17, q3, [%[output_block_data], #32]\n"
-        "ldp    q18, q4, [%[output_block_data], #64]\n"
-        "cmp    w17, #4\n"  // =4
-        "add    %[output_block_data], x3, #96\n"  // =96
-        "str    %[output_block_data], [sp, #64]\n"  // 8-byte Folded Spill
-        "b.ne   " DC_KERNEL_NO_MULT_16 "f\n"
-        // %bb.5:        // in Loop: Header=BB111_4 Depth=1
-        "ldp    x24, x12, [sp, #80]\n"  // 16-byte Folded Reload
-        "ldr    x17, [sp, #32]\n"  // 8-byte Folded Reload
-        "ldr    x26, [sp, #72]\n"  // 8-byte Folded Reload
-        "mov    x9, xzr\n"
-        "lsl    w12, w12, #3\n"
-        "lsl    x12, x12, #2\n"
-        "add    x16, x17, x12\n"
-        "ldr    x17, [sp, #40]\n"  // 8-byte Folded Reload
-        "stp    q4, q3, [sp, #224]\n"  // 32-byte Folded Spill
-        "str    q15, [sp, #176]\n"  // 16-byte Folded Spill
-        "add    x12, x17, x12\n"
-        "stp    x12, x16, [sp, #208]\n"  // 16-byte Folded Spill
-        "b      " DC_KERNEL_NO_MULT_7 "f\n"
-        DC_KERNEL_NO_MULT_6 ":\n"  // in Loop: Header=BB111_7 Depth=2
-        "ldp    q18, q17, [sp, #224]\n"  // 32-byte Folded Reload
-        "add    x9, x9, #1\n"  // =1
-        "add    x26, x26, #16\n"  // =16
-        "cmp    x9, #2\n"  // =2
-        "add    x24, x24, #4\n"  // =4
-        "mov    v16.16b, v15.16b\n"
-        "b.eq   " DC_KERNEL_NO_MULT_3 "b\n"
-        DC_KERNEL_NO_MULT_7 ":\n"  // Parent Loop BB111_4 Depth=1
-        // =>  This Loop Header: Depth=2
-        // Child Loop BB111_9 Depth 3
-        // Child Loop BB111_15 Depth 3
-        "ldr    q19, [%[bias_data]], #16\n"
-        "ldr    x16, [sp, #264]\n"  // 8-byte Folded Reload
-        "lsl    x12, x9, #4\n"
-        "ldr    w17, [sp, #344]\n"  // 4-byte Folded Reload
-        "mov    v31.16b, v19.16b\n"
-        "add    %[output_block_data], x16, x12\n"
-        "ldr    x16, [sp, #216]\n"  // 8-byte Folded Reload
-        "ldr    q22, [%[output_block_data]]\n"
-        "mov    v8.16b, v19.16b\n"
-        "mov    v9.16b, v19.16b\n"
-        "ldr    q20, [x16, x12]\n"
-        "ldr    x16, [sp, #208]\n"  // 8-byte Folded Reload
-        "mov    v10.16b, v19.16b\n"
-        "cmp    w17, #1\n"  // =1
-        "ldr    q21, [x16, x12]\n"
-        "ldr    x12, [sp, #328]\n"  // 8-byte Folded Reload
-        "ldr    q27, [%[output_block_data], x12]\n"
-        "ldr    x12, [sp, #320]\n"  // 8-byte Folded Reload
-        "ldr    q26, [%[output_block_data], x12]\n"
-        "ldr    x12, [sp, #312]\n"  // 8-byte Folded Reload
-        ".word 0x4e9a965f  // sdot   v31.4s, v18.16b, v26.16b\n"
-        "ldr    q25, [%[output_block_data], x12]\n"
-        "ldr    x12, [sp, #304]\n"  // 8-byte Folded Reload
-        ".word 0x4e9a9628  // sdot   v8.4s, v17.16b, v26.16b\n"
-        ".word 0x4e9a9609  // sdot   v9.4s, v16.16b, v26.16b\n"
-        ".word 0x4e99960a  // sdot   v10.4s, v16.16b, v25.16b\n"
-        "ldr    q24, [%[output_block_data], x12]\n"
-        "ldr    x12, [sp, #296]\n"  // 8-byte Folded Reload
-        "ldr    q23, [%[output_block_data], x12]\n"
-        "b.lt   " DC_KERNEL_NO_MULT_11 "f\n"
-        // %bb.8:        // in Loop: Header=BB111_7 Depth=2
-        "stp    x24, x9, [sp, #280]\n"  // 16-byte Folded Spill
-        "ldr    w12, [sp, #344]\n"  // 4-byte Folded Reload
-        "mov    x17, x24\n"
-        "str    x26, [sp, #272]\n"  // 8-byte Folded Spill
-        "mov    x22, x26\n"
-        "ldp    x27, x24, [sp, #144]\n"  // 16-byte Folded Reload
-        "ldp    x26, %[filter_workspace], [sp, #128]\n"  // 16-byte Folded Reload
-        "ldr    x16, [sp, #120]\n"  // 8-byte Folded Reload
-        "shl    v28.4s, v16.4s, #8\n"
-        "shl    v29.4s, v17.4s, #8\n"
-        "shl    v30.4s, v18.4s, #8\n"
-        "mov    v11.16b, v23.16b\n"
-        "mov    v12.16b, v24.16b\n"
-        "mov    v13.16b, v27.16b\n"
-        "mov    v14.16b, v22.16b\n"
-        DC_KERNEL_NO_MULT_9 ":\n"  // Parent Loop BB111_4 Depth=1
-        // Parent Loop BB111_7 Depth=2
-        // =>  This Inner Loop Header: Depth=3
-        ".word 0x4e8e961f  // sdot   v31.4s, v16.16b, v14.16b\n"
-        ".word 0x4e8d9608  // sdot   v8.4s, v16.16b, v13.16b\n"
-        ".word 0x4e999629  // sdot   v9.4s, v17.16b, v25.16b\n"
-        ".word 0x4e8d963f  // sdot   v31.4s, v17.16b, v13.16b\n"
-        ".word 0x4e8c962a  // sdot   v10.4s, v17.16b, v12.16b\n"
-        ".word 0x4e999648  // sdot   v8.4s, v18.16b, v25.16b\n"
-        ".word 0x4e8c9649  // sdot   v9.4s, v18.16b, v12.16b\n"
-        "sqrdmulh        v31.4s, v31.4s, v21.4s\n"
-        ".word 0x4e8b964a  // sdot   v10.4s, v18.16b, v11.16b\n"
-        "sqrdmulh        v8.4s, v8.4s, v21.4s\n"
-        "sqrdmulh        v9.4s, v9.4s, v21.4s\n"
-        "sqrshl v31.4s, v31.4s, v20.4s\n"
-        "sqrdmulh        v10.4s, v10.4s, v21.4s\n"
-        "sqrshl v8.4s, v8.4s, v20.4s\n"
-        "sqrshl v9.4s, v9.4s, v20.4s\n"
-        "sqxtn  v31.4h, v31.4s\n"
-        "sqrshl v10.4s, v10.4s, v20.4s\n"
-        "sqxtn  v9.4h, v9.4s\n"
-        "sqxtn2 v31.8h, v8.4s\n"
-        "sqxtn2 v9.8h, v10.4s\n"
-        "sqadd  v31.8h, v31.8h, v0.8h\n"
-        "sqadd  v8.8h, v9.8h, v0.8h\n"
-        "sqxtn  v31.8b, v31.8h\n"
-        "sqxtn2 v31.16b, v8.8h\n"
-        "smax   v31.16b, v31.16b, v5.16b\n"
-        "add    %[output_block_data], x27, x17\n"
-        "smin   v31.16b, v31.16b, v6.16b\n"
-        "str    s31, [x23, x17]\n"
-        "st1    { v31.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], x26, x17\n"
-        "st1    { v31.s }[2], [%[output_block_data]]\n"
-        "add    %[output_block_data], x16, x17\n"
-        "st1    { v31.s }[3], [%[output_block_data]]\n"
-        "ldr    %[output_block_data], [sp, #376]\n"  // 8-byte Folded Reload
-        "mov    v10.16b, v19.16b\n"
-        "mov    v31.16b, v19.16b\n"
-        "mov    v8.16b, v19.16b\n"
-        "ldr    x9, [sp, #352]\n"  // 8-byte Folded Reload
-        ".word 0x4e99978a  // sdot   v10.4s, v28.16b, v25.16b\n"
-        ".word 0x4e8e979f  // sdot   v31.4s, v28.16b, v14.16b\n"
-        ".word 0x4e8d9788  // sdot   v8.4s, v28.16b, v13.16b\n"
-        ".word 0x4e8c97aa  // sdot   v10.4s, v29.16b, v12.16b\n"
-        "mov    v9.16b, v19.16b\n"
-        ".word 0x4e8d97bf  // sdot   v31.4s, v29.16b, v13.16b\n"
-        ".word 0x4e9a97a8  // sdot   v8.4s, v29.16b, v26.16b\n"
-        ".word 0x4e8b97ca  // sdot   v10.4s, v30.16b, v11.16b\n"
-        "add    %[output_block_data], x3, x22\n"
-        "rev32  v2.8h, v26.8h\n"
-        ".word 0x4e9a9789  // sdot   v9.4s, v28.16b, v26.16b\n"
-        ".word 0x4e9a97df  // sdot   v31.4s, v30.16b, v26.16b\n"
-        ".word 0x4e9997c8  // sdot   v8.4s, v30.16b, v25.16b\n"
-        "sqrdmulh        v26.4s, v10.4s, v21.4s\n"
-        "rev32  v15.8h, v22.8h\n"
-        "ldr    q22, [%[output_block_data], #32]\n"
-        "add    %[output_block_data], x9, x17\n"
-        "rev32  v4.8h, v24.8h\n"
-        ".word 0x4e9997a9  // sdot   v9.4s, v29.16b, v25.16b\n"
-        "sqrdmulh        v24.4s, v8.4s, v21.4s\n"
-        "sqrshl v8.4s, v26.4s, v20.4s\n"
-        "ldr    q26, [%[scratch_block_data], x22]\n"
-        "mov    x9, %[scratch_block_data]\n"
-        "ldr    %[scratch_block_data], [sp, #368]\n"  // 8-byte Folded Reload
-        "mov    v7.16b, v6.16b\n"
-        "mov    v6.16b, v5.16b\n"
-        "rev32  v5.8h, v23.8h\n"
-        ".word 0x4e8c97c9  // sdot   v9.4s, v30.16b, v12.16b\n"
-        "sqrdmulh        v23.4s, v31.4s, v21.4s\n"
-        "rev32  v3.8h, v25.8h\n"
-        "sqrdmulh        v25.4s, v9.4s, v21.4s\n"
-        "sqrshl v23.4s, v23.4s, v20.4s\n"
-        "sqrshl v31.4s, v24.4s, v20.4s\n"
-        "sqrshl v24.4s, v25.4s, v20.4s\n"
-        "sqxtn  v9.4h, v23.4s\n"
-        "rev32  v1.8h, v27.8h\n"
-        "sqxtn  v10.4h, v24.4s\n"
-        "ldr    q27, [x28, x22]\n"
-        "ldr    q25, [%[scratch_block_data], x22]\n"
-        "ldr    q24, [x11, x22]\n"
-        "ldr    q23, [x10, x22]\n"
-        "sqxtn2 v9.8h, v31.4s\n"
-        "sqxtn2 v10.8h, v8.4s\n"
-        "sqadd  v31.8h, v9.8h, v0.8h\n"
-        "sqadd  v8.8h, v10.8h, v0.8h\n"
-        "sqxtn  v31.8b, v31.8h\n"
-        "sqxtn2 v31.16b, v8.8h\n"
-        "smax   v31.16b, v31.16b, v6.16b\n"
-        "smin   v31.16b, v31.16b, v7.16b\n"
-        "str    s31, [%[filter_workspace], x17]\n"
-        "st1    { v31.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], %[function_params], x17\n"
-        "st1    { v31.s }[2], [%[output_block_data]]\n"
-        "add    %[output_block_data], x13, x17\n"
-        "mov    v8.16b, v19.16b\n"
-        "st1    { v31.s }[3], [%[output_block_data]]\n"
-        "trn1   v31.8h, v15.8h, v22.8h\n"
-        "mov    v9.16b, v19.16b\n"
-        "mov    v10.16b, v19.16b\n"
-        "trn1   v1.8h, v1.8h, v27.8h\n"
-        "trn1   v2.8h, v2.8h, v26.8h\n"
-        ".word 0x4e9f9608  // sdot   v8.4s, v16.16b, v31.16b\n"
-        "mov    v11.16b, v19.16b\n"
-        "trn1   v3.8h, v3.8h, v25.8h\n"
-        ".word 0x4e819609  // sdot   v9.4s, v16.16b, v1.16b\n"
-        ".word 0x4e82960a  // sdot   v10.4s, v16.16b, v2.16b\n"
-        ".word 0x4e819628  // sdot   v8.4s, v17.16b, v1.16b\n"
-        "trn1   v4.8h, v4.8h, v24.8h\n"
-        ".word 0x4e83960b  // sdot   v11.4s, v16.16b, v3.16b\n"
-        ".word 0x4e829629  // sdot   v9.4s, v17.16b, v2.16b\n"
-        ".word 0x4e83962a  // sdot   v10.4s, v17.16b, v3.16b\n"
-        ".word 0x4e829648  // sdot   v8.4s, v18.16b, v2.16b\n"
-        "trn1   v5.8h, v5.8h, v23.8h\n"
-        ".word 0x4e84962b  // sdot   v11.4s, v17.16b, v4.16b\n"
-        ".word 0x4e839649  // sdot   v9.4s, v18.16b, v3.16b\n"
-        ".word 0x4e84964a  // sdot   v10.4s, v18.16b, v4.16b\n"
-        "sqrdmulh        v8.4s, v8.4s, v21.4s\n"
-        ".word 0x4e85964b  // sdot   v11.4s, v18.16b, v5.16b\n"
-        "sqrdmulh        v9.4s, v9.4s, v21.4s\n"
-        "sqrdmulh        v10.4s, v10.4s, v21.4s\n"
-        "sqrshl v8.4s, v8.4s, v20.4s\n"
-        "sqrdmulh        v11.4s, v11.4s, v21.4s\n"
-        "sqrshl v9.4s, v9.4s, v20.4s\n"
-        "sqrshl v10.4s, v10.4s, v20.4s\n"
-        "sqxtn  v8.4h, v8.4s\n"
-        "sqrshl v11.4s, v11.4s, v20.4s\n"
-        "sqxtn  v10.4h, v10.4s\n"
-        "sqxtn2 v8.8h, v9.4s\n"
-        "sqxtn2 v10.8h, v11.4s\n"
-        "sqadd  v8.8h, v8.8h, v0.8h\n"
-        "sqadd  v9.8h, v10.8h, v0.8h\n"
-        "sqxtn  v8.8b, v8.8h\n"
-        "sqxtn2 v8.16b, v9.8h\n"
-        "mov    v9.16b, v19.16b\n"
-        "ldr    %[scratch_block_data], [sp, #360]\n"  // 8-byte Folded Reload
-        "mov    v10.16b, v19.16b\n"
-        "mov    v11.16b, v19.16b\n"
-        ".word 0x4e9f9789  // sdot   v9.4s, v28.16b, v31.16b\n"
-        "mov    v12.16b, v19.16b\n"
-        ".word 0x4e81978a  // sdot   v10.4s, v28.16b, v1.16b\n"
-        ".word 0x4e82978b  // sdot   v11.4s, v28.16b, v2.16b\n"
-        ".word 0x4e8197a9  // sdot   v9.4s, v29.16b, v1.16b\n"
-        "smax   v8.16b, v8.16b, v6.16b\n"
-        ".word 0x4e83978c  // sdot   v12.4s, v28.16b, v3.16b\n"
-        ".word 0x4e8297aa  // sdot   v10.4s, v29.16b, v2.16b\n"
-        ".word 0x4e8397ab  // sdot   v11.4s, v29.16b, v3.16b\n"
-        ".word 0x4e8297c9  // sdot   v9.4s, v30.16b, v2.16b\n"
-        "add    %[output_block_data], x21, x17\n"
-        "smin   v8.16b, v8.16b, v7.16b\n"
-        ".word 0x4e8497ac  // sdot   v12.4s, v29.16b, v4.16b\n"
-        ".word 0x4e8397ca  // sdot   v10.4s, v30.16b, v3.16b\n"
-        ".word 0x4e8497cb  // sdot   v11.4s, v30.16b, v4.16b\n"
-        "sqrdmulh        v1.4s, v9.4s, v21.4s\n"
-        "str    s8, [%[scratch_block_data], x17]\n"
-        "st1    { v8.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], x20, x17\n"
-        ".word 0x4e8597cc  // sdot   v12.4s, v30.16b, v5.16b\n"
-        "sqrdmulh        v2.4s, v10.4s, v21.4s\n"
-        "sqrdmulh        v3.4s, v11.4s, v21.4s\n"
-        "sqrshl v1.4s, v1.4s, v20.4s\n"
-        "st1    { v8.s }[2], [%[output_block_data]]\n"
-        "add    %[output_block_data], x19, x17\n"
-        "sqrdmulh        v4.4s, v12.4s, v21.4s\n"
-        "sqrshl v2.4s, v2.4s, v20.4s\n"
-        "sqrshl v3.4s, v3.4s, v20.4s\n"
-        "sqxtn  v1.4h, v1.4s\n"
-        "st1    { v8.s }[3], [%[output_block_data]]\n"
-        "sqrshl v4.4s, v4.4s, v20.4s\n"
-        "sqxtn  v3.4h, v3.4s\n"
-        "sqxtn2 v1.8h, v2.4s\n"
-        "sqxtn2 v3.8h, v4.4s\n"
-        "sqadd  v1.8h, v1.8h, v0.8h\n"
-        "sqadd  v2.8h, v3.8h, v0.8h\n"
-        "sqxtn  v1.8b, v1.8h\n"
-        "mov    v5.16b, v6.16b\n"
-        "sqxtn2 v1.16b, v2.8h\n"
-        "smax   v1.16b, v1.16b, v5.16b\n"
-        "add    %[output_block_data], x15, x17\n"
-        "smin   v1.16b, v1.16b, v7.16b\n"
-        "str    s1, [x25, x17]\n"
-        "st1    { v1.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], x14, x17\n"
-        "mov    v31.16b, v19.16b\n"
-        "mov    v8.16b, v19.16b\n"
-        "mov    v9.16b, v19.16b\n"
-        "mov    v10.16b, v19.16b\n"
-        "mov    %[scratch_block_data], x9\n"
-        "mov    v6.16b, v7.16b\n"
-        "st1    { v1.s }[2], [%[output_block_data]]\n"
-        "add    %[output_block_data], x6, x17\n"
-        "subs   w12, w12, #1\n"  // =1
-        "add    x22, x22, #32\n"  // =32
-        ".word 0x4e9a965f  // sdot   v31.4s, v18.16b, v26.16b\n"
-        ".word 0x4e9a9628  // sdot   v8.4s, v17.16b, v26.16b\n"
-        ".word 0x4e9a9609  // sdot   v9.4s, v16.16b, v26.16b\n"
-        ".word 0x4e99960a  // sdot   v10.4s, v16.16b, v25.16b\n"
-        "add    x17, x17, x24\n"
-        "mov    v11.16b, v23.16b\n"
-        "mov    v12.16b, v24.16b\n"
-        "mov    v13.16b, v27.16b\n"
-        "mov    v14.16b, v22.16b\n"
-        "st1    { v1.s }[3], [%[output_block_data]]\n"
-        "b.ne   " DC_KERNEL_NO_MULT_9 "b\n"
-        // %bb.10:        // in Loop: Header=BB111_7 Depth=2
-        "ldr    x12, [sp, #376]\n"  // 8-byte Folded Reload
-        "ldp    d14, d7, [sp, #160]\n"  // 16-byte Folded Reload
-        "ldr    q15, [sp, #176]\n"  // 16-byte Folded Reload
-        "ldp    x24, x9, [sp, #280]\n"  // 16-byte Folded Reload
-        "add    %[output_block_data], x12, x22\n"
-        "ldr    x22, [sp, #200]\n"  // 8-byte Folded Reload
-        "ldr    x26, [sp, #272]\n"  // 8-byte Folded Reload
-        "add    x12, x23, x17\n"
-        "mov    w1, #4\n"
-        "ldr    w17, [sp, #348]\n"  // 4-byte Folded Reload
-        "cmp    w17, #0\n"  // =0
-        "b.gt   " DC_KERNEL_NO_MULT_12 "f\n"
-        "b      " DC_KERNEL_NO_MULT_6 "b\n"
-        DC_KERNEL_NO_MULT_11 ":\n"  // in Loop: Header=BB111_7 Depth=2
-        "ldr    x12, [sp, #112]\n"  // 8-byte Folded Reload
-        "add    x12, x12, x9, lsl #2\n"
-        "ldr    w17, [sp, #348]\n"  // 4-byte Folded Reload
-        "cmp    w17, #0\n"  // =0
-        "b.le   " DC_KERNEL_NO_MULT_6 "b\n"
-        DC_KERNEL_NO_MULT_12 ":\n"  // in Loop: Header=BB111_7 Depth=2
-        "ldr    w17, [sp, #348]\n"  // 4-byte Folded Reload
-        "movi   v28.16b, #0\n"
-        "movi   v29.16b, #0\n"
-        "movi   v30.16b, #0\n"
-        "cmp    w17, #3\n"  // =3
-        "movi   v11.16b, #0\n"
-        "movi   v12.16b, #0\n"
-        "movi   v13.16b, #0\n"
-        "b.lt   " DC_KERNEL_NO_MULT_14 "f\n"
-        // %bb.13:        // in Loop: Header=BB111_7 Depth=2
-        "add    x17, %[output_block_data], #32\n"  // =32
-        "ldp    x16, %[output_block_data], [sp, #320]\n"  // 16-byte Folded Reload
-        "ldr    q13, [x17]\n"
-        "ldr    %[scratch_block_data], [sp, #96]\n"  // 8-byte Folded Reload
-        "ldr    q12, [x17, %[output_block_data]]\n"
-        "ldr    %[output_block_data], [sp, #312]\n"  // 8-byte Folded Reload
-        "ldr    q11, [x17, x16]\n"
-        "ldr    q30, [x17, %[output_block_data]]\n"
-        "ldr    %[output_block_data], [sp, #304]\n"  // 8-byte Folded Reload
-        "ldr    q29, [x17, %[output_block_data]]\n"
-        "ldr    %[output_block_data], [sp, #296]\n"  // 8-byte Folded Reload
-        "ldr    q28, [x17, %[output_block_data]]\n"
-        DC_KERNEL_NO_MULT_14 ":\n"  // in Loop: Header=BB111_7 Depth=2
-        "ldr    w17, [sp, #348]\n"  // 4-byte Folded Reload
-        DC_KERNEL_NO_MULT_15 ":\n"  // Parent Loop BB111_4 Depth=1
-        // Parent Loop BB111_7 Depth=2
-        // =>  This Inner Loop Header: Depth=3
-        ".word 0x4e96961f  // sdot   v31.4s, v16.16b, v22.16b\n"
-        ".word 0x4e9b9608  // sdot   v8.4s, v16.16b, v27.16b\n"
-        ".word 0x4e999629  // sdot   v9.4s, v17.16b, v25.16b\n"
-        ".word 0x4e9b963f  // sdot   v31.4s, v17.16b, v27.16b\n"
-        ".word 0x4e98962a  // sdot   v10.4s, v17.16b, v24.16b\n"
-        ".word 0x4e999648  // sdot   v8.4s, v18.16b, v25.16b\n"
-        ".word 0x4e989649  // sdot   v9.4s, v18.16b, v24.16b\n"
-        "sqrdmulh        v1.4s, v31.4s, v21.4s\n"
-        ".word 0x4e97964a  // sdot   v10.4s, v18.16b, v23.16b\n"
-        "sqrdmulh        v2.4s, v8.4s, v21.4s\n"
-        "sqrdmulh        v3.4s, v9.4s, v21.4s\n"
-        "sqrshl v1.4s, v1.4s, v20.4s\n"
-        "sqrdmulh        v4.4s, v10.4s, v21.4s\n"
-        "sqrshl v2.4s, v2.4s, v20.4s\n"
-        "sqrshl v3.4s, v3.4s, v20.4s\n"
-        "sqxtn  v1.4h, v1.4s\n"
-        "sqrshl v4.4s, v4.4s, v20.4s\n"
-        "sqxtn  v3.4h, v3.4s\n"
-        "sqxtn2 v1.8h, v2.4s\n"
-        "sqxtn2 v3.8h, v4.4s\n"
-        "sqadd  v1.8h, v1.8h, v0.8h\n"
-        "sqadd  v2.8h, v3.8h, v0.8h\n"
-        "sqxtn  v1.8b, v1.8h\n"
-        "sqxtn2 v1.16b, v2.8h\n"
-        "smax   v1.16b, v1.16b, v5.16b\n"
-        "add    %[output_block_data], x12, x22\n"
-        "smin   v1.16b, v1.16b, v6.16b\n"
-        "ushr   v26.4s, v26.4s, #8\n"
-        "ushr   v25.4s, v25.4s, #8\n"
-        "str    s1, [x12]\n"
-        "st1    { v1.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], x12, x5\n"
-        "ushr   v22.4s, v22.4s, #8\n"
-        "ushr   v27.4s, v27.4s, #8\n"
-        "sli    v26.4s, v11.4s, #24\n"
-        "ushr   v24.4s, v24.4s, #8\n"
-        "ushr   v23.4s, v23.4s, #8\n"
-        "sli    v25.4s, v30.4s, #24\n"
-        "mov    v31.16b, v19.16b\n"
-        "mov    v8.16b, v19.16b\n"
-        "mov    v9.16b, v19.16b\n"
-        "mov    v10.16b, v19.16b\n"
-        "st1    { v1.s }[2], [%[output_block_data]]\n"
-        "add    %[output_block_data], x12, x8\n"
-        "subs   w17, w17, #1\n"  // =1
-        "sli    v22.4s, v13.4s, #24\n"
-        "ushr   v13.4s, v13.4s, #8\n"
-        "ushr   v11.4s, v11.4s, #8\n"
-        "sli    v27.4s, v12.4s, #24\n"
-        "ushr   v12.4s, v12.4s, #8\n"
-        "ushr   v30.4s, v30.4s, #8\n"
-        "sli    v24.4s, v29.4s, #24\n"
-        "ushr   v29.4s, v29.4s, #8\n"
-        "sli    v23.4s, v28.4s, #24\n"
-        "ushr   v28.4s, v28.4s, #8\n"
-        ".word 0x4e9a965f  // sdot   v31.4s, v18.16b, v26.16b\n"
-        ".word 0x4e9a9628  // sdot   v8.4s, v17.16b, v26.16b\n"
-        ".word 0x4e9a9609  // sdot   v9.4s, v16.16b, v26.16b\n"
-        "add    x12, x12, x7\n"
-        ".word 0x4e99960a  // sdot   v10.4s, v16.16b, v25.16b\n"
-        "st1    { v1.s }[3], [%[output_block_data]]\n"
-        "b.ne   " DC_KERNEL_NO_MULT_15 "b\n"
-        "b      " DC_KERNEL_NO_MULT_6 "b\n"
-        DC_KERNEL_NO_MULT_16 ":\n"  // in Loop: Header=BB111_4 Depth=1
-        "cmp    w17, #1\n"  // =1
-        "add    x9, %[bias_data], #32\n"  // =32
-        "b.lt   " DC_KERNEL_NO_MULT_2 "b\n"
-        // %bb.17:        // in Loop: Header=BB111_4 Depth=1
-        "ldr    w12, [sp, #340]\n"  // 4-byte Folded Reload
-        "cmp    w12, #1\n"  // =1
-        "b.lt   " DC_KERNEL_NO_MULT_27 "f\n"
-        // %bb.18:        // in Loop: Header=BB111_4 Depth=1
-        "ldr    x12, [sp, #88]\n"  // 8-byte Folded Reload
-        "ldp    x17, %[output_block_data], [sp, #32]\n"  // 16-byte Folded Reload
-        "str    x9, [sp, #288]\n"  // 8-byte Folded Spill
-        "ldp    q19, q20, [%[bias_data]]\n"
-        "lsl    w12, w12, #3\n"
-        "lsl    x12, x12, #2\n"
-        "add    x17, x17, x12\n"
-        "add    x12, %[output_block_data], x12\n"
-        "ldp    q21, q22, [x17]\n"
-        "ldp    q23, q24, [x12]\n"
-        "ldr    x9, [sp, #264]\n"  // 8-byte Folded Reload
-        "ldr    x27, [sp, #112]\n"  // 8-byte Folded Reload
-        "mov    w26, wzr\n"
-        "b      " DC_KERNEL_NO_MULT_20 "f\n"
-        DC_KERNEL_NO_MULT_19 ":\n"  // in Loop: Header=BB111_20 Depth=2
-        "ldr    w12, [sp, #108]\n"  // 4-byte Folded Reload
-        "ldr    x22, [sp, #200]\n"  // 8-byte Folded Reload
-        "add    w26, w26, #1\n"  // =1
-        "cmp    w26, w12\n"
-        "add    x27, x27, x22\n"
-        "b.eq   " DC_KERNEL_NO_MULT_26 "f\n"
-        DC_KERNEL_NO_MULT_20 ":\n"  // Parent Loop BB111_4 Depth=1
-        // =>  This Loop Header: Depth=2
-        // Child Loop BB111_22 Depth 3
-        // Child Loop BB111_25 Depth 4
-        "ldp    x16, %[output_block_data], [sp, #320]\n"  // 16-byte Folded Reload
-        "ldp    q25, q26, [x9]\n"
-        "mov    w12, wzr\n"
-        "mov    x17, x9\n"
-        "add    %[scratch_block_data], x9, %[output_block_data]\n"
-        "add    %[output_block_data], x9, x16\n"
-        "ldp    q27, q28, [%[scratch_block_data]]\n"
-        "ldp    q29, q30, [%[output_block_data]]\n"
-        "mov    x9, %[scratch_block_data]\n"
-        "mov    x22, x27\n"
-        "b      " DC_KERNEL_NO_MULT_22 "f\n"
-        DC_KERNEL_NO_MULT_21 ":\n"  // in Loop: Header=BB111_22 Depth=3
-        "ldr    w16, [sp, #340]\n"  // 4-byte Folded Reload
-        "add    w12, w12, #1\n"  // =1
-        "mov    x17, %[scratch_block_data]\n"
-        "cmp    w12, w16\n"
-        "b.eq   " DC_KERNEL_NO_MULT_19 "b\n"
-        DC_KERNEL_NO_MULT_22 ":\n"  // Parent Loop BB111_4 Depth=1
-        // Parent Loop BB111_20 Depth=2
-        // =>  This Loop Header: Depth=3
-        // Child Loop BB111_25 Depth 4
-        "ldr    w16, [sp, #344]\n"  // 4-byte Folded Reload
-        "add    %[scratch_block_data], x17, #32\n"  // =32
-        "cmp    w12, w16\n"
-        "ldr    w16, [sp, #348]\n"  // 4-byte Folded Reload
-        "csel   w3, w16, w1, eq\n"
-        "cmp    w3, #3\n"  // =3
-        "b.ge   " DC_KERNEL_NO_MULT_24 "f\n"
-        // %bb.23:        // in Loop: Header=BB111_22 Depth=3
-        "movi   v31.16b, #0\n"
-        "cmp    w3, #1\n"  // =1
-        "movi   v8.16b, #0\n"
-        "movi   v9.16b, #0\n"
-        "movi   v11.16b, #0\n"
-        "movi   v12.16b, #0\n"
-        "movi   v10.16b, #0\n"
-        "b.ge   " DC_KERNEL_NO_MULT_25 "f\n"
-        "b      " DC_KERNEL_NO_MULT_21 "b\n"
-        DC_KERNEL_NO_MULT_24 ":\n"  // in Loop: Header=BB111_22 Depth=3
-        "ldr    x24, [sp, #328]\n"  // 8-byte Folded Reload
-        "mov    x16, x11\n"
-        "mov    x11, x10\n"
-        "mov    x10, %[scratch_block_data]\n"
-        "add    x24, %[scratch_block_data], x24\n"
-        "ldr    %[scratch_block_data], [sp, #320]\n"  // 8-byte Folded Reload
-        "ldp    q10, q9, [x17, #32]\n"
-        "ldp    q12, q8, [x24]\n"
-        "mov    x23, x15\n"
-        "add    %[scratch_block_data], x10, x0\n"
-        "ldp    q11, q31, [%[scratch_block_data]]\n"
-        "mov    x15, x14\n"
-        "mov    x14, x6\n"
-        "mov    %[bias_data], x13\n"
-        "mov    x13, x21\n"
-        "mov    x21, x20\n"
-        "mov    x20, x19\n"
-        "mov    x19, x25\n"
-        "mov    x19, x20\n"
-        "mov    x20, x21\n"
-        "mov    x21, x13\n"
-        "mov    x13, %[bias_data]\n"
-        "mov    x14, x15\n"
-        "mov    x15, x23\n"
-        "mov    %[scratch_block_data], x10\n"
-        "mov    x10, x11\n"
-        "mov    x11, x16\n"
-        DC_KERNEL_NO_MULT_25 ":\n"  // Parent Loop BB111_4 Depth=1
-        // Parent Loop BB111_20 Depth=2
-        // Parent Loop BB111_22 Depth=3
-        // =>  This Inner Loop Header: Depth=4
-        "mov    v1.16b, v19.16b\n"
-        "mov    v2.16b, v20.16b\n"
-        ".word 0x4e999601  // sdot   v1.4s, v16.16b, v25.16b\n"
-        ".word 0x4e9a95e2  // sdot   v2.4s, v15.16b, v26.16b\n"
-        ".word 0x4e9b9621  // sdot   v1.4s, v17.16b, v27.16b\n"
-        ".word 0x4e9c9462  // sdot   v2.4s, v3.16b, v28.16b\n"
-        ".word 0x4e9d9641  // sdot   v1.4s, v18.16b, v29.16b\n"
-        ".word 0x4e9e9482  // sdot   v2.4s, v4.16b, v30.16b\n"
-        "sqrdmulh        v1.4s, v1.4s, v23.4s\n"
-        "sqrdmulh        v2.4s, v2.4s, v24.4s\n"
-        "sqrshl v1.4s, v1.4s, v21.4s\n"
-        "sqrshl v2.4s, v2.4s, v22.4s\n"
-        "sqxtn  v1.4h, v1.4s\n"
-        "sqxtn2 v1.8h, v2.4s\n"
-        "sqadd  v1.8h, v1.8h, v0.8h\n"
-        "sqxtn  v1.8b, v1.8h\n"
-        "smax   v1.8b, v1.8b, v7.8b\n"
-        "ushr   v25.4s, v25.4s, #8\n"
-        "ushr   v26.4s, v26.4s, #8\n"
-        "ushr   v27.4s, v27.4s, #8\n"
-        "ushr   v28.4s, v28.4s, #8\n"
-        "ushr   v29.4s, v29.4s, #8\n"
-        "ushr   v30.4s, v30.4s, #8\n"
-        "smin   v1.8b, v1.8b, v14.8b\n"
-        "subs   w3, w3, #1\n"  // =1
-        "sli    v25.4s, v10.4s, #24\n"
-        "ushr   v10.4s, v10.4s, #8\n"
-        "sli    v26.4s, v9.4s, #24\n"
-        "ushr   v9.4s, v9.4s, #8\n"
-        "sli    v27.4s, v12.4s, #24\n"
-        "ushr   v12.4s, v12.4s, #8\n"
-        "sli    v28.4s, v8.4s, #24\n"
-        "ushr   v8.4s, v8.4s, #8\n"
-        "sli    v29.4s, v11.4s, #24\n"
-        "ushr   v11.4s, v11.4s, #8\n"
-        "sli    v30.4s, v31.4s, #24\n"
-        "ushr   v31.4s, v31.4s, #8\n"
-        "str    d1, [x22]\n"
-        "add    x22, x22, x7\n"
-        "b.ne   " DC_KERNEL_NO_MULT_25 "b\n"
-        "b      " DC_KERNEL_NO_MULT_21 "b\n"
-        DC_KERNEL_NO_MULT_26 ":\n"  // in Loop: Header=BB111_4 Depth=1
-        "ldr    %[bias_data], [sp, #288]\n"  // 8-byte Folded Reload
-        "ldr    x23, [sp, #24]\n"  // 8-byte Folded Reload
-        "ldr    %[scratch_block_data], [sp, #96]\n"  // 8-byte Folded Reload
-        "b      " DC_KERNEL_NO_MULT_3 "b\n"
-        DC_KERNEL_NO_MULT_27 ":\n"  // in Loop: Header=BB111_4 Depth=1
-        "ldr    w12, [sp, #20]\n"  // 4-byte Folded Reload
-        "cmp    w17, #2\n"  // =2
-        "b.hs   " DC_KERNEL_NO_MULT_29 "f\n"
-        // %bb.28:        // in Loop: Header=BB111_4 Depth=1
-        "mov    w12, wzr\n"
-        "b      " DC_KERNEL_NO_MULT_31 "f\n"
-        DC_KERNEL_NO_MULT_29 ":\n"  // Parent Loop BB111_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "subs   w12, w12, #2\n"  // =2
-        "b.ne   " DC_KERNEL_NO_MULT_29 "b\n"
-        // %bb.30:        // in Loop: Header=BB111_4 Depth=1
-        "ldr    w12, [sp, #20]\n"  // 4-byte Folded Reload
-        "cmp    w17, w12\n"
-        "b.eq   " DC_KERNEL_NO_MULT_2 "b\n"
-        DC_KERNEL_NO_MULT_31 ":\n"  // in Loop: Header=BB111_4 Depth=1
-        "sub    w12, w17, w12\n"
-        DC_KERNEL_NO_MULT_32 ":\n"  // Parent Loop BB111_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "subs   w12, w12, #1\n"  // =1
-        "b.ne   " DC_KERNEL_NO_MULT_32 "b\n"
-        "b      " DC_KERNEL_NO_MULT_2 "b\n"
-        DC_KERNEL_NO_MULT_33 ":\n"
-        // Compiled intrinsics total stack 528, now 384 for spillage only.
-        "add    sp, sp, #384\n"  // =528
-        :
-        // Outputs.
-        [ scratch_block_data ] "+r"(scratch_block_data),
-        [ filter_workspace ] "+r"(filter_workspace),
-        [ bias_data ] "+r"(bias_data),
-        [ output_block_data ] "+r"(output_block_data)
-        :
-        // Inputs.
-        [ function_params ] "r"(function_params)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20",
-        "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
-        "v31",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
-        "x16", "x17", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26",
-        "x27", "x28");
-#undef DC_KERNEL_NO_MULT_1
-#undef DC_KERNEL_NO_MULT_2
-#undef DC_KERNEL_NO_MULT_3
-#undef DC_KERNEL_NO_MULT_4
-#undef DC_KERNEL_NO_MULT_5
-#undef DC_KERNEL_NO_MULT_6
-#undef DC_KERNEL_NO_MULT_7
-#undef DC_KERNEL_NO_MULT_8
-#undef DC_KERNEL_NO_MULT_9
-#undef DC_KERNEL_NO_MULT_10
-#undef DC_KERNEL_NO_MULT_11
-#undef DC_KERNEL_NO_MULT_12
-#undef DC_KERNEL_NO_MULT_13
-#undef DC_KERNEL_NO_MULT_14
-#undef DC_KERNEL_NO_MULT_15
-#undef DC_KERNEL_NO_MULT_16
-#undef DC_KERNEL_NO_MULT_17
-#undef DC_KERNEL_NO_MULT_18
-#undef DC_KERNEL_NO_MULT_19
-#undef DC_KERNEL_NO_MULT_20
-#undef DC_KERNEL_NO_MULT_21
-#undef DC_KERNEL_NO_MULT_22
-#undef DC_KERNEL_NO_MULT_23
-#undef DC_KERNEL_NO_MULT_24
-#undef DC_KERNEL_NO_MULT_25
-#undef DC_KERNEL_NO_MULT_26
-#undef DC_KERNEL_NO_MULT_27
-#undef DC_KERNEL_NO_MULT_28
-#undef DC_KERNEL_NO_MULT_29
-#undef DC_KERNEL_NO_MULT_30
-#undef DC_KERNEL_NO_MULT_31
-#undef DC_KERNEL_NO_MULT_32
-#undef DC_KERNEL_NO_MULT_33
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         int8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockNeon(scratch_block_data, filter_workspace, bias_data,
-                         output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock {
-  static inline void KernelMacroBlockNeon(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, int8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Note that argument registers may be reused after parameter loading.
-    // x0 %[scratch_block_data]
-    // x1 %[filter_workspace]
-    // x2 %[bias_data]
-    // x3 %[output_block_data]
-    // x4 %[function_params]
-#define DC_KERNEL_NO_MULT_STRIDE_1 "1"
-#define DC_KERNEL_NO_MULT_STRIDE_2 "2"
-#define DC_KERNEL_NO_MULT_STRIDE_3 "3"
-#define DC_KERNEL_NO_MULT_STRIDE_4 "4"
-#define DC_KERNEL_NO_MULT_STRIDE_5 "5"
-#define DC_KERNEL_NO_MULT_STRIDE_6 "6"
-#define DC_KERNEL_NO_MULT_STRIDE_7 "7"
-#define DC_KERNEL_NO_MULT_STRIDE_8 "8"
-#define DC_KERNEL_NO_MULT_STRIDE_9 "9"
-#define DC_KERNEL_NO_MULT_STRIDE_10 "10"
-#define DC_KERNEL_NO_MULT_STRIDE_11 "11"
-#define DC_KERNEL_NO_MULT_STRIDE_12 "12"
-#define DC_KERNEL_NO_MULT_STRIDE_13 "13"
-#define DC_KERNEL_NO_MULT_STRIDE_14 "14"
-#define DC_KERNEL_NO_MULT_STRIDE_15 "15"
-#define DC_KERNEL_NO_MULT_STRIDE_16 "16"
-#define DC_KERNEL_NO_MULT_STRIDE_17 "17"
-#define DC_KERNEL_NO_MULT_STRIDE_18 "18"
-#define DC_KERNEL_NO_MULT_STRIDE_19 "19"
-#define DC_KERNEL_NO_MULT_STRIDE_20 "20"
-#define DC_KERNEL_NO_MULT_STRIDE_21 "21"
-#define DC_KERNEL_NO_MULT_STRIDE_22 "22"
-#define DC_KERNEL_NO_MULT_STRIDE_23 "23"
-#define DC_KERNEL_NO_MULT_STRIDE_24 "24"
-#define DC_KERNEL_NO_MULT_STRIDE_25 "25"
-#define DC_KERNEL_NO_MULT_STRIDE_26 "26"
-#define DC_KERNEL_NO_MULT_STRIDE_27 "27"
-#define DC_KERNEL_NO_MULT_STRIDE_28 "28"
-#define DC_KERNEL_NO_MULT_STRIDE_29 "29"
-#define DC_KERNEL_NO_MULT_STRIDE_30 "30"
-#define DC_KERNEL_NO_MULT_STRIDE_31 "31"
-#define DC_KERNEL_NO_MULT_STRIDE_32 "32"
-#define DC_KERNEL_NO_MULT_STRIDE_33 "33"
-#define DC_KERNEL_NO_MULT_STRIDE_34 "34"
-#define DC_KERNEL_NO_MULT_STRIDE_35 "35"
-
-    asm volatile(
-        // Compiled code used block of 176 for spill out of total stack of 320.
-        "sub    sp, sp, #176\n"  // =320
-
-
-        "ldr    w23, [%[function_params], #" STR(DP_OFFSET_DEPTH_MICRO_REPEATS) "]\n"
-        "str    %[scratch_block_data], [sp, #168]\n"  // 8-byte Folded Spill
-        "cmp    w23, #1\n"  // =1
-        "b.lt   " DC_KERNEL_NO_MULT_STRIDE_35 "f\n"
-        // %bb.1:
-        "ldr    x8, [%[function_params], #" STR(DP_OFFSET_OUTPUT_MULTPLIPLIER_PER_CHANNEL) "]\n"
-        "ldpsw  x11, x12, [%[function_params], #" STR(DP_OFFSET_OUTPUT_HEIGHT_STRIDE) "]\n"
-        "ldp    w13, w0, [%[function_params], #" STR(DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "ldr    w5, [%[function_params], #" STR(DP_OFFSET_OUTBOUND_BLOCK_HEIGHT) "]\n"
-        "str    x8, [sp, #144]\n"  // 8-byte Folded Spill
-        "ldr    x8, [%[function_params], #" STR(DP_OFFSET_OUTPUT_SHIFT_PER_CHANNEL) "]\n"
-        "ldr    x14, [%[function_params]]\n"
-        "str    w5, [sp, #164]\n"  // 4-byte Folded Spill
-        "add    x15, %[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MIN) "\n"  // =40
-        "str    x8, [sp, #136]\n"  // 8-byte Folded Spill
-        "add    x16, %[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MAX) "\n"  // =44
-        "add    x17, %[function_params], #" STR(DP_OFFSET_OUTPUT_OFFSET) "\n"  // =28
-        "ldrsw  x8, [%[function_params], #" STR(DP_OFFSET_INPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "ldp    w5, w4, [%[function_params], #" STR(DP_OFFSET_OUTPUT_RESIDUAL_WIDTH) "]\n"
-        "ld1r   { v0.8h }, [x17]\n"
-        "ld1r   { v1.8b }, [x15]\n"
-        "ld1r   { v2.8b }, [x16]\n"
-        "cmp    w5, #1\n"  // =1
-        "ccmp   w0, w13, #0, eq\n"
-        "lsl    w15, w14, #1\n"
-        "csel   w6, w0, w13, lt\n"
-        "lsl    x8, x8, #5\n"
-        "sxtw   x19, w14\n"
-        "sxtw   x22, w15\n"
-        "bic    w14, w6, w6, asr #31\n"
-        "str    x8, [sp, #152]\n"  // 8-byte Folded Spill
-        "lsl    x7, x12, #1\n"
-        "madd   x8, x22, x14, %[output_block_data]\n"
-        "mov    x9, xzr\n"
-        "mov    x10, xzr\n"
-        "lsl    x20, x12, #2\n"
-        "add    x21, x7, x12\n"
-        "sub    x14, x13, x14\n"
-        "stp    x8, x23, [sp, #48]\n"  // 16-byte Folded Spill
-        "add    x8, x8, #4\n"  // =4
-        "str    w4, [sp, #44]\n"  // 4-byte Folded Spill
-        "str    %[scratch_block_data], [sp, #32]\n"  // 8-byte Folded Spill
-        "str    x14, [sp, #128]\n"  // 8-byte Folded Spill
-        "str    x8, [sp, #8]\n"  // 8-byte Folded Spill
-        // implicit-def: $q5
-        // implicit-def: $q21
-        // implicit-def: $q19
-        // implicit-def: $q16
-        // implicit-def: $q20
-        // implicit-def: $q3
-        // implicit-def: $q11
-        // implicit-def: $q13
-        // implicit-def: $q14
-        // implicit-def: $q15
-        // implicit-def: $q6
-        "b      " DC_KERNEL_NO_MULT_STRIDE_4 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_2 ":\n"  // in Loop: Header=BB112_4 Depth=1
-        "add    x27, %[bias_data], #32\n"  // =32
-        "mov    v19.16b, v12.16b\n"
-        "mov    v3.16b, v9.16b\n"
-        "mov    v5.16b, v10.16b\n"
-        "mov    v20.16b, v7.16b\n"
-        DC_KERNEL_NO_MULT_STRIDE_3 ":\n"  // in Loop: Header=BB112_4 Depth=1
-        "add    x10, x10, #1\n"  // =1
-        "cmp    x10, x23\n"
-        "add    x9, x9, #8\n"  // =8
-        "mov    %[bias_data], x27\n"
-        "b.eq   " DC_KERNEL_NO_MULT_STRIDE_35 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_4 ":\n"  // =>This Loop Header: Depth=1
-        // Child Loop BB112_30 Depth 2
-        // Child Loop BB112_21 Depth 2
-        // Child Loop BB112_7 Depth 2
-        // Child Loop BB112_9 Depth 2
-        // Child Loop BB112_12 Depth 2
-        // Child Loop BB112_26 Depth 2
-        "ldr    w8, [sp, #164]\n"  // 4-byte Folded Reload
-        "add    w14, w10, w10, lsl #1\n"
-        "lsl    w14, w14, #5\n"
-        "add    x26, %[filter_workspace], x14\n"
-        "cmp    w8, #2\n"  // =2
-        "ldr    x8, [sp, #168]\n"  // 8-byte Folded Reload
-        "ldr    x14, [sp, #152]\n"  // 8-byte Folded Reload
-        "nop\n"
-        "madd   x28, x10, x14, x8\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_14 "f\n"
-        // %bb.5:        // in Loop: Header=BB112_4 Depth=1
-        "ldr    x8, [sp, #136]\n"  // 8-byte Folded Reload
-        "ubfx   x14, x9, #3, #29\n"
-        "lsl    w15, w10, #3\n"
-        "lsl    x27, x14, #3\n"
-        "lsl    x14, x15, #2\n"
-        "add    x24, x8, x14\n"
-        "ldr    x8, [sp, #144]\n"  // 8-byte Folded Reload
-        "ldr    q22, [x26]\n"
-        "ldr    q23, [x26, #32]\n"
-        "ldr    q24, [x26, #64]\n"
-        "add    x14, x8, x14\n"
-        "ldr    x8, [sp, #48]\n"  // 8-byte Folded Reload
-        "ldr    q25, [%[bias_data]]\n"
-        "ldr    q31, [x28]\n"
-        "ldr    q8, [x28, x12]\n"
-        "ldr    q30, [x28, x7]\n"
-        "ldr    q29, [x28, x21]\n"
-        "ldr    q26, [x24]\n"
-        "ldr    q27, [x14]\n"
-        "ldr    q28, [x28, x20]\n"
-        "add    x25, x8, x27\n"
-        "cmp    w6, #1\n"  // =1
-        "add    %[function_params], %[output_block_data], x15\n"
-        "mov    v12.16b, v19.16b\n"
-        "mov    v7.16b, v20.16b\n"
-        "b.lt   " DC_KERNEL_NO_MULT_STRIDE_23 "f\n"
-        // %bb.6:        // in Loop: Header=BB112_4 Depth=1
-        "mov    v4.16b, v21.16b\n"
-        "mov    x8, %[filter_workspace]\n"
-        "mov    w15, wzr\n"
-        "mov    x16, xzr\n"
-        "add    x17, x28, #32\n"  // =32
-        "mov    x23, x6\n"
-        "mov    v17.16b, v30.16b\n"
-        DC_KERNEL_NO_MULT_STRIDE_7 ":\n"  // Parent Loop BB112_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v18.16b, v25.16b\n"
-        "mov    v19.16b, v25.16b\n"
-        ".word 0x4e9f96d2  // sdot   v18.4s, v22.16b, v31.16b\n"
-        ".word 0x4e9196d3  // sdot   v19.4s, v22.16b, v17.16b\n"
-        ".word 0x4e8896f2  // sdot   v18.4s, v23.16b, v8.16b\n"
-        ".word 0x4e9d96f3  // sdot   v19.4s, v23.16b, v29.16b\n"
-        ".word 0x4e919712  // sdot   v18.4s, v24.16b, v17.16b\n"
-        ".word 0x4e9c9713  // sdot   v19.4s, v24.16b, v28.16b\n"
-        "sqrdmulh        v18.4s, v18.4s, v27.4s\n"
-        "and    %[scratch_block_data], x16, #0xffffffe0\n"
-        "sqrdmulh        v19.4s, v19.4s, v27.4s\n"
-        "sqrshl v18.4s, v18.4s, v26.4s\n"
-        "add    %[scratch_block_data], x17, x0\n"
-        "sqrshl v19.4s, v19.4s, v26.4s\n"
-        "sqxtn  v18.4h, v18.4s\n"
-        "rev32  v20.8h, v31.8h\n"
-        "rev32  v21.8h, v8.8h\n"
-        "rev32  v9.8h, v30.8h\n"
-        "rev32  v10.8h, v29.8h\n"
-        "ldr    q31, [%[scratch_block_data]]\n"
-        "ldr    q8, [%[scratch_block_data], x12]\n"
-        "ldr    q30, [%[scratch_block_data], x7]\n"
-        "ldr    q29, [%[scratch_block_data], x21]\n"
-        "rev32  v17.8h, v28.8h\n"
-        "ldr    q28, [%[scratch_block_data], x20]\n"
-        "sqxtn2 v18.8h, v19.4s\n"
-        "sqadd  v18.8h, v18.8h, v0.8h\n"
-        "sqxtn  v18.8b, v18.8h\n"
-        "add    %[filter_workspace], %[function_params], w15, sxtw\n"
-        "smax   v18.8b, v18.8b, v1.8b\n"
-        "add    %[scratch_block_data], %[filter_workspace], x11\n"
-        "smin   v18.8b, v18.8b, v2.8b\n"
-        "mov    v11.16b, v25.16b\n"
-        "str    s18, [%[filter_workspace]]\n"
-        "st1    { v18.s }[1], [%[scratch_block_data]]\n"
-        "trn1   v18.8h, v20.8h, v31.8h\n"
-        "mov    v19.16b, v25.16b\n"
-        "trn1   v20.8h, v21.8h, v8.8h\n"
-        "trn1   v21.8h, v9.8h, v30.8h\n"
-        ".word 0x4e9296cb  // sdot   v11.4s, v22.16b, v18.16b\n"
-        "trn1   v9.8h, v10.8h, v29.8h\n"
-        ".word 0x4e9596d3  // sdot   v19.4s, v22.16b, v21.16b\n"
-        ".word 0x4e9496eb  // sdot   v11.4s, v23.16b, v20.16b\n"
-        "trn1   v17.8h, v17.8h, v28.8h\n"
-        ".word 0x4e8996f3  // sdot   v19.4s, v23.16b, v9.16b\n"
-        ".word 0x4e95970b  // sdot   v11.4s, v24.16b, v21.16b\n"
-        ".word 0x4e919713  // sdot   v19.4s, v24.16b, v17.16b\n"
-        "sqrdmulh        v17.4s, v11.4s, v27.4s\n"
-        "sqrdmulh        v18.4s, v19.4s, v27.4s\n"
-        "sqrshl v17.4s, v17.4s, v26.4s\n"
-        "sqrshl v18.4s, v18.4s, v26.4s\n"
-        "sqxtn  v17.4h, v17.4s\n"
-        "sqxtn2 v17.8h, v18.4s\n"
-        "sqadd  v17.8h, v17.8h, v0.8h\n"
-        "sqxtn  v17.8b, v17.8h\n"
-        "add    %[filter_workspace], x1, x19\n"
-        "smax   v17.8b, v17.8b, v1.8b\n"
-        "add    %[scratch_block_data], %[filter_workspace], x11\n"
-        "smin   v17.8b, v17.8b, v2.8b\n"
-        "add    x16, x16, #32\n"  // =32
-        "subs   x23, x23, #1\n"  // =1
-        "str    s17, [%[filter_workspace]]\n"
-        "st1    { v17.s }[1], [%[scratch_block_data]]\n"
-        "add    w15, w15, w22\n"
-        "mov    v17.16b, v30.16b\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_7 "b\n"
-        // %bb.8:        // in Loop: Header=BB112_4 Depth=1
-        "mov    v6.16b, v31.16b\n"
-        "mov    v15.16b, v8.16b\n"
-        "mov    v14.16b, v30.16b\n"
-        "mov    v13.16b, v29.16b\n"
-        "mov    v11.16b, v28.16b\n"
-        "mov    w15, w6\n"
-        "mov    %[filter_workspace], x8\n"
-        "mov    v21.16b, v4.16b\n"
-        "cmp    w15, w13\n"
-        "ldr    x15, [sp, #128]\n"  // 8-byte Folded Reload
-        "b.ge   " DC_KERNEL_NO_MULT_STRIDE_10 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_9 ":\n"  // Parent Loop BB112_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v9.16b, v25.16b\n"
-        "mov    v10.16b, v25.16b\n"
-        ".word 0x4e9f96c9  // sdot   v9.4s, v22.16b, v31.16b\n"
-        ".word 0x4e8896e9  // sdot   v9.4s, v23.16b, v8.16b\n"
-        ".word 0x4e9e96ca  // sdot   v10.4s, v22.16b, v30.16b\n"
-        ".word 0x4e9e9709  // sdot   v9.4s, v24.16b, v30.16b\n"
-        ".word 0x4e9d96ea  // sdot   v10.4s, v23.16b, v29.16b\n"
-        ".word 0x4e9c970a  // sdot   v10.4s, v24.16b, v28.16b\n"
-        "sqrdmulh        v9.4s, v9.4s, v27.4s\n"
-        "sqrdmulh        v10.4s, v10.4s, v27.4s\n"
-        "sqrshl v9.4s, v9.4s, v26.4s\n"
-        "sqrshl v10.4s, v10.4s, v26.4s\n"
-        "sqxtn  v9.4h, v9.4s\n"
-        "sqxtn2 v9.8h, v10.4s\n"
-        "sqadd  v9.8h, v9.8h, v0.8h\n"
-        "sqxtn  v9.8b, v9.8h\n"
-        "smax   v9.8b, v9.8b, v1.8b\n"
-        "rev32  v31.8h, v31.8h\n"
-        "rev32  v8.8h, v8.8h\n"
-        "rev32  v30.8h, v30.8h\n"
-        "rev32  v29.8h, v29.8h\n"
-        "rev32  v28.8h, v28.8h\n"
-        "smin   v9.8b, v9.8b, v2.8b\n"
-        "add    x16, x25, x11\n"
-        "subs   x15, x15, #1\n"  // =1
-        "trn1   v31.8h, v31.8h, v6.8h\n"
-        "trn1   v8.8h, v8.8h, v15.8h\n"
-        "trn1   v29.8h, v29.8h, v13.8h\n"
-        "trn1   v30.8h, v30.8h, v14.8h\n"
-        "trn1   v28.8h, v28.8h, v11.8h\n"
-        "str    s9, [x25]\n"
-        "add    x25, x25, x22\n"
-        "st1    { v9.s }[1], [x16]\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_9 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_10 ":\n"  // in Loop: Header=BB112_4 Depth=1
-        "ldr    q22, [x26, #16]\n"
-        "ldr    q23, [x26, #48]\n"
-        "ldr    q24, [x26, #80]\n"
-        "ldr    q29, [x28, #16]!\n"
-        "ldr    q25, [%[bias_data], #16]\n"
-        "ldr    q26, [x24, #16]\n"
-        "ldr    q27, [x14, #16]\n"
-        "ldr    q8, [x28, x12]\n"
-        "ldr    q31, [x28, x7]\n"
-        "ldr    q30, [x28, x21]\n"
-        "ldr    q28, [x28, x20]\n"
-        "ldr    x23, [sp, #56]\n"  // 8-byte Folded Reload
-        "cmp    w6, #0\n"  // =0
-        "mov    v10.16b, v5.16b\n"
-        "b.le   " DC_KERNEL_NO_MULT_STRIDE_24 "f\n"
-        // %bb.11:        // in Loop: Header=BB112_4 Depth=1
-        "mov    v6.16b, v21.16b\n"
-        "mov    v9.16b, v3.16b\n"
-        "mov    w14, wzr\n"
-        "mov    x15, xzr\n"
-        "add    x16, x28, #32\n"  // =32
-        "add    x17, %[function_params], #4\n"  // =4
-        "mov    %[function_params], x6\n"
-        "mov    v17.16b, v31.16b\n"
-        DC_KERNEL_NO_MULT_STRIDE_12 ":\n"  // Parent Loop BB112_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v3.16b, v25.16b\n"
-        "mov    v4.16b, v25.16b\n"
-        ".word 0x4e9d96c3  // sdot   v3.4s, v22.16b, v29.16b\n"
-        ".word 0x4e9196c4  // sdot   v4.4s, v22.16b, v17.16b\n"
-        ".word 0x4e8896e3  // sdot   v3.4s, v23.16b, v8.16b\n"
-        ".word 0x4e9e96e4  // sdot   v4.4s, v23.16b, v30.16b\n"
-        ".word 0x4e919703  // sdot   v3.4s, v24.16b, v17.16b\n"
-        ".word 0x4e9c9704  // sdot   v4.4s, v24.16b, v28.16b\n"
-        "sqrdmulh        v3.4s, v3.4s, v27.4s\n"
-        "and    %[scratch_block_data], x15, #0xffffffe0\n"
-        "sqrdmulh        v4.4s, v4.4s, v27.4s\n"
-        "sqrshl v3.4s, v3.4s, v26.4s\n"
-        "add    %[scratch_block_data], x16, x0\n"
-        "sqrshl v4.4s, v4.4s, v26.4s\n"
-        "sqxtn  v3.4h, v3.4s\n"
-        "rev32  v5.8h, v29.8h\n"
-        "rev32  v18.8h, v8.8h\n"
-        "rev32  v19.8h, v31.8h\n"
-        "rev32  v20.8h, v30.8h\n"
-        "ldr    q29, [%[scratch_block_data]]\n"
-        "ldr    q8, [%[scratch_block_data], x12]\n"
-        "ldr    q31, [%[scratch_block_data], x7]\n"
-        "ldr    q30, [%[scratch_block_data], x21]\n"
-        "rev32  v17.8h, v28.8h\n"
-        "ldr    q28, [%[scratch_block_data], x20]\n"
-        "sqxtn2 v3.8h, v4.4s\n"
-        "sqadd  v3.8h, v3.8h, v0.8h\n"
-        "sqxtn  v3.8b, v3.8h\n"
-        "add    x8, x17, w14, sxtw\n"
-        "smax   v3.8b, v3.8b, v1.8b\n"
-        "add    %[scratch_block_data], x8, x11\n"
-        "smin   v3.8b, v3.8b, v2.8b\n"
-        "mov    v21.16b, v25.16b\n"
-        "str    s3, [x8]\n"
-        "st1    { v3.s }[1], [%[scratch_block_data]]\n"
-        "trn1   v3.8h, v5.8h, v29.8h\n"
-        "mov    v4.16b, v25.16b\n"
-        "trn1   v5.8h, v18.8h, v8.8h\n"
-        "trn1   v18.8h, v19.8h, v31.8h\n"
-        ".word 0x4e8396d5  // sdot   v21.4s, v22.16b, v3.16b\n"
-        "trn1   v19.8h, v20.8h, v30.8h\n"
-        ".word 0x4e9296c4  // sdot   v4.4s, v22.16b, v18.16b\n"
-        ".word 0x4e8596f5  // sdot   v21.4s, v23.16b, v5.16b\n"
-        "trn1   v17.8h, v17.8h, v28.8h\n"
-        ".word 0x4e9396e4  // sdot   v4.4s, v23.16b, v19.16b\n"
-        ".word 0x4e929715  // sdot   v21.4s, v24.16b, v18.16b\n"
-        ".word 0x4e919704  // sdot   v4.4s, v24.16b, v17.16b\n"
-        "sqrdmulh        v3.4s, v21.4s, v27.4s\n"
-        "sqrdmulh        v4.4s, v4.4s, v27.4s\n"
-        "sqrshl v3.4s, v3.4s, v26.4s\n"
-        "sqrshl v4.4s, v4.4s, v26.4s\n"
-        "sqxtn  v3.4h, v3.4s\n"
-        "sqxtn2 v3.8h, v4.4s\n"
-        "sqadd  v3.8h, v3.8h, v0.8h\n"
-        "sqxtn  v3.8b, v3.8h\n"
-        "add    x8, x8, x19\n"
-        "smax   v3.8b, v3.8b, v1.8b\n"
-        "add    x15, x15, #32\n"  // =32
-        "subs   %[function_params], %[function_params], #1\n"  // =1
-        "add    %[scratch_block_data], x8, x11\n"
-        "smin   v3.8b, v3.8b, v2.8b\n"
-        "add    w14, w14, w22\n"
-        "mov    v17.16b, v31.16b\n"
-        "str    s3, [x8]\n"
-        "st1    { v3.s }[1], [%[scratch_block_data]]\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_12 "b\n"
-        // %bb.13:        // in Loop: Header=BB112_4 Depth=1
-        "mov    v15.16b, v8.16b\n"
-        "mov    v14.16b, v31.16b\n"
-        "mov    v13.16b, v30.16b\n"
-        "mov    v11.16b, v28.16b\n"
-        "mov    w14, w6\n"
-        "mov    v21.16b, v6.16b\n"
-        "mov    v6.16b, v29.16b\n"
-        "mov    v3.16b, v29.16b\n"
-        "cmp    w14, w13\n"
-        "b.ge   " DC_KERNEL_NO_MULT_STRIDE_2 "b\n"
-        "b      " DC_KERNEL_NO_MULT_STRIDE_25 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_14 ":\n"  // in Loop: Header=BB112_4 Depth=1
-        "cmp    w13, #1\n"  // =1
-        "add    x27, %[bias_data], #32\n"  // =32
-        "b.lt   " DC_KERNEL_NO_MULT_STRIDE_3 "b\n"
-        // %bb.15:        // in Loop: Header=BB112_4 Depth=1
-        "ldr    x8, [sp, #136]\n"  // 8-byte Folded Reload
-        "lsl    w14, w10, #3\n"
-        "stp    q15, q14, [sp, #64]\n"  // 32-byte Folded Spill
-        "stp    q13, q11, [sp, #96]\n"  // 32-byte Folded Spill
-        "add    x15, x28, x12\n"
-        "lsl    x16, x14, #2\n"
-        "ldp    q10, q11, [x15]\n"
-        "add    x15, x8, x16\n"
-        "ldr    x8, [sp, #144]\n"  // 8-byte Folded Reload
-        "ldp    q30, q31, [x15]\n"
-        "add    x15, x28, x7\n"
-        "ldp    q22, q23, [x26]\n"
-        "add    x16, x8, x16\n"
-        "ldr    w8, [sp, #44]\n"  // 4-byte Folded Reload
-        "ldp    q24, q25, [x26, #32]\n"
-        "ldp    q26, q27, [x26, #64]\n"
-        "ldp    q17, q18, [%[bias_data]]\n"
-        "ldp    q14, q13, [x28], #32\n"
-        "ldp    q8, q9, [x16]\n"
-        "ldp    q12, q15, [x15]\n"
-        "add    %[bias_data], %[output_block_data], x14\n"
-        "cmp    w13, w8\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_27 "f\n"
-        // %bb.16:        // in Loop: Header=BB112_4 Depth=1
-        "ldr    x25, [sp, #32]\n"  // 8-byte Folded Reload
-        "mov    x14, xzr\n"
-        "mov    w4, wzr\n"
-        "mov    x24, x13\n"
-        "cbnz   x25,    " DC_KERNEL_NO_MULT_STRIDE_20 "f\n"
-        "b      " DC_KERNEL_NO_MULT_STRIDE_21 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_17 ":\n"  // in Loop: Header=BB112_21 Depth=2
-        "mov    v28.16b, v17.16b\n"
-        ".word 0x4e8e96dc  // sdot   v28.4s, v22.16b, v14.16b\n"
-        "mov    v29.16b, v18.16b\n"
-        ".word 0x4e8d96fd  // sdot   v29.4s, v23.16b, v13.16b\n"
-        ".word 0x4e8a971c  // sdot   v28.4s, v24.16b, v10.16b\n"
-        ".word 0x4e8b973d  // sdot   v29.4s, v25.16b, v11.16b\n"
-        ".word 0x4e8c975c  // sdot   v28.4s, v26.16b, v12.16b\n"
-        ".word 0x4e8f977d  // sdot   v29.4s, v27.16b, v15.16b\n"
-        "sqrdmulh        v28.4s, v28.4s, v8.4s\n"
-        "sqrdmulh        v29.4s, v29.4s, v9.4s\n"
-        "sqrshl v28.4s, v28.4s, v30.4s\n"
-        "sqrshl v29.4s, v29.4s, v31.4s\n"
-        "sqxtn  v28.4h, v28.4s\n"
-        "sqxtn2 v28.8h, v29.4s\n"
-        "sqadd  v28.8h, v28.8h, v0.8h\n"
-        "sqxtn  v28.8b, v28.8h\n"
-        "smax   v28.8b, v28.8b, v1.8b\n"
-        "smin   v28.8b, v28.8b, v2.8b\n"
-        "mov    v14.16b, v3.16b\n"
-        "mov    v10.16b, v20.16b\n"
-        "mov    v12.16b, v16.16b\n"
-        "mov    v13.16b, v19.16b\n"
-        "mov    v11.16b, v21.16b\n"
-        "mov    v15.16b, v5.16b\n"
-        "str    d28, [x15, x19]\n"
-        DC_KERNEL_NO_MULT_STRIDE_18 ":\n"  // in Loop: Header=BB112_21 Depth=2
-        "add    w4, w4, w22\n"
-        "add    x14, x14, #32\n"  // =32
-        "subs   x24, x24, #1\n"  // =1
-        "sub    x25, x25, #1\n"  // =1
-        "b.eq   " DC_KERNEL_NO_MULT_STRIDE_33 "f\n"
-        // %bb.19:        // in Loop: Header=BB112_21 Depth=2
-        "cbz    x25,    " DC_KERNEL_NO_MULT_STRIDE_21 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_20 ":\n"  // in Loop: Header=BB112_4 Depth=1
-        "and    x15, x14, #0xffffffe0\n"
-        "add    x15, x28, x15\n"
-        "add    x16, x15, x12\n"
-        "add    x17, x15, x7\n"
-        "ldp    q3, q19, [x15]\n"
-        "ldp    q20, q21, [x16]\n"
-        "ldp    q16, q5, [x17]\n"
-        DC_KERNEL_NO_MULT_STRIDE_21 ":\n"  // Parent Loop BB112_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v28.16b, v17.16b\n"
-        "mov    v29.16b, v18.16b\n"
-        ".word 0x4e8e96dc  // sdot   v28.4s, v22.16b, v14.16b\n"
-        ".word 0x4e8a971c  // sdot   v28.4s, v24.16b, v10.16b\n"
-        ".word 0x4e8d96fd  // sdot   v29.4s, v23.16b, v13.16b\n"
-        ".word 0x4e8c975c  // sdot   v28.4s, v26.16b, v12.16b\n"
-        ".word 0x4e8b973d  // sdot   v29.4s, v25.16b, v11.16b\n"
-        ".word 0x4e8f977d  // sdot   v29.4s, v27.16b, v15.16b\n"
-        "sqrdmulh        v28.4s, v28.4s, v8.4s\n"
-        "sqrdmulh        v29.4s, v29.4s, v9.4s\n"
-        "sqrshl v28.4s, v28.4s, v30.4s\n"
-        "sqrshl v29.4s, v29.4s, v31.4s\n"
-        "sqxtn  v28.4h, v28.4s\n"
-        "sqxtn2 v28.8h, v29.4s\n"
-        "sqadd  v28.8h, v28.8h, v0.8h\n"
-        "sqxtn  v28.8b, v28.8h\n"
-        "rev32  v14.8h, v14.8h\n"
-        "rev32  v10.8h, v10.8h\n"
-        "rev32  v12.8h, v12.8h\n"
-        "rev32  v13.8h, v13.8h\n"
-        "rev32  v11.8h, v11.8h\n"
-        "rev32  v15.8h, v15.8h\n"
-        "smax   v28.8b, v28.8b, v1.8b\n"
-        "add    x15, %[bias_data], w4, sxtw\n"
-        "cmp    w5, #1\n"  // =1
-        "trn1   v14.8h, v14.8h, v3.8h\n"
-        "trn1   v13.8h, v13.8h, v19.8h\n"
-        "trn1   v10.8h, v10.8h, v20.8h\n"
-        "trn1   v11.8h, v11.8h, v21.8h\n"
-        "trn1   v12.8h, v12.8h, v16.8h\n"
-        "smin   v28.8b, v28.8b, v2.8b\n"
-        "trn1   v15.8h, v15.8h, v5.8h\n"
-        "str    d28, [x15]\n"
-        "b.gt   " DC_KERNEL_NO_MULT_STRIDE_17 "b\n"
-        // %bb.22:        // in Loop: Header=BB112_21 Depth=2
-        "cbz    x25,    " DC_KERNEL_NO_MULT_STRIDE_18 "b\n"
-        "b      " DC_KERNEL_NO_MULT_STRIDE_17 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_23 ":\n"  // in Loop: Header=BB112_4 Depth=1
-        "mov    w15, wzr\n"
-        "cmp    w15, w13\n"
-        "ldr    x15, [sp, #128]\n"  // 8-byte Folded Reload
-        "b.lt   " DC_KERNEL_NO_MULT_STRIDE_9 "b\n"
-        "b      " DC_KERNEL_NO_MULT_STRIDE_10 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_24 ":\n"  // in Loop: Header=BB112_4 Depth=1
-        "mov    v9.16b, v3.16b\n"
-        "mov    w14, wzr\n"
-        "cmp    w14, w13\n"
-        "b.ge   " DC_KERNEL_NO_MULT_STRIDE_2 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_25 ":\n"  // in Loop: Header=BB112_4 Depth=1
-        "ldr    x8, [sp, #8]\n"  // 8-byte Folded Reload
-        "ldr    x15, [sp, #128]\n"  // 8-byte Folded Reload
-        "add    x14, x8, x27\n"
-        DC_KERNEL_NO_MULT_STRIDE_26 ":\n"  // Parent Loop BB112_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v3.16b, v25.16b\n"
-        "mov    v4.16b, v25.16b\n"
-        ".word 0x4e9d96c3  // sdot   v3.4s, v22.16b, v29.16b\n"
-        ".word 0x4e8896e3  // sdot   v3.4s, v23.16b, v8.16b\n"
-        ".word 0x4e9f96c4  // sdot   v4.4s, v22.16b, v31.16b\n"
-        ".word 0x4e9f9703  // sdot   v3.4s, v24.16b, v31.16b\n"
-        ".word 0x4e9e96e4  // sdot   v4.4s, v23.16b, v30.16b\n"
-        ".word 0x4e9c9704  // sdot   v4.4s, v24.16b, v28.16b\n"
-        "sqrdmulh        v3.4s, v3.4s, v27.4s\n"
-        "sqrdmulh        v4.4s, v4.4s, v27.4s\n"
-        "sqrshl v3.4s, v3.4s, v26.4s\n"
-        "sqrshl v4.4s, v4.4s, v26.4s\n"
-        "sqxtn  v3.4h, v3.4s\n"
-        "sqxtn2 v3.8h, v4.4s\n"
-        "sqadd  v3.8h, v3.8h, v0.8h\n"
-        "sqxtn  v3.8b, v3.8h\n"
-        "smax   v3.8b, v3.8b, v1.8b\n"
-        "rev32  v5.8h, v29.8h\n"
-        "rev32  v17.8h, v8.8h\n"
-        "rev32  v18.8h, v31.8h\n"
-        "rev32  v19.8h, v30.8h\n"
-        "rev32  v20.8h, v28.8h\n"
-        "smin   v3.8b, v3.8b, v2.8b\n"
-        "add    x16, x14, x11\n"
-        "subs   x15, x15, #1\n"  // =1
-        "trn1   v29.8h, v5.8h, v6.8h\n"
-        "trn1   v8.8h, v17.8h, v15.8h\n"
-        "trn1   v30.8h, v19.8h, v13.8h\n"
-        "trn1   v31.8h, v18.8h, v14.8h\n"
-        "trn1   v28.8h, v20.8h, v11.8h\n"
-        "str    s3, [x14]\n"
-        "add    x14, x14, x22\n"
-        "st1    { v3.s }[1], [x16]\n"
-        "b.ne   " DC_KERNEL_NO_MULT_STRIDE_26 "b\n"
-        "b      " DC_KERNEL_NO_MULT_STRIDE_2 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_27 ":\n"  // in Loop: Header=BB112_4 Depth=1
-        "ldr    x25, [sp, #32]\n"  // 8-byte Folded Reload
-        "mov    w14, wzr\n"
-        "mov    %[function_params], xzr\n"
-        "mov    x24, x13\n"
-        "str    q6, [sp, #16]\n"  // 16-byte Folded Spill
-        "b      " DC_KERNEL_NO_MULT_STRIDE_30 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_28 ":\n"  // in Loop: Header=BB112_30 Depth=2
-        "mov    v3.16b, v17.16b\n"
-        ".word 0x4e8e96c3  // sdot   v3.4s, v22.16b, v14.16b\n"
-        "mov    v4.16b, v18.16b\n"
-        ".word 0x4e8d96e4  // sdot   v4.4s, v23.16b, v13.16b\n"
-        ".word 0x4e8a9703  // sdot   v3.4s, v24.16b, v10.16b\n"
-        ".word 0x4e8b9724  // sdot   v4.4s, v25.16b, v11.16b\n"
-        ".word 0x4e8c9743  // sdot   v3.4s, v26.16b, v12.16b\n"
-        ".word 0x4e8f9764  // sdot   v4.4s, v27.16b, v15.16b\n"
-        "sqrdmulh        v3.4s, v3.4s, v8.4s\n"
-        "sqrdmulh        v4.4s, v4.4s, v9.4s\n"
-        "sqrshl v3.4s, v3.4s, v30.4s\n"
-        "sqrshl v4.4s, v4.4s, v31.4s\n"
-        "sqxtn  v3.4h, v3.4s\n"
-        "sqxtn2 v3.8h, v4.4s\n"
-        "sqadd  v3.8h, v3.8h, v0.8h\n"
-        "sqxtn  v3.8b, v3.8h\n"
-        "smax   v3.8b, v3.8b, v1.8b\n"
-        "smin   v3.8b, v3.8b, v2.8b\n"
-        "str    d3, [x15, x19]\n"
-        "mov    v3.16b, v6.16b\n"
-        "mov    v14.16b, v6.16b\n"
-        "mov    v10.16b, v20.16b\n"
-        "mov    v12.16b, v16.16b\n"
-        "mov    v13.16b, v19.16b\n"
-        "mov    v11.16b, v21.16b\n"
-        "mov    v15.16b, v5.16b\n"
-        DC_KERNEL_NO_MULT_STRIDE_29 ":\n"  // in Loop: Header=BB112_30 Depth=2
-        "add    %[function_params], %[function_params], #" STR(DP_OFFSET_OUTPUT_MULTIPLIER) "\n"  // =32
-        "sub    x25, x25, #1\n"  // =1
-        "subs   x24, x24, #1\n"  // =1
-        "add    w14, w14, w22\n"
-        "b.eq   " DC_KERNEL_NO_MULT_STRIDE_34 "f\n"
-        DC_KERNEL_NO_MULT_STRIDE_30 ":\n"  // Parent Loop BB112_4 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "mov    v28.16b, v17.16b\n"
-        "mov    v29.16b, v18.16b\n"
-        ".word 0x4e8e96dc  // sdot   v28.4s, v22.16b, v14.16b\n"
-        "and    x16, %[function_params], #0xffffffe0\n"
-        ".word 0x4e8d96fd  // sdot   v29.4s, v23.16b, v13.16b\n"
-        ".word 0x4e8a971c  // sdot   v28.4s, v24.16b, v10.16b\n"
-        "add    x16, x28, x16\n"
-        ".word 0x4e8b973d  // sdot   v29.4s, v25.16b, v11.16b\n"
-        ".word 0x4e8c975c  // sdot   v28.4s, v26.16b, v12.16b\n"
-        "rev32  v19.8h, v14.8h\n"
-        "rev32  v3.8h, v13.8h\n"
-        "ldp    q14, q13, [x16]\n"
-        ".word 0x4e8f977d  // sdot   v29.4s, v27.16b, v15.16b\n"
-        "sqrdmulh        v28.4s, v28.4s, v8.4s\n"
-        "sqrdmulh        v29.4s, v29.4s, v9.4s\n"
-        "sqrshl v28.4s, v28.4s, v30.4s\n"
-        "add    x17, x16, x12\n"
-        "add    x16, x16, x7\n"
-        "sqrshl v29.4s, v29.4s, v31.4s\n"
-        "sqxtn  v28.4h, v28.4s\n"
-        "rev32  v21.8h, v12.8h\n"
-        "rev32  v4.8h, v11.8h\n"
-        "ldp    q20, q11, [x17]\n"
-        "ldp    q12, q5, [x16]\n"
-        "sqxtn2 v28.8h, v29.4s\n"
-        "mov    v6.16b, v14.16b\n"
-        "trn1   v14.8h, v19.8h, v14.8h\n"
-        "mov    v19.16b, v13.16b\n"
-        "trn1   v13.8h, v3.8h, v13.8h\n"
-        "sqadd  v3.8h, v28.8h, v0.8h\n"
-        "sqxtn  v3.8b, v3.8h\n"
-        "rev32  v16.8h, v10.8h\n"
-        "rev32  v7.8h, v15.8h\n"
-        "smax   v3.8b, v3.8b, v1.8b\n"
-        "add    x15, %[bias_data], w14, sxtw\n"
-        "cmp    w5, #1\n"  // =1
-        "trn1   v10.8h, v16.8h, v20.8h\n"
-        "mov    v16.16b, v12.16b\n"
-        "trn1   v12.8h, v21.8h, v12.8h\n"
-        "mov    v21.16b, v11.16b\n"
-        "trn1   v11.8h, v4.8h, v11.8h\n"
-        "smin   v3.8b, v3.8b, v2.8b\n"
-        "trn1   v15.8h, v7.8h, v5.8h\n"
-        "str    d3, [x15]\n"
-        "b.gt   " DC_KERNEL_NO_MULT_STRIDE_28 "b\n"
-        // %bb.31:        // in Loop: Header=BB112_30 Depth=2
-        "cbnz   x25,    " DC_KERNEL_NO_MULT_STRIDE_28 "b\n"
-        // %bb.32:        // in Loop: Header=BB112_30 Depth=2
-        "mov    v3.16b, v6.16b\n"
-        "b      " DC_KERNEL_NO_MULT_STRIDE_29 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_33 ":\n"  // in Loop: Header=BB112_4 Depth=1
-        "ldp    q13, q11, [sp, #96]\n"  // 32-byte Folded Reload
-        "ldp    q15, q14, [sp, #64]\n"  // 32-byte Folded Reload
-        "b      " DC_KERNEL_NO_MULT_STRIDE_3 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_34 ":\n"  // in Loop: Header=BB112_4 Depth=1
-        "ldp    q13, q11, [sp, #96]\n"  // 32-byte Folded Reload
-        "ldp    q15, q14, [sp, #64]\n"  // 32-byte Folded Reload
-        "ldr    q6, [sp, #16]\n"  // 16-byte Folded Reload
-        "b      " DC_KERNEL_NO_MULT_STRIDE_3 "b\n"
-        DC_KERNEL_NO_MULT_STRIDE_35 ":\n"
-
-        // Compiled intrinsics total stack 320, now 176 for spillage only.
-        "add    sp, sp, #176\n"  // =320
-        :
-        // Outputs.
-        [ scratch_block_data ] "+r"(scratch_block_data),
-        [ filter_workspace ] "+r"(filter_workspace),
-        [ bias_data ] "+r"(bias_data),
-        [ output_block_data ] "+r"(output_block_data)
-        :
-        // Inputs.
-        [ function_params ] "r"(function_params)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19", "v20",
-        "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
-        "v31",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
-        "x16", "x17", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26",
-        "x27", "x28");
-
-#undef DC_KERNEL_NO_MULT_STRIDE_1
-#undef DC_KERNEL_NO_MULT_STRIDE_2
-#undef DC_KERNEL_NO_MULT_STRIDE_3
-#undef DC_KERNEL_NO_MULT_STRIDE_4
-#undef DC_KERNEL_NO_MULT_STRIDE_5
-#undef DC_KERNEL_NO_MULT_STRIDE_6
-#undef DC_KERNEL_NO_MULT_STRIDE_7
-#undef DC_KERNEL_NO_MULT_STRIDE_8
-#undef DC_KERNEL_NO_MULT_STRIDE_9
-#undef DC_KERNEL_NO_MULT_STRIDE_10
-#undef DC_KERNEL_NO_MULT_STRIDE_11
-#undef DC_KERNEL_NO_MULT_STRIDE_12
-#undef DC_KERNEL_NO_MULT_STRIDE_13
-#undef DC_KERNEL_NO_MULT_STRIDE_14
-#undef DC_KERNEL_NO_MULT_STRIDE_15
-#undef DC_KERNEL_NO_MULT_STRIDE_16
-#undef DC_KERNEL_NO_MULT_STRIDE_17
-#undef DC_KERNEL_NO_MULT_STRIDE_18
-#undef DC_KERNEL_NO_MULT_STRIDE_19
-#undef DC_KERNEL_NO_MULT_STRIDE_20
-#undef DC_KERNEL_NO_MULT_STRIDE_21
-#undef DC_KERNEL_NO_MULT_STRIDE_22
-#undef DC_KERNEL_NO_MULT_STRIDE_23
-#undef DC_KERNEL_NO_MULT_STRIDE_24
-#undef DC_KERNEL_NO_MULT_STRIDE_25
-#undef DC_KERNEL_NO_MULT_STRIDE_26
-#undef DC_KERNEL_NO_MULT_STRIDE_27
-#undef DC_KERNEL_NO_MULT_STRIDE_28
-#undef DC_KERNEL_NO_MULT_STRIDE_29
-#undef DC_KERNEL_NO_MULT_STRIDE_30
-#undef DC_KERNEL_NO_MULT_STRIDE_31
-#undef DC_KERNEL_NO_MULT_STRIDE_32
-#undef DC_KERNEL_NO_MULT_STRIDE_33
-#undef DC_KERNEL_NO_MULT_STRIDE_34
-#undef DC_KERNEL_NO_MULT_STRIDE_35
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         int8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockNeon(scratch_block_data, filter_workspace, bias_data,
-                         output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock {
-  static inline void KernelMacroBlockNeon(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, int8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Note that argument registers may be reused after parameter loading.
-    // x0 %[scratch_block_data]
-    // x1 %[filter_workspace]
-    // x2 %[bias_data]
-    // x3 %[output_block_data]
-    // x4 %[function_params]
-#define DC_KERNEL_MULT_1 "1"
-#define DC_KERNEL_MULT_2 "2"
-#define DC_KERNEL_MULT_3 "3"
-#define DC_KERNEL_MULT_4 "4"
-#define DC_KERNEL_MULT_5 "5"
-#define DC_KERNEL_MULT_6 "6"
-#define DC_KERNEL_MULT_7 "7"
-#define DC_KERNEL_MULT_8 "8"
-#define DC_KERNEL_MULT_9 "9"
-#define DC_KERNEL_MULT_10 "10"
-#define DC_KERNEL_MULT_11 "11"
-#define DC_KERNEL_MULT_12 "12"
-#define DC_KERNEL_MULT_13 "13"
-#define DC_KERNEL_MULT_14 "14"
-#define DC_KERNEL_MULT_15 "15"
-#define DC_KERNEL_MULT_16 "16"
-#define DC_KERNEL_MULT_17 "17"
-#define DC_KERNEL_MULT_18 "18"
-#define DC_KERNEL_MULT_19 "19"
-#define DC_KERNEL_MULT_20 "20"
-#define DC_KERNEL_MULT_21 "21"
-#define DC_KERNEL_MULT_22 "22"
-#define DC_KERNEL_MULT_23 "23"
-
-    asm volatile(
-        // Compiled code used block of 336 for spill out of total stack of 448.
-        // However, an 8-byte spill was sneaked in to #344.
-        // Spillage increased to 352 and these are mapped to #336.
-        "sub    sp, sp, #352\n"  // =448
-
-
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_DEPTH_MICRO_REPEATS) "]\n"
-        "str    %[filter_workspace], [sp, #56]\n"  // 8-byte Folded Spill
-        "cmp    w8, #1\n"  // =1
-        "str    x8, [sp, #32]\n"  // 8-byte Folded Spill
-        "b.lt   " DC_KERNEL_MULT_23 "f\n"
-        // %bb.1:
-        "ldr    w11, [%[function_params], #" STR(DP_OFFSET_OUTPUT_RESIDUAL_WIDTH) "]\n"
-        "ldr    x12, [%[function_params], #" STR(DP_OFFSET_OUTPUT_MULTPLIPLIER_PER_CHANNEL) "]\n"
-        "ldp    w17, w15, [%[function_params], #" STR(DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "ldr    w16, [%[function_params], #" STR(DP_OFFSET_OUTBOUND_BLOCK_HEIGHT) "]\n"
-        "ldpsw  x21, x6, [%[function_params], #" STR(DP_OFFSET_OUTPUT_HEIGHT_STRIDE) "]\n"
-        "ldrb   w8, [%[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MIN) "]\n"
-        "ldrb   w9, [%[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MAX) "]\n"
-        "add    x10, %[function_params], #" STR(DP_OFFSET_OUTPUT_OFFSET) "\n"  // =28
-        "str    x12, [sp, #24]\n"  // 8-byte Folded Spill
-        "ldr    x12, [%[function_params], #" STR(DP_OFFSET_OUTPUT_SHIFT_PER_CHANNEL) "]\n"
-        "ldrsw  %[function_params], [%[function_params], #" STR(DP_OFFSET_OUTPUT_DEPTH) "]\n"
-        "cmp    w11, #4\n"  // =4
-        "ccmp   w15, w17, #0, lt\n"
-        "csel   w25, w15, w17, lt\n"
-        "cmp    w16, #1\n"  // =1
-        "str    x16, [sp, #80]\n"  // 8-byte Folded Spill
-        "cset   w16, lt\n"
-        "cmp    w17, #1\n"  // =1
-        "dup    v1.16b, w8\n"
-        "fmov   s3, w8\n"
-        "dup    v2.16b, w9\n"
-        "fmov   s4, w9\n"
-        "lsl    x8, %[function_params], #1\n"
-        "add    x9, x21, %[function_params]\n"
-        "str    w17, [sp, #324]\n"  // 4-byte Folded Spill
-        "cset   w17, lt\n"
-        "ld1r   { v0.8h }, [x10]\n"
-        "lsl    x7, x21, #1\n"
-        "add    x22, x21, x21, lsl #1\n"
-        "add    x10, x8, %[function_params]\n"
-        "add    x9, %[output_block_data], x9\n"
-        "orr    w16, w16, w17\n"
-        "str    x9, [sp, #216]\n"  // 8-byte Folded Spill
-        "str    w15, [sp, #316]\n"  // 4-byte Folded Spill
-        "add    x9, x10, x22\n"
-        "add    x15, x10, x7\n"
-        "str    w16, [sp, #12]\n"  // 4-byte Folded Spill
-        "add    x16, x10, x21\n"
-        "add    x10, %[output_block_data], x10\n"
-        "str    x10, [sp, #200]\n"  // 8-byte Folded Spill
-        "add    x10, x6, #4\n"  // =4
-        "str    x10, [sp, #160]\n"  // 8-byte Folded Spill
-        "lsl    x10, %[function_params], #2\n"
-        "str    x10, [sp, #152]\n"  // 8-byte Folded Spill
-        "add    x10, %[output_block_data], x21\n"
-        "add    x17, x6, x6, lsl #2\n"
-        "str    x10, [sp, #144]\n"  // 8-byte Folded Spill
-        "add    x10, %[output_block_data], %[function_params]\n"
-        "lsl    x24, x6, #2\n"
-        "str    x10, [sp, #136]\n"  // 8-byte Folded Spill
-        "add    x10, x17, #4\n"  // =4
-        "add    x19, x6, x6, lsl #1\n"
-        "str    x10, [sp, #128]\n"  // 8-byte Folded Spill
-        "add    x10, x24, #4\n"  // =4
-        "str    x12, [sp, #16]\n"  // 8-byte Folded Spill
-        "str    w11, [sp, #320]\n"  // 4-byte Folded Spill
-        "lsl    x20, x6, #1\n"
-        "add    x11, x8, x22\n"
-        "add    x12, x8, x7\n"
-        "add    x13, x8, x21\n"
-        "add    x8, %[output_block_data], x8\n"
-        "str    x10, [sp, #120]\n"  // 8-byte Folded Spill
-        "add    x10, x19, #4\n"  // =4
-        "stp    x8, x7, [sp, #224]\n"  // 16-byte Folded Spill
-        "add    x8, x22, %[function_params]\n"
-        "str    x10, [sp, #112]\n"  // 8-byte Folded Spill
-        "add    x10, x20, #4\n"  // =4
-        "mov    x5, xzr\n"
-        "add    x14, x7, %[function_params]\n"
-        "add    x8, %[output_block_data], x8\n"
-        "str    x10, [sp, #104]\n"  // 8-byte Folded Spill
-        "add    x10, %[output_block_data], x7\n"
-        "add    x26, %[output_block_data], x11\n"
-        "str    x8, [sp, #184]\n"  // 8-byte Folded Spill
-        "add    x8, %[output_block_data], x14\n"
-        "mov    x14, x5\n"
-        "add    x5, %[output_block_data], x9\n"
-        "add    x9, %[output_block_data], x16\n"
-        "mov    x16, x22\n"
-        "stp    x19, x6, [sp, #296]\n"  // 16-byte Folded Spill
-        "mov    x11, x7\n"
-        "str    x20, [sp, #328]\n"  // 8-byte Folded Spill
-        "str    x10, [sp, #96]\n"  // 8-byte Folded Spill
-        "add    x10, %[output_block_data], x22\n"
-        "stp    x22, %[output_block_data], [sp, #64]\n"  // 16-byte Folded Spill
-        "ldr    x7, [sp, #160]\n"  // 8-byte Folded Reload
-        "ldr    x23, [sp, #136]\n"  // 8-byte Folded Reload
-        "ldp    x22, x19, [sp, #112]\n"  // 16-byte Folded Reload
-        "ldr    x20, [sp, #104]\n"  // 8-byte Folded Reload
-        "mov    %[filter_workspace], xzr\n"
-        "dup    v3.8b, v3.b[0]\n"
-        "dup    v4.8b, v4.b[0]\n"
-        "add    x27, %[output_block_data], x12\n"
-        "add    x28, %[output_block_data], x13\n"
-        "mov    x13, %[filter_workspace]\n"
-        "stp    x8, x17, [sp, #168]\n"  // 16-byte Folded Spill
-        "add    x8, %[output_block_data], x15\n"
-        "str    x10, [sp, #88]\n"  // 8-byte Folded Spill
-        "mov    w10, #4\n"
-        "stp    x21, %[scratch_block_data], [sp, #256]\n"  // 16-byte Folded Spill
-        "str    w25, [sp, #212]\n"  // 4-byte Folded Spill
-        "str    x24, [sp, #192]\n"  // 8-byte Folded Spill
-        "str    x9, [sp, #336]\n"  // 8-byte Folded Spill
-        "b      " DC_KERNEL_MULT_5 "f\n"
-        DC_KERNEL_MULT_2 ":\n"  // in Loop: Header=BB107_5 Depth=1
-        "mov    %[output_block_data], x21\n"
-        "ldp    x21, %[scratch_block_data], [sp, #256]\n"  // 16-byte Folded Reload
-        DC_KERNEL_MULT_3 ":\n"  // in Loop: Header=BB107_5 Depth=1
-        "mov    %[bias_data], x11\n"
-        DC_KERNEL_MULT_4 ":\n"  // in Loop: Header=BB107_5 Depth=1
-        "ldp    x12, x14, [sp, #32]\n"  // 16-byte Folded Reload
-        "ldr    x11, [sp, #72]\n"  // 8-byte Folded Reload
-        "ldr    x13, [sp, #48]\n"  // 8-byte Folded Reload
-        "add    x14, x14, #1\n"  // =1
-        "add    x11, x11, #8\n"  // =8
-        "cmp    x14, x12\n"
-        "add    x13, x13, #8\n"  // =8
-        "str    x11, [sp, #72]\n"  // 8-byte Folded Spill
-        "b.eq   " DC_KERNEL_MULT_23 "f\n"
-        DC_KERNEL_MULT_5 ":\n"  // =>This Loop Header: Depth=1
-        // Child Loop BB107_19 Depth 2
-        // Child Loop BB107_21 Depth 3
-        // Child Loop BB107_22 Depth 4
-        // Child Loop BB107_8 Depth 2
-        // Child Loop BB107_10 Depth 3
-        // Child Loop BB107_14 Depth 3
-        "ldr    x12, [sp, #56]\n"  // 8-byte Folded Reload
-        "ldr    x16, [sp, #80]\n"  // 8-byte Folded Reload
-        "ldp    q18, q5, [x12]\n"
-        "ldp    q17, q6, [x12, #32]\n"
-        "ldp    q16, q7, [x12, #64]\n"
-        "cmp    w16, #4\n"  // =4
-        "add    x12, x12, #96\n"  // =96
-        "stp    x13, x12, [sp, #48]\n"  // 16-byte Folded Spill
-        "str    x14, [sp, #40]\n"  // 8-byte Folded Spill
-        "b.ne   " DC_KERNEL_MULT_16 "f\n"
-        // %bb.6:        // in Loop: Header=BB107_5 Depth=1
-        "lsl    w12, w14, #3\n"
-        "ldr    x14, [sp, #16]\n"  // 8-byte Folded Reload
-        "lsl    x12, x12, #2\n"
-        "mov    x15, xzr\n"
-        "mov    %[filter_workspace], x13\n"
-        "add    x11, x14, x12\n"
-        "ldr    x14, [sp, #24]\n"  // 8-byte Folded Reload
-        "str    x11, [sp, #248]\n"  // 8-byte Folded Spill
-        "add    x11, x14, x12\n"
-        "str    x11, [sp, #240]\n"  // 8-byte Folded Spill
-        "b      " DC_KERNEL_MULT_8 "f\n"
-        DC_KERNEL_MULT_7 ":\n"  // in Loop: Header=BB107_8 Depth=2
-        "add    x15, x15, #1\n"  // =1
-        "cmp    x15, #2\n"  // =2
-        "add    %[filter_workspace], x1, #4\n"  // =4
-        "mov    v16.16b, v7.16b\n"
-        "mov    v17.16b, v6.16b\n"
-        "mov    v18.16b, v5.16b\n"
-        "b.eq   " DC_KERNEL_MULT_4 "b\n"
-        DC_KERNEL_MULT_8 ":\n"  // Parent Loop BB107_5 Depth=1
-        // =>  This Loop Header: Depth=2
-        // Child Loop BB107_10 Depth 3
-        // Child Loop BB107_14 Depth 3
-        "ldr    q19, [%[bias_data]], #16\n"
-        "ldr    x11, [sp, #248]\n"  // 8-byte Folded Reload
-        "lsl    x12, x15, #4\n"
-        "ldr    w13, [%[scratch_block_data]]\n"
-        "ldr    x16, [sp, #328]\n"  // 8-byte Folded Reload
-        "ldr    q20, [x11, x12]\n"
-        "ldr    x11, [sp, #240]\n"  // 8-byte Folded Reload
-        "ldr    w6, [%[scratch_block_data], x24]\n"
-        "ldr    w16, [%[scratch_block_data], x16]\n"
-        "ldr    q21, [x11, x12]\n"
-        "ldp    x12, x14, [sp, #296]\n"  // 16-byte Folded Reload
-        "fmov   s22, w13\n"
-        "add    x14, %[scratch_block_data], x14\n"
-        "mov    v22.s[1], w13\n"
-        "fmov   s23, w6\n"
-        "ldr    w12, [%[scratch_block_data], x12]\n"
-        "ld1    { v22.s }[2], [x14]\n"
-        "add    x14, %[scratch_block_data], x17\n"
-        "mov    v23.s[1], w6\n"
-        "ld1    { v23.s }[2], [x14]\n"
-        "fmov   s24, w16\n"
-        "mov    v24.s[1], w16\n"
-        "dup    v25.4s, w16\n"
-        "mov    v28.16b, v19.16b\n"
-        "mov    v29.16b, v19.16b\n"
-        "mov    v30.16b, v19.16b\n"
-        "dup    v26.4s, w12\n"
-        "mov    v31.16b, v19.16b\n"
-        "mov    v24.s[2], w12\n"
-        "cmp    w25, #1\n"  // =1
-        ".word 0x4e99961c  // sdot   v28.4s, v16.16b, v25.16b\n"
-        ".word 0x4e99963d  // sdot   v29.4s, v17.16b, v25.16b\n"
-        ".word 0x4e99965e  // sdot   v30.4s, v18.16b, v25.16b\n"
-        "mov    v24.s[3], w16\n"
-        "mov    v22.s[3], w13\n"
-        "mov    v23.s[3], w6\n"
-        ".word 0x4e9a965f  // sdot   v31.4s, v18.16b, v26.16b\n"
-        "b.lt   " DC_KERNEL_MULT_15 "f\n"
-        // %bb.9:        // in Loop: Header=BB107_8 Depth=2
-        "stp    x15, %[bias_data], [sp, #280]\n"  // 16-byte Folded Spill
-        "mov    w13, w25\n"
-        "str    %[filter_workspace], [sp, #272]\n"  // 8-byte Folded Spill
-        "mov    x16, %[filter_workspace]\n"
-        "mov    x14, %[scratch_block_data]\n"
-        "ldp    x25, %[scratch_block_data], [sp, #216]\n"  // 16-byte Folded Reload
-        "mov    x24, x28\n"
-        "mov    x28, x27\n"
-        "ldr    x27, [sp, #200]\n"  // 8-byte Folded Reload
-        "ldr    x17, [sp, #184]\n"  // 8-byte Folded Reload
-        "mov    x9, x8\n"
-        "mov    x8, x5\n"
-        "ldr    x5, [sp, #168]\n"  // 8-byte Folded Reload
-        "ldp    x15, x10, [sp, #144]\n"  // 16-byte Folded Reload
-        "ldr    %[bias_data], [sp, #128]\n"  // 8-byte Folded Reload
-        "ldp    %[filter_workspace], x11, [sp, #88]\n"  // 16-byte Folded Reload
-        "shl    v25.4s, v18.4s, #8\n"
-        "shl    v26.4s, v17.4s, #8\n"
-        "shl    v27.4s, v16.4s, #8\n"
-        "mov    x21, %[output_block_data]\n"
-        DC_KERNEL_MULT_10 ":\n"  // Parent Loop BB107_5 Depth=1
-        // Parent Loop BB107_8 Depth=2
-        // =>  This Inner Loop Header: Depth=3
-        ".word 0x4f96e25c  // sdot   v28.4s, v18.16b, v22.4b[0]\n"
-        ".word 0x4f96ea5d  // sdot   v29.4s, v18.16b, v22.4b[2]\n"
-        ".word 0x4f98ea3e  // sdot   v30.4s, v17.16b, v24.4b[2]\n"
-        ".word 0x4f96ea3c  // sdot   v28.4s, v17.16b, v22.4b[2]\n"
-        ".word 0x4f97e23f  // sdot   v31.4s, v17.16b, v23.4b[0]\n"
-        ".word 0x4f98ea1d  // sdot   v29.4s, v16.16b, v24.4b[2]\n"
-        ".word 0x4f97e21e  // sdot   v30.4s, v16.16b, v23.4b[0]\n"
-        "sqrdmulh        v28.4s, v28.4s, v21.4s\n"
-        ".word 0x4f97ea1f  // sdot   v31.4s, v16.16b, v23.4b[2]\n"
-        "sqrdmulh        v29.4s, v29.4s, v21.4s\n"
-        "sqrdmulh        v30.4s, v30.4s, v21.4s\n"
-        "sqrshl v28.4s, v28.4s, v20.4s\n"
-        "sqrdmulh        v31.4s, v31.4s, v21.4s\n"
-        "sqrshl v29.4s, v29.4s, v20.4s\n"
-        "sqrshl v30.4s, v30.4s, v20.4s\n"
-        "sqxtn  v28.4h, v28.4s\n"
-        "sqrshl v31.4s, v31.4s, v20.4s\n"
-        "sqxtn  v30.4h, v30.4s\n"
-        "sqxtn2 v28.8h, v29.4s\n"
-        "sqxtn2 v30.8h, v31.4s\n"
-        "sqadd  v28.8h, v28.8h, v0.8h\n"
-        "sqadd  v29.8h, v30.8h, v0.8h\n"
-        "sqxtn  v28.8b, v28.8h\n"
-        "sqxtn2 v28.16b, v29.8h\n"
-        "smax   v28.16b, v28.16b, v1.16b\n"
-        "add    %[output_block_data], x15, x16\n"
-        "smin   v28.16b, v28.16b, v2.16b\n"
-        "add    x6, x11, x16\n"
-        "str    s28, [x21, x16]\n"
-        "st1    { v28.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], %[filter_workspace], x16\n"
-        "st1    { v28.s }[2], [x6]\n"
-        "st1    { v28.s }[3], [%[output_block_data]]\n"
-        "mov    x12, x14\n"
-        "add    x6, x14, x20\n"
-        "ldr    w3, [x14, #4]!\n"
-        "ld1    { v24.s }[1], [x6]\n"
-        "add    x6, x12, x19\n"
-        "ld1    { v23.s }[1], [x6]\n"
-        "mov    v22.s[1], w3\n"
-        "add    %[output_block_data], x12, x22\n"
-        "ld1    { v24.s }[3], [%[output_block_data]]\n"
-        "add    %[output_block_data], x12, x7\n"
-        "ld1    { v22.s }[3], [%[output_block_data]]\n"
-        "add    x12, x12, %[bias_data]\n"
-        "mov    v28.16b, v19.16b\n"
-        "ld1    { v23.s }[3], [x12]\n"
-        "mov    v29.16b, v19.16b\n"
-        "mov    v30.16b, v19.16b\n"
-        ".word 0x4f96e33c  // sdot   v28.4s, v25.16b, v22.4b[0]\n"
-        "mov    v31.16b, v19.16b\n"
-        ".word 0x4f98e33e  // sdot   v30.4s, v25.16b, v24.4b[0]\n"
-        ".word 0x4f96eb3d  // sdot   v29.4s, v25.16b, v22.4b[2]\n"
-        ".word 0x4f96eb5c  // sdot   v28.4s, v26.16b, v22.4b[2]\n"
-        ".word 0x4f98eb3f  // sdot   v31.4s, v25.16b, v24.4b[2]\n"
-        ".word 0x4f98eb5e  // sdot   v30.4s, v26.16b, v24.4b[2]\n"
-        ".word 0x4f98e35d  // sdot   v29.4s, v26.16b, v24.4b[0]\n"
-        ".word 0x4f98e37c  // sdot   v28.4s, v27.16b, v24.4b[0]\n"
-        ".word 0x4f97e35f  // sdot   v31.4s, v26.16b, v23.4b[0]\n"
-        ".word 0x4f97e37e  // sdot   v30.4s, v27.16b, v23.4b[0]\n"
-        ".word 0x4f98eb7d  // sdot   v29.4s, v27.16b, v24.4b[2]\n"
-        "sqrdmulh        v28.4s, v28.4s, v21.4s\n"
-        ".word 0x4f97eb7f  // sdot   v31.4s, v27.16b, v23.4b[2]\n"
-        "sqrdmulh        v30.4s, v30.4s, v21.4s\n"
-        "sqrdmulh        v29.4s, v29.4s, v21.4s\n"
-        "sqrshl v28.4s, v28.4s, v20.4s\n"
-        "sqrdmulh        v31.4s, v31.4s, v21.4s\n"
-        "sqrshl v30.4s, v30.4s, v20.4s\n"
-        "sqrshl v29.4s, v29.4s, v20.4s\n"
-        "sqxtn  v28.4h, v28.4s\n"
-        "sqrshl v31.4s, v31.4s, v20.4s\n"
-        "sqxtn  v30.4h, v30.4s\n"
-        "sqxtn2 v28.8h, v29.4s\n"
-        "sqxtn2 v30.8h, v31.4s\n"
-        "sqadd  v28.8h, v28.8h, v0.8h\n"
-        "sqadd  v29.8h, v30.8h, v0.8h\n"
-        "sqxtn  v28.8b, v28.8h\n"
-        "sqxtn2 v28.16b, v29.8h\n"
-        "smax   v28.16b, v28.16b, v1.16b\n"
-        "add    x12, x25, x16\n"
-        "smin   v28.16b, v28.16b, v2.16b\n"
-        "add    %[output_block_data], x5, x16\n"
-        "str    s28, [x23, x16]\n"
-        "st1    { v28.s }[1], [x12]\n"
-        "add    x12, x17, x16\n"
-        "mov    v29.16b, v19.16b\n"
-        "ushr   v10.2d, v22.2d, #16\n"
-        "mov    v30.16b, v19.16b\n"
-        "mov    v31.16b, v19.16b\n"
-        "st1    { v28.s }[2], [%[output_block_data]]\n"
-        "st1    { v28.s }[3], [x12]\n"
-        "ushr   v28.2d, v24.2d, #16\n"
-        ".word 0x4f8ae25d  // sdot   v29.4s, v18.16b, v10.4b[0]\n"
-        "mov    v8.16b, v19.16b\n"
-        ".word 0x4f9ce25f  // sdot   v31.4s, v18.16b, v28.4b[0]\n"
-        ".word 0x4f8aea5e  // sdot   v30.4s, v18.16b, v10.4b[2]\n"
-        ".word 0x4f8aea3d  // sdot   v29.4s, v17.16b, v10.4b[2]\n"
-        "ushr   v9.2d, v23.2d, #16\n"
-        ".word 0x4f9cea48  // sdot   v8.4s, v18.16b, v28.4b[2]\n"
-        ".word 0x4f9cea3f  // sdot   v31.4s, v17.16b, v28.4b[2]\n"
-        ".word 0x4f9ce23e  // sdot   v30.4s, v17.16b, v28.4b[0]\n"
-        ".word 0x4f9ce21d  // sdot   v29.4s, v16.16b, v28.4b[0]\n"
-        ".word 0x4f89e228  // sdot   v8.4s, v17.16b, v9.4b[0]\n"
-        ".word 0x4f89e21f  // sdot   v31.4s, v16.16b, v9.4b[0]\n"
-        ".word 0x4f9cea1e  // sdot   v30.4s, v16.16b, v28.4b[2]\n"
-        "sqrdmulh        v29.4s, v29.4s, v21.4s\n"
-        ".word 0x4f89ea08  // sdot   v8.4s, v16.16b, v9.4b[2]\n"
-        "sqrdmulh        v31.4s, v31.4s, v21.4s\n"
-        "sqrdmulh        v30.4s, v30.4s, v21.4s\n"
-        "sqrshl v29.4s, v29.4s, v20.4s\n"
-        "sqrdmulh        v8.4s, v8.4s, v21.4s\n"
-        "sqrshl v31.4s, v31.4s, v20.4s\n"
-        "sqrshl v30.4s, v30.4s, v20.4s\n"
-        "sqxtn  v29.4h, v29.4s\n"
-        "sqrshl v8.4s, v8.4s, v20.4s\n"
-        "sqxtn  v31.4h, v31.4s\n"
-        "sqxtn2 v29.8h, v30.4s\n"
-        "sqxtn2 v31.8h, v8.4s\n"
-        "sqadd  v29.8h, v29.8h, v0.8h\n"
-        "sqadd  v30.8h, v31.8h, v0.8h\n"
-        "sqxtn  v29.8b, v29.8h\n"
-        "sqxtn2 v29.16b, v30.8h\n"
-        "smax   v29.16b, v29.16b, v1.16b\n"
-        "add    %[output_block_data], x24, x16\n"
-        "smin   v29.16b, v29.16b, v2.16b\n"
-        "mov    v30.16b, v19.16b\n"
-        "add    x12, x28, x16\n"
-        "str    s29, [%[scratch_block_data], x16]\n"
-        "st1    { v29.s }[1], [%[output_block_data]]\n"
-        "add    %[output_block_data], x26, x16\n"
-        "mov    v31.16b, v19.16b\n"
-        "mov    v8.16b, v19.16b\n"
-        ".word 0x4f8ae33e  // sdot   v30.4s, v25.16b, v10.4b[0]\n"
-        "st1    { v29.s }[2], [x12]\n"
-        "st1    { v29.s }[3], [%[output_block_data]]\n"
-        "mov    v29.16b, v19.16b\n"
-        ".word 0x4f9ce328  // sdot   v8.4s, v25.16b, v28.4b[0]\n"
-        ".word 0x4f8aeb3f  // sdot   v31.4s, v25.16b, v10.4b[2]\n"
-        ".word 0x4f8aeb5e  // sdot   v30.4s, v26.16b, v10.4b[2]\n"
-        ".word 0x4f9ceb3d  // sdot   v29.4s, v25.16b, v28.4b[2]\n"
-        ".word 0x4f9ceb48  // sdot   v8.4s, v26.16b, v28.4b[2]\n"
-        ".word 0x4f9ce35f  // sdot   v31.4s, v26.16b, v28.4b[0]\n"
-        ".word 0x4f9ce37e  // sdot   v30.4s, v27.16b, v28.4b[0]\n"
-        ".word 0x4f89e35d  // sdot   v29.4s, v26.16b, v9.4b[0]\n"
-        ".word 0x4f89e368  // sdot   v8.4s, v27.16b, v9.4b[0]\n"
-        ".word 0x4f9ceb7f  // sdot   v31.4s, v27.16b, v28.4b[2]\n"
-        "sqrdmulh        v30.4s, v30.4s, v21.4s\n"
-        ".word 0x4f89eb7d  // sdot   v29.4s, v27.16b, v9.4b[2]\n"
-        "sqrdmulh        v28.4s, v8.4s, v21.4s\n"
-        "sqrdmulh        v31.4s, v31.4s, v21.4s\n"
-        "sqrshl v30.4s, v30.4s, v20.4s\n"
-        "sqrdmulh        v29.4s, v29.4s, v21.4s\n"
-        "sqrshl v28.4s, v28.4s, v20.4s\n"
-        "sqrshl v31.4s, v31.4s, v20.4s\n"
-        "sqxtn  v30.4h, v30.4s\n"
-        "ldr    x12, [sp, #336]\n"  // 8-byte Folded Reload
-        "sqrshl v29.4s, v29.4s, v20.4s\n"
-        "sqxtn  v28.4h, v28.4s\n"
-        "sqxtn2 v30.8h, v31.4s\n"
-        "sqxtn2 v28.8h, v29.4s\n"
-        "sqadd  v29.8h, v30.8h, v0.8h\n"
-        "sqadd  v28.8h, v28.8h, v0.8h\n"
-        "sqxtn  v29.8b, v29.8h\n"
-        "sqxtn2 v29.16b, v28.8h\n"
-        "smax   v28.16b, v29.16b, v1.16b\n"
-        "add    x12, x12, x16\n"
-        "smin   v8.16b, v28.16b, v2.16b\n"
-        "mov    v28.16b, v19.16b\n"
-        "mov    v29.16b, v19.16b\n"
-        "mov    v30.16b, v19.16b\n"
-        "mov    v31.16b, v19.16b\n"
-        "ushr   v24.2d, v24.2d, #32\n"
-        "add    %[output_block_data], x9, x16\n"
-        "str    s8, [x27, x16]\n"
-        "st1    { v8.s }[1], [x12]\n"
-        "add    x12, x8, x16\n"
-        "subs   w13, w13, #1\n"  // =1
-        "ushr   v22.2d, v22.2d, #32\n"
-        "ushr   v23.2d, v23.2d, #32\n"
-        ".word 0x4f98e21c  // sdot   v28.4s, v16.16b, v24.4b[0]\n"
-        ".word 0x4f98e23d  // sdot   v29.4s, v17.16b, v24.4b[0]\n"
-        ".word 0x4f98e25e  // sdot   v30.4s, v18.16b, v24.4b[0]\n"
-        ".word 0x4f98ea5f  // sdot   v31.4s, v18.16b, v24.4b[2]\n"
-        "add    x16, x16, x10\n"
-        "st1    { v8.s }[2], [%[output_block_data]]\n"
-        "st1    { v8.s }[3], [x12]\n"
-        "b.ne   " DC_KERNEL_MULT_10 "b\n"
-        // %bb.11:        // in Loop: Header=BB107_8 Depth=2
-        "ldr    w25, [sp, #212]\n"  // 4-byte Folded Reload
-        "add    x13, x21, x16\n"
-        "mov    %[output_block_data], x21\n"
-        "ldp    x21, %[scratch_block_data], [sp, #256]\n"  // 16-byte Folded Reload
-        "ldr    x6, [sp, #232]\n"  // 8-byte Folded Reload
-        "mov    x27, x28\n"
-        "mov    x28, x24\n"
-        "ldr    x24, [sp, #192]\n"  // 8-byte Folded Reload
-        "ldr    x17, [sp, #176]\n"  // 8-byte Folded Reload
-        "ldp    x15, %[bias_data], [sp, #280]\n"  // 16-byte Folded Reload
-        "ldr    %[filter_workspace], [sp, #272]\n"  // 8-byte Folded Reload
-        "mov    w12, w25\n"
-        "mov    x5, x8\n"
-        "mov    x8, x9\n"
-        "mov    w10, #4\n"
-        "ldr    w16, [sp, #324]\n"  // 4-byte Folded Reload
-        "cmp    w12, w16\n"
-        "b.ge   " DC_KERNEL_MULT_7 "b\n"
-        DC_KERNEL_MULT_12 ":\n"  // in Loop: Header=BB107_8 Depth=2
-        "ldr    w12, [sp, #320]\n"  // 4-byte Folded Reload
-        "cmp    w12, #1\n"  // =1
-        "b.lt   " DC_KERNEL_MULT_7 "b\n"
-        // %bb.13:        // in Loop: Header=BB107_8 Depth=2
-        "add    x12, x14, #4\n"  // =4
-        "ldr    x16, [sp, #328]\n"  // 8-byte Folded Reload
-        "add    x14, x12, x24\n"
-        "ld1    { v23.s }[1], [x14]\n"
-        "add    x14, x12, x17\n"
-        "add    x16, x12, x16\n"
-        "ld1    { v24.s }[1], [x16]\n"
-        "ld1    { v23.s }[3], [x14]\n"
-        "ldp    x16, x14, [sp, #296]\n"  // 16-byte Folded Reload
-        "add    x16, x12, x16\n"
-        "ld1    { v24.s }[3], [x16]\n"
-        "ldr    x16, [sp, #64]\n"  // 8-byte Folded Reload
-        "ld1    { v22.s }[1], [x12], x14\n"
-        "ldr    w14, [sp, #320]\n"  // 4-byte Folded Reload
-        "ld1    { v22.s }[3], [x12]\n"
-        DC_KERNEL_MULT_14 ":\n"  // Parent Loop BB107_5 Depth=1
-        // Parent Loop BB107_8 Depth=2
-        // =>  This Inner Loop Header: Depth=3
-        ".word 0x4f96e25c  // sdot   v28.4s, v18.16b, v22.4b[0]\n"
-        ".word 0x4f96ea5d  // sdot   v29.4s, v18.16b, v22.4b[2]\n"
-        ".word 0x4f98ea3e  // sdot   v30.4s, v17.16b, v24.4b[2]\n"
-        ".word 0x4f96ea3c  // sdot   v28.4s, v17.16b, v22.4b[2]\n"
-        ".word 0x4f97e23f  // sdot   v31.4s, v17.16b, v23.4b[0]\n"
-        ".word 0x4f98ea1d  // sdot   v29.4s, v16.16b, v24.4b[2]\n"
-        ".word 0x4f97e21e  // sdot   v30.4s, v16.16b, v23.4b[0]\n"
-        "sqrdmulh        v25.4s, v28.4s, v21.4s\n"
-        ".word 0x4f97ea1f  // sdot   v31.4s, v16.16b, v23.4b[2]\n"
-        "sqrdmulh        v26.4s, v29.4s, v21.4s\n"
-        "sqrdmulh        v27.4s, v30.4s, v21.4s\n"
-        "sqrshl v25.4s, v25.4s, v20.4s\n"
-        "sqrdmulh        v28.4s, v31.4s, v21.4s\n"
-        "sqrshl v26.4s, v26.4s, v20.4s\n"
-        "sqrshl v27.4s, v27.4s, v20.4s\n"
-        "sqxtn  v25.4h, v25.4s\n"
-        "sqrshl v28.4s, v28.4s, v20.4s\n"
-        "sqxtn  v27.4h, v27.4s\n"
-        "sqxtn2 v25.8h, v26.4s\n"
-        "sqxtn2 v27.8h, v28.4s\n"
-        "sqadd  v25.8h, v25.8h, v0.8h\n"
-        "sqadd  v26.8h, v27.8h, v0.8h\n"
-        "sqxtn  v25.8b, v25.8h\n"
-        "sqxtn2 v25.16b, v26.8h\n"
-        "smax   v25.16b, v25.16b, v1.16b\n"
-        "add    x12, x13, x21\n"
-        "smin   v25.16b, v25.16b, v2.16b\n"
-        "str    s25, [x13]\n"
-        "st1    { v25.s }[1], [x12]\n"
-        "add    x12, x13, x6\n"
-        "ushr   v24.2d, v24.2d, #8\n"
-        "mov    v28.16b, v19.16b\n"
-        "mov    v29.16b, v19.16b\n"
-        "mov    v30.16b, v19.16b\n"
-        "mov    v31.16b, v19.16b\n"
-        "st1    { v25.s }[2], [x12]\n"
-        "add    x12, x13, x16\n"
-        "subs   w14, w14, #1\n"  // =1
-        "ushr   v22.2d, v22.2d, #8\n"
-        "ushr   v23.2d, v23.2d, #8\n"
-        ".word 0x4f98e21c  // sdot   v28.4s, v16.16b, v24.4b[0]\n"
-        ".word 0x4f98e23d  // sdot   v29.4s, v17.16b, v24.4b[0]\n"
-        ".word 0x4f98e25e  // sdot   v30.4s, v18.16b, v24.4b[0]\n"
-        "add    x13, x13, %[function_params]\n"
-        ".word 0x4f98ea5f  // sdot   v31.4s, v18.16b, v24.4b[2]\n"
-        "st1    { v25.s }[3], [x12]\n"
-        "b.ne   " DC_KERNEL_MULT_14 "b\n"
-        "b      " DC_KERNEL_MULT_7 "b\n"
-        DC_KERNEL_MULT_15 ":\n"  // in Loop: Header=BB107_8 Depth=2
-        "ldr    x11, [sp, #72]\n"  // 8-byte Folded Reload
-        "ldr    x6, [sp, #232]\n"  // 8-byte Folded Reload
-        "mov    w12, wzr\n"
-        "mov    x14, %[scratch_block_data]\n"
-        "add    x13, x11, x15, lsl #2\n"
-        "ldr    w16, [sp, #324]\n"  // 4-byte Folded Reload
-        "cmp    w12, w16\n"
-        "b.lt   " DC_KERNEL_MULT_12 "b\n"
-        "b      " DC_KERNEL_MULT_7 "b\n"
-        DC_KERNEL_MULT_16 ":\n"  // in Loop: Header=BB107_5 Depth=1
-        "ldr    w16, [sp, #12]\n"  // 4-byte Folded Reload
-        "add    x11, %[bias_data], #32\n"  // =32
-        "tbnz   w16, #0,    " DC_KERNEL_MULT_3 "b\n"
-        // %bb.17:        // in Loop: Header=BB107_5 Depth=1
-        "ldp    x13, x16, [sp, #16]\n"  // 16-byte Folded Reload
-        "mov    x12, x14\n"
-        "lsl    w12, w12, #3\n"
-        "lsl    x12, x12, #2\n"
-        "add    x13, x13, x12\n"
-        "add    x12, x16, x12\n"
-        "ldp    q19, q20, [%[bias_data]]\n"
-        "ldp    q21, q22, [x13]\n"
-        "ldp    q23, q24, [x12]\n"
-        "ldr    x15, [sp, #72]\n"  // 8-byte Folded Reload
-        "ldr    %[scratch_block_data], [sp, #304]\n"  // 8-byte Folded Reload
-        "mov    x21, %[output_block_data]\n"
-        "mov    x14, xzr\n"
-        "b      " DC_KERNEL_MULT_19 "f\n"
-        DC_KERNEL_MULT_18 ":\n"  // in Loop: Header=BB107_19 Depth=2
-        "ldr    x12, [sp, #80]\n"  // 8-byte Folded Reload
-        "add    x14, x14, #1\n"  // =1
-        "cmp    x14, x12\n"
-        "ldr    x12, [sp, #256]\n"  // 8-byte Folded Reload
-        "add    x15, x15, x12\n"
-        "b.eq   " DC_KERNEL_MULT_2 "b\n"
-        DC_KERNEL_MULT_19 ":\n"  // Parent Loop BB107_5 Depth=1
-        // =>  This Loop Header: Depth=2
-        // Child Loop BB107_21 Depth 3
-        // Child Loop BB107_22 Depth 4
-        "ldr    x12, [sp, #264]\n"  // 8-byte Folded Reload
-        "mov    w13, wzr\n"
-        "madd   x6, x14, %[scratch_block_data], x12\n"
-        "ldr    w12, [x6]\n"
-        "add    x16, x6, %[scratch_block_data]\n"
-        "fmov   s25, w12\n"
-        "mov    v25.s[1], w12\n"
-        "ld1    { v25.s }[2], [x16]\n"
-        "ldr    x16, [sp, #328]\n"  // 8-byte Folded Reload
-        "mov    v25.s[3], w12\n"
-        "add    x16, x6, x16\n"
-        "ld1r   { v26.4s }, [x16]\n"
-        "mov    x16, x15\n"
-        "b      " DC_KERNEL_MULT_21 "f\n"
-        DC_KERNEL_MULT_20 ":\n"  // in Loop: Header=BB107_21 Depth=3
-        "ldr    w12, [sp, #324]\n"  // 4-byte Folded Reload
-        "add    w13, w13, #1\n"  // =1
-        "cmp    w13, w12\n"
-        "b.eq   " DC_KERNEL_MULT_18 "b\n"
-        DC_KERNEL_MULT_21 ":\n"  // Parent Loop BB107_5 Depth=1
-        // Parent Loop BB107_19 Depth=2
-        // =>  This Loop Header: Depth=3
-        // Child Loop BB107_22 Depth 4
-        "ldr    %[output_block_data], [sp, #328]\n"  // 8-byte Folded Reload
-        "add    x6, x6, #4\n"  // =4
-        "mov    x12, x6\n"
-        "ld1    { v25.s }[1], [x12], %[output_block_data]\n"
-        "ldr    w3, [sp, #316]\n"  // 4-byte Folded Reload
-        "ld1    { v26.s }[1], [x12]\n"
-        "ldr    w12, [sp, #320]\n"  // 4-byte Folded Reload
-        "cmp    w13, w3\n"
-        "add    %[output_block_data], x6, %[scratch_block_data]\n"
-        "ld1    { v25.s }[3], [%[output_block_data]]\n"
-        "csel   w12, w12, w10, eq\n"
-        "cmp    w12, #1\n"  // =1
-        "b.lt   " DC_KERNEL_MULT_20 "b\n"
-        DC_KERNEL_MULT_22 ":\n"  // Parent Loop BB107_5 Depth=1
-        // Parent Loop BB107_19 Depth=2
-        // Parent Loop BB107_21 Depth=3
-        // =>  This Inner Loop Header: Depth=4
-        "mov    v27.16b, v19.16b\n"
-        "mov    v28.16b, v20.16b\n"
-        ".word 0x4f99e25b  // sdot   v27.4s, v18.16b, v25.4b[0]\n"
-        ".word 0x4f99e0bc  // sdot   v28.4s, v5.16b, v25.4b[0]\n"
-        ".word 0x4f99ea3b  // sdot   v27.4s, v17.16b, v25.4b[2]\n"
-        ".word 0x4f99e8dc  // sdot   v28.4s, v6.16b, v25.4b[2]\n"
-        ".word 0x4f9ae21b  // sdot   v27.4s, v16.16b, v26.4b[0]\n"
-        ".word 0x4f9ae0fc  // sdot   v28.4s, v7.16b, v26.4b[0]\n"
-        "sqrdmulh        v27.4s, v27.4s, v23.4s\n"
-        "sqrdmulh        v28.4s, v28.4s, v24.4s\n"
-        "sqrshl v27.4s, v27.4s, v21.4s\n"
-        "sqrshl v28.4s, v28.4s, v22.4s\n"
-        "sqxtn  v27.4h, v27.4s\n"
-        "sqxtn2 v27.8h, v28.4s\n"
-        "sqadd  v27.8h, v27.8h, v0.8h\n"
-        "sqxtn  v27.8b, v27.8h\n"
-        "smax   v27.8b, v27.8b, v3.8b\n"
-        "smin   v27.8b, v27.8b, v4.8b\n"
-        "subs   w12, w12, #1\n"  // =1
-        "ushr   v25.2d, v25.2d, #8\n"
-        "ushr   v26.2d, v26.2d, #8\n"
-        "str    d27, [x16]\n"
-        "add    x16, x16, %[function_params]\n"
-        "b.ne   " DC_KERNEL_MULT_22 "b\n"
-        "b      " DC_KERNEL_MULT_20 "b\n"
-        DC_KERNEL_MULT_23 ":\n"
-
-
-        // Compiled intrinsics total stack 448, now 352 for spillage only.
-        "add    sp, sp, #352\n"  // =448
-        :
-        // Outputs.
-        [ scratch_block_data ] "+r"(scratch_block_data),
-        [ filter_workspace ] "+r"(filter_workspace),
-        [ bias_data ] "+r"(bias_data),
-        [ output_block_data ] "+r"(output_block_data)
-        :
-        // Inputs.
-        [ function_params ] "r"(function_params)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v16", "v17", "v18", "v19", "v20",
-        "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
-        "v31",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
-        "x16", "x17", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26",
-        "x27", "x28");
-
-#undef DC_KERNEL_MULT_1
-#undef DC_KERNEL_MULT_2
-#undef DC_KERNEL_MULT_3
-#undef DC_KERNEL_MULT_4
-#undef DC_KERNEL_MULT_5
-#undef DC_KERNEL_MULT_6
-#undef DC_KERNEL_MULT_7
-#undef DC_KERNEL_MULT_8
-#undef DC_KERNEL_MULT_9
-#undef DC_KERNEL_MULT_10
-#undef DC_KERNEL_MULT_11
-#undef DC_KERNEL_MULT_12
-#undef DC_KERNEL_MULT_13
-#undef DC_KERNEL_MULT_14
-#undef DC_KERNEL_MULT_15
-#undef DC_KERNEL_MULT_16
-#undef DC_KERNEL_MULT_17
-#undef DC_KERNEL_MULT_18
-#undef DC_KERNEL_MULT_19
-#undef DC_KERNEL_MULT_20
-#undef DC_KERNEL_MULT_21
-#undef DC_KERNEL_MULT_22
-#undef DC_KERNEL_MULT_23
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         int8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockNeon(scratch_block_data, filter_workspace, bias_data,
-                         output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock {
-  static inline void KernelMacroBlockNeon(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, int8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Note that argument registers may be reused after parameter loading.
-    // x0 %[scratch_block_data]
-    // x1 %[filter_workspace]
-    // x2 %[bias_data]
-    // x3 %[output_block_data]
-    // x4 %[function_params]
-#define DC_KERNEL_MULT_STRIDE_1 "1"
-#define DC_KERNEL_MULT_STRIDE_2 "2"
-#define DC_KERNEL_MULT_STRIDE_3 "3"
-#define DC_KERNEL_MULT_STRIDE_4 "4"
-#define DC_KERNEL_MULT_STRIDE_5 "5"
-#define DC_KERNEL_MULT_STRIDE_6 "6"
-#define DC_KERNEL_MULT_STRIDE_7 "7"
-#define DC_KERNEL_MULT_STRIDE_8 "8"
-#define DC_KERNEL_MULT_STRIDE_9 "9"
-#define DC_KERNEL_MULT_STRIDE_10 "10"
-#define DC_KERNEL_MULT_STRIDE_11 "11"
-#define DC_KERNEL_MULT_STRIDE_12 "12"
-#define DC_KERNEL_MULT_STRIDE_13 "13"
-#define DC_KERNEL_MULT_STRIDE_14 "14"
-#define DC_KERNEL_MULT_STRIDE_15 "15"
-#define DC_KERNEL_MULT_STRIDE_16 "16"
-#define DC_KERNEL_MULT_STRIDE_17 "17"
-#define DC_KERNEL_MULT_STRIDE_18 "18"
-
-    asm volatile(
-        // Compiled code used block of 32 for spill out of total stack of 112.
-        "sub    sp, sp, #32\n"  // =112
-
-
-        "ldr    w8, [%[function_params], #" STR(DP_OFFSET_DEPTH_MICRO_REPEATS) "]\n"
-        "cmp    w8, #1\n"  // =1
-        "b.lt   " DC_KERNEL_MULT_STRIDE_18 "f\n"
-        // %bb.1:
-        "ldr    w7, [%[function_params], #" STR(DP_OFFSET_OUTPUT_RESIDUAL_WIDTH) "]\n"
-        "ldp    w12, w22, [%[function_params], #" STR(DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS) "]\n"
-        "ldpsw  x10, x11, [%[function_params], #" STR(DP_OFFSET_OUTPUT_HEIGHT_STRIDE) "]\n"
-        "ldrsw  x17, [%[function_params], #" STR(DP_OFFSET_OUTPUT_DEPTH) "]\n"
-        "add    x13, %[function_params], #" STR(DP_OFFSET_OUTPUT_OFFSET) "\n"  // =28
-        "add    x14, %[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MAX) "\n"  // =44
-        "add    x6, %[function_params], #" STR(DP_OFFSET_QUANTIZED_ACTIVATION_MIN) "\n"  // =40
-        "cmp    w7, #2\n"  // =2
-        "ldp    x15, x16, [%[function_params], #" STR(DP_OFFSET_OUTPUT_MULTPLIPLIER_PER_CHANNEL) "]\n"
-        "ldr    w4, [%[function_params], #" STR(DP_OFFSET_OUTBOUND_BLOCK_HEIGHT) "]\n"
-        "ld1r   { v0.8h }, [x13]\n"
-        "ld1r   { v1.8b }, [x6]\n"
-        "ld1r   { v2.8b }, [x14]\n"
-        "ccmp   w22, w12, #0, lt\n"
-        "add    x13, x10, x17\n"
-        "str    x22, [sp]\n"  // 8-byte Folded Spill
-        "csel   w22, w22, w12, lt\n"
-        "lsl    x6, x11, #1\n"
-        "add    x21, x13, #4\n"  // =4
-        "bic    w13, w22, w22, asr #31\n"
-        "mov    x9, xzr\n"
-        "add    x5, %[scratch_block_data], #4\n"  // =4
-        "str    w7, [sp, #12]\n"  // 4-byte Folded Spill
-        "add    x7, x17, #4\n"  // =4
-        "add    x19, x10, #4\n"  // =4
-        "add    x20, x6, x11\n"
-        "lsl    x14, x13, #2\n"
-        "sub    x13, x12, x13\n"
-        "stp    x13, x14, [sp, #16]\n"  // 16-byte Folded Spill
-        "b      " DC_KERNEL_MULT_STRIDE_3 "f\n"
-        DC_KERNEL_MULT_STRIDE_2 ":\n"  // in Loop: Header=BB108_3 Depth=1
-        "add    x9, x9, #1\n"  // =1
-        "cmp    x9, x8\n"
-        "b.eq   " DC_KERNEL_MULT_STRIDE_18 "f\n"
-        DC_KERNEL_MULT_STRIDE_3 ":\n"  // =>This Loop Header: Depth=1
-        // Child Loop BB108_16 Depth 2
-        // Child Loop BB108_11 Depth 2
-        // Child Loop BB108_6 Depth 2
-        // Child Loop BB108_13 Depth 2
-        "lsl    w13, w9, #3\n"
-        "lsl    x14, x13, #2\n"
-        "add    x23, x16, x14\n"
-        "ldp    q19, q20, [x23]\n"
-        "ldr    w23, [%[scratch_block_data]]\n"
-        "add    x14, x15, x14\n"
-        "ldp    q21, q22, [x14]\n"
-        "add    x14, %[scratch_block_data], x11\n"
-        "fmov   s23, w23\n"
-        "mov    v23.s[1], w23\n"
-        "ld1    { v23.s }[2], [x14]\n"
-        "ldp    q3, q4, [%[filter_workspace]]\n"
-        "ldp    q5, q6, [%[filter_workspace], #32]\n"
-        "ldp    q7, q16, [%[filter_workspace], #64]\n"
-        "ldp    q17, q18, [%[bias_data]], #32\n"
-        "ldr    s24, [%[scratch_block_data], x6]\n"
-        "add    %[filter_workspace], x1, #96\n"  // =96
-        "add    x25, %[output_block_data], x13\n"
-        "cmp    w4, #2\n"  // =2
-        "mov    v23.s[3], w23\n"
-        "b.ne   " DC_KERNEL_MULT_STRIDE_8 "f\n"
-        // %bb.4:        // in Loop: Header=BB108_3 Depth=1
-        "dup    v24.4s, v24.s[0]\n"
-        "add    x13, %[scratch_block_data], x20\n"
-        "add    x14, %[scratch_block_data], x11, lsl #2\n"
-        "ld1    { v24.s }[2], [x13]\n"
-        "ld1r   { v25.4s }, [x14]\n"
-        "cmp    w22, #1\n"  // =1
-        "lsl    x26, x11, #2\n"
-        "b.lt   " DC_KERNEL_MULT_STRIDE_12 "f\n"
-        // %bb.5:        // in Loop: Header=BB108_3 Depth=1
-        "mov    x27, xzr\n"
-        "mov    x28, x22\n"
-        DC_KERNEL_MULT_STRIDE_6 ":\n"  // Parent Loop BB108_3 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "and    x13, x27, #0xfffffffc\n"
-        "add    x13, x5, x13\n"
-        "mov    x23, x13\n"
-        "ld1    { v23.s }[1], [x23], x26\n"
-        "add    x24, x13, x6\n"
-        "ld1    { v24.s }[1], [x24]\n"
-        "add    x14, x13, x11\n"
-        "add    x24, x13, x20\n"
-        "ld1    { v23.s }[3], [x14]\n"
-        "ld1    { v24.s }[3], [x24]\n"
-        "mov    v27.16b, v17.16b\n"
-        "ld1    { v25.s }[1], [x23]\n"
-        "mov    v28.16b, v17.16b\n"
-        ".word 0x4f97e07b  // sdot   v27.4s, v3.16b, v23.4b[0]\n"
-        ".word 0x4f98e07c  // sdot   v28.4s, v3.16b, v24.4b[0]\n"
-        ".word 0x4f97e8bb  // sdot   v27.4s, v5.16b, v23.4b[2]\n"
-        ".word 0x4f98e8bc  // sdot   v28.4s, v5.16b, v24.4b[2]\n"
-        ".word 0x4f98e0fb  // sdot   v27.4s, v7.16b, v24.4b[0]\n"
-        ".word 0x4f99e0fc  // sdot   v28.4s, v7.16b, v25.4b[0]\n"
-        "sqrdmulh        v27.4s, v27.4s, v21.4s\n"
-        "sqrdmulh        v28.4s, v28.4s, v21.4s\n"
-        "sqrshl v27.4s, v27.4s, v19.4s\n"
-        "sqrshl v28.4s, v28.4s, v19.4s\n"
-        "sqxtn  v31.4h, v27.4s\n"
-        "sqxtn2 v31.8h, v28.4s\n"
-        "mov    v29.16b, v18.16b\n"
-        "sqadd  v28.8h, v31.8h, v0.8h\n"
-        "mov    v30.16b, v18.16b\n"
-        "sqxtn  v28.8b, v28.8h\n"
-        ".word 0x4f97e09d  // sdot   v29.4s, v4.16b, v23.4b[0]\n"
-        "add    x13, x25, x19\n"
-        "smax   v28.8b, v28.8b, v1.8b\n"
-        ".word 0x4f98e09e  // sdot   v30.4s, v4.16b, v24.4b[0]\n"
-        ".word 0x4f97e8dd  // sdot   v29.4s, v6.16b, v23.4b[2]\n"
-        "sub    x23, x13, #4\n"  // =4
-        "smin   v28.8b, v28.8b, v2.8b\n"
-        ".word 0x4f98e8de  // sdot   v30.4s, v6.16b, v24.4b[2]\n"
-        ".word 0x4f98e21d  // sdot   v29.4s, v16.16b, v24.4b[0]\n"
-        "str    s28, [x25]\n"
-        "st1    { v28.s }[1], [x23]\n"
-        ".word 0x4f99e21e  // sdot   v30.4s, v16.16b, v25.4b[0]\n"
-        "sqrdmulh        v28.4s, v29.4s, v22.4s\n"
-        "sqrdmulh        v29.4s, v30.4s, v22.4s\n"
-        "sqrshl v28.4s, v28.4s, v20.4s\n"
-        "sqrshl v29.4s, v29.4s, v20.4s\n"
-        "sqxtn  v28.4h, v28.4s\n"
-        "sqxtn2 v28.8h, v29.4s\n"
-        "sqadd  v28.8h, v28.8h, v0.8h\n"
-        "sqxtn  v28.8b, v28.8h\n"
-        "smax   v28.8b, v28.8b, v1.8b\n"
-        "smin   v28.8b, v28.8b, v2.8b\n"
-        "mov    v26.16b, v17.16b\n"
-        "str    s28, [x25, #4]\n"
-        "mov    v29.16b, v18.16b\n"
-        "st1    { v28.s }[1], [x13]\n"
-        "ushr   v28.2d, v23.2d, #16\n"
-        ".word 0x4f9ce07a  // sdot   v26.4s, v3.16b, v28.4b[0]\n"
-        ".word 0x4f9ce09d  // sdot   v29.4s, v4.16b, v28.4b[0]\n"
-        "mov    v27.16b, v17.16b\n"
-        "mov    v30.16b, v18.16b\n"
-        ".word 0x4f9ce8ba  // sdot   v26.4s, v5.16b, v28.4b[2]\n"
-        ".word 0x4f9ce8dd  // sdot   v29.4s, v6.16b, v28.4b[2]\n"
-        "ushr   v28.2d, v24.2d, #16\n"
-        ".word 0x4f9ce07b  // sdot   v27.4s, v3.16b, v28.4b[0]\n"
-        ".word 0x4f9ce09e  // sdot   v30.4s, v4.16b, v28.4b[0]\n"
-        ".word 0x4f9ce8bb  // sdot   v27.4s, v5.16b, v28.4b[2]\n"
-        ".word 0x4f9ce8de  // sdot   v30.4s, v6.16b, v28.4b[2]\n"
-        ".word 0x4f9ce0fa  // sdot   v26.4s, v7.16b, v28.4b[0]\n"
-        ".word 0x4f9ce21d  // sdot   v29.4s, v16.16b, v28.4b[0]\n"
-        "ushr   v28.2d, v25.2d, #16\n"
-        ".word 0x4f9ce0fb  // sdot   v27.4s, v7.16b, v28.4b[0]\n"
-        "sqrdmulh        v26.4s, v26.4s, v21.4s\n"
-        "sqrdmulh        v27.4s, v27.4s, v21.4s\n"
-        "sqrshl v26.4s, v26.4s, v19.4s\n"
-        "sqrshl v27.4s, v27.4s, v19.4s\n"
-        "sqxtn  v26.4h, v26.4s\n"
-        "sqxtn2 v26.8h, v27.4s\n"
-        "sqadd  v26.8h, v26.8h, v0.8h\n"
-        ".word 0x4f9ce21e  // sdot   v30.4s, v16.16b, v28.4b[0]\n"
-        "sqrdmulh        v28.4s, v29.4s, v22.4s\n"
-        "sqxtn  v26.8b, v26.8h\n"
-        "add    x24, x25, x21\n"
-        "sqrdmulh        v29.4s, v30.4s, v22.4s\n"
-        "sqrshl v28.4s, v28.4s, v20.4s\n"
-        "smax   v26.8b, v26.8b, v1.8b\n"
-        "add    x23, x25, x7\n"
-        "sub    x13, x24, #4\n"  // =4
-        "sqrshl v29.4s, v29.4s, v20.4s\n"
-        "sqxtn  v28.4h, v28.4s\n"
-        "smin   v26.8b, v26.8b, v2.8b\n"
-        "stur   s26, [x23, #-4]\n"
-        "st1    { v26.s }[1], [x13]\n"
-        "sqxtn2 v28.8h, v29.4s\n"
-        "sqadd  v26.8h, v28.8h, v0.8h\n"
-        "sqxtn  v26.8b, v26.8h\n"
-        "add    x14, x25, x17\n"
-        "smax   v26.8b, v26.8b, v1.8b\n"
-        "subs   x28, x28, #1\n"  // =1
-        "ushr   v23.2d, v23.2d, #32\n"
-        "ushr   v24.2d, v24.2d, #32\n"
-        "ushr   v25.2d, v25.2d, #32\n"
-        "add    x25, x14, x17\n"
-        "smin   v26.8b, v26.8b, v2.8b\n"
-        "add    x27, x27, #4\n"  // =4
-        "str    s26, [x23]\n"
-        "st1    { v26.s }[1], [x24]\n"
-        "b.ne   " DC_KERNEL_MULT_STRIDE_6 "b\n"
-        // %bb.7:        // in Loop: Header=BB108_3 Depth=1
-        "mov    w13, w22\n"
-        "cmp    w13, w12\n"
-        "ldp    x13, x27, [sp, #16]\n"  // 16-byte Folded Reload
-        "b.lt   " DC_KERNEL_MULT_STRIDE_13 "f\n"
-        "b      " DC_KERNEL_MULT_STRIDE_2 "b\n"
-        DC_KERNEL_MULT_STRIDE_8 ":\n"  // in Loop: Header=BB108_3 Depth=1
-        "cmp    w12, #1\n"  // =1
-        "b.lt   " DC_KERNEL_MULT_STRIDE_2 "b\n"
-        // %bb.9:        // in Loop: Header=BB108_3 Depth=1
-        "ldr    w13, [sp, #12]\n"  // 4-byte Folded Reload
-        "dup    v24.4s, v24.s[0]\n"
-        "cmp    w13, #2\n"  // =2
-        "b.ne   " DC_KERNEL_MULT_STRIDE_14 "f\n"
-        // %bb.10:        // in Loop: Header=BB108_3 Depth=1
-        "mov    x26, xzr\n"
-        "mov    x13, x12\n"
-        DC_KERNEL_MULT_STRIDE_11 ":\n"  // Parent Loop BB108_3 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "and    x14, x26, #0xfffffffc\n"
-        "add    x14, x5, x14\n"
-        "mov    x23, x14\n"
-        "ld1    { v23.s }[1], [x23], x6\n"
-        "add    x14, x14, x11\n"
-        "mov    v26.16b, v17.16b\n"
-        "mov    v27.16b, v18.16b\n"
-        "ld1    { v24.s }[1], [x23]\n"
-        "ld1    { v23.s }[3], [x14]\n"
-        "mov    v25.16b, v17.16b\n"
-        "add    x14, x25, x17\n"
-        "ushr   v28.2d, v24.2d, #16\n"
-        ".word 0x4f9ce0fa  // sdot   v26.4s, v7.16b, v28.4b[0]\n"
-        ".word 0x4f9ce21b  // sdot   v27.4s, v16.16b, v28.4b[0]\n"
-        "ushr   v28.2d, v23.2d, #16\n"
-        ".word 0x4f9ce07a  // sdot   v26.4s, v3.16b, v28.4b[0]\n"
-        ".word 0x4f9ce09b  // sdot   v27.4s, v4.16b, v28.4b[0]\n"
-        ".word 0x4f9ce8ba  // sdot   v26.4s, v5.16b, v28.4b[2]\n"
-        ".word 0x4f9ce8db  // sdot   v27.4s, v6.16b, v28.4b[2]\n"
-        "mov    v28.16b, v18.16b\n"
-        ".word 0x4f98e0f9  // sdot   v25.4s, v7.16b, v24.4b[0]\n"
-        ".word 0x4f98e21c  // sdot   v28.4s, v16.16b, v24.4b[0]\n"
-        ".word 0x4f97e079  // sdot   v25.4s, v3.16b, v23.4b[0]\n"
-        ".word 0x4f97e09c  // sdot   v28.4s, v4.16b, v23.4b[0]\n"
-        ".word 0x4f97e8b9  // sdot   v25.4s, v5.16b, v23.4b[2]\n"
-        ".word 0x4f97e8dc  // sdot   v28.4s, v6.16b, v23.4b[2]\n"
-        "sqrdmulh        v25.4s, v25.4s, v21.4s\n"
-        "sqrdmulh        v28.4s, v28.4s, v22.4s\n"
-        "sqrshl v25.4s, v25.4s, v19.4s\n"
-        "sqrshl v28.4s, v28.4s, v20.4s\n"
-        "sqxtn  v25.4h, v25.4s\n"
-        "sqxtn2 v25.8h, v28.4s\n"
-        "sqadd  v25.8h, v25.8h, v0.8h\n"
-        "sqrdmulh        v26.4s, v26.4s, v21.4s\n"
-        "sqxtn  v25.8b, v25.8h\n"
-        "sqrdmulh        v27.4s, v27.4s, v22.4s\n"
-        "sqrshl v26.4s, v26.4s, v19.4s\n"
-        "smax   v25.8b, v25.8b, v1.8b\n"
-        "sqrshl v27.4s, v27.4s, v20.4s\n"
-        "sqxtn  v26.4h, v26.4s\n"
-        "smin   v25.8b, v25.8b, v2.8b\n"
-        "str    d25, [x25]\n"
-        "sqxtn2 v26.8h, v27.4s\n"
-        "sqadd  v25.8h, v26.8h, v0.8h\n"
-        "sqxtn  v25.8b, v25.8h\n"
-        "smax   v25.8b, v25.8b, v1.8b\n"
-        "smin   v25.8b, v25.8b, v2.8b\n"
-        "subs   x13, x13, #1\n"  // =1
-        "ushr   v24.2d, v24.2d, #32\n"
-        "ushr   v23.2d, v23.2d, #32\n"
-        "str    d25, [x25, x17]\n"
-        "add    x25, x14, x17\n"
-        "add    x26, x26, #4\n"  // =4
-        "b.ne   " DC_KERNEL_MULT_STRIDE_11 "b\n"
-        "b      " DC_KERNEL_MULT_STRIDE_2 "b\n"
-        DC_KERNEL_MULT_STRIDE_12 ":\n"  // in Loop: Header=BB108_3 Depth=1
-        "mov    w13, wzr\n"
-        "cmp    w13, w12\n"
-        "ldp    x13, x27, [sp, #16]\n"  // 16-byte Folded Reload
-        "b.ge   " DC_KERNEL_MULT_STRIDE_2 "b\n"
-        DC_KERNEL_MULT_STRIDE_13 ":\n"  // Parent Loop BB108_3 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "and    x14, x27, #0xfffffffc\n"
-        "add    x14, x5, x14\n"
-        "mov    x24, x14\n"
-        "add    x23, x14, x6\n"
-        "ld1    { v23.s }[1], [x24], x26\n"
-        "ld1    { v24.s }[1], [x23]\n"
-        "add    x23, x14, x11\n"
-        "add    x14, x14, x20\n"
-        "ld1    { v23.s }[3], [x23]\n"
-        "ld1    { v24.s }[3], [x14]\n"
-        "mov    v26.16b, v17.16b\n"
-        "ld1    { v25.s }[1], [x24]\n"
-        "mov    v27.16b, v17.16b\n"
-        ".word 0x4f97e07a  // sdot   v26.4s, v3.16b, v23.4b[0]\n"
-        ".word 0x4f98e07b  // sdot   v27.4s, v3.16b, v24.4b[0]\n"
-        ".word 0x4f97e8ba  // sdot   v26.4s, v5.16b, v23.4b[2]\n"
-        ".word 0x4f98e8bb  // sdot   v27.4s, v5.16b, v24.4b[2]\n"
-        ".word 0x4f98e0fa  // sdot   v26.4s, v7.16b, v24.4b[0]\n"
-        ".word 0x4f99e0fb  // sdot   v27.4s, v7.16b, v25.4b[0]\n"
-        "sqrdmulh        v26.4s, v26.4s, v21.4s\n"
-        "sqrdmulh        v27.4s, v27.4s, v21.4s\n"
-        "sqrshl v26.4s, v26.4s, v19.4s\n"
-        "sqrshl v27.4s, v27.4s, v19.4s\n"
-        "sqxtn  v26.4h, v26.4s\n"
-        "sqxtn2 v26.8h, v27.4s\n"
-        "sqadd  v26.8h, v26.8h, v0.8h\n"
-        "sqxtn  v26.8b, v26.8h\n"
-        "smax   v26.8b, v26.8b, v1.8b\n"
-        "add    x14, x25, x10\n"
-        "mov    v27.16b, v18.16b\n"
-        "smin   v26.8b, v26.8b, v2.8b\n"
-        "str    s26, [x25]\n"
-        "st1    { v26.s }[1], [x14]\n"
-        "mov    v26.16b, v18.16b\n"
-        ".word 0x4f97e09b  // sdot   v27.4s, v4.16b, v23.4b[0]\n"
-        ".word 0x4f98e09a  // sdot   v26.4s, v4.16b, v24.4b[0]\n"
-        ".word 0x4f97e8db  // sdot   v27.4s, v6.16b, v23.4b[2]\n"
-        ".word 0x4f98e8da  // sdot   v26.4s, v6.16b, v24.4b[2]\n"
-        ".word 0x4f98e21b  // sdot   v27.4s, v16.16b, v24.4b[0]\n"
-        ".word 0x4f99e21a  // sdot   v26.4s, v16.16b, v25.4b[0]\n"
-        "sqrdmulh        v27.4s, v27.4s, v22.4s\n"
-        "sqrdmulh        v26.4s, v26.4s, v22.4s\n"
-        "sqrshl v27.4s, v27.4s, v20.4s\n"
-        "sqrshl v26.4s, v26.4s, v20.4s\n"
-        "sqxtn  v27.4h, v27.4s\n"
-        "sqxtn2 v27.8h, v26.4s\n"
-        "sqadd  v26.8h, v27.8h, v0.8h\n"
-        "sqxtn  v26.8b, v26.8h\n"
-        "smax   v26.8b, v26.8b, v1.8b\n"
-        "smin   v26.8b, v26.8b, v2.8b\n"
-        "subs   x13, x13, #1\n"  // =1
-        "add    x14, x14, #4\n"  // =4
-        "ushr   v23.2d, v23.2d, #16\n"
-        "ushr   v24.2d, v24.2d, #16\n"
-        "ushr   v25.2d, v25.2d, #16\n"
-        "str    s26, [x25, #4]\n"
-        "add    x25, x25, x17\n"
-        "add    x27, x27, #4\n"  // =4
-        "st1    { v26.s }[1], [x14]\n"
-        "b.ne   " DC_KERNEL_MULT_STRIDE_13 "b\n"
-        "b      " DC_KERNEL_MULT_STRIDE_2 "b\n"
-        DC_KERNEL_MULT_STRIDE_14 ":\n"  // in Loop: Header=BB108_3 Depth=1
-        "ldr    x27, [sp]\n"  // 8-byte Folded Reload
-        "mov    x13, xzr\n"
-        "mov    x26, x12\n"
-        "b      " DC_KERNEL_MULT_STRIDE_16 "f\n"
-        DC_KERNEL_MULT_STRIDE_15 ":\n"  // in Loop: Header=BB108_16 Depth=2
-        "add    x13, x13, #4\n"  // =4
-        "subs   x26, x26, #1\n"  // =1
-        "sub    x27, x27, #1\n"  // =1
-        "mov    v23.16b, v25.16b\n"
-        "mov    v24.16b, v26.16b\n"
-        "b.eq   " DC_KERNEL_MULT_STRIDE_2 "b\n"
-        DC_KERNEL_MULT_STRIDE_16 ":\n"  // Parent Loop BB108_3 Depth=1
-        // =>  This Inner Loop Header: Depth=2
-        "and    x14, x13, #0xfffffffc\n"
-        "add    x14, x5, x14\n"
-        "mov    x23, x14\n"
-        "ld1    { v23.s }[1], [x23], x6\n"
-        "add    x14, x14, x11\n"
-        "mov    v25.16b, v17.16b\n"
-        "mov    v26.16b, v18.16b\n"
-        "ld1    { v24.s }[1], [x23]\n"
-        "ld1    { v23.s }[3], [x14]\n"
-        ".word 0x4f98e0f9  // sdot   v25.4s, v7.16b, v24.4b[0]\n"
-        ".word 0x4f98e21a  // sdot   v26.4s, v16.16b, v24.4b[0]\n"
-        ".word 0x4f97e079  // sdot   v25.4s, v3.16b, v23.4b[0]\n"
-        ".word 0x4f97e09a  // sdot   v26.4s, v4.16b, v23.4b[0]\n"
-        ".word 0x4f97e8b9  // sdot   v25.4s, v5.16b, v23.4b[2]\n"
-        ".word 0x4f97e8da  // sdot   v26.4s, v6.16b, v23.4b[2]\n"
-        "sqrdmulh        v25.4s, v25.4s, v21.4s\n"
-        "sqrdmulh        v26.4s, v26.4s, v22.4s\n"
-        "sqrshl v25.4s, v25.4s, v19.4s\n"
-        "sqrshl v26.4s, v26.4s, v20.4s\n"
-        "sqxtn  v27.4h, v25.4s\n"
-        "sqxtn2 v27.8h, v26.4s\n"
-        "sqadd  v26.8h, v27.8h, v0.8h\n"
-        "sqxtn  v26.8b, v26.8h\n"
-        "smax   v26.8b, v26.8b, v1.8b\n"
-        "smin   v26.8b, v26.8b, v2.8b\n"
-        "ushr   v25.2d, v23.2d, #16\n"
-        "str    d26, [x25]\n"
-        "ushr   v26.2d, v24.2d, #16\n"
-        "add    x25, x25, x17\n"
-        "cbz    x27,    " DC_KERNEL_MULT_STRIDE_15 "b\n"
-        // %bb.17:        // in Loop: Header=BB108_16 Depth=2
-        "mov    v27.16b, v17.16b\n"
-        "mov    v28.16b, v18.16b\n"
-        ".word 0x4f9ae0fb  // sdot   v27.4s, v7.16b, v26.4b[0]\n"
-        ".word 0x4f9ae21c  // sdot   v28.4s, v16.16b, v26.4b[0]\n"
-        ".word 0x4f99e07b  // sdot   v27.4s, v3.16b, v25.4b[0]\n"
-        ".word 0x4f99e09c  // sdot   v28.4s, v4.16b, v25.4b[0]\n"
-        ".word 0x4f99e8bb  // sdot   v27.4s, v5.16b, v25.4b[2]\n"
-        ".word 0x4f99e8dc  // sdot   v28.4s, v6.16b, v25.4b[2]\n"
-        "ushr   v25.2d, v23.2d, #32\n"
-        "sqrdmulh        v23.4s, v27.4s, v21.4s\n"
-        "ushr   v26.2d, v24.2d, #32\n"
-        "sqrdmulh        v24.4s, v28.4s, v22.4s\n"
-        "sqrshl v23.4s, v23.4s, v19.4s\n"
-        "sqrshl v24.4s, v24.4s, v20.4s\n"
-        "sqxtn  v23.4h, v23.4s\n"
-        "sqxtn2 v23.8h, v24.4s\n"
-        "sqadd  v23.8h, v23.8h, v0.8h\n"
-        "sqxtn  v23.8b, v23.8h\n"
-        "smax   v23.8b, v23.8b, v1.8b\n"
-        "smin   v23.8b, v23.8b, v2.8b\n"
-        "str    d23, [x25]\n"
-        "add    x25, x25, x17\n"
-        "b      " DC_KERNEL_MULT_STRIDE_15 "b\n"
-        DC_KERNEL_MULT_STRIDE_18 ":\n"
-
-        // Compiled intrinsics total stack 112, now 32 for spillage only.
-        "add    sp, sp, #32\n"  // =112
-        :
-        // Outputs.
-        [ scratch_block_data ] "+r"(scratch_block_data),
-        [ filter_workspace ] "+r"(filter_workspace),
-        [ bias_data ] "+r"(bias_data),
-        [ output_block_data ] "+r"(output_block_data)
-        :
-        // Inputs.
-        [ function_params ] "r"(function_params)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7",
-        "v16", "v17", "v18", "v19", "v20",
-        "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29", "v30",
-        "v31",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x8", "x9", "x10", "x11", "x12", "x13", "x14", "x15",
-        "x16", "x17", "x19", "x20", "x21", "x22", "x23", "x24", "x25", "x26",
-        "x27", "x28");
-
-#undef DC_KERNEL_MULT_STRIDE_1
-#undef DC_KERNEL_MULT_STRIDE_2
-#undef DC_KERNEL_MULT_STRIDE_3
-#undef DC_KERNEL_MULT_STRIDE_4
-#undef DC_KERNEL_MULT_STRIDE_5
-#undef DC_KERNEL_MULT_STRIDE_6
-#undef DC_KERNEL_MULT_STRIDE_7
-#undef DC_KERNEL_MULT_STRIDE_8
-#undef DC_KERNEL_MULT_STRIDE_9
-#undef DC_KERNEL_MULT_STRIDE_10
-#undef DC_KERNEL_MULT_STRIDE_11
-#undef DC_KERNEL_MULT_STRIDE_12
-#undef DC_KERNEL_MULT_STRIDE_13
-#undef DC_KERNEL_MULT_STRIDE_14
-#undef DC_KERNEL_MULT_STRIDE_15
-#undef DC_KERNEL_MULT_STRIDE_16
-#undef DC_KERNEL_MULT_STRIDE_17
-#undef DC_KERNEL_MULT_STRIDE_18
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         int8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockNeon(scratch_block_data, filter_workspace, bias_data,
-                         output_block_data, function_params);
-  }
-};
-
-#undef DP_OFFSET_INPUT_DEPTH
-#undef DP_OFFSET_OUTPUT_DEPTH
-#undef DP_OFFSET_STRIDE
-#undef DP_OFFSET_BIAS_INCREMENT
-//
-#undef DP_OFFSET_INPUT_OFFSET
-#undef DP_OFFSET_OUTPUT_OFFSET
-#undef DP_OFFSET_OUTPUT_MULTIPLIER
-#undef DP_OFFSET_OUTPUT_SHIFT
-#undef DP_OFFSET_QUANTIZED_ACTIVATION_MIN
-#undef DP_OFFSET_QUANTIZED_ACTIVATION_MAX
-//
-#undef DP_OFFSET_PADDING_LEFT
-#undef DP_OFFSET_PADDING_RIGHT
-#undef DP_OFFSET_PADDING_TOP
-#undef DP_OFFSET_PADDING_BOTTOM
-//
-#undef DP_OFFSET_DEPTH_MICRO_REPEATS
-//
-#undef DP_OFFSET_WIDTH_MACRO_COUNT
-#undef DP_OFFSET_INPUT_WIDTH_OVERALL_MICRO_REPEATS
-#undef DP_OFFSET_INPUT_WIDTH_MICRO_REPEATS
-#undef DP_OFFSET_RESIDUAL_WIDTH
-#undef DP_OFFSET_OUTPUT_WIDTH_OVERALL_MICRO_REPEATS
-#undef DP_OFFSET_OUTPUT_WIDTH_MICRO_REPEATS
-#undef DP_OFFSET_OUTPUT_RESIDUAL_WIDTH
-#undef DP_OFFSET_WORKSPACE_WIDTH_MICRO_REPEATS
-//
-#undef DP_OFFSET_HEIGHT_MACRO_COUNT
-#undef DP_OFFSET_INBOUND_BLOCK_HEIGHT
-#undef DP_OFFSET_OUTBOUND_BLOCK_HEIGHT
-#undef DP_OFFSET_INPUT_HEIGHT_STRIDE
-#undef DP_OFFSET_OUTPUT_HEIGHT_STRIDE
-#undef DP_OFFSET_WORKSPACE_HEIGHT_STRIDE
-//
-#undef DP_OFFSET_FOUR_OVER_STRIDE
-
-#endif  // __aarch64__ && !GOOGLE_L4T - Dot product ops hard-coded
-
-// Top-level implementation function for 3x3 depthwise convolution using NEON
-// dot-product instructions.
-//
-// MACRO & MICRO BLOCKS
-//
-// The task is divided into macro blocks. Data is copied first into a macro
-// block in a workspace. This has two purposes: (a) bringing data into
-// cache, and (b) permuting data so that it can be used much more easily in
-// a dot-product filter.
-//
-// When there is no depth multiplication:
-//
-// The permutations required for dot-products are local, within 4 data points
-// down the depth and 4 across the width. We want to pull in input data at least
-// 8-bytes at a time, down the depth, and so we divide the macro blocks into
-// 1x4x8 (height, width, depth) and further divide the micro blocks into
-// sub-blocks with shape (1x4x4).
-//
-// Each macro-block is constructed from micro-blocks that are internally
-// rearranged during loading into the macro-block workspace.
-//
-// In other words, the micro-block shape is
-//     {1, 1, 4, 8}
-// Each macro block is typically shape
-//     {1, height_block_size, 4 * workspace_width_micro_repeats, 64}
-// and workspace_width_micro_repeats is chosen so it fits into the workspace.
-//
-// However, if depth < 64, we decrease the macro block depth, enabling us to
-// increase the macro-block width.
-//
-// When there is depth multiplication:
-//
-// We require input-depth = 1 and exploit that instead.  Note that output data
-// is still full-depth, *as is the filter and bias data after certain
-// adjustments*, and so the filter stage in this case still proceeds in terms of
-// sub-blocks.
-//
-// The Magic of these numbers:
-//     4 is the number of input elements used in each dot-product.
-//     8 is the number of inputs we load at a time into a register.
-//     64 is min amount of data to be loaded in a stretch (when possible).
-//
-// FILTER DATA PREPARATION
-//
-// Filter data needs to be permuted in a fashion like that of input data, and
-// this is done in a preprocessing stage. In addition, this stage extends the
-// filter in the direction of width from 3 to 4. The extra filter taps are set
-// to zero so that input data does not have to be zeroed before applying
-// dot-products.
-//
-// OVERALL COUNTS: HANDLING TRAILING ITERATION
-//
-// Often it is necessary to handle the last iteration in a loop differently,
-// generally because the final item is shorter. The logic to detect the
-// special case can be a bit expensive. We use a scheme in which there are
-// two counts, in a pattern like xxx_yyy_repeats and
-// xxx_overall_yyy_repeats. The first gives the count of "normal"
-// iterations. The loop iterates over the second count, and the induction
-// variable is checked to see if it reaches xxx_yyy_repeats. If there is no
-// special trailing iteration, xxx_yyy_repeats = xxx_overall_yyy_repeats,
-// and the special code is not executed.
-//
-// Example:
-// Suppose that we characterize a size s as
-// f(s) -> (block-4-repetitions, remainder, overall_repetitions):
-// f(11) -> (2, 3, 3)
-// f(12) -> (3, 0, 3)
-// f(13) -> (3, 1, 4)
-//
-// POINTING OUTSIDE OF INPUT ARRAY.
-//
-// When there is padding, the input data pointer passed to the fill routines
-// points outside of the input array and into a kind-of virtual padded
-// margin. It turns out that this simplifies the code and removes
-// conditional statements. It is hard to explain why without comparing two
-// versions of the code. In summary, this way the adjustment into the margin
-// can be made unconditionally, and the correction back into the input array
-// is done where there is a conditional already.
-//
-// OVERLAP
-//
-// Since this is *depthwise* conv, neither the batch nor the depth have overlap.
-// The height and depth overlap by (filter_size - 1). Thus some data is used
-// twice on the borders of macro blocks.
-//
-template 
-inline void DepthwiseConvDotProduct3x3Impl(
-    const DepthwiseParams& params, const RuntimeShape& input_shape,
-    const typename QuantizationTypeImpl::ExternalType*
-        input_data,
-    const RuntimeShape& filter_shape,
-    const typename QuantizationTypeImpl::ExternalType*
-        filter_data,
-    const RuntimeShape& bias_shape, const int32* bias_data,
-    const RuntimeShape& output_shape,
-    typename QuantizationTypeImpl::ExternalType* output_data,
-    int thread_start, int thread_end, int thread_dim) {
-  // Check kernel restrictions.
-  constexpr int filter_size = 3;
-  constexpr int kMaxStride = 2;
-  constexpr int kMaxPadding = 1;
-  constexpr int kSymmetricZeroPoint =
-      QuantizationTypeImpl::kIntSymmetricZeroPoint;
-  TFLITE_DCHECK_EQ(params.weights_offset, -kSymmetricZeroPoint);
-  TFLITE_DCHECK_LE(params.stride_width, kMaxStride);
-  TFLITE_DCHECK_EQ(params.stride_height, params.stride_width);
-  TFLITE_DCHECK_EQ(params.dilation_width_factor, 1);
-  TFLITE_DCHECK_EQ(params.dilation_height_factor, 1);
-  TFLITE_DCHECK_LE(params.padding_values.width, kMaxPadding);
-  TFLITE_DCHECK_LE(params.padding_values.height, kMaxPadding);
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(params.quantized_activation_min,
-                   params.quantized_activation_max);
-
-  // Key kernel parameters (along with padding handled later).
-  const int stride = params.stride_width;
-  const int depth_multiplier = params.depth_multiplier;
-  const bool has_depth_multiplication = depth_multiplier > 1;
-
-  // Extract task dimensions.
-  const int input_depth = input_shape.Dims(3);
-  const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  const int input_height = input_shape.Dims(1);
-  const int input_width = input_shape.Dims(2);
-  const int output_height = output_shape.Dims(1);
-  const int output_width = output_shape.Dims(2);
-  const int batches = MatchingDim(input_shape, 0, output_shape, 0);
-  TFLITE_DCHECK(!has_depth_multiplication || input_depth == 1);
-  TFLITE_DCHECK(has_depth_multiplication || input_depth == output_depth);
-  TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth);
-  TFLITE_DCHECK_EQ(input_depth * depth_multiplier, output_depth);
-  TFLITE_DCHECK_EQ(MatchingDim(filter_shape, 1, filter_shape, 2), filter_size);
-  TFLITE_DCHECK(thread_dim == 0 || thread_dim == 1);
-
-  // Return now if nothing to do.
-  if (output_width == 0 || output_height == 0) {
-    return;
-  }
-
-  // Kernel parameter structure: set basic fields.
-  //
-  // In asm it is easier to pass a structure than more than, say, 8 parameters.
-  DepthwiseConvDotProdParams function_params;
-  function_params.input_depth = input_depth;
-  function_params.output_depth = output_depth;
-  function_params.input_offset = params.input_offset;
-  function_params.output_offset = params.output_offset;
-  function_params.output_multiplier = params.output_multiplier;
-  function_params.output_shift = params.output_shift;
-  function_params.quantized_activation_min = params.quantized_activation_min;
-  function_params.quantized_activation_max = params.quantized_activation_max;
-  function_params.stride = stride;
-
-  // Handle inbound bias data.
-  //
-  // Note that this data is adjusted in a per-depth process before the main
-  // filters. The adjustment accounts for a non-symmetric input offset.
-  //
-  // Kernel subroutines need to be able to operate consistently on an bias
-  // array. Where there is no bias, we provide one filled with zeros.
-  constexpr int kMinBiasLoad = 8;
-  int32 zero_bias_data[kMinBiasLoad];
-  int32 bias_increment;
-  if (bias_data) {
-    bias_increment = 4;
-  } else {
-    memset(zero_bias_data, 0, sizeof(zero_bias_data));
-    bias_data = &zero_bias_data[0];
-    bias_increment = 0;
-  }
-  function_params.bias_increment = bias_increment;
-  TFLITE_DCHECK_LE(2 * function_params.bias_increment, kMinBiasLoad);
-
-  // Process multithreading.
-  int batch_start = 0;
-  int batch_end = batches;
-  int row_start = 0;
-  int row_end = output_height;
-  switch (thread_dim) {
-    case 0:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, batches);
-      batch_start = thread_start;
-      batch_end = thread_end;
-      break;
-    case 1:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, output_height);
-      row_start = thread_start;
-      row_end = thread_end;
-      break;
-  }
-  const int row_count = row_end - row_start;
-
-  // Process padding.
-  //
-  // Whether "correct" or not, this matches ComputeConvSizes. When there is
-  // stride > 1 there can be padding on the bottom or top, and therefore
-  // we need to consider padding. This is true even if one or other of the
-  // padding_values is 0.
-  const int padded_width = (output_width - 1) * stride + filter_size;
-  int full_padding_top;
-  {
-    const int padding_left = params.padding_values.width;
-    // Right padding would be -1 if discarding input because of stride.
-    const int padding_right =
-        std::max(padded_width - input_width - padding_left, 0);
-    int padding_top = params.padding_values.height;
-    const int padded_height = (output_height - 1) * stride + filter_size;
-    int padding_bottom =
-        std::max(padded_height - input_height - padding_top, 0);
-
-    TFLITE_DCHECK_LE(padding_left, padding_right);
-    TFLITE_DCHECK_LE(padding_top, padding_bottom);
-
-    full_padding_top = padding_top;
-    if (row_start != 0) {
-      padding_top = 0;
-    }
-    if (row_end != output_height) {
-      padding_bottom = 0;
-    }
-
-    function_params.padding_left = padding_left;
-    function_params.padding_right = padding_right;
-    function_params.padding_top = padding_top;
-    function_params.padding_bottom = padding_bottom;
-  }
-  // When stride == 1 left or top padding may only be non-zero.
-  // This is when padding is specified but not needed on a trailing dimension.
-  // When stride == 2 right or bottom padding may only be non-zero.
-  // This is a result of the details of the padding calculations.
-  const bool padding_required =
-      function_params.padding_left > 0 || function_params.padding_top > 0 ||
-      function_params.padding_right > 0 || function_params.padding_bottom > 0;
-
-  // Choose parameter-specific kernel subroutines.
-  //
-  // The main part of the kernel has two stages. First, a temporary workspace is
-  // filled with padded and permuted data. Second, the filter is applied to the
-  // workspace data to generate output.
-  //
-  // The workspace fill stage handles padding so that the filter stage does not
-  // need to account for it. The workspace fill stage does not need to
-  // understand striding, and implicitly handles striding through the parameters
-  // that it is given.
-  using pack_macro_block_func_t = decltype(
-      &PackMacroBlock::Run);
-  using kernel_macro_block_func_t = decltype(
-      &KernelMacroBlock::Run);
-  pack_macro_block_func_t pack_macro_block_func;
-  kernel_macro_block_func_t kernel_macro_block_func;
-  {
-    if (has_depth_multiplication) {
-      if (padding_required) {
-        pack_macro_block_func =
-            PackMacroBlock::Run;
-      } else {
-        pack_macro_block_func =
-            PackMacroBlock::Run;
-      }
-      if (stride == 1) {
-        kernel_macro_block_func =
-            KernelMacroBlock::Run;
-      } else {
-        kernel_macro_block_func =
-            KernelMacroBlock::Run;
-      }
-    } else {
-      if (padding_required) {
-        pack_macro_block_func =
-            PackMacroBlock::Run;
-      } else {
-        pack_macro_block_func =
-            PackMacroBlock::Run;
-      }
-      if (stride == 1) {
-        kernel_macro_block_func = KernelMacroBlock<
-            implementation, quantization_type,
-            DepthwiseConvDepthMultiplication::kNoMultiplication,
-            /*stride=*/1>::Run;
-      } else {
-        kernel_macro_block_func = KernelMacroBlock<
-            implementation, quantization_type,
-            DepthwiseConvDepthMultiplication::kNoMultiplication,
-            /*stride=*/2>::Run;
-      }
-    }
-  }
-
-  // Stride-only variables.
-  //
-  const int row_count_per_macro = stride == 1 ? 4 : 2;
-  // row_count_per_macro * stride:
-  constexpr int input_height_per_macro = 4;
-  // Number of rows per micro block (= rows per macro block) is
-  //   (row_count_per_macro - 1) * stride + 1 + (filter_size - 1)
-  const int height_block_size = stride == 1 ? 3 + filter_size : 2 + filter_size;
-  const int input_height_overlap = filter_size - stride;
-  // stride == 1 ? 4 : 2:
-  function_params.four_over_stride = row_count_per_macro;
-
-  TFLITE_DCHECK_EQ(stride * function_params.four_over_stride, 4);
-  TFLITE_DCHECK_EQ(height_block_size,
-                   input_height_per_macro + input_height_overlap);
-
-  // Create workspaces.
-  //
-  // Filter workspace is for shuffle: only first depth/8 is used.
-  // indexed as [depth/8][sub-block][height][depth][width].
-  TFLITE_DCHECK_EQ(kDepthwiseConvAdjustedBiasLimit % 8, 0);
-  int8 macroblock_workspace[kDepthwiseConvScratchWorkspaceSize];
-  int32 adjusted_bias_data[kDepthwiseConvAdjustedBiasLimit];
-  int8 filter_workspace[kDepthwiseConvAdjustedBiasLimit >> 3][3][2][4][4];
-
-  // Output depth characterization.
-  //
-  const int depth_macro_count = output_depth / 64;
-  const int depth_overall_macro_count = (output_depth + 63) / 64;
-  // Number of micro blocks down the depth in a final incomplete macro block.
-  const int depth_trailing_micro_repeats = output_depth / 8 % 8;
-  // The output_depth may not have a remainder: it must be a multiple of 8.
-  TFLITE_DCHECK_EQ(output_depth,
-                   64 * depth_macro_count + 8 * depth_trailing_micro_repeats);
-
-  // Characterize the first macro block depth, the largest.
-  //
-  // We base treatment of the width on the trailing macro block if there are
-  // no full blocks, in order to do more work together (that is, increase
-  // workspace_width_micro_repeats when largest_macro_depth < 64).
-  const int largest_macro_depth =
-      has_depth_multiplication
-          ? 1
-          : (depth_macro_count > 0 ? 64 : 8 * depth_trailing_micro_repeats);
-
-  // Characterize width, consumption of input and generation of output.
-  //
-  // In the case of depth multiplication, we ensure that some of the workspace
-  // at the end remains unused. This enables the filter routines to load the
-  // "next" data, of at least 16 bytes, even when at the end of the workspace.
-  // It is relatively expensive to detect the end micro block. It is also very
-  // difficult to test for (to trigger) erroneous reads (past end of array) in
-  // the depth multiplication case.
-  int workspace_width_micro_repeats =
-      (has_depth_multiplication
-           ? kDepthwiseConvScratchWorkspaceSize - kWorkspaceExtension
-           : kDepthwiseConvScratchWorkspaceSize) /
-      (4 * largest_macro_depth * height_block_size);
-  // When there is no depth multiplication, the workspace depth is a multiple of
-  // 8, which ensures that workspace rows are 16-byte aligned. (Actually 32,
-  // because of the micro width of 4.) This is not necessarily the case under
-  // depth multiplication, so we adjust now to impose this restriction.
-  if (has_depth_multiplication) {
-    workspace_width_micro_repeats = (workspace_width_micro_repeats / 4) * 4;
-  }
-  TFLITE_DCHECK_EQ((workspace_width_micro_repeats * largest_macro_depth) % 4,
-                   0);
-  // Discount 1 of the micro-block repeats in each macro block to account for
-  // overlap.
-  const int consumed_width_per_macro_block =
-      4 * (workspace_width_micro_repeats - 1);
-  const int output_width_per_macro_block =
-      function_params.four_over_stride * (workspace_width_micro_repeats - 1);
-  TFLITE_DCHECK_GT(workspace_width_micro_repeats, 1);
-  TFLITE_DCHECK_EQ(output_width_per_macro_block * stride,
-                   consumed_width_per_macro_block);
-
-  // Width repetitions and residuals.
-  //
-  // Use of the workspace is characterized primarily in terms of *padded input*.
-  // Striding only matters in a few places.
-  //
-  // Simplifications: We require that there always be at least one full
-  // micro-block across the width. Since the maximum padding is 1, the trailing
-  // padding cannot span two micro blocks.
-  const int residual_micro_width = padded_width % 4;
-  // We base the count of macro blocks on the amount of padded input data each
-  // one consumes.
-  int width_overall_macro_count = (padded_width - residual_micro_width +
-                                   consumed_width_per_macro_block - 1) /
-                                  consumed_width_per_macro_block;
-  // Recall that we left a micro block at the end of each macro block for use as
-  // overlap. There is a special case in which we can use one fewer macro
-  // blocks, with the last one consuming extra input. (But not if the
-  // calculation thinks that we can use zero blocks.)
-  if (padded_width <=
-      ((width_overall_macro_count - 1) * consumed_width_per_macro_block + 4)) {
-    width_overall_macro_count -= 1;
-  }
-  width_overall_macro_count = std::max(width_overall_macro_count, 1);
-  // We always have to treat the final macro block along width as trailing,
-  // because even if it is full in terms of padded input, it will be incomplete
-  // in terms of output.
-  const int width_macro_count = width_overall_macro_count - 1;
-  // Micro blocks are traversed in terms of input in fill routines.
-  const int width_trailing_micro_repeats =
-      (padded_width - consumed_width_per_macro_block * width_macro_count) / 4;
-  const int width_overall_trailing_micro_repeats =
-      (padded_width - consumed_width_per_macro_block * width_macro_count + 3) /
-      4;
-  // Micro blocks are traversed in terms of output in filtering routines.
-  const int residual_output_micro_width =
-      (output_width - 1) % function_params.four_over_stride + 1;
-  const int output_width_trailing_micro_repeats =
-      residual_micro_width > (filter_size - 1)
-          ? width_trailing_micro_repeats
-          : width_trailing_micro_repeats - 1;
-  // Check results.
-  TFLITE_DCHECK_GT(width_overall_trailing_micro_repeats, 0);
-  TFLITE_DCHECK_EQ(padded_width,
-                   residual_micro_width +
-                       consumed_width_per_macro_block * width_macro_count +
-                       4 * width_trailing_micro_repeats);
-  TFLITE_DCHECK_LE(width_overall_macro_count, width_macro_count + 1);
-  TFLITE_DCHECK_GE(width_overall_macro_count, width_macro_count);
-
-  // Height repetitions and residuals.
-  //
-  int height_macro_count;
-  int residual_row_count;
-  int height_overall_macro_count;
-  if (stride == 1) {
-    TFLITE_DCHECK_EQ(row_count_per_macro, 4);
-    height_macro_count = row_count / 4;
-    residual_row_count = row_count % 4;
-    height_overall_macro_count = (row_count + 3) / 4;
-  } else {
-    TFLITE_DCHECK_EQ(row_count_per_macro, 2);
-    height_macro_count = row_count / 2;
-    residual_row_count = row_count % 2;
-    height_overall_macro_count = (row_count + 1) / 2;
-  }
-  TFLITE_DCHECK_EQ(
-      row_count, residual_row_count + row_count_per_macro * height_macro_count);
-  TFLITE_DCHECK_LE(height_overall_macro_count, height_macro_count + 1);
-  TFLITE_DCHECK_GE(height_overall_macro_count, height_macro_count);
-
-  // Data strides.
-  //
-  const int input_height_stride = input_width * input_depth;
-  const int output_height_stride = output_width * output_depth;
-  const int input_batch_stride = input_height_stride * input_height;
-  const int output_batch_stride = output_height_stride * output_height;
-  const int input_depth_macro_stride = has_depth_multiplication ? 0 : 64;
-  const int input_width_macro_stride =
-      input_depth * consumed_width_per_macro_block;
-  const int output_width_macro_stride =
-      output_depth * output_width_per_macro_block;
-
-  // Store parameters that do not vary across macro blocks.
-  //
-  function_params.workspace_width_micro_repeats = workspace_width_micro_repeats;
-  function_params.height_macro_count = height_overall_macro_count;
-  function_params.width_macro_count = width_overall_macro_count;
-  function_params.input_height_stride = input_height_stride;
-  function_params.output_height_stride = output_height_stride;
-  function_params.residual_width = residual_micro_width;
-
-  // Prefetch workspace for write, along with any necessary dummy writes.
-  const int max_workspace_height_stride =
-      16 * ((workspace_width_micro_repeats + 3) >> 2) * largest_macro_depth;
-  const int workspace_fill_size = std::min(
-      kDepthwiseConvScratchWorkspaceSize,
-      height_block_size * max_workspace_height_stride + kWorkspaceExtension);
-  WorkspacePrefetchWrite::Run(
-      params.weights_offset, workspace_fill_size, macroblock_workspace);
-
-  // Main process.
-  //
-  // Most kernels are nested batch-height-width-depth. Here we proceed over
-  // macro blocks batch-width-depth-height.
-  //
-  // Example of handling of trailing iteration: when there is trailing depth,
-  // depth_overall_macro_count = depth_macro_count + 1, so we can adjust the
-  // dimensions for trailing macro blocks by looking for
-  // j_depth == depth_macro_count.
-  for (int b = batch_start; b < batch_end; ++b) {
-    for (int k_width = 0; k_width < width_overall_macro_count; ++k_width) {
-      // Figure out the work to be done for this macro block. If it trails in
-      // any dimension, the work in that dimension is adjusted.
-      // The work to be done across widths has 3 cases:
-      // (a) A full macro block,
-      // (b) Partial terminal macro block, with input and output ending in
-      //     same micro block, and
-      // (c) Partial terminal macro block, with output corresponding to one
-      //     fewer micro blocks, because filter extends across micro-block
-      //     boundary.
-      if (k_width != width_macro_count) {
-        function_params.output_residual_width = 0;
-        function_params.input_width_micro_repeats =
-            workspace_width_micro_repeats;
-        function_params.input_width_overall_micro_repeats =
-            workspace_width_micro_repeats;
-        function_params.output_width_micro_repeats =
-            workspace_width_micro_repeats - 1;
-      } else {
-        function_params.output_residual_width = residual_output_micro_width;
-        function_params.input_width_micro_repeats =
-            width_trailing_micro_repeats;
-        function_params.input_width_overall_micro_repeats =
-            width_overall_trailing_micro_repeats;
-        function_params.output_width_micro_repeats =
-            output_width_trailing_micro_repeats;
-      }
-      function_params.output_width_overall_micro_repeats =
-          function_params.output_residual_width == 0
-              ? function_params.output_width_micro_repeats
-              : function_params.output_width_micro_repeats + 1;
-
-      for (int j_depth = 0; j_depth < depth_overall_macro_count; ++j_depth) {
-        if (quantization_type == QuantizationType::kPerChannelInt8) {
-          // Each macro block handles depth of 64 (8 micro). The kernel
-          // functions receive pointers to quantization data for the block being
-          // processed.
-          function_params.output_multiplier_per_channel =
-              params.output_multiplier_per_channel + 64 * j_depth;
-          function_params.output_shift_per_channel =
-              params.output_shift_per_channel + 64 * j_depth;
-        }
-        // Process filter and bias data.
-        //
-        function_params.depth_micro_repeats =
-            j_depth == depth_macro_count ? depth_trailing_micro_repeats : 8;
-        ProcessPerDepth::Run(
-            filter_data + 64 * j_depth,
-            bias_data + 8 * 2 * bias_increment * j_depth,
-            filter_workspace[0][0][0][0], adjusted_bias_data, &function_params);
-
-        const typename QuantizationTypeImpl::ExternalType*
-            input_data_block = input_data + b * input_batch_stride +
-                               j_depth * input_depth_macro_stride +
-                               k_width * input_width_macro_stride -
-                               function_params.padding_left * input_depth +
-                               row_start * stride * input_height_stride -
-                               full_padding_top * input_height_stride;
-        typename QuantizationTypeImpl::ExternalType*
-            output_data_block =
-                output_data + b * output_batch_stride +
-                row_start * output_height_stride + j_depth * 64 +
-                k_width * output_width_macro_stride;
-
-        // Under depth multiplication the workspace_height_stride does not have
-        // to depend on input_width_overall_micro_repeats, but this improves the
-        // compactness of workspace use.
-        const int workspace_height_stride =
-            has_depth_multiplication
-                ? 16 * ((function_params.input_width_overall_micro_repeats +
-                         3) >>
-                        2)
-                : 4 * function_params.input_width_overall_micro_repeats * 8 *
-                      function_params.depth_micro_repeats;
-        TFLITE_DCHECK_EQ(workspace_height_stride % 16, 0);
-        function_params.workspace_height_stride = workspace_height_stride;
-
-        // For the first macro block for output rows we fill in the first few
-        // rows.  After this we will copy them (see below in loop.)
-        function_params.inbound_block_height = input_height_overlap;
-        pack_macro_block_func(-1, k_width, input_data_block,
-                              macroblock_workspace, &function_params);
-        input_data_block += input_height_stride * input_height_overlap;
-
-        for (int i_height = 0; i_height < height_overall_macro_count;
-             ++i_height) {
-          if (i_height != height_macro_count) {
-            function_params.inbound_block_height = input_height_per_macro;
-            function_params.outbound_block_height = row_count_per_macro;
-          } else {
-            function_params.inbound_block_height = residual_row_count * stride;
-            function_params.outbound_block_height = residual_row_count;
-          }
-          TFLITE_DCHECK_LT(i_height * row_count_per_macro, row_count);
-          TFLITE_DCHECK_LT(i_height * input_height_per_macro, input_height);
-          TFLITE_DCHECK_LT(k_width * output_width_per_macro_block,
-                           output_width);
-          TFLITE_DCHECK_LT(k_width * consumed_width_per_macro_block,
-                           input_width);
-
-          // Macro blocks overlap by input_height_overlap rows, so we copy
-          // those instead of filling in afresh.  The first macro block across
-          // output rows was filled in outside of the loop (above).
-          if (i_height > 0) {
-            memcpy(macroblock_workspace,
-                   macroblock_workspace +
-                       input_height_per_macro * workspace_height_stride,
-                   input_height_overlap * workspace_height_stride);
-          }
-
-          pack_macro_block_func(
-              i_height, k_width, input_data_block,
-              macroblock_workspace +
-                  input_height_overlap * workspace_height_stride,
-              &function_params);
-
-          kernel_macro_block_func(
-              macroblock_workspace, filter_workspace[0][0][0][0],
-              adjusted_bias_data, output_data_block, &function_params);
-
-          input_data_block += input_height_stride * input_height_per_macro;
-          output_data_block += output_height_stride * row_count_per_macro;
-        }
-      }
-    }
-  }
-}
-
-template 
-inline void DepthwiseConvDotProduct3x3(
-    const DepthwiseParams& params, const RuntimeShape& input_shape,
-    const uint8* input_data, const RuntimeShape& filter_shape,
-    const uint8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape,
-    uint8* output_data, int thread_start, int thread_end, int thread_dim) {
-  DepthwiseConvDotProduct3x3Impl<
-      implementation, depthwise_conv::QuantizationType::kNonPerChannelUint8>(
-      params, input_shape, input_data, filter_shape, filter_data, bias_shape,
-      bias_data, output_shape, output_data, thread_start, thread_end,
-      thread_dim);
-}
-
-template 
-inline void DepthwiseConvDotProduct3x3PerChannel(
-    const DepthwiseParams& params, const RuntimeShape& input_shape,
-    const int8* input_data, const RuntimeShape& filter_shape,
-    const int8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape, int8* output_data,
-    int thread_start, int thread_end, int thread_dim) {
-  DepthwiseConvDotProduct3x3Impl<
-      implementation, depthwise_conv::QuantizationType::kPerChannelInt8>(
-      params, input_shape, input_data, filter_shape, filter_data, bias_shape,
-      bias_data, output_shape, output_data, thread_start, thread_end,
-      thread_dim);
-}
-
-#undef vst1_lane_8x4
-#undef vst1q_lane_8x4
-#undef vld1q_lane_s8x8
-#undef vld1_lane_8x4
-#undef vld1q_lane_8x4
-#undef vld1q_dup_s8x4
-
-#undef STR
-#undef STR_UNEXPANDED
-
-}  // namespace depthwise_conv
-}  // namespace optimized_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_UINT8_3X3_FILTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_transitional.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_transitional.h
deleted file mode 100644
index 7afdb98..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_transitional.h
+++ /dev/null
@@ -1,7966 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_UINT8_TRANSITIONAL_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_UINT8_TRANSITIONAL_H_
-
-// This file provides kernel implementations that are not used in shipped
-// inference code, but rather (a) show how model C++ code is designed and then
-// transformed into asm code, and (b) aid with maintenance and later development
-// of variations. Many projects (even including, say, the classic NAG libraries)
-// develop highly optimized code, but do not maintain intermediate versions.
-// Often the result is incomprehensible final-version code.
-
-#include 
-
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h"
-#include "tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_ops {
-namespace depthwise_conv {
-
-#ifdef USE_NEON
-
-inline void util_vst1_x8(uint8* data_addr, int8x8_t reg) {
-  return vst1_u8(data_addr, vreinterpret_u8_s8(reg));
-}
-inline void util_vst1_x8(int8* data_addr, int8x8_t reg) {
-  return vst1_s8(data_addr, reg);
-}
-
-// Lane operations are for clarity and convenience. We want to load and store
-// 4 8-bit lanes together. So these are treated much like 32-bit loads and
-// 32-bit stores. Stores require 32-bit alignment.
-
-#define vst1_lane_8x4(dst, reg, lane_num)                         \
-  TFLITE_DCHECK_EQ(reinterpret_cast(dst) % 4, 0); \
-  vst1_lane_u32(reinterpret_cast(dst), reg, lane_num)
-#define vst1q_lane_8x4(dst, reg, lane_num)                        \
-  TFLITE_DCHECK_EQ(reinterpret_cast(dst) % 4, 0); \
-  vst1q_lane_u32(reinterpret_cast(dst), reg, lane_num)
-
-// Important! Most compilation configurations will compile and run without
-// reinterpret_cast. Sanitizers may fail silently on lane-loading, with an
-// obscure bug or mis-feature probably in unhygienic macro expansion.
-#define vld1q_lane_s8x8(src, reg, lane_num) \
-  vld1q_lane_u64(reinterpret_cast(src), reg, lane_num)
-#define vld1_lane_8x4(src, reg, lane_num) \
-  vld1_lane_s32(reinterpret_cast(src), reg, lane_num)
-#define vld1q_lane_8x4(src, reg, lane_num) \
-  vld1q_lane_s32(reinterpret_cast(src), reg, lane_num)
-#define vld1q_dup_s8x4(src) vld1q_dup_s32(reinterpret_cast(src))
-
-#endif  // USE_NEON
-
-template 
-struct ProcessPerDepth {
-  // Filter data is provided as filter_block[3][3][depth/8][2][4]: height 3,
-  // width 3,  sub-block 0 or 1, depth 4. Filter data is written as
-  // filter_bank[3][2][4][4]; height 3, sub-block, depth 4, width 4.
-  //
-  // Note that this rearrangement is much like that performed on input data when
-  // filling the workspace, and optimized versions will be similar.
-  static inline void FillFilterBank(int depth, const uint8* filter_block,
-                                    int8 filter_bank[3][2][4][4]) {
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-    // Load filter data in, 8-bytes down depth / sub-block at a time.
-    //
-    // loaded_filter has dimensions height 3, width 4, sub-block 0 or 1,
-    // depth 4.
-    uint8 loaded_filter[3][4][2][4];
-    for (int y = 0; y < 3; ++y) {
-      for (int x = 0; x < 3; ++x) {
-        memcpy(loaded_filter[y][x][0], &filter_block[3 * y * depth + x * depth],
-               8);
-      }
-      // Pad the filter with symmetric representation of 0, so that the values
-      // become 0 when the zero-poing is added below. Thus these filter taps are
-      // effectively disregarded in later filtering.
-      memset(loaded_filter[y][3][0], kSymmetricZeroPoint, 8);
-    }
-    for (int y = 0; y < 3; ++y) {
-      for (int z = 0; z < 4; ++z) {
-        for (int x = 0; x < 4; ++x) {
-          filter_bank[y][0][z][x] =
-              loaded_filter[y][x][0][z] - kSymmetricZeroPoint;
-          filter_bank[y][1][z][x] =
-              loaded_filter[y][x][1][z] - kSymmetricZeroPoint;
-        }
-      }
-    }
-  }
-
-  // Adjust the bias (weights) data according to the input offset.
-  //
-  // The output calculation is
-  // out[h][w][d] = bias[d] + sum_ij (in[h+i][w+j][d] + in_offset) *
-  //                                 (filter[i][j][d] + filter_offset)
-  // (where offsets are expressed as differences from 128).
-  //
-  // Since we cannot efficiently handle varying offsets / bias across the image,
-  // we insist on filter_offset = 0.
-  //
-  // This function calculates
-  // adjusted_bias[d] = bias[d] + sum_ij in_offset * filter[i][j][d]
-  // which accounts for input offset. If the bias is constant over the depth,
-  // the adjusted bias will vary.
-  static inline void AdjustBias(int32 input_offset,
-                                const int8 filter_bank[3][2][4][4],
-                                const int32* bias_data,
-                                int32 adjusted_bias_block[2][4]) {
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-    TFLITE_DCHECK_GE(input_offset, -255);
-    TFLITE_DCHECK_LE(input_offset, 0);
-    // For instance, if input_offset == 128, no adjustment is needed.
-    const int32 input_offset_difference = input_offset + kSymmetricZeroPoint;
-
-    for (int s = 0; s < 2; ++s) {
-      for (int z = 0; z < 4; ++z) {
-        adjusted_bias_block[s][z] = bias_data[4 * s + z];
-        for (int i = 0; i < 9; ++i) {
-          adjusted_bias_block[s][z] +=
-              input_offset_difference * filter_bank[i % 3][s][z][i / 3];
-        }
-      }
-    }
-  }
-
-  static void Run(const uint8* filter_data, const int32* bias_data,
-                  int8* shuffled_filter_data, int32* adjusted_bias_data,
-                  const DepthwiseConvDotProdParams* function_params) {
-    constexpr int shuffled_filter_increment = 2 * 3 * 4 * 4;
-    const int depth = function_params->output_depth;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int bias_increment = function_params->bias_increment;
-    const int32 input_offset = function_params->input_offset;
-
-    int8 filter_bank[3][2][4][4];
-    int32 adjusted_bias_block[2][4];
-
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      FillFilterBank(depth, filter_data + 8 * j_depth, filter_bank);
-      AdjustBias(input_offset, filter_bank,
-                 bias_data + 2 * bias_increment * j_depth, adjusted_bias_block);
-
-      memcpy(shuffled_filter_data, filter_bank[0][0][0],
-             shuffled_filter_increment);
-      shuffled_filter_data += shuffled_filter_increment;
-      memcpy(adjusted_bias_data, adjusted_bias_block[0],
-             8 * sizeof(adjusted_bias_block[0][0]));
-      adjusted_bias_data += 8;
-    }
-  }
-};
-
-template 
-struct ProcessPerDepth {
-  static inline void Run(const uint8* filter_data, const int32* bias_data,
-                         int8* shuffled_filter_data, int32* adjusted_bias_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    const int depth = function_params->output_depth;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int bias_increment = function_params->bias_increment;
-
-    // Simulate NEON-register transposition of subset of filter.
-    int8 filter_bank_a_0[4][4];  // Depth 4, width 4.
-    int8 filter_bank_a_1[4][4];
-    int8 filter_bank_a_2[4][4];
-    int8 filter_bank_b_0[4][4];
-    int8 filter_bank_b_1[4][4];
-    int8 filter_bank_b_2[4][4];
-
-    // Load filter data in, essentially dropping the [depth/8] dimension, which
-    // is equivalent to loading just the depth needed for one micro-block.
-    //
-    // loaded_filter has dimensions height 3, width 4, sub-block 0 or 1,
-    // depth 4.
-    uint8 loaded_filter_0[4][2][4];
-    uint8 loaded_filter_1[4][2][4];
-    uint8 loaded_filter_2[4][2][4];
-
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-    const int32 input_offset = function_params->input_offset;
-    TFLITE_DCHECK_GE(input_offset, -255);
-    TFLITE_DCHECK_LE(input_offset, 0);
-    const int32 input_offset_difference = input_offset + kSymmetricZeroPoint;
-
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      const uint8* filter_block = filter_data + 8 * j_depth;
-
-      // Filter data is provided as filter_block[3][3][depth/8][2][4].
-      // height 3, width 3, micro-blocks, sub-block 0 or 1, depth 4.
-      // filter_bank[3][2][4][4]; Sub-block, height 3, depth 4, width 4.
-      for (int x = 0; x < 3; ++x) {
-        memcpy(loaded_filter_0[x][0], &filter_block[3 * 0 * depth + x * depth],
-               8);
-        memcpy(loaded_filter_1[x][0], &filter_block[3 * 1 * depth + x * depth],
-               8);
-        memcpy(loaded_filter_2[x][0], &filter_block[3 * 2 * depth + x * depth],
-               8);
-      }
-      // Pad the filter with -filter_offset, so that the values become 0 when
-      // the filter_offset is later added, and so the filter tap is effectively
-      // disregarded.
-      memset(loaded_filter_0[3][0], kSymmetricZeroPoint, 8);
-      memset(loaded_filter_1[3][0], kSymmetricZeroPoint, 8);
-      memset(loaded_filter_2[3][0], kSymmetricZeroPoint, 8);
-
-      for (int z = 0; z < 4; ++z) {
-        for (int x = 0; x < 4; ++x) {
-          filter_bank_a_0[z][x] =
-              loaded_filter_0[x][0][z] - kSymmetricZeroPoint;
-          filter_bank_b_0[z][x] =
-              loaded_filter_0[x][1][z] - kSymmetricZeroPoint;
-          filter_bank_a_1[z][x] =
-              loaded_filter_1[x][0][z] - kSymmetricZeroPoint;
-          filter_bank_b_1[z][x] =
-              loaded_filter_1[x][1][z] - kSymmetricZeroPoint;
-          filter_bank_a_2[z][x] =
-              loaded_filter_2[x][0][z] - kSymmetricZeroPoint;
-          filter_bank_b_2[z][x] =
-              loaded_filter_2[x][1][z] - kSymmetricZeroPoint;
-        }
-      }
-
-      memcpy(shuffled_filter_data, filter_bank_a_0, 16);
-      shuffled_filter_data += 16;
-      memcpy(shuffled_filter_data, filter_bank_b_0, 16);
-      shuffled_filter_data += 16;
-      memcpy(shuffled_filter_data, filter_bank_a_1, 16);
-      shuffled_filter_data += 16;
-      memcpy(shuffled_filter_data, filter_bank_b_1, 16);
-      shuffled_filter_data += 16;
-      memcpy(shuffled_filter_data, filter_bank_a_2, 16);
-      shuffled_filter_data += 16;
-      memcpy(shuffled_filter_data, filter_bank_b_2, 16);
-      shuffled_filter_data += 16;
-
-      int32 adjusted_bias_data_0[4];
-      int32 adjusted_bias_data_1[4];
-      // For instance, if input_offset == 128, no adjustment is needed.
-      for (int z = 0; z < 4; ++z) {
-        adjusted_bias_data_0[z] = bias_data[z];
-        adjusted_bias_data_1[z] = bias_data[4 + z];
-        for (int x = 0; x < 4; ++x) {
-          adjusted_bias_data_0[z] +=
-              input_offset_difference * filter_bank_a_0[z][x];
-          adjusted_bias_data_0[z] +=
-              input_offset_difference * filter_bank_a_1[z][x];
-          adjusted_bias_data_0[z] +=
-              input_offset_difference * filter_bank_a_2[z][x];
-          adjusted_bias_data_1[z] +=
-              input_offset_difference * filter_bank_b_0[z][x];
-          adjusted_bias_data_1[z] +=
-              input_offset_difference * filter_bank_b_1[z][x];
-          adjusted_bias_data_1[z] +=
-              input_offset_difference * filter_bank_b_2[z][x];
-
-          adjusted_bias_data[z] = adjusted_bias_data_0[z];
-          adjusted_bias_data[4 + z] = adjusted_bias_data_1[z];
-        }
-      }
-      bias_data += 2 * bias_increment;
-      adjusted_bias_data += 8;
-    }
-  }
-};
-
-#ifdef USE_NEON
-template 
-struct ProcessPerDepth {
-  static void ProcessPerDepthIntrinsics(
-      const typename QuantizationTypeImpl::ExternalType*
-          filter_data,
-      const int32* bias_data, int8* shuffled_filter_data,
-      int32* adjusted_bias_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    const int depth = function_params->output_depth;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int bias_increment = function_params->bias_increment;
-
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-    constexpr uint8 kSignBit =
-        QuantizationTypeImpl::kUint8SignBit;
-    const int32 input_offset = function_params->input_offset;
-    if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-      TFLITE_DCHECK_GE(input_offset, -255);
-      TFLITE_DCHECK_LE(input_offset, 0);
-    }
-    const int32 input_offset_difference = input_offset + kSymmetricZeroPoint;
-    const int8x16_t ones_vector = vdupq_n_s8(1);
-
-    // Simulate NEON-register transposition of subset of filter.
-    int8x16_t input_0_a;
-    int8x16_t input_0_b;
-    int8x16_t input_0_c;
-    int8x16_t input_1_a;
-    int8x16_t input_1_b;
-    int8x16_t input_1_c;
-    int8x16_t input_2_a;
-    int8x16_t input_2_b;
-    int8x16_t input_2_c;
-
-    int8x16_t filter_0_a;
-    int8x16_t filter_0_b;
-    int8x16_t filter_1_a;
-    int8x16_t filter_1_b;
-    int8x16_t filter_2_a;
-    int8x16_t filter_2_b;
-
-    // For uint8, effect subtraction of zero-point = 128 by XOR of sign bit.
-    const uint8x16_t sign_bit = vdupq_n_u8(kSignBit);
-
-    const typename QuantizationTypeImpl::ExternalType*
-        filter_block = filter_data;
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      // Filter data is provided as filter_block[3][3][depth/8][2][4].
-      // height 3, width 3, micro-blocks, sub-block 0 or 1, depth 4.
-      // filter_bank[3][2][4][4]; Sub-block, height 3, depth 4, width 4.
-
-      const typename QuantizationTypeImpl::ExternalType*
-          filter_block_ptr = filter_block;
-      input_0_a = vld1q_lane_s8x8(filter_block_ptr, input_0_a, 0);
-      filter_block_ptr += depth;
-      input_0_b = vld1q_lane_s8x8(filter_block_ptr, input_0_b, 0);
-      filter_block_ptr += depth;
-      input_0_c = vld1q_lane_s8x8(filter_block_ptr, input_0_c, 0);
-      filter_block_ptr += depth;
-      input_1_a = vld1q_lane_s8x8(filter_block_ptr, input_1_a, 0);
-      filter_block_ptr += depth;
-      input_1_b = vld1q_lane_s8x8(filter_block_ptr, input_1_b, 0);
-      filter_block_ptr += depth;
-      input_1_c = vld1q_lane_s8x8(filter_block_ptr, input_1_c, 0);
-      filter_block_ptr += depth;
-      input_2_a = vld1q_lane_s8x8(filter_block_ptr, input_2_a, 0);
-      filter_block_ptr += depth;
-      input_2_b = vld1q_lane_s8x8(filter_block_ptr, input_2_b, 0);
-      filter_block_ptr += depth;
-      input_2_c = vld1q_lane_s8x8(filter_block_ptr, input_2_c, 0);
-
-      filter_0_a = vzip1q_s8(input_0_a, input_0_b);
-      filter_0_b = vzip1q_s8(input_0_c, sign_bit);
-      filter_1_a = vzip1q_s8(input_1_a, input_1_b);
-      filter_1_b = vzip1q_s8(input_1_c, sign_bit);
-      filter_2_a = vzip1q_s8(input_2_a, input_2_b);
-      filter_2_b = vzip1q_s8(input_2_c, sign_bit);
-      if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-        filter_0_a = veorq_s8(filter_0_a, sign_bit);
-        filter_0_b = veorq_s8(filter_0_b, sign_bit);
-        filter_1_a = veorq_s8(filter_1_a, sign_bit);
-        filter_1_b = veorq_s8(filter_1_b, sign_bit);
-        filter_2_a = veorq_s8(filter_2_a, sign_bit);
-        filter_2_b = veorq_s8(filter_2_b, sign_bit);
-      }
-      vzipq_s8x2_in_place(&filter_0_a, &filter_0_b);
-      vzipq_s8x2_in_place(&filter_1_a, &filter_1_b);
-      vzipq_s8x2_in_place(&filter_2_a, &filter_2_b);
-
-      vst1q_s8(shuffled_filter_data, filter_0_a);
-      shuffled_filter_data += 16;
-      vst1q_s8(shuffled_filter_data, filter_0_b);
-      shuffled_filter_data += 16;
-      vst1q_s8(shuffled_filter_data, filter_1_a);
-      shuffled_filter_data += 16;
-      vst1q_s8(shuffled_filter_data, filter_1_b);
-      shuffled_filter_data += 16;
-      vst1q_s8(shuffled_filter_data, filter_2_a);
-      shuffled_filter_data += 16;
-      vst1q_s8(shuffled_filter_data, filter_2_b);
-      shuffled_filter_data += 16;
-
-      int32x4_t adjusted_bias_data_a = vld1q_s32(bias_data);
-      bias_data += bias_increment;
-      int32x4_t adjusted_bias_data_b = vld1q_s32(bias_data);
-      bias_data += bias_increment;
-      // For instance, if input_offset is kIntSymmetricZeroPoint, no adjustment
-      // is needed.
-
-      int32x4_t filter_sum_a = vdupq_n_s32(0);
-      filter_sum_a = vdotq_s32(filter_sum_a, filter_0_a, ones_vector);
-      filter_sum_a = vdotq_s32(filter_sum_a, filter_1_a, ones_vector);
-      filter_sum_a = vdotq_s32(filter_sum_a, filter_2_a, ones_vector);
-      int32x4_t filter_sum_b = vdupq_n_s32(0);
-      filter_sum_b = vdotq_s32(filter_sum_b, filter_0_b, ones_vector);
-      filter_sum_b = vdotq_s32(filter_sum_b, filter_1_b, ones_vector);
-      filter_sum_b = vdotq_s32(filter_sum_b, filter_2_b, ones_vector);
-
-      adjusted_bias_data_a = vmlaq_n_s32(adjusted_bias_data_a, filter_sum_a,
-                                         input_offset_difference);
-      adjusted_bias_data_b = vmlaq_n_s32(adjusted_bias_data_b, filter_sum_b,
-                                         input_offset_difference);
-
-      vst1q_s32(adjusted_bias_data, adjusted_bias_data_a);
-      adjusted_bias_data += 4;
-      vst1q_s32(adjusted_bias_data, adjusted_bias_data_b);
-      adjusted_bias_data += 4;
-
-      filter_block += 8;
-    }
-  }
-
-  static inline void Run(const typename QuantizationTypeImpl<
-                             quantization_type>::ExternalType* filter_data,
-                         const int32* bias_data, int8* shuffled_filter_data,
-                         int32* adjusted_bias_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    ProcessPerDepthIntrinsics(filter_data, bias_data, shuffled_filter_data,
-                              adjusted_bias_data, function_params);
-  }
-};
-#endif
-
-template 
-struct PackMacroBlock<
-    DepthwiseConvImplementation::kUseCModel3x3DotProduct, quantization_type,
-    DepthwiseConvDepthMultiplication::kNoMultiplication, max_padding> {
-  // A straight copy of a macro block of input data into a scratch buffer.
-  //
-  // Requirement: depth_micro_repeats > 0.
-  static inline void CopyMacroBlock(
-      int32 height_block_number, int32 width_block_number,
-      const DepthwiseConvDotProdParams& function_params,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data) {
-    TFLITE_DCHECK_LE(max_padding, 1);
-
-    // Strides.
-    // The input depth and count of micro blocks provide the width strides.
-    const int input_height_stride = function_params.input_height_stride;
-    const int workspace_height_stride = function_params.workspace_height_stride;
-    const int input_depth = function_params.input_depth;
-    const int depth_micro_repeats = function_params.depth_micro_repeats;
-    TFLITE_DCHECK_GT(depth_micro_repeats, 0);
-
-    // Remaining iteration and dimension parameters.
-    //
-    // If width_overall_micro_repeats = input_width_micro_repeats + 1, then the
-    // final micro block is incomplete.
-    const int width_overall_micro_repeats =
-        function_params.input_width_overall_micro_repeats;
-    int input_width_micro_repeats = function_params.input_width_micro_repeats;
-    const int residual_width = function_params.residual_width;
-    const int block_height = function_params.inbound_block_height;
-
-    const int padding_left = function_params.padding_left;
-    const int padding_right = function_params.padding_right;
-    const int padding_top = function_params.padding_top;
-    const int padding_bottom = function_params.padding_bottom;
-
-    const bool leading_width_padding =
-        padding_left > 0 && width_block_number == 0;
-    const bool trailing_width_padding =
-        padding_right > 0 &&
-        width_block_number == (function_params.width_macro_count - 1);
-    const bool leading_height_padding =
-        padding_top > 0 && height_block_number < 0;
-    const bool trailing_height_padding =
-        padding_bottom > 0 &&
-        height_block_number == (function_params.height_macro_count - 1);
-
-    // Modify the trailing case to reflect the input width.
-    int input_residual_width =
-        input_width_micro_repeats < width_overall_micro_repeats ? residual_width
-                                                                : 4;
-    if (trailing_width_padding) {
-      input_residual_width -= 1;
-      input_width_micro_repeats = width_overall_micro_repeats - 1;
-    }
-
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-    const int32 input_offset_difference =
-        function_params.input_offset + kSymmetricZeroPoint;
-
-    // We load data into a temporary buffer and then save, to match subsequent
-    // processing. This will make it easier to combine stages into one ASM
-    // routine.
-    int8 tmp_load[4][2][4];
-
-    int copy_block_height = block_height;
-    if (leading_height_padding) {
-      memset(scratch_block_data, -input_offset_difference,
-             workspace_height_stride);
-      scratch_block_data += workspace_height_stride;
-      input_block_data += input_height_stride;
-      copy_block_height -= 1;
-    }
-    if (trailing_height_padding) {
-      copy_block_height -= 1;
-    }
-
-    // The outer 3 loops go through all the micro blocks in a macro block.
-    for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-      for (int j_width = 0; j_width < width_overall_micro_repeats; ++j_width) {
-        // Figure out division of work (available input vs trailing padding).
-        int adjusted_residual_width =
-            j_width == input_width_micro_repeats ? input_residual_width : 4;
-
-        int start_width = 0;
-        if (leading_width_padding && j_width == 0) {
-          start_width = 1;
-          memset(tmp_load[0][0], -input_offset_difference, 8);
-        }
-        if (adjusted_residual_width < 4) {
-          for (int x = adjusted_residual_width; x < 4; ++x) {
-            memset(tmp_load[x][0], -input_offset_difference, 8);
-          }
-        }
-
-        for (int i_depth = 0; i_depth < depth_micro_repeats; ++i_depth) {
-          // The inner 3 loops go through the sub-block, depth and width within
-          // each micro block.
-
-          // Load, and apply symmetric offset.
-          int8* scratch_data =
-              scratch_block_data + k_height * workspace_height_stride +
-              j_width * 4 * 8 + i_depth * 4 * 8 * width_overall_micro_repeats;
-          const typename QuantizationTypeImpl::ExternalType*
-              input_data = input_block_data + k_height * input_height_stride +
-                           j_width * 4 * input_depth + i_depth * 8;
-          // Full-size macro blocks are 2*4*4 = 32 bytes.
-          for (int x = start_width; x < adjusted_residual_width; ++x) {
-            for (int s = 0; s < 2; ++s) {
-              for (int d = 0; d < 4; ++d) {
-                tmp_load[x][s][d] = input_data[x * input_depth + 4 * s + d] -
-                                    kSymmetricZeroPoint;
-              }
-            }
-          }
-
-          // Save results.
-          memcpy(&scratch_data[0], tmp_load[0][0], 8);
-          memcpy(&scratch_data[8], tmp_load[1][0], 8);
-          memcpy(&scratch_data[16], tmp_load[2][0], 8);
-          memcpy(&scratch_data[24], tmp_load[3][0], 8);
-        }
-      }
-    }
-
-    if (trailing_height_padding) {
-      memset(scratch_block_data + copy_block_height * workspace_height_stride,
-             -input_offset_difference, workspace_height_stride);
-    }
-  }
-
-  // Transpose 4x4 blocks within each sub-micro-block.
-  //
-  // Implemented somewhat like NEON register manipulation, so that we can see
-  // equivalence of the two approaches.
-  static inline void MicroTransposeBlocks(
-      const DepthwiseConvDotProdParams& function_params,
-      int8* scratch_block_data) {
-    const int workspace_height_stride = function_params.workspace_height_stride;
-    const int width_overall_micro_repeats =
-        function_params.input_width_overall_micro_repeats;
-    const int depth_micro_repeats = function_params.depth_micro_repeats;
-    const int block_height = function_params.inbound_block_height;
-
-    // Transpositions are 4x4, but doing 2 at a time is more efficient in the
-    // NEON code we are simulating.
-    int8 tmp_load[4][2][4];         // [width][sub-block][depth]
-    int8 tmp_transposed[4][2][4];   // [depth][sub-block][width]
-    int8 tmp_interleaved[2][4][4];  // [sub-block][depth][width]
-
-    // The outer 3 loops go through all the micro blocks in a macro block.
-    for (int k_height = 0; k_height < block_height; ++k_height) {
-      for (int j_width = 0; j_width < width_overall_micro_repeats; ++j_width) {
-        for (int i_depth = 0; i_depth < depth_micro_repeats; ++i_depth) {
-          int8* scratch_data =
-              scratch_block_data + k_height * workspace_height_stride +
-              j_width * 4 * 8 + i_depth * 4 * 8 * width_overall_micro_repeats;
-          // A. Load data
-          memcpy(tmp_load[0][0], &scratch_data[0], 8);
-          memcpy(tmp_load[1][0], &scratch_data[8], 8);
-          memcpy(tmp_load[2][0], &scratch_data[16], 8);
-          memcpy(tmp_load[3][0], &scratch_data[24], 8);
-
-          // B. Simulate between-register transposition.
-          for (int x = 0; x < 4; ++x) {
-            for (int y = 0; y < 4; ++y) {
-              tmp_transposed[x][0][y] = tmp_load[y][0][x];
-              tmp_transposed[x][1][y] = tmp_load[y][1][x];
-            }
-          }
-
-          // C. Simulate between-register interleaving.
-          for (int x = 0; x < 4; ++x) {
-            for (int y = 0; y < 4; ++y) {
-              tmp_interleaved[0][x][y] = tmp_transposed[x][0][y];
-              tmp_interleaved[1][x][y] = tmp_transposed[x][1][y];
-            }
-          }
-          // D. Simulate mangled storage arrangement.
-          memcpy(&scratch_data[0], tmp_interleaved[0][0], 16);
-          memcpy(&scratch_data[16], tmp_interleaved[1][0], 16);
-        }
-      }
-    }
-  }
-
-  static inline void Run(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    CopyMacroBlock(height_block_number, width_block_number, *function_params,
-                   input_block_data, scratch_block_data);
-    MicroTransposeBlocks(*function_params, scratch_block_data);
-  }
-};
-
-template 
-struct PackMacroBlock<
-    DepthwiseConvImplementation::kUseCModel3x3DotProduct, quantization_type,
-    DepthwiseConvDepthMultiplication::kUnitInputDepth, max_padding> {
-  static inline void Run(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Currently support for padding is limited to 1 on any side.
-    TFLITE_DCHECK_LE(max_padding, 1);
-
-    // Strides.
-    // The count of micro blocks (below) provides the width strides.
-    const int input_height_stride = function_params->input_height_stride;
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-
-    // Remaining iteration and dimension parameters.
-    //
-    // If width_overall_micro_repeats = input_width_micro_repeats + 1, then the
-    // final micro block is incomplete.
-    const int width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int input_width_micro_repeats =
-        function_params->input_width_micro_repeats;
-    const int residual_width = function_params->residual_width;
-    const int block_height = function_params->inbound_block_height;
-    TFLITE_DCHECK_GE(workspace_height_stride, 4 * width_overall_micro_repeats);
-
-    const int padding_left = function_params->padding_left;
-    const int padding_right = function_params->padding_right;
-    const int padding_top = function_params->padding_top;
-    const int padding_bottom = function_params->padding_bottom;
-
-    const bool leading_width_padding =
-        padding_left > 0 && width_block_number == 0;
-    const bool trailing_width_padding =
-        padding_right > 0 &&
-        width_block_number == (function_params->width_macro_count - 1);
-    const bool leading_height_padding =
-        padding_top > 0 && height_block_number < 0;
-    const bool trailing_height_padding =
-        padding_bottom > 0 &&
-        height_block_number == (function_params->height_macro_count - 1);
-
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-    const int32 input_offset_difference =
-        function_params->input_offset + kSymmetricZeroPoint;
-
-    int copy_block_height = block_height;
-    if (leading_height_padding) {
-      memset(scratch_block_data, -input_offset_difference,
-             workspace_height_stride + kWorkspaceExtension);
-      scratch_block_data += workspace_height_stride;
-      input_block_data += input_height_stride;
-      copy_block_height -= 1;
-    }
-    if (trailing_height_padding) {
-      copy_block_height -= 1;
-    }
-
-    int adjusted_residual_width =
-        input_width_micro_repeats < width_overall_micro_repeats ? residual_width
-                                                                : 4;
-
-    if (trailing_width_padding) {
-      adjusted_residual_width -= 1;
-    }
-    int start_width = 0;
-    if (leading_width_padding) {
-      start_width = 1;
-      input_block_data += 1;
-    }
-
-    const int copy_size = (width_overall_micro_repeats - 1) * 4 +
-                          adjusted_residual_width - start_width;
-
-    TFLITE_DCHECK_LE(
-        copy_size,
-        input_height_stride - width_block_number * input_width_micro_repeats);
-    // We may drop up to stride-1 of trailing input.
-    TFLITE_DCHECK_GE(copy_size, input_height_stride - 1);
-
-    // When there is unit input depth, the micro-block iteration need only be
-    // through the height. The micro blocks are contiguous across the width.
-    for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-      const typename QuantizationTypeImpl::ExternalType*
-          input_data = input_block_data + k_height * input_height_stride;
-      int8* scratch_data =
-          scratch_block_data + k_height * workspace_height_stride;
-
-      // Handle leading padding. This is overwritten if there is no padding.
-      scratch_data[0] = -input_offset_difference;
-
-      memcpy(&scratch_data[start_width], input_data, copy_size);
-      for (int i = 0; i < copy_size; ++i) {
-        scratch_data[start_width + i] += -kSymmetricZeroPoint;
-      }
-
-      // Handle trailing padding, and fill in remainder of micro block.
-      memset(&scratch_data[start_width + copy_size], -input_offset_difference,
-             4 - adjusted_residual_width + kWorkspaceExtension);
-    }
-
-    if (trailing_height_padding) {
-      memset(scratch_block_data + copy_block_height * workspace_height_stride,
-             -input_offset_difference,
-             workspace_height_stride + kWorkspaceExtension);
-    }
-  }
-};
-
-// Beginning of code section containing intermediate code transformation.
-//
-// This section is only compiled when kUseUnwound3x3DotProduct versions of
-// templated functions are selected.
-template 
-struct PackMacroBlock {
-  static inline void Run(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int input_width_micro_repeats =
-        function_params->input_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int block_height = function_params->inbound_block_height;
-    const int residual_width = function_params->residual_width;
-    const int input_height_stride = function_params->input_height_stride;
-    const int input_depth = function_params->input_depth;
-
-    TFLITE_DCHECK_GE(depth_micro_repeats, 0);
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-    const int micro_block_size = 4 * 8;
-    const int depth_advance = width_overall_micro_repeats * micro_block_size;
-    const int width_advance =
-        micro_block_size *
-        (1 - depth_micro_repeats * width_overall_micro_repeats);
-    const int height_advance = workspace_height_stride -
-                               width_overall_micro_repeats * micro_block_size;
-    const int input_depth_skip = 4 * input_depth - 8 * depth_micro_repeats;
-
-    // Transpositions are 4x4, but doing 2 at a time is more efficient in the
-    // NEON code we are simulating. Note the blocks of 4x4 are still interleaved
-    // down the depth.
-    int8 tmp_load[4][2][4];
-    int8 tmp_transposed[4][2][4];
-    int8 tmp_interleaved[2][4][4];
-
-    // Work through one slice, by row, at a time.
-    int8* scratch_data = scratch_block_data;
-    for (int k_height = 0; k_height < block_height; ++k_height) {
-      const typename QuantizationTypeImpl::ExternalType*
-          input_data = input_block_data;
-      input_block_data += input_height_stride;
-
-      // Traverse the width one point at a time, but the depth in (micro) blocks
-      // of size 8.
-      //
-      // The depth and width margins, which are filled with "zeros", may be
-      // larger than is strictly needed to calculate output. This is because the
-      // conv calculation is performed across complete micro blocks.
-      for (int j_width = 0; j_width < input_width_micro_repeats; ++j_width) {
-        // Load, then zero.
-        for (int i_depth = 0; i_depth < depth_micro_repeats; ++i_depth) {
-          // A. Simulate register loading.
-          for (int x = 0; x < 4; ++x) {
-            for (int s = 0; s < 2; ++s) {
-              for (int d = 0; d < 4; ++d) {
-                tmp_load[x][s][d] = input_data[x * input_depth + 4 * s + d] -
-                                    kSymmetricZeroPoint;
-              }
-            }
-          }
-          // B. Simulate between-register transposition.
-          for (int x = 0; x < 4; ++x) {
-            for (int y = 0; y < 4; ++y) {
-              tmp_transposed[x][0][y] = tmp_load[y][0][x];
-              tmp_transposed[x][1][y] = tmp_load[y][1][x];
-            }
-          }
-
-          // C and D are to be performed together as 4-byte stores in NEON code.
-          // C. Simulate between-register interleaving.
-          for (int x = 0; x < 4; ++x) {
-            for (int y = 0; y < 4; ++y) {
-              tmp_interleaved[0][x][y] = tmp_transposed[x][0][y];
-              tmp_interleaved[1][x][y] = tmp_transposed[x][1][y];
-            }
-          }
-          // D. Simulate mangled storage arrangement.
-          memcpy(&scratch_data[0], tmp_interleaved[0][0], 8);
-          memcpy(&scratch_data[8], tmp_interleaved[0][2], 8);
-          memcpy(&scratch_data[16], tmp_interleaved[1][0], 8);
-          memcpy(&scratch_data[24], tmp_interleaved[1][2], 8);
-
-          scratch_data += depth_advance;
-          input_data += 8;
-        }
-        scratch_data += width_advance;
-        input_data += input_depth_skip;
-      }
-      if (width_overall_micro_repeats > input_width_micro_repeats) {
-        TFLITE_DCHECK_EQ(width_overall_micro_repeats,
-                         input_width_micro_repeats + 1);
-        TFLITE_DCHECK_GT(residual_width, 0);
-        // Figure out division of work (available input vs zero-ed).
-        const int adjusted_residual_width = residual_width;
-        // Load, then zero.
-        for (int i_depth = 0; i_depth < depth_micro_repeats; ++i_depth) {
-          // A. Simulate register loading.
-          for (int x = 0; x < adjusted_residual_width; ++x) {
-            for (int s = 0; s < 2; ++s) {
-              for (int d = 0; d < 4; ++d) {
-                tmp_load[x][s][d] = input_data[x * input_depth + 4 * s + d] -
-                                    kSymmetricZeroPoint;
-              }
-            }
-          }
-          for (int x = adjusted_residual_width; x < 4; ++x) {
-            for (int s = 0; s < 2; ++s) {
-              for (int d = 0; d < 4; ++d) {
-                tmp_load[x][s][d] = 0;
-              }
-            }
-          }
-          // B. Simulate between-register transposition.
-          for (int x = 0; x < 4; ++x) {
-            for (int y = 0; y < 4; ++y) {
-              tmp_transposed[x][0][y] = tmp_load[y][0][x];
-              tmp_transposed[x][1][y] = tmp_load[y][1][x];
-            }
-          }
-
-          // C and D are to be performed together as 4-byte stores in NEON code.
-          // C. Simulate between-register interleaving.
-          for (int x = 0; x < 4; ++x) {
-            for (int y = 0; y < 4; ++y) {
-              tmp_interleaved[0][x][y] = tmp_transposed[x][0][y];
-              tmp_interleaved[1][x][y] = tmp_transposed[x][1][y];
-            }
-          }
-          // D. Simulate mangled storage arrangement.
-          memcpy(&scratch_data[0], tmp_interleaved[0][0], 8);
-          memcpy(&scratch_data[8], tmp_interleaved[0][2], 8);
-          memcpy(&scratch_data[16], tmp_interleaved[1][0], 8);
-          memcpy(&scratch_data[24], tmp_interleaved[1][2], 8);
-
-          scratch_data += depth_advance;
-          input_data += 8;
-        }
-        scratch_data += width_advance;
-        input_data += input_depth_skip;
-      }
-      scratch_data += height_advance;
-    }
-
-    TFLITE_DCHECK_EQ(scratch_data, scratch_block_data +
-                                       block_height * workspace_height_stride);
-  }
-};
-
-template 
-struct PackMacroBlock {
-  static inline void Run(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    // Just use C model code for case of padding. Optimized versions merge the
-    // modifications therein to handle padding.
-    PackMacroBlock::Run(height_block_number,
-                                           width_block_number, input_block_data,
-                                           scratch_block_data, function_params);
-  }
-};
-
-template 
-struct PackMacroBlock<
-    DepthwiseConvImplementation::kUseUnwound3x3DotProduct, quantization_type,
-    DepthwiseConvDepthMultiplication::kUnitInputDepth, max_padding> {
-  static inline void Run(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int input_width_micro_repeats =
-        function_params->input_width_micro_repeats;
-    const int block_height = function_params->inbound_block_height;
-    const int residual_width = function_params->residual_width;
-    const int input_height_stride = function_params->input_height_stride;
-
-    const int padding_left = function_params->padding_left;
-    const int padding_right = function_params->padding_right;
-    const int padding_top = function_params->padding_top;
-    const int padding_bottom = function_params->padding_bottom;
-
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-
-    TFLITE_DCHECK_GE(workspace_height_stride, 4 * width_overall_micro_repeats);
-
-    const bool leading_width_padding =
-        padding_left > 0 && width_block_number == 0;
-    const bool trailing_width_padding =
-        padding_right > 0 &&
-        width_block_number == (function_params->width_macro_count - 1);
-    const bool leading_height_padding =
-        padding_top > 0 && height_block_number < 0;
-    const bool trailing_height_padding =
-        padding_bottom > 0 &&
-        height_block_number == (function_params->height_macro_count - 1);
-
-    const int32 input_offset = function_params->input_offset;
-    const int32 input_offset_difference = input_offset + kSymmetricZeroPoint;
-
-    // Work through one slice, by row, at a time.
-    int8* scratch_data_base = scratch_block_data;
-
-    int copy_block_height = block_height;
-    if (leading_height_padding) {
-      copy_block_height -= 1;
-      memset(scratch_data_base, -input_offset_difference,
-             workspace_height_stride + kWorkspaceExtension);
-      scratch_data_base += workspace_height_stride;
-      input_block_data += input_height_stride;
-    }
-    if (trailing_height_padding) {
-      copy_block_height -= 1;
-    }
-
-    int adjusted_residual_width =
-        input_width_micro_repeats < width_overall_micro_repeats ? residual_width
-                                                                : 4;
-
-    if (trailing_width_padding) {
-      adjusted_residual_width -= 1;
-    }
-    int start_width = 0;
-    if (leading_width_padding) {
-      start_width = 1;
-      input_block_data += 1;
-    }
-
-    const int copy_size = (width_overall_micro_repeats - 1) * 4 +
-                          adjusted_residual_width - start_width;
-    // Adjusted so that later conditionals are simplified.
-    const int copy_size_adjusted =
-        trailing_width_padding ? copy_size + 1 : copy_size;
-
-    TFLITE_DCHECK_LE(
-        copy_size,
-        input_height_stride - width_block_number * input_width_micro_repeats);
-    // We may drop up to stride-1 of trailing input.
-    TFLITE_DCHECK_GE(copy_size, input_height_stride - 1);
-
-    // This is used to simulate what should happen in registers.
-    int8 tmp_data[16];
-
-    int scratch_data_offset = 0;
-    int input_block_offset = 0;
-
-    if (copy_size >= 16) {
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Work through one slice, by row, at a time.
-        int8* scratch_data = scratch_data_base + scratch_data_offset;
-
-        int copy_done = 0;
-
-        // The surrounding condition ensures that we always need at least one
-        // iteration of the main copy loop. In the case of leading width
-        // padding, we unroll this specially.
-        if (leading_width_padding) {
-          memcpy(tmp_data + 1, input_block_data + input_block_offset, 15);
-          for (int i = 0; i < 16; ++i) {
-            tmp_data[i] += -kSymmetricZeroPoint;
-          }
-          tmp_data[0] = -input_offset_difference;
-          memcpy(scratch_data, tmp_data, 16);
-          copy_done += 15;
-        }
-
-        // Main copy loop.
-        for (; (copy_done + 16) <= copy_size; copy_done += 16) {
-          memcpy(tmp_data, input_block_data + input_block_offset + copy_done,
-                 16);
-          for (int i = 0; i < 16; ++i) {
-            tmp_data[i] += -kSymmetricZeroPoint;
-          }
-          TFLITE_DCHECK_EQ((start_width + copy_done) % 16, 0);
-          memcpy(&scratch_data[start_width + copy_done], tmp_data, 16);
-        }
-
-        const int copy_remaining = copy_size - copy_done;
-        // Total amount
-        // = copy_size - copy_done + 4 - adjusted_residual_width
-        // = width_overall_micro_repeats * 4 - start_width - copy_done.
-        // Undone micro blocks
-        // = width_overall_micro_repeats - (start_width + copy_done) / 4.
-
-        // Conditional is (copy_remaining > 0 || trailing_width_padding).
-        if (copy_done < copy_size_adjusted) {
-          // Employ overlapping-load strategy in order to load full register,
-          // but use only part.
-          memcpy(tmp_data,
-                 input_block_data + input_block_offset + copy_done -
-                     (16 - copy_remaining),
-                 16);
-          // Shift to select the part that we need.
-          for (int i = 0; i < copy_remaining; ++i) {
-            tmp_data[i] = tmp_data[(16 - copy_remaining) + i];
-          }
-          for (int i = 0; i < 16; ++i) {
-            tmp_data[i] += -kSymmetricZeroPoint;
-          }
-          // Apply padding to remainder, some unnecessary but costless in regs.
-          for (int i = copy_remaining; i < 16; ++i) {
-            tmp_data[i] = -input_offset_difference;
-          }
-          const int final_repeats =
-              width_overall_micro_repeats - (start_width + copy_done) / 4;
-          for (int i = 0; i < final_repeats; ++i) {
-            memcpy(&scratch_data[start_width + copy_done], tmp_data + 4 * i, 4);
-            copy_done += 4;
-          }
-        }
-        memset(scratch_data + start_width + copy_done, -input_offset_difference,
-               kWorkspaceExtension);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else if (copy_size >= 4) {
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Work through one slice, by row, at a time.
-        int8* scratch_data = scratch_data_base + scratch_data_offset;
-
-        int copy_done = 0;
-
-        // The surrounding condition ensures that we always need at least one
-        // iteration of the main copy loop. In the case of leading width
-        // padding, we unroll this specially.
-        if (leading_width_padding) {
-          memcpy(tmp_data + 1, input_block_data + input_block_offset, 3);
-          for (int i = 0; i < 4; ++i) {
-            tmp_data[i] += -kSymmetricZeroPoint;
-          }
-          tmp_data[0] = -input_offset_difference;
-          memcpy(scratch_data, tmp_data, 4);
-          copy_done += 3;
-        }
-
-        for (; (copy_done + 4) <= copy_size; copy_done += 4) {
-          memcpy(tmp_data, input_block_data + input_block_offset + copy_done,
-                 4);
-          for (int i = 0; i < 4; ++i) {
-            tmp_data[i] += -kSymmetricZeroPoint;
-          }
-          // Perform as 4 int32 stores, because that is our alignment.
-          memcpy(&scratch_data[start_width + copy_done], tmp_data, 4);
-        }
-
-        // Total amount
-        // = copy_size - copy_done + 4 - adjusted_residual_width
-        // = width_overall_micro_repeats * 4 - start_width - copy_done.
-        // Undone micro blocks
-        // = width_overall_micro_repeats - (start_width + copy_done) / 4.
-        const int copy_remaining = copy_size - copy_done;
-        // Conditional is (copy_remaining > 0 || trailing_width_padding).
-        if (copy_done < copy_size_adjusted) {
-          TFLITE_DCHECK_LT(copy_remaining, 4);
-          // Employ overlapping-load strategy in order to load full register,
-          // but use only part.
-          memcpy(tmp_data,
-                 input_block_data + input_block_offset + copy_done -
-                     (4 - copy_remaining),
-                 4);
-          // Shift to select the part that we need.
-          for (int i = 0; i < copy_remaining; ++i) {
-            tmp_data[i] = tmp_data[(4 - copy_remaining) + i];
-          }
-          for (int i = 0; i < 4; ++i) {
-            tmp_data[i] += -kSymmetricZeroPoint;
-          }
-          // Apply padding to remainder, some unnecessary but costless in regs.
-          for (int i = copy_remaining; i < 4; ++i) {
-            tmp_data[i] = -input_offset_difference;
-          }
-          memcpy(&scratch_data[start_width + copy_done], tmp_data, 4);
-          copy_done += 4;
-        }
-        memset(scratch_data + start_width + copy_done, -input_offset_difference,
-               kWorkspaceExtension);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else if (width_overall_micro_repeats == 2) {
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Apply padding by quick fill of whole reg.
-        for (int i = 0; i < 8; ++i) {
-          tmp_data[i] = -input_offset;
-        }
-        for (int i = 0; i < copy_size; ++i) {
-          // Apply shift-left insert, tmp_data as both operands.
-          // The zero-index byte is left unchanged.
-          for (int i = 7; i > 0; --i) {
-            tmp_data[i] = tmp_data[i - 1];
-          }
-          tmp_data[1] =
-              input_block_data[input_block_offset + (copy_size - 1 - i)];
-        }
-        if (!leading_width_padding) {
-          // Remove leading padding, junking trailing byte, OK because max size
-          // is less than 8.
-          TFLITE_DCHECK_LT(copy_size_adjusted + start_width, 8);
-          for (int i = 0; i < 7; ++i) {
-            tmp_data[i] = tmp_data[i + 1];
-          }
-        }
-        for (int i = 0; i < 8; ++i) {
-          tmp_data[i] += -kSymmetricZeroPoint;
-        }
-        memcpy(scratch_data_base + scratch_data_offset, tmp_data, 8);
-        memset(scratch_data_base + scratch_data_offset + 8,
-               -input_offset_difference, kWorkspaceExtension);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else {
-      TFLITE_DCHECK_EQ(width_overall_micro_repeats, 1);
-      // This path is basically the same as the preceding, 2-micro-block one,
-      // but here we simply store fewer bytes.
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Apply padding by quick fill of whole reg.
-        for (int i = 0; i < 8; ++i) {
-          tmp_data[i] = -input_offset;
-        }
-        for (int i = 0; i < copy_size; ++i) {
-          // Apply shift-left insert, tmp_data as both operands.
-          // The zero-index byte is left unchanged.
-          for (int i = 7; i > 0; --i) {
-            tmp_data[i] = tmp_data[i - 1];
-          }
-          tmp_data[1] =
-              input_block_data[input_block_offset + (copy_size - 1 - i)];
-        }
-        if (!leading_width_padding) {
-          // Remove leading padding, junking trailing byte, OK because max size
-          // is less than 8.
-          TFLITE_DCHECK_LT(copy_size_adjusted + start_width, 8);
-          for (int i = 0; i < 7; ++i) {
-            tmp_data[i] = tmp_data[i + 1];
-          }
-        }
-        for (int i = 0; i < 8; ++i) {
-          tmp_data[i] += -kSymmetricZeroPoint;
-        }
-        memcpy(scratch_data_base + scratch_data_offset, tmp_data, 4);
-        memset(scratch_data_base + scratch_data_offset + 4,
-               -input_offset_difference, kWorkspaceExtension);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    }
-
-    scratch_data_base += copy_block_height * workspace_height_stride;
-
-    if (trailing_height_padding) {
-      memset(scratch_data_base, -input_offset_difference,
-             workspace_height_stride + kWorkspaceExtension);
-      scratch_data_base += workspace_height_stride;
-    }
-
-    TFLITE_DCHECK_EQ(
-        scratch_data_base,
-        scratch_block_data + block_height * workspace_height_stride);
-  }
-};
-// The preceding section is only compiled when kUseUnwound3x3DotProduct versions
-// of templated functions are selected.
-//
-// End of code section containing intermediate code transformation.
-
-#ifdef USE_NEON
-template 
-struct PackMacroBlock {
-  static inline void PackMacroBlockIntrinsics(
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    TFLITE_DCHECK_EQ(function_params->padding_bottom, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_top, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_left, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_right, 0);
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int input_width_micro_repeats =
-        function_params->input_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int block_height = function_params->inbound_block_height;
-    const int residual_width = function_params->residual_width;
-    const int input_height_stride = function_params->input_height_stride;
-    const int input_depth = function_params->input_depth;
-
-    TFLITE_DCHECK_GE(depth_micro_repeats, 0);
-    constexpr uint8 kSignBit =
-        QuantizationTypeImpl::kUint8SignBit;
-    const int micro_block_size = 4 * 8;
-    const int depth_advance = width_overall_micro_repeats * micro_block_size;
-    const int width_advance =
-        micro_block_size *
-        (1 - depth_micro_repeats * width_overall_micro_repeats);
-    const int height_advance = workspace_height_stride -
-                               width_overall_micro_repeats * micro_block_size;
-    const int input_depth_skip = 4 * input_depth - 8 * depth_micro_repeats;
-
-    // Transpositions are 4x4, but doing 2 at a time is more efficient in NEON
-    // code. Note the blocks of 4x4 are still interleaved down the depth.
-    int8x16_t work_reg_a;
-    int8x16_t work_reg_b;
-
-    // Effect subtraction of zero-point = 128 by XOR of sign bit.
-    const uint8x16_t sign_bit = vdupq_n_u8(kSignBit);
-
-    // Work through one slice, by row, at a time.
-    int8* scratch_data_0 = scratch_block_data;
-
-    for (int k_height = 0; k_height < block_height; ++k_height) {
-      const typename QuantizationTypeImpl::ExternalType*
-          input_data_0 = input_block_data;
-      int8x16_t input_data_a;
-      int8x16_t input_data_b;
-      int8x16_t input_data_c;
-      int8x16_t input_data_d;
-
-      // Traverse the width one point at a time, but the depth in (micro) blocks
-      // of size 8.
-      //
-      // The depth and width margins, which are filled with "zeros", may be
-      // larger than is strictly needed to calculate output. This is because the
-      // conv calculation is performed across complete micro blocks.
-      for (int j_width = 0; j_width < input_width_micro_repeats; ++j_width) {
-        int8x16_t work_reg_a_sp;
-        int8x16_t work_reg_b_sp;
-
-        int i_depth = 0;
-
-        if (depth_micro_repeats >= 2) {
-          i_depth += 2;
-
-          input_data_a = util_vld1q_x8(input_data_0);
-          input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-          input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-          input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-          input_data_0 += 16;
-
-          for (; i_depth < depth_micro_repeats - 1; i_depth += 2) {
-            work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-            work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-            vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-            if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-              work_reg_a = veorq_s8(work_reg_a, sign_bit);
-              work_reg_b = veorq_s8(work_reg_b, sign_bit);
-            }
-
-            work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-            work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-            vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-
-            input_data_a = util_vld1q_x8(input_data_0);
-            input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-            vst1q_s8(scratch_data_0, work_reg_a);
-            vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-            scratch_data_0 += depth_advance;
-
-            if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-              work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-              work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-            }
-
-            input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-            input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-            vst1q_s8(scratch_data_0, work_reg_a_sp);
-            vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-            scratch_data_0 += depth_advance;
-            input_data_0 += 16;
-          }
-
-          work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-          work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-          vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg_a = veorq_s8(work_reg_a, sign_bit);
-            work_reg_b = veorq_s8(work_reg_b, sign_bit);
-          }
-          vst1q_s8(scratch_data_0, work_reg_a);
-          vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-          scratch_data_0 += depth_advance;
-
-          work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-          work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-          vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-            work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-          }
-
-          vst1q_s8(scratch_data_0, work_reg_a_sp);
-          vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-          scratch_data_0 += depth_advance;
-        }
-        for (; i_depth < depth_micro_repeats; ++i_depth) {
-          input_data_a = vld1q_lane_s8x8(input_data_0, input_data_a, 0);
-          input_data_b =
-              vld1q_lane_s8x8(input_data_0 + 1 * input_depth, input_data_b, 0);
-          input_data_c =
-              vld1q_lane_s8x8(input_data_0 + 2 * input_depth, input_data_c, 0);
-          input_data_d =
-              vld1q_lane_s8x8(input_data_0 + 3 * input_depth, input_data_d, 0);
-          work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-          work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-          input_data_0 += 8;
-
-          vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg_a = veorq_s8(work_reg_a, sign_bit);
-            work_reg_b = veorq_s8(work_reg_b, sign_bit);
-          }
-
-          vst1q_s8(scratch_data_0, work_reg_a);
-          vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-          scratch_data_0 += depth_advance;
-        }
-        scratch_data_0 += width_advance;
-        input_data_0 += input_depth_skip;
-      }
-      if (width_overall_micro_repeats > input_width_micro_repeats) {
-        TFLITE_DCHECK_EQ(width_overall_micro_repeats,
-                         input_width_micro_repeats + 1);
-        TFLITE_DCHECK_GT(residual_width, 0);
-        TFLITE_DCHECK_LT(residual_width, 4);
-        for (int i_depth = 0; i_depth < depth_micro_repeats; ++i_depth) {
-          input_data_c = vdupq_n_u8(kSignBit);
-          input_data_a = vld1q_lane_s8x8(input_data_0, input_data_a, 0);
-          input_data_d = vdupq_n_u8(kSignBit);
-          if (residual_width > 1) {
-            input_data_b =
-                vld1q_lane_s8x8(input_data_0 + input_depth, input_data_b, 0);
-            if (residual_width == 3) {
-              input_data_c = vld1q_lane_s8x8(input_data_0 + 2 * input_depth,
-                                             input_data_c, 0);
-            }
-          }
-          work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-          work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg_a = veorq_s8(work_reg_a, sign_bit);
-            work_reg_b = veorq_s8(work_reg_b, sign_bit);
-          }
-          vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-
-          vst1q_s8(scratch_data_0, work_reg_a);
-          vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-          scratch_data_0 += depth_advance;
-          input_data_0 += 8;
-        }
-        scratch_data_0 += width_advance;
-        input_data_0 += input_depth_skip;
-      }
-
-      scratch_data_0 += height_advance;
-      input_block_data += input_height_stride;
-    }
-    TFLITE_DCHECK_EQ(
-        scratch_data_0,
-        scratch_block_data + block_height * workspace_height_stride);
-  }
-
-  static inline void Run(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-#ifdef __aarch64__
-    PreloadInputBlock(input_block_data, function_params);
-#endif
-    PackMacroBlockIntrinsics(input_block_data, scratch_block_data,
-                             function_params);
-  }
-};
-
-template 
-struct PackMacroBlock {
-  static inline void PackMacroBlockIntrinsics(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    constexpr uint8 kSignBit =
-        QuantizationTypeImpl::kUint8SignBit;
-
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int input_width_micro_repeats =
-        function_params->input_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int block_height = function_params->inbound_block_height;
-    const int residual_width = function_params->residual_width;
-    const int input_height_stride = function_params->input_height_stride;
-    const int input_depth = function_params->input_depth;
-
-    const int padding_left = function_params->padding_left;
-    const int padding_right = function_params->padding_right;
-    const int padding_top = function_params->padding_top;
-    const int padding_bottom = function_params->padding_bottom;
-
-    TFLITE_DCHECK_GT(depth_micro_repeats, 0);
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-
-    const int micro_block_size = 4 * 8;
-    const int depth_advance = width_overall_micro_repeats * micro_block_size;
-    const int width_advance =
-        micro_block_size *
-        (1 - depth_micro_repeats * width_overall_micro_repeats);
-    const int height_advance = workspace_height_stride -
-                               width_overall_micro_repeats * micro_block_size;
-    const int input_depth_skip = 4 * input_depth - 8 * depth_micro_repeats;
-
-    const bool leading_width_padding =
-        padding_left > 0 && width_block_number == 0;
-    const bool trailing_width_padding =
-        padding_right > 0 &&
-        width_block_number == (function_params->width_macro_count - 1);
-    const bool leading_height_padding =
-        padding_top > 0 && height_block_number < 0;
-    const bool trailing_height_padding =
-        padding_bottom > 0 &&
-        height_block_number == (function_params->height_macro_count - 1);
-
-    const int32 input_offset = function_params->input_offset;
-    const int32 input_offset_difference = input_offset + kSymmetricZeroPoint;
-
-    // Transpositions are 4x4, but doing 2 at a time is more efficient in NEON
-    // code. Note the blocks of 4x4 are still interleaved down the depth.
-    int8x16_t work_reg_a;
-    int8x16_t work_reg_b;
-
-    // Effect subtraction of zero-point = 128 by XOR of sign bit.
-    const uint8x16_t sign_bit = vdupq_n_u8(kSignBit);
-
-    // Work through one slice, by row, at a time.
-    int8* scratch_data_0 = scratch_block_data;
-
-    int copy_block_height = block_height;
-    if (leading_height_padding) {
-      copy_block_height -= 1;
-      memset(scratch_data_0, -input_offset_difference, workspace_height_stride);
-      scratch_data_0 += workspace_height_stride;
-      input_block_data += input_height_stride;
-    }
-    if (trailing_height_padding) {
-      copy_block_height -= 1;
-    }
-
-    for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-      const typename QuantizationTypeImpl::ExternalType*
-          input_data_0 = input_block_data;
-      int8x16_t input_data_a;
-      int8x16_t input_data_b;
-      int8x16_t input_data_c;
-      int8x16_t input_data_d;
-
-      // Traverse the width one point at a time, but the depth in (micro) blocks
-      // of size 8.
-      //
-      // The depth and width margins, which are filled with "zeros", may be
-      // larger than is strictly needed to calculate output. This is because the
-      // conv calculation is performed across complete micro blocks.
-      for (int j_width = 0; j_width < width_overall_micro_repeats; ++j_width) {
-        // Figure out division of work (available input vs zero-ed).
-        int adjusted_residual_width =
-            j_width == (input_width_micro_repeats) ? residual_width : 4;
-
-        if (trailing_width_padding &&
-            j_width == (width_overall_micro_repeats - 1)) {
-          adjusted_residual_width -= 1;
-        }
-        int start_width = 0;
-        if (leading_width_padding && j_width == 0) {
-          start_width = 1;
-        }
-        if (start_width == 0) {
-          if (adjusted_residual_width == 4) {
-            int8x16_t work_reg_a_sp;
-            int8x16_t work_reg_b_sp;
-
-            int i_depth = 0;
-
-            if (depth_micro_repeats >= 2) {
-              i_depth += 2;
-
-              input_data_a = util_vld1q_x8(input_data_0);
-              input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-              input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-              input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-              input_data_0 += 16;
-
-              for (; i_depth < depth_micro_repeats - 1; i_depth += 2) {
-                work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-                work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-                vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-                if (quantization_type ==
-                    QuantizationType::kNonPerChannelUint8) {
-                  work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                  work_reg_b = veorq_s8(work_reg_b, sign_bit);
-                }
-
-                work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-                work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-                vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-
-                input_data_a = util_vld1q_x8(input_data_0);
-                input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-                vst1q_s8(scratch_data_0, work_reg_a);
-                vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-                scratch_data_0 += depth_advance;
-
-                if (quantization_type ==
-                    QuantizationType::kNonPerChannelUint8) {
-                  work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-                  work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-                }
-
-                input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-                input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-                vst1q_s8(scratch_data_0, work_reg_a_sp);
-                vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-                scratch_data_0 += depth_advance;
-                input_data_0 += 16;
-              }
-
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-
-              work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-              work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-              vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-                work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-              }
-
-              vst1q_s8(scratch_data_0, work_reg_a_sp);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-              scratch_data_0 += depth_advance;
-            }
-            for (; i_depth < depth_micro_repeats; ++i_depth) {
-              input_data_a = vld1q_lane_s8x8(input_data_0, input_data_a, 0);
-              input_data_b = vld1q_lane_s8x8(input_data_0 + 1 * input_depth,
-                                             input_data_b, 0);
-              input_data_c = vld1q_lane_s8x8(input_data_0 + 2 * input_depth,
-                                             input_data_c, 0);
-              input_data_d = vld1q_lane_s8x8(input_data_0 + 3 * input_depth,
-                                             input_data_d, 0);
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-              input_data_0 += 8;
-
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-            }
-            scratch_data_0 += width_advance;
-            input_data_0 += input_depth_skip;
-          } else {
-            TFLITE_DCHECK_LT(adjusted_residual_width, 4);
-            for (int i_depth = 0; i_depth < depth_micro_repeats; ++i_depth) {
-              input_data_a = vdupq_n_u8(-input_offset);
-              input_data_b = vdupq_n_u8(-input_offset);
-              input_data_c = vdupq_n_u8(-input_offset);
-              input_data_d = vdupq_n_u8(-input_offset);
-              if (adjusted_residual_width > 0) {
-                input_data_a = vld1q_lane_s8x8(input_data_0, input_data_a, 0);
-                if (adjusted_residual_width > 1) {
-                  input_data_b = vld1q_lane_s8x8(input_data_0 + input_depth,
-                                                 input_data_b, 0);
-                  if (adjusted_residual_width == 3) {
-                    input_data_c = vld1q_lane_s8x8(
-                        input_data_0 + 2 * input_depth, input_data_c, 0);
-                  }
-                }
-              }
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-              input_data_0 += 8;
-            }
-            scratch_data_0 += width_advance;
-            input_data_0 += input_depth_skip;
-          }
-        } else {
-          if (adjusted_residual_width == 4) {
-            int8x16_t work_reg_a_sp;
-            int8x16_t work_reg_b_sp;
-
-            int i_depth = 0;
-
-            if (depth_micro_repeats >= 2) {
-              i_depth += 2;
-
-              input_data_a = vdupq_n_u8(-input_offset);
-              input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-              input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-              input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-              input_data_0 += 16;
-
-              for (; i_depth < depth_micro_repeats - 1; i_depth += 2) {
-                work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-                work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-                vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-                if (quantization_type ==
-                    QuantizationType::kNonPerChannelUint8) {
-                  work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                  work_reg_b = veorq_s8(work_reg_b, sign_bit);
-                }
-
-                work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-                work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-                vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-
-                input_data_a = vdupq_n_u8(-input_offset);
-                input_data_b = util_vld1q_x8(input_data_0 + 1 * input_depth);
-                vst1q_s8(scratch_data_0, work_reg_a);
-                vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-                scratch_data_0 += depth_advance;
-
-                if (quantization_type ==
-                    QuantizationType::kNonPerChannelUint8) {
-                  work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-                  work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-                }
-
-                input_data_c = util_vld1q_x8(input_data_0 + 2 * input_depth);
-                input_data_d = util_vld1q_x8(input_data_0 + 3 * input_depth);
-                vst1q_s8(scratch_data_0, work_reg_a_sp);
-                vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-                scratch_data_0 += depth_advance;
-                input_data_0 += 16;
-              }
-
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-
-              work_reg_a_sp = vzip2q_s8(input_data_a, input_data_b);
-              work_reg_b_sp = vzip2q_s8(input_data_c, input_data_d);
-              vzipq_s8x2_in_place(&work_reg_a_sp, &work_reg_b_sp);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a_sp = veorq_s8(work_reg_a_sp, sign_bit);
-                work_reg_b_sp = veorq_s8(work_reg_b_sp, sign_bit);
-              }
-
-              vst1q_s8(scratch_data_0, work_reg_a_sp);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b_sp);
-
-              scratch_data_0 += depth_advance;
-            }
-            for (; i_depth < depth_micro_repeats; ++i_depth) {
-              input_data_a = vdupq_n_u8(-input_offset);
-              input_data_b = vld1q_lane_s8x8(input_data_0 + 1 * input_depth,
-                                             input_data_b, 0);
-              input_data_c = vld1q_lane_s8x8(input_data_0 + 2 * input_depth,
-                                             input_data_c, 0);
-              input_data_d = vld1q_lane_s8x8(input_data_0 + 3 * input_depth,
-                                             input_data_d, 0);
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-              input_data_0 += 8;
-
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-            }
-            scratch_data_0 += width_advance;
-            input_data_0 += input_depth_skip;
-          } else {
-            TFLITE_DCHECK_LT(adjusted_residual_width, 4);
-
-            for (int i_depth = 0; i_depth < depth_micro_repeats; ++i_depth) {
-              input_data_a = vdupq_n_u8(-input_offset);
-              input_data_b = vdupq_n_u8(-input_offset);
-              input_data_c = vdupq_n_u8(-input_offset);
-              input_data_d = vdupq_n_u8(-input_offset);
-              // Skip loading first column.
-              if (adjusted_residual_width > 1) {
-                input_data_b = vld1q_lane_s8x8(input_data_0 + input_depth,
-                                               input_data_b, 0);
-                if (adjusted_residual_width == 3) {
-                  input_data_c = vld1q_lane_s8x8(input_data_0 + 2 * input_depth,
-                                                 input_data_c, 0);
-                }
-              }
-              work_reg_a = vzip1q_s8(input_data_a, input_data_b);
-              work_reg_b = vzip1q_s8(input_data_c, input_data_d);
-
-              if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-                work_reg_a = veorq_s8(work_reg_a, sign_bit);
-                work_reg_b = veorq_s8(work_reg_b, sign_bit);
-              }
-              vzipq_s8x2_in_place(&work_reg_a, &work_reg_b);
-
-              vst1q_s8(scratch_data_0, work_reg_a);
-              vst1q_s8(scratch_data_0 + 16, work_reg_b);
-
-              scratch_data_0 += depth_advance;
-              input_data_0 += 8;
-            }
-            scratch_data_0 += width_advance;
-            input_data_0 += input_depth_skip;
-          }
-        }
-      }
-      scratch_data_0 += height_advance;
-      input_block_data += input_height_stride;
-    }
-
-    if (trailing_height_padding) {
-      memset(scratch_data_0, -input_offset_difference, workspace_height_stride);
-      scratch_data_0 += workspace_height_stride;
-    }
-
-    TFLITE_DCHECK_EQ(
-        scratch_data_0,
-        scratch_block_data + block_height * workspace_height_stride);
-  }
-
-  static inline void Run(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-#ifdef __aarch64__
-    PreloadInputBlock(input_block_data, function_params);
-#endif
-
-    PackMacroBlockIntrinsics(height_block_number, width_block_number,
-                             input_block_data, scratch_block_data,
-                             function_params);
-  }
-};
-
-template 
-struct PackMacroBlock {
-  static inline void PackMacroBlockIntrinsics(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int input_width_micro_repeats =
-        function_params->input_width_micro_repeats;
-    const int block_height = function_params->inbound_block_height;
-    const int residual_width = function_params->residual_width;
-    const int input_height_stride = function_params->input_height_stride;
-
-    const int padding_left = function_params->padding_left;
-    const int padding_right = function_params->padding_right;
-    const int padding_top = function_params->padding_top;
-    const int padding_bottom = function_params->padding_bottom;
-
-    constexpr int kSymmetricZeroPoint =
-        QuantizationTypeImpl::kIntSymmetricZeroPoint;
-
-    TFLITE_DCHECK_GE(workspace_height_stride, 4 * width_overall_micro_repeats);
-
-    const bool leading_width_padding =
-        padding_left > 0 && width_block_number == 0;
-    const bool trailing_width_padding =
-        padding_right > 0 &&
-        width_block_number == (function_params->width_macro_count - 1);
-    const bool leading_height_padding =
-        padding_top > 0 && height_block_number < 0;
-    const bool trailing_height_padding =
-        padding_bottom > 0 &&
-        height_block_number == (function_params->height_macro_count - 1);
-
-    const int32 input_offset = function_params->input_offset;
-    const int32 input_offset_difference = input_offset + kSymmetricZeroPoint;
-
-    // Work through one slice, by row, at a time.
-    int8* scratch_data_base = scratch_block_data;
-
-    int copy_block_height = block_height;
-    if (leading_height_padding) {
-      copy_block_height -= 1;
-      memset(scratch_data_base, -input_offset_difference,
-             workspace_height_stride + kWorkspaceExtension);
-      scratch_data_base += workspace_height_stride;
-      input_block_data += input_height_stride;
-    }
-    if (trailing_height_padding) {
-      copy_block_height -= 1;
-    }
-
-    int adjusted_residual_width =
-        input_width_micro_repeats < width_overall_micro_repeats ? residual_width
-                                                                : 4;
-
-    if (trailing_width_padding) {
-      adjusted_residual_width -= 1;
-    }
-    int start_width = 0;
-    if (leading_width_padding) {
-      start_width = 1;
-      input_block_data += 1;
-    }
-
-    const int copy_size = (width_overall_micro_repeats - 1) * 4 +
-                          adjusted_residual_width - start_width;
-    // Adjusted so that later conditionals are simplified.
-    const int copy_size_adjusted =
-        trailing_width_padding ? copy_size + 1 : copy_size;
-
-    TFLITE_DCHECK_LE(
-        copy_size,
-        input_height_stride - width_block_number * input_width_micro_repeats);
-    // We may drop up to stride-1 of trailing input.
-    TFLITE_DCHECK_GE(copy_size, input_height_stride - 1);
-
-    int scratch_data_offset = 0;
-    int input_block_offset = 0;
-
-    constexpr uint8 kSignBit =
-        QuantizationTypeImpl::kUint8SignBit;
-
-    // Transpositions are 4x4, but doing 2 at a time is more efficient in NEON
-    // code. Note the blocks of 4x4 are still interleaved down the depth.
-    int8x16_t work_reg;
-    int8x8_t half_work_reg;
-    int8x8_t padding_mask;
-
-    // Effect subtraction of zero-point = 128 by XOR of sign bit.
-    const uint8x16_t sign_bit = vdupq_n_u8(kSignBit);
-    const uint8x16_t padding_reg = vdupq_n_u8(-input_offset);
-    padding_mask = vdup_n_s8(-1);
-    half_work_reg = vdup_n_s8(0);
-
-    if (copy_size >= 16) {
-      const int copy_remaining = (copy_size + start_width) & 0x7;
-      padding_mask = vreinterpret_s8_s64(vshl_s64(
-          vreinterpret_s64_s8(padding_mask), vdup_n_s64(8 * copy_remaining)));
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Work through one slice, by row, at a time.
-        int8* scratch_data = scratch_data_base + scratch_data_offset;
-
-        int copy_done = 0;
-
-        // The surrounding condition ensures that we always need at least one
-        // iteration of the main copy loop. In the case of leading width
-        // padding, we unroll this specially.
-        if (leading_width_padding) {
-          work_reg = util_vld1q_x8(input_block_data + input_block_offset);
-          work_reg = vextq_s8(padding_reg, work_reg, 15);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg = veorq_s8(work_reg, sign_bit);
-          }
-          vst1q_s8(scratch_data, work_reg);
-          copy_done += 15;
-        }
-
-        // Main copy loop.
-        for (; (copy_done + 16) <= copy_size; copy_done += 16) {
-          work_reg =
-              util_vld1q_x8(input_block_data + input_block_offset + copy_done);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg = veorq_s8(work_reg, sign_bit);
-          }
-          TFLITE_DCHECK_EQ((start_width + copy_done) % 16, 0);
-          vst1q_s8(scratch_data + start_width + copy_done, work_reg);
-        }
-
-        if (copy_done + 8 <= copy_size) {
-          half_work_reg =
-              util_vld1_x8(input_block_data + input_block_offset + copy_done);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ((start_width + copy_done) % 8, 0);
-          vst1_s8(scratch_data + start_width + copy_done, half_work_reg);
-          copy_done += 8;
-        }
-
-        TFLITE_DCHECK_EQ(copy_remaining, copy_size - copy_done);
-        // Total amount
-        // = copy_size - copy_done + 4 - adjusted_residual_width
-        // = width_overall_micro_repeats * 4 - start_width - copy_done.
-        // Undone micro blocks
-        // = width_overall_micro_repeats - (start_width + copy_done) / 4.
-
-        // Conditional is (copy_remaining > 0 || trailing_width_padding).
-        if (copy_done < copy_size_adjusted) {
-          // Employ overlapping-load strategy in order to load full register,
-          // but use only part.
-          // This has the advantage of resulting in zeros after shifting.
-          half_work_reg = util_vld1_x8(input_block_data + input_block_offset +
-                                       copy_size - 8);
-
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_s64(vreinterpret_s64_s8(half_work_reg),
-                       vdup_n_s64(-8 * (8 - copy_remaining))));
-          half_work_reg = vbsl_s8(vreinterpret_u8_s8(padding_mask),
-                                  vget_low_s8(padding_reg), half_work_reg);
-
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ((start_width + copy_done) % 8, 0);
-          vst1_s8(scratch_data + start_width + copy_done, half_work_reg);
-        }
-
-        // Trailing guard.
-        vst1_s8(scratch_data + start_width + copy_done, half_work_reg);
-        vst1_s8(scratch_data + start_width + copy_done + 8, half_work_reg);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else if (copy_size >= 4) {
-      const int copy_remaining = (copy_size + start_width) & 0x3;
-      padding_mask = vreinterpret_s8_s64(vshl_s64(
-          vreinterpret_s64_s8(padding_mask), vdup_n_s64(8 * copy_remaining)));
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Work through one slice, by row, at a time.
-        int8* scratch_data = scratch_data_base + scratch_data_offset;
-
-        int copy_done = 0;
-
-        // The surrounding condition ensures that we always need at least one
-        // iteration of the main copy loop. In the case of leading width
-        // padding, we unroll this specially.
-        if (leading_width_padding) {
-          half_work_reg = vld1_lane_8x4(input_block_data + input_block_offset,
-                                        half_work_reg, 0);
-          half_work_reg = vext_s8(vget_low_s8(padding_reg), half_work_reg, 7);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          vst1_lane_8x4(scratch_data, half_work_reg, 0);
-          copy_done += 3;
-        }
-
-        // Main copy loop.
-        for (; (copy_done + 4) <= copy_size; copy_done += 4) {
-          half_work_reg =
-              vld1_lane_8x4(input_block_data + input_block_offset + copy_done,
-                            half_work_reg, 0);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ((start_width + copy_done) % 4, 0);
-          vst1_lane_8x4(scratch_data + start_width + copy_done, half_work_reg,
-                        0);
-        }
-
-        TFLITE_DCHECK_EQ(copy_remaining, copy_size - copy_done);
-        // Total amount
-        // = copy_size - copy_done + 4 - adjusted_residual_width
-        // = width_overall_micro_repeats * 4 - start_width - copy_done.
-        // Undone micro blocks
-        // = width_overall_micro_repeats - (start_width + copy_done) / 4.
-
-        // Conditional is (copy_remaining > 0 || trailing_width_padding).
-        if (copy_done < copy_size_adjusted) {
-          TFLITE_DCHECK_LT(copy_remaining, 4);
-          // Employ overlapping-load strategy in order to load full register,
-          // but use only part.
-          // This has the advantage of resulting in zeros after shifting.
-          half_work_reg = vld1_lane_8x4(
-              input_block_data + input_block_offset + copy_size - 4,
-              half_work_reg, 0);
-
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_s64(vreinterpret_s64_s8(half_work_reg),
-                       vdup_n_s64(-8 * (4 - copy_remaining))));
-          half_work_reg = vbsl_s8(vreinterpret_u8_s8(padding_mask),
-                                  vget_low_s8(padding_reg), half_work_reg);
-
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ((start_width + copy_done) % 4, 0);
-          vst1_lane_8x4(scratch_data + start_width + copy_done, half_work_reg,
-                        0);
-          copy_done += 4;
-        }
-        // Trailing guard.
-        vst1_lane_8x4(scratch_data + start_width + copy_done, half_work_reg, 0);
-        vst1_lane_8x4(scratch_data + start_width + copy_done + 4, half_work_reg,
-                      0);
-        vst1_lane_8x4(scratch_data + start_width + copy_done + 8, half_work_reg,
-                      0);
-        vst1_lane_8x4(scratch_data + start_width + copy_done + 12,
-                      half_work_reg, 0);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else if (width_overall_micro_repeats == 2) {
-      // Special case of 1 + 3 + 1, padding + copy + padding.
-      // This is rarely executed in practice.
-      TFLITE_DCHECK_EQ(copy_size, 3);
-      TFLITE_DCHECK_EQ(start_width, 1);
-      TFLITE_DCHECK(leading_width_padding);
-      TFLITE_DCHECK(trailing_width_padding);
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        half_work_reg = vdup_n_u8(-input_offset);
-        half_work_reg = vld1_lane_s8(reinterpret_cast(
-                                         input_block_data + input_block_offset),
-                                     half_work_reg, 1);
-        half_work_reg =
-            vld1_lane_s8(reinterpret_cast(input_block_data +
-                                                       input_block_offset + 1),
-                         half_work_reg, 2);
-        half_work_reg =
-            vld1_lane_s8(reinterpret_cast(input_block_data +
-                                                       input_block_offset + 2),
-                         half_work_reg, 3);
-
-        if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-          half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-        }
-        TFLITE_DCHECK_EQ(scratch_data_offset % 8, 0);
-        vst1_s8(scratch_data_base + scratch_data_offset, half_work_reg);
-
-        // Trailing guard.
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 4,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 8,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 12,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 16,
-                      half_work_reg, 0);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else {
-      TFLITE_DCHECK_EQ(width_overall_micro_repeats, 1);
-      const int copy_remaining = (copy_size + start_width) & 0x3;
-      padding_mask = vreinterpret_s8_s64(vshl_s64(
-          vreinterpret_s64_s8(padding_mask), vdup_n_s64(8 * copy_remaining)));
-      if (leading_width_padding) {
-        padding_mask = vset_lane_u8(255, padding_mask, 0);
-      }
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        for (int i = 0; i < copy_size; ++i) {
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_n_s64(vreinterpret_s64_s8(half_work_reg), 8));
-          half_work_reg = vld1_lane_s8(
-              reinterpret_cast(
-                  input_block_data + input_block_offset + copy_size - 1 - i),
-              half_work_reg, 0);
-        }
-        if (leading_width_padding) {
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_n_s64(vreinterpret_s64_s8(half_work_reg), 8));
-        }
-        half_work_reg = vbsl_s8(vreinterpret_u8_s8(padding_mask),
-                                vget_low_s8(padding_reg), half_work_reg);
-
-        if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-          half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-        }
-        TFLITE_DCHECK_EQ(scratch_data_offset % 4, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset, half_work_reg,
-                      0);
-
-        // Trailing guard.
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 4,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 8,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 12,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 16,
-                      half_work_reg, 0);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    }
-
-    scratch_data_base += copy_block_height * workspace_height_stride;
-
-    if (trailing_height_padding) {
-      memset(scratch_data_base, -input_offset_difference,
-             workspace_height_stride + kWorkspaceExtension);
-      scratch_data_base += workspace_height_stride;
-    }
-
-    TFLITE_DCHECK_EQ(
-        scratch_data_base,
-        scratch_block_data + block_height * workspace_height_stride);
-  }
-
-  static inline void Run(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-#ifdef __aarch64__
-    PreloadInputBlock(input_block_data, function_params);
-#endif
-
-    PackMacroBlockIntrinsics(height_block_number, width_block_number,
-                             input_block_data, scratch_block_data,
-                             function_params);
-  }
-};
-
-template 
-struct PackMacroBlock {
-  static inline void PackMacroBlockIntrinsics(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int input_width_micro_repeats =
-        function_params->input_width_micro_repeats;
-    const int block_height = function_params->inbound_block_height;
-    const int residual_width = function_params->residual_width;
-    const int input_height_stride = function_params->input_height_stride;
-
-    TFLITE_DCHECK_EQ(function_params->padding_left, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_right, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_top, 0);
-    TFLITE_DCHECK_EQ(function_params->padding_bottom, 0);
-
-    TFLITE_DCHECK_GE(workspace_height_stride, 4 * width_overall_micro_repeats);
-
-    // Work through one slice, by row, at a time.
-    int8* scratch_data_base = scratch_block_data;
-
-    const int copy_block_height = block_height;
-
-    int adjusted_residual_width =
-        input_width_micro_repeats < width_overall_micro_repeats ? residual_width
-                                                                : 4;
-
-    const int copy_size =
-        (width_overall_micro_repeats - 1) * 4 + adjusted_residual_width;
-
-    TFLITE_DCHECK_LE(
-        copy_size,
-        input_height_stride - width_block_number * input_width_micro_repeats);
-    // We may drop up to stride-1 of trailing input.
-    TFLITE_DCHECK_GE(copy_size, input_height_stride - 1);
-
-    int scratch_data_offset = 0;
-    int input_block_offset = 0;
-
-    constexpr uint8 kSignBit =
-        QuantizationTypeImpl::kUint8SignBit;
-
-    // Transpositions are 4x4, but doing 2 at a time is more efficient in NEON
-    // code. Note the blocks of 4x4 are still interleaved down the depth.
-    int8x16_t work_reg;
-    int8x8_t half_work_reg;
-
-    // Effect subtraction of zero-point = 128 by XOR of sign bit.
-    const uint8x16_t sign_bit = vdupq_n_u8(kSignBit);
-    half_work_reg = vdup_n_s8(0);
-
-    if (copy_size >= 16) {
-      const int copy_remaining = copy_size & 0x7;
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Work through one slice, by row, at a time.
-        int8* scratch_data = scratch_data_base + scratch_data_offset;
-
-        int copy_done = 0;
-
-        // Main copy loop.
-        for (; (copy_done + 16) <= copy_size; copy_done += 16) {
-          work_reg =
-              util_vld1q_x8(input_block_data + input_block_offset + copy_done);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            work_reg = veorq_s8(work_reg, sign_bit);
-          }
-          TFLITE_DCHECK_EQ(copy_done % 16, 0);
-          vst1q_s8(scratch_data + copy_done, work_reg);
-        }
-
-        if (copy_done + 8 <= copy_size) {
-          half_work_reg =
-              util_vld1_x8(input_block_data + input_block_offset + copy_done);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ(copy_done % 8, 0);
-          vst1_s8(scratch_data + copy_done, half_work_reg);
-          copy_done += 8;
-        }
-
-        TFLITE_DCHECK_EQ(copy_remaining, copy_size - copy_done);
-        // Total amount
-        // = copy_size - copy_done + 4 - adjusted_residual_width
-        // = width_overall_micro_repeats * 4 - start_width - copy_done.
-        // Undone micro blocks
-        // = width_overall_micro_repeats - (start_width + copy_done) / 4.
-
-        // Conditional is (copy_remaining > 0 || trailing_width_padding).
-        if (copy_done < copy_size) {
-          // Employ overlapping-load strategy in order to load full register,
-          // but use only part.
-          // This has the advantage of resulting in zeros after shifting.
-          half_work_reg = util_vld1_x8(input_block_data + input_block_offset +
-                                       copy_size - 8);
-
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_s64(vreinterpret_s64_s8(half_work_reg),
-                       vdup_n_s64(-8 * (8 - copy_remaining))));
-
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ(copy_done % 8, 0);
-          vst1_s8(scratch_data + copy_done, half_work_reg);
-          copy_done += 8;
-        }
-
-        // Trailing guard.
-        vst1_s8(scratch_data + copy_done, half_work_reg);
-        vst1_s8(scratch_data + copy_done + 8, half_work_reg);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else if (copy_size >= 4) {
-      const int copy_remaining = copy_size & 0x3;
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        // Work through one slice, by row, at a time.
-        int8* scratch_data = scratch_data_base + scratch_data_offset;
-
-        int copy_done = 0;
-
-        // Main copy loop.
-        for (; (copy_done + 4) <= copy_size; copy_done += 4) {
-          half_work_reg =
-              vld1_lane_8x4(input_block_data + input_block_offset + copy_done,
-                            half_work_reg, 0);
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ(copy_done % 4, 0);
-          vst1_lane_8x4(scratch_data + copy_done, half_work_reg, 0);
-        }
-
-        TFLITE_DCHECK_EQ(copy_remaining, copy_size - copy_done);
-        // Total amount
-        // = copy_size - copy_done + 4 - adjusted_residual_width
-        // = width_overall_micro_repeats * 4 - start_width - copy_done.
-        // Undone micro blocks
-        // = width_overall_micro_repeats - (start_width + copy_done) / 4.
-
-        // Conditional is (copy_remaining > 0 || trailing_width_padding).
-        if (copy_done < copy_size) {
-          TFLITE_DCHECK_LT(copy_remaining, 4);
-          // Employ overlapping-load strategy in order to load full register,
-          // but use only part.
-          // This has the advantage of resulting in zeros after shifting.
-          half_work_reg = vld1_lane_8x4(
-              input_block_data + input_block_offset + copy_size - 4,
-              half_work_reg, 0);
-
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_s64(vreinterpret_s64_s8(half_work_reg),
-                       vdup_n_s64(-8 * (4 - copy_remaining))));
-
-          if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-            half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-          }
-          TFLITE_DCHECK_EQ(copy_done % 4, 0);
-          vst1_lane_8x4(scratch_data + copy_done, half_work_reg, 0);
-          copy_done += 4;
-        }
-        // Trailing guard.
-        vst1_lane_8x4(scratch_data + copy_done, half_work_reg, 0);
-        vst1_lane_8x4(scratch_data + copy_done + 4, half_work_reg, 0);
-        vst1_lane_8x4(scratch_data + copy_done + 8, half_work_reg, 0);
-        vst1_lane_8x4(scratch_data + copy_done + 12, half_work_reg, 0);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    } else {
-      TFLITE_DCHECK_EQ(width_overall_micro_repeats, 1);
-
-      for (int k_height = 0; k_height < copy_block_height; ++k_height) {
-        for (int i = 0; i < copy_size; ++i) {
-          half_work_reg = vreinterpret_s8_s64(
-              vshl_n_s64(vreinterpret_s64_s8(half_work_reg), 8));
-          half_work_reg = vld1_lane_s8(
-              reinterpret_cast(
-                  input_block_data + input_block_offset + copy_size - 1 - i),
-              half_work_reg, 0);
-        }
-
-        half_work_reg = veor_s8(half_work_reg, vget_low_s8(sign_bit));
-        TFLITE_DCHECK_EQ(scratch_data_offset % 4, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset, half_work_reg,
-                      0);
-
-        // Trailing guard.
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 4,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 8,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 12,
-                      half_work_reg, 0);
-        vst1_lane_8x4(scratch_data_base + scratch_data_offset + 16,
-                      half_work_reg, 0);
-
-        scratch_data_offset += workspace_height_stride;
-        input_block_offset += input_height_stride;
-      }
-    }
-
-    scratch_data_base += copy_block_height * workspace_height_stride;
-
-    TFLITE_DCHECK_EQ(
-        scratch_data_base,
-        scratch_block_data + block_height * workspace_height_stride);
-  }
-
-  static inline void Run(
-      int32 height_block_number, int32 width_block_number,
-      const typename QuantizationTypeImpl::ExternalType*
-          input_block_data,
-      int8* scratch_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-#ifdef __aarch64__
-    PreloadInputBlock(input_block_data, function_params);
-#endif
-
-    PackMacroBlockIntrinsics(height_block_number, width_block_number,
-                             input_block_data, scratch_block_data,
-                             function_params);
-  }
-};
-
-#endif  // ARM NEON
-
-// Apply filter to macro block of input data and store results.
-//
-// Requirement: depth_micro_repeats > 0 || residual_depth > 0.
-template 
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseCModel3x3DotProduct, quantization_type,
-    DepthwiseConvDepthMultiplication::kNoMultiplication, stride> {
-  // Construct a width-shifted combination of two input sub-blocks, effectively
-  // concatenating them.
-  //
-  // The filter is applied using sub-blocks. These are in the needed form for
-  // the first (width) offset. For subsequent offsets, the filter is applied to
-  // shifted and combined data. The concatentation and shifting herein is fairly
-  // straightforward, but in the optimized code is an area of creativity in
-  // design because NEON instructions do not directly support the required
-  // between-register permutation.
-  //
-  // In NEON optimized code, input data is grouped in 4-byte blocks. In order to
-  // move along the width for each output point calculation, data is shifted, in
-  // essence between two such blocks.
-  //
-  // selected_data has format height 3, depth 4, width 4.
-  //
-  // When the micro block is trailing (the last across the macro-block width),
-  // it would be illegal to load the right (next) block, and the no_right_block
-  // indicates this scenario.
-  static inline void ConcatenateInputSubBlocks(int offset, int sub_block,
-                                               int workspace_height_stride,
-                                               int width_micro_stride,
-                                               bool no_right_block,
-                                               const int8* input_block,
-                                               int8 selected_data[3][4][4]) {
-    TFLITE_DCHECK_GE(offset, 0);
-    TFLITE_DCHECK_LT(offset, 4);
-
-    // The input banks have same format as selected_data.
-    int8 left_bank[3][4][4];
-    int8 right_bank[3][4][4];
-
-    // Work through one slice, by row, at a time.
-    for (int k_height = 0; k_height < 3; ++k_height) {
-      // Simulate demangling of mangled storage arrangement.
-      const int8* left_input_block =
-          &input_block[k_height * workspace_height_stride + sub_block * 2 * 8];
-      memcpy(left_bank[k_height][0], left_input_block, 16);
-      if (no_right_block) {
-        memset(right_bank[k_height][0], 0, 16);
-      } else {
-        const int8* right_input_block =
-            &input_block[k_height * workspace_height_stride +
-                         sub_block * 2 * 8 + width_micro_stride];
-        memcpy(right_bank[k_height][0], right_input_block, 16);
-      }
-      for (int depth_index = 0; depth_index < 4; ++depth_index) {
-        memcpy(selected_data[k_height][depth_index],
-               &left_bank[k_height][depth_index][offset], 4 - offset);
-        memcpy(&selected_data[k_height][depth_index][4 - offset],
-               right_bank[k_height][depth_index], offset);
-      }
-    }
-  }
-
-  // Straight implementation of 3x3 filter within sub-micro block.
-  static inline void Calculate3x3FilterOutput(
-      const DepthwiseConvDotProdParams& params, int sub_block,
-      const int8 selected_data[3][4][4], const int8 filter_bank[3][2][4][4],
-      const int32* bias_data, uint8 output_values[4]) {
-    const int32 output_activation_min = params.quantized_activation_min;
-    const int32 output_activation_max = params.quantized_activation_max;
-    const int32 output_multiplier = params.output_multiplier;
-    const int32 output_shift = params.output_shift;
-    const int32 output_offset = params.output_offset;
-    for (int d = 0; d < 4; ++d) {
-      int32 acc = 0;
-      for (int y = 0; y < 3; ++y) {
-        for (int x = 0; x < 4; ++x) {
-          int32 input_val = selected_data[y][d][x];
-          int32 filter_val = filter_bank[y][sub_block][d][x];
-          acc += filter_val * input_val;
-        }
-      }
-      acc += bias_data[d];
-      acc = reference_ops::depthwise_conv::DepthwiseConvRound<
-          DepthwiseConvOutputRounding::kUpward>(acc, output_multiplier,
-                                                output_shift);
-      acc += output_offset;
-      acc = std::max(acc, output_activation_min);
-      acc = std::min(acc, output_activation_max);
-      output_values[d] = static_cast(acc);
-    }
-  }
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         uint8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int input_width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int depth = function_params->input_depth;
-    const int stride_val = function_params->stride;
-    const int four_over_stride = function_params->four_over_stride;
-
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    constexpr int bias_increment = 4;
-    TFLITE_DCHECK_EQ(function_params->bias_increment, bias_increment);
-
-    TFLITE_DCHECK(depth_micro_repeats > 0);
-    const int width_micro_stride = 4 * 8;
-    const int depth_micro_stride =
-        width_micro_stride * input_width_overall_micro_repeats;
-
-    constexpr int shuffled_filter_increment = 2 * 3 * 4 * 4;
-
-    // Simulate NEON-register transposition of subset of filter.
-    int8 filter_bank[3][2][4][4];  // Height 3, sub-block,  depth 4, width 4.
-    // Simulate NEON-register input data concatenation + sub-selection.
-    int8 sub_selected_input_data[3][4][4];  // Height 3, depth 4, width 4.
-    uint8 output_values[4];                 // Depth 4.
-
-    // The outer 3 loops go through all the micro blocks in a macro block, and
-    // separately treat the two sub-blocks within each micro block.
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      memcpy(filter_bank[0][0][0],
-             filter_workspace + j_depth * shuffled_filter_increment,
-             shuffled_filter_increment);
-
-      for (int s = 0; s < 2; ++s) {
-        for (int k_height = 0; k_height < block_height; ++k_height) {
-          const int8* scratch_data =
-              scratch_block_data +
-              workspace_height_stride * k_height * stride_val +
-              depth_micro_stride * j_depth;
-          uint8* output_data =
-              output_block_data + output_height_stride * k_height + 8 * j_depth;
-
-          for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-               ++i_width) {
-            const int output_width = i_width == output_width_micro_repeats
-                                         ? residual_width
-                                         : four_over_stride;
-            const bool no_right_block = (output_width - 1) * stride_val < 2;
-            TFLITE_DCHECK_LE(output_width * stride_val, 4);
-            const int8* input_data =
-                scratch_data + width_micro_stride * i_width;
-            // Iterate over input width shifts within sub-micro blocks.
-            for (int x = 0; x < output_width; ++x) {
-              ConcatenateInputSubBlocks(x * stride_val, s,
-                                        workspace_height_stride,
-                                        width_micro_stride, no_right_block,
-                                        input_data, sub_selected_input_data);
-              Calculate3x3FilterOutput(
-                  *function_params, s, sub_selected_input_data, filter_bank,
-                  bias_data + (2 * j_depth + s) * bias_increment,
-                  output_values);
-              for (int d = 0; d < 4; ++d) {
-                output_data[depth * (four_over_stride * i_width + x) + 4 * s +
-                            d] = output_values[d];
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-};
-
-// Apply filter to macro block of input data and store results.
-//
-// Parameters for repeats and residual sizes are in terms of outputs.
-//
-// Requirement: depth_micro_repeats > 0 || residual_depth > 0.
-template 
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseCModel3x3DotProduct, quantization_type,
-    DepthwiseConvDepthMultiplication::kUnitInputDepth, stride> {
-  // Construct a width-shifted combination of two input sub-blocks, effectively
-  // concatenating them.
-  //
-  // The filter is applied using sub-blocks. These are in the needed form for
-  // the first (width) offset. For subsequent offsets, the filter is applied to
-  // shifted and combined data. The concatentation and shifting herein is fairly
-  // straightforward, but in the optimized code is an area of creativity in
-  // design because NEON instructions do not directly support the required
-  // between-register permutation.
-  //
-  // In NEON optimized code, input data is grouped in 4-byte blocks. In order to
-  // move along the width for each output point calculation, data is shifted, in
-  // essence between two such blocks.
-  //
-  // selected_data has format height 3, width 4.
-  //
-  // When the micro block is trailing (the last across the macro-block width),
-  // it would be illegal to load the right (next) block, and the no_right_block
-  // indicates this scenario.
-  static inline void ConcatenateInputSubBlocks(int offset,
-                                               int workspace_height_stride,
-                                               bool no_right_block,
-                                               const int8* input_block,
-                                               int8 selected_data[3][4]) {
-    TFLITE_DCHECK_GE(offset, 0);
-    TFLITE_DCHECK_LT(offset, 4);
-    if (no_right_block) {
-      for (int k_height = 0; k_height < 3; ++k_height) {
-        memcpy(selected_data[k_height],
-               &input_block[k_height * workspace_height_stride + offset],
-               4 - offset);
-      }
-    } else {
-      for (int k_height = 0; k_height < 3; ++k_height) {
-        memcpy(selected_data[k_height],
-               &input_block[k_height * workspace_height_stride + offset], 4);
-      }
-    }
-  }
-
-  // Straight implementation of 3x3 filter within sub-micro block.
-  static inline void Calculate3x3FilterOutput(
-      const DepthwiseConvDotProdParams& function_params, int sub_block,
-      const int8 selected_data[3][4], const int8 filter_bank[3][2][4][4],
-      const int32* bias_data, uint8 output_values[4]) {
-    const int32 output_activation_min =
-        function_params.quantized_activation_min;
-    const int32 output_activation_max =
-        function_params.quantized_activation_max;
-    const int32 output_multiplier = function_params.output_multiplier;
-    const int32 output_shift = function_params.output_shift;
-    const int32 output_offset = function_params.output_offset;
-    for (int d = 0; d < 4; ++d) {
-      int32 acc = 0;
-      for (int y = 0; y < 3; ++y) {
-        for (int x = 0; x < 4; ++x) {
-          int32 input_val = selected_data[y][x];
-          int32 filter_val = filter_bank[y][sub_block][d][x];
-          acc += filter_val * input_val;
-        }
-      }
-      acc += bias_data[d];
-      acc = reference_ops::depthwise_conv::DepthwiseConvRound<
-          DepthwiseConvOutputRounding::kUpward>(acc, output_multiplier,
-                                                output_shift);
-      acc += output_offset;
-      acc = std::max(acc, output_activation_min);
-      acc = std::min(acc, output_activation_max);
-      output_values[d] = static_cast(acc);
-    }
-  }
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         uint8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int depth = function_params->output_depth;
-    const int stride_val = function_params->stride;
-    const int four_over_stride = function_params->four_over_stride;
-
-    const int workspace_width_micro_repeats =
-        function_params->workspace_width_micro_repeats;
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    constexpr int bias_increment = 4;
-    TFLITE_DCHECK_EQ(function_params->bias_increment, bias_increment);
-
-    TFLITE_DCHECK(depth_micro_repeats > 0);
-
-    constexpr int shuffled_filter_increment = 2 * 3 * 4 * 4;
-
-    // Simulate NEON-register transposition of subset of filter.
-    int8 filter_bank[3][2][4][4];  // Height 3, sub-block,  depth 4, width 4.
-    // Simulate NEON-register input data concatenation + sub-selection.
-    int8 sub_selected_input_data[3][4];  // Height 3, depth 4, width 4.
-    uint8 output_values[4];              // Depth 4.
-
-    // The outer 3 loops go through all the micro blocks in a macro block, and
-    // separately treat the two sub-blocks within each micro block.
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      memcpy(filter_bank[0][0][0],
-             filter_workspace + j_depth * shuffled_filter_increment,
-             shuffled_filter_increment);
-
-      for (int s = 0; s < 2; ++s) {
-        for (int k_height = 0; k_height < block_height; ++k_height) {
-          const int8* scratch_data =
-              scratch_block_data +
-              workspace_height_stride * k_height * stride_val;
-          uint8* output_data =
-              output_block_data + output_height_stride * k_height + 8 * j_depth;
-
-          for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-               ++i_width) {
-            const int output_width = i_width == output_width_micro_repeats
-                                         ? residual_width
-                                         : four_over_stride;
-            const bool no_right_block = i_width == output_width_micro_repeats &&
-                                        output_width_overall_micro_repeats ==
-                                            workspace_width_micro_repeats;
-            TFLITE_DCHECK_LE(output_width * stride_val, 4);
-            const int8* input_data = scratch_data + 4 * i_width;
-            // Iterate over input width shifts within 4x4 blocks.
-            for (int x = 0; x < output_width; ++x) {
-              ConcatenateInputSubBlocks(x * stride_val, workspace_height_stride,
-                                        no_right_block, input_data,
-                                        sub_selected_input_data);
-              Calculate3x3FilterOutput(
-                  *function_params, s, sub_selected_input_data, filter_bank,
-                  bias_data + (2 * j_depth + s) * bias_increment,
-                  output_values);
-              for (int d = 0; d < 4; ++d) {
-                output_data[depth * (four_over_stride * i_width + x) + 4 * s +
-                            d] = output_values[d];
-              }
-            }
-          }
-        }
-      }
-    }
-  }
-};
-
-// Beginning of code section containing intermediate code transformation.
-//
-// This section is only compiled when kUseUnwound3x3DotProduct versions of
-// templated functions are selected.
-template 
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseUnwound3x3DotProduct, quantization_type,
-    DepthwiseConvDepthMultiplication::kNoMultiplication, stride> {
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         uint8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int input_width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int depth = function_params->input_depth;
-    const int stride_val = function_params->stride;
-    const int four_over_stride = function_params->four_over_stride;
-
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    const int bias_increment = function_params->bias_increment;
-
-    TFLITE_DCHECK(depth_micro_repeats > 0);
-    const int width_micro_stride = 4 * 8;
-    const int depth_micro_stride =
-        width_micro_stride * input_width_overall_micro_repeats;
-
-    const int32 output_activation_min =
-        function_params->quantized_activation_min;
-    const int32 output_activation_max =
-        function_params->quantized_activation_max;
-    const int32 output_multiplier = function_params->output_multiplier;
-    const int32 output_shift = function_params->output_shift;
-    const int32 output_offset = function_params->output_offset;
-
-    // Simulate NEON-register transposition of subset of filter.
-    int8 filter_bank_a_0[4][4];  // Depth 4, width 4.
-    int8 filter_bank_a_1[4][4];
-    int8 filter_bank_a_2[4][4];
-    int8 filter_bank_b_0[4][4];
-    int8 filter_bank_b_1[4][4];
-    int8 filter_bank_b_2[4][4];
-    // Simulate NEON-register input data concatenation + sub-selection.
-    // Also sub-block, height 3, depth 4, width 4.
-    uint8 output_values[4];  // Sub-block, depth 4.
-    // selected_data has format Depth 4, width 4.
-    int8 left_bank_0[4][4];
-    int8 left_bank_1[4][4];
-    int8 left_bank_2[4][4];
-    int8 right_bank_0[4][4];
-    int8 right_bank_1[4][4];
-    int8 right_bank_2[4][4];
-    memset(right_bank_0[0], 0, 16);
-    memset(right_bank_1[0], 0, 16);
-    memset(right_bank_2[0], 0, 16);
-
-    constexpr int shuffled_filter_increment = 2 * 3 * 4 * 4;
-
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      const int8* filter_block =
-          filter_workspace + shuffled_filter_increment * j_depth;
-
-      memcpy(filter_bank_a_0, filter_block, 16);
-      memcpy(filter_bank_b_0, filter_block + 16, 16);
-      memcpy(filter_bank_a_1, filter_block + 32, 16);
-      memcpy(filter_bank_b_1, filter_block + 48, 16);
-      memcpy(filter_bank_a_2, filter_block + 64, 16);
-      memcpy(filter_bank_b_2, filter_block + 80, 16);
-
-      for (int s = 0; s < 2; ++s) {
-        // Work through one slice, by row, at a time.
-        for (int k_height = 0; k_height < block_height; ++k_height) {
-          const int8* scratch_data =
-              scratch_block_data +
-              workspace_height_stride * k_height * stride_val +
-              depth_micro_stride * j_depth;
-          uint8* output_data =
-              output_block_data + output_height_stride * k_height + 8 * j_depth;
-          const int8* input_data_0 = scratch_data + s * 2 * 8;
-
-          // Load first sub-micro block of data into operational banks.
-          memcpy(left_bank_0[0], input_data_0, 16);
-          memcpy(left_bank_1[0], input_data_0 + workspace_height_stride, 16);
-          memcpy(left_bank_2[0], input_data_0 + 2 * workspace_height_stride,
-                 16);
-
-          for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-               ++i_width) {
-            const int output_width = i_width == output_width_micro_repeats
-                                         ? residual_width
-                                         : four_over_stride;
-            TFLITE_DCHECK_LE(output_width * stride_val, 4);
-            const int8* input_data =
-                input_data_0 + width_micro_stride * i_width;
-            const bool no_right_block = (output_width - 1) * stride_val < 2;
-
-            // Load next sub-micro block of data.
-            if (!no_right_block) {
-              memcpy(right_bank_0[0], input_data + width_micro_stride, 16);
-              memcpy(right_bank_1[0],
-                     input_data + workspace_height_stride + width_micro_stride,
-                     16);
-              memcpy(
-                  right_bank_2[0],
-                  input_data + 2 * workspace_height_stride + width_micro_stride,
-                  16);
-            }
-
-            // Iterate over input width shifts within 4x4 blocks.
-            for (int x = 0; x < output_width; ++x) {
-              // Operate on depth of 4 in batches.
-              for (int d = 0; d < 4; ++d) {
-                int32 acc = 0;
-                for (int x = 0; x < 4; ++x) {
-                  int32 input_val = left_bank_0[d][x];
-                  int32 filter_val = filter_bank_a_0[d][x];
-                  acc += filter_val * input_val;
-                }
-                for (int x = 0; x < 4; ++x) {
-                  int32 input_val = left_bank_1[d][x];
-                  int32 filter_val = filter_bank_a_1[d][x];
-                  acc += filter_val * input_val;
-                }
-                for (int x = 0; x < 4; ++x) {
-                  int32 input_val = left_bank_2[d][x];
-                  int32 filter_val = filter_bank_a_2[d][x];
-                  acc += filter_val * input_val;
-                }
-                acc += bias_data[d];
-                acc = reference_ops::depthwise_conv::DepthwiseConvRound<
-                    DepthwiseConvOutputRounding::kUpward>(
-                    acc, output_multiplier, output_shift);
-                acc += output_offset;
-                acc = std::max(acc, output_activation_min);
-                acc = std::min(acc, output_activation_max);
-                output_values[d] = static_cast(acc);
-              }
-
-              for (int d = 0; d < 4; ++d) {
-                output_data[depth * (four_over_stride * i_width + x) + 4 * s +
-                            d] = output_values[d];
-              }
-
-              // Simulate shifting instructions.
-              if (stride_val == 1) {
-                for (int depth_index = 0; depth_index < 4; ++depth_index) {
-                  for (int z = 0; z < 3; ++z) {
-                    left_bank_0[depth_index][z] =
-                        left_bank_0[depth_index][z + 1];
-                    left_bank_1[depth_index][z] =
-                        left_bank_1[depth_index][z + 1];
-                    left_bank_2[depth_index][z] =
-                        left_bank_2[depth_index][z + 1];
-                  }
-                  left_bank_0[depth_index][3] = right_bank_0[depth_index][0];
-                  left_bank_1[depth_index][3] = right_bank_1[depth_index][0];
-                  left_bank_2[depth_index][3] = right_bank_2[depth_index][0];
-                  for (int z = 0; z < 3; ++z) {
-                    right_bank_0[depth_index][z] =
-                        right_bank_0[depth_index][z + 1];
-                    right_bank_1[depth_index][z] =
-                        right_bank_1[depth_index][z + 1];
-                    right_bank_2[depth_index][z] =
-                        right_bank_2[depth_index][z + 1];
-                  }
-                }
-              } else {
-                for (int depth_index = 0; depth_index < 4; ++depth_index) {
-                  for (int z = 0; z < 2; ++z) {
-                    left_bank_0[depth_index][z] =
-                        left_bank_0[depth_index][z + 2];
-                    left_bank_1[depth_index][z] =
-                        left_bank_1[depth_index][z + 2];
-                    left_bank_2[depth_index][z] =
-                        left_bank_2[depth_index][z + 2];
-                  }
-                  left_bank_0[depth_index][2] = right_bank_0[depth_index][0];
-                  left_bank_1[depth_index][2] = right_bank_1[depth_index][0];
-                  left_bank_2[depth_index][2] = right_bank_2[depth_index][0];
-                  left_bank_0[depth_index][3] = right_bank_0[depth_index][1];
-                  left_bank_1[depth_index][3] = right_bank_1[depth_index][1];
-                  left_bank_2[depth_index][3] = right_bank_2[depth_index][1];
-                  for (int z = 0; z < 2; ++z) {
-                    right_bank_0[depth_index][z] =
-                        right_bank_0[depth_index][z + 2];
-                    right_bank_1[depth_index][z] =
-                        right_bank_1[depth_index][z + 2];
-                    right_bank_2[depth_index][z] =
-                        right_bank_2[depth_index][z + 2];
-                  }
-                }
-              }
-            }
-          }
-        }
-        bias_data += bias_increment;
-
-        // Move filter for second sub-block into operational filter.
-        for (int z = 0; z < 4; ++z) {
-          for (int x = 0; x < 4; ++x) {
-            filter_bank_a_0[z][x] = filter_bank_b_0[z][x];
-            filter_bank_a_1[z][x] = filter_bank_b_1[z][x];
-            filter_bank_a_2[z][x] = filter_bank_b_2[z][x];
-          }
-        }
-      }
-    }
-  }
-};
-
-template 
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseUnwound3x3DotProduct, quantization_type,
-    DepthwiseConvDepthMultiplication::kUnitInputDepth, stride> {
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         uint8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int output_depth = function_params->output_depth;
-    const int stride_val = function_params->stride;
-    const int four_over_stride = function_params->four_over_stride;
-
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    const int bias_increment = function_params->bias_increment;
-
-    const int32 output_activation_min =
-        function_params->quantized_activation_min;
-    const int32 output_activation_max =
-        function_params->quantized_activation_max;
-    const int32 output_multiplier = function_params->output_multiplier;
-    const int32 output_shift = function_params->output_shift;
-    const int32 output_offset = function_params->output_offset;
-
-    TFLITE_DCHECK(depth_micro_repeats > 0);
-
-    TFLITE_DCHECK_EQ(bias_increment, 4);
-
-    constexpr int shuffled_filter_increment = 2 * 3 * 4 * 4;
-
-    // Simulate NEON-register transposition of subset of filter.
-    int8 filter_bank_a_0[4][4];  // Depth 4, width 4.
-    int8 filter_bank_a_1[4][4];
-    int8 filter_bank_a_2[4][4];
-    int8 filter_bank_b_0[4][4];
-    int8 filter_bank_b_1[4][4];
-    int8 filter_bank_b_2[4][4];
-    // Simulate NEON-register input data concatenation + sub-selection.
-    // Also sub-block, height 3, depth 4, width 4.
-
-    int8 input_bank_0[8];
-    int8 input_bank_1[8];
-    int8 input_bank_2[8];
-
-    TFLITE_DCHECK_GE(depth_micro_repeats, 1);
-
-    uint8 output_values[2][4];  // Sub-block, depth 4.
-
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      memcpy(filter_bank_a_0, filter_workspace, 16);
-      memcpy(filter_bank_b_0, filter_workspace + 16, 16);
-      memcpy(filter_bank_a_1, filter_workspace + 32, 16);
-      memcpy(filter_bank_b_1, filter_workspace + 48, 16);
-      memcpy(filter_bank_a_2, filter_workspace + 64, 16);
-      memcpy(filter_bank_b_2, filter_workspace + 80, 16);
-
-      // Work through one slice, by row, at a time.
-      for (int k_height = 0; k_height < block_height; ++k_height) {
-        const int8* scratch_data =
-            scratch_block_data +
-            workspace_height_stride * k_height * stride_val;
-        uint8* output_data =
-            output_block_data + output_height_stride * k_height + 8 * j_depth;
-
-        memcpy(input_bank_0, scratch_data, 4);
-        memcpy(input_bank_1, scratch_data + workspace_height_stride, 4);
-        memcpy(input_bank_2, scratch_data + 2 * workspace_height_stride, 4);
-
-        for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-             ++i_width) {
-          const int output_width = i_width == output_width_micro_repeats
-                                       ? residual_width
-                                       : four_over_stride;
-
-          TFLITE_DCHECK_LE(output_width * stride_val, 4);
-          const int8* input_data = scratch_data + 4 * i_width;
-
-          memcpy(input_bank_0 + 4, input_data + 4, 4);
-          memcpy(input_bank_1 + 4, input_data + workspace_height_stride + 4, 4);
-          memcpy(input_bank_2 + 4, input_data + 2 * workspace_height_stride + 4,
-                 4);
-
-          // Iterate over input width shifts within 4x4 blocks.
-          for (int w = 0; w < output_width; ++w) {
-            constexpr int offset =
-                0;  // Shift input instead of offset in multiply-accumulate.
-
-            {
-              const int s = 0;
-              for (int d = 0; d < 4; ++d) {
-                int32 acc = bias_data[s * 4 + d];
-                for (int x = 0; x < 4; ++x) {
-                  int32 input_val_0 = input_bank_0[offset + x];
-                  int32 filter_val_0 = filter_bank_a_0[d][x];
-                  acc += filter_val_0 * input_val_0;
-                  int32 input_val_1 = input_bank_1[offset + x];
-                  int32 filter_val_1 = filter_bank_a_1[d][x];
-                  acc += filter_val_1 * input_val_1;
-                  int32 input_val_2 = input_bank_2[offset + x];
-                  int32 filter_val_2 = filter_bank_a_2[d][x];
-                  acc += filter_val_2 * input_val_2;
-                }
-                acc = reference_ops::depthwise_conv::DepthwiseConvRound<
-                    DepthwiseConvOutputRounding::kUpward>(
-                    acc, output_multiplier, output_shift);
-                acc += output_offset;
-                acc = std::max(acc, output_activation_min);
-                acc = std::min(acc, output_activation_max);
-                output_values[s][d] = static_cast(acc);
-
-                output_data[s * 4 + d] = output_values[s][d];
-              }
-            }
-            {
-              const int s = 1;
-              for (int d = 0; d < 4; ++d) {
-                int32 acc = bias_data[s * 4 + d];
-                for (int x = 0; x < 4; ++x) {
-                  int32 input_val_0 = input_bank_0[offset + x];
-                  int32 filter_val_0 = filter_bank_b_0[d][x];
-                  acc += filter_val_0 * input_val_0;
-                  int32 input_val_1 = input_bank_1[offset + x];
-                  int32 filter_val_1 = filter_bank_b_1[d][x];
-                  acc += filter_val_1 * input_val_1;
-                  int32 input_val_2 = input_bank_2[offset + x];
-                  int32 filter_val_2 = filter_bank_b_2[d][x];
-                  acc += filter_val_2 * input_val_2;
-                }
-                acc = reference_ops::depthwise_conv::DepthwiseConvRound<
-                    DepthwiseConvOutputRounding::kUpward>(
-                    acc, output_multiplier, output_shift);
-                acc += output_offset;
-                acc = std::max(acc, output_activation_min);
-                acc = std::min(acc, output_activation_max);
-                output_values[s][d] = static_cast(acc);
-
-                output_data[s * 4 + d] = output_values[s][d];
-              }
-            }
-
-            // Simulate register shifts.
-            for (int i = 0; i < (8 - stride_val); ++i) {
-              input_bank_0[i] = input_bank_0[i + stride_val];
-              input_bank_1[i] = input_bank_1[i + stride_val];
-              input_bank_2[i] = input_bank_2[i + stride_val];
-            }
-
-            output_data += output_depth;
-          }
-        }
-      }
-      bias_data += 2 * bias_increment;
-      filter_workspace += shuffled_filter_increment;
-    }
-  }
-};
-// The preceding section is only compiled when kUseUnwound3x3DotProduct versions
-// of templated functions are selected.
-//
-// End of code section containing intermediate code transformation.
-
-#ifdef USE_NEON
-template <>
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseIntrinsics3x3DotProduct,
-    QuantizationType::kNonPerChannelUint8,
-    DepthwiseConvDepthMultiplication::kNoMultiplication,
-    /*stride=*/1> {
-  static inline uint8x8_t vqmovxn_s16(int16x8_t x) { return vqmovun_s16(x); }
-  static inline uint8x8_t util_vmin_x8(uint8x8_t a, uint8x8_t b) {
-    return vmin_u8(a, b);
-  }
-  static inline uint8x8_t util_vmax_x8(uint8x8_t a, uint8x8_t b) {
-    return vmax_u8(a, b);
-  }
-  static inline uint8x16_t util_vminq_x8(uint8x16_t a, uint8x16_t b) {
-    return vminq_u8(a, b);
-  }
-  static inline uint8x16_t util_vmaxq_x8(uint8x16_t a, uint8x16_t b) {
-    return vmaxq_u8(a, b);
-  }
-
-  static inline void KernelMacroBlockIntrinsics(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    static constexpr QuantizationType quantization_type =
-        QuantizationType::kNonPerChannelUint8;
-
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int input_width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int depth = function_params->input_depth;
-
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    constexpr int kBiasIncrement = 4;
-
-    TFLITE_DCHECK(depth_micro_repeats > 0);
-    const int width_micro_stride = 4 * 8;
-    const int depth_micro_stride =
-        width_micro_stride * input_width_overall_micro_repeats;
-
-    const int32 output_activation_min =
-        function_params->quantized_activation_min;
-    const int32 output_activation_max =
-        function_params->quantized_activation_max;
-    const int32 output_multiplier = function_params->output_multiplier;
-    const int32 output_shift = function_params->output_shift;
-    const int32 output_offset = function_params->output_offset;
-    if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-      TFLITE_DCHECK_GE(output_activation_min, 0);
-      TFLITE_DCHECK_LT(output_activation_min, 256);
-      TFLITE_DCHECK_GE(output_activation_max, 0);
-      TFLITE_DCHECK_LT(output_activation_max, 256);
-    } else {
-      TFLITE_DCHECK_GE(output_activation_min, -128);
-      TFLITE_DCHECK_LT(output_activation_min, 128);
-      TFLITE_DCHECK_GE(output_activation_max, -128);
-      TFLITE_DCHECK_LT(output_activation_max, 128);
-    }
-    TFLITE_DCHECK_GE(output_offset, -32878);
-    TFLITE_DCHECK_LT(output_offset, 32768);
-
-    const int16x8_t output_offset_vec =
-        vdupq_n_s16(static_cast(output_offset));
-    const uint8x16_t output_activation_min_vec =
-        vdupq_n_u8(static_cast(output_activation_min));
-    const uint8x16_t output_activation_max_vec =
-        vdupq_n_u8(static_cast(output_activation_max));
-
-    const int8* input_data_depthwise = scratch_block_data;
-    typename QuantizationTypeImpl::ExternalType*
-        output_data_depthwise = output_block_data;
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      // Simulate NEON-register transposition of subset of filter.
-      int8x16_t filter_reg_0_a;
-      int8x16_t filter_reg_0_b;
-      int8x16_t filter_reg_1_a;
-      int8x16_t filter_reg_1_b;
-      int8x16_t filter_reg_2_a;
-      int8x16_t filter_reg_2_b;
-      int8x16_t filter_reg_0_a_shifted;
-      int8x16_t filter_reg_1_a_shifted;
-      int8x16_t filter_reg_2_a_shifted;
-
-      filter_reg_0_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_0_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-
-      filter_reg_0_a_shifted = vshlq_n_u32(filter_reg_0_a, 8);
-      filter_reg_1_a_shifted = vshlq_n_u32(filter_reg_1_a, 8);
-      filter_reg_2_a_shifted = vshlq_n_u32(filter_reg_2_a, 8);
-
-      if (block_height == 4) {
-        for (int s = 0; s < 2; ++s) {
-          // Work through one slice, by row, at a time.
-          const int8* input_data_base = input_data_depthwise + 2 * 8 * s;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data_base = output_data_depthwise + 4 * s;
-
-          const int8* next_input_data = input_data_base;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data = output_data_base;
-
-          const int32x4_t adjusted_bias_data = vld1q_s32(bias_data);
-          bias_data += kBiasIncrement;
-
-          // Load first sub-micro block of data into operational banks.
-          int8x16_t left_bank_0_reg = vld1q_s8(next_input_data);
-          int8x16_t left_bank_1_reg =
-              vld1q_s8(next_input_data + workspace_height_stride);
-          int8x16_t left_bank_2_reg =
-              vld1q_s8(next_input_data + 2 * workspace_height_stride);
-          int8x16_t left_bank_3_reg =
-              vld1q_s8(next_input_data + 3 * workspace_height_stride);
-          int8x16_t left_bank_4_reg =
-              vld1q_s8(next_input_data + 4 * workspace_height_stride);
-          int8x16_t left_bank_5_reg =
-              vld1q_s8(next_input_data + 5 * workspace_height_stride);
-
-          int32x4_t acc0;
-          int32x4_t acc1;
-          int32x4_t acc2;
-          int32x4_t acc3;
-
-          acc0 = adjusted_bias_data;
-          acc1 = adjusted_bias_data;
-          acc2 = adjusted_bias_data;
-          acc3 = adjusted_bias_data;
-
-          acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-          acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_2_reg);
-          acc2 = vdotq_s32(acc2, filter_reg_0_a, left_bank_2_reg);
-          acc3 = vdotq_s32(acc3, filter_reg_0_a, left_bank_3_reg);
-
-          for (int i_width = 0; i_width < output_width_micro_repeats;
-               ++i_width) {
-            next_input_data += width_micro_stride;
-
-            // Iterate over input width shifts within 4x4 blocks.
-            {
-              acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_1_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_2_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_1_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_2_a, left_bank_5_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::Run(
-                  acc0, -output_shift);
-              acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::Run(
-                  acc1, -output_shift);
-              acc2 = vqrdmulhq_n_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::Run(
-                  acc2, -output_shift);
-              acc3 = vqrdmulhq_n_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::Run(
-                  acc3, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              uint8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                  vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              output_data += depth;
-            }
-
-            // Load next sub-micro block of data.
-            int8x16_t right_bank_0_reg;
-            int8x16_t right_bank_1_reg;
-            int8x16_t right_bank_2_reg;
-            int8x16_t right_bank_3_reg;
-            int8x16_t right_bank_4_reg;
-            int8x16_t right_bank_5_reg;
-
-            // Loading of next block always valid.
-            right_bank_0_reg = vld1q_s8(next_input_data);
-            right_bank_1_reg =
-                vld1q_s8(next_input_data + workspace_height_stride);
-            right_bank_2_reg =
-                vld1q_s8(next_input_data + 2 * workspace_height_stride);
-            right_bank_3_reg =
-                vld1q_s8(next_input_data + 3 * workspace_height_stride);
-            right_bank_4_reg =
-                vld1q_s8(next_input_data + 4 * workspace_height_stride);
-            right_bank_5_reg =
-                vld1q_s8(next_input_data + 5 * workspace_height_stride);
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_0_a_shifted, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a_shifted, left_bank_1_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_2_a_shifted, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a_shifted, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a_shifted, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a_shifted, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_0_a_shifted, left_bank_2_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_1_a_shifted, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_2_a_shifted, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_0_a_shifted, left_bank_3_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_1_a_shifted, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_2_a_shifted, left_bank_5_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::Run(
-                  acc0, -output_shift);
-              acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::Run(
-                  acc1, -output_shift);
-              acc2 = vqrdmulhq_n_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::Run(
-                  acc2, -output_shift);
-              acc3 = vqrdmulhq_n_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::Run(
-                  acc3, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              uint8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                  vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              left_bank_0_reg = vrev32q_u16(left_bank_0_reg);
-              left_bank_1_reg = vrev32q_u16(left_bank_1_reg);
-              left_bank_2_reg = vrev32q_u16(left_bank_2_reg);
-              left_bank_3_reg = vrev32q_u16(left_bank_3_reg);
-              left_bank_4_reg = vrev32q_u16(left_bank_4_reg);
-              left_bank_5_reg = vrev32q_u16(left_bank_5_reg);
-              vtrn1_s8x2_in_place(&left_bank_0_reg, &right_bank_0_reg);
-              vtrn1_s8x2_in_place(&left_bank_1_reg, &right_bank_1_reg);
-              vtrn1_s8x2_in_place(&left_bank_2_reg, &right_bank_2_reg);
-              vtrn1_s8x2_in_place(&left_bank_3_reg, &right_bank_3_reg);
-              vtrn1_s8x2_in_place(&left_bank_4_reg, &right_bank_4_reg);
-              vtrn1_s8x2_in_place(&left_bank_5_reg, &right_bank_5_reg);
-
-              output_data += depth;
-            }
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_0_a, left_bank_2_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_1_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_2_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_0_a, left_bank_3_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_1_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_2_a, left_bank_5_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::Run(
-                  acc0, -output_shift);
-              acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::Run(
-                  acc1, -output_shift);
-              acc2 = vqrdmulhq_n_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::Run(
-                  acc2, -output_shift);
-              acc3 = vqrdmulhq_n_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::Run(
-                  acc3, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              uint8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                  vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              output_data += depth;
-            }
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_0_a_shifted, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a_shifted, left_bank_1_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_2_a_shifted, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a_shifted, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a_shifted, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a_shifted, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_0_a_shifted, left_bank_2_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_1_a_shifted, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_2_a_shifted, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_0_a_shifted, left_bank_3_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_1_a_shifted, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_2_a_shifted, left_bank_5_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::Run(
-                  acc0, -output_shift);
-              acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::Run(
-                  acc1, -output_shift);
-              acc2 = vqrdmulhq_n_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::Run(
-                  acc2, -output_shift);
-              acc3 = vqrdmulhq_n_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::Run(
-                  acc3, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              uint8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                  vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              left_bank_0_reg = right_bank_0_reg;
-              left_bank_1_reg = right_bank_1_reg;
-              left_bank_2_reg = right_bank_2_reg;
-              left_bank_3_reg = right_bank_3_reg;
-              left_bank_4_reg = right_bank_4_reg;
-              left_bank_5_reg = right_bank_5_reg;
-
-              output_data += depth;
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_2_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_0_a, left_bank_2_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_0_a, left_bank_3_reg);
-            }
-          }
-
-          if (residual_width > 0) {
-            next_input_data += width_micro_stride;
-            const int output_width = residual_width;
-
-            // Load next sub-micro block of data.
-            int8x16_t right_bank_0_reg;
-            int8x16_t right_bank_1_reg;
-            int8x16_t right_bank_2_reg;
-            int8x16_t right_bank_3_reg;
-            int8x16_t right_bank_4_reg;
-            int8x16_t right_bank_5_reg;
-            // Logic: (output_width - 1) * stride_val < 2.
-            const bool no_right_block = output_width < 3;
-
-            if (no_right_block) {
-              // Only needed for sanitizer checks.
-              right_bank_0_reg = vdupq_n_s8(0);
-              right_bank_1_reg = vdupq_n_s8(0);
-              right_bank_2_reg = vdupq_n_s8(0);
-              right_bank_3_reg = vdupq_n_s8(0);
-              right_bank_4_reg = vdupq_n_s8(0);
-              right_bank_5_reg = vdupq_n_s8(0);
-            } else {
-              right_bank_0_reg = vld1q_s8(next_input_data);
-              right_bank_1_reg =
-                  vld1q_s8(next_input_data + workspace_height_stride);
-              right_bank_2_reg =
-                  vld1q_s8(next_input_data + 2 * workspace_height_stride);
-              right_bank_3_reg =
-                  vld1q_s8(next_input_data + 3 * workspace_height_stride);
-              right_bank_4_reg =
-                  vld1q_s8(next_input_data + 4 * workspace_height_stride);
-              right_bank_5_reg =
-                  vld1q_s8(next_input_data + 5 * workspace_height_stride);
-            }
-
-            // Iterate over input width shifts within 4x4 blocks.
-            for (int x = 0; x < output_width; ++x) {
-              acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_1_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_2_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_1_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_2_a, left_bank_5_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::Run(
-                  acc0, -output_shift);
-              acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::Run(
-                  acc1, -output_shift);
-              acc2 = vqrdmulhq_n_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::Run(
-                  acc2, -output_shift);
-              acc3 = vqrdmulhq_n_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::Run(
-                  acc3, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              uint8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                  vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              biregister_rotate_8(&left_bank_0_reg, &right_bank_0_reg);
-              biregister_rotate_8(&left_bank_1_reg, &right_bank_1_reg);
-              biregister_rotate_8(&left_bank_2_reg, &right_bank_2_reg);
-              biregister_rotate_8(&left_bank_3_reg, &right_bank_3_reg);
-              biregister_rotate_8(&left_bank_4_reg, &right_bank_4_reg);
-              biregister_rotate_8(&left_bank_5_reg, &right_bank_5_reg);
-
-              output_data += depth;
-
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_2_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_0_a, left_bank_2_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_0_a, left_bank_3_reg);
-            }
-          }
-          input_data_base += 4 * workspace_height_stride;
-          output_data_base += 4 * output_height_stride;
-
-          // Move to next sub-block: advance to second set of filters, to new
-          // bias.
-          filter_reg_0_a = filter_reg_0_b;
-          filter_reg_1_a = filter_reg_1_b;
-          filter_reg_2_a = filter_reg_2_b;
-          filter_reg_0_a_shifted = vshlq_n_u32(filter_reg_0_a, 8);
-          filter_reg_1_a_shifted = vshlq_n_u32(filter_reg_1_a, 8);
-          filter_reg_2_a_shifted = vshlq_n_u32(filter_reg_2_a, 8);
-        }
-      } else {
-        const int8* input_data_base = input_data_depthwise;
-        typename QuantizationTypeImpl::ExternalType*
-            output_data_base = output_data_depthwise;
-
-        const int32x4_t adjusted_bias_data_a = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-        const int32x4_t adjusted_bias_data_b = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-
-        for (int k_height = 0; k_height < block_height; ++k_height) {
-          const int8* next_input_data = input_data_base;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data = output_data_base;
-
-          // Load first sub-micro block of data into operational banks.
-          int8x16_t left_bank_0_reg_a = vld1q_s8(next_input_data);
-          int8x16_t left_bank_1_reg_a =
-              vld1q_s8(next_input_data + workspace_height_stride);
-          int8x16_t left_bank_2_reg_a =
-              vld1q_s8(next_input_data + 2 * workspace_height_stride);
-          int8x16_t left_bank_0_reg_b = vld1q_s8(next_input_data + 16);
-          int8x16_t left_bank_1_reg_b =
-              vld1q_s8(next_input_data + workspace_height_stride + 16);
-          int8x16_t left_bank_2_reg_b =
-              vld1q_s8(next_input_data + 2 * workspace_height_stride + 16);
-
-          for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-               ++i_width) {
-            next_input_data += width_micro_stride;
-            const int output_width =
-                i_width == output_width_micro_repeats ? residual_width : 4;
-
-            int8x16_t right_bank_0_reg_a;
-            int8x16_t right_bank_1_reg_a;
-            int8x16_t right_bank_2_reg_a;
-            int8x16_t right_bank_0_reg_b;
-            int8x16_t right_bank_1_reg_b;
-            int8x16_t right_bank_2_reg_b;
-            // Logic: (output_width - 1) * stride_val < 2.
-            const bool no_right_block = output_width < 3;
-
-            // Load next sub-micro block of data.
-            if (no_right_block) {
-              // Only needed for sanitizer checks.
-              right_bank_0_reg_a = vdupq_n_s8(0);
-              right_bank_1_reg_a = vdupq_n_s8(0);
-              right_bank_2_reg_a = vdupq_n_s8(0);
-              right_bank_0_reg_b = vdupq_n_s8(0);
-              right_bank_1_reg_b = vdupq_n_s8(0);
-              right_bank_2_reg_b = vdupq_n_s8(0);
-            } else {
-              right_bank_0_reg_a = vld1q_s8(next_input_data);
-              right_bank_1_reg_a =
-                  vld1q_s8(next_input_data + workspace_height_stride);
-              right_bank_2_reg_a =
-                  vld1q_s8(next_input_data + 2 * workspace_height_stride);
-              right_bank_0_reg_b = vld1q_s8(next_input_data + 16);
-              right_bank_1_reg_b =
-                  vld1q_s8(next_input_data + workspace_height_stride + 16);
-              right_bank_2_reg_b =
-                  vld1q_s8(next_input_data + 2 * workspace_height_stride + 16);
-            }
-
-            // Iterate over input width shifts within 4x4 blocks.
-            for (int x = 0; x < output_width; ++x) {
-              int32x4_t acc_a = adjusted_bias_data_a;
-              int32x4_t acc_b = adjusted_bias_data_b;
-              acc_a = vdotq_s32(acc_a, filter_reg_0_a, left_bank_0_reg_a);
-              acc_a = vdotq_s32(acc_a, filter_reg_1_a, left_bank_1_reg_a);
-              acc_a = vdotq_s32(acc_a, filter_reg_2_a, left_bank_2_reg_a);
-              acc_b = vdotq_s32(acc_b, filter_reg_0_b, left_bank_0_reg_b);
-              acc_b = vdotq_s32(acc_b, filter_reg_1_b, left_bank_1_reg_b);
-              acc_b = vdotq_s32(acc_b, filter_reg_2_b, left_bank_2_reg_b);
-
-              // Fixed-point multiplication.
-              acc_a = vqrdmulhq_n_s32(acc_a, output_multiplier);
-              acc_b = vqrdmulhq_n_s32(acc_b, output_multiplier);
-              acc_a = DivideByPOT::Run(
-                  acc_a, -output_shift);
-              acc_b = DivideByPOT::Run(
-                  acc_b, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_0 =
-                  vcombine_s16(vqmovn_s32(acc_a), vqmovn_s32(acc_b));
-              acc_s16_0_0 = vqaddq_s16(acc_s16_0_0, output_offset_vec);
-              // Apply the activation function.
-              uint8x8_t acc_u8_0_0 = vqmovxn_s16(acc_s16_0_0);
-              acc_u8_0_0 = util_vmax_x8(acc_u8_0_0,
-                                        vget_low_u8(output_activation_min_vec));
-              acc_u8_0_0 = util_vmin_x8(acc_u8_0_0,
-                                        vget_low_u8(output_activation_max_vec));
-
-              util_vst1_x8(output_data, acc_u8_0_0);
-
-              biregister_rotate_8(&left_bank_0_reg_a, &right_bank_0_reg_a);
-              biregister_rotate_8(&left_bank_1_reg_a, &right_bank_1_reg_a);
-              biregister_rotate_8(&left_bank_2_reg_a, &right_bank_2_reg_a);
-              biregister_rotate_8(&left_bank_0_reg_b, &right_bank_0_reg_b);
-              biregister_rotate_8(&left_bank_1_reg_b, &right_bank_1_reg_b);
-              biregister_rotate_8(&left_bank_2_reg_b, &right_bank_2_reg_b);
-
-              output_data += depth;
-            }
-          }
-          input_data_base += workspace_height_stride;
-          output_data_base += output_height_stride;
-        }
-      }
-      input_data_depthwise += depth_micro_stride;
-      output_data_depthwise += 8;
-    }
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         uint8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockIntrinsics(scratch_block_data, filter_workspace, bias_data,
-                               output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseIntrinsics3x3DotProduct,
-    QuantizationType::kNonPerChannelUint8,
-    DepthwiseConvDepthMultiplication::kNoMultiplication,
-    /*stride=*/2> {
-  static inline uint8x8_t vqmovxn_s16(int16x8_t x) { return vqmovun_s16(x); }
-  static inline uint8x8_t util_vmin_x8(uint8x8_t a, uint8x8_t b) {
-    return vmin_u8(a, b);
-  }
-  static inline uint8x8_t util_vmax_x8(uint8x8_t a, uint8x8_t b) {
-    return vmax_u8(a, b);
-  }
-
-  static inline void KernelMacroBlockIntrinsics(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    static constexpr QuantizationType quantization_type =
-        QuantizationType::kNonPerChannelUint8;
-
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int input_width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int depth = function_params->input_depth;
-    constexpr int kStrideVal = 2;
-    constexpr int kFourOverStride = 2;
-    TFLITE_DCHECK_EQ(function_params->stride, kStrideVal);
-    TFLITE_DCHECK_EQ(function_params->four_over_stride, kFourOverStride);
-
-    const int workspace_width_micro_repeats =
-        function_params->workspace_width_micro_repeats;
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    constexpr int kBiasIncrement = 4;
-
-    TFLITE_DCHECK(depth_micro_repeats > 0);
-    const int width_micro_stride = 4 * 8;
-    const int depth_micro_stride =
-        width_micro_stride * input_width_overall_micro_repeats;
-
-    const int32 output_activation_min =
-        function_params->quantized_activation_min;
-    const int32 output_activation_max =
-        function_params->quantized_activation_max;
-    const int32 output_multiplier = function_params->output_multiplier;
-    const int32 output_shift = function_params->output_shift;
-    const int32 output_offset = function_params->output_offset;
-    if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-      TFLITE_DCHECK_GE(output_activation_min, 0);
-      TFLITE_DCHECK_LT(output_activation_min, 256);
-      TFLITE_DCHECK_GE(output_activation_max, 0);
-      TFLITE_DCHECK_LT(output_activation_max, 256);
-    } else {
-      TFLITE_DCHECK_GE(output_activation_min, -128);
-      TFLITE_DCHECK_LT(output_activation_min, 128);
-      TFLITE_DCHECK_GE(output_activation_max, -128);
-      TFLITE_DCHECK_LT(output_activation_max, 128);
-    }
-    TFLITE_DCHECK_GE(output_offset, -32878);
-    TFLITE_DCHECK_LT(output_offset, 32768);
-
-    // This version only does min/max on 64 bits.
-    const int16x8_t output_offset_vec =
-        vdupq_n_s16(static_cast(output_offset));
-    const uint8x8_t output_activation_min_vec =
-        vdup_n_u8(static_cast(output_activation_min));
-    const uint8x8_t output_activation_max_vec =
-        vdup_n_u8(static_cast(output_activation_max));
-
-    constexpr int shuffled_filter_increment = 2 * 3 * 4 * 4;
-
-    TFLITE_DCHECK_LE(block_height, 2);
-
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      const int8* filter_block =
-          filter_workspace + shuffled_filter_increment * j_depth;
-
-      if (block_height == 2) {
-        for (int s = 0; s < 2; ++s) {
-          // Simulate NEON-register transposition of subset of filter.
-          int8x16_t filter_reg_0_a;
-          int8x16_t filter_reg_1_a;
-          int8x16_t filter_reg_2_a;
-
-          filter_reg_0_a = vld1q_s8(filter_block + s * 16);
-          filter_reg_1_a = vld1q_s8(filter_block + s * 16 + 32);
-          filter_reg_2_a = vld1q_s8(filter_block + s * 16 + 64);
-
-          const int8* scratch_data =
-              scratch_block_data + depth_micro_stride * j_depth;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data = output_block_data + 8 * j_depth;
-          const int8* input_data_0 = scratch_data + s * 2 * 8;
-
-          const int32x4_t adjusted_bias_data = vld1q_s32(bias_data);
-
-          // Load first sub-micro block of data into operational banks.
-          int8x16_t left_bank_0_reg = vld1q_s8(input_data_0);
-          int8x16_t left_bank_1_reg =
-              vld1q_s8(input_data_0 + workspace_height_stride);
-          int8x16_t left_bank_2_reg =
-              vld1q_s8(input_data_0 + 2 * workspace_height_stride);
-          int8x16_t left_bank_3_reg =
-              vld1q_s8(input_data_0 + 3 * workspace_height_stride);
-          int8x16_t left_bank_4_reg =
-              vld1q_s8(input_data_0 + 4 * workspace_height_stride);
-
-          int8x16_t right_bank_0_reg;
-          int8x16_t right_bank_1_reg;
-          int8x16_t right_bank_2_reg;
-          int8x16_t right_bank_3_reg;
-          int8x16_t right_bank_4_reg;
-
-          int32x4_t acc0;
-          int32x4_t acc1;
-          int16x8_t acc_s16_0_1;
-          uint8x8_t acc_u8;
-
-          int i_width = 0;
-
-          // When output_width_micro_repeats <
-          // output_width_overall_micro_repeats, 0 < residual_width <= 2, and so
-          // residual_width == 1 is then true iff residual_width < 2.
-          const int adjusted_width_micro_repeats =
-              (output_width_micro_repeats <
-               output_width_overall_micro_repeats) &&
-                      (residual_width == 1)
-                  ? output_width_micro_repeats
-                  : output_width_overall_micro_repeats;
-
-          for (; i_width < adjusted_width_micro_repeats; ++i_width) {
-            const int output_width = kFourOverStride;
-            TFLITE_DCHECK_LE(output_width * kStrideVal, 4);
-            const int8* input_data =
-                input_data_0 + width_micro_stride * i_width;
-            acc0 = adjusted_bias_data;
-            acc1 = adjusted_bias_data;
-            right_bank_0_reg = vld1q_s8(input_data + width_micro_stride);
-            right_bank_1_reg = vld1q_s8(input_data + width_micro_stride +
-                                        workspace_height_stride);
-
-            acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_2_reg);
-            typename QuantizationTypeImpl::ExternalType*
-                output_data_base = output_data + depth * 2 * i_width + 4 * s;
-
-            right_bank_2_reg = vld1q_s8(input_data + width_micro_stride +
-                                        2 * workspace_height_stride);
-            right_bank_3_reg = vld1q_s8(input_data + width_micro_stride +
-                                        3 * workspace_height_stride);
-            acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-            acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_3_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_4_reg);
-            right_bank_4_reg = vld1q_s8(input_data + width_micro_stride +
-                                        4 * workspace_height_stride);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-            acc0 = DivideByPOT::Run(
-                acc0, -output_shift);
-            acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-            acc1 = DivideByPOT::Run(
-                acc1, -output_shift);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8 = util_vmax_x8(acc_u8, output_activation_min_vec);
-            acc_u8 = util_vmin_x8(acc_u8, output_activation_max_vec);
-
-            left_bank_0_reg = vrev32q_u16(left_bank_0_reg);
-            left_bank_1_reg = vrev32q_u16(left_bank_1_reg);
-            left_bank_2_reg = vrev32q_u16(left_bank_2_reg);
-            left_bank_3_reg = vrev32q_u16(left_bank_3_reg);
-            left_bank_4_reg = vrev32q_u16(left_bank_4_reg);
-            acc0 = adjusted_bias_data;
-            acc1 = adjusted_bias_data;
-            vtrn1_s8x2_in_place(&left_bank_0_reg, &right_bank_0_reg);
-            vtrn1_s8x2_in_place(&left_bank_1_reg, &right_bank_1_reg);
-            vtrn1_s8x2_in_place(&left_bank_2_reg, &right_bank_2_reg);
-            vst1_lane_8x4(output_data_base, acc_u8, 0);
-            vst1_lane_8x4(output_data_base + output_height_stride, acc_u8, 1);
-
-            vtrn1_s8x2_in_place(&left_bank_3_reg, &right_bank_3_reg);
-            vtrn1_s8x2_in_place(&left_bank_4_reg, &right_bank_4_reg);
-
-            acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_2_reg);
-            acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_3_reg);
-            acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_4_reg);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-            acc0 = DivideByPOT::Run(
-                acc0, -output_shift);
-            acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-            acc1 = DivideByPOT::Run(
-                acc1, -output_shift);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8 = util_vmax_x8(acc_u8, output_activation_min_vec);
-            acc_u8 = util_vmin_x8(acc_u8, output_activation_max_vec);
-
-            vst1_lane_8x4(output_data_base + depth, acc_u8, 0);
-            vst1_lane_8x4(output_data_base + depth + output_height_stride,
-                          acc_u8, 1);
-
-            left_bank_0_reg = right_bank_0_reg;
-            left_bank_1_reg = right_bank_1_reg;
-            left_bank_2_reg = right_bank_2_reg;
-            left_bank_3_reg = right_bank_3_reg;
-            left_bank_4_reg = right_bank_4_reg;
-          }
-          for (; i_width < output_width_overall_micro_repeats; ++i_width) {
-            TFLITE_DCHECK_NE(residual_width, kFourOverStride);
-
-            // No need to load next ("right") block of data.
-
-            typename QuantizationTypeImpl::ExternalType*
-                output_data_base = output_data + depth * 2 * i_width + 4 * s;
-
-            // Iterate over input width shifts within 4x4 blocks.
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_3_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_4_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::Run(
-                  acc0, -output_shift);
-              acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::Run(
-                  acc1, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              // Apply the activation function.
-              uint8x8_t acc_u8 = vqmovxn_s16(acc_s16_0_1);
-              acc_u8 = util_vmax_x8(acc_u8, output_activation_min_vec);
-              acc_u8 = util_vmin_x8(acc_u8, output_activation_max_vec);
-
-              vst1_lane_8x4(output_data_base, acc_u8, 0);
-              vst1_lane_8x4(output_data_base + output_height_stride, acc_u8, 1);
-
-              left_bank_0_reg = vrev32q_u16(left_bank_0_reg);
-              left_bank_1_reg = vrev32q_u16(left_bank_1_reg);
-              left_bank_2_reg = vrev32q_u16(left_bank_2_reg);
-              left_bank_3_reg = vrev32q_u16(left_bank_3_reg);
-              left_bank_4_reg = vrev32q_u16(left_bank_4_reg);
-              vtrn1_s8x2_in_place(&left_bank_0_reg, &right_bank_0_reg);
-              vtrn1_s8x2_in_place(&left_bank_1_reg, &right_bank_1_reg);
-              vtrn1_s8x2_in_place(&left_bank_2_reg, &right_bank_2_reg);
-              vtrn1_s8x2_in_place(&left_bank_3_reg, &right_bank_3_reg);
-              vtrn1_s8x2_in_place(&left_bank_4_reg, &right_bank_4_reg);
-            }
-          }
-          bias_data += kBiasIncrement;
-        }
-      } else {
-        // block_height == 1.
-        int8x16_t filter_reg_0_a;
-        int8x16_t filter_reg_1_a;
-        int8x16_t filter_reg_2_a;
-        int8x16_t filter_reg_0_b;
-        int8x16_t filter_reg_1_b;
-        int8x16_t filter_reg_2_b;
-
-        filter_reg_0_a = vld1q_s8(filter_block);
-        filter_reg_1_a = vld1q_s8(filter_block + 32);
-        filter_reg_2_a = vld1q_s8(filter_block + 64);
-        filter_reg_0_b = vld1q_s8(filter_block + 16);
-        filter_reg_1_b = vld1q_s8(filter_block + 16 + 32);
-        filter_reg_2_b = vld1q_s8(filter_block + 16 + 64);
-
-        const int8* scratch_data =
-            scratch_block_data + depth_micro_stride * j_depth;
-        typename QuantizationTypeImpl::ExternalType*
-            output_data = output_block_data + 8 * j_depth;
-        const int8* input_data_0 = scratch_data;
-
-        const int32x4_t adjusted_bias_data_a = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-        const int32x4_t adjusted_bias_data_b = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-
-        // Load first sub-micro block of data into operational banks.
-        int8x16_t left_bank_0_reg_a = vld1q_s8(input_data_0);
-        int8x16_t left_bank_1_reg_a =
-            vld1q_s8(input_data_0 + workspace_height_stride);
-        int8x16_t left_bank_2_reg_a =
-            vld1q_s8(input_data_0 + 2 * workspace_height_stride);
-        int8x16_t left_bank_0_reg_b = vld1q_s8(input_data_0 + 16);
-        int8x16_t left_bank_1_reg_b =
-            vld1q_s8(input_data_0 + workspace_height_stride + 16);
-        int8x16_t left_bank_2_reg_b =
-            vld1q_s8(input_data_0 + 2 * workspace_height_stride + 16);
-
-        int8x16_t right_bank_0_reg_a;
-        int8x16_t right_bank_1_reg_a;
-        int8x16_t right_bank_2_reg_a;
-        int8x16_t right_bank_0_reg_b;
-        int8x16_t right_bank_1_reg_b;
-        int8x16_t right_bank_2_reg_b;
-
-        int32x4_t acc0_a;
-        int32x4_t acc0_b;
-
-        for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-             ++i_width) {
-          const int output_width = i_width == output_width_micro_repeats
-                                       ? residual_width
-                                       : kFourOverStride;
-          TFLITE_DCHECK_LE(output_width * kStrideVal, 4);
-          const int8* input_data = input_data_0 + width_micro_stride * i_width;
-          const bool no_right_block = i_width == output_width_micro_repeats &&
-                                      output_width_overall_micro_repeats ==
-                                          workspace_width_micro_repeats;
-
-          if (!no_right_block) {
-            // Load next sub-micro block of data.
-            right_bank_0_reg_a = vld1q_s8(input_data + width_micro_stride);
-            right_bank_1_reg_a = vld1q_s8(input_data + width_micro_stride +
-                                          workspace_height_stride);
-            right_bank_2_reg_a = vld1q_s8(input_data + width_micro_stride +
-                                          2 * workspace_height_stride);
-            right_bank_0_reg_b = vld1q_s8(input_data + width_micro_stride + 16);
-            right_bank_1_reg_b = vld1q_s8(input_data + width_micro_stride +
-                                          workspace_height_stride + 16);
-            right_bank_2_reg_b = vld1q_s8(input_data + width_micro_stride +
-                                          2 * workspace_height_stride + 16);
-          }
-
-          typename QuantizationTypeImpl::ExternalType*
-              output_data_base = output_data + depth * 2 * i_width;
-
-          // Iterate over input width shifts within 4x4 blocks.
-          {
-            acc0_a = adjusted_bias_data_a;
-            acc0_b = adjusted_bias_data_b;
-
-            acc0_a = vdotq_s32(acc0_a, filter_reg_0_a, left_bank_0_reg_a);
-            acc0_a = vdotq_s32(acc0_a, filter_reg_1_a, left_bank_1_reg_a);
-            acc0_a = vdotq_s32(acc0_a, filter_reg_2_a, left_bank_2_reg_a);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_0_b, left_bank_0_reg_b);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_1_b, left_bank_1_reg_b);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_2_b, left_bank_2_reg_b);
-
-            // Fixed-point multiplication.
-            acc0_a = vqrdmulhq_n_s32(acc0_a, output_multiplier);
-            acc0_b = vqrdmulhq_n_s32(acc0_b, output_multiplier);
-            acc0_a = DivideByPOT::Run(
-                acc0_a, -output_shift);
-            acc0_b = DivideByPOT::Run(
-                acc0_b, -output_shift);
-            // Add the output offset.
-            int16x8_t acc_s16_0_1 =
-                vcombine_s16(vqmovn_s32(acc0_a), vqmovn_s32(acc0_b));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            uint8x8_t acc_u8 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8 = util_vmax_x8(acc_u8, output_activation_min_vec);
-            acc_u8 = util_vmin_x8(acc_u8, output_activation_max_vec);
-
-            util_vst1_x8(output_data_base, acc_u8);
-
-            left_bank_0_reg_a = vrev32q_u16(left_bank_0_reg_a);
-            left_bank_1_reg_a = vrev32q_u16(left_bank_1_reg_a);
-            left_bank_2_reg_a = vrev32q_u16(left_bank_2_reg_a);
-            left_bank_0_reg_b = vrev32q_u16(left_bank_0_reg_b);
-            left_bank_1_reg_b = vrev32q_u16(left_bank_1_reg_b);
-            left_bank_2_reg_b = vrev32q_u16(left_bank_2_reg_b);
-            vtrn1_s8x2_in_place(&left_bank_0_reg_a, &right_bank_0_reg_a);
-            vtrn1_s8x2_in_place(&left_bank_1_reg_a, &right_bank_1_reg_a);
-            vtrn1_s8x2_in_place(&left_bank_2_reg_a, &right_bank_2_reg_a);
-            vtrn1_s8x2_in_place(&left_bank_0_reg_b, &right_bank_0_reg_b);
-            vtrn1_s8x2_in_place(&left_bank_1_reg_b, &right_bank_1_reg_b);
-            vtrn1_s8x2_in_place(&left_bank_2_reg_b, &right_bank_2_reg_b);
-          }
-
-          if (output_width > 1) {
-            acc0_a = adjusted_bias_data_a;
-            acc0_b = adjusted_bias_data_b;
-
-            acc0_a = vdotq_s32(acc0_a, filter_reg_0_a, left_bank_0_reg_a);
-            acc0_a = vdotq_s32(acc0_a, filter_reg_1_a, left_bank_1_reg_a);
-            acc0_a = vdotq_s32(acc0_a, filter_reg_2_a, left_bank_2_reg_a);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_0_b, left_bank_0_reg_b);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_1_b, left_bank_1_reg_b);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_2_b, left_bank_2_reg_b);
-
-            // Fixed-point multiplication.
-            acc0_a = vqrdmulhq_n_s32(acc0_a, output_multiplier);
-            acc0_b = vqrdmulhq_n_s32(acc0_b, output_multiplier);
-            acc0_a = DivideByPOT::Run(
-                acc0_a, -output_shift);
-            acc0_b = DivideByPOT::Run(
-                acc0_b, -output_shift);
-            // Add the output offset.
-            int16x8_t acc_s16_0_1 =
-                vcombine_s16(vqmovn_s32(acc0_a), vqmovn_s32(acc0_b));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            uint8x8_t acc_u8 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8 = util_vmax_x8(acc_u8, output_activation_min_vec);
-            acc_u8 = util_vmin_x8(acc_u8, output_activation_max_vec);
-
-            util_vst1_x8(output_data_base + depth, acc_u8);
-
-            left_bank_0_reg_a = right_bank_0_reg_a;
-            left_bank_1_reg_a = right_bank_1_reg_a;
-            left_bank_2_reg_a = right_bank_2_reg_a;
-            left_bank_0_reg_b = right_bank_0_reg_b;
-            left_bank_1_reg_b = right_bank_1_reg_b;
-            left_bank_2_reg_b = right_bank_2_reg_b;
-          }
-        }
-      }
-    }
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         uint8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockIntrinsics(scratch_block_data, filter_workspace, bias_data,
-                               output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseIntrinsics3x3DotProduct,
-    QuantizationType::kNonPerChannelUint8,
-    DepthwiseConvDepthMultiplication::kUnitInputDepth,
-    /*stride=*/1> {
-  static inline uint8x8_t vqmovxn_s16(int16x8_t x) { return vqmovun_s16(x); }
-  static inline uint8x8_t util_vmin_x8(uint8x8_t a, uint8x8_t b) {
-    return vmin_u8(a, b);
-  }
-  static inline uint8x8_t util_vmax_x8(uint8x8_t a, uint8x8_t b) {
-    return vmax_u8(a, b);
-  }
-  static inline uint8x16_t util_vminq_x8(uint8x16_t a, uint8x16_t b) {
-    return vminq_u8(a, b);
-  }
-  static inline uint8x16_t util_vmaxq_x8(uint8x16_t a, uint8x16_t b) {
-    return vmaxq_u8(a, b);
-  }
-
-  static inline void KernelMacroBlockIntrinsics(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    static constexpr QuantizationType quantization_type =
-        QuantizationType::kNonPerChannelUint8;
-
-    TFLITE_DCHECK_EQ(function_params->stride, 1);
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int output_depth = function_params->output_depth;
-
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    constexpr int kBiasIncrement = 4;
-
-    TFLITE_DCHECK(depth_micro_repeats > 0);
-
-    const int32 output_activation_min =
-        function_params->quantized_activation_min;
-    const int32 output_activation_max =
-        function_params->quantized_activation_max;
-    const int32 output_multiplier = function_params->output_multiplier;
-    const int32 output_shift = function_params->output_shift;
-    const int32 output_offset = function_params->output_offset;
-    if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-      TFLITE_DCHECK_GE(output_activation_min, 0);
-      TFLITE_DCHECK_LT(output_activation_min, 256);
-      TFLITE_DCHECK_GE(output_activation_max, 0);
-      TFLITE_DCHECK_LT(output_activation_max, 256);
-    } else {
-      TFLITE_DCHECK_GE(output_activation_min, -128);
-      TFLITE_DCHECK_LT(output_activation_min, 128);
-      TFLITE_DCHECK_GE(output_activation_max, -128);
-      TFLITE_DCHECK_LT(output_activation_max, 128);
-    }
-    TFLITE_DCHECK_GE(output_offset, -32878);
-    TFLITE_DCHECK_LT(output_offset, 32768);
-
-    const int16x8_t output_offset_vec =
-        vdupq_n_s16(static_cast(output_offset));
-    const uint8x16_t output_activation_min_vec =
-        vdupq_n_u8(static_cast(output_activation_min));
-    const uint8x16_t output_activation_max_vec =
-        vdupq_n_u8(static_cast(output_activation_max));
-
-    typename QuantizationTypeImpl::ExternalType*
-        output_data_depthwise = output_block_data;
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      // Simulate NEON-register transposition of subset of filter.
-      int8x16_t filter_reg_0_a;
-      int8x16_t filter_reg_0_b;
-      int8x16_t filter_reg_1_a;
-      int8x16_t filter_reg_1_b;
-      int8x16_t filter_reg_2_a;
-      int8x16_t filter_reg_2_b;
-      int8x16_t filter_reg_0_a_shifted;
-      int8x16_t filter_reg_1_a_shifted;
-      int8x16_t filter_reg_2_a_shifted;
-
-      filter_reg_0_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_0_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-
-      filter_reg_0_a_shifted = vshlq_n_u32(filter_reg_0_a, 8);
-      filter_reg_1_a_shifted = vshlq_n_u32(filter_reg_1_a, 8);
-      filter_reg_2_a_shifted = vshlq_n_u32(filter_reg_2_a, 8);
-
-      // When output_width_micro_repeats < output_width_overall_micro_repeats,
-      // 0 < residual_width <= 2, and so residual_width == 1 is then true iff
-      // residual_width < 2.
-      const int adjusted_width_micro_repeats =
-          (output_width_micro_repeats < output_width_overall_micro_repeats) &&
-                  (residual_width < 4)
-              ? output_width_micro_repeats
-              : output_width_overall_micro_repeats;
-
-      if (block_height == 4) {
-        for (int s = 0; s < 2; ++s) {
-          // Work through one slice, by row, at a time.
-          typename QuantizationTypeImpl::ExternalType*
-              output_data_base = output_data_depthwise + 4 * s;
-
-          const int8* next_input_data = scratch_block_data;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data = output_data_base;
-
-          const int32x4_t adjusted_bias_data = vld1q_s32(bias_data);
-          bias_data += kBiasIncrement;
-
-          int8x16_t input_bank_a_reg;  //  left 0, right 0, left 1, right 1.
-          int8x16_t input_bank_b_reg;  //  left 2, right 2, left 3, right 3.
-          int8x16_t input_bank_c_reg;  //  left 4, right 4, left 5, right 5.
-
-          // Load first sub-micro block of data into operational banks.
-          input_bank_a_reg =
-              vld1q_dup_s8x4(next_input_data);  // Load lane 0, avoiding
-                                                // uninitialized variable.
-          input_bank_a_reg = vld1q_lane_8x4(
-              next_input_data + workspace_height_stride, input_bank_a_reg, 2);
-          input_bank_b_reg = vld1q_dup_s8x4(
-              next_input_data +
-              2 * workspace_height_stride);  // Load lane 0, avoiding
-                                             // uninitialized variable.
-          input_bank_b_reg =
-              vld1q_lane_8x4(next_input_data + 3 * workspace_height_stride,
-                             input_bank_b_reg, 2);
-          input_bank_c_reg = vld1q_dup_s8x4(
-              next_input_data +
-              4 * workspace_height_stride);  // Load lane 0, avoiding
-                                             // uninitialized variable.
-          input_bank_c_reg =
-              vld1q_lane_8x4(next_input_data + 5 * workspace_height_stride,
-                             input_bank_c_reg, 2);
-
-          int32x4_t acc0;
-          int32x4_t acc1;
-          int32x4_t acc2;
-          int32x4_t acc3;
-
-          acc0 = adjusted_bias_data;
-          acc1 = adjusted_bias_data;
-          acc2 = adjusted_bias_data;
-          acc3 = adjusted_bias_data;
-
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg, 0);
-          acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a, input_bank_b_reg, 0);
-          acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a, input_bank_b_reg, 2);
-
-          int i_width = 0;
-          for (; i_width < adjusted_width_micro_repeats; ++i_width) {
-            next_input_data += 4;
-
-            // Iterate over input width shifts within 4x4 blocks.
-            {
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg,
-                                         0);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg,
-                                         2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_a_reg,
-                                         2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_1_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_2_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_1_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_2_a, input_bank_c_reg,
-                                         2);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::Run(
-                  acc0, -output_shift);
-              acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::Run(
-                  acc1, -output_shift);
-              acc2 = vqrdmulhq_n_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::Run(
-                  acc2, -output_shift);
-              acc3 = vqrdmulhq_n_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::Run(
-                  acc3, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              uint8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                  vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              output_data += output_depth;
-            }
-            // Load next sub-micro block of data.
-            input_bank_a_reg =
-                vld1q_lane_8x4(next_input_data, input_bank_a_reg, 1);
-            input_bank_a_reg = vld1q_lane_8x4(
-                next_input_data + workspace_height_stride, input_bank_a_reg, 3);
-            input_bank_b_reg =
-                vld1q_lane_8x4(next_input_data + 2 * workspace_height_stride,
-                               input_bank_b_reg, 1);
-            input_bank_b_reg =
-                vld1q_lane_8x4(next_input_data + 3 * workspace_height_stride,
-                               input_bank_b_reg, 3);
-            input_bank_c_reg =
-                vld1q_lane_8x4(next_input_data + 4 * workspace_height_stride,
-                               input_bank_c_reg, 1);
-            input_bank_c_reg =
-                vld1q_lane_8x4(next_input_data + 5 * workspace_height_stride,
-                               input_bank_c_reg, 3);
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a_shifted,
-                                         input_bank_a_reg, 0);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a_shifted,
-                                         input_bank_a_reg, 2);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a_shifted,
-                                         input_bank_a_reg, 2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_1_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_2_a_shifted,
-                                         input_bank_c_reg, 0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_1_a_shifted,
-                                         input_bank_c_reg, 0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_2_a_shifted,
-                                         input_bank_c_reg, 2);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::Run(
-                  acc0, -output_shift);
-              acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::Run(
-                  acc1, -output_shift);
-              acc2 = vqrdmulhq_n_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::Run(
-                  acc2, -output_shift);
-              acc3 = vqrdmulhq_n_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::Run(
-                  acc3, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              uint8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                  vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-              input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-              input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 16);
-
-              output_data += output_depth;
-            }
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg,
-                                         0);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg,
-                                         2);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg,
-                                         0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_a_reg,
-                                         2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg,
-                                         0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a, input_bank_b_reg,
-                                         0);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_1_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_2_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a, input_bank_b_reg,
-                                         2);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_1_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_2_a, input_bank_c_reg,
-                                         2);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::Run(
-                  acc0, -output_shift);
-              acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::Run(
-                  acc1, -output_shift);
-              acc2 = vqrdmulhq_n_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::Run(
-                  acc2, -output_shift);
-              acc3 = vqrdmulhq_n_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::Run(
-                  acc3, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              uint8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                  vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              output_data += output_depth;
-            }
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a_shifted,
-                                         input_bank_a_reg, 0);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a_shifted,
-                                         input_bank_a_reg, 2);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a_shifted,
-                                         input_bank_a_reg, 2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_1_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_2_a_shifted,
-                                         input_bank_c_reg, 0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_1_a_shifted,
-                                         input_bank_c_reg, 0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_2_a_shifted,
-                                         input_bank_c_reg, 2);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::Run(
-                  acc0, -output_shift);
-              acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::Run(
-                  acc1, -output_shift);
-              acc2 = vqrdmulhq_n_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::Run(
-                  acc2, -output_shift);
-              acc3 = vqrdmulhq_n_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::Run(
-                  acc3, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              uint8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                  vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-              input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-              input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 16);
-
-              output_data += output_depth;
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg,
-                                         0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg,
-                                         0);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a, input_bank_b_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a, input_bank_b_reg,
-                                         2);
-            }
-          }
-
-          if (i_width < output_width_overall_micro_repeats) {
-            next_input_data += 4;
-            const int output_width = residual_width;
-
-            // Load next sub-micro block of data.
-            input_bank_a_reg =
-                vld1q_lane_8x4(next_input_data, input_bank_a_reg, 1);
-            input_bank_a_reg = vld1q_lane_8x4(
-                next_input_data + workspace_height_stride, input_bank_a_reg, 3);
-            input_bank_b_reg =
-                vld1q_lane_8x4(next_input_data + 2 * workspace_height_stride,
-                               input_bank_b_reg, 1);
-            input_bank_b_reg =
-                vld1q_lane_8x4(next_input_data + 3 * workspace_height_stride,
-                               input_bank_b_reg, 3);
-            input_bank_c_reg =
-                vld1q_lane_8x4(next_input_data + 4 * workspace_height_stride,
-                               input_bank_c_reg, 1);
-            input_bank_c_reg =
-                vld1q_lane_8x4(next_input_data + 5 * workspace_height_stride,
-                               input_bank_c_reg, 3);
-
-            // Iterate over input width shifts within 4x4 blocks.
-            for (int x = 0; x < output_width; ++x) {
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg,
-                                         0);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg,
-                                         2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_a_reg,
-                                         2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_1_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_2_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_1_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_2_a, input_bank_c_reg,
-                                         2);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::Run(
-                  acc0, -output_shift);
-              acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::Run(
-                  acc1, -output_shift);
-              acc2 = vqrdmulhq_n_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::Run(
-                  acc2, -output_shift);
-              acc3 = vqrdmulhq_n_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::Run(
-                  acc3, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              uint8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                  vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 8);
-              input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 8);
-              input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 8);
-
-              output_data += output_depth;
-
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg,
-                                         0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg,
-                                         0);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a, input_bank_b_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a, input_bank_b_reg,
-                                         2);
-            }
-          }
-          // scratch_block_data += 4 * workspace_height_stride;
-          output_data_base += 4 * output_height_stride;
-
-          // Move to next sub-block: advance to second set of filters, to new
-          // bias.
-          filter_reg_0_a = filter_reg_0_b;
-          filter_reg_1_a = filter_reg_1_b;
-          filter_reg_2_a = filter_reg_2_b;
-          filter_reg_0_a_shifted = vshlq_n_u32(filter_reg_0_a, 8);
-          filter_reg_1_a_shifted = vshlq_n_u32(filter_reg_1_a, 8);
-          filter_reg_2_a_shifted = vshlq_n_u32(filter_reg_2_a, 8);
-        }
-      } else {
-        // Block height < 4.
-        typename QuantizationTypeImpl::ExternalType*
-            output_data_base = output_data_depthwise;
-
-        const int32x4_t adjusted_bias_data_a = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-        const int32x4_t adjusted_bias_data_b = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-
-        for (int k_height = 0; k_height < block_height; ++k_height) {
-          const int8* next_input_data =
-              scratch_block_data + k_height * workspace_height_stride;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data = output_data_base;
-
-          int8x16_t input_bank_p_reg;  //  left 0, right 0, left 1, right 1.
-          int8x16_t input_bank_q_reg;  //  left 2, right 2, left 3, right 3.
-
-          // Load first sub-micro block of data into operational banks.
-          input_bank_p_reg =
-              vld1q_dup_s8x4(next_input_data);  // Load lane 0, avoiding
-                                                // uninitialized variable.
-          input_bank_p_reg = vld1q_lane_8x4(
-              next_input_data + workspace_height_stride, input_bank_p_reg, 2);
-          input_bank_q_reg = vld1q_dup_s8x4(
-              next_input_data +
-              2 * workspace_height_stride);  // Load lane 0, avoiding
-                                             // uninitialized variable.
-
-          for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-               ++i_width) {
-            next_input_data += 4;
-            const int output_width =
-                i_width == output_width_micro_repeats ? residual_width : 4;
-
-            // Load next sub-micro block of data.
-            input_bank_p_reg =
-                vld1q_lane_8x4(next_input_data, input_bank_p_reg, 1);
-            input_bank_p_reg = vld1q_lane_8x4(
-                next_input_data + workspace_height_stride, input_bank_p_reg, 3);
-            input_bank_q_reg =
-                vld1q_lane_8x4(next_input_data + 2 * workspace_height_stride,
-                               input_bank_q_reg, 1);
-            // Iterate over input width shifts within 4x4 blocks.
-            for (int x = 0; x < output_width; ++x) {
-              int32x4_t acc_a = adjusted_bias_data_a;
-              int32x4_t acc_b = adjusted_bias_data_b;
-              acc_a = vdotq_four_lane_s32(acc_a, filter_reg_0_a,
-                                          input_bank_p_reg, 0);
-              acc_a = vdotq_four_lane_s32(acc_a, filter_reg_1_a,
-                                          input_bank_p_reg, 2);
-              acc_a = vdotq_four_lane_s32(acc_a, filter_reg_2_a,
-                                          input_bank_q_reg, 0);
-              acc_b = vdotq_four_lane_s32(acc_b, filter_reg_0_b,
-                                          input_bank_p_reg, 0);
-              acc_b = vdotq_four_lane_s32(acc_b, filter_reg_1_b,
-                                          input_bank_p_reg, 2);
-              acc_b = vdotq_four_lane_s32(acc_b, filter_reg_2_b,
-                                          input_bank_q_reg, 0);
-
-              // Fixed-point multiplication.
-              acc_a = vqrdmulhq_n_s32(acc_a, output_multiplier);
-              acc_b = vqrdmulhq_n_s32(acc_b, output_multiplier);
-              acc_a = DivideByPOT::Run(
-                  acc_a, -output_shift);
-              acc_b = DivideByPOT::Run(
-                  acc_b, -output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_0 =
-                  vcombine_s16(vqmovn_s32(acc_a), vqmovn_s32(acc_b));
-              acc_s16_0_0 = vqaddq_s16(acc_s16_0_0, output_offset_vec);
-              // Apply the activation function.
-              uint8x8_t acc_u8_0_0 = vqmovxn_s16(acc_s16_0_0);
-              acc_u8_0_0 = util_vmax_x8(acc_u8_0_0,
-                                        vget_low_u8(output_activation_min_vec));
-              acc_u8_0_0 = util_vmin_x8(acc_u8_0_0,
-                                        vget_low_u8(output_activation_max_vec));
-
-              util_vst1_x8(output_data, acc_u8_0_0);
-
-              input_bank_p_reg = vshrq_n_u64(input_bank_p_reg, 8);
-              input_bank_q_reg = vshrq_n_u64(input_bank_q_reg, 8);
-
-              output_data += output_depth;
-            }
-          }
-          output_data_base += output_height_stride;
-        }
-      }
-      output_data_depthwise += 8;
-    }
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         uint8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockIntrinsics(scratch_block_data, filter_workspace, bias_data,
-                               output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseIntrinsics3x3DotProduct,
-    QuantizationType::kNonPerChannelUint8,
-    DepthwiseConvDepthMultiplication::kUnitInputDepth,
-    /*stride=*/2> {
-  static inline uint8x8_t vqmovxn_s16(int16x8_t x) { return vqmovun_s16(x); }
-  static inline uint8x8_t util_vmin_x8(uint8x8_t a, uint8x8_t b) {
-    return vmin_u8(a, b);
-  }
-  static inline uint8x8_t util_vmax_x8(uint8x8_t a, uint8x8_t b) {
-    return vmax_u8(a, b);
-  }
-
-  static inline void KernelMacroBlockIntrinsics(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, uint8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    static constexpr QuantizationType quantization_type =
-        QuantizationType::kNonPerChannelUint8;
-
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int output_depth = function_params->output_depth;
-    constexpr int kStrideVal = 2;
-    TFLITE_DCHECK_EQ(function_params->stride, kStrideVal);
-
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    constexpr int kBiasIncrement = 4;
-
-    const int32 output_activation_min =
-        function_params->quantized_activation_min;
-    const int32 output_activation_max =
-        function_params->quantized_activation_max;
-    const int32 output_multiplier = function_params->output_multiplier;
-    const int32 output_shift = function_params->output_shift;
-    const int32 output_offset = function_params->output_offset;
-    if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-      TFLITE_DCHECK_GE(output_activation_min, 0);
-      TFLITE_DCHECK_LT(output_activation_min, 256);
-      TFLITE_DCHECK_GE(output_activation_max, 0);
-      TFLITE_DCHECK_LT(output_activation_max, 256);
-    } else {
-      TFLITE_DCHECK_GE(output_activation_min, -128);
-      TFLITE_DCHECK_LT(output_activation_min, 128);
-      TFLITE_DCHECK_GE(output_activation_max, -128);
-      TFLITE_DCHECK_LT(output_activation_max, 128);
-    }
-    TFLITE_DCHECK_GE(output_offset, -32878);
-    TFLITE_DCHECK_LT(output_offset, 32768);
-
-    TFLITE_DCHECK_GE(depth_micro_repeats, 1);
-
-    const int16x8_t output_offset_vec =
-        vdupq_n_s16(static_cast(output_offset));
-    const uint8x16_t output_activation_min_vec =
-        vdupq_n_u8(static_cast(output_activation_min));
-    const uint8x16_t output_activation_max_vec =
-        vdupq_n_u8(static_cast(output_activation_max));
-
-    for (int j_depth = 0; j_depth < (depth_micro_repeats * 1 + 0); ++j_depth) {
-      int8x16_t filter_reg_0_a;
-      int8x16_t filter_reg_0_b;
-      int8x16_t filter_reg_1_a;
-      int8x16_t filter_reg_1_b;
-      int8x16_t filter_reg_2_a;
-      int8x16_t filter_reg_2_b;
-
-      filter_reg_0_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_0_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-
-      const int32x4_t adjusted_bias_data_s_0 = vld1q_s32(bias_data);
-      bias_data += kBiasIncrement;
-      const int32x4_t adjusted_bias_data_s_1 = vld1q_s32(bias_data);
-      bias_data += kBiasIncrement;
-
-      if (block_height == 2) {
-        const int8* scratch_data = scratch_block_data;
-        typename QuantizationTypeImpl::ExternalType*
-            output_data = output_block_data + 8 * j_depth;
-
-        int8x16_t input_bank_a_reg;  //  left 0, right 0, left 1, right 1.
-        int8x16_t input_bank_b_reg;  //  left 2, right 2, left 3, right 3.
-        int8x16_t input_bank_c_reg;  //  left 4, right 4, xxx, xxx.
-
-        // Load first sub-micro block of data into operational banks.
-        input_bank_a_reg =
-            vld1q_dup_s8x4(scratch_data);  // Load lane 0, avoiding
-                                           // uninitialized variable.
-        input_bank_a_reg = vld1q_lane_8x4(
-            scratch_data + workspace_height_stride, input_bank_a_reg, 2);
-        input_bank_b_reg = vld1q_dup_s8x4(
-            scratch_data +
-            2 * workspace_height_stride);  // Load lane 0, avoiding
-                                           // uninitialized variable.
-        input_bank_b_reg = vld1q_lane_8x4(
-            scratch_data + 3 * workspace_height_stride, input_bank_b_reg, 2);
-        input_bank_c_reg = vld1q_dup_s8x4(
-            scratch_data +
-            4 * workspace_height_stride);  // Load lane 0, avoiding
-                                           // uninitialized variable.
-
-        int32x4_t acc0;
-        int32x4_t acc1;
-
-        // When output_width_micro_repeats < output_width_overall_micro_repeats,
-        // 0 < residual_width <= 2, and so residual_width == 1 is then true iff
-        // residual_width < 2.
-        const int adjusted_width_micro_repeats =
-            (output_width_micro_repeats < output_width_overall_micro_repeats) &&
-                    (residual_width < 2)
-                ? output_width_micro_repeats
-                : output_width_overall_micro_repeats;
-
-        int i_width = 0;
-        for (; i_width < adjusted_width_micro_repeats; ++i_width) {
-          const int8* input_data = scratch_data + 4 + 4 * i_width;
-
-          // Load next sub-micro block of data.
-          input_bank_a_reg = vld1q_lane_8x4(input_data, input_bank_a_reg, 1);
-          input_bank_a_reg = vld1q_lane_8x4(
-              input_data + workspace_height_stride, input_bank_a_reg, 3);
-          input_bank_b_reg = vld1q_lane_8x4(
-              input_data + 2 * workspace_height_stride, input_bank_b_reg, 1);
-          input_bank_b_reg = vld1q_lane_8x4(
-              input_data + 3 * workspace_height_stride, input_bank_b_reg, 3);
-          input_bank_c_reg = vld1q_lane_8x4(
-              input_data + 4 * workspace_height_stride, input_bank_c_reg, 1);
-
-          int16x8_t acc_s16_0_1;
-          uint8x8_t acc_u8_0_1;
-          // Iterate over input width shifts within 4x4 blocks.
-          {
-            acc0 = adjusted_bias_data_s_0;
-            acc1 = adjusted_bias_data_s_0;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg, 2);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg, 2);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_c_reg, 0);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-            acc0 = DivideByPOT::Run(
-                acc0, -output_shift);
-            acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-            acc1 = DivideByPOT::Run(
-                acc1, -output_shift);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_max_vec));
-
-            vst1_lane_8x4(output_data, acc_u8_0_1, 0);
-            vst1_lane_8x4(output_data + output_height_stride, acc_u8_0_1, 1);
-
-            acc0 = adjusted_bias_data_s_1;
-            acc1 = adjusted_bias_data_s_1;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_b, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_b, input_bank_a_reg, 2);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_b, input_bank_b_reg, 2);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_b, input_bank_c_reg, 0);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-            acc0 = DivideByPOT::Run(
-                acc0, -output_shift);
-            acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-            acc1 = DivideByPOT::Run(
-                acc1, -output_shift);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_max_vec));
-
-            vst1_lane_8x4(output_data + 4, acc_u8_0_1, 0);
-            vst1_lane_8x4(output_data + 4 + output_height_stride, acc_u8_0_1,
-                          1);
-
-            input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-            input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-            input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 16);
-
-            output_data += output_depth;
-          }
-
-          // output_width == four_over_stride.
-          acc0 = adjusted_bias_data_s_0;
-          acc1 = adjusted_bias_data_s_0;
-
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg, 0);
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg, 2);
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_b_reg, 0);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg, 2);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_c_reg, 0);
-
-          // Fixed-point multiplication.
-          acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-          acc0 = DivideByPOT::Run(
-              acc0, -output_shift);
-          acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-          acc1 = DivideByPOT::Run(
-              acc1, -output_shift);
-          // Add the output offset.
-          acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-          acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-          // Apply the activation function.
-          acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-          acc_u8_0_1 =
-              util_vmax_x8(acc_u8_0_1, vget_low_u8(output_activation_min_vec));
-          acc_u8_0_1 =
-              util_vmin_x8(acc_u8_0_1, vget_low_u8(output_activation_max_vec));
-
-          vst1_lane_8x4(output_data, acc_u8_0_1, 0);
-          vst1_lane_8x4(output_data + output_height_stride, acc_u8_0_1, 1);
-
-          acc0 = adjusted_bias_data_s_1;
-          acc1 = adjusted_bias_data_s_1;
-
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_b, input_bank_a_reg, 0);
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_b, input_bank_a_reg, 2);
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_b, input_bank_b_reg, 0);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_b, input_bank_b_reg, 0);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_b, input_bank_b_reg, 2);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_b, input_bank_c_reg, 0);
-
-          // Fixed-point multiplication.
-          acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-          acc0 = DivideByPOT::Run(
-              acc0, -output_shift);
-          acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-          acc1 = DivideByPOT::Run(
-              acc1, -output_shift);
-          // Add the output offset.
-          acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-          acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-          // Apply the activation function.
-          acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-          acc_u8_0_1 =
-              util_vmax_x8(acc_u8_0_1, vget_low_u8(output_activation_min_vec));
-          acc_u8_0_1 =
-              util_vmin_x8(acc_u8_0_1, vget_low_u8(output_activation_max_vec));
-
-          vst1_lane_8x4(output_data + 4, acc_u8_0_1, 0);
-          vst1_lane_8x4(output_data + 4 + output_height_stride, acc_u8_0_1, 1);
-
-          input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-          input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-          input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 16);
-
-          output_data += output_depth;
-        }
-        for (; i_width < output_width_overall_micro_repeats; ++i_width) {
-          // output_width == 1.
-          const int8* input_data = scratch_data + 4 + 4 * i_width;
-
-          // Load next sub-micro block of data.
-          input_bank_a_reg = vld1q_lane_8x4(input_data, input_bank_a_reg, 1);
-          input_bank_a_reg = vld1q_lane_8x4(
-              input_data + workspace_height_stride, input_bank_a_reg, 3);
-          input_bank_b_reg = vld1q_lane_8x4(
-              input_data + 2 * workspace_height_stride, input_bank_b_reg, 1);
-          input_bank_b_reg = vld1q_lane_8x4(
-              input_data + 3 * workspace_height_stride, input_bank_b_reg, 3);
-          input_bank_c_reg = vld1q_lane_8x4(
-              input_data + 4 * workspace_height_stride, input_bank_c_reg, 1);
-
-          int16x8_t acc_s16_0_1;
-          uint8x8_t acc_u8_0_1;
-          // Iterate over input width shifts within 4x4 blocks.
-          {
-            acc0 = adjusted_bias_data_s_0;
-            acc1 = adjusted_bias_data_s_0;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg, 2);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg, 2);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_c_reg, 0);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-            acc0 = DivideByPOT::Run(
-                acc0, -output_shift);
-            acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-            acc1 = DivideByPOT::Run(
-                acc1, -output_shift);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_max_vec));
-
-            vst1_lane_8x4(output_data, acc_u8_0_1, 0);
-            vst1_lane_8x4(output_data + output_height_stride, acc_u8_0_1, 1);
-
-            acc0 = adjusted_bias_data_s_1;
-            acc1 = adjusted_bias_data_s_1;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_b, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_b, input_bank_a_reg, 2);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_b, input_bank_b_reg, 2);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_b, input_bank_c_reg, 0);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-            acc0 = DivideByPOT::Run(
-                acc0, -output_shift);
-            acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-            acc1 = DivideByPOT::Run(
-                acc1, -output_shift);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_max_vec));
-
-            vst1_lane_8x4(output_data + 4, acc_u8_0_1, 0);
-            vst1_lane_8x4(output_data + 4 + output_height_stride, acc_u8_0_1,
-                          1);
-
-            input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-            input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-            input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 16);
-
-            output_data += output_depth;
-          }
-        }
-      } else {
-        TFLITE_DCHECK_EQ(block_height, 1);
-        // Work through one slice, by row, at a time.
-        const int8* scratch_data = scratch_block_data;
-        typename QuantizationTypeImpl::ExternalType*
-            output_data = output_block_data + 8 * j_depth;
-
-        int8x16_t input_bank_a_reg;  //  left 0, right 0, left 1, right 1.
-        int8x16_t input_bank_b_reg;  //  left 2, right 2, xxx, xxx.
-
-        // Load first sub-micro block of data into operational banks.
-        input_bank_a_reg =
-            vld1q_dup_s8x4(scratch_data);  // Load lane 0, avoiding
-                                           // uninitialized variable.
-        input_bank_a_reg = vld1q_lane_8x4(
-            scratch_data + workspace_height_stride, input_bank_a_reg, 2);
-        input_bank_b_reg = vld1q_dup_s8x4(
-            scratch_data +
-            2 * workspace_height_stride);  // Load lane 0, avoiding
-                                           // uninitialized variable.
-
-        int32x4_t acc0;
-        int32x4_t acc1;
-
-        for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-             ++i_width) {
-          const int output_width =
-              i_width == output_width_micro_repeats ? residual_width : 2;
-
-          TFLITE_DCHECK_LE(output_width, 2);
-          TFLITE_DCHECK_GE(output_width, 1);
-          TFLITE_DCHECK_LE(output_width * kStrideVal, 4);
-          const int8* input_data = scratch_data + 4 + 4 * i_width;
-
-          // Load next sub-micro block of data.
-          input_bank_a_reg = vld1q_lane_8x4(input_data, input_bank_a_reg, 1);
-          input_bank_a_reg = vld1q_lane_8x4(
-              input_data + workspace_height_stride, input_bank_a_reg, 3);
-          input_bank_b_reg = vld1q_lane_8x4(
-              input_data + 2 * workspace_height_stride, input_bank_b_reg, 1);
-
-          int16x8_t acc_s16_0_1;
-          uint8x8_t acc_u8_0_1;
-
-          // Iterate over input width shifts within 4x4 blocks.
-          {
-            acc0 = adjusted_bias_data_s_0;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg, 2);
-
-            acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-            acc0 = DivideByPOT::Run(
-                acc0, -output_shift);
-
-            // Second sub-block accumulation.
-            acc1 = adjusted_bias_data_s_1;
-
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_b, input_bank_a_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_b, input_bank_a_reg, 2);
-
-            acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-            acc1 = DivideByPOT::Run(
-                acc1, -output_shift);
-
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_max_vec));
-
-            // This stores the results for both sub-blocks together.
-            util_vst1_x8(output_data, acc_u8_0_1);
-
-            input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-            input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-
-            output_data += output_depth;
-          }
-          if (output_width == 2) {
-            acc0 = adjusted_bias_data_s_0;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg, 2);
-
-            acc0 = vqrdmulhq_n_s32(acc0, output_multiplier);
-            acc0 = DivideByPOT::Run(
-                acc0, -output_shift);
-
-            // Second sub-block accumulation.
-            acc1 = adjusted_bias_data_s_1;
-
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_b, input_bank_a_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_b, input_bank_a_reg, 2);
-
-            acc1 = vqrdmulhq_n_s32(acc1, output_multiplier);
-            acc1 = DivideByPOT::Run(
-                acc1, -output_shift);
-
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_u8(output_activation_max_vec));
-
-            // This stores the results for both sub-blocks together.
-            util_vst1_x8(output_data, acc_u8_0_1);
-
-            input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-            input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-
-            output_data += output_depth;
-          }
-        }
-      }
-    }
-  }
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         uint8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockIntrinsics(scratch_block_data, filter_workspace, bias_data,
-                               output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseIntrinsics3x3DotProduct,
-    QuantizationType::kPerChannelInt8,
-    DepthwiseConvDepthMultiplication::kNoMultiplication,
-    /*stride=*/1> {
-  static inline int8x8_t vqmovxn_s16(int16x8_t x) { return vqmovn_s16(x); }
-  static inline int8x8_t util_vmin_x8(int8x8_t a, int8x8_t b) {
-    return vmin_s8(a, b);
-  }
-  static inline int8x8_t util_vmax_x8(int8x8_t a, int8x8_t b) {
-    return vmax_s8(a, b);
-  }
-  static inline int8x16_t util_vminq_x8(int8x16_t a, int8x16_t b) {
-    return vminq_s8(a, b);
-  }
-  static inline int8x16_t util_vmaxq_x8(int8x16_t a, int8x16_t b) {
-    return vmaxq_s8(a, b);
-  }
-
-  static inline void KernelMacroBlockIntrinsics(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, int8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    static constexpr QuantizationType quantization_type =
-        QuantizationType::kPerChannelInt8;
-
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int input_width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int depth = function_params->input_depth;
-
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    constexpr int kBiasIncrement = 4;
-
-    TFLITE_DCHECK(depth_micro_repeats > 0);
-    const int width_micro_stride = 4 * 8;
-    const int depth_micro_stride =
-        width_micro_stride * input_width_overall_micro_repeats;
-
-    const int32 output_activation_min =
-        function_params->quantized_activation_min;
-    const int32 output_activation_max =
-        function_params->quantized_activation_max;
-    const int32 output_offset = function_params->output_offset;
-    const int32* output_shift_per_channel =
-        function_params->output_shift_per_channel;
-    const int32* output_multiplier_per_channel =
-        function_params->output_multiplier_per_channel;
-    if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-      TFLITE_DCHECK_GE(output_activation_min, 0);
-      TFLITE_DCHECK_LT(output_activation_min, 256);
-      TFLITE_DCHECK_GE(output_activation_max, 0);
-      TFLITE_DCHECK_LT(output_activation_max, 256);
-    } else {
-      TFLITE_DCHECK_GE(output_activation_min, -128);
-      TFLITE_DCHECK_LT(output_activation_min, 128);
-      TFLITE_DCHECK_GE(output_activation_max, -128);
-      TFLITE_DCHECK_LT(output_activation_max, 128);
-      TFLITE_DCHECK_NE(output_shift_per_channel, nullptr);
-      TFLITE_DCHECK_NE(output_multiplier_per_channel, nullptr);
-    }
-    TFLITE_DCHECK_GE(output_offset, -32878);
-    TFLITE_DCHECK_LT(output_offset, 32768);
-
-    const int16x8_t output_offset_vec =
-        vdupq_n_s16(static_cast(output_offset));
-    const int8x16_t output_activation_min_vec =
-        vdupq_n_s8(static_cast(output_activation_min));
-    const int8x16_t output_activation_max_vec =
-        vdupq_n_s8(static_cast(output_activation_max));
-
-    const int8* input_data_depthwise = scratch_block_data;
-    typename QuantizationTypeImpl::ExternalType*
-        output_data_depthwise = output_block_data;
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      // Simulate NEON-register transposition of subset of filter.
-      int8x16_t filter_reg_0_a;
-      int8x16_t filter_reg_0_b;
-      int8x16_t filter_reg_1_a;
-      int8x16_t filter_reg_1_b;
-      int8x16_t filter_reg_2_a;
-      int8x16_t filter_reg_2_b;
-      int8x16_t filter_reg_0_a_shifted;
-      int8x16_t filter_reg_1_a_shifted;
-      int8x16_t filter_reg_2_a_shifted;
-
-      filter_reg_0_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_0_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-
-      filter_reg_0_a_shifted = vshlq_n_u32(filter_reg_0_a, 8);
-      filter_reg_1_a_shifted = vshlq_n_u32(filter_reg_1_a, 8);
-      filter_reg_2_a_shifted = vshlq_n_u32(filter_reg_2_a, 8);
-
-      if (block_height == 4) {
-        for (int s = 0; s < 2; ++s) {
-          // Work through one slice, by row, at a time.
-          const int8* input_data_base = input_data_depthwise + 2 * 8 * s;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data_base = output_data_depthwise + 4 * s;
-
-          const int8* next_input_data = input_data_base;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data = output_data_base;
-
-          const int32x4_t adjusted_bias_data = vld1q_s32(bias_data);
-          bias_data += kBiasIncrement;
-
-          const int32x4_t output_shift =
-              vld1q_s32(output_shift_per_channel + j_depth * 8 + 4 * s);
-          const int32x4_t output_multiplier =
-              vld1q_s32(output_multiplier_per_channel + j_depth * 8 + 4 * s);
-
-          // Load first sub-micro block of data into operational banks.
-          int8x16_t left_bank_0_reg = vld1q_s8(next_input_data);
-          int8x16_t left_bank_1_reg =
-              vld1q_s8(next_input_data + workspace_height_stride);
-          int8x16_t left_bank_2_reg =
-              vld1q_s8(next_input_data + 2 * workspace_height_stride);
-          int8x16_t left_bank_3_reg =
-              vld1q_s8(next_input_data + 3 * workspace_height_stride);
-          int8x16_t left_bank_4_reg =
-              vld1q_s8(next_input_data + 4 * workspace_height_stride);
-          int8x16_t left_bank_5_reg =
-              vld1q_s8(next_input_data + 5 * workspace_height_stride);
-
-          int32x4_t acc0;
-          int32x4_t acc1;
-          int32x4_t acc2;
-          int32x4_t acc3;
-
-          acc0 = adjusted_bias_data;
-          acc1 = adjusted_bias_data;
-          acc2 = adjusted_bias_data;
-          acc3 = adjusted_bias_data;
-
-          acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-          acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_2_reg);
-          acc2 = vdotq_s32(acc2, filter_reg_0_a, left_bank_2_reg);
-          acc3 = vdotq_s32(acc3, filter_reg_0_a, left_bank_3_reg);
-
-          for (int i_width = 0; i_width < output_width_micro_repeats;
-               ++i_width) {
-            next_input_data += width_micro_stride;
-
-            // Iterate over input width shifts within 4x4 blocks.
-            {
-              acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_1_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_2_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_1_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_2_a, left_bank_5_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::RunMult(
-                  acc0, output_shift);
-              acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::RunMult(
-                  acc1, output_shift);
-              acc2 = vqrdmulhq_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::RunMult(
-                  acc2, output_shift);
-              acc3 = vqrdmulhq_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::RunMult(
-                  acc3, output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              int8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                 vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              output_data += depth;
-            }
-
-            // Load next sub-micro block of data.
-            int8x16_t right_bank_0_reg;
-            int8x16_t right_bank_1_reg;
-            int8x16_t right_bank_2_reg;
-            int8x16_t right_bank_3_reg;
-            int8x16_t right_bank_4_reg;
-            int8x16_t right_bank_5_reg;
-
-            // Loading of next block always valid.
-            right_bank_0_reg = vld1q_s8(next_input_data);
-            right_bank_1_reg =
-                vld1q_s8(next_input_data + workspace_height_stride);
-            right_bank_2_reg =
-                vld1q_s8(next_input_data + 2 * workspace_height_stride);
-            right_bank_3_reg =
-                vld1q_s8(next_input_data + 3 * workspace_height_stride);
-            right_bank_4_reg =
-                vld1q_s8(next_input_data + 4 * workspace_height_stride);
-            right_bank_5_reg =
-                vld1q_s8(next_input_data + 5 * workspace_height_stride);
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_0_a_shifted, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a_shifted, left_bank_1_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_2_a_shifted, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a_shifted, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a_shifted, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a_shifted, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_0_a_shifted, left_bank_2_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_1_a_shifted, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_2_a_shifted, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_0_a_shifted, left_bank_3_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_1_a_shifted, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_2_a_shifted, left_bank_5_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::RunMult(
-                  acc0, output_shift);
-              acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::RunMult(
-                  acc1, output_shift);
-              acc2 = vqrdmulhq_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::RunMult(
-                  acc2, output_shift);
-              acc3 = vqrdmulhq_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::RunMult(
-                  acc3, output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              int8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                 vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              left_bank_0_reg = vrev32q_u16(left_bank_0_reg);
-              left_bank_1_reg = vrev32q_u16(left_bank_1_reg);
-              left_bank_2_reg = vrev32q_u16(left_bank_2_reg);
-              left_bank_3_reg = vrev32q_u16(left_bank_3_reg);
-              left_bank_4_reg = vrev32q_u16(left_bank_4_reg);
-              left_bank_5_reg = vrev32q_u16(left_bank_5_reg);
-              vtrn1_s8x2_in_place(&left_bank_0_reg, &right_bank_0_reg);
-              vtrn1_s8x2_in_place(&left_bank_1_reg, &right_bank_1_reg);
-              vtrn1_s8x2_in_place(&left_bank_2_reg, &right_bank_2_reg);
-              vtrn1_s8x2_in_place(&left_bank_3_reg, &right_bank_3_reg);
-              vtrn1_s8x2_in_place(&left_bank_4_reg, &right_bank_4_reg);
-              vtrn1_s8x2_in_place(&left_bank_5_reg, &right_bank_5_reg);
-
-              output_data += depth;
-            }
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_0_a, left_bank_2_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_1_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_2_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_0_a, left_bank_3_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_1_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_2_a, left_bank_5_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::RunMult(
-                  acc0, output_shift);
-              acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::RunMult(
-                  acc1, output_shift);
-              acc2 = vqrdmulhq_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::RunMult(
-                  acc2, output_shift);
-              acc3 = vqrdmulhq_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::RunMult(
-                  acc3, output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              int8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                 vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              output_data += depth;
-            }
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_0_a_shifted, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a_shifted, left_bank_1_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_2_a_shifted, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a_shifted, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a_shifted, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a_shifted, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_0_a_shifted, left_bank_2_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_1_a_shifted, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_2_a_shifted, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_0_a_shifted, left_bank_3_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_1_a_shifted, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_2_a_shifted, left_bank_5_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::RunMult(
-                  acc0, output_shift);
-              acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::RunMult(
-                  acc1, output_shift);
-              acc2 = vqrdmulhq_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::RunMult(
-                  acc2, output_shift);
-              acc3 = vqrdmulhq_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::RunMult(
-                  acc3, output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              int8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                 vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              left_bank_0_reg = right_bank_0_reg;
-              left_bank_1_reg = right_bank_1_reg;
-              left_bank_2_reg = right_bank_2_reg;
-              left_bank_3_reg = right_bank_3_reg;
-              left_bank_4_reg = right_bank_4_reg;
-              left_bank_5_reg = right_bank_5_reg;
-
-              output_data += depth;
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_2_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_0_a, left_bank_2_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_0_a, left_bank_3_reg);
-            }
-          }
-
-          if (residual_width > 0) {
-            next_input_data += width_micro_stride;
-            const int output_width = residual_width;
-
-            // Load next sub-micro block of data.
-            int8x16_t right_bank_0_reg;
-            int8x16_t right_bank_1_reg;
-            int8x16_t right_bank_2_reg;
-            int8x16_t right_bank_3_reg;
-            int8x16_t right_bank_4_reg;
-            int8x16_t right_bank_5_reg;
-            // Logic: (output_width - 1) * stride_val < 2.
-            const bool no_right_block = output_width < 3;
-
-            if (no_right_block) {
-              // Only needed for sanitizer checks.
-              right_bank_0_reg = vdupq_n_s8(0);
-              right_bank_1_reg = vdupq_n_s8(0);
-              right_bank_2_reg = vdupq_n_s8(0);
-              right_bank_3_reg = vdupq_n_s8(0);
-              right_bank_4_reg = vdupq_n_s8(0);
-              right_bank_5_reg = vdupq_n_s8(0);
-            } else {
-              right_bank_0_reg = vld1q_s8(next_input_data);
-              right_bank_1_reg =
-                  vld1q_s8(next_input_data + workspace_height_stride);
-              right_bank_2_reg =
-                  vld1q_s8(next_input_data + 2 * workspace_height_stride);
-              right_bank_3_reg =
-                  vld1q_s8(next_input_data + 3 * workspace_height_stride);
-              right_bank_4_reg =
-                  vld1q_s8(next_input_data + 4 * workspace_height_stride);
-              right_bank_5_reg =
-                  vld1q_s8(next_input_data + 5 * workspace_height_stride);
-            }
-
-            // Iterate over input width shifts within 4x4 blocks.
-            for (int x = 0; x < output_width; ++x) {
-              acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_1_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_1_a, left_bank_3_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_2_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_1_a, left_bank_4_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_2_a, left_bank_5_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::RunMult(
-                  acc0, output_shift);
-              acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::RunMult(
-                  acc1, output_shift);
-              acc2 = vqrdmulhq_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::RunMult(
-                  acc2, output_shift);
-              acc3 = vqrdmulhq_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::RunMult(
-                  acc3, output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              int8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                 vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              biregister_rotate_8(&left_bank_0_reg, &right_bank_0_reg);
-              biregister_rotate_8(&left_bank_1_reg, &right_bank_1_reg);
-              biregister_rotate_8(&left_bank_2_reg, &right_bank_2_reg);
-              biregister_rotate_8(&left_bank_3_reg, &right_bank_3_reg);
-              biregister_rotate_8(&left_bank_4_reg, &right_bank_4_reg);
-              biregister_rotate_8(&left_bank_5_reg, &right_bank_5_reg);
-
-              output_data += depth;
-
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_2_reg);
-              acc2 = vdotq_s32(acc2, filter_reg_0_a, left_bank_2_reg);
-              acc3 = vdotq_s32(acc3, filter_reg_0_a, left_bank_3_reg);
-            }
-          }
-          input_data_base += 4 * workspace_height_stride;
-          output_data_base += 4 * output_height_stride;
-
-          // Move to next sub-block: advance to second set of filters, to new
-          // bias.
-          filter_reg_0_a = filter_reg_0_b;
-          filter_reg_1_a = filter_reg_1_b;
-          filter_reg_2_a = filter_reg_2_b;
-          filter_reg_0_a_shifted = vshlq_n_u32(filter_reg_0_a, 8);
-          filter_reg_1_a_shifted = vshlq_n_u32(filter_reg_1_a, 8);
-          filter_reg_2_a_shifted = vshlq_n_u32(filter_reg_2_a, 8);
-        }
-      } else {
-        const int8* input_data_base = input_data_depthwise;
-        typename QuantizationTypeImpl::ExternalType*
-            output_data_base = output_data_depthwise;
-
-        const int32x4_t adjusted_bias_data_a = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-        const int32x4_t adjusted_bias_data_b = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-
-        const int32x4_t output_shift_a =
-            vld1q_s32(output_shift_per_channel + j_depth * 8);
-        const int32x4_t output_multiplier_a =
-            vld1q_s32(output_multiplier_per_channel + j_depth * 8);
-        const int32x4_t output_shift_b =
-            vld1q_s32(output_shift_per_channel + j_depth * 8 + 4);
-        const int32x4_t output_multiplier_b =
-            vld1q_s32(output_multiplier_per_channel + j_depth * 8 + 4);
-
-        for (int k_height = 0; k_height < block_height; ++k_height) {
-          const int8* next_input_data = input_data_base;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data = output_data_base;
-
-          // Load first sub-micro block of data into operational banks.
-          int8x16_t left_bank_0_reg_a = vld1q_s8(next_input_data);
-          int8x16_t left_bank_1_reg_a =
-              vld1q_s8(next_input_data + workspace_height_stride);
-          int8x16_t left_bank_2_reg_a =
-              vld1q_s8(next_input_data + 2 * workspace_height_stride);
-          int8x16_t left_bank_0_reg_b = vld1q_s8(next_input_data + 16);
-          int8x16_t left_bank_1_reg_b =
-              vld1q_s8(next_input_data + workspace_height_stride + 16);
-          int8x16_t left_bank_2_reg_b =
-              vld1q_s8(next_input_data + 2 * workspace_height_stride + 16);
-
-          for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-               ++i_width) {
-            next_input_data += width_micro_stride;
-            const int output_width =
-                i_width == output_width_micro_repeats ? residual_width : 4;
-
-            int8x16_t right_bank_0_reg_a;
-            int8x16_t right_bank_1_reg_a;
-            int8x16_t right_bank_2_reg_a;
-            int8x16_t right_bank_0_reg_b;
-            int8x16_t right_bank_1_reg_b;
-            int8x16_t right_bank_2_reg_b;
-            // Logic: (output_width - 1) * stride_val < 2.
-            const bool no_right_block = output_width < 3;
-
-            // Load next sub-micro block of data.
-            if (no_right_block) {
-              // Only needed for sanitizer checks.
-              right_bank_0_reg_a = vdupq_n_s8(0);
-              right_bank_1_reg_a = vdupq_n_s8(0);
-              right_bank_2_reg_a = vdupq_n_s8(0);
-              right_bank_0_reg_b = vdupq_n_s8(0);
-              right_bank_1_reg_b = vdupq_n_s8(0);
-              right_bank_2_reg_b = vdupq_n_s8(0);
-            } else {
-              right_bank_0_reg_a = vld1q_s8(next_input_data);
-              right_bank_1_reg_a =
-                  vld1q_s8(next_input_data + workspace_height_stride);
-              right_bank_2_reg_a =
-                  vld1q_s8(next_input_data + 2 * workspace_height_stride);
-              right_bank_0_reg_b = vld1q_s8(next_input_data + 16);
-              right_bank_1_reg_b =
-                  vld1q_s8(next_input_data + workspace_height_stride + 16);
-              right_bank_2_reg_b =
-                  vld1q_s8(next_input_data + 2 * workspace_height_stride + 16);
-            }
-
-            // Iterate over input width shifts within 4x4 blocks.
-            for (int x = 0; x < output_width; ++x) {
-              int32x4_t acc_a = adjusted_bias_data_a;
-              int32x4_t acc_b = adjusted_bias_data_b;
-              acc_a = vdotq_s32(acc_a, filter_reg_0_a, left_bank_0_reg_a);
-              acc_a = vdotq_s32(acc_a, filter_reg_1_a, left_bank_1_reg_a);
-              acc_a = vdotq_s32(acc_a, filter_reg_2_a, left_bank_2_reg_a);
-              acc_b = vdotq_s32(acc_b, filter_reg_0_b, left_bank_0_reg_b);
-              acc_b = vdotq_s32(acc_b, filter_reg_1_b, left_bank_1_reg_b);
-              acc_b = vdotq_s32(acc_b, filter_reg_2_b, left_bank_2_reg_b);
-
-              // Fixed-point multiplication.
-              acc_a = vqrdmulhq_s32(acc_a, output_multiplier_a);
-              acc_b = vqrdmulhq_s32(acc_b, output_multiplier_b);
-              acc_a =
-                  DivideByPOT::RunMult(
-                      acc_a, output_shift_a);
-              acc_b =
-                  DivideByPOT::RunMult(
-                      acc_b, output_shift_b);
-              // Add the output offset.
-              int16x8_t acc_s16_0_0 =
-                  vcombine_s16(vqmovn_s32(acc_a), vqmovn_s32(acc_b));
-              acc_s16_0_0 = vqaddq_s16(acc_s16_0_0, output_offset_vec);
-              // Apply the activation function.
-              int8x8_t acc_u8_0_0 = vqmovxn_s16(acc_s16_0_0);
-              acc_u8_0_0 = util_vmax_x8(acc_u8_0_0,
-                                        vget_low_s8(output_activation_min_vec));
-              acc_u8_0_0 = util_vmin_x8(acc_u8_0_0,
-                                        vget_low_s8(output_activation_max_vec));
-
-              vst1_s8(output_data, acc_u8_0_0);
-
-              biregister_rotate_8(&left_bank_0_reg_a, &right_bank_0_reg_a);
-              biregister_rotate_8(&left_bank_1_reg_a, &right_bank_1_reg_a);
-              biregister_rotate_8(&left_bank_2_reg_a, &right_bank_2_reg_a);
-              biregister_rotate_8(&left_bank_0_reg_b, &right_bank_0_reg_b);
-              biregister_rotate_8(&left_bank_1_reg_b, &right_bank_1_reg_b);
-              biregister_rotate_8(&left_bank_2_reg_b, &right_bank_2_reg_b);
-
-              output_data += depth;
-            }
-          }
-          input_data_base += workspace_height_stride;
-          output_data_base += output_height_stride;
-        }
-      }
-      input_data_depthwise += depth_micro_stride;
-      output_data_depthwise += 8;
-    }
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         int8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockIntrinsics(scratch_block_data, filter_workspace, bias_data,
-                               output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseIntrinsics3x3DotProduct,
-    QuantizationType::kPerChannelInt8,
-    DepthwiseConvDepthMultiplication::kNoMultiplication,
-    /*stride=*/2> {
-  static inline int8x8_t vqmovxn_s16(int16x8_t x) { return vqmovn_s16(x); }
-  static inline int8x8_t util_vmin_x8(int8x8_t a, int8x8_t b) {
-    return vmin_s8(a, b);
-  }
-  static inline int8x8_t util_vmax_x8(int8x8_t a, int8x8_t b) {
-    return vmax_s8(a, b);
-  }
-
-  static inline void KernelMacroBlockIntrinsics(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, int8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    static constexpr QuantizationType quantization_type =
-        QuantizationType::kPerChannelInt8;
-
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int input_width_overall_micro_repeats =
-        function_params->input_width_overall_micro_repeats;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int depth = function_params->input_depth;
-    constexpr int kStrideVal = 2;
-    constexpr int kFourOverStride = 2;
-    TFLITE_DCHECK_EQ(function_params->stride, kStrideVal);
-    TFLITE_DCHECK_EQ(function_params->four_over_stride, kFourOverStride);
-
-    const int workspace_width_micro_repeats =
-        function_params->workspace_width_micro_repeats;
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    constexpr int kBiasIncrement = 4;
-
-    TFLITE_DCHECK(depth_micro_repeats > 0);
-    const int width_micro_stride = 4 * 8;
-    const int depth_micro_stride =
-        width_micro_stride * input_width_overall_micro_repeats;
-
-    const int32 output_activation_min =
-        function_params->quantized_activation_min;
-    const int32 output_activation_max =
-        function_params->quantized_activation_max;
-    const int32 output_offset = function_params->output_offset;
-    const int32* output_shift_per_channel =
-        function_params->output_shift_per_channel;
-    const int32* output_multiplier_per_channel =
-        function_params->output_multiplier_per_channel;
-    if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-      TFLITE_DCHECK_GE(output_activation_min, 0);
-      TFLITE_DCHECK_LT(output_activation_min, 256);
-      TFLITE_DCHECK_GE(output_activation_max, 0);
-      TFLITE_DCHECK_LT(output_activation_max, 256);
-    } else {
-      TFLITE_DCHECK_GE(output_activation_min, -128);
-      TFLITE_DCHECK_LT(output_activation_min, 128);
-      TFLITE_DCHECK_GE(output_activation_max, -128);
-      TFLITE_DCHECK_LT(output_activation_max, 128);
-      TFLITE_DCHECK_NE(output_shift_per_channel, nullptr);
-      TFLITE_DCHECK_NE(output_multiplier_per_channel, nullptr);
-    }
-    TFLITE_DCHECK_GE(output_offset, -32878);
-    TFLITE_DCHECK_LT(output_offset, 32768);
-
-    // This version only does min/max on 64 bits.
-    const int16x8_t output_offset_vec =
-        vdupq_n_s16(static_cast(output_offset));
-    const int8x8_t output_activation_min_vec =
-        vdup_n_s8(static_cast(output_activation_min));
-    const int8x8_t output_activation_max_vec =
-        vdup_n_s8(static_cast(output_activation_max));
-
-    constexpr int shuffled_filter_increment = 2 * 3 * 4 * 4;
-
-    TFLITE_DCHECK_LE(block_height, 2);
-
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      const int8* filter_block =
-          filter_workspace + shuffled_filter_increment * j_depth;
-
-      if (block_height == 2) {
-        for (int s = 0; s < 2; ++s) {
-          // Simulate NEON-register transposition of subset of filter.
-          int8x16_t filter_reg_0_a;
-          int8x16_t filter_reg_1_a;
-          int8x16_t filter_reg_2_a;
-
-          filter_reg_0_a = vld1q_s8(filter_block + s * 16);
-          filter_reg_1_a = vld1q_s8(filter_block + s * 16 + 32);
-          filter_reg_2_a = vld1q_s8(filter_block + s * 16 + 64);
-
-          const int8* scratch_data =
-              scratch_block_data + depth_micro_stride * j_depth;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data = output_block_data + 8 * j_depth;
-          const int8* input_data_0 = scratch_data + s * 2 * 8;
-
-          const int32x4_t adjusted_bias_data = vld1q_s32(bias_data);
-
-          const int32x4_t output_shift =
-              vld1q_s32(output_shift_per_channel + j_depth * 8 + 4 * s);
-          const int32x4_t output_multiplier =
-              vld1q_s32(output_multiplier_per_channel + j_depth * 8 + 4 * s);
-
-          // Load first sub-micro block of data into operational banks.
-          int8x16_t left_bank_0_reg = vld1q_s8(input_data_0);
-          int8x16_t left_bank_1_reg =
-              vld1q_s8(input_data_0 + workspace_height_stride);
-          int8x16_t left_bank_2_reg =
-              vld1q_s8(input_data_0 + 2 * workspace_height_stride);
-          int8x16_t left_bank_3_reg =
-              vld1q_s8(input_data_0 + 3 * workspace_height_stride);
-          int8x16_t left_bank_4_reg =
-              vld1q_s8(input_data_0 + 4 * workspace_height_stride);
-
-          int8x16_t right_bank_0_reg;
-          int8x16_t right_bank_1_reg;
-          int8x16_t right_bank_2_reg;
-          int8x16_t right_bank_3_reg;
-          int8x16_t right_bank_4_reg;
-
-          int32x4_t acc0;
-          int32x4_t acc1;
-          int16x8_t acc_s16_0_1;
-          int8x8_t acc_u8;
-
-          int i_width = 0;
-
-          // When output_width_micro_repeats <
-          // output_width_overall_micro_repeats, 0 < residual_width <= 2, and so
-          // residual_width == 1 is then true iff residual_width < 2.
-          const int adjusted_width_micro_repeats =
-              (output_width_micro_repeats <
-               output_width_overall_micro_repeats) &&
-                      (residual_width == 1)
-                  ? output_width_micro_repeats
-                  : output_width_overall_micro_repeats;
-
-          for (; i_width < adjusted_width_micro_repeats; ++i_width) {
-            const int output_width = kFourOverStride;
-            TFLITE_DCHECK_LE(output_width * kStrideVal, 4);
-            const int8* input_data =
-                input_data_0 + width_micro_stride * i_width;
-            acc0 = adjusted_bias_data;
-            acc1 = adjusted_bias_data;
-            right_bank_0_reg = vld1q_s8(input_data + width_micro_stride);
-            right_bank_1_reg = vld1q_s8(input_data + width_micro_stride +
-                                        workspace_height_stride);
-
-            acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_2_reg);
-            typename QuantizationTypeImpl::ExternalType*
-                output_data_base = output_data + depth * 2 * i_width + 4 * s;
-
-            right_bank_2_reg = vld1q_s8(input_data + width_micro_stride +
-                                        2 * workspace_height_stride);
-            right_bank_3_reg = vld1q_s8(input_data + width_micro_stride +
-                                        3 * workspace_height_stride);
-            acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-            acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_3_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_4_reg);
-            right_bank_4_reg = vld1q_s8(input_data + width_micro_stride +
-                                        4 * workspace_height_stride);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-            acc0 = DivideByPOT::RunMult(
-                acc0, output_shift);
-            acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-            acc1 = DivideByPOT::RunMult(
-                acc1, output_shift);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8 = util_vmax_x8(acc_u8, output_activation_min_vec);
-            acc_u8 = util_vmin_x8(acc_u8, output_activation_max_vec);
-
-            left_bank_0_reg = vrev32q_u16(left_bank_0_reg);
-            left_bank_1_reg = vrev32q_u16(left_bank_1_reg);
-            left_bank_2_reg = vrev32q_u16(left_bank_2_reg);
-            left_bank_3_reg = vrev32q_u16(left_bank_3_reg);
-            left_bank_4_reg = vrev32q_u16(left_bank_4_reg);
-            acc0 = adjusted_bias_data;
-            acc1 = adjusted_bias_data;
-            vtrn1_s8x2_in_place(&left_bank_0_reg, &right_bank_0_reg);
-            vtrn1_s8x2_in_place(&left_bank_1_reg, &right_bank_1_reg);
-            vtrn1_s8x2_in_place(&left_bank_2_reg, &right_bank_2_reg);
-            vst1_lane_8x4(output_data_base, acc_u8, 0);
-            vst1_lane_8x4(output_data_base + output_height_stride, acc_u8, 1);
-
-            vtrn1_s8x2_in_place(&left_bank_3_reg, &right_bank_3_reg);
-            vtrn1_s8x2_in_place(&left_bank_4_reg, &right_bank_4_reg);
-
-            acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_2_reg);
-            acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_3_reg);
-            acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-            acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_4_reg);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-            acc0 = DivideByPOT::RunMult(
-                acc0, output_shift);
-            acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-            acc1 = DivideByPOT::RunMult(
-                acc1, output_shift);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8 = util_vmax_x8(acc_u8, output_activation_min_vec);
-            acc_u8 = util_vmin_x8(acc_u8, output_activation_max_vec);
-
-            vst1_lane_8x4(output_data_base + depth, acc_u8, 0);
-            vst1_lane_8x4(output_data_base + depth + output_height_stride,
-                          acc_u8, 1);
-
-            left_bank_0_reg = right_bank_0_reg;
-            left_bank_1_reg = right_bank_1_reg;
-            left_bank_2_reg = right_bank_2_reg;
-            left_bank_3_reg = right_bank_3_reg;
-            left_bank_4_reg = right_bank_4_reg;
-          }
-          for (; i_width < output_width_overall_micro_repeats; ++i_width) {
-            TFLITE_DCHECK_NE(residual_width, kFourOverStride);
-
-            // No need to load next ("right") block of data.
-
-            typename QuantizationTypeImpl::ExternalType*
-                output_data_base = output_data + depth * 2 * i_width + 4 * s;
-
-            // Iterate over input width shifts within 4x4 blocks.
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-
-              acc0 = vdotq_s32(acc0, filter_reg_0_a, left_bank_0_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_1_a, left_bank_1_reg);
-              acc0 = vdotq_s32(acc0, filter_reg_2_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_0_a, left_bank_2_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_1_a, left_bank_3_reg);
-              acc1 = vdotq_s32(acc1, filter_reg_2_a, left_bank_4_reg);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::RunMult(
-                  acc0, output_shift);
-              acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::RunMult(
-                  acc1, output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              // Apply the activation function.
-              int8x8_t acc_u8 = vqmovxn_s16(acc_s16_0_1);
-              acc_u8 = util_vmax_x8(acc_u8, output_activation_min_vec);
-              acc_u8 = util_vmin_x8(acc_u8, output_activation_max_vec);
-
-              vst1_lane_8x4(output_data_base, acc_u8, 0);
-              vst1_lane_8x4(output_data_base + output_height_stride, acc_u8, 1);
-
-              left_bank_0_reg = vrev32q_u16(left_bank_0_reg);
-              left_bank_1_reg = vrev32q_u16(left_bank_1_reg);
-              left_bank_2_reg = vrev32q_u16(left_bank_2_reg);
-              left_bank_3_reg = vrev32q_u16(left_bank_3_reg);
-              left_bank_4_reg = vrev32q_u16(left_bank_4_reg);
-              vtrn1_s8x2_in_place(&left_bank_0_reg, &right_bank_0_reg);
-              vtrn1_s8x2_in_place(&left_bank_1_reg, &right_bank_1_reg);
-              vtrn1_s8x2_in_place(&left_bank_2_reg, &right_bank_2_reg);
-              vtrn1_s8x2_in_place(&left_bank_3_reg, &right_bank_3_reg);
-              vtrn1_s8x2_in_place(&left_bank_4_reg, &right_bank_4_reg);
-            }
-          }
-          bias_data += kBiasIncrement;
-        }
-      } else {
-        // block_height == 1.
-        int8x16_t filter_reg_0_a;
-        int8x16_t filter_reg_1_a;
-        int8x16_t filter_reg_2_a;
-        int8x16_t filter_reg_0_b;
-        int8x16_t filter_reg_1_b;
-        int8x16_t filter_reg_2_b;
-
-        filter_reg_0_a = vld1q_s8(filter_block);
-        filter_reg_1_a = vld1q_s8(filter_block + 32);
-        filter_reg_2_a = vld1q_s8(filter_block + 64);
-        filter_reg_0_b = vld1q_s8(filter_block + 16);
-        filter_reg_1_b = vld1q_s8(filter_block + 16 + 32);
-        filter_reg_2_b = vld1q_s8(filter_block + 16 + 64);
-
-        const int8* scratch_data =
-            scratch_block_data + depth_micro_stride * j_depth;
-        typename QuantizationTypeImpl::ExternalType*
-            output_data = output_block_data + 8 * j_depth;
-        const int8* input_data_0 = scratch_data;
-
-        const int32x4_t adjusted_bias_data_a = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-        const int32x4_t adjusted_bias_data_b = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-
-        const int32x4_t output_shift_a =
-            vld1q_s32(output_shift_per_channel + j_depth * 8);
-        const int32x4_t output_multiplier_a =
-            vld1q_s32(output_multiplier_per_channel + j_depth * 8);
-        const int32x4_t output_shift_b =
-            vld1q_s32(output_shift_per_channel + j_depth * 8 + 4);
-        const int32x4_t output_multiplier_b =
-            vld1q_s32(output_multiplier_per_channel + j_depth * 8 + 4);
-
-        // Load first sub-micro block of data into operational banks.
-        int8x16_t left_bank_0_reg_a = vld1q_s8(input_data_0);
-        int8x16_t left_bank_1_reg_a =
-            vld1q_s8(input_data_0 + workspace_height_stride);
-        int8x16_t left_bank_2_reg_a =
-            vld1q_s8(input_data_0 + 2 * workspace_height_stride);
-        int8x16_t left_bank_0_reg_b = vld1q_s8(input_data_0 + 16);
-        int8x16_t left_bank_1_reg_b =
-            vld1q_s8(input_data_0 + workspace_height_stride + 16);
-        int8x16_t left_bank_2_reg_b =
-            vld1q_s8(input_data_0 + 2 * workspace_height_stride + 16);
-
-        int8x16_t right_bank_0_reg_a;
-        int8x16_t right_bank_1_reg_a;
-        int8x16_t right_bank_2_reg_a;
-        int8x16_t right_bank_0_reg_b;
-        int8x16_t right_bank_1_reg_b;
-        int8x16_t right_bank_2_reg_b;
-
-        int32x4_t acc0_a;
-        int32x4_t acc0_b;
-
-        for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-             ++i_width) {
-          const int output_width = i_width == output_width_micro_repeats
-                                       ? residual_width
-                                       : kFourOverStride;
-          TFLITE_DCHECK_LE(output_width * kStrideVal, 4);
-          const int8* input_data = input_data_0 + width_micro_stride * i_width;
-          const bool no_right_block = i_width == output_width_micro_repeats &&
-                                      output_width_overall_micro_repeats ==
-                                          workspace_width_micro_repeats;
-
-          if (!no_right_block) {
-            // Load next sub-micro block of data.
-            right_bank_0_reg_a = vld1q_s8(input_data + width_micro_stride);
-            right_bank_1_reg_a = vld1q_s8(input_data + width_micro_stride +
-                                          workspace_height_stride);
-            right_bank_2_reg_a = vld1q_s8(input_data + width_micro_stride +
-                                          2 * workspace_height_stride);
-            right_bank_0_reg_b = vld1q_s8(input_data + width_micro_stride + 16);
-            right_bank_1_reg_b = vld1q_s8(input_data + width_micro_stride +
-                                          workspace_height_stride + 16);
-            right_bank_2_reg_b = vld1q_s8(input_data + width_micro_stride +
-                                          2 * workspace_height_stride + 16);
-          }
-
-          typename QuantizationTypeImpl::ExternalType*
-              output_data_base = output_data + depth * 2 * i_width;
-
-          // Iterate over input width shifts within 4x4 blocks.
-          {
-            acc0_a = adjusted_bias_data_a;
-            acc0_b = adjusted_bias_data_b;
-
-            acc0_a = vdotq_s32(acc0_a, filter_reg_0_a, left_bank_0_reg_a);
-            acc0_a = vdotq_s32(acc0_a, filter_reg_1_a, left_bank_1_reg_a);
-            acc0_a = vdotq_s32(acc0_a, filter_reg_2_a, left_bank_2_reg_a);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_0_b, left_bank_0_reg_b);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_1_b, left_bank_1_reg_b);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_2_b, left_bank_2_reg_b);
-
-            // Fixed-point multiplication.
-            acc0_a = vqrdmulhq_s32(acc0_a, output_multiplier_a);
-            acc0_b = vqrdmulhq_s32(acc0_b, output_multiplier_b);
-            acc0_a = DivideByPOT::RunMult(
-                acc0_a, output_shift_a);
-            acc0_b = DivideByPOT::RunMult(
-                acc0_b, output_shift_b);
-            // Add the output offset.
-            int16x8_t acc_s16_0_1 =
-                vcombine_s16(vqmovn_s32(acc0_a), vqmovn_s32(acc0_b));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            int8x8_t acc_u8 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8 = util_vmax_x8(acc_u8, output_activation_min_vec);
-            acc_u8 = util_vmin_x8(acc_u8, output_activation_max_vec);
-
-            vst1_s8(output_data_base, acc_u8);
-
-            left_bank_0_reg_a = vrev32q_u16(left_bank_0_reg_a);
-            left_bank_1_reg_a = vrev32q_u16(left_bank_1_reg_a);
-            left_bank_2_reg_a = vrev32q_u16(left_bank_2_reg_a);
-            left_bank_0_reg_b = vrev32q_u16(left_bank_0_reg_b);
-            left_bank_1_reg_b = vrev32q_u16(left_bank_1_reg_b);
-            left_bank_2_reg_b = vrev32q_u16(left_bank_2_reg_b);
-            vtrn1_s8x2_in_place(&left_bank_0_reg_a, &right_bank_0_reg_a);
-            vtrn1_s8x2_in_place(&left_bank_1_reg_a, &right_bank_1_reg_a);
-            vtrn1_s8x2_in_place(&left_bank_2_reg_a, &right_bank_2_reg_a);
-            vtrn1_s8x2_in_place(&left_bank_0_reg_b, &right_bank_0_reg_b);
-            vtrn1_s8x2_in_place(&left_bank_1_reg_b, &right_bank_1_reg_b);
-            vtrn1_s8x2_in_place(&left_bank_2_reg_b, &right_bank_2_reg_b);
-          }
-
-          if (output_width > 1) {
-            acc0_a = adjusted_bias_data_a;
-            acc0_b = adjusted_bias_data_b;
-
-            acc0_a = vdotq_s32(acc0_a, filter_reg_0_a, left_bank_0_reg_a);
-            acc0_a = vdotq_s32(acc0_a, filter_reg_1_a, left_bank_1_reg_a);
-            acc0_a = vdotq_s32(acc0_a, filter_reg_2_a, left_bank_2_reg_a);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_0_b, left_bank_0_reg_b);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_1_b, left_bank_1_reg_b);
-            acc0_b = vdotq_s32(acc0_b, filter_reg_2_b, left_bank_2_reg_b);
-
-            // Fixed-point multiplication.
-            acc0_a = vqrdmulhq_s32(acc0_a, output_multiplier_a);
-            acc0_b = vqrdmulhq_s32(acc0_b, output_multiplier_b);
-            acc0_a = DivideByPOT::RunMult(
-                acc0_a, output_shift_a);
-            acc0_b = DivideByPOT::RunMult(
-                acc0_b, output_shift_b);
-            // Add the output offset.
-            int16x8_t acc_s16_0_1 =
-                vcombine_s16(vqmovn_s32(acc0_a), vqmovn_s32(acc0_b));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            int8x8_t acc_u8 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8 = util_vmax_x8(acc_u8, output_activation_min_vec);
-            acc_u8 = util_vmin_x8(acc_u8, output_activation_max_vec);
-
-            vst1_s8(output_data_base + depth, acc_u8);
-
-            left_bank_0_reg_a = right_bank_0_reg_a;
-            left_bank_1_reg_a = right_bank_1_reg_a;
-            left_bank_2_reg_a = right_bank_2_reg_a;
-            left_bank_0_reg_b = right_bank_0_reg_b;
-            left_bank_1_reg_b = right_bank_1_reg_b;
-            left_bank_2_reg_b = right_bank_2_reg_b;
-          }
-        }
-      }
-    }
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         int8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockIntrinsics(scratch_block_data, filter_workspace, bias_data,
-                               output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseIntrinsics3x3DotProduct,
-    QuantizationType::kPerChannelInt8,
-    DepthwiseConvDepthMultiplication::kUnitInputDepth,
-    /*stride=*/1> {
-  static inline int8x8_t vqmovxn_s16(int16x8_t x) { return vqmovn_s16(x); }
-  static inline int8x8_t util_vmin_x8(int8x8_t a, int8x8_t b) {
-    return vmin_s8(a, b);
-  }
-  static inline int8x8_t util_vmax_x8(int8x8_t a, int8x8_t b) {
-    return vmax_s8(a, b);
-  }
-  static inline int8x16_t util_vminq_x8(int8x16_t a, int8x16_t b) {
-    return vminq_s8(a, b);
-  }
-  static inline int8x16_t util_vmaxq_x8(int8x16_t a, int8x16_t b) {
-    return vmaxq_s8(a, b);
-  }
-
-  static inline void KernelMacroBlockIntrinsics(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, int8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    static constexpr QuantizationType quantization_type =
-        QuantizationType::kPerChannelInt8;
-
-    TFLITE_DCHECK_EQ(function_params->stride, 1);
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int output_depth = function_params->output_depth;
-
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    constexpr int kBiasIncrement = 4;
-
-    TFLITE_DCHECK(depth_micro_repeats > 0);
-
-    const int32 output_activation_min =
-        function_params->quantized_activation_min;
-    const int32 output_activation_max =
-        function_params->quantized_activation_max;
-    const int32 output_offset = function_params->output_offset;
-    const int32* output_shift_per_channel =
-        function_params->output_shift_per_channel;
-    const int32* output_multiplier_per_channel =
-        function_params->output_multiplier_per_channel;
-    if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-      TFLITE_DCHECK_GE(output_activation_min, 0);
-      TFLITE_DCHECK_LT(output_activation_min, 256);
-      TFLITE_DCHECK_GE(output_activation_max, 0);
-      TFLITE_DCHECK_LT(output_activation_max, 256);
-    } else {
-      TFLITE_DCHECK_GE(output_activation_min, -128);
-      TFLITE_DCHECK_LT(output_activation_min, 128);
-      TFLITE_DCHECK_GE(output_activation_max, -128);
-      TFLITE_DCHECK_LT(output_activation_max, 128);
-      TFLITE_DCHECK_NE(output_shift_per_channel, nullptr);
-      TFLITE_DCHECK_NE(output_multiplier_per_channel, nullptr);
-    }
-    TFLITE_DCHECK_GE(output_offset, -32878);
-    TFLITE_DCHECK_LT(output_offset, 32768);
-
-    const int16x8_t output_offset_vec =
-        vdupq_n_s16(static_cast(output_offset));
-    const int8x16_t output_activation_min_vec =
-        vdupq_n_s8(static_cast(output_activation_min));
-    const int8x16_t output_activation_max_vec =
-        vdupq_n_s8(static_cast(output_activation_max));
-
-    typename QuantizationTypeImpl::ExternalType*
-        output_data_depthwise = output_block_data;
-    for (int j_depth = 0; j_depth < depth_micro_repeats; ++j_depth) {
-      // Simulate NEON-register transposition of subset of filter.
-      int8x16_t filter_reg_0_a;
-      int8x16_t filter_reg_0_b;
-      int8x16_t filter_reg_1_a;
-      int8x16_t filter_reg_1_b;
-      int8x16_t filter_reg_2_a;
-      int8x16_t filter_reg_2_b;
-      int8x16_t filter_reg_0_a_shifted;
-      int8x16_t filter_reg_1_a_shifted;
-      int8x16_t filter_reg_2_a_shifted;
-
-      filter_reg_0_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_0_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-
-      filter_reg_0_a_shifted = vshlq_n_u32(filter_reg_0_a, 8);
-      filter_reg_1_a_shifted = vshlq_n_u32(filter_reg_1_a, 8);
-      filter_reg_2_a_shifted = vshlq_n_u32(filter_reg_2_a, 8);
-
-      // When output_width_micro_repeats < output_width_overall_micro_repeats,
-      // 0 < residual_width <= 2, and so residual_width == 1 is then true iff
-      // residual_width < 2.
-      const int adjusted_width_micro_repeats =
-          (output_width_micro_repeats < output_width_overall_micro_repeats) &&
-                  (residual_width < 4)
-              ? output_width_micro_repeats
-              : output_width_overall_micro_repeats;
-
-      if (block_height == 4) {
-        for (int s = 0; s < 2; ++s) {
-          // Work through one slice, by row, at a time.
-          typename QuantizationTypeImpl::ExternalType*
-              output_data_base = output_data_depthwise + 4 * s;
-
-          const int8* next_input_data = scratch_block_data;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data = output_data_base;
-
-          const int32x4_t adjusted_bias_data = vld1q_s32(bias_data);
-          bias_data += kBiasIncrement;
-
-          const int32x4_t output_shift =
-              vld1q_s32(output_shift_per_channel + j_depth * 8 + 4 * s);
-          const int32x4_t output_multiplier =
-              vld1q_s32(output_multiplier_per_channel + j_depth * 8 + 4 * s);
-
-          int8x16_t input_bank_a_reg;  //  left 0, right 0, left 1, right 1.
-          int8x16_t input_bank_b_reg;  //  left 2, right 2, left 3, right 3.
-          int8x16_t input_bank_c_reg;  //  left 4, right 4, left 5, right 5.
-
-          // Load first sub-micro block of data into operational banks.
-          input_bank_a_reg =
-              vld1q_dup_s8x4(next_input_data);  // Load lane 0, avoiding
-                                                // uninitialized variable.
-          input_bank_a_reg = vld1q_lane_8x4(
-              next_input_data + workspace_height_stride, input_bank_a_reg, 2);
-          input_bank_b_reg = vld1q_dup_s8x4(
-              next_input_data +
-              2 * workspace_height_stride);  // Load lane 0, avoiding
-                                             // uninitialized variable.
-          input_bank_b_reg =
-              vld1q_lane_8x4(next_input_data + 3 * workspace_height_stride,
-                             input_bank_b_reg, 2);
-          input_bank_c_reg = vld1q_dup_s8x4(
-              next_input_data +
-              4 * workspace_height_stride);  // Load lane 0, avoiding
-                                             // uninitialized variable.
-          input_bank_c_reg =
-              vld1q_lane_8x4(next_input_data + 5 * workspace_height_stride,
-                             input_bank_c_reg, 2);
-
-          int32x4_t acc0;
-          int32x4_t acc1;
-          int32x4_t acc2;
-          int32x4_t acc3;
-
-          acc0 = adjusted_bias_data;
-          acc1 = adjusted_bias_data;
-          acc2 = adjusted_bias_data;
-          acc3 = adjusted_bias_data;
-
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg, 0);
-          acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a, input_bank_b_reg, 0);
-          acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a, input_bank_b_reg, 2);
-
-          int i_width = 0;
-          for (; i_width < adjusted_width_micro_repeats; ++i_width) {
-            next_input_data += 4;
-
-            // Iterate over input width shifts within 4x4 blocks.
-            {
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg,
-                                         0);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg,
-                                         2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_a_reg,
-                                         2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_1_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_2_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_1_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_2_a, input_bank_c_reg,
-                                         2);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::RunMult(
-                  acc0, output_shift);
-              acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::RunMult(
-                  acc1, output_shift);
-              acc2 = vqrdmulhq_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::RunMult(
-                  acc2, output_shift);
-              acc3 = vqrdmulhq_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::RunMult(
-                  acc3, output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              int8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                 vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              output_data += output_depth;
-            }
-            // Load next sub-micro block of data.
-            input_bank_a_reg =
-                vld1q_lane_8x4(next_input_data, input_bank_a_reg, 1);
-            input_bank_a_reg = vld1q_lane_8x4(
-                next_input_data + workspace_height_stride, input_bank_a_reg, 3);
-            input_bank_b_reg =
-                vld1q_lane_8x4(next_input_data + 2 * workspace_height_stride,
-                               input_bank_b_reg, 1);
-            input_bank_b_reg =
-                vld1q_lane_8x4(next_input_data + 3 * workspace_height_stride,
-                               input_bank_b_reg, 3);
-            input_bank_c_reg =
-                vld1q_lane_8x4(next_input_data + 4 * workspace_height_stride,
-                               input_bank_c_reg, 1);
-            input_bank_c_reg =
-                vld1q_lane_8x4(next_input_data + 5 * workspace_height_stride,
-                               input_bank_c_reg, 3);
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a_shifted,
-                                         input_bank_a_reg, 0);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a_shifted,
-                                         input_bank_a_reg, 2);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a_shifted,
-                                         input_bank_a_reg, 2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_1_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_2_a_shifted,
-                                         input_bank_c_reg, 0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_1_a_shifted,
-                                         input_bank_c_reg, 0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_2_a_shifted,
-                                         input_bank_c_reg, 2);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::RunMult(
-                  acc0, output_shift);
-              acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::RunMult(
-                  acc1, output_shift);
-              acc2 = vqrdmulhq_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::RunMult(
-                  acc2, output_shift);
-              acc3 = vqrdmulhq_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::RunMult(
-                  acc3, output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              int8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                 vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-              input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-              input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 16);
-
-              output_data += output_depth;
-            }
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg,
-                                         0);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg,
-                                         2);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg,
-                                         0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_a_reg,
-                                         2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg,
-                                         0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a, input_bank_b_reg,
-                                         0);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_1_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_2_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a, input_bank_b_reg,
-                                         2);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_1_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_2_a, input_bank_c_reg,
-                                         2);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::RunMult(
-                  acc0, output_shift);
-              acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::RunMult(
-                  acc1, output_shift);
-              acc2 = vqrdmulhq_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::RunMult(
-                  acc2, output_shift);
-              acc3 = vqrdmulhq_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::RunMult(
-                  acc3, output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              int8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                 vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              output_data += output_depth;
-            }
-
-            {
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a_shifted,
-                                         input_bank_a_reg, 0);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a_shifted,
-                                         input_bank_a_reg, 2);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a_shifted,
-                                         input_bank_a_reg, 2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a_shifted,
-                                         input_bank_b_reg, 0);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_1_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_2_a_shifted,
-                                         input_bank_c_reg, 0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a_shifted,
-                                         input_bank_b_reg, 2);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_1_a_shifted,
-                                         input_bank_c_reg, 0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_2_a_shifted,
-                                         input_bank_c_reg, 2);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::RunMult(
-                  acc0, output_shift);
-              acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::RunMult(
-                  acc1, output_shift);
-              acc2 = vqrdmulhq_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::RunMult(
-                  acc2, output_shift);
-              acc3 = vqrdmulhq_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::RunMult(
-                  acc3, output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              int8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                 vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-              input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-              input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 16);
-
-              output_data += output_depth;
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg,
-                                         0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg,
-                                         0);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a, input_bank_b_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a, input_bank_b_reg,
-                                         2);
-            }
-          }
-
-          if (i_width < output_width_overall_micro_repeats) {
-            next_input_data += 4;
-            const int output_width = residual_width;
-
-            // Load next sub-micro block of data.
-            input_bank_a_reg =
-                vld1q_lane_8x4(next_input_data, input_bank_a_reg, 1);
-            input_bank_a_reg = vld1q_lane_8x4(
-                next_input_data + workspace_height_stride, input_bank_a_reg, 3);
-            input_bank_b_reg =
-                vld1q_lane_8x4(next_input_data + 2 * workspace_height_stride,
-                               input_bank_b_reg, 1);
-            input_bank_b_reg =
-                vld1q_lane_8x4(next_input_data + 3 * workspace_height_stride,
-                               input_bank_b_reg, 3);
-            input_bank_c_reg =
-                vld1q_lane_8x4(next_input_data + 4 * workspace_height_stride,
-                               input_bank_c_reg, 1);
-            input_bank_c_reg =
-                vld1q_lane_8x4(next_input_data + 5 * workspace_height_stride,
-                               input_bank_c_reg, 3);
-
-            // Iterate over input width shifts within 4x4 blocks.
-            for (int x = 0; x < output_width; ++x) {
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg,
-                                         0);
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg,
-                                         2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_a_reg,
-                                         2);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_1_a, input_bank_b_reg,
-                                         2);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_2_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_1_a, input_bank_c_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_2_a, input_bank_c_reg,
-                                         2);
-
-              // Fixed-point multiplication.
-              acc0 = vqrdmulhq_s32(acc0, output_multiplier);
-              acc0 = DivideByPOT::RunMult(
-                  acc0, output_shift);
-              acc1 = vqrdmulhq_s32(acc1, output_multiplier);
-              acc1 = DivideByPOT::RunMult(
-                  acc1, output_shift);
-              acc2 = vqrdmulhq_s32(acc2, output_multiplier);
-              acc2 = DivideByPOT::RunMult(
-                  acc2, output_shift);
-              acc3 = vqrdmulhq_s32(acc3, output_multiplier);
-              acc3 = DivideByPOT::RunMult(
-                  acc3, output_shift);
-              // Add the output offset.
-              int16x8_t acc_s16_0_1 =
-                  vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-              int16x8_t acc_s16_2_3 =
-                  vcombine_s16(vqmovn_s32(acc2), vqmovn_s32(acc3));
-              acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-              acc_s16_2_3 = vqaddq_s16(acc_s16_2_3, output_offset_vec);
-              // Apply the activation function.
-              int8x16_t acc_u8_all = vcombine_u8(vqmovxn_s16(acc_s16_0_1),
-                                                 vqmovxn_s16(acc_s16_2_3));
-              acc_u8_all = util_vmaxq_x8(acc_u8_all, output_activation_min_vec);
-              acc_u8_all = util_vminq_x8(acc_u8_all, output_activation_max_vec);
-
-              vst1q_lane_8x4(output_data, acc_u8_all, 0);
-              vst1q_lane_8x4(output_data + output_height_stride, acc_u8_all, 1);
-              vst1q_lane_8x4(output_data + 2 * output_height_stride, acc_u8_all,
-                             2);
-              vst1q_lane_8x4(output_data + 3 * output_height_stride, acc_u8_all,
-                             3);
-
-              input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 8);
-              input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 8);
-              input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 8);
-
-              output_data += output_depth;
-
-              acc0 = adjusted_bias_data;
-              acc1 = adjusted_bias_data;
-              acc2 = adjusted_bias_data;
-              acc3 = adjusted_bias_data;
-
-              acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg,
-                                         0);
-              acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg,
-                                         0);
-              acc2 = vdotq_four_lane_s32(acc2, filter_reg_0_a, input_bank_b_reg,
-                                         0);
-              acc3 = vdotq_four_lane_s32(acc3, filter_reg_0_a, input_bank_b_reg,
-                                         2);
-            }
-          }
-          // scratch_block_data += 4 * workspace_height_stride;
-          output_data_base += 4 * output_height_stride;
-
-          // Move to next sub-block: advance to second set of filters, to new
-          // bias.
-          filter_reg_0_a = filter_reg_0_b;
-          filter_reg_1_a = filter_reg_1_b;
-          filter_reg_2_a = filter_reg_2_b;
-          filter_reg_0_a_shifted = vshlq_n_u32(filter_reg_0_a, 8);
-          filter_reg_1_a_shifted = vshlq_n_u32(filter_reg_1_a, 8);
-          filter_reg_2_a_shifted = vshlq_n_u32(filter_reg_2_a, 8);
-        }
-      } else {
-        // Block height < 4.
-        typename QuantizationTypeImpl::ExternalType*
-            output_data_base = output_data_depthwise;
-
-        const int32x4_t adjusted_bias_data_a = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-        const int32x4_t adjusted_bias_data_b = vld1q_s32(bias_data);
-        bias_data += kBiasIncrement;
-
-        const int32x4_t output_shift_a =
-            vld1q_s32(output_shift_per_channel + j_depth * 8);
-        const int32x4_t output_multiplier_a =
-            vld1q_s32(output_multiplier_per_channel + j_depth * 8);
-        const int32x4_t output_shift_b =
-            vld1q_s32(output_shift_per_channel + j_depth * 8 + 4);
-        const int32x4_t output_multiplier_b =
-            vld1q_s32(output_multiplier_per_channel + j_depth * 8 + 4);
-
-        for (int k_height = 0; k_height < block_height; ++k_height) {
-          const int8* next_input_data =
-              scratch_block_data + k_height * workspace_height_stride;
-          typename QuantizationTypeImpl::ExternalType*
-              output_data = output_data_base;
-
-          int8x16_t input_bank_p_reg;  //  left 0, right 0, left 1, right 1.
-          int8x16_t input_bank_q_reg;  //  left 2, right 2, left 3, right 3.
-
-          // Load first sub-micro block of data into operational banks.
-          input_bank_p_reg =
-              vld1q_dup_s8x4(next_input_data);  // Load lane 0, avoiding
-                                                // uninitialized variable.
-          input_bank_p_reg = vld1q_lane_8x4(
-              next_input_data + workspace_height_stride, input_bank_p_reg, 2);
-          input_bank_q_reg = vld1q_dup_s8x4(
-              next_input_data +
-              2 * workspace_height_stride);  // Load lane 0, avoiding
-                                             // uninitialized variable.
-
-          for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-               ++i_width) {
-            next_input_data += 4;
-            const int output_width =
-                i_width == output_width_micro_repeats ? residual_width : 4;
-
-            // Load next sub-micro block of data.
-            input_bank_p_reg =
-                vld1q_lane_8x4(next_input_data, input_bank_p_reg, 1);
-            input_bank_p_reg = vld1q_lane_8x4(
-                next_input_data + workspace_height_stride, input_bank_p_reg, 3);
-            input_bank_q_reg =
-                vld1q_lane_8x4(next_input_data + 2 * workspace_height_stride,
-                               input_bank_q_reg, 1);
-            // Iterate over input width shifts within 4x4 blocks.
-            for (int x = 0; x < output_width; ++x) {
-              int32x4_t acc_a = adjusted_bias_data_a;
-              int32x4_t acc_b = adjusted_bias_data_b;
-              acc_a = vdotq_four_lane_s32(acc_a, filter_reg_0_a,
-                                          input_bank_p_reg, 0);
-              acc_a = vdotq_four_lane_s32(acc_a, filter_reg_1_a,
-                                          input_bank_p_reg, 2);
-              acc_a = vdotq_four_lane_s32(acc_a, filter_reg_2_a,
-                                          input_bank_q_reg, 0);
-              acc_b = vdotq_four_lane_s32(acc_b, filter_reg_0_b,
-                                          input_bank_p_reg, 0);
-              acc_b = vdotq_four_lane_s32(acc_b, filter_reg_1_b,
-                                          input_bank_p_reg, 2);
-              acc_b = vdotq_four_lane_s32(acc_b, filter_reg_2_b,
-                                          input_bank_q_reg, 0);
-
-              // Fixed-point multiplication.
-              acc_a = vqrdmulhq_s32(acc_a, output_multiplier_a);
-              acc_b = vqrdmulhq_s32(acc_b, output_multiplier_b);
-              acc_a =
-                  DivideByPOT::RunMult(
-                      acc_a, output_shift_a);
-              acc_b =
-                  DivideByPOT::RunMult(
-                      acc_b, output_shift_b);
-              // Add the output offset.
-              int16x8_t acc_s16_0_0 =
-                  vcombine_s16(vqmovn_s32(acc_a), vqmovn_s32(acc_b));
-              acc_s16_0_0 = vqaddq_s16(acc_s16_0_0, output_offset_vec);
-              // Apply the activation function.
-              int8x8_t acc_u8_0_0 = vqmovxn_s16(acc_s16_0_0);
-              acc_u8_0_0 = util_vmax_x8(acc_u8_0_0,
-                                        vget_low_s8(output_activation_min_vec));
-              acc_u8_0_0 = util_vmin_x8(acc_u8_0_0,
-                                        vget_low_s8(output_activation_max_vec));
-
-              vst1_s8(output_data, acc_u8_0_0);
-
-              input_bank_p_reg = vshrq_n_u64(input_bank_p_reg, 8);
-              input_bank_q_reg = vshrq_n_u64(input_bank_q_reg, 8);
-
-              output_data += output_depth;
-            }
-          }
-          output_data_base += output_height_stride;
-        }
-      }
-      output_data_depthwise += 8;
-    }
-  }  // NOLINT(readability/fn_size) Manually unrolled.
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         int8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockIntrinsics(scratch_block_data, filter_workspace, bias_data,
-                               output_block_data, function_params);
-  }
-};
-
-template <>
-struct KernelMacroBlock<
-    DepthwiseConvImplementation::kUseIntrinsics3x3DotProduct,
-    QuantizationType::kPerChannelInt8,
-    DepthwiseConvDepthMultiplication::kUnitInputDepth,
-    /*stride=*/2> {
-  static inline int8x8_t vqmovxn_s16(int16x8_t x) { return vqmovn_s16(x); }
-  static inline int8x8_t util_vmin_x8(int8x8_t a, int8x8_t b) {
-    return vmin_s8(a, b);
-  }
-  static inline int8x8_t util_vmax_x8(int8x8_t a, int8x8_t b) {
-    return vmax_s8(a, b);
-  }
-
-  static inline void KernelMacroBlockIntrinsics(
-      const int8* scratch_block_data, const int8* filter_workspace,
-      const int32* bias_data, int8* output_block_data,
-      const DepthwiseConvDotProdParams* function_params) {
-    static constexpr QuantizationType quantization_type =
-        QuantizationType::kPerChannelInt8;
-
-    const int workspace_height_stride =
-        function_params->workspace_height_stride;
-    const int output_width_micro_repeats =
-        function_params->output_width_micro_repeats;
-    const int depth_micro_repeats = function_params->depth_micro_repeats;
-    const int output_depth = function_params->output_depth;
-    constexpr int kStrideVal = 2;
-    TFLITE_DCHECK_EQ(function_params->stride, kStrideVal);
-
-    const int output_width_overall_micro_repeats =
-        function_params->output_width_overall_micro_repeats;
-    const int block_height = function_params->outbound_block_height;
-    const int residual_width = function_params->output_residual_width;
-    const int output_height_stride = function_params->output_height_stride;
-    constexpr int kBiasIncrement = 4;
-
-    const int32 output_activation_min =
-        function_params->quantized_activation_min;
-    const int32 output_activation_max =
-        function_params->quantized_activation_max;
-    const int32 output_offset = function_params->output_offset;
-    const int32* output_shift_per_channel =
-        function_params->output_shift_per_channel;
-    const int32* output_multiplier_per_channel =
-        function_params->output_multiplier_per_channel;
-    if (quantization_type == QuantizationType::kNonPerChannelUint8) {
-      TFLITE_DCHECK_GE(output_activation_min, 0);
-      TFLITE_DCHECK_LT(output_activation_min, 256);
-      TFLITE_DCHECK_GE(output_activation_max, 0);
-      TFLITE_DCHECK_LT(output_activation_max, 256);
-    } else {
-      TFLITE_DCHECK_GE(output_activation_min, -128);
-      TFLITE_DCHECK_LT(output_activation_min, 128);
-      TFLITE_DCHECK_GE(output_activation_max, -128);
-      TFLITE_DCHECK_LT(output_activation_max, 128);
-      TFLITE_DCHECK_NE(output_shift_per_channel, nullptr);
-      TFLITE_DCHECK_NE(output_multiplier_per_channel, nullptr);
-    }
-    TFLITE_DCHECK_GE(output_offset, -32878);
-    TFLITE_DCHECK_LT(output_offset, 32768);
-
-    TFLITE_DCHECK_GE(depth_micro_repeats, 1);
-
-    const int16x8_t output_offset_vec =
-        vdupq_n_s16(static_cast(output_offset));
-    const int8x16_t output_activation_min_vec =
-        vdupq_n_s8(static_cast(output_activation_min));
-    const int8x16_t output_activation_max_vec =
-        vdupq_n_s8(static_cast(output_activation_max));
-
-    for (int j_depth = 0; j_depth < (depth_micro_repeats * 1 + 0); ++j_depth) {
-      int8x16_t filter_reg_0_a;
-      int8x16_t filter_reg_0_b;
-      int8x16_t filter_reg_1_a;
-      int8x16_t filter_reg_1_b;
-      int8x16_t filter_reg_2_a;
-      int8x16_t filter_reg_2_b;
-
-      filter_reg_0_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_0_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_1_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_a = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-      filter_reg_2_b = vld1q_s8(filter_workspace);
-      filter_workspace += 16;
-
-      const int32x4_t adjusted_bias_data_s_0 = vld1q_s32(bias_data);
-      bias_data += kBiasIncrement;
-      const int32x4_t adjusted_bias_data_s_1 = vld1q_s32(bias_data);
-      bias_data += kBiasIncrement;
-
-      const int32x4_t output_shift_s_0 =
-          vld1q_s32(output_shift_per_channel + j_depth * 8);
-      const int32x4_t output_multiplier_s_0 =
-          vld1q_s32(output_multiplier_per_channel + j_depth * 8);
-      const int32x4_t output_shift_s_1 =
-          vld1q_s32(output_shift_per_channel + j_depth * 8 + 4);
-      const int32x4_t output_multiplier_s_1 =
-          vld1q_s32(output_multiplier_per_channel + j_depth * 8 + 4);
-
-      if (block_height == 2) {
-        const int8* scratch_data = scratch_block_data;
-        typename QuantizationTypeImpl::ExternalType*
-            output_data = output_block_data + 8 * j_depth;
-
-        int8x16_t input_bank_a_reg;  //  left 0, right 0, left 1, right 1.
-        int8x16_t input_bank_b_reg;  //  left 2, right 2, left 3, right 3.
-        int8x16_t input_bank_c_reg;  //  left 4, right 4, xxx, xxx.
-
-        // Load first sub-micro block of data into operational banks.
-        input_bank_a_reg =
-            vld1q_dup_s8x4(scratch_data);  // Load lane 0, avoiding
-                                           // uninitialized variable.
-        input_bank_a_reg = vld1q_lane_8x4(
-            scratch_data + workspace_height_stride, input_bank_a_reg, 2);
-        input_bank_b_reg = vld1q_dup_s8x4(
-            scratch_data +
-            2 * workspace_height_stride);  // Load lane 0, avoiding
-                                           // uninitialized variable.
-        input_bank_b_reg = vld1q_lane_8x4(
-            scratch_data + 3 * workspace_height_stride, input_bank_b_reg, 2);
-        input_bank_c_reg = vld1q_dup_s8x4(
-            scratch_data +
-            4 * workspace_height_stride);  // Load lane 0, avoiding
-                                           // uninitialized variable.
-
-        int32x4_t acc0;
-        int32x4_t acc1;
-
-        // When output_width_micro_repeats < output_width_overall_micro_repeats,
-        // 0 < residual_width <= 2, and so residual_width == 1 is then true iff
-        // residual_width < 2.
-        const int adjusted_width_micro_repeats =
-            (output_width_micro_repeats < output_width_overall_micro_repeats) &&
-                    (residual_width < 2)
-                ? output_width_micro_repeats
-                : output_width_overall_micro_repeats;
-
-        int i_width = 0;
-        for (; i_width < adjusted_width_micro_repeats; ++i_width) {
-          const int8* input_data = scratch_data + 4 + 4 * i_width;
-
-          // Load next sub-micro block of data.
-          input_bank_a_reg = vld1q_lane_8x4(input_data, input_bank_a_reg, 1);
-          input_bank_a_reg = vld1q_lane_8x4(
-              input_data + workspace_height_stride, input_bank_a_reg, 3);
-          input_bank_b_reg = vld1q_lane_8x4(
-              input_data + 2 * workspace_height_stride, input_bank_b_reg, 1);
-          input_bank_b_reg = vld1q_lane_8x4(
-              input_data + 3 * workspace_height_stride, input_bank_b_reg, 3);
-          input_bank_c_reg = vld1q_lane_8x4(
-              input_data + 4 * workspace_height_stride, input_bank_c_reg, 1);
-
-          int16x8_t acc_s16_0_1;
-          int8x8_t acc_u8_0_1;
-          // Iterate over input width shifts within 4x4 blocks.
-          {
-            acc0 = adjusted_bias_data_s_0;
-            acc1 = adjusted_bias_data_s_0;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg, 2);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg, 2);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_c_reg, 0);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_s32(acc0, output_multiplier_s_0);
-            acc0 = DivideByPOT::RunMult(
-                acc0, output_shift_s_0);
-            acc1 = vqrdmulhq_s32(acc1, output_multiplier_s_0);
-            acc1 = DivideByPOT::RunMult(
-                acc1, output_shift_s_0);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_max_vec));
-
-            vst1_lane_8x4(output_data, acc_u8_0_1, 0);
-            vst1_lane_8x4(output_data + output_height_stride, acc_u8_0_1, 1);
-
-            acc0 = adjusted_bias_data_s_1;
-            acc1 = adjusted_bias_data_s_1;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_b, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_b, input_bank_a_reg, 2);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_b, input_bank_b_reg, 2);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_b, input_bank_c_reg, 0);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_s32(acc0, output_multiplier_s_1);
-            acc0 = DivideByPOT::RunMult(
-                acc0, output_shift_s_1);
-            acc1 = vqrdmulhq_s32(acc1, output_multiplier_s_1);
-            acc1 = DivideByPOT::RunMult(
-                acc1, output_shift_s_1);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_max_vec));
-
-            vst1_lane_8x4(output_data + 4, acc_u8_0_1, 0);
-            vst1_lane_8x4(output_data + 4 + output_height_stride, acc_u8_0_1,
-                          1);
-
-            input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-            input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-            input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 16);
-
-            output_data += output_depth;
-          }
-
-          // output_width == four_over_stride.
-          acc0 = adjusted_bias_data_s_0;
-          acc1 = adjusted_bias_data_s_0;
-
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg, 0);
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg, 2);
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_b_reg, 0);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg, 2);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_c_reg, 0);
-
-          // Fixed-point multiplication.
-          acc0 = vqrdmulhq_s32(acc0, output_multiplier_s_0);
-          acc0 = DivideByPOT::RunMult(
-              acc0, output_shift_s_0);
-          acc1 = vqrdmulhq_s32(acc1, output_multiplier_s_0);
-          acc1 = DivideByPOT::RunMult(
-              acc1, output_shift_s_0);
-          // Add the output offset.
-          acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-          acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-          // Apply the activation function.
-          acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-          acc_u8_0_1 =
-              util_vmax_x8(acc_u8_0_1, vget_low_s8(output_activation_min_vec));
-          acc_u8_0_1 =
-              util_vmin_x8(acc_u8_0_1, vget_low_s8(output_activation_max_vec));
-
-          vst1_lane_8x4(output_data, acc_u8_0_1, 0);
-          vst1_lane_8x4(output_data + output_height_stride, acc_u8_0_1, 1);
-
-          acc0 = adjusted_bias_data_s_1;
-          acc1 = adjusted_bias_data_s_1;
-
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_0_b, input_bank_a_reg, 0);
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_1_b, input_bank_a_reg, 2);
-          acc0 = vdotq_four_lane_s32(acc0, filter_reg_2_b, input_bank_b_reg, 0);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_0_b, input_bank_b_reg, 0);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_1_b, input_bank_b_reg, 2);
-          acc1 = vdotq_four_lane_s32(acc1, filter_reg_2_b, input_bank_c_reg, 0);
-
-          // Fixed-point multiplication.
-          acc0 = vqrdmulhq_s32(acc0, output_multiplier_s_1);
-          acc0 = DivideByPOT::RunMult(
-              acc0, output_shift_s_1);
-          acc1 = vqrdmulhq_s32(acc1, output_multiplier_s_1);
-          acc1 = DivideByPOT::RunMult(
-              acc1, output_shift_s_1);
-          // Add the output offset.
-          acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-          acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-          // Apply the activation function.
-          acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-          acc_u8_0_1 =
-              util_vmax_x8(acc_u8_0_1, vget_low_s8(output_activation_min_vec));
-          acc_u8_0_1 =
-              util_vmin_x8(acc_u8_0_1, vget_low_s8(output_activation_max_vec));
-
-          vst1_lane_8x4(output_data + 4, acc_u8_0_1, 0);
-          vst1_lane_8x4(output_data + 4 + output_height_stride, acc_u8_0_1, 1);
-
-          input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-          input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-          input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 16);
-
-          output_data += output_depth;
-        }
-        for (; i_width < output_width_overall_micro_repeats; ++i_width) {
-          // output_width == 1.
-          const int8* input_data = scratch_data + 4 + 4 * i_width;
-
-          // Load next sub-micro block of data.
-          input_bank_a_reg = vld1q_lane_8x4(input_data, input_bank_a_reg, 1);
-          input_bank_a_reg = vld1q_lane_8x4(
-              input_data + workspace_height_stride, input_bank_a_reg, 3);
-          input_bank_b_reg = vld1q_lane_8x4(
-              input_data + 2 * workspace_height_stride, input_bank_b_reg, 1);
-          input_bank_b_reg = vld1q_lane_8x4(
-              input_data + 3 * workspace_height_stride, input_bank_b_reg, 3);
-          input_bank_c_reg = vld1q_lane_8x4(
-              input_data + 4 * workspace_height_stride, input_bank_c_reg, 1);
-
-          int16x8_t acc_s16_0_1;
-          int8x8_t acc_u8_0_1;
-          // Iterate over input width shifts within 4x4 blocks.
-          {
-            acc0 = adjusted_bias_data_s_0;
-            acc1 = adjusted_bias_data_s_0;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg, 2);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_a, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_a, input_bank_b_reg, 2);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_a, input_bank_c_reg, 0);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_s32(acc0, output_multiplier_s_0);
-            acc0 = DivideByPOT::RunMult(
-                acc0, output_shift_s_0);
-            acc1 = vqrdmulhq_s32(acc1, output_multiplier_s_0);
-            acc1 = DivideByPOT::RunMult(
-                acc1, output_shift_s_0);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_max_vec));
-
-            vst1_lane_8x4(output_data, acc_u8_0_1, 0);
-            vst1_lane_8x4(output_data + output_height_stride, acc_u8_0_1, 1);
-
-            acc0 = adjusted_bias_data_s_1;
-            acc1 = adjusted_bias_data_s_1;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_b, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_b, input_bank_a_reg, 2);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_b, input_bank_b_reg, 2);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_b, input_bank_c_reg, 0);
-
-            // Fixed-point multiplication.
-            acc0 = vqrdmulhq_s32(acc0, output_multiplier_s_1);
-            acc0 = DivideByPOT::RunMult(
-                acc0, output_shift_s_1);
-            acc1 = vqrdmulhq_s32(acc1, output_multiplier_s_1);
-            acc1 = DivideByPOT::RunMult(
-                acc1, output_shift_s_1);
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_max_vec));
-
-            vst1_lane_8x4(output_data + 4, acc_u8_0_1, 0);
-            vst1_lane_8x4(output_data + 4 + output_height_stride, acc_u8_0_1,
-                          1);
-
-            input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-            input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-            input_bank_c_reg = vshrq_n_u64(input_bank_c_reg, 16);
-
-            output_data += output_depth;
-          }
-        }
-      } else {
-        TFLITE_DCHECK_EQ(block_height, 1);
-        // Work through one slice, by row, at a time.
-        const int8* scratch_data = scratch_block_data;
-        typename QuantizationTypeImpl::ExternalType*
-            output_data = output_block_data + 8 * j_depth;
-
-        int8x16_t input_bank_a_reg;  //  left 0, right 0, left 1, right 1.
-        int8x16_t input_bank_b_reg;  //  left 2, right 2, xxx, xxx.
-
-        // Load first sub-micro block of data into operational banks.
-        input_bank_a_reg =
-            vld1q_dup_s8x4(scratch_data);  // Load lane 0, avoiding
-                                           // uninitialized variable.
-        input_bank_a_reg = vld1q_lane_8x4(
-            scratch_data + workspace_height_stride, input_bank_a_reg, 2);
-        input_bank_b_reg = vld1q_dup_s8x4(
-            scratch_data +
-            2 * workspace_height_stride);  // Load lane 0, avoiding
-                                           // uninitialized variable.
-
-        int32x4_t acc0;
-        int32x4_t acc1;
-
-        for (int i_width = 0; i_width < output_width_overall_micro_repeats;
-             ++i_width) {
-          const int output_width =
-              i_width == output_width_micro_repeats ? residual_width : 2;
-
-          TFLITE_DCHECK_LE(output_width, 2);
-          TFLITE_DCHECK_GE(output_width, 1);
-          TFLITE_DCHECK_LE(output_width * kStrideVal, 4);
-          const int8* input_data = scratch_data + 4 + 4 * i_width;
-
-          // Load next sub-micro block of data.
-          input_bank_a_reg = vld1q_lane_8x4(input_data, input_bank_a_reg, 1);
-          input_bank_a_reg = vld1q_lane_8x4(
-              input_data + workspace_height_stride, input_bank_a_reg, 3);
-          input_bank_b_reg = vld1q_lane_8x4(
-              input_data + 2 * workspace_height_stride, input_bank_b_reg, 1);
-
-          int16x8_t acc_s16_0_1;
-          int8x8_t acc_u8_0_1;
-
-          // Iterate over input width shifts within 4x4 blocks.
-          {
-            acc0 = adjusted_bias_data_s_0;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg, 2);
-
-            acc0 = vqrdmulhq_s32(acc0, output_multiplier_s_0);
-            acc0 = DivideByPOT::RunMult(
-                acc0, output_shift_s_0);
-
-            // Second sub-block accumulation.
-            acc1 = adjusted_bias_data_s_1;
-
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_b, input_bank_a_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_b, input_bank_a_reg, 2);
-
-            acc1 = vqrdmulhq_s32(acc1, output_multiplier_s_1);
-            acc1 = DivideByPOT::RunMult(
-                acc1, output_shift_s_1);
-
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_max_vec));
-
-            // This stores the results for both sub-blocks together.
-            vst1_s8(output_data, acc_u8_0_1);
-
-            input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-            input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-
-            output_data += output_depth;
-          }
-          if (output_width == 2) {
-            acc0 = adjusted_bias_data_s_0;
-
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_2_a, input_bank_b_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_0_a, input_bank_a_reg, 0);
-            acc0 =
-                vdotq_four_lane_s32(acc0, filter_reg_1_a, input_bank_a_reg, 2);
-
-            acc0 = vqrdmulhq_s32(acc0, output_multiplier_s_0);
-            acc0 = DivideByPOT::RunMult(
-                acc0, output_shift_s_0);
-
-            // Second sub-block accumulation.
-            acc1 = adjusted_bias_data_s_1;
-
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_2_b, input_bank_b_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_0_b, input_bank_a_reg, 0);
-            acc1 =
-                vdotq_four_lane_s32(acc1, filter_reg_1_b, input_bank_a_reg, 2);
-
-            acc1 = vqrdmulhq_s32(acc1, output_multiplier_s_1);
-            acc1 = DivideByPOT::RunMult(
-                acc1, output_shift_s_1);
-
-            // Add the output offset.
-            acc_s16_0_1 = vcombine_s16(vqmovn_s32(acc0), vqmovn_s32(acc1));
-            acc_s16_0_1 = vqaddq_s16(acc_s16_0_1, output_offset_vec);
-            // Apply the activation function.
-            acc_u8_0_1 = vqmovxn_s16(acc_s16_0_1);
-            acc_u8_0_1 = util_vmax_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_min_vec));
-            acc_u8_0_1 = util_vmin_x8(acc_u8_0_1,
-                                      vget_low_s8(output_activation_max_vec));
-
-            // This stores the results for both sub-blocks together.
-            vst1_s8(output_data, acc_u8_0_1);
-
-            input_bank_a_reg = vshrq_n_u64(input_bank_a_reg, 16);
-            input_bank_b_reg = vshrq_n_u64(input_bank_b_reg, 16);
-
-            output_data += output_depth;
-          }
-        }
-      }
-    }
-  }
-
-  static inline void Run(const int8* scratch_block_data,
-                         const int8* filter_workspace, const int32* bias_data,
-                         int8* output_block_data,
-                         const DepthwiseConvDotProdParams* function_params) {
-    KernelMacroBlockIntrinsics(scratch_block_data, filter_workspace, bias_data,
-                               output_block_data, function_params);
-  }
-};
-
-#undef vst1_lane_8x4
-#undef vst1q_lane_8x4
-#undef vld1q_lane_s8x8
-#undef vld1_lane_8x4
-#undef vld1q_lane_8x4
-#undef vld1q_dup_s8x4
-
-#endif  //  USE_NEON
-
-}  // namespace depthwise_conv
-}  // namespace optimized_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_DEPTHWISECONV_UINT8_TRANSITIONAL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/eigen_spatial_convolutions.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/eigen_spatial_convolutions.h
deleted file mode 100644
index 87ef4ec..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/eigen_spatial_convolutions.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Copyright 2017 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_KERNELS_INTERNAL_OPTIMIZED_EIGEN_SPATIAL_CONVOLUTIONS_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_SPATIAL_CONVOLUTIONS_H_
-
-#define EIGEN_USE_CUSTOM_THREAD_POOL
-#define EIGEN_USE_THREADS
-
-// NOTE: Eigen is slightly different internally and externally. We need to
-// hack the unsupported/Eigen/CXX11/Tensor header instantiation macros at
-// specific places, so we need two copies of the hacked file, one for
-// internal and one for external.
-// If you have trouble simply undef out the reducer macro e.g.
-// TFLITE_REDUCE_INSTANTIATIONS_GOOGLE, but be aware this will make
-// the binary much bigger!
-#define TFLITE_REDUCE_INSTANTIATIONS_OPEN_SOURCE
-#define Eigen EigenForTFLite
-#if defined(TFLITE_REDUCE_INSTANTIATIONS_GOOGLE)
-#include "tensorflow/lite/kernels/internal/optimized/eigen_tensor_reduced_instantiations_google.h"
-#elif defined(TFLITE_REDUCE_INSTANTIATIONS_OPEN_SOURCE)
-#include "tensorflow/lite/kernels/internal/optimized/eigen_tensor_reduced_instantiations_oss.h"
-#else
-#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
-#endif
-
-#include "tensorflow/core/kernels/eigen_spatial_convolutions-inl.h"
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_SPATIAL_CONVOLUTIONS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/eigen_tensor_reduced_instantiations_google.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/eigen_tensor_reduced_instantiations_google.h
deleted file mode 100644
index ede5d6f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/eigen_tensor_reduced_instantiations_google.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright 2017 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.
-==============================================================================*/
-
-// This is essentially unsupported/CXX11/Eigen/Tensor.h
-// TODO(petewarden) - move this to a common location in Eigen itself.
-
-// clang-format off
-
-
-#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_GOOGLE_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_GOOGLE_H_
-
-
-#include "Eigen/Core"
-
-#if defined(EIGEN_USE_SYCL)
-#undef min
-#undef max
-#undef isnan
-#undef isinf
-#undef isfinite
-#include 
-#include 
-#include 
-#include 
-#include 
-#endif
-#include 
-#include 
-#include 
-
-
-
-
-
-#ifdef _WIN32
-typedef __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#include 
-#else
-#include 
-#include 
-#endif
-
-#if __cplusplus > 199711 || EIGEN_COMP_MSVC >= 1900
-#include 
-#endif
-
-#ifdef _WIN32
-#include 
-#elif defined(__APPLE__)
-#include 
-#else
-#include 
-#endif
-
-#ifdef EIGEN_USE_THREADS
-#include "third_party/eigen3/unsupported/Eigen/CXX11/ThreadPool"
-#endif
-
-
-#include "Eigen/src/Core/util/DisableStupidWarnings.h"
-
-#include "third_party/eigen3/unsupported/Eigen/SpecialFunctions"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/util/CXX11Meta.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/util/MaxSizeVector.h"
-
-
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h"
-
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBase.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h"
-
-#undef TENSOR_CONTRACTION_DISPATCH
-#define TENSOR_CONTRACTION_DISPATCH(METHOD, ALIGNMENT, ARGS)    \
-  if (this->m_lhs_inner_dim_contiguous &&                       \
-      this->m_rhs_inner_dim_contiguous &&                       \
-      !this->m_rhs_inner_dim_reordered) {                       \
-    METHOD ARGS;                  \
-  } else {                                                      \
-    eigen_assert(false && "Unsupported contraction formats");   \
-  }
-
-
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorScan.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/Tensor.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorMap.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorRef.h"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/src/Tensor/TensorIO.h"
-
-#include "Eigen/src/Core/util/ReenableStupidWarnings.h"
-
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_GOOGLE_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/eigen_tensor_reduced_instantiations_oss.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/eigen_tensor_reduced_instantiations_oss.h
deleted file mode 100644
index cacca3f..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/eigen_tensor_reduced_instantiations_oss.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* Copyright 2017 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.
-==============================================================================*/
-
-// This is essentially unsupported/CXX11/Eigen/Tensor.h
-// TODO(petewarden) - move this to a common location in Eigen itself.
-
-// clang-format off
-
-
-#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_OSS_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_OSS_H_
-
-
-#include "Eigen/Core"
-
-#if defined(EIGEN_USE_SYCL)
-#undef min
-#undef max
-#undef isnan
-#undef isinf
-#undef isfinite
-#include 
-#include 
-#include 
-#include 
-#include 
-#endif
-#include 
-#include 
-#include 
-
-
-
-
-
-#ifdef _WIN32
-typedef __int16 int16_t;
-typedef unsigned __int16 uint16_t;
-typedef __int32 int32_t;
-typedef unsigned __int32 uint32_t;
-typedef __int64 int64_t;
-typedef unsigned __int64 uint64_t;
-#include 
-#else
-#include 
-#include 
-#endif
-
-#if __cplusplus > 199711 || EIGEN_COMP_MSVC >= 1900
-#include 
-#endif
-
-#ifdef _WIN32
-#include 
-#elif defined(__APPLE__)
-#include 
-#else
-#include 
-#endif
-
-#ifdef EIGEN_USE_THREADS
-#include "unsupported/Eigen/CXX11/ThreadPool"
-#endif
-
-
-#include "Eigen/src/Core/util/DisableStupidWarnings.h"
-
-#include "unsupported/Eigen/SpecialFunctions"
-#include "unsupported/Eigen/CXX11/src/util/CXX11Meta.h"
-#include "unsupported/Eigen/CXX11/src/util/MaxSizeVector.h"
-
-
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorMacros.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorForwardDeclarations.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorMeta.h"
-
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorFunctors.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorCostModel.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceDefault.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceThreadPool.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorDeviceGpu.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorIndexList.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorDimensionList.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorDimensions.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorInitializer.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorTraits.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorRandom.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorUInt128.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorIntDiv.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorGlobalFunctions.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorBase.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorBlock.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorEvaluator.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorExpr.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorReduction.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorReductionGpu.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorArgMax.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorConcatenation.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionMapper.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionBlocking.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorContraction.h"
-
-#undef TENSOR_CONTRACTION_DISPATCH
-#define TENSOR_CONTRACTION_DISPATCH(METHOD, ALIGNMENT, ARGS)    \
-  if (this->m_lhs_inner_dim_contiguous &&                       \
-      this->m_rhs_inner_dim_contiguous &&                       \
-      !this->m_rhs_inner_dim_reordered) {                       \
-    METHOD ARGS;                  \
-  } else {                                                      \
-    eigen_assert(false && "Unsupported contraction formats");   \
-  }
-
-
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionThreadPool.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorContractionGpu.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorConversion.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorConvolution.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorFFT.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorPatch.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorImagePatch.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorVolumePatch.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorBroadcasting.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorChipping.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorInflation.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorLayoutSwap.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorMorphing.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorPadding.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorReverse.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorShuffling.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorStriding.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorCustomOp.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorEvalTo.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorForcedEval.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorGenerator.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorAssign.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorScan.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorTrace.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorExecutor.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorDevice.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorStorage.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/Tensor.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorFixedSize.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorMap.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorRef.h"
-#include "unsupported/Eigen/CXX11/src/Tensor/TensorIO.h"
-
-#include "Eigen/src/Core/util/ReenableStupidWarnings.h"
-
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_EIGEN_TENSOR_REDUCED_INSTANTIATIONS_OSS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/im2col_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/im2col_utils.h
deleted file mode 100644
index ca4ce6b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/im2col_utils.h
+++ /dev/null
@@ -1,288 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_IM2COL_UTILS_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_IM2COL_UTILS_H_
-
-#include 
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_ops {
-
-template 
-inline void ExtractPatchIntoBufferColumn(const RuntimeShape& input_shape, int w,
-                                         int h, int b, int kheight, int kwidth,
-                                         int stride_width, int stride_height,
-                                         int pad_width, int pad_height,
-                                         int in_width, int in_height,
-                                         int in_depth, int single_buffer_length,
-                                         int buffer_id, const T* in_data,
-                                         T* conv_buffer_data, uint8 zero_byte) {
-  ruy::profiler::ScopeLabel label("ExtractPatchIntoBufferColumn");
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  // This chunk of code reshapes all the inputs corresponding to
-  // output (b, h, w) to a column vector in conv_buffer(:, buffer_id).
-  const int kwidth_times_indepth = kwidth * in_depth;
-  const int inwidth_times_indepth = in_width * in_depth;
-  const int ih_ungated_start = h * stride_height - pad_height;
-  const int ih_ungated_end = (ih_ungated_start + kheight);
-  const int ih_end = std::min(ih_ungated_end, in_height);
-  const int iw_ungated_start = w * stride_width - pad_width;
-  const int iw_ungated_end = (iw_ungated_start + kwidth);
-  const int iw_end = std::min(iw_ungated_end, in_width);
-  // If the patch is off the edge of the input image, skip writing those rows
-  // and columns from the patch into the output array.
-  const int h_offset = std::max(0, -ih_ungated_start);
-  const int w_offset = std::max(0, -iw_ungated_start);
-  const int ih_start = std::max(0, ih_ungated_start);
-  const int iw_start = std::max(0, iw_ungated_start);
-  const int single_row_num =
-      std::min(kwidth - w_offset, in_width - iw_start) * in_depth;
-  const int output_row_offset = (buffer_id * single_buffer_length);
-  int out_offset =
-      output_row_offset + (h_offset * kwidth + w_offset) * in_depth;
-  int in_offset = Offset(input_shape, b, ih_start, iw_start, 0);
-
-  // Express all of the calculations as padding around the input patch.
-  const int top_padding = h_offset;
-  const int bottom_padding = (ih_ungated_end - ih_end);
-  const int left_padding = w_offset;
-  const int right_padding = (iw_ungated_end - iw_end);
-  assert(single_row_num ==
-         ((kwidth - (left_padding + right_padding)) * in_depth));
-
-  // Write out zeroes to the elements representing the top rows of the input
-  // patch that are off the edge of the input image.
-  if (top_padding > 0) {
-    const int top_row_elements = (top_padding * kwidth * in_depth);
-    memset(conv_buffer_data + output_row_offset, zero_byte,
-           (top_row_elements * sizeof(T)));
-  }
-
-  // If the patch is on the interior of the input image horizontally, just copy
-  // over the rows sequentially, otherwise add zero padding at the start or end.
-  if ((left_padding == 0) && (right_padding == 0)) {
-    for (int ih = ih_start; ih < ih_end; ++ih) {
-      memcpy(conv_buffer_data + out_offset, in_data + in_offset,
-             single_row_num * sizeof(T));
-      out_offset += kwidth_times_indepth;
-      in_offset += inwidth_times_indepth;
-    }
-  } else {
-    for (int ih = ih_start; ih < ih_end; ++ih) {
-      if (left_padding > 0) {
-        const int left_start = (out_offset - (left_padding * in_depth));
-        memset(conv_buffer_data + left_start, zero_byte,
-               (left_padding * in_depth * sizeof(T)));
-      }
-      memcpy(conv_buffer_data + out_offset, in_data + in_offset,
-             single_row_num * sizeof(T));
-      if (right_padding > 0) {
-        const int right_start = (out_offset + single_row_num);
-        memset(conv_buffer_data + right_start, zero_byte,
-               (right_padding * in_depth * sizeof(T)));
-      }
-      out_offset += kwidth_times_indepth;
-      in_offset += inwidth_times_indepth;
-    }
-  }
-
-  // If the bottom of the patch falls off the input image, pad the values
-  // representing those input rows with zeroes.
-  if (bottom_padding > 0) {
-    const int bottom_row_elements = (bottom_padding * kwidth * in_depth);
-    const int bottom_start =
-        output_row_offset +
-        ((top_padding + (ih_end - ih_start)) * kwidth * in_depth);
-    memset(conv_buffer_data + bottom_start, zero_byte,
-           (bottom_row_elements * sizeof(T)));
-  }
-}
-
-// Supports per-batch zero_byte for per-batch asymmetric quantized inputs.
-template 
-void DilatedIm2col(const ConvParams& params, const RuntimeShape& input_shape,
-                   const T* input_data, const RuntimeShape& filter_shape,
-                   const RuntimeShape& output_shape, T* im2col_data,
-                   const int32_t* zero_bytes, const int zero_bytes_len) {
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  // For dilated convolution, the input pixels are not contiguous therefore we
-  // can't use the same optimizations as Im2Col(). Though note this code would
-  // work fine for the non-dilated case too (though likely a bit slower).
-  ruy::profiler::ScopeLabel label("DilatedIm2col");
-  TFLITE_DCHECK(dilation_width_factor != 1 || dilation_height_factor != 1);
-  TFLITE_DCHECK(im2col_data);
-  const int batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int input_height = input_shape.Dims(1);
-  const int input_width = input_shape.Dims(2);
-  const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3);
-  const int filter_height = filter_shape.Dims(1);
-  const int filter_width = filter_shape.Dims(2);
-  const int output_height = output_shape.Dims(1);
-  const int output_width = output_shape.Dims(2);
-  MatchingDim(output_shape, 3, filter_shape, 0);
-
-  // Construct the MxN sized im2col matrix.
-  // The rows M, are sub-ordered B x H x W
-  const RuntimeShape row_shape({1, batches, output_height, output_width});
-  // The columns, N, are sub-ordered Kh x Kw x Din
-  const RuntimeShape col_shape({1, filter_height, filter_width, input_depth});
-  // Use dimensions M and N to construct dims for indexing directly into im2col
-  const RuntimeShape im2col_shape(
-      {1, 1, row_shape.FlatSize(), col_shape.FlatSize()});
-
-  // Loop through the output rows (B x H x W)
-  for (int batch = 0; batch < batches; ++batch) {
-    const T zero_byte = zero_bytes_len > 1 ? static_cast(zero_bytes[batch])
-                                           : static_cast(zero_bytes[0]);
-    for (int out_y = 0; out_y < output_height; ++out_y) {
-      for (int out_x = 0; out_x < output_width; ++out_x) {
-        // Each im2col row is an output pixel. Arrange the input data in this
-        // row in an order we can conveniently multiply with the filter data.
-        int row_offset = Offset(row_shape, 0, batch, out_y, out_x);
-        const int in_x_origin = (out_x * stride_width) - pad_width;
-        const int in_y_origin = (out_y * stride_height) - pad_height;
-        // Loop through all the pixels of the filter (Kh x Kw)
-        for (int filter_y = 0; filter_y < filter_height; ++filter_y) {
-          const int in_y = in_y_origin + dilation_height_factor * filter_y;
-          if ((in_y >= 0) && (in_y < input_height)) {
-            // Filter row is within the input data.
-            // Loop through all the filter pixels in this row.
-            for (int filter_x = 0; filter_x < filter_width; ++filter_x) {
-              const int in_x = in_x_origin + dilation_width_factor * filter_x;
-              int col_offset = Offset(col_shape, 0, filter_y, filter_x, 0);
-              T* dst = im2col_data +
-                       Offset(im2col_shape, 0, 0, row_offset, col_offset);
-              if ((in_x >= 0) && (in_x < input_width)) {
-                // Filter pixel is within the input, copy the input data.
-                T const* src =
-                    input_data + Offset(input_shape, batch, in_y, in_x, 0);
-                memcpy(dst, src, input_depth * sizeof(T));
-              } else {
-                // Filter pixel is outside the input, zero it out.
-                memset(dst, zero_byte, input_depth * sizeof(T));
-              }
-            }
-          } else {
-            // Filter row is outside the input, zero out the entire filter row.
-            int col_offset = Offset(col_shape, 0, filter_y, 0, 0);
-            T* dst = im2col_data +
-                     Offset(im2col_shape, 0, 0, row_offset, col_offset);
-            memset(dst, zero_byte, filter_width * input_depth * sizeof(T));
-          }
-        }
-      }
-    }
-  }
-}
-
-template 
-void DilatedIm2col(const ConvParams& params, uint8 zero_byte,
-                   const RuntimeShape& input_shape, const T* input_data,
-                   const RuntimeShape& filter_shape,
-                   const RuntimeShape& output_shape, T* im2col_data) {
-  const int32_t zero_point = static_cast(zero_byte);
-  DilatedIm2col(params, input_shape, input_data, filter_shape, output_shape,
-                   im2col_data, &zero_point, 1);
-}
-
-template 
-void Im2col(const ConvParams& params, int kheight, int kwidth, uint8 zero_byte,
-            const RuntimeShape& input_shape, const T* input_data,
-            const RuntimeShape& output_shape, T* output_data) {
-  ruy::profiler::ScopeLabel label("Im2col");
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  const int batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int input_depth = input_shape.Dims(3);
-  const int input_width = input_shape.Dims(2);
-  const int input_height = input_shape.Dims(1);
-  const int output_depth = output_shape.Dims(3);
-  const int output_width = output_shape.Dims(2);
-  const int output_height = output_shape.Dims(1);
-
-  int buffer_id = 0;
-  // Loop over the output nodes.
-  for (int b = 0; b < batches; ++b) {
-    for (int h = 0; h < output_height; ++h) {
-      for (int w = 0; w < output_width; ++w) {
-        ExtractPatchIntoBufferColumn(
-            input_shape, w, h, b, kheight, kwidth, stride_width, stride_height,
-            pad_width, pad_height, input_width, input_height, input_depth,
-            output_depth, buffer_id, input_data, output_data, zero_byte);
-        ++buffer_id;
-      }
-    }
-  }
-}
-
-template 
-void Im2col(const ConvParams& params, int kheight, int kwidth,
-            const int32_t* input_offsets, const int input_offsets_size,
-            const RuntimeShape& input_shape, const T* input_data,
-            const RuntimeShape& output_shape, T* output_data) {
-  ruy::profiler::ScopeLabel label("Im2col");
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  const int batches = MatchingDim(input_shape, 0, output_shape, 0);
-  TFLITE_DCHECK_EQ(batches, input_offsets_size);
-  const int input_depth = input_shape.Dims(3);
-  const int input_width = input_shape.Dims(2);
-  const int input_height = input_shape.Dims(1);
-  const int output_depth = output_shape.Dims(3);
-  const int output_width = output_shape.Dims(2);
-  const int output_height = output_shape.Dims(1);
-
-  int buffer_id = 0;
-  // Loop over the output nodes.
-  for (int b = 0; b < batches; ++b) {
-    uint8_t zero_byte = static_cast(input_offsets[b]);
-    for (int h = 0; h < output_height; ++h) {
-      for (int w = 0; w < output_width; ++w) {
-        ExtractPatchIntoBufferColumn(
-            input_shape, w, h, b, kheight, kwidth, stride_width, stride_height,
-            pad_width, pad_height, input_width, input_height, input_depth,
-            output_depth, buffer_id, input_data, output_data, zero_byte);
-        ++buffer_id;
-      }
-    }
-  }
-}
-
-}  // namespace optimized_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_IM2COL_UTILS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/add.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/add.h
deleted file mode 100644
index a63763b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/add.h
+++ /dev/null
@@ -1,305 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_ADD_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_ADD_H_
-
-#include 
-
-#include "fixedpoint/fixedpoint.h"
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/internal/common.h"
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/neon_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/optimized_ops.h"
-#include "tensorflow/lite/kernels/internal/reference/integer_ops/add.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_integer_ops {
-
-// Element-wise add that can often be used for inner loop of broadcast add as
-// well as the non-broadcast add.
-inline void AddElementwise(int size, const ArithmeticParams& params,
-                           const int8* input1_data, const int8* input2_data,
-                           int8* output_data) {
-  ruy::profiler::ScopeLabel label("AddElementwiseInt8/8bit");
-  int i = 0;
-  TFLITE_DCHECK_GT(params.input1_offset, -256);
-  TFLITE_DCHECK_GT(params.input2_offset, -256);
-  TFLITE_DCHECK_LT(params.input1_offset, 256);
-  TFLITE_DCHECK_LT(params.input2_offset, 256);
-
-#ifdef USE_NEON
-  const int8x16_t output_activation_min_vector =
-      vdupq_n_s8(params.quantized_activation_min);
-  const int8x16_t output_activation_max_vector =
-      vdupq_n_s8(params.quantized_activation_max);
-
-  const int input1_left_shift = params.left_shift + params.input1_shift;
-  const int input2_left_shift = params.left_shift + params.input2_shift;
-  const int32x4_t input1_left_dup = vdupq_n_s32(input1_left_shift);
-  const int32x4_t input2_left_dup = vdupq_n_s32(input2_left_shift);
-
-  const int16x8_t input1_offset_dup = vdupq_n_s16(params.input1_offset);
-  const int16x8_t input2_offset_dup = vdupq_n_s16(params.input2_offset);
-
-  for (; i <= size - 16; i += 16) {
-    const int8x16_t input1_val_original = vld1q_s8(input1_data + i);
-    const int8x16_t input2_val_original = vld1q_s8(input2_data + i);
-
-    const int16x8_t input1_val_s16_high =
-        vmovl_s8(vget_high_s8(input1_val_original));
-    const int16x8_t input1_val_s16_low =
-        vmovl_s8(vget_low_s8(input1_val_original));
-
-    const int16x8_t input2_val_s16_high =
-        vmovl_s8(vget_high_s8(input2_val_original));
-    const int16x8_t input2_val_s16_low =
-        vmovl_s8(vget_low_s8(input2_val_original));
-    const int16x8_t input1_val_high =
-        vaddq_s16(input1_val_s16_high, input1_offset_dup);
-    const int16x8_t input2_val_high =
-        vaddq_s16(input2_val_s16_high, input2_offset_dup);
-    const int16x8_t input1_val_low =
-        vaddq_s16(input1_val_s16_low, input1_offset_dup);
-    const int16x8_t input2_val_low =
-        vaddq_s16(input2_val_s16_low, input2_offset_dup);
-    const int16x4_t input1_val_high_high = vget_high_s16(input1_val_high);
-    const int16x4_t input1_val_high_low = vget_low_s16(input1_val_high);
-    const int16x4_t input1_val_low_high = vget_high_s16(input1_val_low);
-    const int16x4_t input1_val_low_low = vget_low_s16(input1_val_low);
-    const int16x4_t input2_val_high_high = vget_high_s16(input2_val_high);
-    const int16x4_t input2_val_high_low = vget_low_s16(input2_val_high);
-    const int16x4_t input2_val_low_high = vget_high_s16(input2_val_low);
-    const int16x4_t input2_val_low_low = vget_low_s16(input2_val_low);
-    int32x4_t x111 = vmovl_s16(input1_val_low_low);
-    int32x4_t x112 = vmovl_s16(input1_val_low_high);
-    int32x4_t x121 = vmovl_s16(input1_val_high_low);
-    int32x4_t x122 = vmovl_s16(input1_val_high_high);
-    int32x4_t x211 = vmovl_s16(input2_val_low_low);
-    int32x4_t x212 = vmovl_s16(input2_val_low_high);
-    int32x4_t x221 = vmovl_s16(input2_val_high_low);
-    int32x4_t x222 = vmovl_s16(input2_val_high_high);
-
-    x111 = vshlq_s32(x111, input1_left_dup);
-    x112 = vshlq_s32(x112, input1_left_dup);
-    x121 = vshlq_s32(x121, input1_left_dup);
-    x122 = vshlq_s32(x122, input1_left_dup);
-    x211 = vshlq_s32(x211, input2_left_dup);
-    x212 = vshlq_s32(x212, input2_left_dup);
-    x221 = vshlq_s32(x221, input2_left_dup);
-    x222 = vshlq_s32(x222, input2_left_dup);
-    x111 = vqrdmulhq_n_s32(x111, params.input1_multiplier);
-    x112 = vqrdmulhq_n_s32(x112, params.input1_multiplier);
-    x121 = vqrdmulhq_n_s32(x121, params.input1_multiplier);
-    x122 = vqrdmulhq_n_s32(x122, params.input1_multiplier);
-    x211 = vqrdmulhq_n_s32(x211, params.input2_multiplier);
-    x212 = vqrdmulhq_n_s32(x212, params.input2_multiplier);
-    x221 = vqrdmulhq_n_s32(x221, params.input2_multiplier);
-    x222 = vqrdmulhq_n_s32(x222, params.input2_multiplier);
-    int32x4_t s11 = vaddq_s32(x111, x211);
-    int32x4_t s12 = vaddq_s32(x112, x212);
-    int32x4_t s21 = vaddq_s32(x121, x221);
-    int32x4_t s22 = vaddq_s32(x122, x222);
-    s11 = vqrdmulhq_n_s32(s11, params.output_multiplier);
-    s12 = vqrdmulhq_n_s32(s12, params.output_multiplier);
-    s21 = vqrdmulhq_n_s32(s21, params.output_multiplier);
-    s22 = vqrdmulhq_n_s32(s22, params.output_multiplier);
-    using gemmlowp::RoundingDivideByPOT;
-    s11 = RoundingDivideByPOT(s11, -params.output_shift);
-    s12 = RoundingDivideByPOT(s12, -params.output_shift);
-    s21 = RoundingDivideByPOT(s21, -params.output_shift);
-    s22 = RoundingDivideByPOT(s22, -params.output_shift);
-    const int16x4_t s11_narrowed = vmovn_s32(s11);
-    const int16x4_t s12_narrowed = vmovn_s32(s12);
-    const int16x4_t s21_narrowed = vmovn_s32(s21);
-    const int16x4_t s22_narrowed = vmovn_s32(s22);
-    const int16x8_t s1 = vaddq_s16(vcombine_s16(s11_narrowed, s12_narrowed),
-                                   vdupq_n_s16(params.output_offset));
-    const int16x8_t s2 = vaddq_s16(vcombine_s16(s21_narrowed, s22_narrowed),
-                                   vdupq_n_s16(params.output_offset));
-    const int8x16_t s = vcombine_s8(vqmovn_s16(s1), vqmovn_s16(s2));
-
-    const int8x16_t clamped =
-        vmaxq_s8(output_activation_min_vector,
-                 vminq_s8(output_activation_max_vector, s));
-    vst1q_s8(output_data + i, clamped);
-  }
-#endif  // NEON
-
-  for (; i < size; ++i) {
-    const int32 input1_val = params.input1_offset + input1_data[i];
-    const int32 input2_val = params.input2_offset + input2_data[i];
-    const int32 shifted_input1_val = input1_val * (1 << params.left_shift);
-    const int32 shifted_input2_val = input2_val * (1 << params.left_shift);
-    const int32 scaled_input1_val =
-        MultiplyByQuantizedMultiplierSmallerThanOneExp(
-            shifted_input1_val, params.input1_multiplier, params.input1_shift);
-    const int32 scaled_input2_val =
-        MultiplyByQuantizedMultiplierSmallerThanOneExp(
-            shifted_input2_val, params.input2_multiplier, params.input2_shift);
-    const int32 raw_sum = scaled_input1_val + scaled_input2_val;
-    const int32 raw_output =
-        MultiplyByQuantizedMultiplierSmallerThanOneExp(
-            raw_sum, params.output_multiplier, params.output_shift) +
-        params.output_offset;
-    const int32 clamped_output =
-        std::min(params.quantized_activation_max,
-                 std::max(params.quantized_activation_min, raw_output));
-    output_data[i] = static_cast(clamped_output);
-  }
-}
-
-// Scalar-broadcast add that can be used for inner loop of more general
-// broadcast add, so that, for example, scalar-broadcast with batch will still
-// be fast.
-inline void AddScalarBroadcast(int size, const ArithmeticParams& params,
-                               int8 input1_data, const int8* input2_data,
-                               int8* output_data) {
-  using gemmlowp::RoundingDivideByPOT;
-
-  ruy::profiler::ScopeLabel label("AddScalarBroadcastInt8/8bit");
-  TFLITE_DCHECK_GT(params.input1_offset, -256);
-  TFLITE_DCHECK_GT(params.input2_offset, -256);
-  TFLITE_DCHECK_LT(params.input1_offset, 256);
-  TFLITE_DCHECK_LT(params.input2_offset, 256);
-
-  int i = 0;
-
-#ifdef USE_NEON
-  const int32x4_t left_shift_dup = vdupq_n_s32(params.left_shift);
-  const int8x8_t output_activation_min_vector =
-      vdup_n_s8(params.quantized_activation_min);
-  const int8x8_t output_activation_max_vector =
-      vdup_n_s8(params.quantized_activation_max);
-
-  // Process broadcast scalar.
-  const int8x8_t input1_val_original = vdup_n_s8(input1_data);
-  const int16x8_t input1_val_s16 = vmovl_s8(input1_val_original);
-  const int16x8_t input1_val =
-      vaddq_s16(input1_val_s16, vdupq_n_s16(params.input1_offset));
-  const int16x4_t input1_val_high = vget_high_s16(input1_val);
-  const int16x4_t input1_val_low = vget_low_s16(input1_val);
-  int32x4_t x11 = vmovl_s16(input1_val_low);
-  int32x4_t x12 = vmovl_s16(input1_val_high);
-  x11 = vshlq_s32(x11, left_shift_dup);
-  x12 = vshlq_s32(x12, left_shift_dup);
-  x11 = vqrdmulhq_n_s32(x11, params.input1_multiplier);
-  x12 = vqrdmulhq_n_s32(x12, params.input1_multiplier);
-  const int32x4_t input1_shift_dup = vdupq_n_s32(params.input1_shift);
-  x11 = vshlq_s32(x11, input1_shift_dup);
-  x12 = vshlq_s32(x12, input1_shift_dup);
-
-  for (; i <= size - 8; i += 8) {
-    const int8x8_t input2_val_original = vld1_s8(input2_data + i);
-    const int16x8_t input2_val_s16 = vmovl_s8(input2_val_original);
-    const int16x8_t input2_val =
-        vaddq_s16(input2_val_s16, vdupq_n_s16(params.input2_offset));
-    const int16x4_t input2_val_high = vget_high_s16(input2_val);
-    const int16x4_t input2_val_low = vget_low_s16(input2_val);
-    int32x4_t x21 = vmovl_s16(input2_val_low);
-    int32x4_t x22 = vmovl_s16(input2_val_high);
-    x21 = vshlq_s32(x21, left_shift_dup);
-    x22 = vshlq_s32(x22, left_shift_dup);
-    x21 = vqrdmulhq_n_s32(x21, params.input2_multiplier);
-    x22 = vqrdmulhq_n_s32(x22, params.input2_multiplier);
-    const int32x4_t input2_shift_dup = vdupq_n_s32(params.input2_shift);
-    x21 = vshlq_s32(x21, input2_shift_dup);
-    x22 = vshlq_s32(x22, input2_shift_dup);
-    int32x4_t s1 = vaddq_s32(x11, x21);
-    int32x4_t s2 = vaddq_s32(x12, x22);
-    s1 = vqrdmulhq_n_s32(s1, params.output_multiplier);
-    s2 = vqrdmulhq_n_s32(s2, params.output_multiplier);
-    s1 = RoundingDivideByPOT(s1, -params.output_shift);
-    s2 = RoundingDivideByPOT(s2, -params.output_shift);
-    const int16x4_t s1_narrowed = vmovn_s32(s1);
-    const int16x4_t s2_narrowed = vmovn_s32(s2);
-    const int16x8_t s = vaddq_s16(vcombine_s16(s1_narrowed, s2_narrowed),
-                                  vdupq_n_s16(params.output_offset));
-    const int8x8_t clamped =
-        vmax_s8(output_activation_min_vector,
-                vmin_s8(output_activation_max_vector, vqmovn_s16(s)));
-    vst1_s8(output_data + i, clamped);
-  }
-#endif  // NEON
-
-  if (i < size) {
-    // Process broadcast scalar.
-    const int32 input1_val = params.input1_offset + input1_data;
-    const int32 shifted_input1_val = input1_val * (1 << params.left_shift);
-    const int32 scaled_input1_val =
-        MultiplyByQuantizedMultiplierSmallerThanOneExp(
-            shifted_input1_val, params.input1_multiplier, params.input1_shift);
-
-    for (; i < size; ++i) {
-      const int32 input2_val = params.input2_offset + input2_data[i];
-      const int32 shifted_input2_val = input2_val * (1 << params.left_shift);
-      const int32 scaled_input2_val =
-          MultiplyByQuantizedMultiplierSmallerThanOneExp(
-              shifted_input2_val, params.input2_multiplier,
-              params.input2_shift);
-      const int32 raw_sum = scaled_input1_val + scaled_input2_val;
-      const int32 raw_output =
-          MultiplyByQuantizedMultiplierSmallerThanOneExp(
-              raw_sum, params.output_multiplier, params.output_shift) +
-          params.output_offset;
-      const int32 clamped_output =
-          std::min(params.quantized_activation_max,
-                   std::max(params.quantized_activation_min, raw_output));
-      output_data[i] = static_cast(clamped_output);
-    }
-  }
-}
-
-inline void Add(const ArithmeticParams& params,
-                const RuntimeShape& input1_shape, const int8* input1_data,
-                const RuntimeShape& input2_shape, const int8* input2_data,
-                const RuntimeShape& output_shape, int8* output_data) {
-  TFLITE_DCHECK_LE(params.quantized_activation_min,
-                   params.quantized_activation_max);
-  ruy::profiler::ScopeLabel label("AddInt8/8bit");
-  const int flat_size =
-      MatchingElementsSize(input1_shape, input2_shape, output_shape);
-
-  TFLITE_DCHECK_GT(params.input1_offset, -256);
-  TFLITE_DCHECK_GT(params.input2_offset, -256);
-  TFLITE_DCHECK_LT(params.input1_offset, 256);
-  TFLITE_DCHECK_LT(params.input2_offset, 256);
-  AddElementwise(flat_size, params, input1_data, input2_data, output_data);
-}
-
-inline void BroadcastAddDispatch(const ArithmeticParams& params,
-                                 const RuntimeShape& input1_shape,
-                                 const int8* input1_data,
-                                 const RuntimeShape& input2_shape,
-                                 const int8* input2_data,
-                                 const RuntimeShape& output_shape,
-                                 int8* output_data) {
-  if (params.broadcast_category == BroadcastableOpCategory::kGenericBroadcast) {
-    return reference_integer_ops::BroadcastAdd4DSlow(
-        params, input1_shape, input1_data, input2_shape, input2_data,
-        output_shape, output_data);
-  }
-
-  optimized_ops::BinaryBroadcastFiveFold(
-      params, input1_shape, input1_data, input2_shape, input2_data,
-      output_shape, output_data, AddElementwise, AddScalarBroadcast);
-}
-
-}  // namespace optimized_integer_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_ADD_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/conv.h
deleted file mode 100644
index c426ceb..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/conv.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_CONV_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_CONV_H_
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
-#include "tensorflow/lite/kernels/internal/common.h"
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-#include "tensorflow/lite/kernels/internal/optimized/im2col_utils.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_integer_ops {
-
-// Fixed-point per-channel-quantization convolution reference kernel.
-inline void ConvPerChannel(
-    const ConvParams& params, const int32* output_multiplier,
-    const int32* output_shift, const RuntimeShape& input_shape,
-    const int8* input_data, const RuntimeShape& filter_shape,
-    const int8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape, int8* output_data,
-    const RuntimeShape& im2col_shape, int8* im2col_data,
-    CpuBackendContext* cpu_backend_context) {
-  ruy::profiler::ScopeLabel label("Conv/8bit");
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  const int32 input_offset = params.input_offset;
-  const int32 output_offset = params.output_offset;
-  // Set min and max value of the output.
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  const int8* gemm_input_data = nullptr;
-  const RuntimeShape* gemm_input_shape = nullptr;
-  const int filter_width = filter_shape.Dims(2);
-  const int filter_height = filter_shape.Dims(1);
-  const bool need_dilated_im2col =
-      dilation_width_factor != 1 || dilation_height_factor != 1;
-  const bool need_im2col = stride_width != 1 || stride_height != 1 ||
-                           filter_width != 1 || filter_height != 1;
-  const int8 input_zero_point = -input_offset;
-  const uint8 zero_point_byte =
-      *reinterpret_cast(&input_zero_point);
-  if (need_dilated_im2col) {
-    TFLITE_DCHECK(im2col_data);
-    optimized_ops::DilatedIm2col(params, zero_point_byte, input_shape,
-                                 input_data, filter_shape, output_shape,
-                                 im2col_data);
-    gemm_input_data = im2col_data;
-    gemm_input_shape = &im2col_shape;
-  } else if (need_im2col) {
-    TFLITE_DCHECK(im2col_data);
-    optimized_ops::Im2col(params, filter_height, filter_width, zero_point_byte,
-                          input_shape, input_data, im2col_shape, im2col_data);
-    gemm_input_data = im2col_data;
-    gemm_input_shape = &im2col_shape;
-  } else {
-    TFLITE_DCHECK(!im2col_data);
-    gemm_input_data = input_data;
-    gemm_input_shape = &input_shape;
-  }
-
-  const int gemm_input_rows = gemm_input_shape->Dims(3);
-  const int gemm_input_cols = FlatSizeSkipDim(*gemm_input_shape, 3);
-  const int filter_rows = filter_shape.Dims(0);
-  const int filter_cols = FlatSizeSkipDim(filter_shape, 0);
-  const int output_rows = output_shape.Dims(3);
-  // See b/79927784.
-  // const int output_cols = FlatSizeSkipDim(output_shape, 3);
-  const int output_cols =
-      output_shape.Dims(0) * output_shape.Dims(1) * output_shape.Dims(2);
-  TFLITE_DCHECK_EQ(output_rows, filter_rows);
-  TFLITE_DCHECK_EQ(output_cols, gemm_input_cols);
-  TFLITE_DCHECK_EQ(filter_cols, gemm_input_rows);
-  TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_rows);
-
-  cpu_backend_gemm::MatrixParams lhs_params;
-  lhs_params.rows = filter_rows;
-  lhs_params.cols = filter_cols;
-  lhs_params.order = cpu_backend_gemm::Order::kRowMajor;
-  lhs_params.zero_point = 0;  // filter is symmetric-quantized
-  cpu_backend_gemm::MatrixParams rhs_params;
-  rhs_params.rows = gemm_input_rows;
-  rhs_params.cols = gemm_input_cols;
-  rhs_params.order = cpu_backend_gemm::Order::kColMajor;
-  rhs_params.zero_point = -input_offset;
-  cpu_backend_gemm::MatrixParams dst_params;
-  dst_params.rows = output_rows;
-  dst_params.cols = output_cols;
-  dst_params.order = cpu_backend_gemm::Order::kColMajor;
-  dst_params.zero_point = output_offset;
-  cpu_backend_gemm::GemmParams<
-      int32, int8,
-      cpu_backend_gemm::QuantizationFlavor::kIntegerWithPerRowMultiplier>
-      gemm_params;
-  gemm_params.bias = bias_data;
-  gemm_params.clamp_min = output_activation_min;
-  gemm_params.clamp_max = output_activation_max;
-  gemm_params.multiplier_fixedpoint_perchannel = output_multiplier;
-  gemm_params.multiplier_exponent_perchannel = output_shift;
-  cpu_backend_gemm::Gemm(lhs_params, filter_data, rhs_params, gemm_input_data,
-                         dst_params, output_data, gemm_params,
-                         cpu_backend_context);
-}
-
-}  // namespace optimized_integer_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h
deleted file mode 100644
index 0f4257d..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h
+++ /dev/null
@@ -1,2018 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_H_
-
-#include 
-
-#include 
-#include 
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_threadpool.h"
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8_3x3_filter.h"
-#include "tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv_3x3_filter.h"
-#include "tensorflow/lite/kernels/internal/optimized/neon_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/optimized_ops.h"
-#include "tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_integer_ops {
-namespace depthwise_conv {
-
-// Implementation of quantized DepthwiseConv
-
-template 
-struct QuantizedDepthwiseConvKernel {};
-
-#ifdef USE_NEON
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int8x8x2_t filter_s8;
-    filter_s8.val[0] = vld1_s8(filter_ptr);
-    filter_s8.val[1] = vld1_s8(filter_ptr + 8);
-    int16x8_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      filter[i] = vmovl_s8(filter_s8.val[i]);
-    }
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4x2_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i].val[0] = vld1q_s32(acc_buffer_ptr + 4 * i);
-        acc[i].val[1] = vld1q_s32(acc_buffer_ptr + 4 * i + 8);
-      }
-      // Load the inputs, add input_offset.
-      const int8x8_t input_s8 = vld1_s8(input_ptr);
-      input_ptr += input_ptr_increment;
-      const int16x8_t input_s16 = vmovl_s8(input_s8);
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x8x2_t input_dup2 = vzipq_s16(input, input);
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[0].val[i] = vmlal_s16(acc[0].val[i], vget_low_s16(filter[i]),
-                                  vget_low_s16(input_dup2.val[i]));
-        acc[1].val[i] = vmlal_s16(acc[1].val[i], vget_high_s16(filter[i]),
-                                  vget_high_s16(input_dup2.val[i]));
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i].val[0]);
-        vst1q_s32(acc_buffer_ptr + 4 * i + 8, acc[i].val[1]);
-      }
-      acc_buffer_ptr += 16;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    const int8x8_t filter_s8 = vld1_s8(filter_ptr);
-    const int16x8_t filter = vmovl_s8(filter_s8);
-
-    int outp = 0;
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8[2];
-      for (int i = 0; i < 2; i++) {
-        input_s8[i] = vld1_s8(input_ptr + 8 * i);
-      }
-      input_ptr += 16;
-      int16x8_t input[2];
-      for (int i = 0; i < 2; i++) {
-        input[i] = vmovl_s8(input_s8[i]);
-      }
-      for (int i = 0; i < 2; i++) {
-        input[i] = vaddq_s16(input[i], vdupq_n_s16(input_offset));
-      }
-      // Multiply-accumulate.
-      acc[0] = vmlal_s16(acc[0], vget_low_s16(filter), vget_low_s16(input[0]));
-      acc[1] =
-          vmlal_s16(acc[1], vget_high_s16(filter), vget_high_s16(input[0]));
-      acc[2] = vmlal_s16(acc[2], vget_low_s16(filter), vget_low_s16(input[1]));
-      acc[3] =
-          vmlal_s16(acc[3], vget_high_s16(filter), vget_high_s16(input[1]));
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle 1 output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[2];
-      acc[0] = vld1q_s32(acc_buffer_ptr);
-      acc[1] = vld1q_s32(acc_buffer_ptr + 4);
-
-      // Load the inputs, add input_offset.
-      const int8x8_t input_s8 = vld1_s8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vmovl_s8(input_s8);
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Multiply-accumulate.
-      acc[0] = vmlal_s16(acc[0], vget_low_s16(filter), vget_low_s16(input));
-      acc[1] = vmlal_s16(acc[1], vget_high_s16(filter), vget_high_s16(input));
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr, acc[0]);
-      vst1q_s32(acc_buffer_ptr + 4, acc[1]);
-      acc_buffer_ptr += 8;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    const int8x8_t filter_s8 = vld1_s8(filter_ptr);
-    const int16x8_t filter = vmovl_s8(filter_s8);
-
-    int outp = 0;
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      const int8x8_t input_s8 = vld1_s8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vmovl_s8(input_s8);
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x8x2_t input_dup2 = vzipq_s16(input, input);
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[2 * i + 0] = vmlal_s16(acc[2 * i + 0], vget_low_s16(filter),
-                                   vget_low_s16(input_dup2.val[i]));
-        acc[2 * i + 1] = vmlal_s16(acc[2 * i + 1], vget_high_s16(filter),
-                                   vget_high_s16(input_dup2.val[i]));
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vdup_n_s8(0);
-      input_s8 = vset_lane_s8(input_ptr[0], input_s8, 0);
-      input_s8 = vset_lane_s8(input_ptr[1], input_s8, 1);
-      input_s8 = vset_lane_s8(input_ptr[2], input_s8, 2);
-      input_s8 = vset_lane_s8(input_ptr[3], input_s8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x4x2_t input_dup2 = vzip_s16(input, input);
-      // Multiply-accumulate
-      acc[0] = vmlal_s16(acc[0], vget_low_s16(filter), input_dup2.val[0]);
-      acc[1] = vmlal_s16(acc[1], vget_high_s16(filter), input_dup2.val[1]);
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int16x8_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      const int8x8_t filter_s8 = vld1_s8(filter_ptr + 8 * i);
-      filter[i] = vmovl_s8(filter_s8);
-    }
-    int outp = 0;
-    // Handle two output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[8];
-      for (int i = 0; i < 8; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vdup_n_s8(0);
-      input_s8 = vset_lane_s8(input_ptr[0], input_s8, 0);
-      input_s8 = vset_lane_s8(input_ptr[1], input_s8, 1);
-      input_s8 = vset_lane_s8(input_ptr[2], input_s8, 2);
-      input_s8 = vset_lane_s8(input_ptr[3], input_s8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-      // Multiply-accumulate.
-      acc[0] = vmlal_lane_s16(acc[0], vget_low_s16(filter[0]), input, 0);
-      acc[1] = vmlal_lane_s16(acc[1], vget_high_s16(filter[0]), input, 0);
-      acc[2] = vmlal_lane_s16(acc[2], vget_low_s16(filter[1]), input, 1);
-      acc[3] = vmlal_lane_s16(acc[3], vget_high_s16(filter[1]), input, 1);
-      acc[4] = vmlal_lane_s16(acc[4], vget_low_s16(filter[0]), input, 2);
-      acc[5] = vmlal_lane_s16(acc[5], vget_high_s16(filter[0]), input, 2);
-      acc[6] = vmlal_lane_s16(acc[6], vget_low_s16(filter[1]), input, 3);
-      acc[7] = vmlal_lane_s16(acc[7], vget_high_s16(filter[1]), input, 3);
-      // Store the accumulators back to acc_buffer.
-      for (int i = 0; i < 8; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 32;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vdup_n_s8(0);
-      input_s8 = vset_lane_s8(input_ptr[0], input_s8, 0);
-      input_s8 = vset_lane_s8(input_ptr[1], input_s8, 1);
-      input_ptr += 2;
-      const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc[0] = vmlal_lane_s16(acc[0], vget_low_s16(filter[0]), input, 0);
-      acc[1] = vmlal_lane_s16(acc[1], vget_high_s16(filter[0]), input, 0);
-      acc[2] = vmlal_lane_s16(acc[2], vget_low_s16(filter[1]), input, 1);
-      acc[3] = vmlal_lane_s16(acc[3], vget_high_s16(filter[1]), input, 1);
-
-      // Store the accumulators back to acc_buffer.
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int8x8_t filter_s8 = vdup_n_s8(0);
-    filter_s8 = vset_lane_s8(filter_ptr[0], filter_s8, 0);
-    filter_s8 = vset_lane_s8(filter_ptr[1], filter_s8, 1);
-    filter_s8 = vset_lane_s8(filter_ptr[2], filter_s8, 2);
-    filter_s8 = vset_lane_s8(filter_ptr[3], filter_s8, 3);
-    const int16x4_t filter = vget_low_s16(vmovl_s8(filter_s8));
-
-    int outp = 0;
-    // Handle 4 output pixels at a time.
-    for (; outp <= num_output_pixels - 4; outp += 4) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      const int8x8_t input_s8 = vld1_s8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vmovl_s8(input_s8);
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x8x2_t input_dup2 = vzipq_s16(input, input);
-      // Multiply-accumulate
-      acc[0] = vmlal_s16(acc[0], filter, vget_low_s16(input_dup2.val[0]));
-      acc[1] = vmlal_s16(acc[1], filter, vget_high_s16(input_dup2.val[0]));
-      acc[2] = vmlal_s16(acc[2], filter, vget_low_s16(input_dup2.val[1]));
-      acc[3] = vmlal_s16(acc[3], filter, vget_high_s16(input_dup2.val[1]));
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc = vld1q_s32(acc_buffer_ptr);
-
-      int8x8_t input_s8 = vdup_n_s8(0);
-      input_s8 = vset_lane_s8(input_ptr[0], input_s8, 0);
-      input_s8 = vset_lane_s8(input_ptr[1], input_s8, 1);
-      input_ptr += 2;
-      const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x4_t input_dup2 = vzip_s16(input, input).val[0];
-      // Multiply-accumulate
-      acc = vmlal_s16(acc, filter, input_dup2);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int8x8_t filter_s8 = vdup_n_s8(0);
-    filter_s8 = vset_lane_s8(filter_ptr[0], filter_s8, 0);
-    filter_s8 = vset_lane_s8(filter_ptr[1], filter_s8, 1);
-    filter_s8 = vset_lane_s8(filter_ptr[0], filter_s8, 2);
-    filter_s8 = vset_lane_s8(filter_ptr[1], filter_s8, 3);
-    const int16x4_t filter = vget_low_s16(vmovl_s8(filter_s8));
-
-    int outp = 0;
-    // Handle 8 output pixels at a time.
-    for (; outp <= num_output_pixels - 8; outp += 8) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8[2];
-      for (int i = 0; i < 2; i++) {
-        input_s8[i] = vld1_s8(input_ptr + 8 * i);
-      }
-      input_ptr += 16;
-      int16x8_t input[2];
-      for (int i = 0; i < 2; i++) {
-        input[i] = vmovl_s8(input_s8[i]);
-      }
-      for (int i = 0; i < 2; i++) {
-        input[i] = vaddq_s16(input[i], vdupq_n_s16(input_offset));
-      }
-
-      // Multiply-accumulate.
-      acc[0] = vmlal_s16(acc[0], filter, vget_low_s16(input[0]));
-      acc[1] = vmlal_s16(acc[1], filter, vget_high_s16(input[0]));
-      acc[2] = vmlal_s16(acc[2], filter, vget_low_s16(input[1]));
-      acc[3] = vmlal_s16(acc[3], filter, vget_high_s16(input[1]));
-      // Store the accumulators back to acc_buffer.
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle 4 output pixels at a time.
-    for (; outp <= num_output_pixels - 4; outp += 4) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      const int8x8_t input_s8 = vld1_s8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vmovl_s8(input_s8);
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc[0] = vmlal_s16(acc[0], filter, vget_low_s16(input));
-      acc[1] = vmlal_s16(acc[1], filter, vget_high_s16(input));
-      // Store the accumulators back to acc_buffer.
-      for (int i = 0; i < 2; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-    }
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc = vld1q_s32(acc_buffer_ptr);
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vdup_n_s8(0);
-      input_s8 = vset_lane_s8(input_ptr[0], input_s8, 0);
-      input_s8 = vset_lane_s8(input_ptr[1], input_s8, 1);
-      input_s8 = vset_lane_s8(input_ptr[2], input_s8, 2);
-      input_s8 = vset_lane_s8(input_ptr[3], input_s8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc = vmlal_s16(acc, filter, input);
-      // Store the accumulators back to acc_buffer.
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-    // Handle 1 output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer.
-      int32x2_t acc = vld1_s32(acc_buffer_ptr);
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vdup_n_s8(0);
-      input_s8 = vset_lane_s8(input_ptr[0], input_s8, 0);
-      input_s8 = vset_lane_s8(input_ptr[1], input_s8, 1);
-      input_ptr += 2;
-      const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc = vget_low_s32(vmlal_s16(vcombine_s32(acc, acc), filter, input));
-      // Store the accumulators back to acc_buffer.
-      vst1_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 2;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int8x8_t filter_s8 = vdup_n_s8(0);
-    filter_s8 = vset_lane_s8(filter_ptr[0], filter_s8, 0);
-    filter_s8 = vset_lane_s8(filter_ptr[1], filter_s8, 1);
-    filter_s8 = vset_lane_s8(filter_ptr[0], filter_s8, 2);
-    filter_s8 = vset_lane_s8(filter_ptr[1], filter_s8, 3);
-    const int16x4_t filter = vget_low_s16(vmovl_s8(filter_s8));
-
-    int outp = 0;
-    // Handle 8 output pixels at a time.
-    for (; outp <= num_output_pixels - 8; outp += 8) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      const int8x8_t input_s8 = vld1_s8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vmovl_s8(input_s8);
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Duplicate the input values, 2-fold
-      const int16x8x2_t input_dup2 = vzipq_s16(input, input);
-      // Multiply-accumulate
-      acc[0] = vmlal_s16(acc[0], filter, vget_low_s16(input_dup2.val[0]));
-      acc[1] = vmlal_s16(acc[1], filter, vget_high_s16(input_dup2.val[0]));
-      acc[2] = vmlal_s16(acc[2], filter, vget_low_s16(input_dup2.val[1]));
-      acc[3] = vmlal_s16(acc[3], filter, vget_high_s16(input_dup2.val[1]));
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x2_t acc = vld1_s32(acc_buffer_ptr);
-
-      // Load the inputs, add input_offset.
-      const uint32 input = *input_ptr++ + input_offset;
-
-      // Multiply-accumulate
-      acc = vget_low_s32(vmlal_n_s16(vcombine_s32(acc, acc), filter, input));
-      // Store the accumulators back to acc_buffer
-      vst1_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 2;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int8x8_t filter_s8 = vdup_n_s8(0);
-    filter_s8 = vset_lane_s8(filter_ptr[0], filter_s8, 0);
-    filter_s8 = vset_lane_s8(filter_ptr[1], filter_s8, 1);
-    filter_s8 = vset_lane_s8(filter_ptr[2], filter_s8, 2);
-    filter_s8 = vset_lane_s8(filter_ptr[3], filter_s8, 3);
-    const int16x4_t filter = vget_low_s16(vmovl_s8(filter_s8));
-
-    int outp = 0;
-    // Handle 8 output pixels at a time.
-    for (; outp <= num_output_pixels - 8; outp += 8) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[8];
-      for (int i = 0; i < 8; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vld1_s8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vmovl_s8(input_s8);
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-
-      // Multiply-accumulate
-      acc[0] = vmlal_lane_s16(acc[0], filter, vget_low_s16(input), 0);
-      acc[1] = vmlal_lane_s16(acc[1], filter, vget_low_s16(input), 1);
-      acc[2] = vmlal_lane_s16(acc[2], filter, vget_low_s16(input), 2);
-      acc[3] = vmlal_lane_s16(acc[3], filter, vget_low_s16(input), 3);
-      acc[4] = vmlal_lane_s16(acc[4], filter, vget_high_s16(input), 0);
-      acc[5] = vmlal_lane_s16(acc[5], filter, vget_high_s16(input), 1);
-      acc[6] = vmlal_lane_s16(acc[6], filter, vget_high_s16(input), 2);
-      acc[7] = vmlal_lane_s16(acc[7], filter, vget_high_s16(input), 3);
-
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 8; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 32;
-    }
-    // Handle 4 output pixels at a time.
-    for (; outp <= num_output_pixels - 4; outp += 4) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vdup_n_s8(0);
-      input_s8 = vset_lane_s8(input_ptr[0], input_s8, 0);
-      input_s8 = vset_lane_s8(input_ptr[1], input_s8, 1);
-      input_s8 = vset_lane_s8(input_ptr[2], input_s8, 2);
-      input_s8 = vset_lane_s8(input_ptr[3], input_s8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate
-      acc[0] = vmlal_lane_s16(acc[0], filter, input, 0);
-      acc[1] = vmlal_lane_s16(acc[1], filter, input, 1);
-      acc[2] = vmlal_lane_s16(acc[2], filter, input, 2);
-      acc[3] = vmlal_lane_s16(acc[3], filter, input, 3);
-
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc = vld1q_s32(acc_buffer_ptr);
-
-      // Load the inputs, add input_offset.
-      const uint32 input = *input_ptr++ + input_offset;
-
-      // Multiply-accumulate
-      acc = vmlal_n_s16(acc, filter, input);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int8x8_t filter_s8 = vdup_n_s8(0);
-    filter_s8 = vset_lane_s8(filter_ptr[0], filter_s8, 0);
-    filter_s8 = vset_lane_s8(filter_ptr[1], filter_s8, 1);
-    filter_s8 = vset_lane_s8(filter_ptr[2], filter_s8, 2);
-    filter_s8 = vset_lane_s8(filter_ptr[3], filter_s8, 3);
-    const int16x4_t filter = vget_low_s16(vmovl_s8(filter_s8));
-
-    int outp = 0;
-    // Handle 4 output pixels at a time.
-    for (; outp <= num_output_pixels - 4; outp += 4) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Load the inputs, add input_offset.
-      int16x8_t input[2];
-      for (int i = 0; i < 2; i++) {
-        const int8x8_t input_s8 = vld1_s8(input_ptr + 8 * i);
-        const int16x8_t input_s16 = vmovl_s8(input_s8);
-        input[i] = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      }
-      input_ptr += 16;
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[2 * i + 0] =
-            vmlal_s16(acc[2 * i + 0], filter, vget_low_s16(input[i]));
-        acc[2 * i + 1] =
-            vmlal_s16(acc[2 * i + 1], filter, vget_high_s16(input[i]));
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc;
-      acc = vld1q_s32(acc_buffer_ptr);
-
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vdup_n_s8(0);
-      input_s8 = vset_lane_s8(input_ptr[0], input_s8, 0);
-      input_s8 = vset_lane_s8(input_ptr[1], input_s8, 1);
-      input_s8 = vset_lane_s8(input_ptr[2], input_s8, 2);
-      input_s8 = vset_lane_s8(input_ptr[3], input_s8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-      // Multiply-accumulate
-      acc = vmlal_s16(acc, filter, input);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int16x8_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      const int8x8_t filter_s8 = vld1_s8(filter_ptr + 8 * i);
-      filter[i] = vmovl_s8(filter_s8);
-    }
-
-    int outp = 0;
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[8];
-      for (int i = 0; i < 8; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vld1_s8(input_ptr);
-      input_ptr += 8;
-      const int16x8_t input_s16 = vmovl_s8(input_s8);
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-
-      // Multiply-accumulate
-      acc[0] = vmlal_lane_s16(acc[0], vget_low_s16(filter[0]),
-                              vget_low_s16(input), 0);
-      acc[1] = vmlal_lane_s16(acc[1], vget_high_s16(filter[0]),
-                              vget_low_s16(input), 1);
-      acc[2] = vmlal_lane_s16(acc[2], vget_low_s16(filter[1]),
-                              vget_low_s16(input), 2);
-      acc[3] = vmlal_lane_s16(acc[3], vget_high_s16(filter[1]),
-                              vget_low_s16(input), 3);
-      acc[4] = vmlal_lane_s16(acc[4], vget_low_s16(filter[0]),
-                              vget_high_s16(input), 0);
-      acc[5] = vmlal_lane_s16(acc[5], vget_high_s16(filter[0]),
-                              vget_high_s16(input), 1);
-      acc[6] = vmlal_lane_s16(acc[6], vget_low_s16(filter[1]),
-                              vget_high_s16(input), 2);
-      acc[7] = vmlal_lane_s16(acc[7], vget_high_s16(filter[1]),
-                              vget_high_s16(input), 3);
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 8; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 32;
-    }
-    // Handle one output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vdup_n_s8(0);
-      input_s8 = vset_lane_s8(input_ptr[0], input_s8, 0);
-      input_s8 = vset_lane_s8(input_ptr[1], input_s8, 1);
-      input_s8 = vset_lane_s8(input_ptr[2], input_s8, 2);
-      input_s8 = vset_lane_s8(input_ptr[3], input_s8, 3);
-      input_ptr += 4;
-      const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate
-      acc[0] = vmlal_lane_s16(acc[0], vget_low_s16(filter[0]), input, 0);
-      acc[1] = vmlal_lane_s16(acc[1], vget_high_s16(filter[0]), input, 1);
-      acc[2] = vmlal_lane_s16(acc[2], vget_low_s16(filter[1]), input, 2);
-      acc[3] = vmlal_lane_s16(acc[3], vget_high_s16(filter[1]), input, 3);
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // We will have to duplicate bytes in a NEON register, 3-fold.
-    // We will do that by register-level table-look-up using VTBL instructions.
-    // Here we prepare the registers containing the table-lookup indices.
-    static const int8 dup3_indices_array[3][8] = {{0, 0, 0, 1, 1, 1, 2, 2},
-                                                  {2, 3, 3, 3, 4, 4, 4, 5},
-                                                  {5, 5, 6, 6, 6, 7, 7, 7}};
-    int8x8_t dup3_indices[3];
-    for (int i = 0; i < 3; i++) {
-      dup3_indices[i] = vld1_s8(dup3_indices_array[i]);
-    }
-
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      const int8* local_filter_ptr = filter_ptr;
-      const int8* local_input_ptr = input_ptr;
-      int ic = 0;
-      // Handle 8 input channels at a time.
-      for (; ic <= input_depth - 8; ic += 8) {
-        // Load the filters.
-        int16x8_t filter[3];
-        int8x8x3_t filter_s8;
-        filter_s8.val[0] = vld1_s8(local_filter_ptr);
-        filter_s8.val[1] = vld1_s8(local_filter_ptr + 8);
-        filter_s8.val[2] = vld1_s8(local_filter_ptr + 16);
-        local_filter_ptr += 24;
-        for (int i = 0; i < 3; i++) {
-          filter[i] = vmovl_s8(filter_s8.val[i]);
-        }
-        // Load the inputs, duplicate 3-fold, add input_offset.
-        const int8x8_t input_s8 = vld1_s8(local_input_ptr);
-        local_input_ptr += 8;
-
-        int8x8_t input_s8_dup3[3];
-        for (int i = 0; i < 3; i++) {
-          input_s8_dup3[i] = vtbl1_s8(input_s8, dup3_indices[i]);
-        }
-        int16x8_t input_dup3[3];
-        for (int i = 0; i < 3; i++) {
-          const int16x8_t input_s16_dup3 = vmovl_s8(input_s8_dup3[i]);
-          input_dup3[i] = vaddq_s16(input_s16_dup3, vdupq_n_s16(input_offset));
-        }
-        // Load the accumulators from acc_buffer
-        int32x4x3_t acc[2];
-        for (int i = 0; i < 2; i++) {
-          acc[i].val[0] = vld1q_s32(acc_buffer_ptr + 4 * i);
-          acc[i].val[1] = vld1q_s32(acc_buffer_ptr + 4 * i + 8);
-          acc[i].val[2] = vld1q_s32(acc_buffer_ptr + 4 * i + 16);
-        }
-        // Multiply-accumulate
-        for (int j = 0; j < 3; j++) {
-          acc[0].val[j] = vmlal_s16(acc[0].val[j], vget_low_s16(input_dup3[j]),
-                                    vget_low_s16(filter[j]));
-          acc[1].val[j] = vmlal_s16(acc[1].val[j], vget_high_s16(input_dup3[j]),
-                                    vget_high_s16(filter[j]));
-        }
-        // Store the accumulators back to acc_buffer
-        for (int i = 0; i < 2; i++) {
-          vst1q_s32(acc_buffer_ptr + 4 * i, acc[i].val[0]);
-          vst1q_s32(acc_buffer_ptr + 4 * i + 8, acc[i].val[1]);
-          vst1q_s32(acc_buffer_ptr + 4 * i + 16, acc[i].val[2]);
-        }
-        acc_buffer_ptr += 24;
-      }
-      // Handle one input channel at a time.
-      for (; ic < input_depth; ic++) {
-        const int16 input_val = *local_input_ptr++ + input_offset;
-        for (int i = 0; i < 3; i++) {
-          *acc_buffer_ptr++ +=
-              static_cast(local_filter_ptr[i]) * input_val;
-        }
-        local_filter_ptr += 3;
-      }
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      const int8* local_filter_ptr = filter_ptr;
-      const int8* local_input_ptr = input_ptr;
-      int ic = 0;
-      // Handle 8 input channels at a time.
-      for (; ic <= input_depth - 8; ic += 8) {
-        // Load the filters.
-        int16x8_t filter[2];
-        int8x8x2_t filter_s8;
-        filter_s8.val[0] = vld1_s8(local_filter_ptr);
-        filter_s8.val[1] = vld1_s8(local_filter_ptr + 8);
-        local_filter_ptr += 16;
-        for (int i = 0; i < 2; i++) {
-          filter[i] = vmovl_s8(filter_s8.val[i]);
-        }
-        // Load the inputs, add input_offset, duplicate 2-fold.
-        const int8x8_t input_s8 = vld1_s8(local_input_ptr);
-        local_input_ptr += 8;
-        const int16x8_t input_s16 = vmovl_s8(input_s8);
-        const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-        const int16x8x2_t input_dup2 = vzipq_s16(input, input);
-        // Load the accumulators from acc_buffer.
-        int32x4x2_t acc[2];
-        for (int i = 0; i < 2; i++) {
-          acc[i].val[0] = vld1q_s32(acc_buffer_ptr + 4 * i);
-          acc[i].val[1] = vld1q_s32(acc_buffer_ptr + 4 * i + 8);
-        }
-        // Multiply-accumulate.
-        for (int j = 0; j < 2; j++) {
-          acc[0].val[j] = vmlal_s16(acc[0].val[j], vget_low_s16(filter[j]),
-                                    vget_low_s16(input_dup2.val[j]));
-          acc[1].val[j] = vmlal_s16(acc[1].val[j], vget_high_s16(filter[j]),
-                                    vget_high_s16(input_dup2.val[j]));
-        }
-        // Store the accumulators back to acc_buffer.
-        for (int i = 0; i < 2; i++) {
-          vst1q_s32(acc_buffer_ptr + 4 * i, acc[i].val[0]);
-          vst1q_s32(acc_buffer_ptr + 4 * i + 8, acc[i].val[1]);
-        }
-        acc_buffer_ptr += 16;
-      }
-      // Handle one input channel at a time.
-      for (; ic < input_depth; ic++) {
-        // Load the inputs.
-        const int16 input_val = *local_input_ptr++ + input_offset;
-        for (int i = 0; i < 2; i++) {
-          *acc_buffer_ptr++ +=
-              static_cast(local_filter_ptr[i]) * input_val;
-        }
-        local_filter_ptr += 2;
-      }
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      const int8* local_filter_ptr = filter_ptr;
-      const int8* local_input_ptr = input_ptr;
-      int ic = 0;
-      // Handle 16 input channels at a time.
-      for (; ic <= input_depth - 16; ic += 16) {
-        // Load the filters.
-        int8x8_t filter_s8_0 = vld1_s8(local_filter_ptr + 8 * 0);
-        int8x8_t filter_s8_1 = vld1_s8(local_filter_ptr + 8 * 1);
-        local_filter_ptr += 16;
-        int16x8_t filter_0 = vmovl_s8(filter_s8_0);
-        int16x8_t filter_1 = vmovl_s8(filter_s8_1);
-        // Load the inputs, add input_offset.
-        int8x8_t input_s8_0 = vld1_s8(local_input_ptr + 8 * 0);
-        int8x8_t input_s8_1 = vld1_s8(local_input_ptr + 8 * 1);
-        local_input_ptr += 16;
-        int16x8_t input_0 = vmovl_s8(input_s8_0);
-        int16x8_t input_1 = vmovl_s8(input_s8_1);
-        input_0 = vaddq_s16(input_0, vdupq_n_s16(input_offset));
-        input_1 = vaddq_s16(input_1, vdupq_n_s16(input_offset));
-        // Load the accumulators from acc_buffer
-        int32x4_t acc_0 = vld1q_s32(acc_buffer_ptr + 4 * 0);
-        int32x4_t acc_1 = vld1q_s32(acc_buffer_ptr + 4 * 1);
-        int32x4_t acc_2 = vld1q_s32(acc_buffer_ptr + 4 * 2);
-        int32x4_t acc_3 = vld1q_s32(acc_buffer_ptr + 4 * 3);
-        acc_0 = vmlal_s16(acc_0, vget_low_s16(input_0), vget_low_s16(filter_0));
-        acc_1 =
-            vmlal_s16(acc_1, vget_high_s16(input_0), vget_high_s16(filter_0));
-        acc_2 = vmlal_s16(acc_2, vget_low_s16(input_1), vget_low_s16(filter_1));
-        acc_3 =
-            vmlal_s16(acc_3, vget_high_s16(input_1), vget_high_s16(filter_1));
-        // Store the accumulators back to acc_buffer
-        vst1q_s32(acc_buffer_ptr + 4 * 0, acc_0);
-        vst1q_s32(acc_buffer_ptr + 4 * 1, acc_1);
-        vst1q_s32(acc_buffer_ptr + 4 * 2, acc_2);
-        vst1q_s32(acc_buffer_ptr + 4 * 3, acc_3);
-        acc_buffer_ptr += 16;
-      }
-      // Handle 8 input channels at a time.
-      for (; ic <= input_depth - 8; ic += 8) {
-        // Load the filters.
-        const int8x8_t filter_s8 = vld1_s8(local_filter_ptr);
-        local_filter_ptr += 8;
-        const int16x8_t filter = vmovl_s8(filter_s8);
-        // Load the inputs, add input_offset.
-        const int8x8_t input_s8 = vld1_s8(local_input_ptr);
-        local_input_ptr += 8;
-        const int16x8_t input_s16 = vmovl_s8(input_s8);
-        const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-        // Load the accumulators from acc_buffer
-        int32x4_t acc[2];
-        for (int i = 0; i < 2; i++) {
-          acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-        }
-        // Multiply-accumulate
-        acc[0] = vmlal_s16(acc[0], vget_low_s16(input), vget_low_s16(filter));
-        acc[1] = vmlal_s16(acc[1], vget_high_s16(input), vget_high_s16(filter));
-        // Store the accumulators back to acc_buffer
-        for (int i = 0; i < 2; i++) {
-          vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-        }
-        acc_buffer_ptr += 8;
-      }
-      // Handle one input channel at a time.
-      for (; ic < input_depth; ic++) {
-        const int16 input_val = *local_input_ptr++ + input_offset;
-        const int16 filter_val = *local_filter_ptr++;
-        *acc_buffer_ptr++ += static_cast(filter_val) * input_val;
-      }
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int8x8_t filter_s8[2];
-    for (int i = 0; i < 2; i++) {
-      filter_s8[i] = vld1_s8(filter_ptr + 8 * i);
-    }
-    int16x8_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      filter[i] = vmovl_s8(filter_s8[i]);
-    }
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8[2];
-      for (int i = 0; i < 2; i++) {
-        input_s8[i] = vld1_s8(input_ptr + 8 * i);
-      }
-      input_ptr += input_ptr_increment;
-      int16x8_t input[2];
-      for (int i = 0; i < 2; i++) {
-        input[i] = vmovl_s8(input_s8[i]);
-      }
-      for (int i = 0; i < 2; i++) {
-        input[i] = vaddq_s16(input[i], vdupq_n_s16(input_offset));
-      }
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[2 * i + 0] = vmlal_s16(acc[2 * i + 0], vget_low_s16(input[i]),
-                                   vget_low_s16(filter[i]));
-        acc[2 * i + 1] = vmlal_s16(acc[2 * i + 1], vget_high_s16(input[i]),
-                                   vget_high_s16(filter[i]));
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    const int8x8_t filter_s8 = vld1_s8(filter_ptr);
-    const int16x8_t filter = vmovl_s8(filter_s8);
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the inputs, add input_offset.
-      const int8x8_t input_s8 = vld1_s8(input_ptr);
-      const int16x8_t input_s16 = vmovl_s8(input_s8);
-      const int16x8_t input = vaddq_s16(input_s16, vdupq_n_s16(input_offset));
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      acc[0] = vmlal_s16(acc[0], vget_low_s16(input), vget_low_s16(filter));
-      acc[1] = vmlal_s16(acc[1], vget_high_s16(input), vget_high_s16(filter));
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-      input_ptr += input_ptr_increment;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int8x8_t filter_s8[2];
-    for (int i = 0; i < 2; i++) {
-      filter_s8[i] = vld1_s8(filter_ptr + 8 * i);
-    }
-    int16x8_t filter[2];
-    for (int i = 0; i < 2; i++) {
-      filter[i] = vmovl_s8(filter_s8[i]);
-    }
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      int8 input_s8 = *input_ptr;
-      input_ptr += input_ptr_increment;
-      int16 input = static_cast(input_s8 + input_offset);
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[4];
-      for (int i = 0; i < 4; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      for (int i = 0; i < 2; i++) {
-        acc[2 * i + 0] =
-            vmlal_n_s16(acc[2 * i + 0], vget_low_s16(filter[i]), input);
-        acc[2 * i + 1] =
-            vmlal_n_s16(acc[2 * i + 1], vget_high_s16(filter[i]), input);
-      }
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 4; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 16;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int8x8_t filter_s8_0 = vld1_s8(filter_ptr + 8 * 0);
-    int8x8_t filter_s8_1 = vld1_s8(filter_ptr + 8 * 1);
-    int8x8_t filter_s8_2 = vld1_s8(filter_ptr + 8 * 2);
-    int8x8_t filter_s8_3 = vld1_s8(filter_ptr + 8 * 3);
-    int16x8_t filter_0 = vmovl_s8(filter_s8_0);
-    int16x8_t filter_1 = vmovl_s8(filter_s8_1);
-    int16x8_t filter_2 = vmovl_s8(filter_s8_2);
-    int16x8_t filter_3 = vmovl_s8(filter_s8_3);
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      int8 input_s8 = *input_ptr;
-      input_ptr += input_ptr_increment;
-      int16 input = static_cast(input_s8 + input_offset);
-      // Load the accumulators from acc_buffer
-      int32x4_t acc_0 = vld1q_s32(acc_buffer_ptr + 4 * 0);
-      int32x4_t acc_1 = vld1q_s32(acc_buffer_ptr + 4 * 1);
-      int32x4_t acc_2 = vld1q_s32(acc_buffer_ptr + 4 * 2);
-      int32x4_t acc_3 = vld1q_s32(acc_buffer_ptr + 4 * 3);
-      int32x4_t acc_4 = vld1q_s32(acc_buffer_ptr + 4 * 4);
-      int32x4_t acc_5 = vld1q_s32(acc_buffer_ptr + 4 * 5);
-      int32x4_t acc_6 = vld1q_s32(acc_buffer_ptr + 4 * 6);
-      int32x4_t acc_7 = vld1q_s32(acc_buffer_ptr + 4 * 7);
-      // Multiply-accumulate
-      acc_0 = vmlal_n_s16(acc_0, vget_low_s16(filter_0), input);
-      acc_1 = vmlal_n_s16(acc_1, vget_high_s16(filter_0), input);
-      acc_2 = vmlal_n_s16(acc_2, vget_low_s16(filter_1), input);
-      acc_3 = vmlal_n_s16(acc_3, vget_high_s16(filter_1), input);
-      acc_4 = vmlal_n_s16(acc_4, vget_low_s16(filter_2), input);
-      acc_5 = vmlal_n_s16(acc_5, vget_high_s16(filter_2), input);
-      acc_6 = vmlal_n_s16(acc_6, vget_low_s16(filter_3), input);
-      acc_7 = vmlal_n_s16(acc_7, vget_high_s16(filter_3), input);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr + 4 * 0, acc_0);
-      vst1q_s32(acc_buffer_ptr + 4 * 1, acc_1);
-      vst1q_s32(acc_buffer_ptr + 4 * 2, acc_2);
-      vst1q_s32(acc_buffer_ptr + 4 * 3, acc_3);
-      vst1q_s32(acc_buffer_ptr + 4 * 4, acc_4);
-      vst1q_s32(acc_buffer_ptr + 4 * 5, acc_5);
-      vst1q_s32(acc_buffer_ptr + 4 * 6, acc_6);
-      vst1q_s32(acc_buffer_ptr + 4 * 7, acc_7);
-      acc_buffer_ptr += 32;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    // NEON wants to load 8 bytes at a time, but 20 is not divisible by 8.
-    // We load the first 16 bytes into filter_s8_{0,1} as usual.
-    // Then we load the 8 last bytes into filter_s8_x  (x for 'extra').
-    // This is redundant: the first 4 bytes of filter_s8_x are the same
-    // as the last 4 bytes of filter_s8_x.
-    int8x8_t filter_s8_0 = vld1_s8(filter_ptr + 8 * 0);
-    int8x8_t filter_s8_1 = vld1_s8(filter_ptr + 8 * 1);
-    int8x8_t filter_s8_x = vld1_s8(filter_ptr + 8 * 1 + 4);
-    int16x8_t filter_0 = vmovl_s8(filter_s8_0);
-    int16x8_t filter_1 = vmovl_s8(filter_s8_1);
-    int16x8_t filter_x = vmovl_s8(filter_s8_x);
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      int8 input_s8 = *input_ptr;
-      input_ptr += input_ptr_increment;
-      int16 input = static_cast(input_s8 + input_offset);
-      // Load the accumulators from acc_buffer
-      int32x4_t acc_0 = vld1q_s32(acc_buffer_ptr + 4 * 0);
-      int32x4_t acc_1 = vld1q_s32(acc_buffer_ptr + 4 * 1);
-      int32x4_t acc_2 = vld1q_s32(acc_buffer_ptr + 4 * 2);
-      int32x4_t acc_3 = vld1q_s32(acc_buffer_ptr + 4 * 3);
-      int32x4_t acc_4 = vld1q_s32(acc_buffer_ptr + 4 * 4);
-      // Multiply-accumulate
-      acc_0 = vmlal_n_s16(acc_0, vget_low_s16(filter_0), input);
-      acc_1 = vmlal_n_s16(acc_1, vget_high_s16(filter_0), input);
-      acc_2 = vmlal_n_s16(acc_2, vget_low_s16(filter_1), input);
-      acc_3 = vmlal_n_s16(acc_3, vget_high_s16(filter_1), input);
-      acc_4 = vmlal_n_s16(acc_4, vget_high_s16(filter_x), input);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr + 4 * 0, acc_0);
-      vst1q_s32(acc_buffer_ptr + 4 * 1, acc_1);
-      vst1q_s32(acc_buffer_ptr + 4 * 2, acc_2);
-      vst1q_s32(acc_buffer_ptr + 4 * 3, acc_3);
-      vst1q_s32(acc_buffer_ptr + 4 * 4, acc_4);
-      acc_buffer_ptr += 20;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    const int8x8_t filter_s8 = vld1_s8(filter_ptr);
-    const int16x8_t filter = vmovl_s8(filter_s8);
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      int8 input_s8 = *input_ptr;
-      input_ptr += input_ptr_increment;
-      int16 input = static_cast(input_s8 + input_offset);
-      // Load the accumulators from acc_buffer
-      int32x4_t acc[2];
-      for (int i = 0; i < 2; i++) {
-        acc[i] = vld1q_s32(acc_buffer_ptr + 4 * i);
-      }
-      // Multiply-accumulate
-      acc[0] = vmlal_n_s16(acc[0], vget_low_s16(filter), input);
-      acc[1] = vmlal_n_s16(acc[1], vget_high_s16(filter), input);
-      // Store the accumulators back to acc_buffer
-      for (int i = 0; i < 2; i++) {
-        vst1q_s32(acc_buffer_ptr + 4 * i, acc[i]);
-      }
-      acc_buffer_ptr += 8;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int8x8_t filter_s8 = vdup_n_s8(0);
-    filter_s8 = vset_lane_s8(filter_ptr[0], filter_s8, 0);
-    filter_s8 = vset_lane_s8(filter_ptr[1], filter_s8, 1);
-    filter_s8 = vset_lane_s8(filter_ptr[0], filter_s8, 2);
-    filter_s8 = vset_lane_s8(filter_ptr[1], filter_s8, 3);
-    const int16x4_t filter = vget_low_s16(vmovl_s8(filter_s8));
-
-    int outp = 0;
-
-    // Handle 2 output pixels at a time.
-    for (; outp <= num_output_pixels - 2; outp += 2) {
-      // Load the accumulators from acc_buffer.
-      int32x4_t acc = vld1q_s32(acc_buffer_ptr);
-      // Load the inputs, add input_offset.
-      int16x4_t input_s16 = vdup_n_s16(0);
-      input_s16 = vset_lane_s16((reinterpret_cast(input_ptr))[0],
-                                input_s16, 0);
-      input_ptr += input_ptr_increment;
-      input_s16 = vset_lane_s16((reinterpret_cast(input_ptr))[0],
-                                input_s16, 1);
-      input_ptr += input_ptr_increment;
-      input_s16 = vget_low_s16(vmovl_s8(vreinterpret_s8_s16(input_s16)));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc = vmlal_s16(acc, filter, input);
-      // Store the accumulators back to acc_buffer.
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-
-    // Handle 1 output pixel at a time.
-    for (; outp < num_output_pixels; outp++) {
-      // Load the accumulators from acc_buffer.
-      int32x2_t acc = vld1_s32(acc_buffer_ptr);
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vdup_n_s8(0);
-      input_s8 = vset_lane_s8(input_ptr[0], input_s8, 0);
-      input_s8 = vset_lane_s8(input_ptr[1], input_s8, 1);
-      input_ptr += input_ptr_increment;
-      const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-
-      // Multiply-accumulate.
-      acc = vget_low_s32(vmlal_s16(vcombine_s32(acc, acc), filter, input));
-      // Store the accumulators back to acc_buffer.
-      vst1_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 2;
-    }
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    if (num_output_pixels <= 0) {
-      return;
-    }
-
-    // Load the filters.
-    int8x8_t filter_s8 = vdup_n_s8(0);
-    filter_s8 = vset_lane_s8(filter_ptr[0], filter_s8, 0);
-    filter_s8 = vset_lane_s8(filter_ptr[1], filter_s8, 1);
-    filter_s8 = vset_lane_s8(filter_ptr[2], filter_s8, 2);
-    filter_s8 = vset_lane_s8(filter_ptr[3], filter_s8, 3);
-    const int16x4_t filter = vget_low_s16(vmovl_s8(filter_s8));
-
-    int outp = 0;
-
-    // Handle one output pixel at a time until second to the last pixel. Second
-    // to the last because we read eight input pixels while only processing
-    // four.
-    for (; outp < num_output_pixels - 1; outp++) {
-      // Load the accumulators from acc_buffer
-      int32x4_t acc;
-      acc = vld1q_s32(acc_buffer_ptr);
-
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8 = vld1_s8(input_ptr);
-      input_ptr += input_ptr_increment;
-      const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-      const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-      // Multiply-accumulate
-      acc = vmlal_s16(acc, filter, input);
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr, acc);
-      acc_buffer_ptr += 4;
-    }
-
-    // Handle the last output pixel.
-    // Load the accumulators from acc_buffer
-    int32x4_t acc;
-    acc = vld1q_s32(acc_buffer_ptr);
-
-    // Load the inputs, add input_offset.
-    int8x8_t input_s8 = vdup_n_s8(0);
-    input_s8 = vset_lane_s8(input_ptr[0], input_s8, 0);
-    input_s8 = vset_lane_s8(input_ptr[1], input_s8, 1);
-    input_s8 = vset_lane_s8(input_ptr[2], input_s8, 2);
-    input_s8 = vset_lane_s8(input_ptr[3], input_s8, 3);
-    const int16x4_t input_s16 = vget_low_s16(vmovl_s8(input_s8));
-    const int16x4_t input = vadd_s16(input_s16, vdup_n_s16(input_offset));
-    // Multiply-accumulate
-    acc = vmlal_s16(acc, filter, input);
-    // Store the accumulators back to acc_buffer
-    vst1q_s32(acc_buffer_ptr, acc);
-  }
-};
-
-template <>
-struct QuantizedDepthwiseConvKernel {
-  static void Run(int num_output_pixels, int input_depth, int depth_multiplier,
-                  const int8* input_ptr, int16 input_offset,
-                  int input_ptr_increment, const int8* filter_ptr,
-                  int32* acc_buffer_ptr) {
-    // Load the filters.
-    int8x8_t filter_s8_0 = vld1_s8(filter_ptr);
-    int8x8_t filter_s8_1 = vld1_s8(filter_ptr + 4);
-    int16x8_t filter_s16_0 = vmovl_s8(filter_s8_0);
-    int16x8_t filter_s16_1 = vmovl_s8(filter_s8_1);
-    int16x4_t filter_0 = vget_low_s16(filter_s16_0);
-    int16x4_t filter_1 = vget_high_s16(filter_s16_0);
-    int16x4_t filter_2 = vget_high_s16(filter_s16_1);
-
-    // Handle one output pixel at a time.
-    for (int outp = 0; outp < num_output_pixels; outp++) {
-      // Load the inputs, add input_offset.
-      int8x8_t input_s8_0 = vld1_s8(input_ptr);
-      int8x8_t input_s8_1 = vld1_s8(input_ptr + 4);
-      input_ptr += input_ptr_increment;
-      int16x8_t input_0 = vmovl_s8(input_s8_0);
-      int16x8_t input_1 = vmovl_s8(input_s8_1);
-      input_0 = vaddq_s16(input_0, vdupq_n_s16(input_offset));
-      input_1 = vaddq_s16(input_1, vdupq_n_s16(input_offset));
-
-      // Load the accumulators from acc_buffer
-      int32x4_t acc_0 = vld1q_s32(acc_buffer_ptr + 4 * 0);
-      int32x4_t acc_1 = vld1q_s32(acc_buffer_ptr + 4 * 1);
-      int32x4_t acc_2 = vld1q_s32(acc_buffer_ptr + 4 * 2);
-
-      // Multiply-accumulate
-      acc_0 = vmlal_s16(acc_0, vget_low_s16(input_0), filter_0);
-      acc_1 = vmlal_s16(acc_1, vget_high_s16(input_0), filter_1);
-      acc_2 = vmlal_s16(acc_2, vget_high_s16(input_1), filter_2);
-
-      // Store the accumulators back to acc_buffer
-      vst1q_s32(acc_buffer_ptr + 4 * 0, acc_0);
-      vst1q_s32(acc_buffer_ptr + 4 * 1, acc_1);
-      vst1q_s32(acc_buffer_ptr + 4 * 2, acc_2);
-
-      acc_buffer_ptr += 12;
-    }
-  }
-};
-#endif
-
-// Accumulates the effect of one row of the filter, on a segment of one row
-// of the output, accessing the corresponding one row of the input.
-template 
-void QuantizedDepthwiseConvAccumRow(int stride, int dilation_factor,
-                                    int input_depth, int input_width,
-                                    const int8* input_data, int16 input_offset,
-                                    int pad_width, int depth_multiplier,
-                                    int filter_width, const int8* filter_data,
-                                    int out_x_buffer_start,
-                                    int out_x_buffer_end, int output_depth,
-                                    int32* acc_buffer) {
-  ruy::profiler::ScopeLabel label(__PRETTY_FUNCTION__);
-  // Consistency check parameters. This is important in particular to ensure
-  // that we keep the number of template instantiations minimal, so we don't
-  // increase binary size unnecessarily.
-  static_assert(kFixedDepthMultiplier || !kFixedInputDepth, "");
-  static_assert(kFixedInputDepth || kAllowStrided, "");
-  TFLITE_DCHECK(stride == 1 || kAllowStrided);
-  if (kFixedInputDepth) {
-    TFLITE_DCHECK_EQ(input_depth, kFixedInputDepth);
-  }
-  if (kFixedDepthMultiplier) {
-    TFLITE_DCHECK_EQ(depth_multiplier, kFixedDepthMultiplier);
-  }
-  TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier);
-  const int input_ptr_increment = stride * input_depth;
-  const int8* filter_base_ptr = filter_data;
-  for (int filter_x = 0; filter_x < filter_width; ++filter_x) {
-    // For the current (filter_x, filter_y) point in the filter,
-    // compute the boundaries of the corresponding output row segment.
-    int out_x_loop_start_unclamped = 0;
-    int out_x_loop_end_unclamped = 0;
-    if (kAllowStrided) {
-      if (stride == 2) {
-        out_x_loop_start_unclamped =
-            (pad_width - dilation_factor * filter_x + 1) / 2;
-        out_x_loop_end_unclamped =
-            (pad_width + input_width - dilation_factor * filter_x + 1) / 2;
-      } else if (stride == 4) {
-        out_x_loop_start_unclamped =
-            (pad_width - dilation_factor * filter_x + 3) / 4;
-        out_x_loop_end_unclamped =
-            (pad_width + input_width - dilation_factor * filter_x + 3) / 4;
-      } else {
-        out_x_loop_start_unclamped =
-            (pad_width - dilation_factor * filter_x + stride - 1) / stride;
-        out_x_loop_end_unclamped = (pad_width + input_width -
-                                    dilation_factor * filter_x + stride - 1) /
-                                   stride;
-      }
-    } else {
-      out_x_loop_start_unclamped = pad_width - dilation_factor * filter_x;
-      out_x_loop_end_unclamped =
-          pad_width + input_width - dilation_factor * filter_x;
-    }
-    // The kernel will have to iterate on the segment of the
-    // output row that starts at out_x_loop_start and out_x_loop_end.
-    const int out_x_loop_start =
-        std::max(out_x_buffer_start, out_x_loop_start_unclamped);
-    const int out_x_loop_end =
-        std::min(out_x_buffer_end, out_x_loop_end_unclamped);
-
-    int32* acc_buffer_ptr =
-        acc_buffer + (out_x_loop_start - out_x_buffer_start) * output_depth;
-    const int in_x_origin =
-        (out_x_loop_start * stride) - pad_width + dilation_factor * filter_x;
-    const int8* input_ptr = input_data + in_x_origin * input_depth;
-    const int num_output_pixels = out_x_loop_end - out_x_loop_start;
-    QuantizedDepthwiseConvKernel<
-        kAllowStrided, kFixedInputDepth,
-        kFixedDepthMultiplier>::Run(num_output_pixels, input_depth,
-                                    depth_multiplier, input_ptr, input_offset,
-                                    input_ptr_increment, filter_base_ptr,
-                                    acc_buffer_ptr);
-    filter_base_ptr += output_depth;
-  }
-}
-
-// generic fallback of DepthwiseConvAccumRow, portable, non-templatized.
-inline void QuantizedDepthwiseConvAccumRowGeneric(
-    int stride, int dilation_factor, int input_depth, int input_width,
-    const int8* input_data, int16 input_offset, int pad_width,
-    int depth_multiplier, int filter_width, const int8* filter_data,
-    int out_x_buffer_start, int out_x_buffer_end, int output_depth,
-    int32* acc_buffer) {
-  ruy::profiler::ScopeLabel label("DepthwiseConvAccumRowGeneric (slow)");
-  const int8* filter_base_ptr = filter_data;
-  for (int filter_x = 0; filter_x < filter_width; ++filter_x) {
-    const int out_x_loop_start = std::max(
-        out_x_buffer_start,
-        (pad_width - dilation_factor * filter_x + stride - 1) / stride);
-    const int out_x_loop_end = std::min(
-        out_x_buffer_end,
-        (pad_width + input_width - dilation_factor * filter_x + stride - 1) /
-            stride);
-
-    int32* acc_buffer_ptr =
-        acc_buffer + (out_x_loop_start - out_x_buffer_start) * output_depth;
-    const int in_x_origin =
-        (out_x_loop_start * stride) - pad_width + dilation_factor * filter_x;
-    const int8* input_ptr = input_data + in_x_origin * input_depth;
-    const int input_ptr_increment = (stride - 1) * input_depth;
-    for (int out_x = out_x_loop_start; out_x < out_x_loop_end; out_x++) {
-      const int8* filter_ptr = filter_base_ptr;
-      for (int ic = 0; ic < input_depth; ++ic) {
-        const int16 input_val = *input_ptr++ + input_offset;
-        for (int m = 0; m < depth_multiplier; m++) {
-          const int16 filter_val = *filter_ptr++;
-          *acc_buffer_ptr++ += static_cast(filter_val) * input_val;
-        }
-      }
-      input_ptr += input_ptr_increment;
-    }
-    filter_base_ptr += output_depth;
-  }
-}
-
-// Initializes the accumulator buffer with bias values.
-inline void DepthwiseConvInitAccBuffer(int num_output_pixels, int output_depth,
-                                       const int32* bias_data,
-                                       int32* acc_buffer) {
-  int i = 0;
-#ifdef USE_NEON
-  if (output_depth == 1) {
-    const int32x4_t b = vdupq_n_s32(bias_data[0]);
-    for (; i <= num_output_pixels - 16; i += 16) {
-      vst1q_s32(acc_buffer + i + 0, b);
-      vst1q_s32(acc_buffer + i + 4, b);
-      vst1q_s32(acc_buffer + i + 8, b);
-      vst1q_s32(acc_buffer + i + 12, b);
-    }
-    for (; i <= num_output_pixels - 4; i += 4) {
-      vst1q_s32(acc_buffer + i, b);
-    }
-  } else if (output_depth == 2) {
-    int32x4_t b = vdupq_n_s32(bias_data[0]);
-    b = vsetq_lane_s32(bias_data[1], b, 1);
-    b = vsetq_lane_s32(bias_data[1], b, 3);
-    for (; i <= num_output_pixels - 8; i += 8) {
-      vst1q_s32(acc_buffer + 2 * i + 0, b);
-      vst1q_s32(acc_buffer + 2 * i + 4, b);
-      vst1q_s32(acc_buffer + 2 * i + 8, b);
-      vst1q_s32(acc_buffer + 2 * i + 12, b);
-    }
-    for (; i <= num_output_pixels - 2; i += 2) {
-      vst1q_s32(acc_buffer + 2 * i, b);
-    }
-  } else if (output_depth == 4) {
-    const int32x4_t b = vld1q_s32(bias_data);
-    for (; i <= num_output_pixels - 4; i += 4) {
-      vst1q_s32(acc_buffer + 4 * i + 0, b);
-      vst1q_s32(acc_buffer + 4 * i + 4, b);
-      vst1q_s32(acc_buffer + 4 * i + 8, b);
-      vst1q_s32(acc_buffer + 4 * i + 12, b);
-    }
-    for (; i < num_output_pixels; i++) {
-      vst1q_s32(acc_buffer + 4 * i, b);
-    }
-  } else if (output_depth == 8) {
-    const int32x4_t b0 = vld1q_s32(bias_data);
-    const int32x4_t b1 = vld1q_s32(bias_data + 4);
-    for (; i <= num_output_pixels - 2; i += 2) {
-      vst1q_s32(acc_buffer + 8 * i + 0, b0);
-      vst1q_s32(acc_buffer + 8 * i + 4, b1);
-      vst1q_s32(acc_buffer + 8 * i + 8, b0);
-      vst1q_s32(acc_buffer + 8 * i + 12, b1);
-    }
-    for (; i < num_output_pixels; i++) {
-      vst1q_s32(acc_buffer + 8 * i + 0, b0);
-      vst1q_s32(acc_buffer + 8 * i + 4, b1);
-    }
-  } else if (output_depth == 16) {
-    const int32x4_t b0 = vld1q_s32(bias_data);
-    const int32x4_t b1 = vld1q_s32(bias_data + 4);
-    const int32x4_t b2 = vld1q_s32(bias_data + 8);
-    const int32x4_t b3 = vld1q_s32(bias_data + 12);
-    for (; i < num_output_pixels; i++) {
-      vst1q_s32(acc_buffer + 16 * i + 0, b0);
-      vst1q_s32(acc_buffer + 16 * i + 4, b1);
-      vst1q_s32(acc_buffer + 16 * i + 8, b2);
-      vst1q_s32(acc_buffer + 16 * i + 12, b3);
-    }
-  }
-#endif
-  for (; i < num_output_pixels; i++) {
-    memcpy(acc_buffer + i * output_depth, bias_data,
-           sizeof(acc_buffer[0]) * output_depth);
-  }
-}
-
-inline void DepthwiseConvGeneral(
-    const DepthwiseParams& params, const int32* output_multiplier,
-    const int32* output_shift, const RuntimeShape& input_shape,
-    const int8* input_data, const RuntimeShape& filter_shape,
-    const int8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape, int8* output_data,
-    int thread_start, int thread_end, int thread_dim) {
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-  const int depth_multiplier = params.depth_multiplier;
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  const int32 input_offset = params.input_offset;
-  const int32 output_offset = params.output_offset;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  const int batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  const int input_height = input_shape.Dims(1);
-  const int input_width = input_shape.Dims(2);
-  const int input_depth = input_shape.Dims(3);
-  const int filter_height = filter_shape.Dims(1);
-  const int filter_width = filter_shape.Dims(2);
-  const int output_rows = output_shape.Dims(1);
-  const int output_width = output_shape.Dims(2);
-
-  static const int kAccBufferMaxSize = 2048;
-  int32 acc_buffer[kAccBufferMaxSize];
-  TFLITE_DCHECK_GE(kAccBufferMaxSize, output_depth);
-  const int kOutputPixelsInAccBuffer = kAccBufferMaxSize / output_depth;
-  const int kAccBufferActualSize = kOutputPixelsInAccBuffer * output_depth;
-  TFLITE_DCHECK_LE(kOutputPixelsInAccBuffer * output_depth,
-                   kAccBufferActualSize);
-  TFLITE_DCHECK_LE(kAccBufferActualSize, kAccBufferMaxSize);
-  TFLITE_DCHECK_GE(kOutputPixelsInAccBuffer, 1);
-  TFLITE_DCHECK(thread_dim == 0 || thread_dim == 1);
-
-  // row_accum_func will point to the core accumulation function to be used
-  // for this DepthwiseConv op.
-  using row_accum_func_t = decltype(&QuantizedDepthwiseConvAccumRowGeneric);
-  row_accum_func_t row_accum_func = nullptr;
-
-#define TFMINI_USE_DEPTHWISECONV_KERNEL(ALLOW_STRIDED, FIXED_INPUT_DEPTH, \
-                                        FIXED_DEPTH_MULTIPLIER)           \
-  if (!row_accum_func && (stride_width == 1 || ALLOW_STRIDED) &&          \
-      (input_depth == FIXED_INPUT_DEPTH || FIXED_INPUT_DEPTH == 0) &&     \
-      depth_multiplier == FIXED_DEPTH_MULTIPLIER) {                       \
-    row_accum_func =                                                      \
-        QuantizedDepthwiseConvAccumRow;           \
-  }
-
-#ifdef USE_NEON
-  // We go over our list of kernels by decreasing order of preference
-  // for the cases where multiple kernels could apply.
-
-  // Start with the fastest kernels: AllowStrided=false, fixed input depth.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 1, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 2, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 4, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 1, 4)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 4, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 4, 4)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 8, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 2, 8)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 2, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 12, 1)
-
-  // Next come the strided kernels: AllowStrided=true, fixed input depth.
-  // They are a bit less efficient, but allow stride!=1.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 8, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 16, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 16)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 20)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 32)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 8)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 8, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 2, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 4, 1)
-
-  // Finally, the kernels allowing a variable input depth,
-  // these are the least efficient but most general kernels.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 3)
-#endif  // USE_NEON
-
-  // No matching fast kernel found, use slow fallback.
-  if (!row_accum_func) {
-    row_accum_func = QuantizedDepthwiseConvAccumRowGeneric;
-  }
-
-#undef TFMINI_USE_DEPTHWISECONV_KERNEL
-
-  const int input_height_stride = input_shape.Dims(3) * input_shape.Dims(2);
-  const int input_batch_stride = input_height_stride * input_shape.Dims(1);
-  const int filter_height_stride = filter_shape.Dims(3) * filter_shape.Dims(2);
-
-  // Now that we have determined row_accum_func, we can start work.
-  int batch_start = 0;
-  int batch_end = batches;
-  int row_start = 0;
-  int row_end = output_rows;
-  int output_ptr_offset = 0;
-
-  switch (thread_dim) {
-    case 0:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, batches);
-      batch_start = thread_start;
-      batch_end = thread_end;
-      output_ptr_offset = batch_start * FlatSizeSkipDim(output_shape, 0);
-      break;
-    case 1:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, output_rows);
-      row_start = thread_start;
-      row_end = thread_end;
-      output_ptr_offset = row_start * output_width * output_depth;
-      break;
-  }
-
-  int8* output_ptr = output_data + output_ptr_offset;
-  int batch_step =
-      (output_rows + row_start - row_end) * output_width * output_depth;
-  for (int b = batch_start; b < batch_end; ++b) {
-    for (int out_y = row_start; out_y < row_end; ++out_y) {
-      const int in_y_origin = (out_y * stride_height) - pad_height;
-      const int filter_y_start =
-          std::max(0, (-in_y_origin + dilation_height_factor - 1) /
-                          dilation_height_factor);
-      const int filter_y_end =
-          std::min(filter_height,
-                   (input_height - in_y_origin + dilation_height_factor - 1) /
-                       dilation_height_factor);
-      for (int out_x_buffer_start = 0; out_x_buffer_start < output_width;
-           out_x_buffer_start += kOutputPixelsInAccBuffer) {
-        const int out_x_buffer_end = std::min(
-            output_width, out_x_buffer_start + kOutputPixelsInAccBuffer);
-        // We call a 'pixel' a group of activation that share all but the
-        // 'depth'/'channel' coordinate. num_output_pixels is the number of
-        // output pixels that we will accumulate in this loop iteration.
-        const int num_output_pixels = out_x_buffer_end - out_x_buffer_start;
-        // Initialize our local accumulator with the bias values, so we don't
-        // have to add them later.
-        DepthwiseConvInitAccBuffer(num_output_pixels, output_depth, bias_data,
-                                   acc_buffer);
-        // Accumulation loop. Most of the time should be spent in here.
-        for (int filter_y = filter_y_start; filter_y < filter_y_end;
-             ++filter_y) {
-          const int in_y = in_y_origin + dilation_height_factor * filter_y;
-          row_accum_func(
-              stride_width, dilation_width_factor, input_depth, input_width,
-              input_data + in_y * input_height_stride + b * input_batch_stride,
-              input_offset, pad_width, depth_multiplier, filter_width,
-              filter_data + filter_y * filter_height_stride, out_x_buffer_start,
-              out_x_buffer_end, output_depth, acc_buffer);
-        }
-        // Finished accumulating int32 values. Now need to convert them to
-        // the final 8bit form and store them.
-        ruy::profiler::ScopeLabel label("downquantize+store");
-        const int num_output_values = output_depth * num_output_pixels;
-
-        optimized_ops::Quantize(output_multiplier, output_shift, output_depth,
-                                num_output_values, output_offset,
-                                output_activation_min, output_activation_max,
-                                acc_buffer, output_ptr);
-
-        output_ptr += num_output_values;
-      }
-    }
-    output_ptr += batch_step;
-  }
-}
-
-}  // namespace depthwise_conv
-
-template 
-inline void DepthwiseConvWithRounding(
-    const DepthwiseParams& params, const int32* output_multiplier,
-    const int32* output_shift, const RuntimeShape& input_shape,
-    const int8* input_data, const RuntimeShape& filter_shape,
-    const int8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape, int8* output_data,
-    int thread_start, int thread_end, int thread_dim,
-    const CpuBackendContext& cpu_backend_context) {
-  ruy::profiler::ScopeLabel label("DepthwiseConvInt8/8bit");
-  const int depth_multiplier = params.depth_multiplier;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  TFLITE_DCHECK_GE(dilation_width_factor, 1);
-  TFLITE_DCHECK_GE(dilation_height_factor, 1);
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-  const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  const int input_depth = input_shape.Dims(3);
-  TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier);
-  TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth);
-
-// Enable for arm64 except for the Nvidia Linux 4 Tegra (L4T) running on
-// Jetson TX-2. This compiler does not support the offsetof() macro.
-#if defined(__aarch64__) && !defined(GOOGLE_L4T)
-#if defined(__ANDROID__) && defined(__clang__)
-  CpuFlags cpu_flags;
-  GetCpuFlags(&cpu_flags);
-  const bool has_dot_product_instructions = cpu_flags.neon_dotprod;
-
-  // Dispatch to dot-product 3x3 kernels when supported.
-  if (has_dot_product_instructions) {
-    using optimized_ops::depthwise_conv::DotProduct3x3KernelType;
-    DotProduct3x3KernelType kernel_type =
-        optimized_ops::depthwise_conv::CategorizeDotProductKernel<
-            optimized_ops::depthwise_conv::QuantizationType::kPerChannelInt8>(
-            input_shape, filter_shape, output_shape, params, output_shift);
-    if (kernel_type != DotProduct3x3KernelType::kNone) {
-      ruy::profiler::ScopeLabel specialized_label(
-          "DepthwiseConvInt8/8bit/3x3XDotProduct");
-      DepthwiseParams params_copy = params;
-      params_copy.output_shift_per_channel = output_shift;
-      params_copy.output_multiplier_per_channel = output_multiplier;
-      optimized_ops::depthwise_conv::DepthwiseConvDotProduct3x3PerChannel<
-          DepthwiseConvImplementation::kUseNeon3x3DotProduct>(
-          params_copy, input_shape, input_data, filter_shape, filter_data,
-          bias_shape, bias_data, output_shape, output_data, thread_start,
-          thread_end, thread_dim);
-      return;
-    }
-  }
-
-#endif
-  // Dispatch to non-dot-product 3x3 kernels when supported.
-
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-
-  // Call kernel optimized for depthwise convolutions using 3x3 filters if
-  // parameters are supported.
-  if (optimized_ops::depthwise_conv::Fast3x3FilterKernelSupported<
-          optimized_ops::depthwise_conv::QuantizationType::kPerChannelInt8>(
-          input_shape, filter_shape, stride_width, stride_height,
-          dilation_width_factor, dilation_height_factor, pad_width, pad_height,
-          depth_multiplier, output_shape, 0, output_shift)) {
-    ruy::profiler::ScopeLabel specialized_label("DepthwiseConvInt8/8bit/3x3");
-    optimized_ops::depthwise_conv::DepthwiseConv3x3FilterPerChannel<
-        DepthwiseConvOutputRounding::kUpward>(
-        params, output_multiplier, output_shift, input_shape, input_data,
-        filter_shape, filter_data, bias_shape, bias_data, output_shape,
-        output_data, thread_start, thread_end, thread_dim);
-    return;
-  }
-#endif
-
-  ruy::profiler::ScopeLabel specialized_label("DepthwiseConvInt8/8bit/General");
-  depthwise_conv::DepthwiseConvGeneral(
-      params, output_multiplier, output_shift, input_shape, input_data,
-      filter_shape, filter_data, bias_shape, bias_data, output_shape,
-      output_data, thread_start, thread_end, thread_dim);
-}
-
-inline void DepthwiseConvImpl(
-    const DepthwiseParams& params, const int32* output_multiplier,
-    const int32* output_shift, const RuntimeShape& input_shape,
-    const int8* input_data, const RuntimeShape& filter_shape,
-    const int8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape, int8* output_data,
-    int thread_start, int thread_end, int thread_dim,
-    const CpuBackendContext& cpu_backend_context) {
-  return DepthwiseConvWithRounding(
-      params, output_multiplier, output_shift, input_shape, input_data,
-      filter_shape, filter_data, bias_shape, bias_data, output_shape,
-      output_data, thread_start, thread_end, thread_dim, cpu_backend_context);
-}
-
-template 
-struct DepthwiseConvWorkerTask : cpu_backend_threadpool::Task {
-  DepthwiseConvWorkerTask(const DepthwiseParams& params,
-                          const int32* output_multiplier,
-                          const int32* output_shift,
-                          const RuntimeShape& input_shape, const T* input_data,
-                          const RuntimeShape& filter_shape,
-                          const T* filter_data, const RuntimeShape& bias_shape,
-                          const TS* bias_data, const RuntimeShape& output_shape,
-                          T* output_data, int thread_start, int thread_end,
-                          int thread_dim,
-                          const CpuBackendContext& cpu_backend_context_x)
-      : params_(params),
-        output_multiplier_(output_multiplier),
-        output_shift_(output_shift),
-        input_shape_(input_shape),
-        input_data_(input_data),
-        filter_shape_(filter_shape),
-        filter_data_(filter_data),
-        bias_shape_(bias_shape),
-        bias_data_(bias_data),
-        output_shape_(output_shape),
-        output_data_(output_data),
-        thread_start_(thread_start),
-        thread_end_(thread_end),
-        thread_dim_(thread_dim),
-        cpu_backend_context(cpu_backend_context_x) {}
-
-  void Run() override {
-    DepthwiseConvImpl(params_, output_multiplier_, output_shift_, input_shape_,
-                      input_data_, filter_shape_, filter_data_, bias_shape_,
-                      bias_data_, output_shape_, output_data_, thread_start_,
-                      thread_end_, thread_dim_, cpu_backend_context);
-  }
-
- private:
-  const DepthwiseParams& params_;
-  const int32* output_multiplier_;
-  const int32* output_shift_;
-  const RuntimeShape& input_shape_;
-  const T* input_data_;
-  const RuntimeShape& filter_shape_;
-  const T* filter_data_;
-  const RuntimeShape& bias_shape_;
-  const TS* bias_data_;
-  const RuntimeShape& output_shape_;
-  T* output_data_;
-  int thread_start_;
-  int thread_end_;
-  int thread_dim_;
-  const CpuBackendContext& cpu_backend_context;
-};
-
-inline int HowManyConvThreads(const RuntimeShape& output_shape,
-                              const RuntimeShape& filter_shape,
-                              int thread_dim) {
-  constexpr int kMinMulPerThread = 8;
-  const int output_units = output_shape.Dims(thread_dim);
-  const int filter_height = filter_shape.Dims(1);
-  const int filter_width = filter_shape.Dims(2);
-  const int num_mul_per_unit =
-      FlatSizeSkipDim(output_shape, thread_dim) * filter_height * filter_width;
-  const int min_units_per_thread = kMinMulPerThread / num_mul_per_unit + 1;
-  int thread_count = output_units / min_units_per_thread;
-  return thread_count;
-}
-
-inline void DepthwiseConvPerChannel(
-    const DepthwiseParams& params, const int32* output_multiplier,
-    const int32* output_shift, const RuntimeShape& input_shape,
-    const int8* input_data, const RuntimeShape& filter_shape,
-    const int8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape, int8* output_data,
-    CpuBackendContext* cpu_backend_context) {
-  ruy::profiler::ScopeLabel label("DepthwiseConvInt8");
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  const int output_batches = output_shape.Dims(0);
-  const int output_rows = output_shape.Dims(1);
-  int thread_count_batch = HowManyConvThreads(output_shape, filter_shape, 0);
-  int thread_count_row = HowManyConvThreads(output_shape, filter_shape, 1);
-  int thread_dim, thread_count, thread_dim_size;
-  if (thread_count_batch > thread_count_row) {
-    thread_dim = 0;
-    thread_dim_size = output_batches;
-    thread_count = thread_count_batch;
-  } else {
-    thread_dim = 1;
-    thread_dim_size = output_rows;
-    thread_count = thread_count_row;
-  }
-
-  const int max_threads = cpu_backend_context->max_num_threads();
-  thread_count = std::max(1, std::min(thread_count, max_threads));
-
-  if (thread_count == 1) {
-    DepthwiseConvImpl(params, output_multiplier, output_shift, input_shape,
-                      input_data, filter_shape, filter_data, bias_shape,
-                      bias_data, output_shape, output_data, /*thread_start=*/0,
-                      /*thread_end=*/output_rows, /*thread_dim=*/1,
-                      *cpu_backend_context);
-  } else {
-    std::vector> tasks;
-    // TODO(b/131746020) don't create new heap allocations every time.
-    // At least we make it a single heap allocation by using reserve().
-    tasks.reserve(thread_count);
-    int thread_start = 0;
-    for (int i = 0; i < thread_count; ++i) {
-      int thread_end =
-          thread_start + (thread_dim_size - thread_start) / (thread_count - i);
-      tasks.emplace_back(params, output_multiplier, output_shift, input_shape,
-                         input_data, filter_shape, filter_data, bias_shape,
-                         bias_data, output_shape, output_data, thread_start,
-                         thread_end, thread_dim, *cpu_backend_context);
-      thread_start = thread_end;
-    }
-    cpu_backend_threadpool::Execute(tasks.size(), tasks.data(),
-                                    cpu_backend_context);
-  }
-}
-
-}  // namespace optimized_integer_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv_3x3_filter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv_3x3_filter.h
deleted file mode 100644
index 0cb1a23..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv_3x3_filter.h
+++ /dev/null
@@ -1,3082 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_3X3_FILTER_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_3X3_FILTER_H_
-
-#include 
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_ops {
-namespace depthwise_conv {
-
-#define STR(s) STR_UNEXPANDED(s)
-#define STR_UNEXPANDED(s) #s
-
-// Enable for arm64 except for the Nvidia Linux 4 Tegra (L4T) running on
-// Jetson TX-2. This compiler does not support the offsetof() macro.
-#if defined(__aarch64__) && !defined(GOOGLE_L4T)
-#include 
-
-// Represents the number of bytes offset from the start of the
-// DepthwiseConvParams struct. This is used in the asm to load parameters.
-// Keep these values in sync with the static_asserts below.
-#define OFFSET_INPUT_DEPTH 0
-#define OFFSET_INPUT_ROW_SIZE 8
-#define OFFSET_OUTPUT_DEPTH 16
-#define OFFSET_OUTPUT_ROW_SIZE 24
-#define OFFSET_FILTER_ROW_SIZE 32
-#define OFFSET_INPUT_OFFSET 40
-#define OFFSET_OUTPUT_OFFSET 44
-#define OFFSET_OUTPUT_MULTIPLIER 52
-#define OFFSET_OUTPUT_ACTIVATION_MIN 56
-#define OFFSET_OUTPUT_ACTIVATION_MAX 60
-#define OFFSET_OUTPUT_RIGHT_SHIFT 64
-#define OFFSET_INPUT_WIDTH 68
-#define OFFSET_INPUT_HEIGHT 72
-#define OFFSET_STRIDE_WIDTH 76
-#define OFFSET_STRIDE_HEIGHT 80
-#define OFFSET_OUTPUT_WIDTH 84
-#define OFFSET_OUTPUT_HEIGHT 88
-
-static_assert(offsetof(DepthwiseConvParams, input_depth) == OFFSET_INPUT_DEPTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_row_size) ==
-                  OFFSET_INPUT_ROW_SIZE,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_depth) ==
-                  OFFSET_OUTPUT_DEPTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_row_size) ==
-                  OFFSET_OUTPUT_ROW_SIZE,
-              "");
-static_assert(offsetof(DepthwiseConvParams, filter_row_size) ==
-                  OFFSET_FILTER_ROW_SIZE,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_offset) ==
-                  OFFSET_INPUT_OFFSET,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_offset) ==
-                  OFFSET_OUTPUT_OFFSET,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_multiplier) ==
-                  OFFSET_OUTPUT_MULTIPLIER,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_activation_min) ==
-                  OFFSET_OUTPUT_ACTIVATION_MIN,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_activation_max) ==
-                  OFFSET_OUTPUT_ACTIVATION_MAX,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_right_shift) ==
-                  OFFSET_OUTPUT_RIGHT_SHIFT,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_width) == OFFSET_INPUT_WIDTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_height) ==
-                  OFFSET_INPUT_HEIGHT,
-              "");
-static_assert(offsetof(DepthwiseConvParams, stride_width) ==
-                  OFFSET_STRIDE_WIDTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, stride_height) ==
-                  OFFSET_STRIDE_HEIGHT,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_width) ==
-                  OFFSET_OUTPUT_WIDTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_height) ==
-                  OFFSET_OUTPUT_HEIGHT,
-              "");
-
-template <>
-struct DepthwiseConvWindowPerChannel {
- public:
-  static inline void Run(const int32* output_multiplier_ptr,
-                         const int32* output_shift_ptr, const int8* input_ptr,
-                         const int8* filter_ptr, const int32* bias_ptr,
-                         int8* output_ptr, int64_t input_depth,
-                         int64_t input_row_size, int32 output_window_height,
-                         int32 output_window_width,
-                         const DepthwiseConvParams* params_ptr) {
-    const int64_t input_width_increment = 2 * input_depth;
-    const int64_t input_height_increment = 2 * input_row_size;
-    const int64_t output_height_increment = 2 * params_ptr->output_row_size;
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-
-#define DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "1"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "2"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "3"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "4"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "5"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "6"
-#define DEPTHWISECONV_LABEL_HEIGHT_1 "7"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "8"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "9"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "10"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_END "11"
-
-    asm volatile(
-        // Performs depthwise convolutions for a window specified by
-        // |output_window_height| and |output_window_width|. The inner-most loop
-        // processes 2x2 outputs, and any leftovers at the end.
-        //
-        // Algorithm works as follows:
-        //
-        //   1. Load filters of 8 depth (8x3x3). Registers v0--v8 hold filter
-        //      values.
-        //   2. For 2 output heights at a time:
-        //        i.  For 2 output widths at a time, load inputs for a 2x1 (2
-        //            height, 1 width) output window (4x3 input window).
-        //            Registers v9--v20 hold input values. Mul-add with
-        //            accumulators v21--v24. Then run activation, downquantize
-        //            and store. Repeat for the next 2x1 output window,
-        //            leveraging overlapping inputs.
-        //        ii. Handle single leftover width if exists.
-        //   3. Handle single leftover height if exists.
-        //        i.  For 2 output widths at a time, load inputs for a 1x2 (1
-        //            height, 2 width) output window (3x4 input window).
-        //            Registers v9--v20 hold input values. Mul-add with
-        //            accumulators v21--v24. Then run activation, downquantize
-        //            and store. Repeat for the next 1x2 output window,
-        //            leveraging overlapping inputs.
-        //        ii. Handle single leftover width if exists.
-        //
-        // Loads are placed as soon as the register is no longer needed and
-        // interleaved with arithmetic operations to take advantage of
-        // dual-issue pipelines. We also add input offsets as far from the loads
-        // as possible to give loads enough cycles to fetch data from memory.
-        //
-        // This logic is copied and modified from the non-per-channel quantized
-        // part.
-        // However, the challenges are how to plan the registers allocation
-        // wisely: 25 NEON registers are already reserved for inputs, filters,
-        // and outputs; also, 2 registers (v30, v31) are used for output
-        // min/max, while another 2 registers (v26, v29) are used for input
-        // offset & output offset, so that's total 25 + 2 + 2 = 29 already.
-        // But we need 4 more registers to hold the output multiplier & output
-        // right shift (we only have 3).
-        //
-        // So here's the plan:
-        // v27 (which held duplicated output multiplier previously) will hold
-        // the first 4 values of the output_multiplier_ptr (we have 8 in total);
-        // v30 (which held duplicated output right shift previously) will hold
-        // the first 4 values of the output_shift_ptr (we have 8 in total);
-        // lastly, v28 will hold the last 4 values of output_multiplier and v31
-        // (previously occupied by activations) will hold the last 4 values of
-        // output_shift. Then v25 will be used for output activation min while
-        // output activation max will just reuse other registers, like v24.
-        //
-        // Set "constant" registers. These registers may be replaced with temp
-        // values from time to time when there are not enough NEON registers.
-        // We use x9--x15 general purpose registers as they are caller-saved
-        // temporary registers (see
-        // http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf).  // NOLINT
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr x3, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "cmp %w[output_window_height], #2\n"
-        "dup v26.8h, w9\n"
-        "ldr w2, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v29.8h, w2\n"
-        "ldr w4, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "ldr w0, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "add x10, %[bias_ptr], #16\n"
-        "ldr x1, [%[params_ptr], #" STR(OFFSET_OUTPUT_ROW_SIZE) "]\n"
-        "dup v25.16b, w4\n"
-
-        // Deal with output multiplier & output shift.
-        "ld1 {v27.4s, v28.4s}, [%[output_multiplier_ptr]]\n"
-        "ld1 {v30.4s, v31.4s}, [%[output_shift_ptr]]\n"
-
-        // Load filters and add offsets.
-        "ld1 {v0.8b}, [%[filter_ptr]], x3\n"
-        "ld1 {v1.8b}, [%[filter_ptr]], x3\n"
-        "sshll v0.8h, v0.8b, #0\n"
-        "ld1 {v2.8b}, [%[filter_ptr]], x3\n"
-        "sshll v1.8h, v1.8b, #0\n"
-        "ld1 {v3.8b}, [%[filter_ptr]], x3\n"
-        "sshll v2.8h, v2.8b, #0\n"
-        "ld1 {v4.8b}, [%[filter_ptr]], x3\n"
-        "sshll v3.8h, v3.8b, #0\n"
-        "ld1 {v5.8b}, [%[filter_ptr]], x3\n"
-        "sshll v4.8h, v4.8b, #0\n"
-        "ld1 {v6.8b}, [%[filter_ptr]], x3\n"
-        "sshll v5.8h, v5.8b, #0\n"
-        "ld1 {v7.8b}, [%[filter_ptr]], x3\n"
-        "sshll v6.8h, v6.8b, #0\n"
-        "ld1 {v8.8b}, [%[filter_ptr]], x3\n"
-        "sshll v7.8h, v7.8b, #0\n"
-        "sshll v8.8h, v8.8b, #0\n"
-
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_2_LOOP ":\n"
-          // This loop processes 2x2 outputs. To avoid register exhaustion,
-          // inputs for the left 2 outputs are loaded first, then the right
-          // two outputs.
-          "mov x11, %[input_ptr]\n"
-          "mov x12, x11\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "add x13, x11, %[input_row_size]\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "add x14, x13, %[input_row_size]\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x15, x14, %[input_row_size]\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "mov w5, %w[output_window_width]\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "mov x6, %[output_ptr]\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "add x7, %[output_ptr], x1\n"
-          "ld1 {v15.8b}, [x14], %[input_depth]\n"
-          // The height 2 / width 2 loop loads an extra 2x1 outputs (2 height,
-          // 1 width) in anticipation for the next iteration. Make sure
-          // |output_window_width| is large enough to handle the additional
-          // loads, otherwise jump to specific the appropriate label to handle
-          // smaller widths.
-          "cmp w5, #2\n"
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "ld1 {v16.8b}, [x14], %[input_depth]\n"
-          "saddw v10.8h, v26.8h, v10.8b\n"
-          "ld1 {v17.8b}, [x14], %[input_depth]\n"
-          "saddw v11.8h, v26.8h, v11.8b\n"
-          "ld1 {v18.8b}, [x15], %[input_depth]\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "ld1 {v19.8b}, [x15], %[input_depth]\n"
-          "saddw v13.8h, v26.8h, v13.8b\n"
-          "ld1 {v20.8b}, [x15], %[input_depth]\n"
-          "saddw v14.8h, v26.8h, v14.8b\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "saddw v15.8h, v26.8h, v15.8b\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "saddw v16.8h, v26.8h, v16.8b\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-          "saddw v17.8h, v26.8h, v17.8b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "saddw v18.8h, v26.8h, v18.8b\n"
-          "saddw v19.8h, v26.8h, v19.8b\n"
-          "saddw v20.8h, v26.8h, v20.8b\n"
-
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "f\n"
-          "cmp w5, #1\n"
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          //"loop_%=:\n"
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP ":\n"
-            // Mul-add left outputs.
-            "smlal v21.4s, v0.4h, v9.4h\n"
-            "subs w5, w5, #2\n"
-            "smlal2 v22.4s, v0.8h, v9.8h\n"
-            "cmp w5, #3\n"
-            "smlal v23.4s, v0.4h, v12.4h\n"
-            "ld1 {v9.8b}, [x12]\n"
-            "smlal2 v24.4s, v0.8h, v12.8h\n"
-            "smlal v21.4s, v1.4h, v10.4h\n"
-            "smlal2 v22.4s, v1.8h, v10.8h\n"
-            "smlal v23.4s, v1.4h, v13.4h\n"
-            "smlal2 v24.4s, v1.8h, v13.8h\n"
-            "smlal v21.4s, v2.4h, v11.4h\n"
-            "smlal2 v22.4s, v2.8h, v11.8h\n"
-            "smlal v23.4s, v2.4h, v14.4h\n"
-            "smlal2 v24.4s, v2.8h, v14.8h\n"
-            "smlal v21.4s, v3.4h, v12.4h\n"
-            "smlal2 v22.4s, v3.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x13]\n"
-            "smlal v23.4s, v3.4h, v15.4h\n"
-            "smlal2 v24.4s, v3.8h, v15.8h\n"
-            "smlal v21.4s, v4.4h, v13.4h\n"
-            "smlal2 v22.4s, v4.8h, v13.8h\n"
-            "smlal v23.4s, v4.4h, v16.4h\n"
-            "smlal2 v24.4s, v4.8h, v16.8h\n"
-            "smlal v21.4s, v5.4h, v14.4h\n"
-            "smlal2 v22.4s, v5.8h, v14.8h\n"
-            "smlal v23.4s, v5.4h, v17.4h\n"
-            "smlal2 v24.4s, v5.8h, v17.8h\n"
-            "smlal v21.4s, v6.4h, v15.4h\n"
-            "smlal2 v22.4s, v6.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x14]\n"
-            "smlal v23.4s, v6.4h, v18.4h\n"
-            "smlal2 v24.4s, v6.8h, v18.8h\n"
-            "ld1 {v18.8b}, [x15]\n"
-            "smlal v21.4s, v7.4h, v16.4h\n"
-            "smlal2 v22.4s, v7.8h, v16.8h\n"
-            "smlal v23.4s, v7.4h, v19.4h\n"
-            "smlal2 v24.4s, v7.8h, v19.8h\n"
-            "smlal v21.4s, v8.4h, v17.4h\n"
-            "smlal2 v22.4s, v8.8h, v17.8h\n"
-            "smlal v23.4s, v8.4h, v20.4h\n"
-            "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-            "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-            "sqrdmulh v22.4s, v22.4s, v28.4s\n"
-            "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-            "sqrdmulh v24.4s, v24.4s, v28.4s\n"
-            "sqrshl v21.4s, v21.4s, v30.4s\n"
-            "sqrshl v22.4s, v22.4s, v31.4s\n"
-            "sqrshl v23.4s, v23.4s, v30.4s\n"
-            "sqrshl v24.4s, v24.4s, v31.4s\n"
-            "sqxtn v21.4h, v21.4s\n"
-            "sqxtn2 v21.8h, v22.4s\n"
-            "sqxtn v23.4h, v23.4s\n"
-            "sqxtn2 v23.8h, v24.4s\n"
-            "sqadd v21.8h, v21.8h, v29.8h\n"
-            "sqadd v23.8h, v23.8h, v29.8h\n"
-            "sqxtn v21.8b, v21.8h\n"
-            "sqxtn2 v21.16b, v23.8h\n"
-            "dup v24.16b, w0\n"
-            "ld1 {v22.4s}, [x10]\n"
-            "smax v21.16b, v21.16b, v25.16b\n"
-            "smin v21.16b, v21.16b, v24.16b\n"
-            "ld1 {v24.4s}, [x10]\n"
-            "saddw v9.8h, v26.8h, v9.8b\n"
-            "st1 {v21.8b}, [x6], x3\n"
-            "saddw v12.8h, v26.8h, v12.8b\n"
-            "mov v23.d[0], v21.d[1]\n"
-            "st1 {v23.8b}, [x7], x3\n"
-            "saddw v15.8h, v26.8h, v15.8b\n"
-            "ld1 {v21.4s}, [%[bias_ptr]]\n"
-            "saddw v18.8h, v26.8h, v18.8b\n"
-            "ld1 {v23.4s}, [%[bias_ptr]]\n"
-
-            // Mul-add right outputs.
-            "smlal v21.4s, v0.4h, v10.4h\n"
-            "add x11, x11, %[input_width_increment]\n"
-            "smlal2 v22.4s, v0.8h, v10.8h\n"
-            "mov x12, x11\n"
-            "smlal v23.4s, v0.4h, v13.4h\n"
-            "add x13, x11, %[input_row_size]\n"
-            "smlal2 v24.4s, v0.8h, v13.8h\n"
-            "add x14, x13, %[input_row_size]\n"
-            "smlal v21.4s, v1.4h, v11.4h\n"
-            "add x15, x14, %[input_row_size]\n"
-            "smlal2 v22.4s, v1.8h, v11.8h\n"
-            "smlal v23.4s, v1.4h, v14.4h\n"
-            "smlal2 v24.4s, v1.8h, v14.8h\n"
-            "smlal v21.4s, v2.4h, v9.4h\n"
-            "smlal2 v22.4s, v2.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v2.4h, v12.4h\n"
-            "ld1 {v10.8b}, [x12], %[input_depth]\n"
-            "smlal2 v24.4s, v2.8h, v12.8h\n"
-            "ld1 {v11.8b}, [x12], %[input_depth]\n"
-            "smlal v21.4s, v3.4h, v13.4h\n"
-            "smlal2 v22.4s, v3.8h, v13.8h\n"
-            "smlal v23.4s, v3.4h, v16.4h\n"
-            "smlal2 v24.4s, v3.8h, v16.8h\n"
-            "smlal v21.4s, v4.4h, v14.4h\n"
-            "smlal2 v22.4s, v4.8h, v14.8h\n"
-            "smlal v23.4s, v4.4h, v17.4h\n"
-            "smlal2 v24.4s, v4.8h, v17.8h\n"
-            "smlal v21.4s, v5.4h, v12.4h\n"
-            "smlal2 v22.4s, v5.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v5.4h, v15.4h\n"
-            "ld1 {v13.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v5.8h, v15.8h\n"
-            "ld1 {v14.8b}, [x13], %[input_depth]\n"
-            "smlal v21.4s, v6.4h, v16.4h\n"
-            "smlal2 v22.4s, v6.8h, v16.8h\n"
-            "smlal v23.4s, v6.4h, v19.4h\n"
-            "smlal2 v24.4s, v6.8h, v19.8h\n"
-            "smlal v21.4s, v7.4h, v17.4h\n"
-            "smlal2 v22.4s, v7.8h, v17.8h\n"
-            "smlal v23.4s, v7.4h, v20.4h\n"
-            "smlal2 v24.4s, v7.8h, v20.8h\n"
-            "smlal v21.4s, v8.4h, v15.4h\n"
-            "smlal2 v22.4s, v8.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x14], %[input_depth]\n"
-            "smlal v23.4s, v8.4h, v18.4h\n"
-            "ld1 {v16.8b}, [x14], %[input_depth]\n"
-            "smlal2 v24.4s, v8.8h, v18.8h\n"
-            "ld1 {v17.8b}, [x14], %[input_depth]\n"
-
-            "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-            "ld1 {v18.8b}, [x15], %[input_depth]\n"
-            "sqrdmulh v22.4s, v22.4s, v28.4s\n"
-            "ld1 {v19.8b}, [x15], %[input_depth]\n"
-            "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-            "ld1 {v20.8b}, [x15], %[input_depth]\n"
-            "sqrdmulh v24.4s, v24.4s, v28.4s\n"
-            "sqrshl v21.4s, v21.4s, v30.4s\n"
-            "sqrshl v22.4s, v22.4s, v31.4s\n"
-            "sqrshl v23.4s, v23.4s, v30.4s\n"
-            "sqrshl v24.4s, v24.4s, v31.4s\n"
-            "sqxtn v21.4h, v21.4s\n"
-            "sqxtn2 v21.8h, v22.4s\n"
-            "sqxtn v23.4h, v23.4s\n"
-            "sqxtn2 v23.8h, v24.4s\n"
-            "sqadd v21.8h, v21.8h, v29.8h\n"
-            "sqadd v23.8h, v23.8h, v29.8h\n"
-            "sqxtn v21.8b, v21.8h\n"
-            "sqxtn2 v21.16b, v23.8h\n"
-            "dup v24.16b, w0\n"
-            "ld1 {v22.4s}, [x10]\n"
-            "smax v21.16b, v21.16b, v25.16b\n"
-            "smin v21.16b, v21.16b, v24.16b\n"
-            "ld1 {v24.4s}, [x10]\n"
-            "saddw v9.8h, v26.8h, v9.8b\n"
-            "st1 {v21.8b}, [x6], x3\n"
-            "saddw v10.8h, v26.8h, v10.8b\n"
-            "mov v23.d[0], v21.d[1]\n"
-            "st1 {v23.8b}, [x7], x3\n"
-            "saddw v11.8h, v26.8h, v11.8b\n"
-            "saddw v12.8h, v26.8h, v12.8b\n"
-            "saddw v13.8h, v26.8h, v13.8b\n"
-            "saddw v14.8h, v26.8h, v14.8b\n"
-            "saddw v15.8h, v26.8h, v15.8b\n"
-            "ld1 {v21.4s}, [%[bias_ptr]]\n"
-            "saddw v16.8h, v26.8h, v16.8b\n"
-            "ld1 {v23.4s}, [%[bias_ptr]]\n"
-            "saddw v17.8h, v26.8h, v17.8b\n"
-            "saddw v18.8h, v26.8h, v18.8b\n"
-            "saddw v19.8h, v26.8h, v19.8b\n"
-            "saddw v20.8h, v26.8h, v20.8b\n"
-
-            "bge " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "b\n"
-
-          // At this point, there will be one of 2 width or 1 width leftover,
-          // not both.
-          "cmp w5, #2\n"
-          "blt " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          // Handle last 2 columns if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER ":\n"
-          // Mul-add left outputs.
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "ld1 {v9.8b}, [x12]\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "smlal v23.4s, v2.4h, v14.4h\n"
-          "smlal2 v24.4s, v2.8h, v14.8h\n"
-          "smlal v21.4s, v3.4h, v12.4h\n"
-          "smlal2 v22.4s, v3.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x13]\n"
-          "smlal v23.4s, v3.4h, v15.4h\n"
-          "smlal2 v24.4s, v3.8h, v15.8h\n"
-          "smlal v21.4s, v4.4h, v13.4h\n"
-          "smlal2 v22.4s, v4.8h, v13.8h\n"
-          "smlal v23.4s, v4.4h, v16.4h\n"
-          "smlal2 v24.4s, v4.8h, v16.8h\n"
-          "smlal v21.4s, v5.4h, v14.4h\n"
-          "smlal2 v22.4s, v5.8h, v14.8h\n"
-          "smlal v23.4s, v5.4h, v17.4h\n"
-          "smlal2 v24.4s, v5.8h, v17.8h\n"
-          "smlal v21.4s, v6.4h, v15.4h\n"
-          "smlal2 v22.4s, v6.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x14]\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x15]\n"
-          "smlal v21.4s, v7.4h, v16.4h\n"
-          "smlal2 v22.4s, v7.8h, v16.8h\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v28.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v28.4s\n"
-          "sqrshl v21.4s, v21.4s, v30.4s\n"
-          "sqrshl v22.4s, v22.4s, v31.4s\n"
-          "sqrshl v23.4s, v23.4s, v30.4s\n"
-          "sqrshl v24.4s, v24.4s, v31.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtn v21.8b, v21.8h\n"
-          "sqxtn2 v21.16b, v23.8h\n"
-          "dup v24.16b, w0\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "smax v21.16b, v21.16b, v25.16b\n"
-          "smin v21.16b, v21.16b, v24.16b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "st1 {v21.8b}, [x6], x3\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "st1 {v23.8b}, [x7], x3\n"
-          "saddw v15.8h, v26.8h, v15.8b\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "saddw v18.8h, v26.8h, v18.8b\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-
-          // Mul-add right outputs.
-          "smlal v21.4s, v0.4h, v10.4h\n"
-          "smlal2 v22.4s, v0.8h, v10.8h\n"
-          "smlal v23.4s, v0.4h, v13.4h\n"
-          "smlal2 v24.4s, v0.8h, v13.8h\n"
-          "smlal v21.4s, v1.4h, v11.4h\n"
-          "smlal2 v22.4s, v1.8h, v11.8h\n"
-          "smlal v23.4s, v1.4h, v14.4h\n"
-          "smlal2 v24.4s, v1.8h, v14.8h\n"
-          "smlal v21.4s, v2.4h, v9.4h\n"
-          "smlal2 v22.4s, v2.8h, v9.8h\n"
-          "smlal v23.4s, v2.4h, v12.4h\n"
-          "smlal2 v24.4s, v2.8h, v12.8h\n"
-          "smlal v21.4s, v3.4h, v13.4h\n"
-          "smlal2 v22.4s, v3.8h, v13.8h\n"
-          "smlal v23.4s, v3.4h, v16.4h\n"
-          "smlal2 v24.4s, v3.8h, v16.8h\n"
-          "smlal v21.4s, v4.4h, v14.4h\n"
-          "smlal2 v22.4s, v4.8h, v14.8h\n"
-          "smlal v23.4s, v4.4h, v17.4h\n"
-          "smlal2 v24.4s, v4.8h, v17.8h\n"
-          "smlal v21.4s, v5.4h, v12.4h\n"
-          "smlal2 v22.4s, v5.8h, v12.8h\n"
-          "smlal v23.4s, v5.4h, v15.4h\n"
-          "smlal2 v24.4s, v5.8h, v15.8h\n"
-          "smlal v21.4s, v6.4h, v16.4h\n"
-          "smlal2 v22.4s, v6.8h, v16.8h\n"
-          "smlal v23.4s, v6.4h, v19.4h\n"
-          "smlal2 v24.4s, v6.8h, v19.8h\n"
-          "smlal v21.4s, v7.4h, v17.4h\n"
-          "smlal2 v22.4s, v7.8h, v17.8h\n"
-          "smlal v23.4s, v7.4h, v20.4h\n"
-          "smlal2 v24.4s, v7.8h, v20.8h\n"
-          "smlal v21.4s, v8.4h, v15.4h\n"
-          "smlal2 v22.4s, v8.8h, v15.8h\n"
-          "smlal v23.4s, v8.4h, v18.4h\n"
-          "smlal2 v24.4s, v8.8h, v18.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v28.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v28.4s\n"
-          "sqrshl v21.4s, v21.4s, v30.4s\n"
-          "sqrshl v22.4s, v22.4s, v31.4s\n"
-          "sqrshl v23.4s, v23.4s, v30.4s\n"
-          "sqrshl v24.4s, v24.4s, v31.4s\n"
-
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtn v21.8b, v21.8h\n"
-          "sqxtn2 v21.16b, v23.8h\n"
-          "dup v24.16b, w0\n"
-          "smax v21.16b, v21.16b, v25.16b\n"
-          "smin v21.16b, v21.16b, v24.16b\n"
-          "st1 {v21.8b}, [x6], x3\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [x7], x3\n"
-          "b " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "f\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER ":\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "smlal v23.4s, v2.4h, v14.4h\n"
-          "smlal2 v24.4s, v2.8h, v14.8h\n"
-          "smlal v21.4s, v3.4h, v12.4h\n"
-          "smlal2 v22.4s, v3.8h, v12.8h\n"
-          "smlal v23.4s, v3.4h, v15.4h\n"
-          "smlal2 v24.4s, v3.8h, v15.8h\n"
-          "smlal v21.4s, v4.4h, v13.4h\n"
-          "smlal2 v22.4s, v4.8h, v13.8h\n"
-          "smlal v23.4s, v4.4h, v16.4h\n"
-          "smlal2 v24.4s, v4.8h, v16.8h\n"
-          "smlal v21.4s, v5.4h, v14.4h\n"
-          "smlal2 v22.4s, v5.8h, v14.8h\n"
-          "smlal v23.4s, v5.4h, v17.4h\n"
-          "smlal2 v24.4s, v5.8h, v17.8h\n"
-          "smlal v21.4s, v6.4h, v15.4h\n"
-          "smlal2 v22.4s, v6.8h, v15.8h\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "smlal v21.4s, v7.4h, v16.4h\n"
-          "smlal2 v22.4s, v7.8h, v16.8h\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v28.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v28.4s\n"
-          "sqrshl v21.4s, v21.4s, v30.4s\n"
-          "sqrshl v22.4s, v22.4s, v31.4s\n"
-          "sqrshl v23.4s, v23.4s, v30.4s\n"
-          "sqrshl v24.4s, v24.4s, v31.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtn v21.8b, v21.8h\n"
-          "sqxtn2 v21.16b, v23.8h\n"
-          "dup v24.16b, w0\n"
-          "smax v21.16b, v21.16b, v25.16b\n"
-          "smin v21.16b, v21.16b, v24.16b\n"
-          "st1 {v21.8b}, [x6], x3\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [x7], x3\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP ":\n"
-          "subs %w[output_window_height], %w[output_window_height], #2\n"
-          "add %[input_ptr], %[input_ptr], %[input_height_increment]\n"
-          "cmp %w[output_window_height], #2\n"
-          "add %[output_ptr], %[output_ptr], %[output_height_increment]\n"
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP ":\n"
-        "cmp %w[output_window_height], #1\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_1 ":\n"
-        "mov x12, %[input_ptr]\n"
-        "ld1 {v9.8b}, [x12], %[input_depth]\n"
-        "add x13, %[input_ptr], %[input_row_size]\n"
-        "ld1 {v10.8b}, [x12], %[input_depth]\n"
-        "add x14, x13, %[input_row_size]\n"
-        "ld1 {v11.8b}, [x12], %[input_depth]\n"
-        "add x15, x14, %[input_row_size]\n"
-        "mov w5, %w[output_window_width]\n"
-        "ld1 {v13.8b}, [x13], %[input_depth]\n"
-        "mov x6, %[output_ptr]\n"
-        "ld1 {v14.8b}, [x13], %[input_depth]\n"
-        "add x7, %[output_ptr], x1\n"
-        "ld1 {v15.8b}, [x13], %[input_depth]\n"
-        // The height 1 / width 2 loop loads an extra 1x1 output in anticipation
-        // for the next iteration. Make sure |output_window_width| is large
-        // enough to handle the additional load, otherwise jump to the
-        // appropriate label to handle smaller widths.
-        "cmp w5, #2\n"
-        "ld1 {v17.8b}, [x14], %[input_depth]\n"
-        "ld1 {v18.8b}, [x14], %[input_depth]\n"
-        "ld1 {v19.8b}, [x14], %[input_depth]\n"
-        "ld1 {v21.4s}, [%[bias_ptr]]\n"
-        "ld1 {v22.4s}, [x10]\n"
-        "ld1 {v23.4s}, [%[bias_ptr]]\n"
-        "ld1 {v24.4s}, [x10]\n"
-
-        "saddw v9.8h, v26.8h, v9.8b\n"
-        "saddw v10.8h, v26.8h, v10.8b\n"
-        "saddw v11.8h, v26.8h, v11.8b\n"
-        "saddw v13.8h, v26.8h, v13.8b\n"
-        "saddw v14.8h, v26.8h, v14.8b\n"
-        "saddw v15.8h, v26.8h, v15.8b\n"
-        "saddw v17.8h, v26.8h, v17.8b\n"
-        "saddw v18.8h, v26.8h, v18.8b\n"
-        "saddw v19.8h, v26.8h, v19.8b\n"
-
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "f\n"
-        "cmp w5, #1\n"
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP ":\n"
-          // Load inputs for 3x4 input window which corresponds to a 1x2 output
-          // window.
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v12.8b}, [x12]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v16.8b}, [x13]\n"
-          "smlal v23.4s, v0.4h, v10.4h\n"
-          "ld1 {v20.8b}, [x14]\n"
-          "smlal2 v24.4s, v0.8h, v10.8h\n"
-          "subs w5, w5, #2\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "cmp w5, #3\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "add %[input_ptr], %[input_ptr], %[input_width_increment]\n"
-          "smlal v23.4s, v1.4h, v11.4h\n"
-          "mov x12, %[input_ptr]\n"
-          "smlal2 v24.4s, v1.8h, v11.8h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x13, %[input_ptr], %[input_row_size]\n"
-          "smlal v23.4s, v2.4h, v12.4h\n"
-          "add x14, x13, %[input_row_size]\n"
-          "smlal2 v24.4s, v2.8h, v12.8h\n"
-          "smlal v21.4s, v3.4h, v13.4h\n"
-          "add x15, x14, %[input_row_size]\n"
-          "smlal2 v22.4s, v3.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v3.4h, v14.4h\n"
-          "smlal2 v24.4s, v3.8h, v14.8h\n"
-          "smlal v21.4s, v4.4h, v14.4h\n"
-          "smlal2 v22.4s, v4.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v4.4h, v15.4h\n"
-          "smlal2 v24.4s, v4.8h, v15.8h\n"
-          "smlal v21.4s, v5.4h, v15.4h\n"
-          "saddw v16.8h, v26.8h, v16.8b\n"
-          "smlal2 v22.4s, v5.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v5.4h, v16.4h\n"
-          "smlal2 v24.4s, v5.8h, v16.8h\n"
-          "smlal v21.4s, v6.4h, v17.4h\n"
-          "smlal2 v22.4s, v6.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "smlal v21.4s, v7.4h, v18.4h\n"
-          "smlal2 v22.4s, v7.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v19.4h\n"
-          "saddw v20.8h, v26.8h, v20.8b\n"
-          "smlal2 v22.4s, v8.8h, v19.8h\n"
-          "ld1 {v19.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-          "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v28.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v28.4s\n"
-          "sqrshl v21.4s, v21.4s, v30.4s\n"
-          "sqrshl v22.4s, v22.4s, v31.4s\n"
-          "sqrshl v23.4s, v23.4s, v30.4s\n"
-          "sqrshl v24.4s, v24.4s, v31.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtn v21.8b, v21.8h\n"
-          "sqxtn2 v21.16b, v23.8h\n"
-          "dup v24.16b, w0\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "smax v21.16b, v21.16b, v25.16b\n"
-          "smin v21.16b, v21.16b, v24.16b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "st1 {v21.8b}, [%[output_ptr]], x3\n"
-          "saddw v10.8h, v26.8h, v10.8b\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [%[output_ptr]], x3\n"
-          "saddw v11.8h, v26.8h, v11.8b\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "saddw v13.8h, v26.8h, v13.8b\n"
-          "saddw v14.8h, v26.8h, v14.8b\n"
-          "saddw v15.8h, v26.8h, v15.8b\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "saddw v16.8h, v26.8h, v16.8b\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-          "saddw v17.8h, v26.8h, v17.8b\n"
-          "saddw v18.8h, v26.8h, v18.8b\n"
-          "saddw v19.8h, v26.8h, v19.8b\n"
-          "saddw v20.8h, v26.8h, v20.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "b\n"
-
-        // At this point, there will be one of 2 width or 1 width leftover,
-        // not both.
-        "cmp w5, #2\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        // Handle last two horizontal outputs if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER ":\n"
-        "smlal v21.4s, v0.4h, v9.4h\n"
-        "ld1 {v12.8b}, [x12], %[input_depth]\n"
-        "smlal2 v22.4s, v0.8h, v9.8h\n"
-        "ld1 {v16.8b}, [x13], %[input_depth]\n"
-        "smlal v23.4s, v0.4h, v10.4h\n"
-        "ld1 {v20.8b}, [x14], %[input_depth]\n"
-        "smlal2 v24.4s, v0.8h, v10.8h\n"
-        "smlal v21.4s, v1.4h, v10.4h\n"
-        "smlal2 v22.4s, v1.8h, v10.8h\n"
-        "smlal v23.4s, v1.4h, v11.4h\n"
-        "smlal2 v24.4s, v1.8h, v11.8h\n"
-        "smlal v21.4s, v2.4h, v11.4h\n"
-        "saddw v12.8h, v26.8h, v12.8b\n"
-        "smlal2 v22.4s, v2.8h, v11.8h\n"
-        "smlal v23.4s, v2.4h, v12.4h\n"
-        "smlal2 v24.4s, v2.8h, v12.8h\n"
-        "smlal v21.4s, v3.4h, v13.4h\n"
-        "smlal2 v22.4s, v3.8h, v13.8h\n"
-        "smlal v23.4s, v3.4h, v14.4h\n"
-        "smlal2 v24.4s, v3.8h, v14.8h\n"
-        "smlal v21.4s, v4.4h, v14.4h\n"
-        "smlal2 v22.4s, v4.8h, v14.8h\n"
-        "smlal v23.4s, v4.4h, v15.4h\n"
-        "smlal2 v24.4s, v4.8h, v15.8h\n"
-        "smlal v21.4s, v5.4h, v15.4h\n"
-        "saddw v16.8h, v26.8h, v16.8b\n"
-        "smlal2 v22.4s, v5.8h, v15.8h\n"
-        "smlal v23.4s, v5.4h, v16.4h\n"
-        "smlal2 v24.4s, v5.8h, v16.8h\n"
-        "smlal v21.4s, v6.4h, v17.4h\n"
-        "smlal2 v22.4s, v6.8h, v17.8h\n"
-        "smlal v23.4s, v6.4h, v18.4h\n"
-        "smlal2 v24.4s, v6.8h, v18.8h\n"
-        "smlal v21.4s, v7.4h, v18.4h\n"
-        "smlal2 v22.4s, v7.8h, v18.8h\n"
-        "smlal v23.4s, v7.4h, v19.4h\n"
-        "smlal2 v24.4s, v7.8h, v19.8h\n"
-        "smlal v21.4s, v8.4h, v19.4h\n"
-        "saddw v20.8h, v26.8h, v20.8b\n"
-        "smlal2 v22.4s, v8.8h, v19.8h\n"
-        "smlal v23.4s, v8.4h, v20.4h\n"
-        "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-        "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-        "sqrdmulh v22.4s, v22.4s, v28.4s\n"
-        "sqrdmulh v23.4s, v23.4s, v27.4s\n"
-        "sqrdmulh v24.4s, v24.4s, v28.4s\n"
-        "sqrshl v21.4s, v21.4s, v30.4s\n"
-        "sqrshl v22.4s, v22.4s, v31.4s\n"
-        "sqrshl v23.4s, v23.4s, v30.4s\n"
-        "sqrshl v24.4s, v24.4s, v31.4s\n"
-        "sqxtn v21.4h, v21.4s\n"
-        "sqxtn2 v21.8h, v22.4s\n"
-        "sqxtn v23.4h, v23.4s\n"
-        "sqxtn2 v23.8h, v24.4s\n"
-        "sqadd v21.8h, v21.8h, v29.8h\n"
-        "sqadd v23.8h, v23.8h, v29.8h\n"
-        "sqxtn v21.8b, v21.8h\n"
-        "sqxtn2 v21.16b, v23.8h\n"
-        "dup v24.16b, w0\n"
-        "smax v21.16b, v21.16b, v25.16b\n"
-        "smin v21.16b, v21.16b, v24.16b\n"
-        "st1 {v21.8b}, [%[output_ptr]], x3\n"
-        "mov v23.d[0], v21.d[1]\n"
-        "st1 {v23.8b}, [%[output_ptr]], x3\n"
-        "b " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        // Handle bottom right output if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER ":\n"
-        "smlal v21.4s, v0.4h, v9.4h\n"
-        "smlal2 v22.4s, v0.8h, v9.8h\n"
-        "smlal v21.4s, v1.4h, v10.4h\n"
-        "smlal2 v22.4s, v1.8h, v10.8h\n"
-        "smlal v21.4s, v2.4h, v11.4h\n"
-        "smlal2 v22.4s, v2.8h, v11.8h\n"
-        "smlal v21.4s, v3.4h, v13.4h\n"
-        "smlal2 v22.4s, v3.8h, v13.8h\n"
-        "smlal v21.4s, v4.4h, v14.4h\n"
-        "smlal2 v22.4s, v4.8h, v14.8h\n"
-        "smlal v21.4s, v5.4h, v15.4h\n"
-        "smlal2 v22.4s, v5.8h, v15.8h\n"
-        "smlal v21.4s, v6.4h, v17.4h\n"
-        "smlal2 v22.4s, v6.8h, v17.8h\n"
-        "smlal v21.4s, v7.4h, v18.4h\n"
-        "smlal2 v22.4s, v7.8h, v18.8h\n"
-        "smlal v21.4s, v8.4h, v19.4h\n"
-        "smlal2 v22.4s, v8.8h, v19.8h\n"
-
-        "sqrdmulh v21.4s, v21.4s, v27.4s\n"
-        "sqrdmulh v22.4s, v22.4s, v28.4s\n"
-        "sqrshl v21.4s, v21.4s, v30.4s\n"
-        "sqrshl v22.4s, v22.4s, v31.4s\n"
-        "sqxtn v21.4h, v21.4s\n"
-        "sqxtn2 v21.8h, v22.4s\n"
-        "sqadd v21.8h, v21.8h, v29.8h\n"
-        "sqxtn v21.8b, v21.8h\n"
-        "dup v24.16b, w0\n"
-        "smax v21.8b, v21.8b, v25.8b\n"
-        "smin v21.8b, v21.8b, v24.8b\n"
-        "st1 {v21.8b}, [%[output_ptr]]\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_END ":\n"
-    :
-    // Outputs.
-    [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-    [output_ptr] "+r"(output_ptr),
-    [output_window_height] "+r"(output_window_height)
-    :
-    // Inputs.
-    [output_multiplier_ptr] "r"(output_multiplier_ptr),
-    [output_shift_ptr] "r"(output_shift_ptr),
-    [bias_ptr] "r"(bias_ptr), [input_row_size] "r"(input_row_size),
-    [input_depth] "r"(input_depth),
-    [output_window_width] "r"(output_window_width),
-    [input_width_increment] "r"(input_width_increment),
-    [input_height_increment] "r"(input_height_increment),
-    [output_height_increment] "r"(output_height_increment),
-    [params_ptr] "r"(params_ptr)
-    :
-    // Clobbers.
-    "cc", "memory",
-    // We use these NEON registers.
-    "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
-    "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-    "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29",
-    "v30", "v31",
-    // We use these general-purpose registers.
-    "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
-    "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_END
-  }
-};
-
-template <>
-struct DepthwiseConvWindowPerChannel {
-  static inline void Run(const int32* output_multiplier_ptr,
-                         const int32* output_shift_ptr, const int8* input_ptr,
-                         const int8* filter_ptr, const int32* bias_ptr,
-                         int8* output_ptr, int64_t input_depth,
-                         int64_t input_row_size, int32 output_window_height,
-                         int32 output_window_width,
-                         const DepthwiseConvParams* params_ptr) {
-    const int64_t input_width_increment = 4 * input_depth;
-    const int64_t input_height_increment = 4 * input_row_size;
-    const int64_t output_height_increment = 2 * params_ptr->output_row_size;
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-
-#define DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "1"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "2"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "3"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "4"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "5"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "6"
-#define DEPTHWISECONV_LABEL_HEIGHT_1 "7"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "8"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "9"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "10"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_END "11"
-
-    asm volatile(
-        // Performs depthwise convolutions for a window specified by
-        // |output_window_height| and |output_window_width|. The inner-most loop
-        // processes 2x2 outputs, and any leftovers at the end.
-        //
-        // Algorithm works as follows:
-        //
-        //   1. Load filters of 8 depth (8x3x3). Registers v0--v8 hold filter
-        //      values.
-        //   2. For 2 output heights at a time:
-        //        i.  For 2 output widths at a time at stride 2, a 5x5 input
-        //            window is required. To avoid register exhaustion, we load
-        //            the first 2 rows of the 5x5 input window into registers
-        //            v9--v18, and use the same registers to load the next 2
-        //            rows, and finally v9--v13 to load the last row.
-        //            Accumulators for all 2x2 outputs are reserved by registers
-        //            v21-v22 (top left output), v23-v24 (top right output),
-        //            v19-v20 (bottom left output), v25-v26 (bottom right
-        //            output).
-        //        ii. Handle single leftover width if exists.
-        //   3. Handle single leftover height if exists.
-        //        i.  For 2 output widths at a time at stride 2, load inputs for
-        //            a 1x2 (1 height, 2 width) output window (3x5 input
-        //            window). Registers v9--v24 hold input values. Mul-add with
-        //            accumulators v24--v27.
-        //        ii. Handle single leftover width if exists.
-        //
-        // Loads are placed as soon as the register is no longer needed and
-        // interleaved with arithmetic operations to take advantage of
-        // dual-issue pipelines. We also add input offsets as far from the loads
-        // as possible to give loads enough cycles to fetch data from memory.
-        //
-        // This logic is copied and modified from the non-per-channel quantized
-        // part.
-        // The register planning here is really tricky:
-        // v0-v29 are all used at least once for either filter/input/output,
-        // some of them are used for output shift and output multiplier, or
-        // input/output offset.
-        // Only v30 & v31 are only used for output activation min/max.
-        // For per-channel case, we need 4 registers to hold output shift &
-        // output multiplier. However, given the reality, we simply cannot do
-        // that without reloading.
-        //
-        // So here's the plan:
-        // We hold output_multiplier in v30 & v31, and we will load output_shift
-        // into two consecutive registers each time before use.
-        // We will duplicate output min & max before needed.
-        // Sometimes we may borrow registers from input offset or bias, we will
-        // dup them back after use.
-        //
-
-        // Set "constant" registers. These registers may be replaced with temp
-        // values from time to time when there are not enough NEON registers.
-        // We use x9--x15 general purpose registers as they are caller-saved
-        // temporary registers (see http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf).  // NOLINT
-        "ldr w0, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "cmp %w[output_window_height], #2\n"
-        "dup v28.8h, w0\n"
-        "ldr w2, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "ldr w3, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "dup v29.8h, w2\n"
-        "ldr w4, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "ldr x5, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "ldr x19, [%[params_ptr], #" STR(OFFSET_OUTPUT_ROW_SIZE) "]\n"
-
-        // Deal with output multiplier.
-        "ld1 {v30.4s, v31.4s}, [%[output_multiplier_ptr]]\n"
-
-        // Load filters and add offsets.
-        "add x10, %[bias_ptr], #16\n"
-        "ld1 {v0.8b}, [%[filter_ptr]], x5\n"
-        "ld1 {v1.8b}, [%[filter_ptr]], x5\n"
-        "sshll v0.8h, v0.8b, #0\n"
-        "ld1 {v2.8b}, [%[filter_ptr]], x5\n"
-        "sshll v1.8h, v1.8b, #0\n"
-        "ld1 {v3.8b}, [%[filter_ptr]], x5\n"
-        "sshll v2.8h, v2.8b, #0\n"
-        "ld1 {v4.8b}, [%[filter_ptr]], x5\n"
-        "sshll v3.8h, v3.8b, #0\n"
-        "ld1 {v5.8b}, [%[filter_ptr]], x5\n"
-        "sshll v4.8h, v4.8b, #0\n"
-        "ld1 {v6.8b}, [%[filter_ptr]], x5\n"
-        "sshll v5.8h, v5.8b, #0\n"
-        "ld1 {v7.8b}, [%[filter_ptr]], x5\n"
-        "sshll v6.8h, v6.8b, #0\n"
-        "ld1 {v8.8b}, [%[filter_ptr]]\n"
-        "sshll v7.8h, v7.8b, #0\n"
-        "sshll v8.8h, v8.8b, #0\n"
-
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_2_LOOP ":\n"
-          // Load the first two rows of the 5x5 input window, then reuse the
-          // same registers to load subsequent rows as they become available.
-          "mov x11, %[input_ptr]\n"
-          "mov x12, x11\n"
-          "add x13, x12, %[input_row_size]\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "mov w14, %w[output_window_width]\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          // The height 2 / width 2 loop loads an extra 1 output horizontally in
-          // anticipation for the next iteration. Make sure
-          // |output_window_width| is large enough to handle the additional
-          // load, otherwise jump to the appropriate label to handle smaller
-          // widths.
-          "cmp w14, #2\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x15, x13, %[input_row_size]\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "mov x6, %[output_ptr]\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "add x7, %[output_ptr], x19\n"
-          "ld1 {v16.8b}, [x13], %[input_depth]\n"
-          "ld1 {v21.4s}, [%[bias_ptr]]\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "ld1 {v23.4s}, [%[bias_ptr]]\n"
-          "saddw v9.8h, v28.8h, v9.8b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "saddw v10.8h, v28.8h, v10.8b\n"
-          "ld1 {v19.4s}, [%[bias_ptr]]\n"
-          "saddw v11.8h, v28.8h, v11.8b\n"
-          "ld1 {v20.4s}, [x10]\n"
-          "saddw v14.8h, v28.8h, v14.8b\n"
-          "ld1 {v25.4s}, [%[bias_ptr]]\n"
-          "saddw v15.8h, v28.8h, v15.8b\n"
-          "ld1 {v26.4s}, [x10]\n"
-          "saddw v16.8h, v28.8h, v16.8b\n"
-
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "f\n"
-          "cmp w14, #1\n"
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          //"loop_%=:\n"
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP ":\n"
-            "smlal v21.4s, v0.4h, v9.4h\n"
-            "ld1 {v12.8b}, [x12], %[input_depth]\n"
-            "smlal2 v22.4s, v0.8h, v9.8h\n"
-            "ld1 {v13.8b}, [x12]\n"
-            "add x12, x15, %[input_row_size]\n"
-            "smlal v23.4s, v0.4h, v11.4h\n"
-            "ld1 {v17.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v0.8h, v11.8h\n"
-            "ld1 {v18.8b}, [x13]\n"
-            "add x13, x12, %[input_row_size]\n"
-            "smlal v21.4s, v1.4h, v10.4h\n"
-            "ld1 {v9.8b}, [x15], %[input_depth]\n"
-            "smlal2 v22.4s, v1.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x15], %[input_depth]\n"
-            "smlal v21.4s, v2.4h, v11.4h\n"
-            "smlal2 v22.4s, v2.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x15], %[input_depth]\n"
-            "smlal v21.4s, v3.4h, v14.4h\n"
-            "smlal2 v22.4s, v3.8h, v14.8h\n"
-            "ld1 {v14.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v3.4h, v16.4h\n"
-            "subs w14, w14, #2\n"
-            "smlal2 v24.4s, v3.8h, v16.8h\n"
-            "cmp w14, #3\n"
-            "smlal v21.4s, v4.4h, v15.4h\n"
-            "saddw v12.8h, v28.8h, v12.8b\n"
-            "smlal2 v22.4s, v4.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x12], %[input_depth]\n"
-            "smlal v21.4s, v5.4h, v16.4h\n"
-            "saddw v13.8h, v28.8h, v13.8b\n"
-            "smlal2 v22.4s, v5.8h, v16.8h\n"
-            "ld1 {v16.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v1.4h, v12.4h\n"
-            "saddw v17.8h, v28.8h, v17.8b\n"
-            "smlal2 v24.4s, v1.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x15], %[input_depth]\n"
-            "smlal v23.4s, v2.4h, v13.4h\n"
-            "saddw v18.8h, v28.8h, v18.8b\n"
-            "smlal2 v24.4s, v2.8h, v13.8h\n"
-            "ld1 {v13.8b}, [x15]\n"
-            "smlal v23.4s, v4.4h, v17.4h\n"
-            "saddw v9.8h, v28.8h, v9.8b\n"
-            "smlal2 v24.4s, v4.8h, v17.8h\n"
-            "ld1 {v17.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v5.4h, v18.4h\n"
-            "saddw v10.8h, v28.8h, v10.8b\n"
-            "smlal2 v24.4s, v5.8h, v18.8h\n"
-            "ld1 {v18.8b}, [x12]\n"
-
-            "smlal v21.4s, v6.4h, v9.4h\n"
-            "smlal2 v22.4s, v6.8h, v9.8h\n"
-            "smlal v19.4s, v0.4h, v9.4h\n"
-            "saddw v11.8h, v28.8h, v11.8b\n"
-            "smlal2 v20.4s, v0.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v6.4h, v11.4h\n"
-            "smlal2 v24.4s, v6.8h, v11.8h\n"
-            "smlal v21.4s, v7.4h, v10.4h\n"
-            "smlal2 v22.4s, v7.8h, v10.8h\n"
-            "saddw v12.8h, v28.8h, v12.8b\n"
-            "smlal v19.4s, v1.4h, v10.4h\n"
-            "smlal2 v20.4s, v1.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v7.4h, v12.4h\n"
-            "smlal2 v24.4s, v7.8h, v12.8h\n"
-            "smlal v25.4s, v1.4h, v12.4h\n"
-            "smlal2 v26.4s, v1.8h, v12.8h\n"
-            "smlal v21.4s, v8.4h, v11.4h\n"
-            "smlal2 v22.4s, v8.8h, v11.8h\n"
-            "add x11, x11, %[input_width_increment]\n"
-            "smlal v19.4s, v2.4h, v11.4h\n"
-            "mov x12, x11\n"
-            "smlal2 v20.4s, v2.8h, v11.8h\n"
-            "saddw v13.8h, v28.8h, v13.8b\n"
-            "smlal v25.4s, v0.4h, v11.4h\n"
-            "smlal2 v26.4s, v0.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v8.4h, v13.4h\n"
-            "ld1 {v12.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v8.8h, v13.8h\n"
-            "smlal v25.4s, v2.4h, v13.4h\n"
-            "smlal2 v26.4s, v2.8h, v13.8h\n"
-            "ld1 {v13.8b}, [x13]\n"
-            "add x13, x12, %[input_row_size]\n"
-            "add x15, x13, %[input_row_size]\n"
-
-            "ld1 {v27.4s, v28.4s}, [%[output_shift_ptr]]\n"
-            "sqrdmulh v21.4s, v21.4s, v30.4s\n"
-            "sqrdmulh v22.4s, v22.4s, v31.4s\n"
-            "sqrdmulh v23.4s, v23.4s, v30.4s\n"
-            "sqrdmulh v24.4s, v24.4s, v31.4s\n"
-            "sqrshl v21.4s, v21.4s, v27.4s\n"
-            "sqrshl v22.4s, v22.4s, v28.4s\n"
-            "sqrshl v23.4s, v23.4s, v27.4s\n"
-            "sqrshl v24.4s, v24.4s, v28.4s\n"
-            "dup v28.8h, w0\n"
-            "sqxtn v21.4h, v21.4s\n"
-            "sqxtn2 v21.8h, v22.4s\n"
-            "sqxtn v23.4h, v23.4s\n"
-            "sqxtn2 v23.8h, v24.4s\n"
-            "sqadd v21.8h, v21.8h, v29.8h\n"
-            "sqadd v23.8h, v23.8h, v29.8h\n"
-            "sqxtn v21.8b, v21.8h\n"
-            "sqxtn2 v21.16b, v23.8h\n"
-            "dup v27.16b, w3\n"
-            "dup v29.16b, w4\n"
-            "ld1 {v22.4s}, [x10]\n"
-            "smax v21.16b, v21.16b, v27.16b\n"
-            "smin v21.16b, v21.16b, v29.16b\n"
-            "ld1 {v24.4s}, [x10]\n"
-            "dup v29.8h, w2\n"
-            "saddw v9.8h, v28.8h, v9.8b\n"
-            "st1 {v21.8b}, [x6], x5\n"
-            "saddw v10.8h, v28.8h, v10.8b\n"
-            "mov v23.d[0], v21.d[1]\n"
-            "st1 {v23.8b}, [x6], x5\n"
-            "saddw v11.8h, v28.8h, v11.8b\n"
-
-            "smlal v19.4s, v6.4h, v9.4h\n"
-            "smlal2 v20.4s, v6.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v6.4h, v11.4h\n"
-            "smlal2 v26.4s, v6.8h, v11.8h\n"
-            "smlal v19.4s, v7.4h, v10.4h\n"
-            "saddw v12.8h, v28.8h, v12.8b\n"
-            "smlal2 v20.4s, v7.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v7.4h, v12.4h\n"
-            "smlal2 v26.4s, v7.8h, v12.8h\n"
-            "smlal v19.4s, v8.4h, v11.4h\n"
-            "saddw v13.8h, v28.8h, v13.8b\n"
-            "smlal2 v20.4s, v8.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v8.4h, v13.4h\n"
-            "saddw v14.8h, v28.8h, v14.8b\n"
-            "smlal2 v26.4s, v8.8h, v13.8h\n"
-            "saddw v16.8h, v28.8h, v16.8b\n"
-            "smlal v19.4s, v3.4h, v14.4h\n"
-            "saddw v15.8h, v28.8h, v15.8b\n"
-            "smlal2 v20.4s, v3.8h, v14.8h\n"
-            "ld1 {v14.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v3.4h, v16.4h\n"
-            "ld1 {v21.4s}, [%[bias_ptr]]\n"
-            "smlal2 v26.4s, v3.8h, v16.8h\n"
-            "ld1 {v23.4s}, [%[bias_ptr]]\n"
-            "smlal v19.4s, v4.4h, v15.4h\n"
-            "saddw v17.8h, v28.8h, v17.8b\n"
-            "smlal2 v20.4s, v4.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v4.4h, v17.4h\n"
-            "smlal2 v26.4s, v4.8h, v17.8h\n"
-            "smlal v19.4s, v5.4h, v16.4h\n"
-            "saddw v18.8h, v28.8h, v18.8b\n"
-            "smlal2 v20.4s, v5.8h, v16.8h\n"
-            "ld1 {v16.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v5.4h, v18.4h\n"
-            "smlal2 v26.4s, v5.8h, v18.8h\n"
-
-            "ld1 {v27.4s, v28.4s}, [%[output_shift_ptr]]\n"
-            "sqrdmulh v19.4s, v19.4s, v30.4s\n"
-            "sqrdmulh v20.4s, v20.4s, v31.4s\n"
-            "sqrdmulh v25.4s, v25.4s, v30.4s\n"
-            "sqrdmulh v26.4s, v26.4s, v31.4s\n"
-            "sqrshl v19.4s, v19.4s, v27.4s\n"
-            "sqrshl v20.4s, v20.4s, v28.4s\n"
-            "sqrshl v25.4s, v25.4s, v27.4s\n"
-            "sqrshl v26.4s, v26.4s, v28.4s\n"
-            "dup v28.8h, w0\n"
-            "sqxtn v19.4h, v19.4s\n"
-            "sqxtn2 v19.8h, v20.4s\n"
-            "sqxtn v25.4h, v25.4s\n"
-            "sqxtn2 v25.8h, v26.4s\n"
-            "sqadd v19.8h, v19.8h, v29.8h\n"
-            "sqadd v25.8h, v25.8h, v29.8h\n"
-            "sqxtn v19.8b, v19.8h\n"
-            "sqxtn2 v19.16b, v25.8h\n"
-            "dup v27.16b, w3\n"
-            "dup v29.16b, w4\n"
-            "ld1 {v20.4s}, [x10]\n"
-            "smax v19.16b, v19.16b, v27.16b\n"
-            "smin v19.16b, v19.16b, v29.16b\n"
-            "ld1 {v26.4s}, [x10]\n"
-            "dup v29.8h, w2\n"
-            "saddw v9.8h, v28.8h, v9.8b\n"
-            "st1 {v19.8b}, [x7], x5\n"
-            "saddw v10.8h, v28.8h, v10.8b\n"
-            "mov v25.d[0], v19.d[1]\n"
-            "st1 {v25.8b}, [x7], x5\n"
-            "saddw v11.8h, v28.8h, v11.8b\n"
-            "ld1 {v19.4s}, [%[bias_ptr]]\n"
-            "saddw v14.8h, v28.8h, v14.8b\n"
-            "ld1 {v25.4s}, [%[bias_ptr]]\n"
-            "saddw v15.8h, v28.8h, v15.8b\n"
-            "saddw v16.8h, v28.8h, v16.8b\n"
-
-            "bge " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "b\n"
-
-          // At this point, there will be one of 2 width or 1 width leftover,
-          // not both.
-          "cmp w14, #2\n"
-          "blt " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          // Handle last 2 columns if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER ":\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v12.8b}, [x12], %[input_depth]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v13.8b}, [x12]\n"
-          "add x12, x15, %[input_row_size]\n"
-          "smlal v23.4s, v0.4h, v11.4h\n"
-          "ld1 {v17.8b}, [x13], %[input_depth]\n"
-          "smlal2 v24.4s, v0.8h, v11.8h\n"
-          "ld1 {v18.8b}, [x13]\n"
-          "add x13, x12, %[input_row_size]\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "ld1 {v9.8b}, [x15], %[input_depth]\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v3.4h, v14.4h\n"
-          "smlal2 v22.4s, v3.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v3.4h, v16.4h\n"
-          "smlal2 v24.4s, v3.8h, v16.8h\n"
-          "smlal v21.4s, v4.4h, v15.4h\n"
-          "saddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v22.4s, v4.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v5.4h, v16.4h\n"
-          "saddw v13.8h, v28.8h, v13.8b\n"
-          "smlal2 v22.4s, v5.8h, v16.8h\n"
-          "ld1 {v16.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v1.4h, v12.4h\n"
-          "saddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v24.4s, v1.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x15], %[input_depth]\n"
-          "smlal v23.4s, v2.4h, v13.4h\n"
-          "saddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v24.4s, v2.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x15]\n"
-          "smlal v23.4s, v4.4h, v17.4h\n"
-          "saddw v9.8h, v28.8h, v9.8b\n"
-          "smlal2 v24.4s, v4.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v5.4h, v18.4h\n"
-          "saddw v10.8h, v28.8h, v10.8b\n"
-          "smlal2 v24.4s, v5.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x12]\n"
-
-          "smlal v21.4s, v6.4h, v9.4h\n"
-          "smlal2 v22.4s, v6.8h, v9.8h\n"
-          "smlal v19.4s, v0.4h, v9.4h\n"
-          "saddw v11.8h, v28.8h, v11.8b\n"
-          "smlal2 v20.4s, v0.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v6.4h, v11.4h\n"
-          "smlal2 v24.4s, v6.8h, v11.8h\n"
-          "smlal v21.4s, v7.4h, v10.4h\n"
-          "smlal2 v22.4s, v7.8h, v10.8h\n"
-          "saddw v12.8h, v28.8h, v12.8b\n"
-          "smlal v19.4s, v1.4h, v10.4h\n"
-          "smlal2 v20.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v7.4h, v12.4h\n"
-          "smlal2 v24.4s, v7.8h, v12.8h\n"
-          "smlal v25.4s, v1.4h, v12.4h\n"
-          "smlal2 v26.4s, v1.8h, v12.8h\n"
-          "smlal v21.4s, v8.4h, v11.4h\n"
-          "smlal2 v22.4s, v8.8h, v11.8h\n"
-          "smlal v19.4s, v2.4h, v11.4h\n"
-          "smlal2 v20.4s, v2.8h, v11.8h\n"
-          "saddw v13.8h, v28.8h, v13.8b\n"
-          "smlal v25.4s, v0.4h, v11.4h\n"
-          "smlal2 v26.4s, v0.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v8.4h, v13.4h\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "smlal2 v24.4s, v8.8h, v13.8h\n"
-          "smlal v25.4s, v2.4h, v13.4h\n"
-          "smlal2 v26.4s, v2.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13]\n"
-
-          "ld1 {v27.4s, v28.4s}, [%[output_shift_ptr]]\n"
-          "sqrdmulh v21.4s, v21.4s, v30.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v31.4s\n"
-          "sqrdmulh v23.4s, v23.4s, v30.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v31.4s\n"
-          "sqrshl v21.4s, v21.4s, v27.4s\n"
-          "sqrshl v22.4s, v22.4s, v28.4s\n"
-          "sqrshl v23.4s, v23.4s, v27.4s\n"
-          "sqrshl v24.4s, v24.4s, v28.4s\n"
-          "dup v28.8h, w0\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtn v21.8b, v21.8h\n"
-          "sqxtn2 v21.16b, v23.8h\n"
-          "dup v27.16b, w3\n"
-          "dup v29.16b, w4\n"
-          "ld1 {v22.4s}, [x10]\n"
-          "smax v21.16b, v21.16b, v27.16b\n"
-          "smin v21.16b, v21.16b, v29.16b\n"
-          "ld1 {v24.4s}, [x10]\n"
-          "dup v29.8h, w2\n"
-          "saddw v9.8h, v28.8h, v9.8b\n"
-          "st1 {v21.8b}, [x6], x5\n"
-          "saddw v10.8h, v28.8h, v10.8b\n"
-          "mov v23.d[0], v21.d[1]\n"
-          "st1 {v23.8b}, [x6]\n"
-          "saddw v11.8h, v28.8h, v11.8b\n"
-
-          "smlal v19.4s, v6.4h, v9.4h\n"
-          "smlal2 v20.4s, v6.8h, v9.8h\n"
-          "smlal v25.4s, v6.4h, v11.4h\n"
-          "smlal2 v26.4s, v6.8h, v11.8h\n"
-          "smlal v19.4s, v7.4h, v10.4h\n"
-          "saddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v20.4s, v7.8h, v10.8h\n"
-          "smlal v25.4s, v7.4h, v12.4h\n"
-          "smlal2 v26.4s, v7.8h, v12.8h\n"
-          "smlal v19.4s, v8.4h, v11.4h\n"
-          "saddw v13.8h, v28.8h, v13.8b\n"
-          "smlal2 v20.4s, v8.8h, v11.8h\n"
-          "smlal v25.4s, v8.4h, v13.4h\n"
-          "saddw v14.8h, v28.8h, v14.8b\n"
-          "smlal2 v26.4s, v8.8h, v13.8h\n"
-          "saddw v16.8h, v28.8h, v16.8b\n"
-          "smlal v19.4s, v3.4h, v14.4h\n"
-          "saddw v15.8h, v28.8h, v15.8b\n"
-          "smlal2 v20.4s, v3.8h, v14.8h\n"
-          "smlal v25.4s, v3.4h, v16.4h\n"
-          "smlal2 v26.4s, v3.8h, v16.8h\n"
-          "smlal v19.4s, v4.4h, v15.4h\n"
-          "saddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v20.4s, v4.8h, v15.8h\n"
-          "smlal v25.4s, v4.4h, v17.4h\n"
-          "smlal2 v26.4s, v4.8h, v17.8h\n"
-          "smlal v19.4s, v5.4h, v16.4h\n"
-          "saddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v20.4s, v5.8h, v16.8h\n"
-          "smlal v25.4s, v5.4h, v18.4h\n"
-          "smlal2 v26.4s, v5.8h, v18.8h\n"
-
-          "ld1 {v27.4s, v28.4s}, [%[output_shift_ptr]]\n"
-          "sqrdmulh v19.4s, v19.4s, v30.4s\n"
-          "sqrdmulh v20.4s, v20.4s, v31.4s\n"
-          "sqrdmulh v25.4s, v25.4s, v30.4s\n"
-          "sqrdmulh v26.4s, v26.4s, v31.4s\n"
-          "sqrshl v19.4s, v19.4s, v27.4s\n"
-          "sqrshl v20.4s, v20.4s, v28.4s\n"
-          "sqrshl v25.4s, v25.4s, v27.4s\n"
-          "sqrshl v26.4s, v26.4s, v28.4s\n"
-          "dup v28.8h, w0\n"
-          "sqxtn v19.4h, v19.4s\n"
-          "sqxtn2 v19.8h, v20.4s\n"
-          "sqxtn v25.4h, v25.4s\n"
-          "sqxtn2 v25.8h, v26.4s\n"
-          "sqadd v19.8h, v19.8h, v29.8h\n"
-          "sqadd v25.8h, v25.8h, v29.8h\n"
-          "dup v27.16b, w3\n"
-          "dup v29.16b, w4\n"
-          "sqxtn v19.8b, v19.8h\n"
-          "sqxtn2 v19.16b, v25.8h\n"
-          "smax v19.16b, v19.16b, v27.16b\n"
-          "smin v19.16b, v19.16b, v29.16b\n"
-          "st1 {v19.8b}, [x7], x5\n"
-          "dup v29.8h, w2\n"
-          "mov v25.d[0], v19.d[1]\n"
-          "st1 {v25.8b}, [x7]\n"
-          "b " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "f\n"
-
-          // Handle last column if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER ":\n"
-          // Registers v9, v10, v11, v14, v15, and v16 have already been loaded
-          // with the correct values at this point. This corresponds to the
-          // first two input rows of the top left output. Now load the last
-          // input row for this output. Once these inputs are no longer needed,
-          // load the input rows for the bottom left output.
-          "add x12, x15, %[input_row_size]\n"
-          "add x13, x12, %[input_row_size]\n"
-
-          "ld1 {v12.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v13.8b}, [x15], %[input_depth]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v17.8b}, [x15]\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x12]\n"
-          "smlal v21.4s, v3.4h, v14.4h\n"
-          "smlal2 v22.4s, v3.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v21.4s, v4.4h, v15.4h\n"
-          "smlal2 v22.4s, v4.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "smlal v21.4s, v5.4h, v16.4h\n"
-          "saddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v22.4s, v5.8h, v16.8h\n"
-          "saddw v13.8h, v28.8h, v13.8b\n"
-          "ld1 {v16.8b}, [x13]\n"
-
-          "smlal v21.4s, v6.4h, v12.4h\n"
-          "smlal2 v22.4s, v6.8h, v12.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "saddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v7.4h, v13.4h\n"
-          "smlal2 v22.4s, v7.8h, v13.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v2.4h, v17.4h\n"
-          "smlal2 v24.4s, v2.8h, v17.8h\n"
-
-          "ld1 {v26.4s, v27.4s}, [%[output_shift_ptr]]\n"
-          "sqrdmulh v21.4s, v21.4s, v30.4s\n"
-          "sqrdmulh v22.4s, v22.4s, v31.4s\n"
-          "sqrshl v21.4s, v21.4s, v26.4s\n"
-          "sqrshl v22.4s, v22.4s, v27.4s\n"
-          "sqxtn v21.4h, v21.4s\n"
-          "sqxtn2 v21.8h, v22.4s\n"
-          "dup v26.16b, w3\n"
-          "dup v27.16b, w4\n"
-          "sqadd v21.8h, v21.8h, v29.8h\n"
-          "sqxtn v21.8b, v21.8h\n"
-          "smax v21.8b, v21.8b, v26.8b\n"
-          "smin v21.8b, v21.8b, v27.8b\n"
-          "saddw v9.8h, v28.8h, v9.8b\n"
-          "st1 {v21.8b}, [x6]\n"
-          "saddw v10.8h, v28.8h, v10.8b\n"
-
-          "smlal v23.4s, v3.4h, v9.4h\n"
-          "saddw v11.8h, v28.8h, v11.8b\n"
-          "smlal2 v24.4s, v3.8h, v9.8h\n"
-          "saddw v14.8h, v28.8h, v14.8b\n"
-          "smlal v23.4s, v4.4h, v10.4h\n"
-          "saddw v15.8h, v28.8h, v15.8b\n"
-          "smlal2 v24.4s, v4.8h, v10.8h\n"
-          "saddw v16.8h, v28.8h, v16.8b\n"
-          "smlal v23.4s, v5.4h, v11.4h\n"
-          "smlal2 v24.4s, v5.8h, v11.8h\n"
-
-          "smlal v23.4s, v6.4h, v14.4h\n"
-          "smlal2 v24.4s, v6.8h, v14.8h\n"
-          "smlal v23.4s, v7.4h, v15.4h\n"
-          "smlal2 v24.4s, v7.8h, v15.8h\n"
-          "smlal v23.4s, v8.4h, v16.4h\n"
-          "smlal2 v24.4s, v8.8h, v16.8h\n"
-
-          "ld1 {v26.4s, v27.4s}, [%[output_shift_ptr]]\n"
-          "sqrdmulh v23.4s, v23.4s, v30.4s\n"
-          "sqrdmulh v24.4s, v24.4s, v31.4s\n"
-          "sqrshl v23.4s, v23.4s, v26.4s\n"
-          "sqrshl v24.4s, v24.4s, v27.4s\n"
-          "sqxtn v23.4h, v23.4s\n"
-          "sqxtn2 v23.8h, v24.4s\n"
-          "dup v26.16b, w3\n"
-          "dup v27.16b, w4\n"
-          "sqadd v23.8h, v23.8h, v29.8h\n"
-          "sqxtn v23.8b, v23.8h\n"
-          "smax v23.8b, v23.8b, v26.8b\n"
-          "smin v23.8b, v23.8b, v27.8b\n"
-          "st1 {v23.8b}, [x7]\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP ":\n"
-          "subs %w[output_window_height], %w[output_window_height], #2\n"
-          "add %[input_ptr], %[input_ptr], %[input_height_increment]\n"
-          "cmp %w[output_window_height], #2\n"
-          "add %[output_ptr], %[output_ptr], %[output_height_increment]\n"
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP ":\n"
-        "cmp %w[output_window_height], #1\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_1 ":\n"
-        "mov x11, %[input_ptr]\n"
-        "mov x12, x11\n"
-        "add x13, x12, %[input_row_size]\n"
-        "ld1 {v9.8b}, [x12], %[input_depth]\n"
-        "add x15, x13, %[input_row_size]\n"
-        "ld1 {v10.8b}, [x12], %[input_depth]\n"
-        "mov x6, %[output_ptr]\n"
-        "ld1 {v11.8b}, [x12], %[input_depth]\n"
-        "mov w14, %w[output_window_width]\n"
-        // The height 1 / width 2 loop loads an extra 1x1 output in anticipation
-        // for the next iteration. Make sure |output_window_width| is large
-        // enough to handle the additional load, otherwise jump to the
-        // appropriate label to handle smaller widths.
-        "cmp w14, #2\n"
-        "ld1 {v12.8b}, [x13], %[input_depth]\n"
-        "ld1 {v13.8b}, [x13], %[input_depth]\n"
-        "ld1 {v14.8b}, [x13], %[input_depth]\n"
-        "ld1 {v15.8b}, [x15], %[input_depth]\n"
-        "ld1 {v16.8b}, [x15], %[input_depth]\n"
-        "ld1 {v17.8b}, [x15], %[input_depth]\n"
-
-        "saddw v9.8h, v28.8h, v9.8b\n"
-        "ld1 {v24.4s}, [%[bias_ptr]]\n"
-        "saddw v10.8h, v28.8h, v10.8b\n"
-        "ld1 {v25.4s}, [x10]\n"
-        "saddw v11.8h, v28.8h, v11.8b\n"
-        "ld1 {v26.4s}, [%[bias_ptr]]\n"
-        "ld1 {v27.4s}, [x10]\n"
-        "saddw v12.8h, v28.8h, v12.8b\n"
-        "saddw v13.8h, v28.8h, v13.8b\n"
-        "saddw v14.8h, v28.8h, v14.8b\n"
-        "saddw v15.8h, v28.8h, v15.8b\n"
-        "saddw v16.8h, v28.8h, v16.8b\n"
-        "saddw v17.8h, v28.8h, v17.8b\n"
-
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "f\n"
-        "cmp w14, #1\n"
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP ":\n"
-          "smlal v24.4s, v0.4h, v9.4h\n"
-          "ld1 {v18.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v0.8h, v9.8h\n"
-          "ld1 {v19.8b}, [x12]\n"
-          "smlal v26.4s, v0.4h, v11.4h\n"
-          "ld1 {v20.8b}, [x13], %[input_depth]\n"
-          "smlal2 v27.4s, v0.8h, v11.8h\n"
-          "ld1 {v21.8b}, [x13]\n"
-          "smlal v24.4s, v1.4h, v10.4h\n"
-          "ld1 {v22.8b}, [x15], %[input_depth]\n"
-          "smlal2 v25.4s, v1.8h, v10.8h\n"
-          "ld1 {v23.8b}, [x15]\n"
-          "smlal v24.4s, v2.4h, v11.4h\n"
-          "subs w14, w14, #2\n"
-          "smlal2 v25.4s, v2.8h, v11.8h\n"
-          "cmp w14, #3\n"
-          "smlal v24.4s, v3.4h, v12.4h\n"
-          "add x11, x11, %[input_width_increment]\n"
-          "smlal2 v25.4s, v3.8h, v12.8h\n"
-          "mov x12, x11\n"
-          "smlal v26.4s, v3.4h, v14.4h\n"
-          "add x13, x12, %[input_row_size]\n"
-          "smlal2 v27.4s, v3.8h, v14.8h\n"
-          "add x15, x13, %[input_row_size]\n"
-          "smlal v24.4s, v4.4h, v13.4h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v4.8h, v13.8h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "smlal v24.4s, v5.4h, v14.4h\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v5.8h, v14.8h\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "smlal v24.4s, v6.4h, v15.4h\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "smlal2 v25.4s, v6.8h, v15.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v26.4s, v6.4h, v17.4h\n"
-          "ld1 {v15.8b}, [x15], %[input_depth]\n"
-          "smlal2 v27.4s, v6.8h, v17.8h\n"
-          "smlal v24.4s, v7.4h, v16.4h\n"
-          "smlal2 v25.4s, v7.8h, v16.8h\n"
-          "ld1 {v16.8b}, [x15], %[input_depth]\n"
-          "smlal v24.4s, v8.4h, v17.4h\n"
-          "saddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v25.4s, v8.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x15], %[input_depth]\n"
-          "saddw v19.8h, v28.8h, v19.8b\n"
-
-          "smlal v26.4s, v1.4h, v18.4h\n"
-          "saddw v20.8h, v28.8h, v20.8b\n"
-          "smlal2 v27.4s, v1.8h, v18.8h\n"
-          "smlal v26.4s, v2.4h, v19.4h\n"
-          "saddw v21.8h, v28.8h, v21.8b\n"
-          "smlal2 v27.4s, v2.8h, v19.8h\n"
-          "smlal v26.4s, v4.4h, v20.4h\n"
-          "smlal v26.4s, v5.4h, v21.4h\n"
-          "smlal2 v27.4s, v4.8h, v20.8h\n"
-          "saddw v22.8h, v28.8h, v22.8b\n"
-          "smlal2 v27.4s, v5.8h, v21.8h\n"
-          "saddw v23.8h, v28.8h, v23.8b\n"
-          "smlal v26.4s, v7.4h, v22.4h\n"
-          "smlal2 v27.4s, v7.8h, v22.8h\n"
-          "smlal v26.4s, v8.4h, v23.4h\n"
-          "smlal2 v27.4s, v8.8h, v23.8h\n"
-
-          "ld1 {v28.4s, v29.4s}, [%[output_shift_ptr]]\n"
-          "sqrdmulh v24.4s, v24.4s, v30.4s\n"
-          "sqrdmulh v25.4s, v25.4s, v31.4s\n"
-          "sqrdmulh v26.4s, v26.4s, v30.4s\n"
-          "sqrdmulh v27.4s, v27.4s, v31.4s\n"
-          "sqrshl v24.4s, v24.4s, v28.4s\n"
-          "sqrshl v25.4s, v25.4s, v29.4s\n"
-          "sqrshl v26.4s, v26.4s, v28.4s\n"
-          "sqrshl v27.4s, v27.4s, v29.4s\n"
-          "dup v28.8h, w2\n"
-          "sqxtn v24.4h, v24.4s\n"
-          "sqxtn2 v24.8h, v25.4s\n"
-          "sqxtn v26.4h, v26.4s\n"
-          "sqxtn2 v26.8h, v27.4s\n"
-          "sqadd v24.8h, v24.8h, v28.8h\n"
-          "sqadd v26.8h, v26.8h, v28.8h\n"
-          "sqxtn v24.8b, v24.8h\n"
-          "sqxtn2 v24.16b, v26.8h\n"
-          "dup v28.8h, w0\n"
-          "dup v27.16b, w3\n"
-          "dup v29.16b, w4\n"
-          "ld1 {v25.4s}, [x10]\n"
-          "smax v24.16b, v24.16b, v27.16b\n"
-          "smin v24.16b, v24.16b, v29.16b\n"
-          "saddw v9.8h, v28.8h, v9.8b\n"
-          "st1 {v24.8b}, [x6], x5\n"
-          "ld1 {v27.4s}, [x10]\n"
-          "saddw v10.8h, v28.8h, v10.8b\n"
-          "mov v26.d[0], v24.d[1]\n"
-          "st1 {v26.8b}, [x6], x5\n"
-          "saddw v11.8h, v28.8h, v11.8b\n"
-          "saddw v12.8h, v28.8h, v12.8b\n"
-          "saddw v13.8h, v28.8h, v13.8b\n"
-          "saddw v14.8h, v28.8h, v14.8b\n"
-          "ld1 {v24.4s}, [%[bias_ptr]]\n"
-          "saddw v15.8h, v28.8h, v15.8b\n"
-          "ld1 {v26.4s}, [%[bias_ptr]]\n"
-          "saddw v16.8h, v28.8h, v16.8b\n"
-          "saddw v17.8h, v28.8h, v17.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "b\n"
-
-        // At this point, there will be one of 2 width or 1 width leftover,
-        // not both.
-        "cmp w14, #2\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        // Handle last two horizontal outputs if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER ":\n"
-        "smlal v24.4s, v0.4h, v9.4h\n"
-        "ld1 {v18.8b}, [x12], %[input_depth]\n"
-        "smlal2 v25.4s, v0.8h, v9.8h\n"
-        "ld1 {v19.8b}, [x12]\n"
-        "smlal v26.4s, v0.4h, v11.4h\n"
-        "ld1 {v20.8b}, [x13], %[input_depth]\n"
-        "smlal2 v27.4s, v0.8h, v11.8h\n"
-        "ld1 {v21.8b}, [x13]\n"
-        "smlal v24.4s, v1.4h, v10.4h\n"
-        "ld1 {v22.8b}, [x15], %[input_depth]\n"
-        "smlal2 v25.4s, v1.8h, v10.8h\n"
-        "ld1 {v23.8b}, [x15]\n"
-        "smlal v24.4s, v2.4h, v11.4h\n"
-        "smlal2 v25.4s, v2.8h, v11.8h\n"
-        "smlal v24.4s, v3.4h, v12.4h\n"
-        "smlal2 v25.4s, v3.8h, v12.8h\n"
-        "smlal v26.4s, v3.4h, v14.4h\n"
-        "smlal2 v27.4s, v3.8h, v14.8h\n"
-        "smlal v24.4s, v4.4h, v13.4h\n"
-        "smlal2 v25.4s, v4.8h, v13.8h\n"
-        "smlal v24.4s, v5.4h, v14.4h\n"
-        "smlal2 v25.4s, v5.8h, v14.8h\n"
-        "smlal v24.4s, v6.4h, v15.4h\n"
-        "smlal2 v25.4s, v6.8h, v15.8h\n"
-        "smlal v26.4s, v6.4h, v17.4h\n"
-        "smlal2 v27.4s, v6.8h, v17.8h\n"
-        "smlal v24.4s, v7.4h, v16.4h\n"
-        "smlal2 v25.4s, v7.8h, v16.8h\n"
-        "smlal v24.4s, v8.4h, v17.4h\n"
-        "saddw v18.8h, v28.8h, v18.8b\n"
-        "smlal2 v25.4s, v8.8h, v17.8h\n"
-        "saddw v19.8h, v28.8h, v19.8b\n"
-
-        "smlal v26.4s, v1.4h, v18.4h\n"
-        "saddw v20.8h, v28.8h, v20.8b\n"
-        "smlal2 v27.4s, v1.8h, v18.8h\n"
-        "smlal v26.4s, v2.4h, v19.4h\n"
-        "saddw v21.8h, v28.8h, v21.8b\n"
-        "smlal2 v27.4s, v2.8h, v19.8h\n"
-        "smlal v26.4s, v4.4h, v20.4h\n"
-        "smlal v26.4s, v5.4h, v21.4h\n"
-        "smlal2 v27.4s, v4.8h, v20.8h\n"
-        "saddw v22.8h, v28.8h, v22.8b\n"
-        "smlal2 v27.4s, v5.8h, v21.8h\n"
-        "saddw v23.8h, v28.8h, v23.8b\n"
-        "smlal v26.4s, v7.4h, v22.4h\n"
-        "smlal2 v27.4s, v7.8h, v22.8h\n"
-        "smlal v26.4s, v8.4h, v23.4h\n"
-        "smlal2 v27.4s, v8.8h, v23.8h\n"
-
-        "ld1 {v28.4s, v29.4s}, [%[output_shift_ptr]]\n"
-        "sqrdmulh v24.4s, v24.4s, v30.4s\n"
-        "sqrdmulh v25.4s, v25.4s, v31.4s\n"
-        "sqrdmulh v26.4s, v26.4s, v30.4s\n"
-        "sqrdmulh v27.4s, v27.4s, v31.4s\n"
-        "sqrshl v24.4s, v24.4s, v28.4s\n"
-        "sqrshl v25.4s, v25.4s, v29.4s\n"
-        "sqrshl v26.4s, v26.4s, v28.4s\n"
-        "sqrshl v27.4s, v27.4s, v29.4s\n"
-        "dup v28.8h, w2\n"
-        "sqxtn v24.4h, v24.4s\n"
-        "sqxtn2 v24.8h, v25.4s\n"
-        "sqxtn v26.4h, v26.4s\n"
-        "sqxtn2 v26.8h, v27.4s\n"
-        "sqadd v24.8h, v24.8h, v28.8h\n"
-        "sqadd v26.8h, v26.8h, v28.8h\n"
-        "sqxtn v24.8b, v24.8h\n"
-        "dup v28.16b, w3\n"
-        "dup v29.16b, w4\n"
-        "sqxtn2 v24.16b, v26.8h\n"
-        "smax v24.16b, v24.16b, v28.16b\n"
-        "smin v24.16b, v24.16b, v29.16b\n"
-        "st1 {v24.8b}, [x6], x5\n"
-        "mov v26.d[0], v24.d[1]\n"
-        "st1 {v26.8b}, [x6]\n"
-        "dup v28.8h, w0\n"
-        "b " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        // Handle bottom right output if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER ":\n"
-        "dup v29.8h, w2\n"
-
-        "smlal v24.4s, v0.4h, v9.4h\n"
-        "smlal2 v25.4s, v0.8h, v9.8h\n"
-        "smlal v24.4s, v1.4h, v10.4h\n"
-        "smlal2 v25.4s, v1.8h, v10.8h\n"
-        "smlal v24.4s, v2.4h, v11.4h\n"
-        "smlal2 v25.4s, v2.8h, v11.8h\n"
-        "smlal v24.4s, v3.4h, v12.4h\n"
-        "smlal2 v25.4s, v3.8h, v12.8h\n"
-        "smlal v24.4s, v4.4h, v13.4h\n"
-        "smlal2 v25.4s, v4.8h, v13.8h\n"
-        "smlal v24.4s, v5.4h, v14.4h\n"
-        "smlal2 v25.4s, v5.8h, v14.8h\n"
-        "smlal v24.4s, v6.4h, v15.4h\n"
-        "smlal2 v25.4s, v6.8h, v15.8h\n"
-        "smlal v24.4s, v7.4h, v16.4h\n"
-        "smlal2 v25.4s, v7.8h, v16.8h\n"
-        "smlal v24.4s, v8.4h, v17.4h\n"
-        "smlal2 v25.4s, v8.8h, v17.8h\n"
-
-        "ld1 {v26.4s, v27.4s}, [%[output_shift_ptr]]\n"
-        "sqrdmulh v24.4s, v24.4s, v30.4s\n"
-        "sqrdmulh v25.4s, v25.4s, v31.4s\n"
-        "sqrshl v24.4s, v24.4s, v26.4s\n"
-        "sqrshl v25.4s, v25.4s, v27.4s\n"
-        "sqxtn v24.4h, v24.4s\n"
-        "sqxtn2 v24.8h, v25.4s\n"
-        "dup v26.16b, w3\n"
-        "dup v27.16b, w4\n"
-        "sqadd v24.8h, v24.8h, v29.8h\n"
-        "sqxtn v24.8b, v24.8h\n"
-        "smax v24.8b, v24.8b, v26.8b\n"
-        "smin v24.8b, v24.8b, v27.8b\n"
-        "st1 {v24.8b}, [x6]\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_1_END ":\n"
-    :
-    // Outputs.
-    [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-    [output_ptr] "+r"(output_ptr),
-    [output_window_height] "+r"(output_window_height)
-    :
-    // Inputs.
-    [output_multiplier_ptr] "r"(output_multiplier_ptr),
-    [output_shift_ptr] "r"(output_shift_ptr),
-    [bias_ptr] "r"(bias_ptr), [input_row_size] "r"(input_row_size),
-    [input_depth] "r"(input_depth),
-    [output_window_width] "r"(output_window_width),
-    [input_width_increment] "r"(input_width_increment),
-    [input_height_increment] "r"(input_height_increment),
-    [output_height_increment] "r"(output_height_increment),
-    [params_ptr] "r"(params_ptr)
-    :
-    // Clobbers.
-    "cc", "memory",
-    // We use these NEON registers.
-    "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
-    "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-    "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29",
-    "v30", "v31",
-    // We use these general-purpose registers.
-    "x0", "x2", "x3", "x4", "x5", "x6", "x7",
-    "x10", "x11", "x12", "x13", "x14", "x15",
-    "x19", "x20");
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_END
-  }
-};
-
-template <>
-struct DepthwiseConvPartialPerChannel {
-  static inline void Run(const int32* output_multiplier_ptr,
-                         const int32* output_shift_ptr, const int8* input_ptr,
-                         const int8* filter_ptr, const int32* bias_ptr,
-                         int8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 1x1 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the 1x1 input and filter values.
-        //
-        // Use v6-v7 to hold output_multiplier & v10-v11 to hold output_shift.
-        "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "dup v26.8h, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-        "cmp x11, #16\n"
-        "dup v28.8h, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "ldr w10, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.16b, w9\n"
-        "dup v31.16b, w10\n"
-
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "saddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "sshll v0.8h, v0.8b, #0\n"
-
-        // Loads output_multiplier & output_shift.
-        "ld1 {v6.4s}, [%[output_multiplier_ptr]], #16\n"
-        "ld1 {v10.4s}, [%[output_shift_ptr]], #16\n"
-        "ld1 {v7.4s}, [%[output_multiplier_ptr]], #16\n"
-        "ld1 {v11.4s}, [%[output_shift_ptr]], #16\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "subs x11, x11, #8\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-          "cmp x11, #16\n"
-          "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-
-          "sqrdmulh v16.4s, v16.4s, v6.4s\n"
-          "sqrdmulh v17.4s, v17.4s, v7.4s\n"
-          "sqrshl v16.4s, v16.4s, v10.4s\n"
-          "sqrshl v17.4s, v17.4s, v11.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtn v16.8b, v16.8h\n"
-          "smax v16.8b, v16.8b, v30.8b\n"
-          "smin v16.8b, v16.8b, v31.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "saddw v8.8h, v26.8h, v8.8b\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "sshll v0.8h, v0.8b, #0\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-          "ld1 {v6.4s}, [%[output_multiplier_ptr]], #16\n"
-          "ld1 {v10.4s}, [%[output_shift_ptr]], #16\n"
-          "ld1 {v7.4s}, [%[output_multiplier_ptr]], #16\n"
-          "ld1 {v11.4s}, [%[output_shift_ptr]], #16\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v6.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v7.4s\n"
-        "sqrshl v16.4s, v16.4s, v10.4s\n"
-        "sqrshl v17.4s, v17.4s, v11.4s\n"
-
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtn v16.8b, v16.8h\n"
-        "smax v16.8b, v16.8b, v30.8b\n"
-        "smin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr),
-        [output_multiplier_ptr] "+r"(output_multiplier_ptr),
-        [output_shift_ptr] "+r"(output_shift_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v6", "v7", "v8", "v10", "v11", "v16", "v17", "v18", "v19",
-        "v26", "v28", "v30", "v31",
-        // We use these general-purpose registers.
-        "x9", "x10", "x11");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-template <>
-struct DepthwiseConvPartialPerChannel {
-  static inline void Run(const int32* output_multiplier_ptr,
-                         const int32* output_shift_ptr, const int8* input_ptr,
-                         const int8* filter_ptr, const int32* bias_ptr,
-                         int8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 2x2 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 2x2 input and
-        // filter values.
-        //
-        // Use v4-v5 to hold output_multiplier & v6-v7 to hold output_shift.
-
-        // Load input and filter values.
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "ldr x9, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "cmp x15, #16\n"
-        "add x12, %[input_ptr], x15\n"
-        "add x13, %[input_ptr], x9\n"
-        "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-        "add x14, x13, x15\n"
-        "ld1 {v9.8b}, [x12], #8\n"
-        "ldr x6, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-
-        "add x9, %[filter_ptr], x15\n"
-        "ld1 {v10.8b}, [x13], #8\n"
-        "add x10, %[filter_ptr], x6\n"
-        "ld1 {v11.8b}, [x14], #8\n"
-        "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-        "add x11, x10, x15\n"
-        "ld1 {v1.8b}, [x9], #8\n"
-        "ld1 {v2.8b}, [x10], #8\n"
-        "ld1 {v3.8b}, [x11], #8\n"
-
-        // Load constants.
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "dup v26.8h, w6\n"
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v28.8h, w6\n"
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "ldr w7, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.16b, w6\n"
-        "dup v31.16b, w7\n"
-
-        // Loads output_multiplier & output_shift.
-        "ld1 {v4.4s}, [%[output_multiplier_ptr]], #16\n"
-        "ld1 {v6.4s}, [%[output_shift_ptr]], #16\n"
-        "ld1 {v5.4s}, [%[output_multiplier_ptr]], #16\n"
-        "ld1 {v7.4s}, [%[output_shift_ptr]], #16\n"
-
-        // Add input and filter offsets.
-        "saddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "saddw v9.8h, v26.8h, v9.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "saddw v10.8h, v26.8h, v10.8b\n"
-        "saddw v11.8h, v26.8h, v11.8b\n"
-
-        "sshll v0.8h, v0.8b, #0\n"
-        "sshll v1.8h, v1.8b, #0\n"
-        "sshll v2.8h, v2.8b, #0\n"
-        "sshll v3.8h, v3.8b, #0\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "subs x15, x15, #8\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-          "cmp x15, #16\n"
-          "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x12], #8\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "ld1 {v1.8b}, [x9], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], #8\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v2.8b}, [x10], #8\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x14], #8\n"
-          "ld1 {v3.8b}, [x11], #8\n"
-
-          "sqrdmulh v16.4s, v16.4s, v4.4s\n"
-          "sqrdmulh v17.4s, v17.4s, v5.4s\n"
-          "sqrshl v16.4s, v16.4s, v6.4s\n"
-          "sqrshl v17.4s, v17.4s, v7.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtn v16.8b, v16.8h\n"
-          "smax v16.8b, v16.8b, v30.8b\n"
-          "smin v16.8b, v16.8b, v31.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "saddw v8.8h, v26.8h, v8.8b\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-          "saddw v10.8h, v26.8h, v10.8b\n"
-          "saddw v11.8h, v26.8h, v11.8b\n"
-          "sshll v0.8h, v0.8b, #0\n"
-          "sshll v1.8h, v1.8b, #0\n"
-          "sshll v2.8h, v2.8b, #0\n"
-          "sshll v3.8h, v3.8b, #0\n"
-          "ld1 {v4.4s}, [%[output_multiplier_ptr]], #16\n"
-          "ld1 {v6.4s}, [%[output_shift_ptr]], #16\n"
-          "ld1 {v5.4s}, [%[output_multiplier_ptr]], #16\n"
-          "ld1 {v7.4s}, [%[output_shift_ptr]], #16\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v4.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v5.4s\n"
-        "sqrshl v16.4s, v16.4s, v6.4s\n"
-        "sqrshl v17.4s, v17.4s, v7.4s\n"
-
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtn v16.8b, v16.8h\n"
-        "smax v16.8b, v16.8b, v30.8b\n"
-        "smin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr),
-        [output_multiplier_ptr] "+r"(output_multiplier_ptr),
-        [output_shift_ptr] "+r"(output_shift_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v16", "v17","v18", "v19", "v26", "v28", "v30", "v31",
-        // We use these general-purpose registers.
-        "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-template <>
-struct DepthwiseConvPartialPerChannel {
-  static inline void Run(const int32* output_multiplier_ptr,
-                         const int32* output_shift_ptr, const int8* input_ptr,
-                         const int8* filter_ptr, const int32* bias_ptr,
-                         int8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 2x3 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 2x3 input and
-        // filter values.
-        //
-        // Use v6-v7 to hold output_multiplier & v14-v15 to hold output_shift.
-
-        // Load input and filter values.
-        "ldr x7, [%[params_ptr], #" STR(OFFSET_INPUT_DEPTH) "]\n"
-        "mov x12, %[input_ptr]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "mov x9, %[filter_ptr]\n"
-        "ldr x14, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-        "add x13, x12, x11\n"
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-
-        "ld1 {v8.8b}, [x12], x7\n"
-        "add x10, x9, x14\n"
-        "ld1 {v9.8b}, [x12], x7\n"
-        "cmp x15, #16\n"
-        "ld1 {v10.8b}, [x12]\n"
-        "add %[input_ptr], %[input_ptr], #8\n"
-        "ld1 {v11.8b}, [x13], x7\n"
-        "add %[filter_ptr], %[filter_ptr], #8\n"
-        "ld1 {v12.8b}, [x13], x7\n"
-        "ld1 {v13.8b}, [x13]\n"
-
-        "ld1 {v0.8b}, [x9], x7\n"
-        "ld1 {v1.8b}, [x9], x7\n"
-        "ld1 {v2.8b}, [x9]\n"
-        "ld1 {v3.8b}, [x10], x7\n"
-        "ld1 {v4.8b}, [x10], x7\n"
-        "ld1 {v5.8b}, [x10]\n"
-
-        // Load constants.
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "dup v26.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v28.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.8b, w12\n"
-        "dup v31.8b, w13\n"
-
-        // Loads output_multiplier & output_shift.
-        "ld1 {v6.4s}, [%[output_multiplier_ptr]], #16\n"
-        "ld1 {v14.4s}, [%[output_shift_ptr]], #16\n"
-        "ld1 {v7.4s}, [%[output_multiplier_ptr]], #16\n"
-        "ld1 {v15.4s}, [%[output_shift_ptr]], #16\n"
-
-        // Add input and filter offsets.
-        "saddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "saddw v9.8h, v26.8h, v9.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "saddw v10.8h, v26.8h, v10.8b\n"
-        "saddw v11.8h, v26.8h, v11.8b\n"
-        "saddw v12.8h, v26.8h, v12.8b\n"
-        "saddw v13.8h, v26.8h, v13.8b\n"
-
-        "sshll v0.8h, v0.8b, #0\n"
-        "sshll v1.8h, v1.8b, #0\n"
-        "sshll v2.8h, v2.8b, #0\n"
-        "sshll v3.8h, v3.8b, #0\n"
-        "sshll v4.8h, v4.8b, #0\n"
-        "sshll v5.8h, v5.8b, #0\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "mov x12, %[input_ptr]\n"
-          "subs x15, x15, #8\n"
-          "add x13, x12, x11\n"
-          "cmp x15, #16\n"
-          "add %[input_ptr], %[input_ptr], #8\n"
-
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "mov x9, %[filter_ptr]\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [x12], x7\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "add x10, x9, x14\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x12], x7\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "add %[filter_ptr], %[filter_ptr], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x12]\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v0.8b}, [x9], x7\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13], x7\n"
-          "smlal v16.4s, v4.4h, v12.4h\n"
-          "ld1 {v1.8b}, [x9], x7\n"
-          "smlal2 v17.4s, v4.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x13], x7\n"
-          "smlal v16.4s, v5.4h, v13.4h\n"
-          "ld1 {v2.8b}, [x9]\n"
-          "smlal2 v17.4s, v5.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13]\n"
-
-          "sqrdmulh v16.4s, v16.4s, v6.4s\n"
-          "ld1 {v3.8b}, [x10], x7\n"
-          "sqrdmulh v17.4s, v17.4s, v7.4s\n"
-          "ld1 {v4.8b}, [x10], x7\n"
-          "sqrshl v16.4s, v16.4s, v14.4s\n"
-          "ld1 {v5.8b}, [x10]\n"
-          "sqrshl v17.4s, v17.4s, v15.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtn v16.8b, v16.8h\n"
-          "smax v16.8b, v16.8b, v30.8b\n"
-          "smin v16.8b, v16.8b, v31.8b\n"
-          "saddw v8.8h, v26.8h, v8.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "saddw v10.8h, v26.8h, v10.8b\n"
-          "saddw v11.8h, v26.8h, v11.8b\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "saddw v13.8h, v26.8h, v13.8b\n"
-
-          "sshll v0.8h, v0.8b, #0\n"
-          "sshll v1.8h, v1.8b, #0\n"
-          "sshll v2.8h, v2.8b, #0\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "sshll v3.8h, v3.8b, #0\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-          "sshll v4.8h, v4.8b, #0\n"
-          "sshll v5.8h, v5.8b, #0\n"
-          "ld1 {v6.4s}, [%[output_multiplier_ptr]], #16\n"
-          "ld1 {v14.4s}, [%[output_shift_ptr]], #16\n"
-          "ld1 {v7.4s}, [%[output_multiplier_ptr]], #16\n"
-          "ld1 {v15.4s}, [%[output_shift_ptr]], #16\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-        "smlal v16.4s, v4.4h, v12.4h\n"
-        "smlal2 v17.4s, v4.8h, v12.8h\n"
-        "smlal v16.4s, v5.4h, v13.4h\n"
-        "smlal2 v17.4s, v5.8h, v13.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v6.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v7.4s\n"
-        "sqrshl v16.4s, v16.4s, v14.4s\n"
-        "sqrshl v17.4s, v17.4s, v15.4s\n"
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtn v16.8b, v16.8h\n"
-        "smax v16.8b, v16.8b, v30.8b\n"
-        "smin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr),
-        [output_multiplier_ptr] "+r"(output_multiplier_ptr),
-        [output_shift_ptr] "+r"(output_shift_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-        "v26", "v28", "v30", "v31",
-        // We use these general-purpose registers.
-        "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-template <>
-struct DepthwiseConvPartialPerChannel {
-  static inline void Run(const int32* output_multiplier_ptr,
-                         const int32* output_shift_ptr, const int8* input_ptr,
-                         const int8* filter_ptr, const int32* bias_ptr,
-                         int8* output_ptr,
-                         const DepthwiseConvParams* params_ptr) {
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 3x2 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 3x2 input and
-        // filter values.
-        //
-        // Use v6-v7 to hold output_multiplier & v14-v15 to hold output_shift.
-
-        // Load input and filter values.
-        "ldr x6, [%[params_ptr], #" STR(OFFSET_INPUT_DEPTH) "]\n"
-        "mov x12, %[input_ptr]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "mov x7, %[filter_ptr]\n"
-        "ldr x5, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-        "add x13, x12, x11\n"
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "add x14, x13, x11\n"
-
-        "ld1 {v8.8b}, [x12], x6\n"
-        "add x9, x7, x5\n"
-        "ld1 {v9.8b}, [x12]\n"
-        "cmp x15, #16\n"
-        "add x10, x9, x5\n"
-        "ld1 {v10.8b}, [x13], x6\n"
-        "add %[input_ptr], %[input_ptr], #8\n"
-        "ld1 {v11.8b}, [x13]\n"
-        "add %[filter_ptr], %[filter_ptr], #8\n"
-        "ld1 {v12.8b}, [x14], x6\n"
-        "ld1 {v13.8b}, [x14]\n"
-
-        "ld1 {v0.8b}, [x7], x6\n"
-        "ld1 {v1.8b}, [x7]\n"
-        "ld1 {v2.8b}, [x9], x6\n"
-        "ld1 {v3.8b}, [x9]\n"
-        "ld1 {v4.8b}, [x10], x6\n"
-        "ld1 {v5.8b}, [x10]\n"
-
-        // Load constants.
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "dup v26.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_OFFSET) "]\n"
-        "dup v28.8h, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MIN) "]\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.8b, w12\n"
-        "dup v31.8b, w13\n"
-
-        // Loads output_multiplier & output_shift.
-        "ld1 {v6.4s}, [%[output_multiplier_ptr]], #16\n"
-        "ld1 {v14.4s}, [%[output_shift_ptr]], #16\n"
-        "ld1 {v7.4s}, [%[output_multiplier_ptr]], #16\n"
-        "ld1 {v15.4s}, [%[output_shift_ptr]], #16\n"
-
-        // Add input and filter offsets.
-        "saddw v8.8h, v26.8h, v8.8b\n"
-        "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-        "saddw v9.8h, v26.8h, v9.8b\n"
-        "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-        "saddw v10.8h, v26.8h, v10.8b\n"
-        "saddw v11.8h, v26.8h, v11.8b\n"
-        "saddw v12.8h, v26.8h, v12.8b\n"
-        "saddw v13.8h, v26.8h, v13.8b\n"
-
-        "sshll v0.8h, v0.8b, #0\n"
-        "sshll v1.8h, v1.8b, #0\n"
-        "sshll v2.8h, v2.8b, #0\n"
-        "sshll v3.8h, v3.8b, #0\n"
-        "sshll v4.8h, v4.8b, #0\n"
-        "sshll v5.8h, v5.8b, #0\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "mov x12, %[input_ptr]\n"
-          "subs x15, x15, #8\n"
-          "add x13, x12, x11\n"
-          "cmp x15, #16\n"
-          "add x14, x13, x11\n"
-          "add %[input_ptr], %[input_ptr], #8\n"
-
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "mov x7, %[filter_ptr]\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [x12], x6\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "add x9, x7, x5\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "add x10, x9, x5\n"
-          "ld1 {v9.8b}, [x12]\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "add %[filter_ptr], %[filter_ptr], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], x6\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v0.8b}, [x7], x6\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13]\n"
-          "smlal v16.4s, v4.4h, v12.4h\n"
-          "ld1 {v1.8b}, [x7]\n"
-          "smlal2 v17.4s, v4.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x14], x6\n"
-          "smlal v16.4s, v5.4h, v13.4h\n"
-          "ld1 {v2.8b}, [x9], x6\n"
-          "smlal2 v17.4s, v5.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x14]\n"
-
-          "sqrdmulh v16.4s, v16.4s, v6.4s\n"
-          "ld1 {v3.8b}, [x9]\n"
-          "sqrdmulh v17.4s, v17.4s, v7.4s\n"
-          "ld1 {v4.8b}, [x10], x6\n"
-          "sqrshl v16.4s, v16.4s, v14.4s\n"
-          "ld1 {v5.8b}, [x10]\n"
-          "sqrshl v17.4s, v17.4s, v15.4s\n"
-          "sqxtn v16.4h, v16.4s\n"
-          "sqxtn2 v16.8h, v17.4s\n"
-          "sqadd v16.8h, v16.8h, v28.8h\n"
-          "sqxtn v16.8b, v16.8h\n"
-          "smax v16.8b, v16.8b, v30.8b\n"
-          "smin v16.8b, v16.8b, v31.8b\n"
-          "saddw v8.8h, v26.8h, v8.8b\n"
-          "st1 {v16.8b}, [%[output_ptr]], #8\n"
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "saddw v10.8h, v26.8h, v10.8b\n"
-          "saddw v11.8h, v26.8h, v11.8b\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "saddw v13.8h, v26.8h, v13.8b\n"
-
-          "sshll v0.8h, v0.8b, #0\n"
-          "sshll v1.8h, v1.8b, #0\n"
-          "sshll v2.8h, v2.8b, #0\n"
-          "ld1 {v16.4s}, [%[bias_ptr]], #16\n"
-          "sshll v3.8h, v3.8b, #0\n"
-          "ld1 {v17.4s}, [%[bias_ptr]], #16\n"
-          "sshll v4.8h, v4.8b, #0\n"
-          "sshll v5.8h, v5.8b, #0\n"
-          "ld1 {v6.4s}, [%[output_multiplier_ptr]], #16\n"
-          "ld1 {v14.4s}, [%[output_shift_ptr]], #16\n"
-          "ld1 {v7.4s}, [%[output_multiplier_ptr]], #16\n"
-          "ld1 {v15.4s}, [%[output_shift_ptr]], #16\n"
-
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-        "smlal v16.4s, v4.4h, v12.4h\n"
-        "smlal2 v17.4s, v4.8h, v12.8h\n"
-        "smlal v16.4s, v5.4h, v13.4h\n"
-        "smlal2 v17.4s, v5.8h, v13.8h\n"
-
-        "sqrdmulh v16.4s, v16.4s, v6.4s\n"
-        "sqrdmulh v17.4s, v17.4s, v7.4s\n"
-        "sqrshl v16.4s, v16.4s, v14.4s\n"
-        "sqrshl v17.4s, v17.4s, v15.4s\n"
-        "sqxtn v16.4h, v16.4s\n"
-        "sqxtn2 v16.8h, v17.4s\n"
-        "sqadd v16.8h, v16.8h, v28.8h\n"
-        "sqxtn v16.8b, v16.8h\n"
-        // TODO(b/129852264): Improve testing coverage.
-        "smax v16.8b, v16.8b, v30.8b\n"
-        "smin v16.8b, v16.8b, v31.8b\n"
-        "st1 {v16.8b}, [%[output_ptr]]\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr),
-        [output_multiplier_ptr] "+r"(output_multiplier_ptr),
-        [output_shift_ptr] "+r"(output_shift_ptr)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-        "v26", "v28", "v30", "v31",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-#undef OFFSET_INPUT_DEPTH
-#undef OFFSET_INPUT_ROW_SIZE
-#undef OFFSET_OUTPUT_DEPTH
-#undef OFFSET_OUTPUT_ROW_SIZE
-#undef OFFSET_INPUT_OFFSET
-#undef OFFSET_OUTPUT_OFFSET
-#undef OFFSET_OUTPUT_MULTIPLIER
-#undef OFFSET_OUTPUT_ACTIVATION_MIN
-#undef OFFSET_OUTPUT_ACTIVATION_MAX
-#undef OFFSET_OUTPUT_RIGHT_SHIFT
-#undef OFFSET_INPUT_WIDTH
-#undef OFFSET_INPUT_HEIGHT
-#undef OFFSET_OUTPUT_WIDTH
-#undef OFFSET_OUTPUT_HEIGHT
-
-template 
-struct DepthwiseConvThroughDepthPerChannel {
-  // Runs the DepthwiseConvWindowPerChannel kernels through the depth dimension
-  // from |start_depth| to |end_depth|. Keep this not inlined to maintain a
-  // small binary size. We use a DepthwiseConvParams struct for read only params
-  // to minimize call overhead.
-  static void __attribute__((noinline))
-  Run(const int32* output_multiplier_ptr, const int32* output_shift_ptr,
-      const int8* input_ptr, const int8* filter_ptr, const int32* bias_ptr,
-      int8* output_ptr, int64_t start_depth, int64_t end_depth,
-      int64_t input_depth, int64_t input_row_size, int32 output_window_height,
-      int32 output_window_width, const DepthwiseConvParams& params) {
-    for (; start_depth <= end_depth - 8; start_depth += 8) {
-      DepthwiseConvWindowPerChannel::Run(output_multiplier_ptr,
-                                                        output_shift_ptr,
-                                                        input_ptr, filter_ptr,
-                                                        bias_ptr, output_ptr,
-                                                        input_depth,
-                                                        input_row_size,
-                                                        output_window_height,
-                                                        output_window_width,
-                                                        ¶ms);
-      input_ptr += 8;
-      output_ptr += 8;
-      filter_ptr += 8;
-      bias_ptr += 8;
-      output_multiplier_ptr += 8;
-      output_shift_ptr += 8;
-    }
-  }
-};
-
-template 
-struct DepthwiseConvMultiRowPerChannel {
-  using ConvKernel =
-      DepthwiseConvThroughDepthPerChannel;
-
-  static inline void Run(const int32* output_multiplier,
-                         const int32* output_shift, const int8* input_data,
-                         int32 start_x, int32 end_x, const int8* filter_data,
-                         const int32* bias_data, int8* output_data,
-                         const DepthwiseConvParams& params,
-                         const ShuffleParams& shuffle_params,
-                         int8* shuffle_workspace) {
-    TFLITE_DCHECK(
-        shuffle_params.input_height ==
-        get_shuffle_input_size(kStrideHeight, shuffle_params.output_height));
-    TFLITE_DCHECK(
-        shuffle_params.input_width ==
-        get_shuffle_input_size(kStrideWidth, shuffle_params.output_width));
-    TFLITE_DCHECK_LE(
-        64 * shuffle_params.input_width * shuffle_params.input_height,
-        kDepthwiseConvScratchWorkspaceSize);
-
-    int32 out_x = start_x;
-
-    // Run shuffling on inputs with sufficiently large depth and width. When
-    // these parameters are large enough, more time is taken to load inputs
-    // from memory. At this point, it becomes useful to prefetch and
-    // preshuffle the input data to maximize locality.
-    if (params.output_depth > 64 ||
-        (params.output_depth <= 64 && params.input_width > 150)) {
-      for (; out_x <= (end_x - shuffle_params.output_width);
-           out_x += shuffle_params.output_width) {
-        const int8* input_ptr = input_data;
-        const int32* bias_ptr = bias_data;
-        const int32* output_multiplier_ptr = output_multiplier;
-        const int32* output_shift_ptr = output_shift;
-        const int8* filter_ptr = filter_data;
-        int8* output_ptr = output_data;
-        int64_t depth = 0;
-        const int64_t shuffle_row_size = 64 * shuffle_params.input_width;
-
-        for (; depth <= params.output_depth - 64; depth += 64) {
-          // Preload.
-          const int8* h_ptr = input_ptr;
-          for (int32 i = 0; i < shuffle_params.input_height; i++) {
-            const int8* ptr = h_ptr;
-            for (int32 j = 0; j < shuffle_params.input_width; j++) {
-              optimized_ops_preload_l1_keep(ptr);
-              ptr += params.input_depth;
-            }
-            h_ptr += params.input_row_size;
-          }
-
-          // For a large enough input, shuffle into buckets.
-          ShuffleInput(input_ptr, params.input_depth, params.input_width,
-                       params.input_height, 64, shuffle_params.input_width,
-                       shuffle_params.input_height, shuffle_workspace);
-          ConvKernel::Run(output_multiplier_ptr, output_shift_ptr,
-                          shuffle_workspace, filter_ptr, bias_ptr, output_ptr,
-                          0, 64, 64, shuffle_row_size,
-                          shuffle_params.output_height,
-                          shuffle_params.output_width, params);
-          input_ptr += 64;
-          output_ptr += 64;
-          filter_ptr += 64;
-          bias_ptr += 64;
-          output_multiplier_ptr += 64;
-          output_shift_ptr += 64;
-        }
-
-        // Preload.
-        const int8* h_ptr = input_ptr;
-        for (int32 i = 0; i < shuffle_params.input_height; i++) {
-          const int8* ptr = h_ptr;
-          for (int32 j = 0; j < shuffle_params.input_width; j++) {
-            optimized_ops_preload_l1_keep(ptr);
-            ptr += params.input_depth;
-          }
-          h_ptr += params.input_row_size;
-        }
-
-        // Handle leftover depth.
-        ConvKernel::Run(output_multiplier_ptr, output_shift_ptr, input_ptr,
-                        filter_ptr, bias_ptr, output_ptr, depth,
-                        params.output_depth, params.input_depth,
-                        params.input_row_size, shuffle_params.output_height,
-                        shuffle_params.output_width, params);
-
-        input_data +=
-            shuffle_params.output_width * kStrideWidth * params.input_depth;
-        output_data += shuffle_params.output_width * params.output_depth;
-      }
-    }
-
-    const int32 output_leftover_width = end_x - out_x;
-    if (output_leftover_width > 0) {
-      ConvKernel::Run(output_multiplier, output_shift, input_data, filter_data,
-                      bias_data, output_data, 0, params.output_depth,
-                      params.input_depth, params.input_row_size,
-                      shuffle_params.output_height, output_leftover_width,
-                      params);
-    }
-  }
-};
-
-// Processes the borders of the input for pad_width and pad_height = 1.
-// Calls 4 asm kernels:
-//   * 1x1 input shape.
-//   * Corner edges.
-//   * Horizontal edges.
-//   * Vertical edges.
-template 
-inline void DepthwiseConvHandlePaddingPerChannel(
-    const int32* output_multiplier_ptr, const int32* output_shift_ptr,
-    const int8* input_data, const int8* filter_data, const int32* bias_data,
-    int8* output_data, const DepthwiseConvParams& params) {
-  if (params.input_width == 1 && params.input_height == 1) {
-    const int8* filter_ptr =
-        filter_data + params.filter_row_size + params.output_depth;
-    DepthwiseConvPartialPerChannel::Run(output_multiplier_ptr,
-                                           output_shift_ptr, input_data,
-                                           filter_ptr, bias_data, output_data,
-                                           ¶ms);
-    return;
-  }
-
-  const int32 out_x_start_corner = 0;
-  const int32 out_x_end_corner = params.output_width - 1;
-  const int32 out_y_start_corner = 0;
-  const int32 out_y_end_corner = params.output_height - 1;
-
-  // Handle top row.
-  const int8* input_ptr = input_data;
-  const int8* filter_ptr =
-      filter_data + params.filter_row_size + params.output_depth;
-  int8* output_ptr = output_data;
-
-  DepthwiseConvPartialPerChannel::Run(
-      output_multiplier_ptr, output_shift_ptr, input_ptr, filter_ptr, bias_data,
-      output_ptr, ¶ms);
-
-  input_ptr += (params.stride_width - 1) * params.input_depth;
-  filter_ptr = filter_data + params.filter_row_size;
-  output_ptr += params.output_depth;
-
-  for (int32 out_x = out_x_start_corner + 1; out_x < out_x_end_corner;
-       out_x++) {
-    DepthwiseConvPartialPerChannel::Run(output_multiplier_ptr,
-                                           output_shift_ptr, input_ptr,
-                                           filter_ptr, bias_data, output_ptr,
-                                           ¶ms);
-    input_ptr += params.stride_width * params.input_depth;
-    output_ptr += params.output_depth;
-  }
-
-  DepthwiseConvPartialPerChannel::Run(
-      output_multiplier_ptr, output_shift_ptr, input_ptr, filter_ptr, bias_data,
-      output_ptr, ¶ms);
-
-  // Handle left side.
-  input_ptr = input_data + (params.stride_width - 1) * params.input_row_size;
-  filter_ptr = filter_data + params.input_depth;
-  output_ptr = output_data + params.output_row_size;
-
-  for (int32 out_y = out_y_start_corner + 1; out_y < out_y_end_corner;
-       out_y++) {
-    DepthwiseConvPartialPerChannel::Run(output_multiplier_ptr,
-                                           output_shift_ptr, input_ptr,
-                                           filter_ptr, bias_data, output_ptr,
-                                           ¶ms);
-    input_ptr += params.stride_width * params.input_row_size;
-    output_ptr += params.output_row_size;
-  }
-
-  // Handle right side.
-  input_ptr = input_data + (params.input_width - 2) * params.input_depth +
-              (params.stride_width - 1) * params.input_row_size;
-  filter_ptr = filter_data;
-  output_ptr = output_data + params.output_row_size +
-               (params.output_width - 1) * params.output_depth;
-
-  for (int32 out_y = out_y_start_corner + 1; out_y < out_y_end_corner;
-       out_y++) {
-    DepthwiseConvPartialPerChannel::Run(output_multiplier_ptr,
-                                           output_shift_ptr, input_ptr,
-                                           filter_ptr, bias_data, output_ptr,
-                                           ¶ms);
-    input_ptr += params.stride_width * params.input_row_size;
-    output_ptr += params.output_row_size;
-  }
-
-  // Handle bottom row.
-  input_ptr = input_data + (params.input_height - 2) * params.input_row_size;
-  filter_ptr = filter_data + params.output_depth;
-  output_ptr =
-      output_data + (params.output_height - 1) * params.output_row_size;
-
-  DepthwiseConvPartialPerChannel::Run(
-      output_multiplier_ptr, output_shift_ptr, input_ptr, filter_ptr, bias_data,
-      output_ptr, ¶ms);
-
-  input_ptr += (params.stride_width == 1) ? 0 : params.input_depth;
-  filter_ptr = filter_data;
-  output_ptr += params.output_depth;
-
-  for (int32 out_x = out_x_start_corner + 1; out_x < out_x_end_corner;
-       out_x++) {
-    DepthwiseConvPartialPerChannel::Run(output_multiplier_ptr,
-                                           output_shift_ptr, input_ptr,
-                                           filter_ptr, bias_data, output_ptr,
-                                           ¶ms);
-    input_ptr += params.stride_width * params.input_depth;
-    output_ptr += params.output_depth;
-  }
-
-  DepthwiseConvPartialPerChannel::Run(
-      output_multiplier_ptr, output_shift_ptr, input_ptr, filter_ptr, bias_data,
-      output_ptr, ¶ms);
-}
-
-template 
-inline void DepthwiseConv3x3FilterPerChannel(
-    const DepthwiseParams& rt_params, const int32* output_multiplier_ptr,
-    const int32* output_shift_ptr, const RuntimeShape& input_shape,
-    const int8* input_data, const RuntimeShape& filter_shape,
-    const int8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape, int8* output_data,
-    int thread_start, int thread_end, int thread_dim) {
-  DepthwiseConvParams params;
-
-  const int32 stride_width = rt_params.stride_width;
-  const int32 stride_height = rt_params.stride_height;
-  const int32 pad_width = rt_params.padding_values.width;
-  const int32 pad_height = rt_params.padding_values.height;
-  const int32 depth_multiplier = rt_params.depth_multiplier;
-  const int32 output_activation_min = rt_params.quantized_activation_min;
-  const int32 output_activation_max = rt_params.quantized_activation_max;
-  const int32 input_offset = rt_params.input_offset;
-  const int32 filter_offset = rt_params.weights_offset;
-  const int32 output_offset = rt_params.output_offset;
-
-  params.input_depth = input_shape.Dims(3);
-  params.input_width = input_shape.Dims(2);
-  params.input_height = input_shape.Dims(1);
-  params.input_row_size = params.input_depth * params.input_width;
-  params.input_offset = input_offset;
-  params.stride_width = stride_width;
-  params.stride_height = stride_height;
-  params.output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  params.output_width = output_shape.Dims(2);
-  params.output_height = output_shape.Dims(1);
-  params.output_row_size = params.output_depth * params.output_width;
-  params.output_offset = output_offset;
-  params.filter_offset = filter_offset;
-  params.output_activation_min = output_activation_min;
-  params.output_activation_max = output_activation_max;
-
-  const int32 filter_height = filter_shape.Dims(1);
-  const int32 filter_width = filter_shape.Dims(2);
-  params.filter_row_size = params.output_depth * filter_width;
-
-  // Algorithm assumes below constraints. It is optimized for depth
-  // multiplier of 1, 3x3 filter, no padding and strides 1 and 2.
-  TFLITE_DCHECK(params.output_depth == params.input_depth * depth_multiplier);
-  TFLITE_DCHECK(depth_multiplier == 1);
-  TFLITE_DCHECK(filter_height == 3);
-  TFLITE_DCHECK(filter_width == 3);
-  TFLITE_DCHECK(stride_height == 1 || stride_height == 2);
-  TFLITE_DCHECK(stride_width == 1 || stride_width == 2);
-  TFLITE_DCHECK(stride_width == stride_height);
-  TFLITE_DCHECK(pad_height == 0 || pad_height == 1);
-  TFLITE_DCHECK(pad_width == 0 || pad_width == 1);
-  TFLITE_DCHECK(pad_width == pad_height);
-  TFLITE_DCHECK(thread_dim == 0 || thread_dim == 1);
-
-  const int32 batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int64_t input_batch_size = params.input_row_size * params.input_height;
-  const int64_t output_batch_size =
-      params.output_row_size * params.output_height;
-
-  ShuffleParams one_row_shuffle_params, two_row_shuffle_params,
-      four_row_shuffle_params, eight_row_shuffle_params;
-  if (stride_width == 1) {
-    one_row_shuffle_params = ShuffleParams(30, 1, 1, 1);
-    two_row_shuffle_params = ShuffleParams(22, 2, 1, 1);
-    four_row_shuffle_params = ShuffleParams(14, 4, 1, 1);
-    eight_row_shuffle_params = ShuffleParams(8, 8, 1, 1);
-  } else {
-    one_row_shuffle_params = ShuffleParams(14, 1, 2, 2);
-    two_row_shuffle_params = ShuffleParams(8, 2, 2, 2);
-    four_row_shuffle_params = ShuffleParams(4, 4, 2, 2);
-    eight_row_shuffle_params = ShuffleParams(2, 8, 2, 2);
-  }
-
-  using conv_multirow_func_t =
-      decltype(&DepthwiseConvMultiRowPerChannel::Run);
-  conv_multirow_func_t conv_multirow_func =
-      DepthwiseConvMultiRowPerChannel::Run;
-  if (stride_width == 2) {
-    conv_multirow_func =
-        DepthwiseConvMultiRowPerChannel::Run;
-  }
-
-  // Allocate maximum memory needed for shuffled input.
-  // TODO(mariewhite): The size of this workspace is small enough to be
-  // allocated on the stack. Eventually we will want to move it to the heap
-  // and have it allocated outside of this function, like the im2col_array
-  // used in gemmlowp.
-  int8 shuffle_workspace[kDepthwiseConvScratchWorkspaceSize];
-
-  int batch_start = 0;
-  int batch_end = batches;
-  int row_start = 0;
-  int row_end = params.output_height;
-
-  switch (thread_dim) {
-    case 0:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, batches);
-      batch_start = thread_start;
-      batch_end = thread_end;
-      break;
-    case 1:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, params.output_height);
-      row_start = thread_start;
-      row_end = thread_end;
-      break;
-  }
-
-  for (int32 b = batch_start; b < batch_end; ++b) {
-    // input_ptr and output_ptr point to the start of each batch
-    const int8* input_ptr = input_data + b * input_batch_size;
-    int8* output_ptr = output_data + b * output_batch_size;
-
-    int32 out_x = 0;
-    int32 out_y = row_start;
-    int32 end_x = params.output_width;
-    int32 end_y = row_end;
-
-    if (pad_width == 1 && pad_height == 1) {
-      DepthwiseConvHandlePaddingPerChannel(
-          output_multiplier_ptr, output_shift_ptr, input_ptr, filter_data,
-          bias_data, output_ptr, params);
-
-      // Update extents now that the edges have been handled.
-      out_x = 1;
-      end_x = params.output_width - 1;
-      out_y = std::max(1, out_y);
-      end_y = std::min(params.output_height - 1, end_y);
-    }
-
-    // pad_width and pad_height can both be 0 or 1, depending on padding option,
-    // such as Padding_VALID / Padding_SAME.
-    const int in_x = (out_x * stride_width) - pad_width;
-    const int in_y = (out_y * stride_height) - pad_height;
-
-    // input_ptr and output_ptr point to (in_y, in_x) and (out_y, out_x),
-    // respectively. (in_y, in_x) and (out_y, out_x) change along with
-    // row_start.
-    input_ptr += in_y * params.input_row_size + in_x * params.input_depth;
-    output_ptr += out_y * params.output_row_size + out_x * params.output_depth;
-
-    // Shuffling shapes that maximize width over the shuffle workspace size
-    // perform better since the inputs are closer together, minimizing
-    // shuffling time.
-    //
-    // If the input shape has width large enough for the 2 row kernels,
-    // we prefer to use this. The innermost loop of the kernels handle
-    // 2 height x 2 width so this is the fastest path.
-    //
-    // If the input shape has smaller width but larger height, shuffling is
-    // still useful and can benefit from kernels 4 row and 8 row kernels.
-
-    // Handle 8 rows at a time.
-    if (params.input_width < four_row_shuffle_params.input_width) {
-      for (; out_y <= end_y - 8; out_y += 8) {
-        conv_multirow_func(output_multiplier_ptr, output_shift_ptr, input_ptr,
-                           out_x, end_x, filter_data, bias_data, output_ptr,
-                           params, eight_row_shuffle_params, shuffle_workspace);
-        input_ptr += 8 * stride_height * params.input_row_size;
-        output_ptr += 8 * params.output_row_size;
-      }
-    }
-
-    // Handle 4 rows at a time.
-    if (params.input_width < two_row_shuffle_params.input_width) {
-      for (; out_y <= end_y - 4; out_y += 4) {
-        conv_multirow_func(output_multiplier_ptr, output_shift_ptr, input_ptr,
-                           out_x, end_x, filter_data, bias_data, output_ptr,
-                           params, four_row_shuffle_params, shuffle_workspace);
-        input_ptr += 4 * stride_height * params.input_row_size;
-        output_ptr += 4 * params.output_row_size;
-      }
-    }
-
-    // Handle 2 rows at a time.
-    for (; out_y <= end_y - 2; out_y += 2) {
-      conv_multirow_func(output_multiplier_ptr, output_shift_ptr, input_ptr,
-                         out_x, end_x, filter_data, bias_data, output_ptr,
-                         params, two_row_shuffle_params, shuffle_workspace);
-      input_ptr += 2 * stride_height * params.input_row_size;
-      output_ptr += 2 * params.output_row_size;
-    }
-
-    // Handle one row at a time.
-    for (; out_y < end_y; out_y++) {
-      conv_multirow_func(output_multiplier_ptr, output_shift_ptr, input_ptr,
-                         out_x, end_x, filter_data, bias_data, output_ptr,
-                         params, one_row_shuffle_params, shuffle_workspace);
-      input_ptr += stride_height * params.input_row_size;
-      output_ptr += params.output_row_size;
-    }
-  }
-}
-#endif  // __aarch64__
-
-#undef STR
-#undef STR_UNEXPANDED
-
-}  // namespace depthwise_conv
-}  // namespace optimized_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_3X3_FILTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv_hybrid.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv_hybrid.h
deleted file mode 100644
index 37e9261..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv_hybrid.h
+++ /dev/null
@@ -1,454 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_HYBRID_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_HYBRID_H_
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_threadpool.h"
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h"
-#include "tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h"
-#include "tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv_hybrid_3x3_filter.h"
-#include "tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_integer_ops {
-namespace depthwise_conv {
-
-// Initializes the accumulator buffer with zeros.
-inline void DepthwiseConvInitAccBuffer(int num_output_pixels, int output_depth,
-                                       int32* acc_buffer) {
-  memset(acc_buffer, 0,
-         sizeof(acc_buffer[0]) * output_depth * num_output_pixels);
-}
-
-// Initializes the accumulator buffer with bias values.
-inline void DepthwiseConvHybridGeneral(
-    const DepthwiseParams& params,
-    const float* input_scales, const RuntimeShape& input_shape,
-    const int8* input_data, const RuntimeShape& filter_shape,
-    const int8* filter_data, const RuntimeShape& bias_shape,
-    const float* bias_data, const RuntimeShape& output_shape,
-    float* output_data, const float* per_channel_scales,
-    const int32_t* input_offsets, int thread_start, int thread_end,
-    int thread_dim) {
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-  const int depth_multiplier = params.depth_multiplier;
-  const float output_activation_min = params.float_activation_min;
-  const float output_activation_max = params.float_activation_max;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  const int batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  const int input_height = input_shape.Dims(1);
-  const int input_width = input_shape.Dims(2);
-  const int input_depth = input_shape.Dims(3);
-  const int filter_height = filter_shape.Dims(1);
-  const int filter_width = filter_shape.Dims(2);
-  const int output_rows = output_shape.Dims(1);
-  const int output_width = output_shape.Dims(2);
-
-  static const int kAccBufferMaxSize = 2048;
-  int32 acc_buffer[kAccBufferMaxSize];
-  TFLITE_DCHECK_GE(kAccBufferMaxSize, output_depth);
-  const int kOutputPixelsInAccBuffer = kAccBufferMaxSize / output_depth;
-  const int kAccBufferActualSize = kOutputPixelsInAccBuffer * output_depth;
-  TFLITE_DCHECK_LE(kOutputPixelsInAccBuffer * output_depth,
-                   kAccBufferActualSize);
-  TFLITE_DCHECK_LE(kAccBufferActualSize, kAccBufferMaxSize);
-  TFLITE_DCHECK_GE(kOutputPixelsInAccBuffer, 1);
-  TFLITE_DCHECK(thread_dim == 0 || thread_dim == 1);
-
-  // row_accum_func will point to the core accumulation function to be used
-  // for this DepthwiseConvHybrid op.
-  using row_accum_func_t = decltype(&QuantizedDepthwiseConvAccumRowGeneric);
-  row_accum_func_t row_accum_func = nullptr;
-
-#define TFMINI_USE_DEPTHWISECONV_KERNEL(ALLOW_STRIDED, FIXED_INPUT_DEPTH, \
-                                        FIXED_DEPTH_MULTIPLIER)           \
-  if (!row_accum_func && (stride_width == 1 || ALLOW_STRIDED) &&          \
-      (input_depth == FIXED_INPUT_DEPTH || FIXED_INPUT_DEPTH == 0) &&     \
-      depth_multiplier == FIXED_DEPTH_MULTIPLIER) {                       \
-    row_accum_func =                                                      \
-        QuantizedDepthwiseConvAccumRow;           \
-  }
-
-#ifdef USE_NEON
-  // We go over our list of kernels by decreasing order of preference
-  // for the cases where multiple kernels could apply.
-
-  // Start with the fastest kernels: AllowStrided=false, fixed input depth.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 1, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 2, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 4, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 1, 4)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 4, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 4, 4)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 8, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 2, 8)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 2, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(false, 12, 1)
-
-  // Next come the strided kernels: AllowStrided=true, fixed input depth.
-  // They are a bit less efficient, but allow stride!=1.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 8, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 16, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 16)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 20)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 32)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 1, 8)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 8, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 2, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 4, 1)
-
-  // Finally, the kernels allowing a variable input depth,
-  // these are the least efficient but most general kernels.
-
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 1)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 2)
-  TFMINI_USE_DEPTHWISECONV_KERNEL(true, 0, 3)
-#endif  // USE_NEON
-
-  // No matching fast kernel found, use slow fallback.
-  if (!row_accum_func) {
-    row_accum_func = QuantizedDepthwiseConvAccumRowGeneric;
-  }
-
-#undef TFMINI_USE_DEPTHWISECONV_KERNEL
-
-  const int input_height_stride = input_shape.Dims(3) * input_shape.Dims(2);
-  const int input_batch_stride = input_height_stride * input_shape.Dims(1);
-  const int filter_height_stride = filter_shape.Dims(3) * filter_shape.Dims(2);
-
-  // Now that we have determined row_accum_func, we can start work.
-  int batch_start = 0;
-  int batch_end = batches;
-  int row_start = 0;
-  int row_end = output_rows;
-  int output_ptr_offset = 0;
-
-  switch (thread_dim) {
-    case 0:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, batches);
-      batch_start = thread_start;
-      batch_end = thread_end;
-      output_ptr_offset = batch_start * FlatSizeSkipDim(output_shape, 0);
-      break;
-    case 1:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, output_rows);
-      row_start = thread_start;
-      row_end = thread_end;
-      output_ptr_offset = row_start * output_width * output_depth;
-      break;
-  }
-
-  float* output_ptr = output_data + output_ptr_offset;
-  int batch_step =
-      (output_rows + row_start - row_end) * output_width * output_depth;
-  for (int b = batch_start; b < batch_end; ++b) {
-    float input_scale = input_scales[b];
-    int32_t input_offset = input_offsets[b];
-    for (int out_y = row_start; out_y < row_end; ++out_y) {
-      const int in_y_origin = (out_y * stride_height) - pad_height;
-      const int filter_y_start =
-          std::max(0, (-in_y_origin + dilation_height_factor - 1) /
-                          dilation_height_factor);
-      const int filter_y_end =
-          std::min(filter_height,
-                   (input_height - in_y_origin + dilation_height_factor - 1) /
-                       dilation_height_factor);
-      for (int out_x_buffer_start = 0; out_x_buffer_start < output_width;
-           out_x_buffer_start += kOutputPixelsInAccBuffer) {
-        const int out_x_buffer_end = std::min(
-            output_width, out_x_buffer_start + kOutputPixelsInAccBuffer);
-        // We call a 'pixel' a group of activation that share all but the
-        // 'depth'/'channel' coordinate. num_output_pixels is the number of
-        // output pixels that we will accumulate in this loop iteration.
-        const int num_output_pixels = out_x_buffer_end - out_x_buffer_start;
-        DepthwiseConvInitAccBuffer(num_output_pixels, output_depth, acc_buffer);
-
-        // Accumulation loop. Most of the time should be spent in here.
-        for (int filter_y = filter_y_start; filter_y < filter_y_end;
-             ++filter_y) {
-          const int in_y = in_y_origin + dilation_height_factor * filter_y;
-          row_accum_func(
-              stride_width, dilation_width_factor, input_depth, input_width,
-              input_data + in_y * input_height_stride + b * input_batch_stride,
-              -input_offset, pad_width, depth_multiplier, filter_width,
-              filter_data + filter_y * filter_height_stride, out_x_buffer_start,
-              out_x_buffer_end, output_depth, acc_buffer);
-        }
-        // Finished accumulating int32 values. Just store them as float values
-        gemmlowp::ScopedProfilingLabel label("store");
-        const int num_output_values = output_depth * num_output_pixels;
-        int c = 0;
-        while (c < output_depth) {
-          int target_output_depth = output_depth;
-
-#ifdef USE_NEON
-          const float32x4_t output_activation_min_vec =
-              vdupq_n_f32(output_activation_min);
-          const float32x4_t output_activation_max_vec =
-              vdupq_n_f32(output_activation_max);
-          const float32x4_t input_scale_32x4 = vdupq_n_f32(input_scale);
-          for (; c <= output_depth - 4; c += 4) {
-            if ((c + 4) > output_depth) {
-              break;
-            }
-            const float32x4_t channel_scale_32x4 =
-                vld1q_f32(per_channel_scales + c);
-            const float32x4_t bias_32x4 = vld1q_f32(bias_data + c);
-            for (int n = 0; n < num_output_pixels; ++n) {
-              int loc = n * output_depth + c;
-              int32x4_t acc = vld1q_s32(acc_buffer + loc);
-              float32x4_t float_acc = vcvtq_f32_s32(acc);
-              float_acc = vmulq_f32(float_acc, channel_scale_32x4);
-              float_acc = vmulq_f32(float_acc, input_scale_32x4);
-              float_acc = vaddq_f32(float_acc, bias_32x4);
-              float_acc = vmaxq_f32(float_acc, output_activation_min_vec);
-              float_acc = vminq_f32(float_acc, output_activation_max_vec);
-              vst1q_f32(output_ptr + loc, float_acc);
-            }
-          }
-#endif  // USE_NEON
-
-          for (; c < target_output_depth; c++) {
-            for (int n = 0; n < num_output_pixels; ++n) {
-              int loc = n * output_depth + c;
-              int32 acc = acc_buffer[loc];
-              float float_acc = acc * input_scale * per_channel_scales[c];
-              float_acc += bias_data[c];
-              float_acc = std::max(float_acc, output_activation_min);
-              float_acc = std::min(float_acc, output_activation_max);
-              output_ptr[loc] = float_acc;
-            }
-          }
-        }
-        output_ptr += num_output_values;
-      }
-    }
-    output_ptr += batch_step;
-  }
-}
-
-}  // namespace depthwise_conv
-
-template 
-inline void DepthwiseConvHybridWithRounding(
-    const DepthwiseParams& params, const float* input_scales,
-    const RuntimeShape& input_shape, const int8* input_data,
-    const RuntimeShape& filter_shape, const int8* filter_data,
-    const RuntimeShape& bias_shape, const float* bias_data,
-    const RuntimeShape& output_shape, float* output_data,
-    const float* per_channel_scales, const int32_t* input_offsets,
-    int thread_start, int thread_end, int thread_dim) {
-  gemmlowp::ScopedProfilingLabel label("DepthwiseConvHybridInt8/8bit");
-  const int depth_multiplier = params.depth_multiplier;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  TFLITE_DCHECK_GE(dilation_width_factor, 1);
-  TFLITE_DCHECK_GE(dilation_height_factor, 1);
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-  const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  const int input_depth = input_shape.Dims(3);
-  TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier);
-  TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth);
-
-// Enable for arm64 except for the Nvidia Linux 4 Tegra (L4T) running on
-// Jetson TX-2. This compiler does not support the offsetof() macro.
-
-#if defined(__aarch64__) && !defined(GOOGLE_L4T)
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-
-  // Call kernel optimized for depthwise convolutions using 3x3 filters if
-  // parameters are supported.
-  if (optimized_ops::depthwise_conv::Fast3x3FilterKernelSupported<
-      optimized_ops::depthwise_conv::QuantizationType::kNonPerChannelUint8>(
-          input_shape, filter_shape, stride_width, stride_height,
-          dilation_width_factor, dilation_height_factor, pad_width, pad_height,
-          depth_multiplier, output_shape, 0, nullptr)) {
-    gemmlowp::ScopedProfilingLabel specialized_label(
-        "DepthwiseConvHybridInt8/8bit/3x3");
-    optimized_ops::depthwise_conv::DepthwiseConvHybrid3x3FilterPerChannel<
-        DepthwiseConvOutputRounding::kUpward>(
-            params, input_scales, input_shape, input_data,
-            filter_shape, filter_data, bias_shape, bias_data, output_shape,
-            output_data, per_channel_scales, input_offsets,
-            thread_start, thread_end, thread_dim);
-    return;
-  }
-#endif
-
-  gemmlowp::ScopedProfilingLabel specialized_label(
-      "DepthwiseConvHybridInt8/8bit/General");
-  depthwise_conv::DepthwiseConvHybridGeneral(
-      params, input_scales, input_shape, input_data,
-      filter_shape, filter_data, bias_shape, bias_data, output_shape,
-      output_data, per_channel_scales, input_offsets,
-      thread_start, thread_end, thread_dim);
-}
-
-inline void DepthwiseConvHybridImpl(
-    const DepthwiseParams& params, const float* input_scales,
-    const RuntimeShape& input_shape, const int8* input_data,
-    const RuntimeShape& filter_shape, const int8* filter_data,
-    const RuntimeShape& bias_shape, const float* bias_data,
-    const RuntimeShape& output_shape, float* output_data,
-    const float* per_channel_scales, const int32_t* input_offsets,
-    int thread_start, int thread_end, int thread_dim) {
-  return DepthwiseConvHybridWithRounding<
-      DepthwiseConvOutputRounding::kAwayFromZero>(
-          params, input_scales, input_shape, input_data,
-          filter_shape, filter_data, bias_shape, bias_data, output_shape,
-          output_data, per_channel_scales, input_offsets,
-          thread_start, thread_end, thread_dim);
-}
-
-template 
-struct DepthwiseConvHybridWorkerTask : cpu_backend_threadpool::Task {
-  DepthwiseConvHybridWorkerTask(const DepthwiseParams& params,
-                                const float* input_scales,
-                                const RuntimeShape& input_shape,
-                                const T* input_data,
-                                const RuntimeShape& filter_shape,
-                                const T* filter_data,
-                                const RuntimeShape& bias_shape,
-                                const TS* bias_data,
-                                const RuntimeShape& output_shape,
-                                float* output_data,
-                                const float* per_channel_scales,
-                                const int32_t* input_offsets,
-                                int thread_start, int thread_end,
-                                int thread_dim)
-      : params(params),
-        input_scales(input_scales),
-        input_shape(input_shape),
-        input_data(input_data),
-        filter_shape(filter_shape),
-        filter_data(filter_data),
-        bias_shape(bias_shape),
-        bias_data(bias_data),
-        output_shape(output_shape),
-        output_data(output_data),
-        per_channel_scales(per_channel_scales),
-        input_offsets(input_offsets),
-        thread_start(thread_start),
-        thread_end(thread_end),
-        thread_dim(thread_dim) {}
-
-  void Run() override {
-    DepthwiseConvHybridImpl(params, input_scales, input_shape,
-                            input_data, filter_shape, filter_data,
-                            bias_shape, bias_data, output_shape,
-                            output_data, per_channel_scales, input_offsets,
-                            thread_start, thread_end, thread_dim);
-  }
-
- private:
-  const DepthwiseParams& params;
-  const float* input_scales;
-  const RuntimeShape& input_shape;
-  const T* input_data;
-  const RuntimeShape& filter_shape;
-  const T* filter_data;
-  const RuntimeShape& bias_shape;
-  const TS* bias_data;
-  const RuntimeShape& output_shape;
-  float* output_data;
-  const float* per_channel_scales;
-  const int32_t* input_offsets;
-  int thread_start;
-  int thread_end;
-  int thread_dim;
-};
-
-inline void DepthwiseConvHybridPerChannel(
-    const DepthwiseParams& params, const float* input_scales,
-    const RuntimeShape& input_shape, const int8* input_data,
-    const RuntimeShape& filter_shape, const int8* filter_data,
-    const RuntimeShape& bias_shape, const float* bias_data,
-    const RuntimeShape& output_shape, float* output_data,
-    const float* per_channel_scales, int32_t* input_offsets,
-    CpuBackendContext* cpu_backend_context) {
-  gemmlowp::ScopedProfilingLabel label("DepthwiseConvHybridInt8");
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  const int output_batches = output_shape.Dims(0);
-  const int output_rows = output_shape.Dims(1);
-  int thread_count_batch = HowManyConvThreads(output_shape, filter_shape, 0);
-  int thread_count_row = HowManyConvThreads(output_shape, filter_shape, 1);
-  int thread_dim, thread_count, thread_dim_size;
-  if (thread_count_batch > thread_count_row) {
-    thread_dim = 0;
-    thread_dim_size = output_batches;
-    thread_count = thread_count_batch;
-  } else {
-    thread_dim = 1;
-    thread_dim_size = output_rows;
-    thread_count = thread_count_row;
-  }
-
-  const int max_threads = cpu_backend_context->max_num_threads();
-  thread_count = std::max(1, std::min(thread_count, max_threads));
-
-  if (thread_count == 1) {
-    DepthwiseConvHybridImpl(params, input_scales, input_shape,
-                            input_data, filter_shape, filter_data, bias_shape,
-                            bias_data, output_shape, output_data,
-                            per_channel_scales, input_offsets,
-                            /*thread_start=*/0, /*thread_end=*/output_rows,
-                            /*thread_dim=*/1);
-  } else {
-    std::vector> tasks;
-    // TODO(b/131746020) don't create new heap allocations every time.
-    // At least we make it a single heap allocation by using reserve().
-    tasks.reserve(thread_count);
-    int thread_start = 0;
-    for (int i = 0; i < thread_count; ++i) {
-      int thread_end =
-          thread_start + (thread_dim_size - thread_start) / (thread_count - i);
-      tasks.emplace_back(params, input_scales, input_shape,
-                         input_data, filter_shape, filter_data, bias_shape,
-                         bias_data, output_shape, output_data,
-                         per_channel_scales, input_offsets, thread_start,
-                         thread_end, thread_dim);
-      thread_start = thread_end;
-    }
-    cpu_backend_threadpool::Execute(tasks.size(), tasks.data(),
-                                    cpu_backend_context);
-  }
-}
-
-}  // namespace optimized_integer_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_HYBRID_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv_hybrid_3x3_filter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv_hybrid_3x3_filter.h
deleted file mode 100644
index f947251..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv_hybrid_3x3_filter.h
+++ /dev/null
@@ -1,3242 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_HYBRID_3X3_FILTER_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_HYBRID_3X3_FILTER_H_
-
-#include 
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_3x3_filter_common.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_ops {
-namespace depthwise_conv {
-
-#define STR(s) STR_UNEXPANDED(s)
-#define STR_UNEXPANDED(s) #s
-
-// Enable for arm64 except for the Nvidia Linux 4 Tegra (L4T) running on
-// Jetson TX-2. This compiler does not support the offsetof() macro.
-#if defined(__aarch64__) && !defined(GOOGLE_L4T)
-#include 
-
-// Represents the number of bytes offset from the start of the
-// DepthwiseConvParams struct. This is used in the asm to load parameters.
-// Keep these values in sync with the static_asserts below.
-#define OFFSET_INPUT_DEPTH 0
-#define OFFSET_INPUT_ROW_SIZE 8
-#define OFFSET_OUTPUT_DEPTH 16
-#define OFFSET_OUTPUT_ROW_SIZE 24
-#define OFFSET_FILTER_ROW_SIZE 32
-#define OFFSET_INPUT_OFFSET 40
-#define OFFSET_OUTPUT_OFFSET 44
-#define OFFSET_OUTPUT_MULTIPLIER 52
-#define OFFSET_OUTPUT_ACTIVATION_MIN 56
-#define OFFSET_OUTPUT_ACTIVATION_MAX 60
-#define OFFSET_OUTPUT_RIGHT_SHIFT 64
-#define OFFSET_INPUT_WIDTH 68
-#define OFFSET_INPUT_HEIGHT 72
-#define OFFSET_STRIDE_WIDTH 76
-#define OFFSET_STRIDE_HEIGHT 80
-#define OFFSET_OUTPUT_WIDTH 84
-#define OFFSET_OUTPUT_HEIGHT 88
-#define OFFSET_FLOAT_OUTPUT_ACTIVATION_MIN 92
-#define OFFSET_FLOAT_OUTPUT_ACTIVATION_MAX 96
-
-static_assert(offsetof(DepthwiseConvParams, input_depth) == OFFSET_INPUT_DEPTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_row_size) ==
-                  OFFSET_INPUT_ROW_SIZE,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_depth) ==
-                  OFFSET_OUTPUT_DEPTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_row_size) ==
-                  OFFSET_OUTPUT_ROW_SIZE,
-              "");
-static_assert(offsetof(DepthwiseConvParams, filter_row_size) ==
-                  OFFSET_FILTER_ROW_SIZE,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_offset) ==
-                  OFFSET_INPUT_OFFSET,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_offset) ==
-                  OFFSET_OUTPUT_OFFSET,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_multiplier) ==
-                  OFFSET_OUTPUT_MULTIPLIER,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_activation_min) ==
-                  OFFSET_OUTPUT_ACTIVATION_MIN,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_activation_max) ==
-                  OFFSET_OUTPUT_ACTIVATION_MAX,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_right_shift) ==
-                  OFFSET_OUTPUT_RIGHT_SHIFT,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_width) == OFFSET_INPUT_WIDTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, input_height) ==
-                  OFFSET_INPUT_HEIGHT,
-              "");
-static_assert(offsetof(DepthwiseConvParams, stride_width) ==
-                  OFFSET_STRIDE_WIDTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, stride_height) ==
-                  OFFSET_STRIDE_HEIGHT,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_width) ==
-                  OFFSET_OUTPUT_WIDTH,
-              "");
-static_assert(offsetof(DepthwiseConvParams, output_height) ==
-                  OFFSET_OUTPUT_HEIGHT,
-              "");
-static_assert(offsetof(DepthwiseConvParams, float_output_activation_min) ==
-                  OFFSET_FLOAT_OUTPUT_ACTIVATION_MIN,
-              "");
-static_assert(offsetof(DepthwiseConvParams, float_output_activation_max) ==
-                  OFFSET_FLOAT_OUTPUT_ACTIVATION_MAX,
-              "");
-
-
-template 
-    struct DepthwiseConvHybridWindowPerChannel {};
-
-template 
-    struct DepthwiseConvHybridPartialPerChannel {};
-
-template <>
-struct DepthwiseConvHybridWindowPerChannel {
- public:
-  static inline void Run(const float* input_scale,
-                         const int8* input_ptr,
-                         const int8* filter_ptr, const float* bias_ptr,
-                         float* output_ptr, int64_t input_depth,
-                         int64_t input_row_size, int32 output_window_height,
-                         int32 output_window_width,
-                         const float* per_channel_scales,
-                         const DepthwiseConvParams* params_ptr) {
-    const int64_t input_width_increment = 2 * input_depth;
-    const int64_t input_height_increment = 2 * input_row_size;
-    const int64_t output_height_increment = 2 * 4 * params_ptr->output_row_size;
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-
-#define DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "1"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "2"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "3"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "4"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "5"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "6"
-#define DEPTHWISECONV_LABEL_HEIGHT_1 "7"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "8"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "9"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "10"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_END "11"
-
-    asm volatile(
-        // Performs depthwise convolutions for a window specified by
-        // |output_window_height| and |output_window_width|. The inner-most loop
-        // processes 2x2 outputs, and any leftovers at the end.
-        //
-        // Algorithm works as follows:
-        //
-        //   1. Load filters of 8 depth (8x3x3). Registers v0--v8 hold filter
-        //      values.
-        //   2. For 2 output heights at a time:
-        //        i.  For 2 output widths at a time, load inputs for a 2x1 (2
-        //            height, 1 width) output window (4x3 input window).
-        //            Registers v9--v20 hold input values. Mul-add with
-        //            accumulators v21--v24. Then run activation, downquantize
-        //            and store. Repeat for the next 2x1 output window,
-        //            leveraging overlapping inputs.
-        //        ii. Handle single leftover width if exists.
-        //   3. Handle single leftover height if exists.
-        //        i.  For 2 output widths at a time, load inputs for a 1x2 (1
-        //            height, 2 width) output window (3x4 input window).
-        //            Registers v9--v20 hold input values. Mul-add with
-        //            accumulators v21--v24. Then run activation, downquantize
-        //            and store. Repeat for the next 1x2 output window,
-        //            leveraging overlapping inputs.
-        //        ii. Handle single leftover width if exists.
-        //
-        // Loads are placed as soon as the register is no longer needed and
-        // interleaved with arithmetic operations to take advantage of
-        // dual-issue pipelines. We also add input offsets as far from the loads
-        // as possible to give loads enough cycles to fetch data from memory.
-        //
-        // This logic is copied and modified from the non-per-channel quantized
-        // part.
-        // However, the challenges are how to plan the registers allocation
-        // wisely: 25 NEON registers are already reserved for inputs, filters,
-        // and outputs; also, 2 registers (v30, v31) are used for output
-        // min/max, while another 2 registers (v26, v29) are used for input
-        // offset & output offset, so that's total 25 + 2 + 2 = 29 already.
-        // But we need 4 more registers to hold the output multiplier & output
-        // right shift (we only have 3).
-        //
-        // So here's the plan:
-        // v27 (which held duplicated output multiplier previously) will hold
-        // the first 4 values of the output_multiplier_ptr (we have 8 in total);
-        // v30 (which held duplicated output right shift previously) will hold
-        // the first 4 values of the output_shift_ptr (we have 8 in total);
-        // lastly, v28 will hold the last 4 values of output_mulitplier and v31
-        // (previously occupied by activations) will hold the last 4 values of
-        // output_shift. Then v25 will be used for output activation min while
-        // output activation max will just reuse oother registers, like v24.
-        //
-        // Set "constant" registers. These registers may be replaced with temp
-        // values from time to time when there are not enough NEON registers.
-        // We use x9--x15 general purpose registers as they are caller-saved
-        // temporary registers (see
-        // http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf).  // NOLINT
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr x3, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "cmp %w[output_window_height], #2\n"
-        "ldr w4, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MIN) "]\n"
-        "ldr w0, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v25.4s, w4\n"
-        "dup v29.4s, w0\n"
-        "ldr x1, [%[params_ptr], #" STR(OFFSET_OUTPUT_ROW_SIZE) "]\n"
-        "mov x4, #4\n"
-        "mul x1, x1, x4\n"
-        "mul x4, x4, x3\n"
-
-        // Load per_channel scales and bias (float).
-        "ldr w2, [%[input_scale]]\n"
-        "ld1 {v27.4s, v28.4s}, [%[per_channel_scales]]\n"
-        "ld1 {v30.4s, v31.4s}, [%[bias_ptr]]\n"
-        "dup v26.4s, w2\n"
-        "fmul v27.4s, v27.4s, v26.4s\n"
-        "fmul v28.4s, v28.4s, v26.4s\n"
-        "dup v26.8h, w9\n"
-
-        // Load filters and add offsets.
-        "ld1 {v0.8b}, [%[filter_ptr]], x3\n"
-        "ld1 {v1.8b}, [%[filter_ptr]], x3\n"
-        "sshll v0.8h, v0.8b, #0\n"
-        "ld1 {v2.8b}, [%[filter_ptr]], x3\n"
-        "sshll v1.8h, v1.8b, #0\n"
-        "ld1 {v3.8b}, [%[filter_ptr]], x3\n"
-        "sshll v2.8h, v2.8b, #0\n"
-        "ld1 {v4.8b}, [%[filter_ptr]], x3\n"
-        "sshll v3.8h, v3.8b, #0\n"
-        "ld1 {v5.8b}, [%[filter_ptr]], x3\n"
-        "sshll v4.8h, v4.8b, #0\n"
-        "ld1 {v6.8b}, [%[filter_ptr]], x3\n"
-        "sshll v5.8h, v5.8b, #0\n"
-        "ld1 {v7.8b}, [%[filter_ptr]], x3\n"
-        "sshll v6.8h, v6.8b, #0\n"
-        "ld1 {v8.8b}, [%[filter_ptr]], x3\n"
-        "sshll v7.8h, v7.8b, #0\n"
-        "sshll v8.8h, v8.8b, #0\n"
-
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_2_LOOP ":\n"
-          // This loop processes 2x2 outputs. To avoid register exhaustion,
-          // inputs for the left 2 outputs are loaded first, then the right
-          // two outputs.
-          "mov x11, %[input_ptr]\n"
-          "mov x12, x11\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "add x13, x11, %[input_row_size]\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "add x14, x13, %[input_row_size]\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x15, x14, %[input_row_size]\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "mov w5, %w[output_window_width]\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "mov x6, %[output_ptr]\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "add x7, %[output_ptr], x1\n"
-          "ld1 {v15.8b}, [x14], %[input_depth]\n"
-          // The height 2 / width 2 loop loads an extra 2x1 outputs (2 height,
-          // 1 width) in anticipation for the next iteration. Make sure
-          // |output_window_width| is large enough to handle the additional
-          // loads, otherwise jump to specific the appropriate label to handle
-          // smaller widths.
-          "cmp w5, #2\n"
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "ld1 {v16.8b}, [x14], %[input_depth]\n"
-          "saddw v10.8h, v26.8h, v10.8b\n"
-          "ld1 {v17.8b}, [x14], %[input_depth]\n"
-          "saddw v11.8h, v26.8h, v11.8b\n"
-          "ld1 {v18.8b}, [x15], %[input_depth]\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "ld1 {v19.8b}, [x15], %[input_depth]\n"
-          "saddw v13.8h, v26.8h, v13.8b\n"
-          "ld1 {v20.8b}, [x15], %[input_depth]\n"
-          "saddw v14.8h, v26.8h, v14.8b\n"
-
-          "movi v21.4s, #0\n"
-          "saddw v15.8h, v26.8h, v15.8b\n"
-          "movi v22.4s, #0\n"
-          "saddw v16.8h, v26.8h, v16.8b\n"
-          "movi v23.4s, #0\n"
-          "saddw v17.8h, v26.8h, v17.8b\n"
-          "movi v24.4s, #0\n"
-
-          "saddw v18.8h, v26.8h, v18.8b\n"
-          "saddw v19.8h, v26.8h, v19.8b\n"
-          "saddw v20.8h, v26.8h, v20.8b\n"
-
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "f\n"
-          "cmp w5, #1\n"
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          //"loop_%=:\n"
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP ":\n"
-            // Mul-add left outputs.
-            "smlal v21.4s, v0.4h, v9.4h\n"
-            "subs w5, w5, #2\n"
-            "smlal2 v22.4s, v0.8h, v9.8h\n"
-            "cmp w5, #3\n"
-            "smlal v23.4s, v0.4h, v12.4h\n"
-            "ld1 {v9.8b}, [x12]\n"
-            "smlal2 v24.4s, v0.8h, v12.8h\n"
-            "smlal v21.4s, v1.4h, v10.4h\n"
-            "smlal2 v22.4s, v1.8h, v10.8h\n"
-            "smlal v23.4s, v1.4h, v13.4h\n"
-            "smlal2 v24.4s, v1.8h, v13.8h\n"
-            "smlal v21.4s, v2.4h, v11.4h\n"
-            "smlal2 v22.4s, v2.8h, v11.8h\n"
-            "smlal v23.4s, v2.4h, v14.4h\n"
-            "smlal2 v24.4s, v2.8h, v14.8h\n"
-            "smlal v21.4s, v3.4h, v12.4h\n"
-            "smlal2 v22.4s, v3.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x13]\n"
-            "smlal v23.4s, v3.4h, v15.4h\n"
-            "smlal2 v24.4s, v3.8h, v15.8h\n"
-            "smlal v21.4s, v4.4h, v13.4h\n"
-            "smlal2 v22.4s, v4.8h, v13.8h\n"
-            "smlal v23.4s, v4.4h, v16.4h\n"
-            "smlal2 v24.4s, v4.8h, v16.8h\n"
-            "smlal v21.4s, v5.4h, v14.4h\n"
-            "smlal2 v22.4s, v5.8h, v14.8h\n"
-            "smlal v23.4s, v5.4h, v17.4h\n"
-            "smlal2 v24.4s, v5.8h, v17.8h\n"
-            "smlal v21.4s, v6.4h, v15.4h\n"
-            "smlal2 v22.4s, v6.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x14]\n"
-            "smlal v23.4s, v6.4h, v18.4h\n"
-            "smlal2 v24.4s, v6.8h, v18.8h\n"
-            "ld1 {v18.8b}, [x15]\n"
-            "smlal v21.4s, v7.4h, v16.4h\n"
-            "smlal2 v22.4s, v7.8h, v16.8h\n"
-            "smlal v23.4s, v7.4h, v19.4h\n"
-            "smlal2 v24.4s, v7.8h, v19.8h\n"
-            "smlal v21.4s, v8.4h, v17.4h\n"
-            "smlal2 v22.4s, v8.8h, v17.8h\n"
-            "smlal v23.4s, v8.4h, v20.4h\n"
-            "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-            // Cast to float.
-            "scvtf v21.4s, v21.4s\n"
-            "scvtf v22.4s, v22.4s\n"
-            "scvtf v23.4s, v23.4s\n"
-            "scvtf v24.4s, v24.4s\n"
-            // Multiply by per channel scale.
-            "fmul v21.4s, v21.4s, v27.4s\n"
-            "fmul v22.4s, v22.4s, v28.4s\n"
-            "fmul v23.4s, v23.4s, v27.4s\n"
-            "fmul v24.4s, v24.4s, v28.4s\n"
-            // Add bias.
-            "fadd v21.4s, v21.4s, v30.4s\n"
-            "fadd v22.4s, v22.4s, v31.4s\n"
-            "fadd v23.4s, v23.4s, v30.4s\n"
-            "fadd v24.4s, v24.4s, v31.4s\n"
-            // Clamp range.
-            "fmax v21.4s, v21.4s, v25.4s\n"
-            "fmin v21.4s, v21.4s, v29.4s\n"
-            "fmax v22.4s, v22.4s, v25.4s\n"
-            "fmin v22.4s, v22.4s, v29.4s\n"
-            "fmax v23.4s, v23.4s, v25.4s\n"
-            "fmin v23.4s, v23.4s, v29.4s\n"
-            "fmax v24.4s, v24.4s, v25.4s\n"
-            "fmin v24.4s, v24.4s, v29.4s\n"
-            // Store to float.
-            "st1 {v21.4s, v22.4s}, [x6], x4\n"
-            "st1 {v23.4s, v24.4s}, [x7], x4\n"
-            // Reset to int
-            "fcvtms v21.4s, v21.4s\n"
-            "fcvtms v22.4s, v22.4s\n"
-            "fcvtms v23.4s, v23.4s\n"
-            "fcvtms v24.4s, v24.4s\n"
-
-            "movi v22.4s, #0\n"
-            "movi v24.4s, #0\n"
-            "saddw v9.8h, v26.8h, v9.8b\n"
-            "saddw v12.8h, v26.8h, v12.8b\n"
-            "saddw v15.8h, v26.8h, v15.8b\n"
-            "movi v21.4s, #0\n"
-            "saddw v18.8h, v26.8h, v18.8b\n"
-            "movi v23.4s, #0\n"
-
-            // Mul-add right outputs.
-            "smlal v21.4s, v0.4h, v10.4h\n"
-            "add x11, x11, %[input_width_increment]\n"
-            "smlal2 v22.4s, v0.8h, v10.8h\n"
-            "mov x12, x11\n"
-            "smlal v23.4s, v0.4h, v13.4h\n"
-            "add x13, x11, %[input_row_size]\n"
-            "smlal2 v24.4s, v0.8h, v13.8h\n"
-            "add x14, x13, %[input_row_size]\n"
-            "smlal v21.4s, v1.4h, v11.4h\n"
-            "add x15, x14, %[input_row_size]\n"
-            "smlal2 v22.4s, v1.8h, v11.8h\n"
-            "smlal v23.4s, v1.4h, v14.4h\n"
-            "smlal2 v24.4s, v1.8h, v14.8h\n"
-            "smlal v21.4s, v2.4h, v9.4h\n"
-            "smlal2 v22.4s, v2.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v2.4h, v12.4h\n"
-            "ld1 {v10.8b}, [x12], %[input_depth]\n"
-            "smlal2 v24.4s, v2.8h, v12.8h\n"
-            "ld1 {v11.8b}, [x12], %[input_depth]\n"
-            "smlal v21.4s, v3.4h, v13.4h\n"
-            "smlal2 v22.4s, v3.8h, v13.8h\n"
-            "smlal v23.4s, v3.4h, v16.4h\n"
-            "smlal2 v24.4s, v3.8h, v16.8h\n"
-            "smlal v21.4s, v4.4h, v14.4h\n"
-            "smlal2 v22.4s, v4.8h, v14.8h\n"
-            "smlal v23.4s, v4.4h, v17.4h\n"
-            "smlal2 v24.4s, v4.8h, v17.8h\n"
-            "smlal v21.4s, v5.4h, v12.4h\n"
-            "smlal2 v22.4s, v5.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v5.4h, v15.4h\n"
-            "ld1 {v13.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v5.8h, v15.8h\n"
-            "ld1 {v14.8b}, [x13], %[input_depth]\n"
-            "smlal v21.4s, v6.4h, v16.4h\n"
-            "smlal2 v22.4s, v6.8h, v16.8h\n"
-            "smlal v23.4s, v6.4h, v19.4h\n"
-            "smlal2 v24.4s, v6.8h, v19.8h\n"
-            "smlal v21.4s, v7.4h, v17.4h\n"
-            "smlal2 v22.4s, v7.8h, v17.8h\n"
-            "smlal v23.4s, v7.4h, v20.4h\n"
-            "smlal2 v24.4s, v7.8h, v20.8h\n"
-            "smlal v21.4s, v8.4h, v15.4h\n"
-            "smlal2 v22.4s, v8.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x14], %[input_depth]\n"
-            "smlal v23.4s, v8.4h, v18.4h\n"
-            "ld1 {v16.8b}, [x14], %[input_depth]\n"
-            "smlal2 v24.4s, v8.8h, v18.8h\n"
-            "ld1 {v17.8b}, [x14], %[input_depth]\n"
-            "ld1 {v18.8b}, [x15], %[input_depth]\n"
-            "ld1 {v19.8b}, [x15], %[input_depth]\n"
-            "ld1 {v20.8b}, [x15], %[input_depth]\n"
-
-            // Cast to float.
-            "scvtf v21.4s, v21.4s\n"
-            "scvtf v22.4s, v22.4s\n"
-            "scvtf v23.4s, v23.4s\n"
-            "scvtf v24.4s, v24.4s\n"
-            // Multiply by per channel scale.
-            "fmul v21.4s, v21.4s, v27.4s\n"
-            "fmul v22.4s, v22.4s, v28.4s\n"
-            "fmul v23.4s, v23.4s, v27.4s\n"
-            "fmul v24.4s, v24.4s, v28.4s\n"
-            // Add bias.
-            "fadd v21.4s, v21.4s, v30.4s\n"
-            "fadd v22.4s, v22.4s, v31.4s\n"
-            "fadd v23.4s, v23.4s, v30.4s\n"
-            "fadd v24.4s, v24.4s, v31.4s\n"
-            // Clamp range.
-            "fmax v21.4s, v21.4s, v25.4s\n"
-            "fmin v21.4s, v21.4s, v29.4s\n"
-            "fmax v22.4s, v22.4s, v25.4s\n"
-            "fmin v22.4s, v22.4s, v29.4s\n"
-            "fmax v23.4s, v23.4s, v25.4s\n"
-            "fmin v23.4s, v23.4s, v29.4s\n"
-            "fmax v24.4s, v24.4s, v25.4s\n"
-            "fmin v24.4s, v24.4s, v29.4s\n"
-            // Store to float.
-            "st1 {v21.4s, v22.4s}, [x6], x4\n"
-            "st1 {v23.4s, v24.4s}, [x7], x4\n"
-            // Reset to int.
-            "fcvtms v21.4s, v21.4s\n"
-            "fcvtms v22.4s, v22.4s\n"
-            "fcvtms v23.4s, v23.4s\n"
-            "fcvtms v24.4s, v24.4s\n"
-
-            "movi v22.4s, #0\n"
-            "movi v24.4s, #0\n"
-            "saddw v9.8h, v26.8h, v9.8b\n"
-            "saddw v10.8h, v26.8h, v10.8b\n"
-            "saddw v11.8h, v26.8h, v11.8b\n"
-            "saddw v12.8h, v26.8h, v12.8b\n"
-            "saddw v13.8h, v26.8h, v13.8b\n"
-            "saddw v14.8h, v26.8h, v14.8b\n"
-            "saddw v15.8h, v26.8h, v15.8b\n"
-            "movi v21.4s, #0\n"
-            "saddw v16.8h, v26.8h, v16.8b\n"
-            "movi v23.4s, #0\n"
-            "saddw v17.8h, v26.8h, v17.8b\n"
-            "saddw v18.8h, v26.8h, v18.8b\n"
-            "saddw v19.8h, v26.8h, v19.8b\n"
-            "saddw v20.8h, v26.8h, v20.8b\n"
-
-            "bge " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "b\n"
-
-          // At this point, there will be one of 2 width or 1 width leftover,
-          // not both.
-          "cmp w5, #2\n"
-          "blt " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          // Handle last 2 columns if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER ":\n"
-          // Mul-add left outputs.
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "ld1 {v9.8b}, [x12]\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "smlal v23.4s, v2.4h, v14.4h\n"
-          "smlal2 v24.4s, v2.8h, v14.8h\n"
-          "smlal v21.4s, v3.4h, v12.4h\n"
-          "smlal2 v22.4s, v3.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x13]\n"
-          "smlal v23.4s, v3.4h, v15.4h\n"
-          "smlal2 v24.4s, v3.8h, v15.8h\n"
-          "smlal v21.4s, v4.4h, v13.4h\n"
-          "smlal2 v22.4s, v4.8h, v13.8h\n"
-          "smlal v23.4s, v4.4h, v16.4h\n"
-          "smlal2 v24.4s, v4.8h, v16.8h\n"
-          "smlal v21.4s, v5.4h, v14.4h\n"
-          "smlal2 v22.4s, v5.8h, v14.8h\n"
-          "smlal v23.4s, v5.4h, v17.4h\n"
-          "smlal2 v24.4s, v5.8h, v17.8h\n"
-          "smlal v21.4s, v6.4h, v15.4h\n"
-          "smlal2 v22.4s, v6.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x14]\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x15]\n"
-          "smlal v21.4s, v7.4h, v16.4h\n"
-          "smlal2 v22.4s, v7.8h, v16.8h\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-          // Cast to float.
-          "scvtf v21.4s, v21.4s\n"
-          "scvtf v22.4s, v22.4s\n"
-          "scvtf v23.4s, v23.4s\n"
-          "scvtf v24.4s, v24.4s\n"
-          // Multiply by per channel scale.
-          "fmul v21.4s, v21.4s, v27.4s\n"
-          "fmul v22.4s, v22.4s, v28.4s\n"
-          "fmul v23.4s, v23.4s, v27.4s\n"
-          "fmul v24.4s, v24.4s, v28.4s\n"
-          // Add bias.
-          "fadd v21.4s, v21.4s, v30.4s\n"
-          "fadd v22.4s, v22.4s, v31.4s\n"
-          "fadd v23.4s, v23.4s, v30.4s\n"
-          "fadd v24.4s, v24.4s, v31.4s\n"
-          // Clamp range.
-          "fmax v21.4s, v21.4s, v25.4s\n"
-          "fmin v21.4s, v21.4s, v29.4s\n"
-          "fmax v22.4s, v22.4s, v25.4s\n"
-          "fmin v22.4s, v22.4s, v29.4s\n"
-          "fmax v23.4s, v23.4s, v25.4s\n"
-          "fmin v23.4s, v23.4s, v29.4s\n"
-          "fmax v24.4s, v24.4s, v25.4s\n"
-          "fmin v24.4s, v24.4s, v29.4s\n"
-          // Store to float.
-          "st1 {v21.4s, v22.4s}, [x6], x4\n"
-          "st1 {v23.4s, v24.4s}, [x7], x4\n"
-          // Reset to int.
-          "fcvtms v21.4s, v21.4s\n"
-          "fcvtms v22.4s, v22.4s\n"
-          "fcvtms v23.4s, v23.4s\n"
-          "fcvtms v24.4s, v24.4s\n"
-
-          "movi v22.4s, #0\n"
-          "movi v24.4s, #0\n"
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "saddw v15.8h, v26.8h, v15.8b\n"
-          "movi v21.4s, #0\n"
-          "saddw v18.8h, v26.8h, v18.8b\n"
-          "movi v23.4s, #0\n"
-
-          // Mul-add right outputs.
-          "smlal v21.4s, v0.4h, v10.4h\n"
-          "smlal2 v22.4s, v0.8h, v10.8h\n"
-          "smlal v23.4s, v0.4h, v13.4h\n"
-          "smlal2 v24.4s, v0.8h, v13.8h\n"
-          "smlal v21.4s, v1.4h, v11.4h\n"
-          "smlal2 v22.4s, v1.8h, v11.8h\n"
-          "smlal v23.4s, v1.4h, v14.4h\n"
-          "smlal2 v24.4s, v1.8h, v14.8h\n"
-          "smlal v21.4s, v2.4h, v9.4h\n"
-          "smlal2 v22.4s, v2.8h, v9.8h\n"
-          "smlal v23.4s, v2.4h, v12.4h\n"
-          "smlal2 v24.4s, v2.8h, v12.8h\n"
-          "smlal v21.4s, v3.4h, v13.4h\n"
-          "smlal2 v22.4s, v3.8h, v13.8h\n"
-          "smlal v23.4s, v3.4h, v16.4h\n"
-          "smlal2 v24.4s, v3.8h, v16.8h\n"
-          "smlal v21.4s, v4.4h, v14.4h\n"
-          "smlal2 v22.4s, v4.8h, v14.8h\n"
-          "smlal v23.4s, v4.4h, v17.4h\n"
-          "smlal2 v24.4s, v4.8h, v17.8h\n"
-          "smlal v21.4s, v5.4h, v12.4h\n"
-          "smlal2 v22.4s, v5.8h, v12.8h\n"
-          "smlal v23.4s, v5.4h, v15.4h\n"
-          "smlal2 v24.4s, v5.8h, v15.8h\n"
-          "smlal v21.4s, v6.4h, v16.4h\n"
-          "smlal2 v22.4s, v6.8h, v16.8h\n"
-          "smlal v23.4s, v6.4h, v19.4h\n"
-          "smlal2 v24.4s, v6.8h, v19.8h\n"
-          "smlal v21.4s, v7.4h, v17.4h\n"
-          "smlal2 v22.4s, v7.8h, v17.8h\n"
-          "smlal v23.4s, v7.4h, v20.4h\n"
-          "smlal2 v24.4s, v7.8h, v20.8h\n"
-          "smlal v21.4s, v8.4h, v15.4h\n"
-          "smlal2 v22.4s, v8.8h, v15.8h\n"
-          "smlal v23.4s, v8.4h, v18.4h\n"
-          "smlal2 v24.4s, v8.8h, v18.8h\n"
-
-          // Cast to float.
-          "scvtf v21.4s, v21.4s\n"
-          "scvtf v22.4s, v22.4s\n"
-          "scvtf v23.4s, v23.4s\n"
-          "scvtf v24.4s, v24.4s\n"
-          // Multiply by per channel scale.
-          "fmul v21.4s, v21.4s, v27.4s\n"
-          "fmul v22.4s, v22.4s, v28.4s\n"
-          "fmul v23.4s, v23.4s, v27.4s\n"
-          "fmul v24.4s, v24.4s, v28.4s\n"
-          // Add bias.
-          "fadd v21.4s, v21.4s, v30.4s\n"
-          "fadd v22.4s, v22.4s, v31.4s\n"
-          "fadd v23.4s, v23.4s, v30.4s\n"
-          "fadd v24.4s, v24.4s, v31.4s\n"
-          // Clamp range.
-          "fmax v21.4s, v21.4s, v25.4s\n"
-          "fmin v21.4s, v21.4s, v29.4s\n"
-          "fmax v22.4s, v22.4s, v25.4s\n"
-          "fmin v22.4s, v22.4s, v29.4s\n"
-          "fmax v23.4s, v23.4s, v25.4s\n"
-          "fmin v23.4s, v23.4s, v29.4s\n"
-          "fmax v24.4s, v24.4s, v25.4s\n"
-          "fmin v24.4s, v24.4s, v29.4s\n"
-          // Store to float.
-          "st1 {v21.4s, v22.4s}, [x6], x4\n"
-          "st1 {v23.4s, v24.4s}, [x7], x4\n"
-          // Reset to int.
-          "fcvtms v21.4s, v21.4s\n"
-          "fcvtms v22.4s, v22.4s\n"
-          "fcvtms v23.4s, v23.4s\n"
-          "fcvtms v24.4s, v24.4s\n"
-          "b " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "f\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER ":\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "smlal v23.4s, v2.4h, v14.4h\n"
-          "smlal2 v24.4s, v2.8h, v14.8h\n"
-          "smlal v21.4s, v3.4h, v12.4h\n"
-          "smlal2 v22.4s, v3.8h, v12.8h\n"
-          "smlal v23.4s, v3.4h, v15.4h\n"
-          "smlal2 v24.4s, v3.8h, v15.8h\n"
-          "smlal v21.4s, v4.4h, v13.4h\n"
-          "smlal2 v22.4s, v4.8h, v13.8h\n"
-          "smlal v23.4s, v4.4h, v16.4h\n"
-          "smlal2 v24.4s, v4.8h, v16.8h\n"
-          "smlal v21.4s, v5.4h, v14.4h\n"
-          "smlal2 v22.4s, v5.8h, v14.8h\n"
-          "smlal v23.4s, v5.4h, v17.4h\n"
-          "smlal2 v24.4s, v5.8h, v17.8h\n"
-          "smlal v21.4s, v6.4h, v15.4h\n"
-          "smlal2 v22.4s, v6.8h, v15.8h\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "smlal v21.4s, v7.4h, v16.4h\n"
-          "smlal2 v22.4s, v7.8h, v16.8h\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-          // Cast to float.
-          "scvtf v21.4s, v21.4s\n"
-          "scvtf v22.4s, v22.4s\n"
-          "scvtf v23.4s, v23.4s\n"
-          "scvtf v24.4s, v24.4s\n"
-          // Multiply by per channel scale.
-          "fmul v21.4s, v21.4s, v27.4s\n"
-          "fmul v22.4s, v22.4s, v28.4s\n"
-          "fmul v23.4s, v23.4s, v27.4s\n"
-          "fmul v24.4s, v24.4s, v28.4s\n"
-           // Add bias.
-          "fadd v21.4s, v21.4s, v30.4s\n"
-          "fadd v22.4s, v22.4s, v31.4s\n"
-          "fadd v23.4s, v23.4s, v30.4s\n"
-          "fadd v24.4s, v24.4s, v31.4s\n"
-          // Clamp range.
-          "fmax v21.4s, v21.4s, v25.4s\n"
-          "fmin v21.4s, v21.4s, v29.4s\n"
-          "fmax v22.4s, v22.4s, v25.4s\n"
-          "fmin v22.4s, v22.4s, v29.4s\n"
-          "fmax v23.4s, v23.4s, v25.4s\n"
-          "fmin v23.4s, v23.4s, v29.4s\n"
-          "fmax v24.4s, v24.4s, v25.4s\n"
-          "fmin v24.4s, v24.4s, v29.4s\n"
-          // Store to float.
-          "st1 {v21.4s, v22.4s}, [x6], x4\n"
-          "st1 {v23.4s, v24.4s}, [x7], x4\n"
-          // Reset to int.
-          "fcvtms v21.4s, v21.4s\n"
-          "fcvtms v22.4s, v22.4s\n"
-          "fcvtms v23.4s, v23.4s\n"
-          "fcvtms v24.4s, v24.4s\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP ":\n"
-          "subs %w[output_window_height], %w[output_window_height], #2\n"
-          "add %[input_ptr], %[input_ptr], %[input_height_increment]\n"
-          "cmp %w[output_window_height], #2\n"
-          "add %[output_ptr], %[output_ptr], %[output_height_increment]\n"
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP ":\n"
-        "cmp %w[output_window_height], #1\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_1 ":\n"
-        "mov x12, %[input_ptr]\n"
-        "ld1 {v9.8b}, [x12], %[input_depth]\n"
-        "add x13, %[input_ptr], %[input_row_size]\n"
-        "ld1 {v10.8b}, [x12], %[input_depth]\n"
-        "add x14, x13, %[input_row_size]\n"
-        "ld1 {v11.8b}, [x12], %[input_depth]\n"
-        "add x15, x14, %[input_row_size]\n"
-        "mov w5, %w[output_window_width]\n"
-        "ld1 {v13.8b}, [x13], %[input_depth]\n"
-        "mov x6, %[output_ptr]\n"
-        "ld1 {v14.8b}, [x13], %[input_depth]\n"
-        "add x7, %[output_ptr], x1\n"
-        "ld1 {v15.8b}, [x13], %[input_depth]\n"
-        // The height 1 / width 2 loop loads an extra 1x1 output in anticipation
-        // for the next iteration. Make sure |output_window_width| is large
-        // enough to handle the additional load, otherwise jump to the
-        // appropriate label to handle smaller widths.
-        "cmp w5, #2\n"
-        "ld1 {v17.8b}, [x14], %[input_depth]\n"
-        "ld1 {v18.8b}, [x14], %[input_depth]\n"
-        "ld1 {v19.8b}, [x14], %[input_depth]\n"
-        "movi v21.4s, #0\n"
-        "movi v22.4s, #0\n"
-        "movi v23.4s, #0\n"
-        "movi v24.4s, #0\n"
-
-        "saddw v9.8h, v26.8h, v9.8b\n"
-        "saddw v10.8h, v26.8h, v10.8b\n"
-        "saddw v11.8h, v26.8h, v11.8b\n"
-        "saddw v13.8h, v26.8h, v13.8b\n"
-        "saddw v14.8h, v26.8h, v14.8b\n"
-        "saddw v15.8h, v26.8h, v15.8b\n"
-        "saddw v17.8h, v26.8h, v17.8b\n"
-        "saddw v18.8h, v26.8h, v18.8b\n"
-        "saddw v19.8h, v26.8h, v19.8b\n"
-
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "f\n"
-        "cmp w5, #1\n"
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP ":\n"
-          // Load inputs for 3x4 input window which corresponds to a 1x2 output
-          // window.
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v12.8b}, [x12]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v16.8b}, [x13]\n"
-          "smlal v23.4s, v0.4h, v10.4h\n"
-          "ld1 {v20.8b}, [x14]\n"
-          "smlal2 v24.4s, v0.8h, v10.8h\n"
-          "subs w5, w5, #2\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "cmp w5, #3\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "add %[input_ptr], %[input_ptr], %[input_width_increment]\n"
-          "smlal v23.4s, v1.4h, v11.4h\n"
-          "mov x12, %[input_ptr]\n"
-          "smlal2 v24.4s, v1.8h, v11.8h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x13, %[input_ptr], %[input_row_size]\n"
-          "smlal v23.4s, v2.4h, v12.4h\n"
-          "add x14, x13, %[input_row_size]\n"
-          "smlal2 v24.4s, v2.8h, v12.8h\n"
-          "smlal v21.4s, v3.4h, v13.4h\n"
-          "add x15, x14, %[input_row_size]\n"
-          "smlal2 v22.4s, v3.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v3.4h, v14.4h\n"
-          "smlal2 v24.4s, v3.8h, v14.8h\n"
-          "smlal v21.4s, v4.4h, v14.4h\n"
-          "smlal2 v22.4s, v4.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v4.4h, v15.4h\n"
-          "smlal2 v24.4s, v4.8h, v15.8h\n"
-          "smlal v21.4s, v5.4h, v15.4h\n"
-          "saddw v16.8h, v26.8h, v16.8b\n"
-          "smlal2 v22.4s, v5.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v5.4h, v16.4h\n"
-          "smlal2 v24.4s, v5.8h, v16.8h\n"
-          "smlal v21.4s, v6.4h, v17.4h\n"
-          "smlal2 v22.4s, v6.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v6.4h, v18.4h\n"
-          "smlal2 v24.4s, v6.8h, v18.8h\n"
-          "smlal v21.4s, v7.4h, v18.4h\n"
-          "smlal2 v22.4s, v7.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v7.4h, v19.4h\n"
-          "smlal2 v24.4s, v7.8h, v19.8h\n"
-          "smlal v21.4s, v8.4h, v19.4h\n"
-          "saddw v20.8h, v26.8h, v20.8b\n"
-          "smlal2 v22.4s, v8.8h, v19.8h\n"
-          "ld1 {v19.8b}, [x14], %[input_depth]\n"
-          "smlal v23.4s, v8.4h, v20.4h\n"
-          "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-          // Cast to float.
-          "scvtf v21.4s, v21.4s\n"
-          "scvtf v22.4s, v22.4s\n"
-          "scvtf v23.4s, v23.4s\n"
-          "scvtf v24.4s, v24.4s\n"
-          // Multiply by per channel scale.
-          "fmul v21.4s, v21.4s, v27.4s\n"
-          "fmul v22.4s, v22.4s, v28.4s\n"
-          "fmul v23.4s, v23.4s, v27.4s\n"
-          "fmul v24.4s, v24.4s, v28.4s\n"
-          // Add bias.
-          "fadd v21.4s, v21.4s, v30.4s\n"
-          "fadd v22.4s, v22.4s, v31.4s\n"
-          "fadd v23.4s, v23.4s, v30.4s\n"
-          "fadd v24.4s, v24.4s, v31.4s\n"
-          // Clamp range.
-          "fmax v21.4s, v21.4s, v25.4s\n"
-          "fmin v21.4s, v21.4s, v29.4s\n"
-          "fmax v22.4s, v22.4s, v25.4s\n"
-          "fmin v22.4s, v22.4s, v29.4s\n"
-          "fmax v23.4s, v23.4s, v25.4s\n"
-          "fmin v23.4s, v23.4s, v29.4s\n"
-          "fmax v24.4s, v24.4s, v25.4s\n"
-          "fmin v24.4s, v24.4s, v29.4s\n"
-          // Store to float.
-          "st1 {v21.4s, v22.4s}, [%[output_ptr]], x4\n"
-          "st1 {v23.4s, v24.4s}, [%[output_ptr]], x4\n"
-          // Reset to int.
-          "fcvtms v21.4s, v21.4s\n"
-          "fcvtms v22.4s, v22.4s\n"
-          "fcvtms v23.4s, v23.4s\n"
-          "fcvtms v24.4s, v24.4s\n"
-
-          "movi v22.4s, #0\n"
-          "movi v24.4s, #0\n"
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "saddw v10.8h, v26.8h, v10.8b\n"
-          "saddw v11.8h, v26.8h, v11.8b\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "saddw v13.8h, v26.8h, v13.8b\n"
-          "saddw v14.8h, v26.8h, v14.8b\n"
-          "saddw v15.8h, v26.8h, v15.8b\n"
-          "movi v21.4s, #0\n"
-          "saddw v16.8h, v26.8h, v16.8b\n"
-          "movi v23.4s, #0\n"
-          "saddw v17.8h, v26.8h, v17.8b\n"
-          "saddw v18.8h, v26.8h, v18.8b\n"
-          "saddw v19.8h, v26.8h, v19.8b\n"
-          "saddw v20.8h, v26.8h, v20.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "b\n"
-
-        // At this point, there will be one of 2 width or 1 width leftover,
-        // not both.
-        "cmp w5, #2\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        // Handle last two horizontal outputs if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER ":\n"
-        "smlal v21.4s, v0.4h, v9.4h\n"
-        "ld1 {v12.8b}, [x12], %[input_depth]\n"
-        "smlal2 v22.4s, v0.8h, v9.8h\n"
-        "ld1 {v16.8b}, [x13], %[input_depth]\n"
-        "smlal v23.4s, v0.4h, v10.4h\n"
-        "ld1 {v20.8b}, [x14], %[input_depth]\n"
-        "smlal2 v24.4s, v0.8h, v10.8h\n"
-        "smlal v21.4s, v1.4h, v10.4h\n"
-        "smlal2 v22.4s, v1.8h, v10.8h\n"
-        "smlal v23.4s, v1.4h, v11.4h\n"
-        "smlal2 v24.4s, v1.8h, v11.8h\n"
-        "smlal v21.4s, v2.4h, v11.4h\n"
-        "saddw v12.8h, v26.8h, v12.8b\n"
-        "smlal2 v22.4s, v2.8h, v11.8h\n"
-        "smlal v23.4s, v2.4h, v12.4h\n"
-        "smlal2 v24.4s, v2.8h, v12.8h\n"
-        "smlal v21.4s, v3.4h, v13.4h\n"
-        "smlal2 v22.4s, v3.8h, v13.8h\n"
-        "smlal v23.4s, v3.4h, v14.4h\n"
-        "smlal2 v24.4s, v3.8h, v14.8h\n"
-        "smlal v21.4s, v4.4h, v14.4h\n"
-        "smlal2 v22.4s, v4.8h, v14.8h\n"
-        "smlal v23.4s, v4.4h, v15.4h\n"
-        "smlal2 v24.4s, v4.8h, v15.8h\n"
-        "smlal v21.4s, v5.4h, v15.4h\n"
-        "saddw v16.8h, v26.8h, v16.8b\n"
-        "smlal2 v22.4s, v5.8h, v15.8h\n"
-        "smlal v23.4s, v5.4h, v16.4h\n"
-        "smlal2 v24.4s, v5.8h, v16.8h\n"
-        "smlal v21.4s, v6.4h, v17.4h\n"
-        "smlal2 v22.4s, v6.8h, v17.8h\n"
-        "smlal v23.4s, v6.4h, v18.4h\n"
-        "smlal2 v24.4s, v6.8h, v18.8h\n"
-        "smlal v21.4s, v7.4h, v18.4h\n"
-        "smlal2 v22.4s, v7.8h, v18.8h\n"
-        "smlal v23.4s, v7.4h, v19.4h\n"
-        "smlal2 v24.4s, v7.8h, v19.8h\n"
-        "smlal v21.4s, v8.4h, v19.4h\n"
-        "saddw v20.8h, v26.8h, v20.8b\n"
-        "smlal2 v22.4s, v8.8h, v19.8h\n"
-        "smlal v23.4s, v8.4h, v20.4h\n"
-        "smlal2 v24.4s, v8.8h, v20.8h\n"
-
-        // Cast to float.
-        "scvtf v21.4s, v21.4s\n"
-        "scvtf v22.4s, v22.4s\n"
-        "scvtf v23.4s, v23.4s\n"
-        "scvtf v24.4s, v24.4s\n"
-        // Multiply by per channel scale.
-        "fmul v21.4s, v21.4s, v27.4s\n"
-        "fmul v22.4s, v22.4s, v28.4s\n"
-        "fmul v23.4s, v23.4s, v27.4s\n"
-        "fmul v24.4s, v24.4s, v28.4s\n"
-        // Add bias.
-        "fadd v21.4s, v21.4s, v30.4s\n"
-        "fadd v22.4s, v22.4s, v31.4s\n"
-        "fadd v23.4s, v23.4s, v30.4s\n"
-        "fadd v24.4s, v24.4s, v31.4s\n"
-        // Clamp range.
-        "fmax v21.4s, v21.4s, v25.4s\n"
-        "fmin v21.4s, v21.4s, v29.4s\n"
-        "fmax v22.4s, v22.4s, v25.4s\n"
-        "fmin v22.4s, v22.4s, v29.4s\n"
-        "fmax v23.4s, v23.4s, v25.4s\n"
-        "fmin v23.4s, v23.4s, v29.4s\n"
-        "fmax v24.4s, v24.4s, v25.4s\n"
-        "fmin v24.4s, v24.4s, v29.4s\n"
-        // Store to float.
-        "st1 {v21.4s, v22.4s}, [%[output_ptr]], x4\n"
-        "st1 {v23.4s, v24.4s}, [%[output_ptr]], x4\n"
-        // Reset to int.
-        "fcvtms v21.4s, v21.4s\n"
-        "fcvtms v22.4s, v22.4s\n"
-        "fcvtms v23.4s, v23.4s\n"
-        "fcvtms v24.4s, v24.4s\n"
-
-        "b " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        // Handle bottom right output if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER ":\n"
-        "smlal v21.4s, v0.4h, v9.4h\n"
-        "smlal2 v22.4s, v0.8h, v9.8h\n"
-        "smlal v21.4s, v1.4h, v10.4h\n"
-        "smlal2 v22.4s, v1.8h, v10.8h\n"
-        "smlal v21.4s, v2.4h, v11.4h\n"
-        "smlal2 v22.4s, v2.8h, v11.8h\n"
-        "smlal v21.4s, v3.4h, v13.4h\n"
-        "smlal2 v22.4s, v3.8h, v13.8h\n"
-        "smlal v21.4s, v4.4h, v14.4h\n"
-        "smlal2 v22.4s, v4.8h, v14.8h\n"
-        "smlal v21.4s, v5.4h, v15.4h\n"
-        "smlal2 v22.4s, v5.8h, v15.8h\n"
-        "smlal v21.4s, v6.4h, v17.4h\n"
-        "smlal2 v22.4s, v6.8h, v17.8h\n"
-        "smlal v21.4s, v7.4h, v18.4h\n"
-        "smlal2 v22.4s, v7.8h, v18.8h\n"
-        "smlal v21.4s, v8.4h, v19.4h\n"
-        "smlal2 v22.4s, v8.8h, v19.8h\n"
-
-        "scvtf v21.4s, v21.4s\n"
-        "scvtf v22.4s, v22.4s\n"
-        "fmul v21.4s, v21.4s, v27.4s\n"
-        "fmul v22.4s, v22.4s, v28.4s\n"
-        "fadd v21.4s, v21.4s, v30.4s\n"
-        "fadd v22.4s, v22.4s, v31.4s\n"
-        "fmax v21.4s, v21.4s, v25.4s\n"
-        "fmin v21.4s, v21.4s, v29.4s\n"
-        "fmax v22.4s, v22.4s, v25.4s\n"
-        "fmin v22.4s, v22.4s, v29.4s\n"
-        "st1 {v21.4s, v22.4s}, [%[output_ptr]]\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_END ":\n"
-    :
-    // Outputs.
-    [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-    [output_ptr] "+r"(output_ptr),
-    [output_window_height] "+r"(output_window_height),
-    [per_channel_scales] "+r"(per_channel_scales)
-    :
-    // Inputs.
-    [input_scale] "r"(input_scale),
-    [bias_ptr] "r"(bias_ptr), [input_row_size] "r"(input_row_size),
-    [input_depth] "r"(input_depth),
-    [output_window_width] "r"(output_window_width),
-    [input_width_increment] "r"(input_width_increment),
-    [input_height_increment] "r"(input_height_increment),
-    [output_height_increment] "r"(output_height_increment),
-    [params_ptr] "r"(params_ptr)
-    :
-    // Clobbers.
-    "cc", "memory",
-    // We use these NEON registers.
-    "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
-    "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-    "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29",
-    "v30", "v31",
-    // We use these general-purpose registers.
-    "x0", "x1", "x2", "x3", "x4", "x5", "x6", "x7",
-    "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_END
-  }
-};
-
-template <>
-struct DepthwiseConvHybridWindowPerChannel {
-  static inline void Run(const float* input_scale, const int8* input_ptr,
-                         const int8* filter_ptr, const float* bias_ptr,
-                         float* output_ptr, int64_t input_depth,
-                         int64_t input_row_size, int32 output_window_height,
-                         int32 output_window_width,
-                         const float* per_channel_scales,
-                         const DepthwiseConvParams* params_ptr) {
-    const int64_t input_width_increment = 4 * input_depth;
-    const int64_t input_height_increment = 4 * input_row_size;
-    const int64_t output_height_increment = 2 * 4 * params_ptr->output_row_size;
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-
-#define DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "1"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "2"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "3"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "4"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "5"
-#define DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "6"
-#define DEPTHWISECONV_LABEL_HEIGHT_1 "7"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "8"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "9"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "10"
-#define DEPTHWISECONV_LABEL_HEIGHT_1_END "11"
-
-    asm volatile(
-        // Performs depthwise convolutions for a window specified by
-        // |output_window_height| and |output_window_width|. The inner-most loop
-        // processes 2x2 outputs, and any leftovers at the end.
-        //
-        // Algorithm works as follows:
-        //
-        //   1. Load filters of 8 depth (8x3x3). Registers v0--v8 hold filter
-        //      values.
-        //   2. For 2 output heights at a time:
-        //        i.  For 2 output widths at a time at stride 2, a 5x5 input
-        //            window is required. To avoid register exhaustion, we load
-        //            the first 2 rows of the 5x5 input window into registers
-        //            v9--v18, and use the same registers to load the next 2
-        //            rows, and finally v9--v13 to load the last row.
-        //            Accumulators for all 2x2 outputs are reserved by registers
-        //            v21-v22 (top left output), v23-v24 (top right output),
-        //            v19-v20 (bottom left output), v25-v26 (bottom right
-        //            output).
-        //        ii. Handle single leftover width if exists.
-        //   3. Handle single leftover height if exists.
-        //        i.  For 2 output widths at a time at stride 2, load inputs for
-        //            a 1x2 (1 height, 2 width) output window (3x5 input
-        //            window). Registers v9--v24 hold input values. Mul-add with
-        //            accumulators v24--v27.
-        //        ii. Handle single leftover width if exists.
-        //
-        // Loads are placed as soon as the register is no longer needed and
-        // interleaved with arithmetic operations to take advantage of
-        // dual-issue pipelines. We also add input offsets as far from the loads
-        // as possible to give loads enough cycles to fetch data from memory.
-        //
-        // This logic is copied and modified from the non-per-channel quantized
-        // part.
-        // The register planning here is really tricky:
-        // v0-v29 are all used at least once for either filter/input/output,
-        // some of them are used for output shift and output mulitplier, or
-        // input/output offset.
-        // Only v30 & v31 are only used for output activation min/max.
-        // For per-channel case, we need 4 registers to hold output shift &
-        // output multiplier. However, given the reality, we simply cannot do
-        // that without reloading.
-        //
-        // So here's the plan:
-        // We hold output_multiplier in v30 & v31, and we will load output_shift
-        // into two consecutive registers each time before use.
-        // We will duplicate output min & max before needed.
-        // Sometimes we may borrow registers from input offset or bias, we will
-        // dup them back after use.
-        //
-
-        // Set "constant" registers. These registers may be replaced with temp
-        // values from time to time when there are not enough NEON registers.
-        // We use x9--x15 general purpose registers as they are caller-saved
-        // temporary registers (see http://infocenter.arm.com/help/topic/com.arm.doc.ihi0055b/IHI0055B_aapcs64.pdf).  // NOLINT
-        "ldr w0, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "cmp %w[output_window_height], #2\n"
-        "ldr x5, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "ldr x19, [%[params_ptr], #" STR(OFFSET_OUTPUT_ROW_SIZE) "]\n"
-        "mov x4, #4\n"
-        "mul x19, x19, x4\n"
-        "mul x4, x4, x5\n"
-        "ldr w2, [%[input_scale]]\n"
-        "dup v28.4s, w2\n"
-        "ldr w3, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MIN) "]\n"
-        "ldr w2, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v29.4s, w2\n"
-        "ld1 {v30.4s, v31.4s}, [%[per_channel_scales]]\n"
-        "fmul v30.4s, v30.4s, v28.4s\n"
-        "fmul v31.4s, v31.4s, v28.4s\n"
-        "dup v28.8h, w0\n"
-
-        // Load filters and add offsets.
-        "ld1 {v0.8b}, [%[filter_ptr]], x5\n"
-        "ld1 {v1.8b}, [%[filter_ptr]], x5\n"
-        "sshll v0.8h, v0.8b, #0\n"
-        "ld1 {v2.8b}, [%[filter_ptr]], x5\n"
-        "sshll v1.8h, v1.8b, #0\n"
-        "ld1 {v3.8b}, [%[filter_ptr]], x5\n"
-        "sshll v2.8h, v2.8b, #0\n"
-        "ld1 {v4.8b}, [%[filter_ptr]], x5\n"
-        "sshll v3.8h, v3.8b, #0\n"
-        "ld1 {v5.8b}, [%[filter_ptr]], x5\n"
-        "sshll v4.8h, v4.8b, #0\n"
-        "ld1 {v6.8b}, [%[filter_ptr]], x5\n"
-        "sshll v5.8h, v5.8b, #0\n"
-        "ld1 {v7.8b}, [%[filter_ptr]], x5\n"
-        "sshll v6.8h, v6.8b, #0\n"
-        "ld1 {v8.8b}, [%[filter_ptr]]\n"
-        "sshll v7.8h, v7.8b, #0\n"
-        "sshll v8.8h, v8.8b, #0\n"
-
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_2_LOOP ":\n"
-          // Load the first two rows of the 5x5 input window, then reuse the
-          // same registers to load subsequent rows as they become available.
-          "mov x11, %[input_ptr]\n"
-          "mov x12, x11\n"
-          "add x13, x12, %[input_row_size]\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "mov w14, %w[output_window_width]\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          // The height 2 / width 2 loop loads an extra 1 output horizontally in
-          // anticipation for the next iteration. Make sure
-          // |output_window_width| is large enough to handle the additional
-          // load, otherwise jump to the appropriate label to handle smaller
-          // widths.
-          "cmp w14, #2\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "add x15, x13, %[input_row_size]\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "mov x6, %[output_ptr]\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "add x7, %[output_ptr], x19\n"
-          "ld1 {v16.8b}, [x13], %[input_depth]\n"
-          "movi v21.4s, #0\n"
-          "movi v22.4s, #0\n"
-          "movi v23.4s, #0\n"
-          "saddw v9.8h, v28.8h, v9.8b\n"
-          "movi v24.4s, #0\n"
-          "saddw v10.8h, v28.8h, v10.8b\n"
-          "movi v19.4s, #0\n"
-          "saddw v11.8h, v28.8h, v11.8b\n"
-          "movi v20.4s, #0\n"
-          "saddw v14.8h, v28.8h, v14.8b\n"
-          "movi v25.4s, #0\n"
-          "saddw v15.8h, v28.8h, v15.8b\n"
-          "movi v26.4s, #0\n"
-          "saddw v16.8h, v28.8h, v16.8b\n"
-
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER "f\n"
-          "cmp w14, #1\n"
-          "beq " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          //"loop_%=:\n"
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP ":\n"
-            "smlal v21.4s, v0.4h, v9.4h\n"
-            "ld1 {v12.8b}, [x12], %[input_depth]\n"
-            "smlal2 v22.4s, v0.8h, v9.8h\n"
-            "ld1 {v13.8b}, [x12]\n"
-            "add x12, x15, %[input_row_size]\n"
-            "smlal v23.4s, v0.4h, v11.4h\n"
-            "ld1 {v17.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v0.8h, v11.8h\n"
-            "ld1 {v18.8b}, [x13]\n"
-            "add x13, x12, %[input_row_size]\n"
-            "smlal v21.4s, v1.4h, v10.4h\n"
-            "ld1 {v9.8b}, [x15], %[input_depth]\n"
-            "smlal2 v22.4s, v1.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x15], %[input_depth]\n"
-            "smlal v21.4s, v2.4h, v11.4h\n"
-            "smlal2 v22.4s, v2.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x15], %[input_depth]\n"
-            "smlal v21.4s, v3.4h, v14.4h\n"
-            "smlal2 v22.4s, v3.8h, v14.8h\n"
-            "ld1 {v14.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v3.4h, v16.4h\n"
-            "subs w14, w14, #2\n"
-            "smlal2 v24.4s, v3.8h, v16.8h\n"
-            "cmp w14, #3\n"
-            "smlal v21.4s, v4.4h, v15.4h\n"
-            "saddw v12.8h, v28.8h, v12.8b\n"
-            "smlal2 v22.4s, v4.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x12], %[input_depth]\n"
-            "smlal v21.4s, v5.4h, v16.4h\n"
-            "saddw v13.8h, v28.8h, v13.8b\n"
-            "smlal2 v22.4s, v5.8h, v16.8h\n"
-            "ld1 {v16.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v1.4h, v12.4h\n"
-            "saddw v17.8h, v28.8h, v17.8b\n"
-            "smlal2 v24.4s, v1.8h, v12.8h\n"
-            "ld1 {v12.8b}, [x15], %[input_depth]\n"
-            "smlal v23.4s, v2.4h, v13.4h\n"
-            "saddw v18.8h, v28.8h, v18.8b\n"
-            "smlal2 v24.4s, v2.8h, v13.8h\n"
-            "ld1 {v13.8b}, [x15]\n"
-            "smlal v23.4s, v4.4h, v17.4h\n"
-            "saddw v9.8h, v28.8h, v9.8b\n"
-            "smlal2 v24.4s, v4.8h, v17.8h\n"
-            "ld1 {v17.8b}, [x12], %[input_depth]\n"
-            "smlal v23.4s, v5.4h, v18.4h\n"
-            "saddw v10.8h, v28.8h, v10.8b\n"
-            "smlal2 v24.4s, v5.8h, v18.8h\n"
-            "ld1 {v18.8b}, [x12]\n"
-
-            "smlal v21.4s, v6.4h, v9.4h\n"
-            "smlal2 v22.4s, v6.8h, v9.8h\n"
-            "smlal v19.4s, v0.4h, v9.4h\n"
-            "saddw v11.8h, v28.8h, v11.8b\n"
-            "smlal2 v20.4s, v0.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v6.4h, v11.4h\n"
-            "smlal2 v24.4s, v6.8h, v11.8h\n"
-            "smlal v21.4s, v7.4h, v10.4h\n"
-            "smlal2 v22.4s, v7.8h, v10.8h\n"
-            "saddw v12.8h, v28.8h, v12.8b\n"
-            "smlal v19.4s, v1.4h, v10.4h\n"
-            "smlal2 v20.4s, v1.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v7.4h, v12.4h\n"
-            "smlal2 v24.4s, v7.8h, v12.8h\n"
-            "smlal v25.4s, v1.4h, v12.4h\n"
-            "smlal2 v26.4s, v1.8h, v12.8h\n"
-            "smlal v21.4s, v8.4h, v11.4h\n"
-            "smlal2 v22.4s, v8.8h, v11.8h\n"
-            "add x11, x11, %[input_width_increment]\n"
-            "smlal v19.4s, v2.4h, v11.4h\n"
-            "mov x12, x11\n"
-            "smlal2 v20.4s, v2.8h, v11.8h\n"
-            "saddw v13.8h, v28.8h, v13.8b\n"
-            "smlal v25.4s, v0.4h, v11.4h\n"
-            "smlal2 v26.4s, v0.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x13], %[input_depth]\n"
-            "smlal v23.4s, v8.4h, v13.4h\n"
-            "ld1 {v12.8b}, [x13], %[input_depth]\n"
-            "smlal2 v24.4s, v8.8h, v13.8h\n"
-            "smlal v25.4s, v2.4h, v13.4h\n"
-            "smlal2 v26.4s, v2.8h, v13.8h\n"
-            "ld1 {v13.8b}, [x13]\n"
-            "add x13, x12, %[input_row_size]\n"
-            "add x15, x13, %[input_row_size]\n"
-            // Cast to float.
-            "ld1 {v27.4s, v28.4s}, [%[bias_ptr]]\n"
-            "scvtf v21.4s, v21.4s\n"
-            "scvtf v22.4s, v22.4s\n"
-            "scvtf v23.4s, v23.4s\n"
-            "scvtf v24.4s, v24.4s\n"
-            // Multiply by per channel scale.
-            "fmul v21.4s, v21.4s, v30.4s\n"
-            "fmul v22.4s, v22.4s, v31.4s\n"
-            "fmul v23.4s, v23.4s, v30.4s\n"
-            "fmul v24.4s, v24.4s, v31.4s\n"
-            // Add bias.
-            "fadd v21.4s, v21.4s, v27.4s\n"
-            "fadd v22.4s, v22.4s, v28.4s\n"
-            "fadd v23.4s, v23.4s, v27.4s\n"
-            "fadd v24.4s, v24.4s, v28.4s\n"
-            "dup v28.8h, w0\n"
-            "dup v27.4s, w3\n"
-            "fmax v21.4s, v21.4s, v27.4s\n"
-            "fmin v21.4s, v21.4s, v29.4s\n"
-            "fmax v22.4s, v22.4s, v27.4s\n"
-            "fmin v22.4s, v22.4s, v29.4s\n"
-            "fmax v23.4s, v23.4s, v27.4s\n"
-            "fmin v23.4s, v23.4s, v29.4s\n"
-            "fmax v24.4s, v24.4s, v27.4s\n"
-            "fmin v24.4s, v24.4s, v29.4s\n"
-            // Store.
-            "st1 {v21.4s, v22.4s}, [x6], x4\n"
-            "st1 {v23.4s, v24.4s}, [x6], x4\n"
-            // Reset to int.
-            "fcvtms v21.4s, v21.4s\n"
-            "fcvtms v22.4s, v22.4s\n"
-            "fcvtms v23.4s, v23.4s\n"
-            "fcvtms v24.4s, v24.4s\n"
-
-            "movi v22.4s, #0\n"
-            "movi v24.4s, #0\n"
-            "saddw v9.8h, v28.8h, v9.8b\n"
-            "saddw v10.8h, v28.8h, v10.8b\n"
-            "saddw v11.8h, v28.8h, v11.8b\n"
-
-            "smlal v19.4s, v6.4h, v9.4h\n"
-            "smlal2 v20.4s, v6.8h, v9.8h\n"
-            "ld1 {v9.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v6.4h, v11.4h\n"
-            "smlal2 v26.4s, v6.8h, v11.8h\n"
-            "smlal v19.4s, v7.4h, v10.4h\n"
-            "saddw v12.8h, v28.8h, v12.8b\n"
-            "smlal2 v20.4s, v7.8h, v10.8h\n"
-            "ld1 {v10.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v7.4h, v12.4h\n"
-            "smlal2 v26.4s, v7.8h, v12.8h\n"
-            "smlal v19.4s, v8.4h, v11.4h\n"
-            "saddw v13.8h, v28.8h, v13.8b\n"
-            "smlal2 v20.4s, v8.8h, v11.8h\n"
-            "ld1 {v11.8b}, [x12], %[input_depth]\n"
-            "smlal v25.4s, v8.4h, v13.4h\n"
-            "saddw v14.8h, v28.8h, v14.8b\n"
-            "smlal2 v26.4s, v8.8h, v13.8h\n"
-            "saddw v16.8h, v28.8h, v16.8b\n"
-            "smlal v19.4s, v3.4h, v14.4h\n"
-            "saddw v15.8h, v28.8h, v15.8b\n"
-            "smlal2 v20.4s, v3.8h, v14.8h\n"
-            "ld1 {v14.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v3.4h, v16.4h\n"
-            "movi v21.4s, #0\n"
-            "smlal2 v26.4s, v3.8h, v16.8h\n"
-            "movi v23.4s, #0\n"
-            "smlal v19.4s, v4.4h, v15.4h\n"
-            "saddw v17.8h, v28.8h, v17.8b\n"
-            "smlal2 v20.4s, v4.8h, v15.8h\n"
-            "ld1 {v15.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v4.4h, v17.4h\n"
-            "smlal2 v26.4s, v4.8h, v17.8h\n"
-            "smlal v19.4s, v5.4h, v16.4h\n"
-            "saddw v18.8h, v28.8h, v18.8b\n"
-            "smlal2 v20.4s, v5.8h, v16.8h\n"
-            "ld1 {v16.8b}, [x13], %[input_depth]\n"
-            "smlal v25.4s, v5.4h, v18.4h\n"
-            "smlal2 v26.4s, v5.8h, v18.8h\n"
-
-            // Cast to float.
-            "ld1 {v27.4s, v28.4s}, [%[bias_ptr]]\n"
-            "scvtf v19.4s, v19.4s\n"
-            "scvtf v20.4s, v20.4s\n"
-            "scvtf v25.4s, v25.4s\n"
-            "scvtf v26.4s, v26.4s\n"
-            // Multiply by per channel scale.
-            "fmul v19.4s, v19.4s, v30.4s\n"
-            "fmul v20.4s, v20.4s, v31.4s\n"
-            "fmul v25.4s, v25.4s, v30.4s\n"
-            "fmul v26.4s, v26.4s, v31.4s\n"
-            // Add bias.
-            "fadd v19.4s, v19.4s, v27.4s\n"
-            "fadd v20.4s, v20.4s, v28.4s\n"
-            "fadd v25.4s, v25.4s, v27.4s\n"
-            "fadd v26.4s, v26.4s, v28.4s\n"
-            "dup v27.4s, w3\n"
-            "fmax v19.4s, v19.4s, v27.4s\n"
-            "fmin v19.4s, v19.4s, v29.4s\n"
-            "fmax v20.4s, v20.4s, v27.4s\n"
-            "fmin v20.4s, v20.4s, v29.4s\n"
-            "fmax v25.4s, v25.4s, v27.4s\n"
-            "fmin v25.4s, v25.4s, v29.4s\n"
-            "fmax v26.4s, v26.4s, v27.4s\n"
-            "fmin v26.4s, v26.4s, v29.4s\n"
-            "dup v28.8h, w0\n"
-            // Store.
-            "st1 {v19.4s, v20.4s}, [x7], x4\n"
-            "st1 {v25.4s, v26.4s}, [x7], x4\n"
-            "fcvtms v19.4s, v19.4s\n"
-            "fcvtms v20.4s, v20.4s\n"
-            "fcvtms v25.4s, v25.4s\n"
-            "fcvtms v26.4s, v26.4s\n"
-
-            "movi v20.4s, #0\n"
-            "movi v26.4s, #0\n"
-            "saddw v9.8h, v28.8h, v9.8b\n"
-            "saddw v10.8h, v28.8h, v10.8b\n"
-            "saddw v11.8h, v28.8h, v11.8b\n"
-            "movi v19.4s, #0\n"
-            "saddw v14.8h, v28.8h, v14.8b\n"
-            "movi v25.4s, #0\n"
-            "saddw v15.8h, v28.8h, v15.8b\n"
-            "saddw v16.8h, v28.8h, v16.8b\n"
-
-            "bge " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP "b\n"
-
-          // At this point, there will be one of 2 width or 1 width leftover,
-          // not both.
-          "cmp w14, #2\n"
-          "blt " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER "f\n"
-
-          // Handle last 2 columns if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER ":\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v12.8b}, [x12], %[input_depth]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v13.8b}, [x12]\n"
-          "add x12, x15, %[input_row_size]\n"
-          "smlal v23.4s, v0.4h, v11.4h\n"
-          "ld1 {v17.8b}, [x13], %[input_depth]\n"
-          "smlal2 v24.4s, v0.8h, v11.8h\n"
-          "ld1 {v18.8b}, [x13]\n"
-          "add x13, x12, %[input_row_size]\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "ld1 {v9.8b}, [x15], %[input_depth]\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v3.4h, v14.4h\n"
-          "smlal2 v22.4s, v3.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v3.4h, v16.4h\n"
-          "smlal2 v24.4s, v3.8h, v16.8h\n"
-          "smlal v21.4s, v4.4h, v15.4h\n"
-          "saddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v22.4s, v4.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v5.4h, v16.4h\n"
-          "saddw v13.8h, v28.8h, v13.8b\n"
-          "smlal2 v22.4s, v5.8h, v16.8h\n"
-          "ld1 {v16.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v1.4h, v12.4h\n"
-          "saddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v24.4s, v1.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x15], %[input_depth]\n"
-          "smlal v23.4s, v2.4h, v13.4h\n"
-          "saddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v24.4s, v2.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x15]\n"
-          "smlal v23.4s, v4.4h, v17.4h\n"
-          "saddw v9.8h, v28.8h, v9.8b\n"
-          "smlal2 v24.4s, v4.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x12], %[input_depth]\n"
-          "smlal v23.4s, v5.4h, v18.4h\n"
-          "saddw v10.8h, v28.8h, v10.8b\n"
-          "smlal2 v24.4s, v5.8h, v18.8h\n"
-          "ld1 {v18.8b}, [x12]\n"
-
-          "smlal v21.4s, v6.4h, v9.4h\n"
-          "smlal2 v22.4s, v6.8h, v9.8h\n"
-          "smlal v19.4s, v0.4h, v9.4h\n"
-          "saddw v11.8h, v28.8h, v11.8b\n"
-          "smlal2 v20.4s, v0.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v6.4h, v11.4h\n"
-          "smlal2 v24.4s, v6.8h, v11.8h\n"
-          "smlal v21.4s, v7.4h, v10.4h\n"
-          "smlal2 v22.4s, v7.8h, v10.8h\n"
-          "saddw v12.8h, v28.8h, v12.8b\n"
-          "smlal v19.4s, v1.4h, v10.4h\n"
-          "smlal2 v20.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v7.4h, v12.4h\n"
-          "smlal2 v24.4s, v7.8h, v12.8h\n"
-          "smlal v25.4s, v1.4h, v12.4h\n"
-          "smlal2 v26.4s, v1.8h, v12.8h\n"
-          "smlal v21.4s, v8.4h, v11.4h\n"
-          "smlal2 v22.4s, v8.8h, v11.8h\n"
-          "smlal v19.4s, v2.4h, v11.4h\n"
-          "smlal2 v20.4s, v2.8h, v11.8h\n"
-          "saddw v13.8h, v28.8h, v13.8b\n"
-          "smlal v25.4s, v0.4h, v11.4h\n"
-          "smlal2 v26.4s, v0.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13], %[input_depth]\n"
-          "smlal v23.4s, v8.4h, v13.4h\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "smlal2 v24.4s, v8.8h, v13.8h\n"
-          "smlal v25.4s, v2.4h, v13.4h\n"
-          "smlal2 v26.4s, v2.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13]\n"
-
-          "ld1 {v27.4s, v28.4s}, [%[bias_ptr]]\n"
-          "scvtf v21.4s, v21.4s\n"
-          "scvtf v22.4s, v22.4s\n"
-          "scvtf v23.4s, v23.4s\n"
-          "scvtf v24.4s, v24.4s\n"
-          // Multiply by per channel scale.
-          "fmul v21.4s, v21.4s, v30.4s\n"
-          "fmul v22.4s, v22.4s, v31.4s\n"
-          "fmul v23.4s, v23.4s, v30.4s\n"
-          "fmul v24.4s, v24.4s, v31.4s\n"
-          // Add bias.
-          "fadd v21.4s, v21.4s, v27.4s\n"
-          "fadd v22.4s, v22.4s, v28.4s\n"
-          "fadd v23.4s, v23.4s, v27.4s\n"
-          "fadd v24.4s, v24.4s, v28.4s\n"
-          "dup v28.8h, w0\n"
-          "dup v27.4s, w3\n"
-          "fmax v21.4s, v21.4s, v27.4s\n"
-          "fmin v21.4s, v21.4s, v29.4s\n"
-          "fmax v22.4s, v22.4s, v27.4s\n"
-          "fmin v22.4s, v22.4s, v29.4s\n"
-          "fmax v23.4s, v23.4s, v27.4s\n"
-          "fmin v23.4s, v23.4s, v29.4s\n"
-          "fmax v24.4s, v24.4s, v27.4s\n"
-          "fmin v24.4s, v24.4s, v29.4s\n"
-          // Store.
-          "st1 {v21.4s, v22.4s}, [x6], x4\n"
-          "st1 {v23.4s, v24.4s}, [x6]\n"
-          // Reset to int.
-          "fcvtms v21.4s, v21.4s\n"
-          "fcvtms v22.4s, v22.4s\n"
-          "fcvtms v23.4s, v23.4s\n"
-          "fcvtms v24.4s, v24.4s\n"
-
-          "movi v22.4s, #0\n"
-          "movi v24.4s, #0\n"
-          "saddw v9.8h, v28.8h, v9.8b\n"
-          "saddw v10.8h, v28.8h, v10.8b\n"
-          "saddw v11.8h, v28.8h, v11.8b\n"
-
-          "smlal v19.4s, v6.4h, v9.4h\n"
-          "smlal2 v20.4s, v6.8h, v9.8h\n"
-          "smlal v25.4s, v6.4h, v11.4h\n"
-          "smlal2 v26.4s, v6.8h, v11.8h\n"
-          "smlal v19.4s, v7.4h, v10.4h\n"
-          "saddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v20.4s, v7.8h, v10.8h\n"
-          "smlal v25.4s, v7.4h, v12.4h\n"
-          "smlal2 v26.4s, v7.8h, v12.8h\n"
-          "smlal v19.4s, v8.4h, v11.4h\n"
-          "saddw v13.8h, v28.8h, v13.8b\n"
-          "smlal2 v20.4s, v8.8h, v11.8h\n"
-          "smlal v25.4s, v8.4h, v13.4h\n"
-          "saddw v14.8h, v28.8h, v14.8b\n"
-          "smlal2 v26.4s, v8.8h, v13.8h\n"
-          "saddw v16.8h, v28.8h, v16.8b\n"
-          "smlal v19.4s, v3.4h, v14.4h\n"
-          "saddw v15.8h, v28.8h, v15.8b\n"
-          "smlal2 v20.4s, v3.8h, v14.8h\n"
-          "smlal v25.4s, v3.4h, v16.4h\n"
-          "smlal2 v26.4s, v3.8h, v16.8h\n"
-          "smlal v19.4s, v4.4h, v15.4h\n"
-          "saddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v20.4s, v4.8h, v15.8h\n"
-          "smlal v25.4s, v4.4h, v17.4h\n"
-          "smlal2 v26.4s, v4.8h, v17.8h\n"
-          "smlal v19.4s, v5.4h, v16.4h\n"
-          "saddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v20.4s, v5.8h, v16.8h\n"
-          "smlal v25.4s, v5.4h, v18.4h\n"
-          "smlal2 v26.4s, v5.8h, v18.8h\n"
-
-          // Cast to float.
-          "ld1 {v27.4s, v28.4s}, [%[bias_ptr]]\n"
-          "scvtf v19.4s, v19.4s\n"
-          "scvtf v20.4s, v20.4s\n"
-          "scvtf v25.4s, v25.4s\n"
-          "scvtf v26.4s, v26.4s\n"
-          // Multiply by per channel scale.
-          "fmul v19.4s, v19.4s, v30.4s\n"
-          "fmul v20.4s, v20.4s, v31.4s\n"
-          "fmul v25.4s, v25.4s, v30.4s\n"
-          "fmul v26.4s, v26.4s, v31.4s\n"
-          // Add bias.
-          "fadd v19.4s, v19.4s, v27.4s\n"
-          "fadd v20.4s, v20.4s, v28.4s\n"
-          "fadd v25.4s, v25.4s, v27.4s\n"
-          "fadd v26.4s, v26.4s, v28.4s\n"
-          "dup v28.8h, w0\n"
-          "dup v27.4s, w3\n"
-          "fmax v19.4s, v19.4s, v27.4s\n"
-          "fmin v19.4s, v19.4s, v29.4s\n"
-          "fmax v20.4s, v20.4s, v27.4s\n"
-          "fmin v20.4s, v20.4s, v29.4s\n"
-          "fmax v25.4s, v25.4s, v27.4s\n"
-          "fmin v25.4s, v25.4s, v29.4s\n"
-          "fmax v26.4s, v26.4s, v27.4s\n"
-          "fmin v26.4s, v26.4s, v29.4s\n"
-          "dup v28.8h, w0\n"
-          // Store.
-          "st1 {v19.4s, v20.4s}, [x7], x4\n"
-          "st1 {v25.4s, v26.4s}, [x7]\n"
-          "fcvtms v19.4s, v19.4s\n"
-          "fcvtms v20.4s, v20.4s\n"
-          "fcvtms v25.4s, v25.4s\n"
-          "fcvtms v26.4s, v26.4s\n"
-          "b " DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP "f\n"
-
-          // Handle last column if exists.
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER ":\n"
-          // Registers v9, v10, v11, v14, v15, and v16 have already been loaded
-          // with the correct values at this point. This corresponds to the
-          // first two input rows of the top left output. Now load the last
-          // input row for this output. Once these inputs are no longer needed,
-          // load the input rows for the bottom left output.
-          "add x12, x15, %[input_row_size]\n"
-          "add x13, x12, %[input_row_size]\n"
-
-          "ld1 {v12.8b}, [x15], %[input_depth]\n"
-          "smlal v21.4s, v0.4h, v9.4h\n"
-          "ld1 {v13.8b}, [x15], %[input_depth]\n"
-          "smlal2 v22.4s, v0.8h, v9.8h\n"
-          "ld1 {v17.8b}, [x15]\n"
-          "smlal v21.4s, v1.4h, v10.4h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal2 v22.4s, v1.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "smlal v21.4s, v2.4h, v11.4h\n"
-          "smlal2 v22.4s, v2.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x12]\n"
-          "smlal v21.4s, v3.4h, v14.4h\n"
-          "smlal2 v22.4s, v3.8h, v14.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v21.4s, v4.4h, v15.4h\n"
-          "smlal2 v22.4s, v4.8h, v15.8h\n"
-          "ld1 {v15.8b}, [x13], %[input_depth]\n"
-          "smlal v21.4s, v5.4h, v16.4h\n"
-          "saddw v12.8h, v28.8h, v12.8b\n"
-          "smlal2 v22.4s, v5.8h, v16.8h\n"
-          "saddw v13.8h, v28.8h, v13.8b\n"
-          "ld1 {v16.8b}, [x13]\n"
-
-          "smlal v21.4s, v6.4h, v12.4h\n"
-          "smlal2 v22.4s, v6.8h, v12.8h\n"
-          "smlal v23.4s, v0.4h, v12.4h\n"
-          "saddw v17.8h, v28.8h, v17.8b\n"
-          "smlal2 v24.4s, v0.8h, v12.8h\n"
-          "smlal v21.4s, v7.4h, v13.4h\n"
-          "smlal2 v22.4s, v7.8h, v13.8h\n"
-          "smlal v23.4s, v1.4h, v13.4h\n"
-          "smlal2 v24.4s, v1.8h, v13.8h\n"
-          "smlal v21.4s, v8.4h, v17.4h\n"
-          "smlal2 v22.4s, v8.8h, v17.8h\n"
-          "smlal v23.4s, v2.4h, v17.4h\n"
-          "smlal2 v24.4s, v2.8h, v17.8h\n"
-
-          "ld1 {v26.4s, v27.4s}, [%[bias_ptr]]\n"
-          "scvtf v21.4s, v21.4s\n"
-          "scvtf v22.4s, v22.4s\n"
-          "fmul v21.4s, v21.4s, v30.4s\n"
-          "fmul v22.4s, v22.4s, v31.4s\n"
-          "fadd v21.4s, v21.4s, v26.4s\n"
-          "fadd v22.4s, v22.4s, v27.4s\n"
-          "dup v26.4s, w3\n"
-          "fmax v21.4s, v21.4s, v26.4s\n"
-          "fmin v21.4s, v21.4s, v29.4s\n"
-          "fmax v22.4s, v22.4s, v26.4s\n"
-          "fmin v22.4s, v22.4s, v29.4s\n"
-          "st1 {v21.4s, v22.4s}, [x6]\n"
-          "fcvtms v21.4s, v21.4s\n"
-          "fcvtms v22.4s, v22.4s\n"
-
-          "saddw v9.8h, v28.8h, v9.8b\n"
-          "saddw v10.8h, v28.8h, v10.8b\n"
-          "smlal v23.4s, v3.4h, v9.4h\n"
-          "saddw v11.8h, v28.8h, v11.8b\n"
-          "smlal2 v24.4s, v3.8h, v9.8h\n"
-          "saddw v14.8h, v28.8h, v14.8b\n"
-          "smlal v23.4s, v4.4h, v10.4h\n"
-          "saddw v15.8h, v28.8h, v15.8b\n"
-          "smlal2 v24.4s, v4.8h, v10.8h\n"
-          "saddw v16.8h, v28.8h, v16.8b\n"
-          "smlal v23.4s, v5.4h, v11.4h\n"
-          "smlal2 v24.4s, v5.8h, v11.8h\n"
-          "smlal v23.4s, v6.4h, v14.4h\n"
-          "smlal2 v24.4s, v6.8h, v14.8h\n"
-          "smlal v23.4s, v7.4h, v15.4h\n"
-          "smlal2 v24.4s, v7.8h, v15.8h\n"
-          "smlal v23.4s, v8.4h, v16.4h\n"
-          "smlal2 v24.4s, v8.8h, v16.8h\n"
-
-          "ld1 {v26.4s, v27.4s}, [%[bias_ptr]]\n"
-          "scvtf v23.4s, v23.4s\n"
-          "scvtf v24.4s, v24.4s\n"
-          "fmul v23.4s, v23.4s, v30.4s\n"
-          "fmul v24.4s, v24.4s, v31.4s\n"
-          "fadd v23.4s, v23.4s, v26.4s\n"
-          "fadd v24.4s, v24.4s, v27.4s\n"
-          "dup v26.4s, w3\n"
-          "fmax v23.4s, v23.4s, v26.4s\n"
-          "fmin v23.4s, v23.4s, v29.4s\n"
-          "fmax v24.4s, v24.4s, v26.4s\n"
-          "fmin v24.4s, v24.4s, v29.4s\n"
-          "st1 {v23.4s, v24.4s}, [x7]\n"
-          "fcvtms v23.4s, v23.4s\n"
-          "fcvtms v24.4s, v24.4s\n"
-
-          DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP ":\n"
-          "subs %w[output_window_height], %w[output_window_height], #2\n"
-          "add %[input_ptr], %[input_ptr], %[input_height_increment]\n"
-          "cmp %w[output_window_height], #2\n"
-          "add %[output_ptr], %[output_ptr], %[output_height_increment]\n"
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_2_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP ":\n"
-        "cmp %w[output_window_height], #1\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        DEPTHWISECONV_LABEL_HEIGHT_1 ":\n"
-        "mov x11, %[input_ptr]\n"
-        "mov x12, x11\n"
-        "add x13, x12, %[input_row_size]\n"
-        "ld1 {v9.8b}, [x12], %[input_depth]\n"
-        "add x15, x13, %[input_row_size]\n"
-        "ld1 {v10.8b}, [x12], %[input_depth]\n"
-        "mov x6, %[output_ptr]\n"
-        "ld1 {v11.8b}, [x12], %[input_depth]\n"
-        "mov w14, %w[output_window_width]\n"
-        // The height 1 / width 2 loop loads an extra 1x1 output in anticipation
-        // for the next iteration. Make sure |output_window_width| is large
-        // enough to handle the additional load, otherwise jump to the
-        // appropriate label to handle smaller widths.
-        "cmp w14, #2\n"
-        "ld1 {v12.8b}, [x13], %[input_depth]\n"
-        "ld1 {v13.8b}, [x13], %[input_depth]\n"
-        "ld1 {v14.8b}, [x13], %[input_depth]\n"
-        "ld1 {v15.8b}, [x15], %[input_depth]\n"
-        "ld1 {v16.8b}, [x15], %[input_depth]\n"
-        "ld1 {v17.8b}, [x15], %[input_depth]\n"
-
-        "saddw v9.8h, v28.8h, v9.8b\n"
-        "movi v24.4s, #0\n"
-        "saddw v10.8h, v28.8h, v10.8b\n"
-        "movi v25.4s, #0\n"
-        "saddw v11.8h, v28.8h, v11.8b\n"
-        "movi v26.4s, #0\n"
-        "movi v27.4s, #0\n"
-        "saddw v12.8h, v28.8h, v12.8b\n"
-        "saddw v13.8h, v28.8h, v13.8b\n"
-        "saddw v14.8h, v28.8h, v14.8b\n"
-        "saddw v15.8h, v28.8h, v15.8b\n"
-        "saddw v16.8h, v28.8h, v16.8b\n"
-        "saddw v17.8h, v28.8h, v17.8b\n"
-
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER "f\n"
-        "cmp w14, #1\n"
-        "beq " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP ":\n"
-          "smlal v24.4s, v0.4h, v9.4h\n"
-          "ld1 {v18.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v0.8h, v9.8h\n"
-          "ld1 {v19.8b}, [x12]\n"
-          "smlal v26.4s, v0.4h, v11.4h\n"
-          "ld1 {v20.8b}, [x13], %[input_depth]\n"
-          "smlal2 v27.4s, v0.8h, v11.8h\n"
-          "ld1 {v21.8b}, [x13]\n"
-          "smlal v24.4s, v1.4h, v10.4h\n"
-          "ld1 {v22.8b}, [x15], %[input_depth]\n"
-          "smlal2 v25.4s, v1.8h, v10.8h\n"
-          "ld1 {v23.8b}, [x15]\n"
-          "smlal v24.4s, v2.4h, v11.4h\n"
-          "subs w14, w14, #2\n"
-          "smlal2 v25.4s, v2.8h, v11.8h\n"
-          "cmp w14, #3\n"
-          "smlal v24.4s, v3.4h, v12.4h\n"
-          "add x11, x11, %[input_width_increment]\n"
-          "smlal2 v25.4s, v3.8h, v12.8h\n"
-          "mov x12, x11\n"
-          "smlal v26.4s, v3.4h, v14.4h\n"
-          "add x13, x12, %[input_row_size]\n"
-          "smlal2 v27.4s, v3.8h, v14.8h\n"
-          "add x15, x13, %[input_row_size]\n"
-          "smlal v24.4s, v4.4h, v13.4h\n"
-          "ld1 {v9.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v4.8h, v13.8h\n"
-          "ld1 {v10.8b}, [x12], %[input_depth]\n"
-          "smlal v24.4s, v5.4h, v14.4h\n"
-          "ld1 {v11.8b}, [x12], %[input_depth]\n"
-          "smlal2 v25.4s, v5.8h, v14.8h\n"
-          "ld1 {v12.8b}, [x13], %[input_depth]\n"
-          "smlal v24.4s, v6.4h, v15.4h\n"
-          "ld1 {v13.8b}, [x13], %[input_depth]\n"
-          "smlal2 v25.4s, v6.8h, v15.8h\n"
-          "ld1 {v14.8b}, [x13], %[input_depth]\n"
-          "smlal v26.4s, v6.4h, v17.4h\n"
-          "ld1 {v15.8b}, [x15], %[input_depth]\n"
-          "smlal2 v27.4s, v6.8h, v17.8h\n"
-          "smlal v24.4s, v7.4h, v16.4h\n"
-          "smlal2 v25.4s, v7.8h, v16.8h\n"
-          "ld1 {v16.8b}, [x15], %[input_depth]\n"
-          "smlal v24.4s, v8.4h, v17.4h\n"
-          "saddw v18.8h, v28.8h, v18.8b\n"
-          "smlal2 v25.4s, v8.8h, v17.8h\n"
-          "ld1 {v17.8b}, [x15], %[input_depth]\n"
-          "saddw v19.8h, v28.8h, v19.8b\n"
-
-          "smlal v26.4s, v1.4h, v18.4h\n"
-          "saddw v20.8h, v28.8h, v20.8b\n"
-          "smlal2 v27.4s, v1.8h, v18.8h\n"
-          "smlal v26.4s, v2.4h, v19.4h\n"
-          "saddw v21.8h, v28.8h, v21.8b\n"
-          "smlal2 v27.4s, v2.8h, v19.8h\n"
-          "smlal v26.4s, v4.4h, v20.4h\n"
-          "smlal v26.4s, v5.4h, v21.4h\n"
-          "smlal2 v27.4s, v4.8h, v20.8h\n"
-          "saddw v22.8h, v28.8h, v22.8b\n"
-          "smlal2 v27.4s, v5.8h, v21.8h\n"
-          "saddw v23.8h, v28.8h, v23.8b\n"
-          "smlal v26.4s, v7.4h, v22.4h\n"
-          "smlal2 v27.4s, v7.8h, v22.8h\n"
-          "smlal v26.4s, v8.4h, v23.4h\n"
-          "smlal2 v27.4s, v8.8h, v23.8h\n"
-
-          "ld1 {v28.4s, v29.4s}, [%[bias_ptr]]\n"
-          "scvtf v24.4s, v24.4s\n"
-          "scvtf v25.4s, v25.4s\n"
-          "scvtf v26.4s, v26.4s\n"
-          "scvtf v27.4s, v27.4s\n"
-          "fmul v24.4s, v24.4s, v30.4s\n"
-          "fmul v25.4s, v25.4s, v31.4s\n"
-          "fmul v26.4s, v26.4s, v30.4s\n"
-          "fmul v27.4s, v27.4s, v31.4s\n"
-          "fadd v24.4s, v24.4s, v28.4s\n"
-          "fadd v25.4s, v25.4s, v29.4s\n"
-          "fadd v26.4s, v26.4s, v28.4s\n"
-          "fadd v27.4s, v27.4s, v29.4s\n"
-          "dup v28.4s, w3\n"
-          "dup v29.4s, w2\n"
-          "fmax v24.4s, v24.4s, v28.4s\n"
-          "fmin v24.4s, v24.4s, v29.4s\n"
-          "fmax v25.4s, v25.4s, v28.4s\n"
-          "fmin v25.4s, v25.4s, v29.4s\n"
-          "fmax v26.4s, v26.4s, v28.4s\n"
-          "fmin v26.4s, v26.4s, v29.4s\n"
-          "fmax v27.4s, v27.4s, v28.4s\n"
-          "fmin v27.4s, v27.4s, v29.4s\n"
-          "dup v28.8h, w0\n"
-          "st1 {v24.4s, v25.4s}, [x6], x4\n"
-          "st1 {v26.4s, v27.4s}, [x6], x4\n"
-          "fcvtms v24.4s, v24.4s\n"
-          "fcvtms v25.4s, v25.4s\n"
-          "fcvtms v26.4s, v26.4s\n"
-          "fcvtms v27.4s, v27.4s\n"
-
-          "movi v25.4s, #0\n"
-          "saddw v9.8h, v28.8h, v9.8b\n"
-          "movi v27.4s, #0\n"
-          "saddw v10.8h, v28.8h, v10.8b\n"
-          "saddw v11.8h, v28.8h, v11.8b\n"
-          "saddw v12.8h, v28.8h, v12.8b\n"
-          "saddw v13.8h, v28.8h, v13.8b\n"
-          "saddw v14.8h, v28.8h, v14.8b\n"
-          "movi v24.4s, #0\n"
-          "saddw v15.8h, v28.8h, v15.8b\n"
-          "movi v26.4s, #0\n"
-          "saddw v16.8h, v28.8h, v16.8b\n"
-          "saddw v17.8h, v28.8h, v17.8b\n"
-
-          "bge " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP "b\n"
-
-        // At this point, there will be one of 2 width or 1 width leftover,
-        // not both.
-        "cmp w14, #2\n"
-        "blt " DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER "f\n"
-
-        // Handle last two horizontal outputs if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER ":\n"
-        "smlal v24.4s, v0.4h, v9.4h\n"
-        "ld1 {v18.8b}, [x12], %[input_depth]\n"
-        "smlal2 v25.4s, v0.8h, v9.8h\n"
-        "ld1 {v19.8b}, [x12]\n"
-        "smlal v26.4s, v0.4h, v11.4h\n"
-        "ld1 {v20.8b}, [x13], %[input_depth]\n"
-        "smlal2 v27.4s, v0.8h, v11.8h\n"
-        "ld1 {v21.8b}, [x13]\n"
-        "smlal v24.4s, v1.4h, v10.4h\n"
-        "ld1 {v22.8b}, [x15], %[input_depth]\n"
-        "smlal2 v25.4s, v1.8h, v10.8h\n"
-        "ld1 {v23.8b}, [x15]\n"
-        "smlal v24.4s, v2.4h, v11.4h\n"
-        "smlal2 v25.4s, v2.8h, v11.8h\n"
-        "smlal v24.4s, v3.4h, v12.4h\n"
-        "smlal2 v25.4s, v3.8h, v12.8h\n"
-        "smlal v26.4s, v3.4h, v14.4h\n"
-        "smlal2 v27.4s, v3.8h, v14.8h\n"
-        "smlal v24.4s, v4.4h, v13.4h\n"
-        "smlal2 v25.4s, v4.8h, v13.8h\n"
-        "smlal v24.4s, v5.4h, v14.4h\n"
-        "smlal2 v25.4s, v5.8h, v14.8h\n"
-        "smlal v24.4s, v6.4h, v15.4h\n"
-        "smlal2 v25.4s, v6.8h, v15.8h\n"
-        "smlal v26.4s, v6.4h, v17.4h\n"
-        "smlal2 v27.4s, v6.8h, v17.8h\n"
-        "smlal v24.4s, v7.4h, v16.4h\n"
-        "smlal2 v25.4s, v7.8h, v16.8h\n"
-        "smlal v24.4s, v8.4h, v17.4h\n"
-        "saddw v18.8h, v28.8h, v18.8b\n"
-        "smlal2 v25.4s, v8.8h, v17.8h\n"
-        "saddw v19.8h, v28.8h, v19.8b\n"
-
-        "smlal v26.4s, v1.4h, v18.4h\n"
-        "saddw v20.8h, v28.8h, v20.8b\n"
-        "smlal2 v27.4s, v1.8h, v18.8h\n"
-        "smlal v26.4s, v2.4h, v19.4h\n"
-        "saddw v21.8h, v28.8h, v21.8b\n"
-        "smlal2 v27.4s, v2.8h, v19.8h\n"
-        "smlal v26.4s, v4.4h, v20.4h\n"
-        "smlal v26.4s, v5.4h, v21.4h\n"
-        "smlal2 v27.4s, v4.8h, v20.8h\n"
-        "saddw v22.8h, v28.8h, v22.8b\n"
-        "smlal2 v27.4s, v5.8h, v21.8h\n"
-        "saddw v23.8h, v28.8h, v23.8b\n"
-        "smlal v26.4s, v7.4h, v22.4h\n"
-        "smlal2 v27.4s, v7.8h, v22.8h\n"
-        "smlal v26.4s, v8.4h, v23.4h\n"
-        "smlal2 v27.4s, v8.8h, v23.8h\n"
-
-        "ld1 {v28.4s, v29.4s}, [%[bias_ptr]]\n"
-        "scvtf v24.4s, v24.4s\n"
-        "scvtf v25.4s, v25.4s\n"
-        "scvtf v26.4s, v26.4s\n"
-        "scvtf v27.4s, v27.4s\n"
-        "fmul v24.4s, v24.4s, v30.4s\n"
-        "fmul v25.4s, v25.4s, v31.4s\n"
-        "fmul v26.4s, v26.4s, v30.4s\n"
-        "fmul v27.4s, v27.4s, v31.4s\n"
-        "fadd v24.4s, v24.4s, v28.4s\n"
-        "fadd v25.4s, v25.4s, v29.4s\n"
-        "fadd v26.4s, v26.4s, v28.4s\n"
-        "fadd v27.4s, v27.4s, v29.4s\n"
-        "dup v28.4s, w3\n"
-        "dup v29.4s, w2\n"
-        "fmax v24.4s, v24.4s, v28.4s\n"
-        "fmin v24.4s, v24.4s, v29.4s\n"
-        "fmax v25.4s, v25.4s, v28.4s\n"
-        "fmin v25.4s, v25.4s, v29.4s\n"
-        "fmax v26.4s, v26.4s, v28.4s\n"
-        "fmin v26.4s, v26.4s, v29.4s\n"
-        "fmax v27.4s, v27.4s, v28.4s\n"
-        "fmin v27.4s, v27.4s, v29.4s\n"
-        "dup v28.8h, w0\n"
-        "st1 {v24.4s, v25.4s}, [x6], x4\n"
-        "st1 {v26.4s, v27.4s}, [x6]\n"
-        "fcvtms v24.4s, v24.4s\n"
-        "fcvtms v25.4s, v25.4s\n"
-        "fcvtms v26.4s, v26.4s\n"
-        "fcvtms v27.4s, v27.4s\n"
-        "b " DEPTHWISECONV_LABEL_HEIGHT_1_END "f\n"
-
-        // Handle bottom right output if exists.
-        DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER ":\n"
-        "dup v29.8h, w2\n"
-
-        "smlal v24.4s, v0.4h, v9.4h\n"
-        "smlal2 v25.4s, v0.8h, v9.8h\n"
-        "smlal v24.4s, v1.4h, v10.4h\n"
-        "smlal2 v25.4s, v1.8h, v10.8h\n"
-        "smlal v24.4s, v2.4h, v11.4h\n"
-        "smlal2 v25.4s, v2.8h, v11.8h\n"
-        "smlal v24.4s, v3.4h, v12.4h\n"
-        "smlal2 v25.4s, v3.8h, v12.8h\n"
-        "smlal v24.4s, v4.4h, v13.4h\n"
-        "smlal2 v25.4s, v4.8h, v13.8h\n"
-        "smlal v24.4s, v5.4h, v14.4h\n"
-        "smlal2 v25.4s, v5.8h, v14.8h\n"
-        "smlal v24.4s, v6.4h, v15.4h\n"
-        "smlal2 v25.4s, v6.8h, v15.8h\n"
-        "smlal v24.4s, v7.4h, v16.4h\n"
-        "smlal2 v25.4s, v7.8h, v16.8h\n"
-        "smlal v24.4s, v8.4h, v17.4h\n"
-        "smlal2 v25.4s, v8.8h, v17.8h\n"
-
-        "ld1 {v26.4s, v27.4s}, [%[bias_ptr]]\n"
-        "scvtf v24.4s, v24.4s\n"
-        "scvtf v25.4s, v25.4s\n"
-        "fmul v24.4s, v24.4s, v30.4s\n"
-        "fmul v25.4s, v25.4s, v31.4s\n"
-        "fadd v24.4s, v24.4s, v26.4s\n"
-        "fadd v25.4s, v25.4s, v27.4s\n"
-        "dup v26.4s, w3\n"
-        "dup v27.4s, w2\n"
-        "fmax v24.4s, v24.4s, v26.4s\n"
-        "fmin v24.4s, v24.4s, v27.4s\n"
-        "fmax v25.4s, v25.4s, v26.4s\n"
-        "fmin v25.4s, v25.4s, v27.4s\n"
-        "st1 {v24.4s, v25.4s}, [x6]\n"
-        "fcvtms v24.4s, v24.4s\n"
-        "fcvtms v25.4s, v25.4s\n"
-        DEPTHWISECONV_LABEL_HEIGHT_1_END ":\n"
-    :
-    // Outputs.
-    [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-    [output_ptr] "+r"(output_ptr),
-    [output_window_height] "+r"(output_window_height)
-    :
-    // Inputs.
-    [input_scale] "r"(input_scale),
-    [bias_ptr] "r"(bias_ptr), [input_row_size] "r"(input_row_size),
-    [input_depth] "r"(input_depth),
-    [output_window_width] "r"(output_window_width),
-    [input_width_increment] "r"(input_width_increment),
-    [input_height_increment] "r"(input_height_increment),
-    [output_height_increment] "r"(output_height_increment),
-    [per_channel_scales] "r"(per_channel_scales),
-    [params_ptr] "r"(params_ptr)
-    :
-    // Clobbers.
-    "cc", "memory",
-    // We use these NEON registers.
-    "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9",
-    "v10", "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-    "v20", "v21", "v22", "v23", "v24", "v25", "v26", "v27", "v28", "v29",
-    "v30", "v31",
-    // We use these general-purpose registers.
-    "x0", "x2", "x3", "x4", "x5", "x6", "x7",
-    "x10", "x11", "x12", "x13", "x14", "x15",
-    "x19", "x20");
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_WIDTH_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_2_AFTER_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LOOP
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_1_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_WIDTH_2_LEFTOVER
-#undef DEPTHWISECONV_LABEL_HEIGHT_1_END
-  }
-};
-
-template <>
-struct DepthwiseConvHybridPartialPerChannel<
-    DepthwiseConvOutputRounding::kUpward, EdgeType::kCenter, 1, 1> {
-    static inline void Run(const float* input_scale, const int8* input_ptr,
-                           const int8* filter_ptr, const float* bias_ptr,
-                           float* output_ptr, const float* per_channel_scales,
-                           const DepthwiseConvParams* params_ptr) {
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 1x1 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the 1x1 input and filter values.
-        //
-        // Use v6-v7 to hold output_multiplier & v10-v11 to hold output_shift.
-        "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-        "dup v26.8h, w9\n"
-        "ldr w9, [%[input_scale]]\n"
-        "cmp x11, #16\n"
-        "dup v28.4s, w9\n"
-        "ldr w9, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MIN) "]\n"
-        "ldr w10, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.4s, w9\n"
-        "dup v31.4s, w10\n"
-        "movi v16.4s, #0\n"
-        "saddw v8.8h, v26.8h, v8.8b\n"
-        "movi v17.4s, #0\n"
-        "sshll v0.8h, v0.8b, #0\n"
-
-        "ld1 {v6.4s}, [%[per_channel_scales]], #16\n"
-        "fmul v6.4s, v6.4s, v28.4s\n"
-        "ld1 {v10.4s}, [%[bias_ptr]], #16\n"
-        "ld1 {v7.4s}, [%[per_channel_scales]], #16\n"
-        "fmul v7.4s, v7.4s, v28.4s\n"
-        "ld1 {v11.4s}, [%[bias_ptr]], #16\n"
-
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "subs x11, x11, #8\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-          "cmp x11, #16\n"
-          "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-
-          "scvtf v16.4s, v16.4s\n"
-          "scvtf v17.4s, v17.4s\n"
-          "fmul v16.4s, v16.4s, v6.4s\n"
-          "fmul v17.4s, v17.4s, v7.4s\n"
-          "fadd v16.4s, v16.4s, v10.4s\n"
-          "fadd v17.4s, v17.4s, v11.4s\n"
-          "fmax v16.4s, v16.4s, v30.4s\n"
-          "fmin v16.4s, v16.4s, v31.4s\n"
-          "fmax v17.4s, v17.4s, v30.4s\n"
-          "fmin v17.4s, v17.4s, v31.4s\n"
-          "st1 {v16.4s, v17.4s}, [%[output_ptr]], #32\n"
-          "fcvtms v16.4s, v16.4s\n"
-          "fcvtms v17.4s, v17.4s\n"
-
-          "saddw v8.8h, v26.8h, v8.8b\n"
-          "movi v16.4s, #0\n"
-          "sshll v0.8h, v0.8b, #0\n"
-          "movi v17.4s, #0\n"
-          "ld1 {v6.4s}, [%[per_channel_scales]], #16\n"
-          "ld1 {v10.4s}, [%[bias_ptr]], #16\n"
-          "ld1 {v7.4s}, [%[per_channel_scales]], #16\n"
-          "ld1 {v11.4s}, [%[bias_ptr]], #16\n"
-          "fmul v6.4s, v6.4s, v28.4s\n"
-          "fmul v7.4s, v7.4s, v28.4s\n"
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-
-        "scvtf v16.4s, v16.4s\n"
-        "scvtf v17.4s, v17.4s\n"
-        "fmul v16.4s, v16.4s, v6.4s\n"
-        "fmul v17.4s, v17.4s, v7.4s\n"
-        "fadd v16.4s, v16.4s, v10.4s\n"
-        "fadd v17.4s, v17.4s, v11.4s\n"
-        "fmax v16.4s, v16.4s, v30.4s\n"
-        "fmin v16.4s, v16.4s, v31.4s\n"
-        "fmax v17.4s, v17.4s, v30.4s\n"
-        "fmin v17.4s, v17.4s, v31.4s\n"
-        "st1 {v16.4s, v17.4s}, [%[output_ptr]]\n"
-        "fcvtms v16.4s, v16.4s\n"
-        "fcvtms v17.4s, v17.4s\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr),
-        [per_channel_scales] "+r"(per_channel_scales)
-        :
-        // Inputs.
-        [params_ptr] "r"(params_ptr), [input_scale] "r"(input_scale)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v6", "v7", "v8", "v10", "v11", "v16", "v17", "v18", "v19",
-        "v26", "v28", "v30", "v31",
-        // We use these general-purpose registers.
-        "x9", "x10", "x11");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-template <>
-struct DepthwiseConvHybridPartialPerChannel<
-    DepthwiseConvOutputRounding::kUpward, EdgeType::kCorner, 1, 1> {
-  static inline void Run(const float* input_scale, const int8* input_ptr,
-                         const int8* filter_ptr, const float* bias_ptr,
-                         float* output_ptr, const float* per_channel_scales,
-                         const DepthwiseConvParams* params_ptr) {
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 2x2 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 2x2 input and
-        // filter values.
-        //
-        // Use v4-v5 to hold output_multiplier & v6-v7 to hold output_shift.
-
-        // Load input and filter values.
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "ldr x9, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "cmp x15, #16\n"
-        "add x12, %[input_ptr], x15\n"
-        "add x13, %[input_ptr], x9\n"
-        "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-        "add x14, x13, x15\n"
-        "ld1 {v9.8b}, [x12], #8\n"
-        "ldr x6, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-
-        "add x9, %[filter_ptr], x15\n"
-        "ld1 {v10.8b}, [x13], #8\n"
-        "add x10, %[filter_ptr], x6\n"
-        "ld1 {v11.8b}, [x14], #8\n"
-        "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-        "add x11, x10, x15\n"
-        "ld1 {v1.8b}, [x9], #8\n"
-        "ld1 {v2.8b}, [x10], #8\n"
-        "ld1 {v3.8b}, [x11], #8\n"
-
-        // Load constants.
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "dup v26.8h, w6\n"
-        "ldr w6, [%[input_scale]]\n"
-        "dup v28.4s, w6\n"
-        "ldr w6, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MIN) "]\n"
-        "ldr w7, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.4s, w6\n"
-        "dup v31.4s, w7\n"
-
-        // Loads output_multiplier & output_shift.
-        "ld1 {v4.4s}, [%[bias_ptr]], #16\n"
-        "ld1 {v6.4s}, [%[per_channel_scales]], #16\n"
-        "ld1 {v5.4s}, [%[bias_ptr]], #16\n"
-        "ld1 {v7.4s}, [%[per_channel_scales]], #16\n"
-        "fmul v6.4s, v6.4s, v28.4s\n"
-        "fmul v7.4s, v7.4s, v28.4s\n"
-
-        // Add input and filter offsets.
-        "saddw v8.8h, v26.8h, v8.8b\n"
-        "movi v16.4s, #0\n"
-        "saddw v9.8h, v26.8h, v9.8b\n"
-        "movi v17.4s, #0\n"
-        "saddw v10.8h, v26.8h, v10.8b\n"
-        "saddw v11.8h, v26.8h, v11.8b\n"
-
-        "sshll v0.8h, v0.8b, #0\n"
-        "sshll v1.8h, v1.8b, #0\n"
-        "sshll v2.8h, v2.8b, #0\n"
-        "sshll v3.8h, v3.8b, #0\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "subs x15, x15, #8\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [%[input_ptr]], #8\n"
-          "cmp x15, #16\n"
-          "ld1 {v0.8b}, [%[filter_ptr]], #8\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x12], #8\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "ld1 {v1.8b}, [x9], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], #8\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v2.8b}, [x10], #8\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x14], #8\n"
-          "ld1 {v3.8b}, [x11], #8\n"
-
-          "scvtf v16.4s, v16.4s\n"
-          "scvtf v17.4s, v17.4s\n"
-          "fmul v16.4s, v16.4s, v6.4s\n"
-          "fmul v17.4s, v17.4s, v7.4s\n"
-          "fadd v16.4s, v16.4s, v4.4s\n"
-          "fadd v17.4s, v17.4s, v5.4s\n"
-          "fmax v16.4s, v16.4s, v30.4s\n"
-          "fmin v16.4s, v16.4s, v31.4s\n"
-          "fmax v17.4s, v17.4s, v30.4s\n"
-          "fmin v17.4s, v17.4s, v31.4s\n"
-          "st1 {v16.4s, v17.4s}, [%[output_ptr]], #32\n"
-          "fcvtms v16.4s, v16.4s\n"
-          "fcvtms v17.4s, v17.4s\n"
-
-          "saddw v8.8h, v26.8h, v8.8b\n"
-          "movi v16.4s, #0\n"
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "movi v17.4s, #0\n"
-          "saddw v10.8h, v26.8h, v10.8b\n"
-          "saddw v11.8h, v26.8h, v11.8b\n"
-          "sshll v0.8h, v0.8b, #0\n"
-          "sshll v1.8h, v1.8b, #0\n"
-          "sshll v2.8h, v2.8b, #0\n"
-          "sshll v3.8h, v3.8b, #0\n"
-          "ld1 {v4.4s}, [%[bias_ptr]], #16\n"
-          "ld1 {v6.4s}, [%[per_channel_scales]], #16\n"
-          "ld1 {v5.4s}, [%[bias_ptr]], #16\n"
-          "ld1 {v7.4s}, [%[per_channel_scales]], #16\n"
-          "fmul v6.4s, v6.4s, v28.4s\n"
-          "fmul v7.4s, v7.4s, v28.4s\n"
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-
-        "scvtf v16.4s, v16.4s\n"
-        "scvtf v17.4s, v17.4s\n"
-        "fmul v16.4s, v16.4s, v6.4s\n"
-        "fmul v17.4s, v17.4s, v7.4s\n"
-        "fadd v16.4s, v16.4s, v4.4s\n"
-        "fadd v17.4s, v17.4s, v5.4s\n"
-        "fmax v16.4s, v16.4s, v30.4s\n"
-        "fmin v16.4s, v16.4s, v31.4s\n"
-        "fmax v17.4s, v17.4s, v30.4s\n"
-        "fmin v17.4s, v17.4s, v31.4s\n"
-        "st1 {v16.4s, v17.4s}, [%[output_ptr]]\n"
-        "fcvtms v16.4s, v16.4s\n"
-        "fcvtms v17.4s, v17.4s\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr),
-        [per_channel_scales] "+r"(per_channel_scales)
-        :
-        // Inputs.
-        [input_scale] "r"(input_scale),
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v16", "v17","v18", "v19", "v26", "v28", "v30", "v31",
-        // We use these general-purpose registers.
-        "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-template <>
-struct DepthwiseConvHybridPartialPerChannel<
-    DepthwiseConvOutputRounding::kUpward, EdgeType::kHorizontal, 1, 1> {
-  static inline void Run(const float* input_scale, const int8* input_ptr,
-                         const int8* filter_ptr, const float* bias_ptr,
-                         float* output_ptr, const float* per_channel_scales,
-                         const DepthwiseConvParams* params_ptr) {
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 2x3 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 2x3 input and
-        // filter values.
-        //
-        // Use v6-v7 to hold output_multiplier & v14-v15 to hold output_shift.
-
-        // Load input and filter values.
-        "ldr x7, [%[params_ptr], #" STR(OFFSET_INPUT_DEPTH) "]\n"
-        "mov x12, %[input_ptr]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "mov x9, %[filter_ptr]\n"
-        "ldr x14, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-        "add x13, x12, x11\n"
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-
-        "ld1 {v8.8b}, [x12], x7\n"
-        "add x10, x9, x14\n"
-        "ld1 {v9.8b}, [x12], x7\n"
-        "cmp x15, #16\n"
-        "ld1 {v10.8b}, [x12]\n"
-        "add %[input_ptr], %[input_ptr], #8\n"
-        "ld1 {v11.8b}, [x13], x7\n"
-        "add %[filter_ptr], %[filter_ptr], #8\n"
-        "ld1 {v12.8b}, [x13], x7\n"
-        "ld1 {v13.8b}, [x13]\n"
-
-        "ld1 {v0.8b}, [x9], x7\n"
-        "ld1 {v1.8b}, [x9], x7\n"
-        "ld1 {v2.8b}, [x9]\n"
-        "ld1 {v3.8b}, [x10], x7\n"
-        "ld1 {v4.8b}, [x10], x7\n"
-        "ld1 {v5.8b}, [x10]\n"
-
-        // Load constants.
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "dup v26.8h, w12\n"
-        "ldr w12, [%[input_scale]]\n"
-        "dup v28.4s, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MIN) "]\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.4s, w12\n"
-        "dup v31.4s, w13\n"
-
-        // Loads output_multiplier & output_shift.
-        "ld1 {v6.4s}, [%[bias_ptr]], #16\n"
-        "ld1 {v14.4s}, [%[per_channel_scales]], #16\n"
-        "fmul v14.4s, v14.4s, v28.4s\n"
-        "ld1 {v7.4s}, [%[bias_ptr]], #16\n"
-        "ld1 {v15.4s}, [%[per_channel_scales]], #16\n"
-        "fmul v15.4s, v15.4s, v28.4s\n"
-
-        // Add input and filter offsets.
-        "saddw v8.8h, v26.8h, v8.8b\n"
-        "movi v16.4s, #0\n"
-        "saddw v9.8h, v26.8h, v9.8b\n"
-        "movi v17.4s, #0\n"
-        "saddw v10.8h, v26.8h, v10.8b\n"
-        "saddw v11.8h, v26.8h, v11.8b\n"
-        "saddw v12.8h, v26.8h, v12.8b\n"
-        "saddw v13.8h, v26.8h, v13.8b\n"
-
-        "sshll v0.8h, v0.8b, #0\n"
-        "sshll v1.8h, v1.8b, #0\n"
-        "sshll v2.8h, v2.8b, #0\n"
-        "sshll v3.8h, v3.8b, #0\n"
-        "sshll v4.8h, v4.8b, #0\n"
-        "sshll v5.8h, v5.8b, #0\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "mov x12, %[input_ptr]\n"
-          "subs x15, x15, #8\n"
-          "add x13, x12, x11\n"
-          "cmp x15, #16\n"
-          "add %[input_ptr], %[input_ptr], #8\n"
-
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "mov x9, %[filter_ptr]\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [x12], x7\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "add x10, x9, x14\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "ld1 {v9.8b}, [x12], x7\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "add %[filter_ptr], %[filter_ptr], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x12]\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v0.8b}, [x9], x7\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13], x7\n"
-          "smlal v16.4s, v4.4h, v12.4h\n"
-          "ld1 {v1.8b}, [x9], x7\n"
-          "smlal2 v17.4s, v4.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x13], x7\n"
-          "smlal v16.4s, v5.4h, v13.4h\n"
-          "ld1 {v2.8b}, [x9]\n"
-          "smlal2 v17.4s, v5.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x13]\n"
-
-          "scvtf v16.4s, v16.4s\n"
-          "fmul v16.4s, v16.4s, v14.4s\n"
-          "ld1 {v3.8b}, [x10], x7\n"
-          "scvtf v17.4s, v17.4s\n"
-          "fmul v17.4s, v17.4s, v15.4s\n"
-          "ld1 {v4.8b}, [x10], x7\n"
-          "fadd v16.4s, v16.4s, v6.4s\n"
-          "ld1 {v5.8b}, [x10]\n"
-          "fadd v17.4s, v17.4s, v7.4s\n"
-          "fmax v16.4s, v16.4s, v30.4s\n"
-          "fmin v16.4s, v16.4s, v31.4s\n"
-          "fmax v17.4s, v17.4s, v30.4s\n"
-          "fmin v17.4s, v17.4s, v31.4s\n"
-          "saddw v8.8h, v26.8h, v8.8b\n"
-          "st1 {v16.4s, v17.4s}, [%[output_ptr]], #32\n"
-          "fcvtms v16.4s, v16.4s\n"
-          "fcvtms v17.4s, v17.4s\n"
-
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "saddw v10.8h, v26.8h, v10.8b\n"
-          "saddw v11.8h, v26.8h, v11.8b\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "saddw v13.8h, v26.8h, v13.8b\n"
-
-          "sshll v0.8h, v0.8b, #0\n"
-          "sshll v1.8h, v1.8b, #0\n"
-          "sshll v2.8h, v2.8b, #0\n"
-          "movi v16.4s, #0\n"
-          "sshll v3.8h, v3.8b, #0\n"
-          "movi v17.4s, #0\n"
-          "sshll v4.8h, v4.8b, #0\n"
-          "sshll v5.8h, v5.8b, #0\n"
-          "ld1 {v6.4s}, [%[bias_ptr]], #16\n"
-          "ld1 {v14.4s}, [%[per_channel_scales]], #16\n"
-          "ld1 {v7.4s}, [%[bias_ptr]], #16\n"
-          "ld1 {v15.4s}, [%[per_channel_scales]], #16\n"
-          "fmul v14.4s, v14.4s, v28.4s\n"
-          "fmul v15.4s, v15.4s, v28.4s\n"
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-        "smlal v16.4s, v4.4h, v12.4h\n"
-        "smlal2 v17.4s, v4.8h, v12.8h\n"
-        "smlal v16.4s, v5.4h, v13.4h\n"
-        "smlal2 v17.4s, v5.8h, v13.8h\n"
-
-        "scvtf v16.4s, v16.4s\n"
-        "scvtf v17.4s, v17.4s\n"
-        "fmul v16.4s, v16.4s, v14.4s\n"
-        "fmul v17.4s, v17.4s, v15.4s\n"
-        "fadd v16.4s, v16.4s, v6.4s\n"
-        "fadd v17.4s, v17.4s, v7.4s\n"
-        "fmax v16.4s, v16.4s, v30.4s\n"
-        "fmin v16.4s, v16.4s, v31.4s\n"
-        "fmax v17.4s, v17.4s, v30.4s\n"
-        "fmin v17.4s, v17.4s, v31.4s\n"
-        "st1 {v16.4s, v17.4s}, [%[output_ptr]]\n"
-        "fcvtms v16.4s, v16.4s\n"
-        "fcvtms v17.4s, v17.4s\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr),
-        [per_channel_scales] "+r"(per_channel_scales),
-        [bias_ptr] "+r"(bias_ptr)
-        :
-        // Inputs.
-        [input_scale] "r"(input_scale), [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-        "v26", "v28", "v30", "v31",
-        // We use these general-purpose registers.
-        "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-template <>
-struct DepthwiseConvHybridPartialPerChannel<
-    DepthwiseConvOutputRounding::kUpward, EdgeType::kVertical, 1, 1> {
-  static inline void Run(const float* input_scale, const int8* input_ptr,
-                         const int8* filter_ptr, const float* bias_ptr,
-                         float* output_ptr, const float* per_channel_scales,
-                         const DepthwiseConvParams* params_ptr) {
-    TFLITE_DCHECK_EQ(params_ptr->filter_offset, 0);
-#define DEPTHWISECONV_LABEL_DEPTH_8_LOOP "1"
-#define DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "2"
-    asm volatile(
-        // Performs depthwise convolutions for an input window of size 3x2 and
-        // padding of 1 across the full depth. Expects |input_ptr| and
-        // |filter_ptr| to be pointing to the beginning of the 3x2 input and
-        // filter values.
-        //
-        // Use v6-v7 to hold output_multiplier & v14-v15 to hold output_shift.
-
-        // Load input and filter values.
-        "ldr x6, [%[params_ptr], #" STR(OFFSET_INPUT_DEPTH) "]\n"
-        "mov x12, %[input_ptr]\n"
-        "ldr x11, [%[params_ptr], #" STR(OFFSET_INPUT_ROW_SIZE) "]\n"
-        "mov x7, %[filter_ptr]\n"
-        "ldr x5, [%[params_ptr], #" STR(OFFSET_FILTER_ROW_SIZE) "]\n"
-        "add x13, x12, x11\n"
-        "ldr x15, [%[params_ptr], #" STR(OFFSET_OUTPUT_DEPTH) "]\n"
-        "add x14, x13, x11\n"
-
-        "ld1 {v8.8b}, [x12], x6\n"
-        "add x9, x7, x5\n"
-        "ld1 {v9.8b}, [x12]\n"
-        "cmp x15, #16\n"
-        "add x10, x9, x5\n"
-        "ld1 {v10.8b}, [x13], x6\n"
-        "add %[input_ptr], %[input_ptr], #8\n"
-        "ld1 {v11.8b}, [x13]\n"
-        "add %[filter_ptr], %[filter_ptr], #8\n"
-        "ld1 {v12.8b}, [x14], x6\n"
-        "ld1 {v13.8b}, [x14]\n"
-
-        "ld1 {v0.8b}, [x7], x6\n"
-        "ld1 {v1.8b}, [x7]\n"
-        "ld1 {v2.8b}, [x9], x6\n"
-        "ld1 {v3.8b}, [x9]\n"
-        "ld1 {v4.8b}, [x10], x6\n"
-        "ld1 {v5.8b}, [x10]\n"
-
-        // Load constants.
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_INPUT_OFFSET) "]\n"
-        "dup v26.8h, w12\n"
-        "ldr w12, [%[input_scale]]\n"
-        "dup v28.4s, w12\n"
-        "ldr w12, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MIN) "]\n"
-        "ldr w13, [%[params_ptr], #" STR(OFFSET_FLOAT_OUTPUT_ACTIVATION_MAX) "]\n"
-        "dup v30.4s, w12\n"
-        "dup v31.4s, w13\n"
-
-        "ld1 {v6.4s}, [%[bias_ptr]], #16\n"
-        "ld1 {v14.4s}, [%[per_channel_scales]], #16\n"
-        "ld1 {v7.4s}, [%[bias_ptr]], #16\n"
-        "ld1 {v15.4s}, [%[per_channel_scales]], #16\n"
-        "fmul v14.4s, v14.4s, v28.4s\n"
-        "fmul v15.4s, v15.4s, v28.4s\n"
-
-        // Add input and filter offsets.
-        "saddw v8.8h, v26.8h, v8.8b\n"
-        "movi v16.4s, #0\n"
-        "saddw v9.8h, v26.8h, v9.8b\n"
-        "movi v17.4s, #0\n"
-        "saddw v10.8h, v26.8h, v10.8b\n"
-        "saddw v11.8h, v26.8h, v11.8b\n"
-        "saddw v12.8h, v26.8h, v12.8b\n"
-        "saddw v13.8h, v26.8h, v13.8b\n"
-
-        "sshll v0.8h, v0.8b, #0\n"
-        "sshll v1.8h, v1.8b, #0\n"
-        "sshll v2.8h, v2.8b, #0\n"
-        "sshll v3.8h, v3.8b, #0\n"
-        "sshll v4.8h, v4.8b, #0\n"
-        "sshll v5.8h, v5.8b, #0\n"
-
-        "blt " DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP "f\n"
-
-        //"loop_%=:\n"
-        DEPTHWISECONV_LABEL_DEPTH_8_LOOP ":\n"
-          "mov x12, %[input_ptr]\n"
-          "subs x15, x15, #8\n"
-          "add x13, x12, x11\n"
-          "cmp x15, #16\n"
-          "add x14, x13, x11\n"
-          "add %[input_ptr], %[input_ptr], #8\n"
-
-          "smlal v16.4s, v0.4h, v8.4h\n"
-          "mov x7, %[filter_ptr]\n"
-          "smlal2 v17.4s, v0.8h, v8.8h\n"
-          "ld1 {v8.8b}, [x12], x6\n"
-          "smlal v16.4s, v1.4h, v9.4h\n"
-          "add x9, x7, x5\n"
-          "smlal2 v17.4s, v1.8h, v9.8h\n"
-          "add x10, x9, x5\n"
-          "ld1 {v9.8b}, [x12]\n"
-          "smlal v16.4s, v2.4h, v10.4h\n"
-          "add %[filter_ptr], %[filter_ptr], #8\n"
-          "smlal2 v17.4s, v2.8h, v10.8h\n"
-          "ld1 {v10.8b}, [x13], x6\n"
-          "smlal v16.4s, v3.4h, v11.4h\n"
-          "ld1 {v0.8b}, [x7], x6\n"
-          "smlal2 v17.4s, v3.8h, v11.8h\n"
-          "ld1 {v11.8b}, [x13]\n"
-          "smlal v16.4s, v4.4h, v12.4h\n"
-          "ld1 {v1.8b}, [x7]\n"
-          "smlal2 v17.4s, v4.8h, v12.8h\n"
-          "ld1 {v12.8b}, [x14], x6\n"
-          "smlal v16.4s, v5.4h, v13.4h\n"
-          "ld1 {v2.8b}, [x9], x6\n"
-          "smlal2 v17.4s, v5.8h, v13.8h\n"
-          "ld1 {v13.8b}, [x14]\n"
-
-          "scvtf v16.4s, v16.4s\n"
-          "fmul v16.4s, v16.4s, v14.4s\n"
-          "ld1 {v3.8b}, [x9]\n"
-          "scvtf v17.4s, v17.4s\n"
-          "fmul v17.4s, v17.4s, v15.4s\n"
-          "ld1 {v4.8b}, [x10], x6\n"
-          "fadd v16.4s, v16.4s, v6.4s\n"
-          "ld1 {v5.8b}, [x10]\n"
-          "fadd v17.4s, v17.4s, v7.4s\n"
-          "fmax v16.4s, v16.4s, v30.4s\n"
-          "fmin v16.4s, v16.4s, v31.4s\n"
-          "fmax v17.4s, v17.4s, v30.4s\n"
-          "fmin v17.4s, v17.4s, v31.4s\n"
-          "st1 {v16.4s, v17.4s}, [%[output_ptr]], #32\n"
-          "fcvtms v16.4s, v16.4s\n"
-          "fcvtms v17.4s, v17.4s\n"
-
-          "saddw v8.8h, v26.8h, v8.8b\n"
-          "saddw v9.8h, v26.8h, v9.8b\n"
-          "saddw v10.8h, v26.8h, v10.8b\n"
-          "saddw v11.8h, v26.8h, v11.8b\n"
-          "saddw v12.8h, v26.8h, v12.8b\n"
-          "saddw v13.8h, v26.8h, v13.8b\n"
-
-          "sshll v0.8h, v0.8b, #0\n"
-          "sshll v1.8h, v1.8b, #0\n"
-          "sshll v2.8h, v2.8b, #0\n"
-          "movi v16.4s, #0\n"
-          "sshll v3.8h, v3.8b, #0\n"
-          "movi v17.4s, #0\n"
-          "sshll v4.8h, v4.8b, #0\n"
-          "sshll v5.8h, v5.8b, #0\n"
-
-          "ld1 {v6.4s}, [%[bias_ptr]], #16\n"
-          "ld1 {v14.4s}, [%[per_channel_scales]], #16\n"
-          "ld1 {v7.4s}, [%[bias_ptr]], #16\n"
-          "ld1 {v15.4s}, [%[per_channel_scales]], #16\n"
-          "fmul v14.4s, v14.4s, v28.4s\n"
-          "fmul v15.4s, v15.4s, v28.4s\n"
-          "bge " DEPTHWISECONV_LABEL_DEPTH_8_LOOP "b\n"
-
-        DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP ":\n"
-        "smlal v16.4s, v0.4h, v8.4h\n"
-        "smlal2 v17.4s, v0.8h, v8.8h\n"
-        "smlal v16.4s, v1.4h, v9.4h\n"
-        "smlal2 v17.4s, v1.8h, v9.8h\n"
-        "smlal v16.4s, v2.4h, v10.4h\n"
-        "smlal2 v17.4s, v2.8h, v10.8h\n"
-        "smlal v16.4s, v3.4h, v11.4h\n"
-        "smlal2 v17.4s, v3.8h, v11.8h\n"
-        "smlal v16.4s, v4.4h, v12.4h\n"
-        "smlal2 v17.4s, v4.8h, v12.8h\n"
-        "smlal v16.4s, v5.4h, v13.4h\n"
-        "smlal2 v17.4s, v5.8h, v13.8h\n"
-
-        "scvtf v16.4s, v16.4s\n"
-        "scvtf v17.4s, v17.4s\n"
-        "fmul v16.4s, v16.4s, v14.4s\n"
-        "fmul v17.4s, v17.4s, v15.4s\n"
-        "fadd v16.4s, v16.4s, v6.4s\n"
-        "fadd v17.4s, v17.4s, v7.4s\n"
-        "fmax v16.4s, v16.4s, v30.4s\n"
-        "fmin v16.4s, v16.4s, v31.4s\n"
-        "fmax v17.4s, v17.4s, v30.4s\n"
-        "fmin v17.4s, v17.4s, v31.4s\n"
-        "st1 {v16.4s, v17.4s}, [%[output_ptr]]\n"
-        "fcvtms v16.4s, v16.4s\n"
-        "fcvtms v17.4s, v17.4s\n"
-        :
-        // Outputs.
-        [filter_ptr] "+r"(filter_ptr), [input_ptr] "+r"(input_ptr),
-        [output_ptr] "+r"(output_ptr), [bias_ptr] "+r"(bias_ptr),
-        [per_channel_scales] "+r"(per_channel_scales)
-        :
-        // Inputs.
-        [input_scale] "r"(input_scale),
-        [params_ptr] "r"(params_ptr)
-        :
-        // Clobbers.
-        "cc", "memory",
-        // We use these NEON registers.
-        "v0", "v1", "v2", "v3", "v4", "v5", "v6", "v7", "v8", "v9", "v10",
-        "v11", "v12", "v13", "v14", "v15", "v16", "v17", "v18", "v19",
-        "v26", "v28", "v30", "v31",
-        // We use these general-purpose registers.
-        "x5", "x6", "x7", "x9", "x10", "x11", "x12", "x13", "x14", "x15");
-#undef DEPTHWISECONV_LABEL_DEPTH_8_LOOP
-#undef DEPTHWISECONV_LABEL_DEPTH_8_AFTER_LOOP
-  }
-};
-
-#undef OFFSET_INPUT_DEPTH
-#undef OFFSET_INPUT_ROW_SIZE
-#undef OFFSET_OUTPUT_DEPTH
-#undef OFFSET_OUTPUT_ROW_SIZE
-#undef OFFSET_INPUT_OFFSET
-#undef OFFSET_OUTPUT_OFFSET
-#undef OFFSET_OUTPUT_MULTIPLIER
-#undef OFFSET_OUTPUT_ACTIVATION_MIN
-#undef OFFSET_OUTPUT_ACTIVATION_MAX
-#undef OFFSET_OUTPUT_RIGHT_SHIFT
-#undef OFFSET_INPUT_WIDTH
-#undef OFFSET_INPUT_HEIGHT
-#undef OFFSET_OUTPUT_WIDTH
-#undef OFFSET_OUTPUT_HEIGHT
-#undef OFFSET_OUTPUT_FLOAT_ACTIVATION_MIN
-#undef OFFSET_OUTPUT_FLOAT_ACTIVATION_MAX
-
-template 
-struct DepthwiseConvHybridThroughDepthPerChannel {
-  // Runs the DepthwiseConvWindowPerChannel kernels through the depth dimension
-  // from |start_depth| to |end_depth|. Keep this not inlined to maintain a
-  // small binary size. We use a DepthwiseConvParams struct for read only params
-  // to minimize call overhead.
-  static void __attribute__((noinline))
-  Run(const float* input_scale, const int8* input_ptr, const int8* filter_ptr,
-      const float* bias_ptr, float* output_ptr, int64_t start_depth,
-      int64_t end_depth, int64_t input_depth, int64_t input_row_size,
-      int32 output_window_height, int32 output_window_width,
-      const float* per_channel_scales, const DepthwiseConvParams& params) {
-    for (; start_depth <= end_depth - 8; start_depth += 8) {
-      DepthwiseConvHybridWindowPerChannel::Run(input_scale,
-                              input_ptr, filter_ptr,
-                              bias_ptr, output_ptr,
-                              input_depth,
-                              input_row_size,
-                              output_window_height,
-                              output_window_width,
-                              per_channel_scales,
-                              ¶ms);
-      input_ptr += 8;
-      output_ptr += 8;
-      filter_ptr += 8;
-      bias_ptr += 8;
-      per_channel_scales += 8;
-    }
-  }
-};
-
-template 
-struct DepthwiseConvHybridMultiRowPerChannel {
-  using ConvKernel =
-      DepthwiseConvHybridThroughDepthPerChannel;
-
-  static inline void Run(const float* input_scale, const int8* input_data,
-                         int32 start_x, int32 end_x, const int8* filter_data,
-                         const float* bias_data, float* output_data,
-                         const float* per_channel_scales,
-                         const DepthwiseConvParams& params,
-                         const ShuffleParams& shuffle_params,
-                         int8* shuffle_workspace) {
-    TFLITE_DCHECK(
-        shuffle_params.input_height ==
-        get_shuffle_input_size(kStrideHeight, shuffle_params.output_height));
-    TFLITE_DCHECK(
-        shuffle_params.input_width ==
-        get_shuffle_input_size(kStrideWidth, shuffle_params.output_width));
-    TFLITE_DCHECK_LE(
-        64 * shuffle_params.input_width * shuffle_params.input_height,
-        kDepthwiseConvScratchWorkspaceSize);
-
-    int32 out_x = start_x;
-
-    // Run shuffling on inputs with sufficiently large depth and width. When
-    // these parameters are large enough, more time is taken to load inputs
-    // from memory. At this point, it becomes useful to prefetch and
-    // preshuffle the input data to maximize locality.
-
-    if (params.output_depth > 64 ||
-        (params.output_depth <= 64 && params.input_width > 150)) {
-      for (; out_x <= (end_x - shuffle_params.output_width);
-           out_x += shuffle_params.output_width) {
-        const int8* input_ptr = input_data;
-        const float* bias_ptr = bias_data;
-        const int8* filter_ptr = filter_data;
-        const float* per_channel_scales_ptr = per_channel_scales;
-        float* output_ptr = output_data;
-        int64_t depth = 0;
-        const int64_t shuffle_row_size = 64 * shuffle_params.input_width;
-
-        for (; depth <= params.output_depth - 64; depth += 64) {
-          // Preload.
-          const int8* h_ptr = input_ptr;
-          for (int32 i = 0; i < shuffle_params.input_height; i++) {
-            const int8* ptr = h_ptr;
-            for (int32 j = 0; j < shuffle_params.input_width; j++) {
-              optimized_ops_preload_l1_keep(ptr);
-              ptr += params.input_depth;
-            }
-            h_ptr += params.input_row_size;
-          }
-
-          // For a large enough input, shuffle into buckets.
-          ShuffleInput(input_ptr, params.input_depth, params.input_width,
-                       params.input_height, 64, shuffle_params.input_width,
-                       shuffle_params.input_height, shuffle_workspace);
-          ConvKernel::Run(input_scale,
-                          shuffle_workspace, filter_ptr, bias_ptr, output_ptr,
-                          0, 64, 64, shuffle_row_size,
-                          shuffle_params.output_height,
-                          shuffle_params.output_width, per_channel_scales_ptr,
-                          params);
-          input_ptr += 64;
-          output_ptr += 64;
-          filter_ptr += 64;
-          bias_ptr += 64;
-          per_channel_scales_ptr += 64;
-        }
-
-        // Preload.
-        const int8* h_ptr = input_ptr;
-        for (int32 i = 0; i < shuffle_params.input_height; i++) {
-          const int8* ptr = h_ptr;
-          for (int32 j = 0; j < shuffle_params.input_width; j++) {
-            optimized_ops_preload_l1_keep(ptr);
-            ptr += params.input_depth;
-          }
-          h_ptr += params.input_row_size;
-        }
-
-        // Handle leftover depth.
-        ConvKernel::Run(input_scale, input_ptr,
-                        filter_ptr, bias_ptr, output_ptr, depth,
-                        params.output_depth, params.input_depth,
-                        params.input_row_size, shuffle_params.output_height,
-                        shuffle_params.output_width, per_channel_scales_ptr,
-                        params);
-        input_data +=
-            shuffle_params.output_width * kStrideWidth * params.input_depth;
-        output_data += shuffle_params.output_width * params.output_depth;
-      }
-    }
-
-
-    const int32 output_leftover_width = end_x - out_x;
-    if (output_leftover_width > 0) {
-      ConvKernel::Run(input_scale, input_data, filter_data,
-                      bias_data, output_data, 0, params.output_depth,
-                      params.input_depth, params.input_row_size,
-                      shuffle_params.output_height, output_leftover_width,
-                      per_channel_scales, params);
-    }
-  }
-};
-
-// Processes the borders of the input for pad_width and pad_height = 1.
-// Calls 4 asm kernels:
-//   * 1x1 input shape.
-//   * Corner edges.
-//   * Horizontal edges.
-//   * Vertical edges.
-template 
-    inline void DepthwiseConvHybridHandlePaddingPerChannel(
-        const float* input_scale, const int8* input_data,
-        const int8* filter_data, const float* bias_data, float* output_data,
-        const float* per_channel_scales, const DepthwiseConvParams& params) {
-  if (params.input_width == 1 && params.input_height == 1) {
-    const int8* filter_ptr =
-        filter_data + params.filter_row_size + params.output_depth;
-    DepthwiseConvHybridPartialPerChannel::Run(input_scale, input_data,
-                filter_ptr, bias_data, output_data,
-                per_channel_scales, ¶ms);
-    return;
-  }
-
-  const int32 out_x_start_corner = 0;
-  const int32 out_x_end_corner = params.output_width - 1;
-  const int32 out_y_start_corner = 0;
-  const int32 out_y_end_corner = params.output_height - 1;
-
-  // Handle top row.
-  const int8* input_ptr = input_data;
-  const int8* filter_ptr =
-      filter_data + params.filter_row_size + params.output_depth;
-  float* output_ptr = output_data;
-
-  DepthwiseConvHybridPartialPerChannel<
-      output_rounding, EdgeType::kCorner, 1, 1>::Run(
-          input_scale, input_ptr, filter_ptr, bias_data,
-          output_ptr, per_channel_scales, ¶ms);
-
-  input_ptr += (params.stride_width - 1) * params.input_depth;
-  filter_ptr = filter_data + params.filter_row_size;
-  output_ptr += params.output_depth;
-
-  for (int32 out_x = out_x_start_corner + 1; out_x < out_x_end_corner;
-       out_x++) {
-    DepthwiseConvHybridPartialPerChannel<
-        output_rounding, EdgeType::kHorizontal, 1, 1>::Run(
-            input_scale, input_ptr, filter_ptr, bias_data, output_ptr,
-            per_channel_scales, ¶ms);
-    input_ptr += params.stride_width * params.input_depth;
-    output_ptr += params.output_depth;
-  }
-
-  DepthwiseConvHybridPartialPerChannel<
-      output_rounding, EdgeType::kCorner, 1, 1>::Run(
-          input_scale, input_ptr, filter_ptr, bias_data, output_ptr,
-          per_channel_scales, ¶ms);
-
-  // Handle left side.
-  input_ptr = input_data + (params.stride_width - 1) * params.input_row_size;
-  filter_ptr = filter_data + params.input_depth;
-  output_ptr = output_data + params.output_row_size;
-
-  for (int32 out_y = out_y_start_corner + 1; out_y < out_y_end_corner;
-       out_y++) {
-    DepthwiseConvHybridPartialPerChannel<
-        output_rounding, EdgeType::kVertical, 1, 1>::Run(
-            input_scale, input_ptr, filter_ptr, bias_data, output_ptr,
-            per_channel_scales, ¶ms);
-    input_ptr += params.stride_width * params.input_row_size;
-    output_ptr += params.output_row_size;
-  }
-
-  // Handle right side.
-  input_ptr = input_data + (params.input_width - 2) * params.input_depth +
-              (params.stride_width - 1) * params.input_row_size;
-  filter_ptr = filter_data;
-  output_ptr = output_data + params.output_row_size +
-               (params.output_width - 1) * params.output_depth;
-
-  for (int32 out_y = out_y_start_corner + 1; out_y < out_y_end_corner;
-       out_y++) {
-    DepthwiseConvHybridPartialPerChannel<
-        output_rounding, EdgeType::kVertical, 1, 1>::Run(
-            input_scale, input_ptr, filter_ptr, bias_data, output_ptr,
-            per_channel_scales, ¶ms);
-    input_ptr += params.stride_width * params.input_row_size;
-    output_ptr += params.output_row_size;
-  }
-
-  // Handle bottom row.
-  input_ptr = input_data + (params.input_height - 2) * params.input_row_size;
-  filter_ptr = filter_data + params.output_depth;
-  output_ptr =
-     output_data + (params.output_height - 1) * params.output_row_size;
-
-  DepthwiseConvHybridPartialPerChannel<
-      output_rounding, EdgeType::kCorner, 1, 1>::Run(
-          input_scale, input_ptr, filter_ptr, bias_data, output_ptr,
-          per_channel_scales, ¶ms);
-
-  input_ptr += (params.stride_width == 1) ? 0 : params.input_depth;
-  filter_ptr = filter_data;
-  output_ptr += params.output_depth;
-
-  for (int32 out_x = out_x_start_corner + 1; out_x < out_x_end_corner;
-       out_x++) {
-    DepthwiseConvHybridPartialPerChannel<
-        output_rounding, EdgeType::kHorizontal, 1, 1>::Run(
-            input_scale, input_ptr, filter_ptr, bias_data, output_ptr,
-            per_channel_scales, ¶ms);
-    input_ptr += params.stride_width * params.input_depth;
-    output_ptr += params.output_depth;
-  }
-  DepthwiseConvHybridPartialPerChannel<
-      output_rounding, EdgeType::kCorner, 1, 1>::Run(
-          input_scale, input_ptr, filter_ptr, bias_data, output_ptr,
-          per_channel_scales, ¶ms);
-}
-
-template 
-inline void DepthwiseConvHybrid3x3FilterPerChannel(
-    const DepthwiseParams& rt_params, const float* input_scales,
-    const RuntimeShape& input_shape, const int8* input_data,
-    const RuntimeShape& filter_shape, const int8* filter_data,
-    const RuntimeShape& bias_shape, const float* bias_data,
-    const RuntimeShape& output_shape, float* output_data,
-    const float* per_channel_scales, const int32* input_offsets,
-    int thread_start, int thread_end, int thread_dim) {
-  DepthwiseConvParams params;
-  const int32 stride_width = rt_params.stride_width;
-  const int32 stride_height = rt_params.stride_height;
-  const int32 pad_width = rt_params.padding_values.width;
-  const int32 pad_height = rt_params.padding_values.height;
-  const int32 depth_multiplier = rt_params.depth_multiplier;
-  const float output_activation_min = rt_params.float_activation_min;
-  const float output_activation_max = rt_params.float_activation_max;
-  const int32 filter_offset = rt_params.weights_offset;
-
-  params.input_depth = input_shape.Dims(3);
-  params.input_width = input_shape.Dims(2);
-  params.input_height = input_shape.Dims(1);
-  params.input_row_size = params.input_depth * params.input_width;
-  params.stride_width = stride_width;  params.stride_height = stride_height;
-  params.output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  params.output_width = output_shape.Dims(2);
-  params.output_height = output_shape.Dims(1);
-  params.output_row_size = params.output_depth * params.output_width;
-  params.filter_offset = filter_offset;
-  params.float_output_activation_min = output_activation_min;
-  params.float_output_activation_max = output_activation_max;
-
-  const int32 filter_height = filter_shape.Dims(1);
-  const int32 filter_width = filter_shape.Dims(2);
-  params.filter_row_size = params.output_depth * filter_width;
-
-  // Algorithm assumes below constraints. It is optimized for depth
-  // multiplier of 1, 3x3 filter, no padding and strides 1 and 2.
-  TFLITE_DCHECK(params.output_depth == params.input_depth * depth_multiplier);
-  TFLITE_DCHECK(depth_multiplier == 1);
-  TFLITE_DCHECK(filter_height == 3);
-  TFLITE_DCHECK(filter_width == 3);
-  TFLITE_DCHECK(stride_height == 1 || stride_height == 2);
-  TFLITE_DCHECK(stride_width == 1 || stride_width == 2);
-  TFLITE_DCHECK(stride_width == stride_height);
-  TFLITE_DCHECK(pad_height == 0 || pad_height == 1);
-  TFLITE_DCHECK(pad_width == 0 || pad_width == 1);
-  TFLITE_DCHECK(pad_width == pad_height);
-  TFLITE_DCHECK(thread_dim == 0 || thread_dim == 1);
-
-  const int32 batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int64_t input_batch_size = params.input_row_size * params.input_height;
-  const int64_t output_batch_size =
-      params.output_row_size * params.output_height;
-
-  ShuffleParams one_row_shuffle_params, two_row_shuffle_params,
-      four_row_shuffle_params, eight_row_shuffle_params;
-  if (stride_width == 1) {
-    one_row_shuffle_params = ShuffleParams(30, 1, 1, 1);
-    two_row_shuffle_params = ShuffleParams(22, 2, 1, 1);
-    four_row_shuffle_params = ShuffleParams(14, 4, 1, 1);
-    eight_row_shuffle_params = ShuffleParams(8, 8, 1, 1);
-  } else {
-    one_row_shuffle_params = ShuffleParams(14, 1, 2, 2);
-    two_row_shuffle_params = ShuffleParams(8, 2, 2, 2);
-    four_row_shuffle_params = ShuffleParams(4, 4, 2, 2);
-    eight_row_shuffle_params = ShuffleParams(2, 8, 2, 2);
-  }
-
-  using conv_multirow_func_t =
-      decltype(
-          &DepthwiseConvHybridMultiRowPerChannel::Run);
-  conv_multirow_func_t conv_multirow_func =
-      DepthwiseConvHybridMultiRowPerChannel::Run;
-  if (stride_width == 2) {
-    conv_multirow_func =
-        DepthwiseConvHybridMultiRowPerChannel::Run;
-  }
-
-  // Allocate maximum memory needed for shuffled input.
-  int8 shuffle_workspace[kDepthwiseConvScratchWorkspaceSize];
-
-  int batch_start = 0;
-  int batch_end = batches;
-  int row_start = 0;
-  int row_end = params.output_height;
-
-  switch (thread_dim) {
-    case 0:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, batches);
-      batch_start = thread_start;
-      batch_end = thread_end;
-      break;
-    case 1:
-      TFLITE_DCHECK_GE(thread_start, 0);
-      TFLITE_DCHECK_LE(thread_end, params.output_height);
-      row_start = thread_start;
-      row_end = thread_end;
-      break;
-  }
-
-  for (int32 b = batch_start; b < batch_end; ++b) {
-    // input_ptr and output_ptr point to the start of each batch
-    const int8* input_ptr = input_data + b * input_batch_size;
-    float* output_ptr = output_data + b * output_batch_size;
-    params.input_offset = -input_offsets[b];
-    int32 out_x = 0;
-    int32 out_y = row_start;
-    int32 end_x = params.output_width;
-    int32 end_y = row_end;
-    if (pad_width == 1 && pad_height == 1) {
-      DepthwiseConvHybridHandlePaddingPerChannel(
-          input_scales + b, input_ptr, filter_data,
-          bias_data, output_ptr, per_channel_scales, params);
-
-      // Update extents now that the edges have been handled.
-      out_x = 1;
-      end_x = params.output_width - 1;
-      out_y = std::max(1, out_y);
-      end_y = std::min(params.output_height - 1, end_y);
-    }
-
-    // pad_width and pad_height can both be 0 or 1, depending on padding option,
-    // such as Padding_VALID / Padding_SAME.
-    const int in_x = (out_x * stride_width) - pad_width;
-    const int in_y = (out_y * stride_height) - pad_height;
-
-    // input_ptr and output_ptr point to (in_y, in_x) and (out_y, out_x),
-    // respectively. (in_y, in_x) and (out_y, out_x) change along with
-    // row_start.
-    input_ptr += in_y * params.input_row_size + in_x * params.input_depth;
-    output_ptr += out_y * params.output_row_size + out_x * params.output_depth;
-
-    // Shuffling shapes that maximize width over the shuffle workspace size
-    // perform better since the inputs are closer together, minimizing
-    // shuffling time.
-    //
-    // If the input shape has width large enough for the 2 row kernels,
-    // we prefer to use this. The innermost loop of the kernels handle
-    // 2 height x 2 width so this is the fastest path.
-    //
-    // If the input shape has smaller width but larger height, shuffling is
-    // still useful and can benefit from kernels 4 row and 8 row kernels.
-
-    // Handle 8 rows at a time.
-    if (params.input_width < four_row_shuffle_params.input_width) {
-      for (; out_y <= end_y - 8; out_y += 8) {
-        conv_multirow_func(input_scales + b, input_ptr,
-                           out_x, end_x, filter_data, bias_data, output_ptr,
-                           per_channel_scales, params, eight_row_shuffle_params,
-                           shuffle_workspace);
-        input_ptr += 8 * stride_height * params.input_row_size;
-        output_ptr += 8 * params.output_row_size;
-      }
-    }
-
-    // Handle 4 rows at a time.
-    if (params.input_width < two_row_shuffle_params.input_width) {
-      for (; out_y <= end_y - 4; out_y += 4) {
-        conv_multirow_func(input_scales + b, input_ptr,
-                           out_x, end_x, filter_data, bias_data, output_ptr,
-                           per_channel_scales, params, four_row_shuffle_params,
-                           shuffle_workspace);
-        input_ptr += 4 * stride_height * params.input_row_size;
-        output_ptr += 4 * params.output_row_size;
-      }
-    }
-
-    // Handle 2 rows at a time.
-    for (; out_y <= end_y - 2; out_y += 2) {
-      conv_multirow_func(input_scales + b, input_ptr,
-                         out_x, end_x, filter_data, bias_data, output_ptr,
-                         per_channel_scales, params, two_row_shuffle_params,
-                         shuffle_workspace);
-      input_ptr += 2 * stride_height * params.input_row_size;
-      output_ptr += 2 * params.output_row_size;
-    }
-    // Handle one row at a time.
-    for (; out_y < end_y; out_y++) {
-      conv_multirow_func(input_scales + b, input_ptr,
-                         out_x, end_x, filter_data, bias_data, output_ptr,
-                         per_channel_scales, params, one_row_shuffle_params,
-                         shuffle_workspace);
-      input_ptr += stride_height * params.input_row_size;
-      output_ptr += params.output_row_size;
-    }
-  }
-}
-#endif  // __aarch64__
-
-#undef STR
-#undef STR_UNEXPANDED
-
-}  // namespace depthwise_conv
-}  // namespace optimized_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_DEPTHWISE_CONV_HYBRID_3X3_FILTER_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/fully_connected.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/fully_connected.h
deleted file mode 100644
index d234c5b..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/fully_connected.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_FULLY_CONNECTED_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_FULLY_CONNECTED_H_
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
-#include "tensorflow/lite/kernels/internal/common.h"
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-#include "tensorflow/lite/kernels/internal/reference/integer_ops/fully_connected.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_integer_ops {
-
-inline void FullyConnected(
-    const FullyConnectedParams& params, const RuntimeShape& input_shape,
-    const int8* input_data, const RuntimeShape& filter_shape,
-    const int8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape, int8* output_data,
-    CpuBackendContext* cpu_backend_context) {
-  ruy::profiler::ScopeLabel label("FullyConnectedInt8/8bit");
-
-  const int32 input_offset = params.input_offset;
-  const int32 filter_offset = params.weights_offset;
-  const int32 output_offset = params.output_offset;
-  const int32 output_multiplier = params.output_multiplier;
-  const int output_shift = params.output_shift;
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  TFLITE_DCHECK_GE(filter_shape.DimensionsCount(), 2);
-  TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1);
-  // TODO(benoitjacob): This really should be:
-  //     const int batches = ArraySize(output_dims, 1);
-  // but the current --variable_batch hack consists in overwriting the 3rd
-  // dimension with the runtime batch size, as we don't keep track for each
-  // array of which dimension is the batch dimension in it.
-  const int output_dim_count = output_shape.DimensionsCount();
-  const int filter_dim_count = filter_shape.DimensionsCount();
-  const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1);
-  const int filter_rows = filter_shape.Dims(filter_dim_count - 2);
-  const int filter_cols = filter_shape.Dims(filter_dim_count - 1);
-  TFLITE_DCHECK_EQ(filter_shape.FlatSize(), filter_rows * filter_cols);
-  const int output_rows = output_shape.Dims(output_dim_count - 1);
-  TFLITE_DCHECK_EQ(output_rows, filter_rows);
-  if (bias_data) {
-    TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_rows);
-  }
-
-  cpu_backend_gemm::MatrixParams lhs_params;
-  lhs_params.rows = filter_rows;
-  lhs_params.cols = filter_cols;
-  lhs_params.order = cpu_backend_gemm::Order::kRowMajor;
-  lhs_params.zero_point = -filter_offset;
-  cpu_backend_gemm::MatrixParams rhs_params;
-  rhs_params.rows = filter_cols;
-  rhs_params.cols = batches;
-  rhs_params.order = cpu_backend_gemm::Order::kColMajor;
-  rhs_params.zero_point = -input_offset;
-  cpu_backend_gemm::MatrixParams dst_params;
-  dst_params.rows = filter_rows;
-  dst_params.cols = batches;
-  dst_params.order = cpu_backend_gemm::Order::kColMajor;
-  dst_params.zero_point = output_offset;
-  cpu_backend_gemm::GemmParams gemm_params;
-  gemm_params.bias = bias_data;
-  gemm_params.clamp_min = output_activation_min;
-  gemm_params.clamp_max = output_activation_max;
-  gemm_params.multiplier_fixedpoint = output_multiplier;
-  gemm_params.multiplier_exponent = output_shift;
-  cpu_backend_gemm::Gemm(lhs_params, filter_data, rhs_params, input_data,
-                         dst_params, output_data, gemm_params,
-                         cpu_backend_context);
-}
-
-}  // namespace optimized_integer_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_FULLY_CONNECTED_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/mean.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/mean.h
deleted file mode 100644
index b2ccef7..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/mean.h
+++ /dev/null
@@ -1,249 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_MEAN_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_MEAN_H_
-
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_threadpool.h"
-#include "tensorflow/lite/kernels/internal/common.h"
-#include "tensorflow/lite/kernels/internal/optimized/optimized_ops.h"
-
-namespace tflite {
-namespace optimized_integer_ops {
-
-inline void MeanImpl(const tflite::MeanParams& op_params,
-                     const RuntimeShape& input_shape, const int8_t* input_data,
-                     int32 multiplier, int32 shift, int32 bias,
-                     const RuntimeShape& output_shape, int8_t* output_data,
-                     int start_depth, int end_depth) {
-  ruy::profiler::ScopeLabel label("Mean4D/Int8/MeanImpl");
-
-  // Current implementation only supports dimension equals 4 and simultaneous
-  // reduction over width and height.
-  const int output_batch = output_shape.Dims(0);
-  const int output_height = output_shape.Dims(2);
-  const int output_width = output_shape.Dims(2);
-  const int input_height = input_shape.Dims(1);
-  const int input_width = input_shape.Dims(2);
-
-  TFLITE_CHECK_EQ(op_params.axis_count, 2);
-  TFLITE_CHECK((op_params.axis[0] == 1 && op_params.axis[1] == 2) ||
-               (op_params.axis[0] == 2 && op_params.axis[1] == 1));
-  TFLITE_CHECK_EQ(output_height, 1);
-  TFLITE_CHECK_EQ(output_width, 1);
-
-  constexpr static int32_t kMinValue = std::numeric_limits::min();
-  constexpr static int32_t kMaxValue = std::numeric_limits::max();
-
-#ifdef USE_NEON
-  const int32x4_t bias_dup = vdupq_n_s32(bias);
-  const int32x4_t min_dup = vdupq_n_s32(kMinValue);
-  const int32x4_t max_dup = vdupq_n_s32(kMaxValue);
-#endif  // USE_NEON
-  for (int out_b = 0; out_b < output_batch; ++out_b) {
-    int out_d = start_depth;
-#ifdef USE_NEON
-
-    for (; out_d <= end_depth - 16; out_d += 16) {
-      int32x4x4_t temp_sum;
-      temp_sum.val[0] = vdupq_n_s32(0);
-      temp_sum.val[1] = vdupq_n_s32(0);
-      temp_sum.val[2] = vdupq_n_s32(0);
-      temp_sum.val[3] = vdupq_n_s32(0);
-      for (int in_h = 0; in_h < input_height; ++in_h) {
-        for (int in_w = 0; in_w < input_width; ++in_w) {
-          const int8_t* input_data_ptr =
-              input_data + Offset(input_shape, out_b, in_h, in_w, out_d);
-          int8x16_t input_data_val = vld1q_s8(input_data_ptr);
-
-          int16x8_t input_data_low_shift =
-              vmovl_s8(vget_low_s8(input_data_val));
-          int16x8_t input_data_high_shift =
-              vmovl_s8(vget_high_s8(input_data_val));
-
-          int32x4_t input_low_low =
-              vmovl_s16(vget_low_s16(input_data_low_shift));
-          int32x4_t input_high_low =
-              vmovl_s16(vget_high_s16(input_data_low_shift));
-          int32x4_t input_low_high =
-              vmovl_s16(vget_low_s16(input_data_high_shift));
-          int32x4_t input_high_high =
-              vmovl_s16(vget_high_s16(input_data_high_shift));
-
-          temp_sum.val[0] = vaddq_s32(temp_sum.val[0], input_low_low);
-          temp_sum.val[1] = vaddq_s32(temp_sum.val[1], input_high_low);
-          temp_sum.val[2] = vaddq_s32(temp_sum.val[2], input_low_high);
-          temp_sum.val[3] = vaddq_s32(temp_sum.val[3], input_high_high);
-        }
-      }
-
-      temp_sum = optimized_ops::MultiplyByQuantizedMultiplier4Rows(
-          temp_sum, multiplier, shift);
-
-      temp_sum.val[0] = vaddq_s32(temp_sum.val[0], bias_dup);
-      temp_sum.val[1] = vaddq_s32(temp_sum.val[1], bias_dup);
-      temp_sum.val[2] = vaddq_s32(temp_sum.val[2], bias_dup);
-      temp_sum.val[3] = vaddq_s32(temp_sum.val[3], bias_dup);
-
-      temp_sum.val[0] = vminq_s32(vmaxq_s32(temp_sum.val[0], min_dup), max_dup);
-      temp_sum.val[1] = vminq_s32(vmaxq_s32(temp_sum.val[1], min_dup), max_dup);
-      temp_sum.val[2] = vminq_s32(vmaxq_s32(temp_sum.val[2], min_dup), max_dup);
-      temp_sum.val[3] = vminq_s32(vmaxq_s32(temp_sum.val[3], min_dup), max_dup);
-
-      int16x4_t narrowed_low_low = vmovn_s32(temp_sum.val[0]);
-      int16x4_t narrowed_high_low = vmovn_s32(temp_sum.val[1]);
-      int16x4_t narrowed_low_high = vmovn_s32(temp_sum.val[2]);
-      int16x4_t narrowed_high_high = vmovn_s32(temp_sum.val[3]);
-
-      int16x8_t combined_low =
-          vcombine_s16(narrowed_low_low, narrowed_high_low);
-      int16x8_t combined_high =
-          vcombine_s16(narrowed_low_high, narrowed_high_high);
-
-      int8x8_t narrowed_low = vmovn_s16(combined_low);
-      int8x8_t narrowed_high = vmovn_s16(combined_high);
-
-      int8x16_t combined_output = vcombine_s8(narrowed_low, narrowed_high);
-
-      int8_t* output_data_ptr =
-          output_data + Offset(output_shape, out_b, 0, 0, out_d);
-      vst1q_s8(output_data_ptr, combined_output);
-    }
-#endif  // USE_NEON
-
-    for (; out_d < end_depth; ++out_d) {
-      int acc = 0;
-      for (int in_h = 0; in_h < input_height; ++in_h) {
-        for (int in_w = 0; in_w < input_width; ++in_w) {
-          acc += input_data[Offset(input_shape, out_b, in_h, in_w, out_d)];
-        }
-      }
-
-      acc = MultiplyByQuantizedMultiplier(acc, multiplier, shift);
-      acc += bias;
-      acc = std::min(std::max(acc, kMinValue), kMaxValue);
-      output_data[Offset(output_shape, out_b, 0, 0, out_d)] =
-          static_cast(acc);
-    }
-  }
-}
-
-struct MeanWorkerTask : cpu_backend_threadpool::Task {
-  MeanWorkerTask(const tflite::MeanParams& op_params,
-                 const RuntimeShape& input_shape, const int8_t* input_data,
-                 int32 multiplier, int32 shift, int32 bias,
-                 const RuntimeShape& output_shape, int8_t* output_data,
-                 int start_height, int end_height)
-      : op_params(op_params),
-        input_shape(input_shape),
-        input_data(input_data),
-        multiplier(multiplier),
-        shift(shift),
-        bias(bias),
-        output_shape(output_shape),
-        output_data(output_data),
-        start_height(start_height),
-        end_height(end_height) {}
-
-  void Run() override {
-    MeanImpl(op_params, input_shape, input_data, multiplier, shift, bias,
-             output_shape, output_data, start_height, end_height);
-  }
-
- private:
-  const tflite::MeanParams& op_params;
-  const RuntimeShape& input_shape;
-  const int8_t* input_data;
-  int32 multiplier;
-  int32 shift;
-  int32 bias;
-  const RuntimeShape& output_shape;
-  int8_t* output_data;
-  int start_height;
-  int end_height;
-};
-
-inline void Mean(const tflite::MeanParams& op_params,
-                 const RuntimeShape& unextended_input_shape,
-                 const int8_t* input_data, int32 input_zero_point,
-                 float input_scale, const RuntimeShape& unextended_output_shape,
-                 int8_t* output_data, int32 output_zero_point,
-                 float output_scale, CpuBackendContext* cpu_backend_context) {
-  ruy::profiler::ScopeLabel label("Mean4D/Int8");
-  // Current implementation only supports dimension equals 4 and simultaneous
-  // reduction over width and height.
-  TFLITE_CHECK_EQ(unextended_input_shape.DimensionsCount(), 4);
-  TFLITE_CHECK_LE(unextended_output_shape.DimensionsCount(), 4);
-  const RuntimeShape input_shape =
-      RuntimeShape::ExtendedShape(4, unextended_input_shape);
-  const RuntimeShape output_shape =
-      RuntimeShape::ExtendedShape(4, unextended_output_shape);
-  const int output_height = output_shape.Dims(1);
-  const int output_width = output_shape.Dims(2);
-  const int output_depth = output_shape.Dims(3);
-
-  TFLITE_CHECK_EQ(op_params.axis_count, 2);
-  TFLITE_CHECK((op_params.axis[0] == 1 && op_params.axis[1] == 2) ||
-               (op_params.axis[0] == 2 && op_params.axis[1] == 1));
-  TFLITE_CHECK_EQ(output_height, 1);
-  TFLITE_CHECK_EQ(output_width, 1);
-
-  const int input_height = input_shape.Dims(1);
-  const int input_width = input_shape.Dims(2);
-  const float num_elements_in_axis = input_width * input_height;
-
-  int32 bias =
-      output_zero_point -
-      static_cast(input_zero_point * input_scale / output_scale);
-  float real_scale = input_scale / (num_elements_in_axis * output_scale);
-
-  int32 multiplier, shift;
-  QuantizeMultiplier(real_scale, &multiplier, &shift);
-
-  constexpr int kMinDepthPerThread = 8;
-  int thread_count = output_depth / kMinDepthPerThread;
-  thread_count = thread_count > 0 ? thread_count : 1;
-  const int capped_thread_count =
-      std::min(thread_count, cpu_backend_context->max_num_threads());
-
-  if (capped_thread_count == 1) {
-    MeanImpl(op_params, input_shape, input_data, multiplier, shift, bias,
-             output_shape, output_data, 0, output_depth);
-  } else {
-    // Instead parallel for batch, we loop for the output_depth since batch
-    // is typical 1.
-    std::vector tasks;
-    // TODO(b/131746020) don't create new heap allocations every time.
-    // At least we make it a single heap allocation by using reserve().
-    tasks.reserve(capped_thread_count);
-    int depth_start = 0;
-    for (int i = 0; i < capped_thread_count; ++i) {
-      // Try to distribute the tasks as even as possible.
-      int depth_end = depth_start +
-                      (output_depth - depth_start) / (capped_thread_count - i);
-      tasks.emplace_back(op_params, input_shape, input_data, multiplier, shift,
-                         bias, output_shape, output_data, depth_start,
-                         depth_end);
-      depth_start = depth_end;
-    }
-    cpu_backend_threadpool::Execute(tasks.size(), tasks.data(),
-                                    cpu_backend_context);
-  }
-}
-
-}  // namespace optimized_integer_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_MEAN_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/mul.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/mul.h
deleted file mode 100644
index 45c27ab..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/mul.h
+++ /dev/null
@@ -1,266 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_MUL_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_MUL_H_
-
-#include 
-
-#include "fixedpoint/fixedpoint.h"
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/internal/common.h"
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/neon_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/optimized_ops.h"
-#include "tensorflow/lite/kernels/internal/reference/integer_ops/mul.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_integer_ops {
-
-// Element-wise mul that can often be used for inner loop of broadcast Mul as
-// well as the non-broadcast Mul.
-inline void MulElementwise(int size, const ArithmeticParams& params,
-                           const int8* input1_data, const int8* input2_data,
-                           int8* output_data) {
-  ruy::profiler::ScopeLabel label("MulElementwiseInt8/8bit");
-  int i = 0;
-  TFLITE_DCHECK_GT(params.input1_offset, -256);
-  TFLITE_DCHECK_LT(params.input1_offset, 256);
-  TFLITE_DCHECK_GT(params.input2_offset, -256);
-  TFLITE_DCHECK_LT(params.input2_offset, 256);
-  TFLITE_DCHECK_GT(params.output_offset, -256);
-  TFLITE_DCHECK_LT(params.output_offset, 256);
-#ifdef USE_NEON
-  const int16x8_t input1_offset_vector = vdupq_n_s16(params.input1_offset);
-  const int16x8_t input2_offset_vector = vdupq_n_s16(params.input2_offset);
-  const int16x8_t output_offset_vector = vdupq_n_s16(params.output_offset);
-  const auto output_activation_min_vector =
-      vdupq_n_s8(params.quantized_activation_min);
-  const auto output_activation_max_vector =
-      vdupq_n_s8(params.quantized_activation_max);
-  const int left_shift = std::max(0, params.output_shift);
-  const int right_shift = std::max(0, -params.output_shift);
-  const int32x4_t left_shift_vec = vdupq_n_s32(left_shift);
-  for (; i <= size - 16; i += 16) {
-    // We load / store 16 at a time, multiplying as four sets of 4 int32s.
-    const int8x16_t input1_val_original = vld1q_s8(input1_data + i);
-    const int8x16_t input2_val_original = vld1q_s8(input2_data + i);
-
-    const int16x8_t input1_val_s16_high =
-        vmovl_s8(vget_high_s8(input1_val_original));
-    const int16x8_t input1_val_s16_low =
-        vmovl_s8(vget_low_s8(input1_val_original));
-
-    const int16x8_t input2_val_s16_high =
-        vmovl_s8(vget_high_s8(input2_val_original));
-    const int16x8_t input2_val_s16_low =
-        vmovl_s8(vget_low_s8(input2_val_original));
-    const int16x8_t input1_val_high =
-        vaddq_s16(input1_val_s16_high, input1_offset_vector);
-    const int16x8_t input2_val_high =
-        vaddq_s16(input2_val_s16_high, input2_offset_vector);
-    const int16x8_t input1_val_low =
-        vaddq_s16(input1_val_s16_low, input1_offset_vector);
-    const int16x8_t input2_val_low =
-        vaddq_s16(input2_val_s16_low, input2_offset_vector);
-    const int16x4_t input1_val_high_high = vget_high_s16(input1_val_high);
-    const int16x4_t input1_val_high_low = vget_low_s16(input1_val_high);
-    const int16x4_t input1_val_low_high = vget_high_s16(input1_val_low);
-    const int16x4_t input1_val_low_low = vget_low_s16(input1_val_low);
-    const int16x4_t input2_val_high_high = vget_high_s16(input2_val_high);
-    const int16x4_t input2_val_high_low = vget_low_s16(input2_val_high);
-    const int16x4_t input2_val_low_high = vget_high_s16(input2_val_low);
-    const int16x4_t input2_val_low_low = vget_low_s16(input2_val_low);
-
-    auto p1 = vmull_s16(input2_val_high_high, input1_val_high_high);
-    auto p2 = vmull_s16(input2_val_high_low, input1_val_high_low);
-    auto p3 = vmull_s16(input2_val_low_high, input1_val_low_high);
-    auto p4 = vmull_s16(input2_val_low_low, input1_val_low_low);
-
-    p1 = vshlq_s32(p1, left_shift_vec);
-    p2 = vshlq_s32(p2, left_shift_vec);
-    p3 = vshlq_s32(p3, left_shift_vec);
-    p4 = vshlq_s32(p4, left_shift_vec);
-
-    p1 = vqrdmulhq_n_s32(p1, params.output_multiplier);
-    p2 = vqrdmulhq_n_s32(p2, params.output_multiplier);
-    p3 = vqrdmulhq_n_s32(p3, params.output_multiplier);
-    p4 = vqrdmulhq_n_s32(p4, params.output_multiplier);
-    using gemmlowp::RoundingDivideByPOT;
-    p1 = RoundingDivideByPOT(p1, right_shift);
-    p2 = RoundingDivideByPOT(p2, right_shift);
-    p3 = RoundingDivideByPOT(p3, right_shift);
-    p4 = RoundingDivideByPOT(p4, right_shift);
-
-    const auto p1_narrowed = vqmovn_s32(p1);
-    const auto p2_narrowed = vqmovn_s32(p2);
-    const auto p3_narrowed = vqmovn_s32(p3);
-    const auto p4_narrowed = vqmovn_s32(p4);
-
-    const int16x8_t p_part1 =
-        vaddq_s16(vcombine_s16(p2_narrowed, p1_narrowed), output_offset_vector);
-    const int16x8_t p_part2 =
-        vaddq_s16(vcombine_s16(p4_narrowed, p3_narrowed), output_offset_vector);
-    const int8x16_t p = vcombine_s8(vqmovn_s16(p_part2), vqmovn_s16(p_part1));
-
-    const auto clamped = vmaxq_s8(output_activation_min_vector,
-                                  vminq_s8(output_activation_max_vector, p));
-    vst1q_s8(output_data + i, clamped);
-  }
-#endif  // NEON
-
-  for (; i < size; ++i) {
-    const int32 input1_val = params.input1_offset + input1_data[i];
-    const int32 input2_val = params.input2_offset + input2_data[i];
-    const int32 unclamped_result =
-        params.output_offset +
-        MultiplyByQuantizedMultiplier(input1_val * input2_val,
-                                      params.output_multiplier,
-                                      params.output_shift);
-    const int32 clamped_output =
-        std::min(params.quantized_activation_max,
-                 std::max(params.quantized_activation_min, unclamped_result));
-    output_data[i] = static_cast(clamped_output);
-  }
-}
-
-// Broadcast mul that can often be used for inner loop of broadcast Mul.
-inline void MulSimpleBroadcast(int size, const ArithmeticParams& params,
-                               const int8 broadcast_value,
-                               const int8* input2_data, int8* output_data) {
-  ruy::profiler::ScopeLabel label("BroadMulSimpleBroadcastInt8/8bit");
-  const int16 input1_val = params.input1_offset + broadcast_value;
-
-  int i = 0;
-  TFLITE_DCHECK_GT(params.input1_offset, -256);
-  TFLITE_DCHECK_LT(params.input1_offset, 256);
-  TFLITE_DCHECK_GT(params.input2_offset, -256);
-  TFLITE_DCHECK_LT(params.input2_offset, 256);
-  TFLITE_DCHECK_GT(params.output_offset, -256);
-  TFLITE_DCHECK_LT(params.output_offset, 256);
-#ifdef USE_NEON
-  const auto input2_offset_vector = vdupq_n_s16(params.input2_offset);
-  const auto output_offset_vector = vdupq_n_s16(params.output_offset);
-  const auto output_activation_min_vector =
-      vdupq_n_s8(params.quantized_activation_min);
-  const auto output_activation_max_vector =
-      vdupq_n_s8(params.quantized_activation_max);
-  const int left_shift = std::max(0, params.output_shift);
-  const int right_shift = std::max(0, -params.output_shift);
-  const int32x4_t left_shift_vec = vdupq_n_s32(left_shift);
-  for (; i <= size - 16; i += 16) {
-    // We load / store 16 at a time, multiplying as four sets of 4 int32s.
-    const auto input2_val_original = vld1q_s8(input2_data + i);
-    const auto input2_val_s16_high =
-        vmovl_s8(vget_high_s8(input2_val_original));
-    const auto input2_val_s16_low = vmovl_s8(vget_low_s8(input2_val_original));
-
-    const auto input2_val_high =
-        vaddq_s16(input2_val_s16_high, input2_offset_vector);
-    const auto input2_val_low =
-        vaddq_s16(input2_val_s16_low, input2_offset_vector);
-
-    const auto input2_val_low_low = vget_low_s16(input2_val_low);
-    const auto input2_val_low_high = vget_high_s16(input2_val_low);
-    const auto input2_val_high_low = vget_low_s16(input2_val_high);
-    const auto input2_val_high_high = vget_high_s16(input2_val_high);
-
-    auto p1 = vmull_n_s16(input2_val_high_high, input1_val);
-    auto p2 = vmull_n_s16(input2_val_high_low, input1_val);
-    auto p3 = vmull_n_s16(input2_val_low_high, input1_val);
-    auto p4 = vmull_n_s16(input2_val_low_low, input1_val);
-
-    p1 = vshlq_s32(p1, left_shift_vec);
-    p2 = vshlq_s32(p2, left_shift_vec);
-    p3 = vshlq_s32(p3, left_shift_vec);
-    p4 = vshlq_s32(p4, left_shift_vec);
-
-    p1 = vqrdmulhq_n_s32(p1, params.output_multiplier);
-    p2 = vqrdmulhq_n_s32(p2, params.output_multiplier);
-    p3 = vqrdmulhq_n_s32(p3, params.output_multiplier);
-    p4 = vqrdmulhq_n_s32(p4, params.output_multiplier);
-    using gemmlowp::RoundingDivideByPOT;
-    p1 = RoundingDivideByPOT(p1, right_shift);
-    p2 = RoundingDivideByPOT(p2, right_shift);
-    p3 = RoundingDivideByPOT(p3, right_shift);
-    p4 = RoundingDivideByPOT(p4, right_shift);
-
-    const auto p1_narrowed = vqmovn_s32(p1);
-    const auto p2_narrowed = vqmovn_s32(p2);
-    const auto p3_narrowed = vqmovn_s32(p3);
-    const auto p4_narrowed = vqmovn_s32(p4);
-
-    const int16x8_t p_part1 =
-        vaddq_s16(vcombine_s16(p2_narrowed, p1_narrowed), output_offset_vector);
-    const int16x8_t p_part2 =
-        vaddq_s16(vcombine_s16(p4_narrowed, p3_narrowed), output_offset_vector);
-    const int8x16_t p = vcombine_s8(vqmovn_s16(p_part2), vqmovn_s16(p_part1));
-
-    const auto clamped = vmaxq_s8(output_activation_min_vector,
-                                  vminq_s8(output_activation_max_vector, p));
-    vst1q_s8(output_data + i, clamped);
-  }
-#endif  // NEON
-
-  for (; i < size; ++i) {
-    const int32 input2_val = params.input2_offset + input2_data[i];
-    const int32 unclamped_result =
-        params.output_offset +
-        MultiplyByQuantizedMultiplier(input1_val * input2_val,
-                                      params.output_multiplier,
-                                      params.output_shift);
-    const int32 clamped_output =
-        std::min(params.quantized_activation_max,
-                 std::max(params.quantized_activation_min, unclamped_result));
-    output_data[i] = static_cast(clamped_output);
-  }
-}
-
-inline void Mul(const ArithmeticParams& params,
-                const RuntimeShape& input1_shape, const int8* input1_data,
-                const RuntimeShape& input2_shape, const int8* input2_data,
-                const RuntimeShape& output_shape, int8* output_data) {
-  TFLITE_DCHECK_LE(params.quantized_activation_min,
-                   params.quantized_activation_max);
-  ruy::profiler::ScopeLabel label("MulInt8/8bit");
-  const int flat_size =
-      MatchingElementsSize(input1_shape, input2_shape, output_shape);
-
-  MulElementwise(flat_size, params, input1_data, input2_data, output_data);
-}
-
-inline void BroadcastMulDispatch(const ArithmeticParams& params,
-                                 const RuntimeShape& input1_shape,
-                                 const int8* input1_data,
-                                 const RuntimeShape& input2_shape,
-                                 const int8* input2_data,
-                                 const RuntimeShape& output_shape,
-                                 int8* output_data) {
-  if (params.broadcast_category == BroadcastableOpCategory::kGenericBroadcast) {
-    return reference_integer_ops::BroadcastMul4DSlow(
-        params, input1_shape, input1_data, input2_shape, input2_data,
-        output_shape, output_data);
-  }
-
-  optimized_ops::BinaryBroadcastFiveFold(
-      params, input1_shape, input1_data, input2_shape, input2_data,
-      output_shape, output_data, MulElementwise, MulSimpleBroadcast);
-}
-
-}  // namespace optimized_integer_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_MUL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/pooling.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/pooling.h
deleted file mode 100644
index dfe8bd9..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/pooling.h
+++ /dev/null
@@ -1,303 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_POOLING_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_POOLING_H_
-
-#include 
-
-#include 
-
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-#include "tensorflow/lite/kernels/internal/cppmath.h"
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/im2col_utils.h"
-#include "tensorflow/lite/kernels/internal/optimized/neon_check.h"
-#include "tensorflow/lite/kernels/internal/quantization_util.h"
-#include "tensorflow/lite/kernels/internal/reference/integer_ops/pooling.h"
-#include "tensorflow/lite/kernels/internal/reference/reference_ops.h"
-#include "tensorflow/lite/kernels/internal/strided_slice_logic.h"
-#include "tensorflow/lite/kernels/internal/tensor_utils.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_integer_ops {
-
-inline void MaxPool(const PoolParams& params, const RuntimeShape& input_shape,
-                    const int8* input_data, const RuntimeShape& output_shape,
-                    int8* output_data) {
-  ruy::profiler::ScopeLabel label("MaxPool/8bit");
-
-  // Here, and in other pooling ops, in order to maintain locality of reference,
-  // to minimize some recalculations, and to load into NEON vector registers, we
-  // use an inner loop down the depth. Since depths can be large and hence we
-  // would need arbitrarily large temporary storage, we divide the work up into
-  // depth tranches just within the batch loop.
-  static constexpr int kPoolingAccTrancheSize = 256;
-
-  TFLITE_DCHECK_LE(params.quantized_activation_min,
-                   params.quantized_activation_max);
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-  const int batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int depth = MatchingDim(input_shape, 3, output_shape, 3);
-  const int input_height = input_shape.Dims(1);
-  const int input_width = input_shape.Dims(2);
-  const int output_height = output_shape.Dims(1);
-  const int output_width = output_shape.Dims(2);
-  const int stride_height = params.stride_height;
-  const int stride_width = params.stride_width;
-
-  int8 acc[kPoolingAccTrancheSize];
-  for (int batch = 0; batch < batches; ++batch) {
-    // We proceed through the depth in tranches (see comment above). The
-    // depth_base is the depth at the beginning of the tranche. The
-    // tranche_depth is the depth dimension of the tranche.
-    for (int depth_base = 0; depth_base < depth;
-         depth_base += kPoolingAccTrancheSize) {
-      const int tranche_depth =
-          std::min(depth - depth_base, kPoolingAccTrancheSize);
-      for (int out_y = 0; out_y < output_height; ++out_y) {
-        for (int out_x = 0; out_x < output_width; ++out_x) {
-          const int in_x_origin =
-              (out_x * stride_width) - params.padding_values.width;
-          const int in_y_origin =
-              (out_y * stride_height) - params.padding_values.height;
-          const int filter_x_start = std::max(0, -in_x_origin);
-          const int filter_x_end =
-              std::min(params.filter_width, input_width - in_x_origin);
-          const int filter_y_start = std::max(0, -in_y_origin);
-          const int filter_y_end =
-              std::min(params.filter_height, input_height - in_y_origin);
-          memset(acc, params.quantized_activation_min,
-                 tranche_depth * sizeof(acc[0]));
-          const int8* input_ptr =
-              input_data + depth_base +
-              depth * (in_x_origin +
-                       input_width * (in_y_origin + input_height * batch));
-          for (int fy = filter_y_start; fy < filter_y_end; fy++) {
-            const int8* input_row_ptr =
-                input_ptr + depth * (fy * input_width + filter_x_start);
-            for (int fx = filter_x_start; fx < filter_x_end; fx++) {
-              const int8* input_channel_ptr = input_row_ptr;
-              int channel = 0;
-#ifdef USE_NEON
-              for (; channel <= tranche_depth - 16; channel += 16) {
-                int8x16_t acc_reg = vld1q_s8(acc + channel);
-                int8x16_t input_reg = vld1q_s8(input_channel_ptr);
-                input_channel_ptr += 16;
-                acc_reg = vmaxq_s8(acc_reg, input_reg);
-                vst1q_s8(acc + channel, acc_reg);
-              }
-
-              for (; channel <= tranche_depth - 8; channel += 8) {
-                int8x8_t acc_reg = vld1_s8(acc + channel);
-                int8x8_t input_reg = vld1_s8(input_channel_ptr);
-                input_channel_ptr += 8;
-                acc_reg = vmax_s8(acc_reg, input_reg);
-                vst1_s8(acc + channel, acc_reg);
-              }
-#endif
-              for (; channel < tranche_depth; ++channel) {
-                acc[channel] = std::max(acc[channel], *input_channel_ptr++);
-              }
-              input_row_ptr += depth;
-            }
-          }
-          int8* output_ptr = output_data + Offset(output_shape, batch, out_y,
-                                                  out_x, depth_base);
-          int channel = 0;
-#ifdef USE_NEON
-          for (; channel <= tranche_depth - 16; channel += 16) {
-            int8x16_t a = vld1q_s8(acc + channel);
-            a = vminq_s8(a, vdupq_n_s8(params.quantized_activation_max));
-            a = vmaxq_s8(a, vdupq_n_s8(params.quantized_activation_min));
-            vst1q_s8(output_ptr + channel, a);
-          }
-          for (; channel <= tranche_depth - 8; channel += 8) {
-            int8x8_t a = vld1_s8(acc + channel);
-            a = vmin_s8(a, vdup_n_s8(params.quantized_activation_max));
-            a = vmax_s8(a, vdup_n_s8(params.quantized_activation_min));
-            vst1_s8(output_ptr + channel, a);
-          }
-#endif
-          for (; channel < tranche_depth; ++channel) {
-            int8 a = acc[channel];
-            a = std::max(a, params.quantized_activation_min);
-            a = std::min(a, params.quantized_activation_max);
-            output_ptr[channel] = static_cast(a);
-          }
-        }
-      }
-    }
-  }
-}
-
-inline bool AveragePool16(const PoolParams& params,
-                          const RuntimeShape& input_shape,
-                          const int8* input_data,
-                          const RuntimeShape& output_shape, int8* output_data) {
-  ruy::profiler::ScopeLabel label("AveragePool/8bitWith16bitAccumulator");
-
-  // Here, and in other pooling ops, in order to maintain locality of reference,
-  // to minimize some recalculations, and to load into NEON vector registers, we
-  // use an inner loop down the depth. Since depths can be large and hence we
-  // would need arbitrarily large temporary storage, we divide the work up into
-  // depth tranches just within the batch loop.
-  static constexpr int kPoolingAccTrancheSize = 256;
-
-  TFLITE_DCHECK_LE(params.quantized_activation_min,
-                   params.quantized_activation_max);
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-  const int batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int depth = MatchingDim(input_shape, 3, output_shape, 3);
-  const int input_height = input_shape.Dims(1);
-  const int input_width = input_shape.Dims(2);
-  const int output_height = output_shape.Dims(1);
-  const int output_width = output_shape.Dims(2);
-  const int stride_height = params.stride_height;
-  const int stride_width = params.stride_width;
-
-  int16 acc[kPoolingAccTrancheSize];
-  for (int batch = 0; batch < batches; ++batch) {
-    // We proceed through the depth in tranches (see comment above). The
-    // depth_base is the depth at the beginning of the tranche. The
-    // tranche_depth is the depth dimension of the tranche.
-    for (int depth_base = 0; depth_base < depth;
-         depth_base += kPoolingAccTrancheSize) {
-      const int tranche_depth =
-          std::min(depth - depth_base, kPoolingAccTrancheSize);
-      for (int out_y = 0; out_y < output_height; ++out_y) {
-        for (int out_x = 0; out_x < output_width; ++out_x) {
-          const int in_x_origin =
-              (out_x * stride_width) - params.padding_values.width;
-          const int in_y_origin =
-              (out_y * stride_height) - params.padding_values.height;
-          const int filter_x_start = std::max(0, -in_x_origin);
-          const int filter_x_end =
-              std::min(params.filter_width, input_width - in_x_origin);
-          const int filter_y_start = std::max(0, -in_y_origin);
-          const int filter_y_end =
-              std::min(params.filter_height, input_height - in_y_origin);
-          const int filter_count =
-              (filter_x_end - filter_x_start) * (filter_y_end - filter_y_start);
-          if (filter_count == 0) return false;
-          memset(acc, 0, tranche_depth * sizeof(acc[0]));
-          const int8* input_ptr =
-              input_data + depth_base +
-              depth * (in_x_origin +
-                       input_width * (in_y_origin + input_height * batch));
-          for (int fy = filter_y_start; fy < filter_y_end; fy++) {
-            const int8* input_row_ptr =
-                input_ptr + depth * (fy * input_width + filter_x_start);
-            for (int fx = filter_x_start; fx < filter_x_end; fx++) {
-              const int8* input_channel_ptr = input_row_ptr;
-              int channel = 0;
-#ifdef USE_NEON
-              for (; channel <= tranche_depth - 16; channel += 16) {
-                int16x8_t acc_reg[2];
-                for (int i = 0; i < 2; i++) {
-                  acc_reg[i] = vld1q_s16(acc + channel + 8 * i);
-                }
-                int8x16_t input_reg = vld1q_s8(input_channel_ptr);
-                input_channel_ptr += 16;
-                acc_reg[0] = vaddw_s8(acc_reg[0], vget_low_s8(input_reg));
-                acc_reg[1] = vaddw_s8(acc_reg[1], vget_high_s8(input_reg));
-                for (int i = 0; i < 2; i++) {
-                  vst1q_s16(acc + channel + 8 * i, acc_reg[i]);
-                }
-              }
-              for (; channel <= tranche_depth - 8; channel += 8) {
-                int16x8_t acc_reg = vld1q_s16(acc + channel);
-                int8x8_t input_reg = vld1_s8(input_channel_ptr);
-                input_channel_ptr += 8;
-                acc_reg = vaddw_s8(acc_reg, input_reg);
-                vst1q_s16(acc + channel, acc_reg);
-              }
-#endif
-              for (; channel < tranche_depth; ++channel) {
-                acc[channel] += *input_channel_ptr++;
-              }
-              input_row_ptr += depth;
-            }
-          }
-          int8* output_ptr = output_data + Offset(output_shape, batch, out_y,
-                                                  out_x, depth_base);
-          int channel = 0;
-#ifdef USE_NEON
-#define AVGPOOL_DIVIDING_BY(FILTER_COUNT)                                    \
-  if (filter_count == FILTER_COUNT) {                                        \
-    for (; channel <= tranche_depth - 8; channel += 8) {                     \
-      int16 buf[8];                                                          \
-      for (int i = 0; i < 8; i++) {                                          \
-        buf[i] = acc[channel + i] > 0                                        \
-                     ? (acc[channel + i] + FILTER_COUNT / 2) / FILTER_COUNT  \
-                     : (acc[channel + i] - FILTER_COUNT / 2) / FILTER_COUNT; \
-      }                                                                      \
-      int8x8_t buf8 = vqmovn_s16(vld1q_s16(buf));                            \
-      buf8 = vmin_s8(buf8, vdup_n_s8(params.quantized_activation_max));      \
-      buf8 = vmax_s8(buf8, vdup_n_s8(params.quantized_activation_min));      \
-      vst1_s8(output_ptr + channel, buf8);                                   \
-    }                                                                        \
-  }
-          AVGPOOL_DIVIDING_BY(9)
-          AVGPOOL_DIVIDING_BY(15)
-#undef AVGPOOL_DIVIDING_BY
-          for (; channel <= tranche_depth - 8; channel += 8) {
-            int16 buf[8];
-            for (int i = 0; i < 8; i++) {
-              buf[i] =
-                  acc[channel + i] > 0
-                      ? (acc[channel + i] + filter_count / 2) / filter_count
-                      : (acc[channel + i] - filter_count / 2) / filter_count;
-            }
-            int8x8_t buf8 = vqmovn_s16(vld1q_s16(buf));
-            buf8 = vmin_s8(buf8, vdup_n_s8(params.quantized_activation_max));
-            buf8 = vmax_s8(buf8, vdup_n_s8(params.quantized_activation_min));
-            vst1_s8(output_ptr + channel, buf8);
-          }
-#endif
-          for (; channel < tranche_depth; ++channel) {
-            int16 a = acc[channel] > 0
-                          ? (acc[channel] + filter_count / 2) / filter_count
-                          : (acc[channel] - filter_count / 2) / filter_count;
-            a = std::max(a, params.quantized_activation_min);
-            a = std::min(a, params.quantized_activation_max);
-            output_ptr[channel] = static_cast(a);
-          }
-        }
-      }
-    }
-  }
-  return true;
-}
-
-inline bool AveragePool(const PoolParams& params,
-                        const RuntimeShape& input_shape, const int8* input_data,
-                        const RuntimeShape& output_shape, int8* output_data) {
-  if (params.filter_height * params.filter_width > 16 * 16) {
-    return reference_integer_ops::AveragePool(params, input_shape, input_data,
-                                              output_shape, output_data);
-  } else {
-    return AveragePool16(params, input_shape, input_data, output_shape,
-                         output_data);
-  }
-}
-
-}  // namespace optimized_integer_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_POOLING_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/transpose_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/transpose_conv.h
deleted file mode 100644
index 36519dd..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/integer_ops/transpose_conv.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_TRANSPOSE_CONV_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_TRANSPOSE_CONV_H_
-
-#include "tensorflow/lite/kernels/internal/optimized/optimized_ops.h"
-
-namespace tflite {
-namespace optimized_integer_ops {
-
-// TransposeConvV2 expect the weights in HWOI order.
-inline void TransposeConvV2(
-    const ConvParams& params, const int32* output_multiplier,
-    const int32* output_shift, const RuntimeShape& input_shape,
-    const int8_t* input_data, const RuntimeShape& hwoi_ordered_filter_shape,
-    const int8_t* hwoi_ordered_filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape,
-    int8_t* output_data, const RuntimeShape& col2im_shape, int32_t* col2im_data,
-    int32_t* scratch_data, CpuBackendContext* cpu_backend_context) {
-  ruy::profiler::ScopeLabel label("TransposeConvV2/int8");
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(hwoi_ordered_filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK(col2im_data);
-  TFLITE_DCHECK(hwoi_ordered_filter_data);
-
-  const int batch_size = MatchingDim(input_shape, 0, output_shape, 0);
-  const int input_image_size = input_shape.Dims(1) * input_shape.Dims(2);
-  const int output_height = output_shape.Dims(1);
-  const int output_width = output_shape.Dims(2);
-  const int output_image_size = output_height * output_width;
-  const int input_depth =
-      MatchingDim(input_shape, 3, hwoi_ordered_filter_shape, 3);
-  const int output_depth =
-      MatchingDim(output_shape, 3, hwoi_ordered_filter_shape, 2);
-  const int input_offset = input_image_size * input_depth;
-  const int output_offset = output_image_size * output_depth;
-
-  const int filter_height = hwoi_ordered_filter_shape.Dims(0);
-  const int filter_width = hwoi_ordered_filter_shape.Dims(1);
-  const int padding_top = params.padding_values.height;
-  const int padding_bottom =
-      params.padding_values.height + params.padding_values.height_offset;
-  const int padding_left = params.padding_values.width;
-  const int padding_right =
-      params.padding_values.width + params.padding_values.width_offset;
-  const int stride_height = params.stride_height;
-  const int stride_width = params.stride_width;
-
-  const int hwoi_ordered_filter_total_size =
-      filter_height * filter_width * output_depth;
-
-  cpu_backend_gemm::MatrixParams lhs_params;
-  lhs_params.order = cpu_backend_gemm::Order::kRowMajor;
-  lhs_params.rows = hwoi_ordered_filter_total_size;
-  lhs_params.cols = input_depth;
-  // Since our weight is symmetric quantized, the zp will always be 0.
-  lhs_params.zero_point = 0;
-
-  int32_t* scratch_data_p = scratch_data;
-  std::fill_n(scratch_data, output_offset * batch_size, static_cast(0));
-  for (int i = 0; i < batch_size; ++i) {
-    cpu_backend_gemm::MatrixParams rhs_params;
-    rhs_params.order = cpu_backend_gemm::Order::kColMajor;
-    rhs_params.rows = input_depth;
-    rhs_params.cols = input_image_size;
-    rhs_params.zero_point = -params.input_offset;
-
-    cpu_backend_gemm::MatrixParams dst_params;
-    dst_params.order = cpu_backend_gemm::Order::kColMajor;
-    dst_params.rows = hwoi_ordered_filter_total_size;
-    dst_params.cols = input_image_size;
-
-    cpu_backend_gemm::GemmParams gemm_params;
-    cpu_backend_gemm::Gemm(lhs_params, hwoi_ordered_filter_data, rhs_params,
-                           input_data + input_offset * i, dst_params,
-                           col2im_data, gemm_params, cpu_backend_context);
-
-    optimized_ops::Col2im(
-        col2im_data, output_depth, output_height, output_width, filter_height,
-        filter_width, padding_top, padding_left, padding_bottom, padding_right,
-        stride_height, stride_width, scratch_data_p);
-
-    scratch_data_p += output_offset;
-  }
-  scratch_data_p = scratch_data;
-  optimized_ops::BiasAdd(scratch_data_p, bias_data, batch_size, output_height,
-                         output_width, output_depth);
-
-  const int32_t output_min = std::numeric_limits::min();
-  const int32_t output_max = std::numeric_limits::max();
-
-  optimized_ops::Quantize(output_multiplier, output_shift, output_depth,
-                          output_shape.FlatSize(), params.output_offset,
-                          output_min, output_max, scratch_data, output_data);
-}
-
-}  // namespace optimized_integer_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_INTEGER_OPS_TRANSPOSE_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/legacy_optimized_ops.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/legacy_optimized_ops.h
deleted file mode 100644
index 0f1c503..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/legacy_optimized_ops.h
+++ /dev/null
@@ -1,4958 +0,0 @@
-/* Copyright 2018 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_KERNELS_INTERNAL_OPTIMIZED_LEGACY_OPTIMIZED_OPS_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_LEGACY_OPTIMIZED_OPS_H_
-
-#include 
-#include 
-
-#include "public/gemmlowp.h"
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/depthwiseconv_multithread.h"
-#include "tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h"
-#include "tensorflow/lite/kernels/internal/optimized/integer_ops/fully_connected.h"
-#include "tensorflow/lite/kernels/internal/optimized/optimized_ops.h"
-#include "tensorflow/lite/kernels/internal/reference/legacy_reference_ops.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace optimized_ops {
-
-// Unoptimized reference ops:
-using reference_ops::ArgMax;
-using reference_ops::ArgMinMax;
-using reference_ops::Broadcast4DSlowGreater;
-using reference_ops::Broadcast4DSlowGreaterEqual;
-using reference_ops::Broadcast4DSlowGreaterEqualWithScaling;
-using reference_ops::Broadcast4DSlowGreaterWithScaling;
-using reference_ops::Broadcast4DSlowLess;
-using reference_ops::Broadcast4DSlowLessEqual;
-using reference_ops::Broadcast4DSlowLessEqualWithScaling;
-using reference_ops::Broadcast4DSlowLessWithScaling;
-using reference_ops::BroadcastAdd4DSlow;
-using reference_ops::BroadcastGreater;
-using reference_ops::BroadcastGreaterEqual;
-using reference_ops::BroadcastLess;
-using reference_ops::BroadcastLessEqual;
-using reference_ops::BroadcastMul4DSlow;
-using reference_ops::BroadcastSubSlow;
-using reference_ops::Concatenation;
-using reference_ops::ConcatenationWithScaling;
-using reference_ops::DepthConcatenation;
-using reference_ops::Div;
-using reference_ops::FakeQuant;
-using reference_ops::Gather;
-using reference_ops::Greater;
-using reference_ops::GreaterEqual;
-using reference_ops::GreaterEqualWithScaling;
-using reference_ops::GreaterWithScaling;
-using reference_ops::Less;
-using reference_ops::LessEqual;
-using reference_ops::LessEqualWithScaling;
-using reference_ops::LessWithScaling;
-using reference_ops::Mean;
-using reference_ops::RankOneSelect;
-using reference_ops::Relu1;
-using reference_ops::Relu6;
-using reference_ops::ReluX;
-using reference_ops::Select;
-using reference_ops::SpaceToBatchND;
-using reference_ops::Split;
-using reference_ops::StridedSlice;
-using reference_ops::TensorFlowSplit;
-
-static constexpr int kDepthwiseReverseShift = -1;
-
-template 
-VectorMap MapAsVector(Scalar* data, const Dims& dims) {
-  const int size = FlatSize(dims);
-  return VectorMap(data, size, 1);
-}
-
-template 
-MatrixMap MapAsMatrixWithFirstDimAsRows(Scalar* data,
-                                                const Dims& dims) {
-  const int rows = dims.sizes[0];
-  int cols = 1;
-  for (int d = 1; d < N; d++) {
-    cols *= dims.sizes[d];
-  }
-  return MatrixMap(data, rows, cols);
-}
-
-template 
-MatrixMap MapAsMatrixWithLastDimAsCols(Scalar* data,
-                                               const Dims& dims) {
-  const int cols = dims.sizes[N - 1];
-  int rows = 1;
-  for (int d = 0; d < N - 1; d++) {
-    rows *= dims.sizes[d];
-  }
-  return MatrixMap(data, rows, cols);
-}
-
-template 
-ArrayMap MapAsArrayWithFirstDimAsRows(Scalar* data,
-                                              const Dims& dims) {
-  const int rows = dims.sizes[0];
-  int cols = 1;
-  for (int d = 1; d < N; d++) {
-    cols *= dims.sizes[d];
-  }
-  return ArrayMap(data, rows, cols);
-}
-
-// TODO(b/62193649): this function is only needed as long
-// as we have the --variable_batch hack.
-template 
-MatrixMap MapAsMatrixWithGivenNumberOfRows(Scalar* data,
-                                                   const Dims& dims,
-                                                   int rows) {
-  const int flatsize = FlatSize(dims);
-  TFLITE_DCHECK((flatsize % rows) == 0);
-  const int cols = flatsize / rows;
-  return MatrixMap(data, rows, cols);
-}
-
-inline bool AreSameDims(const Dims<4>& dims1, const Dims<4>& dims2) {
-  for (int i = 0; i < 4; i++) {
-    if (dims1.sizes[i] != dims2.sizes[i]) {
-      return false;
-    }
-  }
-  return true;
-}
-
-inline void DepthwiseConv(const float* input_data, const Dims<4>& input_dims,
-                          const float* filter_data, const Dims<4>& filter_dims,
-                          const float* bias_data, const Dims<4>& bias_dims,
-                          int stride_width, int stride_height,
-                          int dilation_width_factor, int dilation_height_factor,
-                          int pad_width, int pad_height, int depth_multiplier,
-                          float output_activation_min,
-                          float output_activation_max, float* output_data,
-                          const Dims<4>& output_dims) {
-  tflite::DepthwiseParams op_params;
-  // Padding type is ignored, but still set.
-  op_params.padding_type = PaddingType::kSame;
-  op_params.padding_values.width = pad_width;
-  op_params.padding_values.height = pad_height;
-  op_params.stride_width = stride_width;
-  op_params.stride_height = stride_height;
-  op_params.dilation_width_factor = dilation_width_factor;
-  op_params.dilation_height_factor = dilation_height_factor;
-  op_params.depth_multiplier = depth_multiplier;
-  op_params.float_activation_min = output_activation_min;
-  op_params.float_activation_max = output_activation_max;
-
-  const RuntimeShape output_shape = DimsToShape(output_dims);
-  const int output_height = output_shape.Dims(1);
-
-  DepthwiseConvImpl(op_params, DimsToShape(input_dims), input_data,
-                    DimsToShape(filter_dims), filter_data,
-                    DimsToShape(bias_dims), bias_data, output_shape,
-                    output_data, CpuFlags(), /*thread_start=*/0,
-                    /*thread_end=*/output_height, /*thread_dim=*/1);
-}
-
-inline void DepthwiseConv(const float* input_data, const Dims<4>& input_dims,
-                          const float* filter_data, const Dims<4>& filter_dims,
-                          const float* bias_data, const Dims<4>& bias_dims,
-                          int stride_width, int stride_height, int pad_width,
-                          int pad_height, int depth_multiplier,
-                          float output_activation_min,
-                          float output_activation_max, float* output_data,
-                          const Dims<4>& output_dims) {
-  DepthwiseConv(input_data, input_dims, filter_data, filter_dims, bias_data,
-                bias_dims, stride_width, stride_height, 1, 1, pad_width,
-                pad_height, depth_multiplier, output_activation_min,
-                output_activation_max, output_data, output_dims);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void DepthwiseConv(const float* input_data, const Dims<4>& input_dims,
-                   const float* filter_data, const Dims<4>& filter_dims,
-                   const float* bias_data, const Dims<4>& bias_dims,
-                   int stride_width, int stride_height, int pad_width,
-                   int pad_height, int depth_multiplier, float* output_data,
-                   const Dims<4>& output_dims) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-  DepthwiseConv(input_data, input_dims, filter_data, filter_dims, bias_data,
-                bias_dims, stride_width, stride_height, pad_width, pad_height,
-                depth_multiplier, output_activation_min, output_activation_max,
-                output_data, output_dims);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void DepthwiseConv(const float* input_data, const Dims<4>& input_dims,
-                   const float* filter_data, const Dims<4>& filter_dims,
-                   const float* bias_data, const Dims<4>& bias_dims, int stride,
-                   int pad_width, int pad_height, int depth_multiplier,
-                   float* output_data, const Dims<4>& output_dims) {
-  DepthwiseConv(input_data, input_dims, filter_data, filter_dims, bias_data,
-                    bias_dims, stride, stride, pad_width, pad_height,
-                    depth_multiplier, output_data, output_dims);
-}
-
-template 
-inline void LegacyDepthwiseConvWithRounding(
-    const DepthwiseParams& params, const RuntimeShape& input_shape,
-    const uint8* input_data, const RuntimeShape& filter_shape,
-    const uint8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape,
-    uint8* output_data, int thread_start, int thread_end, int thread_dim) {
-  ruy::profiler::ScopeLabel label("DepthwiseConv/8bit");
-  const int depth_multiplier = params.depth_multiplier;
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  TFLITE_DCHECK_GE(dilation_width_factor, 1);
-  TFLITE_DCHECK_GE(dilation_height_factor, 1);
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(output_activation_min, output_activation_max);
-  const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3);
-  const int input_depth = input_shape.Dims(3);
-  TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier);
-  TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth);
-
-// Enable for arm64 except for the Nvidia Linux 4 Tegra (L4T) running on
-// Jetson TX-2. This compiler does not support the offsetof() macro.
-#if defined(__aarch64__) && !defined(GOOGLE_L4T)
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-  const int output_shift = params.output_shift;
-
-  // Call kernel optimized for depthwise convolutions using 3x3 filters if
-  // parameters are supported.
-  if (depthwise_conv::Fast3x3FilterKernelSupported(
-          input_shape, filter_shape, stride_width, stride_height,
-          dilation_width_factor, dilation_height_factor, pad_width, pad_height,
-          depth_multiplier, output_shape, output_shift)) {
-    ruy::profiler::ScopeLabel specialized_label("DepthwiseConv/8bit/3x3");
-    depthwise_conv::DepthwiseConv3x3Filter(
-        params, input_shape, input_data, filter_shape, filter_data, bias_shape,
-        bias_data, output_shape, output_data, thread_start, thread_end,
-        thread_dim);
-    return;
-  }
-#endif
-
-  ruy::profiler::ScopeLabel specialized_label("DepthwiseConv/8bit/General");
-  depthwise_conv::DepthwiseConvGeneral(params, input_shape, input_data,
-                                       filter_shape, filter_data, bias_shape,
-                                       bias_data, output_shape, output_data,
-                                       thread_start, thread_end, thread_dim);
-}
-
-inline void LegacyDepthwiseConvImpl(
-    const DepthwiseParams& params, const RuntimeShape& input_shape,
-    const uint8* input_data, const RuntimeShape& filter_shape,
-    const uint8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape,
-    uint8* output_data, int thread_start, int thread_end, int thread_dim) {
-  return LegacyDepthwiseConvWithRounding<
-      DepthwiseConvOutputRounding::kAwayFromZero>(
-      params, input_shape, input_data, filter_shape, filter_data, bias_shape,
-      bias_data, output_shape, output_data, thread_start, thread_end,
-      thread_dim);
-}
-
-inline void DepthwiseConv(const uint8* input_data, const Dims<4>& input_dims,
-                          int32 input_offset, const uint8* filter_data,
-                          const Dims<4>& filter_dims, int32 filter_offset,
-                          const int32* bias_data, const Dims<4>& bias_dims,
-                          int stride_width, int stride_height,
-                          int dilation_width_factor, int dilation_height_factor,
-                          int pad_width, int pad_height, int depth_multiplier,
-                          int32 output_offset, int32 output_multiplier,
-                          int output_shift, int32 output_activation_min,
-                          int32 output_activation_max, uint8* output_data,
-                          const Dims<4>& output_dims) {
-  tflite::DepthwiseParams op_params;
-  // Padding type is ignored, but still set.
-  op_params.padding_type = PaddingType::kSame;
-  op_params.padding_values.width = pad_width;
-  op_params.padding_values.height = pad_height;
-  op_params.stride_width = stride_width;
-  op_params.stride_height = stride_height;
-  op_params.dilation_width_factor = dilation_width_factor;
-  op_params.dilation_height_factor = dilation_height_factor;
-  op_params.depth_multiplier = depth_multiplier;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-  op_params.input_offset = input_offset;
-  op_params.weights_offset = filter_offset;
-  op_params.output_offset = output_offset;
-  op_params.output_multiplier = output_multiplier;
-  // Legacy ops used mixed left and right shifts. Now all are +ve-means-left.
-  op_params.output_shift = kDepthwiseReverseShift * output_shift;
-
-  const RuntimeShape output_shape = DimsToShape(output_dims);
-  const int output_height = output_shape.Dims(1);
-
-  LegacyDepthwiseConvImpl(
-      op_params, DimsToShape(input_dims), input_data, DimsToShape(filter_dims),
-      filter_data, DimsToShape(bias_dims), bias_data, DimsToShape(output_dims),
-      output_data, /*thread_start=*/0,
-      /*thread_end=*/output_height, /*thread_dim=*/1);
-}
-
-inline void DepthwiseConv(const uint8* input_data, const Dims<4>& input_dims,
-                          int32 input_offset, const uint8* filter_data,
-                          const Dims<4>& filter_dims, int32 filter_offset,
-                          const int32* bias_data, const Dims<4>& bias_dims,
-                          int stride_width, int stride_height, int pad_width,
-                          int pad_height, int depth_multiplier,
-                          int32 output_offset, int32 output_multiplier,
-                          int output_shift, int32 output_activation_min,
-                          int32 output_activation_max, uint8* output_data,
-                          const Dims<4>& output_dims) {
-  DepthwiseConv(input_data, input_dims, input_offset, filter_data, filter_dims,
-                filter_offset, bias_data, bias_dims, stride_width,
-                stride_height, 1, 1, pad_width, pad_height, depth_multiplier,
-                output_offset, output_multiplier, output_shift,
-                output_activation_min, output_activation_max, output_data,
-                output_dims);
-}
-
-// Legacy, for compatibility with old checked-in code.
-template 
-void DepthwiseConv(const uint8* input_data, const Dims<4>& input_dims,
-                   int32 input_offset, const uint8* filter_data,
-                   const Dims<4>& filter_dims, int32 filter_offset,
-                   const int32* bias_data, const Dims<4>& bias_dims,
-                   int stride_width, int stride_height, int pad_width,
-                   int pad_height, int depth_multiplier, int32 output_offset,
-                   int32 output_multiplier, int output_shift,
-                   int32 output_activation_min, int32 output_activation_max,
-                   uint8* output_data, const Dims<4>& output_dims) {
-  if (Ac == FusedActivationFunctionType::kNone) {
-    TFLITE_DCHECK_EQ(output_activation_min, 0);
-    TFLITE_DCHECK_EQ(output_activation_max, 255);
-  }
-  DepthwiseConv(input_data, input_dims, input_offset, filter_data, filter_dims,
-                filter_offset, bias_data, bias_dims, stride_width,
-                stride_height, pad_width, pad_height, depth_multiplier,
-                output_offset, output_multiplier, output_shift,
-                output_activation_min, output_activation_max, output_data,
-                output_dims);
-}
-
-// Legacy, for compatibility with old checked-in code.
-template 
-void DepthwiseConv(const uint8* input_data, const Dims<4>& input_dims,
-                   int32 input_offset, const uint8* filter_data,
-                   const Dims<4>& filter_dims, int32 filter_offset,
-                   const int32* bias_data, const Dims<4>& bias_dims, int stride,
-                   int pad_width, int pad_height, int depth_multiplier,
-                   int32 output_offset, int32 output_multiplier,
-                   int output_shift, int32 output_activation_min,
-                   int32 output_activation_max, uint8* output_data,
-                   const Dims<4>& output_dims) {
-  DepthwiseConv(input_data, input_dims, input_offset, filter_data,
-                    filter_dims, filter_offset, bias_data, bias_dims, stride,
-                    stride, pad_width, pad_height, depth_multiplier,
-                    output_offset, output_multiplier, output_shift,
-                    output_activation_min, output_activation_max, output_data,
-                    output_dims);
-}
-
-template 
-struct LegacyDepthwiseConvWorkerTask : public gemmlowp::Task {
-  LegacyDepthwiseConvWorkerTask(
-      const DepthwiseParams& params, const RuntimeShape& input_shape,
-      const T* input_data, const RuntimeShape& filter_shape,
-      const T* filter_data, const RuntimeShape& bias_shape, const TS* bias_data,
-      const RuntimeShape& output_shape, T* output_data, int thread_start,
-      int thread_end, int thread_dim)
-      : params_(params),
-        input_shape_(input_shape),
-        input_data_(input_data),
-        filter_shape_(filter_shape),
-        filter_data_(filter_data),
-        bias_shape_(bias_shape),
-        bias_data_(bias_data),
-        output_shape_(output_shape),
-        output_data_(output_data),
-        thread_start_(thread_start),
-        thread_end_(thread_end),
-        thread_dim_(thread_dim) {}
-
-  void Run() override {
-    LegacyDepthwiseConvImpl(params_, input_shape_, input_data_, filter_shape_,
-                            filter_data_, bias_shape_, bias_data_,
-                            output_shape_, output_data_, thread_start_,
-                            thread_end_, thread_dim_);
-  }
-
- private:
-  const DepthwiseParams& params_;
-  const RuntimeShape& input_shape_;
-  const T* input_data_;
-  const RuntimeShape& filter_shape_;
-  const T* filter_data_;
-  const RuntimeShape& bias_shape_;
-  const TS* bias_data_;
-  const RuntimeShape& output_shape_;
-  T* output_data_;
-  int thread_start_;
-  int thread_end_;
-  int thread_dim_;
-};
-
-inline int HowManyConvThreads(const RuntimeShape& output_shape,
-                              const RuntimeShape& filter_shape,
-                              int thread_dim) {
-  constexpr int kMinMulPerThread = 8;
-  const int output_units = output_shape.Dims(thread_dim);
-  const int filter_height = filter_shape.Dims(1);
-  const int filter_width = filter_shape.Dims(2);
-  const int num_mul_per_unit =
-      FlatSizeSkipDim(output_shape, thread_dim) * filter_height * filter_width;
-  const int min_units_per_thread = kMinMulPerThread / num_mul_per_unit + 1;
-  int thread_count = output_units / min_units_per_thread;
-  return thread_count;
-}
-
-inline void DepthwiseConv(
-    const DepthwiseParams& params, const RuntimeShape& input_shape,
-    const uint8* input_data, const RuntimeShape& filter_shape,
-    const uint8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape,
-    uint8* output_data, gemmlowp::GemmContext* gemmlowp_context = nullptr) {
-  ruy::profiler::ScopeLabel label("DepthwiseConv");
-
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  const int output_batches = output_shape.Dims(0);
-  const int output_rows = output_shape.Dims(1);
-  int thread_count_batch = HowManyConvThreads(output_shape, filter_shape, 0);
-  int thread_count_row = HowManyConvThreads(output_shape, filter_shape, 1);
-  int thread_dim, thread_count, thread_dim_size;
-  if (thread_count_batch > thread_count_row) {
-    thread_dim = 0;
-    thread_dim_size = output_batches;
-    thread_count = thread_count_batch;
-  } else {
-    thread_dim = 1;
-    thread_dim_size = output_rows;
-    thread_count = thread_count_row;
-  }
-
-  const int max_threads =
-      gemmlowp_context ? gemmlowp_context->max_num_threads() : 1;
-  thread_count = std::max(1, std::min(thread_count, max_threads));
-
-  if (thread_count == 1) {
-    LegacyDepthwiseConvImpl(params, input_shape, input_data, filter_shape,
-                            filter_data, bias_shape, bias_data, output_shape,
-                            output_data, /*thread_start=*/0,
-                            /*thread_end=*/output_rows, /*thread_dim=*/1);
-  } else {
-    std::vector tasks(thread_count);
-    int thread_start = 0;
-    for (int i = 0; i < thread_count; ++i) {
-      int thread_end =
-          thread_start + (thread_dim_size - thread_start) / (thread_count - i);
-      tasks[i] = new LegacyDepthwiseConvWorkerTask(
-          params, input_shape, input_data, filter_shape, filter_data,
-          bias_shape, bias_data, output_shape, output_data, thread_start,
-          thread_end, thread_dim);
-      thread_start = thread_end;
-    }
-    gemmlowp_context->workers_pool()->LegacyExecuteAndDestroyTasks(tasks);
-  }
-}
-
-template 
-struct LegacyPerChannelDepthwiseConvWorkerTask : public gemmlowp::Task {
-  LegacyPerChannelDepthwiseConvWorkerTask(
-      const DepthwiseParams& params, const int32* output_multiplier,
-      const int32* output_shift, const RuntimeShape& input_shape,
-      const T* input_data, const RuntimeShape& filter_shape,
-      const T* filter_data, const RuntimeShape& bias_shape, const TS* bias_data,
-      const RuntimeShape& output_shape, T* output_data, int thread_start,
-      int thread_end, int thread_dim)
-      : params_(params),
-        output_multiplier_(output_multiplier),
-        output_shift_(output_shift),
-        input_shape_(input_shape),
-        input_data_(input_data),
-        filter_shape_(filter_shape),
-        filter_data_(filter_data),
-        bias_shape_(bias_shape),
-        bias_data_(bias_data),
-        output_shape_(output_shape),
-        output_data_(output_data),
-        thread_start_(thread_start),
-        thread_end_(thread_end),
-        thread_dim_(thread_dim) {}
-
-  void Run() override {
-    CpuBackendContext backend_context;
-    optimized_integer_ops::DepthwiseConvImpl(
-        params_, output_multiplier_, output_shift_, input_shape_, input_data_,
-        filter_shape_, filter_data_, bias_shape_, bias_data_, output_shape_,
-        output_data_, thread_start_, thread_end_, thread_dim_, backend_context);
-  }
-
- private:
-  const DepthwiseParams& params_;
-  const int32* output_multiplier_;
-  const int32* output_shift_;
-  const RuntimeShape& input_shape_;
-  const T* input_data_;
-  const RuntimeShape& filter_shape_;
-  const T* filter_data_;
-  const RuntimeShape& bias_shape_;
-  const TS* bias_data_;
-  const RuntimeShape& output_shape_;
-  T* output_data_;
-  int thread_start_;
-  int thread_end_;
-  int thread_dim_;
-};
-
-inline void DepthwiseConvPerChannel(
-    const DepthwiseParams& params, const int32* output_multiplier,
-    const int32* output_shift, const RuntimeShape& input_shape,
-    const int8* input_data, const RuntimeShape& filter_shape,
-    const int8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape, int8* output_data,
-    gemmlowp::GemmContext* gemmlowp_context = nullptr) {
-  ruy::profiler::ScopeLabel label("DepthwiseConvInt8");
-
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  const int output_batches = output_shape.Dims(0);
-  const int output_rows = output_shape.Dims(1);
-  int thread_count_batch = HowManyConvThreads(output_shape, filter_shape, 0);
-  int thread_count_row = HowManyConvThreads(output_shape, filter_shape, 1);
-  int thread_dim, thread_count, thread_dim_size;
-  if (thread_count_batch > thread_count_row) {
-    thread_dim = 0;
-    thread_dim_size = output_batches;
-    thread_count = thread_count_batch;
-  } else {
-    thread_dim = 1;
-    thread_dim_size = output_rows;
-    thread_count = thread_count_row;
-  }
-
-  const int max_threads =
-      gemmlowp_context ? gemmlowp_context->max_num_threads() : 1;
-  thread_count = std::max(1, std::min(thread_count, max_threads));
-
-  if (thread_count == 1) {
-    CpuBackendContext backend_context;
-    optimized_integer_ops::DepthwiseConvImpl(
-        params, output_multiplier, output_shift, input_shape, input_data,
-        filter_shape, filter_data, bias_shape, bias_data, output_shape,
-        output_data, /*thread_start=*/0,
-        /*thread_end=*/output_rows, /*thread_dim=*/1, backend_context);
-  } else {
-    std::vector tasks(thread_count);
-    int thread_start = 0;
-    for (int i = 0; i < thread_count; ++i) {
-      int thread_end =
-          thread_start + (thread_dim_size - thread_start) / (thread_count - i);
-      tasks[i] = new LegacyPerChannelDepthwiseConvWorkerTask(
-          params, output_multiplier, output_shift, input_shape, input_data,
-          filter_shape, filter_data, bias_shape, bias_data, output_shape,
-          output_data, thread_start, thread_end, thread_dim);
-      thread_start = thread_end;
-    }
-    gemmlowp_context->workers_pool()->LegacyExecuteAndDestroyTasks(tasks);
-  }
-}
-
-inline void DepthwiseConv(
-    const DepthwiseParams& params, const RuntimeShape& input_shape,
-    const float* input_data, const RuntimeShape& filter_shape,
-    const float* filter_data, const RuntimeShape& bias_shape,
-    const float* bias_data, const RuntimeShape& output_shape,
-    float* output_data) {
-  DepthwiseConvImpl(params, input_shape, input_data, filter_shape, filter_data,
-                    bias_shape, bias_data, output_shape, output_data,
-                    CpuFlags(),
-                    /*thread_start=*/0,
-                    /*thread_end=*/output_shape.Dims(1), /*thread_dim=*/1);
-}
-
-inline void AddBiasAndEvalActivationFunction(const float* bias_data,
-                                             const Dims<4>& bias_dims,
-                                             float* array_data,
-                                             const Dims<4>& array_dims,
-                                             float output_activation_min,
-                                             float output_activation_max) {
-  AddBiasAndEvalActivationFunction(output_activation_min, output_activation_max,
-                                   DimsToShape(bias_dims), bias_data,
-                                   DimsToShape(array_dims), array_data);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void AddBiasAndEvalActivationFunction(const float* bias_data,
-                                      const Dims<4>& bias_dims,
-                                      float* array_data,
-                                      const Dims<4>& array_dims) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-  AddBiasAndEvalActivationFunction(bias_data, bias_dims, array_data, array_dims,
-                                   output_activation_min,
-                                   output_activation_max);
-}
-
-template 
-void Gemm(const Eigen::MatrixBase& lhs, const Eigen::MatrixBase& rhs,
-          Eigen::MatrixBase* result) {
-  if (rhs.cols() == 1) {
-    ruy::profiler::ScopeLabel label("GEMV");
-    result->col(0).noalias() = lhs * rhs.col(0);
-  } else {
-    ruy::profiler::ScopeLabel label("GEMM");
-    result->noalias() = lhs * rhs;
-  }
-}
-
-inline void FullyConnected(
-    const FullyConnectedParams& params, const RuntimeShape& input_shape,
-    const float* input_data, const RuntimeShape& weights_shape,
-    const float* weights_data, const RuntimeShape& bias_shape,
-    const float* optional_bias_data, const RuntimeShape& output_shape,
-    float* output_data) {
-  ruy::profiler::ScopeLabel label("FullyConnected");
-  const float output_activation_min = params.float_activation_min;
-  const float output_activation_max = params.float_activation_max;
-
-  // TODO(b/62193649): this convoluted shape computation (determining
-  // input_rows from the weights_dims, then MapAsMatrixWithGivenNumberOfRows)
-  // is because the current --variable_batch hack consists in overwriting the
-  // 3rd dimension with the runtime batch size, as we don't keep track for each
-  // array of which dimension is the batch dimension in it.
-  // When that is fixed, this should become:
-  // const auto input_matrix_map =
-  //     MapAsMatrixWithFirstDimAsRows(input_data, input_dims);
-  const int dims_count = weights_shape.DimensionsCount();
-  const int input_rows = weights_shape.Dims(dims_count - 1);
-  const auto input_matrix_map =
-      MapAsMatrixWithGivenNumberOfRows(input_data, input_shape, input_rows);
-  const auto filter_matrix_map =
-      MapAsMatrixWithLastDimAsRows(weights_data, weights_shape);
-  auto output_matrix_map =
-      MapAsMatrixWithLastDimAsRows(output_data, output_shape);
-
-  Gemm(filter_matrix_map.transpose(), input_matrix_map, &output_matrix_map);
-
-  if (optional_bias_data != nullptr) {
-    AddBiasAndEvalActivationFunction(
-        output_activation_min, output_activation_max, bias_shape,
-        optional_bias_data, output_shape, output_data);
-  } else {
-    const int flat_size = output_shape.FlatSize();
-    for (int i = 0; i < flat_size; ++i) {
-      output_data[i] = ActivationFunctionWithMinMax(
-          output_data[i], output_activation_min, output_activation_max);
-    }
-  }
-}
-
-inline void FullyConnected(const float* input_data, const Dims<4>& input_dims,
-                           const float* weights_data,
-                           const Dims<4>& weights_dims, const float* bias_data,
-                           const Dims<4>& bias_dims,
-                           float output_activation_min,
-                           float output_activation_max, float* output_data,
-                           const Dims<4>& output_dims) {
-  tflite::FullyConnectedParams op_params;
-  op_params.float_activation_min = output_activation_min;
-  op_params.float_activation_max = output_activation_max;
-
-  FullyConnected(op_params, DimsToShape(input_dims), input_data,
-                 DimsToShape(weights_dims), weights_data,
-                 DimsToShape(bias_dims), bias_data, DimsToShape(output_dims),
-                 output_data);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void FullyConnected(const float* input_data, const Dims<4>& input_dims,
-                    const float* weights_data, const Dims<4>& weights_dims,
-                    const float* bias_data, const Dims<4>& bias_dims,
-                    float* output_data, const Dims<4>& output_dims) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-  FullyConnected(input_data, input_dims, weights_data, weights_dims, bias_data,
-                 bias_dims, output_activation_min, output_activation_max,
-                 output_data, output_dims);
-}
-
-struct GemmlowpOutputPipeline {
-  typedef gemmlowp::VectorMap
-      ColVectorMap;
-  typedef std::tuple,
-                     gemmlowp::OutputStageScaleInt32ByFixedPointAndExponent,
-                     gemmlowp::OutputStageClamp,
-                     gemmlowp::OutputStageSaturatingCastToUint8>
-      Pipeline;
-  static Pipeline MakeExp(const int32* bias_data, int output_rows,
-                          int32 output_offset, int32 output_multiplier,
-                          int output_left_shift, int32 output_activation_min,
-                          int32 output_activation_max) {
-    ColVectorMap bias_vector(bias_data, output_rows);
-    gemmlowp::OutputStageBiasAddition bias_addition_stage;
-    bias_addition_stage.bias_vector = bias_vector;
-    gemmlowp::OutputStageScaleInt32ByFixedPointAndExponent quantize_down_stage;
-    quantize_down_stage.result_offset_after_shift = output_offset;
-    quantize_down_stage.result_fixedpoint_multiplier = output_multiplier;
-    quantize_down_stage.result_exponent = output_left_shift;
-    gemmlowp::OutputStageClamp clamp_stage;
-    clamp_stage.min = output_activation_min;
-    clamp_stage.max = output_activation_max;
-    gemmlowp::OutputStageSaturatingCastToUint8 saturating_cast_stage;
-    return std::make_tuple(bias_addition_stage, quantize_down_stage,
-                           clamp_stage, saturating_cast_stage);
-  }
-};
-
-struct GemmlowpOutputPipelineInt8 {
-  typedef gemmlowp::VectorMap
-      ColVectorMap;
-  typedef std::tuple,
-                     gemmlowp::OutputStageScaleInt32ByFixedPointAndExponent,
-                     gemmlowp::OutputStageClamp,
-                     gemmlowp::OutputStageSaturatingCastToInt8>
-      Pipeline;
-  static Pipeline MakeExp(const int32* bias_data, int output_rows,
-                          int32 output_offset, int32 output_multiplier,
-                          int output_left_shift, int32 output_activation_min,
-                          int32 output_activation_max) {
-    ColVectorMap bias_vector(bias_data, output_rows);
-    gemmlowp::OutputStageBiasAddition bias_addition_stage;
-    bias_addition_stage.bias_vector = bias_vector;
-    gemmlowp::OutputStageScaleInt32ByFixedPointAndExponent quantize_down_stage;
-    quantize_down_stage.result_offset_after_shift = output_offset;
-    quantize_down_stage.result_fixedpoint_multiplier = output_multiplier;
-    quantize_down_stage.result_exponent = output_left_shift;
-    gemmlowp::OutputStageClamp clamp_stage;
-    clamp_stage.min = output_activation_min;
-    clamp_stage.max = output_activation_max;
-    gemmlowp::OutputStageSaturatingCastToInt8 saturating_cast_stage;
-    return std::make_tuple(bias_addition_stage, quantize_down_stage,
-                           clamp_stage, saturating_cast_stage);
-  }
-};
-
-#ifdef USE_NEON
-inline void LegacyFullyConnectedAsGEMVWorkerImpl(
-    const RuntimeShape& input_shape, const uint8* input_data,
-    int32 input_offset, const RuntimeShape& filter_shape,
-    const uint8* filter_data, int32 filter_offset,
-    const RuntimeShape& bias_shape, const int32* bias_data, int32 output_offset,
-    int32 output_multiplier, int output_shift, int32 output_activation_min,
-    int32 output_activation_max, const RuntimeShape& output_shape,
-    uint8* output_data, int row_start, int row_end) {
-  ruy::profiler::ScopeLabel label("FullyConnectedAsGEMV/8bit");
-  TFLITE_DCHECK_GE(input_shape.DimensionsCount(), 1);
-  TFLITE_DCHECK_GE(filter_shape.DimensionsCount(), 2);
-  TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1);
-  const int output_dim_count = output_shape.DimensionsCount();
-  TFLITE_DCHECK_EQ(FlatSizeSkipDim(output_shape, output_dim_count - 1), 1);
-  const int input_size = FlatSizeSkipDim(input_shape, 0);
-  static constexpr int kPeel = 4;
-  const bool shift_left = (output_shift > 0);
-  for (int k = 0; k < input_size; k += 64) {
-    optimized_ops_preload_l1_stream(input_data + k);
-  }
-  for (int k = 0; k < kPeel * input_size; k += 64) {
-    optimized_ops_preload_l1_stream(filter_data + k);
-  }
-
-  TFLITE_DCHECK_GE(row_end - row_start, kPeel);
-
-  for (int out = row_start; out < row_end; out += kPeel) {
-    out = std::min(out, row_end - kPeel);
-    int32x4_t acc0 = vdupq_n_s32(0);
-    int32x4_t acc1 = acc0;
-    int32x4_t acc2 = acc0;
-    int32x4_t acc3 = acc0;
-    const int16x8_t input_offset_vec = vdupq_n_s16(input_offset);
-    const int16x8_t filter_offset_vec = vdupq_n_s16(filter_offset);
-    int in = 0;
-    for (; in <= input_size - 16; in += 16) {
-      const uint8x16_t input_val_u8 = vld1q_u8(input_data + in);
-      const uint8* filter_ptr = filter_data + in + out * input_size;
-      uint8x16_t filter_val_u8_0 = vld1q_u8(filter_ptr);
-      optimized_ops_preload_l1_stream(filter_ptr + 64);
-      filter_ptr += input_size;
-      uint8x16_t filter_val_u8_1 = vld1q_u8(filter_ptr);
-      optimized_ops_preload_l1_stream(filter_ptr + 64);
-      filter_ptr += input_size;
-      uint8x16_t filter_val_u8_2 = vld1q_u8(filter_ptr);
-      optimized_ops_preload_l1_stream(filter_ptr + 64);
-      filter_ptr += input_size;
-      uint8x16_t filter_val_u8_3 = vld1q_u8(filter_ptr);
-      optimized_ops_preload_l1_stream(filter_ptr + 64);
-      int16x8_t input_val_0, input_val_1;
-      uint8x8_t low = vget_low_u8(input_val_u8);
-      uint8x8_t high = vget_high_u8(input_val_u8);
-      input_val_0 = vreinterpretq_s16_u16(vmovl_u8(low));
-      input_val_1 = vreinterpretq_s16_u16(vmovl_u8(high));
-      input_val_0 = vaddq_s16(input_val_0, input_offset_vec);
-      input_val_1 = vaddq_s16(input_val_1, input_offset_vec);
-      low = vget_low_u8(filter_val_u8_0);
-      high = vget_high_u8(filter_val_u8_0);
-      int16x8_t filter_val_0_0 = vreinterpretq_s16_u16(vmovl_u8(low));
-      int16x8_t filter_val_0_1 = vreinterpretq_s16_u16(vmovl_u8(high));
-      filter_val_0_0 = vaddq_s16(filter_val_0_0, filter_offset_vec);
-      filter_val_0_1 = vaddq_s16(filter_val_0_1, filter_offset_vec);
-      low = vget_low_u8(filter_val_u8_1);
-      high = vget_high_u8(filter_val_u8_1);
-      int16x8_t filter_val_1_0 = vreinterpretq_s16_u16(vmovl_u8(low));
-      int16x8_t filter_val_1_1 = vreinterpretq_s16_u16(vmovl_u8(high));
-      filter_val_1_0 = vaddq_s16(filter_val_1_0, filter_offset_vec);
-      filter_val_1_1 = vaddq_s16(filter_val_1_1, filter_offset_vec);
-      low = vget_low_u8(filter_val_u8_2);
-      high = vget_high_u8(filter_val_u8_2);
-      int16x8_t filter_val_2_0 = vreinterpretq_s16_u16(vmovl_u8(low));
-      int16x8_t filter_val_2_1 = vreinterpretq_s16_u16(vmovl_u8(high));
-      filter_val_2_0 = vaddq_s16(filter_val_2_0, filter_offset_vec);
-      filter_val_2_1 = vaddq_s16(filter_val_2_1, filter_offset_vec);
-      low = vget_low_u8(filter_val_u8_3);
-      high = vget_high_u8(filter_val_u8_3);
-      int16x8_t filter_val_3_0 = vreinterpretq_s16_u16(vmovl_u8(low));
-      int16x8_t filter_val_3_1 = vreinterpretq_s16_u16(vmovl_u8(high));
-      filter_val_3_0 = vaddq_s16(filter_val_3_0, filter_offset_vec);
-      filter_val_3_1 = vaddq_s16(filter_val_3_1, filter_offset_vec);
-      acc0 = vmlal_s16(acc0, vget_low_s16(filter_val_0_0),
-                       vget_low_s16(input_val_0));
-      acc1 = vmlal_s16(acc1, vget_low_s16(filter_val_1_0),
-                       vget_low_s16(input_val_0));
-      acc2 = vmlal_s16(acc2, vget_low_s16(filter_val_2_0),
-                       vget_low_s16(input_val_0));
-      acc3 = vmlal_s16(acc3, vget_low_s16(filter_val_3_0),
-                       vget_low_s16(input_val_0));
-      acc0 = vmlal_s16(acc0, vget_low_s16(filter_val_0_1),
-                       vget_low_s16(input_val_1));
-      acc1 = vmlal_s16(acc1, vget_low_s16(filter_val_1_1),
-                       vget_low_s16(input_val_1));
-      acc2 = vmlal_s16(acc2, vget_low_s16(filter_val_2_1),
-                       vget_low_s16(input_val_1));
-      acc3 = vmlal_s16(acc3, vget_low_s16(filter_val_3_1),
-                       vget_low_s16(input_val_1));
-      acc0 = vmlal_s16(acc0, vget_high_s16(filter_val_0_0),
-                       vget_high_s16(input_val_0));
-      acc1 = vmlal_s16(acc1, vget_high_s16(filter_val_1_0),
-                       vget_high_s16(input_val_0));
-      acc2 = vmlal_s16(acc2, vget_high_s16(filter_val_2_0),
-                       vget_high_s16(input_val_0));
-      acc3 = vmlal_s16(acc3, vget_high_s16(filter_val_3_0),
-                       vget_high_s16(input_val_0));
-      acc0 = vmlal_s16(acc0, vget_high_s16(filter_val_0_1),
-                       vget_high_s16(input_val_1));
-      acc1 = vmlal_s16(acc1, vget_high_s16(filter_val_1_1),
-                       vget_high_s16(input_val_1));
-      acc2 = vmlal_s16(acc2, vget_high_s16(filter_val_2_1),
-                       vget_high_s16(input_val_1));
-      acc3 = vmlal_s16(acc3, vget_high_s16(filter_val_3_1),
-                       vget_high_s16(input_val_1));
-    }
-    for (; in <= input_size - 8; in += 8) {
-      const uint8x8_t input_val_u8 = vld1_u8(input_data + in);
-      const uint8* filter_ptr = filter_data + in + out * input_size;
-      uint8x8_t filter_val_u8_0 = vld1_u8(filter_ptr);
-      filter_ptr += input_size;
-      uint8x8_t filter_val_u8_1 = vld1_u8(filter_ptr);
-      filter_ptr += input_size;
-      uint8x8_t filter_val_u8_2 = vld1_u8(filter_ptr);
-      filter_ptr += input_size;
-      uint8x8_t filter_val_u8_3 = vld1_u8(filter_ptr);
-      int16x8_t input_val = vreinterpretq_s16_u16(vmovl_u8(input_val_u8));
-      input_val = vaddq_s16(input_val, input_offset_vec);
-      int16x8_t filter_val_0 = vreinterpretq_s16_u16(vmovl_u8(filter_val_u8_0));
-      filter_val_0 = vaddq_s16(filter_val_0, filter_offset_vec);
-      int16x8_t filter_val_1 = vreinterpretq_s16_u16(vmovl_u8(filter_val_u8_1));
-      filter_val_1 = vaddq_s16(filter_val_1, filter_offset_vec);
-      int16x8_t filter_val_2 = vreinterpretq_s16_u16(vmovl_u8(filter_val_u8_2));
-      filter_val_2 = vaddq_s16(filter_val_2, filter_offset_vec);
-      int16x8_t filter_val_3 = vreinterpretq_s16_u16(vmovl_u8(filter_val_u8_3));
-      filter_val_3 = vaddq_s16(filter_val_3, filter_offset_vec);
-      acc0 =
-          vmlal_s16(acc0, vget_low_s16(filter_val_0), vget_low_s16(input_val));
-      acc1 =
-          vmlal_s16(acc1, vget_low_s16(filter_val_1), vget_low_s16(input_val));
-      acc2 =
-          vmlal_s16(acc2, vget_low_s16(filter_val_2), vget_low_s16(input_val));
-      acc3 =
-          vmlal_s16(acc3, vget_low_s16(filter_val_3), vget_low_s16(input_val));
-      acc0 = vmlal_s16(acc0, vget_high_s16(filter_val_0),
-                       vget_high_s16(input_val));
-      acc1 = vmlal_s16(acc1, vget_high_s16(filter_val_1),
-                       vget_high_s16(input_val));
-      acc2 = vmlal_s16(acc2, vget_high_s16(filter_val_2),
-                       vget_high_s16(input_val));
-      acc3 = vmlal_s16(acc3, vget_high_s16(filter_val_3),
-                       vget_high_s16(input_val));
-    }
-    if (in < input_size) {
-      int32 buf[16];
-      vst1q_s32(buf + 0, acc0);
-      vst1q_s32(buf + 4, acc1);
-      vst1q_s32(buf + 8, acc2);
-      vst1q_s32(buf + 12, acc3);
-      for (; in < input_size; in++) {
-        int lane = (in + 8 - input_size) % 4;
-        const int32 input_val = input_data[in] + input_offset;
-        for (int k = 0; k < kPeel; k++) {
-          int32 filter_val =
-              filter_data[in + (out + k) * input_size] + filter_offset;
-          buf[lane + 4 * k] += filter_val * input_val;
-        }
-      }
-      acc0 = vld1q_s32(buf + 0);
-      acc1 = vld1q_s32(buf + 4);
-      acc2 = vld1q_s32(buf + 8);
-      acc3 = vld1q_s32(buf + 12);
-    }
-
-    // Horizontally reduce accumulators
-    int32x2_t pairwise_reduced_acc_0 =
-        vpadd_s32(vget_low_s32(acc0), vget_high_s32(acc0));
-    int32x2_t pairwise_reduced_acc_1 =
-        vpadd_s32(vget_low_s32(acc1), vget_high_s32(acc1));
-    int32x2_t pairwise_reduced_acc_2 =
-        vpadd_s32(vget_low_s32(acc2), vget_high_s32(acc2));
-    int32x2_t pairwise_reduced_acc_3 =
-        vpadd_s32(vget_low_s32(acc3), vget_high_s32(acc3));
-    const int32x2_t reduced_lo =
-        vpadd_s32(pairwise_reduced_acc_0, pairwise_reduced_acc_1);
-    const int32x2_t reduced_hi =
-        vpadd_s32(pairwise_reduced_acc_2, pairwise_reduced_acc_3);
-    int32x4_t reduced = vcombine_s32(reduced_lo, reduced_hi);
-    // Add bias values.
-    int32x4_t bias_vec = vld1q_s32(bias_data + out);
-    reduced = vaddq_s32(reduced, bias_vec);
-    if (shift_left) {
-      const int32 multiplier_power_of_two = 1 << output_shift;
-      reduced = vmulq_n_s32(reduced, multiplier_power_of_two);
-      reduced = vqrdmulhq_n_s32(reduced, output_multiplier);
-    } else {
-      // Multiply by the fixed-point multiplier.
-      reduced = vqrdmulhq_n_s32(reduced, output_multiplier);
-      // Rounding-shift-right.
-      using gemmlowp::RoundingDivideByPOT;
-      reduced = RoundingDivideByPOT(reduced, -output_shift);
-    }
-    // Add the output offset.
-    const int32x4_t output_offset_vec = vdupq_n_s32(output_offset);
-    reduced = vaddq_s32(reduced, output_offset_vec);
-    // Narrow values down to 16 bit signed.
-    const int16x4_t res16 = vqmovn_s32(reduced);
-    // Narrow values down to 8 bit unsigned, saturating.
-    uint8x8_t res8 = vqmovun_s16(vcombine_s16(res16, res16));
-    // Apply the clamping from the activation function
-    res8 = vmax_u8(res8, vdup_n_u8(output_activation_min));
-    res8 = vmin_u8(res8, vdup_n_u8(output_activation_max));
-    // Store results to destination.
-    vst1_lane_u8(output_data + out + 0, res8, 0);
-    vst1_lane_u8(output_data + out + 1, res8, 1);
-    vst1_lane_u8(output_data + out + 2, res8, 2);
-    vst1_lane_u8(output_data + out + 3, res8, 3);
-  }
-}
-
-struct LegacyFullyConnectedAsGEMVWorkerTask : public gemmlowp::Task {
-  LegacyFullyConnectedAsGEMVWorkerTask(
-      const RuntimeShape& input_shape, const uint8* input_data,
-      int32 input_offset, const RuntimeShape& filter_shape,
-      const uint8* filter_data, int32 filter_offset,
-      const RuntimeShape& bias_shape, const int32* bias_data,
-      int32 output_offset, int32 output_multiplier, int output_shift,
-      int32 output_activation_min, int32 output_activation_max,
-      const RuntimeShape& output_shape, uint8* output_data, int row_start,
-      int row_end)
-      : input_shape_(input_shape),
-        input_data_(input_data),
-        input_offset_(input_offset),
-        filter_shape_(filter_shape),
-        filter_data_(filter_data),
-        filter_offset_(filter_offset),
-        bias_shape_(bias_shape),
-        bias_data_(bias_data),
-        output_offset_(output_offset),
-        output_multiplier_(output_multiplier),
-        output_shift_(output_shift),
-        output_activation_min_(output_activation_min),
-        output_activation_max_(output_activation_max),
-        output_shape_(output_shape),
-        output_data_(output_data),
-        row_start_(row_start),
-        row_end_(row_end) {}
-
-  void Run() override {
-    LegacyFullyConnectedAsGEMVWorkerImpl(
-        input_shape_, input_data_, input_offset_, filter_shape_, filter_data_,
-        filter_offset_, bias_shape_, bias_data_, output_offset_,
-        output_multiplier_, output_shift_, output_activation_min_,
-        output_activation_max_, output_shape_, output_data_, row_start_,
-        row_end_);
-  }
-
-  const RuntimeShape& input_shape_;
-  const uint8* input_data_;
-  int32 input_offset_;
-  const RuntimeShape& filter_shape_;
-  const uint8* filter_data_;
-  int32 filter_offset_;
-  const RuntimeShape& bias_shape_;
-  const int32* bias_data_;
-  int32 output_offset_;
-  int32 output_multiplier_;
-  int output_shift_;
-  int32 output_activation_min_;
-  int32 output_activation_max_;
-  const RuntimeShape& output_shape_;
-  uint8* output_data_;
-  int row_start_;
-  int row_end_;
-};
-
-inline void FullyConnectedAsGEMV(
-    const RuntimeShape& input_shape, const uint8* input_data,
-    int32 input_offset, const RuntimeShape& filter_shape,
-    const uint8* filter_data, int32 filter_offset,
-    const RuntimeShape& bias_shape, const int32* bias_data, int32 output_offset,
-    int32 output_multiplier, int output_shift, int32 output_activation_min,
-    int32 output_activation_max, const RuntimeShape& output_shape,
-    uint8* output_data, gemmlowp::GemmContext* gemmlowp_context) {
-  const int output_dim_count = output_shape.DimensionsCount();
-  const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1);
-  const int output_rows = output_shape.Dims(output_dim_count - 1);
-  const int input_size = FlatSizeSkipDim(input_shape, 0);
-  static constexpr int kKernelRows = 4;
-  const int thread_count = gemmlowp::HowManyThreads(
-      gemmlowp_context->max_num_threads(), output_rows, batches, input_size);
-  if (thread_count == 1) {
-    // Single-thread case: do the computation on the current thread, don't
-    // use a threadpool
-    LegacyFullyConnectedAsGEMVWorkerImpl(
-        input_shape, input_data, input_offset, filter_shape, filter_data,
-        filter_offset, bias_shape, bias_data, output_offset, output_multiplier,
-        output_shift, output_activation_min, output_activation_max,
-        output_shape, output_data, 0, output_rows);
-    return;
-  }
-
-  // Multi-threaded case: use the gemmlowp context's threadpool.
-  TFLITE_DCHECK_GT(thread_count, 1);
-  std::vector tasks(thread_count);
-  const int kRowsPerWorker = gemmlowp::RoundUp(
-      gemmlowp::CeilQuotient(output_rows, thread_count));
-  int row_start = 0;
-  for (int i = 0; i < thread_count; ++i) {
-    int row_end = std::min(output_rows, row_start + kRowsPerWorker);
-    tasks[i] = new LegacyFullyConnectedAsGEMVWorkerTask(
-        input_shape, input_data, input_offset, filter_shape, filter_data,
-        filter_offset, bias_shape, bias_data, output_offset, output_multiplier,
-        output_shift, output_activation_min, output_activation_max,
-        output_shape, output_data, row_start, row_end);
-    row_start = row_end;
-  }
-  TFLITE_DCHECK_EQ(row_start, output_rows);
-  gemmlowp_context->workers_pool()->LegacyExecuteAndDestroyTasks(tasks);
-}
-#endif  // USE_NEON
-
-inline void FullyConnected(
-    const FullyConnectedParams& params, const RuntimeShape& input_shape,
-    const uint8* input_data, const RuntimeShape& filter_shape,
-    const uint8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape,
-    uint8* output_data, gemmlowp::GemmContext* gemmlowp_context) {
-  ruy::profiler::ScopeLabel label("FullyConnected/8bit");
-  const int32 input_offset = params.input_offset;
-  const int32 filter_offset = params.weights_offset;
-  const int32 output_offset = params.output_offset;
-  const int32 output_multiplier = params.output_multiplier;
-  const int output_shift = params.output_shift;
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  TFLITE_DCHECK_GE(filter_shape.DimensionsCount(), 2);
-  TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1);
-  // TODO(benoitjacob): This really should be:
-  //     const int batches = ArraySize(output_dims, 1);
-  // but the current --variable_batch hack consists in overwriting the 3rd
-  // dimension with the runtime batch size, as we don't keep track for each
-  // array of which dimension is the batch dimension in it.
-  const int output_dim_count = output_shape.DimensionsCount();
-  const int filter_dim_count = filter_shape.DimensionsCount();
-  const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1);
-#ifdef USE_NEON
-  if (batches == 1) {
-    const int output_size = MatchingDim(filter_shape, filter_dim_count - 2,
-                                        output_shape, output_dim_count - 1);
-    if (output_size >= 4) {
-      return FullyConnectedAsGEMV(
-          input_shape, input_data, input_offset, filter_shape, filter_data,
-          filter_offset, bias_shape, bias_data, output_offset,
-          output_multiplier, output_shift, output_activation_min,
-          output_activation_max, output_shape, output_data, gemmlowp_context);
-    }
-  }
-#endif  // USE_NEON
-  const int filter_rows = filter_shape.Dims(filter_dim_count - 2);
-  const int filter_cols = filter_shape.Dims(filter_dim_count - 1);
-  TFLITE_DCHECK_EQ(filter_shape.FlatSize(), filter_rows * filter_cols);
-  const int output_rows = output_shape.Dims(output_dim_count - 1);
-  TFLITE_DCHECK_EQ(output_rows, filter_rows);
-  TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_rows);
-
-  gemmlowp::MatrixMap filter_matrix(
-      filter_data, output_rows, filter_cols, filter_cols);
-  gemmlowp::MatrixMap input_matrix(
-      input_data, filter_cols, batches, filter_cols);
-  gemmlowp::MatrixMap output_matrix(
-      output_data, output_rows, batches, output_rows);
-  const auto& output_pipeline = GemmlowpOutputPipeline::MakeExp(
-      bias_data, output_rows, output_offset, output_multiplier, output_shift,
-      output_activation_min, output_activation_max);
-  gemmlowp::GemmWithOutputPipeline(
-      gemmlowp_context, filter_matrix, input_matrix, &output_matrix,
-      filter_offset, input_offset, output_pipeline);
-}
-
-#ifdef GEMMLOWP_NEON
-// In the common case of batch size 1, a fully-connected node degenerates
-// to a matrix*vector product. LSTM cells contain a fully-connected node;
-// when quantized, this becomes a special type of GEMV operation where
-// the output is 16bit-quantized, thus needs its own special path.
-inline void GEMVForLstmCell(const RuntimeShape& input_shape,
-                            const uint8* input_data,
-                            const RuntimeShape& weights_shape,
-                            const uint8* weights_data, uint8 weights_zero_point,
-                            const RuntimeShape& bias_shape,
-                            const int32* bias_data, int32 accum_multiplier,
-                            int accum_shift, const RuntimeShape& output_shape,
-                            int16* output_data) {
-  ruy::profiler::ScopeLabel label("GEMVForLstmCell");
-  TFLITE_DCHECK_GE(input_shape.DimensionsCount(), 1);
-  TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2);
-  TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1);
-  const int output_dim_count = output_shape.DimensionsCount();
-  const int weights_dim_count = weights_shape.DimensionsCount();
-  TFLITE_DCHECK_EQ(FlatSizeSkipDim(output_shape, output_dim_count - 1), 1);
-  const int input_size = FlatSizeSkipDim(input_shape, 0);
-  const int output_size = MatchingDim(weights_shape, weights_dim_count - 2,
-                                      output_shape, output_dim_count - 1);
-  // This special fast path for quantized LSTM cells does not try to support
-  // odd sizes that we haven't encountered in any LSTM cell, that would
-  // require special code (that would go untested until any LSTM cell
-  // exercises it). We just guard our assumptions about size evenness with
-  // the following assertions.
-  TFLITE_DCHECK(!(output_size % 4));
-  TFLITE_DCHECK(!(input_size % 8));
-  const int32* bias_ptr = bias_data;
-  int16* output_ptr = output_data;
-  for (int out = 0; out < output_size; out += 4) {
-    int32x4_t acc_0 = vdupq_n_s32(0);
-    int32x4_t acc_1 = vdupq_n_s32(0);
-    int32x4_t acc_2 = vdupq_n_s32(0);
-    int32x4_t acc_3 = vdupq_n_s32(0);
-    const int16x8_t input_offset_vec = vdupq_n_s16(-128);
-    const int16x8_t weights_offset_vec = vdupq_n_s16(-weights_zero_point);
-    int in = 0;
-    // Handle 16 levels of depth at a time.
-    for (; in <= input_size - 16; in += 16) {
-      const uint8x16_t input_val_u8 = vld1q_u8(input_data + in);
-      const uint8* weights_ptr = weights_data + in + out * input_size;
-      uint8x16_t weights_val_u8_0 = vld1q_u8(weights_ptr + 0 * input_size);
-      uint8x16_t weights_val_u8_1 = vld1q_u8(weights_ptr + 1 * input_size);
-      uint8x16_t weights_val_u8_2 = vld1q_u8(weights_ptr + 2 * input_size);
-      uint8x16_t weights_val_u8_3 = vld1q_u8(weights_ptr + 3 * input_size);
-      int16x8_t input_val_0, input_val_1;
-      const uint8x8_t low = vget_low_u8(input_val_u8);
-      const uint8x8_t high = vget_high_u8(input_val_u8);
-      input_val_0 = vreinterpretq_s16_u16(vmovl_u8(low));
-      input_val_1 = vreinterpretq_s16_u16(vmovl_u8(high));
-      input_val_0 = vaddq_s16(input_val_0, input_offset_vec);
-      input_val_1 = vaddq_s16(input_val_1, input_offset_vec);
-      int16x8_t weights_val_0_0, weights_val_1_0, weights_val_2_0,
-          weights_val_3_0;
-      int16x8_t weights_val_0_1, weights_val_1_1, weights_val_2_1,
-          weights_val_3_1;
-      weights_val_0_0 = vaddq_s16(
-          vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(weights_val_u8_0))),
-          weights_offset_vec);
-      weights_val_0_1 = vaddq_s16(
-          vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(weights_val_u8_0))),
-          weights_offset_vec);
-      weights_val_1_0 = vaddq_s16(
-          vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(weights_val_u8_1))),
-          weights_offset_vec);
-      weights_val_1_1 = vaddq_s16(
-          vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(weights_val_u8_1))),
-          weights_offset_vec);
-      weights_val_2_0 = vaddq_s16(
-          vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(weights_val_u8_2))),
-          weights_offset_vec);
-      weights_val_2_1 = vaddq_s16(
-          vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(weights_val_u8_2))),
-          weights_offset_vec);
-      weights_val_3_0 = vaddq_s16(
-          vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(weights_val_u8_3))),
-          weights_offset_vec);
-      weights_val_3_1 = vaddq_s16(
-          vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(weights_val_u8_3))),
-          weights_offset_vec);
-      acc_0 = vmlal_s16(acc_0, vget_low_s16(weights_val_0_0),
-                        vget_low_s16(input_val_0));
-      acc_1 = vmlal_s16(acc_1, vget_low_s16(weights_val_1_0),
-                        vget_low_s16(input_val_0));
-      acc_2 = vmlal_s16(acc_2, vget_low_s16(weights_val_2_0),
-                        vget_low_s16(input_val_0));
-      acc_3 = vmlal_s16(acc_3, vget_low_s16(weights_val_3_0),
-                        vget_low_s16(input_val_0));
-      acc_0 = vmlal_s16(acc_0, vget_high_s16(weights_val_0_0),
-                        vget_high_s16(input_val_0));
-      acc_1 = vmlal_s16(acc_1, vget_high_s16(weights_val_1_0),
-                        vget_high_s16(input_val_0));
-      acc_2 = vmlal_s16(acc_2, vget_high_s16(weights_val_2_0),
-                        vget_high_s16(input_val_0));
-      acc_3 = vmlal_s16(acc_3, vget_high_s16(weights_val_3_0),
-                        vget_high_s16(input_val_0));
-      acc_0 = vmlal_s16(acc_0, vget_low_s16(weights_val_0_1),
-                        vget_low_s16(input_val_1));
-      acc_1 = vmlal_s16(acc_1, vget_low_s16(weights_val_1_1),
-                        vget_low_s16(input_val_1));
-      acc_2 = vmlal_s16(acc_2, vget_low_s16(weights_val_2_1),
-                        vget_low_s16(input_val_1));
-      acc_3 = vmlal_s16(acc_3, vget_low_s16(weights_val_3_1),
-                        vget_low_s16(input_val_1));
-      acc_0 = vmlal_s16(acc_0, vget_high_s16(weights_val_0_1),
-                        vget_high_s16(input_val_1));
-      acc_1 = vmlal_s16(acc_1, vget_high_s16(weights_val_1_1),
-                        vget_high_s16(input_val_1));
-      acc_2 = vmlal_s16(acc_2, vget_high_s16(weights_val_2_1),
-                        vget_high_s16(input_val_1));
-      acc_3 = vmlal_s16(acc_3, vget_high_s16(weights_val_3_1),
-                        vget_high_s16(input_val_1));
-    }
-    // Handle 8 levels of depth at a time.
-    for (; in < input_size; in += 8) {
-      const uint8x8_t input_val_u8 = vld1_u8(input_data + in);
-      const uint8* weights_ptr = weights_data + in + out * input_size;
-      uint8x8_t weights_val_u8_0 = vld1_u8(weights_ptr + 0 * input_size);
-      uint8x8_t weights_val_u8_1 = vld1_u8(weights_ptr + 1 * input_size);
-      uint8x8_t weights_val_u8_2 = vld1_u8(weights_ptr + 2 * input_size);
-      uint8x8_t weights_val_u8_3 = vld1_u8(weights_ptr + 3 * input_size);
-      int16x8_t input_val;
-      input_val = vreinterpretq_s16_u16(vmovl_u8(input_val_u8));
-      input_val = vaddq_s16(input_val, input_offset_vec);
-      int16x8_t weights_val_0, weights_val_1, weights_val_2, weights_val_3;
-      weights_val_0 =
-          vaddq_s16(vreinterpretq_s16_u16(vmovl_u8(weights_val_u8_0)),
-                    weights_offset_vec);
-      weights_val_1 =
-          vaddq_s16(vreinterpretq_s16_u16(vmovl_u8(weights_val_u8_1)),
-                    weights_offset_vec);
-      weights_val_2 =
-          vaddq_s16(vreinterpretq_s16_u16(vmovl_u8(weights_val_u8_2)),
-                    weights_offset_vec);
-      weights_val_3 =
-          vaddq_s16(vreinterpretq_s16_u16(vmovl_u8(weights_val_u8_3)),
-                    weights_offset_vec);
-      acc_0 = vmlal_s16(acc_0, vget_low_s16(weights_val_0),
-                        vget_low_s16(input_val));
-      acc_1 = vmlal_s16(acc_1, vget_low_s16(weights_val_1),
-                        vget_low_s16(input_val));
-      acc_2 = vmlal_s16(acc_2, vget_low_s16(weights_val_2),
-                        vget_low_s16(input_val));
-      acc_3 = vmlal_s16(acc_3, vget_low_s16(weights_val_3),
-                        vget_low_s16(input_val));
-      acc_0 = vmlal_s16(acc_0, vget_high_s16(weights_val_0),
-                        vget_high_s16(input_val));
-      acc_1 = vmlal_s16(acc_1, vget_high_s16(weights_val_1),
-                        vget_high_s16(input_val));
-      acc_2 = vmlal_s16(acc_2, vget_high_s16(weights_val_2),
-                        vget_high_s16(input_val));
-      acc_3 = vmlal_s16(acc_3, vget_high_s16(weights_val_3),
-                        vget_high_s16(input_val));
-    }
-    // Horizontally reduce accumulators
-    int32x2_t pairwise_reduced_acc_0, pairwise_reduced_acc_1,
-        pairwise_reduced_acc_2, pairwise_reduced_acc_3;
-    pairwise_reduced_acc_0 =
-        vpadd_s32(vget_low_s32(acc_0), vget_high_s32(acc_0));
-    pairwise_reduced_acc_1 =
-        vpadd_s32(vget_low_s32(acc_1), vget_high_s32(acc_1));
-    pairwise_reduced_acc_2 =
-        vpadd_s32(vget_low_s32(acc_2), vget_high_s32(acc_2));
-    pairwise_reduced_acc_3 =
-        vpadd_s32(vget_low_s32(acc_3), vget_high_s32(acc_3));
-    const int32x2_t reduced_lo =
-        vpadd_s32(pairwise_reduced_acc_0, pairwise_reduced_acc_1);
-    const int32x2_t reduced_hi =
-        vpadd_s32(pairwise_reduced_acc_2, pairwise_reduced_acc_3);
-    int32x4_t reduced = vcombine_s32(reduced_lo, reduced_hi);
-    // Add bias values.
-    int32x4_t bias_vec = vld1q_s32(bias_ptr);
-    bias_ptr += 4;
-    reduced = vaddq_s32(reduced, bias_vec);
-    int left_shift = accum_shift > 0 ? accum_shift : 0;
-    int right_shift = accum_shift > 0 ? 0 : -accum_shift;
-    reduced = vshlq_s32(reduced, vdupq_n_s32(left_shift));
-    // Multiply by the fixed-point multiplier.
-    reduced = vqrdmulhq_n_s32(reduced, accum_multiplier);
-    // Rounding-shift-right.
-    using gemmlowp::RoundingDivideByPOT;
-    reduced = RoundingDivideByPOT(reduced, right_shift);
-    // Narrow values down to 16 bit signed.
-    const int16x4_t res16 = vqmovn_s32(reduced);
-    vst1_s16(output_ptr, res16);
-    output_ptr += 4;
-  }
-}
-#endif
-
-#ifdef GEMMLOWP_NEON
-inline void GEMVForLstmCellWithSymmetricRange(
-    const RuntimeShape& input_shape, const uint8* input_data,
-    const RuntimeShape& weights_shape, const uint8* weights_data,
-    const RuntimeShape& bias_shape, const int32* bias_data,
-    int32 accum_multiplier, int accum_shift, const RuntimeShape& output_shape,
-    int16* output_data) {
-  ruy::profiler::ScopeLabel label("GEMVForLstmCellWithSymmetricRange");
-  TFLITE_DCHECK_GE(input_shape.DimensionsCount(), 1);
-  TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2);
-  TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1);
-  const int output_dim_count = output_shape.DimensionsCount();
-  const int weights_dim_count = weights_shape.DimensionsCount();
-  TFLITE_DCHECK_EQ(FlatSizeSkipDim(output_shape, output_dim_count - 1), 1);
-  const int input_size = FlatSizeSkipDim(input_shape, 0);
-  const int output_size = MatchingDim(weights_shape, weights_dim_count - 2,
-                                      output_shape, output_dim_count - 1);
-  // This special fast path for quantized LSTM cells does not try to support
-  // odd sizes that we haven't encountered in any LSTM cell, that would
-  // require special code (that would go untested until any LSTM cell
-  // exercises it). We just guard our assumptions about size evenness with
-  // the following assertions.
-  TFLITE_DCHECK(!(output_size % 4));
-  TFLITE_DCHECK(!(input_size % 64));
-  const int32* bias_ptr = bias_data;
-  int16* output_ptr = output_data;
-  const uint8x16_t signbit = vdupq_n_u8(0x80);
-  for (int in = 0; in < input_size; in += 32) {
-    optimized_ops_preload_l1_keep(input_data + in);
-  }
-  const int left_shift = accum_shift > 0 ? accum_shift : 0;
-  const int right_shift = accum_shift > 0 ? 0 : -accum_shift;
-  for (int out = 0; out < output_size; out += 4) {
-    // Load the bias values
-    int32x4_t bias_vec = vld1q_s32(bias_ptr);
-    bias_ptr += 4;
-
-    // Clear accumulators. We use 2 accumulator registers per row,
-    // for 4 rows. row_accumRN is the N-th accumulator for row R.
-    int32x4_t row_accum00 = vdupq_n_s32(0);
-    int32x4_t row_accum01 = vdupq_n_s32(0);
-    int32x4_t row_accum10 = vdupq_n_s32(0);
-    int32x4_t row_accum11 = vdupq_n_s32(0);
-    int32x4_t row_accum20 = vdupq_n_s32(0);
-    int32x4_t row_accum21 = vdupq_n_s32(0);
-    int32x4_t row_accum30 = vdupq_n_s32(0);
-    int32x4_t row_accum31 = vdupq_n_s32(0);
-
-    // kReadAhead parametrizes how far ahead we prefetch weights into L1 cache.
-    const int kReadAhead = 512;
-    // Prefetch the first weights values.
-    for (int k = 0; k < kReadAhead; k += 64) {
-      optimized_ops_preload_l1_stream(weights_data + (out + 0) * input_size +
-                                      k);
-      optimized_ops_preload_l1_stream(weights_data + (out + 1) * input_size +
-                                      k);
-      optimized_ops_preload_l1_stream(weights_data + (out + 2) * input_size +
-                                      k);
-      optimized_ops_preload_l1_stream(weights_data + (out + 3) * input_size +
-                                      k);
-    }
-    // Loop along the rows, handling 64 bytes per iteration because that's
-    // cache line size on most current ARM-architecture CPUs.
-    for (int in = 0; in < input_size; in += 64) {
-      // Prefetch some future weights values.
-      optimized_ops_preload_l1_stream(weights_data + (out + 0) * input_size +
-                                      in + kReadAhead);
-      optimized_ops_preload_l1_stream(weights_data + (out + 1) * input_size +
-                                      in + kReadAhead);
-      optimized_ops_preload_l1_stream(weights_data + (out + 2) * input_size +
-                                      in + kReadAhead);
-      optimized_ops_preload_l1_stream(weights_data + (out + 3) * input_size +
-                                      in + kReadAhead);
-
-      // We will use 2 local 16-bit accumulators per row, for 2 rows.
-      // See below (*) for the rationale of processing only 2 rows at a time.
-      // local_accumRN is the N-th local accumulator for row R.
-      int16x8_t local_accum00;
-      int16x8_t local_accum01;
-      int16x8_t local_accum10;
-      int16x8_t local_accum11;
-
-      // Load 64 bytes of input activations values. Convert to signed int8
-      // by flipping the sign bit (i.e. subtracting 128, the required
-      // zero_point value).
-      int8x16_t input0 = vreinterpretq_s8_u8(
-          veorq_u8(signbit, vld1q_u8(input_data + in + 16 * 0)));
-      int8x16_t input1 = vreinterpretq_s8_u8(
-          veorq_u8(signbit, vld1q_u8(input_data + in + 16 * 1)));
-      int8x16_t input2 = vreinterpretq_s8_u8(
-          veorq_u8(signbit, vld1q_u8(input_data + in + 16 * 2)));
-      int8x16_t input3 = vreinterpretq_s8_u8(
-          veorq_u8(signbit, vld1q_u8(input_data + in + 16 * 3)));
-
-      // Beginning of the core accumulation. Notice how while we have 4
-      // rows to process, this code is taking care of only 2 rows at a time,
-      // thus being divided into two parts looking similar ("Rows 0 and 1" and
-      // "Rows 2 and 3").
-      //
-      // (*) The rationale for handling only 2 rows at a time is to avoid
-      // cache aliasing issues on 4-way set-associative L1-cache CPUs, such
-      // as Cortex-A53. With sufficiently large, power-of-two matrix dimensions,
-      // we may find ourselves in a situation where rows alias each other in
-      // the L1 cache, and moreover may also mutually alias with the input
-      // activations. If we try to load 4 rows at a time, together with the
-      // input activations, that may be 5 mutually-aliasing vectors, resulting
-      // in constant mutual eviction from L1 cache. Handling 2 rows at a time
-      // here largely mitigates these issues, and seems at least to be very
-      // effective on Cortex-A53:
-      //                          Before       After
-      // big (Cortex-A73)         2.85 ms      2.85 ms
-      // little (Cortex-A53)      11.0 ms      5.16 ms
-
-      // Rows 0 and 1:
-      // Load 64 bytes of weights values from each row. Convert to signed int8
-      // by flipping the sign bit (i.e. subtracting 128, the required
-      // zero_point value).
-      int8x16_t weights00 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 0) * input_size + in + 16 * 0)));
-      int8x16_t weights01 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 0) * input_size + in + 16 * 1)));
-      int8x16_t weights02 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 0) * input_size + in + 16 * 2)));
-      int8x16_t weights03 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 0) * input_size + in + 16 * 3)));
-      int8x16_t weights10 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 1) * input_size + in + 16 * 0)));
-      int8x16_t weights11 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 1) * input_size + in + 16 * 1)));
-      int8x16_t weights12 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 1) * input_size + in + 16 * 2)));
-      int8x16_t weights13 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 1) * input_size + in + 16 * 3)));
-      // Multiply-accumulate into local 16-bit accumulators.
-      // We can accumulate two products without overflow because weights are
-      // required to never be -128, so each product is at most 127^2 in absolute
-      // value.
-      local_accum00 = vmull_s8(vget_low_s8(weights00), vget_low_s8(input0));
-      local_accum01 = vmull_s8(vget_low_s8(weights01), vget_low_s8(input1));
-      local_accum10 = vmull_s8(vget_low_s8(weights10), vget_low_s8(input0));
-      local_accum11 = vmull_s8(vget_low_s8(weights11), vget_low_s8(input1));
-      local_accum00 = vmlal_s8(local_accum00, vget_high_s8(weights00),
-                               vget_high_s8(input0));
-      local_accum01 = vmlal_s8(local_accum01, vget_high_s8(weights01),
-                               vget_high_s8(input1));
-      local_accum10 = vmlal_s8(local_accum10, vget_high_s8(weights10),
-                               vget_high_s8(input0));
-      local_accum11 = vmlal_s8(local_accum11, vget_high_s8(weights11),
-                               vget_high_s8(input1));
-      // Pairwise add and accumulate into 32-bit accumulators
-      row_accum00 = vpadalq_s16(row_accum00, local_accum00);
-      row_accum01 = vpadalq_s16(row_accum01, local_accum01);
-      row_accum10 = vpadalq_s16(row_accum10, local_accum10);
-      row_accum11 = vpadalq_s16(row_accum11, local_accum11);
-      // Multiply-accumulate into local 16-bit accumulators.
-      // We can accumulate two products without overflow because weights are
-      // required to never be -128, so each product is at most 127^2 in absolute
-      // value.
-      local_accum00 = vmull_s8(vget_low_s8(weights02), vget_low_s8(input2));
-      local_accum01 = vmull_s8(vget_low_s8(weights03), vget_low_s8(input3));
-      local_accum10 = vmull_s8(vget_low_s8(weights12), vget_low_s8(input2));
-      local_accum11 = vmull_s8(vget_low_s8(weights13), vget_low_s8(input3));
-      local_accum00 = vmlal_s8(local_accum00, vget_high_s8(weights02),
-                               vget_high_s8(input2));
-      local_accum01 = vmlal_s8(local_accum01, vget_high_s8(weights03),
-                               vget_high_s8(input3));
-      local_accum10 = vmlal_s8(local_accum10, vget_high_s8(weights12),
-                               vget_high_s8(input2));
-      local_accum11 = vmlal_s8(local_accum11, vget_high_s8(weights13),
-                               vget_high_s8(input3));
-      // Pairwise add and accumulate into 32-bit accumulators
-      row_accum00 = vpadalq_s16(row_accum00, local_accum00);
-      row_accum01 = vpadalq_s16(row_accum01, local_accum01);
-      row_accum10 = vpadalq_s16(row_accum10, local_accum10);
-      row_accum11 = vpadalq_s16(row_accum11, local_accum11);
-
-      // Rows 2 and 3:
-      // Load 64 bytes of weights values from each row. Convert to signed int8
-      // by flipping the sign bit (i.e. subtracting 128, the required
-      // zero_point value).
-      weights00 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 2) * input_size + in + 16 * 0)));
-      weights01 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 2) * input_size + in + 16 * 1)));
-      weights02 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 2) * input_size + in + 16 * 2)));
-      weights03 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 2) * input_size + in + 16 * 3)));
-      weights10 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 3) * input_size + in + 16 * 0)));
-      weights11 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 3) * input_size + in + 16 * 1)));
-      weights12 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 3) * input_size + in + 16 * 2)));
-      weights13 = vreinterpretq_s8_u8(veorq_u8(
-          signbit,
-          vld1q_u8(weights_data + (out + 3) * input_size + in + 16 * 3)));
-      // Multiply-accumulate into local 16-bit accumulators.
-      // We can accumulate two products without overflow because weights are
-      // required to never be -128, so each product is at most 127^2 in absolute
-      // value.
-      local_accum00 = vmull_s8(vget_low_s8(weights00), vget_low_s8(input0));
-      local_accum01 = vmull_s8(vget_low_s8(weights01), vget_low_s8(input1));
-      local_accum10 = vmull_s8(vget_low_s8(weights10), vget_low_s8(input0));
-      local_accum11 = vmull_s8(vget_low_s8(weights11), vget_low_s8(input1));
-      local_accum00 = vmlal_s8(local_accum00, vget_high_s8(weights00),
-                               vget_high_s8(input0));
-      local_accum01 = vmlal_s8(local_accum01, vget_high_s8(weights01),
-                               vget_high_s8(input1));
-      local_accum10 = vmlal_s8(local_accum10, vget_high_s8(weights10),
-                               vget_high_s8(input0));
-      local_accum11 = vmlal_s8(local_accum11, vget_high_s8(weights11),
-                               vget_high_s8(input1));
-      // Pairwise add and accumulate into 32-bit accumulators
-      row_accum20 = vpadalq_s16(row_accum20, local_accum00);
-      row_accum21 = vpadalq_s16(row_accum21, local_accum01);
-      row_accum30 = vpadalq_s16(row_accum30, local_accum10);
-      row_accum31 = vpadalq_s16(row_accum31, local_accum11);
-      // Multiply-accumulate into local 16-bit accumulators.
-      // We can accumulate two products without overflow because weights are
-      // required to never be -128, so each product is at most 127^2 in absolute
-      // value.
-      local_accum00 = vmull_s8(vget_low_s8(weights02), vget_low_s8(input2));
-      local_accum01 = vmull_s8(vget_low_s8(weights03), vget_low_s8(input3));
-      local_accum10 = vmull_s8(vget_low_s8(weights12), vget_low_s8(input2));
-      local_accum11 = vmull_s8(vget_low_s8(weights13), vget_low_s8(input3));
-      local_accum00 = vmlal_s8(local_accum00, vget_high_s8(weights02),
-                               vget_high_s8(input2));
-      local_accum01 = vmlal_s8(local_accum01, vget_high_s8(weights03),
-                               vget_high_s8(input3));
-      local_accum10 = vmlal_s8(local_accum10, vget_high_s8(weights12),
-                               vget_high_s8(input2));
-      local_accum11 = vmlal_s8(local_accum11, vget_high_s8(weights13),
-                               vget_high_s8(input3));
-      // Pairwise add and accumulate into 32-bit accumulators
-      row_accum20 = vpadalq_s16(row_accum20, local_accum00);
-      row_accum21 = vpadalq_s16(row_accum21, local_accum01);
-      row_accum30 = vpadalq_s16(row_accum30, local_accum10);
-      row_accum31 = vpadalq_s16(row_accum31, local_accum11);
-    }
-
-    row_accum00 = vaddq_s32(row_accum00, row_accum01);
-    row_accum10 = vaddq_s32(row_accum10, row_accum11);
-    row_accum20 = vaddq_s32(row_accum20, row_accum21);
-    row_accum30 = vaddq_s32(row_accum30, row_accum31);
-    // Horizontally reduce accumulators
-    int32x2_t pairwise_reduced_acc_0, pairwise_reduced_acc_1,
-        pairwise_reduced_acc_2, pairwise_reduced_acc_3;
-    pairwise_reduced_acc_0 =
-        vpadd_s32(vget_low_s32(row_accum00), vget_high_s32(row_accum00));
-    pairwise_reduced_acc_1 =
-        vpadd_s32(vget_low_s32(row_accum10), vget_high_s32(row_accum10));
-    pairwise_reduced_acc_2 =
-        vpadd_s32(vget_low_s32(row_accum20), vget_high_s32(row_accum20));
-    pairwise_reduced_acc_3 =
-        vpadd_s32(vget_low_s32(row_accum30), vget_high_s32(row_accum30));
-    const int32x2_t reduced_lo =
-        vpadd_s32(pairwise_reduced_acc_0, pairwise_reduced_acc_1);
-    const int32x2_t reduced_hi =
-        vpadd_s32(pairwise_reduced_acc_2, pairwise_reduced_acc_3);
-    int32x4_t reduced = vcombine_s32(reduced_lo, reduced_hi);
-    // Add bias values.
-    reduced = vaddq_s32(reduced, bias_vec);
-    reduced = vshlq_s32(reduced, vdupq_n_s32(left_shift));
-    // Multiply by the fixed-point multiplier.
-    reduced = vqrdmulhq_n_s32(reduced, accum_multiplier);
-    // Rounding-shift-right.
-    using gemmlowp::RoundingDivideByPOT;
-    reduced = RoundingDivideByPOT(reduced, right_shift);
-    // Narrow values down to 16 bit signed.
-    const int16x4_t res16 = vqmovn_s32(reduced);
-    vst1_s16(output_ptr, res16);
-    output_ptr += 4;
-  }
-}
-#endif
-
-inline void FullyConnected(
-    const FullyConnectedParams& params, const RuntimeShape& input_shape,
-    const uint8* input_data, const RuntimeShape& filter_shape,
-    const uint8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data_int32, const RuntimeShape& output_shape,
-    int16* output_data, gemmlowp::GemmContext* gemmlowp_context) {
-  ruy::profiler::ScopeLabel label("FullyConnected/Uint8Int16");
-  const int32 input_offset = params.input_offset;
-  const int32 filter_offset = params.weights_offset;
-  const int32 output_offset = params.output_offset;
-  const int32 output_multiplier = params.output_multiplier;
-  const int output_shift = params.output_shift;
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  // This is a copy of the reference implementation. We do not currently have a
-  // properly optimized version.
-  (void)gemmlowp_context;  // only used in properly optimized code.
-  TFLITE_DCHECK_LE(output_activation_min, output_activation_max);
-  TFLITE_DCHECK_EQ(output_offset, 0);
-  TFLITE_DCHECK_GE(filter_shape.DimensionsCount(), 2);
-  TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1);
-
-  // TODO(benoitjacob): This really should be:
-  //     const int batches = ArraySize(output_dims, 1);
-  // but the current --variable_batch hack consists in overwriting the 3rd
-  // dimension with the runtime batch size, as we don't keep track for each
-  // array of which dimension is the batch dimension in it.
-  const int output_dim_count = output_shape.DimensionsCount();
-  const int filter_dim_count = filter_shape.DimensionsCount();
-  const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1);
-  const int output_depth = MatchingDim(filter_shape, filter_dim_count - 2,
-                                       output_shape, output_dim_count - 1);
-  const int accum_depth = filter_shape.Dims(filter_dim_count - 1);
-
-  // Implementation of the fully connected node suited to the inside of an LSTM
-  // cell. The operands are 8-bit integers, the accumulators are internally
-  // 32bit integers, and the output is 16-bit fixed-point with 3 integer bits so
-  // the output range is [-2^3, 2^3] == [-8, 8]. The rationale for that
-  // is explained in the function comment above.
-#ifdef GEMMLOWP_NEON
-  if (batches == 1 && input_offset == -128 && output_activation_min == -32768 &&
-      output_activation_max == 32767) {
-    if (filter_offset == -128 && !(output_depth % 4) && !(accum_depth % 64)) {
-      GEMVForLstmCellWithSymmetricRange(
-          input_shape, input_data, filter_shape, filter_data, bias_shape,
-          bias_data_int32, output_multiplier, output_shift, output_shape,
-          output_data);
-      return;
-    }
-    if (!(output_depth % 4) && !(accum_depth % 8)) {
-      GEMVForLstmCell(input_shape, input_data, filter_shape, filter_data,
-                      filter_offset, bias_shape, bias_data_int32,
-                      output_multiplier, output_shift, output_shape,
-                      output_data);
-      return;
-    }
-  }
-#endif
-  gemmlowp::MatrixMap weights_matrix(
-      filter_data, output_depth, accum_depth);
-  gemmlowp::MatrixMap input_matrix(
-      input_data, accum_depth, batches);
-  gemmlowp::MatrixMap output_matrix(
-      output_data, output_depth, batches);
-  typedef gemmlowp::VectorMap
-      ColVectorMap;
-  ColVectorMap bias_vector(bias_data_int32, output_depth);
-  gemmlowp::OutputStageBiasAddition bias_addition_stage;
-  bias_addition_stage.bias_vector = bias_vector;
-  gemmlowp::OutputStageScaleInt32ByFixedPointAndExponent scale_stage;
-  scale_stage.result_offset_after_shift = 0;
-  scale_stage.result_fixedpoint_multiplier = output_multiplier;
-  // Note that this shift is negated wrt ordinary FC.
-  scale_stage.result_exponent = output_shift;
-  gemmlowp::OutputStageClamp clamp_stage;
-  clamp_stage.min = output_activation_min;
-  clamp_stage.max = output_activation_max;
-  gemmlowp::OutputStageSaturatingCastToInt16 saturating_cast_int16_stage;
-  auto output_pipeline =
-      std::make_tuple(bias_addition_stage, scale_stage, clamp_stage,
-                      saturating_cast_int16_stage);
-  gemmlowp::GemmWithOutputPipeline(
-      gemmlowp_context, weights_matrix, input_matrix, &output_matrix,
-      filter_offset, input_offset, output_pipeline);
-}
-
-inline void FullyConnected(const uint8* input_data, const Dims<4>& input_dims,
-                           int32 input_offset, const uint8* filter_data,
-                           const Dims<4>& filter_dims, int32 filter_offset,
-                           const int32* bias_data, const Dims<4>& bias_dims,
-                           int32 output_offset, int32 output_multiplier,
-                           int output_shift, int32 output_activation_min,
-                           int32 output_activation_max, uint8* output_data,
-                           const Dims<4>& output_dims,
-                           gemmlowp::GemmContext* gemmlowp_context) {
-  tflite::FullyConnectedParams op_params;
-  op_params.input_offset = input_offset;
-  op_params.weights_offset = filter_offset;
-  op_params.output_offset = output_offset;
-  op_params.output_multiplier = output_multiplier;
-  // Legacy ops used mixed left and right shifts. Now all are +ve-means-left.
-  op_params.output_shift = kReverseShift * output_shift;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-
-  FullyConnected(op_params, DimsToShape(input_dims), input_data,
-                 DimsToShape(filter_dims), filter_data, DimsToShape(bias_dims),
-                 bias_data, DimsToShape(output_dims), output_data,
-                 gemmlowp_context);
-}
-
-inline void FullyConnected(
-    const uint8* input_data, const Dims<4>& input_dims, int32 input_offset,
-    const uint8* filter_data, const Dims<4>& filter_dims, int32 filter_offset,
-    const int32* bias_data_int32, const Dims<4>& bias_dims, int32 output_offset,
-    int32 output_multiplier, int output_shift, int32 output_activation_min,
-    int32 output_activation_max, int16* output_data, const Dims<4>& output_dims,
-    gemmlowp::GemmContext* gemmlowp_context) {
-  tflite::FullyConnectedParams op_params;
-  op_params.input_offset = input_offset;
-  op_params.weights_offset = filter_offset;
-  op_params.output_offset = output_offset;
-  op_params.output_multiplier = output_multiplier;
-  // Legacy ops used mixed left and right shifts. Now all are +ve-means-left.
-  op_params.output_shift = kReverseShift * output_shift;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-
-  FullyConnected(op_params, DimsToShape(input_dims), input_data,
-                 DimsToShape(filter_dims), filter_data, DimsToShape(bias_dims),
-                 bias_data_int32, DimsToShape(output_dims), output_data,
-                 gemmlowp_context);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void FullyConnected(const uint8* input_data, const Dims<4>& input_dims,
-                    int32 input_offset, const uint8* filter_data,
-                    const Dims<4>& filter_dims, int32 filter_offset,
-                    const int32* bias_data, const Dims<4>& bias_dims,
-                    int32 output_offset, int32 output_multiplier,
-                    int output_shift, int32 output_activation_min,
-                    int32 output_activation_max, uint8* output_data,
-                    const Dims<4>& output_dims,
-                    gemmlowp::GemmContext* gemmlowp_context) {
-  static_assert(Ac == FusedActivationFunctionType::kNone ||
-                    Ac == FusedActivationFunctionType::kRelu ||
-                    Ac == FusedActivationFunctionType::kRelu6 ||
-                    Ac == FusedActivationFunctionType::kRelu1,
-                "");
-  FullyConnected(input_data, input_dims, input_offset, filter_data, filter_dims,
-                 filter_offset, bias_data, bias_dims, output_offset,
-                 output_multiplier, output_shift, output_activation_min,
-                 output_activation_max, output_data, output_dims,
-                 gemmlowp_context);
-}
-
-#ifdef USE_NEON
-inline void LegacyInt8FullyConnectedAsGEMVWorkerImpl(
-    const RuntimeShape& input_shape, const int8_t* input_data,
-    int32 input_offset, const RuntimeShape& filter_shape,
-    const int8_t* filter_data, int32 filter_offset,
-    const RuntimeShape& bias_shape, const int32* bias_data, int32 output_offset,
-    int32 output_multiplier, int output_shift, int32 output_activation_min,
-    int32 output_activation_max, const RuntimeShape& output_shape,
-    int8_t* output_data, int row_start, int row_end) {
-  ruy::profiler::ScopeLabel label("FullyConnectedAsGEMVInt8/8bit");
-  TFLITE_DCHECK_GE(input_shape.DimensionsCount(), 1);
-  TFLITE_DCHECK_GE(filter_shape.DimensionsCount(), 2);
-  TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1);
-  const int output_dim_count = output_shape.DimensionsCount();
-  TFLITE_DCHECK_EQ(FlatSizeSkipDim(output_shape, output_dim_count - 1), 1);
-  const int input_size = FlatSizeSkipDim(input_shape, 0);
-  static constexpr int kPeel = 4;
-  const bool shift_left = (output_shift > 0);
-  TFLITE_DCHECK_GE(row_end - row_start, kPeel);
-
-  for (int out = row_start; out < row_end; out += kPeel) {
-    out = std::min(out, row_end - kPeel);
-    int32x4_t acc0 = vdupq_n_s32(0);
-    int32x4_t acc1 = acc0;
-    int32x4_t acc2 = acc0;
-    int32x4_t acc3 = acc0;
-    const int16x8_t input_offset_vec = vdupq_n_s16(input_offset);
-    const int16x8_t filter_offset_vec = vdupq_n_s16(filter_offset);
-    int in = 0;
-    for (; in <= input_size - 16; in += 16) {
-      const int8x16_t input_val_s8 = vld1q_s8(input_data + in);
-      const int8_t* filter_ptr = filter_data + in + out * input_size;
-      int8x16_t filter_val_s8_0 = vld1q_s8(filter_ptr);
-      filter_ptr += input_size;
-      int8x16_t filter_val_s8_1 = vld1q_s8(filter_ptr);
-      filter_ptr += input_size;
-      int8x16_t filter_val_s8_2 = vld1q_s8(filter_ptr);
-      filter_ptr += input_size;
-      int8x16_t filter_val_s8_3 = vld1q_s8(filter_ptr);
-      int16x8_t input_val_0, input_val_1;
-      int8x8_t low = vget_low_s8(input_val_s8);
-      int8x8_t high = vget_high_s8(input_val_s8);
-      input_val_0 = vmovl_s8(low);
-      input_val_1 = vmovl_s8(high);
-      input_val_0 = vaddq_s16(input_val_0, input_offset_vec);
-      input_val_1 = vaddq_s16(input_val_1, input_offset_vec);
-      low = vget_low_s8(filter_val_s8_0);
-      high = vget_high_s8(filter_val_s8_0);
-      int16x8_t filter_val_0_0 = vmovl_s8(low);
-      int16x8_t filter_val_0_1 = vmovl_s8(high);
-      filter_val_0_0 = vaddq_s16(filter_val_0_0, filter_offset_vec);
-      filter_val_0_1 = vaddq_s16(filter_val_0_1, filter_offset_vec);
-      low = vget_low_s8(filter_val_s8_1);
-      high = vget_high_s8(filter_val_s8_1);
-      int16x8_t filter_val_1_0 = vmovl_s8(low);
-      int16x8_t filter_val_1_1 = vmovl_s8(high);
-      filter_val_1_0 = vaddq_s16(filter_val_1_0, filter_offset_vec);
-      filter_val_1_1 = vaddq_s16(filter_val_1_1, filter_offset_vec);
-      low = vget_low_s8(filter_val_s8_2);
-      high = vget_high_s8(filter_val_s8_2);
-      int16x8_t filter_val_2_0 = vmovl_s8(low);
-      int16x8_t filter_val_2_1 = vmovl_s8(high);
-      filter_val_2_0 = vaddq_s16(filter_val_2_0, filter_offset_vec);
-      filter_val_2_1 = vaddq_s16(filter_val_2_1, filter_offset_vec);
-      low = vget_low_s8(filter_val_s8_3);
-      high = vget_high_s8(filter_val_s8_3);
-      int16x8_t filter_val_3_0 = vmovl_s8(low);
-      int16x8_t filter_val_3_1 = vmovl_s8(high);
-      filter_val_3_0 = vaddq_s16(filter_val_3_0, filter_offset_vec);
-      filter_val_3_1 = vaddq_s16(filter_val_3_1, filter_offset_vec);
-      acc0 = vmlal_s16(acc0, vget_low_s16(filter_val_0_0),
-                       vget_low_s16(input_val_0));
-      acc1 = vmlal_s16(acc1, vget_low_s16(filter_val_1_0),
-                       vget_low_s16(input_val_0));
-      acc2 = vmlal_s16(acc2, vget_low_s16(filter_val_2_0),
-                       vget_low_s16(input_val_0));
-      acc3 = vmlal_s16(acc3, vget_low_s16(filter_val_3_0),
-                       vget_low_s16(input_val_0));
-      acc0 = vmlal_s16(acc0, vget_low_s16(filter_val_0_1),
-                       vget_low_s16(input_val_1));
-      acc1 = vmlal_s16(acc1, vget_low_s16(filter_val_1_1),
-                       vget_low_s16(input_val_1));
-      acc2 = vmlal_s16(acc2, vget_low_s16(filter_val_2_1),
-                       vget_low_s16(input_val_1));
-      acc3 = vmlal_s16(acc3, vget_low_s16(filter_val_3_1),
-                       vget_low_s16(input_val_1));
-      acc0 = vmlal_s16(acc0, vget_high_s16(filter_val_0_0),
-                       vget_high_s16(input_val_0));
-      acc1 = vmlal_s16(acc1, vget_high_s16(filter_val_1_0),
-                       vget_high_s16(input_val_0));
-      acc2 = vmlal_s16(acc2, vget_high_s16(filter_val_2_0),
-                       vget_high_s16(input_val_0));
-      acc3 = vmlal_s16(acc3, vget_high_s16(filter_val_3_0),
-                       vget_high_s16(input_val_0));
-      acc0 = vmlal_s16(acc0, vget_high_s16(filter_val_0_1),
-                       vget_high_s16(input_val_1));
-      acc1 = vmlal_s16(acc1, vget_high_s16(filter_val_1_1),
-                       vget_high_s16(input_val_1));
-      acc2 = vmlal_s16(acc2, vget_high_s16(filter_val_2_1),
-                       vget_high_s16(input_val_1));
-      acc3 = vmlal_s16(acc3, vget_high_s16(filter_val_3_1),
-                       vget_high_s16(input_val_1));
-    }
-    for (; in <= input_size - 8; in += 8) {
-      const int8x8_t input_val_s8 = vld1_s8(input_data + in);
-      const int8_t* filter_ptr = filter_data + in + out * input_size;
-      int8x8_t filter_val_s8_0 = vld1_s8(filter_ptr);
-      filter_ptr += input_size;
-      int8x8_t filter_val_s8_1 = vld1_s8(filter_ptr);
-      filter_ptr += input_size;
-      int8x8_t filter_val_s8_2 = vld1_s8(filter_ptr);
-      filter_ptr += input_size;
-      int8x8_t filter_val_s8_3 = vld1_s8(filter_ptr);
-      int16x8_t input_val = vmovl_s8(input_val_s8);
-      input_val = vaddq_s16(input_val, input_offset_vec);
-      int16x8_t filter_val_0 = vmovl_s8(filter_val_s8_0);
-      filter_val_0 = vaddq_s16(filter_val_0, filter_offset_vec);
-      int16x8_t filter_val_1 = vmovl_s8(filter_val_s8_1);
-      filter_val_1 = vaddq_s16(filter_val_1, filter_offset_vec);
-      int16x8_t filter_val_2 = vmovl_s8(filter_val_s8_2);
-      filter_val_2 = vaddq_s16(filter_val_2, filter_offset_vec);
-      int16x8_t filter_val_3 = vmovl_s8(filter_val_s8_3);
-      filter_val_3 = vaddq_s16(filter_val_3, filter_offset_vec);
-      acc0 =
-          vmlal_s16(acc0, vget_low_s16(filter_val_0), vget_low_s16(input_val));
-      acc1 =
-          vmlal_s16(acc1, vget_low_s16(filter_val_1), vget_low_s16(input_val));
-      acc2 =
-          vmlal_s16(acc2, vget_low_s16(filter_val_2), vget_low_s16(input_val));
-      acc3 =
-          vmlal_s16(acc3, vget_low_s16(filter_val_3), vget_low_s16(input_val));
-      acc0 = vmlal_s16(acc0, vget_high_s16(filter_val_0),
-                       vget_high_s16(input_val));
-      acc1 = vmlal_s16(acc1, vget_high_s16(filter_val_1),
-                       vget_high_s16(input_val));
-      acc2 = vmlal_s16(acc2, vget_high_s16(filter_val_2),
-                       vget_high_s16(input_val));
-      acc3 = vmlal_s16(acc3, vget_high_s16(filter_val_3),
-                       vget_high_s16(input_val));
-    }
-    if (in < input_size) {
-      int32 buf[16];
-      vst1q_s32(buf + 0, acc0);
-      vst1q_s32(buf + 4, acc1);
-      vst1q_s32(buf + 8, acc2);
-      vst1q_s32(buf + 12, acc3);
-      for (; in < input_size; in++) {
-        int lane = (in + 8 - input_size) % 4;
-        const int32 input_val = input_data[in] + input_offset;
-        for (int k = 0; k < kPeel; k++) {
-          int32 filter_val =
-              filter_data[in + (out + k) * input_size] + filter_offset;
-          buf[lane + 4 * k] += filter_val * input_val;
-        }
-      }
-      acc0 = vld1q_s32(buf + 0);
-      acc1 = vld1q_s32(buf + 4);
-      acc2 = vld1q_s32(buf + 8);
-      acc3 = vld1q_s32(buf + 12);
-    }
-
-    // Horizontally reduce accumulators
-    int32x2_t pairwise_reduced_acc_0 =
-        vpadd_s32(vget_low_s32(acc0), vget_high_s32(acc0));
-    int32x2_t pairwise_reduced_acc_1 =
-        vpadd_s32(vget_low_s32(acc1), vget_high_s32(acc1));
-    int32x2_t pairwise_reduced_acc_2 =
-        vpadd_s32(vget_low_s32(acc2), vget_high_s32(acc2));
-    int32x2_t pairwise_reduced_acc_3 =
-        vpadd_s32(vget_low_s32(acc3), vget_high_s32(acc3));
-    const int32x2_t reduced_lo =
-        vpadd_s32(pairwise_reduced_acc_0, pairwise_reduced_acc_1);
-    const int32x2_t reduced_hi =
-        vpadd_s32(pairwise_reduced_acc_2, pairwise_reduced_acc_3);
-    int32x4_t reduced = vcombine_s32(reduced_lo, reduced_hi);
-    // Add bias values.
-    int32x4_t bias_vec = vld1q_s32(bias_data + out);
-    reduced = vaddq_s32(reduced, bias_vec);
-    if (shift_left) {
-      const int32 multiplier_power_of_two = 1 << output_shift;
-      reduced = vmulq_n_s32(reduced, multiplier_power_of_two);
-      reduced = vqrdmulhq_n_s32(reduced, output_multiplier);
-    } else {
-      // Multiply by the fixed-point multiplier.
-      reduced = vqrdmulhq_n_s32(reduced, output_multiplier);
-      // Rounding-shift-right.
-      using gemmlowp::RoundingDivideByPOT;
-      reduced = RoundingDivideByPOT(reduced, -output_shift);
-    }
-    // Add the output offset.
-    const int32x4_t output_offset_vec = vdupq_n_s32(output_offset);
-    reduced = vaddq_s32(reduced, output_offset_vec);
-    // Narrow values down to 16 bit signed.
-    const int16x4_t res16 = vqmovn_s32(reduced);
-    // Narrow values down to 8 bit signed, saturating.
-    int8x8_t res8 = vqmovn_s16(vcombine_s16(res16, res16));
-    // Apply the clamping from the activation function
-    res8 = vmax_s8(res8, vdup_n_s8(output_activation_min));
-    res8 = vmin_s8(res8, vdup_n_s8(output_activation_max));
-    // Store results to destination.
-    vst1_lane_s8(output_data + out + 0, res8, 0);
-    vst1_lane_s8(output_data + out + 1, res8, 1);
-    vst1_lane_s8(output_data + out + 2, res8, 2);
-    vst1_lane_s8(output_data + out + 3, res8, 3);
-  }
-}
-
-struct LegacyInt8FullyConnectedAsGEMVWorkerTask : public gemmlowp::Task {
-  LegacyInt8FullyConnectedAsGEMVWorkerTask(
-      const RuntimeShape& input_shape, const int8_t* input_data,
-      int32 input_offset, const RuntimeShape& filter_shape,
-      const int8_t* filter_data, int32 filter_offset,
-      const RuntimeShape& bias_shape, const int32* bias_data,
-      int32 output_offset, int32 output_multiplier, int output_shift,
-      int32 output_activation_min, int32 output_activation_max,
-      const RuntimeShape& output_shape, int8_t* output_data, int row_start,
-      int row_end)
-      : input_shape_(input_shape),
-        input_data_(input_data),
-        input_offset_(input_offset),
-        filter_shape_(filter_shape),
-        filter_data_(filter_data),
-        filter_offset_(filter_offset),
-        bias_shape_(bias_shape),
-        bias_data_(bias_data),
-        output_offset_(output_offset),
-        output_multiplier_(output_multiplier),
-        output_shift_(output_shift),
-        output_activation_min_(output_activation_min),
-        output_activation_max_(output_activation_max),
-        output_shape_(output_shape),
-        output_data_(output_data),
-        row_start_(row_start),
-        row_end_(row_end) {}
-
-  void Run() override {
-    LegacyInt8FullyConnectedAsGEMVWorkerImpl(
-        input_shape_, input_data_, input_offset_, filter_shape_, filter_data_,
-        filter_offset_, bias_shape_, bias_data_, output_offset_,
-        output_multiplier_, output_shift_, output_activation_min_,
-        output_activation_max_, output_shape_, output_data_, row_start_,
-        row_end_);
-  }
-
-  const RuntimeShape& input_shape_;
-  const int8_t* input_data_;
-  int32 input_offset_;
-  const RuntimeShape& filter_shape_;
-  const int8_t* filter_data_;
-  int32 filter_offset_;
-  const RuntimeShape& bias_shape_;
-  const int32* bias_data_;
-  int32 output_offset_;
-  int32 output_multiplier_;
-  int output_shift_;
-  int32 output_activation_min_;
-  int32 output_activation_max_;
-  const RuntimeShape& output_shape_;
-  int8_t* output_data_;
-  int row_start_;
-  int row_end_;
-};
-
-inline void LegacyInt8FullyConnectedAsGEMV(
-    const RuntimeShape& input_shape, const int8_t* input_data,
-    int32 input_offset, const RuntimeShape& filter_shape,
-    const int8_t* filter_data, int32 filter_offset,
-    const RuntimeShape& bias_shape, const int32* bias_data, int32 output_offset,
-    int32 output_multiplier, int output_shift, int32 output_activation_min,
-    int32 output_activation_max, const RuntimeShape& output_shape,
-    int8_t* output_data, gemmlowp::GemmContext* gemmlowp_context) {
-  const int output_dim_count = output_shape.DimensionsCount();
-  const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1);
-  const int output_rows = output_shape.Dims(output_dim_count - 1);
-  const int input_size = FlatSizeSkipDim(input_shape, 0);
-  static constexpr int kKernelRows = 4;
-  const int thread_count = gemmlowp::HowManyThreads(
-      gemmlowp_context->max_num_threads(), output_rows, batches, input_size);
-  if (thread_count == 1) {
-    // Single-thread case: do the computation on the current thread, don't
-    // use a threadpool
-    LegacyInt8FullyConnectedAsGEMVWorkerImpl(
-        input_shape, input_data, input_offset, filter_shape, filter_data,
-        filter_offset, bias_shape, bias_data, output_offset, output_multiplier,
-        output_shift, output_activation_min, output_activation_max,
-        output_shape, output_data, 0, output_rows);
-    return;
-  }
-
-  // Multi-threaded case: use the gemmlowp context's threadpool.
-  TFLITE_DCHECK_GT(thread_count, 1);
-  std::vector tasks;
-  // TODO(b/131746020) don't create new heap allocations every time.
-  // At least we make it a single heap allocation by using reserve().
-  tasks.reserve(thread_count);
-  const int kRowsPerWorker = gemmlowp::RoundUp(
-      gemmlowp::CeilQuotient(output_rows, thread_count));
-  int row_start = 0;
-  for (int i = 0; i < thread_count; ++i) {
-    int row_end = std::min(output_rows, row_start + kRowsPerWorker);
-    tasks.emplace_back(input_shape, input_data, input_offset, filter_shape,
-                       filter_data, filter_offset, bias_shape, bias_data,
-                       output_offset, output_multiplier, output_shift,
-                       output_activation_min, output_activation_max,
-                       output_shape, output_data, row_start, row_end);
-    row_start = row_end;
-  }
-  TFLITE_DCHECK_EQ(row_start, output_rows);
-  gemmlowp_context->workers_pool()->Execute(tasks.size(), tasks.data());
-}
-#endif  // USE_NEON
-
-inline void FullyConnected(
-    const FullyConnectedParams& params, const RuntimeShape& input_shape,
-    const int8* input_data, const RuntimeShape& filter_shape,
-    const int8* filter_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape, int8* output_data,
-    gemmlowp::GemmContext* gemmlowp_context) {
-  ruy::profiler::ScopeLabel label("FullyConnectedInt8/8bit");
-
-#ifdef USE_NEON
-  const int32 input_offset = params.input_offset;
-  const int32 filter_offset = params.weights_offset;
-  const int32 output_offset = params.output_offset;
-  const int32 output_multiplier = params.output_multiplier;
-  const int output_shift = params.output_shift;
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  TFLITE_DCHECK_GE(filter_shape.DimensionsCount(), 2);
-  TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1);
-  // TODO(benoitjacob): This really should be:
-  //     const int batches = ArraySize(output_dims, 1);
-  // but the current --variable_batch hack consists in overwriting the 3rd
-  // dimension with the runtime batch size, as we don't keep track for each
-  // array of which dimension is the batch dimension in it.
-  const int output_dim_count = output_shape.DimensionsCount();
-  const int filter_dim_count = filter_shape.DimensionsCount();
-  const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1);
-  if (batches == 1) {
-    const int output_size = MatchingDim(filter_shape, filter_dim_count - 2,
-                                        output_shape, output_dim_count - 1);
-    if (output_size >= 4) {
-      return LegacyInt8FullyConnectedAsGEMV(
-          input_shape, input_data, input_offset, filter_shape, filter_data,
-          filter_offset, bias_shape, bias_data, output_offset,
-          output_multiplier, output_shift, output_activation_min,
-          output_activation_max, output_shape, output_data, gemmlowp_context);
-    }
-  }
-#endif  // USE_NEON
-
-#ifdef GEMMLOWP_NEON
-  const int filter_rows = filter_shape.Dims(filter_dim_count - 2);
-  const int filter_cols = filter_shape.Dims(filter_dim_count - 1);
-  TFLITE_DCHECK_EQ(filter_shape.FlatSize(), filter_rows * filter_cols);
-  const int output_rows = output_shape.Dims(output_dim_count - 1);
-  TFLITE_DCHECK_EQ(output_rows, filter_rows);
-  TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_rows);
-
-  gemmlowp::MatrixMap filter_matrix(
-      filter_data, output_rows, filter_cols, filter_cols);
-  gemmlowp::MatrixMap input_matrix(
-      input_data, filter_cols, batches, filter_cols);
-  gemmlowp::MatrixMap output_matrix(
-      output_data, output_rows, batches, output_rows);
-  const auto& output_pipeline = GemmlowpOutputPipelineInt8::MakeExp(
-      bias_data, output_rows, output_offset, output_multiplier, output_shift,
-      output_activation_min, output_activation_max);
-
-  gemmlowp::GemmWithOutputPipeline<
-      int8, int8, gemmlowp::SignedL8R8WithLhsNonzeroBitDepthParams>(
-      gemmlowp_context, filter_matrix, input_matrix, &output_matrix,
-      filter_offset, input_offset, output_pipeline);
-  return;
-#endif  // GEMMLOWP_NEON
-
-  // If both GEMMLOWP_NEON && NEON paths are skipped, fallback to reference
-  // implementation.
-  reference_integer_ops::FullyConnected(params, input_shape, input_data,
-                                        filter_shape, filter_data, bias_shape,
-                                        bias_data, output_shape, output_data);
-}
-
-struct LegacyShuffledFullyConnectedWorkerTask : gemmlowp::Task {
-  LegacyShuffledFullyConnectedWorkerTask(const uint8* input_data,
-                                         const int8* shuffled_weights_data,
-                                         int batches, int output_depth,
-                                         int output_stride, int accum_depth,
-                                         const int32* bias_data,
-                                         int32 output_multiplier,
-                                         int output_shift, int16* output_data)
-      : input_data_(input_data),
-        shuffled_weights_data_(shuffled_weights_data),
-        batches_(batches),
-        output_depth_(output_depth),
-        output_stride_(output_stride),
-        accum_depth_(accum_depth),
-        bias_data_(bias_data),
-        output_multiplier_(output_multiplier),
-        output_shift_(output_shift),
-        output_data_(output_data) {}
-
-  void Run() override {
-    ShuffledFullyConnectedWorkerImpl(
-        input_data_, shuffled_weights_data_, batches_, output_depth_,
-        output_stride_, accum_depth_, bias_data_, output_multiplier_,
-        output_shift_, output_data_);
-  }
-
-  const uint8* input_data_;
-  const int8* shuffled_weights_data_;
-  int batches_;
-  int output_depth_;
-  int output_stride_;
-  int accum_depth_;
-  const int32* bias_data_;
-  int32 output_multiplier_;
-  int output_shift_;
-  int16* output_data_;
-};
-
-inline void ShuffledFullyConnected(
-    const FullyConnectedParams& params, const RuntimeShape& input_shape,
-    const uint8* input_data, const RuntimeShape& weights_shape,
-    const uint8* shuffled_weights_data, const RuntimeShape& bias_shape,
-    const int32* bias_data, const RuntimeShape& output_shape,
-    int16* output_data, uint8* shuffled_input_workspace_data,
-    gemmlowp::GemmContext* gemmlowp_context) {
-  ruy::profiler::ScopeLabel label("ShuffledFullyConnected/8bit");
-  const int32 output_multiplier = params.output_multiplier;
-  const int output_shift = params.output_shift;
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  (void)gemmlowp_context;  // only used in optimized code.
-  TFLITE_DCHECK_EQ(output_activation_min, -32768);
-  TFLITE_DCHECK_EQ(output_activation_max, 32767);
-  TFLITE_DCHECK_GE(input_shape.DimensionsCount(), 1);
-  TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2);
-  TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1);
-  // TODO(benoitjacob): This really should be:
-  //     const int batches = ArraySize(output_dims, 1);
-  // but the current --variable_batch hack consists in overwriting the 3rd
-  // dimension with the runtime batch size, as we don't keep track for each
-  // array of which dimension is the batch dimension in it.
-  const int output_dim_count = output_shape.DimensionsCount();
-  const int weights_dim_count = weights_shape.DimensionsCount();
-  const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1);
-  const int output_depth = MatchingDim(weights_shape, weights_dim_count - 2,
-                                       output_shape, output_dim_count - 1);
-  const int accum_depth = weights_shape.Dims(weights_dim_count - 1);
-  TFLITE_DCHECK((accum_depth % 16) == 0);
-  TFLITE_DCHECK((output_depth % 4) == 0);
-  // Shuffled weights have had their sign bit (0x80) pre-flipped (xor'd)
-  // so that just reinterpreting them as int8 values is equivalent to
-  // subtracting 128 from them, thus implementing for free the subtraction of
-  // the zero_point value 128.
-  const int8* int8_shuffled_weights_data =
-      reinterpret_cast(shuffled_weights_data);
-
-  // Shuffling and xoring of input activations into the workspace buffer
-  if (batches == 1) {
-#ifdef USE_NEON
-    const uint8x16_t signbit = vdupq_n_u8(0x80);
-    for (int i = 0; i < accum_depth; i += 16) {
-      uint8x16_t val = vld1q_u8(input_data + i);
-      val = veorq_u8(val, signbit);
-      vst1q_u8(shuffled_input_workspace_data + i, val);
-    }
-#else
-    for (int i = 0; i < accum_depth; i++) {
-      shuffled_input_workspace_data[i] = input_data[i] ^ 0x80;
-    }
-#endif
-  } else if (batches == 4) {
-    uint8* shuffled_input_workspace_ptr = shuffled_input_workspace_data;
-    int c = 0;
-#ifdef USE_NEON
-    const uint8x16_t signbit = vdupq_n_u8(0x80);
-    for (c = 0; c < accum_depth; c += 16) {
-      const uint8* src_data_ptr = input_data + c;
-      uint8x16_t val0 = vld1q_u8(src_data_ptr + 0 * accum_depth);
-      uint8x16_t val1 = vld1q_u8(src_data_ptr + 1 * accum_depth);
-      uint8x16_t val2 = vld1q_u8(src_data_ptr + 2 * accum_depth);
-      uint8x16_t val3 = vld1q_u8(src_data_ptr + 3 * accum_depth);
-      val0 = veorq_u8(val0, signbit);
-      val1 = veorq_u8(val1, signbit);
-      val2 = veorq_u8(val2, signbit);
-      val3 = veorq_u8(val3, signbit);
-      vst1q_u8(shuffled_input_workspace_ptr + 0, val0);
-      vst1q_u8(shuffled_input_workspace_ptr + 16, val1);
-      vst1q_u8(shuffled_input_workspace_ptr + 32, val2);
-      vst1q_u8(shuffled_input_workspace_ptr + 48, val3);
-      shuffled_input_workspace_ptr += 64;
-    }
-#else
-    for (c = 0; c < accum_depth; c += 16) {
-      for (int b = 0; b < 4; b++) {
-        const uint8* src_data_ptr = input_data + b * accum_depth + c;
-        for (int j = 0; j < 16; j++) {
-          uint8 src_val = *src_data_ptr++;
-          // Flip the sign bit, so that the kernel will only need to
-          // reinterpret these uint8 values as int8, getting for free the
-          // subtraction of the zero_point value 128.
-          uint8 dst_val = src_val ^ 0x80;
-          *shuffled_input_workspace_ptr++ = dst_val;
-        }
-      }
-    }
-#endif
-  } else {
-    TFLITE_DCHECK(false);
-    return;
-  }
-
-  static constexpr int kKernelRows = 4;
-  const int thread_count = gemmlowp::HowManyThreads(
-      gemmlowp_context->max_num_threads(), output_depth, batches, accum_depth);
-  if (thread_count == 1) {
-    // Single-thread case: do the computation on the current thread, don't
-    // use a threadpool
-    ShuffledFullyConnectedWorkerImpl(
-        shuffled_input_workspace_data, int8_shuffled_weights_data, batches,
-        output_depth, output_depth, accum_depth, bias_data, output_multiplier,
-        output_shift, output_data);
-    return;
-  }
-
-  // Multi-threaded case: use the gemmlowp context's threadpool.
-  TFLITE_DCHECK_GT(thread_count, 1);
-  std::vector tasks(thread_count);
-  const int kRowsPerWorker = gemmlowp::RoundUp(
-      gemmlowp::CeilQuotient(output_depth, thread_count));
-  int row_start = 0;
-  for (int i = 0; i < thread_count; i++) {
-    int row_end = std::min(output_depth, row_start + kRowsPerWorker);
-    tasks[i] = new LegacyShuffledFullyConnectedWorkerTask(
-        shuffled_input_workspace_data,
-        int8_shuffled_weights_data + row_start * accum_depth, batches,
-        row_end - row_start, output_depth, accum_depth, bias_data + row_start,
-        output_multiplier, output_shift, output_data + row_start);
-    row_start = row_end;
-  }
-  TFLITE_DCHECK_EQ(row_start, output_depth);
-  gemmlowp_context->workers_pool()->LegacyExecuteAndDestroyTasks(tasks);
-}
-
-inline void ShuffledFullyConnected(
-    const uint8* input_data, const Dims<4>& input_dims,
-    const uint8* shuffled_weights_data, const Dims<4>& weights_dims,
-    const int32* bias_data, const Dims<4>& bias_dims, int32 output_multiplier,
-    int output_shift, int32 output_activation_min, int32 output_activation_max,
-    int16* output_data, const Dims<4>& output_dims,
-    uint8* shuffled_input_workspace_data,
-    gemmlowp::GemmContext* gemmlowp_context) {
-  tflite::FullyConnectedParams op_params;
-  op_params.output_multiplier = output_multiplier;
-  // Legacy ops used mixed left and right shifts. Now all are +ve-means-left.
-  op_params.output_shift = kReverseShift * output_shift;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-
-  ShuffledFullyConnected(op_params, DimsToShape(input_dims), input_data,
-                         DimsToShape(weights_dims), shuffled_weights_data,
-                         DimsToShape(bias_dims), bias_data,
-                         DimsToShape(output_dims), output_data,
-                         shuffled_input_workspace_data, gemmlowp_context);
-}
-
-template 
-inline void ExtractPatchIntoBufferColumn(
-    const Dims<4>& input_dims, int w, int h, int b, int kheight, int kwidth,
-    int stride_width, int stride_height, int pad_width, int pad_height,
-    int in_width, int in_height, int in_depth, int single_buffer_length,
-    int buffer_id, const T* in_data, T* conv_buffer_data, uint8 zero_byte) {
-  ExtractPatchIntoBufferColumn(
-      DimsToShape(input_dims), w, h, b, kheight, kwidth, stride_width,
-      stride_height, pad_width, pad_height, in_width, in_height, in_depth,
-      single_buffer_length, buffer_id, in_data, conv_buffer_data, zero_byte);
-}
-
-template 
-void DilatedIm2col(const T* input_data, const Dims<4>& input_dims,
-                   const Dims<4>& filter_dims, int stride_width,
-                   int stride_height, int dilation_width_factor,
-                   int dilation_height_factor, int pad_width, int pad_height,
-                   const Dims<4>& output_dims, uint8 zero_byte,
-                   T* im2col_data) {
-  tflite::ConvParams op_params;
-  // Padding type is ignored, but still set.
-  op_params.padding_type = PaddingType::kSame;
-  op_params.padding_values.width = pad_width;
-  op_params.padding_values.height = pad_height;
-  op_params.stride_width = stride_width;
-  op_params.stride_height = stride_height;
-  op_params.dilation_width_factor = dilation_width_factor;
-  op_params.dilation_height_factor = dilation_height_factor;
-
-  DilatedIm2col(op_params, zero_byte, DimsToShape(input_dims), input_data,
-                DimsToShape(filter_dims), DimsToShape(output_dims),
-                im2col_data);
-}
-
-template 
-void Im2col(const T* input_data, const Dims<4>& input_dims, int stride_width,
-            int stride_height, int pad_width, int pad_height, int kheight,
-            int kwidth, uint8 zero_byte, T* output_data,
-            const Dims<4>& output_dims) {
-  tflite::ConvParams op_params;
-  // Padding type is ignored, but still set.
-  op_params.padding_type = PaddingType::kSame;
-  op_params.padding_values.width = pad_width;
-  op_params.padding_values.height = pad_height;
-  op_params.stride_width = stride_width;
-  op_params.stride_height = stride_height;
-  op_params.dilation_width_factor = 1;
-  op_params.dilation_height_factor = 1;
-
-  Im2col(op_params, kheight, kwidth, zero_byte, DimsToShape(input_dims),
-         input_data, DimsToShape(output_dims), output_data);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void Im2col(const T* input_data, const Dims<4>& input_dims, int stride,
-            int pad_width, int pad_height, int kheight, int kwidth,
-            uint8 zero_byte, T* output_data, const Dims<4>& output_dims) {
-  Im2col(input_data, input_dims, stride, stride, pad_width, pad_height, kheight,
-         kwidth, zero_byte, output_data, output_dims);
-}
-
-inline void Conv(const ConvParams& params, const RuntimeShape& input_shape,
-                 const float* input_data, const RuntimeShape& filter_shape,
-                 const float* filter_data, const RuntimeShape& bias_shape,
-                 const float* bias_data, const RuntimeShape& output_shape,
-                 float* output_data, const RuntimeShape& im2col_shape,
-                 float* im2col_data) {
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  const float output_activation_min = params.float_activation_min;
-  const float output_activation_max = params.float_activation_max;
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  (void)im2col_data;
-  (void)im2col_shape;
-  ruy::profiler::ScopeLabel label("Conv");
-
-  // NB: the float 0.0f value is represented by all zero bytes.
-  const uint8 float_zero_byte = 0x00;
-  const float* gemm_input_data = nullptr;
-  const RuntimeShape* gemm_input_shape = nullptr;
-  const int filter_width = filter_shape.Dims(2);
-  const int filter_height = filter_shape.Dims(1);
-  const bool need_dilated_im2col =
-      dilation_width_factor != 1 || dilation_height_factor != 1;
-  const bool need_im2col = stride_width != 1 || stride_height != 1 ||
-                           filter_width != 1 || filter_height != 1;
-  if (need_dilated_im2col) {
-    DilatedIm2col(params, float_zero_byte, input_shape, input_data,
-                  filter_shape, output_shape, im2col_data);
-    gemm_input_data = im2col_data;
-    gemm_input_shape = &im2col_shape;
-  } else if (need_im2col) {
-    TFLITE_DCHECK(im2col_data);
-    Im2col(params, filter_height, filter_width, float_zero_byte, input_shape,
-           input_data, im2col_shape, im2col_data);
-    gemm_input_data = im2col_data;
-    gemm_input_shape = &im2col_shape;
-  } else {
-    // TODO(aselle): We need to make sure to not send im2col if it is not
-    // needed.
-    TFLITE_DCHECK(!im2col_data);
-    gemm_input_data = input_data;
-    gemm_input_shape = &input_shape;
-  }
-
-  // The following code computes matrix multiplication c = a * transponse(b)
-  // with CBLAS, where:
-  // * `a` is a matrix with dimensions (m, k).
-  // * `b` is a matrix with dimensions (n, k), so transpose(b) is (k, n).
-  // * `c` is a matrix with dimensions (m, n).
-  // The naming of variables are aligned with CBLAS specification here.
-  const float* a = gemm_input_data;
-  const float* b = filter_data;
-  float* c = output_data;
-  const int gemm_input_dims = gemm_input_shape->DimensionsCount();
-  int m = FlatSizeSkipDim(*gemm_input_shape, gemm_input_dims - 1);
-  int n = output_shape.Dims(3);
-  int k = gemm_input_shape->Dims(gemm_input_dims - 1);
-
-#if defined(TF_LITE_USE_CBLAS) && defined(__APPLE__)
-  // The stride of matrix a, b and c respectively.
-  int stride_a = k;
-  int stride_b = k;
-  int stride_c = n;
-
-  cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans, m, n, k, 1.0f, a,
-              stride_a, b, stride_b, 0.0f, c, stride_c);
-#else
-  // When an optimized CBLAS implementation is not available, fall back
-  // to using Eigen.
-  typedef Eigen::Matrix
-      Matrix;
-  typedef Eigen::Map MatrixRef;
-  typedef Eigen::Map ConstMatrixRef;
-
-  MatrixRef matrix_c(c, m, n);
-  ConstMatrixRef matrix_a(a, m, k);
-  ConstMatrixRef matrix_b(b, n, k);
-
-  // The following special casing for when a or b is a vector is required
-  // as Eigen seem to fail to make this optimization on its own.
-  if (n == 1) {
-    ruy::profiler::ScopeLabel label("GEMV");
-    matrix_c.col(0).noalias() = matrix_a * matrix_b.row(0).transpose();
-  } else if (m == 1) {
-    ruy::profiler::ScopeLabel label("GEMV");
-    matrix_c.row(0).noalias() = matrix_a.row(0) * matrix_b.transpose();
-  } else {
-    ruy::profiler::ScopeLabel label("GEMM");
-    matrix_c.noalias() = matrix_a * matrix_b.transpose();
-  }
-
-#endif  //  defined(TF_LITE_USE_CBLAS) && defined(__APPLE__)
-
-  optimized_ops::AddBiasAndEvalActivationFunction(
-      output_activation_min, output_activation_max, bias_shape, bias_data,
-      output_shape, output_data);
-}
-
-inline void Conv(const float* input_data, const Dims<4>& input_dims,
-                 const float* filter_data, const Dims<4>& filter_dims,
-                 const float* bias_data, const Dims<4>& bias_dims,
-                 int stride_width, int stride_height, int dilation_width_factor,
-                 int dilation_height_factor, int pad_width, int pad_height,
-                 float output_activation_min, float output_activation_max,
-                 float* output_data, const Dims<4>& output_dims,
-                 float* im2col_data, const Dims<4>& im2col_dims) {
-  tflite::ConvParams op_params;
-  // Padding type is ignored, but still set.
-  op_params.padding_type = PaddingType::kSame;
-  op_params.padding_values.width = pad_width;
-  op_params.padding_values.height = pad_height;
-  op_params.stride_width = stride_width;
-  op_params.stride_height = stride_height;
-  op_params.dilation_width_factor = dilation_width_factor;
-  op_params.dilation_height_factor = dilation_height_factor;
-  op_params.float_activation_min = output_activation_min;
-  op_params.float_activation_max = output_activation_max;
-
-  Conv(op_params, DimsToShape(input_dims), input_data, DimsToShape(filter_dims),
-       filter_data, DimsToShape(bias_dims), bias_data, DimsToShape(output_dims),
-       output_data, DimsToShape(im2col_dims), im2col_data);
-}
-
-inline void HybridConv(const int8_t* input_data, const Dims<4>& input_dims,
-                       const int8_t* filter_data, const Dims<4>& filter_dims,
-                       const float* bias_data, const Dims<4>& bias_dims,
-                       int stride_width, int stride_height, int pad_width,
-                       int pad_height, float* scaling_factors_ptr,
-                       float output_activation_min, float output_activation_max,
-                       int32_t* scratch_data, const Dims<4>& scratch_dims,
-                       float* output_data, const Dims<4>& output_dims,
-                       int8_t* im2col_data, const Dims<4>& im2col_dims,
-                       CpuBackendContext* context) {
-  tflite::ConvParams op_params;
-  // Padding type is ignored, but still set.
-  op_params.padding_type = PaddingType::kSame;
-  op_params.padding_values.width = pad_width;
-  op_params.padding_values.height = pad_height;
-  op_params.stride_width = stride_width;
-  op_params.stride_height = stride_height;
-  op_params.float_activation_min = output_activation_min;
-  op_params.float_activation_max = output_activation_max;
-
-  HybridConv(op_params, scaling_factors_ptr, DimsToShape(input_dims),
-             input_data, DimsToShape(filter_dims), filter_data,
-             DimsToShape(bias_dims), bias_data, DimsToShape(scratch_dims),
-             scratch_data, DimsToShape(output_dims), output_data,
-             DimsToShape(im2col_dims), im2col_data, context);
-}
-
-template 
-void Conv(const float* input_data, const Dims<4>& input_dims,
-          const float* filter_data, const Dims<4>& filter_dims,
-          const float* bias_data, const Dims<4>& bias_dims, int stride_width,
-          int stride_height, int dilation_width_factor,
-          int dilation_height_factor, int pad_width, int pad_height,
-          float* output_data, const Dims<4>& output_dims, float* im2col_data,
-          const Dims<4>& im2col_dims) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-  Conv(input_data, input_dims, filter_data, filter_dims, bias_data, bias_dims,
-       stride_width, stride_height, dilation_width_factor,
-       dilation_height_factor, pad_width, pad_height, output_activation_min,
-       output_activation_max, output_data, output_dims, im2col_data,
-       im2col_dims);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void Conv(const float* input_data, const Dims<4>& input_dims,
-          const float* filter_data, const Dims<4>& filter_dims,
-          const float* bias_data, const Dims<4>& bias_dims, int stride_width,
-          int stride_height, int pad_width, int pad_height, float* output_data,
-          const Dims<4>& output_dims, float* im2col_data,
-          const Dims<4>& im2col_dims) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-  Conv(input_data, input_dims, filter_data, filter_dims, bias_data, bias_dims,
-       stride_width, stride_height, 1, 1, pad_width, pad_height,
-       output_activation_min, output_activation_max, output_data, output_dims,
-       im2col_data, im2col_dims);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void Conv(const float* input_data, const Dims<4>& input_dims,
-          const float* filter_data, const Dims<4>& filter_dims,
-          const float* bias_data, const Dims<4>& bias_dims, int stride,
-          int pad_width, int pad_height, float* output_data,
-          const Dims<4>& output_dims, float* im2col_data,
-          const Dims<4>& im2col_dims) {
-  Conv(input_data, input_dims, filter_data, filter_dims, bias_data,
-           bias_dims, stride, stride, 1, 1, pad_width, pad_height, output_data,
-           output_dims, im2col_data, im2col_dims);
-}
-
-inline void Conv(const ConvParams& params, const RuntimeShape& input_shape,
-                 const uint8* input_data, const RuntimeShape& filter_shape,
-                 const uint8* filter_data, const RuntimeShape& bias_shape,
-                 const int32* bias_data, const RuntimeShape& output_shape,
-                 uint8* output_data, const RuntimeShape& im2col_shape,
-                 uint8* im2col_data, gemmlowp::GemmContext* gemmlowp_context) {
-  ruy::profiler::ScopeLabel label("Conv/8bit");
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const int dilation_width_factor = params.dilation_width_factor;
-  const int dilation_height_factor = params.dilation_height_factor;
-  const int32 input_offset = params.input_offset;
-  const int32 filter_offset = params.weights_offset;
-  const int32 output_offset = params.output_offset;
-  const int32 output_multiplier = params.output_multiplier;
-  const int output_shift = params.output_shift;
-  const int32 output_activation_min = params.quantized_activation_min;
-  const int32 output_activation_max = params.quantized_activation_max;
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  const uint8* gemm_input_data = nullptr;
-  const RuntimeShape* gemm_input_shape = nullptr;
-  const int filter_width = filter_shape.Dims(2);
-  const int filter_height = filter_shape.Dims(1);
-  const bool need_dilated_im2col =
-      dilation_width_factor != 1 || dilation_height_factor != 1;
-  const bool need_im2col = stride_width != 1 || stride_height != 1 ||
-                           filter_width != 1 || filter_height != 1;
-  if (need_dilated_im2col) {
-    TFLITE_DCHECK(im2col_data);
-    const int input_zero_point = -input_offset;
-    TFLITE_DCHECK_GE(input_zero_point, 0);
-    TFLITE_DCHECK_LE(input_zero_point, 255);
-    DilatedIm2col(params, input_zero_point, input_shape, input_data,
-                  filter_shape, output_shape, im2col_data);
-    gemm_input_data = im2col_data;
-    gemm_input_shape = &im2col_shape;
-  } else if (need_im2col) {
-    TFLITE_DCHECK(im2col_data);
-    const int input_zero_point = -input_offset;
-    TFLITE_DCHECK_GE(input_zero_point, 0);
-    TFLITE_DCHECK_LE(input_zero_point, 255);
-    Im2col(params, filter_height, filter_width, input_zero_point, input_shape,
-           input_data, im2col_shape, im2col_data);
-    gemm_input_data = im2col_data;
-    gemm_input_shape = &im2col_shape;
-  } else {
-    TFLITE_DCHECK(!im2col_data);
-    gemm_input_data = input_data;
-    gemm_input_shape = &input_shape;
-  }
-
-  const int gemm_input_rows = gemm_input_shape->Dims(3);
-  // Using FlatSizeSkipDim causes segfault in some contexts (see b/79927784).
-  // The root cause has not yet been identified though. Same applies below for
-  // the other calls commented out. This is a partial rollback of cl/196819423.
-  // const int gemm_input_cols = FlatSizeSkipDim(*gemm_input_shape, 3);
-  const int gemm_input_cols = gemm_input_shape->Dims(0) *
-                              gemm_input_shape->Dims(1) *
-                              gemm_input_shape->Dims(2);
-  const int filter_rows = filter_shape.Dims(0);
-  // See b/79927784.
-  // const int filter_cols = FlatSizeSkipDim(filter_shape, 0);
-  const int filter_cols =
-      filter_shape.Dims(1) * filter_shape.Dims(2) * filter_shape.Dims(3);
-  const int output_rows = output_shape.Dims(3);
-  // See b/79927784.
-  // const int output_cols = FlatSizeSkipDim(output_shape, 3);
-  const int output_cols =
-      output_shape.Dims(0) * output_shape.Dims(1) * output_shape.Dims(2);
-  TFLITE_DCHECK_EQ(output_rows, filter_rows);
-  TFLITE_DCHECK_EQ(output_cols, gemm_input_cols);
-  TFLITE_DCHECK_EQ(filter_cols, gemm_input_rows);
-  TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_rows);
-
-#ifdef USE_NEON
-  if (gemm_input_cols == 1 && output_rows >= 4) {
-    RuntimeShape fc_filter_shape{
-        filter_shape.Dims(0),
-        filter_shape.Dims(filter_shape.DimensionsCount() - 1)};
-
-    return FullyConnectedAsGEMV(
-        *gemm_input_shape, gemm_input_data, input_offset, fc_filter_shape,
-        filter_data, filter_offset, bias_shape, bias_data, output_offset,
-        output_multiplier, output_shift, output_activation_min,
-        output_activation_max, output_shape, output_data, gemmlowp_context);
-  }
-#endif
-
-  gemmlowp::MatrixMap filter_matrix(
-      filter_data, filter_rows, filter_cols);
-  gemmlowp::MatrixMap input_matrix(
-      gemm_input_data, gemm_input_rows, gemm_input_cols);
-  gemmlowp::MatrixMap output_matrix(
-      output_data, output_rows, output_cols);
-  const auto& output_pipeline = GemmlowpOutputPipeline::MakeExp(
-      bias_data, output_rows, output_offset, output_multiplier, output_shift,
-      output_activation_min, output_activation_max);
-  gemmlowp::GemmWithOutputPipeline(
-      gemmlowp_context, filter_matrix, input_matrix, &output_matrix,
-      filter_offset, input_offset, output_pipeline);
-}
-
-inline void Conv(const uint8* input_data, const Dims<4>& input_dims,
-                 int32 input_offset, const uint8* filter_data,
-                 const Dims<4>& filter_dims, int32 filter_offset,
-                 const int32* bias_data, const Dims<4>& bias_dims,
-                 int stride_width, int stride_height, int dilation_width_factor,
-                 int dilation_height_factor, int pad_width, int pad_height,
-                 int32 output_offset, int32 output_multiplier, int output_shift,
-                 int32 output_activation_min, int32 output_activation_max,
-                 uint8* output_data, const Dims<4>& output_dims,
-                 uint8* im2col_data, const Dims<4>& im2col_dims,
-                 gemmlowp::GemmContext* gemmlowp_context) {
-  tflite::ConvParams op_params;
-  // Padding type is ignored, but still set.
-  op_params.padding_type = PaddingType::kSame;
-  op_params.padding_values.width = pad_width;
-  op_params.padding_values.height = pad_height;
-  op_params.stride_width = stride_width;
-  op_params.stride_height = stride_height;
-  op_params.dilation_width_factor = dilation_width_factor;
-  op_params.dilation_height_factor = dilation_height_factor;
-  op_params.input_offset = input_offset;
-  op_params.weights_offset = filter_offset;
-  op_params.output_offset = output_offset;
-  op_params.output_multiplier = output_multiplier;
-  // Legacy ops used mixed left and right shifts. Now all are +ve-means-left.
-  op_params.output_shift = kReverseShift * output_shift;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-
-  Conv(op_params, DimsToShape(input_dims), input_data, DimsToShape(filter_dims),
-       filter_data, DimsToShape(bias_dims), bias_data, DimsToShape(output_dims),
-       output_data, DimsToShape(im2col_dims), im2col_data, gemmlowp_context);
-}
-
-inline void Conv(const uint8* input_data, const Dims<4>& input_dims,
-                 int32 input_offset, const uint8* filter_data,
-                 const Dims<4>& filter_dims, int32 filter_offset,
-                 const int32* bias_data, const Dims<4>& bias_dims,
-                 int stride_width, int stride_height, int pad_width,
-                 int pad_height, int32 output_offset, int32 output_multiplier,
-                 int output_shift, int32 output_activation_min,
-                 int32 output_activation_max, uint8* output_data,
-                 const Dims<4>& output_dims, uint8* im2col_data,
-                 const Dims<4>& im2col_dims,
-                 gemmlowp::GemmContext* gemmlowp_context) {
-  Conv(input_data, input_dims, input_offset, filter_data, filter_dims,
-       filter_offset, bias_data, bias_dims, stride_width, stride_height, 1, 1,
-       pad_width, pad_height, output_offset, output_multiplier, output_shift,
-       output_activation_min, output_activation_max, output_data, output_dims,
-       im2col_data, im2col_dims, gemmlowp_context);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-inline void Conv(const uint8* input_data, const Dims<4>& input_dims,
-                 int32 input_offset, const uint8* filter_data,
-                 const Dims<4>& filter_dims, int32 filter_offset,
-                 const int32* bias_data, const Dims<4>& bias_dims,
-                 int stride_width, int stride_height, int pad_width,
-                 int pad_height, int32 output_offset, int32 output_multiplier,
-                 int output_shift, int32 output_activation_min,
-                 int32 output_activation_max, uint8* output_data,
-                 const Dims<4>& output_dims, uint8* im2col_data,
-                 const Dims<4>& im2col_dims,
-                 gemmlowp::GemmContext* gemmlowp_context) {
-  static_assert(Ac == FusedActivationFunctionType::kNone ||
-                    Ac == FusedActivationFunctionType::kRelu ||
-                    Ac == FusedActivationFunctionType::kRelu6 ||
-                    Ac == FusedActivationFunctionType::kRelu1,
-                "");
-  if (Ac == FusedActivationFunctionType::kNone) {
-    TFLITE_DCHECK_EQ(output_activation_min, 0);
-    TFLITE_DCHECK_EQ(output_activation_max, 255);
-  }
-  Conv(input_data, input_dims, input_offset, filter_data, filter_dims,
-       filter_offset, bias_data, bias_dims, stride_width, stride_height,
-       pad_width, pad_height, output_offset, output_multiplier, output_shift,
-       output_activation_min, output_activation_max, output_data, output_dims,
-       im2col_data, im2col_dims, gemmlowp_context);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void Conv(const uint8* input_data, const Dims<4>& input_dims,
-          int32 input_offset, const uint8* filter_data,
-          const Dims<4>& filter_dims, int32 filter_offset,
-          const int32* bias_data, const Dims<4>& bias_dims, int stride,
-          int pad_width, int pad_height, int32 output_offset,
-          int32 output_multiplier, int output_shift,
-          int32 output_activation_min, int32 output_activation_max,
-          uint8* output_data, const Dims<4>& output_dims, uint8* im2col_data,
-          const Dims<4>& im2col_dims, gemmlowp::GemmContext* gemmlowp_context) {
-  static_assert(Ac == FusedActivationFunctionType::kNone ||
-                    Ac == FusedActivationFunctionType::kRelu ||
-                    Ac == FusedActivationFunctionType::kRelu6 ||
-                    Ac == FusedActivationFunctionType::kRelu1,
-                "");
-  Conv(input_data, input_dims, input_offset, filter_data, filter_dims,
-       filter_offset, bias_data, bias_dims, stride, stride, pad_width,
-       pad_height, output_offset, output_multiplier, output_shift,
-       output_activation_min, output_activation_max, output_data, output_dims,
-       im2col_data, im2col_dims, gemmlowp_context);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void Im2col(const T* input_data, const Dims<4>& input_dims, int stride,
-            int pad_width, int pad_height, int kheight, int kwidth,
-            uint8 zero_byte, T* output_data, const Dims<4>& output_dims) {
-  Im2col(input_data, input_dims, stride, stride, pad_width, pad_height, kheight,
-         kwidth, zero_byte, output_data, output_dims);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void ConvAsGemm(const float* input_data, const Dims<4>& input_dims,
-                const float* filter_data, const Dims<4>& filter_dims,
-                const float* bias_data, const Dims<4>& bias_dims,
-                float* output_data, const Dims<4>& output_dims) {
-  ruy::profiler::ScopeLabel label("ConvAsGemm");
-
-  const auto input_matrix_map =
-      MapAsMatrixWithFirstDimAsRows(input_data, input_dims);
-  const auto filter_matrix_map =
-      MapAsMatrixWithLastDimAsCols(filter_data, filter_dims);
-  auto output_matrix_map =
-      MapAsMatrixWithFirstDimAsRows(output_data, output_dims);
-
-  Gemm(filter_matrix_map.transpose(), input_matrix_map, &output_matrix_map);
-
-  AddBiasAndEvalActivationFunction(bias_data, bias_dims, output_data,
-                                       output_dims);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void ConvAsGemm(const uint8* input_data, const Dims<4>& input_dims,
-                int32 input_offset, const uint8* filter_data,
-                const Dims<4>& filter_dims, int32 filter_offset,
-                const int32* bias_data, const Dims<4>& bias_dims,
-                int32 output_offset, int32 output_multiplier, int output_shift,
-                int32 output_activation_min, int32 output_activation_max,
-                uint8* output_data, const Dims<4>& output_dims,
-                gemmlowp::GemmContext* gemmlowp_context) {
-  ruy::profiler::ScopeLabel label("ConvAsGemm/8bit");
-  static_assert(Ac == FusedActivationFunctionType::kNone ||
-                    Ac == FusedActivationFunctionType::kRelu ||
-                    Ac == FusedActivationFunctionType::kRelu6 ||
-                    Ac == FusedActivationFunctionType::kRelu1,
-                "");
-  const int input_rows = input_dims.sizes[0];
-  const int input_cols = FlatSizeSkipDim(input_dims, 0);
-  const int filter_rows = filter_dims.sizes[3];
-  const int filter_cols = FlatSizeSkipDim(filter_dims, 3);
-  const int output_rows = output_dims.sizes[0];
-  const int output_cols = FlatSizeSkipDim(output_dims, 0);
-  TFLITE_DCHECK_EQ(output_rows, filter_rows);
-  TFLITE_DCHECK_EQ(output_cols, input_cols);
-  TFLITE_DCHECK_EQ(filter_cols, input_rows);
-  TFLITE_DCHECK_EQ(bias_dims.sizes[0], output_rows);
-  TFLITE_DCHECK_EQ(bias_dims.sizes[1], 1);
-  TFLITE_DCHECK_EQ(bias_dims.sizes[2], 1);
-  TFLITE_DCHECK_EQ(bias_dims.sizes[3], 1);
-  gemmlowp::MatrixMap filter_matrix(
-      filter_data, output_rows, filter_cols, filter_cols);
-  gemmlowp::MatrixMap input_matrix(
-      input_data, filter_cols, output_cols, filter_cols);
-  gemmlowp::MatrixMap output_matrix(
-      output_data, output_rows, output_cols, output_rows);
-  const auto& output_pipeline = GemmlowpOutputPipeline::MakeExp(
-      bias_data, output_rows, output_offset, output_multiplier, -output_shift,
-      output_activation_min, output_activation_max);
-  gemmlowp::GemmWithOutputPipeline(
-      gemmlowp_context, filter_matrix, input_matrix, &output_matrix,
-      filter_offset, input_offset, output_pipeline);
-}
-
-inline void TransposeConv(
-    const ConvParams& params, const RuntimeShape& input_shape,
-    const float* input_data, const RuntimeShape& filter_shape,
-    const float* filter_data, const RuntimeShape& output_shape,
-    float* output_data, const RuntimeShape& im2col_shape, float* im2col_data) {
-  ruy::profiler::ScopeLabel label("TransposeConv");
-  // Note we could use transposed weights with forward conv for unstrided
-  // cases. But we are already getting good performance with this code as-is.
-  TFLITE_DCHECK(im2col_data);
-  TransposeIm2col(params, 0, input_shape, input_data, filter_shape,
-                  output_shape, im2col_data);
-
-  const auto im2col_matrix_map =
-      MapAsMatrixWithLastDimAsRows(im2col_data, im2col_shape);
-  const auto filter_matrix_map =
-      MapAsMatrixWithFirstDimAsCols(filter_data, filter_shape);
-  auto output_matrix_map =
-      MapAsMatrixWithLastDimAsRows(output_data, output_shape);
-
-  Gemm(filter_matrix_map.transpose(), im2col_matrix_map, &output_matrix_map);
-}
-
-inline void TransposeConv(const float* input_data, const Dims<4>& input_dims,
-                          const float* filter_data, const Dims<4>& filter_dims,
-                          int stride_width, int stride_height, int pad_width,
-                          int pad_height, float* output_data,
-                          const Dims<4>& output_dims, float* im2col_data,
-                          const Dims<4>& im2col_dims) {
-  tflite::ConvParams op_params;
-  // Padding type is ignored, but still set.
-  op_params.padding_type = PaddingType::kSame;
-  op_params.padding_values.width = pad_width;
-  op_params.padding_values.height = pad_height;
-  op_params.stride_width = stride_width;
-  op_params.stride_height = stride_height;
-
-  TransposeConv(op_params, DimsToShape(input_dims), input_data,
-                DimsToShape(filter_dims), filter_data, DimsToShape(output_dims),
-                output_data, DimsToShape(im2col_dims), im2col_data);
-}
-
-inline void TransposeConvV2(
-    const ConvParams& params, const RuntimeShape& input_shape,
-    const float* input_data, const RuntimeShape& hwoi_ordered_filter_shape,
-    const float* hwoi_ordered_filter_data, const RuntimeShape& output_shape,
-    float* output_data, const RuntimeShape& col2im_shape, float* col2im_data,
-    CpuBackendContext* cpu_backend_context) {
-  TransposeConvV2(params, input_shape, input_data, hwoi_ordered_filter_shape,
-                  hwoi_ordered_filter_data, /*bias_shape*/ RuntimeShape(),
-                  /*bias_data*/ nullptr, output_shape, output_data,
-                  col2im_shape, col2im_data, cpu_backend_context);
-}
-
-template 
-void TransposeIm2col(const T* input_data, const Dims<4>& input_dims,
-                     const Dims<4>& filter_dims, int stride_width,
-                     int stride_height, int pad_width, int pad_height,
-                     const Dims<4>& output_dims, uint8 zero_byte,
-                     T* im2col_data) {
-  tflite::ConvParams op_params;
-  // Padding type is ignored, but still set.
-  op_params.padding_type = PaddingType::kSame;
-  op_params.padding_values.width = pad_width;
-  op_params.padding_values.height = pad_height;
-  op_params.stride_width = stride_width;
-  op_params.stride_height = stride_height;
-
-  TransposeIm2col(op_params, zero_byte, DimsToShape(input_dims), input_data,
-                  DimsToShape(filter_dims), DimsToShape(output_dims),
-                  im2col_data);
-}
-
-inline void LstmCell(
-    const LstmCellParams& params, const RuntimeShape& unextended_input_shape,
-    const float* input_data, const RuntimeShape& unextended_prev_activ_shape,
-    const float* prev_activ_data, const RuntimeShape& weights_shape,
-    const float* weights_data, const RuntimeShape& unextended_bias_shape,
-    const float* bias_data, const RuntimeShape& unextended_prev_state_shape,
-    const float* prev_state_data,
-    const RuntimeShape& unextended_output_state_shape, float* output_state_data,
-    const RuntimeShape& unextended_output_activ_shape, float* output_activ_data,
-    const RuntimeShape& unextended_concat_temp_shape, float* concat_temp_data,
-    const RuntimeShape& unextended_activ_temp_shape, float* activ_temp_data) {
-  ruy::profiler::ScopeLabel label("LstmCell");
-  TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_prev_activ_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_bias_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_prev_state_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_output_state_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_output_activ_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_concat_temp_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_activ_temp_shape.DimensionsCount(), 4);
-  const RuntimeShape input_shape =
-      RuntimeShape::ExtendedShape(4, unextended_input_shape);
-  const RuntimeShape prev_activ_shape =
-      RuntimeShape::ExtendedShape(4, unextended_prev_activ_shape);
-  const RuntimeShape bias_shape =
-      RuntimeShape::ExtendedShape(4, unextended_bias_shape);
-  const RuntimeShape prev_state_shape =
-      RuntimeShape::ExtendedShape(4, unextended_prev_state_shape);
-  const RuntimeShape output_state_shape =
-      RuntimeShape::ExtendedShape(4, unextended_output_state_shape);
-  const RuntimeShape output_activ_shape =
-      RuntimeShape::ExtendedShape(4, unextended_output_activ_shape);
-  const RuntimeShape concat_temp_shape =
-      RuntimeShape::ExtendedShape(4, unextended_concat_temp_shape);
-  const RuntimeShape activ_temp_shape =
-      RuntimeShape::ExtendedShape(4, unextended_activ_temp_shape);
-  TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2);
-
-  const int weights_dim_count = weights_shape.DimensionsCount();
-  MatchingDim(  // batches
-      input_shape, 0, prev_activ_shape, 0, prev_state_shape, 0,
-      output_state_shape, 0, output_activ_shape, 0);
-  MatchingDim(  // height
-      input_shape, 1, prev_activ_shape, 1, prev_state_shape, 1,
-      output_state_shape, 1, output_activ_shape, 1);
-  MatchingDim(  // width
-      input_shape, 2, prev_activ_shape, 2, prev_state_shape, 2,
-      output_state_shape, 2, output_activ_shape, 2);
-  const int input_depth = input_shape.Dims(3);
-  const int prev_activ_depth = prev_activ_shape.Dims(3);
-  const int total_input_depth = prev_activ_depth + input_depth;
-  TFLITE_DCHECK_EQ(weights_shape.Dims(weights_dim_count - 1),
-                   total_input_depth);
-  TFLITE_DCHECK_EQ(FlatSizeSkipDim(bias_shape, 3), 1);
-  const int intern_activ_depth =
-      MatchingDim(weights_shape, weights_dim_count - 2, bias_shape, 3);
-  TFLITE_DCHECK_EQ(weights_shape.FlatSize(),
-                   intern_activ_depth * total_input_depth);
-  TFLITE_DCHECK_EQ(intern_activ_depth % 4, 0);
-  const int output_depth =
-      MatchingDim(prev_state_shape, 3, prev_activ_shape, 3, output_state_shape,
-                  3, output_activ_shape, 3);
-  TFLITE_DCHECK_EQ(output_depth, intern_activ_depth / 4);
-
-  // Concatenate prev_activ and input data together
-  std::vector concat_input_arrays_data;
-  std::vector concat_input_arrays_shapes;
-  concat_input_arrays_data.push_back(input_data);
-  concat_input_arrays_data.push_back(prev_activ_data);
-  concat_input_arrays_shapes.push_back(&input_shape);
-  concat_input_arrays_shapes.push_back(&prev_activ_shape);
-  tflite::ConcatenationParams concat_params;
-  concat_params.axis = 3;
-  concat_params.inputs_count = concat_input_arrays_data.size();
-  Concatenation(concat_params, &(concat_input_arrays_shapes[0]),
-                &(concat_input_arrays_data[0]), concat_temp_shape,
-                concat_temp_data);
-
-  // Fully connected
-  tflite::FullyConnectedParams fc_params;
-  fc_params.float_activation_min = std::numeric_limits::lowest();
-  fc_params.float_activation_max = std::numeric_limits::max();
-  FullyConnected(fc_params, concat_temp_shape, concat_temp_data, weights_shape,
-                 weights_data, bias_shape, bias_data, activ_temp_shape,
-                 activ_temp_data);
-
-  // Map raw arrays to Eigen arrays so we can use Eigen's optimized array
-  // operations.
-  ArrayMap activ_temp_map =
-      MapAsArrayWithLastDimAsRows(activ_temp_data, activ_temp_shape);
-  auto input_gate_sm = activ_temp_map.block(0 * output_depth, 0, output_depth,
-                                            activ_temp_map.cols());
-  auto new_input_sm = activ_temp_map.block(1 * output_depth, 0, output_depth,
-                                           activ_temp_map.cols());
-  auto forget_gate_sm = activ_temp_map.block(2 * output_depth, 0, output_depth,
-                                             activ_temp_map.cols());
-  auto output_gate_sm = activ_temp_map.block(3 * output_depth, 0, output_depth,
-                                             activ_temp_map.cols());
-  ArrayMap prev_state_map =
-      MapAsArrayWithLastDimAsRows(prev_state_data, prev_state_shape);
-  ArrayMap output_state_map =
-      MapAsArrayWithLastDimAsRows(output_state_data, output_state_shape);
-  ArrayMap output_activ_map =
-      MapAsArrayWithLastDimAsRows(output_activ_data, output_activ_shape);
-
-  // Combined memory state and final output calculation
-  ruy::profiler::ScopeLabel label2("MemoryStateAndFinalOutput");
-  output_state_map =
-      input_gate_sm.unaryExpr(Eigen::internal::scalar_logistic_op()) *
-          new_input_sm.tanh() +
-      forget_gate_sm.unaryExpr(Eigen::internal::scalar_logistic_op()) *
-          prev_state_map;
-  output_activ_map =
-      output_gate_sm.unaryExpr(Eigen::internal::scalar_logistic_op()) *
-      output_state_map.tanh();
-}
-
-inline void LstmCell(const float* input_data, const Dims<4>& input_dims,
-                     const float* prev_activ_data,
-                     const Dims<4>& prev_activ_dims, const float* weights_data,
-                     const Dims<4>& weights_dims, const float* bias_data,
-                     const Dims<4>& bias_dims, const float* prev_state_data,
-                     const Dims<4>& prev_state_dims, float* output_state_data,
-                     const Dims<4>& output_state_dims, float* output_activ_data,
-                     const Dims<4>& output_activ_dims, float* concat_temp_data,
-                     const Dims<4>& concat_temp_dims, float* activ_temp_data,
-                     const Dims<4>& activ_temp_dims) {
-  tflite::LstmCellParams op_params;
-  // Float LSTM cell does not need parameters to be set: leave untouched.
-
-  LstmCell(op_params, DimsToShape(input_dims), input_data,
-           DimsToShape(prev_activ_dims), prev_activ_data,
-           DimsToShape(weights_dims), weights_data, DimsToShape(bias_dims),
-           bias_data, DimsToShape(prev_state_dims), prev_state_data,
-           DimsToShape(output_state_dims), output_state_data,
-           DimsToShape(output_activ_dims), output_activ_data,
-           DimsToShape(concat_temp_dims), concat_temp_data,
-           DimsToShape(activ_temp_dims), activ_temp_data);
-}
-
-template 
-inline void LstmCell(
-    const LstmCellParams& params, const RuntimeShape& unextended_input_shape,
-    const uint8* input_data_uint8,
-    const RuntimeShape& unextended_prev_activ_shape,
-    const uint8* prev_activ_data_uint8, const RuntimeShape& weights_shape,
-    const uint8* weights_data_uint8, const RuntimeShape& unextended_bias_shape,
-    const int32* bias_data_int32,
-    const RuntimeShape& unextended_prev_state_shape,
-    const int16* prev_state_data_int16,
-    const RuntimeShape& unextended_output_state_shape,
-    int16* output_state_data_int16,
-    const RuntimeShape& unextended_output_activ_shape,
-    uint8* output_activ_data_uint8,
-    const RuntimeShape& unextended_concat_temp_shape,
-    uint8* concat_temp_data_uint8,
-    const RuntimeShape& unextended_activ_temp_shape,
-    int16* activ_temp_data_int16, gemmlowp::GemmContext* gemmlowp_context) {
-  ruy::profiler::ScopeLabel label(
-      "LstmCell/quantized (8bit external, 16bit internal)");
-  int32 weights_zero_point = params.weights_zero_point;
-  int32 accum_multiplier = params.accum_multiplier;
-  int accum_shift = params.accum_shift;
-  TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_prev_activ_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_bias_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_prev_state_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_output_state_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_output_activ_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_concat_temp_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_LE(unextended_activ_temp_shape.DimensionsCount(), 4);
-  const RuntimeShape input_shape =
-      RuntimeShape::ExtendedShape(4, unextended_input_shape);
-  const RuntimeShape prev_activ_shape =
-      RuntimeShape::ExtendedShape(4, unextended_prev_activ_shape);
-  const RuntimeShape bias_shape =
-      RuntimeShape::ExtendedShape(4, unextended_bias_shape);
-  const RuntimeShape prev_state_shape =
-      RuntimeShape::ExtendedShape(4, unextended_prev_state_shape);
-  const RuntimeShape output_state_shape =
-      RuntimeShape::ExtendedShape(4, unextended_output_state_shape);
-  const RuntimeShape output_activ_shape =
-      RuntimeShape::ExtendedShape(4, unextended_output_activ_shape);
-  const RuntimeShape concat_temp_shape =
-      RuntimeShape::ExtendedShape(4, unextended_concat_temp_shape);
-  const RuntimeShape activ_temp_shape =
-      RuntimeShape::ExtendedShape(4, unextended_activ_temp_shape);
-  TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2);
-
-  // Gather dimensions information, and perform consistency checks.
-  const int weights_dim_count = weights_shape.DimensionsCount();
-  const int outer_size = MatchingFlatSizeSkipDim(
-      input_shape, 3, prev_activ_shape, prev_state_shape, output_state_shape,
-      output_activ_shape);
-  const int input_depth = input_shape.Dims(3);
-  const int prev_activ_depth = prev_activ_shape.Dims(3);
-  const int total_input_depth = prev_activ_depth + input_depth;
-  TFLITE_DCHECK_EQ(weights_shape.Dims(weights_dim_count - 1),
-                   total_input_depth);
-  const int intern_activ_depth =
-      MatchingDim(weights_shape, weights_dim_count - 2, bias_shape, 3);
-  TFLITE_DCHECK_EQ(weights_shape.FlatSize(),
-                   intern_activ_depth * total_input_depth);
-  TFLITE_DCHECK_EQ(FlatSizeSkipDim(bias_shape, 3), 1);
-  TFLITE_DCHECK_EQ(intern_activ_depth % 4, 0);
-  const int output_depth =
-      MatchingDim(prev_state_shape, 3, prev_activ_shape, 3, output_state_shape,
-                  3, output_activ_shape, 3);
-  TFLITE_DCHECK_EQ(output_depth, intern_activ_depth / 4);
-  const int fc_batches = FlatSizeSkipDim(activ_temp_shape, 3);
-  const int fc_output_depth =
-      MatchingDim(weights_shape, weights_dim_count - 2, activ_temp_shape, 3);
-  const int fc_accum_depth = total_input_depth;
-  TFLITE_DCHECK_EQ(fc_output_depth, 4 * output_depth);
-
-  // Depth-concatenate prev_activ and input data together.
-  uint8 const* concat_input_arrays_data[2] = {input_data_uint8,
-                                              prev_activ_data_uint8};
-  const RuntimeShape* concat_input_arrays_shapes[2] = {&input_shape,
-                                                       &prev_activ_shape};
-  tflite::ConcatenationParams concat_params;
-  concat_params.axis = 3;
-  concat_params.inputs_count = 2;
-  Concatenation(concat_params, concat_input_arrays_shapes,
-                concat_input_arrays_data, concat_temp_shape,
-                concat_temp_data_uint8);
-
-  // Implementation of the fully connected node inside the LSTM cell.
-  // The operands are 8-bit integers, the accumulators are internally 32bit
-  // integers, and the output is 16-bit fixed-point with 3 integer bits so
-  // the output range is [-2^3, 2^3] == [-8, 8]. The rationale for that
-  // is explained in the function comment above.
-  bool gemm_already_performed = false;
-#ifdef GEMMLOWP_NEON
-  if (fc_batches == 1 && !(fc_output_depth % 4) && !(fc_accum_depth % 8)) {
-    GEMVForLstmCell(concat_temp_shape, concat_temp_data_uint8, weights_shape,
-                    weights_data_uint8, weights_zero_point, bias_shape,
-                    bias_data_int32, accum_multiplier, accum_shift,
-                    activ_temp_shape, activ_temp_data_int16);
-    gemm_already_performed = true;
-  }
-#endif
-  if (!gemm_already_performed) {
-    gemmlowp::MatrixMap
-        weights_matrix(weights_data_uint8, fc_output_depth, fc_accum_depth);
-    gemmlowp::MatrixMap input_matrix(
-        concat_temp_data_uint8, fc_accum_depth, fc_batches);
-    gemmlowp::MatrixMap output_matrix(
-        activ_temp_data_int16, fc_output_depth, fc_batches);
-    typedef gemmlowp::VectorMap
-        ColVectorMap;
-    ColVectorMap bias_vector(bias_data_int32, fc_output_depth);
-    gemmlowp::OutputStageBiasAddition bias_addition_stage;
-    bias_addition_stage.bias_vector = bias_vector;
-    gemmlowp::OutputStageScaleInt32ByFixedPointAndExponent scale_stage;
-    scale_stage.result_offset_after_shift = 0;
-    scale_stage.result_fixedpoint_multiplier = accum_multiplier;
-    scale_stage.result_exponent = accum_shift;
-    gemmlowp::OutputStageSaturatingCastToInt16 saturating_cast_int16_stage;
-    auto output_pipeline = std::make_tuple(bias_addition_stage, scale_stage,
-                                           saturating_cast_int16_stage);
-    gemmlowp::GemmWithOutputPipeline<
-        uint8, int16, gemmlowp::L8R8WithLhsNonzeroBitDepthParams>(
-        gemmlowp_context, weights_matrix, input_matrix, &output_matrix,
-        -weights_zero_point, -128, output_pipeline);
-  }
-
-  // Rest of the LSTM cell: tanh and logistic math functions, and some adds
-  // and muls, all done in 16-bit fixed-point.
-  const int16* input_gate_input_ptr = activ_temp_data_int16;
-  const int16* input_modulation_gate_input_ptr =
-      activ_temp_data_int16 + output_depth;
-  const int16* forget_gate_input_ptr = activ_temp_data_int16 + 2 * output_depth;
-  const int16* output_gate_input_ptr = activ_temp_data_int16 + 3 * output_depth;
-  const int16* prev_state_ptr = prev_state_data_int16;
-  int16* output_state_data_ptr = output_state_data_int16;
-  uint8* output_activ_data_ptr = output_activ_data_uint8;
-
-  for (int b = 0; b < outer_size; ++b) {
-    int c = 0;
-#ifdef GEMMLOWP_NEON
-    for (; c <= output_depth - 8; c += 8) {
-      // Define the fixed-point data types that we will use here. All use
-      // int16 as the underlying integer type i.e. all are 16-bit fixed-point.
-      // They only differ by the number of integral vs. fractional bits,
-      // determining the range of values that they can represent.
-      //
-      // F0 uses 0 integer bits, range [-1, 1].
-      // This is the return type of math functions such as tanh, logistic,
-      // whose range is in [-1, 1].
-      using F0 = gemmlowp::FixedPoint;
-      // F3 uses 3 integer bits, range [-8, 8].
-      // This is the range of the previous fully-connected node's output,
-      // which is our input here.
-      using F3 = gemmlowp::FixedPoint;
-      // FS uses StateIntegerBits integer bits, range [-2^StateIntegerBits,
-      // 2^StateIntegerBits]. It's used to represent the internal state, whose
-      // number of integer bits is currently dictated by the model. See comment
-      // on the StateIntegerBits template parameter above.
-      using FS = gemmlowp::FixedPoint;
-      // Implementation of input gate, using fixed-point logistic function.
-      F3 input_gate_input = F3::FromRaw(vld1q_s16(input_gate_input_ptr));
-      input_gate_input_ptr += 8;
-      F0 input_gate_output = gemmlowp::logistic(input_gate_input);
-      // Implementation of input modulation gate, using fixed-point tanh
-      // function.
-      F3 input_modulation_gate_input =
-          F3::FromRaw(vld1q_s16(input_modulation_gate_input_ptr));
-      input_modulation_gate_input_ptr += 8;
-      F0 input_modulation_gate_output =
-          gemmlowp::tanh(input_modulation_gate_input);
-      // Implementation of forget gate, using fixed-point logistic function.
-      F3 forget_gate_input = F3::FromRaw(vld1q_s16(forget_gate_input_ptr));
-      forget_gate_input_ptr += 8;
-      F0 forget_gate_output = gemmlowp::logistic(forget_gate_input);
-      // Implementation of output gate, using fixed-point logistic function.
-      F3 output_gate_input = F3::FromRaw(vld1q_s16(output_gate_input_ptr));
-      output_gate_input_ptr += 8;
-      F0 output_gate_output = gemmlowp::logistic(output_gate_input);
-      // Implementation of internal multiplication nodes, still in fixed-point.
-      F0 input_times_input_modulation =
-          input_gate_output * input_modulation_gate_output;
-      FS prev_state = FS::FromRaw(vld1q_s16(prev_state_ptr));
-      prev_state_ptr += 8;
-      FS prev_state_times_forget_state = forget_gate_output * prev_state;
-      // Implementation of internal addition node, saturating.
-      FS new_state = gemmlowp::SaturatingAdd(
-          gemmlowp::Rescale(input_times_input_modulation),
-          prev_state_times_forget_state);
-      // Implementation of last internal Tanh node, still in fixed-point.
-      // Since a Tanh fixed-point implementation is specialized for a given
-      // number or integer bits, and each specialization can have a substantial
-      // code size, and we already used above a Tanh on an input with 3 integer
-      // bits, and per the table in the above function comment there is no
-      // significant accuracy to be lost by clamping to [-8, +8] for a
-      // 3-integer-bits representation, let us just do that. This helps people
-      // porting this to targets where code footprint must be minimized.
-      F3 new_state_f3 = gemmlowp::Rescale<3>(new_state);
-      F0 output_activ_int16 = output_gate_output * gemmlowp::tanh(new_state_f3);
-      // Store the new internal state back to memory, as 16-bit integers.
-      // Note: here we store the original value with StateIntegerBits, not
-      // the rescaled 3-integer-bits value fed to tanh.
-      vst1q_s16(output_state_data_ptr, new_state.raw());
-      output_state_data_ptr += 8;
-      // Down-scale the output activations to 8-bit integers, saturating,
-      // and store back to memory.
-      int16x8_t rescaled_output_activ =
-          gemmlowp::RoundingDivideByPOT(output_activ_int16.raw(), 8);
-      int8x8_t int8_output_activ = vqmovn_s16(rescaled_output_activ);
-      uint8x8_t uint8_output_activ =
-          vadd_u8(vdup_n_u8(128), vreinterpret_u8_s8(int8_output_activ));
-      vst1_u8(output_activ_data_ptr, uint8_output_activ);
-      output_activ_data_ptr += 8;
-    }
-#endif
-    for (; c < output_depth; ++c) {
-      // Define the fixed-point data types that we will use here. All use
-      // int16 as the underlying integer type i.e. all are 16-bit fixed-point.
-      // They only differ by the number of integral vs. fractional bits,
-      // determining the range of values that they can represent.
-      //
-      // F0 uses 0 integer bits, range [-1, 1].
-      // This is the return type of math functions such as tanh, logistic,
-      // whose range is in [-1, 1].
-      using F0 = gemmlowp::FixedPoint;
-      // F3 uses 3 integer bits, range [-8, 8].
-      // This is the range of the previous fully-connected node's output,
-      // which is our input here.
-      using F3 = gemmlowp::FixedPoint;
-      // FS uses StateIntegerBits integer bits, range [-2^StateIntegerBits,
-      // 2^StateIntegerBits]. It's used to represent the internal state, whose
-      // number of integer bits is currently dictated by the model. See comment
-      // on the StateIntegerBits template parameter above.
-      using FS = gemmlowp::FixedPoint;
-      // Implementation of input gate, using fixed-point logistic function.
-      F3 input_gate_input = F3::FromRaw(*input_gate_input_ptr++);
-      F0 input_gate_output = gemmlowp::logistic(input_gate_input);
-      // Implementation of input modulation gate, using fixed-point tanh
-      // function.
-      F3 input_modulation_gate_input =
-          F3::FromRaw(*input_modulation_gate_input_ptr++);
-      F0 input_modulation_gate_output =
-          gemmlowp::tanh(input_modulation_gate_input);
-      // Implementation of forget gate, using fixed-point logistic function.
-      F3 forget_gate_input = F3::FromRaw(*forget_gate_input_ptr++);
-      F0 forget_gate_output = gemmlowp::logistic(forget_gate_input);
-      // Implementation of output gate, using fixed-point logistic function.
-      F3 output_gate_input = F3::FromRaw(*output_gate_input_ptr++);
-      F0 output_gate_output = gemmlowp::logistic(output_gate_input);
-      // Implementation of internal multiplication nodes, still in fixed-point.
-      F0 input_times_input_modulation =
-          input_gate_output * input_modulation_gate_output;
-      FS prev_state = FS::FromRaw(*prev_state_ptr++);
-      FS prev_state_times_forget_state = forget_gate_output * prev_state;
-      // Implementation of internal addition node, saturating.
-      FS new_state = gemmlowp::SaturatingAdd(
-          gemmlowp::Rescale(input_times_input_modulation),
-          prev_state_times_forget_state);
-      // Implementation of last internal Tanh node, still in fixed-point.
-      // Since a Tanh fixed-point implementation is specialized for a given
-      // number or integer bits, and each specialization can have a substantial
-      // code size, and we already used above a Tanh on an input with 3 integer
-      // bits, and per the table in the above function comment there is no
-      // significant accuracy to be lost by clamping to [-8, +8] for a
-      // 3-integer-bits representation, let us just do that. This helps people
-      // porting this to targets where code footprint must be minimized.
-      F3 new_state_f3 = gemmlowp::Rescale<3>(new_state);
-      F0 output_activ_int16 = output_gate_output * gemmlowp::tanh(new_state_f3);
-      // Store the new internal state back to memory, as 16-bit integers.
-      // Note: here we store the original value with StateIntegerBits, not
-      // the rescaled 3-integer-bits value fed to tanh.
-      *output_state_data_ptr++ = new_state.raw();
-      // Down-scale the output activations to 8-bit integers, saturating,
-      // and store back to memory.
-      int16 rescaled_output_activ =
-          gemmlowp::RoundingDivideByPOT(output_activ_int16.raw(), 8);
-      int16 clamped_output_activ =
-          std::max(-128, std::min(127, rescaled_output_activ));
-      *output_activ_data_ptr++ = 128 + clamped_output_activ;
-    }
-    input_gate_input_ptr += 3 * output_depth;
-    input_modulation_gate_input_ptr += 3 * output_depth;
-    forget_gate_input_ptr += 3 * output_depth;
-    output_gate_input_ptr += 3 * output_depth;
-  }
-}
-
-template 
-void LstmCell(const uint8* input_data_uint8, const Dims<4>& input_dims,
-              const uint8* prev_activ_data_uint8,
-              const Dims<4>& prev_activ_dims, const uint8* weights_data_uint8,
-              const Dims<4>& weights_dims, const int32* bias_data_int32,
-              const Dims<4>& bias_dims, const int16* prev_state_data_int16,
-              const Dims<4>& prev_state_dims, int16* output_state_data_int16,
-              const Dims<4>& output_state_dims, uint8* output_activ_data_uint8,
-              const Dims<4>& output_activ_dims, uint8* concat_temp_data_uint8,
-              const Dims<4>& concat_temp_dims, int16* activ_temp_data_int16,
-              const Dims<4>& activ_temp_dims, int32 weights_zero_point,
-              int32 accum_multiplier, int accum_shift,
-              gemmlowp::GemmContext* gemmlowp_context) {
-  tflite::LstmCellParams op_params;
-  op_params.weights_zero_point = weights_zero_point;
-  op_params.accum_multiplier = accum_multiplier;
-  op_params.accum_shift = accum_shift;
-
-  LstmCell(
-      op_params, DimsToShape(input_dims), input_data_uint8,
-      DimsToShape(prev_activ_dims), prev_activ_data_uint8,
-      DimsToShape(weights_dims), weights_data_uint8, DimsToShape(bias_dims),
-      bias_data_int32, DimsToShape(prev_state_dims), prev_state_data_int16,
-      DimsToShape(output_state_dims), output_state_data_int16,
-      DimsToShape(output_activ_dims), output_activ_data_uint8,
-      DimsToShape(concat_temp_dims), concat_temp_data_uint8,
-      DimsToShape(activ_temp_dims), activ_temp_data_int16, gemmlowp_context);
-}
-
-template 
-void BroadcastDiv(const T* input1_data, const Dims<4>& input1_dims,
-                  const T* input2_data, const Dims<4>& input2_dims,
-                  T output_activation_min, T output_activation_max,
-                  T* output_data, const Dims<4>& output_dims) {
-  tflite::ArithmeticParams op_params;
-  SetActivationParams(output_activation_min, output_activation_max, &op_params);
-
-  BroadcastDivSlow(op_params, DimsToShape(input1_dims), input1_data,
-                   DimsToShape(input2_dims), input2_data,
-                   DimsToShape(output_dims), output_data);
-}
-
-template 
-void L2Normalization(const float* input_data, const RuntimeShape& input_shape,
-                     float* output_data, const RuntimeShape& output_shape) {
-  static_assert(Ac == FusedActivationFunctionType::kNone, "");
-  tflite::L2NormalizationParams op_params;
-  // No params need to be set for float, but reserved in signature for future
-  // activations.
-
-  L2Normalization(op_params, input_shape, input_data, output_shape,
-                  output_data);
-}
-
-inline void L2Normalization(const uint8* input_data,
-                            const RuntimeShape& input_shape,
-                            int32 input_zero_point, uint8* output_data,
-                            const RuntimeShape& output_shape) {
-  tflite::L2NormalizationParams op_params;
-  op_params.input_zero_point = input_zero_point;
-
-  L2Normalization(op_params, input_shape, input_data, output_shape,
-                  output_data);
-}
-
-template 
-void L2Normalization(const float* input_data, const Dims<4>& input_dims,
-                     float* output_data, const Dims<4>& output_dims) {
-  L2Normalization(input_data, DimsToShape(input_dims), output_data,
-                      DimsToShape(output_dims));
-}
-
-inline void L2Normalization(const uint8* input_data, const Dims<4>& input_dims,
-                            int32 input_zero_point, uint8* output_data,
-                            const Dims<4>& output_dims) {
-  L2Normalization(input_data, DimsToShape(input_dims), input_zero_point,
-                  output_data, DimsToShape(output_dims));
-}
-
-inline void Relu(const float* input_data, const Dims<4>& input_dims,
-                 float* output_data, const Dims<4>& output_dims) {
-  Relu(DimsToShape(input_dims), input_data, DimsToShape(output_dims),
-       output_data);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void Add(const float* input1_data, const Dims<4>& input1_dims,
-         const float* input2_data, const Dims<4>& input2_dims,
-         float* output_data, const Dims<4>& output_dims) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-
-  tflite::ArithmeticParams op_params;
-  op_params.float_activation_min = output_activation_min;
-  op_params.float_activation_max = output_activation_max;
-  Add(op_params, DimsToShape(input1_dims), input1_data,
-      DimsToShape(input2_dims), input2_data, DimsToShape(output_dims),
-      output_data);
-}
-
-template 
-inline void Add(int left_shift, const uint8* input1_data,
-                const Dims<4>& input1_dims, int32 input1_offset,
-                int32 input1_multiplier, int input1_shift,
-                const uint8* input2_data, const Dims<4>& input2_dims,
-                int32 input2_offset, int32 input2_multiplier, int input2_shift,
-                int32 output_offset, int32 output_multiplier, int output_shift,
-                int32 output_activation_min, int32 output_activation_max,
-                uint8* output_data, const Dims<4>& output_dims) {
-  constexpr int kReverseShift = -1;
-  static_assert(Ac == FusedActivationFunctionType::kNone ||
-                    Ac == FusedActivationFunctionType::kRelu ||
-                    Ac == FusedActivationFunctionType::kRelu6 ||
-                    Ac == FusedActivationFunctionType::kRelu1,
-                "");
-  TFLITE_DCHECK_LE(output_activation_min, output_activation_max);
-  if (Ac == FusedActivationFunctionType::kNone) {
-    TFLITE_DCHECK_EQ(output_activation_min, 0);
-    TFLITE_DCHECK_EQ(output_activation_max, 255);
-  }
-
-  tflite::ArithmeticParams op_params;
-  op_params.left_shift = left_shift;
-  op_params.input1_offset = input1_offset;
-  op_params.input1_multiplier = input1_multiplier;
-  op_params.input1_shift = kReverseShift * input1_shift;
-  op_params.input2_offset = input2_offset;
-  op_params.input2_multiplier = input2_multiplier;
-  op_params.input2_shift = kReverseShift * input2_shift;
-  op_params.output_offset = output_offset;
-  op_params.output_multiplier = output_multiplier;
-  op_params.output_shift = kReverseShift * output_shift;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-  Add(op_params, DimsToShape(input1_dims), input1_data,
-      DimsToShape(input2_dims), input2_data, DimsToShape(output_dims),
-      output_data);
-}
-
-template 
-void Add(const int32* input1_data, const Dims<4>& input1_dims,
-         const int32* input2_data, const Dims<4>& input2_dims,
-         int32* output_data, const Dims<4>& output_dims) {
-  ruy::profiler::ScopeLabel label("Add/int32");
-  TFLITE_DCHECK(Ac == FusedActivationFunctionType::kNone);
-
-  tflite::ArithmeticParams op_params;
-  op_params.quantized_activation_min = std::numeric_limits::min();
-  op_params.quantized_activation_max = std::numeric_limits::max();
-  Add(op_params, DimsToShape(input1_dims), input1_data,
-      DimsToShape(input2_dims), input2_data, DimsToShape(output_dims),
-      output_data);
-}
-
-template 
-void BroadcastAdd(const T* input1_data, const Dims<4>& input1_dims,
-                  const T* input2_data, const Dims<4>& input2_dims,
-                  T output_activation_min, T output_activation_max,
-                  T* output_data, const Dims<4>& output_dims) {
-  tflite::ArithmeticParams op_params;
-  op_params.float_activation_min = output_activation_min;
-  op_params.float_activation_max = output_activation_max;
-  BroadcastAdd4DSlow(op_params, DimsToShape(input1_dims), input1_data,
-                     DimsToShape(input2_dims), input2_data,
-                     DimsToShape(output_dims), output_data);
-}
-
-template 
-inline void BroadcastAdd(int left_shift, const uint8* input1_data,
-                         const Dims<4>& input1_dims, int32 input1_offset,
-                         int32 input1_multiplier, int input1_shift,
-                         const uint8* input2_data, const Dims<4>& input2_dims,
-                         int32 input2_offset, int32 input2_multiplier,
-                         int input2_shift, int32 output_offset,
-                         int32 output_multiplier, int output_shift,
-                         int32 output_activation_min,
-                         int32 output_activation_max, uint8* output_data,
-                         const Dims<4>& output_dims) {
-  constexpr int kReverseShift = -1;
-  static_assert(Ac == FusedActivationFunctionType::kNone ||
-                    Ac == FusedActivationFunctionType::kRelu ||
-                    Ac == FusedActivationFunctionType::kRelu6 ||
-                    Ac == FusedActivationFunctionType::kRelu1,
-                "");
-  TFLITE_DCHECK_LE(output_activation_min, output_activation_max);
-  if (Ac == FusedActivationFunctionType::kNone) {
-    TFLITE_DCHECK_EQ(output_activation_min, 0);
-    TFLITE_DCHECK_EQ(output_activation_max, 255);
-  }
-
-  tflite::ArithmeticParams op_params;
-  op_params.left_shift = left_shift;
-  op_params.input1_offset = input1_offset;
-  op_params.input1_multiplier = input1_multiplier;
-  op_params.input1_shift = kReverseShift * input1_shift;
-  op_params.input2_offset = input2_offset;
-  op_params.input2_multiplier = input2_multiplier;
-  op_params.input2_shift = kReverseShift * input2_shift;
-  op_params.output_offset = output_offset;
-  op_params.output_multiplier = output_multiplier;
-  op_params.output_shift = kReverseShift * output_shift;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-  BroadcastAdd4DSlow(op_params, DimsToShape(input1_dims), input1_data,
-                     DimsToShape(input2_dims), input2_data,
-                     DimsToShape(output_dims), output_data);
-}
-
-template 
-inline void BroadcastAddFivefold(
-    int y0, int y1, int y2, int y3, int y4, int left_shift,
-    const uint8* input1_data, const Dims<4>& input1_dims, int32 input1_offset,
-    int32 input1_multiplier, int input1_shift, const uint8* input2_data,
-    const Dims<4>& input2_dims, int32 input2_offset, int32 input2_multiplier,
-    int input2_shift, int32 output_offset, int32 output_multiplier,
-    int output_shift, int32 output_activation_min, int32 output_activation_max,
-    uint8* output_data, const Dims<4>& output_dims) {
-  constexpr int kReverseShift = -1;
-  static_assert(Ac == FusedActivationFunctionType::kNone ||
-                    Ac == FusedActivationFunctionType::kRelu ||
-                    Ac == FusedActivationFunctionType::kRelu6 ||
-                    Ac == FusedActivationFunctionType::kRelu1,
-                "");
-  TFLITE_DCHECK_LE(output_activation_min, output_activation_max);
-  if (Ac == FusedActivationFunctionType::kNone) {
-    TFLITE_DCHECK_EQ(output_activation_min, 0);
-    TFLITE_DCHECK_EQ(output_activation_max, 255);
-  }
-  tflite::ArithmeticParams op_params;
-  op_params.broadcast_category =
-      tflite::BroadcastableOpCategory::kFirstInputBroadcastsFast;
-  op_params.left_shift = left_shift;
-  op_params.input1_offset = input1_offset;
-  op_params.input1_multiplier = input1_multiplier;
-  op_params.input1_shift = kReverseShift * input1_shift;
-  op_params.input2_offset = input2_offset;
-  op_params.input2_multiplier = input2_multiplier;
-  op_params.input2_shift = kReverseShift * input2_shift;
-  op_params.output_offset = output_offset;
-  op_params.output_multiplier = output_multiplier;
-  op_params.output_shift = kReverseShift * output_shift;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-  op_params.broadcast_shape[4] = y0;
-  op_params.broadcast_shape[3] = y1;
-  op_params.broadcast_shape[2] = y2;
-  op_params.broadcast_shape[1] = y3;
-  op_params.broadcast_shape[0] = y4;
-  BroadcastAddFivefold(op_params, DimsToShape(input1_dims), input1_data,
-                       DimsToShape(input2_dims), input2_data,
-                       DimsToShape(output_dims), output_data);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void BroadcastAdd(const T* input1_data, const Dims<4>& input1_dims,
-                  const T* input2_data, const Dims<4>& input2_dims,
-                  T* output_data, const Dims<4>& output_dims) {
-  T output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-
-  BroadcastAdd(input1_data, input1_dims, input2_data, input2_dims,
-               output_activation_min, output_activation_max, output_data,
-               output_dims);
-}
-
-template 
-inline void Add(const int16* input1_data, const Dims<4>& input1_dims,
-                int input1_shift, const int16* input2_data,
-                const Dims<4>& input2_dims, int input2_shift,
-                int16 output_activation_min, int16 output_activation_max,
-                int16* output_data, const Dims<4>& output_dims) {
-  constexpr int kReverseShift = -1;
-  static_assert(Ac == FusedActivationFunctionType::kNone ||
-                    Ac == FusedActivationFunctionType::kRelu ||
-                    Ac == FusedActivationFunctionType::kRelu6 ||
-                    Ac == FusedActivationFunctionType::kRelu1,
-                "");
-  TFLITE_DCHECK_LE(output_activation_min, output_activation_max);
-  if (Ac == FusedActivationFunctionType::kNone) {
-    TFLITE_DCHECK_EQ(output_activation_min, -32768);
-    TFLITE_DCHECK_EQ(output_activation_max, 32767);
-  }
-
-  tflite::ArithmeticParams op_params;
-  op_params.input1_shift = kReverseShift * input1_shift;
-  op_params.input2_shift = kReverseShift * input2_shift;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-  Add(op_params, DimsToShape(input1_dims), input1_data,
-      DimsToShape(input2_dims), input2_data, DimsToShape(output_dims),
-      output_data);
-}
-
-inline void Sub(const float* input1_data, const Dims<4>& input1_dims,
-                const float* input2_data, const Dims<4>& input2_dims,
-                float* output_data, const Dims<4>& output_dims) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(FusedActivationFunctionType::kNone,
-                      &output_activation_min, &output_activation_max);
-  tflite::ArithmeticParams op_params;
-  op_params.float_activation_min = output_activation_min;
-  op_params.float_activation_max = output_activation_max;
-  Sub(op_params, DimsToShape(input1_dims), input1_data,
-      DimsToShape(input2_dims), input2_data, DimsToShape(output_dims),
-      output_data);
-}
-
-template 
-void Sub(const T* input1_data, const Dims<4>& input1_dims, const T* input2_data,
-         const Dims<4>& input2_dims, T* output_data,
-         const Dims<4>& output_dims) {
-  T output_activation_min, output_activation_max;
-  GetActivationMinMax(FusedActivationFunctionType::kNone,
-                      &output_activation_min, &output_activation_max);
-  tflite::ArithmeticParams op_params;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-  Sub(op_params, DimsToShape(input1_dims), input1_data,
-      DimsToShape(input2_dims), input2_data, DimsToShape(output_dims),
-      output_data);
-}
-
-inline void BroadcastMul(const uint8* input1_data, const Dims<4>& input1_dims,
-                         int32 input1_offset, const uint8* input2_data,
-                         const Dims<4>& input2_dims, int32 input2_offset,
-                         int32 output_offset, int32 output_multiplier,
-                         int output_shift, int32 output_activation_min,
-                         int32 output_activation_max, uint8* output_data,
-                         const Dims<4>& output_dims) {
-  tflite::ArithmeticParams op_params;
-  SetActivationParams(output_activation_min, output_activation_max, &op_params);
-  op_params.input1_offset = input1_offset;
-  op_params.input2_offset = input2_offset;
-  op_params.output_offset = output_offset;
-  op_params.output_multiplier = output_multiplier;
-  op_params.output_shift = kReverseShift * output_shift;
-
-  BroadcastMul4DSlow(op_params, DimsToShape(input1_dims), input1_data,
-                     DimsToShape(input2_dims), input2_data,
-                     DimsToShape(output_dims), output_data);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-inline void BroadcastMul(const uint8* input1_data, const Dims<4>& input1_dims,
-                         int32 input1_offset, const uint8* input2_data,
-                         const Dims<4>& input2_dims, int32 input2_offset,
-                         int32 output_offset, int32 output_multiplier,
-                         int output_shift, int32 output_activation_min,
-                         int32 output_activation_max, uint8* output_data,
-                         const Dims<4>& output_dims) {
-  BroadcastMul(input1_data, input1_dims, input1_offset, input2_data,
-               input2_dims, input2_offset, output_offset, output_multiplier,
-               output_shift, output_activation_min, output_activation_max,
-               output_data, output_dims);
-}
-
-inline bool AveragePool(const float* input_data, const Dims<4>& input_dims,
-                        int stride_width, int stride_height, int pad_width,
-                        int pad_height, int kwidth, int kheight,
-                        float output_activation_min,
-                        float output_activation_max, float* output_data,
-                        const Dims<4>& output_dims) {
-  tflite::PoolParams params;
-  params.stride_height = stride_height;
-  params.stride_width = stride_width;
-  params.filter_height = kheight;
-  params.filter_width = kwidth;
-  params.padding_values.height = pad_height;
-  params.padding_values.width = pad_width;
-  params.float_activation_min = output_activation_min;
-  params.float_activation_max = output_activation_max;
-  return AveragePool(params, DimsToShape(input_dims), input_data,
-                     DimsToShape(output_dims), output_data);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-bool AveragePool(const float* input_data, const Dims<4>& input_dims,
-                 int stride_width, int stride_height, int pad_width,
-                 int pad_height, int kwidth, int kheight, float* output_data,
-                 const Dims<4>& output_dims) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-
-  return AveragePool(input_data, input_dims, stride_width, stride_height,
-                     pad_width, pad_height, kwidth, kheight,
-                     output_activation_min, output_activation_max, output_data,
-                     output_dims);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-bool AveragePool(const float* input_data, const Dims<4>& input_dims, int stride,
-                 int pad_width, int pad_height, int filter_width,
-                 int filter_height, float* output_data,
-                 const Dims<4>& output_dims) {
-  return AveragePool(input_data, input_dims, stride, stride, pad_width,
-                         pad_height, filter_width, filter_height, output_data,
-                         output_dims);
-}
-
-inline bool AveragePool(const uint8* input_data, const Dims<4>& input_dims,
-                        int stride_width, int stride_height, int pad_width,
-                        int pad_height, int filter_width, int filter_height,
-                        int32 output_activation_min,
-                        int32 output_activation_max, uint8* output_data,
-                        const Dims<4>& output_dims) {
-  tflite::PoolParams params;
-  params.stride_height = stride_height;
-  params.stride_width = stride_width;
-  params.filter_height = filter_height;
-  params.filter_width = filter_width;
-  params.padding_values.height = pad_height;
-  params.padding_values.width = pad_width;
-  params.quantized_activation_min = output_activation_min;
-  params.quantized_activation_max = output_activation_max;
-  return AveragePool(params, DimsToShape(input_dims), input_data,
-                     DimsToShape(output_dims), output_data);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-bool AveragePool(const uint8* input_data, const Dims<4>& input_dims,
-                 int stride_width, int stride_height, int pad_width,
-                 int pad_height, int filter_width, int filter_height,
-                 int32 output_activation_min, int32 output_activation_max,
-                 uint8* output_data, const Dims<4>& output_dims) {
-  static_assert(Ac == FusedActivationFunctionType::kNone ||
-                    Ac == FusedActivationFunctionType::kRelu ||
-                    Ac == FusedActivationFunctionType::kRelu6 ||
-                    Ac == FusedActivationFunctionType::kRelu1,
-                "");
-  if (Ac == FusedActivationFunctionType::kNone) {
-    TFLITE_DCHECK_EQ(output_activation_min, 0);
-    TFLITE_DCHECK_EQ(output_activation_max, 255);
-  }
-  return AveragePool(input_data, input_dims, stride_width, stride_height,
-                     pad_width, pad_height, filter_width, filter_height,
-                     output_activation_min, output_activation_max, output_data,
-                     output_dims);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-bool AveragePool(const uint8* input_data, const Dims<4>& input_dims, int stride,
-                 int pad_width, int pad_height, int filter_width,
-                 int filter_height, int32 output_activation_min,
-                 int32 output_activation_max, uint8* output_data,
-                 const Dims<4>& output_dims) {
-  return AveragePool(input_data, input_dims, stride, stride, pad_width,
-                         pad_height, filter_width, filter_height,
-                         output_activation_min, output_activation_max,
-                         output_data, output_dims);
-}
-
-inline void MaxPool(const float* input_data, const Dims<4>& input_dims,
-                    int stride_width, int stride_height, int pad_width,
-                    int pad_height, int kwidth, int kheight,
-                    float output_activation_min, float output_activation_max,
-                    float* output_data, const Dims<4>& output_dims) {
-  tflite::PoolParams params;
-  params.stride_height = stride_height;
-  params.stride_width = stride_width;
-  params.filter_height = kheight;
-  params.filter_width = kwidth;
-  params.padding_values.height = pad_height;
-  params.padding_values.width = pad_width;
-  params.float_activation_min = output_activation_min;
-  params.float_activation_max = output_activation_max;
-  MaxPool(params, DimsToShape(input_dims), input_data, DimsToShape(output_dims),
-          output_data);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void MaxPool(const float* input_data, const Dims<4>& input_dims,
-             int stride_width, int stride_height, int pad_width, int pad_height,
-             int kwidth, int kheight, float* output_data,
-             const Dims<4>& output_dims) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-  MaxPool(input_data, input_dims, stride_width, stride_height, pad_width,
-          pad_height, kwidth, kheight, output_activation_min,
-          output_activation_max, output_data, output_dims);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void MaxPool(const float* input_data, const Dims<4>& input_dims, int stride,
-             int pad_width, int pad_height, int filter_width, int filter_height,
-             float* output_data, const Dims<4>& output_dims) {
-  MaxPool(input_data, input_dims, stride, stride, pad_width, pad_height,
-              filter_width, filter_height, output_data, output_dims);
-}
-
-inline void MaxPool(const uint8* input_data, const Dims<4>& input_dims,
-                    int stride_width, int stride_height, int pad_width,
-                    int pad_height, int filter_width, int filter_height,
-                    int32 output_activation_min, int32 output_activation_max,
-                    uint8* output_data, const Dims<4>& output_dims) {
-  PoolParams params;
-  params.stride_height = stride_height;
-  params.stride_width = stride_width;
-  params.filter_height = filter_height;
-  params.filter_width = filter_width;
-  params.padding_values.height = pad_height;
-  params.padding_values.width = pad_width;
-  params.quantized_activation_min = output_activation_min;
-  params.quantized_activation_max = output_activation_max;
-  MaxPool(params, DimsToShape(input_dims), input_data, DimsToShape(output_dims),
-          output_data);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void MaxPool(const uint8* input_data, const Dims<4>& input_dims,
-             int stride_width, int stride_height, int pad_width, int pad_height,
-             int filter_width, int filter_height, int32 output_activation_min,
-             int32 output_activation_max, uint8* output_data,
-             const Dims<4>& output_dims) {
-  static_assert(Ac == FusedActivationFunctionType::kNone ||
-                    Ac == FusedActivationFunctionType::kRelu ||
-                    Ac == FusedActivationFunctionType::kRelu6 ||
-                    Ac == FusedActivationFunctionType::kRelu1,
-                "");
-  if (Ac == FusedActivationFunctionType::kNone) {
-    TFLITE_DCHECK_EQ(output_activation_min, 0);
-    TFLITE_DCHECK_EQ(output_activation_max, 255);
-  }
-  MaxPool(input_data, input_dims, stride_width, stride_height, pad_width,
-          pad_height, filter_width, filter_height, output_activation_min,
-          output_activation_max, output_data, output_dims);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void MaxPool(const uint8* input_data, const Dims<4>& input_dims, int stride,
-             int pad_width, int pad_height, int filter_width, int filter_height,
-             int32 output_activation_min, int32 output_activation_max,
-             uint8* output_data, const Dims<4>& output_dims) {
-  MaxPool(input_data, input_dims, stride, stride, pad_width, pad_height,
-              filter_width, filter_height, output_activation_min,
-              output_activation_max, output_data, output_dims);
-}
-
-inline void L2Pool(const float* input_data, const Dims<4>& input_dims,
-                   int stride_width, int stride_height, int pad_width,
-                   int pad_height, int filter_width, int filter_height,
-                   float output_activation_min, float output_activation_max,
-                   float* output_data, const Dims<4>& output_dims) {
-  PoolParams params;
-  params.stride_height = stride_height;
-  params.stride_width = stride_width;
-  params.filter_height = filter_height;
-  params.filter_width = filter_width;
-  params.padding_values.height = pad_height;
-  params.padding_values.width = pad_width;
-  params.float_activation_min = output_activation_min;
-  params.float_activation_max = output_activation_max;
-  L2Pool(params, DimsToShape(input_dims), input_data, DimsToShape(output_dims),
-         output_data);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void L2Pool(const float* input_data, const Dims<4>& input_dims,
-            int stride_width, int stride_height, int pad_width, int pad_height,
-            int filter_width, int filter_height, float* output_data,
-            const Dims<4>& output_dims) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-  L2Pool(input_data, input_dims, stride_width, stride_height, pad_width,
-         pad_height, filter_width, filter_height, output_activation_min,
-         output_activation_max, output_data, output_dims);
-}
-
-// legacy, for compatibility with old checked-in code
-template 
-void L2Pool(const float* input_data, const Dims<4>& input_dims, int stride,
-            int pad_width, int pad_height, int filter_width, int filter_height,
-            float* output_data, const Dims<4>& output_dims) {
-  L2Pool(input_data, input_dims, stride, stride, pad_width, pad_height,
-             filter_width, filter_height, output_data, output_dims);
-}
-
-inline void Softmax(const SoftmaxParams& params,
-                    const RuntimeShape& input_shape, const uint8* input_data,
-                    const RuntimeShape& output_shape, uint8* output_data) {
-  const int32 input_beta_multiplier = params.input_multiplier;
-  const int32 input_beta_left_shift = params.input_left_shift;
-  const int diff_min = params.diff_min;
-  // The representation chosen for the input to the exp() function is Q5.26.
-  // We need to leave extra space since values that we skip might be as large as
-  // -32 before multiplying by input_beta_multiplier, and therefore as large as
-  // -16 afterwards.  Note that exp(-8) is definitely not insignificant to
-  // accumulation, but exp(-16) definitely is.
-  static const int kScaledDiffIntegerBits = 5;
-  static const int kAccumulationIntegerBits = 12;
-  using FixedPointScaledDiff =
-      gemmlowp::FixedPoint;
-  using FixedPointAccum = gemmlowp::FixedPoint;
-  using FixedPoint0 = gemmlowp::FixedPoint;
-
-  ruy::profiler::ScopeLabel label("Softmax/8bit");
-  const int trailing_dim = input_shape.DimensionsCount() - 1;
-  const int outer_size =
-      MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape);
-  const int depth =
-      MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim);
-
-  for (int b = 0; b < outer_size; ++b) {
-    const uint8* input_data_ptr = input_data + b * depth;
-    uint8* output_data_ptr = output_data + b * depth;
-
-    // Determine the largest entry in the current row
-    uint8 max_in_row = 0;
-    {
-      int c = 0;
-#ifdef USE_NEON
-      uint8x16_t max16_0 = vdupq_n_u8(0);
-      uint8x16_t max16_1 = vdupq_n_u8(0);
-      for (; c <= depth - 32; c += 32) {
-        max16_0 = vmaxq_u8(max16_0, vld1q_u8(input_data_ptr + c + 0));
-        max16_1 = vmaxq_u8(max16_1, vld1q_u8(input_data_ptr + c + 16));
-      }
-      uint8x16_t max16 = vmaxq_u8(max16_0, max16_1);
-      if (c <= depth - 16) {
-        max16 = vmaxq_u8(max16, vld1q_u8(input_data_ptr + c));
-        c += 16;
-      }
-      uint8x8_t max8 = vmax_u8(vget_low_u8(max16), vget_high_u8(max16));
-      if (c <= depth - 8) {
-        max8 = vmax_u8(max8, vld1_u8(input_data_ptr + c));
-        c += 8;
-      }
-      uint8x8_t max4 = vmax_u8(max8, vext_u8(max8, max8, 4));
-      uint8x8_t max2 = vmax_u8(max4, vext_u8(max4, max4, 2));
-      uint8x8_t max1 = vpmax_u8(max2, max2);
-      max_in_row = vget_lane_u8(max1, 0);
-#endif
-      for (; c < depth; ++c) {
-        max_in_row = std::max(max_in_row, input_data_ptr[c]);
-      }
-    }
-
-#ifdef USE_NEON
-    using FixedPointAccumInt32x4 =
-        gemmlowp::FixedPoint;
-    using FixedPointScaledDiffInt32x4 =
-        gemmlowp::FixedPoint;
-    using FixedPoint0Int32x4 = gemmlowp::FixedPoint;
-    FixedPoint0Int32x4 input_beta_multiplier_f0 =
-        FixedPoint0Int32x4::FromScalarRaw(input_beta_multiplier);
-    int16x8_t max_in_row_s16 = vdupq_n_s16(max_in_row);
-#endif
-
-    // Compute the sum of exponentials of the differences of entries in the
-    // current row from the largest entry in the current row.
-    FixedPointAccum sum_of_exps = FixedPointAccum::Zero();
-    {
-      int c = 0;
-#ifdef USE_NEON
-      int32x4_t diff_min_s32 = vdupq_n_s32(diff_min);
-      FixedPointAccumInt32x4 sum_of_exps_0 = FixedPointAccumInt32x4::Zero();
-      FixedPointAccumInt32x4 sum_of_exps_1 = FixedPointAccumInt32x4::Zero();
-      FixedPointAccumInt32x4 zeros = FixedPointAccumInt32x4::Zero();
-      for (; c <= depth - 8; c += 8) {
-        uint16x8_t input_u16 = vmovl_u8(vld1_u8(input_data_ptr + c));
-        int16x8_t input_diff_s16 =
-            vsubq_s16(vreinterpretq_s16_u16(input_u16), max_in_row_s16);
-        int32x4_t input_diff_s32_0 = vmovl_s16(vget_low_s16(input_diff_s16));
-        int32x4_t input_diff_s32_1 = vmovl_s16(vget_high_s16(input_diff_s16));
-        int32x4_t mask_0 =
-            gemmlowp::MaskIfGreaterThanOrEqual(input_diff_s32_0, diff_min_s32);
-        int32x4_t mask_1 =
-            gemmlowp::MaskIfGreaterThanOrEqual(input_diff_s32_1, diff_min_s32);
-        FixedPointScaledDiffInt32x4 scaled_diff_0 =
-            input_beta_multiplier_f0 *
-            FixedPointScaledDiffInt32x4::FromRaw(
-                gemmlowp::ShiftLeft(input_diff_s32_0, input_beta_left_shift));
-        FixedPointScaledDiffInt32x4 scaled_diff_1 =
-            input_beta_multiplier_f0 *
-            FixedPointScaledDiffInt32x4::FromRaw(
-                gemmlowp::ShiftLeft(input_diff_s32_1, input_beta_left_shift));
-        FixedPointAccumInt32x4 exps_0 =
-            gemmlowp::Rescale(
-                exp_on_negative_values(scaled_diff_0));
-        FixedPointAccumInt32x4 exps_1 =
-            gemmlowp::Rescale(
-                exp_on_negative_values(scaled_diff_1));
-        FixedPointAccumInt32x4 masked_exps_0 =
-            SelectUsingMask(mask_0, exps_0, zeros);
-        FixedPointAccumInt32x4 masked_exps_1 =
-            SelectUsingMask(mask_1, exps_1, zeros);
-        sum_of_exps_0 = sum_of_exps_0 + masked_exps_0;
-        sum_of_exps_1 = sum_of_exps_1 + masked_exps_1;
-      }
-      int32x4_t sum_of_exps_reduced_4 = (sum_of_exps_0 + sum_of_exps_1).raw();
-      int32x2_t sum_of_exps_reduced_2 =
-          vadd_s32(vget_low_s32(sum_of_exps_reduced_4),
-                   vget_high_s32(sum_of_exps_reduced_4));
-      int32x2_t sum_of_exps_reduced_1 =
-          vpadd_s32(sum_of_exps_reduced_2, sum_of_exps_reduced_2);
-      sum_of_exps =
-          FixedPointAccum::FromRaw(vget_lane_s32(sum_of_exps_reduced_1, 0));
-#endif
-      for (; c < depth; ++c) {
-        int32 input_diff = static_cast(input_data_ptr[c]) - max_in_row;
-        if (input_diff >= diff_min) {
-          const int32 input_diff_rescaled =
-              MultiplyByQuantizedMultiplierGreaterThanOne(
-                  input_diff, input_beta_multiplier, input_beta_left_shift);
-          const FixedPointScaledDiff scaled_diff_f8 =
-              FixedPointScaledDiff::FromRaw(input_diff_rescaled);
-          sum_of_exps =
-              sum_of_exps + gemmlowp::Rescale(
-                                exp_on_negative_values(scaled_diff_f8));
-        }
-      }
-    }
-
-    // Compute the fixed-point multiplier and shift that we need to apply to
-    // perform a division by the above-computed sum-of-exponentials.
-    int num_bits_over_unit = 0;
-    FixedPoint0 shifted_scale = FixedPoint0::FromRaw(GetReciprocal(
-        sum_of_exps.raw(), kAccumulationIntegerBits, &num_bits_over_unit));
-
-    // Compute the quotients of exponentials of differences of entries in the
-    // current row from the largest entry, over the previously-computed sum of
-    // exponentials.
-    {
-      int c = 0;
-#ifdef USE_NEON
-      int16x8_t diff_min_s16 = vdupq_n_s16(diff_min);
-      for (; c <= depth - 8; c += 8) {
-        uint16x8_t input_u16 = vmovl_u8(vld1_u8(input_data_ptr + c));
-        int16x8_t input_diff_s16 =
-            vsubq_s16(vreinterpretq_s16_u16(input_u16), max_in_row_s16);
-        int32x4_t input_diff_s32_0 = vmovl_s16(vget_low_s16(input_diff_s16));
-        int32x4_t input_diff_s32_1 = vmovl_s16(vget_high_s16(input_diff_s16));
-        uint8x8_t mask = vmovn_u16(vcgeq_s16(input_diff_s16, diff_min_s16));
-        FixedPointScaledDiffInt32x4 scaled_diff_0 =
-            input_beta_multiplier_f0 *
-            FixedPointScaledDiffInt32x4::FromRaw(
-                gemmlowp::ShiftLeft(input_diff_s32_0, input_beta_left_shift));
-        FixedPointScaledDiffInt32x4 scaled_diff_1 =
-            input_beta_multiplier_f0 *
-            FixedPointScaledDiffInt32x4::FromRaw(
-                gemmlowp::ShiftLeft(input_diff_s32_1, input_beta_left_shift));
-        FixedPoint0Int32x4 exp_0 = exp_on_negative_values(scaled_diff_0);
-        FixedPoint0Int32x4 exp_1 = exp_on_negative_values(scaled_diff_1);
-        int32x4_t output_s32_0 = gemmlowp::RoundingDivideByPOT(
-            vqrdmulhq_n_s32(exp_0.raw(), shifted_scale.raw()),
-            num_bits_over_unit + 31 - 8);
-        int32x4_t output_s32_1 = gemmlowp::RoundingDivideByPOT(
-            vqrdmulhq_n_s32(exp_1.raw(), shifted_scale.raw()),
-            num_bits_over_unit + 31 - 8);
-        int16x8_t output_s16 =
-            vcombine_s16(vqmovn_s32(output_s32_0), vqmovn_s32(output_s32_1));
-        uint8x8_t output_u8 = vqmovun_s16(output_s16);
-        uint8x8_t masked_output = vbsl_u8(mask, output_u8, vdup_n_u8(0));
-        vst1_u8(output_data_ptr + c, masked_output);
-      }
-#endif
-      for (; c < depth; ++c) {
-        int32 input_diff = static_cast(input_data_ptr[c]) - max_in_row;
-        if (input_diff >= diff_min) {
-          const int32 input_diff_rescaled =
-              MultiplyByQuantizedMultiplierGreaterThanOne(
-                  input_diff, input_beta_multiplier, input_beta_left_shift);
-          const FixedPointScaledDiff scaled_diff_f8 =
-              FixedPointScaledDiff::FromRaw(input_diff_rescaled);
-
-          FixedPoint0 exp_in_0 = exp_on_negative_values(scaled_diff_f8);
-          int32 unsat_output = gemmlowp::RoundingDivideByPOT(
-              (shifted_scale * exp_in_0).raw(), num_bits_over_unit + 31 - 8);
-
-          output_data_ptr[c] = std::max(std::min(unsat_output, 255), 0);
-
-        } else {
-          output_data_ptr[c] = 0;
-        }
-      }
-    }
-  }
-}
-
-inline void Softmax(const float* input_data, const RuntimeShape& input_shape,
-                    float beta, float* output_data,
-                    const RuntimeShape& output_shape) {
-  SoftmaxParams params;
-  params.beta = beta;
-  Softmax(params, input_shape, input_data, output_shape, output_data);
-}
-
-inline void Softmax(const float* input_data, const Dims<4>& input_dims,
-                    float beta, float* output_data,
-                    const Dims<4>& output_dims) {
-  Softmax(input_data, DimsToShape(input_dims), beta, output_data,
-          DimsToShape(output_dims));
-}
-
-inline void Softmax(const uint8* input_data, const RuntimeShape& input_shape,
-                    int32 input_beta_multiplier, int32 input_beta_left_shift,
-                    int diff_min, uint8* output_data,
-                    const RuntimeShape& output_shape) {
-  SoftmaxParams params;
-  params.input_multiplier = input_beta_multiplier;
-  params.input_left_shift = input_beta_left_shift;
-  params.diff_min = diff_min;
-  Softmax(params, input_shape, input_data, output_shape, output_data);
-}
-inline void Softmax(const uint8* input_data, const Dims<4>& input_dims,
-                    int32 input_beta_multiplier, int32 input_beta_left_shift,
-                    int diff_min, uint8* output_data,
-                    const Dims<4>& output_dims) {
-  Softmax(input_data, DimsToShape(input_dims), input_beta_multiplier,
-          input_beta_left_shift, diff_min, output_data,
-          DimsToShape(output_dims));
-}
-
-inline void LogSoftmax(const float* input_data, const RuntimeShape& input_shape,
-                       float* output_data, const RuntimeShape& output_shape) {
-  SoftmaxParams params;
-  // No params currently used for float LogSoftmax.
-  LogSoftmax(params, input_shape, input_data, output_shape, output_data);
-}
-
-inline void LogSoftmax(const float* input_data, const Dims<4>& input_dims,
-                       float* output_data, const Dims<4>& output_dims) {
-  LogSoftmax(input_data, DimsToShape(input_dims), output_data,
-             DimsToShape(output_dims));
-}
-
-inline void LogSoftmax(const uint8* input_data, const RuntimeShape& input_shape,
-                       int32 input_multiplier, int32 input_left_shift,
-                       int32 reverse_scaling_divisor,
-                       int32 reverse_scaling_right_shift, int diff_min,
-                       uint8* output_data, const RuntimeShape& output_shape) {
-  SoftmaxParams params;
-  params.input_multiplier = input_multiplier;
-  params.input_left_shift = input_left_shift;
-  params.reverse_scaling_divisor = reverse_scaling_divisor;
-  params.reverse_scaling_right_shift = reverse_scaling_right_shift;
-  params.diff_min = diff_min;
-  reference_ops::LogSoftmax(params, input_shape, input_data, output_shape,
-                            output_data);
-}
-
-inline void LogSoftmax(const uint8* input_data, const Dims<4>& input_dims,
-                       int32 input_multiplier, int32 input_left_shift,
-                       int32 reverse_scaling_divisor,
-                       int32 reverse_scaling_right_shift, int diff_min,
-                       uint8* output_data, const Dims<4>& output_dims) {
-  reference_ops::LogSoftmax(
-      input_data, DimsToShape(input_dims), input_multiplier, input_left_shift,
-      reverse_scaling_divisor, reverse_scaling_right_shift, diff_min,
-      output_data, DimsToShape(output_dims));
-}
-
-inline void Logistic(const LogisticParams& params,
-                     const RuntimeShape& input_shape, const uint8* input_data,
-                     const RuntimeShape& output_shape, uint8* output_data) {
-  ruy::profiler::ScopeLabel label("Logistic/Uint8");
-  const int32 input_zero_point = params.input_zero_point;
-  const int32 input_range_radius = params.input_range_radius;
-  const int32 input_multiplier = params.input_multiplier;
-  const int input_left_shift = params.input_left_shift;
-  const int size = MatchingFlatSize(input_shape, output_shape);
-
-  int c = 0;
-#ifdef USE_NEON
-  // Handle 16 values at a time
-  for (; c <= size - 16; c += 16) {
-    // Read input uint8 values, cast to int16 and subtract input_zero_point
-    uint8x16_t input_val_u8 = vld1q_u8(input_data + c);
-    int16x8_t input_val_centered_0 =
-        vsubq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(input_val_u8))),
-                  vdupq_n_s16(input_zero_point));
-    int16x8_t input_val_centered_1 =
-        vsubq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(input_val_u8))),
-                  vdupq_n_s16(input_zero_point));
-
-    // Prepare the bit masks that we will use at the end to implement the logic
-    // that was expressed in the scalar code with branching:
-    //   if (input_val_centered < -input_range_radius) {
-    //     output_val = 0;
-    //   } else if (input_val_centered > input_range_radius) {
-    //     output_val = 255;
-    //   } else {
-    //     ...
-    uint16x8_t mask_rightclamp_0 =
-        vcgtq_s16(input_val_centered_0, vdupq_n_s16(input_range_radius));
-    uint16x8_t mask_rightclamp_1 =
-        vcgtq_s16(input_val_centered_1, vdupq_n_s16(input_range_radius));
-    uint16x8_t mask_leftclamp_0 =
-        vcgeq_s16(input_val_centered_0, vdupq_n_s16(-input_range_radius));
-    uint16x8_t mask_leftclamp_1 =
-        vcgeq_s16(input_val_centered_1, vdupq_n_s16(-input_range_radius));
-    uint8x16_t mask_rightclamp = vcombine_u8(vshrn_n_u16(mask_rightclamp_0, 8),
-                                             vshrn_n_u16(mask_rightclamp_1, 8));
-    uint8x16_t mask_leftclamp = vcombine_u8(vshrn_n_u16(mask_leftclamp_0, 8),
-                                            vshrn_n_u16(mask_leftclamp_1, 8));
-
-    // This performs what is expressed in the scalar code as
-    // const int32 input_val_rescaled =
-    //     MultiplyByQuantizedMultiplierGreaterThanOne(
-    //         input_val_centered, input_multiplier, input_left_shift);
-    int32x4_t input_val_rescaled_0 =
-        vshlq_s32(vmovl_s16(vget_low_s16(input_val_centered_0)),
-                  vdupq_n_s32(input_left_shift));
-    int32x4_t input_val_rescaled_1 =
-        vshlq_s32(vmovl_s16(vget_high_s16(input_val_centered_0)),
-                  vdupq_n_s32(input_left_shift));
-    int32x4_t input_val_rescaled_2 =
-        vshlq_s32(vmovl_s16(vget_low_s16(input_val_centered_1)),
-                  vdupq_n_s32(input_left_shift));
-    int32x4_t input_val_rescaled_3 =
-        vshlq_s32(vmovl_s16(vget_high_s16(input_val_centered_1)),
-                  vdupq_n_s32(input_left_shift));
-    input_val_rescaled_0 =
-        vqrdmulhq_n_s32(input_val_rescaled_0, input_multiplier);
-    input_val_rescaled_1 =
-        vqrdmulhq_n_s32(input_val_rescaled_1, input_multiplier);
-    input_val_rescaled_2 =
-        vqrdmulhq_n_s32(input_val_rescaled_2, input_multiplier);
-    input_val_rescaled_3 =
-        vqrdmulhq_n_s32(input_val_rescaled_3, input_multiplier);
-
-    // Invoke gemmlowp::logistic on FixedPoint wrapping int32x4_t
-    using FixedPoint4 = gemmlowp::FixedPoint;
-    using FixedPoint0 = gemmlowp::FixedPoint;
-    const FixedPoint4 input_val_f4_0 =
-        FixedPoint4::FromRaw(input_val_rescaled_0);
-    const FixedPoint4 input_val_f4_1 =
-        FixedPoint4::FromRaw(input_val_rescaled_1);
-    const FixedPoint4 input_val_f4_2 =
-        FixedPoint4::FromRaw(input_val_rescaled_2);
-    const FixedPoint4 input_val_f4_3 =
-        FixedPoint4::FromRaw(input_val_rescaled_3);
-    const FixedPoint0 output_val_f0_0 = gemmlowp::logistic(input_val_f4_0);
-    const FixedPoint0 output_val_f0_1 = gemmlowp::logistic(input_val_f4_1);
-    const FixedPoint0 output_val_f0_2 = gemmlowp::logistic(input_val_f4_2);
-    const FixedPoint0 output_val_f0_3 = gemmlowp::logistic(input_val_f4_3);
-
-    // Divide by 2^23 as in the scalar code
-    using gemmlowp::RoundingDivideByPOT;
-    int32x4_t output_val_s32_0 = RoundingDivideByPOT(output_val_f0_0.raw(), 23);
-    int32x4_t output_val_s32_1 = RoundingDivideByPOT(output_val_f0_1.raw(), 23);
-    int32x4_t output_val_s32_2 = RoundingDivideByPOT(output_val_f0_2.raw(), 23);
-    int32x4_t output_val_s32_3 = RoundingDivideByPOT(output_val_f0_3.raw(), 23);
-
-    // Cast output values to uint8, saturating
-    int16x8_t output_val_s16_0 = vcombine_s16(vqmovn_s32(output_val_s32_0),
-                                              vqmovn_s32(output_val_s32_1));
-    int16x8_t output_val_s16_1 = vcombine_s16(vqmovn_s32(output_val_s32_2),
-                                              vqmovn_s32(output_val_s32_3));
-    uint8x16_t output_val_u8 = vcombine_u8(vqmovun_s16(output_val_s16_0),
-                                           vqmovun_s16(output_val_s16_1));
-
-    // Perform the bit-masking with the bit masks computed at the beginning,
-    // see the comment there.
-    output_val_u8 = vorrq_u8(output_val_u8, mask_rightclamp);
-    output_val_u8 = vandq_u8(output_val_u8, mask_leftclamp);
-
-    // Store back to memory
-    vst1q_u8(output_data + c, output_val_u8);
-  }
-#endif
-  // Leftover loop: handle one value at a time with scalar code.
-  for (; c < size; ++c) {
-    const uint8 input_val_u8 = input_data[c];
-    const int32 input_val_centered =
-        static_cast(input_val_u8) - input_zero_point;
-    uint8 output_val;
-    if (input_val_centered < -input_range_radius) {
-      output_val = 0;
-    } else if (input_val_centered > input_range_radius) {
-      output_val = 255;
-    } else {
-      const int32 input_val_rescaled =
-          MultiplyByQuantizedMultiplierGreaterThanOne(
-              input_val_centered, input_multiplier, input_left_shift);
-      using FixedPoint4 = gemmlowp::FixedPoint;
-      using FixedPoint0 = gemmlowp::FixedPoint;
-      const FixedPoint4 input_val_f4 = FixedPoint4::FromRaw(input_val_rescaled);
-      const FixedPoint0 output_val_f0 = gemmlowp::logistic(input_val_f4);
-      using gemmlowp::RoundingDivideByPOT;
-      int32 output_val_s32 = RoundingDivideByPOT(output_val_f0.raw(), 23);
-      if (output_val_s32 == 256) {
-        output_val_s32 = 255;
-      }
-      TFLITE_DCHECK_GE(output_val_s32, 0);
-      TFLITE_DCHECK_LE(output_val_s32, 255);
-      output_val = static_cast(output_val_s32);
-    }
-    output_data[c] = output_val;
-  }
-}
-
-inline void Logistic(const uint8* input_data, const RuntimeShape& input_shape,
-                     int32 input_zero_point, int32 input_range_radius,
-                     int32 input_multiplier, int input_left_shift,
-                     uint8* output_data, const RuntimeShape& output_shape) {
-  LogisticParams params;
-  params.input_zero_point = input_zero_point;
-  params.input_range_radius = input_range_radius;
-  params.input_multiplier = input_multiplier;
-  params.input_left_shift = input_left_shift;
-  Logistic(params, input_shape, input_data, output_shape, output_data);
-}
-
-inline void Logistic(const float* input_data, const Dims<4>& input_dims,
-                     float* output_data, const Dims<4>& output_dims) {
-  Logistic(DimsToShape(input_dims), input_data, DimsToShape(output_dims),
-           output_data);
-}
-
-inline void Logistic(const uint8* input_data, const Dims<4>& input_dims,
-                     int32 input_zero_point, int32 input_range_radius,
-                     int32 input_multiplier, int input_left_shift,
-                     uint8* output_data, const Dims<4>& output_dims) {
-  Logistic(input_data, DimsToShape(input_dims), input_zero_point,
-           input_range_radius, input_multiplier, input_left_shift, output_data,
-           DimsToShape(output_dims));
-}
-
-inline void Logistic(const RuntimeShape& input_shape, const int16* input_data,
-                     const RuntimeShape& output_shape, int16* output_data) {
-  LogisticParams params;
-  // No params currently needed by int16 Logistic.
-  Logistic(params, input_shape, input_data, output_shape, output_data);
-}
-
-inline void Logistic(const int16* input_data, const RuntimeShape& input_shape,
-                     int16* output_data, const RuntimeShape& output_shape) {
-  LogisticParams params;
-  // No params currently needed by int16 Logistic.
-  Logistic(params, input_shape, input_data, output_shape, output_data);
-}
-
-inline void Logistic(const int16* input_data, const Dims<4>& input_dims,
-                     int16* output_data, const Dims<4>& output_dims) {
-  Logistic(input_data, DimsToShape(input_dims), output_data,
-           DimsToShape(output_dims));
-}
-
-inline void Tanh(const float* input_data, const Dims<4>& input_dims,
-                 float* output_data, const Dims<4>& output_dims) {
-  Tanh(DimsToShape(input_dims), input_data, DimsToShape(output_dims),
-       output_data);
-}
-
-inline void Tanh(const TanhParams& params, const RuntimeShape& input_shape,
-                 const uint8* input_data, const RuntimeShape& output_shape,
-                 uint8* output_data) {
-  // Note that this is almost the exact same code as in Logistic().
-  ruy::profiler::ScopeLabel label("Tanh");
-  const int32 input_zero_point = params.input_zero_point;
-  const int32 input_range_radius = params.input_range_radius;
-  const int32 input_multiplier = params.input_multiplier;
-  const int input_left_shift = params.input_left_shift;
-  const int size = MatchingFlatSize(input_shape, output_shape);
-
-  int c = 0;
-  int32_t output_zero_point = 128;
-#ifdef USE_NEON
-  // Handle 16 values at a time
-  for (; c <= size - 16; c += 16) {
-    // Read input uint8 values, cast to int16 and subtract input_zero_point
-    uint8x16_t input_val_u8 = vld1q_u8(input_data + c);
-    int16x8_t input_val_centered_0 =
-        vsubq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(input_val_u8))),
-                  vdupq_n_s16(input_zero_point));
-    int16x8_t input_val_centered_1 =
-        vsubq_s16(vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(input_val_u8))),
-                  vdupq_n_s16(input_zero_point));
-
-    // Prepare the bit masks that we will use at the end to implement the logic
-    // that was expressed in the scalar code with branching:
-    //   if (input_val_centered < -input_range_radius) {
-    //     output_val = 0;
-    //   } else if (input_val_centered > input_range_radius) {
-    //     output_val = 255;
-    //   } else {
-    //     ...
-    uint16x8_t mask_rightclamp_0 =
-        vcgtq_s16(input_val_centered_0, vdupq_n_s16(input_range_radius));
-    uint16x8_t mask_rightclamp_1 =
-        vcgtq_s16(input_val_centered_1, vdupq_n_s16(input_range_radius));
-    uint16x8_t mask_leftclamp_0 =
-        vcgeq_s16(input_val_centered_0, vdupq_n_s16(-input_range_radius));
-    uint16x8_t mask_leftclamp_1 =
-        vcgeq_s16(input_val_centered_1, vdupq_n_s16(-input_range_radius));
-    uint8x16_t mask_rightclamp = vcombine_u8(vshrn_n_u16(mask_rightclamp_0, 8),
-                                             vshrn_n_u16(mask_rightclamp_1, 8));
-    uint8x16_t mask_leftclamp = vcombine_u8(vshrn_n_u16(mask_leftclamp_0, 8),
-                                            vshrn_n_u16(mask_leftclamp_1, 8));
-
-    // This performs what is expressed in the scalar code as
-    // const int32 input_val_rescaled =
-    //     MultiplyByQuantizedMultiplierGreaterThanOne(
-    //         input_val_centered, input_multiplier, input_left_shift);
-    int32x4_t input_val_rescaled_0 =
-        vshlq_s32(vmovl_s16(vget_low_s16(input_val_centered_0)),
-                  vdupq_n_s32(input_left_shift));
-    int32x4_t input_val_rescaled_1 =
-        vshlq_s32(vmovl_s16(vget_high_s16(input_val_centered_0)),
-                  vdupq_n_s32(input_left_shift));
-    int32x4_t input_val_rescaled_2 =
-        vshlq_s32(vmovl_s16(vget_low_s16(input_val_centered_1)),
-                  vdupq_n_s32(input_left_shift));
-    int32x4_t input_val_rescaled_3 =
-        vshlq_s32(vmovl_s16(vget_high_s16(input_val_centered_1)),
-                  vdupq_n_s32(input_left_shift));
-    input_val_rescaled_0 =
-        vqrdmulhq_n_s32(input_val_rescaled_0, input_multiplier);
-    input_val_rescaled_1 =
-        vqrdmulhq_n_s32(input_val_rescaled_1, input_multiplier);
-    input_val_rescaled_2 =
-        vqrdmulhq_n_s32(input_val_rescaled_2, input_multiplier);
-    input_val_rescaled_3 =
-        vqrdmulhq_n_s32(input_val_rescaled_3, input_multiplier);
-
-    // Invoke gemmlowp::tanh on FixedPoint wrapping int32x4_t
-    using FixedPoint4 = gemmlowp::FixedPoint;
-    using FixedPoint0 = gemmlowp::FixedPoint;
-    const FixedPoint4 input_val_f4_0 =
-        FixedPoint4::FromRaw(input_val_rescaled_0);
-    const FixedPoint4 input_val_f4_1 =
-        FixedPoint4::FromRaw(input_val_rescaled_1);
-    const FixedPoint4 input_val_f4_2 =
-        FixedPoint4::FromRaw(input_val_rescaled_2);
-    const FixedPoint4 input_val_f4_3 =
-        FixedPoint4::FromRaw(input_val_rescaled_3);
-    const FixedPoint0 output_val_f0_0 = gemmlowp::tanh(input_val_f4_0);
-    const FixedPoint0 output_val_f0_1 = gemmlowp::tanh(input_val_f4_1);
-    const FixedPoint0 output_val_f0_2 = gemmlowp::tanh(input_val_f4_2);
-    const FixedPoint0 output_val_f0_3 = gemmlowp::tanh(input_val_f4_3);
-
-    // Divide by 2^24 as in the scalar code
-    using gemmlowp::RoundingDivideByPOT;
-    int32x4_t output_val_s32_0 = RoundingDivideByPOT(output_val_f0_0.raw(), 24);
-    int32x4_t output_val_s32_1 = RoundingDivideByPOT(output_val_f0_1.raw(), 24);
-    int32x4_t output_val_s32_2 = RoundingDivideByPOT(output_val_f0_2.raw(), 24);
-    int32x4_t output_val_s32_3 = RoundingDivideByPOT(output_val_f0_3.raw(), 24);
-
-    // Add the output zero point
-    int32x4_t output_zero_point_s32 = vdupq_n_s32(output_zero_point);
-    output_val_s32_0 = vaddq_s32(output_val_s32_0, output_zero_point_s32);
-    output_val_s32_1 = vaddq_s32(output_val_s32_1, output_zero_point_s32);
-    output_val_s32_2 = vaddq_s32(output_val_s32_2, output_zero_point_s32);
-    output_val_s32_3 = vaddq_s32(output_val_s32_3, output_zero_point_s32);
-
-    // Cast output values to uint8, saturating
-    int16x8_t output_val_s16_0 = vcombine_s16(vqmovn_s32(output_val_s32_0),
-                                              vqmovn_s32(output_val_s32_1));
-    int16x8_t output_val_s16_1 = vcombine_s16(vqmovn_s32(output_val_s32_2),
-                                              vqmovn_s32(output_val_s32_3));
-    uint8x16_t output_val_u8 = vcombine_u8(vqmovun_s16(output_val_s16_0),
-                                           vqmovun_s16(output_val_s16_1));
-
-    // Perform the bit-masking with the bit masks computed at the beginning,
-    // see the comment there.
-    output_val_u8 = vorrq_u8(output_val_u8, mask_rightclamp);
-    output_val_u8 = vandq_u8(output_val_u8, mask_leftclamp);
-
-    // Store back to memory
-    vst1q_u8(output_data + c, output_val_u8);
-  }
-#endif
-  // Leftover loop: handle one value at a time with scalar code.
-  for (; c < size; ++c) {
-    const uint8 input_val_u8 = input_data[c];
-    const int32 input_val_centered =
-        static_cast(input_val_u8) - input_zero_point;
-    uint8 output_val;
-    if (input_val_centered < -input_range_radius) {
-      output_val = 0;
-    } else if (input_val_centered > input_range_radius) {
-      output_val = 255;
-    } else {
-      const int32 input_val_rescaled =
-          MultiplyByQuantizedMultiplierGreaterThanOne(
-              input_val_centered, input_multiplier, input_left_shift);
-      using FixedPoint4 = gemmlowp::FixedPoint;
-      using FixedPoint0 = gemmlowp::FixedPoint;
-      const FixedPoint4 input_val_f4 = FixedPoint4::FromRaw(input_val_rescaled);
-      const FixedPoint0 output_val_f0 = gemmlowp::tanh(input_val_f4);
-      using gemmlowp::RoundingDivideByPOT;
-      int32 output_val_s32 = RoundingDivideByPOT(output_val_f0.raw(), 24);
-      output_val_s32 += output_zero_point;
-      if (output_val_s32 == 256) {
-        output_val_s32 = 255;
-      }
-      TFLITE_DCHECK_GE(output_val_s32, 0);
-      TFLITE_DCHECK_LE(output_val_s32, 255);
-      output_val = static_cast(output_val_s32);
-    }
-    output_data[c] = output_val;
-  }
-}
-
-inline void Tanh(const uint8* input_data, const RuntimeShape& input_shape,
-                 int32 input_zero_point, int32 input_range_radius,
-                 int32 input_multiplier, int input_left_shift,
-                 uint8* output_data, const RuntimeShape& output_shape) {
-  TanhParams params;
-  params.input_zero_point = input_zero_point;
-  params.input_range_radius = input_range_radius;
-  params.input_multiplier = input_multiplier;
-  params.input_left_shift = input_left_shift;
-  Tanh(params, input_shape, input_data, output_shape, output_data);
-}
-
-inline void Tanh(const uint8* input_data, const Dims<4>& input_dims,
-                 int32 input_zero_point, int32 input_range_radius,
-                 int32 input_multiplier, int input_left_shift,
-                 uint8* output_data, const Dims<4>& output_dims) {
-  Tanh(input_data, DimsToShape(input_dims), input_zero_point,
-       input_range_radius, input_multiplier, input_left_shift, output_data,
-       DimsToShape(output_dims));
-}
-
-inline void Tanh(const int16* input_data, const RuntimeShape& input_shape,
-                 int input_left_shift, int16* output_data,
-                 const RuntimeShape& output_shape) {
-  TanhParams params;
-  params.input_left_shift = input_left_shift;
-  Tanh(params, input_shape, input_data, output_shape, output_data);
-}
-
-inline void Tanh(const int16* input_data, const Dims<4>& input_dims,
-                 int input_left_shift, int16* output_data,
-                 const Dims<4>& output_dims) {
-  Tanh(input_data, DimsToShape(input_dims), input_left_shift, output_data,
-       DimsToShape(output_dims));
-}
-
-template 
-inline void DepthToSpace(const T* input_data, const Dims<4>& input_dims,
-                         int block_size, T* output_data,
-                         const Dims<4>& output_dims) {
-  tflite::DepthToSpaceParams op_params;
-  op_params.block_size = block_size;
-
-  DepthToSpace(op_params, DimsToShape(input_dims), input_data,
-               DimsToShape(output_dims), output_data);
-}
-
-template 
-inline void SpaceToDepth(const T* input_data, const Dims<4>& input_dims,
-                         int block_size, T* output_data,
-                         const Dims<4>& output_dims) {
-  tflite::SpaceToDepthParams op_params;
-  op_params.block_size = block_size;
-
-  SpaceToDepth(op_params, DimsToShape(input_dims), input_data,
-               DimsToShape(output_dims), output_data);
-}
-
-inline void Mul(const float* input1_data, const Dims<4>& input1_dims,
-                const float* input2_data, const Dims<4>& input2_dims,
-                float output_activation_min, float output_activation_max,
-                float* output_data, const Dims<4>& output_dims) {
-  tflite::ArithmeticParams op_params;
-  op_params.float_activation_min = output_activation_min;
-  op_params.float_activation_max = output_activation_max;
-
-  Mul(op_params, DimsToShape(input1_dims), input1_data,
-      DimsToShape(input2_dims), input2_data, DimsToShape(output_dims),
-      output_data);
-}
-
-template 
-void Mul(const float* input1_data, const Dims<4>& input1_dims,
-         const float* input2_data, const Dims<4>& input2_dims,
-         float* output_data, const Dims<4>& output_dims) {
-  float output_activation_min, output_activation_max;
-  GetActivationMinMax(Ac, &output_activation_min, &output_activation_max);
-
-  Mul(input1_data, input1_dims, input2_data, input2_dims, output_activation_min,
-      output_activation_max, output_data, output_dims);
-}
-
-inline void Mul(const int32* input1_data, const Dims<4>& input1_dims,
-                const int32* input2_data, const Dims<4>& input2_dims,
-                int32 output_activation_min, int32 output_activation_max,
-                int32* output_data, const Dims<4>& output_dims) {
-  tflite::ArithmeticParams op_params;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-
-  Mul(op_params, DimsToShape(input1_dims), input1_data,
-      DimsToShape(input2_dims), input2_data, DimsToShape(output_dims),
-      output_data);
-}
-
-template 
-void Mul(const int32* input1_data, const Dims<4>& input1_dims,
-         const int32* input2_data, const Dims<4>& input2_dims,
-         int32* output_data, const Dims<4>& output_dims) {
-  TFLITE_DCHECK(Ac == FusedActivationFunctionType::kNone);
-  tflite::ArithmeticParams op_params;
-  // No parameters needed.
-
-  MulNoActivation(op_params, DimsToShape(input1_dims), input1_data,
-                  DimsToShape(input2_dims), input2_data,
-                  DimsToShape(output_dims), output_data);
-}
-
-inline void Mul(const int16* input1_data, const Dims<4>& input1_dims,
-                const int16* input2_data, const Dims<4>& input2_dims,
-                int16* output_data, const Dims<4>& output_dims) {
-  tflite::ArithmeticParams op_params;
-  // No parameters needed.
-
-  Mul(op_params, DimsToShape(input1_dims), input1_data,
-      DimsToShape(input2_dims), input2_data, DimsToShape(output_dims),
-      output_data);
-}
-
-inline void Mul(const int16* input1_data, const Dims<4>& input1_dims,
-                const int16* input2_data, const Dims<4>& input2_dims,
-                int32 output_offset, int32 output_activation_min,
-                int32 output_activation_max, uint8* output_data,
-                const Dims<4>& output_dims) {
-  tflite::ArithmeticParams op_params;
-  op_params.output_offset = output_offset;
-  op_params.quantized_activation_min = output_activation_min;
-  op_params.quantized_activation_max = output_activation_max;
-
-  Mul(op_params, DimsToShape(input1_dims), input1_data,
-      DimsToShape(input2_dims), input2_data, DimsToShape(output_dims),
-      output_data);
-}
-
-template 
-void BroadcastMul(const T* input1_data, const Dims<4>& input1_dims,
-                  const T* input2_data, const Dims<4>& input2_dims,
-                  T output_activation_min, T output_activation_max,
-                  T* output_data, const Dims<4>& output_dims) {
-  tflite::ArithmeticParams op_params;
-  SetActivationParams(output_activation_min, output_activation_max, &op_params);
-
-  BroadcastMul4DSlow(op_params, DimsToShape(input1_dims), input1_data,
-                     DimsToShape(input2_dims), input2_data,
-                     DimsToShape(output_dims), output_data);
-}
-
-// For compatibility with old checked-in code
-template 
-inline void BroadcastMul(const float* input1_data, const Dims<4>& input1_dims,
-                         const float* input2_data, const Dims<4>& input2_dims,
-                         float* output_data, const Dims<4>& output_dims) {
-  tflite::ArithmeticParams op_params;
-  float float_activation_min;
-  float float_activation_max;
-  GetActivationMinMax(Ac, &float_activation_min, &float_activation_max);
-  SetActivationParams(float_activation_min, float_activation_max, &op_params);
-
-  BroadcastMul4DSlow(op_params, DimsToShape(input1_dims), input1_data,
-                     DimsToShape(input2_dims), input2_data,
-                     DimsToShape(output_dims), output_data);
-}
-
-inline void LocalResponseNormalization(const float* input_data,
-                                       const Dims<4>& input_dims, int range,
-                                       float bias, float alpha, float beta,
-                                       float* output_data,
-                                       const Dims<4>& output_dims) {
-  tflite::LocalResponseNormalizationParams op_params;
-  op_params.range = range;
-  op_params.bias = bias;
-  op_params.alpha = alpha;
-  op_params.beta = beta;
-
-  LocalResponseNormalization(op_params, DimsToShape(input_dims), input_data,
-                             DimsToShape(output_dims), output_data);
-}
-
-template 
-void Cast(const SrcT* input_data, const Dims<4>& input_dims, DstT* output_data,
-          const Dims<4>& output_dims) {
-  Cast(DimsToShape(input_dims), input_data, DimsToShape(output_dims),
-       output_data);
-}
-
-inline void Floor(const float* input_data, const Dims<4>& input_dims,
-                  float* output_data, const Dims<4>& output_dims) {
-  Floor(DimsToShape(input_dims), input_data, DimsToShape(output_dims),
-        output_data);
-}
-
-inline void ResizeBilinear(const float* input_data, const Dims<4>& input_dims,
-                           const int32* output_size_data,
-                           const Dims<4>& output_size_dims, float* output_data,
-                           const Dims<4>& output_dims, bool align_corners) {
-  tflite::ResizeBilinearParams op_params;
-  op_params.align_corners = align_corners;
-  op_params.half_pixel_centers = false;
-  ResizeBilinear(op_params, DimsToShape(input_dims), input_data,
-                 DimsToShape(output_size_dims), output_size_data,
-                 DimsToShape(output_dims), output_data);
-}
-
-inline void ResizeBilinear(const uint8* input_data, const Dims<4>& input_dims,
-                           const int32* output_size_data,
-                           const Dims<4>& output_size_dims, uint8* output_data,
-                           const Dims<4>& output_dims, bool align_corners) {
-  tflite::ResizeBilinearParams op_params;
-  op_params.align_corners = align_corners;
-  op_params.half_pixel_centers = false;
-  ResizeBilinear(op_params, DimsToShape(input_dims), input_data,
-                 DimsToShape(output_size_dims), output_size_data,
-                 DimsToShape(output_dims), output_data);
-}
-
-// legacy, for compatibility with old checked-in code
-inline void ResizeBilinear(const float* input_data, const Dims<4>& input_dims,
-                           const int32* output_size_data,
-                           const Dims<4>& output_size_dims, float* output_data,
-                           const Dims<4>& output_dims) {
-  ResizeBilinear(input_data, input_dims, output_size_data, output_size_dims,
-                 output_data, output_dims, /*align_corners=*/false);
-}
-
-// legacy, for compatibility with old checked-in code
-inline void ResizeBilinear(const uint8* input_data, const Dims<4>& input_dims,
-                           const int32* output_size_data,
-                           const Dims<4>& output_size_dims, uint8* output_data,
-                           const Dims<4>& output_dims) {
-  ResizeBilinear(input_data, input_dims, output_size_data, output_size_dims,
-                 output_data, output_dims, /*align_corners=*/false);
-}
-
-template 
-inline void BatchToSpaceND(const T* input_data, const Dims<4>& input_dims,
-                           const int32* block_shape_data,
-                           const Dims<4>& block_shape_dims,
-                           const int32* crops_data, const Dims<4>& crops_dims,
-                           T* output_data, const Dims<4>& output_dims) {
-  BatchToSpaceND(DimsToShape(input_dims), input_data,
-                 DimsToShape(block_shape_dims), block_shape_data,
-                 DimsToShape(crops_dims), crops_data, DimsToShape(output_dims),
-                 output_data);
-}
-
-// Legacy signature, function covered both Pad and PadV2.
-template 
-inline void PadV2(const T* input_data, const Dims<4>& input_dims,
-                  const std::vector& left_paddings,
-                  const std::vector& right_paddings, T* output_data,
-                  const Dims<4>& output_dims, const T pad_value) {
-  TFLITE_DCHECK_EQ(left_paddings.size(), 4);
-  TFLITE_DCHECK_EQ(right_paddings.size(), 4);
-  tflite::PadParams op_params;
-  op_params.left_padding_count = 4;
-  op_params.right_padding_count = 4;
-  for (int i = 0; i < 4; ++i) {
-    op_params.left_padding[i] = left_paddings[3 - i];
-    op_params.right_padding[i] = right_paddings[3 - i];
-  }
-  const T pad_value_copy = pad_value;
-
-  Pad(op_params, DimsToShape(input_dims), input_data, &pad_value_copy,
-      DimsToShape(output_dims), output_data);
-}
-
-// Old Pad that calls legacy PadV2.
-template 
-inline void Pad(const T* input_data, const Dims<4>& input_dims,
-                const std::vector& left_paddings,
-                const std::vector& right_paddings, T* output_data,
-                const Dims<4>& output_dims, const int32_t pad_value) {
-  const T converted_pad_value = static_cast(pad_value);
-  PadV2(input_data, input_dims, left_paddings, right_paddings, output_data,
-           output_dims, converted_pad_value);
-}
-
-// Old Pad that only padded with 0.
-template 
-inline void Pad(const T* input_data, const Dims<4>& input_dims,
-                const std::vector& left_paddings,
-                const std::vector& right_paddings, T* output_data,
-                const Dims<4>& output_dims) {
-  const T pad_value = static_cast(0);
-  PadV2(input_data, input_dims, left_paddings, right_paddings, output_data,
-           output_dims, pad_value);
-}
-
-template 
-inline void Slice(const T* input_data, const Dims<4>& input_dims,
-                  const std::vector& begin, const std::vector& size,
-                  T* output_data, const Dims<4>& output_dims) {
-  tflite::SliceParams op_params;
-  op_params.begin_count = 4;
-  op_params.size_count = 4;
-  for (int i = 0; i < 4; ++i) {
-    op_params.begin[i] = begin[3 - i];
-    op_params.size[i] = size[3 - i];
-  }
-
-  Slice(op_params, DimsToShape(input_dims), input_data,
-        DimsToShape(output_dims), output_data);
-}
-
-template 
-void TensorFlowMinimum(const T* input1_data, const Dims<4>& input1_dims,
-                       const T* input2_data, T* output_data,
-                       const Dims<4>& output_dims) {
-  Minimum(DimsToShape(input1_dims), input1_data, input2_data,
-          DimsToShape(output_dims), output_data);
-}
-
-template 
-void TensorFlowMaximum(const T* input1_data, const Dims<4>& input1_dims,
-                       const T* input2_data, T* output_data,
-                       const Dims<4>& output_dims) {
-  Maximum(DimsToShape(input1_dims), input1_data, input2_data,
-          DimsToShape(output_dims), output_data);
-}
-
-inline void Dequantize(const uint8* input_data, const Dims<4>& input_dims,
-                       int32 zero_point, double scale, float* output_data,
-                       const Dims<4>& output_dims) {
-  tflite::DequantizationParams op_params;
-  op_params.zero_point = zero_point;
-  op_params.scale = scale;
-
-  Dequantize(op_params, DimsToShape(input_dims), input_data,
-             DimsToShape(output_dims), output_data);
-}
-
-template 
-void Transpose(const T* input, const Dims<4>& input_dims, T* output,
-               const Dims<4>& output_dims, const int* permuted_axes) {
-  TransposeParams params;
-  params.perm_count = 4;
-  for (int i = 0; i < 4; ++i) {
-    params.perm[i] = 3 - permuted_axes[3 - i];
-  }
-  Transpose(params, DimsToShape(input_dims), input, DimsToShape(output_dims),
-            output);
-}
-
-}  // namespace optimized_ops
-}  // namespace tflite
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_LEGACY_OPTIMIZED_OPS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/multithreaded_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/multithreaded_conv.h
deleted file mode 100644
index c4eab73..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/multithreaded_conv.h
+++ /dev/null
@@ -1,183 +0,0 @@
-/* Copyright 2017 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_KERNELS_INTERNAL_OPTIMIZED_MULTITHREADED_CONV_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_MULTITHREADED_CONV_H_
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/c/builtin_op_data.h"
-#include "tensorflow/lite/kernels/internal/common.h"
-#include "tensorflow/lite/kernels/internal/optimized/eigen_spatial_convolutions.h"
-#include "tensorflow/lite/kernels/internal/optimized/optimized_ops.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-namespace tflite {
-namespace multithreaded_ops {
-
-// Shorthands for the types we need when interfacing with the EigenTensor
-// library.
-typedef Eigen::TensorMap<
-    Eigen::Tensor, Eigen::Aligned>
-    EigenMatrix;
-typedef Eigen::TensorMap<
-    Eigen::Tensor,
-    Eigen::Aligned>
-    ConstEigenMatrix;
-
-typedef Eigen::TensorMap<
-    Eigen::Tensor, Eigen::Aligned>
-    EigenTensor;
-typedef Eigen::TensorMap<
-    Eigen::Tensor,
-    Eigen::Aligned>
-    ConstEigenTensor;
-
-// Utility functions we need for the EigenTensor API.
-template 
-struct MatMulConvFunctor {
-  // Computes on device "d": out = in0 * in1, where * is matrix
-  // multiplication.
-  void operator()(
-      const Device& d, EigenMatrix out, ConstEigenMatrix in0,
-      ConstEigenMatrix in1,
-      const Eigen::array, 1>& dim_pair) {
-    out.device(d) = in0.contract(in1, dim_pair);
-  }
-};
-
-template 
-class EigenTensorConvFunctor {
- private:
-  Eigen::PaddingType RuntimePadding2EigenPadding(PaddingType padding) {
-    switch (padding) {
-      case PaddingType::kValid:
-        return Eigen::PADDING_VALID;
-      case PaddingType::kSame:
-        return Eigen::PADDING_SAME;
-      case PaddingType::kNone:
-        assert(false);  // should never get here.
-        return Eigen::PADDING_VALID;
-    }
-    return Eigen::PADDING_SAME;  // Prevent compiler warning about missing
-                                 // return
-  }
-
- public:
-  void operator()(const Eigen::ThreadPoolDevice& device, const T* input_data,
-                  int input_batches, int input_height, int input_width,
-                  int input_depth, const T* filter_data, int filter_height,
-                  int filter_width, int filter_count, int stride_rows,
-                  int stride_cols, int pad_width, int pad_height,
-                  PaddingType padding, T* output_data, int output_height,
-                  int output_width) {
-    const bool is_1x1_kernel = (filter_height == 1 && filter_width == 1 &&
-                                stride_rows == 1 && stride_cols == 1);
-    if (is_1x1_kernel) {
-      // For 1x1 kernel, the 2D convolution is reduced to matrix
-      // multiplication.
-      const int conv_width = output_height * output_width;
-      Eigen::array, 1> dim_pair;
-      dim_pair[0] = Eigen::IndexPair(1, 0);
-      EigenMatrix output(output_data, input_batches * conv_width, filter_count);
-      ConstEigenMatrix input(input_data, input_batches * conv_width,
-                             input_depth);
-      ConstEigenMatrix filter(filter_data, input_depth, filter_count);
-      MatMulConvFunctor()(device, output, input,
-                                                      filter, dim_pair);
-    } else if (filter_height == input_height && filter_width == input_width &&
-               pad_width == 0 && pad_height == 0) {
-      // If the input data and filter have the same height/width,
-      // the 2D convolution is reduced to matrix multiplication.
-      const int k =  // Length of reduction dimension.
-          filter_width * filter_height * input_depth;
-      Eigen::array, 1> dim_pair;
-      dim_pair[0] = Eigen::IndexPair(1, 0);
-      EigenMatrix output(output_data, input_batches, filter_count);
-      ConstEigenMatrix input(input_data, input_batches, k);
-      ConstEigenMatrix filter(filter_data, k, filter_count);
-      MatMulConvFunctor()(device, output, input,
-                                                      filter, dim_pair);
-    } else {
-      EigenTensor output(output_data, input_batches, output_height,
-                         output_width, filter_count);
-      ConstEigenTensor input(input_data, input_batches, input_height,
-                             input_width, input_depth);
-      ConstEigenTensor filter(filter_data, filter_height, filter_width,
-                              input_depth, filter_count);
-      output.device(device) =
-          Eigen::SpatialConvolution(input, filter, stride_cols, stride_rows,
-                                    RuntimePadding2EigenPadding(padding));
-    }
-  }
-};
-
-inline void Conv(const Eigen::ThreadPoolDevice& device,
-                 const ConvParams& params, const RuntimeShape& input_shape,
-                 const float* input_data, const RuntimeShape& filter_shape,
-                 const float* filter_data, const RuntimeShape& bias_shape,
-                 const float* bias_data, const RuntimeShape& output_shape,
-                 float* output_data, const RuntimeShape& im2col_shape,
-                 float* im2col_data) {
-  // Nest profiling under "Conv", to aggregate with other kernels.
-  ruy::profiler::ScopeLabel label("Conv");
-  ruy::profiler::ScopeLabel inner_label("Multithreaded EigenTensor");
-
-  // im2col data should not be generated for the multi-thread supporting case.
-  TFLITE_DCHECK(!im2col_data);
-  (void)im2col_shape;
-  const int stride_width = params.stride_width;
-  const int stride_height = params.stride_height;
-  const PaddingType padding = params.padding_type;
-  const int pad_width = params.padding_values.width;
-  const int pad_height = params.padding_values.height;
-  const float output_activation_min = params.float_activation_min;
-  const float output_activation_max = params.float_activation_max;
-  TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4);
-  TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4);
-
-  const int batches = MatchingDim(input_shape, 0, output_shape, 0);
-  const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3);
-  const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3);
-  const int input_height = input_shape.Dims(1);
-  const int input_width = input_shape.Dims(2);
-  const int filter_height = filter_shape.Dims(1);
-  const int filter_width = filter_shape.Dims(2);
-  const int output_height = output_shape.Dims(1);
-  const int output_width = output_shape.Dims(2);
-  EigenTensorConvFunctor conv_functor;
-  conv_functor(device, input_data, batches, input_height, input_width,
-               input_depth, filter_data, filter_height, filter_width,
-               output_depth, stride_height, stride_width, pad_height, pad_width,
-               padding, output_data, output_height, output_width);
-
-  optimized_ops::AddBiasAndEvalActivationFunction(
-      output_activation_min, output_activation_max, bias_shape, bias_data,
-      output_shape, output_data);
-}
-
-}  // namespace multithreaded_ops
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_MULTITHREADED_CONV_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/neon_check.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/neon_check.h
deleted file mode 100644
index bbf745c..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/neon_check.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* 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_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_
-
-#if defined(__ARM_NEON__) || defined(__ARM_NEON)
-#define USE_NEON
-#include 
-#endif
-
-#if defined __GNUC__ && defined __SSE4_1__ && !defined TF_LITE_DISABLE_X86_NEON
-#define USE_NEON
-#include "NEON_2_SSE.h"
-#endif
-
-// NEON_OR_PORTABLE(SomeFunc, args) calls NeonSomeFunc(args) if USE_NEON is
-// defined, PortableSomeFunc(args) otherwise.
-#ifdef USE_NEON
-// Always use Neon code
-#define NEON_OR_PORTABLE(funcname, ...) Neon##funcname(__VA_ARGS__)
-
-#else
-// No NEON available: Use Portable code
-#define NEON_OR_PORTABLE(funcname, ...) Portable##funcname(__VA_ARGS__)
-
-#endif  // defined(USE_NEON)
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_CHECK_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/neon_tensor_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/neon_tensor_utils.h
deleted file mode 100644
index 6288462..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/neon_tensor_utils.h
+++ /dev/null
@@ -1,322 +0,0 @@
-/* Copyright 2017 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_KERNELS_INTERNAL_OPTIMIZED_NEON_TENSOR_UTILS_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_TENSOR_UTILS_H_
-
-// TODO(ghodrat): Remove this header file and the dependency to internal data
-// structure.
-#include "tensorflow/lite/c/builtin_op_data.h"
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/neon_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/neon_tensor_utils_impl.h"
-#include "tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h"
-
-namespace tflite {
-namespace tensor_utils {
-
-void MatrixBatchVectorMultiplyAccumulate(const float* matrix, int m_rows,
-                                         int m_cols, const float* vector,
-                                         int n_batch, float* result) {
-  NEON_OR_PORTABLE(MatrixBatchVectorMultiplyAccumulate, matrix, m_rows, m_cols,
-                   vector, n_batch, result);
-}
-
-void MatrixBatchVectorMultiplyAccumulate(const int8_t* __restrict__ matrix,
-                                         const int m_rows, const int m_cols,
-                                         const int8_t* __restrict__ vectors,
-                                         const float* scaling_factors,
-                                         int n_batch,
-                                         float* __restrict__ result) {
-  NEON_OR_PORTABLE(MatrixBatchVectorMultiplyAccumulate, matrix, m_rows, m_cols,
-                   vectors, scaling_factors, n_batch, result);
-}
-
-void MatrixBatchVectorMultiplyAccumulate(const int8_t* __restrict__ matrix,
-                                         const int m_rows, const int m_cols,
-                                         const int8_t* __restrict__ vectors,
-                                         const float* scaling_factors,
-                                         int n_batch, int32_t* scratch,
-                                         float* __restrict__ result,
-                                         CpuBackendContext* context) {
-  NEON_OR_PORTABLE(MatrixBatchVectorMultiplyAccumulate, matrix, m_rows, m_cols,
-                   vectors, scaling_factors, n_batch, scratch, result, context);
-}
-
-void MatrixBatchVectorMultiplyAccumulate(
-    const int8_t* __restrict__ matrix, const int m_rows, const int m_cols,
-    const int8_t* __restrict__ vectors, const float* scaling_factors,
-    int n_batch, float* __restrict__ result, const float* per_channel_scale,
-    const int32_t* input_offset, int32_t* scratch, int32_t* row_sums,
-    bool* compute_row_sums, CpuBackendContext* context) {
-  NEON_OR_PORTABLE(MatrixBatchVectorMultiplyAccumulate, matrix, m_rows, m_cols,
-                   vectors, scaling_factors, n_batch, result, per_channel_scale,
-                   input_offset, scratch, row_sums, compute_row_sums, context);
-}
-
-void SparseMatrixBatchVectorMultiplyAccumulate1x4(
-    const float* __restrict__ matrix, const int32_t* __restrict__ segments,
-    const int32_t* __restrict__ indices, int m_rows, int m_cols,
-    const float* __restrict__ vector, int n_batch, float* __restrict__ result) {
-  NEON_OR_PORTABLE(SparseMatrixBatchVectorMultiplyAccumulate1x4, matrix,
-                   segments, indices, m_rows, m_cols, vector, n_batch, result);
-}
-
-void SparseMatrixBatchVectorMultiplyAccumulate(
-    const float* __restrict__ matrix, const uint8_t* __restrict__ ledger,
-    int m_rows, int m_cols, const float* __restrict__ vector, int n_batch,
-    float* __restrict__ result) {
-  NEON_OR_PORTABLE(SparseMatrixBatchVectorMultiplyAccumulate, matrix, ledger,
-                   m_rows, m_cols, vector, n_batch, result);
-}
-
-void SparseMatrixBatchVectorMultiplyAccumulate(
-    const int8_t* __restrict__ matrix, const uint8_t* ledger, const int m_rows,
-    const int m_cols, const int8_t* __restrict__ vectors,
-    const float* scaling_factors, int n_batch, float* __restrict__ result) {
-  NEON_OR_PORTABLE(SparseMatrixBatchVectorMultiplyAccumulate, matrix, ledger,
-                   m_rows, m_cols, vectors, scaling_factors, n_batch, result);
-}
-
-void MatrixBatchVectorMultiplyAccumulate(
-    const int8_t* input, const int32_t* bias,
-    const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift,
-    int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp,
-    int32_t* scratch, int16_t* output, CpuBackendContext* context) {
-  NEON_OR_PORTABLE(MatrixBatchVectorMultiplyAccumulate, input, bias,
-                   input_to_gate_weights, multiplier, shift, n_batch, n_input,
-                   n_output, output_zp, scratch, output, context);
-}
-
-void MatrixBatchVectorMultiplyAccumulate(
-    const int8_t* input, const int32_t* bias,
-    const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift,
-    int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp,
-    int32_t* scratch, int8_t* output, CpuBackendContext* context) {
-  NEON_OR_PORTABLE(MatrixBatchVectorMultiplyAccumulate, input, bias,
-                   input_to_gate_weights, multiplier, shift, n_batch, n_input,
-                   n_output, output_zp, scratch, output, context);
-}
-
-void MatrixBatchVectorMultiply(const int8_t* input, int32_t input_zeropoint,
-                               const int8_t* input_to_gate_weights,
-                               int32_t input_to_gate_effective_scale_a,
-                               int32_t input_to_gate_effective_scale_b,
-                               int32_t n_batch, int32_t n_input, int32_t n_cell,
-                               int8_t* gate_output, int8_t gate_output_zp) {
-  PortableMatrixBatchVectorMultiply(
-      input, input_zeropoint, input_to_gate_weights,
-      input_to_gate_effective_scale_a, input_to_gate_effective_scale_b, n_batch,
-      n_input, n_cell, gate_output, gate_output_zp);
-}
-
-void MatrixBatchVectorMultiply(const int16_t* hidden,
-                               const int8_t* hidden_to_output_weights,
-                               int32_t proj_effective_scale_a,
-                               int32_t proj_effective_scale_b,
-                               const int32_t* gate_bias, int32_t n_batch,
-                               int32_t n_hidden, int32_t n_output,
-                               int32_t output_zp, int8_t* proj_output) {
-  PortableMatrixBatchVectorMultiply(hidden, hidden_to_output_weights,
-                                    proj_effective_scale_a,
-                                    proj_effective_scale_b, gate_bias, n_batch,
-                                    n_hidden, n_output, output_zp, proj_output);
-}
-
-void MatrixScalarMultiplyAccumulate(const int8_t* matrix, int32_t scalar,
-                                    int32_t n_row, int32_t n_col,
-                                    int32_t* output) {
-  NEON_OR_PORTABLE(MatrixScalarMultiplyAccumulate, matrix, scalar, n_row, n_col,
-                   output);
-}
-
-void ApplyLayerNorm(const int16_t* input, const int16_t* layer_norm_weights,
-                    const int32_t* bias, int32_t layer_norm_scale_a,
-                    int32_t layer_norm_scale_b, int32_t variance_limit,
-                    int n_batch, int n_input, int16_t* output) {
-  NEON_OR_PORTABLE(ApplyLayerNorm, input, layer_norm_weights, bias,
-                   layer_norm_scale_a, layer_norm_scale_b, variance_limit,
-                   n_batch, n_input, output);
-}
-
-void ApplyLayerNormFloat(const int16_t* input,
-                         const int16_t* layer_norm_weights,
-                         int32_t layer_norm_scale_a, int32_t layer_norm_scale_b,
-                         const int32_t* bias, int n_batch, int n_input,
-                         int16_t* output) {
-  PortableApplyLayerNormFloat(input, layer_norm_weights, layer_norm_scale_a,
-                              layer_norm_scale_b, bias, n_batch, n_input,
-                              output);
-}
-
-void ApplySigmoid(const int16_t* input, int32_t n_batch, int32_t n_input,
-                  int16_t* output) {
-  NEON_OR_PORTABLE(ApplySigmoid, input, n_batch, n_input, output);
-}
-
-void ApplySigmoidFloat(const int16_t* input, int32_t n_batch, int32_t n_input,
-                       int16_t* output) {
-  PortableApplySigmoidFloat(input, n_batch, n_input, output);
-}
-
-void ApplyTanh(int32_t integer_bits, const int16_t* input, int32_t n_batch,
-               int32_t n_input, int16_t* output) {
-  NEON_OR_PORTABLE(ApplyTanh, integer_bits, input, n_batch, n_input, output);
-}
-
-void ApplyTanhFloat(const int16_t* input, int32_t n_batch, int32_t n_input,
-                    int32_t integer_bits, int16_t* output) {
-  PortableApplyTanhFloat(input, n_batch, n_input, integer_bits, output);
-}
-
-void CwiseMul(const int16_t* input_1, const int16_t* input_2, int n_batch,
-              int n_input, int shift, int16_t* output) {
-  NEON_OR_PORTABLE(CwiseMul, input_1, input_2, n_batch, n_input, shift, output);
-}
-
-void CwiseMul(const int16_t* input_1, const int16_t* input_2,
-              int32_t multiplier, int shift, int n_batch, int n_input,
-              int32_t output_zp, int8_t* output) {
-  NEON_OR_PORTABLE(CwiseMul, input_1, input_2, multiplier, shift, n_batch,
-                   n_input, output_zp, output);
-}
-
-void CwiseAdd(const int16_t* input_1, const int16_t* input_2, int n_batch,
-              int n_input, int16_t* output) {
-  NEON_OR_PORTABLE(CwiseAdd, input_1, input_2, n_batch, n_input, output);
-}
-
-void CwiseClipping(float* vector, const int v_size,
-                   const float clipping_value) {
-  NEON_OR_PORTABLE(CwiseClipping, vector, v_size, clipping_value);
-}
-void CwiseClipping(int16_t* vector, const int v_size,
-                   const int16_t clipping_value) {
-  NEON_OR_PORTABLE(CwiseClipping, vector, v_size, clipping_value);
-}
-void CwiseClipping(int8_t* vector, const int v_size,
-                   const int8_t clipping_value) {
-  NEON_OR_PORTABLE(CwiseClipping, vector, v_size, clipping_value);
-}
-
-void BatchVectorBatchVectorDotProduct(const int16_t* vector1,
-                                      const int16_t* vector2, int v_size,
-                                      int n_batch, int32_t* result) {
-  PortableBatchVectorBatchVectorDotProduct(vector1, vector2, v_size, n_batch,
-                                           result);
-}
-
-void VectorBatchVectorCwiseProductAccumulate(const int16_t* vector, int v_size,
-                                             const int16_t* batch_vector,
-                                             int n_batch, int32_t multiplier,
-                                             int shift, int16_t* result) {
-  PortableVectorBatchVectorCwiseProductAccumulate(
-      vector, v_size, batch_vector, n_batch, multiplier, shift, result);
-}
-
-float VectorVectorDotProduct(const float* vector1, const float* vector2,
-                             int v_size) {
-  return NEON_OR_PORTABLE(VectorVectorDotProduct, vector1, vector2, v_size);
-}
-
-void VectorBatchVectorAdd(const float* vector, int v_size, int n_batch,
-                          float* batch_vector) {
-  PortableVectorBatchVectorAdd(vector, v_size, n_batch, batch_vector);
-}
-
-void Sub1Vector(const float* vector, int v_size, float* result) {
-  NEON_OR_PORTABLE(Sub1Vector, vector, v_size, result);
-}
-
-void Sub1Vector(const int16_t* vector, int v_size, int16_t* result) {
-  NEON_OR_PORTABLE(Sub1Vector, vector, v_size, result);
-}
-
-// Check if all entries of a vector are zero for float.
-bool IsZeroVector(const float* vector, int v_size) {
-  return NEON_OR_PORTABLE(IsZeroVector, vector, v_size);
-}
-
-// Check if all entries of a vector are zero for int8.
-bool IsZeroVector(const int8_t* vector, int v_size) {
-  return NEON_OR_PORTABLE(IsZeroVector, vector, v_size);
-}
-
-void VectorScalarMultiply(const int8_t* vector, int v_size, float scale,
-                          float* result) {
-  NEON_OR_PORTABLE(VectorScalarMultiply, vector, v_size, scale, result);
-}
-
-void SymmetricQuantizeFloats(const float* values, const int size,
-                             int8_t* quantized_values, float* min_value,
-                             float* max_value, float* scaling_factor) {
-  NEON_OR_PORTABLE(SymmetricQuantizeFloats, values, size, quantized_values,
-                   min_value, max_value, scaling_factor);
-}
-
-void SymmetricQuantizeFloats(const float* values, const int size,
-                             int8_t* quantized_values, float min_value,
-                             float max_value, float* scaling_factor) {
-  NEON_OR_PORTABLE(SymmetricQuantizeFloats, values, size, quantized_values,
-                   min_value, max_value, scaling_factor);
-}
-
-void AsymmetricQuantizeFloats(const float* values, const int size,
-                              int8_t* quantized_values, float* scaling_factor,
-                              int32_t* offset) {
-  NEON_OR_PORTABLE(AsymmetricQuantizeFloats, values, size, quantized_values,
-                   scaling_factor, offset);
-}
-
-void ReductionSumVector(const float* input_vector, float* output_vector,
-                        int output_size, int reduction_size) {
-  NEON_OR_PORTABLE(ReductionSumVector, input_vector, output_vector, output_size,
-                   reduction_size);
-}
-
-void ReductionSumVector(const int32_t* input_vector, int32_t* output_vector,
-                        int output_size, int reduction_size) {
-  PortableReductionSumVector(input_vector, output_vector, output_size,
-                             reduction_size);
-}
-
-void ReductionSumVector(const int8_t* input_vector, int32_t* output_vector,
-                        int output_size, int reduction_size) {
-  NEON_OR_PORTABLE(ReductionSumVector, input_vector, output_vector, output_size,
-                   reduction_size);
-}
-
-void MeanStddevNormalization(const float* input_vector, float* output_vector,
-                             int v_size, int n_batch) {
-  PortableMeanStddevNormalization(input_vector, output_vector, v_size, n_batch);
-}
-
-void TwoGateSaturatingAdd(const int8_t* input, int8_t input_zp,
-                          const int8_t* recurrent, int8_t recurrent_zp,
-                          int32_t input_effective_scale_a,
-                          int32_t input_effective_scale_b,
-                          int32_t recurrent_effective_scale_a,
-                          int32_t recurrent_effective_scale_b, int32_t n_batch,
-                          int32_t n_cell, int16_t* output) {
-  PortableTwoGateSaturatingAdd(
-      input, input_zp, recurrent, recurrent_zp, input_effective_scale_a,
-      input_effective_scale_b, recurrent_effective_scale_a,
-      recurrent_effective_scale_b, n_batch, n_cell, output);
-}
-
-}  // namespace tensor_utils
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_TENSOR_UTILS_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/neon_tensor_utils_impl.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/neon_tensor_utils_impl.h
deleted file mode 100644
index 44bc83a..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/neon_tensor_utils_impl.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* Copyright 2017 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_KERNELS_INTERNAL_OPTIMIZED_NEON_TENSOR_UTILS_IMPL_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_TENSOR_UTILS_IMPL_H_
-
-// TODO(ghodrat): Remove this header file and the dependency to internal data
-// structure.
-#include "tensorflow/lite/c/builtin_op_data.h"
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-
-#if defined(_MSC_VER)
-#define __restrict__ __restrict
-#endif
-
-namespace tflite {
-namespace tensor_utils {
-
-#ifdef USE_NEON
-
-// Multiply a matrix by a batch vector, and store results in a batch-size
-// vector.
-void NeonMatrixBatchVectorMultiplyAccumulate(const float* matrix, int m_rows,
-                                             int m_cols, const float* vector,
-                                             int n_batch, float* result);
-
-// Matrix multiplication for quantized values using symmetric quantization.
-void NeonMatrixBatchVectorMultiplyAccumulate(const int8_t* __restrict__ matrix,
-                                             const int m_rows, const int m_cols,
-                                             const int8_t* __restrict__ vectors,
-                                             const float* scaling_factors,
-                                             int n_batch,
-                                             float* __restrict__ result);
-
-// Same as above but with a scratch buffer and CpuBackendContext for the
-// int8 x int8 -> int32 accumulation computation
-void NeonMatrixBatchVectorMultiplyAccumulate(const int8_t* __restrict__ matrix,
-                                             const int m_rows, const int m_cols,
-                                             const int8_t* __restrict__ vectors,
-                                             const float* scaling_factors,
-                                             int n_batch, int32_t* scratch,
-                                             float* __restrict__ result,
-                                             CpuBackendContext* context);
-
-// Matrix multiplication for quantized values using asymmetric quantization.
-void NeonMatrixBatchVectorMultiplyAccumulate(
-    const int8_t* __restrict__ matrix, const int m_rows, const int m_cols,
-    const int8_t* __restrict__ vectors, const float* scaling_factors,
-    int n_batch, float* __restrict__ result, const float* per_channel_scale,
-    const int32_t* input_offset, int32_t* scratch, int32_t* row_sums,
-    bool* compute_row_sums, CpuBackendContext* context);
-
-void NeonApplyLayerNorm(const int16_t* input, const int16_t* layer_norm_weights,
-                        const int32_t* bias, int32_t layer_norm_scale_a,
-                        int32_t layer_norm_scale_b, int32_t variance_limit,
-                        int n_batch, int n_input, int16_t* output);
-
-void NeonApplySigmoid(const int16_t* input, int32_t n_batch, int32_t n_input,
-                      int16_t* output);
-
-void NeonApplyTanh(int32_t integer_bits, const int16_t* input, int32_t n_batch,
-                   int32_t n_input, int16_t* output);
-
-void NeonCwiseMul(const int16_t* input_1, const int16_t* input_2, int n_batch,
-                  int n_input, int shift, int16_t* output);
-
-void NeonCwiseMul(const int16_t* input_1, const int16_t* input_2,
-                  int32_t multiplier, int shift, int n_batch, int n_input,
-                  int32_t output_zp, int8_t* output);
-
-void NeonCwiseAdd(const int16_t* input_1, const int16_t* input_2, int n_batch,
-                  int n_input, int16_t* output);
-
-void NeonCwiseClipping(float* vector, const int v_size,
-                       const float clipping_value);
-void NeonCwiseClipping(int16_t* vector, const int v_size,
-                       const int16_t clipping_value);
-void NeonCwiseClipping(int8_t* vector, const int v_size,
-                       const int8_t clipping_value);
-
-void NeonMatrixBatchVectorMultiplyAccumulate(
-    const int8_t* input, const int32_t* bias,
-    const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift,
-    int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp,
-    int32_t* scratch, int8_t* output, CpuBackendContext* context);
-
-void NeonMatrixBatchVectorMultiplyAccumulate(
-    const int8_t* input, const int32_t* bias,
-    const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift,
-    int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp,
-    int32_t* scratch, int16_t* output, CpuBackendContext* context);
-
-void NeonMatrixScalarMultiplyAccumulate(const int8_t* matrix, int32_t scalar,
-                                        int32_t n_row, int32_t n_col,
-                                        int32_t* output);
-
-void NeonSparseMatrixBatchVectorMultiplyAccumulate1x4(
-    const float* __restrict__ matrix, const int32_t* __restrict__ segments,
-    const int32_t* __restrict__ indices, int m_rows, int m_cols,
-    const float* __restrict__ vector, int n_batch, float* __restrict__ result);
-
-// Multiply a matrix by a batch vector, and store results in a batch-size
-// vector. Sparse version.
-void NeonSparseMatrixBatchVectorMultiplyAccumulate(
-    const float* __restrict__ matrix, const uint8_t* __restrict__ ledger,
-    int m_rows, int m_cols, const float* __restrict__ vector, int n_batch,
-    float* __restrict__ result);
-
-// Matrix multiplication for quantized values using symmetric quantization.
-// Sparse version.
-void NeonSparseMatrixBatchVectorMultiplyAccumulate(
-    const int8_t* __restrict__ matrix, const uint8_t* ledger, const int m_rows,
-    const int m_cols, const int8_t* __restrict__ vectors,
-    const float* scaling_factors, int n_batch, float* __restrict__ result);
-
-// Dot product of two vectors.
-float NeonVectorVectorDotProduct(const float* vector1, const float* vector2,
-                                 int v_size);
-
-// Compute "1.0f - elements of vector" (used in CIFG).
-void NeonSub1Vector(const float* vector, int v_size, float* result);
-
-void NeonSub1Vector(const int16_t* vector, int v_size, int16_t* result);
-
-// Multiply all elements of vector with a scalar.
-void NeonVectorScalarMultiply(const int8_t* vector, int v_size, float scale,
-                              float* result);
-
-// Check if all entries of a vector are zero.
-bool NeonIsZeroVector(const float* vector, int v_size);
-
-// Check if all entries of a vector are zero.
-bool NeonIsZeroVector(const int8_t* vector, int v_size);
-
-// Symmetric quantizer.
-void NeonSymmetricQuantizeFloats(const float* values, const int size,
-                                 int8_t* quantized_values, float* min,
-                                 float* max, float* scaling_factor);
-
-// Symmetric quantizer.
-void NeonSymmetricQuantizeFloats(const float* values, const int size,
-                                 int8_t* quantized_values, float min, float max,
-                                 float* scaling_factor);
-
-// Asymmetric quantizer.
-void NeonAsymmetricQuantizeFloats(const float* values, const int size,
-                                  int8_t* quantized_values,
-                                  float* scaling_factor, int32_t* offset);
-
-// Reduce-sum on a float input vector:
-// input_vector: float pointer to input vector.
-// output_vector: float pointer to vector.
-// output_size: output vector size.
-// reduction_size: number of consecutive elements from input vector which are
-// added to get one element of output.
-void NeonReductionSumVector(const float* input_vector, float* output_vector,
-                            int output_size, int reduction_size);
-
-void NeonReductionSumVector(const int8_t* input_vector, int32_t* output_vector,
-                            int output_size, int reduction_size);
-
-#endif  // USE_NEON
-
-}  // namespace tensor_utils
-}  // namespace tflite
-
-#endif  // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_NEON_TENSOR_UTILS_IMPL_H_
diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/optimized_ops.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/optimized_ops.h
deleted file mode 100644
index 32812ed..0000000
--- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/optimized_ops.h
+++ /dev/null
@@ -1,8320 +0,0 @@
-/* Copyright 2018 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_KERNELS_INTERNAL_OPTIMIZED_OPTIMIZED_OPS_H_
-#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_OPTIMIZED_OPS_H_
-
-#include 
-#include 
-#include 
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "tensorflow/lite/kernels/internal/common.h"
-#include "tensorflow/lite/kernels/internal/compatibility.h"
-#include "tensorflow/lite/kernels/internal/reference/add.h"
-#include "tensorflow/lite/kernels/internal/reference/resize_nearest_neighbor.h"
-
-#if defined(TF_LITE_USE_CBLAS) && defined(__APPLE__)
-#include 
-#endif
-
-#include "third_party/eigen3/Eigen/Core"
-#include "third_party/eigen3/unsupported/Eigen/CXX11/Tensor"
-#include "fixedpoint/fixedpoint.h"
-#include "ruy/profiler/instrumentation.h"  // from @ruy
-#include "tensorflow/lite/c/common.h"
-#include "tensorflow/lite/kernels/cpu_backend_context.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm.h"
-#include "tensorflow/lite/kernels/cpu_backend_gemm_params.h"
-#include "tensorflow/lite/kernels/cpu_backend_threadpool.h"
-#include "tensorflow/lite/kernels/internal/cppmath.h"
-#include "tensorflow/lite/kernels/internal/optimized/cpu_check.h"
-#include "tensorflow/lite/kernels/internal/optimized/im2col_utils.h"
-#include "tensorflow/lite/kernels/internal/quantization_util.h"
-#include "tensorflow/lite/kernels/internal/reference/reference_ops.h"
-#include "tensorflow/lite/kernels/internal/strided_slice_logic.h"
-#include "tensorflow/lite/kernels/internal/tensor.h"
-#include "tensorflow/lite/kernels/internal/tensor_utils.h"
-#include "tensorflow/lite/kernels/internal/transpose_utils.h"
-#include "tensorflow/lite/kernels/internal/types.h"
-
-#if __aarch64__ && __clang__
-#define TFLITE_SOFTMAX_USE_UINT16_LUT
-#endif
-
-namespace tflite {
-namespace optimized_ops {
-
-// Unoptimized reference ops:
-using reference_ops::ArgMax;
-using reference_ops::ArgMinMax;
-using reference_ops::Broadcast4DSlowGreater;
-using reference_ops::Broadcast4DSlowGreaterEqual;
-using reference_ops::Broadcast4DSlowGreaterEqualWithScaling;
-using reference_ops::Broadcast4DSlowGreaterWithScaling;
-using reference_ops::Broadcast4DSlowLess;
-using reference_ops::Broadcast4DSlowLessEqual;
-using reference_ops::Broadcast4DSlowLessEqualWithScaling;
-using reference_ops::Broadcast4DSlowLessWithScaling;
-using reference_ops::BroadcastAdd4DSlow;
-using reference_ops::BroadcastMul4DSlow;
-using reference_ops::BroadcastSubSlow;
-using reference_ops::Concatenation;
-using reference_ops::ConcatenationWithScaling;
-using reference_ops::DepthConcatenation;
-using reference_ops::Div;
-using reference_ops::Elu;
-using reference_ops::FakeQuant;
-using reference_ops::Fill;
-using reference_ops::Gather;
-using reference_ops::Greater;
-using reference_ops::GreaterEqual;
-using reference_ops::GreaterEqualWithScaling;
-using reference_ops::GreaterWithScaling;
-using reference_ops::LeakyRelu;
-using reference_ops::Less;
-using reference_ops::LessEqual;
-using reference_ops::LessEqualWithScaling;
-using reference_ops::LessWithScaling;
-using reference_ops::Mean;
-using reference_ops::ProcessBroadcastShapes;
-using reference_ops::RankOneSelect;
-using reference_ops::Relu1;
-using reference_ops::Relu6;
-using reference_ops::ReluX;
-using reference_ops::Round;
-using reference_ops::Select;
-using reference_ops::SpaceToBatchND;
-using reference_ops::Split;
-using reference_ops::StridedSlice;
-using reference_ops::Sub16;
-
-// TODO(b/80247582) Remove this constant.
-// This will be phased out as the shifts are revised with more thought. Use of a
-// constant enables us to track progress on this work.
-//
-// Used to convert from old-style shifts (right) to new-style (left).
-static constexpr int kReverseShift = -1;
-
-// Make a local VectorMap typedef allowing to map a float array
-// as a Eigen vector expression. The std::conditional here is to
-// construct the suitable Eigen type for the constness of the
-// data. Indeed, for const data, we need to produce
-//    Eigen::Map>
-// and not the more straightforward
-//    Eigen::Map>
-template 
-using VectorMap = typename std::conditional<
-    std::is_const::value,
-    Eigen::Map::type,
-                                   Eigen::Dynamic, 1>>,
-    Eigen::Map>>::type;
-
-template 
-VectorMap MapAsVector(Scalar* data, const RuntimeShape& shape) {
-  const int size = shape.FlatSize();
-  return VectorMap(data, size, 1);
-}
-
-// Make a local VectorMap typedef allowing to map a float array
-// as a Eigen matrix expression. The same explanation as for VectorMap
-// above also applies here.
-template 
-using MatrixMap = typename std::conditional<
-    std::is_const::value,
-    Eigen::Map::type,
-                                   Eigen::Dynamic, Eigen::Dynamic>>,
-    Eigen::Map>>::type;
-
-template 
-MatrixMap MapAsMatrixWithLastDimAsRows(Scalar* data,
-                                               const RuntimeShape& shape) {
-  const int dims_count = shape.DimensionsCount();
-  const int rows = shape.Dims(dims_count - 1);
-  const int cols = FlatSizeSkipDim(shape, dims_count - 1);
-  return MatrixMap(data, rows, cols);
-}
-
-template 
-MatrixMap MapAsMatrixWithFirstDimAsCols(Scalar* data,
-                                                const RuntimeShape& shape) {
-  const int cols = shape.Dims(0);
-  const int rows = FlatSizeSkipDim(shape, 0);
-  return MatrixMap(data, rows, cols);
-}
-
-template 
-using ArrayMap = typename std::conditional<
-    std::is_const::value,
-    Eigen::Map::type,
-                                  Eigen::Dynamic, Eigen::Dynamic>>,
-    Eigen::Map>>::type;
-
-template 
-ArrayMap MapAsArrayWithLastDimAsRows(Scalar* data,
-                                             const RuntimeShape& shape) {
-  const int dims_count = shape.DimensionsCount();
-  const int rows = shape.Dims(dims_count - 1);
-  const int cols = FlatSizeSkipDim(shape, dims_count - 1);
-  return ArrayMap(data, rows, cols);
-}
-
-// Copied from tensorflow/core/framework/tensor_types.h
-template 
-struct TTypes {
-  // Rank-1 tensor (vector) of scalar type T.
-  typedef Eigen::TensorMap,
-                           Eigen::Aligned>
-      Flat;
-  typedef Eigen::TensorMap<
-      Eigen::Tensor>
-      UnalignedConstMatrix;
-};
-
-// TODO(b/62193649): this function is only needed as long
-// as we have the --variable_batch hack.
-template 
-MatrixMap MapAsMatrixWithGivenNumberOfRows(Scalar* data,
-                                                   const RuntimeShape& shape,
-                                                   int rows) {
-  const int flatsize = shape.FlatSize();
-  TFLITE_DCHECK_EQ(flatsize % rows, 0);
-  const int cols = flatsize / rows;
-  return MatrixMap(data, rows, cols);
-}
-
-// TODO(renjieliu): Refactor this to merge with other
-// MultiplyByQuantizedMultipler.
-#ifdef USE_NEON
-inline int32x4x4_t MultiplyByQuantizedMultiplier4Rows(
-    int32x4x4_t input_val, int32 quantized_multiplier, int32 shift) {
-  const int left_shift = std::max(shift, 0);
-  const int right_shift = std::min(shift, 0);
-  int32x4x4_t result;
-
-  int32x4_t multiplier_dup = vdupq_n_s32(quantized_multiplier);
-  int32x4_t left_shift_dup = vdupq_n_s32(left_shift);
-  int32x4_t right_shift_dup = vdupq_n_s32(right_shift);
-
-  result.val[0] =
-      vrshlq_s32(vqrdmulhq_s32(vshlq_s32(input_val.val[0], left_shift_dup),
-                               multiplier_dup),
-                 right_shift_dup);
-
-  result.val[1] =
-      vrshlq_s32(vqrdmulhq_s32(vshlq_s32(input_val.val[1], left_shift_dup),
-                               multiplier_dup),
-                 right_shift_dup);
-
-  result.val[2] =
-      vrshlq_s32(vqrdmulhq_s32(vshlq_s32(input_val.val[2], left_shift_dup),
-                               multiplier_dup),
-                 right_shift_dup);
-
-  result.val[3] =
-      vrshlq_s32(vqrdmulhq_s32(vshlq_s32(input_val.val[3], left_shift_dup),
-                               multiplier_dup),
-                 right_shift_dup);
-
-  return result;
-}
-#endif
-
-template 
-inline void BinaryBroadcastFiveFold(const ArithmeticParams& unswitched_params,
-                                    const RuntimeShape& unswitched_input1_shape,
-                                    const T* unswitched_input1_data,
-                                    const RuntimeShape& unswitched_input2_shape,
-                                    const T* unswitched_input2_data,
-                                    const RuntimeShape& output_shape,
-                                    T* output_data, ElementwiseF elementwise_f,
-                                    ScalarBroadcastF scalar_broadcast_f) {
-  ArithmeticParams switched_params = unswitched_params;
-  switched_params.input1_offset = unswitched_params.input2_offset;
-  switched_params.input1_multiplier = unswitched_params.input2_multiplier;
-  switched_params.input1_shift = unswitched_params.input2_shift;
-  switched_params.input2_offset = unswitched_params.input1_offset;
-  switched_params.input2_multiplier = unswitched_params.input1_multiplier;
-  switched_params.input2_shift = unswitched_params.input1_shift;
-
-  const bool use_unswitched =
-      unswitched_params.broadcast_category ==
-      tflite::BroadcastableOpCategory::kFirstInputBroadcastsFast;
-
-  const ArithmeticParams& params =
-      use_unswitched ? unswitched_params : switched_params;
-  const T* input1_data =
-      use_unswitched ? unswitched_input1_data : unswitched_input2_data;
-  const T* input2_data =
-      use_unswitched ? unswitched_input2_data : unswitched_input1_data;
-
-  // Fivefold nested loops. The second input resets its position for each
-  // iteration of the second loop. The first input resets its position at the
-  // beginning of the fourth loop. The innermost loop is an elementwise add of
-  // sections of the arrays.
-  T* output_data_ptr = output_data;
-  const T* input1_data_ptr = input1_data;
-  const T* input2_data_reset = input2_data;
-  // In the fivefold pattern, y0, y2 and y4 are not broadcast, and so shared
-  // between input shapes. y3 for input 1 is always broadcast, and so the
-  // dimension there is 1, whereas optionally y1 might be broadcast for
-  // input 2. Put another way, input1.shape.FlatSize = y0 * y1 * y2 * y4,
-  // input2.shape.FlatSize = y0 * y2 * y3 * y4.
-  int y0 = params.broadcast_shape[0];
-  int y1 = params.broadcast_shape[1];
-  int y2 = params.broadcast_shape[2];
-  int y3 = params.broadcast_shape[3];
-  int y4 = params.broadcast_shape[4];
-  if (y4 > 1) {
-    // General fivefold pattern, with y4 > 1 so there is a non-broadcast inner
-    // dimension.
-    for (int i0 = 0; i0 < y0; ++i0) {
-      const T* input2_data_ptr = nullptr;
-      for (int i1 = 0; i1 < y1; ++i1) {
-        input2_data_ptr = input2_data_reset;
-        for (int i2 = 0; i2 < y2; ++i2) {
-          for (int i3 = 0; i3 < y3; ++i3) {
-            elementwise_f(y4, params, input1_data_ptr, input2_data_ptr,
-                          output_data_ptr);
-            input2_data_ptr += y4;
-            output_data_ptr += y4;
-          }
-          // We have broadcast y4 of input1 data y3 times, and now move on.
-          input1_data_ptr += y4;
-        }
-      }
-      // We have broadcast y2*y3*y4 of input2 data y1 times, and now move on.
-      input2_data_reset = input2_data_ptr;
-    }
-  } else if (input1_data_ptr != nullptr) {
-    // Special case of y4 == 1, in which the innermost loop is a single
-    // element and can be combined with the next (y3) as an inner broadcast.
-    //
-    // Note that this handles the case of pure scalar broadcast when
-    // y0 == y1 == y2 == 1. With low overhead it handles cases such as scalar
-    // broadcast with batch (as y2 > 1).
-    //
-    // NOTE The process is the same as the above general case except
-    // simplified for y4 == 1 and the loop over y3 is contained within the
-    // AddScalarBroadcast function.
-    for (int i0 = 0; i0 < y0; ++i0) {
-      const T* input2_data_ptr = nullptr;
-      for (int i1 = 0; i1 < y1; ++i1) {
-        input2_data_ptr = input2_data_reset;
-        for (int i2 = 0; i2 < y2; ++i2) {
-          scalar_broadcast_f(y3, params, *input1_data_ptr, input2_data_ptr,
-                             output_data_ptr);
-          input2_data_ptr += y3;
-          output_data_ptr += y3;
-          input1_data_ptr += 1;
-        }
-      }
-      input2_data_reset = input2_data_ptr;
-    }
-  }
-}
-
-#ifdef TFLITE_SOFTMAX_USE_UINT16_LUT
-
-// Looks up each element of  in 
, returns them in a vector. -inline uint8x16_t aarch64_lookup_vector(const uint8x16x4_t table[4], - uint8x16_t indices) { - // Look up in 1st quarter of the table: top 2 bits of indices == 00 - uint8x16_t output1 = vqtbl4q_u8(table[0], indices); - // Look up in 2nd quarter of the table: top 2 bits of indices == 01 - uint8x16_t output2 = - vqtbl4q_u8(table[1], veorq_u8(indices, vdupq_n_u8(0x40))); - // Look up in 3rd quarter of the table: top 2 bits of indices == 10 - uint8x16_t output3 = - vqtbl4q_u8(table[2], veorq_u8(indices, vdupq_n_u8(0x80))); - // Look up in 4th quarter of the table: top 2 bits of indices == 11 - uint8x16_t output4 = - vqtbl4q_u8(table[3], veorq_u8(indices, vdupq_n_u8(0xc0))); - - // Combine result of the 4 lookups. - return vorrq_u8(vorrq_u8(output1, output2), vorrq_u8(output3, output4)); -} - -#endif - -inline void AddBiasAndEvalActivationFunction(float output_activation_min, - float output_activation_max, - const RuntimeShape& bias_shape, - const float* bias_data, - const RuntimeShape& array_shape, - float* array_data) { - BiasAndClamp(output_activation_min, output_activation_max, - bias_shape.FlatSize(), bias_data, array_shape.FlatSize(), - array_data); -} - -inline void FullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& weights_shape, - const float* weights_data, const RuntimeShape& bias_shape, - const float* optional_bias_data, const RuntimeShape& output_shape, - float* output_data, CpuBackendContext* cpu_backend_context) { - ruy::profiler::ScopeLabel label("FullyConnected"); - const int dims_count = weights_shape.DimensionsCount(); - const int input_rows = weights_shape.Dims(dims_count - 1); - cpu_backend_gemm::MatrixParams rhs_params; - rhs_params.order = cpu_backend_gemm::Order::kColMajor; - rhs_params.rows = input_rows; - rhs_params.cols = input_shape.FlatSize() / input_rows; - rhs_params.cache_policy = - cpu_backend_gemm::DefaultCachePolicy(params.rhs_cacheable); - TFLITE_DCHECK_EQ(input_shape.FlatSize(), rhs_params.rows * rhs_params.cols); - cpu_backend_gemm::MatrixParams lhs_params; - lhs_params.order = cpu_backend_gemm::Order::kRowMajor; - lhs_params.cols = weights_shape.Dims(dims_count - 1); - lhs_params.rows = FlatSizeSkipDim(weights_shape, dims_count - 1); - lhs_params.cache_policy = - cpu_backend_gemm::DefaultCachePolicy(params.lhs_cacheable); - cpu_backend_gemm::MatrixParams dst_params; - dst_params.order = cpu_backend_gemm::Order::kColMajor; - dst_params.rows = output_shape.Dims(output_shape.DimensionsCount() - 1); - dst_params.cols = - FlatSizeSkipDim(output_shape, output_shape.DimensionsCount() - 1); - cpu_backend_gemm::GemmParams gemm_params; - gemm_params.bias = optional_bias_data; - gemm_params.clamp_min = params.float_activation_min; - gemm_params.clamp_max = params.float_activation_max; - cpu_backend_gemm::Gemm(lhs_params, weights_data, rhs_params, input_data, - dst_params, output_data, gemm_params, - cpu_backend_context); -} - -inline void FullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const uint8* input_data, const RuntimeShape& filter_shape, - const uint8* filter_data, const RuntimeShape& bias_shape, - const int32* bias_data, const RuntimeShape& output_shape, - uint8* output_data, CpuBackendContext* cpu_backend_context) { - ruy::profiler::ScopeLabel label("FullyConnected/8bit"); - const int32 input_offset = params.input_offset; - const int32 filter_offset = params.weights_offset; - const int32 output_offset = params.output_offset; - const int32 output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32 output_activation_min = params.quantized_activation_min; - const int32 output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_GE(filter_shape.DimensionsCount(), 2); - TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1); - // TODO(benoitjacob): This really should be: - // const int batches = ArraySize(output_dims, 1); - // but the current --variable_batch hack consists in overwriting the 3rd - // dimension with the runtime batch size, as we don't keep track for each - // array of which dimension is the batch dimension in it. - const int output_dim_count = output_shape.DimensionsCount(); - const int filter_dim_count = filter_shape.DimensionsCount(); - const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1); - const int filter_rows = filter_shape.Dims(filter_dim_count - 2); - const int filter_cols = filter_shape.Dims(filter_dim_count - 1); - TFLITE_DCHECK_EQ(filter_shape.FlatSize(), filter_rows * filter_cols); - const int output_rows = output_shape.Dims(output_dim_count - 1); - TFLITE_DCHECK_EQ(output_rows, filter_rows); - if (bias_data) { - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_rows); - } - - cpu_backend_gemm::MatrixParams lhs_params; - lhs_params.rows = filter_rows; - lhs_params.cols = filter_cols; - lhs_params.order = cpu_backend_gemm::Order::kRowMajor; - lhs_params.zero_point = -filter_offset; - lhs_params.cache_policy = - cpu_backend_gemm::DefaultCachePolicy(params.lhs_cacheable); - cpu_backend_gemm::MatrixParams rhs_params; - rhs_params.rows = filter_cols; - rhs_params.cols = batches; - rhs_params.order = cpu_backend_gemm::Order::kColMajor; - rhs_params.zero_point = -input_offset; - rhs_params.cache_policy = - cpu_backend_gemm::DefaultCachePolicy(params.rhs_cacheable); - cpu_backend_gemm::MatrixParams dst_params; - dst_params.rows = filter_rows; - dst_params.cols = batches; - dst_params.order = cpu_backend_gemm::Order::kColMajor; - dst_params.zero_point = output_offset; - cpu_backend_gemm::GemmParams gemm_params; - gemm_params.bias = bias_data; - gemm_params.clamp_min = output_activation_min; - gemm_params.clamp_max = output_activation_max; - gemm_params.multiplier_fixedpoint = output_multiplier; - gemm_params.multiplier_exponent = output_shift; - cpu_backend_gemm::Gemm(lhs_params, filter_data, rhs_params, input_data, - dst_params, output_data, gemm_params, - cpu_backend_context); -} - -inline void FullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const uint8* input_data, const RuntimeShape& filter_shape, - const uint8* filter_data, const RuntimeShape& bias_shape, - const int32* bias_data_int32, const RuntimeShape& output_shape, - int16* output_data, CpuBackendContext* cpu_backend_context) { - ruy::profiler::ScopeLabel label("FullyConnected/Uint8Int16"); - const int32 input_offset = params.input_offset; - const int32 filter_offset = params.weights_offset; - const int32 output_offset = params.output_offset; - const int32 output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32 output_activation_min = params.quantized_activation_min; - const int32 output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - TFLITE_DCHECK_EQ(output_offset, 0); - TFLITE_DCHECK_GE(filter_shape.DimensionsCount(), 2); - TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1); - - // TODO(benoitjacob): This really should be: - // const int batches = ArraySize(output_dims, 1); - // but the current --variable_batch hack consists in overwriting the 3rd - // dimension with the runtime batch size, as we don't keep track for each - // array of which dimension is the batch dimension in it. - const int output_dim_count = output_shape.DimensionsCount(); - const int filter_dim_count = filter_shape.DimensionsCount(); - const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1); - const int output_depth = MatchingDim(filter_shape, filter_dim_count - 2, - output_shape, output_dim_count - 1); - const int accum_depth = filter_shape.Dims(filter_dim_count - 1); - - cpu_backend_gemm::MatrixParams lhs_params; - lhs_params.rows = output_depth; - lhs_params.cols = accum_depth; - lhs_params.order = cpu_backend_gemm::Order::kRowMajor; - lhs_params.zero_point = -filter_offset; - lhs_params.cache_policy = - cpu_backend_gemm::DefaultCachePolicy(params.lhs_cacheable); - cpu_backend_gemm::MatrixParams rhs_params; - rhs_params.rows = accum_depth; - rhs_params.cols = batches; - rhs_params.order = cpu_backend_gemm::Order::kColMajor; - rhs_params.zero_point = -input_offset; - rhs_params.cache_policy = - cpu_backend_gemm::DefaultCachePolicy(params.rhs_cacheable); - cpu_backend_gemm::MatrixParams dst_params; - dst_params.rows = output_depth; - dst_params.cols = batches; - dst_params.order = cpu_backend_gemm::Order::kColMajor; - dst_params.zero_point = 0; - cpu_backend_gemm::GemmParams gemm_params; - gemm_params.bias = bias_data_int32; - gemm_params.clamp_min = output_activation_min; - gemm_params.clamp_max = output_activation_max; - gemm_params.multiplier_fixedpoint = output_multiplier; - gemm_params.multiplier_exponent = output_shift; - cpu_backend_gemm::Gemm(lhs_params, filter_data, rhs_params, input_data, - dst_params, output_data, gemm_params, - cpu_backend_context); -} - -// Internal function doing the actual arithmetic work for -// ShuffledFullyConnected. -// May be called either directly by it (single-threaded case) or may be used -// as the 'task' for worker threads to run (multi-threaded case, see -// ShuffledFullyConnectedWorkerTask below). -inline void ShuffledFullyConnectedWorkerImpl( - const uint8* shuffled_input_workspace_data, - const int8* shuffled_weights_data, int batches, int output_depth, - int output_stride, int accum_depth, const int32* bias_data, - int32 output_multiplier, int output_shift, int16* output_data) { -#if defined USE_NEON - const int8* shuffled_weights_ptr = shuffled_weights_data; - if (batches == 1) { - const int right_shift = output_shift > 0 ? 0 : -output_shift; - const int left_shift = output_shift > 0 ? output_shift : 0; - for (int c = 0; c < output_depth; c += 4) { - // Accumulation loop. - int32x4_t row_accum0 = vdupq_n_s32(0); - int32x4_t row_accum1 = vdupq_n_s32(0); - int32x4_t row_accum2 = vdupq_n_s32(0); - int32x4_t row_accum3 = vdupq_n_s32(0); - for (int d = 0; d < accum_depth; d += 16) { - int8x16_t weights0 = vld1q_s8(shuffled_weights_ptr + 0); - int8x16_t weights1 = vld1q_s8(shuffled_weights_ptr + 16); - int8x16_t weights2 = vld1q_s8(shuffled_weights_ptr + 32); - int8x16_t weights3 = vld1q_s8(shuffled_weights_ptr + 48); - shuffled_weights_ptr += 64; - int8x16_t input = - vreinterpretq_s8_u8(vld1q_u8(shuffled_input_workspace_data + d)); - int16x8_t local_accum0 = - vmull_s8(vget_low_s8(weights0), vget_low_s8(input)); - int16x8_t local_accum1 = - vmull_s8(vget_low_s8(weights1), vget_low_s8(input)); - int16x8_t local_accum2 = - vmull_s8(vget_low_s8(weights2), vget_low_s8(input)); - int16x8_t local_accum3 = - vmull_s8(vget_low_s8(weights3), vget_low_s8(input)); - local_accum0 = - vmlal_s8(local_accum0, vget_high_s8(weights0), vget_high_s8(input)); - local_accum1 = - vmlal_s8(local_accum1, vget_high_s8(weights1), vget_high_s8(input)); - local_accum2 = - vmlal_s8(local_accum2, vget_high_s8(weights2), vget_high_s8(input)); - local_accum3 = - vmlal_s8(local_accum3, vget_high_s8(weights3), vget_high_s8(input)); - row_accum0 = vpadalq_s16(row_accum0, local_accum0); - row_accum1 = vpadalq_s16(row_accum1, local_accum1); - row_accum2 = vpadalq_s16(row_accum2, local_accum2); - row_accum3 = vpadalq_s16(row_accum3, local_accum3); - } - // Horizontally reduce accumulators - int32x2_t pairwise_reduced_acc_0, pairwise_reduced_acc_1, - pairwise_reduced_acc_2, pairwise_reduced_acc_3; - pairwise_reduced_acc_0 = - vpadd_s32(vget_low_s32(row_accum0), vget_high_s32(row_accum0)); - pairwise_reduced_acc_1 = - vpadd_s32(vget_low_s32(row_accum1), vget_high_s32(row_accum1)); - pairwise_reduced_acc_2 = - vpadd_s32(vget_low_s32(row_accum2), vget_high_s32(row_accum2)); - pairwise_reduced_acc_3 = - vpadd_s32(vget_low_s32(row_accum3), vget_high_s32(row_accum3)); - const int32x2_t reduced_lo = - vpadd_s32(pairwise_reduced_acc_0, pairwise_reduced_acc_1); - const int32x2_t reduced_hi = - vpadd_s32(pairwise_reduced_acc_2, pairwise_reduced_acc_3); - int32x4_t reduced = vcombine_s32(reduced_lo, reduced_hi); - // Add bias values. - int32x4_t bias_vec = vld1q_s32(bias_data + c); - reduced = vaddq_s32(reduced, bias_vec); - reduced = vshlq_s32(reduced, vdupq_n_s32(left_shift)); - // Multiply by the fixed-point multiplier. - reduced = vqrdmulhq_n_s32(reduced, output_multiplier); - // Rounding-shift-right. - using gemmlowp::RoundingDivideByPOT; - reduced = RoundingDivideByPOT(reduced, right_shift); - // Narrow values down to 16 bit signed. - const int16x4_t res16 = vqmovn_s32(reduced); - vst1_s16(output_data + c, res16); - } - } else if (batches == 4) { - const int right_shift = output_shift > 0 ? 0 : -output_shift; - const int left_shift = output_shift > 0 ? output_shift : 0; - for (int c = 0; c < output_depth; c += 4) { - const int8* shuffled_input_ptr = - reinterpret_cast(shuffled_input_workspace_data); - // Accumulation loop. - int32x4_t row_accum00 = vdupq_n_s32(0); - int32x4_t row_accum10 = vdupq_n_s32(0); - int32x4_t row_accum20 = vdupq_n_s32(0); - int32x4_t row_accum30 = vdupq_n_s32(0); - int32x4_t row_accum01 = vdupq_n_s32(0); - int32x4_t row_accum11 = vdupq_n_s32(0); - int32x4_t row_accum21 = vdupq_n_s32(0); - int32x4_t row_accum31 = vdupq_n_s32(0); - int32x4_t row_accum02 = vdupq_n_s32(0); - int32x4_t row_accum12 = vdupq_n_s32(0); - int32x4_t row_accum22 = vdupq_n_s32(0); - int32x4_t row_accum32 = vdupq_n_s32(0); - int32x4_t row_accum03 = vdupq_n_s32(0); - int32x4_t row_accum13 = vdupq_n_s32(0); - int32x4_t row_accum23 = vdupq_n_s32(0); - int32x4_t row_accum33 = vdupq_n_s32(0); - for (int d = 0; d < accum_depth; d += 16) { - int8x16_t weights0 = vld1q_s8(shuffled_weights_ptr + 0); - int8x16_t weights1 = vld1q_s8(shuffled_weights_ptr + 16); - int8x16_t weights2 = vld1q_s8(shuffled_weights_ptr + 32); - int8x16_t weights3 = vld1q_s8(shuffled_weights_ptr + 48); - shuffled_weights_ptr += 64; - int8x16_t input0 = vld1q_s8(shuffled_input_ptr + 0); - int8x16_t input1 = vld1q_s8(shuffled_input_ptr + 16); - int8x16_t input2 = vld1q_s8(shuffled_input_ptr + 32); - int8x16_t input3 = vld1q_s8(shuffled_input_ptr + 48); - shuffled_input_ptr += 64; - int16x8_t local_accum0, local_accum1, local_accum2, local_accum3; -#define TFLITE_SHUFFLED_FC_ACCUM(B) \ - local_accum0 = vmull_s8(vget_low_s8(weights0), vget_low_s8(input##B)); \ - local_accum1 = vmull_s8(vget_low_s8(weights1), vget_low_s8(input##B)); \ - local_accum2 = vmull_s8(vget_low_s8(weights2), vget_low_s8(input##B)); \ - local_accum3 = vmull_s8(vget_low_s8(weights3), vget_low_s8(input##B)); \ - local_accum0 = \ - vmlal_s8(local_accum0, vget_high_s8(weights0), vget_high_s8(input##B)); \ - local_accum1 = \ - vmlal_s8(local_accum1, vget_high_s8(weights1), vget_high_s8(input##B)); \ - local_accum2 = \ - vmlal_s8(local_accum2, vget_high_s8(weights2), vget_high_s8(input##B)); \ - local_accum3 = \ - vmlal_s8(local_accum3, vget_high_s8(weights3), vget_high_s8(input##B)); \ - row_accum0##B = vpadalq_s16(row_accum0##B, local_accum0); \ - row_accum1##B = vpadalq_s16(row_accum1##B, local_accum1); \ - row_accum2##B = vpadalq_s16(row_accum2##B, local_accum2); \ - row_accum3##B = vpadalq_s16(row_accum3##B, local_accum3); - - TFLITE_SHUFFLED_FC_ACCUM(0) - TFLITE_SHUFFLED_FC_ACCUM(1) - TFLITE_SHUFFLED_FC_ACCUM(2) - TFLITE_SHUFFLED_FC_ACCUM(3) - -#undef TFLITE_SHUFFLED_FC_ACCUM - } - // Horizontally reduce accumulators - -#define TFLITE_SHUFFLED_FC_STORE(B) \ - { \ - int32x2_t pairwise_reduced_acc_0, pairwise_reduced_acc_1, \ - pairwise_reduced_acc_2, pairwise_reduced_acc_3; \ - pairwise_reduced_acc_0 = \ - vpadd_s32(vget_low_s32(row_accum0##B), vget_high_s32(row_accum0##B)); \ - pairwise_reduced_acc_1 = \ - vpadd_s32(vget_low_s32(row_accum1##B), vget_high_s32(row_accum1##B)); \ - pairwise_reduced_acc_2 = \ - vpadd_s32(vget_low_s32(row_accum2##B), vget_high_s32(row_accum2##B)); \ - pairwise_reduced_acc_3 = \ - vpadd_s32(vget_low_s32(row_accum3##B), vget_high_s32(row_accum3##B)); \ - const int32x2_t reduced_lo = \ - vpadd_s32(pairwise_reduced_acc_0, pairwise_reduced_acc_1); \ - const int32x2_t reduced_hi = \ - vpadd_s32(pairwise_reduced_acc_2, pairwise_reduced_acc_3); \ - int32x4_t reduced = vcombine_s32(reduced_lo, reduced_hi); \ - int32x4_t bias_vec = vld1q_s32(bias_data + c); \ - reduced = vaddq_s32(reduced, bias_vec); \ - reduced = vshlq_s32(reduced, vdupq_n_s32(left_shift)); \ - reduced = vqrdmulhq_n_s32(reduced, output_multiplier); \ - using gemmlowp::RoundingDivideByPOT; \ - reduced = RoundingDivideByPOT(reduced, right_shift); \ - const int16x4_t res16 = vqmovn_s32(reduced); \ - vst1_s16(output_data + c + B * output_stride, res16); \ - } - - TFLITE_SHUFFLED_FC_STORE(0); - TFLITE_SHUFFLED_FC_STORE(1); - TFLITE_SHUFFLED_FC_STORE(2); - TFLITE_SHUFFLED_FC_STORE(3); - -#undef TFLITE_SHUFFLED_FC_STORE - } - } else { - TFLITE_DCHECK(false); - return; - } -#else - if (batches == 1) { - int16* output_ptr = output_data; - // Shuffled weights have had their sign bit (0x80) pre-flipped (xor'd) - // so that just reinterpreting them as int8 values is equivalent to - // subtracting 128 from them, thus implementing for free the subtraction of - // the zero_point value 128. - const int8* shuffled_weights_ptr = - reinterpret_cast(shuffled_weights_data); - // Likewise, we preshuffled and pre-xored the input data above. - const int8* shuffled_input_data = - reinterpret_cast(shuffled_input_workspace_data); - for (int c = 0; c < output_depth; c += 4) { - // Internal accumulation. - // Initialize accumulator with the bias-value. - int32 accum[4] = {0}; - // Accumulation loop. - for (int d = 0; d < accum_depth; d += 16) { - for (int i = 0; i < 4; i++) { - for (int j = 0; j < 16; j++) { - int8 input_val = shuffled_input_data[d + j]; - int8 weights_val = *shuffled_weights_ptr++; - accum[i] += weights_val * input_val; - } - } - } - for (int i = 0; i < 4; i++) { - // Add bias value - int acc = accum[i] + bias_data[c + i]; - // Down-scale the final int32 accumulator to the scale used by our - // (16-bit, typically 3 integer bits) fixed-point format. The quantized - // multiplier and shift here have been pre-computed offline - // (e.g. by toco). - acc = - MultiplyByQuantizedMultiplier(acc, output_multiplier, output_shift); - // Saturate, cast to int16, and store to output array. - acc = std::max(acc, -32768); - acc = std::min(acc, 32767); - output_ptr[c + i] = acc; - } - } - } else if (batches == 4) { - int16* output_ptr = output_data; - // Shuffled weights have had their sign bit (0x80) pre-flipped (xor'd) - // so that just reinterpreting them as int8 values is equivalent to - // subtracting 128 from them, thus implementing for free the subtraction of - // the zero_point value 128. - const int8* shuffled_weights_ptr = - reinterpret_cast(shuffled_weights_data); - // Likewise, we preshuffled and pre-xored the input data above. - const int8* shuffled_input_data = - reinterpret_cast(shuffled_input_workspace_data); - for (int c = 0; c < output_depth; c += 4) { - const int8* shuffled_input_ptr = shuffled_input_data; - // Accumulation loop. - // Internal accumulation. - // Initialize accumulator with the bias-value. - int32 accum[4][4]; - for (int i = 0; i < 4; i++) { - for (int b = 0; b < 4; b++) { - accum[i][b] = 0; - } - } - for (int d = 0; d < accum_depth; d += 16) { - for (int i = 0; i < 4; i++) { - for (int b = 0; b < 4; b++) { - for (int j = 0; j < 16; j++) { - int8 input_val = shuffled_input_ptr[16 * b + j]; - int8 weights_val = shuffled_weights_ptr[16 * i + j]; - accum[i][b] += weights_val * input_val; - } - } - } - shuffled_input_ptr += 64; - shuffled_weights_ptr += 64; - } - for (int i = 0; i < 4; i++) { - for (int b = 0; b < 4; b++) { - // Add bias value - int acc = accum[i][b] + bias_data[c + i]; - // Down-scale the final int32 accumulator to the scale used by our - // (16-bit, typically 3 integer bits) fixed-point format. The - // quantized multiplier and shift here have been pre-computed offline - // (e.g. by toco). - acc = MultiplyByQuantizedMultiplier(acc, output_multiplier, - output_shift); - // Saturate, cast to int16, and store to output array. - acc = std::max(acc, -32768); - acc = std::min(acc, 32767); - output_ptr[b * output_stride + c + i] = acc; - } - } - } - } else { - TFLITE_DCHECK(false); - return; - } -#endif -} - -// Wraps ShuffledFullyConnectedWorkerImpl into a Task class -// to allow using gemmlowp's threadpool. -struct ShuffledFullyConnectedWorkerTask : cpu_backend_threadpool::Task { - ShuffledFullyConnectedWorkerTask(const uint8* input_data, - const int8* shuffled_weights_data, - int batches, int output_depth, - int output_stride, int accum_depth, - const int32* bias_data, - int32 output_multiplier, int output_shift, - int16* output_data) - : input_data_(input_data), - shuffled_weights_data_(shuffled_weights_data), - batches_(batches), - output_depth_(output_depth), - output_stride_(output_stride), - accum_depth_(accum_depth), - bias_data_(bias_data), - output_multiplier_(output_multiplier), - output_shift_(output_shift), - output_data_(output_data) {} - - void Run() override { - ShuffledFullyConnectedWorkerImpl( - input_data_, shuffled_weights_data_, batches_, output_depth_, - output_stride_, accum_depth_, bias_data_, output_multiplier_, - output_shift_, output_data_); - } - - const uint8* input_data_; - const int8* shuffled_weights_data_; - int batches_; - int output_depth_; - int output_stride_; - int accum_depth_; - const int32* bias_data_; - int32 output_multiplier_; - int output_shift_; - int16* output_data_; -}; - -inline void ShuffledFullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const uint8* input_data, const RuntimeShape& weights_shape, - const uint8* shuffled_weights_data, const RuntimeShape& bias_shape, - const int32* bias_data, const RuntimeShape& output_shape, - int16* output_data, uint8* shuffled_input_workspace_data, - CpuBackendContext* cpu_backend_context) { - ruy::profiler::ScopeLabel label("ShuffledFullyConnected/8bit"); - const int32 output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32 output_activation_min = params.quantized_activation_min; - const int32 output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_EQ(output_activation_min, -32768); - TFLITE_DCHECK_EQ(output_activation_max, 32767); - TFLITE_DCHECK_GE(input_shape.DimensionsCount(), 1); - TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2); - TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1); - // TODO(benoitjacob): This really should be: - // const int batches = ArraySize(output_dims, 1); - // but the current --variable_batch hack consists in overwriting the 3rd - // dimension with the runtime batch size, as we don't keep track for each - // array of which dimension is the batch dimension in it. - const int output_dim_count = output_shape.DimensionsCount(); - const int weights_dim_count = weights_shape.DimensionsCount(); - const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1); - const int output_depth = MatchingDim(weights_shape, weights_dim_count - 2, - output_shape, output_dim_count - 1); - const int accum_depth = weights_shape.Dims(weights_dim_count - 1); - TFLITE_DCHECK((accum_depth % 16) == 0); - TFLITE_DCHECK((output_depth % 4) == 0); - // Shuffled weights have had their sign bit (0x80) pre-flipped (xor'd) - // so that just reinterpreting them as int8 values is equivalent to - // subtracting 128 from them, thus implementing for free the subtraction of - // the zero_point value 128. - const int8* int8_shuffled_weights_data = - reinterpret_cast(shuffled_weights_data); - - // Shuffling and xoring of input activations into the workspace buffer - if (batches == 1) { -#ifdef USE_NEON - const uint8x16_t signbit = vdupq_n_u8(0x80); - for (int i = 0; i < accum_depth; i += 16) { - uint8x16_t val = vld1q_u8(input_data + i); - val = veorq_u8(val, signbit); - vst1q_u8(shuffled_input_workspace_data + i, val); - } -#else - for (int i = 0; i < accum_depth; i++) { - shuffled_input_workspace_data[i] = input_data[i] ^ 0x80; - } -#endif - } else if (batches == 4) { - uint8* shuffled_input_workspace_ptr = shuffled_input_workspace_data; - int c = 0; -#ifdef USE_NEON - const uint8x16_t signbit = vdupq_n_u8(0x80); - for (c = 0; c < accum_depth; c += 16) { - const uint8* src_data_ptr = input_data + c; - uint8x16_t val0 = vld1q_u8(src_data_ptr + 0 * accum_depth); - uint8x16_t val1 = vld1q_u8(src_data_ptr + 1 * accum_depth); - uint8x16_t val2 = vld1q_u8(src_data_ptr + 2 * accum_depth); - uint8x16_t val3 = vld1q_u8(src_data_ptr + 3 * accum_depth); - val0 = veorq_u8(val0, signbit); - val1 = veorq_u8(val1, signbit); - val2 = veorq_u8(val2, signbit); - val3 = veorq_u8(val3, signbit); - vst1q_u8(shuffled_input_workspace_ptr + 0, val0); - vst1q_u8(shuffled_input_workspace_ptr + 16, val1); - vst1q_u8(shuffled_input_workspace_ptr + 32, val2); - vst1q_u8(shuffled_input_workspace_ptr + 48, val3); - shuffled_input_workspace_ptr += 64; - } -#else - for (c = 0; c < accum_depth; c += 16) { - for (int b = 0; b < 4; b++) { - const uint8* src_data_ptr = input_data + b * accum_depth + c; - for (int j = 0; j < 16; j++) { - uint8 src_val = *src_data_ptr++; - // Flip the sign bit, so that the kernel will only need to - // reinterpret these uint8 values as int8, getting for free the - // subtraction of the zero_point value 128. - uint8 dst_val = src_val ^ 0x80; - *shuffled_input_workspace_ptr++ = dst_val; - } - } - } -#endif - } else { - TFLITE_DCHECK(false); - return; - } - - static constexpr int kKernelRows = 4; - const int thread_count = - LegacyHowManyThreads(cpu_backend_context->max_num_threads(), - output_depth, batches, accum_depth); - if (thread_count == 1) { - // Single-thread case: do the computation on the current thread, don't - // use a threadpool - ShuffledFullyConnectedWorkerImpl( - shuffled_input_workspace_data, int8_shuffled_weights_data, batches, - output_depth, output_depth, accum_depth, bias_data, output_multiplier, - output_shift, output_data); - return; - } - - // Multi-threaded case: use the gemmlowp context's threadpool. - TFLITE_DCHECK_GT(thread_count, 1); - std::vector tasks; - // TODO(b/131746020) don't create new heap allocations every time. - // At least we make it a single heap allocation by using reserve(). - tasks.reserve(thread_count); - const int kRowsPerWorker = - RoundUp(CeilQuotient(output_depth, thread_count)); - int row_start = 0; - for (int i = 0; i < thread_count; i++) { - int row_end = std::min(output_depth, row_start + kRowsPerWorker); - tasks.emplace_back(shuffled_input_workspace_data, - int8_shuffled_weights_data + row_start * accum_depth, - batches, row_end - row_start, output_depth, accum_depth, - bias_data + row_start, output_multiplier, output_shift, - output_data + row_start); - row_start = row_end; - } - TFLITE_DCHECK_EQ(row_start, output_depth); - cpu_backend_threadpool::Execute(tasks.size(), tasks.data(), - cpu_backend_context); -} - -#ifdef USE_NEON - -inline int32x4_t RoundToNearest(const float32x4_t input) { -#if defined(__aarch64__) || defined(__SSSE3__) - // Note: vcvtnq_s32_f32 is not available in ARMv7 - return vcvtnq_s32_f32(input); -#else - static const float32x4_t zero_val_dup = vdupq_n_f32(0.0f); - static const float32x4_t point5_val_dup = vdupq_n_f32(0.5f); - static const float32x4_t minus_point5_val_dup = vdupq_n_f32(-0.5f); - - const uint32x4_t mask = vcltq_f32(input, zero_val_dup); - const float32x4_t round = - vbslq_f32(mask, minus_point5_val_dup, point5_val_dup); - return vcvtq_s32_f32(vaddq_f32(input, round)); -#endif // defined(__aarch64__) || defined(__SSSE3__) -} - -inline uint32x4_t RoundToNearestUnsigned(const float32x4_t input) { -#if defined(__aarch64__) - // Note that vcvtnq_u32_f32 is not available in ARMv7 or in arm_neon_sse.h. - return vcvtnq_u32_f32(input); -#else - static const float32x4_t point5_val_dup = vdupq_n_f32(0.5f); - - return vcvtq_u32_f32(vaddq_f32(input, point5_val_dup)); -#endif // defined(__aarch64__) -} - -#endif // USE_NEON - -inline void MeanImpl(const tflite::MeanParams& op_params, - const RuntimeShape& input_shape, const uint8_t* input_data, - int32 multiplier, int32 shift, int32 bias, - const RuntimeShape& output_shape, uint8_t* output_data, - int start_depth, int end_depth) { - ruy::profiler::ScopeLabel label("Mean4D/Uint8/MeanImpl"); - - // Current implementation only supports dimension equals 4 and simultaneous - // reduction over width and height. - const int output_batch = output_shape.Dims(0); - const int output_height = output_shape.Dims(2); - const int output_width = output_shape.Dims(2); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - - TFLITE_CHECK_EQ(op_params.axis_count, 2); - TFLITE_CHECK((op_params.axis[0] == 1 && op_params.axis[1] == 2) || - (op_params.axis[0] == 2 && op_params.axis[1] == 1)); - TFLITE_CHECK_EQ(output_height, 1); - TFLITE_CHECK_EQ(output_width, 1); - - constexpr int32_t kMinValue = std::numeric_limits::min(); - constexpr int32_t kMaxValue = std::numeric_limits::max(); - -#ifdef USE_NEON - const int32x4_t bias_dup = vdupq_n_s32(bias); - const int32x4_t min_dup = vdupq_n_s32(kMinValue); - const int32x4_t max_dup = vdupq_n_s32(kMaxValue); -#endif // USE_NEON - - for (int out_b = 0; out_b < output_batch; ++out_b) { - int out_d = start_depth; -#ifdef USE_NEON - - for (; out_d <= end_depth - 16; out_d += 16) { - int32x4x4_t temp_sum; - temp_sum.val[0] = vdupq_n_s32(0); - temp_sum.val[1] = vdupq_n_s32(0); - temp_sum.val[2] = vdupq_n_s32(0); - temp_sum.val[3] = vdupq_n_s32(0); - for (int in_h = 0; in_h < input_height; ++in_h) { - for (int in_w = 0; in_w < input_width; ++in_w) { - const uint8_t* input_data_ptr = - input_data + Offset(input_shape, out_b, in_h, in_w, out_d); - uint8x16_t input_data_val = vld1q_u8(input_data_ptr); - - int16x8_t input_data_low_shift = - vreinterpretq_s16_u16(vmovl_u8(vget_low_u8(input_data_val))); - int16x8_t input_data_high_shift = - vreinterpretq_s16_u16(vmovl_u8(vget_high_u8(input_data_val))); - - int32x4_t input_low_low = - vmovl_s16(vget_low_s16(input_data_low_shift)); - int32x4_t input_high_low = - vmovl_s16(vget_high_s16(input_data_low_shift)); - int32x4_t input_low_high = - vmovl_s16(vget_low_s16(input_data_high_shift)); - int32x4_t input_high_high = - vmovl_s16(vget_high_s16(input_data_high_shift)); - - temp_sum.val[0] = vaddq_s32(temp_sum.val[0], input_low_low); - temp_sum.val[1] = vaddq_s32(temp_sum.val[1], input_high_low); - temp_sum.val[2] = vaddq_s32(temp_sum.val[2], input_low_high); - temp_sum.val[3] = vaddq_s32(temp_sum.val[3], input_high_high); - } - } - - temp_sum = - MultiplyByQuantizedMultiplier4Rows(temp_sum, multiplier, shift); - - temp_sum.val[0] = vaddq_s32(temp_sum.val[0], bias_dup); - temp_sum.val[1] = vaddq_s32(temp_sum.val[1], bias_dup); - temp_sum.val[2] = vaddq_s32(temp_sum.val[2], bias_dup); - temp_sum.val[3] = vaddq_s32(temp_sum.val[3], bias_dup); - - temp_sum.val[0] = vminq_s32(vmaxq_s32(temp_sum.val[0], min_dup), max_dup); - temp_sum.val[1] = vminq_s32(vmaxq_s32(temp_sum.val[1], min_dup), max_dup); - temp_sum.val[2] = vminq_s32(vmaxq_s32(temp_sum.val[2], min_dup), max_dup); - temp_sum.val[3] = vminq_s32(vmaxq_s32(temp_sum.val[3], min_dup), max_dup); - - uint16x4_t narrowed_low_low = - vmovn_u32(vreinterpretq_u32_s32(temp_sum.val[0])); - uint16x4_t narrowed_high_low = - vmovn_u32(vreinterpretq_u32_s32(temp_sum.val[1])); - uint16x4_t narrowed_low_high = - vmovn_u32(vreinterpretq_u32_s32(temp_sum.val[2])); - uint16x4_t narrowed_high_high = - vmovn_u32(vreinterpretq_u32_s32(temp_sum.val[3])); - - uint16x8_t combined_low = - vcombine_u16(narrowed_low_low, narrowed_high_low); - uint16x8_t combined_high = - vcombine_u16(narrowed_low_high, narrowed_high_high); - - uint8x8_t narrowed_low = vmovn_u16(combined_low); - uint8x8_t narrowed_high = vmovn_u16(combined_high); - - uint8x16_t combined_output = vcombine_u8(narrowed_low, narrowed_high); - - uint8_t* output_data_ptr = - output_data + Offset(output_shape, out_b, 0, 0, out_d); - vst1q_u8(output_data_ptr, combined_output); - } -#endif // USE_NEON - - for (; out_d < end_depth; ++out_d) { - int acc = 0; - for (int in_h = 0; in_h < input_height; ++in_h) { - for (int in_w = 0; in_w < input_width; ++in_w) { - acc += input_data[Offset(input_shape, out_b, in_h, in_w, out_d)]; - } - } - - acc = MultiplyByQuantizedMultiplier(acc, multiplier, shift); - acc += bias; - acc = std::min(std::max(acc, kMinValue), kMaxValue); - output_data[Offset(output_shape, out_b, 0, 0, out_d)] = - static_cast(acc); - } - } -} - -struct MeanWorkerTask : cpu_backend_threadpool::Task { - MeanWorkerTask(const tflite::MeanParams& op_params, - const RuntimeShape& input_shape, const uint8_t* input_data, - int32 multiplier, int32 shift, int32 bias, - const RuntimeShape& output_shape, uint8_t* output_data, - int start_height, int end_height) - : op_params(op_params), - input_shape(input_shape), - input_data(input_data), - multiplier(multiplier), - shift(shift), - bias(bias), - output_shape(output_shape), - output_data(output_data), - start_height(start_height), - end_height(end_height) {} - - void Run() override { - MeanImpl(op_params, input_shape, input_data, multiplier, shift, bias, - output_shape, output_data, start_height, end_height); - } - - private: - const tflite::MeanParams& op_params; - const RuntimeShape& input_shape; - const uint8_t* input_data; - int32 multiplier; - int32 shift; - int32 bias; - const RuntimeShape& output_shape; - uint8_t* output_data; - int start_height; - int end_height; -}; - -inline void Mean(const tflite::MeanParams& op_params, - const RuntimeShape& unextended_input_shape, - const uint8_t* input_data, int32 input_zero_point, - float input_scale, const RuntimeShape& unextended_output_shape, - uint8_t* output_data, int32 output_zero_point, - float output_scale, CpuBackendContext* cpu_backend_context) { - ruy::profiler::ScopeLabel label("Mean4D/Uint8"); - // Current implementation only supports dimension equals 4 and simultaneous - // reduction over width and height. - TFLITE_CHECK_EQ(unextended_input_shape.DimensionsCount(), 4); - TFLITE_CHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int output_depth = output_shape.Dims(3); - - TFLITE_CHECK_EQ(op_params.axis_count, 2); - TFLITE_CHECK((op_params.axis[0] == 1 && op_params.axis[1] == 2) || - (op_params.axis[0] == 2 && op_params.axis[1] == 1)); - TFLITE_CHECK_EQ(output_height, 1); - TFLITE_CHECK_EQ(output_width, 1); - - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const float num_elements_in_axis = input_width * input_height; - - int32 bias = - output_zero_point - - static_cast(input_zero_point * input_scale / output_scale); - float real_scale = input_scale / (num_elements_in_axis * output_scale); - - int32 multiplier, shift; - QuantizeMultiplier(real_scale, &multiplier, &shift); - - constexpr int kMinDepthPerThread = 8; - int thread_count = output_depth / kMinDepthPerThread; - thread_count = thread_count > 0 ? thread_count : 1; - const int capped_thread_count = - std::min(thread_count, cpu_backend_context->max_num_threads()); - - if (capped_thread_count == 1) { - MeanImpl(op_params, input_shape, input_data, multiplier, shift, bias, - output_shape, output_data, 0, output_depth); - } else { - // Instead parallel for batch, we loop for the output_depth since batch - // is typical 1. - std::vector tasks; - // TODO(b/131746020) don't create new heap allocations every time. - // At least we make it a single heap allocation by using reserve(). - tasks.reserve(capped_thread_count); - int depth_start = 0; - for (int i = 0; i < capped_thread_count; ++i) { - // Try to distribute the tasks as even as possible. - int depth_end = depth_start + - (output_depth - depth_start) / (capped_thread_count - i); - tasks.emplace_back(op_params, input_shape, input_data, multiplier, shift, - bias, output_shape, output_data, depth_start, - depth_end); - depth_start = depth_end; - } - cpu_backend_threadpool::Execute(tasks.size(), tasks.data(), - cpu_backend_context); - } -} - -template -inline bool MeanGeneral(const T* input_data, const int* input_dims, - const int input_num_dims, T* output_data, - const int* output_dims, const int output_num_dims, - const int* axis, const int num_axis_dimensions, - bool keep_dims, int* temp_index, int* resolved_axis, - U* temp_sum) { - return reference_ops::Mean(input_data, input_dims, input_num_dims, - output_data, output_dims, output_num_dims, axis, - num_axis_dimensions, keep_dims, temp_index, - resolved_axis, temp_sum); -} - -template <> -inline bool MeanGeneral( - const float* input_data, const int* input_dims, const int input_num_dims, - float* output_data, const int* output_dims, const int output_num_dims, - const int* axis, const int num_axis_dimensions, bool keep_dims, - int* temp_index, int* resolved_axis, float* temp_sum) { - // Handle reduce_mean for the last dimensions. - if (num_axis_dimensions == 1 && axis[0] == (input_num_dims - 1)) { - ruy::profiler::ScopeLabel label("MeanLastDim/Float"); - int output_size = 1; - for (int i = 0; i < input_num_dims - 1; ++i) { - output_size *= input_dims[i]; - } - const int last_input_dim = input_dims[axis[0]]; - - // TODO(b/152563685): Consider use eigen to cover more general cases. - const MatrixMap in_mat(input_data, last_input_dim, - output_size); - VectorMap out(output_data, output_size, 1); - out = (in_mat.array().colwise().sum()) / static_cast(last_input_dim); - return true; - } - - return reference_ops::Mean(input_data, input_dims, input_num_dims, - output_data, output_dims, output_num_dims, axis, - num_axis_dimensions, keep_dims, temp_index, - resolved_axis, temp_sum); -} - -inline void Conv(const ConvParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& filter_shape, - const float* filter_data, const RuntimeShape& bias_shape, - const float* bias_data, const RuntimeShape& output_shape, - float* output_data, const RuntimeShape& im2col_shape, - float* im2col_data, CpuBackendContext* cpu_backend_context) { - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const float output_activation_min = params.float_activation_min; - const float output_activation_max = params.float_activation_max; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - - ruy::profiler::ScopeLabel label("Conv"); - - // NB: the float 0.0f value is represented by all zero bytes. - const uint8 float_zero_byte = 0x00; - const float* gemm_input_data = nullptr; - const RuntimeShape* gemm_input_shape = nullptr; - const int filter_width = filter_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const bool need_dilated_im2col = - dilation_width_factor != 1 || dilation_height_factor != 1; - const bool need_im2col = stride_width != 1 || stride_height != 1 || - filter_width != 1 || filter_height != 1; - if (need_dilated_im2col) { - DilatedIm2col(params, float_zero_byte, input_shape, input_data, - filter_shape, output_shape, im2col_data); - gemm_input_data = im2col_data; - gemm_input_shape = &im2col_shape; - } else if (need_im2col) { - TFLITE_DCHECK(im2col_data); - Im2col(params, filter_height, filter_width, float_zero_byte, input_shape, - input_data, im2col_shape, im2col_data); - gemm_input_data = im2col_data; - gemm_input_shape = &im2col_shape; - } else { - // TODO(aselle): We need to make sure to not send im2col if it is not - // needed. - TFLITE_DCHECK(!im2col_data); - gemm_input_data = input_data; - gemm_input_shape = &input_shape; - } - - const int gemm_input_dims = gemm_input_shape->DimensionsCount(); - int m = FlatSizeSkipDim(*gemm_input_shape, gemm_input_dims - 1); - int n = output_shape.Dims(3); - int k = gemm_input_shape->Dims(gemm_input_dims - 1); - -#if defined(TF_LITE_USE_CBLAS) && defined(__APPLE__) - // The following code computes matrix multiplication c = a * transponse(b) - // with CBLAS, where: - // * `a` is a matrix with dimensions (m, k). - // * `b` is a matrix with dimensions (n, k), so transpose(b) is (k, n). - // * `c` is a matrix with dimensions (m, n). - // The naming of variables are aligned with CBLAS specification here. - const float* a = gemm_input_data; - const float* b = filter_data; - float* c = output_data; - // The stride of matrix a, b and c respectively. - int stride_a = k; - int stride_b = k; - int stride_c = n; - - cblas_sgemm(CblasRowMajor, CblasNoTrans, CblasTrans, m, n, k, 1.0f, a, - stride_a, b, stride_b, 0.0f, c, stride_c); - optimized_ops::AddBiasAndEvalActivationFunction( - output_activation_min, output_activation_max, bias_shape, bias_data, - output_shape, output_data); -#else - // When an optimized CBLAS implementation is not available, fall back - // to using cpu_backend_gemm. - cpu_backend_gemm::MatrixParams lhs_params; - lhs_params.order = cpu_backend_gemm::Order::kRowMajor; - lhs_params.rows = n; - lhs_params.cols = k; - cpu_backend_gemm::MatrixParams rhs_params; - rhs_params.order = cpu_backend_gemm::Order::kColMajor; - rhs_params.rows = k; - rhs_params.cols = m; - cpu_backend_gemm::MatrixParams dst_params; - dst_params.order = cpu_backend_gemm::Order::kColMajor; - dst_params.rows = n; - dst_params.cols = m; - cpu_backend_gemm::GemmParams gemm_params; - gemm_params.bias = bias_data; - gemm_params.clamp_min = output_activation_min; - gemm_params.clamp_max = output_activation_max; - cpu_backend_gemm::Gemm(lhs_params, filter_data, rhs_params, gemm_input_data, - dst_params, output_data, gemm_params, - cpu_backend_context); -#endif // defined(TF_LITE_USE_CBLAS) && defined(__APPLE__) -} - -inline void HybridConv(const ConvParams& params, float* scaling_factors_ptr, - const RuntimeShape& input_shape, - const int8_t* input_data, - const RuntimeShape& filter_shape, - const int8_t* filter_data, - const RuntimeShape& bias_shape, const float* bias_data, - const RuntimeShape& accum_scratch_shape, - int32_t* accum_scratch, const RuntimeShape& output_shape, - float* output_data, const RuntimeShape& im2col_shape, - int8_t* im2col_data, CpuBackendContext* context) { - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const float output_activation_min = params.float_activation_min; - const float output_activation_max = params.float_activation_max; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - - const int batch_size = input_shape.Dims(0); - const int filter_width = filter_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - - const int8_t* gemm_input_data = nullptr; - int num_input; - const bool need_im2col = stride_width != 1 || stride_height != 1 || - filter_width != 1 || filter_height != 1; - - if (need_im2col) { - TFLITE_DCHECK(im2col_data); - // symmetric quantization assumes zero point of 0. - const int input_zero_point = 0; - - Im2col(params, filter_height, filter_width, input_zero_point, input_shape, - input_data, im2col_shape, im2col_data); - gemm_input_data = im2col_data; - num_input = im2col_shape.FlatSize(); - } else { - TFLITE_DCHECK(!im2col_data); - gemm_input_data = input_data; - num_input = input_shape.FlatSize(); - } - - // Flatten 4D matrices into 2D matrices for matrix multiplication. - - // Flatten so that each filter has its own row. - const int filter_rows = filter_shape.Dims(0); - const int filter_cols = FlatSizeSkipDim(filter_shape, 0); - - // In MatrixBatchVectorMultiplyAccumulate, each output value is the - // dot product of one row of the first matrix with one row of the second - // matrix. Therefore, the number of cols in each matrix are equivalent. - // - // After Im2Col, each input patch becomes a row. - const int gemm_input_cols = filter_cols; - const int gemm_input_rows = num_input / gemm_input_cols; - - const int output_cols = output_shape.Dims(3); - const int output_rows = FlatSizeSkipDim(output_shape, 3); - TFLITE_DCHECK_EQ(output_cols, filter_rows); - TFLITE_DCHECK_EQ(output_rows, gemm_input_rows); - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_cols); - - // MatrixBatchVectorMultiplyAccumulate assumes that each row of the second - // input matrix has its own scale factor. This code duplicates the scale - // factors for each row in the same batch. - const int rows_per_batch = gemm_input_rows / batch_size; - for (int i = gemm_input_rows - 1; i >= 0; --i) { - scaling_factors_ptr[i] = scaling_factors_ptr[i / rows_per_batch]; - } - - std::fill_n(output_data, output_rows * output_cols, 0.0f); - - // The scratch buffer must have the same size as the output. - TFLITE_DCHECK_EQ(accum_scratch_shape.FlatSize(), output_shape.FlatSize()); - tensor_utils::MatrixBatchVectorMultiplyAccumulate( - filter_data, filter_rows, filter_cols, gemm_input_data, - scaling_factors_ptr, /*n_batch=*/gemm_input_rows, accum_scratch, - output_data, context); - AddBiasAndEvalActivationFunction(output_activation_min, output_activation_max, - bias_shape, bias_data, output_shape, - output_data); -} - -inline void HybridConvPerChannel( - const ConvParams& params, float* scaling_factors_ptr, - const RuntimeShape& input_shape, const int8_t* input_data, - const RuntimeShape& filter_shape, const int8_t* filter_data, - const RuntimeShape& bias_shape, const float* bias_data, - const RuntimeShape& output_shape, float* output_data, - const RuntimeShape& im2col_shape, int8_t* im2col_data, - const float* per_channel_scale, int32_t* input_offset, - const RuntimeShape& scratch_shape, int32_t* scratch, int32_t* row_sums, - bool* compute_row_sums, CpuBackendContext* cpu_backend_context) { - ruy::profiler::ScopeLabel label("ConvHybridPerChannel"); - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - - const int8* gemm_input_data = nullptr; - const RuntimeShape* gemm_input_shape = nullptr; - const int filter_width = filter_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const bool need_dilated_im2col = - dilation_width_factor != 1 || dilation_height_factor != 1; - const bool need_im2col = stride_width != 1 || stride_height != 1 || - filter_width != 1 || filter_height != 1; - - const int batch_size = input_shape.Dims(0); - - if (need_dilated_im2col) { - TFLITE_DCHECK(im2col_data); - optimized_ops::DilatedIm2col(params, input_shape, input_data, filter_shape, - output_shape, im2col_data, input_offset, - batch_size); - gemm_input_data = im2col_data; - gemm_input_shape = &im2col_shape; - } else if (need_im2col) { - Im2col(params, filter_height, filter_width, input_offset, batch_size, - input_shape, input_data, im2col_shape, im2col_data); - gemm_input_data = im2col_data; - gemm_input_shape = &im2col_shape; - } else { - TFLITE_DCHECK(!im2col_data); - gemm_input_data = input_data; - gemm_input_shape = &input_shape; - } - - const int filter_rows = filter_shape.Dims(0); - const int filter_cols = FlatSizeSkipDim(filter_shape, 0); - - const int gemm_input_rows = gemm_input_shape->Dims(3); - const int gemm_input_cols = FlatSizeSkipDim(*gemm_input_shape, 3); - const int output_rows = output_shape.Dims(3); - const int output_cols = - output_shape.Dims(0) * output_shape.Dims(1) * output_shape.Dims(2); - - TFLITE_DCHECK_EQ(output_rows, filter_rows); - TFLITE_DCHECK_EQ(output_cols, gemm_input_cols); - TFLITE_DCHECK_EQ(filter_cols, gemm_input_rows); - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_rows); - TFLITE_DCHECK_EQ(scratch_shape.FlatSize(), output_shape.FlatSize()); - if (!compute_row_sums || *compute_row_sums) { - memset(row_sums, 0, sizeof(int32_t) * filter_rows); - tensor_utils::ReductionSumVector(filter_data, row_sums, filter_rows, - filter_cols); - if (compute_row_sums) { - *compute_row_sums = false; - } - } - - cpu_backend_gemm::MatrixParams lhs_params; - lhs_params.rows = filter_rows; - lhs_params.cols = filter_cols; - lhs_params.order = cpu_backend_gemm::Order::kRowMajor; - - cpu_backend_gemm::MatrixParams rhs_params; - rhs_params.order = cpu_backend_gemm::Order::kColMajor; - rhs_params.rows = gemm_input_rows; - rhs_params.cols = gemm_input_cols; - - cpu_backend_gemm::MatrixParams dst_params; - dst_params.order = cpu_backend_gemm::Order::kColMajor; - dst_params.rows = output_rows; - dst_params.cols = output_cols; - - // TODO(b/149003801): Use hybrid gemm once supported in Ruy. - cpu_backend_gemm::GemmParams gemm_params; - cpu_backend_gemm::Gemm(lhs_params, filter_data, rhs_params, gemm_input_data, - dst_params, scratch, gemm_params, cpu_backend_context); - - MatrixMap out_mat(output_data, filter_rows, output_cols); - MatrixMap in_mat(scratch, filter_rows, output_cols); - VectorMap bias_data_vec(bias_data, filter_rows, 1); - VectorMap row_sums_vec(row_sums, filter_rows, 1); - VectorMap per_channel_scale_vec(per_channel_scale, filter_rows, - 1); - const int cols_per_batch = output_cols / batch_size; - for (int c = 0; c < output_cols; c++) { - const int b = c / cols_per_batch; - const float input_scale = scaling_factors_ptr[b]; - const int32_t zero_point = input_offset[b]; - out_mat.col(c) = - (((in_mat.col(c) - (row_sums_vec * zero_point)) - .cast() - .cwiseProduct((per_channel_scale_vec * input_scale))) + - bias_data_vec) - .cwiseMin(params.float_activation_max) - .cwiseMax(params.float_activation_min); - } -} - -inline void Conv(const ConvParams& params, const RuntimeShape& input_shape, - const uint8* input_data, const RuntimeShape& filter_shape, - const uint8* filter_data, const RuntimeShape& bias_shape, - const int32* bias_data, const RuntimeShape& output_shape, - uint8* output_data, const RuntimeShape& im2col_shape, - uint8* im2col_data, CpuBackendContext* cpu_backend_context) { - ruy::profiler::ScopeLabel label("Conv/8bit"); - - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int32 input_offset = params.input_offset; - const int32 filter_offset = params.weights_offset; - const int32 output_offset = params.output_offset; - const int32 output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32 output_activation_min = params.quantized_activation_min; - const int32 output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - - const uint8* gemm_input_data = nullptr; - const RuntimeShape* gemm_input_shape = nullptr; - const int filter_width = filter_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const bool need_dilated_im2col = - dilation_width_factor != 1 || dilation_height_factor != 1; - const bool need_im2col = stride_width != 1 || stride_height != 1 || - filter_width != 1 || filter_height != 1; - if (need_dilated_im2col) { - TFLITE_DCHECK(im2col_data); - const int input_zero_point = -input_offset; - TFLITE_DCHECK_GE(input_zero_point, 0); - TFLITE_DCHECK_LE(input_zero_point, 255); - DilatedIm2col(params, input_zero_point, input_shape, input_data, - filter_shape, output_shape, im2col_data); - gemm_input_data = im2col_data; - gemm_input_shape = &im2col_shape; - } else if (need_im2col) { - TFLITE_DCHECK(im2col_data); - const int input_zero_point = -input_offset; - TFLITE_DCHECK_GE(input_zero_point, 0); - TFLITE_DCHECK_LE(input_zero_point, 255); - Im2col(params, filter_height, filter_width, input_zero_point, input_shape, - input_data, im2col_shape, im2col_data); - gemm_input_data = im2col_data; - gemm_input_shape = &im2col_shape; - } else { - TFLITE_DCHECK(!im2col_data); - gemm_input_data = input_data; - gemm_input_shape = &input_shape; - } - - const int gemm_input_rows = gemm_input_shape->Dims(3); - // Using FlatSizeSkipDim causes segfault in some contexts (see b/79927784). - // The root cause has not yet been identified though. Same applies below for - // the other calls commented out. This is a partial rollback of cl/196819423. - // const int gemm_input_cols = FlatSizeSkipDim(*gemm_input_shape, 3); - const int gemm_input_cols = gemm_input_shape->Dims(0) * - gemm_input_shape->Dims(1) * - gemm_input_shape->Dims(2); - const int filter_rows = filter_shape.Dims(0); - // See b/79927784. - // const int filter_cols = FlatSizeSkipDim(filter_shape, 0); - const int filter_cols = - filter_shape.Dims(1) * filter_shape.Dims(2) * filter_shape.Dims(3); - const int output_rows = output_shape.Dims(3); - // See b/79927784. - // const int output_cols = FlatSizeSkipDim(output_shape, 3); - const int output_cols = - output_shape.Dims(0) * output_shape.Dims(1) * output_shape.Dims(2); - TFLITE_DCHECK_EQ(output_rows, filter_rows); - TFLITE_DCHECK_EQ(output_cols, gemm_input_cols); - TFLITE_DCHECK_EQ(filter_cols, gemm_input_rows); - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_rows); - - cpu_backend_gemm::MatrixParams lhs_params; - lhs_params.rows = filter_rows; - lhs_params.cols = filter_cols; - lhs_params.order = cpu_backend_gemm::Order::kRowMajor; - lhs_params.zero_point = -filter_offset; - cpu_backend_gemm::MatrixParams rhs_params; - rhs_params.rows = gemm_input_rows; - rhs_params.cols = gemm_input_cols; - rhs_params.order = cpu_backend_gemm::Order::kColMajor; - rhs_params.zero_point = -input_offset; - cpu_backend_gemm::MatrixParams dst_params; - dst_params.rows = output_rows; - dst_params.cols = output_cols; - dst_params.order = cpu_backend_gemm::Order::kColMajor; - dst_params.zero_point = output_offset; - cpu_backend_gemm::GemmParams gemm_params; - gemm_params.bias = bias_data; - gemm_params.clamp_min = output_activation_min; - gemm_params.clamp_max = output_activation_max; - gemm_params.multiplier_fixedpoint = output_multiplier; - gemm_params.multiplier_exponent = output_shift; - cpu_backend_gemm::Gemm(lhs_params, filter_data, rhs_params, gemm_input_data, - dst_params, output_data, gemm_params, - cpu_backend_context); -} - -template -inline void DepthToSpace(const tflite::DepthToSpaceParams& op_params, - const RuntimeShape& unextended_input_shape, - const T* input_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - ruy::profiler::ScopeLabel label("DepthToSpace"); - - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - const int input_depth = input_shape.Dims(3); - const int input_width = input_shape.Dims(2); - const int input_height = input_shape.Dims(1); - - const int output_depth = output_shape.Dims(3); - const int batch_size = output_shape.Dims(0); - - // Number of continuous values that we can copy in one interation. - const int stride = op_params.block_size * output_depth; - - for (int batch = 0; batch < batch_size; ++batch) { - for (int in_h = 0; in_h < input_height; ++in_h) { - const T* input_ptr = input_data + Offset(input_shape, batch, in_h, 0, 0); - for (int offset_h = 0; offset_h < op_params.block_size; ++offset_h) { - const T* src = input_ptr; - for (int in_w = 0; in_w < input_width; ++in_w) { - memcpy(output_data, src, stride * sizeof(T)); - output_data += stride; - src += input_depth; - } - input_ptr += stride; - } - } - } -} - -template -inline void SpaceToDepth(const tflite::SpaceToDepthParams& op_params, - const RuntimeShape& unextended_input_shape, - const T* input_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - ruy::profiler::ScopeLabel label("SpaceToDepth"); - - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - const int output_depth = output_shape.Dims(3); - const int output_width = output_shape.Dims(2); - const int output_height = output_shape.Dims(1); - - const int input_depth = input_shape.Dims(3); - const int batch_size = input_shape.Dims(0); - - // Number of continuous values that we can copy in one interation. - const int stride = op_params.block_size * input_depth; - - for (int batch = 0; batch < batch_size; ++batch) { - for (int out_h = 0; out_h < output_height; ++out_h) { - T* output_ptr = output_data + Offset(output_shape, batch, out_h, 0, 0); - for (int offset_h = 0; offset_h < op_params.block_size; ++offset_h) { - T* dst = output_ptr; - for (int out_w = 0; out_w < output_width; ++out_w) { - memcpy(dst, input_data, stride * sizeof(T)); - input_data += stride; - dst += output_depth; - } - output_ptr += stride; - } - } - } -} - -inline void Relu(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("Relu (not fused)"); - - const auto input = MapAsVector(input_data, input_shape); - auto output = MapAsVector(output_data, output_shape); - output = input.cwiseMax(0.0f); -} - -inline void L2Normalization(const tflite::L2NormalizationParams& op_params, - const RuntimeShape& input_shape, - const float* input_data, - const RuntimeShape& output_shape, - float* output_data, float epsilon = 1e-6) { - ruy::profiler::ScopeLabel label("L2Normalization"); - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int outer_size = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int depth = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - for (int i = 0; i < outer_size; ++i) { - float squared_l2_norm = 0; - for (int c = 0; c < depth; ++c) { - const float val = input_data[c]; - squared_l2_norm += val * val; - } - float l2_norm = std::sqrt(squared_l2_norm); - l2_norm = std::max(l2_norm, epsilon); - for (int c = 0; c < depth; ++c) { - *output_data = *input_data / l2_norm; - ++output_data; - ++input_data; - } - } -} - -inline void L2Normalization(const tflite::L2NormalizationParams& op_params, - const RuntimeShape& input_shape, - const uint8* input_data, - const RuntimeShape& output_shape, - uint8* output_data) { - ruy::profiler::ScopeLabel label("L2Normalization/8bit"); - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int depth = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - const int outer_size = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int32 input_zero_point = op_params.input_zero_point; - for (int i = 0; i < outer_size; ++i) { - int32 square_l2_norm = 0; - for (int c = 0; c < depth; c++) { - // Note that input_data advances by depth in the second pass below. - int32 diff = input_data[c] - input_zero_point; - square_l2_norm += diff * diff; - } - // TODO(b/29395854): add clamping to TOCO and TF Lite kernel - // for all zero tensors in the input_data - int32 inv_l2norm_multiplier; - int inv_l2norm_shift; - GetInvSqrtQuantizedMultiplierExp(square_l2_norm, kReverseShift, - &inv_l2norm_multiplier, &inv_l2norm_shift); - - for (int c = 0; c < depth; c++) { - int32 diff = *input_data - input_zero_point; - int32 rescaled_diff = MultiplyByQuantizedMultiplierSmallerThanOneExp( - 128 * diff, inv_l2norm_multiplier, inv_l2norm_shift); - int32 unclamped_output_val = 128 + rescaled_diff; - int32 output_val = std::min(255, std::max(0, unclamped_output_val)); - *output_data = static_cast(output_val); - ++input_data; - ++output_data; - } - } -} - -inline void AddElementwise(int size, const ArithmeticParams& params, - const float* input1_data, const float* input2_data, - float* output_data) { - int i = 0; - -#ifdef USE_NEON - const auto activation_min = vdupq_n_f32(params.float_activation_min); - const auto activation_max = vdupq_n_f32(params.float_activation_max); - for (; i <= size - 16; i += 16) { - auto a10 = vld1q_f32(input1_data + i); - auto a11 = vld1q_f32(input1_data + i + 4); - auto a12 = vld1q_f32(input1_data + i + 8); - auto a13 = vld1q_f32(input1_data + i + 12); - auto a20 = vld1q_f32(input2_data + i); - auto a21 = vld1q_f32(input2_data + i + 4); - auto a22 = vld1q_f32(input2_data + i + 8); - auto a23 = vld1q_f32(input2_data + i + 12); - auto x0 = vaddq_f32(a10, a20); - auto x1 = vaddq_f32(a11, a21); - auto x2 = vaddq_f32(a12, a22); - auto x3 = vaddq_f32(a13, a23); - x0 = vmaxq_f32(activation_min, x0); - x1 = vmaxq_f32(activation_min, x1); - x2 = vmaxq_f32(activation_min, x2); - x3 = vmaxq_f32(activation_min, x3); - x0 = vminq_f32(activation_max, x0); - x1 = vminq_f32(activation_max, x1); - x2 = vminq_f32(activation_max, x2); - x3 = vminq_f32(activation_max, x3); - vst1q_f32(output_data + i, x0); - vst1q_f32(output_data + i + 4, x1); - vst1q_f32(output_data + i + 8, x2); - vst1q_f32(output_data + i + 12, x3); - } - for (; i <= size - 4; i += 4) { - auto a1 = vld1q_f32(input1_data + i); - auto a2 = vld1q_f32(input2_data + i); - auto x = vaddq_f32(a1, a2); - x = vmaxq_f32(activation_min, x); - x = vminq_f32(activation_max, x); - vst1q_f32(output_data + i, x); - } -#endif // NEON - - for (; i < size; i++) { - auto x = input1_data[i] + input2_data[i]; - output_data[i] = ActivationFunctionWithMinMax( - x, params.float_activation_min, params.float_activation_max); - } -} - -inline void Add(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const float* input1_data, - const RuntimeShape& input2_shape, const float* input2_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("Add"); - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - AddElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -// Element-wise add that can often be used for inner loop of broadcast add as -// well as the non-broadcast add. -inline void AddElementwise(int size, const ArithmeticParams& params, - const uint8* input1_data, const uint8* input2_data, - uint8* output_data) { - ruy::profiler::ScopeLabel label("AddElementwise/8bit"); - int i = 0; - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_LT(params.input2_offset, 256); -#ifdef USE_NEON - const uint8x8_t output_activation_min_vector = - vdup_n_u8(params.quantized_activation_min); - const uint8x8_t output_activation_max_vector = - vdup_n_u8(params.quantized_activation_max); - for (; i <= size - 8; i += 8) { - const uint8x8_t input1_val_original = vld1_u8(input1_data + i); - const uint8x8_t input2_val_original = vld1_u8(input2_data + i); - const int16x8_t input1_val_s16 = - vreinterpretq_s16_u16(vmovl_u8(input1_val_original)); - const int16x8_t input2_val_s16 = - vreinterpretq_s16_u16(vmovl_u8(input2_val_original)); - const int16x8_t input1_val = - vaddq_s16(input1_val_s16, vdupq_n_s16(params.input1_offset)); - const int16x8_t input2_val = - vaddq_s16(input2_val_s16, vdupq_n_s16(params.input2_offset)); - const int16x4_t input1_val_high = vget_high_s16(input1_val); - const int16x4_t input1_val_low = vget_low_s16(input1_val); - const int16x4_t input2_val_high = vget_high_s16(input2_val); - const int16x4_t input2_val_low = vget_low_s16(input2_val); - int32x4_t x11 = vmovl_s16(input1_val_low); - int32x4_t x12 = vmovl_s16(input1_val_high); - int32x4_t x21 = vmovl_s16(input2_val_low); - int32x4_t x22 = vmovl_s16(input2_val_high); - const int32x4_t left_shift_dup = vdupq_n_s32(params.left_shift); - x11 = vshlq_s32(x11, left_shift_dup); - x12 = vshlq_s32(x12, left_shift_dup); - x21 = vshlq_s32(x21, left_shift_dup); - x22 = vshlq_s32(x22, left_shift_dup); - x11 = vqrdmulhq_n_s32(x11, params.input1_multiplier); - x12 = vqrdmulhq_n_s32(x12, params.input1_multiplier); - x21 = vqrdmulhq_n_s32(x21, params.input2_multiplier); - x22 = vqrdmulhq_n_s32(x22, params.input2_multiplier); - const int32x4_t input1_shift_dup = vdupq_n_s32(params.input1_shift); - const int32x4_t input2_shift_dup = vdupq_n_s32(params.input2_shift); - x11 = vshlq_s32(x11, input1_shift_dup); - x12 = vshlq_s32(x12, input1_shift_dup); - x21 = vshlq_s32(x21, input2_shift_dup); - x22 = vshlq_s32(x22, input2_shift_dup); - int32x4_t s1 = vaddq_s32(x11, x21); - int32x4_t s2 = vaddq_s32(x12, x22); - s1 = vqrdmulhq_n_s32(s1, params.output_multiplier); - s2 = vqrdmulhq_n_s32(s2, params.output_multiplier); - using gemmlowp::RoundingDivideByPOT; - s1 = RoundingDivideByPOT(s1, -params.output_shift); - s2 = RoundingDivideByPOT(s2, -params.output_shift); - const int16x4_t s1_narrowed = vmovn_s32(s1); - const int16x4_t s2_narrowed = vmovn_s32(s2); - const int16x8_t s = vaddq_s16(vcombine_s16(s1_narrowed, s2_narrowed), - vdupq_n_s16(params.output_offset)); - const uint8x8_t clamped = - vmax_u8(output_activation_min_vector, - vmin_u8(output_activation_max_vector, vqmovun_s16(s))); - vst1_u8(output_data + i, clamped); - } -#endif // NEON - - for (; i < size; ++i) { - const int32 input1_val = params.input1_offset + input1_data[i]; - const int32 input2_val = params.input2_offset + input2_data[i]; - const int32 shifted_input1_val = input1_val * (1 << params.left_shift); - const int32 shifted_input2_val = input2_val * (1 << params.left_shift); - const int32 scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, params.input1_multiplier, params.input1_shift); - const int32 scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, params.input2_multiplier, params.input2_shift); - const int32 raw_sum = scaled_input1_val + scaled_input2_val; - const int32 raw_output = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - raw_sum, params.output_multiplier, params.output_shift) + - params.output_offset; - const int32 clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, raw_output)); - output_data[i] = static_cast(clamped_output); - } -} - -// Scalar-broadcast add that can be used for inner loop of more general -// broadcast add, so that, for example, scalar-broadcast with batch will still -// be fast. -inline void AddScalarBroadcast(int size, const ArithmeticParams& params, - uint8 input1_data, const uint8* input2_data, - uint8* output_data) { - using gemmlowp::RoundingDivideByPOT; - - ruy::profiler::ScopeLabel label("AddScalarBroadcast/8bit"); - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_LT(params.input2_offset, 256); - - int i = 0; - -#ifdef USE_NEON - const int32x4_t left_shift_dup = vdupq_n_s32(params.left_shift); - const uint8x8_t output_activation_min_vector = - vdup_n_u8(params.quantized_activation_min); - const uint8x8_t output_activation_max_vector = - vdup_n_u8(params.quantized_activation_max); - - // Process broadcast scalar. - const uint8x8_t input1_val_original = vdup_n_u8(input1_data); - const int16x8_t input1_val_s16 = - vreinterpretq_s16_u16(vmovl_u8(input1_val_original)); - const int16x8_t input1_val = - vaddq_s16(input1_val_s16, vdupq_n_s16(params.input1_offset)); - const int16x4_t input1_val_high = vget_high_s16(input1_val); - const int16x4_t input1_val_low = vget_low_s16(input1_val); - int32x4_t x11 = vmovl_s16(input1_val_low); - int32x4_t x12 = vmovl_s16(input1_val_high); - x11 = vshlq_s32(x11, left_shift_dup); - x12 = vshlq_s32(x12, left_shift_dup); - x11 = vqrdmulhq_n_s32(x11, params.input1_multiplier); - x12 = vqrdmulhq_n_s32(x12, params.input1_multiplier); - const int32x4_t input1_shift_dup = vdupq_n_s32(params.input1_shift); - x11 = vshlq_s32(x11, input1_shift_dup); - x12 = vshlq_s32(x12, input1_shift_dup); - - for (; i <= size - 8; i += 8) { - const uint8x8_t input2_val_original = vld1_u8(input2_data + i); - const int16x8_t input2_val_s16 = - vreinterpretq_s16_u16(vmovl_u8(input2_val_original)); - const int16x8_t input2_val = - vaddq_s16(input2_val_s16, vdupq_n_s16(params.input2_offset)); - const int16x4_t input2_val_high = vget_high_s16(input2_val); - const int16x4_t input2_val_low = vget_low_s16(input2_val); - int32x4_t x21 = vmovl_s16(input2_val_low); - int32x4_t x22 = vmovl_s16(input2_val_high); - x21 = vshlq_s32(x21, left_shift_dup); - x22 = vshlq_s32(x22, left_shift_dup); - x21 = vqrdmulhq_n_s32(x21, params.input2_multiplier); - x22 = vqrdmulhq_n_s32(x22, params.input2_multiplier); - const int32x4_t input2_shift_dup = vdupq_n_s32(params.input2_shift); - x21 = vshlq_s32(x21, input2_shift_dup); - x22 = vshlq_s32(x22, input2_shift_dup); - int32x4_t s1 = vaddq_s32(x11, x21); - int32x4_t s2 = vaddq_s32(x12, x22); - s1 = vqrdmulhq_n_s32(s1, params.output_multiplier); - s2 = vqrdmulhq_n_s32(s2, params.output_multiplier); - s1 = RoundingDivideByPOT(s1, -params.output_shift); - s2 = RoundingDivideByPOT(s2, -params.output_shift); - const int16x4_t s1_narrowed = vmovn_s32(s1); - const int16x4_t s2_narrowed = vmovn_s32(s2); - const int16x8_t s = vaddq_s16(vcombine_s16(s1_narrowed, s2_narrowed), - vdupq_n_s16(params.output_offset)); - const uint8x8_t clamped = - vmax_u8(output_activation_min_vector, - vmin_u8(output_activation_max_vector, vqmovun_s16(s))); - vst1_u8(output_data + i, clamped); - } -#endif // NEON - - if (i < size) { - // Process broadcast scalar. - const int32 input1_val = params.input1_offset + input1_data; - const int32 shifted_input1_val = input1_val * (1 << params.left_shift); - const int32 scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, params.input1_multiplier, params.input1_shift); - - for (; i < size; ++i) { - const int32 input2_val = params.input2_offset + input2_data[i]; - const int32 shifted_input2_val = input2_val * (1 << params.left_shift); - const int32 scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, params.input2_multiplier, - params.input2_shift); - const int32 raw_sum = scaled_input1_val + scaled_input2_val; - const int32 raw_output = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - raw_sum, params.output_multiplier, params.output_shift) + - params.output_offset; - const int32 clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, raw_output)); - output_data[i] = static_cast(clamped_output); - } - } -} - -// Scalar-broadcast add that can be used for inner loop of more general -// broadcast add, so that, for example, scalar-broadcast with batch will still -// be fast. -inline void AddScalarBroadcast(int size, const ArithmeticParams& params, - float broadcast_value, const float* input2_data, - float* output_data) { - int i = 0; -#ifdef USE_NEON - const float32x4_t output_activation_min_vector = - vdupq_n_f32(params.float_activation_min); - const float32x4_t output_activation_max_vector = - vdupq_n_f32(params.float_activation_max); - const float32x4_t broadcast_value_dup = vdupq_n_f32(broadcast_value); - for (; i <= size - 4; i += 4) { - const float32x4_t input2_val_original = vld1q_f32(input2_data + i); - - const float32x4_t output = - vaddq_f32(input2_val_original, broadcast_value_dup); - - const float32x4_t clamped = - vmaxq_f32(output_activation_min_vector, - vminq_f32(output_activation_max_vector, output)); - vst1q_f32(output_data + i, clamped); - } -#endif // NEON - - for (; i < size; ++i) { - auto x = broadcast_value + input2_data[i]; - output_data[i] = ActivationFunctionWithMinMax( - x, params.float_activation_min, params.float_activation_max); - } -} - -inline void Add(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const uint8* input1_data, - const RuntimeShape& input2_shape, const uint8* input2_data, - const RuntimeShape& output_shape, uint8* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - ruy::profiler::ScopeLabel label("Add/8bit"); - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_LT(params.input2_offset, 256); - AddElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -inline void Add(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int16* input1_data, - const RuntimeShape& input2_shape, const int16* input2_data, - const RuntimeShape& output_shape, int16* output_data) { - ruy::profiler::ScopeLabel label("Add/Int16"); - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - - const int input1_shift = params.input1_shift; - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - const int16 output_activation_min = params.quantized_activation_min; - const int16 output_activation_max = params.quantized_activation_max; - - TFLITE_DCHECK(input1_shift == 0 || params.input2_shift == 0); - TFLITE_DCHECK_LE(input1_shift, 0); - TFLITE_DCHECK_LE(params.input2_shift, 0); - const int16* not_shift_input = input1_shift == 0 ? input1_data : input2_data; - const int16* shift_input = input1_shift == 0 ? input2_data : input1_data; - const int input_right_shift = - input1_shift == 0 ? -params.input2_shift : -input1_shift; - - for (int i = 0; i < flat_size; i++) { - // F0 uses 0 integer bits, range [-1, 1]. - using F0 = gemmlowp::FixedPoint; - - F0 input_ready_scaled = F0::FromRaw(not_shift_input[i]); - F0 scaled_input = F0::FromRaw( - gemmlowp::RoundingDivideByPOT(shift_input[i], input_right_shift)); - F0 result = gemmlowp::SaturatingAdd(scaled_input, input_ready_scaled); - const int16 raw_output = result.raw(); - const int16 clamped_output = std::min( - output_activation_max, std::max(output_activation_min, raw_output)); - output_data[i] = clamped_output; - } -} - -inline void Add(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int32* input1_data, - const RuntimeShape& input2_shape, const int32* input2_data, - const RuntimeShape& output_shape, int32* output_data) { - ruy::profiler::ScopeLabel label("Add/int32"); - - auto input1_map = MapAsVector(input1_data, input1_shape); - auto input2_map = MapAsVector(input2_data, input2_shape); - auto output_map = MapAsVector(output_data, output_shape); - if (input1_shape == input2_shape) { - output_map.array() = input1_map.array() + input2_map.array(); - } else if (input2_shape.FlatSize() == 1) { - auto scalar = input2_data[0]; - output_map.array() = input1_map.array() + scalar; - } else if (input1_shape.FlatSize() == 1) { - auto scalar = input1_data[0]; - output_map.array() = scalar + input2_map.array(); - } else { - reference_ops::BroadcastAdd4DSlow(params, input1_shape, input1_data, - input2_shape, input2_data, output_shape, - output_data); - return; - } - output_map = output_map.cwiseMax(params.quantized_activation_min); - output_map = output_map.cwiseMin(params.quantized_activation_max); -} - -template -inline void BroadcastAddDispatch( - const ArithmeticParams& params, const RuntimeShape& input1_shape, - const T* input1_data, const RuntimeShape& input2_shape, - const T* input2_data, const RuntimeShape& output_shape, T* output_data) { - if (params.broadcast_category == BroadcastableOpCategory::kGenericBroadcast) { - return BroadcastAdd4DSlow(params, input1_shape, input1_data, input2_shape, - input2_data, output_shape, output_data); - } - - BinaryBroadcastFiveFold( - params, input1_shape, input1_data, input2_shape, input2_data, - output_shape, output_data, - static_cast(AddElementwise), - static_cast( - AddScalarBroadcast)); -} - -inline void BroadcastAddFivefold(const ArithmeticParams& unswitched_params, - const RuntimeShape& unswitched_input1_shape, - const uint8* unswitched_input1_data, - const RuntimeShape& unswitched_input2_shape, - const uint8* unswitched_input2_data, - const RuntimeShape& output_shape, - uint8* output_data) { - BroadcastAddDispatch(unswitched_params, unswitched_input1_shape, - unswitched_input1_data, unswitched_input2_shape, - unswitched_input2_data, output_shape, output_data); -} - -inline void BroadcastAddFivefold(const ArithmeticParams& params, - const RuntimeShape& unswitched_input1_shape, - const float* unswitched_input1_data, - const RuntimeShape& unswitched_input2_shape, - const float* unswitched_input2_data, - const RuntimeShape& output_shape, - float* output_data) { - BroadcastAddDispatch(params, unswitched_input1_shape, unswitched_input1_data, - unswitched_input2_shape, unswitched_input2_data, - output_shape, output_data); -} - -inline void MulElementwise(int size, const ArithmeticParams& params, - const float* input1_data, const float* input2_data, - float* output_data) { - const float output_activation_min = params.float_activation_min; - const float output_activation_max = params.float_activation_max; - - int i = 0; -#ifdef USE_NEON - const auto activation_min = vdupq_n_f32(output_activation_min); - const auto activation_max = vdupq_n_f32(output_activation_max); - for (; i <= size - 16; i += 16) { - auto a10 = vld1q_f32(input1_data + i); - auto a11 = vld1q_f32(input1_data + i + 4); - auto a12 = vld1q_f32(input1_data + i + 8); - auto a13 = vld1q_f32(input1_data + i + 12); - auto a20 = vld1q_f32(input2_data + i); - auto a21 = vld1q_f32(input2_data + i + 4); - auto a22 = vld1q_f32(input2_data + i + 8); - auto a23 = vld1q_f32(input2_data + i + 12); - auto x0 = vmulq_f32(a10, a20); - auto x1 = vmulq_f32(a11, a21); - auto x2 = vmulq_f32(a12, a22); - auto x3 = vmulq_f32(a13, a23); - - x0 = vmaxq_f32(activation_min, x0); - x1 = vmaxq_f32(activation_min, x1); - x2 = vmaxq_f32(activation_min, x2); - x3 = vmaxq_f32(activation_min, x3); - x0 = vminq_f32(activation_max, x0); - x1 = vminq_f32(activation_max, x1); - x2 = vminq_f32(activation_max, x2); - x3 = vminq_f32(activation_max, x3); - - vst1q_f32(output_data + i, x0); - vst1q_f32(output_data + i + 4, x1); - vst1q_f32(output_data + i + 8, x2); - vst1q_f32(output_data + i + 12, x3); - } - for (; i <= size - 4; i += 4) { - auto a1 = vld1q_f32(input1_data + i); - auto a2 = vld1q_f32(input2_data + i); - auto x = vmulq_f32(a1, a2); - - x = vmaxq_f32(activation_min, x); - x = vminq_f32(activation_max, x); - - vst1q_f32(output_data + i, x); - } -#endif // NEON - - for (; i < size; i++) { - auto x = input1_data[i] * input2_data[i]; - output_data[i] = ActivationFunctionWithMinMax(x, output_activation_min, - output_activation_max); - } -} - -inline void Mul(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const float* input1_data, - const RuntimeShape& input2_shape, const float* input2_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("Mul"); - - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - MulElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -inline void Mul(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int32* input1_data, - const RuntimeShape& input2_shape, const int32* input2_data, - const RuntimeShape& output_shape, int32* output_data) { - ruy::profiler::ScopeLabel label("Mul/int32/activation"); - - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - const int32 output_activation_min = params.quantized_activation_min; - const int32 output_activation_max = params.quantized_activation_max; - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax( - input1_data[i] * input2_data[i], output_activation_min, - output_activation_max); - } -} - -inline void MulNoActivation(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const int32* input1_data, - const RuntimeShape& input2_shape, - const int32* input2_data, - const RuntimeShape& output_shape, - int32* output_data) { - ruy::profiler::ScopeLabel label("Mul/int32"); - - auto input1_map = MapAsVector(input1_data, input1_shape); - auto input2_map = MapAsVector(input2_data, input2_shape); - auto output_map = MapAsVector(output_data, output_shape); - if (input1_shape == input2_shape) { - output_map.array() = input1_map.array() * input2_map.array(); - } else if (input2_shape.FlatSize() == 1) { - auto scalar = input2_data[0]; - output_map.array() = input1_map.array() * scalar; - } else if (input1_shape.FlatSize() == 1) { - auto scalar = input1_data[0]; - output_map.array() = scalar * input2_map.array(); - } else { - reference_ops::BroadcastMul4DSlow(params, input1_shape, input1_data, - input2_shape, input2_data, output_shape, - output_data); - } -} - -inline void Mul(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int16* input1_data, - const RuntimeShape& input2_shape, const int16* input2_data, - const RuntimeShape& output_shape, int16* output_data) { - ruy::profiler::ScopeLabel label("Mul/Int16/NoActivation"); - // This is a copy of the reference implementation. We do not currently have a - // properly optimized version. - - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - // F0 uses 0 integer bits, range [-1, 1]. - using F0 = gemmlowp::FixedPoint; - - F0 unclamped_result = - F0::FromRaw(input1_data[i]) * F0::FromRaw(input2_data[i]); - output_data[i] = unclamped_result.raw(); - } -} - -inline void Mul(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int16* input1_data, - const RuntimeShape& input2_shape, const int16* input2_data, - const RuntimeShape& output_shape, uint8* output_data) { - ruy::profiler::ScopeLabel label("Mul/Int16Uint8"); - // This is a copy of the reference implementation. We do not currently have a - // properly optimized version. - const int32 output_activation_min = params.quantized_activation_min; - const int32 output_activation_max = params.quantized_activation_max; - const int32 output_offset = params.output_offset; - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - // F0 uses 0 integer bits, range [-1, 1]. - using F0 = gemmlowp::FixedPoint; - - F0 unclamped_result = - F0::FromRaw(input1_data[i]) * F0::FromRaw(input2_data[i]); - int16 rescaled_result = - gemmlowp::RoundingDivideByPOT(unclamped_result.raw(), 8); - int16 clamped_result = - std::min(output_activation_max - output_offset, rescaled_result); - clamped_result = - std::max(output_activation_min - output_offset, clamped_result); - output_data[i] = output_offset + clamped_result; - } -} - -// Element-wise mul that can often be used for inner loop of broadcast Mul as -// well as the non-broadcast Mul. -inline void MulElementwise(int size, const ArithmeticParams& params, - const uint8* input1_data, const uint8* input2_data, - uint8* output_data) { - int i = 0; - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input2_offset, 256); - TFLITE_DCHECK_GT(params.output_offset, -256); - TFLITE_DCHECK_LT(params.output_offset, 256); -#ifdef USE_NEON - const auto input1_offset_vector = vdupq_n_s16(params.input1_offset); - const auto input2_offset_vector = vdupq_n_s16(params.input2_offset); - const auto output_offset_vector = vdupq_n_s16(params.output_offset); - const auto output_activation_min_vector = - vdup_n_u8(params.quantized_activation_min); - const auto output_activation_max_vector = - vdup_n_u8(params.quantized_activation_max); - const int left_shift = std::max(0, params.output_shift); - const int right_shift = std::max(0, -params.output_shift); - const int32x4_t left_shift_vec = vdupq_n_s32(left_shift); - for (; i <= size - 8; i += 8) { - // We load / store 8 at a time, multiplying as two sets of 4 int32s. - const auto input1_val_original = vld1_u8(input1_data + i); - const auto input2_val_original = vld1_u8(input2_data + i); - const auto input1_val_s16 = - vreinterpretq_s16_u16(vmovl_u8(input1_val_original)); - const auto input2_val_s16 = - vreinterpretq_s16_u16(vmovl_u8(input2_val_original)); - const auto input1_val = vaddq_s16(input1_val_s16, input1_offset_vector); - const auto input2_val = vaddq_s16(input2_val_s16, input2_offset_vector); - - const auto input1_val_low = vget_low_s16(input1_val); - const auto input1_val_high = vget_high_s16(input1_val); - const auto input2_val_low = vget_low_s16(input2_val); - const auto input2_val_high = vget_high_s16(input2_val); - - auto p1 = vmull_s16(input2_val_low, input1_val_low); - auto p2 = vmull_s16(input2_val_high, input1_val_high); - - p1 = vshlq_s32(p1, left_shift_vec); - p2 = vshlq_s32(p2, left_shift_vec); - p1 = vqrdmulhq_n_s32(p1, params.output_multiplier); - p2 = vqrdmulhq_n_s32(p2, params.output_multiplier); - using gemmlowp::RoundingDivideByPOT; - p1 = RoundingDivideByPOT(p1, right_shift); - p2 = RoundingDivideByPOT(p2, right_shift); - - const auto p1_narrowed = vqmovn_s32(p1); - const auto p2_narrowed = vqmovn_s32(p2); - const auto p = - vaddq_s16(vcombine_s16(p1_narrowed, p2_narrowed), output_offset_vector); - const auto clamped = - vmax_u8(output_activation_min_vector, - vmin_u8(output_activation_max_vector, vqmovun_s16(p))); - vst1_u8(output_data + i, clamped); - } -#endif // NEON - - for (; i < size; ++i) { - const int32 input1_val = params.input1_offset + input1_data[i]; - const int32 input2_val = params.input2_offset + input2_data[i]; - const int32 unclamped_result = - params.output_offset + - MultiplyByQuantizedMultiplier(input1_val * input2_val, - params.output_multiplier, - params.output_shift); - const int32 clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, unclamped_result)); - output_data[i] = static_cast(clamped_output); - } -} - -// Broadcast mul that can often be used for inner loop of broadcast Mul. -inline void MulSimpleBroadcast(int size, const ArithmeticParams& params, - const uint8 broadcast_value, - const uint8* input2_data, uint8* output_data) { - const int16 input1_val = params.input1_offset + broadcast_value; - - int i = 0; - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input2_offset, 256); - TFLITE_DCHECK_GT(params.output_offset, -256); - TFLITE_DCHECK_LT(params.output_offset, 256); -#ifdef USE_NEON - const auto input2_offset_vector = vdupq_n_s16(params.input2_offset); - const auto output_offset_vector = vdupq_n_s16(params.output_offset); - const auto output_activation_min_vector = - vdup_n_u8(params.quantized_activation_min); - const auto output_activation_max_vector = - vdup_n_u8(params.quantized_activation_max); - const int left_shift = std::max(0, params.output_shift); - const int right_shift = std::max(0, -params.output_shift); - const int32x4_t left_shift_vec = vdupq_n_s32(left_shift); - for (; i <= size - 8; i += 8) { - // We load / store 8 at a time, multiplying as two sets of 4 int32s. - const auto input2_val_original = vld1_u8(input2_data + i); - const auto input2_val_s16 = - vreinterpretq_s16_u16(vmovl_u8(input2_val_original)); - const auto input2_val = vaddq_s16(input2_val_s16, input2_offset_vector); - - const auto input2_val_low = vget_low_s16(input2_val); - const auto input2_val_high = vget_high_s16(input2_val); - - auto p1 = vmull_n_s16(input2_val_low, input1_val); - auto p2 = vmull_n_s16(input2_val_high, input1_val); - - p1 = vshlq_s32(p1, left_shift_vec); - p2 = vshlq_s32(p2, left_shift_vec); - p1 = vqrdmulhq_n_s32(p1, params.output_multiplier); - p2 = vqrdmulhq_n_s32(p2, params.output_multiplier); - using gemmlowp::RoundingDivideByPOT; - p1 = RoundingDivideByPOT(p1, right_shift); - p2 = RoundingDivideByPOT(p2, right_shift); - - const auto p1_narrowed = vmovn_s32(p1); - const auto p2_narrowed = vmovn_s32(p2); - const auto p = - vaddq_s16(vcombine_s16(p1_narrowed, p2_narrowed), output_offset_vector); - const auto clamped = - vmax_u8(output_activation_min_vector, - vmin_u8(output_activation_max_vector, vqmovun_s16(p))); - vst1_u8(output_data + i, clamped); - } -#endif // NEON - - for (; i < size; ++i) { - const int32 input2_val = params.input2_offset + input2_data[i]; - const int32 unclamped_result = - params.output_offset + - MultiplyByQuantizedMultiplier(input1_val * input2_val, - params.output_multiplier, - params.output_shift); - const int32 clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, unclamped_result)); - output_data[i] = static_cast(clamped_output); - } -} - -// Broadcast mul that can often be used for inner loop of broadcast Mul. -// This function will handle scalar_value (LHS) * vector_values (RHS). -// Since it's a float function, input params does not matter here. -inline void MulSimpleBroadcast(int size, const ArithmeticParams& params, - const float broadcast_value, - const float* input2_data, float* output_data) { - int i = 0; -#ifdef USE_NEON - const float32x4_t output_activation_min_vector = - vdupq_n_f32(params.float_activation_min); - const float32x4_t output_activation_max_vector = - vdupq_n_f32(params.float_activation_max); - const float32x4_t broadcast_value_dup = vdupq_n_f32(broadcast_value); - for (; i <= size - 4; i += 4) { - const float32x4_t input2_val_original = vld1q_f32(input2_data + i); - - const float32x4_t output = - vmulq_f32(input2_val_original, broadcast_value_dup); - - const float32x4_t clamped = - vmaxq_f32(output_activation_min_vector, - vminq_f32(output_activation_max_vector, output)); - vst1q_f32(output_data + i, clamped); - } -#endif // NEON - - for (; i < size; ++i) { - float x = broadcast_value * input2_data[i]; - output_data[i] = ActivationFunctionWithMinMax( - x, params.float_activation_min, params.float_activation_max); - } -} - -inline void Mul(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const uint8* input1_data, - const RuntimeShape& input2_shape, const uint8* input2_data, - const RuntimeShape& output_shape, uint8* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - ruy::profiler::ScopeLabel label("Mul/8bit"); - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - MulElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -template -inline void BroadcastMulDispatch( - const ArithmeticParams& params, const RuntimeShape& input1_shape, - const T* input1_data, const RuntimeShape& input2_shape, - const T* input2_data, const RuntimeShape& output_shape, T* output_data) { - if (params.broadcast_category == BroadcastableOpCategory::kGenericBroadcast) { - return BroadcastMul4DSlow(params, input1_shape, input1_data, input2_shape, - input2_data, output_shape, output_data); - } - - BinaryBroadcastFiveFold( - params, input1_shape, input1_data, input2_shape, input2_data, - output_shape, output_data, - static_cast(MulElementwise), - static_cast( - MulSimpleBroadcast)); -} - -inline void BroadcastMulFivefold(const ArithmeticParams& unswitched_params, - const RuntimeShape& unswitched_input1_shape, - const uint8* unswitched_input1_data, - const RuntimeShape& unswitched_input2_shape, - const uint8* unswitched_input2_data, - const RuntimeShape& output_shape, - uint8* output_data) { - BroadcastMulDispatch(unswitched_params, unswitched_input1_shape, - unswitched_input1_data, unswitched_input2_shape, - unswitched_input2_data, output_shape, output_data); -} - -inline void BroadcastMulFivefold(const ArithmeticParams& params, - const RuntimeShape& unswitched_input1_shape, - const float* unswitched_input1_data, - const RuntimeShape& unswitched_input2_shape, - const float* unswitched_input2_data, - const RuntimeShape& output_shape, - float* output_data) { - BroadcastMulDispatch(params, unswitched_input1_shape, unswitched_input1_data, - unswitched_input2_shape, unswitched_input2_data, - output_shape, output_data); -} - -// TODO(jiawen): We can implement BroadcastDiv on buffers of arbitrary -// dimensionality if the runtime code does a single loop over one dimension -// that handles broadcasting as the base case. The code generator would then -// generate max(D1, D2) nested for loops. -// TODO(benoitjacob): BroadcastDiv is intentionally duplicated from -// reference_ops.h. Once an optimized version is implemented and NdArrayDesc -// is no longer referenced in this file, move NdArrayDesc from types.h to -// reference_ops.h. -template -void BroadcastDivSlow(const ArithmeticParams& params, - const RuntimeShape& unextended_input1_shape, - const T* input1_data, - const RuntimeShape& unextended_input2_shape, - const T* input2_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - ruy::profiler::ScopeLabel label("BroadcastDivSlow"); - T output_activation_min; - T output_activation_max; - GetActivationParams(params, &output_activation_min, &output_activation_max); - - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(unextended_input2_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), N); - - NdArrayDesc desc1; - NdArrayDesc desc2; - NdArrayDesc output_desc; - NdArrayDescsForElementwiseBroadcast(unextended_input1_shape, - unextended_input2_shape, &desc1, &desc2); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, unextended_output_shape), - &output_desc); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - auto div_func = [&](int indexes[N]) { - output_data[SubscriptToIndex(output_desc, indexes)] = - ActivationFunctionWithMinMax( - input1_data[SubscriptToIndex(desc1, indexes)] / - input2_data[SubscriptToIndex(desc2, indexes)], - output_activation_min, output_activation_max); - }; - NDOpsHelper(output_desc, div_func); -} - -// TODO: BroadcastDiv is intentionally duplicated from reference_ops.h. -// For more details see the comment above the generic version of -// BroadcastDivSlow. -template -inline void BroadcastDivSlow(const ArithmeticParams& params, - const RuntimeShape& unextended_input1_shape, - const uint8* input1_data, - const RuntimeShape& unextended_input2_shape, - const uint8* input2_data, - const RuntimeShape& unextended_output_shape, - uint8* output_data) { - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(unextended_input2_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), N); - - NdArrayDesc desc1; - NdArrayDesc desc2; - NdArrayDesc output_desc; - NdArrayDescsForElementwiseBroadcast(unextended_input1_shape, - unextended_input2_shape, &desc1, &desc2); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, unextended_output_shape), - &output_desc); - - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input2_offset, 256); - TFLITE_DCHECK_GT(params.output_offset, -256); - TFLITE_DCHECK_LT(params.output_offset, 256); - - auto div_func = [&](int indexes[N]) { - const int32 input1_val = - params.input1_offset + input1_data[SubscriptToIndex(desc1, indexes)]; - const int32 input2_val = - params.input2_offset + input2_data[SubscriptToIndex(desc2, indexes)]; - TFLITE_DCHECK_NE(input2_val, 0); - int recip_shift; - const int32 input2_inv = - (input2_val > 0) ? GetReciprocal(input2_val, 31, &recip_shift) - : -GetReciprocal(-input2_val, 31, &recip_shift); - const int headroom = CountLeadingSignBits(input1_val); - const int32 unscaled_quotient = MultiplyByQuantizedMultiplierGreaterThanOne( - input1_val, input2_inv, headroom); - const int total_shift = params.output_shift - recip_shift - headroom; - const int32 unclamped_result = - params.output_offset + - MultiplyByQuantizedMultiplierSmallerThanOneExp( - unscaled_quotient, params.output_multiplier, total_shift); - const int32 clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, unclamped_result)); - output_data[SubscriptToIndex(output_desc, indexes)] = - static_cast(clamped_output); - }; - NDOpsHelper(output_desc, div_func); -} - -// TODO(aselle): This is not actually optimized yet. -inline void SubNonBroadcast(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const float* input1_data, - const RuntimeShape& input2_shape, - const float* input2_data, - const RuntimeShape& output_shape, - float* output_data) { - ruy::profiler::ScopeLabel label("SubNonBroadcast"); - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax( - input1_data[i] - input2_data[i], params.float_activation_min, - params.float_activation_max); - } -} - -inline void SetActivationMinMax(const ArithmeticParams& params, - int32* activation_min, int32* activation_max) { - *activation_min = params.quantized_activation_min; - *activation_max = params.quantized_activation_max; -} - -inline void SetActivationMinMax(const ArithmeticParams& params, - float* activation_min, float* activation_max) { - *activation_min = params.float_activation_min; - *activation_max = params.float_activation_max; -} - -inline void SetActivationMinMax(const ArithmeticParams& params, - int64_t* activation_min, - int64_t* activation_max) { - *activation_min = params.int64_activation_min; - *activation_max = params.int64_activation_max; -} - -template -inline void SubWithActivation( - const ArithmeticParams& params, const RuntimeShape& input1_shape, - const T* input1_data, const RuntimeShape& input2_shape, - const T* input2_data, const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("SubWithActivation_optimized"); - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - T activation_min, activation_max; - SetActivationMinMax(params, &activation_min, &activation_max); - - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax( - input1_data[i] - input2_data[i], activation_min, activation_max); - } -} - -template -void Sub(const ArithmeticParams& params, const RuntimeShape& input1_shape, - const T* input1_data, const RuntimeShape& input2_shape, - const T* input2_data, const RuntimeShape& output_shape, - T* output_data) { - ruy::profiler::ScopeLabel label("Sub"); - - auto input1_map = MapAsVector(input1_data, input1_shape); - auto input2_map = MapAsVector(input2_data, input2_shape); - auto output_map = MapAsVector(output_data, output_shape); - if (input1_shape == input2_shape) { - output_map.array() = input1_map.array() - input2_map.array(); - } else if (input1_shape.FlatSize() == 1) { - auto scalar = input1_data[0]; - output_map.array() = scalar - input2_map.array(); - } else if (input2_shape.FlatSize() == 1) { - auto scalar = input2_data[0]; - output_map.array() = input1_map.array() - scalar; - } else { - BroadcastSubSlow(params, input1_shape, input1_data, input2_shape, - input2_data, output_shape, output_data); - } -} - -inline void LstmCell( - const LstmCellParams& params, const RuntimeShape& unextended_input_shape, - const float* input_data, const RuntimeShape& unextended_prev_activ_shape, - const float* prev_activ_data, const RuntimeShape& weights_shape, - const float* weights_data, const RuntimeShape& unextended_bias_shape, - const float* bias_data, const RuntimeShape& unextended_prev_state_shape, - const float* prev_state_data, - const RuntimeShape& unextended_output_state_shape, float* output_state_data, - const RuntimeShape& unextended_output_activ_shape, float* output_activ_data, - const RuntimeShape& unextended_concat_temp_shape, float* concat_temp_data, - const RuntimeShape& unextended_activ_temp_shape, float* activ_temp_data, - CpuBackendContext* cpu_backend_context) { - ruy::profiler::ScopeLabel label("LstmCell"); - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_prev_activ_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_bias_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_prev_state_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_state_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_activ_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_concat_temp_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_activ_temp_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape prev_activ_shape = - RuntimeShape::ExtendedShape(4, unextended_prev_activ_shape); - const RuntimeShape bias_shape = - RuntimeShape::ExtendedShape(4, unextended_bias_shape); - const RuntimeShape prev_state_shape = - RuntimeShape::ExtendedShape(4, unextended_prev_state_shape); - const RuntimeShape output_state_shape = - RuntimeShape::ExtendedShape(4, unextended_output_state_shape); - const RuntimeShape output_activ_shape = - RuntimeShape::ExtendedShape(4, unextended_output_activ_shape); - const RuntimeShape concat_temp_shape = - RuntimeShape::ExtendedShape(4, unextended_concat_temp_shape); - const RuntimeShape activ_temp_shape = - RuntimeShape::ExtendedShape(4, unextended_activ_temp_shape); - TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2); - - const int weights_dim_count = weights_shape.DimensionsCount(); - MatchingDim( // batches - input_shape, 0, prev_activ_shape, 0, prev_state_shape, 0, - output_state_shape, 0, output_activ_shape, 0); - MatchingDim( // height - input_shape, 1, prev_activ_shape, 1, prev_state_shape, 1, - output_state_shape, 1, output_activ_shape, 1); - MatchingDim( // width - input_shape, 2, prev_activ_shape, 2, prev_state_shape, 2, - output_state_shape, 2, output_activ_shape, 2); - const int input_depth = input_shape.Dims(3); - const int prev_activ_depth = prev_activ_shape.Dims(3); - const int total_input_depth = prev_activ_depth + input_depth; - TFLITE_DCHECK_EQ(weights_shape.Dims(weights_dim_count - 1), - total_input_depth); - TFLITE_DCHECK_EQ(FlatSizeSkipDim(bias_shape, 3), 1); - const int intern_activ_depth = - MatchingDim(weights_shape, weights_dim_count - 2, bias_shape, 3); - TFLITE_DCHECK_EQ(weights_shape.FlatSize(), - intern_activ_depth * total_input_depth); - TFLITE_DCHECK_EQ(intern_activ_depth % 4, 0); - const int output_depth = - MatchingDim(prev_state_shape, 3, prev_activ_shape, 3, output_state_shape, - 3, output_activ_shape, 3); - TFLITE_DCHECK_EQ(output_depth, intern_activ_depth / 4); - - // Concatenate prev_activ and input data together - std::vector concat_input_arrays_data; - std::vector concat_input_arrays_shapes; - concat_input_arrays_data.push_back(input_data); - concat_input_arrays_data.push_back(prev_activ_data); - concat_input_arrays_shapes.push_back(&input_shape); - concat_input_arrays_shapes.push_back(&prev_activ_shape); - tflite::ConcatenationParams concat_params; - concat_params.axis = 3; - concat_params.inputs_count = concat_input_arrays_data.size(); - Concatenation(concat_params, &(concat_input_arrays_shapes[0]), - &(concat_input_arrays_data[0]), concat_temp_shape, - concat_temp_data); - - // Fully connected - tflite::FullyConnectedParams fc_params; - fc_params.float_activation_min = std::numeric_limits::lowest(); - fc_params.float_activation_max = std::numeric_limits::max(); - fc_params.lhs_cacheable = false; - fc_params.rhs_cacheable = false; - FullyConnected(fc_params, concat_temp_shape, concat_temp_data, weights_shape, - weights_data, bias_shape, bias_data, activ_temp_shape, - activ_temp_data, cpu_backend_context); - - // Map raw arrays to Eigen arrays so we can use Eigen's optimized array - // operations. - ArrayMap activ_temp_map = - MapAsArrayWithLastDimAsRows(activ_temp_data, activ_temp_shape); - auto input_gate_sm = activ_temp_map.block(0 * output_depth, 0, output_depth, - activ_temp_map.cols()); - auto new_input_sm = activ_temp_map.block(1 * output_depth, 0, output_depth, - activ_temp_map.cols()); - auto forget_gate_sm = activ_temp_map.block(2 * output_depth, 0, output_depth, - activ_temp_map.cols()); - auto output_gate_sm = activ_temp_map.block(3 * output_depth, 0, output_depth, - activ_temp_map.cols()); - ArrayMap prev_state_map = - MapAsArrayWithLastDimAsRows(prev_state_data, prev_state_shape); - ArrayMap output_state_map = - MapAsArrayWithLastDimAsRows(output_state_data, output_state_shape); - ArrayMap output_activ_map = - MapAsArrayWithLastDimAsRows(output_activ_data, output_activ_shape); - - // Combined memory state and final output calculation - ruy::profiler::ScopeLabel label2("MemoryStateAndFinalOutput"); - output_state_map = - input_gate_sm.unaryExpr(Eigen::internal::scalar_logistic_op()) * - new_input_sm.tanh() + - forget_gate_sm.unaryExpr(Eigen::internal::scalar_logistic_op()) * - prev_state_map; - output_activ_map = - output_gate_sm.unaryExpr(Eigen::internal::scalar_logistic_op()) * - output_state_map.tanh(); -} - -template -inline void LstmCell( - const LstmCellParams& params, const RuntimeShape& unextended_input_shape, - const uint8* input_data_uint8, - const RuntimeShape& unextended_prev_activ_shape, - const uint8* prev_activ_data_uint8, const RuntimeShape& weights_shape, - const uint8* weights_data_uint8, const RuntimeShape& unextended_bias_shape, - const int32* bias_data_int32, - const RuntimeShape& unextended_prev_state_shape, - const int16* prev_state_data_int16, - const RuntimeShape& unextended_output_state_shape, - int16* output_state_data_int16, - const RuntimeShape& unextended_output_activ_shape, - uint8* output_activ_data_uint8, - const RuntimeShape& unextended_concat_temp_shape, - uint8* concat_temp_data_uint8, - const RuntimeShape& unextended_activ_temp_shape, - int16* activ_temp_data_int16, CpuBackendContext* cpu_backend_context) { - ruy::profiler::ScopeLabel label( - "LstmCell/quantized (8bit external, 16bit internal)"); - int32 weights_zero_point = params.weights_zero_point; - int32 accum_multiplier = params.accum_multiplier; - int accum_shift = params.accum_shift; - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_prev_activ_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_bias_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_prev_state_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_state_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_activ_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_concat_temp_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_activ_temp_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape prev_activ_shape = - RuntimeShape::ExtendedShape(4, unextended_prev_activ_shape); - const RuntimeShape bias_shape = - RuntimeShape::ExtendedShape(4, unextended_bias_shape); - const RuntimeShape prev_state_shape = - RuntimeShape::ExtendedShape(4, unextended_prev_state_shape); - const RuntimeShape output_state_shape = - RuntimeShape::ExtendedShape(4, unextended_output_state_shape); - const RuntimeShape output_activ_shape = - RuntimeShape::ExtendedShape(4, unextended_output_activ_shape); - const RuntimeShape concat_temp_shape = - RuntimeShape::ExtendedShape(4, unextended_concat_temp_shape); - const RuntimeShape activ_temp_shape = - RuntimeShape::ExtendedShape(4, unextended_activ_temp_shape); - TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2); - - // Gather dimensions information, and perform consistency checks. - const int weights_dim_count = weights_shape.DimensionsCount(); - const int outer_size = MatchingFlatSizeSkipDim( - input_shape, 3, prev_activ_shape, prev_state_shape, output_state_shape, - output_activ_shape); - const int input_depth = input_shape.Dims(3); - const int prev_activ_depth = prev_activ_shape.Dims(3); - const int total_input_depth = prev_activ_depth + input_depth; - TFLITE_DCHECK_EQ(weights_shape.Dims(weights_dim_count - 1), - total_input_depth); - const int intern_activ_depth = - MatchingDim(weights_shape, weights_dim_count - 2, bias_shape, 3); - TFLITE_DCHECK_EQ(weights_shape.FlatSize(), - intern_activ_depth * total_input_depth); - TFLITE_DCHECK_EQ(FlatSizeSkipDim(bias_shape, 3), 1); - TFLITE_DCHECK_EQ(intern_activ_depth % 4, 0); - const int output_depth = - MatchingDim(prev_state_shape, 3, prev_activ_shape, 3, output_state_shape, - 3, output_activ_shape, 3); - TFLITE_DCHECK_EQ(output_depth, intern_activ_depth / 4); - const int fc_batches = FlatSizeSkipDim(activ_temp_shape, 3); - const int fc_output_depth = - MatchingDim(weights_shape, weights_dim_count - 2, activ_temp_shape, 3); - const int fc_accum_depth = total_input_depth; - TFLITE_DCHECK_EQ(fc_output_depth, 4 * output_depth); - - // Depth-concatenate prev_activ and input data together. - uint8 const* concat_input_arrays_data[2] = {input_data_uint8, - prev_activ_data_uint8}; - const RuntimeShape* concat_input_arrays_shapes[2] = {&input_shape, - &prev_activ_shape}; - tflite::ConcatenationParams concat_params; - concat_params.axis = 3; - concat_params.inputs_count = 2; - Concatenation(concat_params, concat_input_arrays_shapes, - concat_input_arrays_data, concat_temp_shape, - concat_temp_data_uint8); - - // Implementation of the fully connected node inside the LSTM cell. - // The operands are 8-bit integers, the accumulators are internally 32bit - // integers, and the output is 16-bit fixed-point with 3 integer bits so - // the output range is [-2^3, 2^3] == [-8, 8]. The rationale for that - // is explained in the function comment above. - cpu_backend_gemm::MatrixParams lhs_params; - lhs_params.rows = fc_output_depth; - lhs_params.cols = fc_accum_depth; - lhs_params.order = cpu_backend_gemm::Order::kRowMajor; - lhs_params.zero_point = weights_zero_point; - cpu_backend_gemm::MatrixParams rhs_params; - rhs_params.rows = fc_accum_depth; - rhs_params.cols = fc_batches; - rhs_params.order = cpu_backend_gemm::Order::kColMajor; - rhs_params.zero_point = 128; - cpu_backend_gemm::MatrixParams dst_params; - dst_params.rows = fc_output_depth; - dst_params.cols = fc_batches; - dst_params.order = cpu_backend_gemm::Order::kColMajor; - dst_params.zero_point = 0; - cpu_backend_gemm::GemmParams gemm_params; - gemm_params.bias = bias_data_int32; - gemm_params.multiplier_fixedpoint = accum_multiplier; - gemm_params.multiplier_exponent = accum_shift; - cpu_backend_gemm::Gemm( - lhs_params, weights_data_uint8, rhs_params, concat_temp_data_uint8, - dst_params, activ_temp_data_int16, gemm_params, cpu_backend_context); - - // Rest of the LSTM cell: tanh and logistic math functions, and some adds - // and muls, all done in 16-bit fixed-point. - const int16* input_gate_input_ptr = activ_temp_data_int16; - const int16* input_modulation_gate_input_ptr = - activ_temp_data_int16 + output_depth; - const int16* forget_gate_input_ptr = activ_temp_data_int16 + 2 * output_depth; - const int16* output_gate_input_ptr = activ_temp_data_int16 + 3 * output_depth; - const int16* prev_state_ptr = prev_state_data_int16; - int16* output_state_data_ptr = output_state_data_int16; - uint8* output_activ_data_ptr = output_activ_data_uint8; - - for (int b = 0; b < outer_size; ++b) { - int c = 0; -#ifdef GEMMLOWP_NEON - for (; c <= output_depth - 8; c += 8) { - // Define the fixed-point data types that we will use here. All use - // int16 as the underlying integer type i.e. all are 16-bit fixed-point. - // They only differ by the number of integral vs. fractional bits, - // determining the range of values that they can represent. - // - // F0 uses 0 integer bits, range [-1, 1]. - // This is the return type of math functions such as tanh, logistic, - // whose range is in [-1, 1]. - using F0 = gemmlowp::FixedPoint; - // F3 uses 3 integer bits, range [-8, 8]. - // This is the range of the previous fully-connected node's output, - // which is our input here. - using F3 = gemmlowp::FixedPoint; - // FS uses StateIntegerBits integer bits, range [-2^StateIntegerBits, - // 2^StateIntegerBits]. It's used to represent the internal state, whose - // number of integer bits is currently dictated by the model. See comment - // on the StateIntegerBits template parameter above. - using FS = gemmlowp::FixedPoint; - // Implementation of input gate, using fixed-point logistic function. - F3 input_gate_input = F3::FromRaw(vld1q_s16(input_gate_input_ptr)); - input_gate_input_ptr += 8; - F0 input_gate_output = gemmlowp::logistic(input_gate_input); - // Implementation of input modulation gate, using fixed-point tanh - // function. - F3 input_modulation_gate_input = - F3::FromRaw(vld1q_s16(input_modulation_gate_input_ptr)); - input_modulation_gate_input_ptr += 8; - F0 input_modulation_gate_output = - gemmlowp::tanh(input_modulation_gate_input); - // Implementation of forget gate, using fixed-point logistic function. - F3 forget_gate_input = F3::FromRaw(vld1q_s16(forget_gate_input_ptr)); - forget_gate_input_ptr += 8; - F0 forget_gate_output = gemmlowp::logistic(forget_gate_input); - // Implementation of output gate, using fixed-point logistic function. - F3 output_gate_input = F3::FromRaw(vld1q_s16(output_gate_input_ptr)); - output_gate_input_ptr += 8; - F0 output_gate_output = gemmlowp::logistic(output_gate_input); - // Implementation of internal multiplication nodes, still in fixed-point. - F0 input_times_input_modulation = - input_gate_output * input_modulation_gate_output; - FS prev_state = FS::FromRaw(vld1q_s16(prev_state_ptr)); - prev_state_ptr += 8; - FS prev_state_times_forget_state = forget_gate_output * prev_state; - // Implementation of internal addition node, saturating. - FS new_state = gemmlowp::SaturatingAdd( - gemmlowp::Rescale(input_times_input_modulation), - prev_state_times_forget_state); - // Implementation of last internal Tanh node, still in fixed-point. - // Since a Tanh fixed-point implementation is specialized for a given - // number or integer bits, and each specialization can have a substantial - // code size, and we already used above a Tanh on an input with 3 integer - // bits, and per the table in the above function comment there is no - // significant accuracy to be lost by clamping to [-8, +8] for a - // 3-integer-bits representation, let us just do that. This helps people - // porting this to targets where code footprint must be minimized. - F3 new_state_f3 = gemmlowp::Rescale<3>(new_state); - F0 output_activ_int16 = output_gate_output * gemmlowp::tanh(new_state_f3); - // Store the new internal state back to memory, as 16-bit integers. - // Note: here we store the original value with StateIntegerBits, not - // the rescaled 3-integer-bits value fed to tanh. - vst1q_s16(output_state_data_ptr, new_state.raw()); - output_state_data_ptr += 8; - // Down-scale the output activations to 8-bit integers, saturating, - // and store back to memory. - int16x8_t rescaled_output_activ = - gemmlowp::RoundingDivideByPOT(output_activ_int16.raw(), 8); - int8x8_t int8_output_activ = vqmovn_s16(rescaled_output_activ); - uint8x8_t uint8_output_activ = - vadd_u8(vdup_n_u8(128), vreinterpret_u8_s8(int8_output_activ)); - vst1_u8(output_activ_data_ptr, uint8_output_activ); - output_activ_data_ptr += 8; - } -#endif - for (; c < output_depth; ++c) { - // Define the fixed-point data types that we will use here. All use - // int16 as the underlying integer type i.e. all are 16-bit fixed-point. - // They only differ by the number of integral vs. fractional bits, - // determining the range of values that they can represent. - // - // F0 uses 0 integer bits, range [-1, 1]. - // This is the return type of math functions such as tanh, logistic, - // whose range is in [-1, 1]. - using F0 = gemmlowp::FixedPoint; - // F3 uses 3 integer bits, range [-8, 8]. - // This is the range of the previous fully-connected node's output, - // which is our input here. - using F3 = gemmlowp::FixedPoint; - // FS uses StateIntegerBits integer bits, range [-2^StateIntegerBits, - // 2^StateIntegerBits]. It's used to represent the internal state, whose - // number of integer bits is currently dictated by the model. See comment - // on the StateIntegerBits template parameter above. - using FS = gemmlowp::FixedPoint; - // Implementation of input gate, using fixed-point logistic function. - F3 input_gate_input = F3::FromRaw(*input_gate_input_ptr++); - F0 input_gate_output = gemmlowp::logistic(input_gate_input); - // Implementation of input modulation gate, using fixed-point tanh - // function. - F3 input_modulation_gate_input = - F3::FromRaw(*input_modulation_gate_input_ptr++); - F0 input_modulation_gate_output = - gemmlowp::tanh(input_modulation_gate_input); - // Implementation of forget gate, using fixed-point logistic function. - F3 forget_gate_input = F3::FromRaw(*forget_gate_input_ptr++); - F0 forget_gate_output = gemmlowp::logistic(forget_gate_input); - // Implementation of output gate, using fixed-point logistic function. - F3 output_gate_input = F3::FromRaw(*output_gate_input_ptr++); - F0 output_gate_output = gemmlowp::logistic(output_gate_input); - // Implementation of internal multiplication nodes, still in fixed-point. - F0 input_times_input_modulation = - input_gate_output * input_modulation_gate_output; - FS prev_state = FS::FromRaw(*prev_state_ptr++); - FS prev_state_times_forget_state = forget_gate_output * prev_state; - // Implementation of internal addition node, saturating. - FS new_state = gemmlowp::SaturatingAdd( - gemmlowp::Rescale(input_times_input_modulation), - prev_state_times_forget_state); - // Implementation of last internal Tanh node, still in fixed-point. - // Since a Tanh fixed-point implementation is specialized for a given - // number or integer bits, and each specialization can have a substantial - // code size, and we already used above a Tanh on an input with 3 integer - // bits, and per the table in the above function comment there is no - // significant accuracy to be lost by clamping to [-8, +8] for a - // 3-integer-bits representation, let us just do that. This helps people - // porting this to targets where code footprint must be minimized. - F3 new_state_f3 = gemmlowp::Rescale<3>(new_state); - F0 output_activ_int16 = output_gate_output * gemmlowp::tanh(new_state_f3); - // Store the new internal state back to memory, as 16-bit integers. - // Note: here we store the original value with StateIntegerBits, not - // the rescaled 3-integer-bits value fed to tanh. - *output_state_data_ptr++ = new_state.raw(); - // Down-scale the output activations to 8-bit integers, saturating, - // and store back to memory. - int16 rescaled_output_activ = - gemmlowp::RoundingDivideByPOT(output_activ_int16.raw(), 8); - int16 clamped_output_activ = - std::max(-128, std::min(127, rescaled_output_activ)); - *output_activ_data_ptr++ = 128 + clamped_output_activ; - } - input_gate_input_ptr += 3 * output_depth; - input_modulation_gate_input_ptr += 3 * output_depth; - forget_gate_input_ptr += 3 * output_depth; - output_gate_input_ptr += 3 * output_depth; - } -} - -inline int NodeOffset(int b, int h, int w, int height, int width) { - return (b * height + h) * width + w; -} - -inline bool AveragePool(const PoolParams& params, - const RuntimeShape& input_shape, - const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("AveragePool"); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - - if (stride_height == 0) return false; - if (stride_width == 0) return false; - - // TODO(benoitjacob) make this a proper reference impl without Eigen! - const auto in_mat = MapAsMatrixWithLastDimAsRows(input_data, input_shape); - auto out_mat = MapAsMatrixWithLastDimAsRows(output_data, output_shape); - // TODO(benoitjacob) get rid of the dynamic memory allocation here! - Eigen::VectorXf out_count(out_mat.cols()); - out_count.setZero(); - // Prefill the output to 0. - out_mat.setZero(); - for (int b = 0; b < batches; ++b) { - for (int h = 0; h < input_height; ++h) { - for (int w = 0; w < input_width; ++w) { - // (h_start, h_end) * (w_start, w_end) is the range that the input - // vector projects to. - int hpad = h + params.padding_values.height; - int wpad = w + params.padding_values.width; - int h_start = (hpad < params.filter_height) - ? 0 - : (hpad - params.filter_height) / stride_height + 1; - int h_end = std::min(hpad / stride_height + 1, output_height); - int w_start = (wpad < params.filter_width) - ? 0 - : (wpad - params.filter_width) / stride_width + 1; - int w_end = std::min(wpad / stride_width + 1, output_width); - // compute elementwise sum - for (int ph = h_start; ph < h_end; ++ph) { - for (int pw = w_start; pw < w_end; ++pw) { - int out_offset = NodeOffset(b, ph, pw, output_height, output_width); - out_mat.col(out_offset) += - in_mat.col(NodeOffset(b, h, w, input_height, input_width)); - out_count(out_offset)++; - } - } - } - } - } - // Divide the output by the actual number of elements being averaged over - TFLITE_DCHECK_GT(out_count.minCoeff(), 0); - out_mat.array().rowwise() /= out_count.transpose().array(); - - const int flat_size = output_shape.FlatSize(); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax(output_data[i], - params.float_activation_min, - params.float_activation_max); - } - - return true; -} - -inline bool AveragePool16(const PoolParams& params, - const RuntimeShape& input_shape, - const uint8* input_data, - const RuntimeShape& output_shape, - uint8* output_data) { - ruy::profiler::ScopeLabel label("AveragePool/8bit"); - - // Here, and in other pooling ops, in order to maintain locality of reference, - // to minimize some recalculations, and to load into NEON vector registers, we - // use an inner loop down the depth. Since depths can be large and hence we - // would need arbitrarily large temporary storage, we divide the work up into - // depth tranches just within the batch loop. - static constexpr int kPoolingAccTrancheSize = 256; - - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - - uint16 acc[kPoolingAccTrancheSize]; - for (int batch = 0; batch < batches; ++batch) { - // We proceed through the depth in tranches (see comment above). The - // depth_base is the depth at the beginning of the tranche. The - // tranche_depth is the depth dimension of the tranche. - for (int depth_base = 0; depth_base < depth; - depth_base += kPoolingAccTrancheSize) { - const int tranche_depth = - std::min(depth - depth_base, kPoolingAccTrancheSize); - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - const int filter_count = - (filter_x_end - filter_x_start) * (filter_y_end - filter_y_start); - if (filter_count == 0) return false; - memset(acc, 0, tranche_depth * sizeof(acc[0])); - const uint8* input_ptr = - input_data + depth_base + - depth * (in_x_origin + - input_width * (in_y_origin + input_height * batch)); - for (int fy = filter_y_start; fy < filter_y_end; fy++) { - const uint8* input_row_ptr = - input_ptr + depth * (fy * input_width + filter_x_start); - for (int fx = filter_x_start; fx < filter_x_end; fx++) { - const uint8* input_channel_ptr = input_row_ptr; - int channel = 0; -#ifdef USE_NEON - for (; channel <= tranche_depth - 16; channel += 16) { - uint16x8_t acc_reg[2]; - for (int i = 0; i < 2; i++) { - acc_reg[i] = vld1q_u16(acc + channel + 8 * i); - } - uint8x16_t input_reg = vld1q_u8(input_channel_ptr); - input_channel_ptr += 16; - acc_reg[0] = vaddw_u8(acc_reg[0], vget_low_u8(input_reg)); - acc_reg[1] = vaddw_u8(acc_reg[1], vget_high_u8(input_reg)); - for (int i = 0; i < 2; i++) { - vst1q_u16(acc + channel + 8 * i, acc_reg[i]); - } - } - for (; channel <= tranche_depth - 8; channel += 8) { - uint16x8_t acc_reg = vld1q_u16(acc + channel); - uint8x8_t input_reg = vld1_u8(input_channel_ptr); - input_channel_ptr += 8; - acc_reg = vaddw_u8(acc_reg, input_reg); - vst1q_u16(acc + channel, acc_reg); - } -#endif - for (; channel < tranche_depth; ++channel) { - acc[channel] += *input_channel_ptr++; - } - input_row_ptr += depth; - } - } - uint8* output_ptr = output_data + Offset(output_shape, batch, out_y, - out_x, depth_base); - int channel = 0; -#ifdef USE_NEON -#define AVGPOOL_DIVIDING_BY(FILTER_COUNT) \ - if (filter_count == FILTER_COUNT) { \ - for (; channel <= tranche_depth - 8; channel += 8) { \ - uint16 buf[8]; \ - for (int i = 0; i < 8; i++) { \ - buf[i] = (acc[channel + i] + FILTER_COUNT / 2) / FILTER_COUNT; \ - } \ - uint8x8_t buf8 = vqmovn_u16(vld1q_u16(buf)); \ - buf8 = vmin_u8(buf8, vdup_n_u8(params.quantized_activation_max)); \ - buf8 = vmax_u8(buf8, vdup_n_u8(params.quantized_activation_min)); \ - vst1_u8(output_ptr + channel, buf8); \ - } \ - } - AVGPOOL_DIVIDING_BY(9) - AVGPOOL_DIVIDING_BY(15) -#undef AVGPOOL_DIVIDING_BY - for (; channel <= tranche_depth - 8; channel += 8) { - uint16 buf[8]; - for (int i = 0; i < 8; i++) { - buf[i] = (acc[channel + i] + filter_count / 2) / filter_count; - } - uint8x8_t buf8 = vqmovn_u16(vld1q_u16(buf)); - buf8 = vmin_u8(buf8, vdup_n_u8(params.quantized_activation_max)); - buf8 = vmax_u8(buf8, vdup_n_u8(params.quantized_activation_min)); - vst1_u8(output_ptr + channel, buf8); - } -#endif - for (; channel < tranche_depth; ++channel) { - uint16 a = (acc[channel] + filter_count / 2) / filter_count; - a = std::max(a, params.quantized_activation_min); - a = std::min(a, params.quantized_activation_max); - output_ptr[channel] = static_cast(a); - } - } - } - } - } -} - -inline bool AveragePool32(const PoolParams& params, - const RuntimeShape& input_shape, - const uint8* input_data, - const RuntimeShape& output_shape, - uint8* output_data) { - ruy::profiler::ScopeLabel label("AveragePool/8bit"); - - // Here, and in other pooling ops, in order to maintain locality of reference, - // to minimize some recalculations, and to load into NEON vector registers, we - // use an inner loop down the depth. Since depths can be large and hence we - // would need arbitrarily large temporary storage, we divide the work up into - // depth tranches just within the batch loop. - static constexpr int kPoolingAccTrancheSize = 256; - - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - - uint32 acc[kPoolingAccTrancheSize]; - for (int batch = 0; batch < batches; ++batch) { - // We proceed through the depth in tranches (see comment above). The - // depth_base is the depth at the beginning of the tranche. The - // tranche_depth is the depth dimension of the tranche. - for (int depth_base = 0; depth_base < depth; - depth_base += kPoolingAccTrancheSize) { - const int tranche_depth = - std::min(depth - depth_base, kPoolingAccTrancheSize); - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - const int filter_count = - (filter_x_end - filter_x_start) * (filter_y_end - filter_y_start); - if (filter_count == 0) return false; - memset(acc, 0, tranche_depth * sizeof(acc[0])); - const uint8* input_ptr = - input_data + depth_base + - depth * (in_x_origin + - input_width * (in_y_origin + input_height * batch)); - for (int fy = filter_y_start; fy < filter_y_end; fy++) { - const uint8* input_row_ptr = - input_ptr + depth * (fy * input_width + filter_x_start); - for (int fx = filter_x_start; fx < filter_x_end; fx++) { - const uint8* input_channel_ptr = input_row_ptr; - int channel = 0; -#ifdef USE_NEON - for (; channel <= tranche_depth - 16; channel += 16) { - uint16x4_t acc_reg[4]; - uint8x16_t input_reg = vld1q_u8(input_channel_ptr); - input_channel_ptr += 16; - acc_reg[0] = vget_low_u16(vmovl_u8(vget_low_u8(input_reg))); - acc_reg[1] = vget_high_u16(vmovl_u8(vget_low_u8(input_reg))); - acc_reg[2] = vget_low_u16(vmovl_u8(vget_high_u8(input_reg))); - acc_reg[3] = vget_high_u16(vmovl_u8(vget_high_u8(input_reg))); - for (int i = 0; i < 4; i++) { - vst1q_u32( - acc + channel + 4 * i, - vaddw_u16(vld1q_u32(acc + channel + 4 * i), acc_reg[i])); - } - } - for (; channel <= tranche_depth - 8; channel += 8) { - uint16x4_t acc_reg[2]; - uint16x8_t input_reg = vmovl_u8(vld1_u8(input_channel_ptr)); - input_channel_ptr += 8; - acc_reg[0] = vget_low_u16(input_reg); - acc_reg[1] = vget_high_u16(input_reg); - for (int i = 0; i < 2; i++) { - vst1q_u32( - acc + channel + 4 * i, - vaddw_u16(vld1q_u32(acc + channel + 4 * i), acc_reg[i])); - } - } -#endif - for (; channel < tranche_depth; ++channel) { - acc[channel] += *input_channel_ptr++; - } - input_row_ptr += depth; - } - } - uint8* output_ptr = output_data + Offset(output_shape, batch, out_y, - out_x, depth_base); - int channel = 0; -#ifdef USE_NEON -#define AVGPOOL_DIVIDING_BY(FILTER_COUNT) \ - if (filter_count == FILTER_COUNT) { \ - for (; channel <= tranche_depth - 8; channel += 8) { \ - uint16 buf[8]; \ - for (int i = 0; i < 8; i++) { \ - buf[i] = (acc[channel + i] + FILTER_COUNT / 2) / FILTER_COUNT; \ - } \ - uint8x8_t buf8 = vqmovn_u16(vld1q_u16(buf)); \ - buf8 = vmin_u8(buf8, vdup_n_u8(params.quantized_activation_max)); \ - buf8 = vmax_u8(buf8, vdup_n_u8(params.quantized_activation_min)); \ - vst1_u8(output_ptr + channel, buf8); \ - } \ - } - AVGPOOL_DIVIDING_BY(9) - AVGPOOL_DIVIDING_BY(15) -#undef AVGPOOL_DIVIDING_BY - for (; channel <= tranche_depth - 8; channel += 8) { - uint16 buf[8]; - for (int i = 0; i < 8; i++) { - buf[i] = (acc[channel + i] + filter_count / 2) / filter_count; - } - uint8x8_t buf8 = vqmovn_u16(vld1q_u16(buf)); - buf8 = vmin_u8(buf8, vdup_n_u8(params.quantized_activation_max)); - buf8 = vmax_u8(buf8, vdup_n_u8(params.quantized_activation_min)); - vst1_u8(output_ptr + channel, buf8); - } -#endif - for (; channel < tranche_depth; ++channel) { - uint16 a = (acc[channel] + filter_count / 2) / filter_count; - a = std::max(a, params.quantized_activation_min); - a = std::min(a, params.quantized_activation_max); - output_ptr[channel] = static_cast(a); - } - } - } - } - } - return true; -} - -inline bool AveragePool(const PoolParams& params, - const RuntimeShape& input_shape, - const uint8* input_data, - const RuntimeShape& output_shape, uint8* output_data) { - if (params.filter_height * params.filter_width > 16 * 16) { - return AveragePool32(params, input_shape, input_data, output_shape, - output_data); - } else { - return AveragePool16(params, input_shape, input_data, output_shape, - output_data); - } -} - -inline void MaxPool(const PoolParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& output_shape, - float* output_data) { - ruy::profiler::ScopeLabel label("MaxPool"); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - - const auto in_mat = MapAsMatrixWithLastDimAsRows(input_data, input_shape); - auto out_mat = MapAsMatrixWithLastDimAsRows(output_data, output_shape); - // Prefill the output to minimum representable float value - out_mat.setConstant(std::numeric_limits::lowest()); - for (int b = 0; b < batches; ++b) { - for (int h = 0; h < input_height; ++h) { - for (int w = 0; w < input_width; ++w) { - // (h_start, h_end) * (w_start, w_end) is the range that the input - // vector projects to. - int hpad = h + params.padding_values.height; - int wpad = w + params.padding_values.width; - int h_start = (hpad < params.filter_height) - ? 0 - : (hpad - params.filter_height) / stride_height + 1; - int h_end = std::min(hpad / stride_height + 1, output_height); - int w_start = (wpad < params.filter_width) - ? 0 - : (wpad - params.filter_width) / stride_width + 1; - int w_end = std::min(wpad / stride_width + 1, output_width); - // compute elementwise sum - for (int ph = h_start; ph < h_end; ++ph) { - for (int pw = w_start; pw < w_end; ++pw) { - int out_offset = NodeOffset(b, ph, pw, output_height, output_width); - out_mat.col(out_offset) = - out_mat.col(out_offset) - .cwiseMax(in_mat.col( - NodeOffset(b, h, w, input_height, input_width))); - } - } - } - } - } - const int flat_size = output_shape.FlatSize(); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax(output_data[i], - params.float_activation_min, - params.float_activation_max); - } -} - -inline void MaxPool(const PoolParams& params, const RuntimeShape& input_shape, - const uint8* input_data, const RuntimeShape& output_shape, - uint8* output_data) { - ruy::profiler::ScopeLabel label("MaxPool/8bit"); - - // Here, and in other pooling ops, in order to maintain locality of reference, - // to minimize some recalculations, and to load into NEON vector registers, we - // use an inner loop down the depth. Since depths can be large and hence we - // would need arbitrarily large temporary storage, we divide the work up into - // depth tranches just within the batch loop. - static constexpr int kPoolingAccTrancheSize = 256; - - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - - uint8 acc[kPoolingAccTrancheSize]; - for (int batch = 0; batch < batches; ++batch) { - // We proceed through the depth in tranches (see comment above). The - // depth_base is the depth at the beginning of the tranche. The - // tranche_depth is the depth dimension of the tranche. - for (int depth_base = 0; depth_base < depth; - depth_base += kPoolingAccTrancheSize) { - const int tranche_depth = - std::min(depth - depth_base, kPoolingAccTrancheSize); - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - memset(acc, 0, tranche_depth * sizeof(acc[0])); - const uint8* input_ptr = - input_data + depth_base + - depth * (in_x_origin + - input_width * (in_y_origin + input_height * batch)); - for (int fy = filter_y_start; fy < filter_y_end; fy++) { - const uint8* input_row_ptr = - input_ptr + depth * (fy * input_width + filter_x_start); - for (int fx = filter_x_start; fx < filter_x_end; fx++) { - const uint8* input_channel_ptr = input_row_ptr; - int channel = 0; -#ifdef USE_NEON - for (; channel <= tranche_depth - 16; channel += 16) { - uint8x16_t acc_reg = vld1q_u8(acc + channel); - uint8x16_t input_reg = vld1q_u8(input_channel_ptr); - input_channel_ptr += 16; - acc_reg = vmaxq_u8(acc_reg, input_reg); - vst1q_u8(acc + channel, acc_reg); - } - - for (; channel <= tranche_depth - 8; channel += 8) { - uint8x8_t acc_reg = vld1_u8(acc + channel); - uint8x8_t input_reg = vld1_u8(input_channel_ptr); - input_channel_ptr += 8; - acc_reg = vmax_u8(acc_reg, input_reg); - vst1_u8(acc + channel, acc_reg); - } -#endif - for (; channel < tranche_depth; ++channel) { - acc[channel] = std::max(acc[channel], *input_channel_ptr++); - } - input_row_ptr += depth; - } - } - uint8* output_ptr = output_data + Offset(output_shape, batch, out_y, - out_x, depth_base); - int channel = 0; -#ifdef USE_NEON - for (; channel <= tranche_depth - 16; channel += 16) { - uint8x16_t a = vld1q_u8(acc + channel); - a = vminq_u8(a, vdupq_n_u8(params.quantized_activation_max)); - a = vmaxq_u8(a, vdupq_n_u8(params.quantized_activation_min)); - vst1q_u8(output_ptr + channel, a); - } - for (; channel <= tranche_depth - 8; channel += 8) { - uint8x8_t a = vld1_u8(acc + channel); - a = vmin_u8(a, vdup_n_u8(params.quantized_activation_max)); - a = vmax_u8(a, vdup_n_u8(params.quantized_activation_min)); - vst1_u8(output_ptr + channel, a); - } -#endif - for (; channel < tranche_depth; ++channel) { - uint8 a = acc[channel]; - a = std::max(a, params.quantized_activation_min); - a = std::min(a, params.quantized_activation_max); - output_ptr[channel] = static_cast(a); - } - } - } - } - } -} - -inline void L2Pool(const PoolParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& output_shape, - float* output_data) { - ruy::profiler::ScopeLabel label("L2Pool"); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - // Actually carry out L2 Pool. Code is written in forward mode: we go through - // the input values once, and write to all the pooled regions that it maps to. - const auto in_mat = MapAsMatrixWithLastDimAsRows(input_data, input_shape); - auto out_mat = MapAsMatrixWithLastDimAsRows(output_data, output_shape); - Eigen::VectorXf in_square(in_mat.rows()); - Eigen::VectorXf out_count(out_mat.cols()); - out_count.setZero(); - // Prefill the output to 0. - out_mat.setZero(); - for (int b = 0; b < batches; ++b) { - for (int h = 0; h < input_height; ++h) { - for (int w = 0; w < input_width; ++w) { - // (h_start, h_end) * (w_start, w_end) is the range that the input - // vector projects to. - const int hpad = h + params.padding_values.height; - const int wpad = w + params.padding_values.width; - const int h_start = - (hpad < params.filter_height) - ? 0 - : (hpad - params.filter_height) / stride_height + 1; - const int h_end = std::min(hpad / stride_height + 1, output_height); - const int w_start = - (wpad < params.filter_width) - ? 0 - : (wpad - params.filter_width) / stride_width + 1; - const int w_end = std::min(wpad / stride_width + 1, output_width); - // pre-compute square - const int in_offset = w + input_width * (h + input_height * b); - in_square = - in_mat.col(in_offset).array() * in_mat.col(in_offset).array(); - // compute elementwise sum of squares - for (int ph = h_start; ph < h_end; ++ph) { - for (int pw = w_start; pw < w_end; ++pw) { - const int out_offset = pw + output_width * (ph + output_height * b); - out_mat.col(out_offset) += in_square; - out_count(out_offset)++; - } - } - } - } - } - - out_count = out_count.array().inverse(); - out_mat = - (out_mat.array().rowwise() * out_count.transpose().array()).cwiseSqrt(); - - const int flat_size = output_shape.FlatSize(); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax(output_data[i], - params.float_activation_min, - params.float_activation_max); - } -} - -inline void LocalResponseNormalization( - const tflite::LocalResponseNormalizationParams& op_params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("LocalResponseNormalization"); - MatchingFlatSize(input_shape, output_shape); - - const auto data_in = MapAsMatrixWithLastDimAsRows(input_data, input_shape); - auto data_out = MapAsMatrixWithLastDimAsRows(output_data, output_shape); - - // Carry out local response normalization, vector by vector. - // Since the data are stored column major, making row-wise operation - // probably not memory efficient anyway, we do an explicit for loop over - // the columns. - const int double_range = op_params.range * 2; - Eigen::VectorXf padded_square(data_in.rows() + double_range); - padded_square.setZero(); - const float bias = op_params.bias; - for (int r = 0; r < data_in.cols(); ++r) { - // Do local response normalization for data_in(:, r) - // first, compute the square and store them in buffer for repeated use - padded_square.block(op_params.range, 0, data_in.rows(), 1) = - data_in.col(r).cwiseProduct(data_in.col(r)) * op_params.alpha; - // Then, compute the scale and writes them to data_out - float accumulated_scale = 0; - for (int i = 0; i < double_range; ++i) { - accumulated_scale += padded_square(i); - } - for (int i = 0; i < data_in.rows(); ++i) { - accumulated_scale += padded_square(i + double_range); - data_out(i, r) = bias + accumulated_scale; - accumulated_scale -= padded_square(i); - } - } - - // In a few cases, the pow computation could benefit from speedups. - if (op_params.beta == 1) { - data_out.array() = data_in.array() * data_out.array().inverse(); - } else if (op_params.beta == 0.5f) { - data_out.array() = data_in.array() * data_out.array().sqrt().inverse(); - } else { - data_out.array() = data_in.array() * data_out.array().pow(-op_params.beta); - } -} - -inline void SoftmaxImpl(const SoftmaxParams& params, - const RuntimeShape& input_shape, - const float* input_data, - const RuntimeShape& output_shape, float* output_data, - int start_batch, int end_batch) { - ruy::profiler::ScopeLabel label("Softmax/Impl"); - MatchingFlatSize(input_shape, output_shape); - - const int logit_size = input_shape.Dims(input_shape.DimensionsCount() - 1); - const MatrixMap in_mat(input_data + logit_size * start_batch, - logit_size, end_batch - start_batch); - MatrixMap out_mat(output_data + logit_size * start_batch, logit_size, - end_batch - start_batch); - // Compute the exponential first, removing the max coefficient for numerical - // stability. - out_mat = - (in_mat.rowwise() - in_mat.colwise().maxCoeff()).array() * params.beta; - // We are separating out the exp function so that exp can be vectorized. - out_mat = out_mat.array().exp(); - // Normalize to get the activations. - Eigen::Array scale = - out_mat.array().colwise().sum().inverse(); - out_mat.array().rowwise() *= scale; -} - -struct SoftmaxWorkerTask : cpu_backend_threadpool::Task { - SoftmaxWorkerTask(const SoftmaxParams& params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data, - int start_batch, int end_batch) - : params(params), - input_shape(input_shape), - input_data(input_data), - output_shape(output_shape), - output_data(output_data), - start_batch(start_batch), - end_batch(end_batch) {} - void Run() override { - SoftmaxImpl(params, input_shape, input_data, output_shape, output_data, - start_batch, end_batch); - } - - private: - const tflite::SoftmaxParams& params; - const RuntimeShape& input_shape; - const float* input_data; - const RuntimeShape& output_shape; - float* output_data; - int start_batch; - int end_batch; -}; - -inline void Softmax(const SoftmaxParams& params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data, - CpuBackendContext* cpu_backend_context = nullptr) { - ruy::profiler::ScopeLabel label("Softmax"); - - // We picture softmax input as a 2-D matrix while the last dim is the logit - // dim, and the rest dims will be the batch dim for the 2-D matrix. - const int batch_size = - FlatSizeSkipDim(input_shape, input_shape.DimensionsCount() - 1); - constexpr int kMinBatchPerThread = 8; - int thread_count = batch_size / kMinBatchPerThread; - thread_count = thread_count > 0 ? thread_count : 1; - const int capped_thread_count = - cpu_backend_context == nullptr - ? 1 - : std::min(thread_count, cpu_backend_context->max_num_threads()); - if (capped_thread_count == 1) { - SoftmaxImpl(params, input_shape, input_data, output_shape, output_data, 0, - batch_size); - } else { - std::vector tasks; - // TODO(b/131746020) don't create new heap allocations every time. - // At least we make it a single heap allocation by using reserve(). - tasks.reserve(capped_thread_count); - int batch_start = 0; - for (int i = 0; i < capped_thread_count; ++i) { - // Try to distribute the tasks as even as possible. - int batch_end = - batch_start + (batch_size - batch_start) / (capped_thread_count - i); - tasks.emplace_back(params, input_shape, input_data, output_shape, - output_data, batch_start, batch_end); - batch_start = batch_end; - } - cpu_backend_threadpool::Execute(tasks.size(), tasks.data(), - cpu_backend_context); - } -} - -template -inline int32_t QuantizeSoftmaxOutput(float prob_rescaled, int32_t zero_point) { - const int32_t prob_rnd = static_cast(std::round(prob_rescaled)); - return prob_rnd + zero_point; -} - -#if !__aarch64__ -// With ARM64, rounding is faster than add + truncation. -template <> -inline int32_t QuantizeSoftmaxOutput(float prob_rescaled, - int32_t zero_point) { - return static_cast(prob_rescaled + 0.5f); -} -#endif - -inline void PopulateSoftmaxLookupTable(SoftmaxParams* data, float input_scale, - float beta) { - const float scale = -input_scale * beta; - const int32_t max_uint8 = std::numeric_limits::max(); - for (int32_t val = 0; val <= max_uint8; ++val) { - data->table[max_uint8 - val] = expf(scale * val); - } -} - -template -inline void Softmax(const SoftmaxParams& params, - const RuntimeShape& input_shape, const In* input_data, - const RuntimeShape& output_shape, Out* output_data) { - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int excluding_last_dim = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int last_dim = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - - const int32_t clamp_max = std::numeric_limits::max(); - const int32_t clamp_min = std::numeric_limits::min(); - for (int i = 0; i < excluding_last_dim; ++i) { - int32_t max_val = std::numeric_limits::min(); - // Find max quantized value. - for (int j = 0; j < last_dim; ++j) { - max_val = std::max(max_val, static_cast(input_data[j])); - } - - float sum_exp = 0.0f; - const int32_t max_uint8 = std::numeric_limits::max(); - const float* table_offset = ¶ms.table[max_uint8 - max_val]; - // Calculate normalizer sum(exp(x)). - for (int j = 0; j < last_dim; ++j) { - sum_exp += table_offset[input_data[j]]; - } - - const float inv_sum_exp = 1.0f / (sum_exp * params.scale); - // Normalize and quantize probabilities. - for (int j = 0; j < last_dim; ++j) { - const float prob_rescaled = table_offset[input_data[j]] * inv_sum_exp; - const int32_t prob_quantized = - QuantizeSoftmaxOutput(prob_rescaled, params.zero_point); - output_data[j] = static_cast( - std::max(std::min(clamp_max, prob_quantized), clamp_min)); - } - input_data += last_dim; - output_data += last_dim; - } -} - -// Here's the softmax LUT optimization strategy: -// For softmax, we can do some mathmetically equivalent transformation: -// -// softmax(x) = e^x / sum(e^x, 0...n) ===> equals to -// softmax(x) = e^(x - CONST) / sum(e^(x - CONST), 0...n) -// -// For quantization, `x` in our case is (input_q - input_zp) * input_s -// For uint8 case (int8 can be handled similarly), the range is [0, 255] -// -// so if we let -// CONST = (255 - input_zp) * input_s -// then we will have: -// softmax(x) = e^((input_q - 255) * input_s) --------- (1) -// / -// sum(e^(input_q - 255) * input_s, 0...n) -------- (2) -// -// the good thing about (1) is it's within the range of (0, 1), so we can -// approximate its result with uint16. -// (1) = uint8_out * 1 / 2^16. -// -// so (1) is lookup_uint8_table(input_zp) * 1 / 2^16. -// then (2) is essentially the following: -// sum(lookup_uint8_table(input_zp), 0...n) / 2^16. -// -// since (output_q - output_zp) * output_s = softmax(x) -// output_q = lookup_uint8_table(input_zp) -// / -// (sum(lookup_uint8_table(input_zp), 0...n) * output_s) -// + -// output_zp -// -// We can actually further improve the performance by using uint8 instead of -// uint16. But that we may lose some accuracy, so we need to pay attention -// to that. -inline void PopulateSoftmaxUInt8LookupTable(SoftmaxParams* data, - float input_scale, float beta) { - const float scale = input_scale * beta; - const int32_t max_uint8 = std::numeric_limits::max(); - const int32_t max_uint16 = std::numeric_limits::max(); - - for (int32_t val = 0; val <= max_uint8; ++val) { - float input_to_exp = scale * (val - max_uint8); - int32_t temp = static_cast(expf(input_to_exp) * max_uint16 + 0.5); - temp = std::min(max_uint16, temp); - uint8_t part1 = temp >> 8; - uint8_t part2 = temp & 0xff; - data->uint8_table1[val] = static_cast(part1); - data->uint8_table2[val] = static_cast(part2); - } -} - -inline int FindMaxValue(int size, const uint8_t* input_data, uint8_t offset) { - int32_t max_val = std::numeric_limits::min(); - int j = 0; -#ifdef TFLITE_SOFTMAX_USE_UINT16_LUT - uint8x16_t max_val_dup = vdupq_n_u8(max_val); - uint8x16_t offset_dup = vdupq_n_u8(offset); - for (; j <= size - 16; j += 16) { - uint8x16_t input_value = vld1q_u8(input_data + j); - input_value = veorq_u8(input_value, offset_dup); - max_val_dup = vmaxq_u8(input_value, max_val_dup); - } - max_val = std::max(max_val, static_cast(vmaxvq_u8(max_val_dup))); -#endif - - for (; j < size; ++j) { - max_val = std::max(max_val, static_cast(input_data[j] ^ offset)); - } - return max_val; -} - -#ifdef USE_NEON -// Value_to_store layout: -// [high_high, high_low, low_high, low_low]. -inline void StoreValue(int32x4x4_t value_to_store, int8_t* output) { - const int16x8_t result_1 = vcombine_s16(vqmovn_s32(value_to_store.val[1]), - vqmovn_s32(value_to_store.val[0])); - const int16x8_t result_2 = vcombine_s16(vqmovn_s32(value_to_store.val[3]), - vqmovn_s32(value_to_store.val[2])); - const int8x16_t result = - vcombine_s8(vqmovn_s16(result_2), vqmovn_s16(result_1)); - vst1q_s8(output, result); -} - -// Value_to_store layout: -// [high_high, high_low, low_high, low_low]. -inline void StoreValue(int32x4x4_t value_to_store, uint8_t* output) { - const uint16x8_t result_1 = - vcombine_u16(vqmovn_u32(vreinterpretq_u32_s32(value_to_store.val[1])), - vqmovn_u32(vreinterpretq_u32_s32(value_to_store.val[0]))); - const uint16x8_t result_2 = - vcombine_u16(vqmovn_u32(vreinterpretq_u32_s32(value_to_store.val[3])), - vqmovn_u32(vreinterpretq_u32_s32(value_to_store.val[2]))); - const uint8x16_t result = - vcombine_u8(vqmovn_u16(result_2), vqmovn_u16(result_1)); - vst1q_u8(output, result); -} - -#endif - -template -inline void SoftmaxInt8LUT(const SoftmaxParams& params, - const RuntimeShape& input_shape, - const In* input_data, - const RuntimeShape& output_shape, Out* output_data) { - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int excluding_last_dim = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int last_dim = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - - const int32_t clamp_max = std::numeric_limits::max(); - const int32_t clamp_min = std::numeric_limits::min(); - - // Offset is used to interpret the input data "correctly". - // If the input is uint8, the data will be unchanged. - // If the input is int8, since it will be reinterpret as uint8. - // e.g., - // int8 127 will be applied "offset" to become 255 in uint8. - uint8_t offset = 0; - if (std::is_same::value) { - offset = 0x80; - } - - const uint8_t* input_data_uint = reinterpret_cast(input_data); - -#ifdef TFLITE_SOFTMAX_USE_UINT16_LUT - // This code uses ARM64-only instructions. - // TODO(b/143709993): Port to ARMv7 - - // Load the tables into registers. (4*4 128-bit registers) - uint8x16x4_t table1[4]; - table1[0] = vld1q_u8_x4(params.uint8_table1 + 16 * 4 * 0); - table1[1] = vld1q_u8_x4(params.uint8_table1 + 16 * 4 * 1); - table1[2] = vld1q_u8_x4(params.uint8_table1 + 16 * 4 * 2); - table1[3] = vld1q_u8_x4(params.uint8_table1 + 16 * 4 * 3); - - uint8x16x4_t table2[4]; - table2[0] = vld1q_u8_x4(params.uint8_table2 + 16 * 4 * 0); - table2[1] = vld1q_u8_x4(params.uint8_table2 + 16 * 4 * 1); - table2[2] = vld1q_u8_x4(params.uint8_table2 + 16 * 4 * 2); - table2[3] = vld1q_u8_x4(params.uint8_table2 + 16 * 4 * 3); -#endif - - for (int i = 0; i < excluding_last_dim; ++i) { - // Find max quantized value. - int32_t max_val = FindMaxValue(last_dim, input_data_uint, offset); - - int32 sum_exp = 0; - const int32_t max_uint8 = std::numeric_limits::max(); - const uint8_t table_offset = max_uint8 - max_val; - - // Calculate normalizer sum(exp(x)). - int sum_j = 0; -#ifdef TFLITE_SOFTMAX_USE_UINT16_LUT - uint8x16_t table_offset_dup = vdupq_n_u8(table_offset); - uint8x16_t offset_dup = vdupq_n_u8(offset); - uint32x4_t sum_4 = vdupq_n_u32(0); - const int multiplier_shift = 8; - for (; sum_j <= last_dim - 16; sum_j += 16) { - uint8x16_t input_value = vld1q_u8(input_data_uint + sum_j); - input_value = veorq_u8(input_value, offset_dup); - input_value = vaddq_u8(input_value, table_offset_dup); - - const uint8x16_t output1 = aarch64_lookup_vector(table1, input_value); - const uint8x16_t output2 = aarch64_lookup_vector(table2, input_value); - - uint16x8_t exp_value1 = - vshll_n_u8(vget_high_u8(output1), multiplier_shift); - uint16x8_t exp_value2 = - vshll_n_u8(vget_low_u8(output1), multiplier_shift); - - exp_value1 = vaddw_u8(exp_value1, vget_high_u8(output2)); - exp_value2 = vaddw_u8(exp_value2, vget_low_u8(output2)); - - sum_4 = vpadalq_u16(sum_4, exp_value1); - sum_4 = vpadalq_u16(sum_4, exp_value2); - } - int temp = vgetq_lane_u32(sum_4, 0) + vgetq_lane_u32(sum_4, 1) + - vgetq_lane_u32(sum_4, 2) + vgetq_lane_u32(sum_4, 3); - sum_exp += temp; - -#endif - for (; sum_j < last_dim; ++sum_j) { - const uint8_t index = (input_data_uint[sum_j] ^ offset) + table_offset; - - uint8_t part1 = params.uint8_table1[index]; - uint8_t part2 = params.uint8_table2[index]; - sum_exp += ((part1 << 8) + part2); - } - - const float inv_sum_exp = 1.0f / (sum_exp * params.scale); - - int32 multiplier, shift; - QuantizeMultiplier(inv_sum_exp, &multiplier, &shift); - - // Normalize and quantize probabilities. - int j = 0; -#ifdef TFLITE_SOFTMAX_USE_UINT16_LUT - const int32x4_t output_zp_dup = vdupq_n_s32(params.zero_point); - const int32x4_t max_val_dup = vdupq_n_s32(clamp_max); - const int32x4_t min_val_dup = vdupq_n_s32(clamp_min); - - for (; j <= last_dim - 16; j += 16) { - uint8x16_t input_value = vld1q_u8(input_data_uint + j); - input_value = veorq_u8(input_value, offset_dup); - input_value = vaddq_u8(input_value, table_offset_dup); - - const uint8x16_t output1 = aarch64_lookup_vector(table1, input_value); - const uint8x16_t output2 = aarch64_lookup_vector(table2, input_value); - - uint16x8_t exp_value1 = - vshll_n_u8(vget_high_u8(output1), multiplier_shift); - uint16x8_t exp_value2 = - vshll_n_u8(vget_low_u8(output1), multiplier_shift); - - exp_value1 = vaddw_u8(exp_value1, vget_high_u8(output2)); - exp_value2 = vaddw_u8(exp_value2, vget_low_u8(output2)); - - int32x4x4_t output_value; - output_value.val[0] = - vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(exp_value1))); - output_value.val[1] = - vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(exp_value1))); - output_value.val[2] = - vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(exp_value2))); - output_value.val[3] = - vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(exp_value2))); - - int32x4x4_t temp_val = - MultiplyByQuantizedMultiplier4Rows(output_value, multiplier, shift); - - temp_val.val[0] = vaddq_s32(temp_val.val[0], output_zp_dup); - temp_val.val[1] = vaddq_s32(temp_val.val[1], output_zp_dup); - temp_val.val[2] = vaddq_s32(temp_val.val[2], output_zp_dup); - temp_val.val[3] = vaddq_s32(temp_val.val[3], output_zp_dup); - - temp_val.val[0] = - vmaxq_s32(vminq_s32(temp_val.val[0], max_val_dup), min_val_dup); - temp_val.val[1] = - vmaxq_s32(vminq_s32(temp_val.val[1], max_val_dup), min_val_dup); - temp_val.val[2] = - vmaxq_s32(vminq_s32(temp_val.val[2], max_val_dup), min_val_dup); - temp_val.val[3] = - vmaxq_s32(vminq_s32(temp_val.val[3], max_val_dup), min_val_dup); - - StoreValue(temp_val, output_data + j); - } -#endif - for (; j < last_dim; ++j) { - const uint8_t index = (input_data_uint[j] ^ offset) + table_offset; - const uint8_t part1 = params.uint8_table1[index]; - const uint8_t part2 = params.uint8_table2[index]; - const int32_t exp_value = (part1 << 8) + part2; - const int32_t output_value = - MultiplyByQuantizedMultiplier(exp_value, multiplier, shift); - - output_data[j] = static_cast(std::max( - std::min(clamp_max, output_value + params.zero_point), clamp_min)); - } - input_data_uint += last_dim; - output_data += last_dim; - } -} - -inline void LogSoftmax(const SoftmaxParams& params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("LogSoftmax"); - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int outer_size = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int depth = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - - for (int i = 0; i < outer_size; ++i) { - VectorMap block_input(input_data + i * depth, depth, 1); - VectorMap block_output(output_data + i * depth, depth, 1); - // Find max element value which we'll use to ensure numerical stability - // taking advantage of the following equality: - // log(exp(x[i])/sum(exp(x[i]))) == log(exp(x[i]+C)/sum(exp(x[i]+C))) - const float max = block_input.maxCoeff(); - const float log_sum = std::log((block_input.array() - max).exp().sum()); - block_output = block_input.array() - max - log_sum; - } -} - -// Backwards compatibility. Less optimized than below version. -inline void LogSoftmax(const SoftmaxParams& params, - const RuntimeShape& input_shape, const uint8* input_data, - const RuntimeShape& output_shape, uint8* output_data) { - reference_ops::LogSoftmax(params, input_shape, input_data, output_shape, - output_data); -} - -// Compute LogSoftmax as (x - x_max) - ln(sum(e^(x_i - x_max)...) -// as done in tf.nn.log_softmax to prevent underflow and overflow. -// This is in contrast to just log(softmax(x)) -// -// To handle quantization, first dequantize the inputs (from doing -// e^(input scale * val) where we ignore the zero point since it cancels -// out during subtraction due to the ln) and do a rescale at the end to int8. -// -// Notably this makes use of float and is intended as the optimized -// form for quantized execution on CPU. For a fully integer version, -// see the reference op. -// -// TODO(tflite): notes for optimization: -// 1) See if e^ is also bottleneck in the reference fully-integer -// version and apply lookup there and compare. -template -inline void LogSoftmax(const SoftmaxParams& params, float input_scale, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("LogSoftmax"); - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int excluding_last_dim = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int last_dim = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - - const int32_t clamp_max = std::numeric_limits::max(); - const int32_t clamp_min = std::numeric_limits::min(); - - int32_t zero_point_offset = 0; - if (std::is_same::value) { - zero_point_offset = 128; - } - for (int i = 0; i < excluding_last_dim; ++i) { - T max_val = std::numeric_limits::min(); - // Find max quantized value. - for (int j = 0; j < last_dim; ++j) { - max_val = std::max(max_val, input_data[j]); - } - - float sum_exp = 0.0f; - const int32_t max_q8 = std::numeric_limits::max(); - // Offset into table to compute exp(scale*(x - xmax)) instead of - // exp(scale*(x)) to prevent overflow. - const float* table_offset = ¶ms.table[max_q8 - max_val]; - // Calculate sum(exp(scale*(x - x_max))). - for (int j = 0; j < last_dim; ++j) { - sum_exp += table_offset[input_data[j]]; - } - const float log_sum_exp = std::log(sum_exp); - - // params.scale is the output scale. - const float scale = input_scale / params.scale; - const float precomputed = - (input_scale * (max_val + zero_point_offset) + log_sum_exp) / - params.scale; - for (int j = 0; j < last_dim; ++j) { - // Equivalent to (input_scale * (input_data[j] - max_val) - log_sum_exp) / - // output_scale. - const float log_prob = scale * input_data[j] - precomputed; - - // TODO(tflite): look into better solution. - // Use std::rint over std::round (which is used in - // FakeQuant) since it's multiple times faster on tested arm32. - const int32_t prob_quantized = std::rint(log_prob) + params.zero_point; - output_data[j] = static_cast( - std::max(std::min(clamp_max, prob_quantized), clamp_min)); - } - input_data += last_dim; - output_data += last_dim; - } -} - -inline void Logistic(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("Logistic"); - auto input_map = MapAsVector(input_data, input_shape); - auto output_map = MapAsVector(output_data, output_shape); - output_map.array() = - input_map.array().unaryExpr(Eigen::internal::scalar_logistic_op()); -} - -// Convenience version that allows, for example, generated-code calls to be -// uniform between data types. -inline void Logistic(const LogisticParams&, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& output_shape, - float* output_data) { - // Drop params: not needed. - Logistic(input_shape, input_data, output_shape, output_data); -} - -inline void Logistic(const LogisticParams& params, - const RuntimeShape& input_shape, const int16* input_data, - const RuntimeShape& output_shape, int16* output_data) { - ruy::profiler::ScopeLabel label("Logistic/Int16"); - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - } - - int c = 0; - const int16* input_data_ptr = input_data; - int16* output_data_ptr = output_data; -#ifdef GEMMLOWP_NEON - { - // F0 uses 0 integer bits, range [-1, 1]. - // This is the return type of math functions such as tanh, logistic, - // whose range is in [-1, 1]. - using F0 = gemmlowp::FixedPoint; - // F3 uses 3 integer bits, range [-8, 8], the input range expected here. - using F3 = gemmlowp::FixedPoint; - - for (; c <= flat_size - 16; c += 16) { - F3 input0 = F3::FromRaw(vld1q_s16(input_data_ptr)); - F3 input1 = F3::FromRaw(vld1q_s16(input_data_ptr + 8)); - F0 output0 = gemmlowp::logistic(input0); - F0 output1 = gemmlowp::logistic(input1); - vst1q_s16(output_data_ptr, output0.raw()); - vst1q_s16(output_data_ptr + 8, output1.raw()); - - input_data_ptr += 16; - output_data_ptr += 16; - } - for (; c <= flat_size - 8; c += 8) { - F3 input = F3::FromRaw(vld1q_s16(input_data_ptr)); - F0 output = gemmlowp::logistic(input); - vst1q_s16(output_data_ptr, output.raw()); - - input_data_ptr += 8; - output_data_ptr += 8; - } - } -#endif -#ifdef GEMMLOWP_SSE4 - { - // F0 uses 0 integer bits, range [-1, 1]. - // This is the return type of math functions such as tanh, logistic, - // whose range is in [-1, 1]. - using F0 = gemmlowp::FixedPoint; - // F3 uses 3 integer bits, range [-8, 8], the input range expected here. - using F3 = gemmlowp::FixedPoint; - - for (; c <= flat_size - 16; c += 16) { - F3 input0 = F3::FromRaw(gemmlowp::to_int16x8_m128i( - _mm_loadu_si128(reinterpret_cast(input_data_ptr)))); - F3 input1 = F3::FromRaw(gemmlowp::to_int16x8_m128i(_mm_loadu_si128( - reinterpret_cast(input_data_ptr + 8)))); - F0 output0 = gemmlowp::logistic(input0); - F0 output1 = gemmlowp::logistic(input1); - _mm_storeu_si128(reinterpret_cast<__m128i*>(output_data_ptr), - output0.raw().v); - _mm_storeu_si128(reinterpret_cast<__m128i*>(output_data_ptr + 8), - output1.raw().v); - input_data_ptr += 16; - output_data_ptr += 16; - } - for (; c <= flat_size - 8; c += 8) { - F3 input = F3::FromRaw(gemmlowp::to_int16x8_m128i( - _mm_loadu_si128(reinterpret_cast(input_data_ptr)))); - F0 output = gemmlowp::logistic(input); - _mm_storeu_si128(reinterpret_cast<__m128i*>(output_data_ptr), - output.raw().v); - input_data_ptr += 8; - output_data_ptr += 8; - } - } -#endif - - { - // F0 uses 0 integer bits, range [-1, 1]. - // This is the return type of math functions such as tanh, logistic, - // whose range is in [-1, 1]. - using F0 = gemmlowp::FixedPoint; - // F3 uses 3 integer bits, range [-8, 8], the input range expected here. - using F3 = gemmlowp::FixedPoint; - - for (; c < flat_size; ++c) { - F3 input = F3::FromRaw(*input_data_ptr); - F0 output = gemmlowp::logistic(input); - *output_data_ptr = output.raw(); - - ++input_data_ptr; - ++output_data_ptr; - } - } -} - -inline void Tanh(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("Tanh"); - auto input_map = MapAsVector(input_data, input_shape); - auto output_map = MapAsVector(output_data, output_shape); - output_map.array() = input_map.array().tanh(); -} - -// Convenience version that allows, for example, generated-code calls to be -// uniform between data types. -inline void Tanh(const TanhParams&, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& output_shape, - float* output_data) { - // Drop params: not needed. - Tanh(input_shape, input_data, output_shape, output_data); -} - -inline void Tanh(const TanhParams& params, const RuntimeShape& input_shape, - const int16* input_data, const RuntimeShape& output_shape, - int16* output_data) { - ruy::profiler::ScopeLabel label("Tanh/Int16"); - const int input_left_shift = params.input_left_shift; - // Support for shifts is limited until we have a parameterized version of - // SaturatingRoundingMultiplyByPOT(). - TFLITE_DCHECK_GE(input_left_shift, 0); - TFLITE_DCHECK_LE(input_left_shift, 1); - - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - int c = 0; - const int16* input_data_ptr = input_data; - int16* output_data_ptr = output_data; -#ifdef GEMMLOWP_NEON - { - // F0 uses 0 integer bits, range [-1, 1]. - // This is the return type of math functions such as tanh, logistic, - // whose range is in [-1, 1]. - using F0 = gemmlowp::FixedPoint; - // F3 uses 3 integer bits, range [-8, 8], the input range expected here. - using F3 = gemmlowp::FixedPoint; - - if (input_left_shift == 0) { - for (; c <= flat_size - 16; c += 16) { - F3 input0 = F3::FromRaw(vld1q_s16(input_data_ptr)); - F3 input1 = F3::FromRaw(vld1q_s16(input_data_ptr + 8)); - F0 output0 = gemmlowp::tanh(input0); - F0 output1 = gemmlowp::tanh(input1); - vst1q_s16(output_data_ptr, output0.raw()); - vst1q_s16(output_data_ptr + 8, output1.raw()); - - input_data_ptr += 16; - output_data_ptr += 16; - } - for (; c <= flat_size - 8; c += 8) { - F3 input = F3::FromRaw(vld1q_s16(input_data_ptr)); - F0 output = gemmlowp::tanh(input); - vst1q_s16(output_data_ptr, output.raw()); - - input_data_ptr += 8; - output_data_ptr += 8; - } - } else { - for (; c <= flat_size - 16; c += 16) { - F3 input0 = F3::FromRaw(gemmlowp::SaturatingRoundingMultiplyByPOT<1>( - vld1q_s16(input_data_ptr))); - F3 input1 = F3::FromRaw(gemmlowp::SaturatingRoundingMultiplyByPOT<1>( - vld1q_s16(input_data_ptr + 8))); - F0 output0 = gemmlowp::tanh(input0); - F0 output1 = gemmlowp::tanh(input1); - vst1q_s16(output_data_ptr, output0.raw()); - vst1q_s16(output_data_ptr + 8, output1.raw()); - - input_data_ptr += 16; - output_data_ptr += 16; - } - for (; c <= flat_size - 8; c += 8) { - F3 input = F3::FromRaw(gemmlowp::SaturatingRoundingMultiplyByPOT<1>( - vld1q_s16(input_data_ptr))); - F0 output = gemmlowp::tanh(input); - vst1q_s16(output_data_ptr, output.raw()); - - input_data_ptr += 8; - output_data_ptr += 8; - } - } - } -#endif -#ifdef GEMMLOWP_SSE4 - { - // F0 uses 0 integer bits, range [-1, 1]. - // This is the return type of math functions such as tanh, logistic, - // whose range is in [-1, 1]. - using F0 = gemmlowp::FixedPoint; - // F3 uses 3 integer bits, range [-8, 8], the input range expected here. - using F3 = gemmlowp::FixedPoint; - - if (input_left_shift == 0) { - for (; c <= flat_size - 16; c += 16) { - F3 input0 = F3::FromRaw(gemmlowp::to_int16x8_m128i( - _mm_loadu_si128(reinterpret_cast(input_data_ptr)))); - F3 input1 = F3::FromRaw(gemmlowp::to_int16x8_m128i(_mm_loadu_si128( - reinterpret_cast(input_data_ptr + 8)))); - F0 output0 = gemmlowp::tanh(input0); - F0 output1 = gemmlowp::tanh(input1); - _mm_storeu_si128(reinterpret_cast<__m128i*>(output_data_ptr), - output0.raw().v); - _mm_storeu_si128(reinterpret_cast<__m128i*>(output_data_ptr + 8), - output1.raw().v); - - input_data_ptr += 16; - output_data_ptr += 16; - } - for (; c <= flat_size - 8; c += 8) { - F3 input = F3::FromRaw(gemmlowp::to_int16x8_m128i( - _mm_loadu_si128(reinterpret_cast(input_data_ptr)))); - F0 output = gemmlowp::tanh(input); - _mm_storeu_si128(reinterpret_cast<__m128i*>(output_data_ptr), - output.raw().v); - input_data_ptr += 8; - output_data_ptr += 8; - } - } else { - for (; c <= flat_size - 16; c += 16) { - F3 input0 = F3::FromRaw(gemmlowp::SaturatingRoundingMultiplyByPOT<1>( - gemmlowp::to_int16x8_m128i(_mm_loadu_si128( - reinterpret_cast(input_data_ptr))))); - F3 input1 = F3::FromRaw(gemmlowp::SaturatingRoundingMultiplyByPOT<1>( - gemmlowp::to_int16x8_m128i(_mm_loadu_si128( - reinterpret_cast(input_data_ptr + 8))))); - F0 output0 = gemmlowp::tanh(input0); - F0 output1 = gemmlowp::tanh(input1); - _mm_storeu_si128(reinterpret_cast<__m128i*>(output_data_ptr), - output0.raw().v); - _mm_storeu_si128(reinterpret_cast<__m128i*>(output_data_ptr + 8), - output1.raw().v); - - input_data_ptr += 16; - output_data_ptr += 16; - } - for (; c <= flat_size - 8; c += 8) { - F3 input = F3::FromRaw(gemmlowp::SaturatingRoundingMultiplyByPOT<1>( - gemmlowp::to_int16x8_m128i(_mm_loadu_si128( - reinterpret_cast(input_data_ptr))))); - F0 output = gemmlowp::tanh(input); - _mm_storeu_si128(reinterpret_cast<__m128i*>(output_data_ptr), - output.raw().v); - input_data_ptr += 8; - output_data_ptr += 8; - } - } - } -#endif - - { - // F0 uses 0 integer bits, range [-1, 1]. - // This is the return type of math functions such as tanh, logistic, - // whose range is in [-1, 1]. - using F0 = gemmlowp::FixedPoint; - // F3 uses 3 integer bits, range [-8, 8], the input range expected here. - using F3 = gemmlowp::FixedPoint; - - if (input_left_shift == 0) { - for (; c < flat_size; ++c) { - F3 input = F3::FromRaw(*input_data_ptr); - F0 output = gemmlowp::tanh(input); - *output_data_ptr = output.raw(); - - ++input_data_ptr; - ++output_data_ptr; - } - } else { - for (; c < flat_size; ++c) { - F3 input = F3::FromRaw( - gemmlowp::SaturatingRoundingMultiplyByPOT<1>(*input_data_ptr)); - F0 output = gemmlowp::tanh(input); - *output_data_ptr = output.raw(); - - ++input_data_ptr; - ++output_data_ptr; - } - } - } -} - -template -inline void Cast(const RuntimeShape& input_shape, const SrcT* input_data, - const RuntimeShape& output_shape, DstT* output_data) { - ruy::profiler::ScopeLabel label("Cast"); - auto input_map = MapAsVector(input_data, input_shape); - auto output_map = MapAsVector(output_data, output_shape); - output_map.array() = input_map.array().template cast(); -} - -inline void Floor(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("Floor"); - auto input_map = MapAsVector(input_data, input_shape); - auto output_map = MapAsVector(output_data, output_shape); - output_map.array() = Eigen::floor(input_map.array()); -} - -inline void Ceil(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("Ceil"); - auto input_map = MapAsVector(input_data, input_shape); - auto output_map = MapAsVector(output_data, output_shape); - output_map.array() = Eigen::ceil(input_map.array()); -} - -#ifdef USE_NEON -inline void ResizeBilinearKernel(const float* input_ptr, int32 depth, - float scale, float* output_ptr) { - int ic = 0; - // Handle 32 input channels at a time. - for (; ic <= depth - 32; ic += 32) { - float32x4x2_t input[4]; - for (int i = 0; i < 4; i++) { - input[i].val[0] = vld1q_f32(input_ptr + 8 * i); - input[i].val[1] = vld1q_f32(input_ptr + 8 * i + 4); - } - float32x4x2_t acc[4]; - for (int i = 0; i < 4; i++) { - acc[i].val[0] = vld1q_f32(output_ptr + 8 * i); - acc[i].val[1] = vld1q_f32(output_ptr + 8 * i + 4); - } - for (int i = 0; i < 4; i++) { - acc[i].val[0] = vmlaq_n_f32(acc[i].val[0], input[i].val[0], scale); - acc[i].val[1] = vmlaq_n_f32(acc[i].val[1], input[i].val[1], scale); - } - for (int i = 0; i < 4; i++) { - vst1q_f32(output_ptr, acc[i].val[0]); - vst1q_f32(output_ptr + 4, acc[i].val[1]); - output_ptr += 8; - } - input_ptr += 32; - } - // Handle 16 input channels at a time. - for (; ic <= depth - 16; ic += 16) { - float32x4x2_t input[2]; - for (int i = 0; i < 2; i++) { - input[i].val[0] = vld1q_f32(input_ptr + 8 * i); - input[i].val[1] = vld1q_f32(input_ptr + 8 * i + 4); - } - float32x4x2_t acc[2]; - for (int i = 0; i < 2; i++) { - acc[i].val[0] = vld1q_f32(output_ptr + 8 * i); - acc[i].val[1] = vld1q_f32(output_ptr + 8 * i + 4); - } - for (int i = 0; i < 2; i++) { - acc[i].val[0] = vmlaq_n_f32(acc[i].val[0], input[i].val[0], scale); - acc[i].val[1] = vmlaq_n_f32(acc[i].val[1], input[i].val[1], scale); - } - for (int i = 0; i < 2; i++) { - vst1q_f32(output_ptr, acc[i].val[0]); - vst1q_f32(output_ptr + 4, acc[i].val[1]); - output_ptr += 8; - } - input_ptr += 16; - } - // Handle 8 input channels at a time. - for (; ic <= depth - 8; ic += 8) { - float32x4x2_t input; - input.val[0] = vld1q_f32(input_ptr); - input.val[1] = vld1q_f32(input_ptr + 4); - - float32x4x2_t acc; - acc.val[0] = vld1q_f32(output_ptr); - acc.val[1] = vld1q_f32(output_ptr + 4); - acc.val[0] = vmlaq_n_f32(acc.val[0], input.val[0], scale); - acc.val[1] = vmlaq_n_f32(acc.val[1], input.val[1], scale); - - vst1q_f32(output_ptr, acc.val[0]); - vst1q_f32(output_ptr + 4, acc.val[1]); - - input_ptr += 8; - output_ptr += 8; - } - // Handle 4 input channels at a time. - for (; ic <= depth - 4; ic += 4) { - float32x4_t input = vld1q_f32(input_ptr); - float32x4_t acc = vld1q_f32(output_ptr); - - acc = vmlaq_n_f32(acc, input, scale); - vst1q_f32(output_ptr, acc); - - input_ptr += 4; - output_ptr += 4; - } - // Handle 1 input channel at a time. - for (; ic < depth; ic++) { - *output_ptr += *input_ptr * scale; - output_ptr++; - input_ptr++; - } -} -#else -inline void ResizeBilinearKernel(const float* input_ptr, int32 depth, - float scale, float* output_ptr) { - for (int32 i = 0; i < depth; i++) { - *output_ptr += *input_ptr * scale; - output_ptr++; - input_ptr++; - } -} -#endif - -inline void ResizeBilinearKernel2x2(int32 x0, int32 x1, int32 y0, int32 y1, - int32 x, int32 y, int32 depth, int32 batch, - const RuntimeShape& input_shape, - const float* input_data, - const RuntimeShape& output_shape, - float* output_data) { - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int32 input_width = input_shape.Dims(2); - const int32 output_width = output_shape.Dims(2); - - const int32 input_x_offset = (x1 - x0) * depth; - const int32 input_y_offset = (y1 - y0) * depth * input_width; - const int32 output_x_offset = depth; - const int32 output_y_offset = depth * output_width; - -#ifdef USE_NEON - TFLITE_DCHECK(x1 >= x0); - TFLITE_DCHECK(y1 >= y0); - - int ic = 0; - // Handle 8 input channels at a time. - for (; ic <= depth - 8; ic += 8) { - const float* input_ptr = nullptr; - - float32x4x2_t x0y0; - input_ptr = &input_data[Offset(input_shape, batch, y0, x0, ic)]; - x0y0.val[0] = vld1q_f32(input_ptr); - x0y0.val[1] = vld1q_f32(input_ptr + 4); - - float32x4x2_t x1y0; - input_ptr += input_x_offset; - x1y0.val[0] = vld1q_f32(input_ptr); - x1y0.val[1] = vld1q_f32(input_ptr + 4); - - float32x4x2_t x0y1; - input_ptr += -input_x_offset + input_y_offset; - x0y1.val[0] = vld1q_f32(input_ptr); - x0y1.val[1] = vld1q_f32(input_ptr + 4); - - float32x4x2_t x1y1; - input_ptr += input_x_offset; - x1y1.val[0] = vld1q_f32(input_ptr); - x1y1.val[1] = vld1q_f32(input_ptr + 4); - - // Top left corner. - float* output_ptr = &output_data[Offset(output_shape, batch, y, x, ic)]; - vst1q_f32(output_ptr, x0y0.val[0]); - vst1q_f32(output_ptr + 4, x0y0.val[1]); - - // Top right corner. - output_ptr += output_x_offset; - float32x4x2_t tr; - tr.val[0] = vaddq_f32(x0y0.val[0], x1y0.val[0]); - tr.val[1] = vaddq_f32(x0y0.val[1], x1y0.val[1]); - tr.val[0] = vmulq_n_f32(tr.val[0], 0.5f); - tr.val[1] = vmulq_n_f32(tr.val[1], 0.5f); - - vst1q_f32(output_ptr, tr.val[0]); - vst1q_f32(output_ptr + 4, tr.val[1]); - - // Bottom left corner. - output_ptr += -output_x_offset + output_y_offset; - float32x4x2_t bl; - bl.val[0] = vaddq_f32(x0y0.val[0], x0y1.val[0]); - bl.val[1] = vaddq_f32(x0y0.val[1], x0y1.val[1]); - bl.val[0] = vmulq_n_f32(bl.val[0], 0.5f); - bl.val[1] = vmulq_n_f32(bl.val[1], 0.5f); - vst1q_f32(output_ptr, bl.val[0]); - vst1q_f32(output_ptr + 4, bl.val[1]); - - // Bottom right corner. - output_ptr += output_x_offset; - float32x4x2_t br; - br.val[0] = vaddq_f32(x1y0.val[0], x1y1.val[0]); - br.val[1] = vaddq_f32(x1y0.val[1], x1y1.val[1]); - br.val[0] = vmlaq_n_f32(bl.val[0], br.val[0], 0.5f); - br.val[1] = vmlaq_n_f32(bl.val[1], br.val[1], 0.5f); - br.val[0] = vmulq_n_f32(br.val[0], 0.5f); - br.val[1] = vmulq_n_f32(br.val[1], 0.5f); - vst1q_f32(output_ptr, br.val[0]); - vst1q_f32(output_ptr + 4, br.val[1]); - } - // Handle 4 input channels at a time. - for (; ic <= depth - 4; ic += 4) { - const float* input_ptr = - &input_data[Offset(input_shape, batch, y0, x0, ic)]; - float32x4_t x0y0 = vld1q_f32(input_ptr); - float32x4_t x1y0 = vld1q_f32(input_ptr + input_x_offset); - float32x4_t x0y1 = vld1q_f32(input_ptr + input_y_offset); - float32x4_t x1y1 = vld1q_f32(input_ptr + input_x_offset + input_y_offset); - - // Top left corner. - float* output_ptr = &output_data[Offset(output_shape, batch, y, x, ic)]; - vst1q_f32(output_ptr, x0y0); - - // Top right corner. - output_ptr += output_x_offset; - float32x4_t tr = vaddq_f32(x0y0, x1y0); - tr = vmulq_n_f32(tr, 0.5f); - vst1q_f32(output_ptr, tr); - - // Bottom left corner. - output_ptr += -output_x_offset + output_y_offset; - float32x4_t bl = vaddq_f32(x0y0, x0y1); - bl = vmulq_n_f32(bl, 0.5f); - vst1q_f32(output_ptr, bl); - - // Bottom right corner. - output_ptr += output_x_offset; - float32x4_t br = vaddq_f32(x1y0, x1y1); - br = vmlaq_n_f32(bl, br, 0.5f); - br = vmulq_n_f32(br, 0.5f); - vst1q_f32(output_ptr, br); - } - // Handle one input channel at a time. - for (; ic < depth; ic++) { - const int32 input_offset = Offset(input_shape, batch, y0, x0, ic); - - float x0y0 = input_data[input_offset]; - float x1y0 = input_data[input_offset + input_x_offset]; - float x0y1 = input_data[input_offset + input_y_offset]; - float x1y1 = input_data[input_offset + input_x_offset + input_y_offset]; - - // Top left corner. - const int32 output_offset = Offset(output_shape, batch, y, x, ic); - output_data[output_offset] = x0y0; - - // Top right corner. - output_data[output_offset + output_x_offset] = (x0y0 + x1y0) / 2; - - // Bottom left corner. - float output = (x0y0 + x0y1) / 2; - output_data[output_offset + output_y_offset] = output; - - // Bottom right corner. - output_data[output_offset + output_x_offset + output_y_offset] = - (output + ((x1y0 + x1y1) / 2)) / 2; - } -#else - for (int ch = 0; ch < depth; ch++) { - const int32 input_offset = Offset(input_shape, batch, y0, x0, ch); - - float x0y0 = input_data[input_offset]; - float x1y0 = input_data[input_offset + input_x_offset]; - float x0y1 = input_data[input_offset + input_y_offset]; - float x1y1 = input_data[input_offset + input_x_offset + input_y_offset]; - - // Top left corner. - const int32 output_offset = Offset(output_shape, batch, y, x, ch); - output_data[output_offset] = x0y0; - - // Top right corner. - output_data[output_offset + output_x_offset] = (x0y0 + x1y0) / 2; - - // Bottom left corner. - float output = (x0y0 + x0y1) / 2; - output_data[output_offset + output_y_offset] = output; - - // Bottom right corner. - output_data[output_offset + output_x_offset + output_y_offset] = - (output + ((x1y0 + x1y1) / 2)) / 2; - } -#endif -} - -inline void ResizeBilinear2x2(int32 batches, int32 input_height, - int32 input_width, int32 depth, - int32 output_height, int32 output_width, - const RuntimeShape& input_shape, - const float* input_data, - const RuntimeShape& output_shape, - float* output_data) { - for (int b = 0; b < batches; b++) { - for (int y0 = 0, y = 0; y <= output_height - 2; y += 2, y0++) { - for (int x0 = 0, x = 0; x <= output_width - 2; x += 2, x0++) { - int32 x1 = std::min(x0 + 1, input_width - 1); - int32 y1 = std::min(y0 + 1, input_height - 1); - ResizeBilinearKernel2x2(x0, x1, y0, y1, x, y, depth, b, input_shape, - input_data, output_shape, output_data); - } - } - } -} - -inline void ResizeBilinearGeneric( - int32 batches, int32 input_height, int32 input_width, int32 depth, - int32 output_height, int32 output_width, float height_scale, - float width_scale, const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data, - const bool half_pixel_centers) { - memset(output_data, 0, - batches * output_height * output_width * depth * sizeof(float)); - - int32 output_offset = 0; - for (int b = 0; b < batches; ++b) { - for (int y = 0; y < output_height; ++y) { - float input_y; - int32 y0, y1; - reference_ops::ComputeInterpolationValues( - y, height_scale, half_pixel_centers, input_height, &input_y, &y0, - &y1); - for (int x = 0; x < output_width; ++x) { - float input_x; - int32 x0, x1; - reference_ops::ComputeInterpolationValues( - x, width_scale, half_pixel_centers, input_width, &input_x, &x0, - &x1); - float* output_ptr = &output_data[output_offset]; - - // Run kernel on the 4 corners of the bilinear resize algorithm. - int32 input_offset = Offset(input_shape, b, y0, x0, 0); - float scale = (1 - (input_y - y0)) * (1 - (input_x - x0)); - const float* input_ptr = &input_data[input_offset]; - ResizeBilinearKernel(input_ptr, depth, scale, output_ptr); - - input_offset = Offset(input_shape, b, y0, x1, 0); - scale = (1 - (input_y - y0)) * (input_x - x0); - input_ptr = &input_data[input_offset]; - ResizeBilinearKernel(input_ptr, depth, scale, output_ptr); - - input_offset = Offset(input_shape, b, y1, x0, 0); - scale = (input_y - y0) * (1 - (input_x - x0)); - input_ptr = &input_data[input_offset]; - ResizeBilinearKernel(input_ptr, depth, scale, output_ptr); - - input_offset = Offset(input_shape, b, y1, x1, 0); - scale = (input_y - y0) * (input_x - x0); - input_ptr = &input_data[input_offset]; - ResizeBilinearKernel(input_ptr, depth, scale, output_ptr); - - output_offset += depth; - } - } - } -} - -template -inline void ResizeBilinearGenericSmallChannel( - int32 batches, int32 input_height, int32 input_width, int32 depth, - int32 output_height, int32 output_width, float height_scale, - float width_scale, const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data, - const bool half_pixel_centers) { - T* output_ptr = &output_data[0]; - for (int b = 0; b < batches; ++b) { - for (int y = 0; y < output_height; ++y) { - float input_y; - int32 y0, y1; - reference_ops::ComputeInterpolationValues( - y, height_scale, half_pixel_centers, input_height, &input_y, &y0, - &y1); - for (int x = 0; x < output_width; ++x) { - float input_x; - int32 x0, x1; - reference_ops::ComputeInterpolationValues( - x, width_scale, half_pixel_centers, input_width, &input_x, &x0, - &x1); - - int32 input_offset[4] = {Offset(input_shape, b, y0, x0, 0), - Offset(input_shape, b, y0, x1, 0), - Offset(input_shape, b, y1, x0, 0), - Offset(input_shape, b, y1, x1, 0)}; - float scale[4] = {(1 - (input_y - y0)) * (1 - (input_x - x0)), - (1 - (input_y - y0)) * (input_x - x0), - (input_y - y0) * (1 - (input_x - x0)), - (input_y - y0) * (input_x - x0)}; - - for (int d = 0; d < depth; d++) { - const T* input_ptr = &input_data[d]; - *output_ptr++ = static_cast(input_ptr[input_offset[0]] * scale[0] + - input_ptr[input_offset[1]] * scale[1] + - input_ptr[input_offset[2]] * scale[2] + - input_ptr[input_offset[3]] * scale[3]); - } - } - } - } -} - -inline void ResizeBilinear(const tflite::ResizeBilinearParams& op_params, - const RuntimeShape& unextended_input_shape, - const float* input_data, - const RuntimeShape& output_size_shape, - const int32* output_size_data, - const RuntimeShape& unextended_output_shape, - float* output_data) { - ruy::profiler::ScopeLabel label("ResizeBilinear"); - // If half_pixel_centers is True, align_corners must be False. - TFLITE_DCHECK(!op_params.half_pixel_centers || !op_params.align_corners); - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - int32 batches = MatchingDim(input_shape, 0, output_shape, 0); - int32 input_height = input_shape.Dims(1); - int32 input_width = input_shape.Dims(2); - int32 depth = MatchingDim(input_shape, 3, output_shape, 3); - - TFLITE_DCHECK_EQ(output_size_shape.FlatSize(), 2); - int32 output_height = output_size_data[0]; - int32 output_width = output_size_data[1]; - - // Specialize for 2x2 upsample. - if (!op_params.align_corners && !op_params.half_pixel_centers && - output_height == 2 * input_height && output_width == 2 * input_width) { - ResizeBilinear2x2(batches, input_height, input_width, depth, output_height, - output_width, input_shape, input_data, output_shape, - output_data); - } else { - float height_scale = static_cast(input_height) / output_height; - float width_scale = static_cast(input_width) / output_width; - if (op_params.align_corners && output_height > 1) { - height_scale = static_cast(input_height - 1) / (output_height - 1); - } - if (op_params.align_corners && output_width > 1) { - width_scale = static_cast(input_width - 1) / (output_width - 1); - } - - ResizeBilinearGeneric(batches, input_height, input_width, depth, - output_height, output_width, height_scale, - width_scale, input_shape, input_data, output_shape, - output_data, op_params.half_pixel_centers); - } -} - -// TODO(prabhumk): This is not a real quantized bilinear. It does not use int8 -// or int16 arithmetic. -inline void ResizeBilinear(const tflite::ResizeBilinearParams& op_params, - const RuntimeShape& unextended_input_shape, - const uint8* input_data, - const RuntimeShape& output_size_shape, - const int32* output_size_data, - const RuntimeShape& unextended_output_shape, - uint8* output_data) { - ruy::profiler::ScopeLabel label("ResizeBilinear"); - // If half_pixel_centers is True, align_corners must be False. - TFLITE_DCHECK(!op_params.half_pixel_centers || !op_params.align_corners); - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - int32 batches = MatchingDim(input_shape, 0, output_shape, 0); - int32 input_height = input_shape.Dims(1); - int32 input_width = input_shape.Dims(2); - int32 depth = MatchingDim(input_shape, 3, output_shape, 3); - - TFLITE_DCHECK_EQ(output_size_shape.FlatSize(), 2); - int32 output_height = output_size_data[0]; - int32 output_width = output_size_data[1]; - - float height_scale = - (op_params.align_corners && output_height > 1) - ? (static_cast(input_height - 1) / (output_height - 1)) - : (static_cast(input_height) / output_height); - - float width_scale = - (op_params.align_corners && output_width > 1) - ? (static_cast(input_width - 1) / (output_width - 1)) - : (static_cast(input_width) / output_width); - - ResizeBilinearGenericSmallChannel( - batches, input_height, input_width, depth, output_height, output_width, - height_scale, width_scale, input_shape, input_data, output_shape, - output_data, op_params.half_pixel_centers); -} - -// Helper methods for BatchToSpaceND. -// `spatial_index_dim` specifies post-crop offset index in this spatial -// dimension, i.e. spatial offset introduced by flattening batch to spatial -// dimension minus the crop size at beginning. `block_shape_dim` is the block -// size in current dimension. `input_dim` and `output_dim` are input and output -// size of BatchToSpaceND operation in current dimension. -// Output start index is inclusive and end index is exclusive. -inline void GetIndexRange(int spatial_index_dim, int block_shape_dim, - int input_dim, int output_dim, int* start_index, - int* end_index) { - // (*start_index) * block_shape_dim is effectively rounded up to the next - // multiple of block_shape_dim by the integer division. - *start_index = - std::max(0, (-spatial_index_dim + block_shape_dim - 1) / block_shape_dim); - // Similarly, (*end_index) * block_shape_dim is rounded up too (note that - // end_index is exclusive). - *end_index = std::min( - input_dim, - (output_dim - spatial_index_dim + block_shape_dim - 1) / block_shape_dim); -} - -template -inline void BatchToSpaceND( - const RuntimeShape& unextended_input1_shape, const T* input1_data, - const RuntimeShape& unextended_input2_shape, const int32* block_shape_data, - const RuntimeShape& unextended_input3_shape, const int32* crops_data, - const RuntimeShape& unextended_output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("BatchToSpaceND"); - - TFLITE_DCHECK_GE(unextended_input1_shape.DimensionsCount(), 3); - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(unextended_input1_shape.DimensionsCount(), - unextended_output_shape.DimensionsCount()); - - // Extends the input/output shape from 3D to 4D if needed, NHC -> NH1C. - auto extend_shape = [](const RuntimeShape& shape) { - if (shape.DimensionsCount() == 4) { - return shape; - } - RuntimeShape new_shape(4, 1); - new_shape.SetDim(0, shape.Dims(0)); - new_shape.SetDim(1, shape.Dims(1)); - new_shape.SetDim(3, shape.Dims(2)); - return new_shape; - }; - const RuntimeShape input1_shape = extend_shape(unextended_input1_shape); - const RuntimeShape output_shape = extend_shape(unextended_output_shape); - - const int output_width = output_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_batch_size = output_shape.Dims(0); - - const int depth = input1_shape.Dims(3); - const int input_width = input1_shape.Dims(2); - const int input_height = input1_shape.Dims(1); - const int input_batch_size = input1_shape.Dims(0); - - const int block_shape_height = block_shape_data[0]; - const int block_shape_width = - unextended_input1_shape.DimensionsCount() == 4 ? block_shape_data[1] : 1; - const int crops_top = crops_data[0]; - const int crops_left = - unextended_input1_shape.DimensionsCount() == 4 ? crops_data[2] : 0; - - for (int in_batch = 0; in_batch < input_batch_size; ++in_batch) { - const int out_batch = in_batch % output_batch_size; - const int spatial_offset = in_batch / output_batch_size; - - int in_h_start = 0; - int in_h_end = 0; - // GetIndexRange ensures start and end indices are in [0, output_height). - GetIndexRange(spatial_offset / block_shape_width - crops_top, - block_shape_height, input_height, output_height, &in_h_start, - &in_h_end); - - for (int in_h = in_h_start; in_h < in_h_end; ++in_h) { - const int out_h = in_h * block_shape_height + - spatial_offset / block_shape_width - crops_top; - TFLITE_DCHECK_GE(out_h, 0); - TFLITE_DCHECK_LT(out_h, output_height); - - int in_w_start = 0; - int in_w_end = 0; - // GetIndexRange ensures start and end indices are in [0, output_width). - GetIndexRange(spatial_offset % block_shape_width - crops_left, - block_shape_width, input_width, output_width, &in_w_start, - &in_w_end); - - for (int in_w = in_w_start; in_w < in_w_end; ++in_w) { - const int out_w = in_w * block_shape_width + - spatial_offset % block_shape_width - crops_left; - TFLITE_DCHECK_GE(out_w, 0); - TFLITE_DCHECK_LT(out_w, output_width); - T* out = output_data + Offset(output_shape, out_batch, out_h, out_w, 0); - const T* in = - input1_data + Offset(input1_shape, in_batch, in_h, in_w, 0); - memcpy(out, in, depth * sizeof(T)); - } - } - } -} - -template -void TypedMemset(void* ptr, T value, size_t num) { - // Optimization for common cases where memset() will suffice. - if (value == 0 || std::is_same::value) { - memset(ptr, value, num * sizeof(T)); - } else { - // Default implementation for cases where memset() will not preserve the - // bytes, e.g., typically when sizeof(T) > sizeof(uint8_t). - char* pos = static_cast(ptr); - for (size_t i = 0; i < num; ++i) { - memcpy(pos, &value, sizeof(T)); - pos = pos + sizeof(T); - } - } -} - -// This makes heavy use of Offset, along with conditional branches. There may be -// opportunities for improvement. -// -// There are two versions of pad: Pad and PadV2. In PadV2 there is a second -// scalar input that provides the padding value. Therefore pad_value_ptr can be -// equivalent to a simple input1_data. For Pad, it should point to a zero -// value. -// -// Note that two typenames are required, so that T=P=int32 is considered a -// specialization distinct from P=int32. -template -inline void PadImpl(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const P* pad_value_ptr, const RuntimeShape& output_shape, - T* output_data) { - ruy::profiler::ScopeLabel label("Pad4DSlowImpl"); - const RuntimeShape ext_input_shape = - RuntimeShape::ExtendedShape(4, input_shape); - const RuntimeShape ext_output_shape = - RuntimeShape::ExtendedShape(4, output_shape); - TFLITE_DCHECK_LE(op_params.left_padding_count, 4); - TFLITE_DCHECK_LE(op_params.right_padding_count, 4); - - // Pad kernels are limited to max 4 dimensions. Copy inputs so we can pad them - // to 4 dims (yes, we are "padding the padding"). - std::vector left_padding_copy(4, 0); - const int left_padding_extend = 4 - op_params.left_padding_count; - for (int i = 0; i < op_params.left_padding_count; ++i) { - left_padding_copy[left_padding_extend + i] = op_params.left_padding[i]; - } - std::vector right_padding_copy(4, 0); - const int right_padding_extend = 4 - op_params.right_padding_count; - for (int i = 0; i < op_params.right_padding_count; ++i) { - right_padding_copy[right_padding_extend + i] = op_params.right_padding[i]; - } - - const int output_batch = ext_output_shape.Dims(0); - const int output_height = ext_output_shape.Dims(1); - const int output_width = ext_output_shape.Dims(2); - const int output_depth = ext_output_shape.Dims(3); - - const int left_b_padding = left_padding_copy[0]; - const int left_h_padding = left_padding_copy[1]; - const int left_w_padding = left_padding_copy[2]; - const int left_d_padding = left_padding_copy[3]; - - const int right_b_padding = right_padding_copy[0]; - const int right_h_padding = right_padding_copy[1]; - const int right_w_padding = right_padding_copy[2]; - const int right_d_padding = right_padding_copy[3]; - - const int input_depth = ext_input_shape.Dims(3); - const T pad_value = *pad_value_ptr; - - if (left_b_padding != 0) { - TypedMemset( - output_data, pad_value, - left_b_padding * output_height * output_width * output_depth); - } - for (int out_b = left_b_padding; out_b < output_batch - right_b_padding; - ++out_b) { - if (left_h_padding != 0) { - TypedMemset(output_data + Offset(ext_output_shape, out_b, 0, 0, 0), - pad_value, left_h_padding * output_width * output_depth); - } - for (int out_h = left_h_padding; out_h < output_height - right_h_padding; - ++out_h) { - if (left_w_padding != 0) { - TypedMemset( - output_data + Offset(ext_output_shape, out_b, out_h, 0, 0), - pad_value, left_w_padding * output_depth); - } - for (int out_w = left_w_padding; out_w < output_width - right_w_padding; - ++out_w) { - if (left_d_padding != 0) { - TypedMemset( - output_data + Offset(ext_output_shape, out_b, out_h, out_w, 0), - pad_value, left_d_padding); - } - - T* out = output_data + - Offset(ext_output_shape, out_b, out_h, out_w, left_d_padding); - const T* in = input_data + - Offset(ext_input_shape, out_b - left_b_padding, - out_h - left_h_padding, out_w - left_w_padding, 0); - memcpy(out, in, input_depth * sizeof(T)); - - if (right_d_padding != 0) { - TypedMemset( - output_data + Offset(ext_output_shape, out_b, out_h, out_w, - output_depth - right_d_padding), - pad_value, right_d_padding); - } - } - if (right_w_padding != 0) { - TypedMemset(output_data + Offset(ext_output_shape, out_b, out_h, - output_width - right_w_padding, 0), - pad_value, right_w_padding * output_depth); - } - } - if (right_h_padding != 0) { - TypedMemset( - output_data + Offset(ext_output_shape, out_b, - output_height - right_h_padding, 0, 0), - pad_value, right_h_padding * output_width * output_depth); - } - } - if (right_b_padding != 0) { - TypedMemset( - output_data + - Offset(ext_output_shape, output_batch - right_b_padding, 0, 0, 0), - pad_value, - right_b_padding * output_height * output_width * output_depth); - } -} - -template -inline void Pad(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const P* pad_value_ptr, const RuntimeShape& output_shape, - T* output_data) { - PadImpl(op_params, input_shape, input_data, pad_value_ptr, output_shape, - output_data); -} - -// The second (pad-value) input can be int32 when, say, the first is uint8. -template -inline void Pad(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const int32* pad_value_ptr, const RuntimeShape& output_shape, - T* output_data) { - const T converted_pad_value = static_cast(*pad_value_ptr); - PadImpl(op_params, input_shape, input_data, &converted_pad_value, - output_shape, output_data); -} - -// This version avoids conflicting template matching. -template <> -inline void Pad(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, const int32* input_data, - const int32* pad_value_ptr, const RuntimeShape& output_shape, - int32* output_data) { - PadImpl(op_params, input_shape, input_data, pad_value_ptr, output_shape, - output_data); -} - -// TODO(b/117643175): Optimize. (This is an introductory copy of standard Pad.) -// -// This pad requires that (a) left and right paddings are in the 4D patterns -// {0, h_pad, w_pad, 0}, and (b) memset can be used: *pad_value_ptr == 0 and/or -// T is uint8. -// -// There are two versions of pad: Pad and PadV2. In PadV2 there is a second -// scalar input that provides the padding value. Therefore pad_value_ptr can be -// equivalent to a simple input1_data. For Pad, it should point to a zero -// value. -// -// Note that two typenames are required, so that T=P=int32 is considered a -// specialization distinct from P=int32. -template -inline void PadImageStyleMemset(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, - const T* input_data, const P* pad_value_ptr, - const RuntimeShape& output_shape, - T* output_data) { - ruy::profiler::ScopeLabel label("PadImageStyle"); - const RuntimeShape ext_input_shape = - RuntimeShape::ExtendedShape(4, input_shape); - const RuntimeShape ext_output_shape = - RuntimeShape::ExtendedShape(4, output_shape); - TFLITE_DCHECK_LE(op_params.left_padding_count, 4); - TFLITE_DCHECK_LE(op_params.right_padding_count, 4); - - // Pad kernels are limited to max 4 dimensions. Copy inputs so we can pad them - // to 4 dims (yes, we are "padding the padding"). - std::vector left_padding_copy(4, 0); - const int left_padding_extend = 4 - op_params.left_padding_count; - for (int i = 0; i < op_params.left_padding_count; ++i) { - left_padding_copy[left_padding_extend + i] = op_params.left_padding[i]; - } - std::vector right_padding_copy(4, 0); - const int right_padding_extend = 4 - op_params.right_padding_count; - for (int i = 0; i < op_params.right_padding_count; ++i) { - right_padding_copy[right_padding_extend + i] = op_params.right_padding[i]; - } - // The following padding restrictions are contractual requirements, and - // embody what it means for a padding op to be "image-style". - TFLITE_DCHECK_EQ(left_padding_copy[0], 0); - TFLITE_DCHECK_EQ(left_padding_copy[3], 0); - TFLITE_DCHECK_EQ(right_padding_copy[0], 0); - TFLITE_DCHECK_EQ(right_padding_copy[3], 0); - - const int batch = MatchingDim(ext_input_shape, 0, ext_output_shape, 0); - const int output_height = ext_output_shape.Dims(1); - const int output_width = ext_output_shape.Dims(2); - const int input_height = ext_input_shape.Dims(1); - const int input_width = ext_input_shape.Dims(2); - const int depth = MatchingDim(ext_input_shape, 3, ext_output_shape, 3); - - const int left_h_padding = left_padding_copy[1]; - const int left_w_padding = left_padding_copy[2]; - const int right_h_padding = right_padding_copy[1]; - const int right_w_padding = right_padding_copy[2]; - - TFLITE_DCHECK_EQ(output_height, - input_height + left_h_padding + right_h_padding); - TFLITE_DCHECK_EQ(output_width, - input_width + left_w_padding + right_w_padding); - - const T pad_value = *pad_value_ptr; - const int top_block_size = left_h_padding * output_width * depth; - const size_t num_top_block_bytes = top_block_size * sizeof(T); - const int bottom_block_size = right_h_padding * output_width * depth; - const size_t num_bottom_block_bytes = bottom_block_size * sizeof(T); - const int left_blocks_size = left_w_padding * depth; - const size_t num_left_block_bytes = left_blocks_size * sizeof(T); - const int right_blocks_size = right_w_padding * depth; - const size_t num_right_block_bytes = right_blocks_size * sizeof(T); - const int inner_line_size = input_width * depth; - const size_t num_inner_line_bytes = inner_line_size * sizeof(T); - - if (input_height == 0) { - memset(output_data, pad_value, - num_top_block_bytes + num_bottom_block_bytes); - } else { - for (int i = 0; i < batch; ++i) { - // For each image in the batch, apply the top padding, then iterate - // through rows, then apply the bottom padding. - // - // By unwinding one iteration, we can combine the first left-margin - // padding with the top padding, and the last right-margin padding with - // the bottom padding. - memset(output_data, pad_value, - num_top_block_bytes + num_left_block_bytes); - output_data += top_block_size + left_blocks_size; - memcpy(output_data, input_data, num_inner_line_bytes); - input_data += inner_line_size; - output_data += inner_line_size; - // One iteration unwound. - // Unwinding this loop affords the opportunity to reorder the loop work - // and hence combine memset() calls. - // - // Before unwinding: - // for (int j = 0; j < input_height; ++j) { - // // Pad on left, copy central data, pad on right. - // memset(output_data, pad_value, num_left_block_bytes); - // output_data += left_blocks_size; - // memcpy(output_data, input_data, num_inner_line_bytes); - // input_data += inner_line_size; - // output_data += inner_line_size; - // memset(output_data, pad_value, num_right_block_bytes); - // output_data += right_blocks_size; - // } - for (int j = 1; j < input_height; ++j) { - memset(output_data, pad_value, - num_right_block_bytes + num_left_block_bytes); - output_data += right_blocks_size + left_blocks_size; - memcpy(output_data, input_data, num_inner_line_bytes); - input_data += inner_line_size; - output_data += inner_line_size; - } - memset(output_data, pad_value, - num_right_block_bytes + num_bottom_block_bytes); - output_data += right_blocks_size + bottom_block_size; - } - } -} - -template -inline void PadImageStyle(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const P* pad_value_ptr, - const RuntimeShape& output_shape, T* output_data) { - reference_ops::PadImageStyle(op_params, input_shape, input_data, - pad_value_ptr, output_shape, output_data); -} - -template -inline void PadImageStyle(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, - const uint8* input_data, const P* pad_value_ptr, - const RuntimeShape& output_shape, - uint8* output_data) { - PadImageStyleMemset(op_params, input_shape, input_data, pad_value_ptr, - output_shape, output_data); -} - -template -inline void PadImageStyle(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, - const float* input_data, const P* pad_value_ptr, - const RuntimeShape& output_shape, - float* output_data) { - const float converted_pad_value = static_cast(*pad_value_ptr); - if (converted_pad_value == 0.0f) { - PadImageStyleMemset(op_params, input_shape, input_data, pad_value_ptr, - output_shape, output_data); - } else { - PadImpl(op_params, input_shape, input_data, pad_value_ptr, output_shape, - output_data); - } -} - -template -inline void Slice(const tflite::SliceParams& op_params, - const RuntimeShape& input_shape, - const RuntimeShape& output_shape, - SequentialTensorWriter* writer) { - ruy::profiler::ScopeLabel label("Slice"); - const RuntimeShape ext_shape = RuntimeShape::ExtendedShape(4, input_shape); - // TODO(dkalenichenko): This op only supports 4D tensors or smaller. - TFLITE_DCHECK_LE(op_params.begin_count, 4); - TFLITE_DCHECK_LE(op_params.size_count, 4); - const int begin_count = op_params.begin_count; - const int size_count = op_params.size_count; - // We front-pad the begin and size vectors. - const int start_b = 4 - begin_count > 0 ? 0 : op_params.begin[0]; - const int stop_b = (4 - size_count > 0 || op_params.size[0] == -1) - ? ext_shape.Dims(0) - : start_b + op_params.size[0]; - const int start_h = begin_count < 3 ? 0 : op_params.begin[begin_count - 3]; - const int stop_h = (size_count < 3 || op_params.size[size_count - 3] == -1) - ? ext_shape.Dims(1) - : start_h + op_params.size[size_count - 3]; - const int start_w = begin_count < 2 ? 0 : op_params.begin[begin_count - 2]; - const int stop_w = (size_count < 2 || op_params.size[size_count - 2] == -1) - ? ext_shape.Dims(2) - : start_w + op_params.size[size_count - 2]; - const int start_d = begin_count < 1 ? 0 : op_params.begin[begin_count - 1]; - const int stop_d = (size_count < 1 || op_params.size[size_count - 1] == -1) - ? ext_shape.Dims(3) - : start_d + op_params.size[size_count - 1]; - - for (int in_b = start_b; in_b < stop_b; ++in_b) { - for (int in_h = start_h; in_h < stop_h; ++in_h) { - for (int in_w = start_w; in_w < stop_w; ++in_w) { - const int len = stop_d - start_d; - if (len > 0) - writer->WriteN(Offset(ext_shape, in_b, in_h, in_w, start_d), len); - } - } - } -} - -template -inline void Slice(const tflite::SliceParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - SequentialTensorWriter writer(input_data, output_data); - return Slice(op_params, input_shape, output_shape, &writer); -} - -template -inline void Slice(const tflite::SliceParams& op_params, - const RuntimeShape& input_shape, const TfLiteTensor* input, - const RuntimeShape& output_shape, TfLiteTensor* output) { - SequentialTensorWriter writer(input, output); - return Slice(op_params, input_shape, output_shape, &writer); -} - -template -void Minimum(const RuntimeShape& input1_shape, const T* input1_data, - const T* input2_data, const RuntimeShape& output_shape, - T* output_data) { - ruy::profiler::ScopeLabel label("TensorFlowMinimum"); - auto input1_map = MapAsVector(input1_data, input1_shape); - auto output_map = MapAsVector(output_data, output_shape); - auto min_value = input2_data[0]; - output_map.array() = input1_map.array().min(min_value); -} - -// Convenience version that allows, for example, generated-code calls to be -// the same as other binary ops. -template -inline void Minimum(const RuntimeShape& input1_shape, const T* input1_data, - const RuntimeShape&, const T* input2_data, - const RuntimeShape& output_shape, T* output_data) { - // Drop shape of second input: not needed. - Minimum(input1_shape, input1_data, input2_data, output_shape, output_data); -} - -template -void Maximum(const RuntimeShape& input1_shape, const T* input1_data, - const T* input2_data, const RuntimeShape& output_shape, - T* output_data) { - ruy::profiler::ScopeLabel label("TensorFlowMaximum"); - auto input1_map = MapAsVector(input1_data, input1_shape); - auto output_map = MapAsVector(output_data, output_shape); - auto max_value = input2_data[0]; - output_map.array() = input1_map.array().max(max_value); -} - -// Convenience version that allows, for example, generated-code calls to be -// the same as other binary ops. -template -inline void Maximum(const RuntimeShape& input1_shape, const T* input1_data, - const RuntimeShape&, const T* input2_data, - const RuntimeShape& output_shape, T* output_data) { - // Drop shape of second input: not needed. - Maximum(input1_shape, input1_data, input2_data, output_shape, output_data); -} - -template -void TransposeIm2col(const ConvParams& params, uint8 zero_byte, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& filter_shape, - const RuntimeShape& output_shape, T* im2col_data) { - ruy::profiler::ScopeLabel label("TransposeIm2col"); - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - TFLITE_DCHECK(im2col_data); - - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - MatchingDim(output_shape, 3, filter_shape, 0); // output_depth - - // Construct the MxN sized im2col matrix. - // The rows M, are sub-ordered B x H x W - const RuntimeShape row_shape({1, batches, output_height, output_width}); - // The columns, N, are sub-ordered Kh x Kw x Din - const RuntimeShape col_shape({1, filter_height, filter_width, input_depth}); - // Use dimensions M and N to construct dims for indexing directly into im2col - const RuntimeShape im2col_shape( - {1, 1, row_shape.FlatSize(), col_shape.FlatSize()}); - - // Build the im2col matrix by looping through all the input pixels, - // computing their influence on the output, rather than looping through all - // the output pixels. We therefore must initialize the im2col array to zero. - // This is potentially inefficient because we subsequently overwrite bytes - // set here. However, in practice memset is very fast and costs negligible. - memset(im2col_data, zero_byte, im2col_shape.FlatSize() * sizeof(T)); - - // Loop through the output batches - for (int batch = 0; batch < batches; ++batch) { - // Loop through input pixels one at a time. - for (int in_y = 0; in_y < input_height; ++in_y) { - for (int in_x = 0; in_x < input_width; ++in_x) { - // Loop through the output pixels it will influence - const int out_x_origin = (in_x * stride_width) - pad_width; - const int out_y_origin = (in_y * stride_height) - pad_height; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - const int out_y = out_y_origin + filter_y; - // Is output pixel within height bounds? - if ((out_y >= 0) && (out_y < output_height)) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - const int out_x = out_x_origin + filter_x; - // Is output pixel within width bounds? - if ((out_x >= 0) && (out_x < output_width)) { - // Copy the input elements of this pixel - T const* src = - input_data + Offset(input_shape, batch, in_y, in_x, 0); - int row_offset = Offset(row_shape, 0, batch, out_y, out_x); - int col_offset = Offset(col_shape, 0, filter_y, filter_x, 0); - T* dst = im2col_data + - Offset(im2col_shape, 0, 0, row_offset, col_offset); - memcpy(dst, src, input_depth * sizeof(T)); - } - } - } - } - } - } - } -} - -// Returns in 'im_data' (assumes to be zero-initialized) image patch in storage -// order (height, width, depth), constructed from patches in 'col_data', which -// is required to be in storage order (out_height * out_width, filter_height, -// filter_width, in_depth). Implementation by Yangqing Jia (jiayq). -// Copied from //tensorflow/core/kernels/conv_grad_input_ops.cc -template -void Col2im(const T* col_data, const int depth, const int height, - const int width, const int filter_h, const int filter_w, - const int pad_t, const int pad_l, const int pad_b, const int pad_r, - const int stride_h, const int stride_w, T* im_data) { - ruy::profiler::ScopeLabel label("Col2im"); - int height_col = (height + pad_t + pad_b - filter_h) / stride_h + 1; - int width_col = (width + pad_l + pad_r - filter_w) / stride_w + 1; - int h_pad = -pad_t; - for (int h = 0; h < height_col; ++h) { - int w_pad = -pad_l; - for (int w = 0; w < width_col; ++w) { - T* im_patch_data = im_data + (h_pad * width + w_pad) * depth; - for (int ih = h_pad; ih < h_pad + filter_h; ++ih) { - for (int iw = w_pad; iw < w_pad + filter_w; ++iw) { - if (ih >= 0 && ih < height && iw >= 0 && iw < width) { - // TODO(andydavis) Vectorize this loop (if compiler does not). - for (int i = 0; i < depth; ++i) { - im_patch_data[i] += col_data[i]; - } - } - im_patch_data += depth; - col_data += depth; - } - // Jump over remaining number of depth. - im_patch_data += depth * (width - filter_w); - } - w_pad += stride_w; - } - h_pad += stride_h; - } -} - -template -void BiasAdd(T* im_data, const T* bias_data, const int batch_size, - const int height, const int width, const int depth) { - if (bias_data) { - for (int n = 0; n < batch_size; ++n) { - for (int h = 0; h < height; ++h) { - for (int w = 0; w < width; ++w) { - for (int d = 0; d < depth; ++d) { - im_data[d] += bias_data[d]; - } - im_data += depth; - } - } - } - } -} - -// TransposeConvV2 expect the weights in HWOI order. -inline void TransposeConvV2( - const ConvParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& hwoi_ordered_filter_shape, - const float* hwoi_ordered_filter_data, const RuntimeShape& bias_shape, - const float* bias_data, const RuntimeShape& output_shape, - float* const output_data, const RuntimeShape& col2im_shape, - float* col2im_data, CpuBackendContext* cpu_backend_context) { - ruy::profiler::ScopeLabel label("TransposeConvV2/float"); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(hwoi_ordered_filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK(col2im_data); - TFLITE_DCHECK(hwoi_ordered_filter_data); - - const int batch_size = MatchingDim(input_shape, 0, output_shape, 0); - const int input_image_size = input_shape.Dims(1) * input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int output_image_size = output_height * output_width; - const int input_depth = - MatchingDim(input_shape, 3, hwoi_ordered_filter_shape, 3); - const int output_depth = - MatchingDim(output_shape, 3, hwoi_ordered_filter_shape, 2); - const int input_offset = input_image_size * input_depth; - const int output_offset = output_image_size * output_depth; - - const int filter_height = hwoi_ordered_filter_shape.Dims(0); - const int filter_width = hwoi_ordered_filter_shape.Dims(1); - const int padding_top = params.padding_values.height; - const int padding_bottom = - params.padding_values.height + params.padding_values.height_offset; - const int padding_left = params.padding_values.width; - const int padding_right = - params.padding_values.width + params.padding_values.width_offset; - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - - const int hwoi_ordered_filter_total_size = - filter_height * filter_width * output_depth; - - cpu_backend_gemm::MatrixParams lhs_params; - lhs_params.order = cpu_backend_gemm::Order::kRowMajor; - lhs_params.rows = hwoi_ordered_filter_total_size; - lhs_params.cols = input_depth; - float* output_data_p = output_data; - std::fill_n(output_data, output_offset * batch_size, 0.0f); - for (int i = 0; i < batch_size; ++i) { - cpu_backend_gemm::MatrixParams rhs_params; - rhs_params.order = cpu_backend_gemm::Order::kColMajor; - rhs_params.rows = input_depth; - rhs_params.cols = input_image_size; - cpu_backend_gemm::MatrixParams dst_params; - dst_params.order = cpu_backend_gemm::Order::kColMajor; - dst_params.rows = hwoi_ordered_filter_total_size; - dst_params.cols = input_image_size; - cpu_backend_gemm::GemmParams gemm_params; - cpu_backend_gemm::Gemm(lhs_params, hwoi_ordered_filter_data, rhs_params, - input_data + input_offset * i, dst_params, - col2im_data, gemm_params, cpu_backend_context); - - Col2im(col2im_data, output_depth, output_height, output_width, - filter_height, filter_width, padding_top, padding_left, - padding_bottom, padding_right, stride_height, stride_width, - output_data_p); - output_data_p += output_offset; - } - output_data_p = output_data; - BiasAdd(output_data_p, bias_data, batch_size, output_height, output_width, - output_depth); -} - -inline void Quantize(int32_t multiplier, int32_t shift, int32_t total_size, - int32_t output_zp, int32_t* scratch, uint8_t* output) { - ruy::profiler::ScopeLabel label("Quantize/uint8"); - int i = 0; - const int32_t output_min = std::numeric_limits::min(); - const int32_t output_max = std::numeric_limits::max(); - -#ifdef USE_NEON - const int32x4_t output_zp_dup = vdupq_n_s32(output_zp); - const int32x4_t max_val_dup = vdupq_n_s32(output_max); - const int32x4_t min_val_dup = vdupq_n_s32(output_min); - - using gemmlowp::RoundingDivideByPOT; - using gemmlowp::SaturatingRoundingDoublingHighMul; - - for (; i <= total_size - 16; i += 16) { - int32x4x4_t scratch_val; - scratch_val.val[0] = vld1q_s32(scratch + i); - scratch_val.val[1] = vld1q_s32(scratch + i + 4); - scratch_val.val[2] = vld1q_s32(scratch + i + 8); - scratch_val.val[3] = vld1q_s32(scratch + i + 12); - - int32x4x4_t temp_val = - MultiplyByQuantizedMultiplier4Rows(scratch_val, multiplier, shift); - - temp_val.val[0] = vaddq_s32(temp_val.val[0], output_zp_dup); - temp_val.val[1] = vaddq_s32(temp_val.val[1], output_zp_dup); - temp_val.val[2] = vaddq_s32(temp_val.val[2], output_zp_dup); - temp_val.val[3] = vaddq_s32(temp_val.val[3], output_zp_dup); - - temp_val.val[0] = - vmaxq_s32(vminq_s32(temp_val.val[0], max_val_dup), min_val_dup); - temp_val.val[1] = - vmaxq_s32(vminq_s32(temp_val.val[1], max_val_dup), min_val_dup); - temp_val.val[2] = - vmaxq_s32(vminq_s32(temp_val.val[2], max_val_dup), min_val_dup); - temp_val.val[3] = - vmaxq_s32(vminq_s32(temp_val.val[3], max_val_dup), min_val_dup); - - const uint16x8_t result_1 = - vcombine_u16(vqmovn_u32(vreinterpretq_u32_s32(temp_val.val[0])), - vqmovn_u32(vreinterpretq_u32_s32(temp_val.val[1]))); - const uint16x8_t result_2 = - vcombine_u16(vqmovn_u32(vreinterpretq_u32_s32(temp_val.val[2])), - vqmovn_u32(vreinterpretq_u32_s32(temp_val.val[3]))); - const uint8x16_t result = - vcombine_u8(vqmovn_u16(result_1), vqmovn_u16(result_2)); - vst1q_u8(output + i, result); - } -#endif - for (; i < total_size; ++i) { - int32_t temp = MultiplyByQuantizedMultiplier(scratch[i], multiplier, shift); - temp += output_zp; - if (temp > output_max) { - temp = output_max; - } - if (temp < output_min) { - temp = output_min; - } - output[i] = static_cast(temp); - } -} - -inline void Quantize(const int32_t* multiplier, const int32_t* shift, - int32_t channel_size, int32_t total_size, - int32_t output_zp, int32_t output_min, int32_t output_max, - int32_t* scratch, int8_t* output) { - ruy::profiler::ScopeLabel label("Quantize/int8"); - - // Here we're trying to quantize the raw accumulators: - // output_channels - // data data data data data - // rows data data data data data - // data data data data data - // .... - // - // In order to minimize the reload of the multipliers & shifts, once we load - // the multipliers & shifts, we load & quantize the raw accumulators for every - // row. -#ifdef USE_NEON - const int32x4_t output_offset_vec = vdupq_n_s32(output_zp); - const int32x4_t output_activation_min_vec = vdupq_n_s32(output_min); - const int32x4_t output_activation_max_vec = vdupq_n_s32(output_max); - const int32x4_t zeros = vdupq_n_s32(0); -#endif - - TFLITE_DCHECK_EQ(total_size % channel_size, 0); - const int32_t rows = total_size / channel_size; - - int c = 0; - -#ifdef USE_NEON - using gemmlowp::RoundingDivideByPOT; - for (; c <= channel_size - 8; c += 8) { - int32x4_t out_shift_1 = vld1q_s32(shift + c); - int32x4_t out_shift_2 = vld1q_s32(shift + c + 4); - int32x4_t left_shift_1 = vmaxq_s32(out_shift_1, zeros); - int32x4_t left_shift_2 = vmaxq_s32(out_shift_2, zeros); - - // Right shift will be performed as left shift with negative values. - int32x4_t right_shift_1 = vminq_s32(out_shift_1, zeros); - int32x4_t right_shift_2 = vminq_s32(out_shift_2, zeros); - - int32x4_t out_mul_1 = vld1q_s32(multiplier + c); - int32x4_t out_mul_2 = vld1q_s32(multiplier + c + 4); - for (int n = 0; n < rows; ++n) { - int loc = n * channel_size + c; - int32x4_t acc_1 = vld1q_s32(scratch + loc); - int32x4_t acc_2 = vld1q_s32(scratch + loc + 4); - - // Saturating Rounding Doubling High Mul. - acc_1 = vshlq_s32(acc_1, left_shift_1); - acc_1 = vqrdmulhq_s32(acc_1, out_mul_1); - acc_2 = vshlq_s32(acc_2, left_shift_2); - acc_2 = vqrdmulhq_s32(acc_2, out_mul_2); - - // Rounding Dividing By POT. - acc_1 = vrshlq_s32(acc_1, right_shift_1); - acc_2 = vrshlq_s32(acc_2, right_shift_2); - - // Add the output offset. - acc_1 = vaddq_s32(acc_1, output_offset_vec); - acc_2 = vaddq_s32(acc_2, output_offset_vec); - - // Apply the activation function. - acc_1 = vmaxq_s32(acc_1, output_activation_min_vec); - acc_1 = vminq_s32(acc_1, output_activation_max_vec); - acc_2 = vmaxq_s32(acc_2, output_activation_min_vec); - acc_2 = vminq_s32(acc_2, output_activation_max_vec); - - // Saturating cast to int8 and store to destination. - const int16x4_t acc_s16_1 = vqmovn_s32(acc_1); - const int16x4_t acc_s16_2 = vqmovn_s32(acc_2); - const int16x8_t res_s16 = vcombine_s16(acc_s16_1, acc_s16_2); - const int8x8_t res_s8 = vqmovn_s16(res_s16); - vst1_s8(output + loc, res_s8); - } - } - -#endif // USE_NEON - // Handle leftover values, one by one. This is very slow. - for (; c < channel_size; c++) { - for (int n = 0; n < rows; ++n) { - int loc = n * channel_size + c; - int32 acc = scratch[loc]; - acc = MultiplyByQuantizedMultiplier(acc, multiplier[c], shift[c]); - acc += output_zp; - acc = std::max(acc, output_min); - acc = std::min(acc, output_max); - output[loc] = static_cast(acc); - } - } -} - -// TransposeConvV2 expect the weights in HWOI order. -inline void TransposeConvV2( - const ConvParams& params, const RuntimeShape& input_shape, - const uint8_t* input_data, const RuntimeShape& hwoi_ordered_filter_shape, - const uint8_t* hwoi_ordered_filter_data, const RuntimeShape& bias_shape, - const int32* bias_data, const RuntimeShape& output_shape, - uint8_t* output_data, const RuntimeShape& col2im_shape, - int32_t* col2im_data, int32_t* scratch_data, - CpuBackendContext* cpu_backend_context) { - ruy::profiler::ScopeLabel label("TransposeConvV2/uint8"); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(hwoi_ordered_filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK(col2im_data); - TFLITE_DCHECK(hwoi_ordered_filter_data); - - const int batch_size = MatchingDim(input_shape, 0, output_shape, 0); - const int input_image_size = input_shape.Dims(1) * input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int output_image_size = output_height * output_width; - const int input_depth = - MatchingDim(input_shape, 3, hwoi_ordered_filter_shape, 3); - const int output_depth = - MatchingDim(output_shape, 3, hwoi_ordered_filter_shape, 2); - const int input_offset = input_image_size * input_depth; - const int output_offset = output_image_size * output_depth; - - const int filter_height = hwoi_ordered_filter_shape.Dims(0); - const int filter_width = hwoi_ordered_filter_shape.Dims(1); - const int padding_top = params.padding_values.height; - const int padding_bottom = - params.padding_values.height + params.padding_values.height_offset; - const int padding_left = params.padding_values.width; - const int padding_right = - params.padding_values.width + params.padding_values.width_offset; - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - - const int hwoi_ordered_filter_total_size = - filter_height * filter_width * output_depth; - - cpu_backend_gemm::MatrixParams lhs_params; - lhs_params.order = cpu_backend_gemm::Order::kRowMajor; - lhs_params.rows = hwoi_ordered_filter_total_size; - lhs_params.cols = input_depth; - lhs_params.zero_point = -params.weights_offset; - - int32_t* scratch_data_p = scratch_data; - std::fill_n(scratch_data, output_offset * batch_size, static_cast(0)); - for (int i = 0; i < batch_size; ++i) { - cpu_backend_gemm::MatrixParams rhs_params; - rhs_params.order = cpu_backend_gemm::Order::kColMajor; - rhs_params.rows = input_depth; - rhs_params.cols = input_image_size; - rhs_params.zero_point = -params.input_offset; - - cpu_backend_gemm::MatrixParams dst_params; - dst_params.order = cpu_backend_gemm::Order::kColMajor; - dst_params.rows = hwoi_ordered_filter_total_size; - dst_params.cols = input_image_size; - - cpu_backend_gemm::GemmParams gemm_params; - cpu_backend_gemm::Gemm(lhs_params, hwoi_ordered_filter_data, rhs_params, - input_data + input_offset * i, dst_params, - col2im_data, gemm_params, cpu_backend_context); - - Col2im(col2im_data, output_depth, output_height, output_width, - filter_height, filter_width, padding_top, padding_left, - padding_bottom, padding_right, stride_height, stride_width, - scratch_data_p); - - scratch_data_p += output_offset; - } - scratch_data_p = scratch_data; - BiasAdd(scratch_data_p, bias_data, batch_size, output_height, output_width, - output_depth); - - Quantize(params.output_multiplier, params.output_shift, - output_shape.FlatSize(), params.output_offset, scratch_data, - output_data); -} - -// Integer-only version of ResizeNearestNeighbor. Since scales are represented -// in fixed-point and thus approximated, |in_x| or |in_y| may differ from the -// reference version. Debug checks are in place to test if this occurs. -// NOTE: If align_corners or half_pixel_centers is true, we use the reference -// version. -inline void ResizeNearestNeighbor( - const tflite::ResizeNearestNeighborParams& op_params, - const RuntimeShape& unextended_input_shape, const uint8* input_data, - const RuntimeShape& output_size_shape, const int32* output_size_data, - const RuntimeShape& unextended_output_shape, uint8* output_data) { - if (op_params.align_corners || op_params.half_pixel_centers) { - // TODO(b/149823713): Add support for align_corners & half_pixel_centers in - // this kernel. - reference_ops::ResizeNearestNeighbor( - op_params, unextended_input_shape, input_data, output_size_shape, - output_size_data, unextended_output_shape, output_data); - return; - } - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - int32 batches = MatchingDim(input_shape, 0, output_shape, 0); - int32 input_height = input_shape.Dims(1); - int32 input_width = input_shape.Dims(2); - int32 depth = MatchingDim(input_shape, 3, output_shape, 3); - - // The Tensorflow version of this op allows resize on the width and height - // axis only. - TFLITE_DCHECK_EQ(output_size_shape.FlatSize(), 2); - int32 output_height = output_size_data[0]; - int32 output_width = output_size_data[1]; - - // Convert scales to fixed-point with 16 fractional bits. We add 1 as an - // error factor and to avoid zero scales. For example, with input_height = 1, - // output_height = 3, the float scaling factor would be non-zero at 1/3. - // With fixed-point, this is zero. - int32 height_scale = (input_height << 16) / output_height + 1; - int32 width_scale = (input_width << 16) / output_width + 1; - - const int col_offset = input_shape.Dims(3); - const int row_offset = input_shape.Dims(2) * col_offset; - const int batch_offset = input_shape.Dims(1) * row_offset; - - const uint8* input_ptr = input_data; - uint8* output_ptr = output_data; - for (int b = 0; b < batches; ++b) { - for (int y = 0; y < output_height; ++y) { - int32 in_y = std::min((y * height_scale) >> 16, input_height - 1); - // Check offset calculation is the same as the reference version. See - // function comment for details. We check using a non-float version of: - // TFLITE_DCHECK_EQ(in_y, std::floor(y * (static_cast(input_height) - // / output_height))); - TFLITE_DCHECK_LT(y * input_height, output_height + in_y * output_height); - TFLITE_DCHECK_GE(y * input_height, in_y * output_height); - const uint8* y_input_ptr = input_ptr + in_y * row_offset; - for (int x = 0; x < output_width; ++x) { - int32 in_x = std::min((x * width_scale) >> 16, input_width - 1); - // Check offset calculation is the same as the reference version. See - // function comment for details. We check using a non-float version of: - // TFLITE_DCHECK_EQ(in_y, - // std::floor(y * (static_cast(input_width) - // / output_width))); - TFLITE_DCHECK_LT(x * input_width, output_width + in_x * output_width); - TFLITE_DCHECK_GE(x * input_width, in_x * output_width); - const uint8* x_input_ptr = y_input_ptr + in_x * col_offset; - memcpy(output_ptr, x_input_ptr, depth); - output_ptr += depth; - } - } - input_ptr += batch_offset; - } -} - -template -inline void Requantize(const input_type* input_data, int32_t size, - int32_t effective_scale_multiplier, - int32_t effective_scale_shift, int32_t input_zeropoint, - int32_t output_zeropoint, output_type* output_data) { - reference_ops::Requantize(input_data, size, effective_scale_multiplier, - effective_scale_shift, input_zeropoint, - output_zeropoint, output_data); -} - -template <> -inline void Requantize(const int8_t* input_data, int32_t size, - int32_t effective_scale_multiplier, - int32_t effective_scale_shift, - int32_t input_zeropoint, - int32_t output_zeropoint, - uint8_t* output_data) { - ruy::profiler::ScopeLabel label("Requantize/Int8ToUint8"); - - static constexpr int32_t kMinOutput = std::numeric_limits::min(); - static constexpr int32_t kMaxOutput = std::numeric_limits::max(); - - int i = 0; -#ifdef USE_NEON - // Constants. - const int32x4_t input_zero_point_dup = vdupq_n_s32(-input_zeropoint); - const int32x4_t output_zero_point_dup = vdupq_n_s32(output_zeropoint); - const int32x4_t min_val_dup = vdupq_n_s32(kMinOutput); - const int32x4_t max_val_dup = vdupq_n_s32(kMaxOutput); - - for (; i <= size - 16; i += 16) { - const int8x16_t input_vec = vld1q_s8(input_data + i); - const int16x8_t first_half = vmovl_s8(vget_low_s8(input_vec)); - const int16x8_t second_half = vmovl_s8(vget_high_s8(input_vec)); - int32x4x4_t input; - input.val[0] = vmovl_s16(vget_low_s16(first_half)); - input.val[1] = vmovl_s16(vget_high_s16(first_half)); - input.val[2] = vmovl_s16(vget_low_s16(second_half)); - input.val[3] = vmovl_s16(vget_high_s16(second_half)); - input.val[0] = vaddq_s32(input.val[0], input_zero_point_dup); - input.val[1] = vaddq_s32(input.val[1], input_zero_point_dup); - input.val[2] = vaddq_s32(input.val[2], input_zero_point_dup); - input.val[3] = vaddq_s32(input.val[3], input_zero_point_dup); - - int32x4x4_t result = MultiplyByQuantizedMultiplier4Rows( - input, effective_scale_multiplier, effective_scale_shift); - - result.val[0] = vaddq_s32(result.val[0], output_zero_point_dup); - result.val[1] = vaddq_s32(result.val[1], output_zero_point_dup); - result.val[2] = vaddq_s32(result.val[2], output_zero_point_dup); - result.val[3] = vaddq_s32(result.val[3], output_zero_point_dup); - result.val[0] = - vmaxq_s32(vminq_s32(result.val[0], max_val_dup), min_val_dup); - result.val[1] = - vmaxq_s32(vminq_s32(result.val[1], max_val_dup), min_val_dup); - result.val[2] = - vmaxq_s32(vminq_s32(result.val[2], max_val_dup), min_val_dup); - result.val[3] = - vmaxq_s32(vminq_s32(result.val[3], max_val_dup), min_val_dup); - - const uint32x4_t result_val_1_unsigned = - vreinterpretq_u32_s32(result.val[0]); - const uint32x4_t result_val_2_unsigned = - vreinterpretq_u32_s32(result.val[1]); - const uint32x4_t result_val_3_unsigned = - vreinterpretq_u32_s32(result.val[2]); - const uint32x4_t result_val_4_unsigned = - vreinterpretq_u32_s32(result.val[3]); - - const uint16x4_t narrowed_val_1 = vqmovn_u32(result_val_1_unsigned); - const uint16x4_t narrowed_val_2 = vqmovn_u32(result_val_2_unsigned); - const uint16x4_t narrowed_val_3 = vqmovn_u32(result_val_3_unsigned); - const uint16x4_t narrowed_val_4 = vqmovn_u32(result_val_4_unsigned); - const uint16x8_t output_first_half = - vcombine_u16(narrowed_val_1, narrowed_val_2); - const uint16x8_t output_second_half = - vcombine_u16(narrowed_val_3, narrowed_val_4); - const uint8x8_t narrowed_first_half = vqmovn_u16(output_first_half); - const uint8x8_t narrowed_second_half = vqmovn_u16(output_second_half); - const uint8x16_t narrowed_result = - vcombine_u8(narrowed_first_half, narrowed_second_half); - vst1q_u8(output_data + i, narrowed_result); - } - -#endif - for (; i < size; ++i) { - const int32_t input = input_data[i] - input_zeropoint; - const int32_t output = - MultiplyByQuantizedMultiplier(input, effective_scale_multiplier, - effective_scale_shift) + - output_zeropoint; - const int32_t clamped_output = - std::max(std::min(output, kMaxOutput), kMinOutput); - output_data[i] = static_cast(clamped_output); - } -} - -template <> -inline void Requantize(const uint8_t* input_data, int32_t size, - int32_t effective_scale_multiplier, - int32_t effective_scale_shift, - int32_t input_zeropoint, - int32_t output_zeropoint, - int8_t* output_data) { - ruy::profiler::ScopeLabel label("Requantize/Uint8ToInt8"); - - static constexpr int32_t kMinOutput = std::numeric_limits::min(); - static constexpr int32_t kMaxOutput = std::numeric_limits::max(); - - int i = 0; -#ifdef USE_NEON - // Constants. - const int32x4_t input_zero_point_dup = vdupq_n_s32(-input_zeropoint); - const int32x4_t output_zero_point_dup = vdupq_n_s32(output_zeropoint); - const int32x4_t min_val_dup = vdupq_n_s32(kMinOutput); - const int32x4_t max_val_dup = vdupq_n_s32(kMaxOutput); - - for (; i <= size - 16; i += 16) { - const uint8x16_t input_vec = vld1q_u8(input_data + i); - const uint16x8_t first_half = vmovl_u8(vget_low_u8(input_vec)); - const uint16x8_t second_half = vmovl_u8(vget_high_u8(input_vec)); - int32x4x4_t input; - input.val[0] = vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(first_half))); - input.val[1] = vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(first_half))); - input.val[2] = vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(second_half))); - input.val[3] = vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(second_half))); - input.val[0] = vaddq_s32(input.val[0], input_zero_point_dup); - input.val[1] = vaddq_s32(input.val[1], input_zero_point_dup); - input.val[2] = vaddq_s32(input.val[2], input_zero_point_dup); - input.val[3] = vaddq_s32(input.val[3], input_zero_point_dup); - - int32x4x4_t result = MultiplyByQuantizedMultiplier4Rows( - input, effective_scale_multiplier, effective_scale_shift); - - result.val[0] = vaddq_s32(result.val[0], output_zero_point_dup); - result.val[1] = vaddq_s32(result.val[1], output_zero_point_dup); - result.val[2] = vaddq_s32(result.val[2], output_zero_point_dup); - result.val[3] = vaddq_s32(result.val[3], output_zero_point_dup); - result.val[0] = - vmaxq_s32(vminq_s32(result.val[0], max_val_dup), min_val_dup); - result.val[1] = - vmaxq_s32(vminq_s32(result.val[1], max_val_dup), min_val_dup); - result.val[2] = - vmaxq_s32(vminq_s32(result.val[2], max_val_dup), min_val_dup); - result.val[3] = - vmaxq_s32(vminq_s32(result.val[3], max_val_dup), min_val_dup); - - const int16x4_t narrowed_val_1 = vqmovn_s32(result.val[0]); - const int16x4_t narrowed_val_2 = vqmovn_s32(result.val[1]); - const int16x4_t narrowed_val_3 = vqmovn_s32(result.val[2]); - const int16x4_t narrowed_val_4 = vqmovn_s32(result.val[3]); - const int16x8_t output_first_half = - vcombine_s16(narrowed_val_1, narrowed_val_2); - const int16x8_t output_second_half = - vcombine_s16(narrowed_val_3, narrowed_val_4); - const int8x8_t narrowed_first_half = vqmovn_s16(output_first_half); - const int8x8_t narrowed_second_half = vqmovn_s16(output_second_half); - const int8x16_t narrowed_result = - vcombine_s8(narrowed_first_half, narrowed_second_half); - vst1q_s8(output_data + i, narrowed_result); - } - -#endif - for (; i < size; ++i) { - const int32_t input = input_data[i] - input_zeropoint; - const int32_t output = - MultiplyByQuantizedMultiplier(input, effective_scale_multiplier, - effective_scale_shift) + - output_zeropoint; - const int32_t clamped_output = - std::max(std::min(output, kMaxOutput), kMinOutput); - output_data[i] = static_cast(clamped_output); - } -} - -template <> -inline void Requantize(const int8_t* input_data, int32_t size, - int32_t effective_scale_multiplier, - int32_t effective_scale_shift, - int32_t input_zeropoint, - int32_t output_zeropoint, - int8_t* output_data) { - ruy::profiler::ScopeLabel label("Requantize/Int8ToInt8"); - - static constexpr int32_t kMinOutput = std::numeric_limits::min(); - static constexpr int32_t kMaxOutput = std::numeric_limits::max(); - - int i = 0; -#ifdef USE_NEON - // Constants. - const int32x4_t input_zero_point_dup = vdupq_n_s32(-input_zeropoint); - const int32x4_t output_zero_point_dup = vdupq_n_s32(output_zeropoint); - const int32x4_t min_val_dup = vdupq_n_s32(kMinOutput); - const int32x4_t max_val_dup = vdupq_n_s32(kMaxOutput); - - for (; i <= size - 16; i += 16) { - const int8x16_t input_vec = vld1q_s8(input_data + i); - const int16x8_t first_half = vmovl_s8(vget_low_s8(input_vec)); - const int16x8_t second_half = vmovl_s8(vget_high_s8(input_vec)); - int32x4x4_t input; - input.val[0] = vmovl_s16(vget_low_s16(first_half)); - input.val[1] = vmovl_s16(vget_high_s16(first_half)); - input.val[2] = vmovl_s16(vget_low_s16(second_half)); - input.val[3] = vmovl_s16(vget_high_s16(second_half)); - - input.val[0] = vaddq_s32(input.val[0], input_zero_point_dup); - input.val[1] = vaddq_s32(input.val[1], input_zero_point_dup); - input.val[2] = vaddq_s32(input.val[2], input_zero_point_dup); - input.val[3] = vaddq_s32(input.val[3], input_zero_point_dup); - - int32x4x4_t result = MultiplyByQuantizedMultiplier4Rows( - input, effective_scale_multiplier, effective_scale_shift); - - result.val[0] = vaddq_s32(result.val[0], output_zero_point_dup); - result.val[1] = vaddq_s32(result.val[1], output_zero_point_dup); - result.val[2] = vaddq_s32(result.val[2], output_zero_point_dup); - result.val[3] = vaddq_s32(result.val[3], output_zero_point_dup); - result.val[0] = - vmaxq_s32(vminq_s32(result.val[0], max_val_dup), min_val_dup); - result.val[1] = - vmaxq_s32(vminq_s32(result.val[1], max_val_dup), min_val_dup); - result.val[2] = - vmaxq_s32(vminq_s32(result.val[2], max_val_dup), min_val_dup); - result.val[3] = - vmaxq_s32(vminq_s32(result.val[3], max_val_dup), min_val_dup); - - const int16x4_t narrowed_val_1 = vqmovn_s32(result.val[0]); - const int16x4_t narrowed_val_2 = vqmovn_s32(result.val[1]); - const int16x4_t narrowed_val_3 = vqmovn_s32(result.val[2]); - const int16x4_t narrowed_val_4 = vqmovn_s32(result.val[3]); - const int16x8_t output_first_half = - vcombine_s16(narrowed_val_1, narrowed_val_2); - const int16x8_t output_second_half = - vcombine_s16(narrowed_val_3, narrowed_val_4); - const int8x8_t narrowed_first_half = vqmovn_s16(output_first_half); - const int8x8_t narrowed_second_half = vqmovn_s16(output_second_half); - const int8x16_t narrowed_result = - vcombine_s8(narrowed_first_half, narrowed_second_half); - vst1q_s8(output_data + i, narrowed_result); - } - -#endif - for (; i < size; ++i) { - const int32_t input = input_data[i] - input_zeropoint; - const int32_t output = - MultiplyByQuantizedMultiplier(input, effective_scale_multiplier, - effective_scale_shift) + - output_zeropoint; - const int32_t clamped_output = - std::max(std::min(output, kMaxOutput), kMinOutput); - output_data[i] = static_cast(clamped_output); - } -} - -template <> -inline void Requantize( - const uint8_t* input_data, int32_t size, int32_t effective_scale_multiplier, - int32_t effective_scale_shift, int32_t input_zeropoint, - int32_t output_zeropoint, uint8_t* output_data) { - ruy::profiler::ScopeLabel label("Requantize/Uint8ToUint8"); - - static constexpr int32_t kMinOutput = std::numeric_limits::min(); - static constexpr int32_t kMaxOutput = std::numeric_limits::max(); - - int i = 0; -#ifdef USE_NEON - // Constants. - const int32x4_t input_zero_point_dup = vdupq_n_s32(-input_zeropoint); - const int32x4_t output_zero_point_dup = vdupq_n_s32(output_zeropoint); - const int32x4_t min_val_dup = vdupq_n_s32(kMinOutput); - const int32x4_t max_val_dup = vdupq_n_s32(kMaxOutput); - - for (; i <= size - 16; i += 16) { - const uint8x16_t input_vec = vld1q_u8(input_data + i); - const uint16x8_t first_half = vmovl_u8(vget_low_u8(input_vec)); - const uint16x8_t second_half = vmovl_u8(vget_high_u8(input_vec)); - int32x4x4_t input; - input.val[0] = vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(first_half))); - input.val[1] = vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(first_half))); - input.val[2] = vreinterpretq_s32_u32(vmovl_u16(vget_low_u16(second_half))); - input.val[3] = vreinterpretq_s32_u32(vmovl_u16(vget_high_u16(second_half))); - input.val[0] = vaddq_s32(input.val[0], input_zero_point_dup); - input.val[1] = vaddq_s32(input.val[1], input_zero_point_dup); - input.val[2] = vaddq_s32(input.val[2], input_zero_point_dup); - input.val[3] = vaddq_s32(input.val[3], input_zero_point_dup); - - int32x4x4_t result = MultiplyByQuantizedMultiplier4Rows( - input, effective_scale_multiplier, effective_scale_shift); - - result.val[0] = vaddq_s32(result.val[0], output_zero_point_dup); - result.val[1] = vaddq_s32(result.val[1], output_zero_point_dup); - result.val[2] = vaddq_s32(result.val[2], output_zero_point_dup); - result.val[3] = vaddq_s32(result.val[3], output_zero_point_dup); - result.val[0] = - vmaxq_s32(vminq_s32(result.val[0], max_val_dup), min_val_dup); - result.val[1] = - vmaxq_s32(vminq_s32(result.val[1], max_val_dup), min_val_dup); - result.val[2] = - vmaxq_s32(vminq_s32(result.val[2], max_val_dup), min_val_dup); - result.val[3] = - vmaxq_s32(vminq_s32(result.val[3], max_val_dup), min_val_dup); - - const uint32x4_t result_val_1_unsigned = - vreinterpretq_u32_s32(result.val[0]); - const uint32x4_t result_val_2_unsigned = - vreinterpretq_u32_s32(result.val[1]); - const uint32x4_t result_val_3_unsigned = - vreinterpretq_u32_s32(result.val[2]); - const uint32x4_t result_val_4_unsigned = - vreinterpretq_u32_s32(result.val[3]); - - const uint16x4_t narrowed_val_1 = vqmovn_u32(result_val_1_unsigned); - const uint16x4_t narrowed_val_2 = vqmovn_u32(result_val_2_unsigned); - const uint16x4_t narrowed_val_3 = vqmovn_u32(result_val_3_unsigned); - const uint16x4_t narrowed_val_4 = vqmovn_u32(result_val_4_unsigned); - const uint16x8_t output_first_half = - vcombine_u16(narrowed_val_1, narrowed_val_2); - const uint16x8_t output_second_half = - vcombine_u16(narrowed_val_3, narrowed_val_4); - const uint8x8_t narrowed_first_half = vqmovn_u16(output_first_half); - const uint8x8_t narrowed_second_half = vqmovn_u16(output_second_half); - const uint8x16_t narrowed_result = - vcombine_u8(narrowed_first_half, narrowed_second_half); - vst1q_u8(output_data + i, narrowed_result); - } - -#endif - for (; i < size; ++i) { - const int32_t input = input_data[i] - input_zeropoint; - const int32_t output = - MultiplyByQuantizedMultiplier(input, effective_scale_multiplier, - effective_scale_shift) + - output_zeropoint; - const int32_t clamped_output = - std::max(std::min(output, kMaxOutput), kMinOutput); - output_data[i] = static_cast(clamped_output); - } -} - -inline void HardSwish(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("HardSwish/Float"); - auto size = MatchingFlatSize(input_shape, output_shape); - int i = 0; -#ifdef USE_NEON - const float32x4_t zero = vdupq_n_f32(0.0f); - const float32x4_t three = vdupq_n_f32(3.0f); - const float32x4_t six = vdupq_n_f32(6.0f); - const float32x4_t one_sixth = vdupq_n_f32(1.0f / 6.0f); - - for (; i <= size - 16; i += 16) { - // 4x partially unrolled version of the loop below. Refer to its comments. - const float32x4_t in_0 = vld1q_f32(input_data + i + 0); - const float32x4_t in_1 = vld1q_f32(input_data + i + 4); - const float32x4_t in_2 = vld1q_f32(input_data + i + 8); - const float32x4_t in_3 = vld1q_f32(input_data + i + 12); - const float32x4_t in_scaled_0 = vmulq_f32(in_0, one_sixth); - const float32x4_t in_scaled_1 = vmulq_f32(in_1, one_sixth); - const float32x4_t in_scaled_2 = vmulq_f32(in_2, one_sixth); - const float32x4_t in_scaled_3 = vmulq_f32(in_3, one_sixth); - const float32x4_t in_reluish_0 = - vminq_f32(six, vmaxq_f32(zero, vaddq_f32(in_0, three))); - const float32x4_t in_reluish_1 = - vminq_f32(six, vmaxq_f32(zero, vaddq_f32(in_1, three))); - const float32x4_t in_reluish_2 = - vminq_f32(six, vmaxq_f32(zero, vaddq_f32(in_2, three))); - const float32x4_t in_reluish_3 = - vminq_f32(six, vmaxq_f32(zero, vaddq_f32(in_3, three))); - const float32x4_t product_0 = vmulq_f32(in_scaled_0, in_reluish_0); - const float32x4_t product_1 = vmulq_f32(in_scaled_1, in_reluish_1); - const float32x4_t product_2 = vmulq_f32(in_scaled_2, in_reluish_2); - const float32x4_t product_3 = vmulq_f32(in_scaled_3, in_reluish_3); - vst1q_f32(output_data + i + 0, product_0); - vst1q_f32(output_data + i + 4, product_1); - vst1q_f32(output_data + i + 8, product_2); - vst1q_f32(output_data + i + 12, product_3); - } - for (; i <= size - 4; i += 4) { - // The expression to be computed is: - // out = one_sixth * in * min(six, max(zero, (in + three))) - // We structure the AST to have two roughly balanced, independent branches: - // - Multiplication: in_scaled = one_sixth * in. - // - Addition and clamping: in_reluish = min(six, max(zero, (in + three))). - // Then the remaining multiplication at the root of the tree. - const float32x4_t in = vld1q_f32(input_data + i); - const float32x4_t in_scaled = vmulq_f32(in, one_sixth); - const float32x4_t in_reluish = - vminq_f32(six, vmaxq_f32(zero, vaddq_f32(in, three))); - const float32x4_t product = vmulq_f32(in_scaled, in_reluish); - vst1q_f32(output_data + i, product); - } -#endif - for (; i < size; i++) { - const float in = input_data[i]; - output_data[i] = - in * std::min(6.0f, std::max(0.0f, in + 3.0f)) * (1.0f / 6.0f); - } -} - -#ifdef USE_NEON -inline void SaturateAndStore(int16x8_t src, std::uint8_t* dst) { - // Narrow values down to 8 bit unsigned, saturating. - uint8x8_t res8 = vqmovun_s16(src); - // Store results to destination. - vst1_u8(dst, res8); -} - -inline void SaturateAndStore(int16x8_t src, std::int8_t* dst) { - // Narrow values down to 8 bit unsigned, saturating. - int8x8_t res8 = vqmovn_s16(src); - // Store results to destination. - vst1_s8(dst, res8); -} -#endif - -template -inline void HardSwish(const HardSwishParams& params, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("HardSwish/Quantized"); - - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - int i = 0; - // This code heavily uses NEON saturating left shifts (vqshl*) with shift - // amounts that can be zero, in which case we rely on the correct behavior - // of a left shift by zero returning just its first operand unmodified. - // Unfortunately, the Intel arm_neon_sse.h implementation of vqshl* is - // buggy in the case of zero shift amounts, see b/137199585. That is why - // this NEON code path is restricted to true ARM NEON, excluding - // arm_neon_sse.h. Anyway, the arm_neon_sse.h implementation of saturating - // left shifts is slow scalar code, so there may not be much benefit in - // running that over just plain reference code. - // - // TODO(b/137199585): revisit when this is fixed. -#ifdef __ARM_NEON - const int16x8_t positive_reluish_multiplier_exponent_minus_one = - vdupq_n_s16(std::max(0, params.reluish_multiplier_exponent - 1)); - const int16x8_t positive_reluish_multiplier_exponent_last_bit = - vdupq_n_s16(params.reluish_multiplier_exponent > 0 ? 1 : 0); - const int16x8_t negative_reluish_multiplier_exponent = - vdupq_n_s16(std::min(0, params.reluish_multiplier_exponent)); - const int16x8_t constant_32767 = vdupq_n_s16(32767); - const int16x8_t output_multiplier_exponent = - vdupq_n_s16(params.output_multiplier_exponent); - const int16x8_t output_zero_point = vdupq_n_s16(params.output_zero_point); - // 4x unrolled version of the below NEON loop. Read that first. - for (; i <= flat_size - 32; i += 32) { - using cpu_backend_gemm::detail::Load16AndSubtractZeroPoint; - const int16x8x2_t input_value_0_1 = - Load16AndSubtractZeroPoint(input_data + i, params.input_zero_point); - const int16x8x2_t input_value_2_3 = Load16AndSubtractZeroPoint( - input_data + i + 16, params.input_zero_point); - const int16x8_t input_value_on_hires_input_scale_0 = - vshlq_n_s16(input_value_0_1.val[0], 7); - const int16x8_t input_value_on_hires_input_scale_1 = - vshlq_n_s16(input_value_0_1.val[1], 7); - const int16x8_t input_value_on_hires_input_scale_2 = - vshlq_n_s16(input_value_2_3.val[0], 7); - const int16x8_t input_value_on_hires_input_scale_3 = - vshlq_n_s16(input_value_2_3.val[1], 7); - const int16x8_t input_value_on_preshift_output_scale_0 = - vqrdmulhq_n_s16(input_value_on_hires_input_scale_0, - params.output_multiplier_fixedpoint_int16); - const int16x8_t input_value_on_preshift_output_scale_1 = - vqrdmulhq_n_s16(input_value_on_hires_input_scale_1, - params.output_multiplier_fixedpoint_int16); - const int16x8_t input_value_on_preshift_output_scale_2 = - vqrdmulhq_n_s16(input_value_on_hires_input_scale_2, - params.output_multiplier_fixedpoint_int16); - const int16x8_t input_value_on_preshift_output_scale_3 = - vqrdmulhq_n_s16(input_value_on_hires_input_scale_3, - params.output_multiplier_fixedpoint_int16); - int16x8_t reluish_value_0 = input_value_on_hires_input_scale_0; - int16x8_t reluish_value_1 = input_value_on_hires_input_scale_1; - int16x8_t reluish_value_2 = input_value_on_hires_input_scale_2; - int16x8_t reluish_value_3 = input_value_on_hires_input_scale_3; - reluish_value_0 = vqshlq_s16( - reluish_value_0, positive_reluish_multiplier_exponent_minus_one); - reluish_value_1 = vqshlq_s16( - reluish_value_1, positive_reluish_multiplier_exponent_minus_one); - reluish_value_2 = vqshlq_s16( - reluish_value_2, positive_reluish_multiplier_exponent_minus_one); - reluish_value_3 = vqshlq_s16( - reluish_value_3, positive_reluish_multiplier_exponent_minus_one); - reluish_value_0 = vqrdmulhq_n_s16( - reluish_value_0, params.reluish_multiplier_fixedpoint_int16); - reluish_value_1 = vqrdmulhq_n_s16( - reluish_value_1, params.reluish_multiplier_fixedpoint_int16); - reluish_value_2 = vqrdmulhq_n_s16( - reluish_value_2, params.reluish_multiplier_fixedpoint_int16); - reluish_value_3 = vqrdmulhq_n_s16( - reluish_value_3, params.reluish_multiplier_fixedpoint_int16); - reluish_value_0 = vqshlq_s16(reluish_value_0, - positive_reluish_multiplier_exponent_last_bit); - reluish_value_1 = vqshlq_s16(reluish_value_1, - positive_reluish_multiplier_exponent_last_bit); - reluish_value_2 = vqshlq_s16(reluish_value_2, - positive_reluish_multiplier_exponent_last_bit); - reluish_value_3 = vqshlq_s16(reluish_value_3, - positive_reluish_multiplier_exponent_last_bit); - reluish_value_0 = - vrshlq_s16(reluish_value_0, negative_reluish_multiplier_exponent); - reluish_value_1 = - vrshlq_s16(reluish_value_1, negative_reluish_multiplier_exponent); - reluish_value_2 = - vrshlq_s16(reluish_value_2, negative_reluish_multiplier_exponent); - reluish_value_3 = - vrshlq_s16(reluish_value_3, negative_reluish_multiplier_exponent); - reluish_value_0 = vrhaddq_s16(reluish_value_0, constant_32767); - reluish_value_1 = vrhaddq_s16(reluish_value_1, constant_32767); - reluish_value_2 = vrhaddq_s16(reluish_value_2, constant_32767); - reluish_value_3 = vrhaddq_s16(reluish_value_3, constant_32767); - const int16x8_t preshift_output_value_0 = - vqdmulhq_s16(reluish_value_0, input_value_on_preshift_output_scale_0); - const int16x8_t preshift_output_value_1 = - vqdmulhq_s16(reluish_value_1, input_value_on_preshift_output_scale_1); - const int16x8_t preshift_output_value_2 = - vqdmulhq_s16(reluish_value_2, input_value_on_preshift_output_scale_2); - const int16x8_t preshift_output_value_3 = - vqdmulhq_s16(reluish_value_3, input_value_on_preshift_output_scale_3); - int16x8_t output_value_0 = - vrshlq_s16(preshift_output_value_0, output_multiplier_exponent); - int16x8_t output_value_1 = - vrshlq_s16(preshift_output_value_1, output_multiplier_exponent); - int16x8_t output_value_2 = - vrshlq_s16(preshift_output_value_2, output_multiplier_exponent); - int16x8_t output_value_3 = - vrshlq_s16(preshift_output_value_3, output_multiplier_exponent); - output_value_0 = vaddq_s16(output_value_0, output_zero_point); - output_value_1 = vaddq_s16(output_value_1, output_zero_point); - output_value_2 = vaddq_s16(output_value_2, output_zero_point); - output_value_3 = vaddq_s16(output_value_3, output_zero_point); - SaturateAndStore(output_value_0, output_data + i); - SaturateAndStore(output_value_1, output_data + i + 8); - SaturateAndStore(output_value_2, output_data + i + 16); - SaturateAndStore(output_value_3, output_data + i + 24); - } - // NEON version of reference_ops::HardSwish. Read that first. - for (; i <= flat_size - 8; i += 8) { - using cpu_backend_gemm::detail::Load8AndSubtractZeroPoint; - const int16x8_t input_value = - Load8AndSubtractZeroPoint(input_data + i, params.input_zero_point); - const int16x8_t input_value_on_hires_input_scale = - vshlq_n_s16(input_value, 7); - const int16x8_t input_value_on_preshift_output_scale = - vqrdmulhq_n_s16(input_value_on_hires_input_scale, - params.output_multiplier_fixedpoint_int16); - int16x8_t reluish_value = input_value_on_hires_input_scale; - reluish_value = vqshlq_s16(reluish_value, - positive_reluish_multiplier_exponent_minus_one); - reluish_value = vqrdmulhq_n_s16(reluish_value, - params.reluish_multiplier_fixedpoint_int16); - reluish_value = vqshlq_s16(reluish_value, - positive_reluish_multiplier_exponent_last_bit); - reluish_value = - vrshlq_s16(reluish_value, negative_reluish_multiplier_exponent); - reluish_value = vrhaddq_s16(reluish_value, constant_32767); - const int16x8_t preshift_output_value = - vqdmulhq_s16(reluish_value, input_value_on_preshift_output_scale); - int16x8_t output_value = - vrshlq_s16(preshift_output_value, output_multiplier_exponent); - output_value = vaddq_s16(output_value, output_zero_point); - SaturateAndStore(output_value, output_data + i); - } -#endif - // TODO(b/137208495): revisit when unit tests cover reference code. - // Fall back to reference_ops::HardSwish. In general we have preferred - // to duplicate such scalar code rather than call reference code to handle - // leftovers, thinking that code duplication was not a big concern. - // However, most of our unit tests happen to test only optimized code, - // and the quantized HardSwish implementation is nontrivial enough that - // I really want test coverage for the reference code. - if (i < flat_size) { - const RuntimeShape leftover_shape{flat_size - i}; - reference_ops::HardSwish(params, leftover_shape, input_data + i, - leftover_shape, output_data + i); - } -} - -template -inline void IntegerExponentPow(const ArithmeticParams& params, - const RuntimeShape& unextended_base_shape, - const T* base_data, const int exponent, - const RuntimeShape& unextended_output_shape, - T* output_data) { - TFLITE_DCHECK_GE(exponent, 1); - if (exponent == 1) { - // copy data over. - std::memcpy(output_data, base_data, - unextended_base_shape.FlatSize() * sizeof(T)); - } else { - IntegerExponentPow(params, unextended_base_shape, base_data, exponent / 2, - unextended_output_shape, output_data); - Mul(params, unextended_base_shape, output_data, unextended_base_shape, - output_data, unextended_output_shape, output_data); - if (exponent % 2 == 1) { - Mul(params, unextended_base_shape, base_data, unextended_base_shape, - output_data, unextended_output_shape, output_data); - } - } -} - -template -inline void BroadcastPow4D(const RuntimeShape& unextended_input1_shape, - const T* input1_data, - const RuntimeShape& unextended_input2_shape, - const T* input2_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - ruy::profiler::ScopeLabel label("PowBroadcast"); - - if (unextended_input2_shape.FlatSize() == 1) { - static const float epsilon = 1e-5; - const T exponent = input2_data[0]; - const int int_exponent = static_cast(std::round(exponent)); - if ((std::abs(input2_data[0] - int_exponent) < epsilon) && - (int_exponent >= 1)) { - ArithmeticParams params; - if (std::is_same::value) { - params.float_activation_max = std::numeric_limits::max(); - params.float_activation_min = std::numeric_limits::lowest(); - } else if (std::is_same::value) { - params.quantized_activation_max = std::numeric_limits::max(); - params.quantized_activation_min = std::numeric_limits::lowest(); - } - IntegerExponentPow(params, unextended_input1_shape, input1_data, - int_exponent, unextended_output_shape, output_data); - return; - } - } - reference_ops::BroadcastPow4DSlow(unextended_input1_shape, input1_data, - unextended_input2_shape, input2_data, - unextended_output_shape, output_data); -} - -#ifdef USE_NEON - -inline void ScaleWithNewZeroPoint(const int32x4_t input, - const float32x4_t scale_dup, - const float32x4_t zero_times_scale_dup, - float32x4_t* output) { -#ifdef __ARM_FEATURE_FMA - *output = vfmaq_f32(zero_times_scale_dup, vcvtq_f32_s32(input), scale_dup); -#else - *output = vaddq_f32(vmulq_f32(vcvtq_f32_s32(input), scale_dup), - zero_times_scale_dup); -#endif -} - -#endif // USE_NEON - -inline void Dequantize(const tflite::DequantizationParams& op_params, - const RuntimeShape& input_shape, - const uint8_t* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("Dequantize/Uint8"); - const int32 zero_point = op_params.zero_point; - const double scale = op_params.scale; - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - int i = 0; -#ifdef USE_NEON - const float32x4_t scale_dup = vdupq_n_f32(static_cast(scale)); - const float32x4_t zero_times_scale_dup = - vdupq_n_f32(static_cast(-zero_point * scale)); - for (; i <= flat_size - 8; i += 8) { - const uint8x8_t input_u8 = vld1_u8(input_data + i); - const uint16x8_t input_u16 = vmovl_u8(input_u8); - const int16x8_t input_s16 = vreinterpretq_s16_u16(input_u16); - const int16x4_t input_s16_low = vget_low_s16(input_s16); - const int16x4_t input_s16_high = vget_high_s16(input_s16); - const int32x4_t val_low = vmovl_s16(input_s16_low); - const int32x4_t val_high = vmovl_s16(input_s16_high); - - float32x4_t result_low, result_high; - ScaleWithNewZeroPoint(val_low, scale_dup, zero_times_scale_dup, - &result_low); - ScaleWithNewZeroPoint(val_high, scale_dup, zero_times_scale_dup, - &result_high); - - vst1q_f32(output_data + i, result_low); - vst1q_f32(output_data + i + 4, result_high); - } -#endif // NEON - for (; i < flat_size; ++i) { - const int32 val = input_data[i]; - const float result = static_cast(scale * (val - zero_point)); - output_data[i] = result; - } -} - -inline void Dequantize(const tflite::DequantizationParams& op_params, - const RuntimeShape& input_shape, - const int8_t* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("Dequantize/Int8"); - const int32 zero_point = op_params.zero_point; - const double scale = op_params.scale; - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - int i = 0; -#ifdef USE_NEON - const float32x4_t scale_dup = vdupq_n_f32(static_cast(scale)); - const float32x4_t zero_times_scale_dup = - vdupq_n_f32(static_cast(-zero_point * scale)); - for (; i <= flat_size - 8; i += 8) { - const int8x8_t input_s8 = vld1_s8(input_data + i); - const int16x8_t input_s16 = vmovl_s8(input_s8); - const int16x4_t input_s16_low = vget_low_s16(input_s16); - const int16x4_t input_s16_high = vget_high_s16(input_s16); - const int32x4_t val_low = vmovl_s16(input_s16_low); - const int32x4_t val_high = vmovl_s16(input_s16_high); - - float32x4_t result_low, result_high; - ScaleWithNewZeroPoint(val_low, scale_dup, zero_times_scale_dup, - &result_low); - ScaleWithNewZeroPoint(val_high, scale_dup, zero_times_scale_dup, - &result_high); - - vst1q_f32(output_data + i, result_low); - vst1q_f32(output_data + i + 4, result_high); - } -#endif // NEON - for (; i < flat_size; ++i) { - const int32 val = input_data[i]; - const float result = static_cast(scale * (val - zero_point)); - output_data[i] = result; - } -} - -inline void Dequantize(const tflite::DequantizationParams& op_params, - const RuntimeShape& input_shape, - const int16_t* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("Dequantize/Int16"); - const int32 zero_point = op_params.zero_point; - const double scale = op_params.scale; - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - int i = 0; -#ifdef USE_NEON - const float32x4_t scale_dup = vdupq_n_f32(static_cast(scale)); - const float32x4_t zero_times_scale_dup = - vdupq_n_f32(static_cast(-zero_point * scale)); - for (; i <= flat_size - 8; i += 8) { - const int16x4_t input_s16_low = vld1_s16(input_data + i); - const int16x4_t input_s16_high = vld1_s16(input_data + i + 4); - const int32x4_t val_low = vmovl_s16(input_s16_low); - const int32x4_t val_high = vmovl_s16(input_s16_high); - - float32x4_t result_low, result_high; - ScaleWithNewZeroPoint(val_low, scale_dup, zero_times_scale_dup, - &result_low); - ScaleWithNewZeroPoint(val_high, scale_dup, zero_times_scale_dup, - &result_high); - - vst1q_f32(output_data + i, result_low); - vst1q_f32(output_data + i + 4, result_high); - } -#endif // NEON - for (; i < flat_size; ++i) { - const int32 val = input_data[i]; - const float result = static_cast(scale * (val - zero_point)); - output_data[i] = result; - } -} - -inline void Dequantize(const RuntimeShape& input_shape, - const Eigen::half* input_data, - const RuntimeShape& output_shape, float* output_data) { - reference_ops::Dequantize(input_shape, input_data, output_shape, output_data); -} - -template -inline void AffineQuantize(const tflite::QuantizationParams& op_params, - const RuntimeShape& input_shape, - const float* input_data, - const RuntimeShape& output_shape, T* output_data) { - reference_ops::AffineQuantize(op_params, input_shape, input_data, - output_shape, output_data); -} - -template <> -inline void AffineQuantize(const tflite::QuantizationParams& op_params, - const RuntimeShape& input_shape, - const float* input_data, - const RuntimeShape& output_shape, - int8_t* output_data) { - ruy::profiler::ScopeLabel label("Quantize/Int8"); - const int32 zero_point = op_params.zero_point; - const double scale = static_cast(op_params.scale); - const int flat_size = MatchingFlatSize(input_shape, output_shape); - static constexpr int32 min_val = std::numeric_limits::min(); - static constexpr int32 max_val = std::numeric_limits::max(); - - int i = 0; -#ifdef USE_NEON - const float32x4_t reverse_scale_dup = vdupq_n_f32(1.0f / scale); - const int32x4_t zero_point_dup = vdupq_n_s32(zero_point); - const int32x4_t min_val_dup = vdupq_n_s32(min_val); - const int32x4_t max_val_dup = vdupq_n_s32(max_val); - - for (; i <= flat_size - 8; i += 8) { - const float* src_data_ptr = input_data + i; - float32x4_t input_val_0 = vld1q_f32(src_data_ptr); - float32x4_t input_val_1 = vld1q_f32(src_data_ptr + 4); - - input_val_0 = vmulq_f32(input_val_0, reverse_scale_dup); - input_val_1 = vmulq_f32(input_val_1, reverse_scale_dup); - - int32x4_t casted_val_0 = RoundToNearest(input_val_0); - int32x4_t casted_val_1 = RoundToNearest(input_val_1); - - casted_val_0 = vaddq_s32(casted_val_0, zero_point_dup); - casted_val_1 = vaddq_s32(casted_val_1, zero_point_dup); - - // Clamp the values to fit the target type's range. - casted_val_0 = vmaxq_s32(casted_val_0, min_val_dup); - casted_val_1 = vmaxq_s32(casted_val_1, min_val_dup); - casted_val_0 = vminq_s32(casted_val_0, max_val_dup); - casted_val_1 = vminq_s32(casted_val_1, max_val_dup); - - const int16x4_t narrowed_val_0 = vmovn_s32(casted_val_0); - const int16x4_t narrowed_val_1 = vmovn_s32(casted_val_1); - const int16x8_t combined_val = vcombine_s16(narrowed_val_0, narrowed_val_1); - const int8x8_t combined_val_narrowed = vmovn_s16(combined_val); - vst1_s8(output_data + i, combined_val_narrowed); - } -#endif // NEON - - for (; i < flat_size; ++i) { - const float val = input_data[i]; - const int32 unclamped = - static_cast(TfLiteRound(val / scale)) + zero_point; - const int32 clamped = std::min(std::max(unclamped, min_val), max_val); - output_data[i] = clamped; - } -} - -template <> -inline void AffineQuantize(const tflite::QuantizationParams& op_params, - const RuntimeShape& input_shape, - const float* input_data, - const RuntimeShape& output_shape, - uint8_t* output_data) { - ruy::profiler::ScopeLabel label("Quantize/Uint8"); - const int32 zero_point = op_params.zero_point; - const double scale = static_cast(op_params.scale); - const int flat_size = MatchingFlatSize(input_shape, output_shape); - static constexpr int32 min_val = std::numeric_limits::min(); - static constexpr int32 max_val = std::numeric_limits::max(); - - int i = 0; -#ifdef USE_NEON - const float32x4_t reverse_scale_dup = vdupq_n_f32(1.0f / scale); - const int32x4_t zero_point_dup = vdupq_n_s32(zero_point); - const int32x4_t min_val_dup = vdupq_n_s32(min_val); - const int32x4_t max_val_dup = vdupq_n_s32(max_val); - - for (; i <= flat_size - 8; i += 8) { - const float* src_data_ptr = input_data + i; - float32x4_t input_val_0 = vld1q_f32(src_data_ptr); - float32x4_t input_val_1 = vld1q_f32(src_data_ptr + 4); - - input_val_0 = vmulq_f32(input_val_0, reverse_scale_dup); - input_val_1 = vmulq_f32(input_val_1, reverse_scale_dup); - - int32x4_t casted_val_0 = RoundToNearest(input_val_0); - int32x4_t casted_val_1 = RoundToNearest(input_val_1); - - casted_val_0 = vaddq_s32(casted_val_0, zero_point_dup); - casted_val_1 = vaddq_s32(casted_val_1, zero_point_dup); - - // Clamp the values to fit the target type's range. - casted_val_0 = vmaxq_s32(casted_val_0, min_val_dup); - casted_val_1 = vmaxq_s32(casted_val_1, min_val_dup); - casted_val_0 = vminq_s32(casted_val_0, max_val_dup); - casted_val_1 = vminq_s32(casted_val_1, max_val_dup); - - const uint16x4_t narrowed_val_0 = vqmovun_s32(casted_val_0); - const uint16x4_t narrowed_val_1 = vqmovun_s32(casted_val_1); - const uint16x8_t combined_val = - vcombine_u16(narrowed_val_0, narrowed_val_1); - const uint8x8_t combined_val_narrowed = vmovn_u16(combined_val); - vst1_u8(output_data + i, combined_val_narrowed); - } -#endif // NEON - - for (; i < flat_size; ++i) { - const float val = input_data[i]; - const int32 unclamped = - static_cast(TfLiteRound(val / scale)) + zero_point; - const int32 clamped = std::min(std::max(unclamped, min_val), max_val); - output_data[i] = clamped; - } -} - -template <> -inline void AffineQuantize(const tflite::QuantizationParams& op_params, - const RuntimeShape& input_shape, - const float* input_data, - const RuntimeShape& output_shape, - int16_t* output_data) { - ruy::profiler::ScopeLabel label("Quantize/Int16"); - const int32 zero_point = op_params.zero_point; - const double scale = static_cast(op_params.scale); - const int flat_size = MatchingFlatSize(input_shape, output_shape); - static constexpr int32 min_val = std::numeric_limits::min(); - static constexpr int32 max_val = std::numeric_limits::max(); - - int i = 0; -#ifdef USE_NEON - const float32x4_t reverse_scale_dup = vdupq_n_f32(1.0f / scale); - const int32x4_t zero_point_dup = vdupq_n_s32(zero_point); - const int32x4_t min_val_dup = vdupq_n_s32(min_val); - const int32x4_t max_val_dup = vdupq_n_s32(max_val); - - for (; i <= flat_size - 8; i += 8) { - const float* src_data_ptr = input_data + i; - float32x4_t input_val_0 = vld1q_f32(src_data_ptr); - float32x4_t input_val_1 = vld1q_f32(src_data_ptr + 4); - - input_val_0 = vmulq_f32(input_val_0, reverse_scale_dup); - input_val_1 = vmulq_f32(input_val_1, reverse_scale_dup); - - int32x4_t casted_val_0 = RoundToNearest(input_val_0); - int32x4_t casted_val_1 = RoundToNearest(input_val_1); - - casted_val_0 = vaddq_s32(casted_val_0, zero_point_dup); - casted_val_1 = vaddq_s32(casted_val_1, zero_point_dup); - - // Clamp the values to fit the target type's range. - casted_val_0 = vmaxq_s32(casted_val_0, min_val_dup); - casted_val_1 = vmaxq_s32(casted_val_1, min_val_dup); - casted_val_0 = vminq_s32(casted_val_0, max_val_dup); - casted_val_1 = vminq_s32(casted_val_1, max_val_dup); - - const int16x4_t narrowed_val_0 = vmovn_s32(casted_val_0); - const int16x4_t narrowed_val_1 = vmovn_s32(casted_val_1); - vst1_s16(output_data + i, narrowed_val_0); - vst1_s16(output_data + i + 4, narrowed_val_1); - } -#endif // NEON - - for (; i < flat_size; ++i) { - const float val = input_data[i]; - const int32 unclamped = - static_cast(TfLiteRound(val / scale)) + zero_point; - const int32 clamped = std::min(std::max(unclamped, min_val), max_val); - output_data[i] = clamped; - } -} - -// TODO(b/139252020): Replace GEMMLOWP_NEON with USE_NEON when the bug is fixed. -// The converted versions of gemmlowp::tanh and gemmlowp::logistic, done by -// arm_sse_2_neon.h, produce incorrect results with int16x8_t data types. -#ifdef GEMMLOWP_NEON - -inline int16x8x4_t SaturatingRounding( - int16x8_t input_val_0, int16x8_t input_val_1, int16x8_t input_val_2, - int16x8_t input_val_3, int input_left_shift, int input_multiplier) { - // This performs what is expressed in the scalar code as - // const int16 input_val_rescaled = SaturatingRoundingDoublingHighMul( - // static_cast(input_val_centered * (1 << input_left_shift)), - // static_cast(input_multiplier)); - const int16x8_t left_shift_dup = vdupq_n_s16(input_left_shift); - const int16x8_t input_val_shifted_0 = vshlq_s16(input_val_0, left_shift_dup); - const int16x8_t input_val_shifted_1 = vshlq_s16(input_val_1, left_shift_dup); - const int16x8_t input_val_shifted_2 = vshlq_s16(input_val_2, left_shift_dup); - const int16x8_t input_val_shifted_3 = vshlq_s16(input_val_3, left_shift_dup); - int16x8x4_t result; - result.val[0] = vqrdmulhq_n_s16(input_val_shifted_0, input_multiplier); - result.val[1] = vqrdmulhq_n_s16(input_val_shifted_1, input_multiplier); - result.val[2] = vqrdmulhq_n_s16(input_val_shifted_2, input_multiplier); - result.val[3] = vqrdmulhq_n_s16(input_val_shifted_3, input_multiplier); - return result; -} - -// 4-bit fixed point is enough for tanh since tanh(16) is almost same with one, -// considering 7 digits under zero. -inline int16x8x4_t FixedPoint4Logistic(int16x8x4_t input_val) { - // Invoke gemmlowp::logistic on FixedPoint wrapping int16x8_t - using FixedPoint4 = gemmlowp::FixedPoint; - using FixedPoint0 = gemmlowp::FixedPoint; - const FixedPoint4 input_val_f4_0 = FixedPoint4::FromRaw(input_val.val[0]); - const FixedPoint4 input_val_f4_1 = FixedPoint4::FromRaw(input_val.val[1]); - const FixedPoint4 input_val_f4_2 = FixedPoint4::FromRaw(input_val.val[2]); - const FixedPoint4 input_val_f4_3 = FixedPoint4::FromRaw(input_val.val[3]); - - // TODO(b/134622898) Implement a low accuracy version of logistic. In this - // method, gemmlowp::tanh spends about 80% of the execution times. The - // current implementation is rougly 12-bit accurate in the 16-bit fixed - // point case. Until reaching to error bounds, there are rooms for - // improvements. - const FixedPoint0 output_val_f0_0 = gemmlowp::logistic(input_val_f4_0); - const FixedPoint0 output_val_f0_1 = gemmlowp::logistic(input_val_f4_1); - const FixedPoint0 output_val_f0_2 = gemmlowp::logistic(input_val_f4_2); - const FixedPoint0 output_val_f0_3 = gemmlowp::logistic(input_val_f4_3); - - // Divide by 2^7 as in the scalar code - int16x8x4_t result; - result.val[0] = vrshrq_n_s16(output_val_f0_0.raw(), 7); - result.val[1] = vrshrq_n_s16(output_val_f0_1.raw(), 7); - result.val[2] = vrshrq_n_s16(output_val_f0_2.raw(), 7); - result.val[3] = vrshrq_n_s16(output_val_f0_3.raw(), 7); - return result; -} - -// 4-bit fixed point is enough for tanh since tanh(16) is almost same with one, -// considering 11 digits under zero at least. -inline int16x8x4_t FixedPoint4Tanh(int16x8x4_t input_val) { - // Invoke gemmlowp::logistic on FixedPoint wrapping int16x8_t - using FixedPoint4 = gemmlowp::FixedPoint; - using FixedPoint0 = gemmlowp::FixedPoint; - const FixedPoint4 input_val_f4_0 = FixedPoint4::FromRaw(input_val.val[0]); - const FixedPoint4 input_val_f4_1 = FixedPoint4::FromRaw(input_val.val[1]); - const FixedPoint4 input_val_f4_2 = FixedPoint4::FromRaw(input_val.val[2]); - const FixedPoint4 input_val_f4_3 = FixedPoint4::FromRaw(input_val.val[3]); - - // TODO(b/134622898) Implement a low accuracy version of logistic. In this - // method, gemmlowp::tanh spends about 80% of the execution times. The - // current implementation is rougly 12-bit accurate in the 16-bit fixed - // point case. Until reaching to error bounds, there are rooms for - // improvements. - const FixedPoint0 output_val_f0_0 = gemmlowp::tanh(input_val_f4_0); - const FixedPoint0 output_val_f0_1 = gemmlowp::tanh(input_val_f4_1); - const FixedPoint0 output_val_f0_2 = gemmlowp::tanh(input_val_f4_2); - const FixedPoint0 output_val_f0_3 = gemmlowp::tanh(input_val_f4_3); - - // Divide by 2^7 as in the scalar code - int16x8x4_t result; - result.val[0] = vrshrq_n_s16(output_val_f0_0.raw(), 8); - result.val[1] = vrshrq_n_s16(output_val_f0_1.raw(), 8); - result.val[2] = vrshrq_n_s16(output_val_f0_2.raw(), 8); - result.val[3] = vrshrq_n_s16(output_val_f0_3.raw(), 8); - return result; -} - -inline uint8x16x2_t CalculateUnsignedClampingWithRangeBitMasks( - int16x8x2_t input_val, int16x8_t range_radius_dup, - int16x8_t neg_range_radius_dup) { - const uint16x8_t mask_rightclamp_0 = - vcgtq_s16(input_val.val[0], range_radius_dup); - const uint16x8_t mask_rightclamp_1 = - vcgtq_s16(input_val.val[1], range_radius_dup); - - const uint16x8_t mask_leftclamp_0 = - vcgeq_s16(input_val.val[0], neg_range_radius_dup); - const uint16x8_t mask_leftclamp_1 = - vcgeq_s16(input_val.val[1], neg_range_radius_dup); - - uint8x16x2_t result; - result.val[0] = vcombine_u8(vshrn_n_u16(mask_leftclamp_0, 8), - vshrn_n_u16(mask_leftclamp_1, 8)); - result.val[1] = vcombine_u8(vshrn_n_u16(mask_rightclamp_0, 8), - vshrn_n_u16(mask_rightclamp_1, 8)); - return result; -} - -inline uint8x16x2_t CalculateSignedClampingWithRangeBitMasks( - int16x8x2_t input_val, int16x8_t range_radius_dup, - int16x8_t neg_range_radius_dup) { - const uint16x8_t mask_rightclamp_0 = - vcgtq_s16(input_val.val[0], range_radius_dup); - const uint16x8_t mask_rightclamp_1 = - vcgtq_s16(input_val.val[1], range_radius_dup); - - const uint16x8_t mask_leftclamp_0 = - vcltq_s16(input_val.val[0], neg_range_radius_dup); - const uint16x8_t mask_leftclamp_1 = - vcltq_s16(input_val.val[1], neg_range_radius_dup); - - uint8x16x2_t result; - result.val[0] = vcombine_u8(vshrn_n_u16(mask_leftclamp_0, 8), - vshrn_n_u16(mask_leftclamp_1, 8)); - result.val[1] = vcombine_u8(vshrn_n_u16(mask_rightclamp_0, 8), - vshrn_n_u16(mask_rightclamp_1, 8)); - return result; -} - -inline void ClampWithRangeAndStore(uint8_t* output_dst, uint8x16_t input_val, - uint8x16x2_t masks_clamp) { - // Store back to memory - vst1q_u8(output_dst, vandq_u8(vorrq_u8(input_val, masks_clamp.val[1]), - masks_clamp.val[0])); -} - -inline void ClampWithRangeAndStore(int8_t* output_dst, int8x16_t input_val, - uint8x16x2_t masks_clamp) { - static const int8x16_t max_dup = vdupq_n_s8(127); - static const int8x16_t min_dup = vdupq_n_s8(-128); - // Store back to memory - vst1q_s8(output_dst, - vbslq_s8(masks_clamp.val[1], max_dup, - vbslq_s8(masks_clamp.val[0], min_dup, input_val))); -} - -#endif // GEMMLOWP_NEON - -inline void Tanh16bitPrecision(const TanhParams& params, - const RuntimeShape& input_shape, - const uint8* input_data, - const RuntimeShape& output_shape, - uint8* output_data) { - // Note that this is almost the exact same code as in Logistic(). - ruy::profiler::ScopeLabel label("Tanh/Uint8"); - const int32 input_zero_point = params.input_zero_point; - const int32 input_range_radius = params.input_range_radius; - const int16 input_multiplier = static_cast(params.input_multiplier); - const int16 input_left_shift = static_cast(params.input_left_shift); - const int size = MatchingFlatSize(input_shape, output_shape); - - int c = 0; - int16_t output_zero_point = 128; - -// TODO(b/139252020): Replace GEMMLOWP_NEON with USE_NEON when the bug is fixed. -// The converted versions of gemmlowp::tanh and gemmlowp::logistic, done by -// arm_sse_2_neon.h, produce incorrect results with int16x8_t data types. -#ifdef GEMMLOWP_NEON - const int16x8_t range_radius_dup = vdupq_n_s16(input_range_radius); - const int16x8_t neg_range_radius_dup = vdupq_n_s16(-input_range_radius); - const int16x8_t output_zero_point_s16 = vdupq_n_s16(output_zero_point); - - // Handle 32 values at a time - for (; c <= size - 32; c += 32) { - // Read input uint8 values, cast to int16 and subtract input_zero_point - using cpu_backend_gemm::detail::Load16AndSubtractZeroPoint; - const int16x8x2_t input_val_centered_0_1 = - Load16AndSubtractZeroPoint(input_data + c, input_zero_point); - const int16x8x2_t input_val_centered_2_3 = - Load16AndSubtractZeroPoint(input_data + c + 16, input_zero_point); - - // Prepare the bit masks that we will use at the end to implement the logic - // that was expressed in the scalar code with branching: - // if (input_val_centered < -input_range_radius) { - // output_val = 0; - // } else if (input_val_centered > input_range_radius) { - // output_val = 255; - // } else { - // ... - uint8x16x2_t masks_clamp_0_1 = CalculateUnsignedClampingWithRangeBitMasks( - input_val_centered_0_1, range_radius_dup, neg_range_radius_dup); - uint8x16x2_t masks_clamp_2_3 = CalculateUnsignedClampingWithRangeBitMasks( - input_val_centered_2_3, range_radius_dup, neg_range_radius_dup); - - int16x8x4_t input_val_rescaled = SaturatingRounding( - input_val_centered_0_1.val[0], input_val_centered_0_1.val[1], - input_val_centered_2_3.val[0], input_val_centered_2_3.val[1], - input_left_shift, input_multiplier); - - int16x8x4_t output_val_s16 = FixedPoint4Tanh(input_val_rescaled); - - // Add the output zero point - output_val_s16.val[0] = - vaddq_s16(output_val_s16.val[0], output_zero_point_s16); - output_val_s16.val[1] = - vaddq_s16(output_val_s16.val[1], output_zero_point_s16); - output_val_s16.val[2] = - vaddq_s16(output_val_s16.val[2], output_zero_point_s16); - output_val_s16.val[3] = - vaddq_s16(output_val_s16.val[3], output_zero_point_s16); - - // Cast output values to uint8, saturating - uint8x16_t output_val_u8_0_1 = vcombine_u8( - vqmovun_s16(output_val_s16.val[0]), vqmovun_s16(output_val_s16.val[1])); - uint8x16_t output_val_u8_2_3 = vcombine_u8( - vqmovun_s16(output_val_s16.val[2]), vqmovun_s16(output_val_s16.val[3])); - - ClampWithRangeAndStore(output_data + c, output_val_u8_0_1, masks_clamp_0_1); - ClampWithRangeAndStore(output_data + c + 16, output_val_u8_2_3, - masks_clamp_2_3); - } -#endif // GEMMLOWP_NEON - // Leftover loop: handle one value at a time with scalar code. - for (; c < size; ++c) { - const uint8 input_val_u8 = input_data[c]; - const int16 input_val_centered = - static_cast(input_val_u8) - input_zero_point; - uint8 output_val; - if (input_val_centered < -input_range_radius) { - output_val = 0; - } else if (input_val_centered > input_range_radius) { - output_val = 255; - } else { - using gemmlowp::SaturatingRoundingDoublingHighMul; - const int16 input_val_rescaled = SaturatingRoundingDoublingHighMul( - static_cast(input_val_centered * (1 << input_left_shift)), - static_cast(input_multiplier)); - using FixedPoint4 = gemmlowp::FixedPoint; - using FixedPoint0 = gemmlowp::FixedPoint; - const FixedPoint4 input_val_f4 = FixedPoint4::FromRaw(input_val_rescaled); - const FixedPoint0 output_val_f0 = gemmlowp::tanh(input_val_f4); - using gemmlowp::RoundingDivideByPOT; - int16 output_val_s16 = RoundingDivideByPOT(output_val_f0.raw(), 8); - output_val_s16 += output_zero_point; - if (output_val_s16 == 256) { - output_val_s16 = 255; - } - TFLITE_DCHECK_GE(output_val_s16, 0); - TFLITE_DCHECK_LE(output_val_s16, 255); - output_val = static_cast(output_val_s16); - } - output_data[c] = output_val; - } -} - -inline void Tanh16bitPrecision(const TanhParams& params, - const RuntimeShape& input_shape, - const int8* input_data, - const RuntimeShape& output_shape, - int8* output_data) { - // Note that this is almost the exact same code as in Logistic(). - ruy::profiler::ScopeLabel label("Tanh/Int8"); - const int32 input_zero_point = params.input_zero_point; - const int32 input_range_radius = params.input_range_radius; - const int16 input_multiplier = static_cast(params.input_multiplier); - const int16 input_left_shift = static_cast(params.input_left_shift); - const int size = MatchingFlatSize(input_shape, output_shape); - - int c = 0; -// TODO(b/139252020): Replace GEMMLOWP_NEON with USE_NEON when the bug is fixed. -// The converted versions of gemmlowp::tanh and gemmlowp::logistic, done by -// arm_sse_2_neon.h, produce incorrect results with int16x8_t data types. -#ifdef GEMMLOWP_NEON - const int16x8_t range_radius_dup = vdupq_n_s16(input_range_radius); - const int16x8_t neg_range_radius_dup = vdupq_n_s16(-input_range_radius); - - // Handle 32 values at a time - for (; c <= size - 32; c += 32) { - // Read input int8 values, cast to int16 and subtract input_zero_point - using cpu_backend_gemm::detail::Load16AndSubtractZeroPoint; - const int16x8x2_t input_val_centered_0_1 = - Load16AndSubtractZeroPoint(input_data + c, input_zero_point); - const int16x8x2_t input_val_centered_2_3 = - Load16AndSubtractZeroPoint(input_data + c + 16, input_zero_point); - - // Prepare the bit masks that we will use at the end to implement the logic - // that was expressed in the scalar code with branching: - // if (input_val_centered < -input_range_radius) { - // output_val = -128; - // } else if (input_val_centered > input_range_radius) { - // output_val = 127; - // } else { - // ... - uint8x16x2_t masks_clamp_0_1 = CalculateSignedClampingWithRangeBitMasks( - input_val_centered_0_1, range_radius_dup, neg_range_radius_dup); - uint8x16x2_t masks_clamp_2_3 = CalculateSignedClampingWithRangeBitMasks( - input_val_centered_2_3, range_radius_dup, neg_range_radius_dup); - - int16x8x4_t input_val_rescaled = SaturatingRounding( - input_val_centered_0_1.val[0], input_val_centered_0_1.val[1], - input_val_centered_2_3.val[0], input_val_centered_2_3.val[1], - input_left_shift, input_multiplier); - - int16x8x4_t output_val_s16 = FixedPoint4Tanh(input_val_rescaled); - - // Cast output values to uint8, saturating - int8x16_t output_val_s8_0_1 = vcombine_s8( - vqmovn_s16(output_val_s16.val[0]), vqmovn_s16(output_val_s16.val[1])); - int8x16_t output_val_s8_2_3 = vcombine_s8( - vqmovn_s16(output_val_s16.val[2]), vqmovn_s16(output_val_s16.val[3])); - - ClampWithRangeAndStore(output_data + c, output_val_s8_0_1, masks_clamp_0_1); - ClampWithRangeAndStore(output_data + c + 16, output_val_s8_2_3, - masks_clamp_2_3); - } -#endif // GEMMLOWP_NEON - // Leftover loop: handle one value at a time with scalar code. - for (; c < size; ++c) { - const int8 input_val_s8 = input_data[c]; - const int16 input_val_centered = - static_cast(input_val_s8) - input_zero_point; - int8 output_val; - if (input_val_centered <= -input_range_radius) { - output_val = -128; - } else if (input_val_centered >= input_range_radius) { - output_val = 127; - } else { - using gemmlowp::SaturatingRoundingDoublingHighMul; - const int16 input_val_rescaled = SaturatingRoundingDoublingHighMul( - static_cast(input_val_centered * (1 << input_left_shift)), - static_cast(input_multiplier)); - using FixedPoint4 = gemmlowp::FixedPoint; - using FixedPoint0 = gemmlowp::FixedPoint; - const FixedPoint4 input_val_f4 = FixedPoint4::FromRaw(input_val_rescaled); - const FixedPoint0 output_val_f0 = gemmlowp::tanh(input_val_f4); - using gemmlowp::RoundingDivideByPOT; - int16 output_val_s16 = RoundingDivideByPOT(output_val_f0.raw(), 8); - if (output_val_s16 == 128) { - output_val_s16 = 127; - } - TFLITE_DCHECK_GE(output_val_s16, -128); - TFLITE_DCHECK_LE(output_val_s16, 127); - output_val = static_cast(output_val_s16); - } - output_data[c] = output_val; - } -} - -inline void Logistic16bitPrecision(const LogisticParams& params, - const RuntimeShape& input_shape, - const uint8* input_data, - const RuntimeShape& output_shape, - uint8* output_data) { - ruy::profiler::ScopeLabel label("Logistic/Uint8"); - const int32 input_zero_point = params.input_zero_point; - const int32 input_range_radius = params.input_range_radius; - const int32 input_multiplier = params.input_multiplier; - const int16 input_left_shift = static_cast(params.input_left_shift); - const int size = MatchingFlatSize(input_shape, output_shape); - - int c = 0; -// TODO(b/139252020): Replace GEMMLOWP_NEON with USE_NEON when the bug is fixed. -// The converted versions of gemmlowp::tanh and gemmlowp::logistic, done by -// arm_sse_2_neon.h, produce incorrect results with int16x8_t data types. -#ifdef GEMMLOWP_NEON - const int16x8_t range_radius_dup = vdupq_n_s16(input_range_radius); - const int16x8_t neg_range_radius_dup = vdupq_n_s16(-input_range_radius); - - // Handle 32 values at a time - for (; c <= size - 32; c += 32) { - // Read input uint8 values, cast to int16 and subtract input_zero_point - using cpu_backend_gemm::detail::Load16AndSubtractZeroPoint; - const int16x8x2_t input_val_centered_0_1 = - Load16AndSubtractZeroPoint(input_data + c, input_zero_point); - const int16x8x2_t input_val_centered_2_3 = - Load16AndSubtractZeroPoint(input_data + c + 16, input_zero_point); - - // Prepare the bit masks that we will use at the end to implement the logic - // that was expressed in the scalar code with branching: - // if (input_val_centered < -input_range_radius) { - // output_val = 0; - // } else if (input_val_centered > input_range_radius) { - // output_val = 255; - // } else { - // ... - uint8x16x2_t masks_clamp_0_1 = CalculateUnsignedClampingWithRangeBitMasks( - input_val_centered_0_1, range_radius_dup, neg_range_radius_dup); - uint8x16x2_t masks_clamp_2_3 = CalculateUnsignedClampingWithRangeBitMasks( - input_val_centered_2_3, range_radius_dup, neg_range_radius_dup); - - int16x8x4_t input_val_rescaled = SaturatingRounding( - input_val_centered_0_1.val[0], input_val_centered_0_1.val[1], - input_val_centered_2_3.val[0], input_val_centered_2_3.val[1], - input_left_shift, input_multiplier); - - int16x8x4_t output_val_s16 = FixedPoint4Logistic(input_val_rescaled); - - // Cast output values to uint8, saturating - uint8x16_t output_val_u8_0_1 = vcombine_u8( - vqmovun_s16(output_val_s16.val[0]), vqmovun_s16(output_val_s16.val[1])); - uint8x16_t output_val_u8_2_3 = vcombine_u8( - vqmovun_s16(output_val_s16.val[2]), vqmovun_s16(output_val_s16.val[3])); - - ClampWithRangeAndStore(output_data + c, output_val_u8_0_1, masks_clamp_0_1); - ClampWithRangeAndStore(output_data + c + 16, output_val_u8_2_3, - masks_clamp_2_3); - } -#endif // GEMMLOWP_NEON - // Leftover loop: handle one value at a time with scalar code. - for (; c < size; ++c) { - const uint8 input_val_u8 = input_data[c]; - const int16 input_val_centered = - static_cast(input_val_u8) - input_zero_point; - uint8 output_val; - if (input_val_centered < -input_range_radius) { - output_val = 0; - } else if (input_val_centered > input_range_radius) { - output_val = 255; - } else { - using gemmlowp::SaturatingRoundingDoublingHighMul; - const int16 input_val_rescaled = SaturatingRoundingDoublingHighMul( - static_cast(input_val_centered * (1 << input_left_shift)), - static_cast(input_multiplier)); - using FixedPoint4 = gemmlowp::FixedPoint; - using FixedPoint0 = gemmlowp::FixedPoint; - const FixedPoint4 input_val_f4 = FixedPoint4::FromRaw(input_val_rescaled); - const FixedPoint0 output_val_f0 = gemmlowp::logistic(input_val_f4); - using gemmlowp::RoundingDivideByPOT; - int16 output_val_s16 = RoundingDivideByPOT(output_val_f0.raw(), 7); - if (output_val_s16 == 256) { - output_val_s16 = 255; - } - TFLITE_DCHECK_GE(output_val_s16, 0); - TFLITE_DCHECK_LE(output_val_s16, 255); - output_val = static_cast(output_val_s16); - } - output_data[c] = output_val; - } -} - -inline void Logistic16bitPrecision(const LogisticParams& params, - const RuntimeShape& input_shape, - const int8* input_data, - const RuntimeShape& output_shape, - int8* output_data) { - ruy::profiler::ScopeLabel label("Logistic/Int8"); - const int32 input_zero_point = params.input_zero_point; - const int32 input_range_radius = params.input_range_radius; - const int32 input_multiplier = params.input_multiplier; - const int16 input_left_shift = static_cast(params.input_left_shift); - const int size = MatchingFlatSize(input_shape, output_shape); - - int c = 0; - const int16 output_zero_point = 128; -// TODO(b/139252020): Replace GEMMLOWP_NEON with USE_NEON when the bug is fixed. -// The converted versions of gemmlowp::tanh and gemmlowp::logistic, done by -// arm_sse_2_neon.h, produce incorrect results with int16x8_t data types. -#ifdef GEMMLOWP_NEON - const int16x8_t range_radius_dup = vdupq_n_s16(input_range_radius); - const int16x8_t neg_range_radius_dup = vdupq_n_s16(-input_range_radius); - const int16x8_t output_zero_point_dup = vdupq_n_s16(output_zero_point); - - // Handle 32 values at a time - for (; c <= size - 32; c += 32) { - // Read input int8 values, cast to int16 and subtract input_zero_point - using cpu_backend_gemm::detail::Load16AndSubtractZeroPoint; - const int16x8x2_t input_val_centered_0_1 = - Load16AndSubtractZeroPoint(input_data + c, input_zero_point); - const int16x8x2_t input_val_centered_2_3 = - Load16AndSubtractZeroPoint(input_data + c + 16, input_zero_point); - - // Prepare the bit masks that we will use at the end to implement the logic - // that was expressed in the scalar code with branching: - // if (input_val_centered < -input_range_radius) { - // output_val = -128; - // } else if (input_val_centered > input_range_radius) { - // output_val = 127; - // } else { - // ... - uint8x16x2_t masks_clamp_0_1 = CalculateSignedClampingWithRangeBitMasks( - input_val_centered_0_1, range_radius_dup, neg_range_radius_dup); - uint8x16x2_t masks_clamp_2_3 = CalculateSignedClampingWithRangeBitMasks( - input_val_centered_2_3, range_radius_dup, neg_range_radius_dup); - - int16x8x4_t input_val_rescaled = SaturatingRounding( - input_val_centered_0_1.val[0], input_val_centered_0_1.val[1], - input_val_centered_2_3.val[0], input_val_centered_2_3.val[1], - input_left_shift, input_multiplier); - - int16x8x4_t output_val_s16 = FixedPoint4Logistic(input_val_rescaled); - - // Substract output zero point. - output_val_s16.val[0] = - vsubq_s16(output_val_s16.val[0], output_zero_point_dup); - output_val_s16.val[1] = - vsubq_s16(output_val_s16.val[1], output_zero_point_dup); - output_val_s16.val[2] = - vsubq_s16(output_val_s16.val[2], output_zero_point_dup); - output_val_s16.val[3] = - vsubq_s16(output_val_s16.val[3], output_zero_point_dup); - - // Cast output values to int8, saturating - int8x16_t output_val_s8_0_1 = vcombine_s8( - vqmovn_s16(output_val_s16.val[0]), vqmovn_s16(output_val_s16.val[1])); - int8x16_t output_val_s8_2_3 = vcombine_s8( - vqmovn_s16(output_val_s16.val[2]), vqmovn_s16(output_val_s16.val[3])); - - ClampWithRangeAndStore(output_data + c, output_val_s8_0_1, masks_clamp_0_1); - ClampWithRangeAndStore(output_data + c + 16, output_val_s8_2_3, - masks_clamp_2_3); - } -#endif // GEMMLOWP_NEON - // Leftover loop: handle one value at a time with scalar code. - for (; c < size; ++c) { - const int8 input_val_s8 = input_data[c]; - const int16 input_val_centered = - static_cast(input_val_s8) - input_zero_point; - int8 output_val; - if (input_val_centered < -input_range_radius) { - output_val = -128; - } else if (input_val_centered > input_range_radius) { - output_val = 127; - } else { - using gemmlowp::SaturatingRoundingDoublingHighMul; - const int16 input_val_rescaled = SaturatingRoundingDoublingHighMul( - static_cast(input_val_centered * (1 << input_left_shift)), - static_cast(input_multiplier)); - using FixedPoint4 = gemmlowp::FixedPoint; - using FixedPoint0 = gemmlowp::FixedPoint; - const FixedPoint4 input_val_f4 = FixedPoint4::FromRaw(input_val_rescaled); - const FixedPoint0 output_val_f0 = gemmlowp::logistic(input_val_f4); - using gemmlowp::RoundingDivideByPOT; - int16 output_val_s16 = RoundingDivideByPOT(output_val_f0.raw(), 7); - output_val_s16 -= output_zero_point; - if (output_val_s16 == 128) { - output_val_s16 = 127; - } - TFLITE_DCHECK_GE(output_val_s16, -128); - TFLITE_DCHECK_LE(output_val_s16, 127); - output_val = static_cast(output_val_s16); - } - output_data[c] = output_val; - } -} - -// Transpose2D only deals with typical 2D matrix transpose ops. -// Perform transpose by transposing 4x4 blocks of the input, proceeding from -// left to right (down the rows) of the input, and then from top to bottom. -template -inline void Transpose2D(const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 2); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 2); - - const int d0 = input_shape.DimsData()[0]; - const int d1 = input_shape.DimsData()[1]; - const int kLines = 4; - const int kSkipSize = (kLines - 1) * d1; - - const T* input = input_data; - - int i = 0; - for (; i <= d0 - kLines; i += kLines) { - T* output = output_data + i; - - const T* input_ptr = input; - optimized_ops_preload_l1_keep(input_ptr); - input_ptr += d1; - optimized_ops_preload_l1_keep(input_ptr); - input_ptr += d1; - optimized_ops_preload_l1_keep(input_ptr); - input_ptr += d1; - optimized_ops_preload_l1_keep(input_ptr); - - int j = 0; - for (; j <= d1 - kLines; j += kLines) { - input_ptr = input; - const T a00 = input_ptr[0]; - const T a01 = input_ptr[1]; - const T a02 = input_ptr[2]; - const T a03 = input_ptr[3]; - input_ptr += d1; - const T a10 = input_ptr[0]; - const T a11 = input_ptr[1]; - const T a12 = input_ptr[2]; - const T a13 = input_ptr[3]; - input_ptr += d1; - const T a20 = input_ptr[0]; - const T a21 = input_ptr[1]; - const T a22 = input_ptr[2]; - const T a23 = input_ptr[3]; - input_ptr += d1; - const T a30 = input_ptr[0]; - const T a31 = input_ptr[1]; - const T a32 = input_ptr[2]; - const T a33 = input_ptr[3]; - - output[0] = a00; - output[1] = a10; - output[2] = a20; - output[3] = a30; - output += d0; - - output[0] = a01; - output[1] = a11; - output[2] = a21; - output[3] = a31; - output += d0; - - output[0] = a02; - output[1] = a12; - output[2] = a22; - output[3] = a32; - output += d0; - - output[0] = a03; - output[1] = a13; - output[2] = a23; - output[3] = a33; - output += d0; - - input += kLines; - } - if (j == d1) { - input += kSkipSize; - } else { - for (int p = 0; p < kLines; ++p) { - for (int q = 0; q < d1 - j; ++q) { - *(output + q * d0 + p) = *(input + p * d1 + q); - } - } - input += (d1 - j) + kSkipSize; - } - } - for (; i < d0; ++i) { - T* output = output_data + i; - for (int j = 0; j < d1; ++j) { - *output = *input; - output += d0; - ++input; - } - } -} - -template <> -inline void Transpose2D(const RuntimeShape& input_shape, - const int32_t* input_data, - const RuntimeShape& output_shape, - int32_t* output_data) { - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 2); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 2); - - const int d0 = input_shape.DimsData()[0]; - const int d1 = input_shape.DimsData()[1]; -#ifdef USE_NEON - const int kLines = 4; - const int kSkipSize = (kLines - 1) * d1; -#endif - - const int32_t* input = input_data; - - int i = 0; -#ifdef USE_NEON - for (; i <= d0 - kLines; i += kLines) { - int32_t* output = output_data + i; - - const int32_t* input_ptr = input; - optimized_ops_preload_l1_keep(input_ptr); - input_ptr += d1; - optimized_ops_preload_l1_keep(input_ptr); - input_ptr += d1; - optimized_ops_preload_l1_keep(input_ptr); - input_ptr += d1; - optimized_ops_preload_l1_keep(input_ptr); - - int j = 0; - for (; j <= d1 - kLines; j += kLines) { - input_ptr = input; - int32x4_t a0 = vld1q_s32(input); - input_ptr += d1; - int32x4_t a1 = vld1q_s32(input_ptr); - input_ptr += d1; - int32x4_t a2 = vld1q_s32(input_ptr); - input_ptr += d1; - int32x4_t a3 = vld1q_s32(input_ptr); - - int32x4x2_t tmp1 = vuzpq_s32(a0, a2); - int32x4x2_t tmp2 = vuzpq_s32(a1, a3); - int32x4x2_t tmp3 = vtrnq_s32(tmp1.val[0], tmp2.val[0]); - int32x4x2_t tmp4 = vtrnq_s32(tmp1.val[1], tmp2.val[1]); - - vst1q_s32(output, tmp3.val[0]); - output += d0; - vst1q_s32(output, tmp4.val[0]); - output += d0; - vst1q_s32(output, tmp3.val[1]); - output += d0; - vst1q_s32(output, tmp4.val[1]); - output += d0; - input += kLines; - } - if (j == d1) { - input += kSkipSize; - } else { - for (int p = 0; p < kLines; ++p) { - for (int q = 0; q < d1 - j; ++q) { - *(output + q * d0 + p) = *(input + p * d1 + q); - } - } - input += (d1 - j) + kSkipSize; - } - } -#endif - for (; i < d0; ++i) { - int32_t* output = output_data + i; - for (int j = 0; j < d1; ++j) { - *output = *input; - output += d0; - ++input; - } - } -} - -// TODO(alanchiao): see if we can reduce the number -// of lines of code in branching without affecting latency. -template -inline void Transpose3D(const TransposeParams& params, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - int s1, s2, s3; - s1 = input_shape.Dims(0); - s2 = input_shape.Dims(1); - s3 = input_shape.Dims(2); - - int p1, p2, p3; - if (params.perm[0] == 2) { - p1 = 1; - } else if (params.perm[1] == 2) { - p2 = 1; - } else { - p3 = 1; - } - - if (params.perm[0] == 1) { - p1 = s3; - } else if (params.perm[1] == 1) { - p2 = s3; - } else { - p3 = s3; - } - - if (params.perm[0] == 0) { - p1 = s2 * s3; - } else if (params.perm[1] == 0) { - p2 = s2 * s3; - } else { - p3 = s2 * s3; - } - - int o_s[3]; - o_s[0] = input_shape.Dims(params.perm[0]); - o_s[1] = input_shape.Dims(params.perm[1]); - o_s[2] = input_shape.Dims(params.perm[2]); - - for (int i1 = 0; i1 < o_s[0]; ++i1) { - for (int i2 = 0; i2 < o_s[1]; ++i2) { - for (int i3 = 0; i3 < o_s[2]; ++i3) { - const int i = i1 * p1 + i2 * p2 + i3 * p3; - const int o = i1 * o_s[1] * o_s[2] + i2 * o_s[2] + i3; - output_data[o] = input_data[i]; - } - } - } -} - -template -void TransposeImpl(const TransposeParams& params, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - const int dims_cnt = input_shape.DimensionsCount(); - - int dim0, dim1; - if (transpose_utils::IsTranspose2DApplicable(params, input_shape, &dim0, - &dim1)) { - Transpose2D(RuntimeShape({dim0, dim1}), input_data, - RuntimeShape({dim1, dim0}), output_data); - return; - } - - // TODO(b/141217325): notably Eigen is better suited for - // larger inputs whereas Transpose3D is generally - // better for smaller ones. - // - // E.g. on Nexus 5, Eigen is better for size 96^3 and up - // and Transpose3D is better for 72^3 and down. - // - // 96^3 is not mobile-friendly for certain usecases - // (e.g. model used in beam search for seq2seq) but is in others. - // Consider tradeoffs. - if (dims_cnt == 3) { - Transpose3D(params, input_shape, input_data, output_shape, output_data); - return; - } - - // Reroute to the reference version if an optimized method for the given data - // is not available. - reference_ops::Transpose(params, input_shape, input_data, output_shape, - output_data); -} - -template -void Transpose(const TransposeParams& unshrinked_params, - const RuntimeShape& unshrinked_input_shape, const T* input_data, - const RuntimeShape& unshrinked_output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("Transpose"); - - const int output_size = unshrinked_output_shape.DimensionsCount(); - TFLITE_DCHECK_LE(unshrinked_input_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(output_size, N); - TFLITE_DCHECK_EQ(output_size, unshrinked_params.perm_count); - - RuntimeShape shrinked_input_shape = RuntimeShape(unshrinked_input_shape); - RuntimeShape shrinked_output_shape = RuntimeShape(unshrinked_output_shape); - TransposeParams shrinked_params = unshrinked_params; - - // Reduce any dimensions that have one size. Lower transpose op usually - // performs better since memory access patterns will be improved. - transpose_utils::RemoveOneSizeDimensions( - &shrinked_input_shape, &shrinked_output_shape, &shrinked_params); - - // Handle identity cases. - // TODO(b/140779653): Add an optimization pass in the conversion process to - // remove transpose op nodes where they do nothing like the below one. - bool identical = true; - for (int i = 0; i < shrinked_params.perm_count; ++i) { - if (shrinked_params.perm[i] != i) { - identical = false; - break; - } - } - if (identical) { - memcpy(output_data, input_data, - unshrinked_input_shape.FlatSize() * sizeof(T)); - return; - } - - // Reduce dimensions by flattening. - if (shrinked_params.perm[0] == 0 && output_size >= 3) { - RuntimeShape non_flatten_input_shape; - RuntimeShape non_flatten_output_shape; - TransposeParams non_flatten_params; - const int total_size = shrinked_input_shape.FlatSize(); - const int non_flatten_size = transpose_utils::Flatten( - shrinked_input_shape, shrinked_output_shape, shrinked_params, - &non_flatten_input_shape, &non_flatten_output_shape, - &non_flatten_params); - TFLITE_DCHECK_NE(non_flatten_params.perm[0], 0); - - for (int i = 0; i < total_size; i += non_flatten_size) { - TransposeImpl(non_flatten_params, non_flatten_input_shape, - input_data + i, non_flatten_output_shape, - output_data + i); - } - return; - } - - // Call non-flattened case. - TransposeImpl(shrinked_params, shrinked_input_shape, input_data, - shrinked_output_shape, output_data); -} - -// Assume input1 & input2 have the same scale & zero point. -inline void MaximumElementwise(int size, const ArithmeticParams& params, - const int8* input1_data, const int8* input2_data, - int8* output_data) { - ruy::profiler::ScopeLabel label("MaximumElementwiseInt8/8bit"); - int i = 0; -#ifdef USE_NEON - for (; i <= size - 16; i += 16) { - const int8x16_t input1_val_original = vld1q_s8(input1_data + i); - const int8x16_t input2_val_original = vld1q_s8(input2_data + i); - const int8x16_t max_data = - vmaxq_s8(input1_val_original, input2_val_original); - vst1q_s8(output_data + i, max_data); - } -#endif // USE_NEON - for (; i < size; ++i) { - const int8 input1_val = input1_data[i]; - const int8 input2_val = input2_data[i]; - output_data[i] = std::max(input1_val, input2_val); - } -} - -inline void MaximumScalarBroadcast(int size, const ArithmeticParams& params, - int8 input1_data, const int8* input2_data, - int8* output_data) { - ruy::profiler::ScopeLabel label("MaximumScalarBroadcastInt8/8bit"); - int i = 0; - -#ifdef USE_NEON - const int8x16_t input1_val_original = vdupq_n_s8(input1_data); - for (; i <= size - 16; i += 16) { - const int8x16_t input2_val_original = vld1q_s8(input2_data + i); - const int8x16_t max_data = - vmaxq_s8(input1_val_original, input2_val_original); - vst1q_s8(output_data + i, max_data); - } -#endif // USE_NEON - for (; i < size; ++i) { - const int8 input2_val = input2_data[i]; - output_data[i] = std::max(input1_data, input2_val); - } -} - -// Assume input1 & input2 have the same scale & zero point. -inline void MinimumElementwise(int size, const ArithmeticParams& params, - const int8* input1_data, const int8* input2_data, - int8* output_data) { - ruy::profiler::ScopeLabel label("MinimumElementwiseInt8/8bit"); - int i = 0; -#ifdef USE_NEON - for (; i <= size - 16; i += 16) { - const int8x16_t input1_val_original = vld1q_s8(input1_data + i); - const int8x16_t input2_val_original = vld1q_s8(input2_data + i); - const int8x16_t min_data = - vminq_s8(input1_val_original, input2_val_original); - vst1q_s8(output_data + i, min_data); - } -#endif // USE_NEON - for (; i < size; ++i) { - const int8 input1_val = input1_data[i]; - const int8 input2_val = input2_data[i]; - output_data[i] = std::min(input1_val, input2_val); - } -} - -inline void MinimumScalarBroadcast(int size, const ArithmeticParams& params, - int8 input1_data, const int8* input2_data, - int8* output_data) { - ruy::profiler::ScopeLabel label("MinimumScalarBroadcastInt8/8bit"); - int i = 0; - -#ifdef USE_NEON - const int8x16_t input1_val_original = vdupq_n_s8(input1_data); - for (; i <= size - 16; i += 16) { - const int8x16_t input2_val_original = vld1q_s8(input2_data + i); - const int8x16_t min_data = - vminq_s8(input1_val_original, input2_val_original); - vst1q_s8(output_data + i, min_data); - } -#endif // USE_NEON - for (; i < size; ++i) { - const int8 input2_val = input2_data[i]; - output_data[i] = std::min(input1_data, input2_val); - } -} - -template -inline void BroadcastMaximumDispatch(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const int8* input1_data, - const RuntimeShape& input2_shape, - const int8* input2_data, - const RuntimeShape& output_shape, - int8* output_data, Op op) { - if (params.broadcast_category == BroadcastableOpCategory::kGenericBroadcast) { - return reference_ops::MaximumMinimumBroadcastSlow( - input1_shape, input1_data, input2_shape, input2_data, output_shape, - output_data, op); - } - - BinaryBroadcastFiveFold(params, input1_shape, input1_data, input2_shape, - input2_data, output_shape, output_data, - MaximumElementwise, MaximumScalarBroadcast); -} - -template -inline void BroadcastMinimumDispatch(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const int8* input1_data, - const RuntimeShape& input2_shape, - const int8* input2_data, - const RuntimeShape& output_shape, - int8* output_data, Op op) { - if (params.broadcast_category == BroadcastableOpCategory::kGenericBroadcast) { - return reference_ops::MaximumMinimumBroadcastSlow( - input1_shape, input1_data, input2_shape, input2_data, output_shape, - output_data, op); - } - - BinaryBroadcastFiveFold(params, input1_shape, input1_data, input2_shape, - input2_data, output_shape, output_data, - MinimumElementwise, MinimumScalarBroadcast); -} - -template -void CumsumImpl(const T* input_data, const RuntimeShape& shape, int axis, - bool exclusive, bool reverse, T* output_data) { - Eigen::array dims = {1, 1, 1}; - - for (int i = 0; i < axis; ++i) { - dims[0] *= shape.Dims(i); - } - dims[1] = shape.Dims(axis); - for (int i = axis + 1; i < shape.DimensionsCount(); ++i) { - dims[2] *= shape.Dims(i); - } - - typedef Eigen::TensorMap< - Eigen::Tensor, - Eigen::Aligned> - ConstTensor; - typedef Eigen::TensorMap< - Eigen::Tensor, Eigen::Aligned> - Tensor; - ConstTensor input(input_data, dims); - Tensor output(output_data, dims); - - if (reverse) { - Eigen::array reverse_idx = {false, true, false}; - output = - input.reverse(reverse_idx).cumsum(1, exclusive).reverse(reverse_idx); - } else { - output = input.cumsum(1, exclusive); - } -} - -template -void CumSum(const T* input_data, const RuntimeShape& shape, int axis, - bool exclusive, bool reverse, T* output_data) { - const int dim = shape.DimensionsCount(); - TFLITE_DCHECK_GE(dim, 1); - CumsumImpl(input_data, shape, axis, exclusive, reverse, output_data); -} - -inline void PReluScalarBroadcast(int size, const ArithmeticParams& params, - float alpha, const float* input_data, - float* output_data) { - ruy::profiler::ScopeLabel label("PreluScalarBroadcast/float"); - int i = 0; - -#ifdef USE_NEON - const float32x4_t zero_dup = vdupq_n_f32(0.0f); - const float32x4_t alpha_dup = vdupq_n_f32(alpha); - for (; i <= size - 16; i += 16) { - const float32x4_t input1 = vld1q_f32(input_data + i); - const float32x4_t input2 = vld1q_f32(input_data + i + 4); - const float32x4_t input3 = vld1q_f32(input_data + i + 8); - const float32x4_t input4 = vld1q_f32(input_data + i + 12); - - const float32x4_t temp1 = vmulq_f32(input1, alpha_dup); - const float32x4_t temp2 = vmulq_f32(input2, alpha_dup); - const float32x4_t temp3 = vmulq_f32(input3, alpha_dup); - const float32x4_t temp4 = vmulq_f32(input4, alpha_dup); - - const uint32x4_t mask1 = vcgeq_f32(input1, zero_dup); - const uint32x4_t mask2 = vcgeq_f32(input2, zero_dup); - const uint32x4_t mask3 = vcgeq_f32(input3, zero_dup); - const uint32x4_t mask4 = vcgeq_f32(input4, zero_dup); - - const float32x4_t result1 = vbslq_f32(mask1, input1, temp1); - vst1q_f32(output_data + i, result1); - const float32x4_t result2 = vbslq_f32(mask2, input2, temp2); - vst1q_f32(output_data + i + 4, result2); - const float32x4_t result3 = vbslq_f32(mask3, input3, temp3); - vst1q_f32(output_data + i + 8, result3); - const float32x4_t result4 = vbslq_f32(mask4, input4, temp4); - vst1q_f32(output_data + i + 12, result4); - } - - for (; i <= size - 4; i += 4) { - const float32x4_t input = vld1q_f32(input_data + i); - const float32x4_t temp = vmulq_f32(input, alpha_dup); - const uint32x4_t mask = vcgeq_f32(input, zero_dup); - const float32x4_t result = vbslq_f32(mask, input, temp); - vst1q_f32(output_data + i, result); - } -#endif // USE_NEON - for (; i < size; ++i) { - const float input = input_data[i]; - output_data[i] = input >= 0.f ? input : input * alpha; - } -} - -inline void PReluElementWise(int flat_size, const ArithmeticParams& params, - const float* alpha_data, const float* input_data, - float* output_data) { - ruy::profiler::ScopeLabel label("PreluElementWise/float"); - - int i = 0; -#ifdef USE_NEON - const float32x4_t zero_dup = vdupq_n_f32(0.0f); - for (; i <= flat_size - 16; i += 16) { - const float32x4_t input1 = vld1q_f32(input_data + i); - const float32x4_t alpha1 = vld1q_f32(alpha_data + i); - const float32x4_t input2 = vld1q_f32(input_data + i + 4); - const float32x4_t alpha2 = vld1q_f32(alpha_data + i + 4); - const float32x4_t input3 = vld1q_f32(input_data + i + 8); - const float32x4_t alpha3 = vld1q_f32(alpha_data + i + 8); - const float32x4_t input4 = vld1q_f32(input_data + i + 12); - const float32x4_t alpha4 = vld1q_f32(alpha_data + i + 12); - - const float32x4_t temp1 = vmulq_f32(input1, alpha1); - const float32x4_t temp2 = vmulq_f32(input2, alpha2); - const float32x4_t temp3 = vmulq_f32(input3, alpha3); - const float32x4_t temp4 = vmulq_f32(input4, alpha4); - - const uint32x4_t mask1 = vcgeq_f32(input1, zero_dup); - const uint32x4_t mask2 = vcgeq_f32(input2, zero_dup); - const uint32x4_t mask3 = vcgeq_f32(input3, zero_dup); - const uint32x4_t mask4 = vcgeq_f32(input4, zero_dup); - - const float32x4_t result1 = vbslq_f32(mask1, input1, temp1); - vst1q_f32(output_data + i, result1); - const float32x4_t result2 = vbslq_f32(mask2, input2, temp2); - vst1q_f32(output_data + i + 4, result2); - const float32x4_t result3 = vbslq_f32(mask3, input3, temp3); - vst1q_f32(output_data + i + 8, result3); - const float32x4_t result4 = vbslq_f32(mask4, input4, temp4); - vst1q_f32(output_data + i + 12, result4); - } - - for (; i <= flat_size - 4; i += 4) { - const float32x4_t input = vld1q_f32(input_data + i); - const float32x4_t alpha = vld1q_f32(alpha_data + i); - - const float32x4_t temp = vmulq_f32(input, alpha); - const uint32x4_t mask = vcgeq_f32(input, zero_dup); - const float32x4_t result = vbslq_f32(mask, input, temp); - vst1q_f32(output_data + i, result); - } -#endif // USE_NEON - for (; i < flat_size; ++i) { - const float input = input_data[i]; - const float alpha = alpha_data[i]; - output_data[i] = input >= 0.f ? input : input * alpha; - } -} - -inline void BroadcastPReluDispatch( - const ArithmeticParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& alpha_shape, - const float* alpha_data, const RuntimeShape& output_shape, - float* output_data, float (*func)(float, float)) { - if (params.broadcast_category == BroadcastableOpCategory::kGenericBroadcast) { - return reference_ops::BroadcastBinaryFunction4DSlow( - input_shape, input_data, alpha_shape, alpha_data, output_shape, - output_data, func); - } - - BinaryBroadcastFiveFold(params, input_shape, input_data, alpha_shape, - alpha_data, output_shape, output_data, - PReluElementWise, PReluScalarBroadcast); -} - -} // namespace optimized_ops -} // namespace tflite - -#if defined OPTIMIZED_OPS_H__IGNORE_DEPRECATED_DECLARATIONS -#undef OPTIMIZED_OPS_H__IGNORE_DEPRECATED_DECLARATIONS -#pragma GCC diagnostic pop -#endif - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_OPTIMIZED_OPS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sparse_ops/fully_connected.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sparse_ops/fully_connected.h deleted file mode 100644 index 34876aa..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sparse_ops/fully_connected.h +++ /dev/null @@ -1,206 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_SPARSE_OPS_FULLY_CONNECTED_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_SPARSE_OPS_FULLY_CONNECTED_H_ - -#include "ruy/profiler/instrumentation.h" // from @ruy -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/cpu_backend_threadpool.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/quantization_util.h" -#include "tensorflow/lite/kernels/internal/tensor_utils.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace optimized_ops { - -inline void FullyConnectedSparseWeight( - const TfLiteSparsity& sparsity, const FullyConnectedParams& params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& weights_shape, const float* weights_data, - const RuntimeShape& bias_shape, const float* bias_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("FullyConnected"); - ruy::profiler::ScopeLabel inner_label("Random Sparse"); - const float output_activation_min = params.float_activation_min; - const float output_activation_max = params.float_activation_max; - - const int output_elements = output_shape.FlatSize(); - const int output_dims_count = output_shape.DimensionsCount(); - const int weights_dims_count = weights_shape.DimensionsCount(); - const int batches = FlatSizeSkipDim(output_shape, output_dims_count - 1); - const int output_depth = MatchingDim(weights_shape, weights_dims_count - 2, - output_shape, output_dims_count - 1); - const int accum_depth = weights_shape.Dims(weights_dims_count - 1); - const int w0_size = sparsity.dim_metadata[0].dense_size; - const int* w1_segments = sparsity.dim_metadata[1].array_segments->data; - const int* w1_indices = sparsity.dim_metadata[1].array_indices->data; - - for (int i = 0; i < output_elements; ++i) { - output_data[i] = 0.f; - } - - for (int b = 0; b < batches; ++b) { - for (int idx_0 = 0; idx_0 < w0_size; ++idx_0) { - for (int pw1 = w1_segments[idx_0]; pw1 < w1_segments[idx_0 + 1]; ++pw1) { - int idx_1 = w1_indices[pw1]; - output_data[b * output_depth + idx_0] += - weights_data[pw1] * input_data[b * accum_depth + idx_1]; - } - } - } - - for (int b = 0; b < batches; ++b) { - for (int i = 0; i < output_depth; ++i) { - float total = output_data[b * output_depth + i]; - float bias_value = bias_data[i]; - output_data[b * output_depth + i] = ActivationFunctionWithMinMax( - total + bias_value, output_activation_min, output_activation_max); - } - } -} - -inline void FullyConnectedSparseWeight1x4Impl( - const TfLiteSparsity& sparsity, const FullyConnectedParams& params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& weights_shape, const float* weights_data, - const RuntimeShape& bias_shape, const float* bias_data, - const RuntimeShape& output_shape, float* output_data, int thread_start, - int thread_end, const CpuBackendContext& cpu_backend_context) { - ruy::profiler::ScopeLabel label("FullyConnected"); - ruy::profiler::ScopeLabel inner_label("1x4 Block Sparse"); - const float output_activation_min = params.float_activation_min; - const float output_activation_max = params.float_activation_max; - - const int input_dims_count = input_shape.DimensionsCount(); - const int output_dims_count = output_shape.DimensionsCount(); - const int weights_dims_count = weights_shape.DimensionsCount(); - const int batches = thread_end - thread_start; - const int input_depth = MatchingDim(weights_shape, weights_dims_count - 1, - input_shape, input_dims_count - 1); - const int output_depth = MatchingDim(weights_shape, weights_dims_count - 2, - output_shape, output_dims_count - 1); - const int* w1_segments = sparsity.dim_metadata[1].array_segments->data; - const int* w1_indices = sparsity.dim_metadata[1].array_indices->data; - - tensor_utils::SparseMatrixBatchVectorMultiplyAccumulate1x4( - weights_data, w1_segments, w1_indices, weights_shape.Dims(0), - weights_shape.Dims(1), input_data + thread_start * input_depth, batches, - output_data + thread_start * output_depth); - - ruy::profiler::ScopeLabel activation_label("activation function"); - for (int b = thread_start; b < thread_end; ++b) { - for (int i = 0; i < output_depth; ++i) { - float total = output_data[b * output_depth + i]; - float bias_value = bias_data[i]; - output_data[b * output_depth + i] = ActivationFunctionWithMinMax( - total + bias_value, output_activation_min, output_activation_max); - } - } -} - -struct FullyConnectedSparseWeight1x4Task : cpu_backend_threadpool::Task { - FullyConnectedSparseWeight1x4Task( - const TfLiteSparsity& sparsity, const FullyConnectedParams& params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& weights_shape, const float* weights_data, - const RuntimeShape& bias_shape, const float* bias_data, - const RuntimeShape& output_shape, float* output_data, int thread_start, - int thread_end, const CpuBackendContext& cpu_backend_context_x) - : sparsity(sparsity), - params(params), - input_shape(input_shape), - input_data(input_data), - weights_shape(weights_shape), - weights_data(weights_data), - bias_shape(bias_shape), - bias_data(bias_data), - output_shape(output_shape), - output_data(output_data), - thread_start(thread_start), - thread_end(thread_end), - cpu_backend_context(cpu_backend_context_x) {} - - void Run() override { - FullyConnectedSparseWeight1x4Impl( - sparsity, params, input_shape, input_data, weights_shape, weights_data, - bias_shape, bias_data, output_shape, output_data, thread_start, - thread_end, cpu_backend_context); - } - - private: - const TfLiteSparsity& sparsity; - const FullyConnectedParams& params; - const RuntimeShape& input_shape; - const float* input_data; - const RuntimeShape& weights_shape; - const float* weights_data; - const RuntimeShape& bias_shape; - const float* bias_data; - const RuntimeShape& output_shape; - float* output_data; - int thread_start; - int thread_end; - const CpuBackendContext& cpu_backend_context; -}; - -// The multi-threaded kernel slices the workload along the batch dimension. If -// there's not enough batches of data, the number of threads used is equal to -// the batch size. We can improve this later with slicing along the row -// dimension of the weight. -inline void FullyConnectedSparseWeight1x4( - const TfLiteSparsity& sparsity, const FullyConnectedParams& params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& weights_shape, const float* weights_data, - const RuntimeShape& bias_shape, const float* bias_data, - const RuntimeShape& output_shape, float* output_data, - CpuBackendContext* cpu_backend_context) { - const int output_elements = output_shape.FlatSize(); - memset(output_data, 0, output_elements * sizeof(float)); - - const int max_threads = cpu_backend_context->max_num_threads(); - const int batches = - FlatSizeSkipDim(output_shape, output_shape.DimensionsCount() - 1); - const int thread_count = std::max(1, std::min(batches, max_threads)); - if (thread_count == 1) { - return FullyConnectedSparseWeight1x4Impl( - sparsity, params, input_shape, input_data, weights_shape, weights_data, - bias_shape, bias_data, output_shape, output_data, 0, batches, - *cpu_backend_context); - } - std::vector tasks; - tasks.reserve(thread_count); - int thread_start = 0; - for (int i = 0; i < thread_count; ++i) { - // This makes sure the workload is relatively balanced when batches is not a - // multiple of thread_count. The first mod(batches, thread_count) tasks need - // to process one more batch than the rest. - int thread_end = thread_start + batches / thread_count; - if (i < batches % thread_count) thread_end++; - - tasks.emplace_back(sparsity, params, input_shape, input_data, weights_shape, - weights_data, bias_shape, bias_data, output_shape, - output_data, thread_start, thread_end, - *cpu_backend_context); - thread_start = thread_end; - } - cpu_backend_threadpool::Execute(tasks.size(), tasks.data(), - cpu_backend_context); -} - -} // namespace optimized_ops -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_SPARSE_OPS_FULLY_CONNECTED_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sse_check.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sse_check.h deleted file mode 100644 index 30139a3..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sse_check.h +++ /dev/null @@ -1,28 +0,0 @@ -/* 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_KERNELS_INTERNAL_OPTIMIZED_SSE_CHECK_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_SSE_CHECK_H_ - -#if defined(__SSSE3__) -// SSSE 3 available: Use the SSE code. -#define SSE_OR_PORTABLE(funcname, ...) Sse##funcname(__VA_ARGS__) - -#else - -// No SSSE 3 available: Use Portable code -#define SSE_OR_PORTABLE(funcname, ...) Portable##funcname(__VA_ARGS__) -#endif - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_SSE_CHECK_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sse_tensor_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sse_tensor_utils.h deleted file mode 100644 index e416579..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sse_tensor_utils.h +++ /dev/null @@ -1,332 +0,0 @@ -/* 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_KERNELS_INTERNAL_OPTIMIZED_SSE_TENSOR_UTILS_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_SSE_TENSOR_UTILS_H_ - -// Note: This file is a copy-paste version of neon_tensor_utils.h, only -// difference is in MatrixBatchVectorMultiplyAccumulate and -// SparseMatrixBatchVectorMultiplyAccumulate (other functions do not have SSE -// implementation yet). - -// Note: Most of the functions below use NEON_OR_PORTABLE, through the Intel -// NEON_2_SSE translator library. If a native SSE version of a function is -// implemented, replace the appropriate one to SSE_OR_PORTABLE. - -// TODO(ghodrat): Remove this header file and the dependency to internal data -// structure. -#include "tensorflow/lite/c/builtin_op_data.h" -#include "tensorflow/lite/kernels/cpu_backend_context.h" -#include "tensorflow/lite/kernels/internal/optimized/neon_check.h" -#include "tensorflow/lite/kernels/internal/optimized/neon_tensor_utils_impl.h" -#include "tensorflow/lite/kernels/internal/optimized/sse_check.h" -#include "tensorflow/lite/kernels/internal/optimized/sse_tensor_utils_impl.h" -#include "tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h" - -namespace tflite { -namespace tensor_utils { - -void MatrixBatchVectorMultiplyAccumulate(const float* matrix, int m_rows, - int m_cols, const float* vector, - int n_batch, float* result) { - NEON_OR_PORTABLE(MatrixBatchVectorMultiplyAccumulate, matrix, m_rows, m_cols, - vector, n_batch, result); -} - -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, - const float* __restrict__ scaling_factors, int n_batch, - float* __restrict__ result) { - SSE_OR_PORTABLE(MatrixBatchVectorMultiplyAccumulate, matrix, m_rows, m_cols, - vectors, scaling_factors, n_batch, result); -} - -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, const float* scaling_factors, - int n_batch, float* __restrict__ result, const float* per_channel_scale, - const int32_t* input_offset, int32_t* scratch, int32_t* row_sums, - bool* compute_row_sums, CpuBackendContext* context) { - SSE_OR_PORTABLE(MatrixBatchVectorMultiplyAccumulate, matrix, m_rows, m_cols, - vectors, scaling_factors, n_batch, result, per_channel_scale, - input_offset, scratch, row_sums, compute_row_sums, context); -} - -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, - const float* __restrict__ scaling_factors, int n_batch, - int32_t* __restrict__ scratch, float* __restrict__ result, - CpuBackendContext* __restrict__ context) { - SSE_OR_PORTABLE(MatrixBatchVectorMultiplyAccumulate, matrix, m_rows, m_cols, - vectors, scaling_factors, n_batch, scratch, result, context); -} - -void SparseMatrixBatchVectorMultiplyAccumulate1x4( - const float* __restrict__ matrix, const int32_t* __restrict__ segments, - const int32_t* __restrict__ indices, int m_rows, int m_cols, - const float* __restrict__ vector, int n_batch, float* __restrict__ result) { - NEON_OR_PORTABLE(SparseMatrixBatchVectorMultiplyAccumulate1x4, matrix, - segments, indices, m_rows, m_cols, vector, n_batch, result); -} - -void SparseMatrixBatchVectorMultiplyAccumulate( - const float* __restrict__ matrix, const uint8_t* __restrict__ ledger, - int m_rows, int m_cols, const float* __restrict__ vector, int n_batch, - float* __restrict__ result) { - NEON_OR_PORTABLE(SparseMatrixBatchVectorMultiplyAccumulate, matrix, ledger, - m_rows, m_cols, vector, n_batch, result); -} - -void SparseMatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const uint8_t* __restrict__ ledger, - const int m_rows, const int m_cols, const int8_t* __restrict__ vectors, - const float* __restrict__ scaling_factors, int n_batch, - float* __restrict__ result) { - SSE_OR_PORTABLE(SparseMatrixBatchVectorMultiplyAccumulate, matrix, ledger, - m_rows, m_cols, vectors, scaling_factors, n_batch, result); -} - -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* input, const int32_t* input_zeropoint_times_weights, - const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift, - int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp, - int32_t* scratch, int16_t* output, CpuBackendContext* context) { - PortableMatrixBatchVectorMultiplyAccumulate( - input, input_zeropoint_times_weights, input_to_gate_weights, multiplier, - shift, n_batch, n_input, n_output, output_zp, scratch, output, context); -} - -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* input, const int32_t* input_zeropoint_times_weights, - const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift, - int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp, - int32_t* scratch, int8_t* output, CpuBackendContext* context) { - PortableMatrixBatchVectorMultiplyAccumulate( - input, input_zeropoint_times_weights, input_to_gate_weights, multiplier, - shift, n_batch, n_input, n_output, output_zp, scratch, output, context); -} - -void MatrixBatchVectorMultiply(const int8_t* input, int32_t input_zeropoint, - const int8_t* input_to_gate_weights, - int32_t input_to_gate_effective_scale_a, - int32_t input_to_gate_effective_scale_b, - int32_t n_batch, int32_t n_input, int32_t n_cell, - int8_t* gate_output, int8_t gate_output_zp) { - PortableMatrixBatchVectorMultiply( - input, input_zeropoint, input_to_gate_weights, - input_to_gate_effective_scale_a, input_to_gate_effective_scale_b, n_batch, - n_input, n_cell, gate_output, gate_output_zp); -} - -void MatrixBatchVectorMultiply(const int16_t* hidden, - const int8_t* hidden_to_output_weights, - int32_t proj_effective_scale_a, - int32_t proj_effective_scale_b, - const int32_t* gate_bias, int32_t n_batch, - int32_t n_hidden, int32_t n_output, - int32_t output_zp, int8_t* proj_output) { - PortableMatrixBatchVectorMultiply(hidden, hidden_to_output_weights, - proj_effective_scale_a, - proj_effective_scale_b, gate_bias, n_batch, - n_hidden, n_output, output_zp, proj_output); -} - -void MatrixScalarMultiplyAccumulate(const int8_t* matrix, int32_t scalar, - int32_t n_row, int32_t n_col, - int32_t* output) { - PortableMatrixScalarMultiplyAccumulate(matrix, scalar, n_row, n_col, output); -} - -void ApplyLayerNorm(const int16_t* input, const int16_t* layer_norm_weights, - const int32_t* bias, int32_t layer_norm_scale_a, - int32_t layer_norm_scale_b, int32_t variance_limit, - int n_batch, int n_input, int16_t* output) { - PortableApplyLayerNorm(input, layer_norm_weights, bias, layer_norm_scale_a, - layer_norm_scale_b, variance_limit, n_batch, n_input, - output); -} - -void ApplyLayerNormFloat(const int16_t* input, - const int16_t* layer_norm_weights, - int32_t layer_norm_scale_a, int32_t layer_norm_scale_b, - const int32_t* bias, int n_batch, int n_input, - int16_t* output) { - PortableApplyLayerNormFloat(input, layer_norm_weights, layer_norm_scale_a, - layer_norm_scale_b, bias, n_batch, n_input, - output); -} - -void ApplySigmoid(const int16_t* input, int32_t n_batch, int32_t n_input, - int16_t* output) { - PortableApplySigmoid(input, n_batch, n_input, output); -} - -void ApplySigmoidFloat(const int16_t* input, int32_t n_batch, int32_t n_input, - int16_t* output) { - PortableApplySigmoidFloat(input, n_batch, n_input, output); -} - -void ApplyTanh(int32_t intger_bits, const int16_t* input, int32_t n_batch, - int32_t n_input, int16_t* output) { - PortableApplyTanh(intger_bits, input, n_batch, n_input, output); -} - -void ApplyTanhFloat(const int16_t* input, int32_t n_batch, int32_t n_input, - int32_t integer_bits, int16_t* output) { - PortableApplyTanhFloat(input, n_batch, n_input, integer_bits, output); -} - -void CwiseMul(const int16_t* input_1, const int16_t* input_2, int n_batch, - int n_input, int shift, int16_t* output) { - PortableCwiseMul(input_1, input_2, n_batch, n_input, shift, output); -} - -void CwiseMul(const int16_t* input_1, const int16_t* input_2, - int32_t multiplier, int32_t shift, int32_t n_batch, - int32_t n_input, int32_t output_zp, int8_t* output) { - PortableCwiseMul(input_1, input_2, multiplier, shift, n_batch, n_input, - output_zp, output); -} - -void CwiseAdd(const int16_t* input_1, const int16_t* input_2, int n_batch, - int n_input, int16_t* output) { - PortableCwiseAdd(input_1, input_2, n_batch, n_input, output); -} - -void CwiseClipping(float* vector, const int v_size, - const float clipping_value) { - PortableCwiseClipping(vector, v_size, clipping_value); -} - -void CwiseClipping(int16_t* vector, const int v_size, - const int16_t clipping_value) { - PortableCwiseClipping(vector, v_size, clipping_value); -} - -void CwiseClipping(int8_t* vector, const int v_size, - const int8_t clipping_value) { - PortableCwiseClipping(vector, v_size, clipping_value); -} - -void BatchVectorBatchVectorDotProduct(const int16_t* vector1, - const int16_t* vector2, int v_size, - int n_batch, int32_t* result) { - PortableBatchVectorBatchVectorDotProduct(vector1, vector2, v_size, n_batch, - result); -} - -void VectorBatchVectorCwiseProductAccumulate(const int16_t* vector, int v_size, - const int16_t* batch_vector, - int n_batch, int32_t multiplier, - int shift, int16_t* result) { - PortableVectorBatchVectorCwiseProductAccumulate( - vector, v_size, batch_vector, n_batch, multiplier, shift, result); -} - -float VectorVectorDotProduct(const float* vector1, const float* vector2, - int v_size) { - return NEON_OR_PORTABLE(VectorVectorDotProduct, vector1, vector2, v_size); -} - -void VectorBatchVectorAdd(const float* vector, int v_size, int n_batch, - float* batch_vector) { - PortableVectorBatchVectorAdd(vector, v_size, n_batch, batch_vector); -} - -void Sub1Vector(const float* vector, int v_size, float* result) { - NEON_OR_PORTABLE(Sub1Vector, vector, v_size, result); -} - -void Sub1Vector(const int16_t* vector, int v_size, int16_t* result) { - PortableSub1Vector(vector, v_size, result); -} - -// Check if all entries of a vector are zero for float. -bool IsZeroVector(const float* vector, int v_size) { - return NEON_OR_PORTABLE(IsZeroVector, vector, v_size); -} - -// Check if all entries of a vector are zero for int8. -bool IsZeroVector(const int8_t* vector, int v_size) { - return PortableIsZeroVector(vector, v_size); -} - -void VectorScalarMultiply(const int8_t* vector, int v_size, float scale, - float* result) { - NEON_OR_PORTABLE(VectorScalarMultiply, vector, v_size, scale, result); -} - -void SymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, float* min_value, - float* max_value, float* scaling_factor) { - NEON_OR_PORTABLE(SymmetricQuantizeFloats, values, size, quantized_values, - min_value, max_value, scaling_factor); -} - -void SymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, float min_value, - float max_value, float* scaling_factor) { - NEON_OR_PORTABLE(SymmetricQuantizeFloats, values, size, quantized_values, - min_value, max_value, scaling_factor); -} - -void AsymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, float* scaling_factor, - int32_t* offset) { - NEON_OR_PORTABLE(AsymmetricQuantizeFloats, values, size, quantized_values, - scaling_factor, offset); -} - -void ReductionSumVector(const float* input_vector, float* output_vector, - int output_size, int reduction_size) { - NEON_OR_PORTABLE(ReductionSumVector, input_vector, output_vector, output_size, - reduction_size); -} - -void ReductionSumVector(const int32_t* input_vector, int32_t* output_vector, - int output_size, int reduction_size) { - PortableReductionSumVector(input_vector, output_vector, output_size, - reduction_size); -} - -void ReductionSumVector(const int8_t* input_vector, int32_t* output_vector, - int output_size, int reduction_size) { - SSE_OR_PORTABLE(ReductionSumVector, input_vector, output_vector, output_size, - reduction_size); -} - -void MeanStddevNormalization(const float* input_vector, float* output_vector, - int v_size, int n_batch) { - PortableMeanStddevNormalization(input_vector, output_vector, v_size, n_batch); -} - -void TwoGateSaturatingAdd(const int8_t* input, int8_t input_zp, - const int8_t* recurrent, int8_t recurrent_zp, - int32_t input_effective_scale_a, - int32_t input_effective_scale_b, - int32_t recurrent_effective_scale_a, - int32_t recurrent_effective_scale_b, int32_t n_batch, - int32_t n_cell, int16_t* output) { - PortableTwoGateSaturatingAdd( - input, input_zp, recurrent, recurrent_zp, input_effective_scale_a, - input_effective_scale_b, recurrent_effective_scale_a, - recurrent_effective_scale_b, n_batch, n_cell, output); -} - -} // namespace tensor_utils -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_SSE_TENSOR_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sse_tensor_utils_impl.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sse_tensor_utils_impl.h deleted file mode 100644 index a77a049..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/optimized/sse_tensor_utils_impl.h +++ /dev/null @@ -1,71 +0,0 @@ -/* 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_KERNELS_INTERNAL_OPTIMIZED_SSE_TENSOR_UTILS_IMPL_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_SSE_TENSOR_UTILS_IMPL_H_ - -#include - -#include "tensorflow/lite/kernels/cpu_backend_context.h" - -#if defined(_MSC_VER) -#define __restrict__ __restrict -#endif - -namespace tflite { -namespace tensor_utils { - -#ifdef __SSSE3__ - -// Matrix multiplication for quantized values using symmetric quantization. -void SseMatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, - const float* __restrict__ scaling_factors, int n_batch, - float* __restrict__ result); - -// Matrix multiplication for quantized values using symmetric quantization -// with additional scratch memory for GEMM operation prior to scaling. -void SseMatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, - const float* __restrict__ scaling_factors, int n_batch, int32_t* scratch, - float* __restrict__ result, CpuBackendContext* context); - -// Matrix multiplication for quantized values using asymmetric quantization. -void SseMatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, - const float* __restrict__ scaling_factors, int n_batch, - float* __restrict__ result, const float* per_channel_scale, - const int32_t* input_offset, int32_t* scratch, int32_t* row_sums, - bool* compute_row_sums, CpuBackendContext* context); - -// Matrix multiplication for quantized values using symmetric quantization. -// Sparse version. -void SseSparseMatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const uint8_t* __restrict__ ledger, - const int m_rows, const int m_cols, const int8_t* __restrict__ vectors, - const float* __restrict__ scaling_factors, int n_batch, - float* __restrict__ result); - -void SseReductionSumVector(const int8_t* input_vector, int32_t* output_vector, - const int output_size, const int reduction_size); - -#endif // __SSSE3__ - -} // namespace tensor_utils -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_OPTIMIZED_SSE_TENSOR_UTILS_IMPL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/portable_tensor.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/portable_tensor.h deleted file mode 100644 index 8b0f6d1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/portable_tensor.h +++ /dev/null @@ -1,123 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_PORTABLE_TENSOR_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_PORTABLE_TENSOR_H_ - -#include -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/internal/tensor_ctypes.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -inline RuntimeShape GetTensorShape(std::vector data) { - return RuntimeShape(data.size(), data.data()); -} - -// A list of tensors in a format that can be used by kernels like split and -// concatenation. -template -class VectorOfTensors { - public: - // Build with the tensors in 'tensor_list'. - VectorOfTensors(const TfLiteContext& context, - const TfLiteIntArray& tensor_list) { - int num_tensors = tensor_list.size; - - all_data_.reserve(num_tensors); - all_shape_.reserve(num_tensors); - all_shape_ptr_.reserve(num_tensors); - - for (int i = 0; i < num_tensors; ++i) { - TfLiteTensor* t = &context.tensors[tensor_list.data[i]]; - all_data_.push_back(GetTensorData(t)); - all_shape_.push_back(GetTensorShape(t)); - } - - // Taking the pointer from inside a std::vector is only OK if the vector is - // never modified, so we populate all_shape in the previous loop and then we - // are free to grab iterators here. - for (int i = 0; i < num_tensors; ++i) { - all_shape_ptr_.push_back(&all_shape_[i]); - } - } - // Return a pointer to the data pointers of all tensors in the list. For - // example: - // float* const* f = v.data(); - // f[0][1] is the second element of the first tensor. - T* const* data() const { return all_data_.data(); } - - // Return a pointer the shape pointers of all tensors in the list. For - // example: - // const RuntimeShape* const* d = v.dims(); - // dims[1] are the dimensions of the second tensor in the list. - const RuntimeShape* const* shapes() const { return all_shape_ptr_.data(); } - - private: - std::vector all_data_; - std::vector all_shape_; - std::vector all_shape_ptr_; -}; - -// A list of quantized tensors in a format that can be used by kernels like -// split and concatenation. -class VectorOfQuantizedTensors : public VectorOfTensors { - public: - // Build with the tensors in 'tensor_list'. - VectorOfQuantizedTensors(const TfLiteContext& context, - const TfLiteIntArray& tensor_list) - : VectorOfTensors(context, tensor_list) { - for (int i = 0; i < tensor_list.size; ++i) { - TfLiteTensor* t = &context.tensors[tensor_list.data[i]]; - zero_point_.push_back(t->params.zero_point); - scale_.push_back(t->params.scale); - } - } - - const float* scale() const { return scale_.data(); } - const int32_t* zero_point() const { return zero_point_.data(); } - - private: - std::vector zero_point_; - std::vector scale_; -}; - -// Writes randomly accessed values from `input` sequentially into `output`. -template -class SequentialTensorWriter { - public: - SequentialTensorWriter(const TfLiteTensor* input, TfLiteTensor* output) { - input_data_ = GetTensorData(input); - output_ptr_ = GetTensorData(output); - } - SequentialTensorWriter(const T* input_data, T* output_data) - : input_data_(input_data), output_ptr_(output_data) {} - - void Write(int position) { *output_ptr_++ = input_data_[position]; } - void WriteN(int position, int len) { - memcpy(output_ptr_, &input_data_[position], sizeof(T) * len); - output_ptr_ += len; - } - - private: - const T* input_data_; - T* output_ptr_; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_PORTABLE_TENSOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/quantization_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/quantization_util.h deleted file mode 100644 index 0ee914b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/quantization_util.h +++ /dev/null @@ -1,292 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_QUANTIZATION_UTIL_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_QUANTIZATION_UTIL_H_ - -#include -#include -#include - -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -// Given the min and max values of a float array, return -// reasonable quantization parameters to use for this array. -template -QuantizationParams ChooseQuantizationParams(double rmin, double rmax, - bool narrow_range) { - const T qmin = std::numeric_limits::min() + (narrow_range ? 1 : 0); - const T qmax = std::numeric_limits::max(); - const double qmin_double = qmin; - const double qmax_double = qmax; - // 0 should always be a representable value. Let's assume that the initial - // min,max range contains 0. - TFLITE_CHECK_LE(rmin, 0.); - TFLITE_CHECK_GE(rmax, 0.); - if (rmin == rmax) { - // Special case where the min,max range is a point. Should be {0}. - TFLITE_CHECK_EQ(rmin, 0.); - TFLITE_CHECK_EQ(rmax, 0.); - QuantizationParams quantization_params; - quantization_params.zero_point = 0; - quantization_params.scale = 0.; - return quantization_params; - } - - // General case. - // - // First determine the scale. - const double scale = (rmax - rmin) / (qmax_double - qmin_double); - - // Zero-point computation. - // First the initial floating-point computation. The zero-point can be - // determined from solving an affine equation for any known pair - // (real value, corresponding quantized value). - // We know two such pairs: (rmin, qmin) and (rmax, qmax). - // The arithmetic error on the zero point computed from either pair - // will be roughly machine_epsilon * (sum of absolute values of terms) - // so we want to use the variant that adds the smaller terms. - const double zero_point_from_min = qmin_double - rmin / scale; - const double zero_point_from_max = qmax_double - rmax / scale; - const double zero_point_from_min_error = - std::abs(qmin_double) + std::abs(rmin / scale); - const double zero_point_from_max_error = - std::abs(qmax_double) + std::abs(rmax / scale); - - const double zero_point_double = - zero_point_from_min_error < zero_point_from_max_error - ? zero_point_from_min - : zero_point_from_max; - - // Now we need to nudge the zero point to be an integer - // (our zero points are integer, and this is motivated by the requirement - // to be able to represent the real value "0" exactly as a quantized value, - // which is required in multiple places, for example in Im2col with SAME - // padding). - T nudged_zero_point = 0; - if (zero_point_double < qmin_double) { - nudged_zero_point = qmin; - } else if (zero_point_double > qmax_double) { - nudged_zero_point = qmax; - } else { - nudged_zero_point = static_cast(round(zero_point_double)); - } - // The zero point should always be in the range of quantized value, - // [qmin, qmax]. - TFLITE_CHECK_GE(nudged_zero_point, qmin); - TFLITE_CHECK_LE(nudged_zero_point, qmax); - - // Finally, store the result nudged quantization params. - QuantizationParams quantization_params; - quantization_params.zero_point = nudged_zero_point; - quantization_params.scale = scale; - return quantization_params; -} - -template -QuantizationParams ChooseQuantizationParams(double rmin, double rmax) { - return ChooseQuantizationParams(rmin, rmax, false); -} - -// Converts a floating-point number to an integer. For all inputs x where -// static_cast(x) is legal according to the C++ standard, the result -// is identical to that cast (i.e. the result is x with its fractional part -// truncated whenever that is representable as IntOut). -// -// static_cast would cause undefined behavior for the following cases, which -// have well-defined behavior for this function: -// -// 1. If x is NaN, the result is zero. -// -// 2. If the truncated form of x is above the representable range of IntOut, -// the result is std::numeric_limits::max(). -// -// 3. If the truncated form of x is below the representable range of IntOut, -// the result is std::numeric_limits::min(). -// -// Note that cases #2 and #3 cover infinities as well as finite numbers. -// -// The range of FloatIn must include the range of IntOut, otherwise -// the results are undefined. -// TODO(sfeuz): Replace by absl::SafeCast once available. -template -IntOut SafeCast(FloatIn x) { - static_assert(!std::numeric_limits::is_integer, - "FloatIn is integer"); - static_assert(std::numeric_limits::is_integer, - "IntOut is not integer"); - static_assert(std::numeric_limits::radix == 2, "IntOut is base 2"); - - // Special case NaN, for which the logic below doesn't work. - if (std::isnan(x)) { - return 0; - } - - // Negative values all clip to zero for unsigned results. - if (!std::numeric_limits::is_signed && x < 0) { - return 0; - } - - // Handle infinities. - if (std::isinf(x)) { - return x < 0 ? std::numeric_limits::min() - : std::numeric_limits::max(); - } - - // Set exp such that x == f * 2^exp for some f with |f| in [0.5, 1.0), - // unless x is zero in which case exp == 0. Note that this implies that the - // magnitude of x is strictly less than 2^exp. - int exp = 0; - std::frexp(x, &exp); - - // Let N be the number of non-sign bits in the representation of IntOut. If - // the magnitude of x is strictly less than 2^N, the truncated version of x - // is representable as IntOut. The only representable integer for which this - // is not the case is kMin for signed types (i.e. -2^N), but that is covered - // by the fall-through below. - if (exp <= std::numeric_limits::digits) { - return x; - } - - // Handle numbers with magnitude >= 2^N. - return x < 0 ? std::numeric_limits::min() - : std::numeric_limits::max(); -} - -// Decompose a double multiplier into a Q0.31 int32 representation of its -// significand, and shift representation of NEGATIVE its exponent --- -// this is intended as a RIGHT-shift. -// -// Restricted to the case where the multiplier < 1 (and non-negative). -void QuantizeMultiplierSmallerThanOneExp(double double_multiplier, - int32_t* quantized_multiplier, - int* left_shift); - -// Decompose a double multiplier into a Q0.31 int32 representation of its -// significand, and shift representation of its exponent. -// -// Restricted to the case where the multiplier > 1. -void QuantizeMultiplierGreaterThanOne(double double_multiplier, - int32_t* quantized_multiplier, - int* left_shift); - -// Decompose a double multiplier into a Q0.31 int32 representation of its -// significand, and shift representation of its exponent. -// -// Handles an arbitrary positive multiplier. The 'shift' output-value is -// basically the 'floating-point exponent' of the multiplier: -// Negative for a right-shift (when the multiplier is <1), positive for a -// left-shift (when the multiplier is >1) -void QuantizeMultiplier(double double_multiplier, int32_t* quantized_multiplier, - int* shift); - -// Splits a double input value into a returned fraction, and a shift value from -// the exponent, using only bitwise and integer operations to support -// microcontrollers and other environments without floating-point support. -// -// This is designed to be a replacement for how std::frexp() is used within the -// QuantizeMultiplier() function, and so has a different signature than the -// standard version, returning a 64-bit integer rather than a double. This -// result has a maximum value of 1<<31, with the fraction expressed as a -// proportion of that maximum. -// -// std::frexp() returns NaNs and infinities unmodified, but since we're -// returning integers that can't represent those values, instead we return -// a shift of std::numeric_limits::max() for all bad numbers, with an int64 -// result of 0 for NaNs, std:numeric_limits::max() for +INFINITY, and -// std::numeric_limits::min() for -INFINITY. Denormalized inputs will -// result in return values that end up truncating some bits at the end, -// reflecting the loss of precision inherent in denormalization. -int64_t IntegerFrExp(double input, int* shift); - -// Converts an integer fraction in the format produced by IntegerFrExp (where -// 0x40000000 is 1.0) and an exponent shift (between -1022 and +1022) into an -// IEEE binary64 double format result. The implementation uses only integer and -// bitwise operators, so no floating point hardware support or emulation is -// needed. This is here so quantized operations can run non-time-critical -// preparation calculations on microcontrollers and other platforms without -// float support. -double DoubleFromFractionAndShift(int64_t fraction, int shift); - -// Performs a multiplication of two numbers in double format, using only integer -// and bitwise instructions. This is aimed at supporting housekeeping functions -// for quantized operations on microcontrollers without floating-point hardware. -double IntegerDoubleMultiply(double a, double b); - -// Returns -1 if a is less than b, 0 if a and b are equal, and +1 if a is -// greater than b. It is implemented using only integer and logical instructions -// so that it can be easily run on microcontrollers for quantized operations. -int IntegerDoubleCompare(double a, double b); - -// This first creates a multiplier in a double equivalent of -// Q(input_integer_bits).(31-input_integer_bits) representation, with extra -// precision in the double's fractional bits. It then splits the result into -// significand and exponent. -void PreprocessSoftmaxScaling(double beta, double input_scale, - int input_integer_bits, - int32_t* quantized_multiplier, int* left_shift); -// Like PreprocessSoftmaxScaling, but inverse scaling factors also calculated. -void PreprocessLogSoftmaxScalingExp(double beta, double input_scale, - int input_integer_bits, - int32_t* quantized_multiplier, - int* left_shift, - int32_t* reverse_scaling_divisor, - int* reverse_scaling_left_shift); -// Calculate the largest input that will result in a within-bounds intermediate -// result within MultiplyByQuantizedMultiplierGreaterThanOne. In other words, -// it must not overflow before we reduce the value by multiplication by the -// input multiplier. The negative radius is used as the minimum difference in -// Softmax. -int CalculateInputRadius(int input_integer_bits, int input_left_shift, - int total_signed_bits = 31); - -// Nudges a min/max quantization range to ensure zero is zero. -// Gymnastics with nudged zero point is to ensure that real zero maps to -// an integer, which is required for e.g. zero-padding in convolutional layers. -// Outputs nudged_min, nudged_max, nudged_scale. -void NudgeQuantizationRange(const float min, const float max, - const int quant_min, const int quant_max, - float* nudged_min, float* nudged_max, - float* nudged_scale); - -// Fake quantizes (quantizes and dequantizes) input_data using the scale, -// nudged_min, and nudged_max from NudgeQuantizationRange. This matches the code -// in TensorFlow's FakeQuantizeWithMinMaxVarsFunctor. -void FakeQuantizeArray(const float nudged_scale, const float nudged_min, - const float nudged_max, const float* input_data, - float* output_data, const float size); - -// If x is approximately a power of two (with any positive or negative -// exponent), stores that exponent (i.e. log2(x)) in *log2_result, otherwise -// returns false. -bool CheckedLog2(const float x, int* log2_result); - -// Decomposes an array of double multipliers into a Q0.31 int32 representation -// of its significand, and shift representation of its exponent. -// -// Handles an arbitrary multiplier. The 'shift' output-value is -// basically the 'floating-point exponent' of the multiplier: -// Negative for a right-shift (when the multiplier is <1), positive for a -// left-shift (when the multiplier is >1) -void QuantizeMultiplierArray(const double* effective_scales, size_t size, - int32_t* effective_scale_significand, - int* effective_shift); - -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_QUANTIZATION_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/add.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/add.h deleted file mode 100644 index 5be7ab4..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/add.h +++ /dev/null @@ -1,454 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_ADD_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ADD_H_ - -#include "fixedpoint/fixedpoint.h" -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { - -namespace reference_ops { - -template -inline void Add(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const T* input1_data, - const RuntimeShape& input2_shape, const T* input2_data, - const RuntimeShape& output_shape, T* output_data) { - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax( - input1_data[i] + input2_data[i], params.quantized_activation_min, - params.quantized_activation_max); - } -} - -inline void Add(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const float* input1_data, - const RuntimeShape& input2_shape, const float* input2_data, - const RuntimeShape& output_shape, float* output_data) { - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - for (int i = 0; i < flat_size; i++) { - auto x = input1_data[i] + input2_data[i]; - output_data[i] = ActivationFunctionWithMinMax( - x, params.float_activation_min, params.float_activation_max); - } -} - -// Element-wise add that can often be used for inner loop of broadcast add as -// well as the non-broadcast add. - -// This function is used for 8-bit as well as for 16-bit, but the accumulator -// is 32-bit for both cases. The overflow does not happen due to the -// choice of the shift (20 or 15, accordingly - see add.cc for more comments). -template -inline void AddElementwise(int size, const ArithmeticParams& params, - const T* input1_data, const T* input2_data, - T* output_data) { - TFLITE_DCHECK_GT(params.input1_offset, -std::numeric_limits::max()); - TFLITE_DCHECK_GT(params.input2_offset, -std::numeric_limits::max()); - TFLITE_DCHECK_LT(params.input1_offset, std::numeric_limits::max()); - TFLITE_DCHECK_LT(params.input2_offset, std::numeric_limits::max()); - - for (int i = 0; i < size; ++i) { - const int32_t input1_val = params.input1_offset + input1_data[i]; - const int32_t input2_val = params.input2_offset + input2_data[i]; - const int32_t shifted_input1_val = input1_val * (1 << params.left_shift); - const int32_t shifted_input2_val = input2_val * (1 << params.left_shift); - const int32_t scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, params.input1_multiplier, params.input1_shift); - const int32_t scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, params.input2_multiplier, params.input2_shift); - const int32_t raw_sum = scaled_input1_val + scaled_input2_val; - const int32_t raw_output = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - raw_sum, params.output_multiplier, params.output_shift) + - params.output_offset; - const int32_t clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, raw_output)); - output_data[i] = static_cast(clamped_output); - } -} - -// Scalar-broadcast add that can be used for inner loop of more general -// broadcast add, so that, for example, scalar-broadcast with batch will still -// be fast. -inline void AddScalarBroadcast(int size, const ArithmeticParams& params, - uint8_t input1_data, const uint8_t* input2_data, - uint8_t* output_data) { - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_LT(params.input2_offset, 256); - - const int32_t input1_val = params.input1_offset + input1_data; - const int32_t shifted_input1_val = input1_val * (1 << params.left_shift); - const int32_t scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, params.input1_multiplier, params.input1_shift); - for (int i = 0; i < size; ++i) { - const int32_t input2_val = params.input2_offset + input2_data[i]; - const int32_t shifted_input2_val = input2_val * (1 << params.left_shift); - const int32_t scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, params.input2_multiplier, params.input2_shift); - const int32_t raw_sum = scaled_input1_val + scaled_input2_val; - const int32_t raw_output = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - raw_sum, params.output_multiplier, params.output_shift) + - params.output_offset; - const int32_t clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, raw_output)); - output_data[i] = static_cast(clamped_output); - } -} - -inline void Add(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const uint8_t* input1_data, - const RuntimeShape& input2_shape, const uint8_t* input2_data, - const RuntimeShape& output_shape, uint8_t* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_LT(params.input2_offset, 256); - AddElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -inline void AddGeneralParamScale(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const int16_t* input1_data, - const RuntimeShape& input2_shape, - const int16_t* input2_data, - const RuntimeShape& output_shape, - int16_t* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - int max_value = std::numeric_limits::max(); - - TFLITE_DCHECK_GT(params.input1_offset, -max_value); - TFLITE_DCHECK_GT(params.input2_offset, -max_value); - TFLITE_DCHECK_LT(params.input1_offset, max_value); - TFLITE_DCHECK_LT(params.input2_offset, max_value); - AddElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -inline void Add(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int16_t* input1_data, - const RuntimeShape& input2_shape, const int16_t* input2_data, - const RuntimeShape& output_shape, int16_t* output_data, - bool pot_scale = true) { - if (!pot_scale) { - AddGeneralParamScale(params, input1_shape, input1_data, input2_shape, - input2_data, output_shape, output_data); - return; - } - - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - - const int input1_shift = params.input1_shift; - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - const int16_t output_activation_min = params.quantized_activation_min; - const int16_t output_activation_max = params.quantized_activation_max; - - TFLITE_DCHECK(input1_shift == 0 || params.input2_shift == 0); - TFLITE_DCHECK_LE(input1_shift, 0); - TFLITE_DCHECK_LE(params.input2_shift, 0); - const int16_t* not_shift_input = - input1_shift == 0 ? input1_data : input2_data; - const int16_t* shift_input = input1_shift == 0 ? input2_data : input1_data; - const int input_right_shift = - input1_shift == 0 ? -params.input2_shift : -input1_shift; - - for (int i = 0; i < flat_size; i++) { - // F0 uses 0 integer bits, range [-1, 1]. - using F0 = gemmlowp::FixedPoint; - - F0 input_ready_scaled = F0::FromRaw(not_shift_input[i]); - F0 scaled_input = F0::FromRaw( - gemmlowp::RoundingDivideByPOT(shift_input[i], input_right_shift)); - F0 result = gemmlowp::SaturatingAdd(scaled_input, input_ready_scaled); - const int16_t raw_output = result.raw(); - const int16_t clamped_output = std::min( - output_activation_max, std::max(output_activation_min, raw_output)); - output_data[i] = clamped_output; - } -} - -// TODO(jiawen): We can implement BroadcastAdd on buffers of arbitrary -// dimensionality if the runtime code does a single loop over one dimension -// that handles broadcasting as the base case. The code generator would then -// generate max(D1, D2) nested for loops. -// TODO(benoitjacob): BroadcastAdd is intentionally duplicated from -// reference_ops.h. Once an optimized version is implemented and NdArrayDesc -// is no longer referenced in this file, move NdArrayDesc from types.h to -// reference_ops.h. -inline void BroadcastAdd4DSlow(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const float* input1_data, - const RuntimeShape& input2_shape, - const float* input2_data, - const RuntimeShape& output_shape, - float* output_data) { - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - const RuntimeShape extended_output_shape = - RuntimeShape::ExtendedShape(4, output_shape); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - for (int b = 0; b < extended_output_shape.Dims(0); ++b) { - for (int y = 0; y < extended_output_shape.Dims(1); ++y) { - for (int x = 0; x < extended_output_shape.Dims(2); ++x) { - for (int c = 0; c < extended_output_shape.Dims(3); ++c) { - output_data[Offset(extended_output_shape, b, y, x, c)] = - ActivationFunctionWithMinMax( - input1_data[SubscriptToIndex(desc1, b, y, x, c)] + - input2_data[SubscriptToIndex(desc2, b, y, x, c)], - params.float_activation_min, params.float_activation_max); - } - } - } - } -} - -inline void BroadcastAdd4DSlow(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const int32_t* input1_data, - const RuntimeShape& input2_shape, - const int32_t* input2_data, - const RuntimeShape& output_shape, - int32_t* output_data) { - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - const RuntimeShape extended_output_shape = - RuntimeShape::ExtendedShape(4, output_shape); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - for (int b = 0; b < extended_output_shape.Dims(0); ++b) { - for (int y = 0; y < extended_output_shape.Dims(1); ++y) { - for (int x = 0; x < extended_output_shape.Dims(2); ++x) { - for (int c = 0; c < extended_output_shape.Dims(3); ++c) { - output_data[Offset(extended_output_shape, b, y, x, c)] = - ActivationFunctionWithMinMax( - input1_data[SubscriptToIndex(desc1, b, y, x, c)] + - input2_data[SubscriptToIndex(desc2, b, y, x, c)], - params.quantized_activation_min, - params.quantized_activation_max); - } - } - } - } -} - -// This function is used for 8-bit as well as for 16-bit, but the accumulator -// is 32-bit for both cases. The overflow does not happen due to the -// choice of the shift (20 or 15, accordingly - see add.cc for more comments). -template -inline void BroadcastAdd4DSlow( - const ArithmeticParams& params, const RuntimeShape& input1_shape, - const T* input1_data, const RuntimeShape& input2_shape, - const T* input2_data, const RuntimeShape& output_shape, T* output_data) { - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - const RuntimeShape extended_output_shape = - RuntimeShape::ExtendedShape(4, output_shape); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - for (int b = 0; b < extended_output_shape.Dims(0); ++b) { - for (int y = 0; y < extended_output_shape.Dims(1); ++y) { - for (int x = 0; x < extended_output_shape.Dims(2); ++x) { - for (int c = 0; c < extended_output_shape.Dims(3); ++c) { - const int32_t input1_val = - params.input1_offset + - input1_data[SubscriptToIndex(desc1, b, y, x, c)]; - const int32_t input2_val = - params.input2_offset + - input2_data[SubscriptToIndex(desc2, b, y, x, c)]; - const int32_t shifted_input1_val = - input1_val * (1 << params.left_shift); - const int32_t shifted_input2_val = - input2_val * (1 << params.left_shift); - const int32_t scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, params.input1_multiplier, - params.input1_shift); - const int32_t scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, params.input2_multiplier, - params.input2_shift); - const int32_t raw_sum = scaled_input1_val + scaled_input2_val; - const int32_t raw_output = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - raw_sum, params.output_multiplier, params.output_shift) + - params.output_offset; - const int32_t clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, raw_output)); - output_data[Offset(extended_output_shape, b, y, x, c)] = - static_cast(clamped_output); - } - } - } - } -} - -inline void BroadcastAddFivefold(const ArithmeticParams& unswitched_params, - const RuntimeShape& unswitched_input1_shape, - const uint8_t* unswitched_input1_data, - const RuntimeShape& unswitched_input2_shape, - const uint8_t* unswitched_input2_data, - const RuntimeShape& output_shape, - uint8_t* output_data) { - ArithmeticParams switched_params = unswitched_params; - switched_params.input1_offset = unswitched_params.input2_offset; - switched_params.input1_multiplier = unswitched_params.input2_multiplier; - switched_params.input1_shift = unswitched_params.input2_shift; - switched_params.input2_offset = unswitched_params.input1_offset; - switched_params.input2_multiplier = unswitched_params.input1_multiplier; - switched_params.input2_shift = unswitched_params.input1_shift; - - const bool use_unswitched = - unswitched_params.broadcast_category == - tflite::BroadcastableOpCategory::kFirstInputBroadcastsFast; - - const ArithmeticParams& params = - use_unswitched ? unswitched_params : switched_params; - const uint8_t* input1_data = - use_unswitched ? unswitched_input1_data : unswitched_input2_data; - const uint8_t* input2_data = - use_unswitched ? unswitched_input2_data : unswitched_input1_data; - - // Fivefold nested loops. The second input resets its position for each - // iteration of the second loop. The first input resets its position at the - // beginning of the fourth loop. The innermost loop is an elementwise add of - // sections of the arrays. - uint8_t* output_data_ptr = output_data; - const uint8_t* input1_data_ptr = input1_data; - const uint8_t* input2_data_reset = input2_data; - // In the fivefold pattern, y0, y2 and y4 are not broadcast, and so shared - // between input shapes. y3 for input 1 is always broadcast, and so the - // dimension there is 1, whereas optionally y1 might be broadcast for input 2. - // Put another way, - // input1.shape.FlatSize = y0 * y1 * y2 * y4, - // input2.shape.FlatSize = y0 * y2 * y3 * y4. - int y0 = params.broadcast_shape[0]; - int y1 = params.broadcast_shape[1]; - int y2 = params.broadcast_shape[2]; - int y3 = params.broadcast_shape[3]; - int y4 = params.broadcast_shape[4]; - if (y4 > 1) { - // General fivefold pattern, with y4 > 1 so there is a non-broadcast inner - // dimension. - for (int i0 = 0; i0 < y0; ++i0) { - const uint8_t* input2_data_ptr; - for (int i1 = 0; i1 < y1; ++i1) { - input2_data_ptr = input2_data_reset; - for (int i2 = 0; i2 < y2; ++i2) { - for (int i3 = 0; i3 < y3; ++i3) { - AddElementwise(y4, params, input1_data_ptr, input2_data_ptr, - output_data_ptr); - input2_data_ptr += y4; - output_data_ptr += y4; - } - // We have broadcast y4 of input1 data y3 times, and now move on. - input1_data_ptr += y4; - } - } - // We have broadcast y2*y3*y4 of input2 data y1 times, and now move on. - input2_data_reset = input2_data_ptr; - } - } else { - // Special case of y4 == 1, in which the innermost loop is a single element - // and can be combined with the next (y3) as an inner broadcast. - // - // Note that this handles the case of pure scalar broadcast when - // y0 == y1 == y2 == 1. With low overhead it handles cases such as scalar - // broadcast with batch (as y2 > 1). - // - // NOTE The process is the same as the above general case except simplified - // for y4 == 1 and the loop over y3 is contained within the - // AddScalarBroadcast function. - for (int i0 = 0; i0 < y0; ++i0) { - const uint8_t* input2_data_ptr; - for (int i1 = 0; i1 < y1; ++i1) { - input2_data_ptr = input2_data_reset; - for (int i2 = 0; i2 < y2; ++i2) { - AddScalarBroadcast(y3, params, *input1_data_ptr, input2_data_ptr, - output_data_ptr); - input2_data_ptr += y3; - output_data_ptr += y3; - input1_data_ptr += 1; - } - } - input2_data_reset = input2_data_ptr; - } - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ADD_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/arg_min_max.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/arg_min_max.h deleted file mode 100644 index e6f34fd..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/arg_min_max.h +++ /dev/null @@ -1,68 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_ARG_MIN_MAX_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ARG_MIN_MAX_H_ - -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -template -void ArgMinMax(const RuntimeShape& input1_shape, const T1* input1_data, - const T3* input2_data, const RuntimeShape& output_shape, - T2* output_data, const Cmp& cmp) { - TFLITE_DCHECK_GT(input1_shape.DimensionsCount(), 0); - TFLITE_DCHECK_EQ(input1_shape.DimensionsCount() - 1, - output_shape.DimensionsCount()); - int axis = input2_data[0]; - if (axis < 0) { - axis += input1_shape.DimensionsCount(); - } - const int axis_size = input1_shape.Dims(axis); - - int outer_size = 1; - for (int i = 0; i < axis; ++i) { - TFLITE_DCHECK_EQ(input1_shape.Dims(i), output_shape.Dims(i)); - outer_size *= input1_shape.Dims(i); - } - - int inner_size = 1; - const int dims_count = input1_shape.DimensionsCount(); - for (int i = axis + 1; i < dims_count; ++i) { - TFLITE_DCHECK_EQ(input1_shape.Dims(i), output_shape.Dims(i - 1)); - inner_size *= input1_shape.Dims(i); - } - for (int outer = 0; outer < outer_size; ++outer) { - for (int inner = 0; inner < inner_size; ++inner) { - auto min_max_value = input1_data[outer * axis_size * inner_size + inner]; - T2 min_max_index = 0; - for (int i = 1; i < axis_size; ++i) { - const auto& curr_value = - input1_data[(outer * axis_size + i) * inner_size + inner]; - if (cmp(curr_value, min_max_value)) { - min_max_value = curr_value; - min_max_index = static_cast(i); - } - } - output_data[outer * inner_size + inner] = min_max_index; - } - } -} -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ARG_MIN_MAX_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/batch_matmul.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/batch_matmul.h deleted file mode 100644 index f06199c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/batch_matmul.h +++ /dev/null @@ -1,317 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_BATCH_MATMUL_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_BATCH_MATMUL_H_ - -#include -#include - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace reference_ops { - -inline void BatchMatMul(const RuntimeShape& lhs_shape, const float* lhs_data, - const RuntimeShape& rhs_shape, const float* rhs_data, - const RuntimeShape& output_shape, float* output_data) { - const RuntimeShape extended_lhs_shape = - RuntimeShape::ExtendedShape(5, lhs_shape); - const RuntimeShape extended_rhs_shape = - RuntimeShape::ExtendedShape(5, rhs_shape); - - // Determine which dimension is the broadcast dimension. - auto broadcast_dim = [](int lhs_dim, int rhs_dim) { - if (lhs_dim == rhs_dim) return lhs_dim; - if (lhs_dim == 1) return rhs_dim; - TFLITE_DCHECK_EQ(rhs_dim, 1); - return lhs_dim; - }; - - // Compute the "extent" for iterating on this dimension. - // If we are broadcasting, then don't advance (i.e return 0). - auto extent = [](const RuntimeShape& shape, int x) { - if (shape.Dims(x) == 1) { - return 0; - } - int prod = 1; - for (int i = x + 1; i < shape.DimensionsCount(); ++i) { - prod *= shape.Dims(i); - } - return prod; - }; - - const int batch_dim0 = - broadcast_dim(extended_lhs_shape.Dims(0), extended_rhs_shape.Dims(0)); - const int batch_dim1 = - broadcast_dim(extended_lhs_shape.Dims(1), extended_rhs_shape.Dims(1)); - const int batch_dim2 = - broadcast_dim(extended_lhs_shape.Dims(2), extended_rhs_shape.Dims(2)); - - const int lhs_ext0 = extent(extended_lhs_shape, 0); - const int lhs_ext1 = extent(extended_lhs_shape, 1); - const int lhs_ext2 = extent(extended_lhs_shape, 2); - const int rhs_ext0 = extent(extended_rhs_shape, 0); - const int rhs_ext1 = extent(extended_rhs_shape, 1); - const int rhs_ext2 = extent(extended_rhs_shape, 2); - - // Set params for each matrix multiply. - const int lhs_rows = extended_lhs_shape.Dims(3); - const int rhs_cols = extended_rhs_shape.Dims(4); - const int accum_depth = extended_lhs_shape.Dims(4); - - for (int b0 = 0; b0 < batch_dim0; ++b0) { - const float* lhs_ptr0 = lhs_data + (b0 * lhs_ext0); - const float* rhs_ptr0 = rhs_data + (b0 * rhs_ext0); - for (int b1 = 0; b1 < batch_dim1; ++b1) { - const float* lhs_ptr1 = lhs_ptr0 + b1 * lhs_ext1; - const float* rhs_ptr1 = rhs_ptr0 + b1 * rhs_ext1; - for (int b2 = 0; b2 < batch_dim2; ++b2) { - const float* lhs_ptr2 = lhs_ptr1 + b2 * lhs_ext2; - const float* rhs_ptr2 = rhs_ptr1 + b2 * rhs_ext2; - float* out_ptr = output_data + ((b0 * batch_dim1 * batch_dim2) + - b1 * batch_dim2 + b2) * - lhs_rows * rhs_cols; - for (int j = 0; j < rhs_cols; ++j) { - for (int i = 0; i < lhs_rows; ++i) { - float total = 0.f; - for (int k = 0; k < accum_depth; ++k) { - total += - lhs_ptr2[accum_depth * i + k] * rhs_ptr2[j * accum_depth + k]; - } - int idx = lhs_rows * j + i; - out_ptr[idx] = total; - } - } - } - } - } -} - -inline void BatchMatMul(const RuntimeShape& lhs_shape, const int8_t* lhs_data, - const RuntimeShape& rhs_shape, const int8_t* rhs_data, - const float* scaling_factors, - const int32_t* input_offset, int32_t* row_sums, - const RuntimeShape& output_shape, float* output_data, - bool* compute_row_sums) { - const RuntimeShape extended_lhs_shape = - RuntimeShape::ExtendedShape(5, lhs_shape); - const RuntimeShape extended_rhs_shape = - RuntimeShape::ExtendedShape(5, rhs_shape); - - // Determine which dimension is the broadcast dimension. - auto broadcast_dim = [](int lhs_dim, int rhs_dim) { - if (lhs_dim == rhs_dim) return lhs_dim; - if (lhs_dim == 1) return rhs_dim; - TFLITE_DCHECK_EQ(rhs_dim, 1); - return lhs_dim; - }; - - // Compute the "extent" for iterating on this dimension. - // If we are broadcasting, then don't advance (i.e return 0). - auto extent = [](const RuntimeShape& shape, int x) { - if (shape.Dims(x) == 1) { - return 0; - } - int prod = 1; - for (int i = x + 1; i < shape.DimensionsCount(); ++i) { - prod *= shape.Dims(i); - } - return prod; - }; - - const int batch_dim0 = - broadcast_dim(extended_lhs_shape.Dims(0), extended_rhs_shape.Dims(0)); - const int batch_dim1 = - broadcast_dim(extended_lhs_shape.Dims(1), extended_rhs_shape.Dims(1)); - const int batch_dim2 = - broadcast_dim(extended_lhs_shape.Dims(2), extended_rhs_shape.Dims(2)); - - const int lhs_ext0 = extent(extended_lhs_shape, 0); - const int lhs_ext1 = extent(extended_lhs_shape, 1); - const int lhs_ext2 = extent(extended_lhs_shape, 2); - const int rhs_ext0 = extent(extended_rhs_shape, 0); - const int rhs_ext1 = extent(extended_rhs_shape, 1); - const int rhs_ext2 = extent(extended_rhs_shape, 2); - - // Set params for each matrix multiply. - const int lhs_rows = extended_lhs_shape.Dims(3); - const int rhs_cols = extended_rhs_shape.Dims(4); - const int accum_depth = extended_lhs_shape.Dims(4); - - const int ioff_ext0 = rhs_ext0 == 0 ? 0 : rhs_cols; - const int ioff_ext1 = rhs_ext1 == 0 ? 0 : rhs_cols; - const int ioff_ext2 = rhs_ext2 == 0 ? 0 : rhs_cols; - const int woff_ext0 = lhs_ext0 == 0 ? 0 : lhs_rows; - const int woff_ext1 = lhs_ext1 == 0 ? 0 : lhs_rows; - const int woff_ext2 = lhs_ext2 == 0 ? 0 : lhs_rows; - - if (!compute_row_sums || *compute_row_sums) { - int num_weights_matrices = 1; - for (int i = 1; i < extended_lhs_shape.DimensionsCount() - 2; ++i) { - num_weights_matrices *= extended_lhs_shape.Dims(i); - } - memset(row_sums, 0, sizeof(int32_t) * lhs_rows * num_weights_matrices); - for (int j = 0; j < num_weights_matrices; ++j) { - tensor_utils::PortableReductionSumVector( - lhs_data + j * lhs_rows * accum_depth, row_sums + j * lhs_rows, - lhs_rows, accum_depth); - } - if (compute_row_sums) { - *compute_row_sums = false; - } - } - - for (int b0 = 0; b0 < batch_dim0; ++b0) { - const int8_t* lhs_ptr0 = lhs_data + (b0 * lhs_ext0); - const int8_t* rhs_ptr0 = rhs_data + (b0 * rhs_ext0); - const int32_t* ioff_ptr0 = input_offset + (b0 * ioff_ext0); - const float* scale_ptr0 = scaling_factors + (b0 * ioff_ext0); - const int32_t* woff_ptr0 = row_sums + (b0 * woff_ext0); - for (int b1 = 0; b1 < batch_dim1; ++b1) { - const int8_t* lhs_ptr1 = lhs_ptr0 + b1 * lhs_ext1; - const int8_t* rhs_ptr1 = rhs_ptr0 + b1 * rhs_ext1; - const int32_t* ioff_ptr1 = ioff_ptr0 + (b1 * ioff_ext1); - const float* scale_ptr1 = scale_ptr0 + (b1 * ioff_ext1); - const int32_t* woff_ptr1 = woff_ptr0 + (b1 * woff_ext1); - for (int b2 = 0; b2 < batch_dim2; ++b2) { - const int8_t* lhs_ptr2 = lhs_ptr1 + b2 * lhs_ext2; - const int8_t* rhs_ptr2 = rhs_ptr1 + b2 * rhs_ext2; - const int32_t* ioff_ptr2 = ioff_ptr1 + (b2 * ioff_ext2); - const float* scale_ptr2 = scale_ptr1 + (b2 * ioff_ext2); - const int32_t* woff_ptr2 = woff_ptr1 + (b2 * woff_ext2); - float* out_ptr = output_data + ((b0 * batch_dim1 * batch_dim2) + - b1 * batch_dim2 + b2) * - lhs_rows * rhs_cols; - for (int j = 0; j < rhs_cols; ++j) { - const float batch_scaling_factor = scale_ptr2[j]; - const float batch_offset = static_cast(ioff_ptr2[j]); - for (int i = 0; i < lhs_rows; ++i) { - int32_t total = 0; - for (int k = 0; k < accum_depth; ++k) { - total += - lhs_ptr2[accum_depth * i + k] * rhs_ptr2[j * accum_depth + k]; - } - int32_t row_sum = woff_ptr2[i]; - total -= row_sum * batch_offset; - int idx = lhs_rows * j + i; - out_ptr[idx] += batch_scaling_factor * total; - } - } - } - } - } -} - -template -inline void BatchMatMul(const FullyConnectedParams& params, - const RuntimeShape& lhs_shape, const T* lhs_data, - const RuntimeShape& rhs_shape, const T* rhs_data, - const RuntimeShape& output_shape, T* output_data) { - const RuntimeShape extended_lhs_shape = - RuntimeShape::ExtendedShape(5, lhs_shape); - const RuntimeShape extended_rhs_shape = - RuntimeShape::ExtendedShape(5, rhs_shape); - - // Determine which dimension is the broadcast dimension. - auto broadcast_dim = [](int lhs_dim, int rhs_dim) { - if (lhs_dim == rhs_dim) return lhs_dim; - if (lhs_dim == 1) return rhs_dim; - TFLITE_DCHECK_EQ(rhs_dim, 1); - return lhs_dim; - }; - - // Compute the "extent" for iterating on this dimension. - // If we are broadcasting, then don't advance (i.e return 0). - auto extent = [](const RuntimeShape& shape, int x) { - if (shape.Dims(x) == 1) { - return 0; - } - int prod = 1; - for (int i = x + 1; i < shape.DimensionsCount(); ++i) { - prod *= shape.Dims(i); - } - return prod; - }; - - const int batch_dim0 = - broadcast_dim(extended_lhs_shape.Dims(0), extended_rhs_shape.Dims(0)); - const int batch_dim1 = - broadcast_dim(extended_lhs_shape.Dims(1), extended_rhs_shape.Dims(1)); - const int batch_dim2 = - broadcast_dim(extended_lhs_shape.Dims(2), extended_rhs_shape.Dims(2)); - - const int lhs_ext0 = extent(extended_lhs_shape, 0); - const int lhs_ext1 = extent(extended_lhs_shape, 1); - const int lhs_ext2 = extent(extended_lhs_shape, 2); - const int rhs_ext0 = extent(extended_rhs_shape, 0); - const int rhs_ext1 = extent(extended_rhs_shape, 1); - const int rhs_ext2 = extent(extended_rhs_shape, 2); - - // Set params for each matrix multiply. - const int lhs_rows = extended_lhs_shape.Dims(3); - const int rhs_cols = extended_rhs_shape.Dims(4); - const int accum_depth = extended_lhs_shape.Dims(4); - - const int32_t input_offset = params.input_offset; - const int32_t filter_offset = params.weights_offset; - const int32_t output_offset = params.output_offset; - const int32_t output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - - for (int b0 = 0; b0 < batch_dim0; ++b0) { - const T* lhs_ptr0 = lhs_data + (b0 * lhs_ext0); - const T* rhs_ptr0 = rhs_data + (b0 * rhs_ext0); - for (int b1 = 0; b1 < batch_dim1; ++b1) { - const T* lhs_ptr1 = lhs_ptr0 + b1 * lhs_ext1; - const T* rhs_ptr1 = rhs_ptr0 + b1 * rhs_ext1; - for (int b2 = 0; b2 < batch_dim2; ++b2) { - const T* lhs_ptr2 = lhs_ptr1 + b2 * lhs_ext2; - const T* rhs_ptr2 = rhs_ptr1 + b2 * rhs_ext2; - T* out_ptr = output_data + - ((b0 * batch_dim1 * batch_dim2) + b1 * batch_dim2 + b2) * - lhs_rows * rhs_cols; - - for (int j = 0; j < rhs_cols; ++j) { - for (int i = 0; i < lhs_rows; ++i) { - AccumT total = 0; - for (int k = 0; k < accum_depth; ++k) { - AccumT lhs_val = lhs_ptr2[accum_depth * i + k]; - AccumT rhs_val = rhs_ptr2[accum_depth * j + k]; - total += (lhs_val + filter_offset) * (rhs_val + input_offset); - } - int32_t total_scaled = MultiplyByQuantizedMultiplier( - total, output_multiplier, output_shift); - total_scaled += output_offset; - total_scaled = std::max(total_scaled, output_activation_min); - total_scaled = std::min(total_scaled, output_activation_max); - const int idx = lhs_rows * j + i; - out_ptr[idx] = static_cast(total_scaled); - } - } - } - } - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_BATCH_MATMUL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/binary_function.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/binary_function.h deleted file mode 100644 index 51d9e2b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/binary_function.h +++ /dev/null @@ -1,84 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_BINARY_FUNCTION_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_BINARY_FUNCTION_H_ - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -// TODO(ycling): Refactoring. Remove BroadcastLogical and use the more -// generalized and efficient BroadcastBinaryFunction. -// -// Also appears to duplicate MinimumMaximum. -// -// R: Result type. T1: Input 1 type. T2: Input 2 type. -template -inline void BroadcastBinaryFunction4DSlow( - const RuntimeShape& unextended_input1_shape, const T1* input1_data, - const RuntimeShape& unextended_input2_shape, const T2* input2_data, - const RuntimeShape& unextended_output_shape, R* output_data, - R (*func)(T1, T2)) { - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_input2_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - NdArrayDescsForElementwiseBroadcast(unextended_input1_shape, - unextended_input2_shape, &desc1, &desc2); - - for (int b = 0; b < output_shape.Dims(0); ++b) { - for (int y = 0; y < output_shape.Dims(1); ++y) { - for (int x = 0; x < output_shape.Dims(2); ++x) { - for (int c = 0; c < output_shape.Dims(3); ++c) { - auto out_idx = Offset(output_shape, b, y, x, c); - auto in1_idx = SubscriptToIndex(desc1, b, y, x, c); - auto in2_idx = SubscriptToIndex(desc2, b, y, x, c); - auto in1_val = input1_data[in1_idx]; - auto in2_val = input2_data[in2_idx]; - output_data[out_idx] = func(in1_val, in2_val); - } - } - } - } -} - -// R: Result type. T1: Input 1 type. T2: Input 2 type. -// TODO(renjieliu): Refactor other binary functions to use this one. -template -inline void BinaryFunction(const RuntimeShape& input1_shape, - const T1* input1_data, - const RuntimeShape& input2_shape, - const T2* input2_data, - const RuntimeShape& output_shape, R* output_data, - R (*func)(T1, T2)) { - const int flat_size = - MatchingFlatSize(input1_shape, input2_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = func(input1_data[i], input2_data[i]); - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_BINARY_FUNCTION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/ceil.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/ceil.h deleted file mode 100644 index 66d1dc3..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/ceil.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2018 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_KERNELS_INTERNAL_REFERENCE_CEIL_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CEIL_H_ - -#include - -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -inline void Ceil(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; ++i) { - output_data[i] = std::ceil(input_data[i]); - } -} - -} // namespace reference_ops -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CEIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/comparisons.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/comparisons.h deleted file mode 100644 index 6344bdc..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/comparisons.h +++ /dev/null @@ -1,280 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_COMPARISONS_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_COMPARISONS_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -template -inline bool EqualFn(T lhs, T rhs) { - return lhs == rhs; -} - -template -inline bool NotEqualFn(T lhs, T rhs) { - return lhs != rhs; -} - -template -inline bool GreaterFn(T lhs, T rhs) { - return lhs > rhs; -} -template -inline bool GreaterEqualFn(T lhs, T rhs) { - return lhs >= rhs; -} -template -inline bool LessFn(T lhs, T rhs) { - return lhs < rhs; -} -template -inline bool LessEqualFn(T lhs, T rhs) { - return lhs <= rhs; -} - -template -using ComparisonFn = bool (*)(T, T); - -template F> -inline void ComparisonImpl( - const ComparisonParams& op_params, const RuntimeShape& input1_shape, - const T* input1_data, const RuntimeShape& input2_shape, - const T* input2_data, const RuntimeShape& output_shape, bool* output_data) { - const int64_t flatsize = - MatchingFlatSize(input1_shape, input2_shape, output_shape); - for (int64_t i = 0; i < flatsize; ++i) { - output_data[i] = F(input1_data[i], input2_data[i]); - } -} - -template F> -inline void Comparison(const ComparisonParams& op_params, - const RuntimeShape& input1_shape, - const float* input1_data, - const RuntimeShape& input2_shape, - const float* input2_data, - const RuntimeShape& output_shape, bool* output_data) { - ComparisonImpl(op_params, input1_shape, input1_data, input2_shape, - input2_data, output_shape, output_data); -} - -template F> -inline void ComparisonWithScaling( - const ComparisonParams& op_params, const RuntimeShape& input1_shape, - const T* input1_data, const RuntimeShape& input2_shape, - const T* input2_data, const RuntimeShape& output_shape, bool* output_data) { - int left_shift = op_params.left_shift; - int32_t input1_offset = op_params.input1_offset; - int32_t input1_multiplier = op_params.input1_multiplier; - int input1_shift = op_params.input1_shift; - int32_t input2_offset = op_params.input2_offset; - int32_t input2_multiplier = op_params.input2_multiplier; - int input2_shift = op_params.input2_shift; - - const int64_t flatsize = - MatchingFlatSize(input1_shape, input2_shape, output_shape); - for (int64_t i = 0; i < flatsize; ++i) { - const int32_t input1_val = input1_offset + input1_data[i]; - const int32_t input2_val = input2_offset + input2_data[i]; - const int32_t shifted_input1_val = input1_val * (1 << left_shift); - const int32_t shifted_input2_val = input2_val * (1 << left_shift); - const int32_t scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, input1_multiplier, input1_shift); - const int32_t scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, input2_multiplier, input2_shift); - output_data[i] = F(scaled_input1_val, scaled_input2_val); - } -} - -struct BroadcastComparison4DSlowCommon { - const RuntimeShape output_shape; - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; -}; - -inline BroadcastComparison4DSlowCommon BroadcastComparison4DSlowPreprocess( - const RuntimeShape& unextended_input1_shape, - const RuntimeShape& unextended_input2_shape, - const RuntimeShape& unextended_output_shape) { - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_input2_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - NdArrayDescsForElementwiseBroadcast(unextended_input1_shape, - unextended_input2_shape, &desc1, &desc2); - return {RuntimeShape::ExtendedShape(4, unextended_output_shape), desc1, - desc2}; -} - -template F> -inline void BroadcastComparison4DSlowImpl( - const ComparisonParams& op_params, - const RuntimeShape& unextended_input1_shape, const T* input1_data, - const RuntimeShape& unextended_input2_shape, const T* input2_data, - const RuntimeShape& unextended_output_shape, bool* output_data) { - const BroadcastComparison4DSlowCommon dims = - BroadcastComparison4DSlowPreprocess(unextended_input1_shape, - unextended_input2_shape, - unextended_output_shape); - - for (int b = 0; b < dims.output_shape.Dims(0); ++b) { - for (int y = 0; y < dims.output_shape.Dims(1); ++y) { - for (int x = 0; x < dims.output_shape.Dims(2); ++x) { - for (int c = 0; c < dims.output_shape.Dims(3); ++c) { - output_data[Offset(dims.output_shape, b, y, x, c)] = - F(input1_data[SubscriptToIndex(dims.desc1, b, y, x, c)], - input2_data[SubscriptToIndex(dims.desc2, b, y, x, c)]); - } - } - } - } -} - -template F> -inline void BroadcastComparison4DSlow(const ComparisonParams& op_params, - const RuntimeShape& input1_shape, - const float* input1_data, - const RuntimeShape& input2_shape, - const float* input2_data, - const RuntimeShape& output_shape, - bool* output_data) { - BroadcastComparison4DSlowImpl(op_params, input1_shape, input1_data, - input2_shape, input2_data, - output_shape, output_data); -} - -template F> -inline void BroadcastComparison4DSlowWithScaling( - const ComparisonParams& op_params, - const RuntimeShape& unextended_input1_shape, const T* input1_data, - const RuntimeShape& unextended_input2_shape, const T* input2_data, - const RuntimeShape& unextended_output_shape, bool* output_data) { - const BroadcastComparison4DSlowCommon dims = - BroadcastComparison4DSlowPreprocess(unextended_input1_shape, - unextended_input2_shape, - unextended_output_shape); - - int left_shift = op_params.left_shift; - int32_t input1_offset = op_params.input1_offset; - int32_t input1_multiplier = op_params.input1_multiplier; - int input1_shift = op_params.input1_shift; - int32_t input2_offset = op_params.input2_offset; - int32_t input2_multiplier = op_params.input2_multiplier; - int input2_shift = op_params.input2_shift; - - for (int b = 0; b < dims.output_shape.Dims(0); ++b) { - for (int y = 0; y < dims.output_shape.Dims(1); ++y) { - for (int x = 0; x < dims.output_shape.Dims(2); ++x) { - for (int c = 0; c < dims.output_shape.Dims(3); ++c) { - const int32_t input1_val = - input1_offset + - input1_data[SubscriptToIndex(dims.desc1, b, y, x, c)]; - const int32_t input2_val = - input2_offset + - input2_data[SubscriptToIndex(dims.desc2, b, y, x, c)]; - const int32_t shifted_input1_val = input1_val * (1 << left_shift); - const int32_t shifted_input2_val = input2_val * (1 << left_shift); - const int32_t scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, input1_multiplier, input1_shift); - const int32_t scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, input2_multiplier, input2_shift); - output_data[Offset(dims.output_shape, b, y, x, c)] = - F(scaled_input1_val, scaled_input2_val); - } - } - } - } -} - -#define TFLITE_COMPARISON_OP(name) \ - inline void name(const ComparisonParams& op_params, \ - const RuntimeShape& input1_shape, const float* input1_data, \ - const RuntimeShape& input2_shape, const float* input2_data, \ - const RuntimeShape& output_shape, bool* output_data) { \ - Comparison(op_params, input1_shape, input1_data, input2_shape, \ - input2_data, output_shape, output_data); \ - } \ - template \ - inline void name##NoScaling( \ - const ComparisonParams& op_params, const RuntimeShape& input1_shape, \ - const T* input1_data, const RuntimeShape& input2_shape, \ - const T* input2_data, const RuntimeShape& output_shape, \ - bool* output_data) { \ - ComparisonImpl(op_params, input1_shape, input1_data, \ - input2_shape, input2_data, output_shape, \ - output_data); \ - } \ - template \ - inline void name##WithScaling( \ - const ComparisonParams& op_params, const RuntimeShape& input1_shape, \ - const T* input1_data, const RuntimeShape& input2_shape, \ - const T* input2_data, const RuntimeShape& output_shape, \ - bool* output_data) { \ - ComparisonWithScaling(op_params, input1_shape, input1_data, \ - input2_shape, input2_data, \ - output_shape, output_data); \ - } \ - template \ - inline void Broadcast4DSlow##name##NoScaling( \ - const ComparisonParams& op_params, const RuntimeShape& input1_shape, \ - const T* input1_data, const RuntimeShape& input2_shape, \ - const T* input2_data, const RuntimeShape& output_shape, \ - bool* output_data) { \ - BroadcastComparison4DSlowImpl( \ - op_params, input1_shape, input1_data, input2_shape, input2_data, \ - output_shape, output_data); \ - } \ - inline void Broadcast4DSlow##name( \ - const ComparisonParams& op_params, const RuntimeShape& input1_shape, \ - const float* input1_data, const RuntimeShape& input2_shape, \ - const float* input2_data, const RuntimeShape& output_shape, \ - bool* output_data) { \ - BroadcastComparison4DSlow(op_params, input1_shape, input1_data, \ - input2_shape, input2_data, \ - output_shape, output_data); \ - } \ - template \ - inline void Broadcast4DSlow##name##WithScaling( \ - const ComparisonParams& op_params, const RuntimeShape& input1_shape, \ - const T* input1_data, const RuntimeShape& input2_shape, \ - const T* input2_data, const RuntimeShape& output_shape, \ - bool* output_data) { \ - BroadcastComparison4DSlowWithScaling( \ - op_params, input1_shape, input1_data, input2_shape, input2_data, \ - output_shape, output_data); \ - } -TFLITE_COMPARISON_OP(Equal); -TFLITE_COMPARISON_OP(NotEqual); -TFLITE_COMPARISON_OP(Greater); -TFLITE_COMPARISON_OP(GreaterEqual); -TFLITE_COMPARISON_OP(Less); -TFLITE_COMPARISON_OP(LessEqual); -#undef TFLITE_COMPARISON_OP - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_COMPARISONS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/concatenation.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/concatenation.h deleted file mode 100644 index 2595979..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/concatenation.h +++ /dev/null @@ -1,140 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_CONCATENATION_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CONCATENATION_H_ - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace reference_ops { - -template -inline void Concatenation(const ConcatenationParams& params, - const RuntimeShape* const* input_shapes, - const Scalar* const* input_data, - const RuntimeShape& output_shape, - Scalar* output_data) { - int axis = params.axis; - int inputs_count = params.inputs_count; - const int concat_dimensions = output_shape.DimensionsCount(); - TFLITE_DCHECK_LT(axis, concat_dimensions); - - int64_t concat_size = 0; - for (int i = 0; i < inputs_count; i++) { - TFLITE_DCHECK_EQ(input_shapes[i]->DimensionsCount(), concat_dimensions); - for (int j = 0; j < concat_dimensions; j++) { - if (j != axis) { - MatchingDim(*input_shapes[i], j, output_shape, j); - } - } - concat_size += input_shapes[i]->Dims(axis); - } - TFLITE_DCHECK_EQ(concat_size, output_shape.Dims(axis)); - int64_t outer_size = 1; - for (int i = 0; i < axis; ++i) { - outer_size *= output_shape.Dims(i); - } - // For all input arrays, - // FlatSize() = outer_size * Dims(axis) * base_inner_size; - int64_t base_inner_size = 1; - for (int i = axis + 1; i < concat_dimensions; ++i) { - base_inner_size *= output_shape.Dims(i); - } - - Scalar* output_ptr = output_data; - for (int k = 0; k < outer_size; k++) { - for (int i = 0; i < inputs_count; ++i) { - const int copy_size = input_shapes[i]->Dims(axis) * base_inner_size; - const Scalar* input_ptr = input_data[i] + k * copy_size; - memcpy(output_ptr, input_ptr, copy_size * sizeof(Scalar)); - output_ptr += copy_size; - } - } -} - -// TODO(prabhumk): This is the same as the optimized implementation. -// TODO(prabhumk): The quantized implementation of concatentation isn't fully -// quantized as it takes scale as a floating point value. This should be fixed -// when optimizng this routine further. -inline void ConcatenationWithScaling(const ConcatenationParams& params, - const RuntimeShape* const* input_shapes, - const uint8_t* const* input_data, - const RuntimeShape& output_shape, - uint8_t* output_data) { - int axis = params.axis; - const int32_t* input_zeropoint = params.input_zeropoint; - const float* input_scale = params.input_scale; - int inputs_count = params.inputs_count; - const int32_t output_zeropoint = params.output_zeropoint; - const float output_scale = params.output_scale; - - const int concat_dimensions = output_shape.DimensionsCount(); - TFLITE_DCHECK_LT(axis, concat_dimensions); - - int64_t concat_size = 0; - for (int i = 0; i < inputs_count; i++) { - TFLITE_DCHECK_EQ(input_shapes[i]->DimensionsCount(), concat_dimensions); - for (int j = 0; j < concat_dimensions; j++) { - if (j != axis) { - MatchingDim(*input_shapes[i], j, output_shape, j); - } - } - concat_size += input_shapes[i]->Dims(axis); - } - TFLITE_DCHECK_EQ(concat_size, output_shape.Dims(axis)); - int64_t outer_size = 1; - for (int i = 0; i < axis; ++i) { - outer_size *= output_shape.Dims(i); - } - // For all input arrays, - // FlatSize() = outer_size * Dims(axis) * base_inner_size; - int64_t base_inner_size = 1; - for (int i = axis + 1; i < concat_dimensions; ++i) { - base_inner_size *= output_shape.Dims(i); - } - - const float inverse_output_scale = 1.f / output_scale; - uint8_t* output_ptr = output_data; - for (int k = 0; k < outer_size; k++) { - for (int i = 0; i < inputs_count; ++i) { - const int copy_size = input_shapes[i]->Dims(axis) * base_inner_size; - const uint8_t* input_ptr = input_data[i] + k * copy_size; - if (input_zeropoint[i] == output_zeropoint && - input_scale[i] == output_scale) { - memcpy(output_ptr, input_ptr, copy_size); - } else { - const float scale = input_scale[i] * inverse_output_scale; - const float bias = -input_zeropoint[i] * scale; - for (int j = 0; j < copy_size; ++j) { - const int32_t value = static_cast(tflite::TfLiteRound( - input_ptr[j] * scale + bias)) + - output_zeropoint; - output_ptr[j] = static_cast( - std::max(std::min(255, value), 0)); - } - } - output_ptr += copy_size; - } - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CONCATENATION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/conv.h deleted file mode 100644 index b912ac1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/conv.h +++ /dev/null @@ -1,267 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_CONV_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CONV_H_ - -#include "tensorflow/lite/kernels/internal/types.h" -#include "tensorflow/lite/kernels/internal/common.h" - - - -namespace tflite { - -namespace reference_ops { - - -inline void Conv(const ConvParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& filter_shape, - const float* filter_data, const RuntimeShape& bias_shape, - const float* bias_data, const RuntimeShape& output_shape, - float* output_data, const RuntimeShape& im2col_shape, - float* im2col_data) { - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - const float output_activation_min = params.float_activation_min; - const float output_activation_max = params.float_activation_max; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - - (void)im2col_data; // only used in optimized code. - (void)im2col_shape; // only used in optimized code. - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3); - const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3); - if (bias_data) { - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - } - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - const int in_y_origin = (out_y * stride_height) - pad_height; - for (int out_x = 0; out_x < output_width; ++out_x) { - const int in_x_origin = (out_x * stride_width) - pad_width; - for (int out_channel = 0; out_channel < output_depth; ++out_channel) { - float total = 0.f; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - const int in_y = in_y_origin + dilation_height_factor * filter_y; - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - const int in_x = in_x_origin + dilation_width_factor * filter_x; - - // Zero padding by omitting the areas outside the image. - const bool is_point_inside_image = - (in_x >= 0) && (in_x < input_width) && (in_y >= 0) && - (in_y < input_height); - - if (!is_point_inside_image) { - continue; - } - - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - float input_value = input_data[Offset(input_shape, batch, in_y, - in_x, in_channel)]; - float filter_value = filter_data[Offset( - filter_shape, out_channel, filter_y, filter_x, in_channel)]; - total += (input_value * filter_value); - } - } - } - float bias_value = 0.0f; - if (bias_data) { - bias_value = bias_data[out_channel]; - } - output_data[Offset(output_shape, batch, out_y, out_x, out_channel)] = - ActivationFunctionWithMinMax(total + bias_value, - output_activation_min, - output_activation_max); - } - } - } - } -} - -inline void Conv(const ConvParams& params, const RuntimeShape& input_shape, - const uint8_t* input_data, const RuntimeShape& filter_shape, - const uint8_t* filter_data, const RuntimeShape& bias_shape, - const int32_t* bias_data, const RuntimeShape& output_shape, - uint8_t* output_data, const RuntimeShape& im2col_shape, - uint8_t* im2col_data, void* cpu_backend_context) { - (void)cpu_backend_context; // only used in optimized code. - (void)im2col_data; // only used in optimized code. - (void)im2col_shape; // only used in optimized code. - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - const int32_t input_offset = params.input_offset; - const int32_t filter_offset = params.weights_offset; - const int32_t output_offset = params.output_offset; - const int32_t output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3); - const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3); - if (bias_data) { - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - } - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - const int in_y_origin = (out_y * stride_height) - pad_height; - for (int out_x = 0; out_x < output_width; ++out_x) { - const int in_x_origin = (out_x * stride_width) - pad_width; - for (int out_channel = 0; out_channel < output_depth; ++out_channel) { - int32_t acc = 0; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - const int in_y = in_y_origin + dilation_height_factor * filter_y; - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - const int in_x = in_x_origin + dilation_width_factor * filter_x; - - // Zero padding by omitting the areas outside the image. - const bool is_point_inside_image = - (in_x >= 0) && (in_x < input_width) && (in_y >= 0) && - (in_y < input_height); - - if (!is_point_inside_image) { - continue; - } - - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - int32_t input_val = input_data[Offset(input_shape, batch, in_y, - in_x, in_channel)]; - int32_t filter_val = filter_data[Offset( - filter_shape, out_channel, filter_y, filter_x, in_channel)]; - acc += - (filter_val + filter_offset) * (input_val + input_offset); - } - } - } - if (bias_data) { - acc += bias_data[out_channel]; - } - acc = MultiplyByQuantizedMultiplier(acc, output_multiplier, - output_shift); - acc += output_offset; - acc = std::max(acc, output_activation_min); - acc = std::min(acc, output_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, out_channel)] = - static_cast(acc); - } - } - } - } -} - -inline void HybridConvPerChannel( - const ConvParams& params, float* scaling_factors_ptr, - const RuntimeShape& input_shape, const int8_t* input_data, - const RuntimeShape& filter_shape, const int8_t* filter_data, - const RuntimeShape& bias_shape, const float* bias_data, - const RuntimeShape& output_shape, float* output_data, - const RuntimeShape& im2col_shape, int8_t* im2col_data, - const float* per_channel_scale, int32_t* input_offset) { - (void)im2col_data; // only used in optimized code. - (void)im2col_shape; // only used in optimized code. - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - const float output_activation_min = params.float_activation_min; - const float output_activation_max = params.float_activation_max; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3); - const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3); - if (bias_data) { - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - } - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int out_channel = 0; out_channel < output_depth; ++out_channel) { - const int in_x_origin = (out_x * stride_width) - pad_width; - const int in_y_origin = (out_y * stride_height) - pad_height; - int32_t acc = 0; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - const int in_x = in_x_origin + dilation_width_factor * filter_x; - const int in_y = - in_y_origin + dilation_height_factor * filter_y; - // If the location is outside the bounds of the input image, - // use zero as a default value. - if ((in_x >= 0) && (in_x < input_width) && (in_y >= 0) && - (in_y < input_height)) { - int32_t input_val = input_data[Offset( - input_shape, batch, in_y, in_x, in_channel)]; - int32_t filter_val = - filter_data[Offset(filter_shape, out_channel, filter_y, - filter_x, in_channel)]; - acc += filter_val * (input_val - input_offset[batch]); - } - } - } - } - float acc_float = - acc * per_channel_scale[out_channel] * scaling_factors_ptr[batch]; - if (bias_data) { - acc_float += bias_data[out_channel]; - } - output_data[Offset(output_shape, batch, out_y, out_x, out_channel)] = - ActivationFunctionWithMinMax(acc_float, output_activation_min, - output_activation_max); - } - } - } - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CONV_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/densify.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/densify.h deleted file mode 100644 index 71a9a26..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/densify.h +++ /dev/null @@ -1,49 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_DENSIFY_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_DENSIFY_H_ - -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/types.h" -#include "tensorflow/lite/tools/optimize/sparsity/format_converter.h" - -namespace tflite { -namespace reference_ops { - -template -inline void Densify(const TfLiteSparsity* sparsity, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - const int dims_count = output_shape.DimensionsCount(); - std::vector vector_shape(dims_count); - for (int i = 0; i < dims_count; i++) { - vector_shape[i] = output_shape.Dims(i); - } - - tflite::optimize::sparsity::FormatConverter converter(vector_shape, - *sparsity); - converter.SparseToDense(input_data); - const std::vector out = converter.GetData(); - for (int i = 0; i < out.size(); i++) { - output_data[i] = out[i]; - } -} - -} // namespace reference_ops -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_DENSIFY_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/depthwiseconv_float.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/depthwiseconv_float.h deleted file mode 100644 index 0cecb16..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/depthwiseconv_float.h +++ /dev/null @@ -1,100 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_REFERENCE_DEPTHWISECONV_FLOAT_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_DEPTHWISECONV_FLOAT_H_ - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace reference_ops { - -inline void DepthwiseConv( - const DepthwiseParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& filter_shape, - const float* filter_data, const RuntimeShape& bias_shape, - const float* bias_data, const RuntimeShape& output_shape, - float* output_data) { - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - const int depth_multiplier = params.depth_multiplier; - const float output_activation_min = params.float_activation_min; - const float output_activation_max = params.float_activation_max; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int input_depth = input_shape.Dims(3); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier); - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - - for (int b = 0; b < batches; ++b) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int ic = 0; ic < input_depth; ++ic) { - for (int m = 0; m < depth_multiplier; m++) { - const int oc = m + ic * depth_multiplier; - const int in_x_origin = (out_x * stride_width) - pad_width; - const int in_y_origin = (out_y * stride_height) - pad_height; - float total = 0.f; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - const int in_x = in_x_origin + dilation_width_factor * filter_x; - const int in_y = - in_y_origin + dilation_height_factor * filter_y; - // If the location is outside the bounds of the input image, - // use zero as a default value. - if ((in_x >= 0) && (in_x < input_width) && (in_y >= 0) && - (in_y < input_height)) { - float input_value = - input_data[Offset(input_shape, b, in_y, in_x, ic)]; - float filter_value = filter_data[Offset( - filter_shape, 0, filter_y, filter_x, oc)]; - total += (input_value * filter_value); - } - } - } - float bias_value = 0.0f; - if (bias_data) { - bias_value = bias_data[oc]; - } - output_data[Offset(output_shape, b, out_y, out_x, oc)] = - ActivationFunctionWithMinMax(total + bias_value, - output_activation_min, - output_activation_max); - } - } - } - } - } -} - -} // end namespace reference_ops -} // end namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_DEPTHWISECONV_FLOAT_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h deleted file mode 100644 index 20bf83d..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h +++ /dev/null @@ -1,297 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_REFERENCE_DEPTHWISECONV_UINT8_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_DEPTHWISECONV_UINT8_H_ - -#include - -#include "fixedpoint/fixedpoint.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -// Used in tests and template parameters to control which version of depthwise -// convolution is called. Primarily for reference code, and specializations -// forced in tests. -enum class DepthwiseConvImplementation { - // Run all tests against kUseStandardEntry even if also testing another - // kernel, since we need to be sure that the main DepthwiseConv() function in - // optimized_ops.h dispatches to a correctly-executing kernel. - kNone = 0, // The "default" option: use the normal - // DepthwiseConv kernel (entry) function. - kUseGenericKernel, // Forced use of generic kernel. - kUseNeon3x3, // 3x3 kernel that uses NEON when available. - kUseNeon3x3DotProduct, // 3x3 kernel that uses dot-product enabled NEON - // when available. - kUseCModel3x3DotProduct, // 3x3 kernel, reference C model that is intended - // to match overall design NEON code. - kUseUnwound3x3DotProduct, // 3x3 kernel, reference C model with unwound loops - // and some arrays. - kUseIntrinsics3x3DotProduct, // 3x3 kernel using NEON intrinsics. -}; - -// Category of depthwise convolution output rounding. -enum class DepthwiseConvOutputRounding { - kNone = 0, // Invalid: specific method must be specified. - kAwayFromZero, // Original method: exact halves rounded away from zero. - kUpward, // Halves towards +infinity: adds 0.5 before truncate. - // This is where a future kNearestEven would be placed. -}; - -// Category of depthwise convolution depth multiplication. -enum class DepthwiseConvDepthMultiplication { - kNoMultiplication = 0, // Depth multiplier = 1. - kUnitInputDepth, // Input depth = 1, output depth = depth multiplier. -}; - -namespace reference_ops { -namespace depthwise_conv { - -template -inline int32_t DepthwiseConvRound(int32_t x, int32_t quantized_multiplier, - int shift) { - TFLITE_DCHECK_NE(output_rounding, DepthwiseConvOutputRounding::kNone); - return MultiplyByQuantizedMultiplier(x, quantized_multiplier, shift); -} - -template <> -inline int32_t DepthwiseConvRound( - int32_t x, int32_t quantized_multiplier, int shift) { - return MultiplyByQuantizedMultiplier(x, quantized_multiplier, shift); -} - -template <> -inline int32_t DepthwiseConvRound( - int32_t x, int32_t quantized_multiplier, int shift) { - using gemmlowp::SaturatingRoundingDoublingHighMul; - const int left_shift = shift > 0 ? shift : 0; - const int right_shift = shift > 0 ? 0 : -shift; - const int rounding_offset = right_shift > 0 ? 1 << (right_shift - 1) : 0; - return (SaturatingRoundingDoublingHighMul(x * (1 << left_shift), - quantized_multiplier) + - rounding_offset) >> - right_shift; -} - -template -struct DepthwiseConvBasicKernel { - static inline void Run( - const DepthwiseParams& params, const RuntimeShape& input_shape, - const uint8_t* input_data, const RuntimeShape& filter_shape, - const uint8_t* filter_data, const RuntimeShape& bias_shape, - const int32_t* bias_data, const RuntimeShape& output_shape, - uint8_t* output_data) { - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - const int depth_multiplier = params.depth_multiplier; - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - const int32_t input_offset = params.input_offset; - const int32_t filter_offset = params.weights_offset; - const int32_t output_offset = params.output_offset; - const int32_t output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int input_depth = input_shape.Dims(3); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier); - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - - for (int b = 0; b < batches; ++b) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int ic = 0; ic < input_depth; ++ic) { - for (int m = 0; m < depth_multiplier; m++) { - const int oc = m + ic * depth_multiplier; - const int in_x_origin = (out_x * stride_width) - pad_width; - const int in_y_origin = (out_y * stride_height) - pad_height; - int32_t acc = 0; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - const int in_x = - in_x_origin + dilation_width_factor * filter_x; - const int in_y = - in_y_origin + dilation_height_factor * filter_y; - // If the location is outside the bounds of the input image, - // use zero as a default value. - if ((in_x >= 0) && (in_x < input_width) && (in_y >= 0) && - (in_y < input_height)) { - int32_t input_val = - input_data[Offset(input_shape, b, in_y, in_x, ic)]; - int32_t filter_val = filter_data[Offset( - filter_shape, 0, filter_y, filter_x, oc)]; - acc += (filter_val + filter_offset) * - (input_val + input_offset); - } - } - } - if (bias_data) { - acc += bias_data[oc]; - } - acc = DepthwiseConvRound(acc, output_multiplier, - output_shift); - acc += output_offset; - acc = std::max(acc, output_activation_min); - acc = std::min(acc, output_activation_max); - output_data[Offset(output_shape, b, out_y, out_x, oc)] = - static_cast(acc); - } - } - } - } - } - } - - // TODO(b/148596273): Reconcile reference versions, perhaps with common - // MultiplyByQuantizedMultiplier or DepthwiseConvRound function. - static inline void RunPerChannel( - const DepthwiseParams& params, const RuntimeShape& input_shape, - const int8_t* input_data, const RuntimeShape& filter_shape, - const int8_t* filter_data, const RuntimeShape& bias_shape, - const int32_t* bias_data, const RuntimeShape& output_shape, - int8_t* output_data) { - // Get parameters. - // TODO(b/141565753): Re-introduce ScopedProfilingLabel on Micro. - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - const int depth_multiplier = params.depth_multiplier; - const int32_t input_offset = params.input_offset; - const int32_t output_offset = params.output_offset; - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - const int32_t* output_multiplier = params.output_multiplier_per_channel; - const int32_t* output_shift = params.output_shift_per_channel; - - // Check dimensions of the tensors. - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int input_depth = input_shape.Dims(3); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier); - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - for (int m = 0; m < depth_multiplier; ++m) { - const int output_channel = m + in_channel * depth_multiplier; - const int in_x_origin = (out_x * stride_width) - pad_width; - const int in_y_origin = (out_y * stride_height) - pad_height; - int32_t acc = 0; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - const int in_x = - in_x_origin + dilation_width_factor * filter_x; - const int in_y = - in_y_origin + dilation_height_factor * filter_y; - // Zero padding by omitting the areas outside the image. - const bool is_point_inside_image = - (in_x >= 0) && (in_x < input_width) && (in_y >= 0) && - (in_y < input_height); - if (is_point_inside_image) { - int32_t input_val = input_data[Offset( - input_shape, batch, in_y, in_x, in_channel)]; - int32_t filter_val = filter_data[Offset( - filter_shape, 0, filter_y, filter_x, output_channel)]; - // Accumulate with 32 bits accumulator. - // In the nudging process during model quantization, we - // force real value of 0.0 be represented by a quantized - // value. This guarantees that the input_offset is a int8_t, - // even though it is represented using int32_t. int32_t += - // int8_t - // * (int8_t - int8_t) so the highest value we can get from - // each accumulation is [-127, 127] * ([-128, 127] - - // [-128, 127]), which is [-32512, 32512]. log2(32512) - // = 14.98, which means we can accumulate at least 2^16 - // multiplications without overflow. The accumulator is - // applied to a filter so the accumulation logic will hold - // as long as the filter size (filter_y * filter_x * - // in_channel) does not exceed 2^16, which is the case in - // all the models we have seen so far. - acc += filter_val * (input_val + input_offset); - } - } - } - if (bias_data) { - acc += bias_data[output_channel]; - } - acc = DepthwiseConvRound( - acc, output_multiplier[output_channel], - output_shift[output_channel]); - acc += output_offset; - acc = std::max(acc, output_activation_min); - acc = std::min(acc, output_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, - output_channel)] = static_cast(acc); - } - } - } - } - } - } -}; - -} // namespace depthwise_conv - -inline void DepthwiseConv( - const DepthwiseParams& params, const RuntimeShape& input_shape, - const uint8_t* input_data, const RuntimeShape& filter_shape, - const uint8_t* filter_data, const RuntimeShape& bias_shape, - const int32_t* bias_data, const RuntimeShape& output_shape, - uint8_t* output_data) { - return depthwise_conv::DepthwiseConvBasicKernel< - DepthwiseConvOutputRounding::kAwayFromZero>::Run(params, input_shape, - input_data, filter_shape, - filter_data, bias_shape, - bias_data, output_shape, - output_data); -} - -} // namespace reference_ops -} // end namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_DEPTHWISECONV_UINT8_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/dequantize.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/dequantize.h deleted file mode 100644 index b90951f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/dequantize.h +++ /dev/null @@ -1,78 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_DEQUANTIZE_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_DEQUANTIZE_H_ - -#include - -#include - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -// Dequantizes into a float without rounding. -template -inline void Dequantize(const tflite::DequantizationParams& op_params, - const RuntimeShape& input_shape, - const InputT* input_data, - const RuntimeShape& output_shape, OutputT* output_data) { - int32_t zero_point = op_params.zero_point; - const double scale = op_params.scale; - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - const int32_t val = input_data[i]; - const OutputT result = static_cast(scale * (val - zero_point)); - output_data[i] = result; - } -} - -// Dequantizes per-channel quantized tensor to float. -template -inline void PerChannelDequantize( - const tflite::PerChannelDequantizationParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, float* output_data) { - // Ensure flat size is same. - MatchingFlatSize(input_shape, output_shape); - - const int32_t* zero_point = op_params.zero_point; - const float* scale = op_params.scale; - const int32_t quantized_dimension = op_params.quantized_dimension; - const int32_t num_dims = input_shape.DimensionsCount(); - const int32_t* dims_data = input_shape.DimsData(); - std::vector current_dim(num_dims, 0); - - do { - size_t offset = - ReducedOutputOffset(num_dims, reinterpret_cast(dims_data), - current_dim.data(), 0, nullptr); - const int channel = current_dim[quantized_dimension]; - const int32_t val = input_data[offset]; - const float result = - static_cast(scale[channel] * (val - zero_point[channel])); - output_data[offset] = result; - } while (NextIndex(num_dims, reinterpret_cast(dims_data), - current_dim.data())); -} - -} // namespace reference_ops - -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_DEQUANTIZE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/floor.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/floor.h deleted file mode 100644 index 0693fd4..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/floor.h +++ /dev/null @@ -1,39 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ - -#include - -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -inline void Floor(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - int offset = i; - output_data[offset] = std::floor(input_data[offset]); - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FLOOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/fully_connected.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/fully_connected.h deleted file mode 100644 index 39a9cd0..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/fully_connected.h +++ /dev/null @@ -1,320 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_REFERENCE_FULLY_CONNECTED_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FULLY_CONNECTED_H_ - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/quantization_util.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace reference_ops { - -inline void FullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& weights_shape, - const float* weights_data, const RuntimeShape& bias_shape, - const float* bias_data, const RuntimeShape& output_shape, - float* output_data) { - const float output_activation_min = params.float_activation_min; - const float output_activation_max = params.float_activation_max; - // TODO(benoitjacob): This really should be: - // const int batches = ArraySize(output_dims, 1); - // but the current --variable_batch hack consists in overwriting the 3rd - // dimension with the runtime batch size, as we don't keep track for each - // array of which dimension is the batch dimension in it. - const int output_dims_count = output_shape.DimensionsCount(); - const int weights_dims_count = weights_shape.DimensionsCount(); - const int batches = FlatSizeSkipDim(output_shape, output_dims_count - 1); - const int output_depth = MatchingDim(weights_shape, weights_dims_count - 2, - output_shape, output_dims_count - 1); - const int accum_depth = weights_shape.Dims(weights_dims_count - 1); - for (int b = 0; b < batches; ++b) { - for (int out_c = 0; out_c < output_depth; ++out_c) { - float total = 0.f; - for (int d = 0; d < accum_depth; ++d) { - total += input_data[b * accum_depth + d] * - weights_data[out_c * accum_depth + d]; - } - float bias_value = 0.0f; - if (bias_data) { - bias_value = bias_data[out_c]; - } - output_data[out_c + output_depth * b] = ActivationFunctionWithMinMax( - total + bias_value, output_activation_min, output_activation_max); - } - } -} - -inline void FullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const uint8_t* input_data, const RuntimeShape& filter_shape, - const uint8_t* filter_data, const RuntimeShape& bias_shape, - const int32_t* bias_data, const RuntimeShape& output_shape, - uint8_t* output_data) { - const int32_t input_offset = params.input_offset; - const int32_t filter_offset = params.weights_offset; - const int32_t output_offset = params.output_offset; - const int32_t output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_GE(filter_shape.DimensionsCount(), 2); - TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1); - - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - // TODO(benoitjacob): This really should be: - // const int batches = ArraySize(output_dims, 1); - // but the current --variable_batch hack consists in overwriting the 3rd - // dimension with the runtime batch size, as we don't keep track for each - // array of which dimension is the batch dimension in it. - const int output_dim_count = output_shape.DimensionsCount(); - const int filter_dim_count = filter_shape.DimensionsCount(); - const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1); - const int output_depth = MatchingDim(filter_shape, filter_dim_count - 2, - output_shape, output_dim_count - 1); - const int accum_depth = filter_shape.Dims(filter_dim_count - 1); - for (int b = 0; b < batches; ++b) { - for (int out_c = 0; out_c < output_depth; ++out_c) { - int32_t acc = 0; - for (int d = 0; d < accum_depth; ++d) { - int32_t input_val = input_data[b * accum_depth + d]; - int32_t filter_val = filter_data[out_c * accum_depth + d]; - acc += (filter_val + filter_offset) * (input_val + input_offset); - } - if (bias_data) { - acc += bias_data[out_c]; - } - acc = MultiplyByQuantizedMultiplier(acc, output_multiplier, output_shift); - acc += output_offset; - acc = std::max(acc, output_activation_min); - acc = std::min(acc, output_activation_max); - output_data[out_c + output_depth * b] = static_cast(acc); - } - } -} - -inline void FullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const uint8_t* input_data, const RuntimeShape& filter_shape, - const uint8_t* filter_data, const RuntimeShape& bias_shape, - const int32_t* bias_data, const RuntimeShape& output_shape, - int16_t* output_data) { - const int32_t input_offset = params.input_offset; - const int32_t filter_offset = params.weights_offset; - const int32_t output_offset = params.output_offset; - const int32_t output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - TFLITE_DCHECK_EQ(output_offset, 0); - // TODO(benoitjacob): This really should be: - // const int batches = ArraySize(output_dims, 1); - // but the current --variable_batch hack consists in overwriting the 3rd - // dimension with the runtime batch size, as we don't keep track for each - // array of which dimension is the batch dimension in it. - const int output_dim_count = output_shape.DimensionsCount(); - const int filter_dim_count = filter_shape.DimensionsCount(); - const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1); - const int output_depth = MatchingDim(filter_shape, filter_dim_count - 2, - output_shape, output_dim_count - 1); - const int accum_depth = filter_shape.Dims(filter_dim_count - 1); - for (int b = 0; b < batches; ++b) { - for (int out_c = 0; out_c < output_depth; ++out_c) { - // Internal accumulation. - // Initialize accumulator with the bias-value. - int32_t accum = bias_data[out_c]; - // Accumulation loop. - for (int d = 0; d < accum_depth; ++d) { - int16_t input_val = input_data[b * accum_depth + d] + input_offset; - int16_t filter_val = - filter_data[out_c * accum_depth + d] + filter_offset; - accum += filter_val * input_val; - } - // Down-scale the final int32_t accumulator to the scale used by our - // (16-bit, typically 3 integer bits) fixed-point format. The quantized - // multiplier and shift here have been pre-computed offline - // (e.g. by toco). - accum = - MultiplyByQuantizedMultiplier(accum, output_multiplier, output_shift); - // Saturate, cast to int16_t, and store to output array. - accum = std::max(accum, output_activation_min - output_offset); - accum = std::min(accum, output_activation_max - output_offset); - accum += output_offset; - output_data[out_c + output_depth * b] = accum; - } - } -} - -inline void ShuffledFullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const uint8_t* input_data, const RuntimeShape& weights_shape, - const uint8_t* shuffled_weights_data, const RuntimeShape& bias_shape, - const int32_t* bias_data, const RuntimeShape& output_shape, - int16_t* output_data, uint8_t* shuffled_input_workspace_data) { - const int32_t output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - - TFLITE_DCHECK_GE(input_shape.DimensionsCount(), 1); - TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2); - TFLITE_DCHECK_GE(output_shape.DimensionsCount(), 1); - // TODO(benoitjacob): This really should be: - // const int batches = ArraySize(output_dims, 1); - // but the current --variable_batch hack consists in overwriting the 3rd - // dimension with the runtime batch size, as we don't keep track for each - // array of which dimension is the batch dimension in it. - const int output_dim_count = output_shape.DimensionsCount(); - const int weights_dim_count = weights_shape.DimensionsCount(); - const int batches = FlatSizeSkipDim(output_shape, output_dim_count - 1); - const int output_depth = MatchingDim(weights_shape, weights_dim_count - 2, - output_shape, output_dim_count - 1); - const int accum_depth = weights_shape.Dims(weights_dim_count - 1); - TFLITE_DCHECK((accum_depth % 16) == 0); - TFLITE_DCHECK((output_depth % 4) == 0); - - // Shuffling and xoring of input activations into the workspace buffer - uint8_t* shuffled_input_workspace_ptr = shuffled_input_workspace_data; - if (batches == 1) { - for (int i = 0; i < accum_depth; i++) { - shuffled_input_workspace_data[i] = input_data[i] ^ 0x80; - } - } else if (batches == 4) { - for (int c = 0; c < accum_depth; c += 16) { - for (int b = 0; b < 4; b++) { - const uint8_t* src_data_ptr = input_data + b * accum_depth + c; - for (int j = 0; j < 16; j++) { - uint8_t src_val = *src_data_ptr++; - // Flip the sign bit, so that the kernel will only need to - // reinterpret these uint8_t values as int8_t, getting for free the - // subtraction of the zero_point value 128. - uint8_t dst_val = src_val ^ 0x80; - *shuffled_input_workspace_ptr++ = dst_val; - } - } - } - } else { - TFLITE_DCHECK(false); - return; - } - - // Actual computation - if (batches == 1) { - int16_t* output_ptr = output_data; - // Shuffled weights have had their sign bit (0x80) pre-flipped (xor'd) - // so that just reinterpreting them as int8_t values is equivalent to - // subtracting 128 from them, thus implementing for free the subtraction of - // the zero_point value 128. - const int8_t* shuffled_weights_ptr = - reinterpret_cast(shuffled_weights_data); - // Likewise, we preshuffled and pre-xored the input data above. - const int8_t* shuffled_input_data = - reinterpret_cast(shuffled_input_workspace_data); - for (int c = 0; c < output_depth; c += 4) { - // Internal accumulation. - // Initialize accumulator with the bias-value. - int32_t accum[4] = {0}; - // Accumulation loop. - for (int d = 0; d < accum_depth; d += 16) { - for (int i = 0; i < 4; i++) { - for (int j = 0; j < 16; j++) { - int8_t input_val = shuffled_input_data[d + j]; - int8_t weights_val = *shuffled_weights_ptr++; - accum[i] += weights_val * input_val; - } - } - } - for (int i = 0; i < 4; i++) { - // Add bias value - int32_t acc = accum[i] + bias_data[c + i]; - // Down-scale the final int32_t accumulator to the scale used by our - // (16-bit, typically 3 integer bits) fixed-point format. The quantized - // multiplier and shift here have been pre-computed offline - // (e.g. by toco). - acc = - MultiplyByQuantizedMultiplier(acc, output_multiplier, output_shift); - // Saturate, cast to int16_t, and store to output array. - acc = std::max(acc, output_activation_min); - acc = std::min(acc, output_activation_max); - output_ptr[c + i] = acc; - } - } - } else if (batches == 4) { - int16_t* output_ptr = output_data; - // Shuffled weights have had their sign bit (0x80) pre-flipped (xor'd) - // so that just reinterpreting them as int8_t values is equivalent to - // subtracting 128 from them, thus implementing for free the subtraction of - // the zero_point value 128. - const int8_t* shuffled_weights_ptr = - reinterpret_cast(shuffled_weights_data); - // Likewise, we preshuffled and pre-xored the input data above. - const int8_t* shuffled_input_data = - reinterpret_cast(shuffled_input_workspace_data); - for (int c = 0; c < output_depth; c += 4) { - const int8_t* shuffled_input_ptr = shuffled_input_data; - // Accumulation loop. - // Internal accumulation. - // Initialize accumulator with the bias-value. - int32_t accum[4][4]; - for (int i = 0; i < 4; i++) { - for (int b = 0; b < 4; b++) { - accum[i][b] = 0; - } - } - for (int d = 0; d < accum_depth; d += 16) { - for (int i = 0; i < 4; i++) { - for (int b = 0; b < 4; b++) { - for (int j = 0; j < 16; j++) { - int8_t input_val = shuffled_input_ptr[16 * b + j]; - int8_t weights_val = shuffled_weights_ptr[16 * i + j]; - accum[i][b] += weights_val * input_val; - } - } - } - shuffled_input_ptr += 64; - shuffled_weights_ptr += 64; - } - for (int i = 0; i < 4; i++) { - for (int b = 0; b < 4; b++) { - // Add bias value - int32_t acc = accum[i][b] + bias_data[c + i]; - // Down-scale the final int32_t accumulator to the scale used by our - // (16-bit, typically 3 integer bits) fixed-point format. The - // quantized multiplier and shift here have been pre-computed offline - // (e.g. by toco). - acc = MultiplyByQuantizedMultiplier(acc, output_multiplier, - output_shift); - // Saturate, cast to int16_t, and store to output array. - acc = std::max(acc, output_activation_min); - acc = std::min(acc, output_activation_max); - output_ptr[b * output_depth + c + i] = acc; - } - } - } - } else { - TFLITE_DCHECK(false); - return; - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_FULLY_CONNECTED_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/hard_swish.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/hard_swish.h deleted file mode 100644 index cda1b5c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/hard_swish.h +++ /dev/null @@ -1,166 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ACTIVATIONS_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ACTIVATIONS_H_ - -#include "ruy/profiler/instrumentation.h" // from @ruy -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace reference_ops { - -inline int16_t SaturatingLeftShift(int16_t value, int amount) { - int32_t result = static_cast(value) * (1 << amount); - result = std::min(result, std::numeric_limits::max()); - result = std::max(result, std::numeric_limits::min()); - return result; -} - -// Similar to ARM instruction SQDMULH. -// Similar to gemmlowp::SaturatingRoundingDoublingHighMul except -// rounding to zero instead of to nearest (SQRDMULH). -inline std::int16_t SaturatingDoublingHighMul(std::int16_t a, std::int16_t b) { - bool overflow = a == b && a == std::numeric_limits::min(); - std::int32_t a_32(a); - std::int32_t b_32(b); - std::int32_t ab_32 = a_32 * b_32; - std::int16_t ab_x2_high16 = static_cast((ab_32) / (1 << 15)); - return overflow ? std::numeric_limits::max() : ab_x2_high16; -} - -template -inline void HardSwish(const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("ReferenceHardSwish/Float"); - auto matching_size = MatchingFlatSize(input_shape, output_shape); - const T* in_end = input_data + matching_size; - for (; input_data < in_end; input_data++, output_data++) { - const float in = *input_data; - *output_data = - in * std::min(static_cast(6), std::max(static_cast(0), in + 3)) / - 6; - } -} - -template -inline void HardSwish(const HardSwishParams& params, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("ReferenceHardSwish/Quantized"); - - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - const int16_t input_value = input_data[i] - params.input_zero_point; - // Left-shift as much as we can without overflow/saturation to put - // significant bits in the high bits of our 16-bit fixedpoint values, so - // that fixed-point approximate computations below are as accurate as - // possible. - const int16_t input_value_on_hires_input_scale = input_value * (1 << 7); - // Compute the input value on essentially the output scale, just not - // right-shifted yet. This is the value that we'll use in the (x >= +3) - // case, and that in the general case we'll multiply against the "relu-ish" - // fixed-point multiplier in [0, 1]. - const int16_t input_value_on_preshift_output_scale = - gemmlowp::SaturatingRoundingDoublingHighMul( - input_value_on_hires_input_scale, - params.output_multiplier_fixedpoint_int16); - // Now compute the "relu-ish multiplier". In the (-3 <= x <= +3) case, that - // is just an affine rescaling of x from [-3, 3] to [0, 1]. In the general - // case, it is just that plus saturation at the boundaries of [-3, 3]. - // First, we rescale from [-3, 3] to [-1, 1], saturating. - // That is done by rescaling the input value with a fixed-point multiplier - // (reluish_multiplier_fixedpoint) and bit-shift such that we represent - // that input value on the scale where the real value 3.0f is represented - // by the quantized value 32768. (+32768 is actually not representable as - // int16_t, so this saturates at +32767, and that is seen empirically to be - // a negligible contribution to numerical error/bias). - // - // This code is careful to correctly implement any magnitude of multiplier, - // involving either a right shift or a left shift, with correct saturation - // behavior in the left-shift case. This forces this code to be more - // complicated, but is necessary for real applications: a partially - // trained quantized MobileNet v3-small model that motivated this code - // exhibits some large [min, max] range boundaries, of the order of - // magnitude of 10 or 100 depending on layers. - // - // The next few lines are basically just an ordinary - // MultiplyByQuantizedMultiplier, except that we are more careful here - // about the fine details of saturation when left-shifting, because here - // overflow in left-shift is a common case, not an anomaly as - // MultiplyByQuantizedMultiplier assumes. - int16_t reluish_value = input_value_on_hires_input_scale; - // Shift left, saturating, as much as we can while ensuring that this - // saturation will not contribute to the result. That is, left shift amount - // reduced by 1. - if (params.reluish_multiplier_exponent > 0) { - reluish_value = SaturatingLeftShift( - reluish_value, params.reluish_multiplier_exponent - 1); - } - // Apply the fixed-point multiplier, dividing the value by a divisor - // ranging in [1, 2]. - reluish_value = gemmlowp::SaturatingRoundingDoublingHighMul( - reluish_value, params.reluish_multiplier_fixedpoint_int16); - // Apply the last bit of left-shift. Thus, in the left-shifting case, if - // any saturation affects the result, it is happening here --- any - // saturation having occurred above is overwritten here, not affecting the - // result. - if (params.reluish_multiplier_exponent > 0) { - reluish_value = SaturatingLeftShift(reluish_value, 1); - } - // Shift right, in the right-shifting case. - if (params.reluish_multiplier_exponent < 0) { - reluish_value = gemmlowp::RoundingDivideByPOT( - reluish_value, -params.reluish_multiplier_exponent); - } - // At this point we have rescaled the value into a 16bit fixedpoint - // reluish_value in [-1, 1]. - // We now convert that to a 16bit fixedpoint value in [0, 1]. - reluish_value = (reluish_value + (1 << 15)) >> 1; - // Use of SaturatingDoublingHighMul here is important to cancel the biases - // from the above SaturatingRoundingDoublingHighMul. - // - // On a partially trained MobileNet-v3-small, - // - // | bias on | ImageNet - // | quantized | Top-1 - // Operation used here | values | accuracy (50k) - // --------------------------------------+------------+----------- - // SaturatingDoublingHighMul | -0.0024 | 58.920 - // SaturatingRoundingDoublingHighMul | -0.0067 | 58.064 - // - // In activations_test, this is covered by this testcase: - // QuantizedActivationsOpTest.HardSwishBias - // - const int16_t preshift_output_value = SaturatingDoublingHighMul( - reluish_value, input_value_on_preshift_output_scale); - // We were so far operating on the pre-shift output scale. Now we finally - // apply that output shift, arriving at the final output scale. - int16_t output_value = gemmlowp::RoundingDivideByPOT( - preshift_output_value, -params.output_multiplier_exponent); - output_value += params.output_zero_point; - output_value = - std::min(output_value, std::numeric_limits::max()); - output_value = - std::max(output_value, std::numeric_limits::min()); - output_data[i] = output_value; - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_CONV_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/add.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/add.h deleted file mode 100644 index 2af6f37..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/add.h +++ /dev/null @@ -1,145 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_ADD_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_ADD_H_ - -#include - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace reference_integer_ops { - -inline void CheckArithmeticParams(const ArithmeticParams& params) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - // Input offset is negative input zero point. Activation tensors are - // asymmetric quantized so they span the full int8 range. - TFLITE_DCHECK_GE(-params.input1_offset, std::numeric_limits::min()); - TFLITE_DCHECK_GE(-params.input2_offset, std::numeric_limits::min()); - TFLITE_DCHECK_LE(-params.input1_offset, std::numeric_limits::max()); - TFLITE_DCHECK_LE(-params.input2_offset, std::numeric_limits::max()); -} - -// Element-wise add that can often be used for inner loop of broadcast add as -// well as the non-broadcast add. -inline void AddElementwise(int size, const ArithmeticParams& params, - const int8_t* input1_data, const int8_t* input2_data, - int8_t* output_data) { - CheckArithmeticParams(params); - - for (int i = 0; i < size; ++i) { - const int32_t input1_val = params.input1_offset + input1_data[i]; - const int32_t input2_val = params.input2_offset + input2_data[i]; - const int32_t shifted_input1_val = input1_val * (1 << params.left_shift); - const int32_t shifted_input2_val = input2_val * (1 << params.left_shift); - const int32_t scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, params.input1_multiplier, params.input1_shift); - const int32_t scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, params.input2_multiplier, params.input2_shift); - const int32_t raw_sum = scaled_input1_val + scaled_input2_val; - const int32_t raw_output = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - raw_sum, params.output_multiplier, params.output_shift) + - params.output_offset; - const int32_t clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, raw_output)); - output_data[i] = static_cast(clamped_output); - } -} - -inline void Add(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int8_t* input1_data, - const RuntimeShape& input2_shape, const int8_t* input2_data, - const RuntimeShape& output_shape, int8_t* output_data) { - CheckArithmeticParams(params); - - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - AddElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -inline void BroadcastAdd4DSlow(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const int8_t* input1_data, - const RuntimeShape& input2_shape, - const int8_t* input2_data, - const RuntimeShape& output_shape, - int8_t* output_data) { - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - const RuntimeShape extended_output_shape = - RuntimeShape::ExtendedShape(4, output_shape); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - for (int b = 0; b < extended_output_shape.Dims(0); ++b) { - for (int y = 0; y < extended_output_shape.Dims(1); ++y) { - for (int x = 0; x < extended_output_shape.Dims(2); ++x) { - for (int c = 0; c < extended_output_shape.Dims(3); ++c) { - const int32_t input1_val = - params.input1_offset + - input1_data[SubscriptToIndex(desc1, b, y, x, c)]; - const int32_t input2_val = - params.input2_offset + - input2_data[SubscriptToIndex(desc2, b, y, x, c)]; - const int32_t shifted_input1_val = - input1_val * (1 << params.left_shift); - const int32_t shifted_input2_val = - input2_val * (1 << params.left_shift); - const int32_t scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, params.input1_multiplier, - params.input1_shift); - const int32_t scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, params.input2_multiplier, - params.input2_shift); - const int32_t raw_sum = scaled_input1_val + scaled_input2_val; - const int32_t raw_output = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - raw_sum, params.output_multiplier, params.output_shift) + - params.output_offset; - const int32_t clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, raw_output)); - output_data[Offset(extended_output_shape, b, y, x, c)] = - static_cast(clamped_output); - } - } - } - } -} - -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_ADD_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h deleted file mode 100644 index 3e9cd0c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/conv.h +++ /dev/null @@ -1,221 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_CONV_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_CONV_H_ - -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { -namespace reference_integer_ops { - -// Fixed-point per-channel-quantization convolution reference kernel. -inline void ConvPerChannel( - const ConvParams& params, const int32_t* output_multiplier, - const int32_t* output_shift, const RuntimeShape& input_shape, - const int8_t* input_data, const RuntimeShape& filter_shape, - const int8_t* filter_data, const RuntimeShape& bias_shape, - const int32_t* bias_data, const RuntimeShape& output_shape, - int8_t* output_data) { - // Get parameters. - const int32_t input_offset = params.input_offset; // r = s(q - Z) - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - const int32_t output_offset = params.output_offset; - - // Set min and max value of the output. - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - - // Consistency check. - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3); - const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3); - if (bias_data) { - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - } - - // Check dimensions of the tensors. - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - const int in_y_origin = (out_y * stride_height) - pad_height; - for (int out_x = 0; out_x < output_width; ++out_x) { - const int in_x_origin = (out_x * stride_width) - pad_width; - for (int out_channel = 0; out_channel < output_depth; ++out_channel) { - int32_t acc = 0; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - const int in_y = in_y_origin + dilation_height_factor * filter_y; - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - const int in_x = in_x_origin + dilation_width_factor * filter_x; - - // Zero padding by omitting the areas outside the image. - const bool is_point_inside_image = - (in_x >= 0) && (in_x < input_width) && (in_y >= 0) && - (in_y < input_height); - - if (!is_point_inside_image) { - continue; - } - - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - int32_t input_val = input_data[Offset(input_shape, batch, in_y, - in_x, in_channel)]; - int32_t filter_val = filter_data[Offset( - filter_shape, out_channel, filter_y, filter_x, in_channel)]; - // Accumulate with 32 bits accumulator. - // In the nudging process during model quantization, we force - // real value of 0.0 be represented by a quantized value. This - // guarantees that the input_offset is a int8_t, even though - // it is represented using int32_t. int32_t += int8_t * - // (int8_t - int8_t) so the highest value we can get from each - // accumulation is [-127, 127] * ([-128, 127] - - // [-128, 127]), which is [-32512, 32512]. log2(32512) - // = 14.98, which means we can accumulate at least 2^16 - // multiplications without overflow. The accumulator is - // applied to a filter so the accumulation logic will hold as - // long as the filter size (filter_y * filter_x * in_channel) - // does not exceed 2^16, which is the case in all the models - // we have seen so far. - // TODO(jianlijianli): Add a check to make sure the - // accumulator depth is smaller than 2^16. - acc += filter_val * (input_val + input_offset); - } - } - } - - if (bias_data) { - acc += bias_data[out_channel]; - } - acc = MultiplyByQuantizedMultiplier( - acc, output_multiplier[out_channel], output_shift[out_channel]); - acc += output_offset; - acc = std::max(acc, output_activation_min); - acc = std::min(acc, output_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, out_channel)] = - static_cast(acc); - } - } - } - } -} - -// Fixed-point per-channel-quantization convolution reference kernel. -// 16-bit data and 8-bit filter -inline void ConvPerChannel( - const ConvParams& params, const int32_t* output_multiplier, - const int32_t* output_shift, const RuntimeShape& input_shape, - const int16_t* input_data, const RuntimeShape& filter_shape, - const int8_t* filter_data, const RuntimeShape& bias_shape, - const std::int64_t* bias_data, const RuntimeShape& output_shape, - int16_t* output_data) { - // Get parameters. - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - - // Set min and max value of the output. - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - - // Consistency check. - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3); - const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3); - if (bias_data) { - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - } - - // Check dimensions of the tensors. - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - const int in_y_origin = (out_y * stride_height) - pad_height; - for (int out_x = 0; out_x < output_width; ++out_x) { - const int in_x_origin = (out_x * stride_width) - pad_width; - for (int out_channel = 0; out_channel < output_depth; ++out_channel) { - std::int64_t acc = 0; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - const int in_y = in_y_origin + dilation_height_factor * filter_y; - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - const int in_x = in_x_origin + dilation_width_factor * filter_x; - - // Zero padding by omitting the areas outside the image. - const bool is_point_inside_image = - (in_x >= 0) && (in_x < input_width) && (in_y >= 0) && - (in_y < input_height); - - if (!is_point_inside_image) { - continue; - } - - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - int32_t input_val = input_data[Offset(input_shape, batch, in_y, - in_x, in_channel)]; - int32_t filter_val = filter_data[Offset( - filter_shape, out_channel, filter_y, filter_x, in_channel)]; - // Accumulate with 64 bits accumulator. - // int64_t += int8_t * int16_t so the highest value we can - // get from each accumulation is [-127, 127] * ([-32768, - // 32767] - - // [-32768, 32767]), which is [-8322945, 8322945]. - // log2(8322945) = 22.99. - acc += filter_val * input_val; - } - } - } - if (bias_data) { - acc += bias_data[out_channel]; - } - int32_t scaled_acc = MultiplyByQuantizedMultiplier( - acc, output_multiplier[out_channel], output_shift[out_channel]); - scaled_acc = std::max(scaled_acc, output_activation_min); - scaled_acc = std::min(scaled_acc, output_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, out_channel)] = - static_cast(scaled_acc); - } - } - } - } -} - -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_CONV_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/depthwise_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/depthwise_conv.h deleted file mode 100644 index 6f54e47..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/depthwise_conv.h +++ /dev/null @@ -1,289 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_DEPTHWISE_CONV_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_DEPTHWISE_CONV_H_ - -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { -namespace reference_integer_ops { -inline void DepthwiseConvPerChannel( - const DepthwiseParams& params, const int32_t* output_multiplier, - const int32_t* output_shift, const RuntimeShape& input_shape, - const int8_t* input_data, const RuntimeShape& filter_shape, - const int8_t* filter_data, const RuntimeShape& bias_shape, - const int32_t* bias_data, const RuntimeShape& output_shape, - int8_t* output_data) { - // Get parameters. - // TODO(b/141565753): Re-introduce ScopedProfilingLabel on Micro. - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - const int depth_multiplier = params.depth_multiplier; - const int32_t input_offset = params.input_offset; - const int32_t output_offset = params.output_offset; - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - - // Check dimensions of the tensors. - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int input_depth = input_shape.Dims(3); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier); - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - for (int m = 0; m < depth_multiplier; ++m) { - const int output_channel = m + in_channel * depth_multiplier; - const int in_x_origin = (out_x * stride_width) - pad_width; - const int in_y_origin = (out_y * stride_height) - pad_height; - int32_t acc = 0; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - const int in_x = in_x_origin + dilation_width_factor * filter_x; - const int in_y = - in_y_origin + dilation_height_factor * filter_y; - // Zero padding by omitting the areas outside the image. - const bool is_point_inside_image = - (in_x >= 0) && (in_x < input_width) && (in_y >= 0) && - (in_y < input_height); - if (is_point_inside_image) { - int32_t input_val = input_data[Offset( - input_shape, batch, in_y, in_x, in_channel)]; - int32_t filter_val = filter_data[Offset( - filter_shape, 0, filter_y, filter_x, output_channel)]; - // Accumulate with 32 bits accumulator. - // In the nudging process during model quantization, we force - // real value of 0.0 be represented by a quantized value. This - // guarantees that the input_offset is a int8_t, even though - // it is represented using int32_t. int32_t += int8_t * - // (int8_t - int8_t) so the highest value we can get from each - // accumulation is [-127, 127] * ([-128, 127] - - // [-128, 127]), which is [-32512, 32512]. log2(32512) - // = 14.98, which means we can accumulate at least 2^16 - // multiplications without overflow. The accumulator is - // applied to a filter so the accumulation logic will hold as - // long as the filter size (filter_y * filter_x * in_channel) - // does not exceed 2^16, which is the case in all the models - // we have seen so far. - // TODO(jianlijianli): Add a check to make sure the - // accumulator depth is smaller than 2^16. - acc += filter_val * (input_val + input_offset); - } - } - } - if (bias_data) { - acc += bias_data[output_channel]; - } - acc = MultiplyByQuantizedMultiplier( - acc, output_multiplier[output_channel], - output_shift[output_channel]); - acc += output_offset; - acc = std::max(acc, output_activation_min); - acc = std::min(acc, output_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, - output_channel)] = static_cast(acc); - } - } - } - } - } -} - -inline void DepthwiseConvPerChannel( - const DepthwiseParams& params, const int32_t* output_multiplier, - const int32_t* output_shift, const RuntimeShape& input_shape, - const int16_t* input_data, const RuntimeShape& filter_shape, - const int8_t* filter_data, const RuntimeShape& bias_shape, - const std::int64_t* bias_data, const RuntimeShape& output_shape, - int16_t* output_data) { - // Get parameters. - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - const int depth_multiplier = params.depth_multiplier; - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - - // Check dimensions of the tensors. - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int input_depth = input_shape.Dims(3); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier); - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - for (int m = 0; m < depth_multiplier; ++m) { - const int output_channel = m + in_channel * depth_multiplier; - const int in_x_origin = (out_x * stride_width) - pad_width; - const int in_y_origin = (out_y * stride_height) - pad_height; - std::int64_t acc = 0; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - const int in_x = in_x_origin + dilation_width_factor * filter_x; - const int in_y = - in_y_origin + dilation_height_factor * filter_y; - // Zero padding by omitting the areas outside the image. - const bool is_point_inside_image = - (in_x >= 0) && (in_x < input_width) && (in_y >= 0) && - (in_y < input_height); - if (is_point_inside_image) { - int32_t input_val = input_data[Offset( - input_shape, batch, in_y, in_x, in_channel)]; - int32_t filter_val = filter_data[Offset( - filter_shape, 0, filter_y, filter_x, output_channel)]; - // Accumulate with 64 bits accumulator. - // We assume maximum of 2^16 accumulations as with the 8-bit - // case so actually the value in the accumulator should not - // exceed 40 bits - acc += static_cast(filter_val) * - static_cast(input_val); - } - } - } - if (bias_data) { - acc += bias_data[output_channel]; - } - int32_t scaled_acc = MultiplyByQuantizedMultiplier( - acc, output_multiplier[output_channel], - output_shift[output_channel]); - scaled_acc = std::max(scaled_acc, output_activation_min); - scaled_acc = std::min(scaled_acc, output_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, - output_channel)] = - static_cast(scaled_acc); - } - } - } - } - } -} - -inline void DepthwiseConvHybridPerChannel( - const DepthwiseParams& params, float* scaling_factors_ptr, - const RuntimeShape& input_shape, const int8_t* input_data, - const RuntimeShape& filter_shape, const int8_t* filter_data, - const RuntimeShape& bias_shape, const float* bias_data, - const RuntimeShape& output_shape, float* output_data, - const float* per_channel_scale, int32_t* input_offset) { - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int dilation_width_factor = params.dilation_width_factor; - const int dilation_height_factor = params.dilation_height_factor; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - const int depth_multiplier = params.depth_multiplier; - const float output_activation_min = params.float_activation_min; - const float output_activation_max = params.float_activation_max; - // Check dimensions of the tensors. - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int output_depth = MatchingDim(filter_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int input_depth = input_shape.Dims(3); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int bias_depth = bias_shape.FlatSize(); - TFLITE_DCHECK_EQ(output_depth, input_depth * depth_multiplier); - TFLITE_DCHECK_EQ(bias_depth, output_depth); - - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - for (int m = 0; m < depth_multiplier; ++m) { - const int output_channel = m + in_channel * depth_multiplier; - const int in_x_origin = (out_x * stride_width) - pad_width; - const int in_y_origin = (out_y * stride_height) - pad_height; - int32_t acc = 0; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - const int in_x = in_x_origin + dilation_width_factor * filter_x; - const int in_y = - in_y_origin + dilation_height_factor * filter_y; - // Zero padding by omitting the areas outside the image. - const bool is_point_inside_image = - (in_x >= 0) && (in_x < input_width) && (in_y >= 0) && - (in_y < input_height); - if (is_point_inside_image) { - int32_t input_val = input_data[Offset( - input_shape, batch, in_y, in_x, in_channel)]; - int32_t filter_val = filter_data[Offset( - filter_shape, 0, filter_y, filter_x, output_channel)]; - acc += filter_val * (input_val - input_offset[batch]); - } - } - } - float acc_float = static_cast(acc); - acc_float *= - per_channel_scale[output_channel] * scaling_factors_ptr[batch]; - if (bias_data && output_channel < bias_depth) { - acc_float += bias_data[output_channel]; - } - output_data[Offset(output_shape, batch, out_y, out_x, - output_channel)] = - ActivationFunctionWithMinMax(acc_float, output_activation_min, - output_activation_max); - } - } - } - } - } -} - -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_DEPTHWISE_CONV_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/dequantize.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/dequantize.h deleted file mode 100644 index ae846fa..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/dequantize.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright 2018 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_DEQUANTIZE_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_DEQUANTIZE_H_ - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace reference_integer_ops { - -template -inline void Dequantize(const tflite::DequantizationParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, float* output_data) { - const int32 zero_point = op_params.zero_point; - const double scale = op_params.scale; - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - const int32 val = static_cast(input_data[i]); - const float result = static_cast(scale * (val - zero_point)); - output_data[i] = result; - } -} - -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_DEQUANTIZE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/fully_connected.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/fully_connected.h deleted file mode 100644 index 2bc3e79..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/fully_connected.h +++ /dev/null @@ -1,108 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_FULLY_CONNECTED_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_FULLY_CONNECTED_H_ - -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { -namespace reference_integer_ops { - -inline void FullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const int8_t* input_data, const RuntimeShape& filter_shape, - const int8_t* filter_data, const RuntimeShape& bias_shape, - const int32_t* bias_data, const RuntimeShape& output_shape, - int8_t* output_data) { - const int32_t input_offset = params.input_offset; - const int32_t filter_offset = params.weights_offset; - const int32_t output_offset = params.output_offset; - const int32_t output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_GE(filter_shape.DimensionsCount(), 2); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 2); - - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - const int filter_dim_count = filter_shape.DimensionsCount(); - const int batches = output_shape.Dims(0); - const int output_depth = output_shape.Dims(1); - TFLITE_DCHECK_LE(output_depth, filter_shape.Dims(filter_dim_count - 2)); - const int accum_depth = filter_shape.Dims(filter_dim_count - 1); - for (int b = 0; b < batches; ++b) { - for (int out_c = 0; out_c < output_depth; ++out_c) { - int32_t acc = 0; - for (int d = 0; d < accum_depth; ++d) { - int32_t input_val = input_data[b * accum_depth + d]; - int32_t filter_val = filter_data[out_c * accum_depth + d]; - acc += (filter_val + filter_offset) * (input_val + input_offset); - } - if (bias_data) { - acc += bias_data[out_c]; - } - acc = MultiplyByQuantizedMultiplier(acc, output_multiplier, output_shift); - acc += output_offset; - acc = std::max(acc, output_activation_min); - acc = std::min(acc, output_activation_max); - output_data[out_c + output_depth * b] = static_cast(acc); - } - } -} - -inline void FullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const int16_t* input_data, const RuntimeShape& filter_shape, - const int8_t* filter_data, const RuntimeShape& bias_shape, - const int64_t* bias_data, const RuntimeShape& output_shape, - int16_t* output_data) { - const int32_t filter_offset = params.weights_offset; - const int32_t output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32_t output_activation_min = params.quantized_activation_min; - const int32_t output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_GE(filter_shape.DimensionsCount(), 2); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 2); - - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - const int filter_dim_count = filter_shape.DimensionsCount(); - const int batches = output_shape.Dims(0); - const int output_depth = output_shape.Dims(1); - TFLITE_DCHECK_LE(output_depth, filter_shape.Dims(filter_dim_count - 2)); - const int accum_depth = filter_shape.Dims(filter_dim_count - 1); - for (int b = 0; b < batches; ++b) { - for (int out_c = 0; out_c < output_depth; ++out_c) { - int64_t acc = 0; - for (int d = 0; d < accum_depth; ++d) { - int32_t input_val = input_data[b * accum_depth + d]; - int32_t filter_val = filter_data[out_c * accum_depth + d]; - acc += (filter_val + filter_offset) * input_val; - } - if (bias_data) { - acc += bias_data[out_c]; - } - int32_t acc_scaled = - MultiplyByQuantizedMultiplier(acc, output_multiplier, output_shift); - acc_scaled = std::max(acc_scaled, output_activation_min); - acc_scaled = std::min(acc_scaled, output_activation_max); - output_data[out_c + output_depth * b] = static_cast(acc_scaled); - } - } -} - -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_FULLY_CONNECTED_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/l2normalization.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/l2normalization.h deleted file mode 100644 index 31f2de9..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/l2normalization.h +++ /dev/null @@ -1,65 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_L2NORMALIZATION_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_L2NORMALIZATION_H_ - -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { -namespace reference_integer_ops { - -inline void L2Normalization(int32_t input_zero_point, int32_t outer_size, - int32_t depth, const int8_t* input_data, - int8_t* output_data) { - static constexpr int8_t kMinInt8 = std::numeric_limits::min(); - static constexpr int8_t kMaxInt8 = std::numeric_limits::max(); - // The output scale must be in sync with Prepare(). - // Output is in 1/128 scale so the actual output range is nudged from [-1, 1] - // to [-1, 127/128]. - static constexpr int32_t kOutputScale = 7; - for (int outer_index = 0; outer_index < outer_size; ++outer_index) { - // int32_t = (int8_t - int8_t) ^ 2. - // ([-128, 127] - [-128, 127]) ^ 2 = [0, (2^8 - 1)^2] so the accumulator is - // safe from overflowing in at least 2^16 steps. - int32_t acc = 0; - for (int inner_index = 0; inner_index < depth; ++inner_index) { - int32_t input = - input_data[depth * outer_index + inner_index] - input_zero_point; - acc += input * input; - } - int32_t inv_l2norm_multiplier; - int inv_l2norm_shift; - GetInvSqrtQuantizedMultiplierExp(acc, kReverseShift, &inv_l2norm_multiplier, - &inv_l2norm_shift); - - for (int inner_index = 0; inner_index < depth; ++inner_index) { - int32_t input = - input_data[depth * outer_index + inner_index] - input_zero_point; - - // Rescale and downcast. Rescale is folded into the division. - int32_t output_in_q24 = MultiplyByQuantizedMultiplier( - input, inv_l2norm_multiplier, inv_l2norm_shift + kOutputScale); - output_in_q24 = - std::min(static_cast(kMaxInt8), - std::max(static_cast(kMinInt8), output_in_q24)); - output_data[depth * outer_index + inner_index] = - static_cast(output_in_q24); - } - } -} -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_L2NORMALIZATION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/log_softmax.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/log_softmax.h deleted file mode 100644 index f22bb4f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/log_softmax.h +++ /dev/null @@ -1,111 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_LOG_SOFTMAX_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_LOG_SOFTMAX_H_ - -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { -namespace reference_integer_ops { - -inline void LogSoftmax(int32_t input_multiplier, int32_t input_shift, - int32_t reverse_multiplier, int32_t reverse_shift, - int32_t diff_min, int32_t outer_size, int32_t depth, - const int8* input_data, int8* output_data) { - static constexpr int8_t kMinInt8 = std::numeric_limits::min(); - static constexpr int8_t kMaxInt8 = std::numeric_limits::max(); - static constexpr int32_t kMinInt32 = std::numeric_limits::min(); - - // [-16, 0] is mapped to [-128, 127] with 1/16 as scale and 127 as zero - // point. This nudges the output to [-255/16, 0]. - static constexpr int32_t kOutputZeroPoint = 127; - - // All IntegerBits must agree with Prepare function. - // Input is chosen as Q5.26 so exp(-1 * 2^5 * 2^-1) = exp(-16) is negligible. - static constexpr int kInputIntegerBits = 5; - static constexpr int kAccumulationIntegerBits = 12; - static constexpr int kOutputIntegerBits = 4; - using F5 = gemmlowp::FixedPoint; - using F12 = gemmlowp::FixedPoint; - - for (int outer_index = 0; outer_index < outer_size; ++outer_index) { - int8 max_in_row = kMinInt8; - for (int inner_index = 0; inner_index < depth; ++inner_index) { - max_in_row = - std::max(max_in_row, input_data[outer_index * depth + inner_index]); - } - - // Accumulator "sum_of_exps_in_q12" is safe from overflowing in 2^12 steps. - F12 sum_of_exps_in_q12 = F12::FromRaw(0); - for (int inner_index = 0; inner_index < depth; ++inner_index) { - int32_t input_diff = - static_cast(input_data[outer_index * depth + inner_index]) - - max_in_row; - if (input_diff >= diff_min) { - const int32_t input_diff_in_q5 = MultiplyByQuantizedMultiplier( - input_diff, input_multiplier, input_shift); - sum_of_exps_in_q12 = - sum_of_exps_in_q12 + - gemmlowp::Rescale( - exp_on_negative_values(F5::FromRaw(input_diff_in_q5))); - } - } - - const int32_t log_sum_of_exps_in_q5 = - log_x_for_x_greater_than_or_equal_to_1( - sum_of_exps_in_q12) - .raw(); - - // Potentially reduced the valid range. shifted_log_sum_of_exps_in_q5 is - // smallest representable in Q5.26 plus the log_sum_of_exps. - const int32_t shifted_log_sum_of_exps_in_q5 = - log_sum_of_exps_in_q5 + kMinInt32; - const int32_t adjusted_diff_min = std::max( - diff_min - 1, - MultiplyByQuantizedMultiplier(shifted_log_sum_of_exps_in_q5, - reverse_multiplier, -reverse_shift)); - - for (int inner_index = 0; inner_index < depth; ++inner_index) { - int32_t input_diff = - static_cast(input_data[outer_index * depth + inner_index]) - - max_in_row; - // Note use of > below instead of >= above. - if (input_diff > adjusted_diff_min) { - const int32_t input_diff_in_q5 = MultiplyByQuantizedMultiplier( - input_diff, input_multiplier, input_shift); - - // Rescale and downcast. - int32_t output_in_q27 = - gemmlowp::RoundingDivideByPOT( - (input_diff_in_q5 - log_sum_of_exps_in_q5), - 31 - kInputIntegerBits - kOutputIntegerBits) + - kOutputZeroPoint; - - output_in_q27 = - std::max(std::min(output_in_q27, static_cast(kMaxInt8)), - static_cast(kMinInt8)); - output_data[outer_index * depth + inner_index] = - static_cast(output_in_q27); - } else { - output_data[outer_index * depth + inner_index] = kMinInt8; - } - } - } -} - -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_LOG_SOFTMAX_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/logistic.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/logistic.h deleted file mode 100644 index e315683..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/logistic.h +++ /dev/null @@ -1,99 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_LOGISTIC_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_LOGISTIC_H_ - -#include -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { -namespace reference_integer_ops { - -inline void Logistic(int32_t input_zero_point, int32_t input_range_radius, - int32_t input_multiplier, int32_t input_left_shift, - int32_t input_size, const int8_t* input_data, - int8_t* output_data) { - // Integer bits must be in sync with Prepare() function. - static constexpr int32_t kInputIntegerBits = 4; - static constexpr int32_t kOutputIntegerBits = 8; - static constexpr int8_t kMinInt8 = std::numeric_limits::min(); - static constexpr int8_t kMaxInt8 = std::numeric_limits::max(); - static constexpr int32_t kOutputZeroPoint = -128; - - for (int i = 0; i < input_size; ++i) { - const int32_t input = - static_cast(input_data[i]) - input_zero_point; - if (input <= -input_range_radius) { - output_data[i] = kMinInt8; - } else if (input >= input_range_radius) { - output_data[i] = kMaxInt8; - } else { - const int32_t input_in_q4 = MultiplyByQuantizedMultiplier( - input, input_multiplier, input_left_shift); - using FixedPoint4 = gemmlowp::FixedPoint; - const int32_t output_in_q0 = - gemmlowp::logistic(FixedPoint4::FromRaw(input_in_q4)).raw(); - - // Rescale and downcast. - using gemmlowp::RoundingDivideByPOT; - int32_t output_in_q23 = - RoundingDivideByPOT(output_in_q0, 31 - kOutputIntegerBits); - output_in_q23 = std::min(std::max(output_in_q23 + kOutputZeroPoint, - static_cast(kMinInt8)), - static_cast(kMaxInt8)); - output_data[i] = static_cast(output_in_q23); - } - } -} - -inline void Logistic(int32_t input_multiplier, int32_t input_size, - const int16_t* ptr_input_data, int16_t* ptr_output_data) { - // We use the LUT for sigmoid and take into account, that - // tanh(x) = 2*sigmoid(2*x) - 1 - - int32_t input_data_mul = (input_multiplier > 0) ? input_multiplier : 1; - - for (int i = 0; i < input_size; ++i, ptr_input_data++, ptr_output_data++) { - int32_t input_data = (*ptr_input_data) * input_data_mul; - - // Scale by 3/4 to expand range [-8,8]->[-10.7,10.7] and - // we do interpolation on unsigned values. - uint32_t abs_input_data = 3 * abs(input_data); - - // We divide by 2 power of 9, because - // we need to divide by 2 in power of 7 for - // the input conversion + 1/4 from the scale above. - uint8_t uh = abs_input_data >> 9; - uint32_t ua = sigmoid_table_uint16[uh]; - uint32_t ub = sigmoid_table_uint16[uh + 1]; - uint32_t ut = abs_input_data & 0x1ff; - - // Interpolation is done using the fractional bit. - uint32_t result = (ua << 9) + ut * (ub - ua); - - result = (input_data >= 0) ? (result + (1 << 9)) - : ((1 << (16 + 9)) - result + (1 << 9) - 1); - - // Back to 16-bit. - result >>= 10; - - *ptr_output_data = result; - } -} - -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_LOGISTIC_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/mean.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/mean.h deleted file mode 100644 index bd48427..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/mean.h +++ /dev/null @@ -1,77 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_MEAN_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_MEAN_H_ - -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { -namespace reference_integer_ops { - -template -inline void Mean(const tflite::MeanParams& op_params, int32_t multiplier, - int32_t shift, const RuntimeShape& unextended_input_shape, - const integer_type* input_data, int32_t input_zero_point, - const RuntimeShape& unextended_output_shape, - integer_type* output_data, int32_t output_zero_point) { - // Current implementation only supports dimension equals 4 and simultaneous - // reduction over width and height. - TFLITE_CHECK_EQ(unextended_input_shape.DimensionsCount(), 4); - TFLITE_CHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - const int output_batch = output_shape.Dims(0); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int output_depth = output_shape.Dims(3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int num_elements_in_axis = input_width * input_height; - - TFLITE_CHECK_EQ(op_params.axis_count, 2); - TFLITE_CHECK((op_params.axis[0] == 1 && op_params.axis[1] == 2) || - (op_params.axis[0] == 2 && op_params.axis[1] == 1)); - TFLITE_CHECK_EQ(output_height, 1); - TFLITE_CHECK_EQ(output_width, 1); - - static constexpr int32_t kMinInt = std::numeric_limits::min(); - static constexpr int32_t kMaxInt = std::numeric_limits::max(); - - for (int out_b = 0; out_b < output_batch; ++out_b) { - for (int out_d = 0; out_d < output_depth; ++out_d) { - int32_t acc = 0; - for (int in_h = 0; in_h < input_height; ++in_h) { - for (int in_w = 0; in_w < input_width; ++in_w) { - acc += input_data[Offset(input_shape, out_b, in_h, in_w, out_d)] - - input_zero_point; - } - } - acc = MultiplyByQuantizedMultiplier(acc, multiplier, shift); - acc = acc > 0 ? (acc + num_elements_in_axis / 2) / num_elements_in_axis - : (acc - num_elements_in_axis / 2) / num_elements_in_axis; - acc += output_zero_point; - acc = std::min(std::max(acc, kMinInt), kMaxInt); - output_data[Offset(output_shape, out_b, 0, 0, out_d)] = - static_cast(acc); - } - } -} - -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_MEAN_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/mul.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/mul.h deleted file mode 100644 index b80838a..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/mul.h +++ /dev/null @@ -1,131 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_MUL_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_MUL_H_ - -#include "fixedpoint/fixedpoint.h" -#include "ruy/profiler/instrumentation.h" // from @ruy -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { -namespace reference_integer_ops { - -template -inline void MulElementwise(int size, const ArithmeticParams& params, - const T* input1_data, const T* input2_data, - T* output_data) { - for (int i = 0; i < size; ++i) { - const int32_t input1_val = params.input1_offset + input1_data[i]; - const int32_t input2_val = params.input2_offset + input2_data[i]; - const int32_t unclamped_result = - params.output_offset + - MultiplyByQuantizedMultiplier(input1_val * input2_val, - params.output_multiplier, - params.output_shift); - const int32_t clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, unclamped_result)); - output_data[i] = static_cast(clamped_output); - } -} - -template -inline void Mul(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const T* input1_data, - const RuntimeShape& input2_shape, const T* input2_data, - const RuntimeShape& output_shape, T* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - ruy::profiler::ScopeLabel label("Mul/8bit"); - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - MulElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -// Mul with 16 bit inputs and int8_t outputs. -inline void Mul(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int16_t* input1_data, - const RuntimeShape& input2_shape, const int16_t* input2_data, - const RuntimeShape& output_shape, int8_t* output_data) { - ruy::profiler::ScopeLabel label("Mul/Int16Int8"); - int32_t output_offset = params.output_offset; - int32_t output_activation_min = params.quantized_activation_min; - int32_t output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - // F0 uses 0 integer bits, range [-1, 1]. - using F0 = gemmlowp::FixedPoint; - - F0 unclamped_result = - F0::FromRaw(input1_data[i]) * F0::FromRaw(input2_data[i]); - int16_t rescaled_result = - gemmlowp::RoundingDivideByPOT(unclamped_result.raw(), 8); - int16_t clamped_result = std::min( - output_activation_max - output_offset, rescaled_result); - clamped_result = std::max(output_activation_min - output_offset, - clamped_result); - output_data[i] = output_offset + clamped_result; - } -} - -template -inline void BroadcastMul4DSlow( - const ArithmeticParams& params, const RuntimeShape& input1_shape, - const T* input1_data, const RuntimeShape& input2_shape, - const T* input2_data, const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("BroadcastMul4DSlow"); - - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - // The input shapes are extended as part of NdArrayDesc initialization. - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - const RuntimeShape extended_output_shape = - RuntimeShape::ExtendedShape(4, output_shape); - - for (int b = 0; b < extended_output_shape.Dims(0); ++b) { - for (int y = 0; y < extended_output_shape.Dims(1); ++y) { - for (int x = 0; x < extended_output_shape.Dims(2); ++x) { - for (int c = 0; c < extended_output_shape.Dims(3); ++c) { - const int32_t input1_val = - params.input1_offset + - input1_data[SubscriptToIndex(desc1, b, y, x, c)]; - const int32_t input2_val = - params.input2_offset + - input2_data[SubscriptToIndex(desc2, b, y, x, c)]; - const int32_t unclamped_result = - params.output_offset + - MultiplyByQuantizedMultiplier(input1_val * input2_val, - params.output_multiplier, - params.output_shift); - const int32_t clamped_output = std::min( - params.quantized_activation_max, - std::max(params.quantized_activation_min, unclamped_result)); - output_data[Offset(extended_output_shape, b, y, x, c)] = - static_cast(clamped_output); - } - } - } - } -} - -} // namespace reference_integer_ops -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_MUL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/pooling.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/pooling.h deleted file mode 100644 index 2cb4dad..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/pooling.h +++ /dev/null @@ -1,262 +0,0 @@ -/* Copyright 2018 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_POOLING_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_POOLING_H_ - -#include -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { -namespace reference_integer_ops { - -inline bool AveragePool(const PoolParams& params, - const RuntimeShape& input_shape, - const int8_t* input_data, - const RuntimeShape& output_shape, int8_t* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int channel = 0; channel < depth; ++channel) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - // Compute the boundaries of the filter region clamped so as to - // ensure that the filter window fits in the input array. - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - int32_t acc = 0; - int filter_count = 0; - for (int filter_y = filter_y_start; filter_y < filter_y_end; - ++filter_y) { - for (int filter_x = filter_x_start; filter_x < filter_x_end; - ++filter_x) { - const int in_x = in_x_origin + filter_x; - const int in_y = in_y_origin + filter_y; - acc += - input_data[Offset(input_shape, batch, in_y, in_x, channel)]; - filter_count++; - } - } - if (filter_count == 0) return false; - // Round to the closest integer value. - acc = acc > 0 ? (acc + filter_count / 2) / filter_count - : (acc - filter_count / 2) / filter_count; - acc = std::max(acc, params.quantized_activation_min); - acc = std::min(acc, params.quantized_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, channel)] = - static_cast(acc); - } - } - } - } - return true; -} - -inline void MaxPool(const PoolParams& params, const RuntimeShape& input_shape, - const int8_t* input_data, const RuntimeShape& output_shape, - int8_t* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - TFLITE_DCHECK_GE(params.quantized_activation_min, - std::numeric_limits::min()); - TFLITE_DCHECK_LE(params.quantized_activation_max, - std::numeric_limits::max()); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int channel = 0; channel < depth; ++channel) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - // Compute the boundaries of the filter region clamped so as to - // ensure that the filter window fits in the input array. - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - int8_t max = std::numeric_limits::lowest(); - for (int filter_y = filter_y_start; filter_y < filter_y_end; - ++filter_y) { - for (int filter_x = filter_x_start; filter_x < filter_x_end; - ++filter_x) { - const int in_x = in_x_origin + filter_x; - const int in_y = in_y_origin + filter_y; - max = std::max( - max, - input_data[Offset(input_shape, batch, in_y, in_x, channel)]); - } - } - max = std::max(max, params.quantized_activation_min); - max = std::min(max, params.quantized_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, channel)] = - static_cast(max); - } - } - } - } -} - -inline bool AveragePool(const PoolParams& params, - const RuntimeShape& input_shape, - const int16_t* input_data, - const RuntimeShape& output_shape, - int16_t* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int channel = 0; channel < depth; ++channel) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - // Compute the boundaries of the filter region clamped so as to - // ensure that the filter window fits in the input array. - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - int32_t acc = 0; - int filter_count = 0; - for (int filter_y = filter_y_start; filter_y < filter_y_end; - ++filter_y) { - for (int filter_x = filter_x_start; filter_x < filter_x_end; - ++filter_x) { - const int in_x = in_x_origin + filter_x; - const int in_y = in_y_origin + filter_y; - acc += - input_data[Offset(input_shape, batch, in_y, in_x, channel)]; - filter_count++; - } - } - if (filter_count == 0) return false; - // Round to the closest integer value. - acc = acc > 0 ? (acc + filter_count / 2) / filter_count - : (acc - filter_count / 2) / filter_count; - acc = std::max(acc, params.quantized_activation_min); - acc = std::min(acc, params.quantized_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, channel)] = - static_cast(acc); - } - } - } - } - return true; -} - -inline void MaxPool(const PoolParams& params, const RuntimeShape& input_shape, - const int16_t* input_data, const RuntimeShape& output_shape, - int16_t* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - TFLITE_DCHECK_GE(params.quantized_activation_min, - std::numeric_limits::min()); - TFLITE_DCHECK_LE(params.quantized_activation_max, - std::numeric_limits::max()); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int channel = 0; channel < depth; ++channel) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - // Compute the boundaries of the filter region clamped so as to - // ensure that the filter window fits in the input array. - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - int16_t max = std::numeric_limits::lowest(); - for (int filter_y = filter_y_start; filter_y < filter_y_end; - ++filter_y) { - for (int filter_x = filter_x_start; filter_x < filter_x_end; - ++filter_x) { - const int in_x = in_x_origin + filter_x; - const int in_y = in_y_origin + filter_y; - max = std::max( - max, - input_data[Offset(input_shape, batch, in_y, in_x, channel)]); - } - } - max = std::max(max, params.quantized_activation_min); - max = std::min(max, params.quantized_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, channel)] = - static_cast(max); - } - } - } - } -} - -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_POOLING_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/tanh.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/tanh.h deleted file mode 100644 index 81ff34f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/tanh.h +++ /dev/null @@ -1,110 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_TANH_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_TANH_H_ - -#include - -#include "fixedpoint/fixedpoint.h" -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { -namespace reference_integer_ops { - -inline void Tanh(int32_t input_zero_point, int32_t input_range_radius, - int32_t input_multiplier, int32_t input_shift, - const RuntimeShape& input_shape, const int8_t* input_data, - const RuntimeShape& output_shape, int8_t* output_data) { - // Integer bits must be in sync with Prepare() function. - static constexpr int32_t kInputIntegerBits = 4; - static constexpr int32_t kOutputScale = 7; - static constexpr int32_t kMinInt8 = std::numeric_limits::min(); - static constexpr int32_t kMaxInt8 = std::numeric_limits::max(); - using F4 = gemmlowp::FixedPoint; - - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; ++i) { - const int32_t input = - static_cast(input_data[i]) - input_zero_point; - if (input <= -input_range_radius) { - output_data[i] = kMinInt8; - } else if (input >= input_range_radius) { - output_data[i] = kMaxInt8; - } else { - const int32_t input_in_q4 = - MultiplyByQuantizedMultiplier(input, input_multiplier, input_shift); - const int32_t output_in_q0 = - gemmlowp::tanh(F4::FromRaw(input_in_q4)).raw(); - - // Rescale and downcast. - using gemmlowp::RoundingDivideByPOT; - int32_t output_in_q24 = - RoundingDivideByPOT(output_in_q0, 31 - kOutputScale); - output_in_q24 = std::min(std::max(output_in_q24, kMinInt8), kMaxInt8); - output_data[i] = static_cast(output_in_q24); - } - } -} - -inline void Tanh(int32_t input_multiplier, int32_t input_left_shift, - const RuntimeShape& input_shape, const int16_t* ptr_input_data, - const RuntimeShape& output_shape, int16_t* ptr_output_data) { - // We use the LUT for sigmoid and take into account, that - // tanh(x) = 2*sigmoid(2*x) - 1 - - int32_t input_data_mul = (input_multiplier > 0) ? input_multiplier : 1; - - int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; ++i, ptr_input_data++, ptr_output_data++) { - int32_t input_data = (*ptr_input_data) * input_data_mul; - - if (input_left_shift == 1) { - input_data <<= 1; - } - - // Scale by 3/4 to expand range [-8,8]->[-10.7,10.7]. - uint32_t abs_input_data = 3 * abs(input_data); - uint32_t uh = abs_input_data >> 8; - int32_t result; - - if (uh >= 255) { - // Saturate to maximum. - result = 0xFFFF << 8; - } else { - uint32_t ua = sigmoid_table_uint16[uh]; - uint32_t ub = sigmoid_table_uint16[uh + 1]; - - uint8_t ut = abs_input_data & 0xFF; - - result = (ua << 8) + ut * (ub - ua); - } - - result = (input_data >= 0) - ? (result - (1 << (14 + 9)) + (1 << (9 - 2))) - : (-result + (1 << (14 + 9)) + (1 << (9 - 2)) - 1); - - // Convert back to 16-bit. - result >>= (9 - 1); - - *ptr_output_data = result; - } -} - -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_TANH_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/transpose_conv.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/transpose_conv.h deleted file mode 100644 index f28b7cb..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/integer_ops/transpose_conv.h +++ /dev/null @@ -1,221 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_TRANSPOSE_CONV_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_TRANSPOSE_CONV_H_ - -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { -namespace reference_integer_ops { - -// Fixed-point per-channel-quantization transpose convolution reference kernel. -inline void TransposeConv( - const ConvParams& params, const int32* output_multiplier, - const int32* output_shift, const RuntimeShape& input_shape, - const int8* input_data, const RuntimeShape& filter_shape, - const int8* filter_data, const RuntimeShape& bias_shape, - const int32* bias_data, const RuntimeShape& output_shape, int8* output_data, - const RuntimeShape& im2col_shape, int8* im2col_data, - int32* scratch_buffer) { - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - (void)im2col_data; // only used in optimized code. - (void)im2col_shape; // only used in optimized code. - - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3); - const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3); - if (bias_data) { - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - } - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int32 input_offset = params.input_offset; - const int32 output_offset = params.output_offset; - const int32 output_activation_min = std::numeric_limits::min(); - const int32 output_activation_max = std::numeric_limits::max(); - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - - const int num_elements = output_shape.FlatSize(); - // We need to initialize scratch_buffer to all 0s, as we apply the same - // 'scatter' based trick as in float version. - memset(scratch_buffer, 0, num_elements * sizeof(int32)); - - // Loop through input elements one at a time. - for (int batch = 0; batch < batches; ++batch) { - for (int in_y = 0; in_y < input_height; ++in_y) { - for (int in_x = 0; in_x < input_width; ++in_x) { - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - // Loop through the output elements it will influence. - const int out_x_origin = (in_x * stride_width) - pad_width; - const int out_y_origin = (in_y * stride_height) - pad_height; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - for (int out_channel = 0; out_channel < output_depth; - ++out_channel) { - // Compute output element location. - const int out_x = out_x_origin + filter_x; - const int out_y = out_y_origin + filter_y; - // We cannot accumulate out of bounds. - if ((out_x >= 0) && (out_x < output_width) && (out_y >= 0) && - (out_y < output_height)) { - const int8 input_value = input_data[Offset( - input_shape, batch, in_y, in_x, in_channel)]; - const int8 filter_value = - filter_data[Offset(filter_shape, out_channel, filter_y, - filter_x, in_channel)]; - scratch_buffer[Offset(output_shape, batch, out_y, out_x, - out_channel)] += - (input_value + input_offset) * filter_value; - } - } - } - } - } - } - } - } - - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int out_channel = 0; out_channel < output_depth; ++out_channel) { - int32 acc = scratch_buffer[Offset(output_shape, batch, out_y, out_x, - out_channel)]; - if (bias_data) { - acc += bias_data[out_channel]; - } - acc = MultiplyByQuantizedMultiplier( - acc, output_multiplier[out_channel], output_shift[out_channel]); - acc += output_offset; - acc = std::max(acc, output_activation_min); - acc = std::min(acc, output_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, out_channel)] = - static_cast(acc); - } - } - } - } -} - -// int16 input (zero_point=0), int8 filter, int64 accumulator -inline void TransposeConv( - const ConvParams& params, const int32* output_multiplier, - const int32* output_shift, const RuntimeShape& input_shape, - const int16* input_data, const RuntimeShape& filter_shape, - const int8* filter_data, const RuntimeShape& bias_shape, - const std::int64_t* bias_data, const RuntimeShape& output_shape, - int16* output_data, const RuntimeShape& im2col_shape, int8* im2col_data, - std::int64_t* scratch_buffer) { - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - (void)im2col_data; // only used in optimized code. - (void)im2col_shape; // only used in optimized code. - - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3); - const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3); - if (bias_data) { - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - } - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int32 output_activation_min = std::numeric_limits::min(); - const int32 output_activation_max = std::numeric_limits::max(); - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - - const int num_elements = output_shape.FlatSize(); - // We need to initialize scratch_buffer to all 0s, as we apply the same - // 'scatter' based trick as in float version. - memset(scratch_buffer, 0, num_elements * sizeof(std::int64_t)); - - // Loop through input elements one at a time. - for (int batch = 0; batch < batches; ++batch) { - for (int in_y = 0; in_y < input_height; ++in_y) { - for (int in_x = 0; in_x < input_width; ++in_x) { - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - // Loop through the output elements it will influence. - const int out_x_origin = (in_x * stride_width) - pad_width; - const int out_y_origin = (in_y * stride_height) - pad_height; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - for (int out_channel = 0; out_channel < output_depth; - ++out_channel) { - // Compute output element location. - const int out_x = out_x_origin + filter_x; - const int out_y = out_y_origin + filter_y; - // We cannot accumulate out of bounds. - if ((out_x >= 0) && (out_x < output_width) && (out_y >= 0) && - (out_y < output_height)) { - const int32 input_value = input_data[Offset( - input_shape, batch, in_y, in_x, in_channel)]; - const int32 filter_value = - filter_data[Offset(filter_shape, out_channel, filter_y, - filter_x, in_channel)]; - scratch_buffer[Offset(output_shape, batch, out_y, out_x, - out_channel)] += - input_value * filter_value; - } - } - } - } - } - } - } - } - - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int out_channel = 0; out_channel < output_depth; ++out_channel) { - std::int64_t acc = scratch_buffer[Offset(output_shape, batch, out_y, - out_x, out_channel)]; - if (bias_data) { - acc += bias_data[out_channel]; - } - int32 scaled_acc = MultiplyByQuantizedMultiplier( - acc, output_multiplier[out_channel], output_shift[out_channel]); - scaled_acc = std::max(scaled_acc, output_activation_min); - scaled_acc = std::min(scaled_acc, output_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, out_channel)] = - static_cast(scaled_acc); - } - } - } - } -} - -} // namespace reference_integer_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_INTEGER_OPS_TRANSPOSE_CONV_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/l2normalization.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/l2normalization.h deleted file mode 100644 index 7587d2b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/l2normalization.h +++ /dev/null @@ -1,90 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_L2NORMALIZATION_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_L2NORMALIZATION_H_ - -#include -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -inline void L2Normalization(const tflite::L2NormalizationParams& op_params, - const RuntimeShape& input_shape, - const float* input_data, - const RuntimeShape& output_shape, - float* output_data, float epsilon = 1e-6) { - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int outer_size = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int depth = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - for (int i = 0; i < outer_size; ++i) { - float squared_l2_norm = 0; - for (int c = 0; c < depth; ++c) { - const float val = input_data[depth * i + c]; - squared_l2_norm += val * val; - } - float l2_norm = std::sqrt(squared_l2_norm); - l2_norm = std::max(l2_norm, epsilon); - for (int c = 0; c < depth; ++c) { - output_data[depth * i + c] = input_data[depth * i + c] / l2_norm; - } - } -} - -inline void L2Normalization(const tflite::L2NormalizationParams& op_params, - const RuntimeShape& input_shape, - const uint8_t* input_data, - const RuntimeShape& output_shape, - uint8_t* output_data) { - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int depth = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - const int outer_size = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int32_t input_zero_point = op_params.input_zero_point; - - for (int i = 0; i < outer_size; ++i) { - int32_t square_l2_norm = 0; - for (int c = 0; c < depth; c++) { - int32_t diff = input_data[depth * i + c] - input_zero_point; - square_l2_norm += diff * diff; - } - int32_t inv_l2norm_multiplier; - int inv_l2norm_shift; - GetInvSqrtQuantizedMultiplierExp(square_l2_norm, kReverseShift, - &inv_l2norm_multiplier, &inv_l2norm_shift); - for (int c = 0; c < depth; c++) { - int32_t diff = input_data[depth * i + c] - input_zero_point; - int32_t rescaled_diff = MultiplyByQuantizedMultiplierSmallerThanOneExp( - 128 * diff, inv_l2norm_multiplier, inv_l2norm_shift); - int32_t unclamped_output_val = 128 + rescaled_diff; - int32_t output_val = - std::min(static_cast(255), - std::max(static_cast(0), unclamped_output_val)); - output_data[depth * i + c] = static_cast(output_val); - } - } -} - -} // namespace reference_ops -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_L2NORMALIZATION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/legacy_reference_ops.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/legacy_reference_ops.h deleted file mode 100644 index 88309ea..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/legacy_reference_ops.h +++ /dev/null @@ -1,2212 +0,0 @@ -/* Copyright 2018 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_KERNELS_INTERNAL_REFERENCE_LEGACY_REFERENCE_OPS_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_LEGACY_REFERENCE_OPS_H_ - -#include -#include - -#include "public/gemmlowp.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/legacy_types.h" -#include "tensorflow/lite/kernels/internal/reference/conv.h" -#include "tensorflow/lite/kernels/internal/reference/depthwiseconv_float.h" -#include "tensorflow/lite/kernels/internal/reference/depthwiseconv_uint8.h" -#include "tensorflow/lite/kernels/internal/reference/reference_ops.h" -#include "tensorflow/lite/kernels/internal/reference/tanh.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -static constexpr int kDepthwiseReverseShift = -1; - -inline void ShapeFromDims(const tflite::Dims<4>& dims, RuntimeShape* shape) { - shape->BuildFrom( - {dims.sizes[3], dims.sizes[2], dims.sizes[1], dims.sizes[0]}); -} - -inline void DepthwiseConv(const float* input_data, const Dims<4>& input_dims, - const float* filter_data, const Dims<4>& filter_dims, - const float* bias_data, const Dims<4>& bias_dims, - int stride_width, int stride_height, - int dilation_width_factor, int dilation_height_factor, - int pad_width, int pad_height, int depth_multiplier, - float output_activation_min, - float output_activation_max, float* output_data, - const Dims<4>& output_dims) { - tflite::DepthwiseParams op_params; - // Padding type is ignored, but still set. - op_params.padding_type = PaddingType::kSame; - op_params.padding_values.width = pad_width; - op_params.padding_values.height = pad_height; - op_params.stride_width = stride_width; - op_params.stride_height = stride_height; - op_params.dilation_width_factor = dilation_width_factor; - op_params.dilation_height_factor = dilation_height_factor; - op_params.depth_multiplier = depth_multiplier; - op_params.float_activation_min = output_activation_min; - op_params.float_activation_max = output_activation_max; - - DepthwiseConv(op_params, DimsToShape(input_dims), input_data, - DimsToShape(filter_dims), filter_data, DimsToShape(bias_dims), - bias_data, DimsToShape(output_dims), output_data); -} - -inline void DepthwiseConv(const float* input_data, const Dims<4>& input_dims, - const float* filter_data, const Dims<4>& filter_dims, - const float* bias_data, const Dims<4>& bias_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int depth_multiplier, - float output_activation_min, - float output_activation_max, float* output_data, - const Dims<4>& output_dims) { - DepthwiseConv(input_data, input_dims, filter_data, filter_dims, bias_data, - bias_dims, stride_width, stride_height, 1, 1, pad_width, - pad_height, depth_multiplier, output_activation_min, - output_activation_max, output_data, output_dims); -} - -// Legacy, for compatibility with old checked-in code. -template -void DepthwiseConv(const float* input_data, const Dims<4>& input_dims, - const float* filter_data, const Dims<4>& filter_dims, - const float* bias_data, const Dims<4>& bias_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int depth_multiplier, float* output_data, - const Dims<4>& output_dims) { - float output_activation_min, output_activation_max; - GetActivationMinMax(Ac, &output_activation_min, &output_activation_max); - DepthwiseConv(input_data, input_dims, filter_data, filter_dims, bias_data, - bias_dims, stride_width, stride_height, pad_width, pad_height, - depth_multiplier, output_activation_min, output_activation_max, - output_data, output_dims); -} - -// Legacy, for compatibility with old checked-in code. -template -void DepthwiseConv(const float* input_data, const Dims<4>& input_dims, - const float* filter_data, const Dims<4>& filter_dims, - const float* bias_data, const Dims<4>& bias_dims, int stride, - int pad_width, int pad_height, int depth_multiplier, - float* output_data, const Dims<4>& output_dims) { - DepthwiseConv(input_data, input_dims, filter_data, filter_dims, bias_data, - bias_dims, stride, stride, pad_width, pad_height, - depth_multiplier, output_data, output_dims); -} - -inline void DepthwiseConv(const uint8* input_data, const Dims<4>& input_dims, - int32 input_offset, const uint8* filter_data, - const Dims<4>& filter_dims, int32 filter_offset, - const int32* bias_data, const Dims<4>& bias_dims, - int stride_width, int stride_height, - int dilation_width_factor, int dilation_height_factor, - int pad_width, int pad_height, int depth_multiplier, - int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims) { - tflite::DepthwiseParams op_params; - // Padding type is ignored, but still set. - op_params.padding_type = PaddingType::kSame; - op_params.padding_values.width = pad_width; - op_params.padding_values.height = pad_height; - op_params.stride_width = stride_width; - op_params.stride_height = stride_height; - op_params.dilation_width_factor = dilation_width_factor; - op_params.dilation_height_factor = dilation_height_factor; - op_params.depth_multiplier = depth_multiplier; - op_params.quantized_activation_min = output_activation_min; - op_params.quantized_activation_max = output_activation_max; - op_params.input_offset = input_offset; - op_params.weights_offset = filter_offset; - op_params.output_offset = output_offset; - op_params.output_multiplier = output_multiplier; - // Legacy ops used mixed left and right shifts. Now all are +ve-means-left. - op_params.output_shift = kDepthwiseReverseShift * output_shift; - - DepthwiseConv(op_params, DimsToShape(input_dims), input_data, - DimsToShape(filter_dims), filter_data, DimsToShape(bias_dims), - bias_data, DimsToShape(output_dims), output_data); -} - -inline void DepthwiseConv(const uint8* input_data, const Dims<4>& input_dims, - int32 input_offset, const uint8* filter_data, - const Dims<4>& filter_dims, int32 filter_offset, - const int32* bias_data, const Dims<4>& bias_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int depth_multiplier, - int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims) { - DepthwiseConv(input_data, input_dims, input_offset, filter_data, filter_dims, - filter_offset, bias_data, bias_dims, stride_width, - stride_height, 1, 1, pad_width, pad_height, depth_multiplier, - output_offset, output_multiplier, output_shift, - output_activation_min, output_activation_max, output_data, - output_dims); -} - -// Legacy, for compatibility with old checked-in code. -template -void DepthwiseConv(const uint8* input_data, const Dims<4>& input_dims, - int32 input_offset, const uint8* filter_data, - const Dims<4>& filter_dims, int32 filter_offset, - const int32* bias_data, const Dims<4>& bias_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int depth_multiplier, int32 output_offset, - int32 output_multiplier, int output_shift, - int32 output_activation_min, int32 output_activation_max, - uint8* output_data, const Dims<4>& output_dims) { - if (Ac == FusedActivationFunctionType::kNone) { - TFLITE_DCHECK_EQ(output_activation_min, 0); - TFLITE_DCHECK_EQ(output_activation_max, 255); - } - DepthwiseConv(input_data, input_dims, input_offset, filter_data, filter_dims, - filter_offset, bias_data, bias_dims, stride_width, - stride_height, pad_width, pad_height, depth_multiplier, - output_offset, output_multiplier, output_shift, - output_activation_min, output_activation_max, output_data, - output_dims); -} - -// Legacy, for compatibility with old checked-in code. -template -void DepthwiseConv(const uint8* input_data, const Dims<4>& input_dims, - int32 input_offset, const uint8* filter_data, - const Dims<4>& filter_dims, int32 filter_offset, - const int32* bias_data, const Dims<4>& bias_dims, int stride, - int pad_width, int pad_height, int depth_multiplier, - int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims) { - DepthwiseConv(input_data, input_dims, input_offset, filter_data, - filter_dims, filter_offset, bias_data, bias_dims, stride, - stride, pad_width, pad_height, depth_multiplier, - output_offset, output_multiplier, output_shift, - output_activation_min, output_activation_max, output_data, - output_dims); -} - -inline void Conv(const float* input_data, const Dims<4>& input_dims, - const float* filter_data, const Dims<4>& filter_dims, - const float* bias_data, const Dims<4>& bias_dims, - int stride_width, int stride_height, int dilation_width_factor, - int dilation_height_factor, int pad_width, int pad_height, - float output_activation_min, float output_activation_max, - float* output_data, const Dims<4>& output_dims, - float* im2col_data, const Dims<4>& im2col_dims) { - tflite::ConvParams op_params; - // Padding type is ignored, but still set. - op_params.padding_type = PaddingType::kSame; - op_params.padding_values.width = pad_width; - op_params.padding_values.height = pad_height; - op_params.stride_width = stride_width; - op_params.stride_height = stride_height; - op_params.dilation_width_factor = dilation_width_factor; - op_params.dilation_height_factor = dilation_height_factor; - op_params.float_activation_min = output_activation_min; - op_params.float_activation_max = output_activation_max; - - Conv(op_params, DimsToShape(input_dims), input_data, DimsToShape(filter_dims), - filter_data, DimsToShape(bias_dims), bias_data, DimsToShape(output_dims), - output_data, DimsToShape(im2col_dims), im2col_data); -} - -template -void Conv(const float* input_data, const Dims<4>& input_dims, - const float* filter_data, const Dims<4>& filter_dims, - const float* bias_data, const Dims<4>& bias_dims, int stride_width, - int stride_height, int dilation_width_factor, - int dilation_height_factor, int pad_width, int pad_height, - float* output_data, const Dims<4>& output_dims, float* im2col_data, - const Dims<4>& im2col_dims) { - float output_activation_min, output_activation_max; - GetActivationMinMax(Ac, &output_activation_min, &output_activation_max); - Conv(input_data, input_dims, filter_data, filter_dims, bias_data, bias_dims, - stride_width, stride_height, dilation_width_factor, - dilation_height_factor, pad_width, pad_height, output_activation_min, - output_activation_max, output_data, output_dims, im2col_data, - im2col_dims); -} - -// legacy, for compatibility with old checked-in code -template -void Conv(const float* input_data, const Dims<4>& input_dims, - const float* filter_data, const Dims<4>& filter_dims, - const float* bias_data, const Dims<4>& bias_dims, int stride_width, - int stride_height, int pad_width, int pad_height, float* output_data, - const Dims<4>& output_dims, float* im2col_data, - const Dims<4>& im2col_dims) { - float output_activation_min, output_activation_max; - GetActivationMinMax(Ac, &output_activation_min, &output_activation_max); - Conv(input_data, input_dims, filter_data, filter_dims, bias_data, bias_dims, - stride_width, stride_height, 1, 1, pad_width, pad_height, - output_activation_min, output_activation_max, output_data, output_dims, - im2col_data, im2col_dims); -} - -// legacy, for compatibility with old checked-in code -template -void Conv(const float* input_data, const Dims<4>& input_dims, - const float* filter_data, const Dims<4>& filter_dims, - const float* bias_data, const Dims<4>& bias_dims, int stride, - int pad_width, int pad_height, float* output_data, - const Dims<4>& output_dims, float* im2col_data, - const Dims<4>& im2col_dims) { - Conv(input_data, input_dims, filter_data, filter_dims, bias_data, - bias_dims, stride, stride, 1, 1, pad_width, pad_height, output_data, - output_dims, im2col_data, im2col_dims); -} - -inline void Conv(const uint8* input_data, const Dims<4>& input_dims, - int32 input_offset, const uint8* filter_data, - const Dims<4>& filter_dims, int32 filter_offset, - const int32* bias_data, const Dims<4>& bias_dims, - int stride_width, int stride_height, int dilation_width_factor, - int dilation_height_factor, int pad_width, int pad_height, - int32 output_offset, int32 output_multiplier, int output_shift, - int32 output_activation_min, int32 output_activation_max, - uint8* output_data, const Dims<4>& output_dims, - uint8* im2col_data, const Dims<4>& im2col_dims, - gemmlowp::GemmContext* gemmlowp_context) { - tflite::ConvParams op_params; - // Padding type is ignored, but still set. - op_params.padding_type = PaddingType::kSame; - op_params.padding_values.width = pad_width; - op_params.padding_values.height = pad_height; - op_params.stride_width = stride_width; - op_params.stride_height = stride_height; - op_params.dilation_width_factor = dilation_width_factor; - op_params.dilation_height_factor = dilation_height_factor; - op_params.input_offset = input_offset; - op_params.weights_offset = filter_offset; - op_params.output_offset = output_offset; - op_params.output_multiplier = output_multiplier; - // Legacy ops used mixed left and right shifts. Now all are +ve-means-left. - op_params.output_shift = kReverseShift * output_shift; - op_params.quantized_activation_min = output_activation_min; - op_params.quantized_activation_max = output_activation_max; - - Conv(op_params, DimsToShape(input_dims), input_data, DimsToShape(filter_dims), - filter_data, DimsToShape(bias_dims), bias_data, DimsToShape(output_dims), - output_data, DimsToShape(im2col_dims), im2col_data, gemmlowp_context); -} - -inline void Conv(const uint8* input_data, const Dims<4>& input_dims, - int32 input_offset, const uint8* filter_data, - const Dims<4>& filter_dims, int32 filter_offset, - const int32* bias_data, const Dims<4>& bias_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims, uint8* im2col_data, - const Dims<4>& im2col_dims, - gemmlowp::GemmContext* gemmlowp_context) { - Conv(input_data, input_dims, input_offset, filter_data, filter_dims, - filter_offset, bias_data, bias_dims, stride_width, stride_height, 1, 1, - pad_width, pad_height, output_offset, output_multiplier, output_shift, - output_activation_min, output_activation_max, output_data, output_dims, - im2col_data, im2col_dims, gemmlowp_context); -} - -// legacy, for compatibility with old checked-in code -template -inline void Conv(const uint8* input_data, const Dims<4>& input_dims, - int32 input_offset, const uint8* filter_data, - const Dims<4>& filter_dims, int32 filter_offset, - const int32* bias_data, const Dims<4>& bias_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims, uint8* im2col_data, - const Dims<4>& im2col_dims, - gemmlowp::GemmContext* gemmlowp_context) { - static_assert(Ac == FusedActivationFunctionType::kNone || - Ac == FusedActivationFunctionType::kRelu || - Ac == FusedActivationFunctionType::kRelu6 || - Ac == FusedActivationFunctionType::kRelu1, - ""); - if (Ac == FusedActivationFunctionType::kNone) { - TFLITE_DCHECK_EQ(output_activation_min, 0); - TFLITE_DCHECK_EQ(output_activation_max, 255); - } - Conv(input_data, input_dims, input_offset, filter_data, filter_dims, - filter_offset, bias_data, bias_dims, stride_width, stride_height, - pad_width, pad_height, output_offset, output_multiplier, output_shift, - output_activation_min, output_activation_max, output_data, output_dims, - im2col_data, im2col_dims, gemmlowp_context); -} - -// legacy, for compatibility with old checked-in code -template -void Conv(const uint8* input_data, const Dims<4>& input_dims, - int32 input_offset, const uint8* filter_data, - const Dims<4>& filter_dims, int32 filter_offset, - const int32* bias_data, const Dims<4>& bias_dims, int stride, - int pad_width, int pad_height, int32 output_offset, - int32 output_multiplier, int output_shift, - int32 output_activation_min, int32 output_activation_max, - uint8* output_data, const Dims<4>& output_dims, uint8* im2col_data, - const Dims<4>& im2col_dims, gemmlowp::GemmContext* gemmlowp_context) { - Conv(input_data, input_dims, input_offset, filter_data, filter_dims, - filter_offset, bias_data, bias_dims, stride, stride, pad_width, - pad_height, output_offset, output_multiplier, output_shift, - output_activation_min, output_activation_max, output_data, - output_dims, im2col_data, im2col_dims, gemmlowp_context); -} - -inline void TransposeConv(const float* input_data, const Dims<4>& input_dims, - const float* filter_data, const Dims<4>& filter_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, float* output_data, - const Dims<4>& output_dims, float* im2col_data, - const Dims<4>& im2col_dims) { - tflite::ConvParams op_params; - // Padding type is ignored, but still set. - op_params.padding_type = PaddingType::kSame; - op_params.padding_values.width = pad_width; - op_params.padding_values.height = pad_height; - op_params.stride_width = stride_width; - op_params.stride_height = stride_height; - - TransposeConv(op_params, DimsToShape(input_dims), input_data, - DimsToShape(filter_dims), filter_data, - /*bias_shape*/ RuntimeShape(), /*bias*/ nullptr, - DimsToShape(output_dims), output_data, DimsToShape(im2col_dims), - im2col_data); -} - -inline void TransposeConv( - const ConvParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& filter_shape, - const float* filter_data, const RuntimeShape& output_shape, - float* output_data, const RuntimeShape& im2col_shape, float* im2col_data) { - TransposeConv(params, input_shape, input_data, filter_shape, filter_data, - /*bias_shape*/ RuntimeShape(), /*bias*/ nullptr, output_shape, - output_data, im2col_shape, im2col_data); -} - -inline void FullyConnected(const float* input_data, const Dims<4>& input_dims, - const float* weights_data, - const Dims<4>& weights_dims, const float* bias_data, - const Dims<4>& bias_dims, - float output_activation_min, - float output_activation_max, float* output_data, - const Dims<4>& output_dims) { - tflite::FullyConnectedParams op_params; - op_params.float_activation_min = output_activation_min; - op_params.float_activation_max = output_activation_max; - - FullyConnected(op_params, DimsToShape(input_dims), input_data, - DimsToShape(weights_dims), weights_data, - DimsToShape(bias_dims), bias_data, DimsToShape(output_dims), - output_data); -} - -// legacy, for compatibility with old checked-in code -template -void FullyConnected(const float* input_data, const Dims<4>& input_dims, - const float* weights_data, const Dims<4>& weights_dims, - const float* bias_data, const Dims<4>& bias_dims, - float* output_data, const Dims<4>& output_dims) { - float output_activation_min, output_activation_max; - GetActivationMinMax(Ac, &output_activation_min, &output_activation_max); - FullyConnected(input_data, input_dims, weights_data, weights_dims, bias_data, - bias_dims, output_activation_min, output_activation_max, - output_data, output_dims); -} - -inline void FullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const uint8* input_data, const RuntimeShape& filter_shape, - const uint8* filter_data, const RuntimeShape& bias_shape, - const int32* bias_data, const RuntimeShape& output_shape, - uint8* output_data, gemmlowp::GemmContext*) { - FullyConnected(params, input_shape, input_data, filter_shape, filter_data, - bias_shape, bias_data, output_shape, output_data); -} - -inline void FullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const uint8* input_data, const RuntimeShape& filter_shape, - const uint8* filter_data, const RuntimeShape& bias_shape, - const int32* bias_data, const RuntimeShape& output_shape, - int16* output_data, gemmlowp::GemmContext*) { - FullyConnected(params, input_shape, input_data, filter_shape, filter_data, - bias_shape, bias_data, output_shape, output_data); -} - -inline void FullyConnected(const uint8* input_data, const Dims<4>& input_dims, - int32 input_offset, const uint8* filter_data, - const Dims<4>& filter_dims, int32 filter_offset, - const int32* bias_data, const Dims<4>& bias_dims, - int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims, - gemmlowp::GemmContext* gemmlowp_context) { - tflite::FullyConnectedParams op_params; - op_params.input_offset = input_offset; - op_params.weights_offset = filter_offset; - op_params.output_offset = output_offset; - op_params.output_multiplier = output_multiplier; - // Legacy ops used mixed left and right shifts. Now all are +ve-means-left. - op_params.output_shift = kReverseShift * output_shift; - op_params.quantized_activation_min = output_activation_min; - op_params.quantized_activation_max = output_activation_max; - - FullyConnected(op_params, DimsToShape(input_dims), input_data, - DimsToShape(filter_dims), filter_data, DimsToShape(bias_dims), - bias_data, DimsToShape(output_dims), output_data, - gemmlowp_context); -} - -inline void FullyConnected(const uint8* input_data, const Dims<4>& input_dims, - int32 input_offset, const uint8* filter_data, - const Dims<4>& filter_dims, int32 filter_offset, - const int32* bias_data, const Dims<4>& bias_dims, - int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, - int32 output_activation_max, int16* output_data, - const Dims<4>& output_dims, - gemmlowp::GemmContext* gemmlowp_context) { - tflite::FullyConnectedParams op_params; - op_params.input_offset = input_offset; - op_params.weights_offset = filter_offset; - op_params.output_offset = output_offset; - op_params.output_multiplier = output_multiplier; - // Legacy ops used mixed left and right shifts. Now all are +ve-means-left. - op_params.output_shift = kReverseShift * output_shift; - op_params.quantized_activation_min = output_activation_min; - op_params.quantized_activation_max = output_activation_max; - - FullyConnected(op_params, DimsToShape(input_dims), input_data, - DimsToShape(filter_dims), filter_data, DimsToShape(bias_dims), - bias_data, DimsToShape(output_dims), output_data, - gemmlowp_context); -} - -inline void ShuffledFullyConnected( - const FullyConnectedParams& params, const RuntimeShape& input_shape, - const uint8* input_data, const RuntimeShape& weights_shape, - const uint8* shuffled_weights_data, const RuntimeShape& bias_shape, - const int32* bias_data, const RuntimeShape& output_shape, - int16* output_data, uint8* shuffled_input_workspace_data, - gemmlowp::GemmContext*) { - ShuffledFullyConnected(params, input_shape, input_data, weights_shape, - shuffled_weights_data, bias_shape, bias_data, - output_shape, output_data, - shuffled_input_workspace_data); -} - -inline void ShuffledFullyConnected( - const uint8* input_data, const Dims<4>& input_dims, - const uint8* shuffled_weights_data, const Dims<4>& weights_dims, - const int32* bias_data, const Dims<4>& bias_dims, int32 output_multiplier, - int output_shift, int32 output_activation_min, int32 output_activation_max, - int16* output_data, const Dims<4>& output_dims, - uint8* shuffled_input_workspace_data, - gemmlowp::GemmContext* gemmlowp_context) { - tflite::FullyConnectedParams op_params; - op_params.output_multiplier = output_multiplier; - // Legacy ops used mixed left and right shifts. Now all are +ve-means-left. - op_params.output_shift = kReverseShift * output_shift; - op_params.quantized_activation_min = output_activation_min; - op_params.quantized_activation_max = output_activation_max; - - ShuffledFullyConnected(op_params, DimsToShape(input_dims), input_data, - DimsToShape(weights_dims), shuffled_weights_data, - DimsToShape(bias_dims), bias_data, - DimsToShape(output_dims), output_data, - shuffled_input_workspace_data, gemmlowp_context); -} - -// legacy, for compatibility with old checked-in code -template -void FullyConnected(const uint8* input_data, const Dims<4>& input_dims, - int32 input_offset, const uint8* filter_data, - const Dims<4>& filter_dims, int32 filter_offset, - const int32* bias_data, const Dims<4>& bias_dims, - int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims, - gemmlowp::GemmContext* gemmlowp_context) { - static_assert(Ac == FusedActivationFunctionType::kNone || - Ac == FusedActivationFunctionType::kRelu || - Ac == FusedActivationFunctionType::kRelu6 || - Ac == FusedActivationFunctionType::kRelu1, - ""); - if (Ac == FusedActivationFunctionType::kNone) { - TFLITE_DCHECK_EQ(output_activation_min, 0); - TFLITE_DCHECK_EQ(output_activation_max, 255); - } - FullyConnected(input_data, input_dims, input_offset, filter_data, filter_dims, - filter_offset, bias_data, bias_dims, output_offset, - output_multiplier, output_shift, output_activation_min, - output_activation_max, output_data, output_dims, - gemmlowp_context); -} - -inline void LstmCell(const float* input_data, const Dims<4>& input_dims, - const float* prev_activ_data, - const Dims<4>& prev_activ_dims, const float* weights_data, - const Dims<4>& weights_dims, const float* bias_data, - const Dims<4>& bias_dims, const float* prev_state_data, - const Dims<4>& prev_state_dims, float* output_state_data, - const Dims<4>& output_state_dims, float* output_activ_data, - const Dims<4>& output_activ_dims, float* concat_temp_data, - const Dims<4>& concat_temp_dims, float* activ_temp_data, - const Dims<4>& activ_temp_dims) { - tflite::LstmCellParams op_params; - // Float LSTM cell does not need parameters to be set: leave untouched. - - LstmCell(op_params, DimsToShape(input_dims), input_data, - DimsToShape(prev_activ_dims), prev_activ_data, - DimsToShape(weights_dims), weights_data, DimsToShape(bias_dims), - bias_data, DimsToShape(prev_state_dims), prev_state_data, - DimsToShape(output_state_dims), output_state_data, - DimsToShape(output_activ_dims), output_activ_data, - DimsToShape(concat_temp_dims), concat_temp_data, - DimsToShape(activ_temp_dims), activ_temp_data); -} - -template -void LstmCell(const uint8* input_data_uint8, const Dims<4>& input_dims, - const uint8* prev_activ_data_uint8, - const Dims<4>& prev_activ_dims, const uint8* weights_data_uint8, - const Dims<4>& weights_dims, const int32* bias_data_int32, - const Dims<4>& bias_dims, const int16* prev_state_data_int16, - const Dims<4>& prev_state_dims, int16* output_state_data_int16, - const Dims<4>& output_state_dims, uint8* output_activ_data_uint8, - const Dims<4>& output_activ_dims, uint8* concat_temp_data_uint8, - const Dims<4>& concat_temp_dims, int16* activ_temp_data_int16, - const Dims<4>& activ_temp_dims, int32 weights_zero_point, - int32 accum_multiplier, int accum_shift, - gemmlowp::GemmContext* gemmlowp_context) { - tflite::LstmCellParams op_params; - op_params.weights_zero_point = weights_zero_point; - op_params.accum_multiplier = accum_multiplier; - op_params.accum_shift = accum_shift; - - LstmCell( - op_params, DimsToShape(input_dims), input_data_uint8, - DimsToShape(prev_activ_dims), prev_activ_data_uint8, - DimsToShape(weights_dims), weights_data_uint8, DimsToShape(bias_dims), - bias_data_int32, DimsToShape(prev_state_dims), prev_state_data_int16, - DimsToShape(output_state_dims), output_state_data_int16, - DimsToShape(output_activ_dims), output_activ_data_uint8, - DimsToShape(concat_temp_dims), concat_temp_data_uint8, - DimsToShape(activ_temp_dims), activ_temp_data_int16, gemmlowp_context); -} - -template -void BroadcastDiv(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, const Dims<4>& input2_dims, - T output_activation_min, T output_activation_max, - T* output_data, const Dims<4>& output_dims) { - tflite::ArithmeticParams op_params; - SetActivationParams(output_activation_min, output_activation_max, &op_params); - - BroadcastDivSlow(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data); -} - -template -inline void Div(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, const Dims<4>& input2_dims, - T output_activation_min, T output_activation_max, - T* output_data, const Dims<4>& output_dims) { - tflite::ArithmeticParams op_params; - SetActivationParams(output_activation_min, output_activation_max, &op_params); - - Div(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -template -inline void Concatenation(int concat_dim, const Scalar* const* input_data, - const Dims<4>* const* input_dims, int inputs_count, - Scalar* output_data, const Dims<4>& output_dims) { - // For now we don't have a model with a Concatenation with fused activation. - TFLITE_DCHECK_EQ(Ac, FusedActivationFunctionType::kNone); - - std::vector input_shapes(inputs_count); - std::vector input_shapes_indirect(inputs_count); - for (int i = 0; i < inputs_count; ++i) { - ShapeFromDims(*input_dims[i], &input_shapes[i]); - input_shapes_indirect[i] = &input_shapes[i]; - } - tflite::ConcatenationParams op_params; - op_params.axis = 3 - concat_dim; - op_params.inputs_count = inputs_count; - - Concatenation(op_params, input_shapes_indirect.data(), input_data, - DimsToShape(output_dims), output_data); -} - -inline void Concatenation(int concat_dim, const uint8* const* input_data, - const Dims<4>* const* input_dims, - const int32* input_zeropoint, - const float* input_scale, int inputs_count, - uint8* output_data, const Dims<4>& output_dims, - const int32 output_zeropoint, - const float output_scale) { - std::vector input_shapes(inputs_count); - std::vector input_shapes_indirect(inputs_count); - for (int i = 0; i < inputs_count; ++i) { - ShapeFromDims(*input_dims[i], &input_shapes[i]); - input_shapes_indirect[i] = &input_shapes[i]; - } - tflite::ConcatenationParams op_params; - op_params.axis = 3 - concat_dim; - op_params.input_zeropoint = input_zeropoint; - op_params.input_scale = input_scale; - op_params.inputs_count = inputs_count; - op_params.output_zeropoint = output_zeropoint; - op_params.output_scale = output_scale; - - ConcatenationWithScaling(op_params, input_shapes_indirect.data(), input_data, - DimsToShape(output_dims), output_data); -} - -template -void DepthConcatenation(const Scalar* const* input_data, - const Dims<4>* const* input_dims, int inputs_count, - Scalar* output_data, const Dims<4>& output_dims) { - // For now we don't have a model with a Concatenation with fused activation. - TFLITE_DCHECK_EQ(Ac, FusedActivationFunctionType::kNone); - - std::vector input_shapes(inputs_count); - std::vector input_shapes_indirect(inputs_count); - for (int i = 0; i < inputs_count; ++i) { - ShapeFromDims(*input_dims[i], &input_shapes[i]); - input_shapes_indirect[i] = &input_shapes[i]; - } - tflite::ConcatenationParams op_params; - op_params.inputs_count = inputs_count; - - DepthConcatenation(op_params, input_shapes_indirect.data(), input_data, - DimsToShape(output_dims), output_data); -} - -template -void TensorFlowSplit(const Scalar* input_data, const Dims<4>& input_dims, - int axis, int outputs_count, Scalar* const* output_data, - const Dims<4>* const* output_dims) { - std::vector output_shapes(outputs_count); - std::vector output_shapes_indirect(outputs_count); - for (int i = 0; i < outputs_count; ++i) { - ShapeFromDims(*output_dims[i], &output_shapes[i]); - output_shapes_indirect[i] = &output_shapes[i]; - } - tflite::SplitParams op_params; - op_params.axis = 3 - axis; - op_params.num_split = outputs_count; - - Split(op_params, DimsToShape(input_dims), input_data, - output_shapes_indirect.data(), output_data); -} - -template -void TensorFlowSplit(const Scalar* input_data, const Dims<4>& input_dims, - int outputs_count, Scalar* const* output_data, - const Dims<4>* const* output_dims) { - TFLITE_DCHECK_GE(outputs_count, 1); - for (int i = 0; i < outputs_count; i++) { - /* batches = */ MatchingArraySize(*output_dims[i], 3, input_dims, 3); - /* height = */ MatchingArraySize(*output_dims[i], 2, input_dims, 2); - /* width = */ MatchingArraySize(*output_dims[i], 1, input_dims, 1); - } - // For now we don't have a model with a Split with fused activation. - TFLITE_DCHECK_EQ(Ac, FusedActivationFunctionType::kNone); - - TensorFlowSplit(input_data, input_dims, /*axis=*/0, outputs_count, - output_data, output_dims); -} - -inline void Softmax(const float* input_data, const RuntimeShape& input_shape, - float beta, float* output_data, - const RuntimeShape& output_shape) { - SoftmaxParams params; - params.beta = beta; - Softmax(params, input_shape, input_data, output_shape, output_data); -} - -inline void Softmax(const uint8* input_data, const RuntimeShape& input_shape, - int32 input_beta_multiplier, int32 input_beta_left_shift, - int diff_min, uint8* output_data, - const RuntimeShape& output_shape) { - SoftmaxParams params; - params.input_multiplier = input_beta_multiplier; - params.input_left_shift = input_beta_left_shift; - params.diff_min = diff_min; - Softmax(params, input_shape, input_data, output_shape, output_data); -} - -inline void LogSoftmax(const float* input_data, const RuntimeShape& input_shape, - float* output_data, const RuntimeShape& output_shape) { - SoftmaxParams params; - // No params currently used for float LogSoftmax. - LogSoftmax(params, input_shape, input_data, output_shape, output_data); -} - -inline void LogSoftmax(const uint8* input_data, const RuntimeShape& input_shape, - int32 input_multiplier, int32 input_left_shift, - int32 reverse_scaling_divisor, - int32 reverse_scaling_right_shift, int diff_min, - uint8* output_data, const RuntimeShape& output_shape) { - SoftmaxParams params; - params.input_multiplier = input_multiplier; - params.input_left_shift = input_left_shift; - params.reverse_scaling_divisor = reverse_scaling_divisor; - params.reverse_scaling_right_shift = reverse_scaling_right_shift; - params.diff_min = diff_min; - LogSoftmax(params, input_shape, input_data, output_shape, output_data); -} - -inline void Logistic(const LogisticParams& params, - const RuntimeShape& input_shape, const uint8* input_data, - const RuntimeShape& output_shape, uint8* output_data) { - const int32 input_zero_point = params.input_zero_point; - const int32 input_range_radius = params.input_range_radius; - const int32 input_multiplier = params.input_multiplier; - const int input_left_shift = params.input_left_shift; - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - const uint8 input_val_u8 = input_data[i]; - const int32 input_val_centered = - static_cast(input_val_u8) - input_zero_point; - uint8 output_val; - if (input_val_centered <= -input_range_radius) { - output_val = 0; - } else if (input_val_centered >= input_range_radius) { - output_val = 255; - } else { - const int32 input_val_rescaled = - MultiplyByQuantizedMultiplierGreaterThanOne( - input_val_centered, input_multiplier, input_left_shift); - using FixedPoint4 = gemmlowp::FixedPoint; - using FixedPoint0 = gemmlowp::FixedPoint; - const FixedPoint4 input_val_f4 = FixedPoint4::FromRaw(input_val_rescaled); - const FixedPoint0 output_val_f0 = gemmlowp::logistic(input_val_f4); - // Convert from Q0.31 to Q23.8. - using gemmlowp::RoundingDivideByPOT; - int32 output_val_s32 = RoundingDivideByPOT(output_val_f0.raw(), 23); - if (output_val_s32 == 256) { - output_val_s32 = 255; - } - // Reinterpret as U0.8. - TFLITE_DCHECK_GE(output_val_s32, 0); - TFLITE_DCHECK_LE(output_val_s32, 255); - output_val = static_cast(output_val_s32); - } - output_data[i] = output_val; - } -} - -inline void Logistic(const uint8* input_data, const RuntimeShape& input_shape, - int32 input_zero_point, int32 input_range_radius, - int32 input_multiplier, int input_left_shift, - uint8* output_data, const RuntimeShape& output_shape) { - LogisticParams params; - params.input_zero_point = input_zero_point; - params.input_range_radius = input_range_radius; - params.input_multiplier = input_multiplier; - params.input_left_shift = input_left_shift; - Logistic(params, input_shape, input_data, output_shape, output_data); -} - -inline void Logistic(const RuntimeShape& input_shape, const int16* input_data, - const RuntimeShape& output_shape, int16* output_data) { - LogisticParams params; - // No params currently needed by int16 Logistic. - Logistic(params, input_shape, input_data, output_shape, output_data); -} - -inline void Tanh(const uint8* input_data, const RuntimeShape& input_shape, - int32 input_zero_point, int32 input_range_radius, - int32 input_multiplier, int input_left_shift, - uint8* output_data, const RuntimeShape& output_shape) { - TanhParams params; - params.input_zero_point = input_zero_point; - params.input_range_radius = input_range_radius; - params.input_multiplier = input_multiplier; - params.input_left_shift = input_left_shift; - Tanh(params, input_shape, input_data, output_shape, output_data); -} - -inline void Tanh(const int16* input_data, const RuntimeShape& input_shape, - int input_left_shift, int16* output_data, - const RuntimeShape& output_shape) { - TanhParams params; - params.input_left_shift = input_left_shift; - Tanh(params, input_shape, input_data, output_shape, output_data); -} - -inline void Dequantize(const uint8* input_data, const Dims<4>& input_dims, - int32 zero_point, double scale, float* output_data, - const Dims<4>& output_dims) { - tflite::DequantizationParams op_params; - op_params.zero_point = zero_point; - op_params.scale = scale; - - Dequantize(op_params, DimsToShape(input_dims), input_data, - DimsToShape(output_dims), output_data); -} - -inline void FakeQuant(const float* input_data, const Dims<4>& input_dims, - float rmin, float rmax, int num_bits, float* output_data, - const Dims<4>& output_dims) { - tflite::FakeQuantParams op_params; - op_params.num_bits = num_bits; - op_params.minmax.min = rmin; - op_params.minmax.max = rmax; - - FakeQuant(op_params, DimsToShape(input_dims), input_data, - DimsToShape(output_dims), output_data); -} - -template -inline void Gather(const T* input_data, const Dims<4>& input_dims, - int input_rank, const int32* coords_data, - const Dims<4>& coords_dims, T* output_data, - const Dims<4>& output_dims) { - tflite::GatherParams op_params; - op_params.axis = 4 - input_rank; - - Gather(op_params, DimsToShape(input_dims), input_data, - DimsToShape(coords_dims), coords_data, DimsToShape(output_dims), - output_data); -} - -inline uint32 LegacyReverseBits32(uint32 n) { - n = ((n >> 1) & 0x55555555) | ((n & 0x55555555) << 1); - n = ((n >> 2) & 0x33333333) | ((n & 0x33333333) << 2); - n = ((n >> 4) & 0x0F0F0F0F) | ((n & 0x0F0F0F0F) << 4); - return (((n & 0xFF) << 24) | ((n & 0xFF00) << 8) | ((n & 0xFF0000) >> 8) | - ((n & 0xFF000000) >> 24)); -} - -inline void StridedSliceReverseIndices(tflite::StridedSliceParams* p) { - TFLITE_CHECK_EQ(p->start_indices_count, p->stop_indices_count); - TFLITE_CHECK_EQ(p->stop_indices_count, p->strides_count); - - std::reverse(p->start_indices, p->start_indices + p->start_indices_count); - std::reverse(p->stop_indices, p->stop_indices + p->stop_indices_count); - std::reverse(p->strides, p->strides + p->strides_count); - - p->begin_mask = LegacyReverseBits32(static_cast(p->begin_mask)) >> - (32 - p->start_indices_count); - p->ellipsis_mask = - LegacyReverseBits32(static_cast(p->ellipsis_mask)) >> - (32 - p->start_indices_count); - p->end_mask = LegacyReverseBits32(static_cast(p->end_mask)) >> - (32 - p->start_indices_count); - p->new_axis_mask = - LegacyReverseBits32(static_cast(p->new_axis_mask)) >> - (32 - p->start_indices_count); - p->shrink_axis_mask = - LegacyReverseBits32(static_cast(p->shrink_axis_mask)) >> - (32 - p->start_indices_count); -} - -template -inline void StridedSlice(const T* input_data, const Dims<4>& input_dims, - int begin_mask, int end_mask, int shrink_axis_mask, - const std::vector& start_indices, - const std::vector& stop_indices, - const std::vector& strides, T* output_data, - const Dims<4>& output_dims) { - TFLITE_DCHECK_EQ(start_indices.size(), 4); - auto op_params = strided_slice::BuildStridedSliceParams( - begin_mask, end_mask, shrink_axis_mask, start_indices, stop_indices, - strides); - StridedSliceReverseIndices(&op_params); - - StridedSlice(op_params, DimsToShape(input_dims), input_data, - DimsToShape(output_dims), output_data); -} - -template -inline void Mean(const T* input_data, const Dims<4>& input_dims, - const std::vector& reduction_indices, T* output_data, - const Dims<4>& output_dims) { - tflite::MeanParams op_params; - op_params.axis_count = reduction_indices.size(); - for (int i = 0; i < op_params.axis_count; ++i) { - op_params.axis[i] = reduction_indices[op_params.axis_count - 1 - i]; - } - - Mean(op_params, DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -template -void Transpose(const T* input, const Dims<4>& input_dims, T* output, - const Dims<4>& output_dims, const int* permuted_axes) { - TransposeParams params; - params.perm_count = 4; - for (int i = 0; i < 4; ++i) { - params.perm[i] = 3 - permuted_axes[3 - i]; - } - Transpose(params, DimsToShape(input_dims), input, DimsToShape(output_dims), - output); -} - -template F> -inline void Comparison(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, const Dims<4>& input2_dims, - bool* output_data, const Dims<4>& output_dims) { - ComparisonParams op_params; - // No parameters needed. - ComparisonImpl(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data); -} - -template F> -inline void Comparison(int left_shift, const T* input1_data, - const Dims<4>& input1_dims, int32 input1_offset, - int32 input1_multiplier, int input1_shift, - const T* input2_data, const Dims<4>& input2_dims, - int32 input2_offset, int32 input2_multiplier, - int input2_shift, bool* output_data, - const Dims<4>& output_dims) { - tflite::ComparisonParams op_params; - op_params.left_shift = left_shift; - op_params.input1_offset = input1_offset; - op_params.input1_multiplier = input1_multiplier; - // Legacy ops used mixed left and right shifts. Now all are +ve-means-left. - op_params.input1_shift = kReverseShift * input1_shift; - op_params.input2_offset = input2_offset; - op_params.input2_multiplier = input2_multiplier; - // Legacy ops used mixed left and right shifts. Now all are +ve-means-left. - op_params.input2_shift = kReverseShift * input2_shift; - - ComparisonWithScaling(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data); -} - -template F> -inline void BroadcastComparison(const T* input1_data, - const Dims<4>& input1_dims, - const T* input2_data, - const Dims<4>& input2_dims, bool* output_data, - const Dims<4>& output_dims) { - ComparisonParams op_params; - // No parameters needed. - BroadcastComparison4DSlowImpl(op_params, DimsToShape(input1_dims), - input1_data, DimsToShape(input2_dims), - input2_data, DimsToShape(output_dims), - output_data); -} - -template F> -inline void BroadcastComparison(int left_shift, const T* input1_data, - const Dims<4>& input1_dims, int32 input1_offset, - int32 input1_multiplier, int input1_shift, - const T* input2_data, - const Dims<4>& input2_dims, int32 input2_offset, - int32 input2_multiplier, int input2_shift, - bool* output_data, const Dims<4>& output_dims) { - ComparisonParams op_params; - - op_params.left_shift = left_shift; - op_params.input1_offset = input1_offset; - op_params.input1_multiplier = input1_multiplier; - // Legacy ops used mixed left and right shifts. Now all are +ve-means-left. - op_params.input1_shift = kReverseShift * input1_shift; - op_params.input2_offset = input2_offset; - op_params.input2_multiplier = input2_multiplier; - // Legacy ops used mixed left and right shifts. Now all are +ve-means-left. - op_params.input2_shift = kReverseShift * input2_shift; - - BroadcastComparison4DSlowWithScaling( - op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -#define TFLITE_LEGACY_COMPARISON_OP(name) \ - template \ - inline void name(const T* input1_data, const Dims<4>& input1_dims, \ - const T* input2_data, const Dims<4>& input2_dims, \ - bool* output_data, const Dims<4>& output_dims) { \ - ruy::profiler::ScopeLabel label(#name); \ - Comparison(input1_data, input1_dims, input2_data, \ - input2_dims, output_data, output_dims); \ - } \ - template \ - inline void name( \ - int left_shift, const T* input1_data, const Dims<4>& input1_dims, \ - int32 input1_offset, int32 input1_multiplier, int input1_shift, \ - const T* input2_data, const Dims<4>& input2_dims, int32 input2_offset, \ - int32 input2_multiplier, int input2_shift, bool* output_data, \ - const Dims<4>& output_dims) { \ - ruy::profiler::ScopeLabel label(#name "/8bit"); \ - Comparison(left_shift, input1_data, input1_dims, \ - input1_offset, input1_multiplier, input1_shift, \ - input2_data, input2_dims, input2_offset, \ - input2_multiplier, input2_shift, output_data, \ - output_dims); \ - } \ - template \ - inline void Broadcast##name( \ - const T* input1_data, const Dims<4>& input1_dims, const T* input2_data, \ - const Dims<4>& input2_dims, bool* output_data, \ - const Dims<4>& output_dims) { \ - ruy::profiler::ScopeLabel label("Broadcast" #name); \ - BroadcastComparison(input1_data, input1_dims, input2_data, \ - input2_dims, output_data, output_dims); \ - } \ - template \ - inline void Broadcast##name( \ - int left_shift, const T* input1_data, const Dims<4>& input1_dims, \ - int32 input1_offset, int32 input1_multiplier, int input1_shift, \ - const T* input2_data, const Dims<4>& input2_dims, int32 input2_offset, \ - int32 input2_multiplier, int input2_shift, bool* output_data, \ - const Dims<4>& output_dims) { \ - ruy::profiler::ScopeLabel label("Broadcast" #name "/8bit"); \ - BroadcastComparison(left_shift, input1_data, input1_dims, \ - input1_offset, input1_multiplier, \ - input1_shift, input2_data, input2_dims, \ - input2_offset, input2_multiplier, \ - input2_shift, output_data, output_dims); \ - } -TFLITE_LEGACY_COMPARISON_OP(Equal); -TFLITE_LEGACY_COMPARISON_OP(NotEqual); -TFLITE_LEGACY_COMPARISON_OP(Greater); -TFLITE_LEGACY_COMPARISON_OP(GreaterEqual); -TFLITE_LEGACY_COMPARISON_OP(Less); -TFLITE_LEGACY_COMPARISON_OP(LessEqual); -#undef TFLITE_LEGACY_COMPARISON_OP - -template -inline void Select(const D* input_condition_data, - const Dims<4>& input_condition_dims, const T* input_x_data, - const Dims<4>& input_x_dims, const T* input_y_data, - const Dims<4>& input_y_dims, T* output_data, - const Dims<4>& output_dims) { - Select(DimsToShape(input_condition_dims), input_condition_data, - DimsToShape(input_x_dims), input_x_data, DimsToShape(input_y_dims), - input_y_data, DimsToShape(output_dims), output_data); -} - -template -inline void RankOneSelect(const D* input_condition_data, - const Dims<4>& input_condition_dims, - const T* input_x_data, const Dims<4>& input_x_dims, - const T* input_y_data, const Dims<4>& input_y_dims, - T* output_data, const Dims<4>& output_dims) { - RankOneSelect(DimsToShape(input_condition_dims), input_condition_data, - DimsToShape(input_x_dims), input_x_data, - DimsToShape(input_y_dims), input_y_data, - DimsToShape(output_dims), output_data); -} - -template -inline void SparseToDense(const std::vector>& indices, - const T* values, T default_value, T* output_data, - const Dims<4>& output_dims, bool value_is_scalar) { - SparseToDense(indices, values, default_value, value_is_scalar, - DimsToShape(output_dims), output_data); -} - -template -void Pack(int dim, const Scalar* const* input_data, - const Dims<4>* const* input_dims, int inputs_count, - Scalar* output_data, const Dims<4>& output_dims) { - std::vector input_shapes(inputs_count); - std::vector input_shapes_indirect(inputs_count); - for (int i = 0; i < inputs_count; ++i) { - ShapeFromDims(*input_dims[i], &input_shapes[i]); - input_shapes_indirect[i] = &input_shapes[i]; - } - tflite::PackParams op_params; - op_params.axis = 3 - dim; - op_params.inputs_count = inputs_count; - - Pack(op_params, input_shapes_indirect.data(), input_data, - DimsToShape(output_dims), output_data); -} - -template -void Unpack(int axis, const Scalar* input_data, const Dims<4>& input_dims, - int dimensions, int outputs_count, Scalar* const* output_datas, - const Dims<4>& output_dims) { - tflite::UnpackParams op_params; - op_params.axis = 3 - axis; - op_params.num_split = outputs_count; - - Unpack(op_params, DimsToShape(input_dims), input_data, - DimsToShape(output_dims), output_datas); -} - -template -void Pack(int dim, const Scalar* const* input_data, - const Dims<4>* const* input_dims, const int32* input_zeropoint, - const float* input_scale, int inputs_count, Scalar* output_data, - const Dims<4>& output_dims, const int32 output_zeropoint, - const float output_scale) { - std::vector input_shapes(inputs_count); - std::vector input_shapes_indirect(inputs_count); - for (int i = 0; i < inputs_count; ++i) { - ShapeFromDims(*input_dims[i], &input_shapes[i]); - input_shapes_indirect[i] = &input_shapes[i]; - } - tflite::PackParams op_params; - op_params.axis = 3 - dim; - op_params.input_zeropoint = input_zeropoint; - op_params.input_scale = input_scale; - op_params.inputs_count = inputs_count; - op_params.output_zeropoint = output_zeropoint; - op_params.output_scale = output_scale; - - PackWithScaling(op_params, input_shapes_indirect.data(), input_data, - DimsToShape(output_dims), output_data); -} - -template -void L2Normalization(const float* input_data, const RuntimeShape& input_shape, - float* output_data, const RuntimeShape& output_shape) { - static_assert(Ac == FusedActivationFunctionType::kNone, ""); - tflite::L2NormalizationParams op_params; - // No params need to be set for float. - - L2Normalization(op_params, input_shape, input_data, output_shape, - output_data); -} - -inline void L2Normalization(const uint8* input_data, - const RuntimeShape& input_shape, - int32 input_zero_point, uint8* output_data, - const RuntimeShape& output_shape) { - tflite::L2NormalizationParams op_params; - op_params.input_zero_point = input_zero_point; - - L2Normalization(op_params, input_shape, input_data, output_shape, - output_data); -} - -template -void L2Normalization(const float* input_data, const Dims<4>& input_dims, - float* output_data, const Dims<4>& output_dims) { - L2Normalization(input_data, DimsToShape(input_dims), output_data, - DimsToShape(output_dims)); -} - -inline void L2Normalization(const uint8* input_data, const Dims<4>& input_dims, - int32 input_zero_point, uint8* output_data, - const Dims<4>& output_dims) { - L2Normalization(input_data, DimsToShape(input_dims), input_zero_point, - output_data, DimsToShape(output_dims)); -} - -inline void Relu(const float* input_data, const Dims<4>& input_dims, - float* output_data, const Dims<4>& output_dims) { - Relu(DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -inline void Relu1(const float* input_data, const Dims<4>& input_dims, - float* output_data, const Dims<4>& output_dims) { - Relu1(DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -inline void Relu6(const float* input_data, const Dims<4>& input_dims, - float* output_data, const Dims<4>& output_dims) { - Relu6(DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -inline void ReluX(uint8 min_value, uint8 max_value, const uint8* input_data, - const RuntimeShape& input_shape, uint8* output_data, - const RuntimeShape& output_shape) { - tflite::ActivationParams params; - params.quantized_activation_max = max_value; - params.quantized_activation_min = min_value; - ReluX(params, input_shape, input_data, output_shape, output_data); -} - -template -inline void Add(int left_shift, const uint8* input1_data, - const Dims<4>& input1_dims, int32 input1_offset, - int32 input1_multiplier, int input1_shift, - const uint8* input2_data, const Dims<4>& input2_dims, - int32 input2_offset, int32 input2_multiplier, int input2_shift, - int32 output_offset, int32 output_multiplier, int output_shift, - int32 output_activation_min, int32 output_activation_max, - uint8* output_data, const Dims<4>& output_dims) { - constexpr int kReverseShift = -1; - static_assert(Ac == FusedActivationFunctionType::kNone || - Ac == FusedActivationFunctionType::kRelu || - Ac == FusedActivationFunctionType::kRelu6 || - Ac == FusedActivationFunctionType::kRelu1, - ""); - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - if (Ac == FusedActivationFunctionType::kNone) { - TFLITE_DCHECK_EQ(output_activation_min, 0); - TFLITE_DCHECK_EQ(output_activation_max, 255); - } - - tflite::ArithmeticParams op_params; - op_params.left_shift = left_shift; - op_params.input1_offset = input1_offset; - op_params.input1_multiplier = input1_multiplier; - op_params.input1_shift = kReverseShift * input1_shift; - op_params.input2_offset = input2_offset; - op_params.input2_multiplier = input2_multiplier; - op_params.input2_shift = kReverseShift * input2_shift; - op_params.output_offset = output_offset; - op_params.output_multiplier = output_multiplier; - op_params.output_shift = kReverseShift * output_shift; - op_params.quantized_activation_min = output_activation_min; - op_params.quantized_activation_max = output_activation_max; - Add(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -template -void Add(const int32* input1_data, const Dims<4>& input1_dims, - const int32* input2_data, const Dims<4>& input2_dims, - int32* output_data, const Dims<4>& output_dims) { - ruy::profiler::ScopeLabel label("Add/int32"); - TFLITE_DCHECK(Ac == FusedActivationFunctionType::kNone); - - tflite::ArithmeticParams op_params; - op_params.quantized_activation_min = std::numeric_limits::min(); - op_params.quantized_activation_max = std::numeric_limits::max(); - Add(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -template -inline void BroadcastAdd(int left_shift, const uint8* input1_data, - const Dims<4>& input1_dims, int32 input1_offset, - int32 input1_multiplier, int input1_shift, - const uint8* input2_data, const Dims<4>& input2_dims, - int32 input2_offset, int32 input2_multiplier, - int input2_shift, int32 output_offset, - int32 output_multiplier, int output_shift, - int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims) { - constexpr int kReverseShift = -1; - static_assert(Ac == FusedActivationFunctionType::kNone || - Ac == FusedActivationFunctionType::kRelu || - Ac == FusedActivationFunctionType::kRelu6 || - Ac == FusedActivationFunctionType::kRelu1, - ""); - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - if (Ac == FusedActivationFunctionType::kNone) { - TFLITE_DCHECK_EQ(output_activation_min, 0); - TFLITE_DCHECK_EQ(output_activation_max, 255); - } - - tflite::ArithmeticParams op_params; - op_params.left_shift = left_shift; - op_params.input1_offset = input1_offset; - op_params.input1_multiplier = input1_multiplier; - op_params.input1_shift = kReverseShift * input1_shift; - op_params.input2_offset = input2_offset; - op_params.input2_multiplier = input2_multiplier; - op_params.input2_shift = kReverseShift * input2_shift; - op_params.output_offset = output_offset; - op_params.output_multiplier = output_multiplier; - op_params.output_shift = kReverseShift * output_shift; - op_params.quantized_activation_min = output_activation_min; - op_params.quantized_activation_max = output_activation_max; - BroadcastAdd4DSlow(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data); -} - -template -void Add(const float* input1_data, const Dims<4>& input1_dims, - const float* input2_data, const Dims<4>& input2_dims, - float* output_data, const Dims<4>& output_dims) { - float output_activation_min, output_activation_max; - GetActivationMinMax(Ac, &output_activation_min, &output_activation_max); - - tflite::ArithmeticParams op_params; - op_params.float_activation_min = output_activation_min; - op_params.float_activation_max = output_activation_max; - Add(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -template -void BroadcastAdd(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, const Dims<4>& input2_dims, - T output_activation_min, T output_activation_max, - T* output_data, const Dims<4>& output_dims) { - tflite::ArithmeticParams op_params; - op_params.float_activation_min = output_activation_min; - op_params.float_activation_max = output_activation_max; - BroadcastAdd4DSlow(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data); -} - -template -inline void BroadcastAddFivefold( - int y0, int y1, int y2, int y3, int y4, int left_shift, - const uint8* input1_data, const Dims<4>& input1_dims, int32 input1_offset, - int32 input1_multiplier, int input1_shift, const uint8* input2_data, - const Dims<4>& input2_dims, int32 input2_offset, int32 input2_multiplier, - int input2_shift, int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, int32 output_activation_max, - uint8* output_data, const Dims<4>& output_dims) { - constexpr int kReverseShift = -1; - static_assert(Ac == FusedActivationFunctionType::kNone || - Ac == FusedActivationFunctionType::kRelu || - Ac == FusedActivationFunctionType::kRelu6 || - Ac == FusedActivationFunctionType::kRelu1, - ""); - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - if (Ac == FusedActivationFunctionType::kNone) { - TFLITE_DCHECK_EQ(output_activation_min, 0); - TFLITE_DCHECK_EQ(output_activation_max, 255); - } - tflite::ArithmeticParams op_params; - op_params.broadcast_category = - tflite::BroadcastableOpCategory::kFirstInputBroadcastsFast; - op_params.left_shift = left_shift; - op_params.input1_offset = input1_offset; - op_params.input1_multiplier = input1_multiplier; - op_params.input1_shift = kReverseShift * input1_shift; - op_params.input2_offset = input2_offset; - op_params.input2_multiplier = input2_multiplier; - op_params.input2_shift = kReverseShift * input2_shift; - op_params.output_offset = output_offset; - op_params.output_multiplier = output_multiplier; - op_params.output_shift = kReverseShift * output_shift; - op_params.quantized_activation_min = output_activation_min; - op_params.quantized_activation_max = output_activation_max; - op_params.broadcast_shape[4] = y0; - op_params.broadcast_shape[3] = y1; - op_params.broadcast_shape[2] = y2; - op_params.broadcast_shape[1] = y3; - op_params.broadcast_shape[0] = y4; - BroadcastAddFivefold(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data); -} - -// legacy, for compatibility with old checked-in code -template -void BroadcastAdd(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, const Dims<4>& input2_dims, - T* output_data, const Dims<4>& output_dims) { - T output_activation_min, output_activation_max; - GetActivationMinMax(Ac, &output_activation_min, &output_activation_max); - - BroadcastAdd(input1_data, input1_dims, input2_data, input2_dims, - output_activation_min, output_activation_max, output_data, - output_dims); -} - -template -inline void Add(const int16* input1_data, const Dims<4>& input1_dims, - int input1_shift, const int16* input2_data, - const Dims<4>& input2_dims, int input2_shift, - int16 output_activation_min, int16 output_activation_max, - int16* output_data, const Dims<4>& output_dims) { - static_assert(Ac == FusedActivationFunctionType::kNone || - Ac == FusedActivationFunctionType::kRelu || - Ac == FusedActivationFunctionType::kRelu6 || - Ac == FusedActivationFunctionType::kRelu1, - ""); - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - if (Ac == FusedActivationFunctionType::kNone) { - TFLITE_DCHECK_EQ(output_activation_min, -32768); - TFLITE_DCHECK_EQ(output_activation_max, 32767); - } - - tflite::ArithmeticParams op_params; - op_params.input1_shift = kReverseShift * input1_shift; - op_params.input2_shift = kReverseShift * input2_shift; - op_params.quantized_activation_min = output_activation_min; - op_params.quantized_activation_max = output_activation_max; - Add(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -inline void Sub(const float* input1_data, const Dims<4>& input1_dims, - const float* input2_data, const Dims<4>& input2_dims, - float* output_data, const Dims<4>& output_dims) { - float output_activation_min, output_activation_max; - GetActivationMinMax(FusedActivationFunctionType::kNone, - &output_activation_min, &output_activation_max); - tflite::ArithmeticParams op_params; - op_params.float_activation_min = output_activation_min; - op_params.float_activation_max = output_activation_max; - Sub(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -template -void Sub(const T* input1_data, const Dims<4>& input1_dims, const T* input2_data, - const Dims<4>& input2_dims, T* output_data, - const Dims<4>& output_dims) { - tflite::ArithmeticParams op_params; - op_params.quantized_activation_min = std::numeric_limits::min(); - op_params.quantized_activation_max = std::numeric_limits::max(); - Sub(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -inline bool AveragePool(const float* input_data, const Dims<4>& input_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int kwidth, int kheight, - float output_activation_min, - float output_activation_max, float* output_data, - const Dims<4>& output_dims) { - tflite::PoolParams params; - params.stride_height = stride_height; - params.stride_width = stride_width; - params.filter_height = kheight; - params.filter_width = kwidth; - params.padding_values.height = pad_height; - params.padding_values.width = pad_width; - params.float_activation_min = output_activation_min; - params.float_activation_max = output_activation_max; - return AveragePool(params, DimsToShape(input_dims), input_data, - DimsToShape(output_dims), output_data); -} - -// Transitional version that will be moved shortly to legacy_reference_ops, as -// part of RuntimeShape revisions. -inline void BroadcastMul4DSlow(const uint8* input1_data, - const Dims<4>& input1_dims, int32 input1_offset, - const uint8* input2_data, - const Dims<4>& input2_dims, int32 input2_offset, - int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims) { - tflite::ArithmeticParams op_params; - SetActivationParams(output_activation_min, output_activation_max, &op_params); - op_params.input1_offset = input1_offset; - op_params.input2_offset = input2_offset; - op_params.output_offset = output_offset; - op_params.output_multiplier = output_multiplier; - op_params.output_shift = output_shift; - - BroadcastMul4DSlow(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data); -} - -inline void BroadcastMul(const uint8* input1_data, const Dims<4>& input1_dims, - int32 input1_offset, const uint8* input2_data, - const Dims<4>& input2_dims, int32 input2_offset, - int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims) { - BroadcastMul4DSlow( - input1_data, input1_dims, input1_offset, input2_data, input2_dims, - input2_offset, output_offset, output_multiplier, - // - kReverseShift * output_shift, - // - output_activation_min, output_activation_max, output_data, output_dims); -} - -// legacy, for compatibility with old checked-in code -template -inline void BroadcastMul(const uint8* input1_data, const Dims<4>& input1_dims, - int32 input1_offset, const uint8* input2_data, - const Dims<4>& input2_dims, int32 input2_offset, - int32 output_offset, int32 output_multiplier, - int output_shift, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims) { - BroadcastMul(input1_data, input1_dims, input1_offset, input2_data, - input2_dims, input2_offset, output_offset, output_multiplier, - output_shift, output_activation_min, output_activation_max, - output_data, output_dims); -} - -// legacy, for compatibility with old checked-in code -template -bool AveragePool(const float* input_data, const Dims<4>& input_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int kwidth, int kheight, float* output_data, - const Dims<4>& output_dims) { - float output_activation_min, output_activation_max; - GetActivationMinMax(Ac, &output_activation_min, &output_activation_max); - - return AveragePool(input_data, input_dims, stride_width, stride_height, - pad_width, pad_height, kwidth, kheight, - output_activation_min, output_activation_max, output_data, - output_dims); -} - -// legacy, for compatibility with old checked-in code -template -bool AveragePool(const float* input_data, const Dims<4>& input_dims, int stride, - int pad_width, int pad_height, int filter_width, - int filter_height, float* output_data, - const Dims<4>& output_dims) { - return AveragePool(input_data, input_dims, stride, stride, pad_width, - pad_height, filter_width, filter_height, output_data, - output_dims); -} - -inline bool AveragePool(const uint8* input_data, const Dims<4>& input_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int filter_width, int filter_height, - int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims) { - tflite::PoolParams params; - params.stride_height = stride_height; - params.stride_width = stride_width; - params.filter_height = filter_height; - params.filter_width = filter_width; - params.padding_values.height = pad_height; - params.padding_values.width = pad_width; - params.quantized_activation_min = output_activation_min; - params.quantized_activation_max = output_activation_max; - return AveragePool(params, DimsToShape(input_dims), input_data, - DimsToShape(output_dims), output_data); -} - -// legacy, for compatibility with old checked-in code -template -bool AveragePool(const uint8* input_data, const Dims<4>& input_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int filter_width, int filter_height, - int32 output_activation_min, int32 output_activation_max, - uint8* output_data, const Dims<4>& output_dims) { - static_assert(Ac == FusedActivationFunctionType::kNone || - Ac == FusedActivationFunctionType::kRelu || - Ac == FusedActivationFunctionType::kRelu6 || - Ac == FusedActivationFunctionType::kRelu1, - ""); - if (Ac == FusedActivationFunctionType::kNone) { - TFLITE_DCHECK_EQ(output_activation_min, 0); - TFLITE_DCHECK_EQ(output_activation_max, 255); - } - return AveragePool(input_data, input_dims, stride_width, stride_height, - pad_width, pad_height, filter_width, filter_height, - output_activation_min, output_activation_max, output_data, - output_dims); -} - -// legacy, for compatibility with old checked-in code -template -bool AveragePool(const uint8* input_data, const Dims<4>& input_dims, int stride, - int pad_width, int pad_height, int filter_width, - int filter_height, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims) { - return AveragePool(input_data, input_dims, stride, stride, pad_width, - pad_height, filter_width, filter_height, - output_activation_min, output_activation_max, - output_data, output_dims); -} - -inline void MaxPool(const float* input_data, const Dims<4>& input_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int kwidth, int kheight, - float output_activation_min, float output_activation_max, - float* output_data, const Dims<4>& output_dims) { - tflite::PoolParams params; - params.stride_height = stride_height; - params.stride_width = stride_width; - params.filter_height = kheight; - params.filter_width = kwidth; - params.padding_values.height = pad_height; - params.padding_values.width = pad_width; - params.float_activation_min = output_activation_min; - params.float_activation_max = output_activation_max; - MaxPool(params, DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -// legacy, for compatibility with old checked-in code -template -void MaxPool(const float* input_data, const Dims<4>& input_dims, - int stride_width, int stride_height, int pad_width, int pad_height, - int kwidth, int kheight, float* output_data, - const Dims<4>& output_dims) { - float output_activation_min, output_activation_max; - GetActivationMinMax(Ac, &output_activation_min, &output_activation_max); - MaxPool(input_data, input_dims, stride_width, stride_height, pad_width, - pad_height, kwidth, kheight, output_activation_min, - output_activation_max, output_data, output_dims); -} - -// legacy, for compatibility with old checked-in code -template -void MaxPool(const float* input_data, const Dims<4>& input_dims, int stride, - int pad_width, int pad_height, int filter_width, int filter_height, - float* output_data, const Dims<4>& output_dims) { - MaxPool(input_data, input_dims, stride, stride, pad_width, pad_height, - filter_width, filter_height, output_data, output_dims); -} - -inline void MaxPool(const uint8* input_data, const Dims<4>& input_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int filter_width, int filter_height, - int32 output_activation_min, int32 output_activation_max, - uint8* output_data, const Dims<4>& output_dims) { - PoolParams params; - params.stride_height = stride_height; - params.stride_width = stride_width; - params.filter_height = filter_height; - params.filter_width = filter_width; - params.padding_values.height = pad_height; - params.padding_values.width = pad_width; - params.quantized_activation_min = output_activation_min; - params.quantized_activation_max = output_activation_max; - MaxPool(params, DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -// legacy, for compatibility with old checked-in code -template -void MaxPool(const uint8* input_data, const Dims<4>& input_dims, - int stride_width, int stride_height, int pad_width, int pad_height, - int filter_width, int filter_height, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims) { - static_assert(Ac == FusedActivationFunctionType::kNone || - Ac == FusedActivationFunctionType::kRelu || - Ac == FusedActivationFunctionType::kRelu6 || - Ac == FusedActivationFunctionType::kRelu1, - ""); - if (Ac == FusedActivationFunctionType::kNone) { - TFLITE_DCHECK_EQ(output_activation_min, 0); - TFLITE_DCHECK_EQ(output_activation_max, 255); - } - MaxPool(input_data, input_dims, stride_width, stride_height, pad_width, - pad_height, filter_width, filter_height, output_activation_min, - output_activation_max, output_data, output_dims); -} - -// legacy, for compatibility with old checked-in code -template -void MaxPool(const uint8* input_data, const Dims<4>& input_dims, int stride, - int pad_width, int pad_height, int filter_width, int filter_height, - int32 output_activation_min, int32 output_activation_max, - uint8* output_data, const Dims<4>& output_dims) { - MaxPool(input_data, input_dims, stride, stride, pad_width, pad_height, - filter_width, filter_height, output_activation_min, - output_activation_max, output_data, output_dims); -} - -inline void L2Pool(const float* input_data, const Dims<4>& input_dims, - int stride_width, int stride_height, int pad_width, - int pad_height, int filter_width, int filter_height, - float output_activation_min, float output_activation_max, - float* output_data, const Dims<4>& output_dims) { - PoolParams params; - params.stride_height = stride_height; - params.stride_width = stride_width; - params.filter_height = filter_height; - params.filter_width = filter_width; - params.padding_values.height = pad_height; - params.padding_values.width = pad_width; - params.float_activation_min = output_activation_min; - params.float_activation_max = output_activation_max; - L2Pool(params, DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -// legacy, for compatibility with old checked-in code -template -void L2Pool(const float* input_data, const Dims<4>& input_dims, - int stride_width, int stride_height, int pad_width, int pad_height, - int filter_width, int filter_height, float* output_data, - const Dims<4>& output_dims) { - float output_activation_min, output_activation_max; - GetActivationMinMax(Ac, &output_activation_min, &output_activation_max); - L2Pool(input_data, input_dims, stride_width, stride_height, pad_width, - pad_height, filter_width, filter_height, output_activation_min, - output_activation_max, output_data, output_dims); -} - -// legacy, for compatibility with old checked-in code -template -void L2Pool(const float* input_data, const Dims<4>& input_dims, int stride, - int pad_width, int pad_height, int filter_width, int filter_height, - float* output_data, const Dims<4>& output_dims) { - L2Pool(input_data, input_dims, stride, stride, pad_width, pad_height, - filter_width, filter_height, output_data, output_dims); -} - -inline void Softmax(const float* input_data, const Dims<4>& input_dims, - float beta, float* output_data, - const Dims<4>& output_dims) { - Softmax(input_data, DimsToShape(input_dims), beta, output_data, - DimsToShape(output_dims)); -} - -inline void Softmax(const uint8* input_data, const Dims<4>& input_dims, - int32 input_beta_multiplier, int32 input_beta_left_shift, - int diff_min, uint8* output_data, - const Dims<4>& output_dims) { - Softmax(input_data, DimsToShape(input_dims), input_beta_multiplier, - input_beta_left_shift, diff_min, output_data, - DimsToShape(output_dims)); -} - -inline void LogSoftmax(const float* input_data, const Dims<4>& input_dims, - float* output_data, const Dims<4>& output_dims) { - LogSoftmax(input_data, DimsToShape(input_dims), output_data, - DimsToShape(output_dims)); -} - -inline void LogSoftmax(const uint8* input_data, const Dims<4>& input_dims, - int32 input_multiplier, int32 input_left_shift, - int32 reverse_scaling_divisor, - int32 reverse_scaling_right_shift, int diff_min, - uint8* output_data, const Dims<4>& output_dims) { - LogSoftmax(input_data, DimsToShape(input_dims), input_multiplier, - input_left_shift, reverse_scaling_divisor, - reverse_scaling_right_shift, diff_min, output_data, - DimsToShape(output_dims)); -} - -inline void Logistic(const float* input_data, const Dims<4>& input_dims, - float* output_data, const Dims<4>& output_dims) { - Logistic(DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -inline void Logistic(const uint8* input_data, const Dims<4>& input_dims, - int32 input_zero_point, int32 input_range_radius, - int32 input_multiplier, int input_left_shift, - uint8* output_data, const Dims<4>& output_dims) { - Logistic(input_data, DimsToShape(input_dims), input_zero_point, - input_range_radius, input_multiplier, input_left_shift, output_data, - DimsToShape(output_dims)); -} - -inline void Logistic(const int16* input_data, const Dims<4>& input_dims, - int16* output_data, const Dims<4>& output_dims) { - Logistic(DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -inline void Tanh(const float* input_data, const Dims<4>& input_dims, - float* output_data, const Dims<4>& output_dims) { - Tanh(DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -inline void Tanh(const uint8* input_data, const Dims<4>& input_dims, - int32 input_zero_point, int32 input_range_radius, - int32 input_multiplier, int input_left_shift, - uint8* output_data, const Dims<4>& output_dims) { - Tanh(input_data, DimsToShape(input_dims), input_zero_point, - input_range_radius, input_multiplier, input_left_shift, output_data, - DimsToShape(output_dims)); -} - -inline void Tanh(const int16* input_data, const Dims<4>& input_dims, - int input_left_shift, int16* output_data, - const Dims<4>& output_dims) { - Tanh(input_data, DimsToShape(input_dims), input_left_shift, output_data, - DimsToShape(output_dims)); -} - -template -inline void DepthToSpace(const T* input_data, const Dims<4>& input_dims, - int block_size, T* output_data, - const Dims<4>& output_dims) { - tflite::DepthToSpaceParams op_params; - op_params.block_size = block_size; - - DepthToSpace(op_params, DimsToShape(input_dims), input_data, - DimsToShape(output_dims), output_data); -} - -template -inline void SpaceToDepth(const T* input_data, const Dims<4>& input_dims, - int block_size, T* output_data, - const Dims<4>& output_dims) { - tflite::SpaceToDepthParams op_params; - op_params.block_size = block_size; - - SpaceToDepth(op_params, DimsToShape(input_dims), input_data, - DimsToShape(output_dims), output_data); -} - -template -inline void Mul(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, const Dims<4>& input2_dims, - T output_activation_min, T output_activation_max, - T* output_data, const Dims<4>& output_dims) { - tflite::ArithmeticParams op_params; - SetActivationParams(output_activation_min, output_activation_max, &op_params); - - Mul(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -// legacy, for compatibility with old checked-in code -template -void Mul(const float* input1_data, const Dims<4>& input1_dims, - const float* input2_data, const Dims<4>& input2_dims, - float* output_data, const Dims<4>& output_dims) { - float output_activation_min, output_activation_max; - GetActivationMinMax(Ac, &output_activation_min, &output_activation_max); - - tflite::ArithmeticParams op_params; - SetActivationParams(output_activation_min, output_activation_max, &op_params); - - Mul(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -template -void BroadcastMul(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, const Dims<4>& input2_dims, - T output_activation_min, T output_activation_max, - T* output_data, const Dims<4>& output_dims) { - tflite::ArithmeticParams op_params; - SetActivationParams(output_activation_min, output_activation_max, &op_params); - - BroadcastMul4DSlow(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data); -} - -// legacy, for compatibility with old checked-in code -template -void BroadcastMul(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, const Dims<4>& input2_dims, - T* output_data, const Dims<4>& output_dims) { - T output_activation_min, output_activation_max; - GetActivationMinMax(Ac, &output_activation_min, &output_activation_max); - - tflite::ArithmeticParams op_params; - SetActivationParams(output_activation_min, output_activation_max, &op_params); - - BroadcastMul4DSlow(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data); -} - -inline void Mul(const int16* input1_data, const Dims<4>& input1_dims, - const int16* input2_data, const Dims<4>& input2_dims, - int16* output_data, const Dims<4>& output_dims) { - tflite::ArithmeticParams op_params; - // No params in this version. - - Mul(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -inline void Mul(const int16* input1_data, const Dims<4>& input1_dims, - const int16* input2_data, const Dims<4>& input2_dims, - int32 output_offset, int32 output_activation_min, - int32 output_activation_max, uint8* output_data, - const Dims<4>& output_dims) { - tflite::ArithmeticParams op_params; - op_params.quantized_activation_min = output_activation_min; - op_params.quantized_activation_max = output_activation_max; - op_params.output_offset = output_offset; - - Mul(op_params, DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, DimsToShape(output_dims), - output_data); -} - -inline void LocalResponseNormalization(const float* input_data, - const Dims<4>& input_dims, int range, - float bias, float alpha, float beta, - float* output_data, - const Dims<4>& output_dims) { - tflite::LocalResponseNormalizationParams op_params; - op_params.range = range; - op_params.bias = bias; - op_params.alpha = alpha; - op_params.beta = beta; - - LocalResponseNormalization(op_params, DimsToShape(input_dims), input_data, - DimsToShape(output_dims), output_data); -} - -template -void Cast(const SrcT* input_data, const Dims<4>& input_dims, DstT* output_data, - const Dims<4>& output_dims) { - Cast(DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -inline void Floor(const float* input_data, const Dims<4>& input_dims, - float* output_data, const Dims<4>& output_dims) { - Floor(DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data); -} - -template -inline void ResizeBilinear(const T* input_data, const Dims<4>& input_dims, - const int32* output_size_data, - const Dims<4>& output_size_dims, T* output_data, - const Dims<4>& output_dims, bool align_corners) { - tflite::ResizeBilinearParams op_params; - op_params.align_corners = align_corners; - op_params.half_pixel_centers = false; - ResizeBilinear(op_params, DimsToShape(input_dims), input_data, - DimsToShape(output_size_dims), output_size_data, - DimsToShape(output_dims), output_data); -} - -// legacy, for compatibility with old checked-in code -inline void ResizeBilinear(const float* input_data, const Dims<4>& input_dims, - const int32* output_size_data, - const Dims<4>& output_size_dims, float* output_data, - const Dims<4>& output_dims) { - ResizeBilinear(input_data, input_dims, output_size_data, - output_size_dims, output_data, output_dims, - /*align_corners=*/false); -} - -inline void ResizeBilinear(const uint8* input_data, const Dims<4>& input_dims, - const int32* output_size_data, - const Dims<4>& output_size_dims, uint8* output_data, - const Dims<4>& output_dims) { - ResizeBilinear(input_data, input_dims, output_size_data, - output_size_dims, output_data, output_dims, - /*align_corners=*/false); -} - -template -inline void SpaceToBatchND(const T* input_data, const Dims<4>& input_dims, - const int32* block_shape_data, - const Dims<4>& block_shape_dims, - const int32* paddings_data, - const Dims<4>& paddings_dims, T* output_data, - const Dims<4>& output_dims, - const int32_t pad_value) { - tflite::SpaceToBatchParams op_params; - op_params.output_offset = pad_value; - - SpaceToBatchND(op_params, DimsToShape(input_dims), input_data, - DimsToShape(block_shape_dims), block_shape_data, - DimsToShape(paddings_dims), paddings_data, - DimsToShape(output_dims), output_data); -} - -template -inline void SpaceToBatchND(const T* input_data, const Dims<4>& input_dims, - const int32* block_shape_data, - const Dims<4>& block_shape_dims, - const int32* paddings_data, - const Dims<4>& paddings_dims, T* output_data, - const Dims<4>& output_dims) { - tflite::SpaceToBatchParams op_params; - op_params.output_offset = 0; - - SpaceToBatchND(op_params, DimsToShape(input_dims), input_data, - DimsToShape(block_shape_dims), block_shape_data, - DimsToShape(paddings_dims), paddings_data, - DimsToShape(output_dims), output_data); -} - -template -inline void BatchToSpaceND(const T* input_data, const Dims<4>& input_dims, - const int32* block_shape_data, - const Dims<4>& block_shape_dims, - const int32* crops_data, const Dims<4>& crops_dims, - T* output_data, const Dims<4>& output_dims) { - BatchToSpaceND(DimsToShape(input_dims), input_data, - DimsToShape(block_shape_dims), block_shape_data, - DimsToShape(crops_dims), crops_data, DimsToShape(output_dims), - output_data); -} - -// Legacy signature, function covered both Pad and PadV2. -template -inline void PadV2(const T* input_data, const Dims<4>& input_dims, - const std::vector& left_paddings, - const std::vector& right_paddings, T* output_data, - const Dims<4>& output_dims, const T pad_value) { - TFLITE_DCHECK_EQ(left_paddings.size(), 4); - TFLITE_DCHECK_EQ(right_paddings.size(), 4); - tflite::PadParams op_params; - op_params.left_padding_count = 4; - op_params.right_padding_count = 4; - for (int i = 0; i < 4; ++i) { - op_params.left_padding[i] = left_paddings[3 - i]; - op_params.right_padding[i] = right_paddings[3 - i]; - } - // SetFloatOrInt(pad_value, &op_params.pad_value); - const T pad_value_copy = pad_value; - - Pad(op_params, DimsToShape(input_dims), input_data, &pad_value_copy, - DimsToShape(output_dims), output_data); -} - -// Old Pad that calls legacy PadV2. -template -inline void Pad(const T* input_data, const Dims<4>& input_dims, - const std::vector& left_paddings, - const std::vector& right_paddings, T* output_data, - const Dims<4>& output_dims, const int32_t pad_value) { - const T converted_pad_value = static_cast(pad_value); - PadV2(input_data, input_dims, left_paddings, right_paddings, output_data, - output_dims, converted_pad_value); -} - -// Old Pad that only padded with 0. -template -inline void Pad(const T* input_data, const Dims<4>& input_dims, - const std::vector& left_paddings, - const std::vector& right_paddings, T* output_data, - const Dims<4>& output_dims) { - const T pad_value = static_cast(0); - PadV2(input_data, input_dims, left_paddings, right_paddings, output_data, - output_dims, pad_value); -} - -template -void TensorFlowMinimum(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, T* output_data, - const Dims<4>& output_dims) { - Minimum(DimsToShape(input1_dims), input1_data, input2_data, - DimsToShape(output_dims), output_data); -} - -template -void TensorFlowMaximum(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, T* output_data, - const Dims<4>& output_dims) { - Maximum(DimsToShape(input1_dims), input1_data, input2_data, - DimsToShape(output_dims), output_data); -} - -template -void TensorFlowMaximumMinimum(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, const Dims<4>& input2_dims, - T* output_data, const Dims<4>& output_dims, - Op op) { - MaximumMinimumBroadcastSlow(DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data, op); -} - -template -void ArgMax(const T3* axis, const T1* input_data, - const tflite::Dims<4>& input_dims, T2* output_data, - const tflite::Dims<4>& output_dims) { - // Assumes the input always has 4 dimensions, and therefore, - // output always has three dimensions. - auto output_shape = RuntimeShape( - {output_dims.sizes[2], output_dims.sizes[1], output_dims.sizes[0]}); - // Another way to interpret this is that output_dims.sizes[4] is always 1. - TFLITE_DCHECK_EQ(output_shape.FlatSize(), - DimsToShape(output_dims).FlatSize()); - // Legacy path only supported this. - TFLITE_DCHECK_EQ(axis[0], 3); - ArgMinMax(DimsToShape(input_dims), input_data, axis, output_shape, - output_data, std::greater()); -} - -template -void ArgMinMax(const T3* axis, const T1* input_data, const Dims<4>& input_dims, - T2* output_data, const Dims<4>& output_dims, const Cmp& cmp) { - ArgMinMax(axis, DimsToShape(input_dims), input_data, DimsToShape(output_dims), - output_data, cmp); -} - -template -inline void Pow(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, const Dims<4>& input2_dims, - T* output_data, const Dims<4>& output_dims) { - Pow(DimsToShape(input1_dims), input1_data, DimsToShape(input2_dims), - input2_data, DimsToShape(output_dims), output_data); -} - -template -inline void BroadcastPow(const T* input1_data, const Dims<4>& input1_dims, - const T* input2_data, const Dims<4>& input2_dims, - T* output_data, const Dims<4>& output_dims) { - BroadcastPow4DSlow(DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data); -} - -// R: Result type. T1: Input 1 type. T2: Input 2 type. -template -inline void BroadcastBinaryFunction(const T1* input1_data, - const Dims<4>& input1_dims, - const T2* input2_data, - const Dims<4>& input2_dims, R* output_data, - const Dims<4>& output_dims, - R (*func)(T1, T2)) { - BroadcastBinaryFunction(DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data, func); -} - -// R: Result type. T1: Input 1 type. T2: Input 2 type. -template -inline void BinaryFunction(const T1* input1_data, const Dims<4>& input1_dims, - const T2* input2_data, const Dims<4>& input2_dims, - R* output_data, const Dims<4>& output_dims, - R (*func)(T1, T2)) { - BinaryFunction(DimsToShape(input1_dims), input1_data, - DimsToShape(input2_dims), input2_data, - DimsToShape(output_dims), output_data, func); -} - -template -inline void Slice(const T* input_data, const Dims<4>& input_dims, - const std::vector& begin, const std::vector& size, - T* output_data, const Dims<4>& output_dims) { - tflite::SliceParams op_params; - op_params.begin_count = 4; - op_params.size_count = 4; - for (int i = 0; i < 4; ++i) { - op_params.begin[i] = begin[3 - i]; - op_params.size[i] = size[3 - i]; - } - - Slice(op_params, DimsToShape(input_dims), input_data, - DimsToShape(output_dims), output_data); -} - -} // namespace reference_ops -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_LEGACY_REFERENCE_OPS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/logistic.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/logistic.h deleted file mode 100644 index 64b7133..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/logistic.h +++ /dev/null @@ -1,132 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_LOGISTIC_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_LOGISTIC_H_ - -#include - -#include "fixedpoint/fixedpoint.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/quantization_util.h" -#include "tensorflow/lite/kernels/internal/types.h" -#include "tensorflow/lite/kernels/op_macros.h" - -namespace tflite { -namespace reference_ops { - -inline void Logistic(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - const float cutoff_upper = 16.619047164916992188f; - const float cutoff_lower = -9.f; - - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - // Rational for using approximation in reference kernel. - // 0. This approximation gives enough precision for float. - // 1. This works around an issue on an embedded chipset where exp() does not - // return correctly as expected - exp(x) should return inf when overflown - // not 1.701417 IEEE 754 defines representation for inf. - // 2. This will speed up calculation and is matching the behavior in the - // optimized kernels. (check the definition of scalar_logistic_op) - - for (int i = 0; i < flat_size; i++) { - float val = input_data[i]; - float result; - if (val > cutoff_upper) { - result = 1.0f; - } else if (val < cutoff_lower) { - result = std::exp(val); - } else { - result = 1.f / (1.f + std::exp(-val)); - } - output_data[i] = result; - } -} - -// Convenience version that allows, for example, generated-code calls to be -// uniform between data types. -inline void Logistic(const LogisticParams&, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& output_shape, - float* output_data) { - // Drop params: not needed. - Logistic(input_shape, input_data, output_shape, output_data); -} - -inline void Logistic(const LogisticParams& params, - const RuntimeShape& input_shape, const int16_t* input_data, - const RuntimeShape& output_shape, int16_t* output_data) { - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - // F0 uses 0 integer bits, range [-1, 1]. - // This is the return type of math functions such as tanh, logistic, - // whose range is in [-1, 1]. - using F0 = gemmlowp::FixedPoint; - // F3 uses 3 integer bits, range [-8, 8], the input range expected here. - using F3 = gemmlowp::FixedPoint; - - const F3 input = F3::FromRaw(input_data[i]); - F0 output = gemmlowp::logistic(input); - output_data[i] = output.raw(); - } -} - -// Quantized int8_t logistic activation. Cheats by dequantizing and -// requantizing around the floating point logistic method. This implementation -// is slow on platforms without a floating point unit. - -// TODO(b/141211002): Delete this int8_t implementation once we can reuse the -// approach used in TFLite for int8_t Logistic. -inline void Logistic(const RuntimeShape& input_shape, const int8_t* input_data, - float input_scale, int input_zero_point, - const RuntimeShape& output_shape, int8_t* output_data, - float output_scale, int output_zero_point) { - const float cutoff_upper = 16.619047164916992188f; - const float cutoff_lower = -9.f; - - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - // Rational for using approximation in reference kernel. - // 0. This approximation gives enough precision for float. - // 1. This works around an issue on an embedded chipset where exp() does not - // return correctly as expected - exp(x) should return inf when overflown - // not 1.701417 IEEE 754 defines representation for inf. - // 2. This will speed up calculation and is matching the behavior in the - // optimized kernels. (check the definition of scalar_logistic_op) - - for (int i = 0; i < flat_size; i++) { - // Dequantize. - float val = - static_cast((input_data[i] - input_zero_point) * input_scale); - float result; - if (val > cutoff_upper) { - result = 1.0f; - } else if (val < cutoff_lower) { - result = std::exp(val); - } else { - result = 1.f / (1.f + std::exp(-val)); - } - // Requantize - int8_t output = - static_cast(result / output_scale + output_zero_point); - output_data[i] = output; - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_LOGISTIC_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/maximum_minimum.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/maximum_minimum.h deleted file mode 100644 index cd11b41..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/maximum_minimum.h +++ /dev/null @@ -1,64 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_REFERENCE_MAXIMUM_MINIMUM_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_MAXIMUM_MINIMUM_H_ - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace reference_ops { - -template -void MaximumMinimumBroadcastSlow(const RuntimeShape& unextended_input1_shape, - const T* input1_data, - const RuntimeShape& unextended_input2_shape, - const T* input2_data, - const RuntimeShape& unextended_output_shape, - T* output_data, Op op) { - // Uses element-wise calculation if broadcast is not required. - if (unextended_input1_shape == unextended_input2_shape) { - const int flat_size = - MatchingElementsSize(unextended_input1_shape, unextended_input2_shape, - unextended_output_shape); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = op(input1_data[i], input2_data[i]); - } - } else { - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(unextended_input2_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), N); - - NdArrayDesc desc1; - NdArrayDesc desc2; - NdArrayDesc output_desc; - NdArrayDescsForElementwiseBroadcast( - unextended_input1_shape, unextended_input2_shape, &desc1, &desc2); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, unextended_output_shape), - &output_desc); - - auto maxmin_func = [&](int indexes[N]) { - output_data[SubscriptToIndex(output_desc, indexes)] = - op(input1_data[SubscriptToIndex(desc1, indexes)], - input2_data[SubscriptToIndex(desc2, indexes)]); - }; - NDOpsHelper(output_desc, maxmin_func); - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_MAXIMUM_MINIMUM_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/mul.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/mul.h deleted file mode 100644 index 0578b81..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/mul.h +++ /dev/null @@ -1,166 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_MUL_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_MUL_H_ - -#include "tensorflow/lite/kernels/internal/common.h" - -namespace tflite { - -namespace reference_ops { - -// Element-wise mul that can often be used for inner loop of broadcast Mul as -// well as the non-broadcast Mul. -inline void MulElementwise(int size, const ArithmeticParams& params, - const uint8_t* input1_data, - const uint8_t* input2_data, uint8_t* output_data) { - for (int i = 0; i < size; ++i) { - const int32_t input1_val = params.input1_offset + input1_data[i]; - const int32_t input2_val = params.input2_offset + input2_data[i]; - const int32_t unclamped_result = - params.output_offset + - MultiplyByQuantizedMultiplier(input1_val * input2_val, - params.output_multiplier, - params.output_shift); - const int32_t clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, unclamped_result)); - output_data[i] = static_cast(clamped_output); - } -} - -template -inline void Mul(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const T* input1_data, - const RuntimeShape& input2_shape, const T* input2_data, - const RuntimeShape& output_shape, T* output_data) { - T output_activation_min; - T output_activation_max; - GetActivationParams(params, &output_activation_min, &output_activation_max); - - const int flat_size = - MatchingFlatSize(input1_shape, input2_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax( - input1_data[i] * input2_data[i], output_activation_min, - output_activation_max); - } -} - -inline void Mul(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const uint8_t* input1_data, - const RuntimeShape& input2_shape, const uint8_t* input2_data, - const RuntimeShape& output_shape, uint8_t* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - const int flat_size = - MatchingFlatSize(input1_shape, input2_shape, output_shape); - - MulElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -inline void BroadcastMul4DSlow(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const uint8_t* input1_data, - const RuntimeShape& input2_shape, - const uint8_t* input2_data, - const RuntimeShape& output_shape, - uint8_t* output_data) { - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - const RuntimeShape extended_output_shape = - RuntimeShape::ExtendedShape(4, output_shape); - - for (int b = 0; b < extended_output_shape.Dims(0); ++b) { - for (int y = 0; y < extended_output_shape.Dims(1); ++y) { - for (int x = 0; x < extended_output_shape.Dims(2); ++x) { - for (int c = 0; c < extended_output_shape.Dims(3); ++c) { - const int32_t input1_val = - params.input1_offset + - input1_data[SubscriptToIndex(desc1, b, y, x, c)]; - const int32_t input2_val = - params.input2_offset + - input2_data[SubscriptToIndex(desc2, b, y, x, c)]; - const int32_t unclamped_result = - params.output_offset + - MultiplyByQuantizedMultiplier(input1_val * input2_val, - params.output_multiplier, - params.output_shift); - const int32_t clamped_output = std::min( - params.quantized_activation_max, - std::max(params.quantized_activation_min, unclamped_result)); - output_data[Offset(extended_output_shape, b, y, x, c)] = - static_cast(clamped_output); - } - } - } - } -} - -template -void BroadcastMul4DSlow(const ArithmeticParams& params, - const RuntimeShape& unextended_input1_shape, - const T* input1_data, - const RuntimeShape& unextended_input2_shape, - const T* input2_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - T output_activation_min; - T output_activation_max; - GetActivationParams(params, &output_activation_min, &output_activation_max); - - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_input2_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - NdArrayDescsForElementwiseBroadcast(unextended_input1_shape, - unextended_input2_shape, &desc1, &desc2); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - for (int b = 0; b < output_shape.Dims(0); ++b) { - for (int y = 0; y < output_shape.Dims(1); ++y) { - for (int x = 0; x < output_shape.Dims(2); ++x) { - for (int c = 0; c < output_shape.Dims(3); ++c) { - output_data[Offset(output_shape, b, y, x, c)] = - ActivationFunctionWithMinMax( - input1_data[SubscriptToIndex(desc1, b, y, x, c)] * - input2_data[SubscriptToIndex(desc2, b, y, x, c)], - output_activation_min, output_activation_max); - } - } - } - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_MUL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/neg.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/neg.h deleted file mode 100644 index e127883..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/neg.h +++ /dev/null @@ -1,37 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_NEG_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NEG_H_ - -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -template -inline void Negate(const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; ++i) { - output_data[i] = -input_data[i]; - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NEG_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/non_max_suppression.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/non_max_suppression.h deleted file mode 100644 index 64c27c1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/non_max_suppression.h +++ /dev/null @@ -1,193 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_NON_MAX_SUPPRESSION_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NON_MAX_SUPPRESSION_H_ - -#include -#include -#include -#include - -namespace tflite { -namespace reference_ops { - -// A pair of diagonal corners of the box. -struct BoxCornerEncoding { - float y1; - float x1; - float y2; - float x2; -}; - -inline float ComputeIntersectionOverUnion(const float* boxes, const int i, - const int j) { - auto& box_i = reinterpret_cast(boxes)[i]; - auto& box_j = reinterpret_cast(boxes)[j]; - const float box_i_y_min = std::min(box_i.y1, box_i.y2); - const float box_i_y_max = std::max(box_i.y1, box_i.y2); - const float box_i_x_min = std::min(box_i.x1, box_i.x2); - const float box_i_x_max = std::max(box_i.x1, box_i.x2); - const float box_j_y_min = std::min(box_j.y1, box_j.y2); - const float box_j_y_max = std::max(box_j.y1, box_j.y2); - const float box_j_x_min = std::min(box_j.x1, box_j.x2); - const float box_j_x_max = std::max(box_j.x1, box_j.x2); - - const float area_i = - (box_i_y_max - box_i_y_min) * (box_i_x_max - box_i_x_min); - const float area_j = - (box_j_y_max - box_j_y_min) * (box_j_x_max - box_j_x_min); - if (area_i <= 0 || area_j <= 0) return 0.0; - const float intersection_ymax = std::min(box_i_y_max, box_j_y_max); - const float intersection_xmax = std::min(box_i_x_max, box_j_x_max); - const float intersection_ymin = std::max(box_i_y_min, box_j_y_min); - const float intersection_xmin = std::max(box_i_x_min, box_j_x_min); - const float intersection_area = - std::max(intersection_ymax - intersection_ymin, 0.0) * - std::max(intersection_xmax - intersection_xmin, 0.0); - return intersection_area / (area_i + area_j - intersection_area); -} - -// Implements (Single-Class) Soft NMS (with Gaussian weighting). -// Supports functionality of TensorFlow ops NonMaxSuppressionV4 & V5. -// Reference: "Soft-NMS - Improving Object Detection With One Line of Code" -// [Bodla et al, https://arxiv.org/abs/1704.04503] -// Implementation adapted from the TensorFlow NMS code at -// tensorflow/core/kernels/non_max_suppression_op.cc. -// -// Arguments: -// boxes: box encodings in format [y1, x1, y2, x2], shape: [num_boxes, 4] -// num_boxes: number of candidates -// scores: scores for candidate boxes, in the same order. shape: [num_boxes] -// max_output_size: the maximum number of selections. -// iou_threshold: Intersection-over-Union (IoU) threshold for NMS -// score_threshold: All candidate scores below this value are rejected -// soft_nms_sigma: Soft NMS parameter, used for decaying scores -// -// Outputs: -// selected_indices: all the selected indices. Underlying array must have -// length >= max_output_size. Cannot be null. -// selected_scores: scores of selected indices. Defer from original value for -// Soft NMS. If not null, array must have length >= max_output_size. -// num_selected_indices: Number of selections. Only these many elements are -// set in selected_indices, selected_scores. Cannot be null. -// -// Assumes inputs are valid (for eg, iou_threshold must be >= 0). -inline void NonMaxSuppression(const float* boxes, const int num_boxes, - const float* scores, const int max_output_size, - const float iou_threshold, - const float score_threshold, - const float soft_nms_sigma, int* selected_indices, - float* selected_scores, - int* num_selected_indices) { - struct Candidate { - int index; - float score; - int suppress_begin_index; - }; - - // Priority queue to hold candidates. - auto cmp = [](const Candidate bs_i, const Candidate bs_j) { - return bs_i.score < bs_j.score; - }; - std::priority_queue, decltype(cmp)> - candidate_priority_queue(cmp); - // Populate queue with candidates above the score threshold. - for (int i = 0; i < num_boxes; ++i) { - if (scores[i] > score_threshold) { - candidate_priority_queue.emplace(Candidate({i, scores[i], 0})); - } - } - - *num_selected_indices = 0; - int num_outputs = std::min(static_cast(candidate_priority_queue.size()), - max_output_size); - if (num_outputs == 0) return; - - // NMS loop. - float scale = 0; - if (soft_nms_sigma > 0.0) { - scale = -0.5 / soft_nms_sigma; - } - while (*num_selected_indices < num_outputs && - !candidate_priority_queue.empty()) { - Candidate next_candidate = candidate_priority_queue.top(); - const float original_score = next_candidate.score; - candidate_priority_queue.pop(); - - // Overlapping boxes are likely to have similar scores, therefore we - // iterate through the previously selected boxes backwards in order to - // see if `next_candidate` should be suppressed. We also enforce a property - // that a candidate can be suppressed by another candidate no more than - // once via `suppress_begin_index` which tracks which previously selected - // boxes have already been compared against next_candidate prior to a given - // iteration. These previous selected boxes are then skipped over in the - // following loop. - bool should_hard_suppress = false; - for (int j = *num_selected_indices - 1; - j >= next_candidate.suppress_begin_index; --j) { - const float iou = ComputeIntersectionOverUnion( - boxes, next_candidate.index, selected_indices[j]); - - // First decide whether to perform hard suppression. - if (iou >= iou_threshold) { - should_hard_suppress = true; - break; - } - - // Suppress score if NMS sigma > 0. - if (soft_nms_sigma > 0.0) { - next_candidate.score = - next_candidate.score * std::exp(scale * iou * iou); - } - - // If score has fallen below score_threshold, it won't be pushed back into - // the queue. - if (next_candidate.score <= score_threshold) break; - } - // If `next_candidate.score` has not dropped below `score_threshold` - // by this point, then we know that we went through all of the previous - // selections and can safely update `suppress_begin_index` to - // `selected.size()`. If on the other hand `next_candidate.score` - // *has* dropped below the score threshold, then since `suppress_weight` - // always returns values in [0, 1], further suppression by items that were - // not covered in the above for loop would not have caused the algorithm - // to select this item. We thus do the same update to - // `suppress_begin_index`, but really, this element will not be added back - // into the priority queue. - next_candidate.suppress_begin_index = *num_selected_indices; - - if (!should_hard_suppress) { - if (next_candidate.score == original_score) { - // Suppression has not occurred, so select next_candidate. - selected_indices[*num_selected_indices] = next_candidate.index; - if (selected_scores) { - selected_scores[*num_selected_indices] = next_candidate.score; - } - ++*num_selected_indices; - } - if (next_candidate.score > score_threshold) { - // Soft suppression might have occurred and current score is still - // greater than score_threshold; add next_candidate back onto priority - // queue. - candidate_priority_queue.push(next_candidate); - } - } - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_NON_MAX_SUPPRESSION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/pad.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/pad.h deleted file mode 100644 index 2a040ce..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/pad.h +++ /dev/null @@ -1,162 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_PAD_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PAD_H_ - -#include - -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -// TFLite Pad supports activation tensors with up to 4 dimensions. -constexpr int PadKernelMaxDimensionCount() { return 4; } - -// There are two versions of pad: Pad and PadV2. In PadV2 there is a second -// scalar input that provides the padding value. Therefore pad_value_ptr can be -// equivalent to a simple input1_data. For Pad, it should point to a zero -// value. -// -// Note that two typenames are required, so that T=P=int32_t is considered a -// specialization distinct from P=int32_t. -template -inline void PadImpl(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const P* pad_value_ptr, const RuntimeShape& output_shape, - T* output_data) { - const RuntimeShape ext_input_shape = - RuntimeShape::ExtendedShape(PadKernelMaxDimensionCount(), input_shape); - const RuntimeShape ext_output_shape = - RuntimeShape::ExtendedShape(PadKernelMaxDimensionCount(), output_shape); - TFLITE_DCHECK_LE(op_params.left_padding_count, PadKernelMaxDimensionCount()); - TFLITE_DCHECK_LE(op_params.right_padding_count, PadKernelMaxDimensionCount()); - - // Runtime calls are currently fixed at 4 dimensions. Copy inputs so we can - // pad them to 4 dims (yes, we are "padding the padding"). - int left_padding_copy[PadKernelMaxDimensionCount()]; - for (int i = 0; i < PadKernelMaxDimensionCount(); i++) { - left_padding_copy[i] = 0; - } - for (int i = 0; i < op_params.left_padding_count; ++i) { - left_padding_copy[i + PadKernelMaxDimensionCount() - - op_params.left_padding_count] = op_params.left_padding[i]; - } - int right_padding_copy[PadKernelMaxDimensionCount()]; - for (int i = 0; i < PadKernelMaxDimensionCount(); i++) { - right_padding_copy[i] = 0; - } - for (int i = 0; i < op_params.right_padding_count; ++i) { - right_padding_copy[i + PadKernelMaxDimensionCount() - - op_params.right_padding_count] = - op_params.right_padding[i]; - } - - const int output_batch = ext_output_shape.Dims(0); - const int output_height = ext_output_shape.Dims(1); - const int output_width = ext_output_shape.Dims(2); - const int output_depth = ext_output_shape.Dims(3); - - const int left_b_padding = left_padding_copy[0]; - const int left_h_padding = left_padding_copy[1]; - const int left_w_padding = left_padding_copy[2]; - const int left_d_padding = left_padding_copy[3]; - - const int right_b_padding = right_padding_copy[0]; - const int right_h_padding = right_padding_copy[1]; - const int right_w_padding = right_padding_copy[2]; - const int right_d_padding = right_padding_copy[3]; - - const T pad_value = *pad_value_ptr; - - const T* in_ptr = input_data; - T* out_ptr = output_data; - for (int out_b = 0; out_b < output_batch; ++out_b) { - for (int out_h = 0; out_h < output_height; ++out_h) { - for (int out_w = 0; out_w < output_width; ++out_w) { - for (int out_d = 0; out_d < output_depth; ++out_d) { - if (out_b < left_b_padding || - out_b >= output_batch - right_b_padding || - out_h < left_h_padding || - out_h >= output_height - right_h_padding || - out_w < left_w_padding || - out_w >= output_width - right_w_padding || - out_d < left_d_padding || - out_d >= output_depth - right_d_padding) { - *out_ptr++ = pad_value; - } else { - *out_ptr++ = *in_ptr++; - } - } - } - } - } -} - -template -inline void Pad(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const P* pad_value_ptr, const RuntimeShape& output_shape, - T* output_data) { - PadImpl(op_params, input_shape, input_data, pad_value_ptr, output_shape, - output_data); -} - -// The second (pad-value) input can be int32_t when, say, the first is uint8_t. -template -inline void Pad(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const int32_t* pad_value_ptr, const RuntimeShape& output_shape, - T* output_data) { - const T converted_pad_value = static_cast(*pad_value_ptr); - PadImpl(op_params, input_shape, input_data, &converted_pad_value, - output_shape, output_data); -} - -// This version avoids conflicting template matching. -template <> -inline void Pad(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, const int32_t* input_data, - const int32_t* pad_value_ptr, const RuntimeShape& output_shape, - int32_t* output_data) { - PadImpl(op_params, input_shape, input_data, pad_value_ptr, output_shape, - output_data); -} - -template -inline void PadImageStyle(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const P* pad_value_ptr, - const RuntimeShape& output_shape, T* output_data) { - Pad(op_params, input_shape, input_data, pad_value_ptr, output_shape, - output_data); -} - -template -inline void PadImageStyle(const tflite::PadParams& op_params, - const RuntimeShape& input_shape, - const float* input_data, const P* pad_value_ptr, - const RuntimeShape& output_shape, - float* output_data) { - Pad(op_params, input_shape, input_data, pad_value_ptr, output_shape, - output_data); -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PAD_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/pooling.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/pooling.h deleted file mode 100644 index ee30b84..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/pooling.h +++ /dev/null @@ -1,301 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_POOLING_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_POOLING_H_ - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/quantization_util.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace reference_ops { - -inline bool AveragePool(const PoolParams& params, - const RuntimeShape& input_shape, - const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int channel = 0; channel < depth; ++channel) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - // Compute the boundaries of the filter region clamped so as to - // ensure that the filter window fits in the input array. - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - float total = 0.f; - float filter_count = 0; - for (int filter_y = filter_y_start; filter_y < filter_y_end; - ++filter_y) { - for (int filter_x = filter_x_start; filter_x < filter_x_end; - ++filter_x) { - const int in_x = in_x_origin + filter_x; - const int in_y = in_y_origin + filter_y; - total += - input_data[Offset(input_shape, batch, in_y, in_x, channel)]; - filter_count++; - } - } - if (filter_count == 0) return false; - const float average = total / filter_count; - output_data[Offset(output_shape, batch, out_y, out_x, channel)] = - ActivationFunctionWithMinMax(average, params.float_activation_min, - params.float_activation_max); - } - } - } - } - return true; -} - -inline bool AveragePool(const PoolParams& params, - const RuntimeShape& input_shape, - const uint8_t* input_data, - const RuntimeShape& output_shape, - uint8_t* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int channel = 0; channel < depth; ++channel) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - // Compute the boundaries of the filter region clamped so as to - // ensure that the filter window fits in the input array. - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - int32_t acc = 0; - int filter_count = 0; - for (int filter_y = filter_y_start; filter_y < filter_y_end; - ++filter_y) { - for (int filter_x = filter_x_start; filter_x < filter_x_end; - ++filter_x) { - const int in_x = in_x_origin + filter_x; - const int in_y = in_y_origin + filter_y; - acc += - input_data[Offset(input_shape, batch, in_y, in_x, channel)]; - filter_count++; - } - } - if (filter_count == 0) return false; - acc = (acc + filter_count / 2) / filter_count; - acc = std::max(acc, params.quantized_activation_min); - acc = std::min(acc, params.quantized_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, channel)] = - static_cast(acc); - } - } - } - } - return true; -} - -inline void L2Pool(const PoolParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& output_shape, - float* output_data) { - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int channel = 0; channel < depth; ++channel) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - // Compute the boundaries of the filter region clamped so as to - // ensure that the filter window fits in the input array. - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - float sum_squares = 0.f; - int filter_count = 0; - for (int filter_y = filter_y_start; filter_y < filter_y_end; - ++filter_y) { - for (int filter_x = filter_x_start; filter_x < filter_x_end; - ++filter_x) { - const int in_x = in_x_origin + filter_x; - const int in_y = in_y_origin + filter_y; - const float val = - input_data[Offset(input_shape, batch, in_y, in_x, channel)]; - sum_squares += val * val; - filter_count++; - } - } - const float l2pool_result = std::sqrt(sum_squares / filter_count); - output_data[Offset(output_shape, batch, out_y, out_x, channel)] = - ActivationFunctionWithMinMax(l2pool_result, - params.float_activation_min, - params.float_activation_max); - } - } - } - } -} - -inline void MaxPool(const PoolParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& output_shape, - float* output_data) { - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int channel = 0; channel < depth; ++channel) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - // Compute the boundaries of the filter region clamped so as to - // ensure that the filter window fits in the input array. - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - float max = std::numeric_limits::lowest(); - for (int filter_y = filter_y_start; filter_y < filter_y_end; - ++filter_y) { - for (int filter_x = filter_x_start; filter_x < filter_x_end; - ++filter_x) { - const int in_x = in_x_origin + filter_x; - const int in_y = in_y_origin + filter_y; - max = std::max( - max, - input_data[Offset(input_shape, batch, in_y, in_x, channel)]); - } - } - output_data[Offset(output_shape, batch, out_y, out_x, channel)] = - ActivationFunctionWithMinMax(max, params.float_activation_min, - params.float_activation_max); - } - } - } - } -} - -inline void MaxPool(const PoolParams& params, const RuntimeShape& input_shape, - const uint8_t* input_data, const RuntimeShape& output_shape, - uint8_t* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - TFLITE_DCHECK_GE(params.quantized_activation_min, 0); - TFLITE_DCHECK_LE(params.quantized_activation_max, 255); - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int depth = MatchingDim(input_shape, 3, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int stride_height = params.stride_height; - const int stride_width = params.stride_width; - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int channel = 0; channel < depth; ++channel) { - const int in_x_origin = - (out_x * stride_width) - params.padding_values.width; - const int in_y_origin = - (out_y * stride_height) - params.padding_values.height; - // Compute the boundaries of the filter region clamped so as to - // ensure that the filter window fits in the input array. - const int filter_x_start = std::max(0, -in_x_origin); - const int filter_x_end = - std::min(params.filter_width, input_width - in_x_origin); - const int filter_y_start = std::max(0, -in_y_origin); - const int filter_y_end = - std::min(params.filter_height, input_height - in_y_origin); - uint8_t max = 0; - for (int filter_y = filter_y_start; filter_y < filter_y_end; - ++filter_y) { - for (int filter_x = filter_x_start; filter_x < filter_x_end; - ++filter_x) { - const int in_x = in_x_origin + filter_x; - const int in_y = in_y_origin + filter_y; - max = std::max( - max, - input_data[Offset(input_shape, batch, in_y, in_x, channel)]); - } - } - max = std::max(max, params.quantized_activation_min); - max = std::min(max, params.quantized_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, channel)] = - static_cast(max); - } - } - } - } -} -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_POOLING_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/portable_tensor_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/portable_tensor_utils.h deleted file mode 100644 index 054fa43..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/portable_tensor_utils.h +++ /dev/null @@ -1,326 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_REFERENCE_PORTABLE_TENSOR_UTILS_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PORTABLE_TENSOR_UTILS_H_ - -// TODO(ghodrat): Remove this header file and the dependency to internal data -// structure. -#include "tensorflow/lite/c/builtin_op_data.h" -#include "tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h" - -#if defined(_MSC_VER) -#define __restrict__ __restrict -#endif - -namespace tflite { -namespace tensor_utils { - -// Check if all entries of a vector are zero for float. -bool IsZeroVector(const float* vector, int v_size) { - return PortableIsZeroVector(vector, v_size); -} - -// Check if all entries of a vector are zero for int8_t. -bool IsZeroVector(const int8_t* vector, int v_size) { - return PortableIsZeroVector(vector, v_size); -} - -void SymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, float* min, float* max, - float* scaling_factor) { - PortableSymmetricQuantizeFloats(values, size, quantized_values, min, max, - scaling_factor); -} - -void SymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, float min_value, - float max_value, float* scaling_factor) { - PortableSymmetricQuantizeFloats(values, size, quantized_values, min_value, - max_value, scaling_factor); -} - -void AsymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, float* scaling_factor, - int32_t* offset) { - PortableAsymmetricQuantizeFloats(values, size, quantized_values, - scaling_factor, offset); -} - -void MatrixBatchVectorMultiplyAccumulate(const float* matrix, int m_rows, - int m_cols, const float* vector, - int n_batch, float* result) { - PortableMatrixBatchVectorMultiplyAccumulate(matrix, m_rows, m_cols, vector, - n_batch, result); -} - -void MatrixBatchVectorMultiplyAccumulate(const int8_t* __restrict__ matrix, - const int m_rows, const int m_cols, - const int8_t* __restrict__ vector, - const float* scaling_factors, - int n_batch, - float* __restrict__ result) { - PortableMatrixBatchVectorMultiplyAccumulate(matrix, m_rows, m_cols, vector, - scaling_factors, n_batch, result); -} - -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, const float* scaling_factors, - int n_batch, float* __restrict__ result, const float* per_channel_scale, - const int32_t* input_offset, int32_t* scratch, int32_t* row_sums, - bool* compute_row_sums, CpuBackendContext* context) { - PortableMatrixBatchVectorMultiplyAccumulate( - matrix, m_rows, m_cols, vectors, scaling_factors, n_batch, result, - per_channel_scale, input_offset, scratch, row_sums, compute_row_sums, - context); -} - -void MatrixBatchVectorMultiplyAccumulate(const int8_t* __restrict__ matrix, - const int m_rows, const int m_cols, - const int8_t* __restrict__ vector, - const float* scaling_factors, - int n_batch, int32_t* scratch, - float* __restrict__ result, - CpuBackendContext* context) { - PortableMatrixBatchVectorMultiplyAccumulate(matrix, m_rows, m_cols, vector, - scaling_factors, n_batch, result); -} - -void SparseMatrixBatchVectorMultiplyAccumulate1x4( - const float* __restrict__ matrix, const int32_t* __restrict__ segments, - const int32_t* __restrict__ indices, int m_rows, int m_cols, - const float* __restrict__ vector, int n_batch, float* __restrict__ result) { - PortableSparseMatrixBatchVectorMultiplyAccumulate1x4( - matrix, segments, indices, m_rows, m_cols, vector, n_batch, result); -} - -void SparseMatrixBatchVectorMultiplyAccumulate( - const float* __restrict__ matrix, const uint8_t* __restrict__ ledger, - int m_rows, int m_cols, const float* __restrict__ vector, int n_batch, - float* __restrict__ result) { - PortableSparseMatrixBatchVectorMultiplyAccumulate( - matrix, ledger, m_rows, m_cols, vector, n_batch, result); -} - -void SparseMatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const uint8_t* ledger, const int m_rows, - const int m_cols, const int8_t* __restrict__ vectors, - const float* scaling_factors, int n_batch, float* __restrict__ result) { - PortableSparseMatrixBatchVectorMultiplyAccumulate( - matrix, ledger, m_rows, m_cols, vectors, scaling_factors, n_batch, - result); -} - -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* input, const int32_t* bias, - const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift, - int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp, - int32_t* scratch, int16_t* output, CpuBackendContext* context) { - PortableMatrixBatchVectorMultiplyAccumulate( - input, bias, input_to_gate_weights, multiplier, shift, n_batch, n_input, - n_output, output_zp, scratch, output, context); -} - -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* input, const int32_t* bias, - const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift, - int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp, - int32_t* scratch, int8_t* output, CpuBackendContext* context) { - PortableMatrixBatchVectorMultiplyAccumulate( - input, bias, input_to_gate_weights, multiplier, shift, n_batch, n_input, - n_output, output_zp, scratch, output, context); -} - -void MatrixScalarMultiplyAccumulate(const int8_t* matrix, int32_t scalar, - int32_t n_row, int32_t n_col, - int32_t* output) { - PortableMatrixScalarMultiplyAccumulate(matrix, scalar, n_row, n_col, output); -} - -void MatrixBatchVectorMultiply(const int8_t* input, int32_t input_zeropoint, - const int8_t* input_to_gate_weights, - int32_t input_to_gate_effective_scale_a, - int32_t input_to_gate_effective_scale_b, - int32_t n_batch, int32_t n_input, int32_t n_cell, - int8_t* gate_output, int8_t gate_output_zp) { - PortableMatrixBatchVectorMultiply( - input, input_zeropoint, input_to_gate_weights, - input_to_gate_effective_scale_a, input_to_gate_effective_scale_b, n_batch, - n_input, n_cell, gate_output, gate_output_zp); -} - -void MatrixBatchVectorMultiply(const int16_t* hidden, - const int8_t* hidden_to_output_weights, - int32_t proj_effective_scale_a, - int32_t proj_effective_scale_b, - const int32_t* gate_bias, int32_t n_batch, - int32_t n_hidden, int32_t n_output, - int32_t output_zp, int8_t* proj_output) { - PortableMatrixBatchVectorMultiply(hidden, hidden_to_output_weights, - proj_effective_scale_a, - proj_effective_scale_b, gate_bias, n_batch, - n_hidden, n_output, output_zp, proj_output); -} - -void ApplyLayerNorm(const int16_t* input, const int16_t* layer_norm_weights, - const int32_t* bias, int32_t layer_norm_scale_a, - int32_t layer_norm_scale_b, int32_t variance_limit, - int n_batch, int n_input, int16_t* output) { - PortableApplyLayerNorm(input, layer_norm_weights, bias, layer_norm_scale_a, - layer_norm_scale_b, variance_limit, n_batch, n_input, - output); -} - -void ApplyLayerNormFloat(const int16_t* input, - const int16_t* layer_norm_weights, - int32_t layer_norm_scale_a, int32_t layer_norm_scale_b, - const int32_t* bias, int n_batch, int n_input, - int16_t* output) { - PortableApplyLayerNormFloat(input, layer_norm_weights, layer_norm_scale_a, - layer_norm_scale_b, bias, n_batch, n_input, - output); -} - -void ApplySigmoid(const int16_t* input, int32_t n_batch, int32_t n_input, - int16_t* output) { - PortableApplySigmoid(input, n_batch, n_input, output); -} - -void ApplySigmoidFloat(const int16_t* input, int32_t n_batch, int32_t n_input, - int16_t* output) { - PortableApplySigmoidFloat(input, n_batch, n_input, output); -} - -void ApplyTanh(int32_t integer_bits, const int16_t* input, int32_t n_batch, - int32_t n_input, int16_t* output) { - PortableApplyTanh(integer_bits, input, n_batch, n_input, output); -} - -void ApplyTanhFloat(const int16_t* input, int32_t n_batch, int32_t n_input, - int32_t integer_bits, int16_t* output) { - PortableApplyTanhFloat(input, n_batch, n_input, integer_bits, output); -} - -void CwiseMul(const int16_t* input_1, const int16_t* input_2, int n_batch, - int n_input, int shift, int16_t* output) { - PortableCwiseMul(input_1, input_2, n_batch, n_input, shift, output); -} - -void CwiseMul(const int16_t* input_1, const int16_t* input_2, - int32_t multiplier, int32_t shift, int32_t n_batch, - int32_t n_input, int32_t output_zp, int8_t* output) { - PortableCwiseMul(input_1, input_2, multiplier, shift, n_batch, n_input, - output_zp, output); -} - -void CwiseAdd(const int16_t* input_1, const int16_t* input_2, int n_batch, - int n_input, int16_t* output) { - PortableCwiseAdd(input_1, input_2, n_batch, n_input, output); -} - -void CwiseClipping(float* vector, const int v_size, - const float clipping_value) { - PortableCwiseClipping(vector, v_size, clipping_value); -} - -void CwiseClipping(int16_t* vector, const int v_size, - const int16_t clipping_value) { - PortableCwiseClipping(vector, v_size, clipping_value); -} - -void CwiseClipping(int8_t* vector, const int v_size, - const int8_t clipping_value) { - PortableCwiseClipping(vector, v_size, clipping_value); -} - -void VectorBatchVectorCwiseProductAccumulate(const int16_t* vector, int v_size, - const int16_t* batch_vector, - int n_batch, int32_t multiplier, - int shift, int16_t* result) { - PortableVectorBatchVectorCwiseProductAccumulate( - vector, v_size, batch_vector, n_batch, multiplier, shift, result); -} - -float VectorVectorDotProduct(const float* vector1, const float* vector2, - int v_size) { - return PortableVectorVectorDotProduct(vector1, vector2, v_size); -} - -void BatchVectorBatchVectorDotProduct(const int16_t* vector1, - const int16_t* vector2, int v_size, - int n_batch, int32_t* result) { - PortableBatchVectorBatchVectorDotProduct(vector1, vector2, v_size, n_batch, - result); -} - -void VectorBatchVectorAdd(const float* vector, int v_size, int n_batch, - float* batch_vector) { - PortableVectorBatchVectorAdd(vector, v_size, n_batch, batch_vector); -} - -void Sub1Vector(const float* vector, int v_size, float* result) { - PortableSub1Vector(vector, v_size, result); -} - -void Sub1Vector(const int16_t* vector, int v_size, int16_t* result) { - PortableSub1Vector(vector, v_size, result); -} - -// Multiply all elements of vector with a scalar. -void VectorScalarMultiply(const int8_t* vector, int v_size, float scale, - float* result) { - PortableVectorScalarMultiply(vector, v_size, scale, result); -} - -void ReductionSumVector(const float* input_vector, float* output_vector, - int output_size, int reduction_size) { - PortableReductionSumVector(input_vector, output_vector, output_size, - reduction_size); -} - -void ReductionSumVector(const int32_t* input_vector, int32_t* output_vector, - int output_size, int reduction_size) { - PortableReductionSumVector(input_vector, output_vector, output_size, - reduction_size); -} - -void ReductionSumVector(const int8_t* input_vector, int32_t* output_vector, - int output_size, int reduction_size) { - PortableReductionSumVector(input_vector, output_vector, output_size, - reduction_size); -} - -void MeanStddevNormalization(const float* input_vector, float* output_vector, - int v_size, int n_batch) { - PortableMeanStddevNormalization(input_vector, output_vector, v_size, n_batch); -} - -void TwoGateSaturatingAdd(const int8_t* input, int8_t input_zp, - const int8_t* recurrent, int8_t recurrent_zp, - int32_t input_effective_scale_a, - int32_t input_effective_scale_b, - int32_t recurrent_effective_scale_a, - int32_t recurrent_effective_scale_b, int32_t n_batch, - int32_t n_cell, int16_t* output) { - PortableTwoGateSaturatingAdd( - input, input_zp, recurrent, recurrent_zp, input_effective_scale_a, - input_effective_scale_b, recurrent_effective_scale_a, - recurrent_effective_scale_b, n_batch, n_cell, output); -} - -} // namespace tensor_utils -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PORTABLE_TENSOR_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h deleted file mode 100644 index 86cd4e3..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/portable_tensor_utils_impl.h +++ /dev/null @@ -1,240 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_PORTABLE_TENSOR_UTILS_IMPL_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PORTABLE_TENSOR_UTILS_IMPL_H_ - -#include -#include - -// TODO(ghodrat): Remove this header file and the dependency to internal data -// structure. -#include "tensorflow/lite/c/builtin_op_data.h" - -#if defined(_MSC_VER) -#define __restrict__ __restrict -#endif - -namespace tflite { - -// Not all backends support CpuBackendContext usage, so forward declare to avoid -// pulling in its implementation. -class CpuBackendContext; - -namespace tensor_utils { - -template -bool PortableIsZeroVector(const T* vector, int v_size) { - for (int i = 0; i < v_size; ++i) { - if (vector[i] != 0) { - return false; - } - } - return true; -} - -void PortableSymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, float* min_value, - float* max_value, float* scaling_factor); - -void PortableSymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, float min_value, - float max_value, float* scaling_factor); - -void PortableAsymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, - float* scaling_factor, int32_t* offset); - -// Multiply a matrix by a batch vector, and store results in a batch-size -// vector. -void PortableMatrixBatchVectorMultiplyAccumulate(const float* matrix, - int m_rows, int m_cols, - const float* vector, - int n_batch, float* result); - -void PortableMatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, const float* scaling_factors, - int n_batch, float* __restrict__ result); - -void PortableMatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, const float* scaling_factors, - int n_batch, float* __restrict__ result, const float* per_channel_scale, - const int32_t* input_offset, int32_t* scratch, int32_t* row_sums, - bool* compute_row_sums, CpuBackendContext* context); - -void PortableMatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vector, const float* scaling_factors, - int n_batch, int32_t* scratch, float* __restrict__ result, - CpuBackendContext* context); - -void PortableSparseMatrixBatchVectorMultiplyAccumulate1x4( - const float* __restrict__ matrix, const int32_t* __restrict__ segments, - const int32_t* __restrict__ indices, int m_rows, int m_cols, - const float* __restrict__ vector, int n_batch, float* __restrict__ result); - -void PortableSparseMatrixBatchVectorMultiplyAccumulate( - const float* __restrict__ matrix, const uint8_t* __restrict__ ledger, - int m_rows, int m_cols, const float* __restrict__ vector, int n_batch, - float* __restrict__ result); - -void PortableSparseMatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const uint8_t* ledger, const int m_rows, - const int m_cols, const int8_t* __restrict__ vectors, - const float* scaling_factors, int n_batch, float* __restrict__ result); - -// Dot product of two vectors. -float PortableVectorVectorDotProduct(const float* vector1, const float* vector2, - int v_size); - -void PortableBatchVectorBatchVectorDotProduct(const int16_t* vector1, - const int16_t* vector2, - int v_size, int n_batch, - int32_t* result); - -void PortableVectorBatchVectorCwiseProductAccumulate( - const int16_t* vector, int v_size, const int16_t* batch_vector, int n_batch, - int32_t multiplier, int shift, int16_t* result); - -void PortableMatrixBatchVectorMultiplyAccumulate( - const int8_t* input, const int32_t* bias, - const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift, - int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp, - int32_t* scratch, int16_t* output, CpuBackendContext* context); - -void PortableMatrixBatchVectorMultiplyAccumulate( - const int8_t* input, const int32_t* bias, - const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift, - int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp, - int32_t* scratch, int8_t* output, CpuBackendContext* context); - -void PortableMatrixBatchVectorMultiply(const int8_t* input, - int32_t input_zeropoint, - const int8_t* input_to_gate_weights, - int32_t input_to_gate_effective_scale_a, - int32_t input_to_gate_effective_scale_b, - int32_t n_batch, int32_t n_input, - int32_t n_cell, int8_t* gate_output, - int8_t gate_output_zp); - -void PortableMatrixBatchVectorMultiply( - const int16_t* hidden, const int8_t* hidden_to_output_weights, - int32_t proj_effective_scale_a, int32_t proj_effective_scale_b, - const int32_t* gate_bias, int32_t n_batch, int32_t n_hidden, - int32_t n_output, int32_t output_zp, int8_t* proj_output); - -void PortableMatrixScalarMultiplyAccumulate(const int8_t* matrix, - int32_t scalar, int32_t n_row, - int32_t n_col, int32_t* output); - -void PortableApplyLayerNorm(const int16_t* input, - const int16_t* layer_norm_weights, - const int32_t* bias, int32_t layer_norm_scale_a, - int32_t layer_norm_scale_b, int32_t variance_limit, - int n_batch, int n_input, int16_t* output); - -void PortableApplyLayerNormFloat(const int16_t* input, - const int16_t* layer_norm_weights, - int32_t layer_norm_scale_a, - int32_t layer_norm_scale_b, - const int32_t* bias, int n_batch, int n_input, - int16_t* output); - -void PortableApplySigmoid(const int16_t* input, int32_t n_batch, - int32_t n_input, int16_t* output); - -void PortableApplySigmoidFloat(const int16_t* input, int32_t n_batch, - int32_t n_input, int16_t* output); - -void PortableApplyTanh(int32_t integer_bits, const int16_t* input, - int32_t n_batch, int32_t n_input, int16_t* output); - -void PortableApplyTanhFloat(const int16_t* input, int32_t n_batch, - int32_t n_input, int32_t integer_bits, - int16_t* output); - -void PortableCwiseMul(const int16_t* input_1, const int16_t* input_2, - int n_batch, int n_input, int shift, int16_t* output); - -void PortableCwiseMul(const int16_t* input_1, const int16_t* input_2, - int32_t multiplier, int32_t shift, int32_t n_batch, - int32_t n_input, int32_t output_zp, int8_t* output); - -void PortableCwiseAdd(const int16_t* input_1, const int16_t* input_2, - int n_batch, int n_input, int16_t* output); - -template -void PortableCwiseClipping(T* vector, const int v_size, - const T clipping_value) { - for (int i = 0; i < v_size; i++) { - vector[i] = std::max(std::min(clipping_value, vector[i]), - static_cast(-clipping_value)); - } -} - -// Batch vector initialization with another vector. -void PortableVectorBatchVectorAssign(const float* vector, int v_size, - int n_batch, float* batch_vector); - -// Add another vector for each batch in the batch vector. -void PortableVectorBatchVectorAdd(const float* vector, int v_size, int n_batch, - float* batch_vector); - -// Compute "1.0f - elements of vector" (used in CIFG). -void PortableSub1Vector(const float* vector, int v_size, float* result); - -void PortableSub1Vector(const int16_t* vector, int v_size, int16_t* result); - -// Multiply all elements of vector with a scalar. -void PortableVectorScalarMultiply(const int8_t* vector, int v_size, float scale, - float* result); - -// Reduce-sum on a float input vector: -// input_vector: float pointer to input vector. -// output_vector: float pointer to vector. -// output_size: output vector size. -// reduction_size: number of consecutive elements from input vector which are -// added to get one element of output. -void PortableReductionSumVector(const float* input_vector, float* output_vector, - int output_size, int reduction_size); - -void PortableReductionSumVector(const int32_t* input_vector, - int32_t* output_vector, int output_size, - int reduction_size); - -void PortableReductionSumVector(const int8_t* input_vector, - int32_t* output_vector, int output_size, - int reduction_size); - -// Layer norm for each batch. -void PortableMeanStddevNormalization(const float* input_vector, - float* output_vector, int v_size, - int n_batch); - -// Saturate Add. -void PortableTwoGateSaturatingAdd(const int8_t* input, int8_t input_zp, - const int8_t* recurrent, int8_t recurrent_zp, - int32_t input_effective_scale_a, - int32_t input_effective_scale_b, - int32_t recurrent_effective_scale_a, - int32_t recurrent_effective_scale_b, - int32_t n_batch, int32_t n_cell, - int16_t* output); - -} // namespace tensor_utils -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PORTABLE_TENSOR_UTILS_IMPL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/prelu.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/prelu.h deleted file mode 100644 index 02db517..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/prelu.h +++ /dev/null @@ -1,109 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_PRELU_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PRELU_H_ - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -// Broadcast prelu to output_shape for quantized uint8_t/int8_t data. -template -inline void BroadcastPrelu4DSlow( - const PreluParams& params, const RuntimeShape& input_shape, - const T* input_data, const RuntimeShape& alpha_shape, const T* alpha_data, - const RuntimeShape& output_shape, T* output_data) { - TFLITE_DCHECK_LE(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(alpha_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(output_shape.DimensionsCount(), 4); - const RuntimeShape extended_output_shape = - RuntimeShape::ExtendedShape(4, output_shape); - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - NdArrayDescsForElementwiseBroadcast(input_shape, alpha_shape, &desc1, &desc2); - - for (int b = 0; b < extended_output_shape.Dims(0); ++b) { - for (int y = 0; y < extended_output_shape.Dims(1); ++y) { - for (int x = 0; x < extended_output_shape.Dims(2); ++x) { - for (int c = 0; c < extended_output_shape.Dims(3); ++c) { - int output_index = Offset(extended_output_shape, b, y, x, c); - int input_index = SubscriptToIndex(desc1, b, y, x, c); - const int32_t input_value = - params.input_offset + input_data[input_index]; - int32_t output_value; - if (input_value >= 0) { - output_value = MultiplyByQuantizedMultiplier( - input_value, params.output_multiplier_1, params.output_shift_1); - } else { - auto alpha_index = SubscriptToIndex(desc2, b, y, x, c); - const int32_t alpha_value = - params.alpha_offset + alpha_data[alpha_index]; - - output_value = MultiplyByQuantizedMultiplier( - input_value * alpha_value, params.output_multiplier_2, - params.output_shift_2); - } - output_value += params.output_offset; - - const int32_t quantized_min = std::numeric_limits::min(); - const int32_t quantized_max = std::numeric_limits::max(); - const int32_t clamped_output = - std::min(quantized_max, std::max(quantized_min, output_value)); - output_data[output_index] = static_cast(clamped_output); - } - } - } - } -} - -template -inline void Prelu(const PreluParams& params, const RuntimeShape& input_shape, - const T* input_data, const RuntimeShape& alpha_shape, - const T* alpha_data, const RuntimeShape& output_shape, - T* output_data) { - const int32_t quantized_min = std::numeric_limits::min(); - const int32_t quantized_max = std::numeric_limits::max(); - - const int flat_size = - MatchingElementsSize(input_shape, alpha_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - const int32_t input_value = params.input_offset + input_data[i]; - int32_t output_value; - if (input_value >= 0) { - output_value = MultiplyByQuantizedMultiplier( - input_value, params.output_multiplier_1, params.output_shift_1); - } else { - const int32_t alpha_value = params.alpha_offset + alpha_data[i]; - - output_value = MultiplyByQuantizedMultiplier(input_value * alpha_value, - params.output_multiplier_2, - params.output_shift_2); - } - output_value += params.output_offset; - - const int32_t clamped_output = - std::min(quantized_max, std::max(quantized_min, output_value)); - output_data[i] = static_cast(clamped_output); - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PRELU_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/process_broadcast_shapes.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/process_broadcast_shapes.h deleted file mode 100644 index 40f779c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/process_broadcast_shapes.h +++ /dev/null @@ -1,138 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_PROCESS_BROADCAST_SHAPES_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PROCESS_BROADCAST_SHAPES_H_ - -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -// Consolidates dimensions in broadcast inputs, checks for five-fold pattern. -// -// For example, if sequence of dimensions of one input is -// ..., 1, 3, 1, 7, 9, 5,... and the other is ..., 2, 3, 1, 7, 1, 1, ... -// we can consolidate these as -// ..., 1, 3*7, 9*5, ... and 2, 3*7, 1. -// -// The category is updated in the less-frequent case of shapes that are -// not suited to a fivefold-loop broadcast. -// -// Falls back to generic pattern when it does not know how to process properly. -// -// Returns true iff there is some sort of broadcast, which includes five-fold -// patterns and falling back to generic broadcast. -inline bool ProcessBroadcastShapes(const RuntimeShape& shape0, - const RuntimeShape& shape1, - tflite::ArithmeticParams* params) { - const int dims_count = - std::max(shape0.DimensionsCount(), shape1.DimensionsCount()); - - params->broadcast_category = BroadcastableOpCategory::kGenericBroadcast; - RuntimeShape scalar_shape(dims_count, 1); - - auto extended_shape0 = RuntimeShape::ExtendedShape(dims_count, shape0); - auto extended_shape1 = RuntimeShape::ExtendedShape(dims_count, shape1); - - // Check for "exact" match, implicitly accepting any scalar shapes. - if (extended_shape0 == extended_shape1) { - params->broadcast_category = BroadcastableOpCategory::kNonBroadcast; - return false; - } - - for (int i = dims_count - 1; i >= 0; --i) { - if (extended_shape0.Dims(i) == extended_shape1.Dims(i)) { - continue; - } else if (extended_shape0.Dims(i) == 1) { - params->broadcast_category = - BroadcastableOpCategory::kFirstInputBroadcastsFast; - break; - } else if (extended_shape1.Dims(i) == 1) { - params->broadcast_category = - BroadcastableOpCategory::kSecondInputBroadcastsFast; - break; - } else { - // This case is erroneous: there is a dimension that does not match and - // is not a broadcast from one shape to the other. - params->broadcast_category = BroadcastableOpCategory::kGenericBroadcast; - return true; - } - } - - if (params->broadcast_category != - BroadcastableOpCategory::kFirstInputBroadcastsFast && - params->broadcast_category != - BroadcastableOpCategory::kSecondInputBroadcastsFast) { - // This is unreachable because at least one else clause in the above loop - // must be reached. - TFLITE_DCHECK(false); - params->broadcast_category = BroadcastableOpCategory::kNonBroadcast; - return false; - } - - // From this point it is assumed contractually that corresponding dimensions - // in shape0 and shape1 are either (a) equal or (b) one or other equals 1. - const bool swap_inputs = params->broadcast_category == - BroadcastableOpCategory::kSecondInputBroadcastsFast; - const RuntimeShape* shape_a = - swap_inputs ? &extended_shape1 : &extended_shape0; - const RuntimeShape* shape_b = - swap_inputs ? &extended_shape0 : &extended_shape1; - - int i = dims_count - 1; - params->broadcast_shape[0] = 1; - params->broadcast_shape[1] = 1; - params->broadcast_shape[2] = 1; - params->broadcast_shape[3] = 1; - params->broadcast_shape[4] = 1; - // y_0 is greedy: include dims if both or neither equal 1: in other words, - // test for equality rather than (shape_a->Dims(i) != 1). - while (i >= 0 && shape_a->Dims(i) == shape_b->Dims(i)) { - params->broadcast_shape[4] *= shape_b->Dims(i); - --i; - } - // Here either input_a or input_b has dim of 1 (if i >= 0). If it is input_b - // that has the unit dimension, the next two loops are not entered. - while (i >= 0 && shape_a->Dims(i) == 1) { - params->broadcast_shape[3] *= shape_b->Dims(i); - --i; - } - while (i >= 0 && shape_a->Dims(i) == shape_b->Dims(i)) { - params->broadcast_shape[2] *= shape_a->Dims(i); - --i; - } - // Here either input_a or input_b has dim of 1 (if i >= 0). - while (i >= 0 && shape_b->Dims(i) == 1) { - params->broadcast_shape[1] *= shape_a->Dims(i); - --i; - } - while (i >= 0 && shape_a->Dims(i) == shape_b->Dims(i)) { - params->broadcast_shape[0] *= shape_b->Dims(i); - --i; - } - - // Rarer case is when the broadcast dimensions cannot be handled by a fivefold - // loop. - if (i >= 0) { - params->broadcast_category = BroadcastableOpCategory::kGenericBroadcast; - } - return true; -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_PROCESS_BROADCAST_SHAPES_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/quantize.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/quantize.h deleted file mode 100644 index 6f3f9ae..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/quantize.h +++ /dev/null @@ -1,55 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_QUANTIZE_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_QUANTIZE_H_ - -#include -#include - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -template -inline void AffineQuantize(const tflite::QuantizationParams& op_params, - const RuntimeShape& input_shape, - const InputT* input_data, - const RuntimeShape& output_shape, - OutputT* output_data) { - const int32_t zero_point = op_params.zero_point; - const double scale = op_params.scale; - const int flat_size = MatchingFlatSize(input_shape, output_shape); - static constexpr int32_t min_val = std::numeric_limits::min(); - static constexpr int32_t max_val = std::numeric_limits::max(); - - for (int i = 0; i < flat_size; i++) { - const InputT val = input_data[i]; - int32_t unclamped = - static_cast(TfLiteRound(val / static_cast(scale))) + - zero_point; - int32_t clamped = std::min(std::max(unclamped, min_val), max_val); - output_data[i] = clamped; - } -} - -} // namespace reference_ops - -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_QUANTIZE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/reduce.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/reduce.h deleted file mode 100644 index a7c86dd..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/reduce.h +++ /dev/null @@ -1,412 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_REDUCE_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_REDUCE_H_ - -#include "ruy/profiler/instrumentation.h" // from @ruy -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/max.h" -#include "tensorflow/lite/kernels/internal/min.h" -#include "tensorflow/lite/kernels/internal/quantization_util.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -// A generic reduce method that can be used for reduce_sum, reduce_mean, etc. -// This method iterates through input data and reduce elements along the -// dimensions given in axis. -template -inline bool Reduce(const In* input_data, const int* input_dims, - const int* output_dims, const int input_num_dims, - const int output_num_dims, const int* axis, - const int num_axis, int* input_iter, - Out reducer(const Out current, const In in), - Out* output_data) { - // Reset input iterator. - for (int idx = 0; idx < input_num_dims; ++idx) { - input_iter[idx] = 0; - } - // Iterate through input_data. - do { - size_t input_offset = - ReducedOutputOffset(input_num_dims, input_dims, input_iter, 0, nullptr); - size_t output_offset = ReducedOutputOffset(input_num_dims, input_dims, - input_iter, num_axis, axis); - output_data[output_offset] = - reducer(output_data[output_offset], input_data[input_offset]); - } while (NextIndex(input_num_dims, input_dims, input_iter)); - return true; -} - -// This method parses the input 'axis' to remove duplicates and handle negative -// values, and returns a valid 'out_axis' -inline bool ResolveAxis(const int num_dims, const int* axis, - const int64_t num_axis, int* out_axis, - int* out_num_axis) { - *out_num_axis = 0; // Just in case. - // Short-circuit axis resolution for scalars; the axis will go unused. - if (num_dims == 0) { - return true; - } - // o(n^2) is fine since out_num_axis should be really small, mostly <= 4 - for (int64_t idx = 0; idx < num_axis; ++idx) { - // Handle negative index. A positive index 'p_idx' can be represented as a - // negative index 'n_idx' as: n_idx = p_idx-num_dims - // eg: For num_dims=3, [0, 1, 2] is the same as [-3, -2, -1] */ - int current = axis[idx] < 0 ? (axis[idx] + num_dims) : axis[idx]; - TFLITE_DCHECK(current >= 0 && current < num_dims); - if (current < 0 || current >= num_dims) { - return false; - } - bool is_dup = false; - for (int j = 0; j < *out_num_axis; ++j) { - if (out_axis[j] == current) { - is_dup = true; - break; - } - } - if (!is_dup) { - out_axis[*out_num_axis] = current; - *out_num_axis += 1; - } - } - return true; -} - -// This method expects that output_data has been initialized. -template -inline bool ReduceSumImpl(const In* input_data, const int* input_dims, - const int* output_dims, const int input_num_dims, - const int output_num_dims, const int* axis, - const int num_axis, int* input_iter, - Out* output_data) { - auto reducer = [](const Out current, const In in) -> Out { - const Out actual_in = static_cast(in); - return current + actual_in; - }; - return Reduce(input_data, input_dims, output_dims, input_num_dims, - output_num_dims, axis, num_axis, input_iter, reducer, - output_data); -} - -template -inline bool InitTensorDataForReduce(const int* dims, const int num_dims, - const T init_value, T* data) { - size_t num_elements = 1; - for (int idx = 0; idx < num_dims; ++idx) { - size_t current = static_cast(dims[idx]); - // Overflow prevention. - if (num_elements > std::numeric_limits::max() / current) { - return false; - } - num_elements *= current; - } - for (size_t idx = 0; idx < num_elements; ++idx) { - data[idx] = init_value; - } - return true; -} - -// Computes the generic value (i.e., sum/max/min/prod) of elements across -// dimensions given in axis. It needs to pass in init_value and reducer. -template -inline bool ReduceGeneric(const T* input_data, const int* input_dims, - const int input_num_dims, T* output_data, - const int* output_dims, const int output_num_dims, - const int* axis, const int64_t num_axis_dimensions, - bool keep_dims, int* temp_index, int* resolved_axis, - T init_value, - T reducer(const T current, const T in)) { - // Return early when input shape has zero dim. - for (int i = 0; i < input_num_dims; ++i) { - if (input_dims[i] == 0) return true; - } - - // Reset output data. - if (!InitTensorDataForReduce(output_dims, output_num_dims, init_value, - output_data)) { - return false; - } - - // Resolve axis. - int num_resolved_axis = 0; - if (!ResolveAxis(input_num_dims, axis, num_axis_dimensions, resolved_axis, - &num_resolved_axis)) { - return false; - } - - return Reduce(input_data, input_dims, output_dims, input_num_dims, - output_num_dims, resolved_axis, num_resolved_axis, - temp_index, reducer, output_data); -} - -// Computes the mean of elements across dimensions given in axis. -// It does so in two stages, first calculates the sum of elements along the axis -// then divides it by the number of element in axis. -template -inline bool Mean(const T* input_data, const int* input_dims, - const int input_num_dims, T* output_data, - const int* output_dims, const int output_num_dims, - const int* axis, const int num_axis_dimensions, bool keep_dims, - int* temp_index, int* resolved_axis, U* temp_sum) { - ruy::profiler::ScopeLabel label("Mean"); - // Reset output data. - size_t num_outputs = 1; - for (int idx = 0; idx < output_num_dims; ++idx) { - size_t current = static_cast(output_dims[idx]); - // Overflow prevention. - if (num_outputs > std::numeric_limits::max() / current) { - return false; - } - num_outputs *= current; - } - for (size_t idx = 0; idx < num_outputs; ++idx) { - output_data[idx] = T(); - temp_sum[idx] = U(); - } - - // Resolve axis. - int num_resolved_axis = 0; - if (!ResolveAxis(input_num_dims, axis, num_axis_dimensions, resolved_axis, - &num_resolved_axis)) { - return false; - } - - if (!ReduceSumImpl(input_data, input_dims, output_dims, input_num_dims, - output_num_dims, resolved_axis, num_resolved_axis, - temp_index, temp_sum)) { - return false; - } - - // Calculate mean by dividing output_data by num of aggregated element. - size_t num_elements_in_axis = 1; - for (int idx = 0; idx < num_resolved_axis; ++idx) { - size_t current = static_cast(input_dims[resolved_axis[idx]]); - // Overflow prevention. - if (current > (std::numeric_limits::max() / num_elements_in_axis)) { - return false; - } - num_elements_in_axis *= current; - } - - if (num_elements_in_axis > 0) { - for (size_t idx = 0; idx < num_outputs; ++idx) { - output_data[idx] = - static_cast(temp_sum[idx] / static_cast(num_elements_in_axis)); - } - } - return true; -} - -template -inline void Mean(const tflite::MeanParams& op_params, - const RuntimeShape& unextended_input_shape, - const T* input_data, - const RuntimeShape& unextended_output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("Mean4D"); - - // Current implementation only supports dimension equals 4 and simultaneous - // reduction over width and height. - TFLITE_CHECK_EQ(unextended_input_shape.DimensionsCount(), 4); - TFLITE_CHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - const int output_batch = output_shape.Dims(0); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int output_depth = output_shape.Dims(3); - - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - - TFLITE_CHECK_EQ(op_params.axis_count, 2); - TFLITE_CHECK((op_params.axis[0] == 1 && op_params.axis[1] == 2) || - (op_params.axis[0] == 2 && op_params.axis[1] == 1)); - TFLITE_CHECK_EQ(output_height, 1); - TFLITE_CHECK_EQ(output_width, 1); - - for (int out_b = 0; out_b < output_batch; ++out_b) { - for (int out_d = 0; out_d < output_depth; ++out_d) { - float value = 0; - for (int in_h = 0; in_h < input_height; ++in_h) { - for (int in_w = 0; in_w < input_width; ++in_w) { - value += input_data[Offset(input_shape, out_b, in_h, in_w, out_d)]; - } - } - output_data[Offset(output_shape, out_b, 0, 0, out_d)] = - value / (input_width * input_height); - } - } -} - -inline void Mean(const tflite::MeanParams& op_params, - const RuntimeShape& unextended_input_shape, - const uint8_t* input_data, int32_t input_zero_point, - float input_scale, const RuntimeShape& unextended_output_shape, - uint8_t* output_data, int32_t output_zero_point, - float output_scale) { - ruy::profiler::ScopeLabel label("Mean4D/Uint8"); - - // Current implementation only supports dimension equals 4 and simultaneous - // reduction over width and height. - TFLITE_CHECK_EQ(unextended_input_shape.DimensionsCount(), 4); - TFLITE_CHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - const int output_batch = output_shape.Dims(0); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int output_depth = output_shape.Dims(3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const float num_elements_in_axis = input_width * input_height; - - TFLITE_CHECK_EQ(op_params.axis_count, 2); - TFLITE_CHECK((op_params.axis[0] == 1 && op_params.axis[1] == 2) || - (op_params.axis[0] == 2 && op_params.axis[1] == 1)); - TFLITE_CHECK_EQ(output_height, 1); - TFLITE_CHECK_EQ(output_width, 1); - - constexpr int32_t kMinValue = std::numeric_limits::min(); - constexpr int32_t kMaxValue = std::numeric_limits::max(); - - int32_t bias = - output_zero_point - - static_cast(input_zero_point * input_scale / output_scale); - double real_scale = - static_cast(input_scale / (num_elements_in_axis * output_scale)); - - int32_t multiplier; - int shift; - QuantizeMultiplier(real_scale, &multiplier, &shift); - for (int out_b = 0; out_b < output_batch; ++out_b) { - for (int out_d = 0; out_d < output_depth; ++out_d) { - int32_t acc = 0; - for (int in_h = 0; in_h < input_height; ++in_h) { - for (int in_w = 0; in_w < input_width; ++in_w) { - acc += input_data[Offset(input_shape, out_b, in_h, in_w, out_d)]; - } - } - acc = MultiplyByQuantizedMultiplier(acc, multiplier, shift); - acc += bias; - acc = std::min(std::max(acc, kMinValue), kMaxValue); - output_data[Offset(output_shape, out_b, 0, 0, out_d)] = - static_cast(acc); - } - } -} - -// Computes the mean of elements across dimensions given in axis. -// It does so in two stages, first calculates the sum of elements along the axis -// then divides it by the number of element in axis for quantized values. -template -inline bool QuantizedMeanOrSum(const T* input_data, int32_t input_zero_point, - float input_scale, const int* input_dims, - const int input_num_dims, T* output_data, - int32_t output_zero_point, float output_scale, - const int* output_dims, - const int output_num_dims, const int* axis, - const int num_axis_dimensions, bool keep_dims, - int* temp_index, int* resolved_axis, U* temp_sum, - bool compute_sum) { - const bool uint8_case = std::is_same::value; - const bool int16_case = std::is_same::value; - if (uint8_case) { - ruy::profiler::ScopeLabel label(compute_sum ? "Sum/Uint8" : "Mean/Uint8"); - } else if (int16_case) { - ruy::profiler::ScopeLabel label(compute_sum ? "Sum/Int16" : "Mean/Int16"); - } else { - ruy::profiler::ScopeLabel label(compute_sum ? "Sum/Int8" : "Mean/Int8"); - } - // Reset output data. - size_t num_outputs = 1; - for (int idx = 0; idx < output_num_dims; ++idx) { - size_t current = static_cast(output_dims[idx]); - // Overflow prevention. - if (num_outputs > std::numeric_limits::max() / current) { - return false; - } - num_outputs *= current; - } - for (size_t idx = 0; idx < num_outputs; ++idx) { - output_data[idx] = T(); - temp_sum[idx] = U(); - } - - // Resolve axis. - int num_resolved_axis = 0; - if (!ResolveAxis(input_num_dims, axis, num_axis_dimensions, resolved_axis, - &num_resolved_axis)) { - return false; - } - - if (!ReduceSumImpl(input_data, input_dims, output_dims, input_num_dims, - output_num_dims, resolved_axis, num_resolved_axis, - temp_index, temp_sum)) { - return false; - } - - // Calculate mean by dividing output_data by num of aggregated element. - size_t num_elements_in_axis = 1; - for (int idx = 0; idx < num_resolved_axis; ++idx) { - size_t current = static_cast(input_dims[resolved_axis[idx]]); - // Overflow prevention. - if (current > (std::numeric_limits::max() / num_elements_in_axis)) { - return false; - } - num_elements_in_axis *= current; - } - - if (num_elements_in_axis > 0) { - const float scale = input_scale / output_scale; - if (compute_sum) { - // TODO(b/116341117): Eliminate float and do this completely in 8bit. - const float bias = -input_zero_point * scale * num_elements_in_axis; - for (size_t idx = 0; idx < num_outputs; ++idx) { - const U value = - static_cast(TfLiteRound(temp_sum[idx] * scale + bias)) + - output_zero_point; - output_data[idx] = static_cast(value); - } - } else { - const float bias = -input_zero_point * scale; - for (size_t idx = 0; idx < num_outputs; ++idx) { - float float_mean = static_cast(temp_sum[idx]) / - static_cast(num_elements_in_axis); - float result = TfLiteMin( - TfLiteRound(float_mean * scale + bias) + output_zero_point, - static_cast(std::numeric_limits::max())); - result = TfLiteMax(result, - static_cast(std::numeric_limits::min())); - output_data[idx] = static_cast(result); - } - } - } - return true; -} - -} // namespace reference_ops - -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_REDUCE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/reference_ops.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/reference_ops.h deleted file mode 100644 index df771bc..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/reference_ops.h +++ /dev/null @@ -1,2639 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_REFERENCE_REFERENCE_OPS_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_REFERENCE_OPS_H_ - -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#include "third_party/eigen3/Eigen/Core" -#include "fixedpoint/fixedpoint.h" -#include "ruy/profiler/instrumentation.h" // from @ruy -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/quantization_util.h" -#include "tensorflow/lite/kernels/internal/reference/add.h" -#include "tensorflow/lite/kernels/internal/reference/arg_min_max.h" -#include "tensorflow/lite/kernels/internal/reference/binary_function.h" -#include "tensorflow/lite/kernels/internal/reference/ceil.h" -#include "tensorflow/lite/kernels/internal/reference/comparisons.h" -#include "tensorflow/lite/kernels/internal/reference/concatenation.h" -#include "tensorflow/lite/kernels/internal/reference/conv.h" -#include "tensorflow/lite/kernels/internal/reference/dequantize.h" -#include "tensorflow/lite/kernels/internal/reference/floor.h" -#include "tensorflow/lite/kernels/internal/reference/fully_connected.h" -#include "tensorflow/lite/kernels/internal/reference/hard_swish.h" -#include "tensorflow/lite/kernels/internal/reference/l2normalization.h" -#include "tensorflow/lite/kernels/internal/reference/logistic.h" -#include "tensorflow/lite/kernels/internal/reference/maximum_minimum.h" -#include "tensorflow/lite/kernels/internal/reference/mul.h" -#include "tensorflow/lite/kernels/internal/reference/neg.h" -#include "tensorflow/lite/kernels/internal/reference/pad.h" -#include "tensorflow/lite/kernels/internal/reference/pooling.h" -#include "tensorflow/lite/kernels/internal/reference/prelu.h" -#include "tensorflow/lite/kernels/internal/reference/process_broadcast_shapes.h" -#include "tensorflow/lite/kernels/internal/reference/quantize.h" -#include "tensorflow/lite/kernels/internal/reference/reduce.h" -#include "tensorflow/lite/kernels/internal/reference/requantize.h" -#include "tensorflow/lite/kernels/internal/reference/resize_nearest_neighbor.h" -#include "tensorflow/lite/kernels/internal/reference/round.h" -#include "tensorflow/lite/kernels/internal/reference/softmax.h" -#include "tensorflow/lite/kernels/internal/reference/strided_slice.h" -#include "tensorflow/lite/kernels/internal/reference/string_comparisons.h" -#include "tensorflow/lite/kernels/internal/reference/sub.h" -#include "tensorflow/lite/kernels/internal/reference/tanh.h" -#include "tensorflow/lite/kernels/internal/strided_slice_logic.h" -#include "tensorflow/lite/kernels/internal/tensor.h" -#include "tensorflow/lite/kernels/internal/types.h" -namespace tflite { - -namespace reference_ops { - -template -inline void DepthToSpace(const tflite::DepthToSpaceParams& op_params, - const RuntimeShape& unextended_input_shape, - const T* input_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - const int input_depth = input_shape.Dims(3); - const int input_width = input_shape.Dims(2); - const int input_height = input_shape.Dims(1); - const int input_batch = input_shape.Dims(0); - - const int output_depth = output_shape.Dims(3); - const int output_width = output_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_batch = output_shape.Dims(0); - - const int32 block_size = op_params.block_size; - - TFLITE_DCHECK_EQ(input_width * block_size, output_width); - TFLITE_DCHECK_EQ(input_height * block_size, output_height); - TFLITE_DCHECK_EQ(input_depth, output_depth * block_size * block_size); - TFLITE_DCHECK_EQ(input_batch, output_batch); - - for (int out_b = 0; out_b < output_batch; ++out_b) { - for (int out_h = 0; out_h < output_height; ++out_h) { - for (int out_w = 0; out_w < output_width; ++out_w) { - for (int out_d = 0; out_d < output_depth; ++out_d) { - const int in_d = - out_d + ((out_h % block_size) * block_size + out_w % block_size) * - output_depth; - - const int in_w = out_w / block_size; - const int in_h = out_h / block_size; - const int in_b = out_b; - - const int input_index = Offset(input_shape, in_b, in_h, in_w, in_d); - const int output_index = - Offset(output_shape, out_b, out_h, out_w, out_d); - - output_data[output_index] = input_data[input_index]; - } - } - } - } -} - -template -inline void SpaceToDepth(const tflite::SpaceToDepthParams& op_params, - const RuntimeShape& unextended_input_shape, - const T* input_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - const int input_depth = input_shape.Dims(3); - const int input_width = input_shape.Dims(2); - const int input_height = input_shape.Dims(1); - const int input_batch = input_shape.Dims(0); - - const int output_depth = output_shape.Dims(3); - const int output_width = output_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_batch = output_shape.Dims(0); - - const int32 block_size = op_params.block_size; - - TFLITE_DCHECK_EQ(input_width, output_width * block_size); - TFLITE_DCHECK_EQ(input_height, output_height * block_size); - TFLITE_DCHECK_EQ(input_depth * block_size * block_size, output_depth); - TFLITE_DCHECK_EQ(input_batch, output_batch); - - for (int in_b = 0; in_b < input_batch; ++in_b) { - for (int in_h = 0; in_h < input_height; ++in_h) { - for (int in_w = 0; in_w < input_width; ++in_w) { - for (int in_d = 0; in_d < input_depth; ++in_d) { - const int out_d = - in_d + ((in_h % block_size) * block_size + in_w % block_size) * - input_depth; - const int out_w = in_w / block_size; - const int out_h = in_h / block_size; - const int out_b = in_b; - - const int input_index = Offset(input_shape, in_b, in_h, in_w, in_d); - const int output_index = - Offset(output_shape, out_b, out_h, out_w, out_d); - - output_data[output_index] = input_data[input_index]; - } - } - } - } -} - -inline void Elu(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - const int flat_size = MatchingFlatSize(input_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - const float val = input_data[i]; - output_data[i] = val < 0.0 ? std::exp(val) - 1 : val; - } -} - -template -inline void Relu(const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - const int flat_size = MatchingFlatSize(input_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - const T val = input_data[i]; - const T lower = 0; - const T clamped = val < lower ? lower : val; - output_data[i] = clamped; - } -} - -template -inline void Relu1(const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("Relu1 (not fused)"); - const int flat_size = MatchingFlatSize(input_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - const T val = input_data[i]; - const T upper = 1; - const T lower = -1; - const T clamped = val > upper ? upper : val < lower ? lower : val; - output_data[i] = clamped; - } -} - -inline void Relu6(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("Relu6 (not fused)"); - const int flat_size = MatchingFlatSize(input_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - const float val = input_data[i]; - const float upper = 6; - const float lower = 0; - const float clamped = val > upper ? upper : val < lower ? lower : val; - output_data[i] = clamped; - } -} - -template -inline void ReluX(const tflite::ReluParams& params, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("Quantized ReluX (not fused)"); - const int flat_size = MatchingFlatSize(input_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - const int32 val = static_cast(input_data[i]); - int32 clamped = params.output_offset + - MultiplyByQuantizedMultiplier(val - params.input_offset, - params.output_multiplier, - params.output_shift); - clamped = std::max(params.quantized_activation_min, clamped); - clamped = std::min(params.quantized_activation_max, clamped); - output_data[i] = static_cast(clamped); - } -} - -template -inline void ReluX(const tflite::ActivationParams& params, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("Quantized ReluX (not fused)"); - const int flat_size = MatchingFlatSize(input_shape, output_shape); - const T max_value = params.quantized_activation_max; - const T min_value = params.quantized_activation_min; - for (int i = 0; i < flat_size; ++i) { - const T val = input_data[i]; - const T clamped = val > max_value ? max_value - : val < min_value ? min_value - : val; - output_data[i] = clamped; - } -} - -inline void LeakyRelu(const tflite::LeakyReluParams& params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("LeakyRelu (not fused)"); - const int flat_size = MatchingFlatSize(input_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - const float val = input_data[i]; - // Note that alpha might be > 1 or < 0, so we don't use std::max here. - output_data[i] = val > 0 ? val : val * params.alpha; - } -} - -template -inline void QuantizeLeakyRelu(const LeakyReluParams& params, - const RuntimeShape& input_shape, - const T* input_data, - const RuntimeShape& output_shape, - T* output_data) { - ruy::profiler::ScopeLabel label("Quantized LeakyRelu (not fused)"); - const int flat_size = MatchingFlatSize(input_shape, output_shape); - static const int32 quantized_min = std::numeric_limits::min(); - static const int32 quantized_max = std::numeric_limits::max(); - for (int i = 0; i < flat_size; ++i) { - const int32 input_value = input_data[i] - params.input_offset; - int32 unclamped_output; - if (input_value >= 0) { - unclamped_output = params.output_offset + - MultiplyByQuantizedMultiplier( - input_value, params.output_multiplier_identity, - params.output_shift_identity); - } else { - unclamped_output = params.output_offset + - MultiplyByQuantizedMultiplier( - input_value, params.output_multiplier_alpha, - params.output_shift_alpha); - } - const T clamped_output = - std::min(quantized_max, std::max(quantized_min, unclamped_output)); - output_data[i] = static_cast(clamped_output); - } -} - -// T is expected to be either float or int. -template -inline void AddN(const RuntimeShape& input_shape, const size_t num_inputs, - T* const* input_data, T* output_data) { - // All inputs and output should have the same shape, this is checked during - // Prepare stage. - const size_t size = input_shape.FlatSize(); - for (int i = 0; i < size; ++i) { - T x = 0; - for (int j = 0; j < num_inputs; ++j) { - x += input_data[j][i]; - } - output_data[i] = x; - } -} - -// TODO(jiawen): We can implement BroadcastMul on buffers of arbitrary -// dimensionality if the runtime code does a single loop over one dimension -// that handles broadcasting as the base case. The code generator would then -// generate max(D1, D2) nested for loops. -// TODO(benoitjacob): BroadcastMul is intentionally duplicated from -// reference_ops.h. Once an optimized version is implemented and NdArrayDesc -// is no longer referenced in this file, move NdArrayDesc from types.h to -// reference_ops.h. -inline void BroadcastMulFivefold(const ArithmeticParams& unswitched_params, - const RuntimeShape& unswitched_input1_shape, - const uint8* unswitched_input1_data, - const RuntimeShape& unswitched_input2_shape, - const uint8* unswitched_input2_data, - const RuntimeShape& output_shape, - uint8* output_data) { - ArithmeticParams switched_params = unswitched_params; - switched_params.input1_offset = unswitched_params.input2_offset; - switched_params.input2_offset = unswitched_params.input1_offset; - - const bool use_unswitched = - unswitched_params.broadcast_category == - tflite::BroadcastableOpCategory::kFirstInputBroadcastsFast; - - const ArithmeticParams& params = - use_unswitched ? unswitched_params : switched_params; - const uint8* input1_data = - use_unswitched ? unswitched_input1_data : unswitched_input2_data; - const uint8* input2_data = - use_unswitched ? unswitched_input2_data : unswitched_input1_data; - - // Fivefold nested loops. The second input resets its position for each - // iteration of the second loop. The first input resets its position at the - // beginning of the fourth loop. The innermost loop is an elementwise Mul of - // sections of the arrays. - uint8* output_data_ptr = output_data; - const uint8* input1_data_ptr = input1_data; - const uint8* input2_data_reset = input2_data; - int y0 = params.broadcast_shape[0]; - int y1 = params.broadcast_shape[1]; - int y2 = params.broadcast_shape[2]; - int y3 = params.broadcast_shape[3]; - int y4 = params.broadcast_shape[4]; - for (int i0 = 0; i0 < y0; ++i0) { - const uint8* input2_data_ptr; - for (int i1 = 0; i1 < y1; ++i1) { - input2_data_ptr = input2_data_reset; - for (int i2 = 0; i2 < y2; ++i2) { - for (int i3 = 0; i3 < y3; ++i3) { - MulElementwise(y4, params, input1_data_ptr, input2_data_ptr, - output_data_ptr); - input2_data_ptr += y4; - output_data_ptr += y4; - } - input1_data_ptr += y4; - } - } - input2_data_reset = input2_data_ptr; - } -} - -inline void Mul(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int16* input1_data, - const RuntimeShape& input2_shape, const int16* input2_data, - const RuntimeShape& output_shape, int16* output_data) { - ruy::profiler::ScopeLabel label("Mul/Int16"); - - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - // F0 uses 0 integer bits, range [-1, 1]. - using F0 = gemmlowp::FixedPoint; - - F0 unclamped_result = - F0::FromRaw(input1_data[i]) * F0::FromRaw(input2_data[i]); - output_data[i] = unclamped_result.raw(); - } -} - -inline void Mul(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int16* input1_data, - const RuntimeShape& input2_shape, const int16* input2_data, - const RuntimeShape& output_shape, uint8* output_data) { - ruy::profiler::ScopeLabel label("Mul/Int16Uint8"); - int32 output_offset = params.output_offset; - int32 output_activation_min = params.quantized_activation_min; - int32 output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - // F0 uses 0 integer bits, range [-1, 1]. - using F0 = gemmlowp::FixedPoint; - - F0 unclamped_result = - F0::FromRaw(input1_data[i]) * F0::FromRaw(input2_data[i]); - int16 rescaled_result = - gemmlowp::RoundingDivideByPOT(unclamped_result.raw(), 8); - int16 clamped_result = - std::min(output_activation_max - output_offset, rescaled_result); - clamped_result = - std::max(output_activation_min - output_offset, clamped_result); - output_data[i] = output_offset + clamped_result; - } -} - -// TODO(jiawen): We can implement BroadcastDiv on buffers of arbitrary -// dimensionality if the runtime code does a single loop over one dimension -// that handles broadcasting as the base case. The code generator would then -// generate max(D1, D2) nested for loops. -template -void BroadcastDivSlow(const ArithmeticParams& params, - const RuntimeShape& unextended_input1_shape, - const T* input1_data, - const RuntimeShape& unextended_input2_shape, - const T* input2_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - T output_activation_min; - T output_activation_max; - GetActivationParams(params, &output_activation_min, &output_activation_max); - - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(unextended_input2_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), N); - - NdArrayDesc desc1; - NdArrayDesc desc2; - NdArrayDesc output_desc; - NdArrayDescsForElementwiseBroadcast(unextended_input1_shape, - unextended_input2_shape, &desc1, &desc2); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, unextended_output_shape), - &output_desc); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest - // stride, typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - - auto div_func = [&](int indexes[N]) { - output_data[SubscriptToIndex(output_desc, indexes)] = - ActivationFunctionWithMinMax( - input1_data[SubscriptToIndex(desc1, indexes)] / - input2_data[SubscriptToIndex(desc2, indexes)], - output_activation_min, output_activation_max); - }; - NDOpsHelper(output_desc, div_func); -} - -template -inline void Div(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const T* input1_data, - const RuntimeShape& input2_shape, const T* input2_data, - const RuntimeShape& output_shape, T* output_data) { - T output_activation_min; - T output_activation_max; - GetActivationParams(params, &output_activation_min, &output_activation_max); - - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax( - input1_data[i] / input2_data[i], output_activation_min, - output_activation_max); - } -} - -// Element-wise div that can often be used for inner loop of broadcast Div as -// well as the non-broadcast Div. -inline void DivElementwise(int size, const ArithmeticParams& params, - const uint8* input1_data, const uint8* input2_data, - uint8* output_data) { - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input2_offset, 256); - TFLITE_DCHECK_GT(params.output_offset, -256); - TFLITE_DCHECK_LT(params.output_offset, 256); - - for (int i = 0; i < size; ++i) { - const int32 input1_val = params.input1_offset + input1_data[i]; - const int32 input2_val = params.input2_offset + input2_data[i]; - TFLITE_DCHECK_NE(input2_val, 0); - int recip_shift; - const int32 input2_inv = - (input2_val > 0) ? GetReciprocal(input2_val, 31, &recip_shift) - : -GetReciprocal(-input2_val, 31, &recip_shift); - const int headroom = CountLeadingSignBits(input1_val); - const int32 unscaled_quotient = MultiplyByQuantizedMultiplierGreaterThanOne( - input1_val, input2_inv, headroom); - const int total_shift = params.output_shift - recip_shift - headroom; - const int32 unclamped_result = - params.output_offset + - MultiplyByQuantizedMultiplierSmallerThanOneExp( - unscaled_quotient, params.output_multiplier, total_shift); - const int32 clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, unclamped_result)); - output_data[i] = static_cast(clamped_output); - } -} - -inline void Div(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const uint8* input1_data, - const RuntimeShape& input2_shape, const uint8* input2_data, - const RuntimeShape& output_shape, uint8* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - ruy::profiler::ScopeLabel label("Div/8bit"); - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - DivElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -template -inline void BroadcastDivSlow(const ArithmeticParams& params, - const RuntimeShape& unextended_input1_shape, - const uint8* input1_data, - const RuntimeShape& unextended_input2_shape, - const uint8* input2_data, - const RuntimeShape& unextended_output_shape, - uint8* output_data) { - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(unextended_input2_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), N); - - NdArrayDesc desc1; - NdArrayDesc desc2; - NdArrayDesc output_desc; - NdArrayDescsForElementwiseBroadcast(unextended_input1_shape, - unextended_input2_shape, &desc1, &desc2); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, unextended_output_shape), - &output_desc); - - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input2_offset, 256); - TFLITE_DCHECK_GT(params.output_offset, -256); - TFLITE_DCHECK_LT(params.output_offset, 256); - - auto div_func = [&](int indexes[N]) { - const int32 input1_val = - params.input1_offset + input1_data[SubscriptToIndex(desc1, indexes)]; - const int32 input2_val = - params.input2_offset + input2_data[SubscriptToIndex(desc2, indexes)]; - TFLITE_DCHECK_NE(input2_val, 0); - int recip_shift; - const int32 input2_inv = - (input2_val > 0) ? GetReciprocal(input2_val, 31, &recip_shift) - : -GetReciprocal(-input2_val, 31, &recip_shift); - const int headroom = CountLeadingSignBits(input1_val); - const int32 unscaled_quotient = MultiplyByQuantizedMultiplierGreaterThanOne( - input1_val, input2_inv, headroom); - const int total_shift = params.output_shift - recip_shift - headroom; - const int32 unclamped_result = - params.output_offset + - MultiplyByQuantizedMultiplierSmallerThanOneExp( - unscaled_quotient, params.output_multiplier, total_shift); - const int32 clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, unclamped_result)); - output_data[SubscriptToIndex(output_desc, indexes)] = - static_cast(clamped_output); - }; - NDOpsHelper(output_desc, div_func); -} - -inline void Sub16(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int16_t* input1_data, - const RuntimeShape& input2_shape, const int16_t* input2_data, - const RuntimeShape& output_shape, int16_t* output_data) { - ruy::profiler::ScopeLabel label("Sub/Int16"); - const int input1_shift = params.input1_shift; - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - const int16 output_activation_min = params.quantized_activation_min; - const int16 output_activation_max = params.quantized_activation_max; - - TFLITE_DCHECK(input1_shift == 0 || params.input2_shift == 0); - TFLITE_DCHECK_LE(input1_shift, 0); - TFLITE_DCHECK_LE(params.input2_shift, 0); - const int16* not_shift_input = input1_shift == 0 ? input1_data : input2_data; - const int16* shift_input = input1_shift == 0 ? input2_data : input1_data; - const int input_right_shift = - input1_shift == 0 ? -params.input2_shift : -input1_shift; - - if (input1_shift == 0) { - // F0 uses 0 integer bits, range [-1, 1]. - using F0 = gemmlowp::FixedPoint; - for (int i = 0; i < flat_size; ++i) { - F0 input_ready_scaled = F0::FromRaw(not_shift_input[i]); - F0 scaled_input = F0::FromRaw( - gemmlowp::RoundingDivideByPOT(shift_input[i], input_right_shift)); - F0 result = SaturatingSub(input_ready_scaled, scaled_input); - const int16 raw_output = result.raw(); - const int16 clamped_output = std::min( - output_activation_max, std::max(output_activation_min, raw_output)); - output_data[i] = clamped_output; - } - } else { - // F0 uses 0 integer bits, range [-1, 1]. - using F0 = gemmlowp::FixedPoint; - for (int i = 0; i < flat_size; ++i) { - F0 input_ready_scaled = F0::FromRaw(not_shift_input[i]); - F0 scaled_input = F0::FromRaw( - gemmlowp::RoundingDivideByPOT(shift_input[i], input_right_shift)); - F0 result = SaturatingSub(scaled_input, input_ready_scaled); - const int16 raw_output = result.raw(); - const int16 clamped_output = std::min( - output_activation_max, std::max(output_activation_min, raw_output)); - output_data[i] = clamped_output; - } - } -} - -template -void Pack(const PackParams& params, const RuntimeShape* const* input_shapes, - const Scalar* const* input_data, const RuntimeShape& output_shape, - Scalar* output_data) { - ruy::profiler::ScopeLabel label("Pack"); - const int dimensions = output_shape.DimensionsCount(); - int axis = params.axis; - int inputs_count = params.inputs_count; - - int outer_size = 1; - for (int i = 0; i < axis; i++) { - outer_size *= output_shape.Dims(i); - } - int copy_size = 1; - for (int i = params.axis + 1; i < dimensions; i++) { - copy_size *= output_shape.Dims(i); - } - TFLITE_DCHECK_EQ((**input_shapes).FlatSize(), copy_size * outer_size); - - for (int i = 0; i < inputs_count; ++i) { - for (int k = 0; k < outer_size; k++) { - const Scalar* input_ptr = input_data[i] + copy_size * k; - int loc = k * inputs_count * copy_size + i * copy_size; - memcpy(output_data + loc, input_ptr, copy_size * sizeof(Scalar)); - } - } -} - -template -void Unpack(const UnpackParams& params, const RuntimeShape& input_shape, - const Scalar* input_data, const RuntimeShape& output_shape, - Scalar* const* output_datas) { - ruy::profiler::ScopeLabel label("Unpack"); - const int dimensions = input_shape.DimensionsCount(); - const int outputs_count = params.num_split; - - int outer_size = 1; - int axis = params.axis; - if (axis < 0) { - axis += dimensions; - } - TFLITE_DCHECK_GE(axis, 0); - TFLITE_DCHECK_LT(axis, dimensions); - for (int i = 0; i < axis; ++i) { - outer_size *= input_shape.Dims(i); - } - int copy_size = 1; - for (int i = axis + 1; i < dimensions; ++i) { - copy_size *= input_shape.Dims(i); - } - TFLITE_DCHECK_EQ(output_shape.FlatSize(), copy_size * outer_size); - - for (int i = 0; i < outputs_count; ++i) { - for (int k = 0; k < outer_size; k++) { - Scalar* output_ptr = output_datas[i] + copy_size * k; - int loc = k * outputs_count * copy_size + i * copy_size; - memcpy(output_ptr, input_data + loc, copy_size * sizeof(Scalar)); - } - } -} - -template -void PackWithScaling(const PackParams& params, - const RuntimeShape* const* input_shapes, - const uint8* const* input_data, - const RuntimeShape& output_shape, uint8* output_data) { - ruy::profiler::ScopeLabel label("PackWithScaling"); - const int dimensions = output_shape.DimensionsCount(); - int axis = params.axis; - const int32* input_zeropoint = params.input_zeropoint; - const float* input_scale = params.input_scale; - int inputs_count = params.inputs_count; - const int32 output_zeropoint = params.output_zeropoint; - const float output_scale = params.output_scale; - - int outer_size = 1; - for (int i = 0; i < axis; i++) { - outer_size *= output_shape.Dims(i); - } - int copy_size = 1; - for (int i = axis + 1; i < dimensions; i++) { - copy_size *= output_shape.Dims(i); - } - TFLITE_DCHECK_EQ((**input_shapes).FlatSize(), copy_size * outer_size); - - Scalar* output_ptr = output_data; - const float inverse_output_scale = 1.f / output_scale; - for (int k = 0; k < outer_size; k++) { - for (int i = 0; i < inputs_count; ++i) { - if (input_zeropoint[i] == output_zeropoint && - input_scale[i] == output_scale) { - memcpy(output_ptr, input_data[i] + k * copy_size, - copy_size * sizeof(Scalar)); - } else { - assert(false); - const float scale = input_scale[i] * inverse_output_scale; - const float bias = -input_zeropoint[i] * scale; - auto input_ptr = input_data[i]; - for (int j = 0; j < copy_size; ++j) { - const int32_t value = - static_cast(std::round(input_ptr[j] * scale + bias)) + - output_zeropoint; - output_ptr[j] = - static_cast(std::max(std::min(255, value), 0)); - } - } - output_ptr += copy_size; - } - } -} - -template -void DepthConcatenation(const ConcatenationParams& params, - const RuntimeShape* const* input_shapes, - const Scalar* const* input_data, - const RuntimeShape& output_shape, Scalar* output_data) { - ruy::profiler::ScopeLabel label("DepthConcatenation"); - auto params_copy = params; - params_copy.axis = 3; - Concatenation(params_copy, input_shapes, input_data, output_shape, - output_data); -} - -inline void LstmCell( - const LstmCellParams& params, const RuntimeShape& unextended_input_shape, - const float* input_data, const RuntimeShape& unextended_prev_activ_shape, - const float* prev_activ_data, const RuntimeShape& weights_shape, - const float* weights_data, const RuntimeShape& unextended_bias_shape, - const float* bias_data, const RuntimeShape& unextended_prev_state_shape, - const float* prev_state_data, - const RuntimeShape& unextended_output_state_shape, float* output_state_data, - const RuntimeShape& unextended_output_activ_shape, float* output_activ_data, - const RuntimeShape& unextended_concat_temp_shape, float* concat_temp_data, - const RuntimeShape& unextended_activ_temp_shape, float* activ_temp_data) { - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_prev_activ_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_bias_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_prev_state_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_state_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_activ_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_concat_temp_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_activ_temp_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape prev_activ_shape = - RuntimeShape::ExtendedShape(4, unextended_prev_activ_shape); - const RuntimeShape bias_shape = - RuntimeShape::ExtendedShape(4, unextended_bias_shape); - const RuntimeShape prev_state_shape = - RuntimeShape::ExtendedShape(4, unextended_prev_state_shape); - const RuntimeShape output_state_shape = - RuntimeShape::ExtendedShape(4, unextended_output_state_shape); - const RuntimeShape output_activ_shape = - RuntimeShape::ExtendedShape(4, unextended_output_activ_shape); - const RuntimeShape concat_temp_shape = - RuntimeShape::ExtendedShape(4, unextended_concat_temp_shape); - const RuntimeShape activ_temp_shape = - RuntimeShape::ExtendedShape(4, unextended_activ_temp_shape); - TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2); - - const int weights_dim_count = weights_shape.DimensionsCount(); - const int batches = - MatchingDim(input_shape, 0, prev_activ_shape, 0, prev_state_shape, 0, - output_state_shape, 0, output_activ_shape, 0); - const int height = - MatchingDim(input_shape, 1, prev_activ_shape, 1, prev_state_shape, 1, - output_state_shape, 1, output_activ_shape, 1); - const int width = - MatchingDim(input_shape, 2, prev_activ_shape, 2, prev_state_shape, 2, - output_state_shape, 2, output_activ_shape, 2); - const int input_depth = input_shape.Dims(3); - const int prev_activ_depth = prev_activ_shape.Dims(3); - const int total_input_depth = prev_activ_depth + input_depth; - TFLITE_DCHECK_EQ(weights_shape.Dims(weights_dim_count - 1), - total_input_depth); - TFLITE_DCHECK_EQ(FlatSizeSkipDim(bias_shape, 3), 1); - const int intern_activ_depth = - MatchingDim(weights_shape, weights_dim_count - 2, bias_shape, 3); - TFLITE_DCHECK_EQ(weights_shape.FlatSize(), - intern_activ_depth * total_input_depth); - TFLITE_DCHECK_EQ(intern_activ_depth % 4, 0); - const int output_depth = - MatchingDim(prev_state_shape, 3, prev_activ_shape, 3, output_state_shape, - 3, output_activ_shape, 3); - TFLITE_DCHECK_EQ(output_depth, intern_activ_depth / 4); - - // Concatenate prev_activ and input data together - std::vector concat_input_arrays_data; - std::vector concat_input_arrays_shapes; - concat_input_arrays_data.push_back(input_data); - concat_input_arrays_data.push_back(prev_activ_data); - concat_input_arrays_shapes.push_back(&input_shape); - concat_input_arrays_shapes.push_back(&prev_activ_shape); - tflite::ConcatenationParams concat_params; - concat_params.axis = 3; - concat_params.inputs_count = concat_input_arrays_data.size(); - Concatenation(concat_params, &(concat_input_arrays_shapes[0]), - &(concat_input_arrays_data[0]), concat_temp_shape, - concat_temp_data); - - // Fully connected - tflite::FullyConnectedParams fc_params; - fc_params.float_activation_min = std::numeric_limits::lowest(); - fc_params.float_activation_max = std::numeric_limits::max(); - FullyConnected(fc_params, concat_temp_shape, concat_temp_data, weights_shape, - weights_data, bias_shape, bias_data, activ_temp_shape, - activ_temp_data); - - // Memory state update (the LSTM "guts") - for (int b = 0; b < batches; ++b) { - for (int w = 0; w < width; ++w) { - for (int h = 0; h < height; ++h) { - for (int c = 0; c < output_depth; ++c) { - const float input_gate = - 1.f / - (1.f + std::exp(-activ_temp_data[Offset(activ_temp_shape, b, h, w, - 0 * output_depth + c)])); - const float new_input = std::tanh(activ_temp_data[Offset( - activ_temp_shape, b, h, w, 1 * output_depth + c)]); - const float forget_gate = - 1.f / - (1.f + std::exp(-activ_temp_data[Offset(activ_temp_shape, b, h, w, - 2 * output_depth + c)])); - const float output_gate = - 1.f / - (1.f + std::exp(-activ_temp_data[Offset(activ_temp_shape, b, h, w, - 3 * output_depth + c)])); - const float new_state = - input_gate * new_input + - forget_gate * - prev_state_data[Offset(prev_state_shape, b, h, w, c)]; - output_state_data[Offset(output_state_shape, b, h, w, c)] = new_state; - output_activ_data[Offset(output_activ_shape, b, h, w, c)] = - output_gate * std::tanh(new_state); - } - } - } - } -} - -// Quantized LSTM cell implementation. -// The quantization of the input, output arrays is as follows: -// - The input activations are quantized as uint8 on the interval -// [-1, 127/128]. -// The rationale for that is that is the natural interval for output -// activations (see next point) and these need to be concatenated together. -// We could accommodate different ranges by re-scaling, but we empirically -// found that setting the input activations range to be [-1, 127/128] in the -// first place, removing the need for re-scaling, greatly improves accuracy. -// - The output activations are quantized as uint8 on the interval -// [-1, 127/128]. -// The rationale for that is that the definition of a LSTM cell makes them -// intrinsically constrained in [-1, 1]; tweaking that to [-1, 127/128] -// makes for simpler, more accurate fixed-point arithmetic. -// - The output-at-previous-timestep state array is obviously quantized as -// the output activations. -// - The internal LSTM memory (not the output-at-previous-timestep, the other -// internal state array) is int16-quantized and may use any power-of-two, -// symmetric range i.e. [-2^N, 2^N * 32767/32768] for any N, which we call -// StateIntegerBits below, see the below discussion of that template -// parameter ("The StateIntegerBits template parameter"). -// - The output of the internal fully-connected node is int16-quantized -// on the interval [-8, 8 * 32767/32768], the rationale for which is -// explained just below ("Why [-8, 8] for fully-connected output?"). -// -// -// === The StateIntegerBits template parameter === -// -// The StateIntegerBits template parameter controls the fixed-point format used -// to represent the internal memory of the LSTM cell (not the -// output-at-previous-timestep, the other internal state array). It's currently -// a template parameter so that the model can control that. The most typical -// value for StateIntegerBits is 4. Other plausible values are anywhere between -// 3 and 5. We might eventually standardize on a single supported value, e.g. 4, -// and drop that template parameter. The reason why it can't be a runtime -// parameter is that this controls the fixed-point format used, i.e. we need to -// generate actually different code based on it. In particular, we generate code -// for a fixed-point tanh() implementation for that format, which internally -// uses a fixed-point exp() implementation, which internally uses a -// barrel-shifter with a number of steps that depends on StateIntegerBits. -// Another consequence of that is that a higher value of StateIntegerBits -// results in a more expensive implementation (more barrel shifter steps -// needed). -// -// -// === Why [-8, 8] for fully-connected output? === -// -// This array is only fed to Logistic and Tanh functions, for which -// the quantized implementation will want to use fixed-point arithmetic, -// requiring a power-of-two representation interval. Thus, we should right -// away quantize this array to a power-of-two interval; otherwise, -// implementation will need to rescale that, losing any benefit that a tighter -// representation interval might otherwise yield, while introducing some -// numerical error and computational overhead. -// -// Now, Logistic and Tanh -// are nearly constant (nearly equal to their horizontal asymptotes) -// outside of a small bounded interval around 0: -// -// Logistic(4) = 1 - 1.8e-2 Tanh(4) = 1 - 6.7e-4 -// Logistic(8) = 1 - 3.4e-4 Tanh(8) = 1 - 2.3e-7 -// Logistic(16) = 1 - 1.1e-7 Tanh(16) = 1 - 2.5e-14 -// -// From this, we see that clamping to [-4, 4] would be too inaccurate -// (the error of 1.8e-2 on Logistic would be felt even in 8bit precision) -// while clamping to [-16, 16] would make no difference even in float32. -// However, for a fixed-point implementation in 16-bit integers, using 5 -// integer bits to represent the [-16, 16] range would leave only 11 -// fractional bits, giving an increment of 2^-11 = 4.9e-4 between consecutive -// representable values. Notice that is higher than the -// worst-case clamping error with clamping to [-8, 8]: 3.4e-4 for Logistic. -// Using [-8, 8] thus seems like the better compromise overall, enjoying -// an increment of 2.4e-4 between representable values and a worst-case -// clamping error of 3.4e-4, both better than the increment of 4.9e-4 with -// [-16, 16]. -// -// Moreover, all other things being equal, it is nice to choose the narrower -// representation range, as that makes the implementation of fixed-point -// math functions a little cheaper (each integer bit requires an additional -// barrel-shifter atep in the implementation of exp(-x)). That is further -// reason to prefer [-8, 8] over [-16, 16]. The choice of [-16, 16] would make -// sense for 32-bit float or 32-bit fixed-point quantization, but we are -// aiming for 16-bit fixed-point quantization of these internal nodes here. -// -template -inline void LstmCell(const LstmCellParams& params, - const RuntimeShape& unextended_input_shape, - const uint8* input_data_uint8, - const RuntimeShape& unextended_prev_activ_shape, - const uint8* prev_activ_data_uint8, - const RuntimeShape& weights_shape, - const uint8* weights_data_uint8, - const RuntimeShape& unextended_bias_shape, - const int32* bias_data_int32, - const RuntimeShape& unextended_prev_state_shape, - const int16* prev_state_data_int16, - const RuntimeShape& unextended_output_state_shape, - int16* output_state_data_int16, - const RuntimeShape& unextended_output_activ_shape, - uint8* output_activ_data_uint8, - const RuntimeShape& unextended_concat_temp_shape, - uint8* concat_temp_data_uint8, - const RuntimeShape& unextended_activ_temp_shape, - int16* activ_temp_data_int16, void* gemmlowp_context) { - (void)gemmlowp_context; // only used in optimized code. - int32 weights_zero_point = params.weights_zero_point; - int32 accum_multiplier = params.accum_multiplier; - int accum_shift = params.accum_shift; - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_prev_activ_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_bias_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_prev_state_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_state_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_activ_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_concat_temp_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_activ_temp_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape prev_activ_shape = - RuntimeShape::ExtendedShape(4, unextended_prev_activ_shape); - const RuntimeShape bias_shape = - RuntimeShape::ExtendedShape(4, unextended_bias_shape); - const RuntimeShape prev_state_shape = - RuntimeShape::ExtendedShape(4, unextended_prev_state_shape); - const RuntimeShape output_state_shape = - RuntimeShape::ExtendedShape(4, unextended_output_state_shape); - const RuntimeShape output_activ_shape = - RuntimeShape::ExtendedShape(4, unextended_output_activ_shape); - const RuntimeShape concat_temp_shape = - RuntimeShape::ExtendedShape(4, unextended_concat_temp_shape); - const RuntimeShape activ_temp_shape = - RuntimeShape::ExtendedShape(4, unextended_activ_temp_shape); - TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2); - - // Gather dimensions information, and perform consistency checks. - const int weights_dim_count = weights_shape.DimensionsCount(); - const int outer_size = MatchingFlatSizeSkipDim( - input_shape, 3, prev_activ_shape, prev_state_shape, output_state_shape, - output_activ_shape); - const int input_depth = input_shape.Dims(3); - const int prev_activ_depth = prev_activ_shape.Dims(3); - const int total_input_depth = prev_activ_depth + input_depth; - TFLITE_DCHECK_EQ(weights_shape.Dims(weights_dim_count - 1), - total_input_depth); - const int intern_activ_depth = - MatchingDim(weights_shape, weights_dim_count - 2, bias_shape, 3); - TFLITE_DCHECK_EQ(weights_shape.FlatSize(), - intern_activ_depth * total_input_depth); - TFLITE_DCHECK_EQ(FlatSizeSkipDim(bias_shape, 3), 1); - TFLITE_DCHECK_EQ(intern_activ_depth % 4, 0); - const int output_depth = - MatchingDim(prev_state_shape, 3, prev_activ_shape, 3, output_state_shape, - 3, output_activ_shape, 3); - TFLITE_DCHECK_EQ(output_depth, intern_activ_depth / 4); - const int fc_batches = FlatSizeSkipDim(activ_temp_shape, 3); - const int fc_output_depth = - MatchingDim(weights_shape, weights_dim_count - 2, activ_temp_shape, 3); - const int fc_accum_depth = total_input_depth; - TFLITE_DCHECK_EQ(fc_output_depth, 4 * output_depth); - - // Depth-concatenate prev_activ and input data together. - uint8 const* concat_input_arrays_data[2] = {input_data_uint8, - prev_activ_data_uint8}; - const RuntimeShape* concat_input_arrays_shapes[2] = {&input_shape, - &prev_activ_shape}; - tflite::ConcatenationParams concat_params; - concat_params.axis = 3; - concat_params.inputs_count = 2; - Concatenation(concat_params, concat_input_arrays_shapes, - concat_input_arrays_data, concat_temp_shape, - concat_temp_data_uint8); - - // Implementation of the fully connected node inside the LSTM cell. - // The operands are 8-bit integers, the accumulators are internally 32bit - // integers, and the output is 16-bit fixed-point with 3 integer bits so - // the output range is [-2^3, 2^3] == [-8, 8]. The rationale for that - // is explained in the function comment above. - for (int b = 0; b < fc_batches; ++b) { - for (int out_c = 0; out_c < fc_output_depth; ++out_c) { - // Internal accumulation. - // Initialize accumulator with the bias-value. - int32 accum = bias_data_int32[out_c]; - // Accumulation loop. - for (int d = 0; d < fc_accum_depth; ++d) { - int16 input_val = concat_temp_data_uint8[b * fc_accum_depth + d] - 128; - int16 weights_val = - weights_data_uint8[out_c * fc_accum_depth + d] - weights_zero_point; - accum += input_val * weights_val; - } - // Down-scale the final int32 accumulator to the scale used by our - // (16-bit, using 3 integer bits) fixed-point format. The quantized - // multiplier and shift here have been pre-computed offline - // (e.g. by toco). - accum = - MultiplyByQuantizedMultiplier(accum, accum_multiplier, accum_shift); - // Saturate, cast to int16, and store to the temporary activations array. - accum = std::max(-32768, std::min(32767, accum)); - activ_temp_data_int16[out_c + fc_output_depth * b] = accum; - } - } - - // Rest of the LSTM cell: tanh and logistic math functions, and some adds - // and muls, all done in 16-bit fixed-point. - for (int b = 0; b < outer_size; ++b) { - for (int c = 0; c < output_depth; ++c) { - // Define the fixed-point data types that we will use here. All use - // int16 as the underlying integer type i.e. all are 16-bit fixed-point. - // They only differ by the number of integral vs. fractional bits, - // determining the range of values that they can represent. - // - // F0 uses 0 integer bits, range [-1, 1]. - // This is the return type of math functions such as tanh, logistic, - // whose range is in [-1, 1]. - using F0 = gemmlowp::FixedPoint; - // F3 uses 3 integer bits, range [-8, 8]. - // This is the range of the previous fully-connected node's output, - // which is our input here. - using F3 = gemmlowp::FixedPoint; - // FS uses StateIntegerBits integer bits, range [-2^StateIntegerBits, - // 2^StateIntegerBits]. It's used to represent the internal state, whose - // number of integer bits is currently dictated by the model. See comment - // on the StateIntegerBits template parameter above. - using FS = gemmlowp::FixedPoint; - // Implementation of input gate, using fixed-point logistic function. - F3 input_gate_input = F3::FromRaw( - activ_temp_data_int16[b * fc_output_depth + 0 * output_depth + c]); - F0 input_gate_output = gemmlowp::logistic(input_gate_input); - // Implementation of input modulation gate, using fixed-point tanh - // function. - F3 input_modulation_gate_input = F3::FromRaw( - activ_temp_data_int16[b * fc_output_depth + 1 * output_depth + c]); - F0 input_modulation_gate_output = - gemmlowp::tanh(input_modulation_gate_input); - // Implementation of forget gate, using fixed-point logistic function. - F3 forget_gate_input = F3::FromRaw( - activ_temp_data_int16[b * fc_output_depth + 2 * output_depth + c]); - F0 forget_gate_output = gemmlowp::logistic(forget_gate_input); - // Implementation of output gate, using fixed-point logistic function. - F3 output_gate_input = F3::FromRaw( - activ_temp_data_int16[b * fc_output_depth + 3 * output_depth + c]); - F0 output_gate_output = gemmlowp::logistic(output_gate_input); - // Implementation of internal multiplication nodes, still in fixed-point. - F0 input_times_input_modulation = - input_gate_output * input_modulation_gate_output; - FS prev_state = FS::FromRaw(prev_state_data_int16[b * output_depth + c]); - FS prev_state_times_forget_state = forget_gate_output * prev_state; - // Implementation of internal addition node, saturating. - FS new_state = gemmlowp::SaturatingAdd( - gemmlowp::Rescale(input_times_input_modulation), - prev_state_times_forget_state); - // Implementation of last internal Tanh node, still in fixed-point. - // Since a Tanh fixed-point implementation is specialized for a given - // number or integer bits, and each specialization can have a substantial - // code size, and we already used above a Tanh on an input with 3 integer - // bits, and per the table in the above function comment there is no - // significant accuracy to be lost by clamping to [-8, +8] for a - // 3-integer-bits representation, let us just do that. This helps people - // porting this to targets where code footprint must be minimized. - F3 new_state_f3 = gemmlowp::Rescale<3>(new_state); - F0 output_activ_int16 = output_gate_output * gemmlowp::tanh(new_state_f3); - // Store the new internal state back to memory, as 16-bit integers. - // Note: here we store the original value with StateIntegerBits, not - // the rescaled 3-integer-bits value fed to tanh. - output_state_data_int16[b * output_depth + c] = new_state.raw(); - // Down-scale the output activations to 8-bit integers, saturating, - // and store back to memory. - int16 rescaled_output_activ = - gemmlowp::RoundingDivideByPOT(output_activ_int16.raw(), 8); - int16 clamped_output_activ = - std::max(-128, std::min(127, rescaled_output_activ)); - output_activ_data_uint8[b * output_depth + c] = - 128 + clamped_output_activ; - } - } -} - -template -void Split(const SplitParams& params, const RuntimeShape& input_shape, - const Scalar* input_data, const RuntimeShape* const* output_shapes, - Scalar* const* output_data) { - ruy::profiler::ScopeLabel label("Split"); - const int split_dimensions = input_shape.DimensionsCount(); - int axis = params.axis < 0 ? params.axis + split_dimensions : params.axis; - int outputs_count = params.num_split; - TFLITE_DCHECK_LT(axis, split_dimensions); - - int64_t split_size = 0; - for (int i = 0; i < outputs_count; i++) { - TFLITE_DCHECK_EQ(output_shapes[i]->DimensionsCount(), split_dimensions); - for (int j = 0; j < split_dimensions; j++) { - if (j != axis) { - MatchingDim(*output_shapes[i], j, input_shape, j); - } - } - split_size += output_shapes[i]->Dims(axis); - } - TFLITE_DCHECK_EQ(split_size, input_shape.Dims(axis)); - int64_t outer_size = 1; - for (int i = 0; i < axis; ++i) { - outer_size *= input_shape.Dims(i); - } - // For all output arrays, - // FlatSize() = outer_size * Dims(axis) * base_inner_size; - int64_t base_inner_size = 1; - for (int i = axis + 1; i < split_dimensions; ++i) { - base_inner_size *= input_shape.Dims(i); - } - - const Scalar* input_ptr = input_data; - for (int k = 0; k < outer_size; k++) { - for (int i = 0; i < outputs_count; ++i) { - const int copy_size = output_shapes[i]->Dims(axis) * base_inner_size; - memcpy(output_data[i] + k * copy_size, input_ptr, - copy_size * sizeof(Scalar)); - input_ptr += copy_size; - } - } -} - -inline int NodeOffset(int b, int h, int w, int height, int width) { - return (b * height + h) * width + w; -} - -inline void LocalResponseNormalization( - const tflite::LocalResponseNormalizationParams& op_params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int outer_size = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int depth = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - - for (int i = 0; i < outer_size; ++i) { - for (int c = 0; c < depth; ++c) { - const int begin_input_c = std::max(0, c - op_params.range); - const int end_input_c = std::min(depth, c + op_params.range); - float accum = 0.f; - for (int input_c = begin_input_c; input_c < end_input_c; ++input_c) { - const float input_val = input_data[i * depth + input_c]; - accum += input_val * input_val; - } - const float multiplier = - std::pow(op_params.bias + op_params.alpha * accum, -op_params.beta); - output_data[i * depth + c] = input_data[i * depth + c] * multiplier; - } - } -} - -inline void LogSoftmax(const SoftmaxParams& params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int outer_size = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int depth = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - - for (int i = 0; i < outer_size; ++i) { - // Find max element value which we'll use to ensure numerical stability - // taking advantage of the following equality: - // log(exp(x[i])/sum(exp(x[i]))) == log(exp(x[i]+C)/sum(exp(x[i]+C))) - float max = std::numeric_limits::lowest(); - for (int c = 0; c < depth; ++c) { - max = std::max(max, input_data[i * depth + c]); - } - - // Compute sum. - float sum = 0.f; - for (int c = 0; c < depth; ++c) { - sum += std::exp(input_data[i * depth + c] - max); - } - - // Compute result. - const float log_sum = std::log(sum); - for (int c = 0; c < depth; ++c) { - output_data[i * depth + c] = input_data[i * depth + c] - max - log_sum; - } - } -} - -inline void LogSoftmax(const SoftmaxParams& params, - const RuntimeShape& input_shape, const uint8* input_data, - const RuntimeShape& output_shape, uint8* output_data) { - ruy::profiler::ScopeLabel label("LogSoftmax/8bit"); - const int32 input_multiplier = params.input_multiplier; - const int32 input_left_shift = params.input_left_shift; - const int32 reverse_scaling_divisor = params.reverse_scaling_divisor; - const int32 reverse_scaling_right_shift = params.reverse_scaling_right_shift; - const int diff_min = params.diff_min; - // The representation chosen for the input to the exp() function is Q5.26. - // We need to leave extra space since values that we skip might be as large - // as -32 before multiplying by input_beta_multiplier, and therefore as - // large as -16 afterwards. Note that exp(-8) is definitely not - // insignificant to accumulation, but exp(-16) definitely is. - static constexpr int kScaledDiffIntegerBits = 5; - static constexpr int kAccumulationIntegerBits = 12; - static constexpr int kOutputIntegerBits = 4; - using FixedPointScaledDiff = - gemmlowp::FixedPoint; - using FixedPointAccum = gemmlowp::FixedPoint; - - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int outer_size = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int depth = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - - for (int i = 0; i < outer_size; ++i) { - uint8 max_in_row = 0; - for (int c = 0; c < depth; ++c) { - max_in_row = std::max(max_in_row, input_data[i * depth + c]); - } - - FixedPointAccum sum_of_exps = FixedPointAccum::Zero(); - for (int c = 0; c < depth; ++c) { - int32 input_diff = - static_cast(input_data[i * depth + c]) - max_in_row; - if (input_diff >= diff_min) { - const int32 input_diff_rescaled = - MultiplyByQuantizedMultiplierGreaterThanOne( - input_diff, input_multiplier, input_left_shift); - const FixedPointScaledDiff scaled_diff_f8 = - FixedPointScaledDiff::FromRaw(input_diff_rescaled); - sum_of_exps = sum_of_exps + gemmlowp::Rescale( - exp_on_negative_values(scaled_diff_f8)); - } - } - - const int32 fixed_log_sum_of_exps = - log_x_for_x_greater_than_or_equal_to_1( - sum_of_exps) - .raw(); - - // rescaled_diff_min is smallest representable in - // Q(kScaledDiffIntegerBits).(31-kScaledDiffIntegerBits) plus the - // log-sub-exps that will be subtracted in the loop. - // - // The thresholds diff_min, etc are negative. - const int rescaled_diff_min = - fixed_log_sum_of_exps + std::numeric_limits::lowest(); - const int adjusted_diff_min = - std::max(diff_min - 1, // Note use of > below instead of >= above. - MultiplyByQuantizedMultiplierSmallerThanOneExp( - rescaled_diff_min, reverse_scaling_divisor, - -reverse_scaling_right_shift)); - - for (int c = 0; c < depth; ++c) { - int32 input_diff = - static_cast(input_data[i * depth + c]) - max_in_row; - if (input_diff > adjusted_diff_min) { - const int32 input_diff_rescaled = - MultiplyByQuantizedMultiplierGreaterThanOne( - input_diff, input_multiplier, input_left_shift); - int32 unsat_output = - gemmlowp::RoundingDivideByPOT( - (input_diff_rescaled - fixed_log_sum_of_exps), - 31 - kScaledDiffIntegerBits - kOutputIntegerBits) + - 255; - - output_data[i * depth + c] = static_cast( - std::max(std::min(unsat_output, static_cast(255)), 0)); - } else { - // Set output to smallest value. - output_data[i * depth + c] = 0; - } - } - } -} - -inline void Dequantize(const RuntimeShape& input_shape, - const Eigen::half* input_data, - const RuntimeShape& output_shape, float* output_data) { - const int flat_size = MatchingFlatSize(input_shape, output_shape); - for (int i = 0; i < flat_size; i++) { - output_data[i] = Eigen::half_impl::half_to_float(input_data[i]); - } -} - -inline void FakeQuant(const tflite::FakeQuantParams& op_params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - ruy::profiler::ScopeLabel label("FakeQuant"); - float rmin = op_params.minmax.min; - float rmax = op_params.minmax.max; - int num_bits = op_params.num_bits; - // 0 should always be a representable value. Let's assume that the initial - // min,max range contains 0. - TFLITE_DCHECK_LE(rmin, 0.0f); - TFLITE_DCHECK_GE(rmax, 0.0f); - TFLITE_DCHECK_LT(rmin, rmax); - - // Code matches tensorflow's FakeQuantWithMinMaxArgsFunctor. - int quant_min = 0; - int quant_max = (1 << num_bits) - 1; - float nudged_min, nudged_max, nudged_scale; - NudgeQuantizationRange(rmin, rmax, quant_min, quant_max, &nudged_min, - &nudged_max, &nudged_scale); - const int flat_size = MatchingFlatSize(input_shape, output_shape); - FakeQuantizeArray(nudged_scale, nudged_min, nudged_max, input_data, - output_data, flat_size); -} - -template -inline void Cast(const RuntimeShape& input_shape, const SrcT* input_data, - const RuntimeShape& output_shape, DstT* output_data) { - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - int offset = i; - output_data[offset] = static_cast(input_data[offset]); - } -} - -template -T FloorMod(T input1, T input2) { - struct FloatMod { - float operator()(const float lhs, const float rhs) const { - return std::fmod(lhs, rhs); - } - }; - using ModFunc = typename std::conditional::value, - std::modulus, FloatMod>::type; - ModFunc mod_func; - T trunc_mod = mod_func(input1, input2); - return (trunc_mod != 0) && ((input2 < 0) != (trunc_mod < 0)) - ? (trunc_mod + input2) - : trunc_mod; -} - -template -inline void Gather(const tflite::GatherParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& coords_shape, const CoordsT* coords_data, - const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("Gather"); - int axis = op_params.axis; - if (axis < 0) { - axis += input_shape.DimensionsCount(); - } - TFLITE_DCHECK_GE(axis, 0); - TFLITE_DCHECK_LT(axis, input_shape.DimensionsCount()); - const int axis_size = input_shape.Dims(axis); - const int coords_count = coords_shape.FlatSize(); - - int outer_size = 1; - for (int i = 0; i < axis; ++i) { - outer_size *= input_shape.Dims(i); - } - - int inner_size = 1; - for (int i = axis + 1; i < input_shape.DimensionsCount(); ++i) { - inner_size *= input_shape.Dims(i); - } - - for (int outer = 0; outer < outer_size; ++outer) { - for (int i = 0; i < coords_count; ++i) { - TFLITE_DCHECK_GE(coords_data[i], 0); - TFLITE_DCHECK_LT(coords_data[i], axis_size); - std::memcpy( - output_data + (outer * coords_count + i) * inner_size, - input_data + (outer * axis_size + coords_data[i]) * inner_size, - sizeof(T) * inner_size); - } - } -} - -// Common subroutine for both `GatherNd` and `GatherNdString`. -struct GatherNdHelperResult { - int n_slices; - int slice_size; - int indices_nd; - std::vector dims_to_count; -}; - -// Returns common values being used on both `GatherNd` and `GatherNdString`. -inline GatherNdHelperResult GatherNdHelper(const RuntimeShape& params_shape, - const RuntimeShape& indices_shape) { - GatherNdHelperResult ret; - ret.n_slices = 1; - ret.slice_size = 1; - const int indices_dims = indices_shape.DimensionsCount(); - ret.indices_nd = indices_shape.Dims(indices_dims - 1); - const int params_dims = params_shape.DimensionsCount(); - for (int i = 0; i < indices_dims - 1; ++i) { - ret.n_slices *= indices_shape.Dims(i); - } - for (int i = ret.indices_nd; i < params_dims; ++i) { - ret.slice_size *= params_shape.Dims(i); - } - - int remain_flat_size = params_shape.FlatSize(); - ret.dims_to_count = std::vector(ret.indices_nd, 0); - for (int i = 0; i < ret.indices_nd; ++i) { - ret.dims_to_count[i] = remain_flat_size / params_shape.Dims(i); - remain_flat_size = ret.dims_to_count[i]; - } - - return ret; -} - -template -inline void GatherNd(const RuntimeShape& params_shape, - const ParamsT* params_data, - const RuntimeShape& indices_shape, - const IndicesT* indices_data, - const RuntimeShape& output_shape, ParamsT* output_data) { - ruy::profiler::ScopeLabel label("GatherNd"); - - const GatherNdHelperResult res = GatherNdHelper(params_shape, indices_shape); - for (int i = 0; i < res.n_slices; ++i) { - int from_pos = 0; - for (int j = 0; j < res.indices_nd; ++j) { - from_pos += indices_data[i * res.indices_nd + j] * res.dims_to_count[j]; - } - std::memcpy(output_data + i * res.slice_size, params_data + from_pos, - sizeof(ParamsT) * res.slice_size); - } -} - -#ifndef TF_LITE_STATIC_MEMORY -template -inline void GatherNdString(const RuntimeShape& params_shape, - const TfLiteTensor* params_data, - const RuntimeShape& indices_shape, - const IndicesT* indices_data, - const RuntimeShape& output_shape, - TfLiteTensor* output_data) { - ruy::profiler::ScopeLabel label("GatherNdString"); - - const GatherNdHelperResult res = GatherNdHelper(params_shape, indices_shape); - DynamicBuffer buffer; - for (int i = 0; i < res.n_slices; ++i) { - int from_pos = 0; - for (int j = 0; j < res.indices_nd; ++j) { - from_pos += indices_data[i * res.indices_nd + j] * res.dims_to_count[j]; - } - for (int j = 0; j < res.slice_size; ++j) { - buffer.AddString(GetString(params_data, from_pos + j)); - } - } - buffer.WriteToTensor(output_data, /*new_shape=*/nullptr); -} -#endif - -template -inline void ScatterNd(const RuntimeShape& indices_shape, - const IndicesT* indices_data, - const RuntimeShape& updates_shape, - const UpdatesT* updates_data, - const RuntimeShape& output_shape, UpdatesT* output_data) { - ruy::profiler::ScopeLabel label("ScatterNd"); - - int n_slices = 1; - int slice_size = 1; - const int outer_dims = indices_shape.DimensionsCount() - 1; - const int indices_nd = indices_shape.Dims(outer_dims); - const int updates_dims = updates_shape.DimensionsCount(); - for (int i = 0; i < outer_dims; ++i) { - n_slices *= indices_shape.Dims(i); - } - for (int i = outer_dims; i < updates_dims; ++i) { - slice_size *= updates_shape.Dims(i); - } - - int output_flat_size = output_shape.FlatSize(); - int remain_flat_size = output_flat_size; - std::vector dims_to_count(indices_nd, 0); - for (int i = 0; i < indices_nd; ++i) { - dims_to_count[i] = remain_flat_size / output_shape.Dims(i); - remain_flat_size = dims_to_count[i]; - } - - memset(output_data, 0, sizeof(UpdatesT) * output_flat_size); - for (int i = 0; i < n_slices; ++i) { - int to_pos = 0; - for (int j = 0; j < indices_nd; ++j) { - IndicesT idx = indices_data[i * indices_nd + j]; - TFLITE_DCHECK(0 <= idx && idx < output_shape.Dims(j)); - to_pos += idx * dims_to_count[j]; - } - for (int j = 0; j < slice_size; j++) { - output_data[to_pos + j] += updates_data[i * slice_size + j]; - } - } -} - -inline void ComputeInterpolationValues(const float value, const float scale, - const bool half_pixel_centers, - int32 input_size, float* scaled_value, - int32* lower_bound, int32* upper_bound) { - if (half_pixel_centers) { - *scaled_value = (value + 0.5f) * scale - 0.5f; - } else { - *scaled_value = value * scale; - } - float scaled_value_floor = std::floor(*scaled_value); - *lower_bound = - std::max(static_cast(scaled_value_floor), static_cast(0)); - *upper_bound = - std::min(static_cast(std::ceil(*scaled_value)), input_size - 1); -} - -template -inline void ResizeBilinear(const tflite::ResizeBilinearParams& op_params, - const RuntimeShape& unextended_input_shape, - const T* input_data, - const RuntimeShape& unextended_output_size_shape, - const int32* output_size_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - // If half_pixel_centers is True, align_corners must be False. - TFLITE_DCHECK(!op_params.half_pixel_centers || !op_params.align_corners); - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_size_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_size_shape = - RuntimeShape::ExtendedShape(4, unextended_output_size_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - int32 batches = MatchingDim(input_shape, 0, output_shape, 0); - int32 input_height = input_shape.Dims(1); - int32 input_width = input_shape.Dims(2); - int32 depth = MatchingDim(input_shape, 3, output_shape, 3); - - TFLITE_DCHECK_EQ(output_size_shape.Dims(0), 1); - TFLITE_DCHECK_EQ(output_size_shape.Dims(1), 1); - TFLITE_DCHECK_EQ(output_size_shape.Dims(2), 1); - TFLITE_DCHECK_EQ(output_size_shape.Dims(3), 2); - int32 output_height = output_size_data[Offset(output_size_shape, 0, 0, 0, 0)]; - int32 output_width = output_size_data[Offset(output_size_shape, 0, 0, 0, 1)]; - - float height_scale = static_cast(input_height) / output_height; - float width_scale = static_cast(input_width) / output_width; - if (op_params.align_corners && output_height > 1) { - height_scale = static_cast(input_height - 1) / (output_height - 1); - } - if (op_params.align_corners && output_width > 1) { - width_scale = static_cast(input_width - 1) / (output_width - 1); - } - - for (int b = 0; b < batches; ++b) { - for (int y = 0; y < output_height; ++y) { - float input_y; - int32 y0, y1; - ComputeInterpolationValues(y, height_scale, op_params.half_pixel_centers, - input_height, &input_y, &y0, &y1); - for (int x = 0; x < output_width; ++x) { - float input_x; - int32 x0, x1; - ComputeInterpolationValues(x, width_scale, op_params.half_pixel_centers, - input_width, &input_x, &x0, &x1); - for (int c = 0; c < depth; ++c) { - T interpolation = - static_cast(input_data[Offset(input_shape, b, y0, x0, c)] * - (1 - (input_y - y0)) * (1 - (input_x - x0)) + - input_data[Offset(input_shape, b, y1, x0, c)] * - (input_y - y0) * (1 - (input_x - x0)) + - input_data[Offset(input_shape, b, y0, x1, c)] * - (1 - (input_y - y0)) * (input_x - x0) + - input_data[Offset(input_shape, b, y1, x1, c)] * - (input_y - y0) * (input_x - x0)); - output_data[Offset(output_shape, b, y, x, c)] = interpolation; - } - } - } - } -} - -inline void ComputeInterpolationValues(const int32 value, const int32 scale_10, - const bool half_pixel_centers, - int32 input_size, int32* scaled_value, - int32* lower_bound, int32* upper_bound) { - if (half_pixel_centers) { - *scaled_value = value * scale_10 + scale_10 / 2 - (1 << 9); - } else { - *scaled_value = value * scale_10; - } - *lower_bound = std::max(*scaled_value / (1 << 10), 0); - *upper_bound = std::min(*scaled_value / (1 << 10) + 1, input_size - 1); -} - -// Same as above but takes int8 as input and output. -inline void ResizeBilinear(const tflite::ResizeBilinearParams& op_params, - const RuntimeShape& unextended_input_shape, - const int8_t* input_data, - const RuntimeShape& unextended_output_size_shape, - const int32* output_size_data, - const RuntimeShape& unextended_output_shape, - int8_t* output_data) { - // If half_pixel_centers is True, align_corners must be False. - TFLITE_DCHECK(!op_params.half_pixel_centers || !op_params.align_corners); - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_size_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_size_shape = - RuntimeShape::ExtendedShape(4, unextended_output_size_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - const int32 batches = MatchingDim(input_shape, 0, output_shape, 0); - const int32 input_height = input_shape.Dims(1); - const int32 input_width = input_shape.Dims(2); - const int32 depth = MatchingDim(input_shape, 3, output_shape, 3); - - TFLITE_DCHECK_EQ(output_size_shape.Dims(0), 1); - TFLITE_DCHECK_EQ(output_size_shape.Dims(1), 1); - TFLITE_DCHECK_EQ(output_size_shape.Dims(2), 1); - TFLITE_DCHECK_EQ(output_size_shape.Dims(3), 2); - const int32 output_height = - output_size_data[Offset(output_size_shape, 0, 0, 0, 0)]; - const int32 output_width = - output_size_data[Offset(output_size_shape, 0, 0, 0, 1)]; - - int32 height_scale_10 = - ((1 << 10) * input_height + output_height / 2) / output_height; - int32 width_scale_10 = - ((1 << 10) * input_width + output_width / 2) / output_width; - if (op_params.align_corners && output_height > 1) { - height_scale_10 = - ((1 << 10) * (input_height - 1) + (output_height - 1) / 2) / - (output_height - 1); - } - if (op_params.align_corners && output_width > 1) { - width_scale_10 = ((1 << 10) * (input_width - 1) + (output_width - 1) / 2) / - (output_width - 1); - } - - for (int b = 0; b < batches; ++b) { - for (int y = 0; y < output_height; ++y) { - int32 input_y, y0, y1; - ComputeInterpolationValues(y, height_scale_10, - op_params.half_pixel_centers, input_height, - &input_y, &y0, &y1); - for (int x = 0; x < output_width; ++x) { - int32 input_x, x0, x1; - ComputeInterpolationValues(x, width_scale_10, - op_params.half_pixel_centers, input_width, - &input_x, &x0, &x1); - for (int c = 0; c < depth; ++c) { - const int64_t output_20_ll = - static_cast( - input_data[Offset(input_shape, b, y0, x0, c)]) * - ((1 << 10) - (input_y - (1 << 10) * y0)) * - ((1 << 10) - (input_x - (1 << 10) * x0)); - const int64_t output_20_lu = - static_cast( - input_data[Offset(input_shape, b, y1, x0, c)]) * - (input_y - (1 << 10) * y0) * - ((1 << 10) - (input_x - (1 << 10) * x0)); - const int64_t output_20_rl = - static_cast( - input_data[Offset(input_shape, b, y0, x1, c)]) * - ((1 << 10) - (input_y - (1 << 10) * y0)) * - (input_x - (1 << 10) * x0); - const int64_t output_20_ru = - static_cast( - input_data[Offset(input_shape, b, y1, x1, c)]) * - (input_y - (1 << 10) * y0) * (input_x - (1 << 10) * x0); - const int64_t output_20 = - output_20_ll + output_20_lu + output_20_rl + output_20_ru; - const int8_t interpolation = - static_cast((output_20 + (1 << 19)) / (1 << 20)); - output_data[Offset(output_shape, b, y, x, c)] = interpolation; - } - } - } - } -} - -template -inline void SpaceToBatchND( - const SpaceToBatchParams& params, - const RuntimeShape& unextended_input1_shape, const T* input1_data, - const RuntimeShape& unextended_input2_shape, const int32* block_shape_data, - const RuntimeShape& unextended_input3_shape, const int32* paddings_data, - const RuntimeShape& unextended_output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("SpaceToBatchND"); - TFLITE_DCHECK_GE(unextended_input1_shape.DimensionsCount(), 3); - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(unextended_input1_shape.DimensionsCount(), - unextended_output_shape.DimensionsCount()); - - // Extends the input/output shape from 3D to 4D if needed, NHC -> NH1C. - auto extend_shape = [](const RuntimeShape& shape) { - if (shape.DimensionsCount() == 4) { - return shape; - } - RuntimeShape new_shape(4, 1); - new_shape.SetDim(0, shape.Dims(0)); - new_shape.SetDim(1, shape.Dims(1)); - new_shape.SetDim(3, shape.Dims(2)); - return new_shape; - }; - const RuntimeShape input1_shape = extend_shape(unextended_input1_shape); - const RuntimeShape output_shape = extend_shape(unextended_output_shape); - - const int depth = input1_shape.Dims(3); - const int input_width = input1_shape.Dims(2); - const int input_height = input1_shape.Dims(1); - const int input_batch_size = input1_shape.Dims(0); - - const int output_width = output_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_batch_size = output_shape.Dims(0); - - const int block_shape_height = block_shape_data[0]; - const int block_shape_width = - unextended_input1_shape.DimensionsCount() == 4 ? block_shape_data[1] : 1; - const int padding_top = paddings_data[0]; - const int padding_left = - unextended_input1_shape.DimensionsCount() == 4 ? paddings_data[2] : 0; - - // For uint8 quantized, the correct padding "zero value" is the output offset. - const int32_t pad_value = params.output_offset; - for (int out_b = 0; out_b < output_batch_size; ++out_b) { - int input_batch = out_b % input_batch_size; - int shift_w = (out_b / input_batch_size) % block_shape_width; - int shift_h = (out_b / input_batch_size) / block_shape_width; - for (int out_h = 0; out_h < output_height; ++out_h) { - for (int out_w = 0; out_w < output_width; ++out_w) { - T* out = output_data + Offset(output_shape, out_b, out_h, out_w, 0); - if (out_h * block_shape_height + shift_h < padding_top || - out_h * block_shape_height + shift_h >= - padding_top + input_height || - out_w * block_shape_width + shift_w < padding_left || - out_w * block_shape_width + shift_w >= padding_left + input_width) { - // This may not execute correctly when pad_value != 0 and T != uint8. - memset(out, pad_value, depth * sizeof(T)); - } else { - const T* in = - input1_data + - Offset(input1_shape, input_batch, - (out_h * block_shape_height + shift_h) - padding_top, - (out_w * block_shape_width + shift_w) - padding_left, 0); - memcpy(out, in, depth * sizeof(T)); - } - } - } - } -} - -template -inline void BatchToSpaceND( - const RuntimeShape& unextended_input1_shape, const T* input1_data, - const RuntimeShape& unextended_input2_shape, const int32* block_shape_data, - const RuntimeShape& unextended_input3_shape, const int32* crops_data, - const RuntimeShape& unextended_output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("BatchToSpaceND"); - TFLITE_DCHECK_GE(unextended_input1_shape.DimensionsCount(), 3); - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(unextended_input1_shape.DimensionsCount(), - unextended_output_shape.DimensionsCount()); - - // Extends the input/output shape from 3D to 4D if needed, NHC -> NH1C. - auto extend_shape = [](const RuntimeShape& shape) { - if (shape.DimensionsCount() == 4) { - return shape; - } - RuntimeShape new_shape(4, 1); - new_shape.SetDim(0, shape.Dims(0)); - new_shape.SetDim(1, shape.Dims(1)); - new_shape.SetDim(3, shape.Dims(2)); - return new_shape; - }; - const RuntimeShape input1_shape = extend_shape(unextended_input1_shape); - const RuntimeShape output_shape = extend_shape(unextended_output_shape); - - const int output_width = output_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_batch_size = output_shape.Dims(0); - - const int depth = input1_shape.Dims(3); - const int input_width = input1_shape.Dims(2); - const int input_height = input1_shape.Dims(1); - const int input_batch_size = input1_shape.Dims(0); - - const int block_shape_height = block_shape_data[0]; - const int block_shape_width = - unextended_input1_shape.DimensionsCount() == 4 ? block_shape_data[1] : 1; - const int crops_top = crops_data[0]; - const int crops_left = - unextended_input1_shape.DimensionsCount() == 4 ? crops_data[2] : 0; - for (int in_batch = 0; in_batch < input_batch_size; ++in_batch) { - const int out_batch = in_batch % output_batch_size; - const int spatial_offset = in_batch / output_batch_size; - for (int in_h = 0; in_h < input_height; ++in_h) { - const int out_h = in_h * block_shape_height + - spatial_offset / block_shape_width - crops_top; - if (out_h < 0 || out_h >= output_height) { - continue; - } - for (int in_w = 0; in_w < input_width; ++in_w) { - const int out_w = in_w * block_shape_width + - spatial_offset % block_shape_width - crops_left; - - if (out_w < 0 || out_w >= output_width) { - continue; - } - T* out = output_data + Offset(output_shape, out_batch, out_h, out_w, 0); - const T* in = - input1_data + Offset(input1_shape, in_batch, in_h, in_w, 0); - memcpy(out, in, depth * sizeof(T)); - } - } - } -} - -template -inline void Slice(const tflite::SliceParams& op_params, - const RuntimeShape& input_shape, - const RuntimeShape& output_shape, - SequentialTensorWriter* writer) { - const RuntimeShape ext_shape = RuntimeShape::ExtendedShape(4, input_shape); - // TODO(dkalenichenko): This op only supports 4D tensors or smaller. - TFLITE_DCHECK_LE(op_params.begin_count, 4); - TFLITE_DCHECK_LE(op_params.size_count, 4); - const int begin_count = op_params.begin_count; - const int size_count = op_params.size_count; - // We front-pad the begin and size vectors. - const int start_b = 4 - begin_count > 0 ? 0 : op_params.begin[0]; - const int stop_b = (4 - size_count > 0 || op_params.size[0] == -1) - ? ext_shape.Dims(0) - : start_b + op_params.size[0]; - const int start_h = begin_count < 3 ? 0 : op_params.begin[begin_count - 3]; - const int stop_h = (size_count < 3 || op_params.size[size_count - 3] == -1) - ? ext_shape.Dims(1) - : start_h + op_params.size[size_count - 3]; - const int start_w = begin_count < 2 ? 0 : op_params.begin[begin_count - 2]; - const int stop_w = (size_count < 2 || op_params.size[size_count - 2] == -1) - ? ext_shape.Dims(2) - : start_w + op_params.size[size_count - 2]; - const int start_d = begin_count < 1 ? 0 : op_params.begin[begin_count - 1]; - const int stop_d = (size_count < 1 || op_params.size[size_count - 1] == -1) - ? ext_shape.Dims(3) - : start_d + op_params.size[size_count - 1]; - - for (int in_b = start_b; in_b < stop_b; ++in_b) { - for (int in_h = start_h; in_h < stop_h; ++in_h) { - for (int in_w = start_w; in_w < stop_w; ++in_w) { - for (int in_d = start_d; in_d < stop_d; ++in_d) { - writer->Write(Offset(ext_shape, in_b, in_h, in_w, in_d)); - } - } - } - } -} - -template -inline void Slice(const tflite::SliceParams& op_params, - const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& output_shape, T* output_data) { - SequentialTensorWriter writer(input_data, output_data); - return Slice(op_params, input_shape, output_shape, &writer); -} - -template -inline void Slice(const tflite::SliceParams& op_params, - const RuntimeShape& input_shape, const TfLiteTensor* input, - const RuntimeShape& output_shape, TfLiteTensor* output) { - SequentialTensorWriter writer(input, output); - return Slice(op_params, input_shape, output_shape, &writer); -} - -template -inline void Exp(const T* input_data, const size_t num_elements, - T* output_data) { - ruy::profiler::ScopeLabel label("Exp"); - for (size_t idx = 0; idx < num_elements; ++idx) { - output_data[idx] = std::exp(input_data[idx]); - } -} - -template -void Minimum(const RuntimeShape& input1_shape, const T* input1_data, - const T* input2_data, const RuntimeShape& output_shape, - T* output_data) { - const int flat_size = MatchingFlatSize(input1_shape, output_shape); - - auto min_value = input2_data[0]; - for (int i = 0; i < flat_size; i++) { - output_data[i] = input1_data[i] > min_value ? min_value : input1_data[i]; - } -} - -// Convenience version that allows, for example, generated-code calls to be -// the same as other binary ops. -template -inline void Minimum(const RuntimeShape& input1_shape, const T* input1_data, - const RuntimeShape&, const T* input2_data, - const RuntimeShape& output_shape, T* output_data) { - // Drop shape of second input: not needed. - Minimum(input1_shape, input1_data, input2_data, output_shape, output_data); -} - -template -void Maximum(const RuntimeShape& input1_shape, const T* input1_data, - const T* input2_data, const RuntimeShape& output_shape, - T* output_data) { - const int flat_size = MatchingFlatSize(input1_shape, output_shape); - - auto max_value = input2_data[0]; - for (int i = 0; i < flat_size; i++) { - output_data[i] = input1_data[i] < max_value ? max_value : input1_data[i]; - } -} - -// Convenience version that allows, for example, generated-code calls to be -// the same as other binary ops. -template -inline void Maximum(const RuntimeShape& input1_shape, const T* input1_data, - const RuntimeShape&, const T* input2_data, - const RuntimeShape& output_shape, T* output_data) { - // Drop shape of second input: not needed. - Maximum(input1_shape, input1_data, input2_data, output_shape, output_data); -} - -template -void ArgMax(const RuntimeShape& input1_shape, const T1* input1_data, - const T3* input2_data, const RuntimeShape& output_shape, - T2* output_data) { - ArgMinMax(input1_shape, input1_data, input2_data, output_shape, output_data, - std::greater()); -} - -// Convenience version that allows, for example, generated-code calls to be -// the same as other binary ops. -template -inline void ArgMax(const RuntimeShape& input1_shape, const T1* input1_data, - const RuntimeShape& input2_shape, const T3* input2_data, - const RuntimeShape& output_shape, T2* output_data) { - // Drop shape of second input: not needed. - ArgMax(input1_shape, input1_data, input2_data, output_shape, output_data); -} - -template -void TransposeImpl(const TransposeParams& params, - const RuntimeShape& unextended_input_shape, - const T* input_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - const int unextended_input_size = unextended_input_shape.DimensionsCount(); - const int unextended_output_size = unextended_output_shape.DimensionsCount(); - TFLITE_DCHECK_LE(unextended_input_size, N); - TFLITE_DCHECK_LE(unextended_output_size, N); - TFLITE_DCHECK_EQ(unextended_output_size, params.perm_count); - const int input_ext_size = N - unextended_input_size; - const int output_ext_size = N - unextended_output_size; - NdArrayDesc input_desc; - NdArrayDesc output_desc; - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, unextended_input_shape), - &input_desc); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, unextended_output_shape), - &output_desc); - - // The perm data is extended to match the output, each index incremented by - // the amount of front padding of the input shape. - int extended_perm[N]; - for (int i = 0; i < N; ++i) { - extended_perm[i] = i < output_ext_size - ? i - : params.perm[i - output_ext_size] + input_ext_size; - } - - // Permutes the input shape so we don't need to permute the indexes inside - // the loop. Check to make sure output_dims is matching input_dims. - NdArrayDesc perm_input_desc; - for (int k = 0; k < N; ++k) { - TFLITE_DCHECK_EQ(input_desc.extents[extended_perm[k]], - output_desc.extents[k]); - perm_input_desc.extents[k] = input_desc.extents[extended_perm[k]]; - perm_input_desc.strides[k] = input_desc.strides[extended_perm[k]]; - } - - // Naive transpose loop (iterate on output index and compute input index). - auto tranpose_func = [&](int indexes[N]) { - output_data[SubscriptToIndex(output_desc, indexes)] = - input_data[SubscriptToIndex(perm_input_desc, indexes)]; - }; - NDOpsHelper(output_desc, tranpose_func); -} - -template -void Transpose(const TransposeParams& params, - const RuntimeShape& unextended_input_shape, const T* input_data, - const RuntimeShape& unextended_output_shape, T* output_data) { - // Transpose kernel only does rearranging values not numeric evaluations on - // each cell. It's safe to implement per size of scalar type and this trick - // keeps the total code size in a reasonable range. - switch (sizeof(T)) { - case 1: - TransposeImpl(params, unextended_input_shape, - reinterpret_cast(input_data), - unextended_output_shape, - reinterpret_cast(output_data)); - break; - case 2: - TransposeImpl(params, unextended_input_shape, - reinterpret_cast(input_data), - unextended_output_shape, - reinterpret_cast(output_data)); - break; - - case 4: - TransposeImpl(params, unextended_input_shape, - reinterpret_cast(input_data), - unextended_output_shape, - reinterpret_cast(output_data)); - break; - case 8: - TransposeImpl(params, unextended_input_shape, - reinterpret_cast(input_data), - unextended_output_shape, - reinterpret_cast(output_data)); - break; - } -} - -inline void TransposeConv( - const ConvParams& params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& filter_shape, - const float* filter_data, const RuntimeShape& bias_shape, - const float* bias_data, const RuntimeShape& output_shape, - float* output_data, const RuntimeShape& im2col_shape, float* im2col_data) { - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - (void)im2col_data; // only used in optimized code. - (void)im2col_shape; // only used in optimized code. - - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3); - const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - if (bias_data) { - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - } - - // Although transpose convolution simplifies to convolution with transposed - // weights for strides of 1, non-unitary striding complicates matters. To - // keep this reference implementation as clear as possible, we use a - // "scatter" access pattern, where we loop through all the input elements, - // computing their influence on the output, rather than looping through the - // output elements in the typical "gather" access pattern of a conv. We - // therefore must initialize the output array to zero. - const int num_elements = output_shape.FlatSize(); - for (int i = 0; i < num_elements; i++) { - output_data[i] = 0.0f; - } - - // Loop through input elements one at a time. - for (int batch = 0; batch < batches; ++batch) { - for (int in_y = 0; in_y < input_height; ++in_y) { - for (int in_x = 0; in_x < input_width; ++in_x) { - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - // Loop through the output elements it will influence - const int out_x_origin = (in_x * stride_width) - pad_width; - const int out_y_origin = (in_y * stride_height) - pad_height; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - for (int out_channel = 0; out_channel < output_depth; - ++out_channel) { - // Compute output element location - const int out_x = out_x_origin + filter_x; - const int out_y = out_y_origin + filter_y; - // We cannot accumulate out of bounds - if ((out_x >= 0) && (out_x < output_width) && (out_y >= 0) && - (out_y < output_height)) { - float input_value = input_data[Offset( - input_shape, batch, in_y, in_x, in_channel)]; - float filter_value = - filter_data[Offset(filter_shape, out_channel, filter_y, - filter_x, in_channel)]; - output_data[Offset(output_shape, batch, out_y, out_x, - out_channel)] += - input_value * filter_value; - } - } - } - } - } - } - } - } - if (bias_data) { - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int out_channel = 0; out_channel < output_depth; ++out_channel) { - output_data[Offset(output_shape, batch, out_y, out_x, - out_channel)] += bias_data[out_channel]; - } - } - } - } - } -} - -inline void TransposeConv( - const ConvParams& params, const RuntimeShape& input_shape, - const uint8* input_data, const RuntimeShape& filter_shape, - const uint8* filter_data, const RuntimeShape& bias_shape, - const int32* bias_data, const RuntimeShape& output_shape, - uint8* output_data, const RuntimeShape& im2col_shape, uint8* im2col_data, - int32* scratch_buffer) { - const int stride_width = params.stride_width; - const int stride_height = params.stride_height; - const int pad_width = params.padding_values.width; - const int pad_height = params.padding_values.height; - TFLITE_DCHECK_EQ(input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(filter_shape.DimensionsCount(), 4); - TFLITE_DCHECK_EQ(output_shape.DimensionsCount(), 4); - (void)im2col_data; // only used in optimized code. - (void)im2col_shape; // only used in optimized code. - - const int batches = MatchingDim(input_shape, 0, output_shape, 0); - const int input_depth = MatchingDim(input_shape, 3, filter_shape, 3); - const int output_depth = MatchingDim(filter_shape, 0, output_shape, 3); - const int input_height = input_shape.Dims(1); - const int input_width = input_shape.Dims(2); - const int filter_height = filter_shape.Dims(1); - const int filter_width = filter_shape.Dims(2); - const int output_height = output_shape.Dims(1); - const int output_width = output_shape.Dims(2); - const int32 input_offset = params.input_offset; - const int32 filter_offset = params.weights_offset; - const int32 output_offset = params.output_offset; - const int32 output_multiplier = params.output_multiplier; - const int output_shift = params.output_shift; - const int32 output_activation_min = params.quantized_activation_min; - const int32 output_activation_max = params.quantized_activation_max; - TFLITE_DCHECK_LE(output_activation_min, output_activation_max); - if (bias_data) { - TFLITE_DCHECK_EQ(bias_shape.FlatSize(), output_depth); - } - - const int num_elements = output_shape.FlatSize(); - // We need to initialize scratch_buffer to all 0s, as we apply the same - // 'scatter' based trick as in float version. - memset(scratch_buffer, 0, num_elements * sizeof(int32)); - - // Loop through input elements one at a time. - for (int batch = 0; batch < batches; ++batch) { - for (int in_y = 0; in_y < input_height; ++in_y) { - for (int in_x = 0; in_x < input_width; ++in_x) { - for (int in_channel = 0; in_channel < input_depth; ++in_channel) { - // Loop through the output elements it will influence. - const int out_x_origin = (in_x * stride_width) - pad_width; - const int out_y_origin = (in_y * stride_height) - pad_height; - for (int filter_y = 0; filter_y < filter_height; ++filter_y) { - for (int filter_x = 0; filter_x < filter_width; ++filter_x) { - for (int out_channel = 0; out_channel < output_depth; - ++out_channel) { - // Compute output element location. - const int out_x = out_x_origin + filter_x; - const int out_y = out_y_origin + filter_y; - // We cannot accumulate out of bounds. - if ((out_x >= 0) && (out_x < output_width) && (out_y >= 0) && - (out_y < output_height)) { - uint8 input_value = input_data[Offset( - input_shape, batch, in_y, in_x, in_channel)]; - uint8 filter_value = - filter_data[Offset(filter_shape, out_channel, filter_y, - filter_x, in_channel)]; - scratch_buffer[Offset(output_shape, batch, out_y, out_x, - out_channel)] += - (input_value + input_offset) * - (filter_value + filter_offset); - } - } - } - } - } - } - } - } - for (int batch = 0; batch < batches; ++batch) { - for (int out_y = 0; out_y < output_height; ++out_y) { - for (int out_x = 0; out_x < output_width; ++out_x) { - for (int out_channel = 0; out_channel < output_depth; ++out_channel) { - int32 acc = scratch_buffer[Offset(output_shape, batch, out_y, out_x, - out_channel)]; - if (bias_data) { - acc += bias_data[out_channel]; - } - int32 scaled_acc = MultiplyByQuantizedMultiplier( - acc, output_multiplier, output_shift); - scaled_acc += output_offset; - scaled_acc = std::max(scaled_acc, output_activation_min); - scaled_acc = std::min(scaled_acc, output_activation_max); - output_data[Offset(output_shape, batch, out_y, out_x, out_channel)] = - static_cast(scaled_acc); - } - } - } - } -} - -template -void Select(const RuntimeShape& input_condition_shape, - const D* input_condition_data, const RuntimeShape& input_x_shape, - const T* input_x_data, const RuntimeShape& input_y_shape, - const T* input_y_data, const RuntimeShape& output_shape, - T* output_data) { - const int64_t flatsize = MatchingFlatSize( - input_condition_shape, input_x_shape, input_y_shape, output_shape); - for (int64_t i = 0; i < flatsize; ++i) { - output_data[i] = - input_condition_data[i] ? input_x_data[i] : input_y_data[i]; - } -} - -template -void RankOneSelect(const RuntimeShape& input_condition_shape, - const D* input_condition_data, - const RuntimeShape& input_x_shape, const T* input_x_data, - const RuntimeShape& input_y_shape, const T* input_y_data, - const RuntimeShape& output_shape, T* output_data) { - const int64_t outer_size = input_condition_shape.FlatSize(); - int64_t inner_size; - if (input_condition_shape.DimensionsCount() == 0) { - inner_size = MatchingFlatSize(input_x_shape, input_y_shape, output_shape); - } else { - TFLITE_DCHECK_EQ( - MatchingDim(input_x_shape, 0, input_y_shape, 0, output_shape, 0), - outer_size); - inner_size = - MatchingFlatSizeSkipDim(input_x_shape, 0, input_y_shape, output_shape); - } - - int64_t offset = 0; - for (int64_t i = 0; i < outer_size; i++) { - const T* input_data = input_condition_data[i] ? input_x_data : input_y_data; - memcpy(output_data + offset, input_data + offset, inner_size * sizeof(T)); - offset += inner_size; - } -} - -template -void BroadcastSelect4DSlow(const RuntimeShape& input_condition_shape, - const D* input_condition_data, - const RuntimeShape& input_x_shape, - const T* input_x_data, - const RuntimeShape& input_y_shape, - const T* input_y_data, - const RuntimeShape& output_shape, T* output_data) { - TFLITE_DCHECK_LE(input_condition_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(input_x_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(input_y_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(output_shape.DimensionsCount(), 4); - - const RuntimeShape extended_output_shape = - RuntimeShape::ExtendedShape(4, output_shape); - - NdArrayDesc<4> desc_condition; - NdArrayDesc<4> desc_x; - NdArrayDesc<4> desc_y; - NdArrayDescsForElementwiseBroadcast(input_condition_shape, input_x_shape, - input_y_shape, &desc_condition, &desc_x, - &desc_y); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest - // stride, typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for - // the best cache behavior. - for (int b = 0; b < extended_output_shape.Dims(0); ++b) { - for (int y = 0; y < extended_output_shape.Dims(1); ++y) { - for (int x = 0; x < extended_output_shape.Dims(2); ++x) { - for (int c = 0; c < extended_output_shape.Dims(3); ++c) { - const int condition_index = - SubscriptToIndex(desc_condition, b, y, x, c); - const int x_index = SubscriptToIndex(desc_x, b, y, x, c); - const int y_index = SubscriptToIndex(desc_y, b, y, x, c); - output_data[Offset(extended_output_shape, b, y, x, c)] = - input_condition_data[condition_index] ? input_x_data[x_index] - : input_y_data[y_index]; - } - } - } - } -} - -template -void SelectTrueCoords(const RuntimeShape& input_condition_shape, - const D* input_condition_data, T* output_data) { - const size_t size = input_condition_shape.FlatSize(); - if (size == 0) { - // Dimension is zero, in which case we don't need to output. - return; - } - const size_t cond_rank = input_condition_shape.DimensionsCount(); - - std::vector dims_to_count(cond_rank, 0); - int cur_flat_size = size; - for (int i = 0; i < cond_rank; ++i) { - dims_to_count[i] = cur_flat_size / input_condition_shape.Dims(i); - cur_flat_size = dims_to_count[i]; - } - - int output_index = 0; - for (int i = 0; i < size; ++i) { - if (input_condition_data[i]) { - // Insert the coordinate of the current item (row major) into output. - int flat_index = i; - for (int j = 0; j < cond_rank; ++j) { - int coord_j = flat_index / dims_to_count[j]; - output_data[output_index * cond_rank + j] = coord_j; - flat_index %= dims_to_count[j]; - } - output_index++; - } - } -} - -// For easy implementation, the indices is always a vector of size-4 vectors. -template -inline void SparseToDense(const std::vector>& indices, - const T* values, T default_value, - bool value_is_scalar, - const RuntimeShape& unextended_output_shape, - T* output_data) { - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - const int value_count = indices.size(); - - // First fill the output_data with default value. - const int num_elements = output_shape.FlatSize(); - for (int i = 0; i < num_elements; ++i) { - output_data[i] = default_value; - } - - // Special handle for value is scalar case to avoid checking the boolean - // condition within the loop every time. - if (value_is_scalar) { - for (int i = 0; i < value_count; ++i) { - const std::vector& index = indices[i]; - TFLITE_DCHECK_EQ(index.size(), 4); - const T value = *values; // just use the first value. - output_data[Offset(output_shape, index[0], index[1], index[2], - index[3])] = value; - } - return; - } - - // Go through the values and indices to fill the sparse values. - for (int i = 0; i < value_count; ++i) { - const std::vector& index = indices[i]; - TFLITE_DCHECK_EQ(index.size(), 4); - const T value = values[i]; - output_data[Offset(output_shape, index[0], index[1], index[2], index[3])] = - value; - } -} - -template -inline void Pow(const RuntimeShape& input1_shape, const T* input1_data, - const RuntimeShape& input2_shape, const T* input2_data, - const RuntimeShape& output_shape, T* output_data) { - const int flat_size = - MatchingFlatSize(input1_shape, input2_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = std::pow(input1_data[i], input2_data[i]); - } -} - -template -inline void BroadcastPow4DSlow(const RuntimeShape& unextended_input1_shape, - const T* input1_data, - const RuntimeShape& unextended_input2_shape, - const T* input2_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - TFLITE_DCHECK_LE(unextended_input1_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_input2_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - NdArrayDescsForElementwiseBroadcast(unextended_input1_shape, - unextended_input2_shape, &desc1, &desc2); - - for (int b = 0; b < output_shape.Dims(0); ++b) { - for (int y = 0; y < output_shape.Dims(1); ++y) { - for (int x = 0; x < output_shape.Dims(2); ++x) { - for (int c = 0; c < output_shape.Dims(3); ++c) { - auto out_idx = Offset(output_shape, b, y, x, c); - auto in1_idx = SubscriptToIndex(desc1, b, y, x, c); - auto in2_idx = SubscriptToIndex(desc2, b, y, x, c); - auto in1_val = input1_data[in1_idx]; - auto in2_val = input2_data[in2_idx]; - output_data[out_idx] = std::pow(in1_val, in2_val); - } - } - } - } -} - -template -void Fill(const RuntimeShape& value_shape, const T* value_data, - const RuntimeShape& output_shape, T* output_data) { - TFLITE_DCHECK_EQ(value_shape.DimensionsCount(), 0); - const int flat_size = output_shape.FlatSize(); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = *value_data; - } -} - -template -void Reverse(int axis, const RuntimeShape& input_shape, - const Scalar* input_data, const RuntimeShape& output_shape, - Scalar* output_data) { - ruy::profiler::ScopeLabel label("Reverse"); - - int outer_size = 1; - for (int i = 0; i < axis; ++i) { - outer_size *= input_shape.Dims(i); - } - - int copy_size = 1; - for (int i = axis + 1; i < input_shape.DimensionsCount(); ++i) { - copy_size *= input_shape.Dims(i); - } - - const int dims_at_axis = input_shape.Dims(axis); - for (int i = 0; i < outer_size; ++i) { - for (int j = 0; j < dims_at_axis; ++j) { - const int start_pos = (i * dims_at_axis + j) * copy_size; - Scalar* output_ptr = output_data + start_pos; - int loc = (i * dims_at_axis + dims_at_axis - j - 1) * copy_size; - memcpy(output_ptr, input_data + loc, copy_size * sizeof(Scalar)); - } - } -} - -template -void ReverseSequence(const TS* seq_lengths, const int seq_dim, - const int batch_dim, const RuntimeShape& input_shape, - const Scalar* input_data, const RuntimeShape& output_shape, - Scalar* output_data) { - ruy::profiler::ScopeLabel label("ReverseSequence"); - - int outer_size = 1; - int outer_dim = std::min(batch_dim, seq_dim); - int medium_dim = std::max(batch_dim, seq_dim); - for (int i = 0; i < outer_dim; ++i) { - outer_size *= input_shape.Dims(i); - } - - int medium_size = 1; - for (int i = outer_dim + 1; i < medium_dim; ++i) { - medium_size *= input_shape.Dims(i); - } - - int copy_size = 1; - for (int i = medium_dim + 1; i < input_shape.DimensionsCount(); ++i) { - copy_size *= input_shape.Dims(i); - } - - const int dims_at_outer_dim = input_shape.Dims(outer_dim); - const int dims_at_medium_dim = input_shape.Dims(medium_dim); - - Scalar* output_ptr; - if (batch_dim > seq_dim) { - for (int i = 0; i < outer_size; ++i) { - for (int j = 0; j < dims_at_outer_dim; ++j) { - const int in_pos_base = (i * dims_at_outer_dim + j) * medium_size; - for (int p = 0; p < medium_size; ++p) { - for (int q = 0; q < dims_at_medium_dim; ++q) { - const int in_pos = - ((in_pos_base + p) * dims_at_medium_dim + q) * copy_size; - const Scalar* in_ptr = input_data + in_pos; - int sl = seq_lengths[q] - 1; - if (j > sl) { - output_ptr = output_data + in_pos; - } else { - const int out_pos_base = - (i * dims_at_outer_dim + sl - j) * medium_size; - const int out_pos = - ((out_pos_base + p) * dims_at_medium_dim + q) * copy_size; - output_ptr = output_data + out_pos; - } - memcpy(output_ptr, in_ptr, copy_size * sizeof(Scalar)); - } - } - } - } - } else if (batch_dim < seq_dim) { - for (int i = 0; i < outer_size; ++i) { - for (int j = 0; j < dims_at_outer_dim; ++j) { - const int in_pos_base = (i * dims_at_outer_dim + j) * medium_size; - int sl = seq_lengths[j] - 1; - const int out_pos_base = (i * dims_at_outer_dim + j) * medium_size; - for (int p = 0; p < medium_size; ++p) { - for (int q = 0; q < dims_at_medium_dim; ++q) { - const int in_pos = - ((in_pos_base + p) * dims_at_medium_dim + q) * copy_size; - const Scalar* in_ptr = input_data + in_pos; - if (q > sl) { - output_ptr = output_data + in_pos; - } else { - const int out_pos = - ((out_pos_base + p) * dims_at_medium_dim + sl - q) * - copy_size; - output_ptr = output_data + out_pos; - } - memcpy(output_ptr, in_ptr, copy_size * sizeof(Scalar)); - } - } - } - } - } -} - -template -inline void SegmentSum(const RuntimeShape& input_shape, const T* input_data, - const RuntimeShape& segment_ids_shape, - const int32_t* segment_ids_data, - const RuntimeShape& output_shape, T* output_data) { - const int segment_flat_size = - MatchingFlatSizeSkipDim(input_shape, 0, output_shape); - - memset(output_data, 0, sizeof(T) * output_shape.FlatSize()); - - for (int i = 0; i < input_shape.Dims(0); i++) { - int output_index = segment_ids_data[i]; - for (int j = 0; j < segment_flat_size; ++j) { - output_data[output_index * segment_flat_size + j] += - input_data[i * segment_flat_size + j]; - } - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_REFERENCE_OPS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/requantize.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/requantize.h deleted file mode 100644 index 32e32ed..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/requantize.h +++ /dev/null @@ -1,67 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_REQUANTIZE_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_REQUANTIZE_H_ - -#include "ruy/profiler/instrumentation.h" // from @ruy -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace reference_ops { - -template -inline void Requantize(const input_type* input_data, int32_t size, - int32_t effective_scale_multiplier, - int32_t effective_scale_shift, int32_t input_zeropoint, - int32_t output_zeropoint, output_type* output_data) { - ruy::profiler::ScopeLabel label("Requantize"); - const bool same_scale = - (effective_scale_multiplier == 1 << 30 && effective_scale_shift == 1); - if (same_scale) { - const bool mixed_type_int8_uint8 = - std::is_same::value && - std::is_same::value; - const bool mixed_type_uint8_int8 = - std::is_same::value && - std::is_same::value; - const int32_t zero_point_diff = input_zeropoint - output_zeropoint; - // Fast path to do requantization for the case when just a shift of 128 is - // needed. - if ((mixed_type_int8_uint8 && zero_point_diff == -128) || - (mixed_type_uint8_int8 && zero_point_diff == 128)) { - for (int i = 0; i < size; ++i) { - output_data[i] = input_data[i] ^ 0x80; - } - } - } - static constexpr int32_t kMinOutput = std::numeric_limits::min(); - static constexpr int32_t kMaxOutput = std::numeric_limits::max(); - for (int i = 0; i < size; ++i) { - const int32_t input = input_data[i] - input_zeropoint; - const int32_t output = - MultiplyByQuantizedMultiplier(input, effective_scale_multiplier, - effective_scale_shift) + - output_zeropoint; - const int32_t clamped_output = - std::max(std::min(output, kMaxOutput), kMinOutput); - output_data[i] = static_cast(clamped_output); - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_REQUANTIZE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/resize_nearest_neighbor.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/resize_nearest_neighbor.h deleted file mode 100644 index 95550ab..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/resize_nearest_neighbor.h +++ /dev/null @@ -1,101 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_RESIZE_NEAREST_NEIGHBOR_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_RESIZE_NEAREST_NEIGHBOR_H_ - -#include - -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -inline int32_t GetNearestNeighbor(const int input_value, - const int32_t input_size, - const int32_t output_size, - const bool align_corners, - const bool half_pixel_centers) { - const float scale = - (align_corners && output_size > 1) - ? (input_size - 1) / static_cast(output_size - 1) - : input_size / static_cast(output_size); - const float offset = half_pixel_centers ? 0.5f : 0.0f; - int32_t output_value = std::min( - align_corners - ? static_cast(TfLiteRound((input_value + offset) * scale)) - : static_cast(std::floor((input_value + offset) * scale)), - input_size - 1); - if (half_pixel_centers) { - output_value = std::max(static_cast(0), output_value); - } - return output_value; -} - -template -inline void ResizeNearestNeighbor( - const tflite::ResizeNearestNeighborParams& op_params, - const RuntimeShape& unextended_input_shape, const T* input_data, - const RuntimeShape& output_size_shape, const int32_t* output_size_data, - const RuntimeShape& unextended_output_shape, T* output_data) { - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 4); - - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(4, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(4, unextended_output_shape); - - int32_t batches = MatchingDim(input_shape, 0, output_shape, 0); - int32_t input_height = input_shape.Dims(1); - int32_t input_width = input_shape.Dims(2); - int32_t depth = MatchingDim(input_shape, 3, output_shape, 3); - - // The Tensorflow version of this op allows resize on the width and height - // axis only. - TFLITE_DCHECK_EQ(output_size_shape.FlatSize(), 2); - int32_t output_height = output_size_data[0]; - int32_t output_width = output_size_data[1]; - - const int col_offset = input_shape.Dims(3); - const int row_offset = input_shape.Dims(2) * col_offset; - const int batch_offset = input_shape.Dims(1) * row_offset; - - const T* input_ptr = input_data; - T* output_ptr = output_data; - for (int b = 0; b < batches; ++b) { - for (int y = 0; y < output_height; ++y) { - int32_t in_y = GetNearestNeighbor(y, input_height, output_height, - op_params.align_corners, - op_params.half_pixel_centers); - const T* y_input_ptr = input_ptr + in_y * row_offset; - for (int x = 0; x < output_width; ++x) { - int32_t in_x = GetNearestNeighbor(x, input_width, output_width, - op_params.align_corners, - op_params.half_pixel_centers); - const T* x_input_ptr = y_input_ptr + in_x * col_offset; - memcpy(output_ptr, x_input_ptr, depth * sizeof(T)); - output_ptr += depth; - } - } - input_ptr += batch_offset; - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_RESIZE_NEAREST_NEIGHBOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/round.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/round.h deleted file mode 100644 index 9bd8f3f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/round.h +++ /dev/null @@ -1,51 +0,0 @@ -/* Copyright 2018 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_KERNELS_INTERNAL_REFERENCE_ROUND_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ROUND_H_ - -#include - -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -inline float RoundToNearest(float value) { - auto floor_val = std::floor(value); - auto diff = value - floor_val; - if ((diff < 0.5f) || - ((diff == 0.5f) && (static_cast(floor_val) % 2 == 0))) { - return floor_val; - } else { - return floor_val = floor_val + 1.0f; - } -} - -inline void Round(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - const int flat_size = MatchingFlatSize(input_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - // Note that this implementation matches that of tensorFlow tf.round - // and corresponds to the bankers rounding method. - // cfenv (for fesetround) is not yet supported universally on Android, so - // using a work around. - output_data[i] = RoundToNearest(input_data[i]); - } -} - -} // namespace reference_ops -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_ROUND_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/softmax.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/softmax.h deleted file mode 100644 index 1b3f118..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/softmax.h +++ /dev/null @@ -1,232 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_REFERENCE_SOFTMAX_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SOFTMAX_H_ - -#include - -#include "fixedpoint/fixedpoint.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/quantization_util.h" -#include "tensorflow/lite/kernels/internal/types.h" -#include "tensorflow/lite/kernels/op_macros.h" - -namespace tflite { -namespace reference_ops { - -inline void Softmax(const SoftmaxParams& params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int outer_size = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int depth = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - - for (int i = 0; i < outer_size; ++i) { - // Find max element value which we'll use to ensure numerical stability - // taking advantage of the following equality: - // exp(x[i])/sum(exp(x[i])) == exp(x[i]+C)/sum(exp(x[i]+C)) - float max = std::numeric_limits::lowest(); - for (int c = 0; c < depth; ++c) { - max = std::max(max, input_data[i * depth + c]); - } - - // Compute sum. - float sum = 0.f; - for (int c = 0; c < depth; ++c) { - const float exp_c = std::exp((input_data[i * depth + c] - max) * - static_cast(params.beta)); - output_data[i * depth + c] = exp_c; - sum += exp_c; - } - - // Compute result. - for (int c = 0; c < depth; ++c) { - output_data[i * depth + c] = output_data[i * depth + c] / sum; - } - } -} - -// Quantized softmax with int8_t/uint8_t input and int8_t/uint8_t/int16_t -// output. -template -inline void Softmax(const SoftmaxParams& params, - const RuntimeShape& input_shape, const InputT* input_data, - const RuntimeShape& output_shape, OutputT* output_data) { - const int32_t input_beta_multiplier = params.input_multiplier; - const int32_t input_beta_left_shift = params.input_left_shift; - const int diff_min = params.diff_min; - // The representation chosen for the input to the exp() function is Q5.26. - // We need to leave extra space since values that we skip might be as large as - // -32 before multiplying by input_beta_multiplier, and therefore as large as - // -16 afterwards. Note that exp(-8) is definitely not insignificant to - // accumulation, but exp(-16) definitely is. - static const int kScaledDiffIntegerBits = 5; - static const int kAccumulationIntegerBits = 12; - using FixedPointScaledDiff = - gemmlowp::FixedPoint; - using FixedPointAccum = - gemmlowp::FixedPoint; - using FixedPoint0 = gemmlowp::FixedPoint; - - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int outer_size = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int depth = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - - for (int i = 0; i < outer_size; ++i) { - InputT max_in_row = std::numeric_limits::min(); - for (int c = 0; c < depth; ++c) { - max_in_row = std::max(max_in_row, input_data[i * depth + c]); - } - - FixedPointAccum sum_of_exps = FixedPointAccum::Zero(); - for (int c = 0; c < depth; ++c) { - int32_t input_diff = - static_cast(input_data[i * depth + c]) - max_in_row; - if (input_diff >= diff_min) { - const int32_t input_diff_rescaled = - MultiplyByQuantizedMultiplierGreaterThanOne( - input_diff, input_beta_multiplier, input_beta_left_shift); - const FixedPointScaledDiff scaled_diff_f8 = - FixedPointScaledDiff::FromRaw(input_diff_rescaled); - sum_of_exps = sum_of_exps + gemmlowp::Rescale( - exp_on_negative_values(scaled_diff_f8)); - } - } - - int num_bits_over_unit; - FixedPoint0 shifted_scale = FixedPoint0::FromRaw(GetReciprocal( - sum_of_exps.raw(), kAccumulationIntegerBits, &num_bits_over_unit)); - - for (int c = 0; c < depth; ++c) { - int32_t input_diff = - static_cast(input_data[i * depth + c]) - max_in_row; - if (input_diff >= diff_min) { - const int32_t input_diff_rescaled = - MultiplyByQuantizedMultiplierGreaterThanOne( - input_diff, input_beta_multiplier, input_beta_left_shift); - const FixedPointScaledDiff scaled_diff_f8 = - FixedPointScaledDiff::FromRaw(input_diff_rescaled); - - FixedPoint0 exp_in_0 = exp_on_negative_values(scaled_diff_f8); - int32_t unsat_output = gemmlowp::RoundingDivideByPOT( - (shifted_scale * exp_in_0).raw(), - num_bits_over_unit + 31 - (sizeof(OutputT) * 8)); - - const int32_t shifted_output = - unsat_output + - static_cast(std::numeric_limits::min()); - - output_data[i * depth + c] = static_cast(std::max( - std::min(shifted_output, - static_cast(std::numeric_limits::max())), - static_cast(std::numeric_limits::min()))); - } else { - output_data[i * depth + c] = std::numeric_limits::min(); - } - } - } -} - -// Computes exp(input - max_input) -inline int16_t SoftMaxCalculateExp(const SoftmaxParams& params, - const int16_t* input_data, const int depth, - int16_t max_in_row, int i, int c) { - int32_t input_diff = input_data[i * depth + c] - max_in_row; - // scale the input_diff such that [-65535, 0] correspond to [-10.0, 0.0] - // exp lut generated with range [-10, 0], as exp(-10) is negligible. - int32_t scaled_diff = MultiplyByQuantizedMultiplier( - input_diff, params.input_multiplier, params.input_left_shift); - // recenter to [-32768, 32767] - int32_t sym_scaled_diff = scaled_diff + 32767; - int16_t sat_sym_scaled_diff = - std::min(std::max(sym_scaled_diff, static_cast(-32768)), - static_cast(32767)); - // apply the exp() LUT activation function - return generic_int16_table_lookup(sat_sym_scaled_diff, params.exp_lut); -} -// Quantized softmax with int16_t input and int16_t output. -inline void SoftmaxInt16(const SoftmaxParams& params, - const RuntimeShape& input_shape, - const int16_t* input_data, - const RuntimeShape& output_shape, - int16_t* output_data) { - const int trailing_dim = input_shape.DimensionsCount() - 1; - const int outer_size = - MatchingFlatSizeSkipDim(input_shape, trailing_dim, output_shape); - const int depth = - MatchingDim(input_shape, trailing_dim, output_shape, trailing_dim); - - for (int i = 0; i < outer_size; ++i) { - // Find the largest element - int16_t max_in_row = std::numeric_limits::min(); - for (int c = 0; c < depth; ++c) { - max_in_row = std::max(max_in_row, input_data[i * depth + c]); - } - - // This loops computes the exp values and their sum. We will need the exp - // values later on in the function so we cache them in the output_data - // buffer. This is an optimization done to avoid calculating the exp values - // twice making use of the output_data buffer as scratch memory. - int32_t sum_of_exps = 0; // Q16.15 fixed point format. - int16_t* exp_results_Q015 = output_data + i * depth; - for (int c = 0; c < depth; ++c) { - exp_results_Q015[c] = - SoftMaxCalculateExp(params, input_data, depth, max_in_row, i, c); - sum_of_exps += exp_results_Q015[c]; - } - - // Compute the reciprocal 1/sum_of_exps - uint8_t headroom_plus_one = - CountLeadingZeros(static_cast(sum_of_exps)); - int32_t shifted_sum = - ((static_cast(sum_of_exps) << (headroom_plus_one - 1)) + - (1 << 13)) >> - 14; - // since the LUT computes 1/(1 + x) we need to first compute x = (sum - 1). - // also, the LUT expects a symmetrical input, so we must also recenter x - // from [0, 65535] to [-32768, 32767]. - int32_t sym_shifted_sum = shifted_sum + (-((1 << 15) + (1 << 16))); - int16_t sat_sym_shifted_sum = static_cast( - std::min(std::max(sym_shifted_sum, static_cast(-32768)), - static_cast(32767))); - // apply 1/(1 + x) LUT activation function - int16_t reciprocal_scale_Q015 = generic_int16_table_lookup( - sat_sym_shifted_sum, params.one_over_one_plus_x_lut); - - // Rescale the exp_result with reciprocal - // range of output is [0, 32767] correspond to [0.0, 1.0] - for (int c = 0; c < depth; ++c) { - uint8_t right_shift = 31 - headroom_plus_one; - int64_t round = 1 << (right_shift - 1); - int32_t result = (static_cast(exp_results_Q015[c]) * - static_cast(reciprocal_scale_Q015) + - round) >> - right_shift; - output_data[i * depth + c] = static_cast( - std::min(std::max(result, static_cast(0)), - static_cast(32767))); - } - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SOFTMAX_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/sparse_ops/fully_connected.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/sparse_ops/fully_connected.h deleted file mode 100644 index 0f8a248..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/sparse_ops/fully_connected.h +++ /dev/null @@ -1,46 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SPARSE_OPS_FULLY_CONNECTED_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SPARSE_OPS_FULLY_CONNECTED_H_ - -#include "tensorflow/lite/kernels/internal/reference/fully_connected.h" -#include "tensorflow/lite/tools/optimize/sparsity/format_converter.h" - -namespace tflite { -namespace reference_ops { - -// Convert weights to dense format and run dense fully connected. -inline void FullyConnectedSparseWeight( - const TfLiteSparsity& sparsity, const FullyConnectedParams& params, - const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& weights_shape, const float* weights_data, - const RuntimeShape& bias_shape, const float* bias_data, - const RuntimeShape& output_shape, float* output_data) { - std::vector weights_shape_vector(weights_shape.DimensionsCount()); - for (int i = 0; i < weights_shape.DimensionsCount(); i++) { - weights_shape_vector[i] = weights_shape.Dims(i); - } - tflite::optimize::sparsity::FormatConverter converter( - weights_shape_vector, sparsity); - converter.SparseToDense(weights_data); - const std::vector dense_weights_data = converter.GetData(); - FullyConnected(params, input_shape, input_data, weights_shape, - dense_weights_data.data(), bias_shape, bias_data, output_shape, - output_data); -} - -} // namespace reference_ops -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SPARSE_OPS_FULLY_CONNECTED_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/strided_slice.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/strided_slice.h deleted file mode 100644 index 8b6f0c1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/strided_slice.h +++ /dev/null @@ -1,94 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_REFERENCE_STRIDED_SLICE_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_STRIDED_SLICE_H_ - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/strided_slice_logic.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { -template -inline void StridedSlice(const tflite::StridedSliceParams& op_params, - const RuntimeShape& unextended_input_shape, - const T* input_data, - const RuntimeShape& unextended_output_shape, - T* output_data) { - using strided_slice::LoopCondition; - using strided_slice::StartForAxis; - using strided_slice::StopForAxis; - // Note that the output_shape is not used herein. - tflite::StridedSliceParams params_copy = op_params; - - TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 5); - TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 5); - const RuntimeShape input_shape = - RuntimeShape::ExtendedShape(5, unextended_input_shape); - const RuntimeShape output_shape = - RuntimeShape::ExtendedShape(5, unextended_output_shape); - - // Reverse and pad to 5 dimensions because that is what the runtime code - // requires (ie. all shapes must be 5D and are given backwards). - strided_slice::StridedSlicePadIndices(¶ms_copy, 5); - - const int start_0 = StartForAxis(params_copy, input_shape, 0); - const int stop_0 = StopForAxis(params_copy, input_shape, 0, start_0); - const int start_1 = StartForAxis(params_copy, input_shape, 1); - const int stop_1 = StopForAxis(params_copy, input_shape, 1, start_1); - const int start_2 = StartForAxis(params_copy, input_shape, 2); - const int stop_2 = StopForAxis(params_copy, input_shape, 2, start_2); - const int start_3 = StartForAxis(params_copy, input_shape, 3); - const int stop_3 = StopForAxis(params_copy, input_shape, 3, start_3); - const int start_4 = StartForAxis(params_copy, input_shape, 4); - const int stop_4 = StopForAxis(params_copy, input_shape, 4, start_4); - - T* out_ptr = output_data; - for (int offset_0 = start_0 * input_shape.Dims(1), - end_0 = stop_0 * input_shape.Dims(1), - step_0 = params_copy.strides[0] * input_shape.Dims(1); - !LoopCondition(offset_0, end_0, params_copy.strides[0]); - offset_0 += step_0) { - for (int offset_1 = (offset_0 + start_1) * input_shape.Dims(2), - end_1 = (offset_0 + stop_1) * input_shape.Dims(2), - step_1 = params_copy.strides[1] * input_shape.Dims(2); - !LoopCondition(offset_1, end_1, params_copy.strides[1]); - offset_1 += step_1) { - for (int offset_2 = (offset_1 + start_2) * input_shape.Dims(3), - end_2 = (offset_1 + stop_2) * input_shape.Dims(3), - step_2 = params_copy.strides[2] * input_shape.Dims(3); - !LoopCondition(offset_2, end_2, params_copy.strides[2]); - offset_2 += step_2) { - for (int offset_3 = (offset_2 + start_3) * input_shape.Dims(4), - end_3 = (offset_2 + stop_3) * input_shape.Dims(4), - step_3 = params_copy.strides[3] * input_shape.Dims(4); - !LoopCondition(offset_3, end_3, params_copy.strides[3]); - offset_3 += step_3) { - for (int offset_4 = offset_3 + start_4, end_4 = offset_3 + stop_4; - !LoopCondition(offset_4, end_4, params_copy.strides[4]); - offset_4 += params_copy.strides[4]) { - *out_ptr++ = input_data[offset_4]; - } - } - } - } - } -} -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_STRIDED_SLICE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/string_comparisons.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/string_comparisons.h deleted file mode 100644 index 61c43ac..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/string_comparisons.h +++ /dev/null @@ -1,84 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_STRING_COMPARISONS_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_STRING_COMPARISONS_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/reference/comparisons.h" -#include "tensorflow/lite/kernels/internal/types.h" -#include "tensorflow/lite/string_util.h" - -namespace tflite { - -namespace reference_ops { - -inline bool StringRefEqualFn(const StringRef& lhs, const StringRef& rhs) { - if (lhs.len != rhs.len) return false; - for (int i = 0; i < lhs.len; ++i) { - if (lhs.str[i] != rhs.str[i]) return false; - } - return true; -} - -inline bool StringRefNotEqualFn(const StringRef& lhs, const StringRef& rhs) { - return !StringRefEqualFn(lhs, rhs); -} - -inline void ComparisonStringImpl(bool (*F)(const StringRef&, const StringRef&), - const RuntimeShape& input1_shape, - const TfLiteTensor* input1, - const RuntimeShape& input2_shape, - const TfLiteTensor* input2, - const RuntimeShape& output_shape, - bool* output_data) { - const int64_t flatsize = - MatchingFlatSize(input1_shape, input2_shape, output_shape); - for (int64_t i = 0; i < flatsize; ++i) { - const auto lhs = GetString(input1, i); - const auto rhs = GetString(input2, i); - output_data[i] = F(lhs, rhs); - } -} - -inline void BroadcastComparison4DSlowStringImpl( - bool (*F)(const StringRef&, const StringRef&), - const RuntimeShape& unextended_input1_shape, const TfLiteTensor* input1, - const RuntimeShape& unextended_input2_shape, const TfLiteTensor* input2, - const RuntimeShape& unextended_output_shape, bool* output_data) { - const BroadcastComparison4DSlowCommon dims = - BroadcastComparison4DSlowPreprocess(unextended_input1_shape, - unextended_input2_shape, - unextended_output_shape); - - for (int b = 0; b < dims.output_shape.Dims(0); ++b) { - for (int y = 0; y < dims.output_shape.Dims(1); ++y) { - for (int x = 0; x < dims.output_shape.Dims(2); ++x) { - for (int c = 0; c < dims.output_shape.Dims(3); ++c) { - const auto lhs = - GetString(input1, SubscriptToIndex(dims.desc1, b, y, x, c)); - const auto rhs = - GetString(input2, SubscriptToIndex(dims.desc2, b, y, x, c)); - output_data[Offset(dims.output_shape, b, y, x, c)] = F(lhs, rhs); - } - } - } - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_STRING_COMPARISONS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/sub.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/sub.h deleted file mode 100644 index b27f251..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/sub.h +++ /dev/null @@ -1,516 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SUB_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SUB_H_ - -#include - -#include -#include - -#include "ruy/profiler/instrumentation.h" // from @ruy -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -namespace reference_ops { - -inline void SubNonBroadcast(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const float* input1_data, - const RuntimeShape& input2_shape, - const float* input2_data, - const RuntimeShape& output_shape, - float* output_data) { - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax( - input1_data[i] - input2_data[i], params.float_activation_min, - params.float_activation_max); - } -} - -inline void SubNonBroadcast(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const int32_t* input1_data, - const RuntimeShape& input2_shape, - const int32_t* input2_data, - const RuntimeShape& output_shape, - int32_t* output_data) { - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax( - input1_data[i] - input2_data[i], params.quantized_activation_min, - params.quantized_activation_max); - } -} - -// TODO(b/151345304): We can implement BroadcastSub on buffers of arbitrary -// dimensionality if the runtime code does a single loop over one dimension -// that handles broadcasting as the base case. The code generator would then -// generate max(D1, D2) nested for loops. -// TODO(b/151345101): BroadcastSub is intentionally duplicated from -// reference_ops.h. Once an optimized version is implemented and NdArrayDesc -// is no longer referenced in this file, move NdArrayDesc from types.h to -// reference_ops.h. -template -inline void BroadcastSubSlow(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const float* input1_data, - const RuntimeShape& input2_shape, - const float* input2_data, - const RuntimeShape& output_shape, - float* output_data) { - ruy::profiler::ScopeLabel label("BroadcastSubSlow/float"); - TFLITE_DCHECK_LE(input1_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(input2_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(output_shape.DimensionsCount(), N); - NdArrayDesc desc1; - NdArrayDesc desc2; - NdArrayDesc output_desc; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, output_shape), &output_desc); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - auto sub_func = [&](int indexes[N]) { - output_data[SubscriptToIndex(output_desc, indexes)] = - ActivationFunctionWithMinMax( - input1_data[SubscriptToIndex(desc1, indexes)] - - input2_data[SubscriptToIndex(desc2, indexes)], - params.float_activation_min, params.float_activation_max); - }; - NDOpsHelper(output_desc, sub_func); -} - -template -inline void BroadcastSubSlow(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const uint8_t* input1_data, - const RuntimeShape& input2_shape, - const uint8_t* input2_data, - const RuntimeShape& output_shape, - uint8_t* output_data) { - ruy::profiler::ScopeLabel label("BroadcastSubSlow/uint8_t"); - TFLITE_DCHECK_LE(input1_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(input2_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(output_shape.DimensionsCount(), N); - NdArrayDesc desc1; - NdArrayDesc desc2; - NdArrayDesc output_desc; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, output_shape), &output_desc); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - auto sub_func = [&](int indexes[N]) { - const int32_t input1_val = - params.input1_offset + input1_data[SubscriptToIndex(desc1, indexes)]; - const int32_t input2_val = - params.input2_offset + input2_data[SubscriptToIndex(desc2, indexes)]; - const int32_t shifted_input1_val = input1_val * (1 << params.left_shift); - const int32_t shifted_input2_val = input2_val * (1 << params.left_shift); - const int32_t scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, params.input1_multiplier, params.input1_shift); - const int32_t scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, params.input2_multiplier, params.input2_shift); - const int32_t raw_sub = scaled_input1_val - scaled_input2_val; - const int32_t raw_output = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - raw_sub, params.output_multiplier, params.output_shift) + - params.output_offset; - const int32_t clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, raw_output)); - output_data[SubscriptToIndex(output_desc, indexes)] = - static_cast(clamped_output); - }; - NDOpsHelper(output_desc, sub_func); -} - -template -inline void BroadcastSubSlow(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const int32_t* input1_data, - const RuntimeShape& input2_shape, - const int32_t* input2_data, - const RuntimeShape& output_shape, - int32_t* output_data) { - ruy::profiler::ScopeLabel label("BroadcastSubSlow/int32_t"); - TFLITE_DCHECK_LE(input1_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(input2_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(output_shape.DimensionsCount(), N); - NdArrayDesc desc1; - NdArrayDesc desc2; - NdArrayDesc output_desc; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, output_shape), &output_desc); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - auto sub_func = [&](int indexes[N]) { - output_data[SubscriptToIndex(output_desc, indexes)] = - ActivationFunctionWithMinMax( - input1_data[SubscriptToIndex(desc1, indexes)] - - input2_data[SubscriptToIndex(desc2, indexes)], - params.quantized_activation_min, params.quantized_activation_max); - }; - NDOpsHelper(output_desc, sub_func); -} - -template -inline void BroadcastSubSlow(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const int8_t* input1_data, - const RuntimeShape& input2_shape, - const int8_t* input2_data, - const RuntimeShape& output_shape, - int8_t* output_data) { - ruy::profiler::ScopeLabel label("BroadcastSubSlow/int8_t"); - NdArrayDesc desc1; - NdArrayDesc desc2; - NdArrayDesc output_desc; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, output_shape), &output_desc); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - auto sub_func = [&](int indexes[N]) { - const int32_t input1_val = - params.input1_offset + input1_data[SubscriptToIndex(desc1, indexes)]; - const int32_t input2_val = - params.input2_offset + input2_data[SubscriptToIndex(desc2, indexes)]; - const int32_t shifted_input1_val = input1_val * (1 << params.left_shift); - const int32_t shifted_input2_val = input2_val * (1 << params.left_shift); - const int32_t scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, params.input1_multiplier, params.input1_shift); - const int32_t scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, params.input2_multiplier, params.input2_shift); - const int32_t raw_sub = scaled_input1_val - scaled_input2_val; - const int32_t raw_output = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - raw_sub, params.output_multiplier, params.output_shift) + - params.output_offset; - const int32_t clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, raw_output)); - output_data[SubscriptToIndex(output_desc, indexes)] = - static_cast(clamped_output); - }; - NDOpsHelper(output_desc, sub_func); -} - -template -void BroadcastSubSlow(const ArithmeticParams& params, - const RuntimeShape& input1_shape, - const int64_t* input1_data, - const RuntimeShape& input2_shape, - const int64_t* input2_data, - const RuntimeShape& output_shape, int64_t* output_data) { - ruy::profiler::ScopeLabel label("BroadcastSubSlow/int64_t"); - TFLITE_DCHECK_LE(input1_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(input2_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(output_shape.DimensionsCount(), N); - NdArrayDesc desc1; - NdArrayDesc desc2; - NdArrayDesc output_desc; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, output_shape), &output_desc); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - auto sub_func = [&](int indexes[N]) { - output_data[SubscriptToIndex(output_desc, indexes)] = - ActivationFunctionWithMinMax( - input1_data[SubscriptToIndex(desc1, indexes)] - - input2_data[SubscriptToIndex(desc2, indexes)], - params.int64_activation_min, params.int64_activation_max); - }; - NDOpsHelper(output_desc, sub_func); -} - -template -void BroadcastSubSlow(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const T* input1_data, - const RuntimeShape& input2_shape, const T* input2_data, - const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("BroadcastSubSlow/templated"); - TFLITE_DCHECK_LE(input1_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(input2_shape.DimensionsCount(), N); - TFLITE_DCHECK_LE(output_shape.DimensionsCount(), N); - NdArrayDesc desc1; - NdArrayDesc desc2; - NdArrayDesc output_desc; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - CopyDimsToDesc(RuntimeShape::ExtendedShape(N, output_shape), &output_desc); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - auto sub_func = [&](int indexes[N]) { - output_data[SubscriptToIndex(output_desc, indexes)] = - ActivationFunctionWithMinMax( - input1_data[SubscriptToIndex(desc1, indexes)] - - input2_data[SubscriptToIndex(desc2, indexes)], - params.quantized_activation_min, params.quantized_activation_max); - }; - NDOpsHelper(output_desc, sub_func); -} - -// Element-wise Sub that can often be used for inner loop of broadcast sub as -// well as the non-broadcast sub. -inline void SubElementwise(int size, const ArithmeticParams& params, - const uint8_t* input1_data, - const uint8_t* input2_data, uint8_t* output_data) { - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_LT(params.input2_offset, 256); - - for (int i = 0; i < size; ++i) { - const int32_t input1_val = params.input1_offset + input1_data[i]; - const int32_t input2_val = params.input2_offset + input2_data[i]; - const int32_t shifted_input1_val = input1_val * (1 << params.left_shift); - const int32_t shifted_input2_val = input2_val * (1 << params.left_shift); - const int32_t scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, params.input1_multiplier, params.input1_shift); - const int32_t scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, params.input2_multiplier, params.input2_shift); - const int32_t raw_sub = scaled_input1_val - scaled_input2_val; - const int32_t raw_output = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - raw_sub, params.output_multiplier, params.output_shift) + - params.output_offset; - const int32_t clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, raw_output)); - output_data[i] = static_cast(clamped_output); - } -} - -// Element-wise add that can often be used for inner loop of broadcast add as -// well as the non-broadcast add. -inline void SubElementwise(int size, const ArithmeticParams& params, - const int8_t* input1_data, const int8_t* input2_data, - int8_t* output_data) { - const int32_t int8_max_value = std::numeric_limits::max(); - TFLITE_DCHECK_GE(params.input1_offset, -1 * int8_max_value); - TFLITE_DCHECK_GE(params.input2_offset, -1 * int8_max_value); - TFLITE_DCHECK_LE(params.input1_offset, int8_max_value); - TFLITE_DCHECK_LE(params.input2_offset, int8_max_value); - - for (int i = 0; i < size; ++i) { - const int32_t input1_val = params.input1_offset + input1_data[i]; - const int32_t input2_val = params.input2_offset + input2_data[i]; - const int32_t shifted_input1_val = input1_val * (1 << params.left_shift); - const int32_t shifted_input2_val = input2_val * (1 << params.left_shift); - const int32_t scaled_input1_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input1_val, params.input1_multiplier, params.input1_shift); - const int32_t scaled_input2_val = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - shifted_input2_val, params.input2_multiplier, params.input2_shift); - const int32_t raw_sub = scaled_input1_val - scaled_input2_val; - const int32_t raw_output = - MultiplyByQuantizedMultiplierSmallerThanOneExp( - raw_sub, params.output_multiplier, params.output_shift) + - params.output_offset; - const int32_t clamped_output = - std::min(params.quantized_activation_max, - std::max(params.quantized_activation_min, raw_output)); - output_data[i] = static_cast(clamped_output); - } -} - -inline void Sub(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const uint8_t* input1_data, - const RuntimeShape& input2_shape, const uint8_t* input2_data, - const RuntimeShape& output_shape, uint8_t* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - TFLITE_DCHECK_GT(params.input1_offset, -256); - TFLITE_DCHECK_GT(params.input2_offset, -256); - TFLITE_DCHECK_LT(params.input1_offset, 256); - TFLITE_DCHECK_LT(params.input2_offset, 256); - SubElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -inline void Sub(const ArithmeticParams& params, - const RuntimeShape& input1_shape, const int8_t* input1_data, - const RuntimeShape& input2_shape, const int8_t* input2_data, - const RuntimeShape& output_shape, int8_t* output_data) { - TFLITE_DCHECK_LE(params.quantized_activation_min, - params.quantized_activation_max); - - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - - const int32_t int8_max_value = std::numeric_limits::max(); - TFLITE_DCHECK_GE(params.input1_offset, -1 * int8_max_value); - TFLITE_DCHECK_GE(params.input2_offset, -1 * int8_max_value); - TFLITE_DCHECK_LE(params.input1_offset, int8_max_value); - TFLITE_DCHECK_LE(params.input2_offset, int8_max_value); - SubElementwise(flat_size, params, input1_data, input2_data, output_data); -} - -template -void Sub(const ArithmeticParams& params, const RuntimeShape& input1_shape, - const T* input1_data, const RuntimeShape& input2_shape, - const T* input2_data, const RuntimeShape& output_shape, - T* output_data) { - NdArrayDesc<4> desc1; - NdArrayDesc<4> desc2; - NdArrayDescsForElementwiseBroadcast(input1_shape, input2_shape, &desc1, - &desc2); - const RuntimeShape extended_output_shape = - RuntimeShape::ExtendedShape(4, output_shape); - - // In Tensorflow, the dimensions are canonically named (batch_number, row, - // col, channel), with extents (batches, height, width, depth), with the - // trailing dimension changing most rapidly (channels has the smallest stride, - // typically 1 element). - // - // In generated C code, we store arrays with the dimensions reversed. The - // first dimension has smallest stride. - // - // We name our variables by their Tensorflow convention, but generate C code - // nesting loops such that the innermost loop has the smallest stride for the - // best cache behavior. - for (int b = 0; b < extended_output_shape.Dims(0); ++b) { - for (int y = 0; y < extended_output_shape.Dims(1); ++y) { - for (int x = 0; x < extended_output_shape.Dims(2); ++x) { - for (int c = 0; c < extended_output_shape.Dims(3); ++c) { - output_data[Offset(extended_output_shape, b, y, x, c)] = - input1_data[SubscriptToIndex(desc1, b, y, x, c)] - - input2_data[SubscriptToIndex(desc2, b, y, x, c)]; - } - } - } - } -} - -inline void SetActivationMinMax(const ArithmeticParams& params, - int32_t* activation_min, - int32_t* activation_max) { - *activation_min = params.quantized_activation_min; - *activation_max = params.quantized_activation_max; -} - -inline void SetActivationMinMax(const ArithmeticParams& params, - float* activation_min, float* activation_max) { - *activation_min = params.float_activation_min; - *activation_max = params.float_activation_max; -} - -inline void SetActivationMinMax(const ArithmeticParams& params, - int64_t* activation_min, - int64_t* activation_max) { - *activation_min = params.int64_activation_min; - *activation_max = params.int64_activation_max; -} - -template -inline void SubWithActivation( - const ArithmeticParams& params, const RuntimeShape& input1_shape, - const T* input1_data, const RuntimeShape& input2_shape, - const T* input2_data, const RuntimeShape& output_shape, T* output_data) { - ruy::profiler::ScopeLabel label("SubWithActivation"); - const int flat_size = - MatchingElementsSize(input1_shape, input2_shape, output_shape); - T activation_min, activation_max; - SetActivationMinMax(params, &activation_min, &activation_max); - - for (int i = 0; i < flat_size; ++i) { - output_data[i] = ActivationFunctionWithMinMax( - input1_data[i] - input2_data[i], activation_min, activation_max); - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SUB_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/svdf.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/svdf.h deleted file mode 100644 index c61abf3..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/svdf.h +++ /dev/null @@ -1,264 +0,0 @@ -/* 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_KERNELS_INTERNAL_REFERENCE_SVDF_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SVDF_H_ - -#include - -#include -#include - -#include "tensorflow/lite/c/builtin_op_data.h" -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/tensor_ctypes.h" -#include "tensorflow/lite/kernels/internal/tensor_utils.h" -#include "tensorflow/lite/kernels/internal/types.h" - -// SVDF op that compresses a fully connected op via low-rank matrix -// factorization. See https://research.google.com/pubs/archive/43813.pdf for -// details. - -namespace tflite { -namespace reference_ops { - -static inline void ApplyTimeWeightsBiasAndActivation( - int batch_size, int memory_size, int num_filters, int num_units, int rank, - const float* const __restrict__ weights_time_data, - const float* const __restrict__ bias_ptr, TfLiteFusedActivation activation, - float* const __restrict__ state_ptr, float* const __restrict__ scratch_ptr, - float* const __restrict__ output_ptr) { - // Compute matmul(state, weights_time). - for (int b = 0; b < batch_size; ++b) { - float* state_ptr_batch = state_ptr + b * memory_size * num_filters; - float* scratch_ptr_batch = scratch_ptr + b * num_filters; - tensor_utils::BatchVectorBatchVectorDotProduct( - weights_time_data, state_ptr_batch, memory_size, num_filters, - scratch_ptr_batch); - } - - // Initialize output with bias if provided. - if (bias_ptr) { - tensor_utils::VectorBatchVectorAssign(bias_ptr, num_units, batch_size, - output_ptr); - } else { - std::fill_n(output_ptr, batch_size * num_units, 0.0f); - } - - // Reduction sum. - for (int b = 0; b < batch_size; ++b) { - float* output_ptr_batch = output_ptr + b * num_units; - float* scratch_ptr_batch = scratch_ptr + b * num_filters; - tensor_utils::ReductionSumVector(scratch_ptr_batch, output_ptr_batch, - num_units, rank); - } - - // Apply activation. - for (int b = 0; b < batch_size; ++b) { - float* output_ptr_batch = output_ptr + b * num_units; - tensor_utils::ApplyActivationToVector(output_ptr_batch, num_units, - activation, output_ptr_batch); - } -} - -inline void EvalIntegerSVDF( - const TfLiteSVDFParams* params, const RuntimeShape& input_shape, - const int8_t* input_data, const RuntimeShape& weights_feature_shape, - const int8_t* weights_feature_data, const RuntimeShape& weights_time_shape, - const int16_t* weights_time_data, const RuntimeShape& bias_shape, - const int32_t* bias_data, int16_t* state_data, - const RuntimeShape& output_shape, int8_t* output_data, - int32_t* scratch_data, int32_t* output_temp_data, int32_t scale_1_a, - int scale_1_b, int32_t scale_2_a, int scale_2_b, int32_t input_zp, - int32_t output_zp) { - const int n_rank = params->rank; - const int n_batch = input_shape.Dims(0); - const int n_input = input_shape.Dims(1); - const int n_filter = weights_feature_shape.Dims(0); - const int n_unit = n_filter / n_rank; - const int n_memory = weights_time_shape.Dims(1); - - // Left shift the activation_state. - // std::copy is fine for overlapping ranges if the output is outside of the - // input range. (This is not true for copy_n.) - std::copy(state_data + 1, state_data + n_batch * n_memory * n_filter, - state_data); - - // Feature matmul. - // Note: no need to clear the latest activation, matmul is not accumulative. - { - const int32_t output_max = std::numeric_limits::max(); - const int32_t output_min = std::numeric_limits::min(); - int16_t* result_in_batch = state_data + (n_memory - 1); - for (int b = 0; b < n_batch; b++) { - const int8_t* matrix_data = weights_feature_data; - for (int r = 0; r < n_filter; r++) { - int32_t dot_prod = 0; - const int8_t* vector_in_batch = input_data + b * n_input; - for (int c = 0; c < n_input; c++) { - dot_prod += *matrix_data++ * (*vector_in_batch++ - input_zp); - } - dot_prod = - MultiplyByQuantizedMultiplier(dot_prod, scale_1_a, scale_1_b); - dot_prod = std::min(std::max(output_min, dot_prod), output_max); - // This assumes state is symmetrically quantized. Otherwise last bit of - // state should be initialized to its zero point and accumulate the - // dot_prod. - // Equivalent as the following: - // result_in_batch = zero point, which happens to be zero. - // result_in_batch += dot_prod. - *result_in_batch = dot_prod; - result_in_batch += n_memory; - } - } - } - - // Time. - { - for (int b = 0; b < n_batch; ++b) { - const int16_t* state_data_batch = state_data + b * n_memory * n_filter; - int32_t* scratch_data_batch = scratch_data + b * n_filter; - tensor_utils::BatchVectorBatchVectorDotProduct( - weights_time_data, state_data_batch, n_memory, n_filter, - scratch_data_batch); - } - } - - // Reduce, add bias, rescale, activation. - { - // Add bias. - if (bias_data) { - tensor_utils::VectorBatchVectorAssign(bias_data, n_unit, n_batch, - output_temp_data); - } else { - std::fill_n(output_temp_data, n_batch * n_unit, 0); - } - // Reduce. - for (int b = 0; b < n_batch; ++b) { - int32_t* output_temp_ptr = output_temp_data + b * n_unit; - int32_t* scratch_data_batch = scratch_data + b * n_filter; - tensor_utils::ReductionSumVector(scratch_data_batch, output_temp_ptr, - n_unit, n_rank); - } - // Rescale. - const int32_t output_max = std::numeric_limits::max(); - const int32_t output_min = std::numeric_limits::min(); - for (int i = 0; i < n_batch * n_unit; ++i) { - int32_t x1 = output_temp_data[i]; - int32_t x2 = MultiplyByQuantizedMultiplier(x1, scale_2_a, scale_2_b); - int32_t x3 = x2 + output_zp; - int32_t x4 = std::min(std::max(output_min, x3), output_max); - output_data[i] = static_cast(x4); - } - } -} - -inline void EvalFloatSVDF( - const TfLiteSVDFParams* params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& weights_feature_shape, - const float* weights_feature_data, const RuntimeShape& weights_time_shape, - const float* weights_time_data, const RuntimeShape& bias_shape, - const float* bias_data, float* scratch_data, float* state_data, - const RuntimeShape& output_shape, float* output_data) { - const int rank = params->rank; - const int batch_size = input_shape.Dims(0); - const int input_size = input_shape.Dims(1); - const int num_filters = weights_feature_shape.Dims(0); - const int num_units = num_filters / rank; - const int memory_size = weights_time_shape.Dims(1); - - // Left shift the activation_state. - // std::copy is fine for overlapping ranges if the output is outside of the - // input range. (This is not true for copy_n.) - std::copy(state_data + 1, state_data + batch_size * memory_size * num_filters, - state_data); - - // Clear scratch (the matmul is accumulative). - std::fill_n(scratch_data, batch_size * num_filters, 0.0f); - - // Compute conv1d(inputs, weights_feature). - tensor_utils::MatrixBatchVectorMultiplyAccumulate( - weights_feature_data, num_filters, input_size, input_data, batch_size, - scratch_data); - - // Copy the latest activation from scratch into activation_state: - // The last, i.e. (memory_size-1)th entry for each batch, and filter. - for (int i = 0; i < batch_size * num_filters; ++i) { - state_data[i * memory_size + memory_size - 1] = scratch_data[i]; - } - - ApplyTimeWeightsBiasAndActivation( - batch_size, memory_size, num_filters, num_units, rank, weights_time_data, - bias_data, params->activation, state_data, scratch_data, output_data); -} - -inline void EvalHybridSVDF( - const TfLiteSVDFParams* params, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& weights_feature_shape, - const int8_t* weights_feature_data, const float weights_feature_scale, - const RuntimeShape& weights_time_shape, const float* weights_time_data, - const RuntimeShape& bias_shape, const float* bias_data, float* scratch, - float* scaling_factors, int8_t* quantized_input, float* state, - const RuntimeShape& output_shape, float* output_data, int32_t* zero_points, - int32_t* row_sums, bool* compute_row_sums) { - const int rank = params->rank; - const int batch_size = input_shape.Dims(0); - const int input_size = input_shape.Dims(1); - const int num_filters = weights_feature_shape.Dims(0); - const int num_units = num_filters / rank; - const int memory_size = weights_time_shape.Dims(1); - - // Left shift the activation_state. - // std::copy is fine for overlapping ranges if the output is outside of the - // input range. (This is not true for copy_n.) - std::copy(state + 1, state + batch_size * memory_size * num_filters, state); - - // Clear scratch (the matmul is accumulative). - std::fill_n(scratch, batch_size * num_filters, 0.0f); - - if (!tensor_utils::IsZeroVector(input_data, batch_size * input_size)) { - // Quantize input from float to int8_t. - tensor_utils::BatchQuantizeFloats( - input_data, batch_size, input_size, quantized_input, scaling_factors, - zero_points, params->asymmetric_quantize_inputs); - for (int b = 0; b < batch_size; ++b) { - scaling_factors[b] *= weights_feature_scale; - } - - // Compute conv1d(inputs, weights_feature). - tensor_utils::MatrixBatchVectorMultiplyAccumulate( - weights_feature_data, num_filters, input_size, quantized_input, - scaling_factors, batch_size, scratch, - /*per_channel_scale=*/nullptr, zero_points, - reinterpret_cast(scratch), row_sums, compute_row_sums, - /*context=*/nullptr); - } - // Copy the latest activation from scratch into activation_state: - // The last, i.e. (memory_size-1)th entry for each batch, and filter. - for (int i = 0; i < batch_size * num_filters; ++i) { - state[i * memory_size + memory_size - 1] = scratch[i]; - } - - // TODO(alanchiao): can optimize hybrid case ~5% by unrolling loop in applying - // time weights so that the inner loop multiplies eight elements at a time. - ApplyTimeWeightsBiasAndActivation( - batch_size, memory_size, num_filters, num_units, rank, weights_time_data, - bias_data, params->activation, state, scratch, output_data); -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_SVDF_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/tanh.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/tanh.h deleted file mode 100644 index 3a05c47..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/reference/tanh.h +++ /dev/null @@ -1,129 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_TANH_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_TANH_H_ - -#include - -#include "fixedpoint/fixedpoint.h" -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/types.h" -#include "tensorflow/lite/kernels/op_macros.h" - -namespace tflite { -namespace reference_ops { - -inline void Tanh(const RuntimeShape& input_shape, const float* input_data, - const RuntimeShape& output_shape, float* output_data) { - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - float val = input_data[i]; - float result = std::tanh(val); - output_data[i] = result; - } -} - -// Convenience version that allows, for example, generated-code calls to be -// uniform between data types. -inline void Tanh(const TanhParams&, const RuntimeShape& input_shape, - const float* input_data, const RuntimeShape& output_shape, - float* output_data) { - // Drop params: not needed. - Tanh(input_shape, input_data, output_shape, output_data); -} - -inline void Tanh(const TanhParams& params, const RuntimeShape& input_shape, - const int16_t* input_data, const RuntimeShape& output_shape, - int16_t* output_data) { - const int input_left_shift = params.input_left_shift; - // Support for shifts is limited until we have a parameterized version of - // SaturatingRoundingMultiplyByPOT(). - TFLITE_DCHECK_GE(input_left_shift, 0); - TFLITE_DCHECK_LE(input_left_shift, 1); - - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - // F0 uses 0 integer bits, range [-1, 1]. - // This is the return type of math functions such as tanh, logistic, - // whose range is in [-1, 1]. - using F0 = gemmlowp::FixedPoint; - // F3 uses 3 integer bits, range [-8, 8], the input range expected here. - using F3 = gemmlowp::FixedPoint; - - if (input_left_shift == 0) { - for (int i = 0; i < flat_size; i++) { - F3 input = F3::FromRaw(input_data[i]); - F0 output = gemmlowp::tanh(input); - output_data[i] = output.raw(); - } - } else { - for (int i = 0; i < flat_size; i++) { - F3 input = F3::FromRaw( - gemmlowp::SaturatingRoundingMultiplyByPOT<1>(input_data[i])); - F0 output = gemmlowp::tanh(input); - output_data[i] = output.raw(); - } - } -} - -inline void Tanh(const TanhParams& params, const RuntimeShape& input_shape, - const uint8_t* input_data, const RuntimeShape& output_shape, - uint8_t* output_data) { - const int32_t input_zero_point = params.input_zero_point; - const int32_t input_range_radius = params.input_range_radius; - const int32_t input_multiplier = params.input_multiplier; - const int input_left_shift = params.input_left_shift; - const int32_t output_zero_point = 128; - const int flat_size = MatchingFlatSize(input_shape, output_shape); - - for (int i = 0; i < flat_size; i++) { - const uint8_t input_val_u8 = input_data[i]; - const int32_t input_val_centered = - static_cast(input_val_u8) - input_zero_point; - uint8_t output_val; - if (input_val_centered <= -input_range_radius) { - output_val = 0; - } else if (input_val_centered >= input_range_radius) { - output_val = 255; - } else { - const int32_t input_val_rescaled = - MultiplyByQuantizedMultiplierGreaterThanOne( - input_val_centered, input_multiplier, input_left_shift); - using FixedPoint4 = gemmlowp::FixedPoint; - using FixedPoint0 = gemmlowp::FixedPoint; - const FixedPoint4 input_val_f4 = FixedPoint4::FromRaw(input_val_rescaled); - const FixedPoint0 output_val_f0 = gemmlowp::tanh(input_val_f4); - // Convert from Q0.31 to Q24.7. - using gemmlowp::RoundingDivideByPOT; - int32_t output_val_s32 = RoundingDivideByPOT(output_val_f0.raw(), 24); - output_val_s32 += output_zero_point; - if (output_val_s32 == 256) { - output_val_s32 = 255; - } - // Reinterpret as Q0.7, encoded in uint8_t. - TFLITE_DCHECK_GE(output_val_s32, 0); - TFLITE_DCHECK_LE(output_val_s32, 255); - output_val = static_cast(output_val_s32); - } - output_data[i] = output_val; - } -} - -} // namespace reference_ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_REFERENCE_TANH_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/spectrogram.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/spectrogram.h deleted file mode 100644 index 879dc1c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/spectrogram.h +++ /dev/null @@ -1,134 +0,0 @@ -/* Copyright 2018 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. -==============================================================================*/ - -// Class for generating spectrogram slices from a waveform. -// Initialize() should be called before calls to other functions. Once -// Initialize() has been called and returned true, The Compute*() functions can -// be called repeatedly with sequential input data (ie. the first element of the -// next input vector directly follows the last element of the previous input -// vector). Whenever enough audio samples are buffered to produce a -// new frame, it will be placed in output. Output is cleared on each -// call to Compute*(). This class is thread-unsafe, and should only be -// called from one thread at a time. -// With the default parameters, the output of this class should be very -// close to the results of the following MATLAB code: -// overlap_samples = window_length_samples - step_samples; -// window = hann(window_length_samples, 'periodic'); -// S = abs(spectrogram(audio, window, overlap_samples)).^2; - -#ifndef TENSORFLOW_LITE_KERNELS_INTERNAL_SPECTROGRAM_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_SPECTROGRAM_H_ - -#include -#include -#include - -#include "third_party/fft2d/fft.h" - -namespace tflite { -namespace internal { - -class Spectrogram { - public: - Spectrogram() : initialized_(false) {} - ~Spectrogram() {} - - // Initializes the class with a given window length and step length - // (both in samples). Internally a Hann window is used as the window - // function. Returns true on success, after which calls to Process() - // are possible. window_length must be greater than 1 and step - // length must be greater than 0. - bool Initialize(int window_length, int step_length); - - // Initialize with an explicit window instead of a length. - bool Initialize(const std::vector& window, int step_length); - - // Processes an arbitrary amount of audio data (contained in input) - // to yield complex spectrogram frames. After a successful call to - // Initialize(), Process() may be called repeatedly with new input data - // each time. The audio input is buffered internally, and the output - // vector is populated with as many temporally-ordered spectral slices - // as it is possible to generate from the input. The output is cleared - // on each call before the new frames (if any) are added. - // - // The template parameters can be float or double. - template - bool ComputeComplexSpectrogram( - const std::vector& input, - std::vector>>* output); - - // This function works as the one above, but returns the power - // (the L2 norm, or the squared magnitude) of each complex value. - template - bool ComputeSquaredMagnitudeSpectrogram( - const std::vector& input, - std::vector>* output); - - // Return reference to the window function used internally. - const std::vector& GetWindow() const { return window_; } - - // Return the number of frequency channels in the spectrogram. - int output_frequency_channels() const { return output_frequency_channels_; } - - private: - template - bool GetNextWindowOfSamples(const std::vector& input, - int* input_start); - void ProcessCoreFFT(); - - int fft_length_; - int output_frequency_channels_; - int window_length_; - int step_length_; - bool initialized_; - int samples_to_next_step_; - - std::vector window_; - std::vector fft_input_output_; - std::deque input_queue_; - - // Working data areas for the FFT routines. - std::vector fft_integer_working_area_; - std::vector fft_double_working_area_; -}; - -// Explicit instantiations in spectrogram.cc. - -extern template bool Spectrogram::ComputeComplexSpectrogram( - const std::vector& input, - std::vector>>*); -extern template bool Spectrogram::ComputeComplexSpectrogram( - const std::vector& input, - std::vector>>*); -extern template bool Spectrogram::ComputeComplexSpectrogram( - const std::vector& input, - std::vector>>*); -extern template bool Spectrogram::ComputeComplexSpectrogram( - const std::vector& input, - std::vector>>*); - -extern template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram( - const std::vector& input, std::vector>*); -extern template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram( - const std::vector& input, std::vector>*); -extern template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram( - const std::vector& input, std::vector>*); -extern template bool Spectrogram::ComputeSquaredMagnitudeSpectrogram( - const std::vector& input, std::vector>*); - -} // namespace internal -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_SPECTROGRAM_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/strided_slice_logic.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/strided_slice_logic.h deleted file mode 100644 index 3d91fbd..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/strided_slice_logic.h +++ /dev/null @@ -1,211 +0,0 @@ -/* Copyright 2018 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_KERNELS_INTERNAL_STRIDED_SLICE_LOGIC_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_STRIDED_SLICE_LOGIC_H_ - -#include -#include - -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace strided_slice { - -// Use until std::clamp() is available from C++17. -inline int Clamp(const int v, const int lo, const int hi) { - TFLITE_DCHECK(!(hi < lo)); - if (hi < v) return hi; - if (v < lo) return lo; - return v; -} - -inline void StridedSlicePadIndices(tflite::StridedSliceParams* p, - int dim_count) { - // Add indices and mask bits to fully include extra dimensions - TFLITE_CHECK_LE(dim_count, 5); - TFLITE_CHECK_GE(dim_count, p->start_indices_count); - TFLITE_CHECK_EQ(p->start_indices_count, p->stop_indices_count); - TFLITE_CHECK_EQ(p->stop_indices_count, p->strides_count); - - const int pad_count = dim_count - p->start_indices_count; - - // Pad indices at start, so move arrays by pad_count. - for (int i = p->start_indices_count - 1; i >= 0; --i) { - p->strides[i + pad_count] = p->strides[i]; - p->start_indices[i + pad_count] = p->start_indices[i]; - p->stop_indices[i + pad_count] = p->stop_indices[i]; - } - for (int i = 0; i < pad_count; ++i) { - p->start_indices[i] = 0; - p->stop_indices[i] = 1; - p->strides[i] = 1; - } - - // Pad masks with 0s or 1s as required. - p->shrink_axis_mask <<= pad_count; - p->ellipsis_mask <<= pad_count; - p->new_axis_mask <<= pad_count; - p->begin_mask <<= pad_count; - p->end_mask <<= pad_count; - p->begin_mask |= (1 << pad_count) - 1; - p->end_mask |= (1 << pad_count) - 1; - - p->start_indices_count = dim_count; - p->stop_indices_count = dim_count; - p->strides_count = dim_count; -} - -// Return the index for the first element along that axis. This index will be a -// positive integer between [0, axis_size] (or [-1, axis_size -1] if stride < 0) -// that can be used to index directly into the data. -inline int StartForAxis(const tflite::StridedSliceParams& params, - const RuntimeShape& input_shape, int axis) { - const auto begin_mask = params.begin_mask; - const auto* start_indices = params.start_indices; - const auto* strides = params.strides; - const int axis_size = input_shape.Dims(axis); - if (axis_size == 0) { - return 0; - } - // Begin with the specified index. - int start = start_indices[axis]; - - // begin_mask override - if (begin_mask & 1 << axis) { - if (strides[axis] > 0) { - // Forward iteration - use the first element. These values will get - // clamped below (Note: We could have set them to 0 and axis_size-1, but - // use lowest() and max() to maintain symmetry with StopForAxis()) - start = std::numeric_limits::lowest(); - } else { - // Backward iteration - use the last element. - start = std::numeric_limits::max(); - } - } - - // Handle negative indices - if (start < 0) { - start += axis_size; - } - - // Clamping - if (strides[axis] > 0) { - // Forward iteration - start = Clamp(start, 0, axis_size); - } else { - // Backward iteration - start = Clamp(start, -1, axis_size - 1); - } - - return start; -} - -// Return the "real" index for the end of iteration along that axis. This is an -// "end" in the traditional C sense, in that it points to one past the last -// element. ie. So if you were iterating through all elements of a 1D array of -// size 4, this function would return 4 as the stop, because it is one past the -// "real" indices of 0, 1, 2 & 3. -inline int StopForAxis(const tflite::StridedSliceParams& params, - const RuntimeShape& input_shape, int axis, - int start_for_axis) { - const auto end_mask = params.end_mask; - const auto shrink_axis_mask = params.shrink_axis_mask; - const auto* stop_indices = params.stop_indices; - const auto* strides = params.strides; - const int axis_size = input_shape.Dims(axis); - if (axis_size == 0) { - return 0; - } - - // Begin with the specified index - const bool shrink_axis = shrink_axis_mask & (1 << axis); - int stop = stop_indices[axis]; - - // When shrinking an axis, the end position does not matter (and can be - // incorrect when negative indexing is used, see Issue #19260). Always use - // start_for_axis + 1 to generate a length 1 slice, since start_for_axis has - // already been adjusted for negative indices. - if (shrink_axis) { - stop = start_for_axis + 1; - } - - // end_mask override - if (end_mask & (1 << axis)) { - if (strides[axis] > 0) { - // Forward iteration - use the last element. These values will get - // clamped below - stop = std::numeric_limits::max(); - } else { - // Backward iteration - use the first element. - stop = std::numeric_limits::lowest(); - } - } - - // Handle negative indices - if (stop < 0) { - stop += axis_size; - } - - // Clamping - // Because the end index points one past the last element, we need slightly - // different clamping ranges depending on the direction. - if (strides[axis] > 0) { - // Forward iteration - stop = Clamp(stop, 0, axis_size); - } else { - // Backward iteration - stop = Clamp(stop, -1, axis_size - 1); - } - - return stop; -} - -inline bool LoopCondition(int index, int stop, int stride) { - // True when we have reached the end of an axis and should loop. - return stride > 0 ? index >= stop : index <= stop; -} - -inline tflite::StridedSliceParams BuildStridedSliceParams( - int begin_mask, int end_mask, int shrink_axis_mask, - const std::vector& start_indices, const std::vector& stop_indices, - const std::vector& strides) { - tflite::StridedSliceParams op_params; - const int dims_count = start_indices.size(); - - op_params.start_indices_count = dims_count; - op_params.stop_indices_count = dims_count; - op_params.strides_count = dims_count; - for (int i = 0; i < dims_count; ++i) { - op_params.start_indices[i] = start_indices[i]; - op_params.stop_indices[i] = stop_indices[i]; - op_params.strides[i] = strides[i]; - } - - op_params.begin_mask = begin_mask; - op_params.ellipsis_mask = 0; - op_params.end_mask = end_mask; - op_params.new_axis_mask = 0; - op_params.shrink_axis_mask = shrink_axis_mask; - - return op_params; -} - -} // namespace strided_slice - -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_STRIDED_SLICE_LOGIC_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/tensor.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/tensor.h deleted file mode 100644 index 84de43c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/tensor.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_TENSOR_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_H_ - -// Most functionality has been moved into a version of this file that doesn't -// rely on std::string, so that it can be used in TFL Micro. -#include "tensorflow/lite/kernels/internal/portable_tensor.h" -#include "tensorflow/lite/string_util.h" - -namespace tflite { - -template <> -class SequentialTensorWriter { - public: - SequentialTensorWriter(const TfLiteTensor* input, TfLiteTensor* output) - : input_(input), output_(output) {} - ~SequentialTensorWriter() { buffer_.WriteToTensor(output_, nullptr); } - - void Write(int position) { this->WriteN(position, 1); } - void WriteN(int position, int len) { - for (int i = 0; i < len; i++) { - buffer_.AddString(GetString(input_, position + i)); - } - } - - private: - const TfLiteTensor* input_; - TfLiteTensor* output_; - DynamicBuffer buffer_; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/tensor_ctypes.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/tensor_ctypes.h deleted file mode 100644 index f1d3e17..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/tensor_ctypes.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_TENSOR_CTYPES_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -template -inline T* GetTensorData(TfLiteTensor* tensor) { - return tensor != nullptr ? reinterpret_cast(tensor->data.raw) : nullptr; -} - -template -inline const T* GetTensorData(const TfLiteTensor* tensor) { - return tensor != nullptr ? reinterpret_cast(tensor->data.raw) - : nullptr; -} - -inline RuntimeShape GetTensorShape(const TfLiteTensor* tensor) { - if (tensor == nullptr) { - return RuntimeShape(); - } - - TfLiteIntArray* dims = tensor->dims; - const int dims_size = dims->size; - const int32_t* dims_data = reinterpret_cast(dims->data); - return RuntimeShape(dims_size, dims_data); -} - -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_CTYPES_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/tensor_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/tensor_utils.h deleted file mode 100644 index 12a5344..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/tensor_utils.h +++ /dev/null @@ -1,640 +0,0 @@ -/* Copyright 2017 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_KERNELS_INTERNAL_TENSOR_UTILS_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_UTILS_H_ - -#include -#include - -#include "third_party/eigen3/Eigen/Core" -#include "tensorflow/lite/c/builtin_op_data.h" - -#if defined(_MSC_VER) -#define __restrict__ __restrict -#endif - -namespace tflite { - -// Not all backends support CpuBackendContext usage, so forward declare to avoid -// pulling in its implementation. Use of CpuBackendContext in method -// implementations is purely optional. -class CpuBackendContext; - -namespace tensor_utils { - -// Checks if all entries of vector are zero for float. -bool IsZeroVector(const float* vector, int v_size); - -// Checks if all entries of vector are zero for int8. -bool IsZeroVector(const int8_t* vector, int v_size); - -// Quantizes a buffer of floating point values using a symmetric quantization -// (i.e. linear quantization without an offset) to 8-bit signed integers. -// It also outputs the range (min, max) of the floating point buffer, and the -// scaling factor used to quantize the values. -void SymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, float* min_value, - float* max_value, float* scaling_factor); - -// Quantizes a buffer of floating point values using a symmetric quantization -// (i.e. linear quantization without an offset) to 8-bit signed integers. -// It uses the range (min, max) provided to the function to calculate the -// appropriate scaling factor to quantize the values. -void SymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, float min_value, - float max_value, float* scaling_factor); - -void AsymmetricQuantizeFloats(const float* values, const int size, - int8_t* quantized_values, float* scaling_factor, - int32_t* offset); - -// Helper function to quantize floats. -// float_data_ptr input float vectors -// n_batch number of input vectors -// n_data size of a single input vector -// quantized_data_ptr (out) vector with quantized data -// scaling_factors (out) scaling factors (one per vector) -// zero_points (out) zero points (one per vector) -// do_asymmetric controls if the quantization should be asymmetric. -inline void BatchQuantizeFloats(const float* float_data_ptr, int n_batch, - int n_data, int8_t* quantized_data_ptr, - float* scaling_factors, int32_t* zero_points, - bool do_asymmetric) { - for (int b = 0; b < n_batch; ++b) { - const int offset = b * n_data; - if (do_asymmetric) { - tensor_utils::AsymmetricQuantizeFloats( - float_data_ptr + offset, n_data, quantized_data_ptr + offset, - &scaling_factors[b], &zero_points[b]); - } else { - float unused_min, unused_max; - tensor_utils::SymmetricQuantizeFloats( - float_data_ptr + offset, n_data, quantized_data_ptr + offset, - &unused_min, &unused_max, &scaling_factors[b]); - } - } -} - -// Multiplies a matrix by a "batched" vector (i.e. a matrix with a batch -// dimension composed by input vectors independent from each other). The result -// of the multiplication is accumulated to the passed result buffer. -// More specifically, for a matrix M of shape [n, i] and a batched-vector -// of shape [i, batch] it will first compute the product of shape [n, batch]. -// This product will be accumulated to the result buffer. -void MatrixBatchVectorMultiplyAccumulate(const float* matrix, int m_rows, - int m_cols, const float* vector, - int n_batch, float* result); - -// Same as the function above, but the matrix is a sparse tensor with block -// pattern 1x4. -// This function assumes that m_cols is a multiple of the block size (4 in this -// case) so that there's no incomplete block. -void SparseMatrixBatchVectorMultiplyAccumulate1x4( - const float* __restrict__ matrix, const int32_t* __restrict__ segments, - const int32_t* __restrict__ indices, int m_rows, int m_cols, - const float* __restrict__ vector, int n_batch, float* __restrict__ result); - -// Same as the function above, but the matrix is stored in block compressed -// sparse row format with block pattern 1x16 which consists of two arrays: -// 1. A matrix array stores non-zero blocks of the matrix in row major. -// 2. A ledger array stores nrows groups, one group per row. Each group starts -// with an integer representing the number of non-zero blocks for the -// corresponding row and follows with column indexes of the first element -// of each non-zero block. -// This function assumes that -// 1. m_cols is a multiple of 16 so that all blocks are full blocks. -// 2. m_cols < 254 * 16 so that block index can be represented by uint8. -void SparseMatrixBatchVectorMultiplyAccumulate( - const float* __restrict__ matrix, const uint8_t* __restrict__ ledger, - int m_rows, int m_cols, const float* __restrict__ vector, int n_batch, - float* __restrict__ result); - -// Same as the function above, but for values quantized using symmetric -// quantization (e.g. by calling SymmetricQuantizeFloats). -// The passed scaling factors is a buffer of the quantization scaling factors -// that will be used to dequentize the products into the final result buffer. -// These scaling factors are the multiplication of the matrix scaling factor -// by the vector's scaling factor, one per batch (i.e. this allows quantizing -// each batch in the batch-vector matrix independently). -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, - const float* __restrict__ scaling_factors, int n_batch, - float* __restrict__ result); - -// Same as the function above, but provide a scratch buffer for the -// int8 x int8 -> int32 and a CpuBackendContext for the accumulator -// computation. -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, - const float* __restrict__ scaling_factors, int n_batch, - int32_t* __restrict__ scratch, float* __restrict__ result, - CpuBackendContext* __restrict__ context); - -// Same as the function above except that vector values -// are quantized with asymmetric quantization per-batch and the matrix -// is quantized per row. -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, - const float* __restrict__ scaling_factors, int n_batch, - float* __restrict__ result, const float* __restrict__ per_channel_scale, - const int32_t* __restrict__ input_offset); - -// Same as the function above except that can make use of cached row sums. -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, const float* scaling_factors, - int n_batch, float* __restrict__ result, const float* per_channel_scale, - const int32_t* input_offset, int32_t* scratch, int32_t* row_sums, - bool* compute_row_sums, CpuBackendContext* context); - -// Same as the function above, but provides separate scaling factor for the -// matrix and the vectors. The scaling factors are multiplied in the -// scaling_factor_scratch buffer. -inline void MatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const int m_rows, const int m_cols, - const int8_t* __restrict__ vectors, const float matrix_scaling_factor, - const float* vector_scaling_factors, int n_batch, - float* __restrict__ result, const float* per_channel_scale, - const int32_t* input_offset, int32_t* scratch, int32_t* row_sums, - bool* compute_row_sums, float* scaling_factor_scratch, - CpuBackendContext* context) { - for (int b = 0; b < n_batch; ++b) { - scaling_factor_scratch[b] = - vector_scaling_factors[b] * matrix_scaling_factor; - } - MatrixBatchVectorMultiplyAccumulate(matrix, m_rows, m_cols, vectors, - scaling_factor_scratch, n_batch, result, - per_channel_scale, input_offset, scratch, - row_sums, compute_row_sums, context); -} - -// Same as the function above, but the matrix is stored in block compressed -// sparse row format with block pattern 1x16 which consists of two arrays: -// 1. A matrix array stores non-zero blocks of the matrix in row major. -// 2. A ledger array stores nrows groups, one group per row. Each group starts -// with an integer representing the number of non-zero blocks for the -// corresponding row followed by column index of the first element of -// each non-zero block. -// This function assumes that -// 1. m_cols is a multiple of 16 so that all blocks are full blocks. -// 2. m_cols < 254 * 16 so that block index can be represented by uint8. -void SparseMatrixBatchVectorMultiplyAccumulate( - const int8_t* __restrict__ matrix, const uint8_t* __restrict__ ledger, - const int m_rows, const int m_cols, const int8_t* __restrict__ vectors, - const float* __restrict__ scaling_factors, int n_batch, - float* __restrict__ result); - -// Multiplies a matrix by a "batched" vector (i.e. a matrix with a batch -// dimension composed by input vectors independent from each other). The result -// of the multiplication is accumulated to the passed result buffer. -// More specifically, for a matrix M of shape [n, i] and a batched-vector -// of shape [i, batch] it will first compute the product of shape [n, batch]. -// This product will be accumulated to the result buffer, -// Parameters: -// - input: batch vector of size n_batch * n_input -// - bias: vector of size b_input -// - input_to_gate_weights: matrix of size n_input * n_output -// - multiplier: scalar -// - shift: scalar -// - n_batch: the batch size -// - n_input: the input size -// - n_output: the output size -// - output_zp: the zero point of the output. -// - scratch: batch vector of size n_batch * n_output -// - output: the 16 bit output -// Notes: -// - this is used for gate matmul: for non-cifg it is for input, forget, -// cell, output gates; for cifg, it is for forget, cell, output gates. -// - multiplier and shift combined gives the scale. -// - assumes input zero point is 0. -// - scratch is created for optimization purpose only. -// TODO(b/152066492): this can be removed if some future optimization -// work makes it unnecessary. -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* input, const int32_t* bias, - const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift, - int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp, - int32_t* scratch, int16_t* output, CpuBackendContext* context); - -// Multiplies a matrix by a "batched" vector (i.e. a matrix with a batch -// dimension composed by input vectors independent from each other). The result -// of the multiplication is accumulated to the passed result buffer. -// More specifically, for a matrix M of shape [n, i] and a batched-vector -// of shape [i, batch] it will first compute the product of shape [n, batch]. -// This product will be accumulated to the result buffer, -// Parameters: -// - input: batch vector of size n_batch * n_input -// - bias: vector of size b_input -// - input_to_gate_weights: matrix of size n_input * n_output -// - multiplier: scalar -// - shift: scalar -// - n_batch: the batch size -// - n_input: the input size -// - n_output: the output size -// - output_zp: the zero point of the output. -// - scratch: batch vector of size n_batch * n_output -// - output: the 8 bit output -// Notes: -// - this is used for projection matmul. -// - multiplier and shift combined gives the scale. -// - assumes input zero point is 0. -// - scratch is created for optimization purpose only. -// TODO(b/152066492): this can be removed if some future optimization -// work makes it unnecessary. -void MatrixBatchVectorMultiplyAccumulate( - const int8_t* input, const int32_t* bias, - const int8_t* input_to_gate_weights, int32_t multiplier, int32_t shift, - int32_t n_batch, int32_t n_input, int32_t n_output, int32_t output_zp, - int32_t* scratch, int8_t* output, CpuBackendContext* context); - -// Same as the above 8, 8, 8 integer matmul except for the presence of zero -// point and non-accumulative. -// TODO(b/148688698): remove this function by folding zero point calculation in -// prepare() function. -void MatrixBatchVectorMultiply(const int8_t* input, int32_t input_zeropoint, - const int8_t* input_to_gate_weights, - int32_t input_to_gate_effective_scale_a, - int32_t input_to_gate_effective_scale_b, - int32_t n_batch, int32_t n_input, int32_t n_cell, - int8_t* gate_output, int8_t gate_output_zp); - -// Same as above but has 16 bit and 8 bit input and 8 bit output. -// Used in projection when hidden is 16bit. -void MatrixBatchVectorMultiply(const int16_t* hidden, - const int8_t* hidden_to_output_weights, - int32_t proj_effective_scale_a, - int32_t proj_effective_scale_b, - const int32_t* gate_bias, int32_t n_batch, - int32_t n_hidden, int32_t n_output, - int32_t output_zp, int8_t* proj_output); - -// Multiplies a matrix with a scalar and reduce the result on each row to a -// scalar. -// Parameters: -// - matrix: matrix of size n_row * n_col -// - scalar: the scalar that is multiplied to each element in the matrix -// - n_row: the row count of the matrix -// - n_col: the column count of the matrix -// - output: the 32bit output -// Note: We do not need saturation because the int8 * int8 is safe from overflow -// in (2^31-1) / (2^14) = 131072, which is bigger than the n_row. Non-zero -// initial output value is not exceptionally large. -void MatrixScalarMultiplyAccumulate(const int8_t* matrix, int32_t scalar, - int32_t n_row, int32_t n_col, - int32_t* output); - -// Apply Layer Normalization (https://arxiv.org/abs/1607.06450) to a Quantized -// vector. -// Parameters: -// - input: batch vector of size n_batch * n_input; 16 bit. -// - layer_norm_weights: the quantized layer normalization weights. -// - bias: the bias for the layer normalization. -// - layer_norm_scale_a: multiplier for scale factor. -// - layer_norm_scale_b: shift for scale factor. -// - variance_limit: the guard to make sure the inverse does not overflow. -// - n_batch: the number of batches. -// - n_input: the size for input and output. -// - output: the 16 bit output -void ApplyLayerNorm(const int16_t* input, const int16_t* layer_norm_weights, - const int32_t* bias, int32_t layer_norm_scale_a, - int32_t layer_norm_scale_b, int32_t variance_limit, - int n_batch, int n_input, int16_t* output); - -// Same as above but the internal calculation is done in float. -void ApplyLayerNormFloat(const int16_t* input, - const int16_t* layer_norm_weights, - int32_t layer_norm_scale_a, int32_t layer_norm_scale_b, - const int32_t* bias, int n_batch, int n_input, - int16_t* output); - -// Apply Sigmoid to a quantized vector. -// Parameters: -// - input: batch vector of size n_batch * n_input; 16 bit. -// - n_batch: the number of batches. -// - n_input: the size for input and output. -// - output: the 16 bit output -// The input is in Q3.12 format and the output is in Q0.15 format. -void ApplySigmoid(const int16_t* input, int32_t n_batch, int32_t n_input, - int16_t* output); - -// Same as above but the internal calcualtion is float. -void ApplySigmoidFloat(const int16_t* input, int32_t n_batch, int32_t n_input, - int16_t* output); - -// Apply Tanh to a quantized vector. -// Parameters: -// - integer_bits: the integer bits of the input. -// Currently supports 0, 1, 2, 3, 4, 5, 6. -// - input: batch vector of size n_batch * n_input; 16 bit. -// - n_batch: the number of batches. -// - n_input: the size for input and output. -// - output: the 16 bit output -// The input is in Qm.15-m format and the output is in Q0.15 format. -void ApplyTanh(int32_t integer_bits, const int16_t* input, int32_t n_batch, - int32_t n_input, int16_t* output); - -// Apply Tanh to a quantized vector. Tbe internal calculation is in float. -// - Input has 2^(integer_bits) as scale. -// - Output has Q0.15 as scale. -void ApplyTanhFloat(const int16_t* input, int32_t n_batch, int32_t n_input, - int32_t integer_bits, int16_t* output); - -// Element-wise multiplication of two quantized vectors. -// Parameters: -// - input_1: batch vector of size n_batch * n_input; 16 bit. -// - input_2: batch vector of size n_batch * n_input; 16 bit. -// - n_batch: the number of batches. -// - n_input: the size for input and output. -// - shift: the shift needed to produce the output. -// - output: the 16 bit output of size n_batch * n_input. -// Output does not need to be initialized. -void CwiseMul(const int16_t* input_1, const int16_t* input_2, int n_batch, - int n_input, int shift, int16_t* output); - -// Element-wise multiplication of two quantized vectors. -// Parameters: -// - input_1: batch vector of size n_batch * n_input; 16 bit. -// - input_2: batch vector of size n_batch * n_input; 16 bit. -// - n_batch: the number of batches. -// - n_input: the size for input and output. -// - shift: the shift needed to produce the output. -// - output: the 8 bit output of size n_batch * n_input. -// Output does not need to be initialized. -void CwiseMul(const int16_t* input_1, const int16_t* input_2, int n_batch, - int n_input, int shift, int8_t* output); - -// Element-wise multiplication of two quantized vectors with rescaling. -// Parameters: -// - input_1: batch vector of size n_batch * n_input; 16 bit. -// - input_2: batch vector of size n_batch * n_input; 16 bit. -// - multiplier: the multiplier part of scale. -// - shift: the shift part of scale. -// - n_batch: the number of batches. -// - n_input: the size for input and output. -// - output: the 8 bit output of size n_batch * n_input. -// - output_zp: the zero point of output. -// Output does not need to be initialized. -// Multiplier ("m") and shift ("s") are connected to scale ("s") with s = m * -// 2^(s - 31). -void CwiseMul(const int16_t* input_1, const int16_t* input_2, - int32_t multiplier, int32_t shift, int32_t n_batch, - int32_t n_input, int32_t output_zp, int8_t* output); - -// Element-wise saturating addition of two quantized vectors without rescaling. -// Parameters: -// - input_1: batch vector of size n_batch * n_input; 16 bit. -// - input_2: batch vector of size n_batch * n_input; 16 bit. -// - n_batch: the number of batches. -// - n_input: the size for input and output. -// - output: the 8 bit output of size n_batch * n_input. -// Output does not need to be initialized. -void CwiseAdd(const int16_t* input_1, const int16_t* input_2, int n_batch, - int n_input, int16_t* output); - -// Element-wise in-place clipping of a vector. Overloaded for float, int16_t, -// int8_t. Parameters: -// - vector: vector of size v_size. -// - v_size: the size of the vector. -// - clipping_value: the value used for clipping. -void CwiseClipping(float* vector, const int v_size, const float clipping_value); -void CwiseClipping(int16_t* vector, const int v_size, - const int16_t clipping_value); -void CwiseClipping(int8_t* vector, const int v_size, - const int8_t clipping_value); - -// Cwise product of two vectors. -template -inline void VectorVectorCwiseProduct(const T* __restrict__ vector1, - const T* __restrict__ vector2, int v_size, - T* __restrict__ result) { - for (int v = 0; v < v_size; v++) { - *result++ = *vector1++ * *vector2++; - } -} - -// Cwise product and accumulate of two vectors. Since it's a MAC operation, the -// assumption here is that result array is initialized to valid values. -template -inline void VectorVectorCwiseProductAccumulate(const T* __restrict__ vector1, - const T* __restrict__ vector2, - int v_size, - T* __restrict__ result) { - for (int v = 0; v < v_size; v++) { - *result++ += *vector1++ * *vector2++; - } -} - -// Dot product of two vectors. -float VectorVectorDotProduct(const float* vector1, const float* vector2, - int v_size); - -// Dot product of two batch vectors of size n_batch * v_size: -// vector1 = [x_1_1, x_1_2, ..., x_1_vsize, -// x_2_1, x_2_2, ..., x_2_vsize, -// ... -// x_nbatch_1,..., x_nbatch_vsize] -// vector2 = [y_1_1, y_1_2, ..., y_1_vsize, -// y_2_1, y_2_2, ..., y_2_vsize, -// ... -// y_nbatch_1,..., y_nbatch_vsize] -// Then result will be a vector of n_batch size starting from 'result': -// [x_1_1 * y_1_1 + x_1_2 * y_1_2 + ... + x_1_vsize * y_1_vsize, -// x_2_1 * y_2_1 + x_2_2 * y_2_2 + ... + x_2_vsize * y_2_vsize, -// ... -// x_nbatch_1 * y_nbatch_1 + ... + x_nbatch_vsize * y_nbatch_vsize] -template -inline void BatchVectorBatchVectorDotProduct(const T* vector1, const T* vector2, - int v_size, int n_batch, - T* result) { - for (int b = 0; b < n_batch; b++) { - result[b] = VectorVectorDotProduct(vector1, vector2, v_size); - vector1 += v_size; - vector2 += v_size; - } -} - -// Same as above but input is 16bit and output is 32bit. -void BatchVectorBatchVectorDotProduct(const int16_t* vector1, - const int16_t* vector2, int v_size, - int n_batch, int32_t* result); - -// Cwise product of a vector and a batch-vector. -template -inline void VectorBatchVectorCwiseProduct(const T* vector, int v_size, - const T* batch_vector, int n_batch, - T* result) { - for (int b = 0; b < n_batch; b++) { - VectorVectorCwiseProduct(vector, batch_vector, v_size, result); - // Update the pointers. - result += v_size; - batch_vector += v_size; - } -} - -// Cwise product and accumulate of a vector and a batch-vector. Since it's a MAC -// operation, the assumption here is that result array is initialized to valid -// values. -template -inline void VectorBatchVectorCwiseProductAccumulate(const T* vector, int v_size, - const T* batch_vector, - int n_batch, T* result) { - for (int b = 0; b < n_batch; b++) { - VectorVectorCwiseProductAccumulate(vector, batch_vector, v_size, result); - // Update the pointers. - result += v_size; - batch_vector += v_size; - } -} - -// Same as above, but inputs are 16bit integer and output is 16bit integer. -void VectorBatchVectorCwiseProductAccumulate(const int16_t* vector, int v_size, - const int16_t* batch_vector, - int n_batch, int32_t multiplier, - int shift, int16_t* result); - -// Add another vector for each batch in the batch vector. -void VectorBatchVectorAdd(const float* vector, int v_size, int n_batch, - float* batch_vector); - -// Batch vector initialization with another vector. -template -void VectorBatchVectorAssign(const T* vector, int v_size, int n_batch, - T* batch_vector) { - for (int b = 0; b < n_batch; b++) { - std::copy_n(vector, v_size, batch_vector + b * v_size); - } -} - -// Apply Rectified Linear to elements of a vector. -inline void ApplyReluToVector(const float* __restrict__ vector, int v_size, - float* __restrict__ result) { - for (int v = 0; v < v_size; v++) { - result[v] = std::max(0.0f, vector[v]); - } -} - -// Apply Rectified Linear 1 (cap to [-1;1]) to elements of a vector -inline void ApplyRelu1ToVector(const float* __restrict__ vector, int v_size, - float* __restrict__ result) { - for (int v = 0; v < v_size; v++) { - result[v] = std::max(-1.0f, std::min(vector[v], 1.0f)); - } -} - -// Apply Rectified Linear 6 (cap to [0;6]) to elements of a vector -inline void ApplyRelu6ToVector(const float* __restrict__ vector, int v_size, - float* __restrict__ result) { - for (int v = 0; v < v_size; v++) { - result[v] = std::max(0.0f, std::min(vector[v], 6.0f)); - } -} - -// Apply tanh to elements of a vector -inline void ApplyTanhToVector(const float* __restrict__ vector, int v_size, - float* __restrict__ result) { - using VectorMap = Eigen::Map>; - VectorMap input_map(const_cast(vector), v_size); - VectorMap output_map(result, v_size); - output_map.array() = input_map.array().tanh(); -} - -// Apply signbit to elements of a vector -inline void ApplySignbitToVector(const float* __restrict__ vector, int v_size, - float* __restrict__ result) { - for (int v = 0; v < v_size; v++) { - result[v] = std::signbit(vector[v]); - } -} - -// Apply sigmoid to elements of a vector. -inline void ApplySigmoidToVector(const float* __restrict__ vector, int v_size, - float* __restrict__ result) { - using VectorMap = Eigen::Map>; - VectorMap input_map(const_cast(vector), v_size); - VectorMap output_map(result, v_size); - output_map.array() = input_map.array().logistic(); -} - -// Apply appropriate activation function to elements of a vector. -inline void ApplyActivationToVector(const float* __restrict__ vector, - int v_size, - TfLiteFusedActivation activation, - float* __restrict__ result) { - switch (activation) { - case kTfLiteActNone: - return; - case kTfLiteActRelu: - return ApplyReluToVector(vector, v_size, result); - case kTfLiteActReluN1To1: - return ApplyRelu1ToVector(vector, v_size, result); - case kTfLiteActRelu6: - return ApplyRelu6ToVector(vector, v_size, result); - case kTfLiteActTanh: - return ApplyTanhToVector(vector, v_size, result); - case kTfLiteActSignBit: - return ApplySignbitToVector(vector, v_size, result); - case kTfLiteActSigmoid: - return ApplySigmoidToVector(vector, v_size, result); - } -} - -// Compute "1.0f - elements of vector" (used in CIFG). -void Sub1Vector(const float* vector, int v_size, float* result); - -// Compute "1.0f - elements of vector" (used in CIFG) for int16 input. -// "vector" has range [0, 32767] because it is the output of sigmoid function. -void Sub1Vector(const int16_t* vector, int v_size, int16_t* result); - -// Multiply all elements of vector with a scalar. -void VectorScalarMultiply(const int8_t* vector, int v_size, float scale, - float* result); - -// Reduce-sum on a float input vector: -// input_vector: float pointer to input vector. -// output_vector: float pointer to vector. -// output_size: output vector size. -// reduction_size: number of consecutive elements from input vector which are -// added to get one element of output. -void ReductionSumVector(const float* input_vector, float* output_vector, - int output_size, int reduction_size); - -// Same as above but input/output is 32 bit integer. -void ReductionSumVector(const int32_t* input_vector, int32_t* output_vector, - int output_size, int reduction_size); - -// Same as above but input is 8 bit integer. -void ReductionSumVector(const int8_t* input_vector, int32_t* output_vector, - int output_size, int reduction_size); - -// Layer norm for each batch. -void MeanStddevNormalization(const float* input_vector, float* output_vector, - int v_size, int n_batch); - -// Saturate Add with rescale on both inputs. -void TwoGateSaturatingAdd(const int8_t* input, int8_t input_zp, - const int8_t* recurrent, int8_t recurrent_zp, - int32_t input_effective_scale_a, - int32_t input_effective_scale_b, - int32_t recurrent_effective_scale_a, - int32_t recurrent_effective_scale_b, int32_t n_batch, - int32_t n_cell, int16_t* output); - -} // namespace tensor_utils -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_TENSOR_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/test_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/test_util.h deleted file mode 100644 index 6c9a341..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/test_util.h +++ /dev/null @@ -1,105 +0,0 @@ -/* Copyright 2018 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_KERNELS_INTERNAL_TEST_UTIL_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_TEST_UTIL_H_ - -#include -#include -#include -#include -#include -#include - -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { - -// Computes output and padding dimensions. -bool ComputeConvSizes(const RuntimeShape& input_shape, int output_depth, - int filter_width, int filter_height, int stride, - int dilation_width_factor, int dilation_height_factor, - PaddingType padding_type, RuntimeShape* output_shape, - int* pad_width, int* pad_height); - -// Returns a mt19937 random engine. -std::mt19937& RandomEngine(); - -// Returns a random integer uniformly distributed between |min| and |max|. -int UniformRandomInt(int min, int max); - -// Returns a random float uniformly distributed between |min| and |max|. -float UniformRandomFloat(float min, float max); - -// Returns a random element in |v|. -template -const T& RandomElement(const std::vector& v) { - return v[UniformRandomInt(0, v.size() - 1)]; -} - -// Returns a random exponentially distributed integer. -int ExponentialRandomPositiveInt(float percentile, int percentile_val, - int max_val); - -// Returns a random exponentially distributed float. -float ExponentialRandomPositiveFloat(float percentile, float percentile_val, - float max_val); - -// Fills a vector with random floats between |min| and |max|. -void FillRandom(std::vector* vec, float min, float max); - -template -void FillRandom(typename std::vector::iterator begin_it, - typename std::vector::iterator end_it, T min, T max) { - // Workaround for compilers that don't support (u)int8_t uniform_distribution. - typedef typename std::conditional= sizeof(int16_t), T, - std::int16_t>::type rand_type; - std::uniform_int_distribution dist(min, max); - // TODO(b/154540105): use std::ref to avoid copying the random engine. - auto gen = std::bind(dist, RandomEngine()); - std::generate(begin_it, end_it, [&gen] { return static_cast(gen()); }); -} - -// Fills a vector with random numbers between |min| and |max|. -template -void FillRandom(std::vector* vec, T min, T max) { - return FillRandom(std::begin(*vec), std::end(*vec), min, max); -} - -// Fills a vector with random numbers. -template -void FillRandom(std::vector* vec) { - FillRandom(vec, std::numeric_limits::min(), std::numeric_limits::max()); -} - -// Fill with a "skyscraper" pattern, in which there is a central section (across -// the depth) with higher values than the surround. -template -void FillRandomSkyscraper(std::vector* vec, int depth, - double middle_proportion, uint8 middle_min, - uint8 sides_max) { - for (auto base_it = std::begin(*vec); base_it != std::end(*vec); - base_it += depth) { - auto left_it = base_it + std::ceil(0.5 * depth * (1.0 - middle_proportion)); - auto right_it = - base_it + std::ceil(0.5 * depth * (1.0 + middle_proportion)); - FillRandom(base_it, left_it, std::numeric_limits::min(), sides_max); - FillRandom(left_it, right_it, middle_min, std::numeric_limits::max()); - FillRandom(right_it, base_it + depth, std::numeric_limits::min(), - sides_max); - } -} - -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_TEST_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/transpose_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/transpose_utils.h deleted file mode 100644 index b7fee18..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/transpose_utils.h +++ /dev/null @@ -1,52 +0,0 @@ -/* 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_KERNELS_INTERNAL_TRANSPOSE_UTILS_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_TRANSPOSE_UTILS_H_ - -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace transpose_utils { - -// IsTranspose2DApplicable returns true if the given perm can be lowered to a -// 2D transpose op. If possible, it copies the lowered dimension counts to the -// given dim0 and dim1 pointers. -bool IsTranspose2DApplicable(const TransposeParams& params, - const RuntimeShape& input_shape, int* dim0, - int* dim1); - -// RemoveOneSizeDimensions removes one size dimensions in the given input/output -// shapes and adjusts the parameter values for transpose op. -void RemoveOneSizeDimensions(RuntimeShape* input_shape, - RuntimeShape* output_shape, - TransposeParams* params); - -// Flatten finds the dimensions that can be flatten, shrinks the given shapes -// and the given perm parameter to reflect the non-flatten dimensions, and -// returns the total size of the non-flatten dimensions. -// -// E.g, in perm [0, 1, 3, 2] case, the first two dimensions can be flatten and -// it returns |Dim Size(2)| x |Dim Size(3)|. -size_t Flatten(const RuntimeShape& input_shape, - const RuntimeShape& output_shape, const TransposeParams& params, - RuntimeShape* non_flatten_input_shape, - RuntimeShape* non_flatten_output_shape, - TransposeParams* non_flatten_params); - -} // namespace transpose_utils - -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_TRANSPOSE_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/types.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/types.h deleted file mode 100644 index 37403a8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/internal/types.h +++ /dev/null @@ -1,1155 +0,0 @@ -/* Copyright 2018 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_KERNELS_INTERNAL_TYPES_H_ -#define TENSORFLOW_LITE_KERNELS_INTERNAL_TYPES_H_ - -#include -#include -#include -#include - -#include "tensorflow/lite/kernels/internal/compatibility.h" - -namespace tflite { - -enum class FusedActivationFunctionType : uint8_t { - kNone, - kRelu6, - kRelu1, - kRelu -}; -enum class PaddingType : uint8_t { kNone, kSame, kValid }; - -struct PaddingValues { - int16_t width; - int16_t height; - // offset is used for calculating "remaining" padding, for example, `width` - // is 1 and `width_offset` is 1, so padding_left is 1 while padding_right is - // 1 + 1 = 2. - int16_t width_offset; - // Same as width_offset except it's over the height dimension. - int16_t height_offset; -}; - -// This enumeration allows for non-default formats for the weights array -// of a fully-connected operator, allowing the use of special optimized -// runtime paths. -enum class FullyConnectedWeightsFormat : uint8_t { - // Default format (flat 2D layout, the inner contiguous dimension - // is input_depth, the outer non-contiguous dimension is output_depth) - kDefault, - // Summary: optimized layout for fast CPU runtime implementation, - // aimed specifically at ARM CPUs at the moment, and specialized for - // 8-bit quantized layers. - // - // The use case we're concerned with here is: 8-bit quantization, - // large weights matrix that doesn't fit in cache (e.g. 4096x2048 in - // a key application that drove this), very small batch size (e.g. 1 -- 4). - // - // Even with 8-bit quantization of weights, the performance of memory - // accesses to the weights can become the dominant issue when - // the batch size is small, so each weight value is used in only a few - // arithmetic ops, i.e. the fully-connected node has a low arithmetic - // intensity. The specific issues that arise are of three kinds: - // (1) One may, ideally, max out DRAM bandwidth, i.e. be truly memory - // bound. That's the "good" issue to run into. - // (2) One may run into sub-optimal pre-fetching: the data hasn't been - // prefetched into the cache by the time we need it. - // (3) One may run into cache aliasing: multiple values that are - // pre-fetched, alias each other in the L1 cache (which typically - // has only 4-way set associativity in ARM CPUs) and thus evict - // each other before we get to using them. - // - // The point of this shuffling is to avoid issues (2) and (3) so that - // we get as fast as possible given only the hard constraint (1). - // This is achieved by turning the difficulty into a solution: the - // difficulty, that each value loaded from memory is used only in - // one kernel iteration, making this operation memory-intensive, hints at - // the solution, of shuffling the weights so that they are stored in the - // exact order as the kernel needs to load them, so that the memory - // accesses made by the kernel are trivial. This solves (2) because the - // trivial memory access pattern allows the CPU's automatic prefetching - // to perform very well (no need even for preload instructions), and this - // solves (3) because the values being loaded concurrently are now - // contiguous in the address space, thus don't alias each other in the cache. - // - // On ARM, we typically want our kernel to process a 4x16 block of weights - // at a time, because: - // - 16 is the number of bytes in a NEON register. - // - 4 is how many rows we need to handle concurrently in the kernel in - // order to have sufficient mutual independence of instructions to - // maximize arithmetic throughput. - // - // Finally, the 'Int8' part in the name refers to the fact that this - // weights format has each weights value encoded as a signed int8_t value, - // even if the data type of the weights buffer is uint8_t. This is intended - // to save runtime kernels the effort to have to XOR the top bit of these - // bytes before using them in signed arithmetic, see this file for more - // explanations on the 'signed int8_t trick' in matrix multiplication kernels: - // - // tensorflow/lite/toco/graph_transformations/ensure_uint8_weights_safe_for_fast_int8_kernels.cc - // - kShuffled4x16Int8, -}; - -// Quantization parameters, determining the mapping of quantized values -// to real values (i.e. determining how quantized values are mathematically -// interpreted). -// -// The correspondence is as follows: -// -// real_value = scale * (quantized_value - zero_point); -// -// In other words, zero_point designates which quantized value corresponds to -// the real 0 value, and scale designates the difference between the real values -// corresponding to consecutive quantized values differing by 1. -struct QuantizationParams { - int32_t zero_point = 0; - double scale = 0.0; -}; - -inline bool operator==(const QuantizationParams& qp1, - const QuantizationParams& qp2) { - return qp1.zero_point == qp2.zero_point && qp1.scale == qp2.scale; -} - -template -struct Dims { - int sizes[N]; - int strides[N]; -}; - -class RuntimeShape { - public: - // Shapes with dimensions up to 5 are stored directly in the structure, while - // larger shapes are separately allocated. - static constexpr int kMaxSmallSize = 5; - - RuntimeShape& operator=(RuntimeShape const&) = delete; - - RuntimeShape() : size_(0) {} - - explicit RuntimeShape(int dimensions_count) : size_(dimensions_count) { - if (dimensions_count > kMaxSmallSize) { -#ifdef TF_LITE_STATIC_MEMORY - TFLITE_CHECK(false && "No shape resizing supported on this platform"); -#else // TF_LITE_STATIC_MEMORY - dims_pointer_ = new int32_t[dimensions_count]; -#endif // TF_LITE_STATIC_MEMORY - } - } - - RuntimeShape(int shape_size, int32_t value) : size_(0) { - Resize(shape_size); - for (int i = 0; i < shape_size; ++i) { - SetDim(i, value); - } - } - - RuntimeShape(int dimensions_count, const int32_t* dims_data) : size_(0) { - ReplaceWith(dimensions_count, dims_data); - } - - RuntimeShape(const std::initializer_list init_list) : size_(0) { - BuildFrom(init_list); - } - - // Avoid using this constructor. We should be able to delete it when C++17 - // rolls out. - RuntimeShape(RuntimeShape const& other) : size_(other.DimensionsCount()) { - if (size_ > kMaxSmallSize) { - dims_pointer_ = new int32_t[size_]; - } - std::memcpy(DimsData(), other.DimsData(), sizeof(int32_t) * size_); - } - - bool operator==(const RuntimeShape& comp) const { - return this->size_ == comp.size_ && - std::memcmp(DimsData(), comp.DimsData(), size_ * sizeof(int32_t)) == - 0; - } - - ~RuntimeShape() { - if (size_ > kMaxSmallSize) { -#ifdef TF_LITE_STATIC_MEMORY - TFLITE_CHECK(false && "No shape resizing supported on this platform"); -#else // TF_LITE_STATIC_MEMORY - delete[] dims_pointer_; -#endif // TF_LITE_STATIC_MEMORY - } - } - - inline int32_t DimensionsCount() const { return size_; } - inline int32_t Dims(int i) const { - TFLITE_DCHECK_GE(i, 0); - TFLITE_DCHECK_LT(i, size_); - return size_ > kMaxSmallSize ? dims_pointer_[i] : dims_[i]; - } - inline void SetDim(int i, int32_t val) { - TFLITE_DCHECK_GE(i, 0); - TFLITE_DCHECK_LT(i, size_); - if (size_ > kMaxSmallSize) { - dims_pointer_[i] = val; - } else { - dims_[i] = val; - } - } - - inline int32_t* DimsData() { - return size_ > kMaxSmallSize ? dims_pointer_ : dims_; - } - inline const int32_t* DimsData() const { - return size_ > kMaxSmallSize ? dims_pointer_ : dims_; - } - // The caller must ensure that the shape is no bigger than 5-D. - inline const int32_t* DimsDataUpTo5D() const { return dims_; } - - inline void Resize(int dimensions_count) { - if (size_ > kMaxSmallSize) { -#ifdef TF_LITE_STATIC_MEMORY - TFLITE_CHECK(false && "No shape resizing supported on this platform"); -#else // TF_LITE_STATIC_MEMORY - delete[] dims_pointer_; -#endif // TF_LITE_STATIC_MEMORY - } - size_ = dimensions_count; - if (dimensions_count > kMaxSmallSize) { -#ifdef TF_LITE_STATIC_MEMORY - TFLITE_CHECK(false && "No shape resizing supported on this platform"); -#else // TF_LITE_STATIC_MEMORY - dims_pointer_ = new int32_t[dimensions_count]; -#endif // TF_LITE_STATIC_MEMORY - } - } - - inline void ReplaceWith(int dimensions_count, const int32_t* dims_data) { - Resize(dimensions_count); - int32_t* dst_dims = DimsData(); - std::memcpy(dst_dims, dims_data, dimensions_count * sizeof(int32_t)); - } - - template - inline void BuildFrom(const T& src_iterable) { - const int dimensions_count = - std::distance(src_iterable.begin(), src_iterable.end()); - Resize(dimensions_count); - int32_t* data = DimsData(); - for (auto it : src_iterable) { - *data = it; - ++data; - } - } - - // This will probably be factored out. Old code made substantial use of 4-D - // shapes, and so this function is used to extend smaller shapes. Note that - // (a) as Dims<4>-dependent code is eliminated, the reliance on this should be - // reduced, and (b) some kernels are stricly 4-D, but then the shapes of their - // inputs should already be 4-D, so this function should not be needed. - inline static RuntimeShape ExtendedShape(int new_shape_size, - const RuntimeShape& shape) { - return RuntimeShape(new_shape_size, shape, 1); - } - - inline void BuildFrom(const std::initializer_list init_list) { - BuildFrom>(init_list); - } - - // Returns the total count of elements, that is the size when flattened into a - // vector. - inline int FlatSize() const { - int buffer_size = 1; - const int* dims_data = reinterpret_cast(DimsData()); - for (int i = 0; i < size_; i++) { - buffer_size *= dims_data[i]; - } - return buffer_size; - } - - bool operator!=(const RuntimeShape& comp) const { return !((*this) == comp); } - - private: - // For use only by ExtendedShape(), written to guarantee (return-value) copy - // elision in C++17. - // This creates a shape padded to the desired size with the specified value. - RuntimeShape(int new_shape_size, const RuntimeShape& shape, int pad_value) - : size_(0) { - // If the following check fails, it is likely because a 4D-only kernel is - // being used with an array of larger dimension count. - TFLITE_CHECK_GE(new_shape_size, shape.DimensionsCount()); - Resize(new_shape_size); - const int size_increase = new_shape_size - shape.DimensionsCount(); - for (int i = 0; i < size_increase; ++i) { - SetDim(i, pad_value); - } - std::memcpy(DimsData() + size_increase, shape.DimsData(), - sizeof(int32_t) * shape.DimensionsCount()); - } - - int32_t size_; - union { - int32_t dims_[kMaxSmallSize]; - int32_t* dims_pointer_; - }; -}; - -// Converts inference-style shape to legacy tflite::Dims<4>. -inline tflite::Dims<4> ToRuntimeDims(const tflite::RuntimeShape& array_shape) { - tflite::Dims<4> result; - const int dimensions_count = array_shape.DimensionsCount(); - TFLITE_CHECK_LE(dimensions_count, 4); - int cum_prod = 1; - for (int i = 0; i < 4; i++) { - const int new_dim = - (i < dimensions_count) ? array_shape.Dims(dimensions_count - 1 - i) : 1; - result.sizes[i] = new_dim; - result.strides[i] = cum_prod; - cum_prod *= new_dim; - } - return result; -} - -// TODO(b/80418076): Move to legacy ops file, update invocations. -inline RuntimeShape DimsToShape(const tflite::Dims<4>& dims) { - return RuntimeShape( - {dims.sizes[3], dims.sizes[2], dims.sizes[1], dims.sizes[0]}); -} - -// Gets next index to iterate through a multidimensional array. -inline bool NextIndex(const int num_dims, const int* dims, int* current) { - if (num_dims == 0) { - return false; - } - TFLITE_DCHECK(dims != nullptr); - TFLITE_DCHECK(current != nullptr); - int carry = 1; - for (int idx = num_dims - 1; idx >= 0; --idx) { - int current_val = current[idx] + carry; - TFLITE_DCHECK_GE(dims[idx], current_val); - if (dims[idx] == current_val) { - current[idx] = 0; - } else { - current[idx] = current_val; - carry = 0; - break; - } - } - return (carry == 0); -} - -// Gets offset of index if reducing on axis. When reducing, the flattened offset -// will not change, if the input index changes on the given axis. For example, -// if you have a 3D tensor and you are reducing to 2D by eliminating axis 0, -// then index (0, 1, 2) and index (1, 1, 2) will map to the same flattened -// offset. -// TODO(kanlig): uses Dims to represent dimensions. -inline size_t ReducedOutputOffset(const int num_dims, const int* dims, - const int* index, const int num_axis, - const int* axis) { - if (num_dims == 0) { - return 0; - } - TFLITE_DCHECK(dims != nullptr); - TFLITE_DCHECK(index != nullptr); - size_t offset = 0; - for (int idx = 0; idx < num_dims; ++idx) { - // if we need to skip this axis - bool is_axis = false; - if (axis != nullptr) { - for (int axis_idx = 0; axis_idx < num_axis; ++axis_idx) { - if (idx == axis[axis_idx]) { - is_axis = true; - break; - } - } - } - if (!is_axis) { - offset = offset * static_cast(dims[idx]) + - static_cast(index[idx]); - } - } - return offset; -} - -inline int Offset(const RuntimeShape& shape, int i0, int i1, int i2, int i3) { - TFLITE_DCHECK_EQ(shape.DimensionsCount(), 4); - const int* dims_data = reinterpret_cast(shape.DimsDataUpTo5D()); - TFLITE_DCHECK(i0 >= 0 && i0 < dims_data[0]); - TFLITE_DCHECK(i1 >= 0 && i1 < dims_data[1]); - TFLITE_DCHECK(i2 >= 0 && i2 < dims_data[2]); - TFLITE_DCHECK(i3 >= 0 && i3 < dims_data[3]); - return ((i0 * dims_data[1] + i1) * dims_data[2] + i2) * dims_data[3] + i3; -} - -inline int Offset(const Dims<4>& dims, int i0, int i1, int i2, int i3) { - TFLITE_DCHECK(i0 >= 0 && i0 < dims.sizes[0]); - TFLITE_DCHECK(i1 >= 0 && i1 < dims.sizes[1]); - TFLITE_DCHECK(i2 >= 0 && i2 < dims.sizes[2]); - TFLITE_DCHECK(i3 >= 0 && i3 < dims.sizes[3]); - return i0 * dims.strides[0] + i1 * dims.strides[1] + i2 * dims.strides[2] + - i3 * dims.strides[3]; -} - -inline int Offset(const Dims<4>& dims, int* index) { - return Offset(dims, index[0], index[1], index[2], index[3]); -} - -inline int Offset(const RuntimeShape& shape, int* index) { - return Offset(shape, index[0], index[1], index[2], index[3]); -} - -// Get array size, DCHECKing that the dim index is in range. -// -// Note that this will be phased out with Dims<4>, since RuntimeShape::Dims() -// already performs this check. -template -int ArraySize(const Dims& array, int index) { - TFLITE_DCHECK(index >= 0 && index < N); - return array.sizes[index]; -} - -// Get common array size, DCHECKing that they all agree. -template -int MatchingArraySize(const ArrayType1& array1, int index1, - const ArrayType2& array2, int index2) { - TFLITE_DCHECK_EQ(ArraySize(array1, index1), ArraySize(array2, index2)); - return ArraySize(array1, index1); -} - -template -int MatchingArraySize(const ArrayType1& array1, int index1, - const ArrayType2& array2, int index2, Args... args) { - TFLITE_DCHECK_EQ(ArraySize(array1, index1), ArraySize(array2, index2)); - return MatchingArraySize(array1, index1, args...); -} - -// Get common shape dim, DCHECKing that they all agree. -inline int MatchingDim(const RuntimeShape& shape1, int index1, - const RuntimeShape& shape2, int index2) { - TFLITE_DCHECK_EQ(shape1.Dims(index1), shape2.Dims(index2)); - return std::min(shape1.Dims(index1), shape2.Dims(index2)); -} - -template -int MatchingDim(const RuntimeShape& shape1, int index1, - const RuntimeShape& shape2, int index2, Args... args) { - TFLITE_DCHECK_EQ(shape1.Dims(index1), shape2.Dims(index2)); - return MatchingDim(shape1, index1, args...); -} - -// Will be phased out with Dims<4>, replaced by RuntimeShape::FlatSize(). -template -inline int FlatSize(const Dims& dims) { - int flat_size = 1; - for (int i = 0; i < N; ++i) { - flat_size *= dims.sizes[i]; - } - return flat_size; -} - -TFLITE_DEPRECATED("Prefer FlatSize.") -inline int RequiredBufferSizeForDims(const Dims<4>& dims) { - return FlatSize(dims); -} - -inline int MatchingElementsSize(const RuntimeShape& shape, - const RuntimeShape& check_shape_0) { - const int size_1 = shape.FlatSize(); - const int size_2 = check_shape_0.FlatSize(); - TFLITE_CHECK_EQ(size_1, size_2); - return size_1; -} - -inline int MatchingElementsSize(const RuntimeShape& shape, - const RuntimeShape& check_shape_0, - const RuntimeShape& check_shape_1) { - const int size_1 = shape.FlatSize(); - const int size_2 = check_shape_0.FlatSize(); - const int size_3 = check_shape_1.FlatSize(); - TFLITE_CHECK_EQ(size_1, size_2); - TFLITE_CHECK_EQ(size_2, size_3); - return size_1; -} - -// Flat size calculation, checking that dimensions match with one or more other -// arrays. -inline int MatchingFlatSize(const RuntimeShape& shape, - const RuntimeShape& check_shape_0) { - TFLITE_DCHECK_EQ(shape.DimensionsCount(), check_shape_0.DimensionsCount()); - const int dims_count = shape.DimensionsCount(); - for (int i = 0; i < dims_count; ++i) { - TFLITE_DCHECK_EQ(shape.Dims(i), check_shape_0.Dims(i)); - } - return shape.FlatSize(); -} - -inline int MatchingFlatSize(const RuntimeShape& shape, - const RuntimeShape& check_shape_0, - const RuntimeShape& check_shape_1) { - TFLITE_DCHECK_EQ(shape.DimensionsCount(), check_shape_0.DimensionsCount()); - const int dims_count = shape.DimensionsCount(); - for (int i = 0; i < dims_count; ++i) { - TFLITE_DCHECK_EQ(shape.Dims(i), check_shape_0.Dims(i)); - } - return MatchingFlatSize(shape, check_shape_1); -} - -inline int MatchingFlatSize(const RuntimeShape& shape, - const RuntimeShape& check_shape_0, - const RuntimeShape& check_shape_1, - const RuntimeShape& check_shape_2) { - TFLITE_DCHECK_EQ(shape.DimensionsCount(), check_shape_0.DimensionsCount()); - const int dims_count = shape.DimensionsCount(); - for (int i = 0; i < dims_count; ++i) { - TFLITE_DCHECK_EQ(shape.Dims(i), check_shape_0.Dims(i)); - } - return MatchingFlatSize(shape, check_shape_1, check_shape_2); -} - -inline int MatchingFlatSize(const RuntimeShape& shape, - const RuntimeShape& check_shape_0, - const RuntimeShape& check_shape_1, - const RuntimeShape& check_shape_2, - const RuntimeShape& check_shape_3) { - TFLITE_DCHECK_EQ(shape.DimensionsCount(), check_shape_0.DimensionsCount()); - const int dims_count = shape.DimensionsCount(); - for (int i = 0; i < dims_count; ++i) { - TFLITE_DCHECK_EQ(shape.Dims(i), check_shape_0.Dims(i)); - } - return MatchingFlatSize(shape, check_shape_1, check_shape_2, check_shape_3); -} - -// Flat size calculation, checking that dimensions match with one or more other -// arrays. -template -inline int MatchingFlatSize(const Dims& dims, const Dims& check_dims_0) { - for (int i = 0; i < N; ++i) { - TFLITE_DCHECK_EQ(ArraySize(dims, i), ArraySize(check_dims_0, i)); - } - return FlatSize(dims); -} - -template -inline int MatchingFlatSize(const Dims& dims, const Dims& check_dims_0, - const Dims& check_dims_1) { - for (int i = 0; i < N; ++i) { - TFLITE_DCHECK_EQ(ArraySize(dims, i), ArraySize(check_dims_0, i)); - } - return MatchingFlatSize(dims, check_dims_1); -} - -template -inline int MatchingFlatSize(const Dims& dims, const Dims& check_dims_0, - const Dims& check_dims_1, - const Dims& check_dims_2) { - for (int i = 0; i < N; ++i) { - TFLITE_DCHECK_EQ(ArraySize(dims, i), ArraySize(check_dims_0, i)); - } - return MatchingFlatSize(dims, check_dims_1, check_dims_2); -} - -template -inline int MatchingFlatSize(const Dims& dims, const Dims& check_dims_0, - const Dims& check_dims_1, - const Dims& check_dims_2, - const Dims& check_dims_3) { - for (int i = 0; i < N; ++i) { - TFLITE_DCHECK_EQ(ArraySize(dims, i), ArraySize(check_dims_0, i)); - } - return MatchingFlatSize(dims, check_dims_1, check_dims_2, check_dims_3); -} - -// Data is required to be contiguous, and so many operators can use either the -// full array flat size or the flat size with one dimension skipped (commonly -// the depth). -template -inline int FlatSizeSkipDim(const Dims& dims, int skip_dim) { - TFLITE_DCHECK(skip_dim >= 0 && skip_dim < N); - int flat_size = 1; - for (int i = 0; i < N; ++i) { - flat_size *= (i == skip_dim) ? 1 : dims.sizes[i]; - } - return flat_size; -} - -// A combination of MatchingFlatSize() and FlatSizeSkipDim(). -template -inline int MatchingFlatSizeSkipDim(const Dims& dims, int skip_dim, - const Dims& check_dims_0) { - for (int i = 0; i < N; ++i) { - if (i != skip_dim) { - TFLITE_DCHECK_EQ(ArraySize(dims, i), ArraySize(check_dims_0, i)); - } - } - return FlatSizeSkipDim(dims, skip_dim); -} - -template -inline int MatchingFlatSizeSkipDim(const Dims& dims, int skip_dim, - const Dims& check_dims_0, - const Dims& check_dims_1) { - for (int i = 0; i < N; ++i) { - if (i != skip_dim) { - TFLITE_DCHECK_EQ(ArraySize(dims, i), ArraySize(check_dims_0, i)); - } - } - return MatchingFlatSizeSkipDim(dims, skip_dim, check_dims_1); -} - -template -inline int MatchingFlatSizeSkipDim(const Dims& dims, int skip_dim, - const Dims& check_dims_0, - const Dims& check_dims_1, - const Dims& check_dims_2) { - for (int i = 0; i < N; ++i) { - if (i != skip_dim) { - TFLITE_DCHECK_EQ(ArraySize(dims, i), ArraySize(check_dims_0, i)); - } - } - return MatchingFlatSizeSkipDim(dims, skip_dim, check_dims_1, check_dims_2); -} - -template -inline int MatchingFlatSizeSkipDim(const Dims& dims, int skip_dim, - const Dims& check_dims_0, - const Dims& check_dims_1, - const Dims& check_dims_2, - const Dims& check_dims_3) { - for (int i = 0; i < N; ++i) { - if (i != skip_dim) { - TFLITE_DCHECK_EQ(ArraySize(dims, i), ArraySize(check_dims_0, i)); - } - } - return MatchingFlatSizeSkipDim(dims, skip_dim, check_dims_1, check_dims_2, - check_dims_3); -} - -// Data is required to be contiguous, and so many operators can use either the -// full array flat size or the flat size with one dimension skipped (commonly -// the depth). -inline int FlatSizeSkipDim(const RuntimeShape& shape, int skip_dim) { - const int dims_count = shape.DimensionsCount(); - TFLITE_DCHECK(skip_dim >= 0 && skip_dim < dims_count); - const auto* dims_data = shape.DimsData(); - int flat_size = 1; - for (int i = 0; i < dims_count; ++i) { - flat_size *= (i == skip_dim) ? 1 : dims_data[i]; - } - return flat_size; -} - -// A combination of MatchingFlatSize() and FlatSizeSkipDim(). -inline int MatchingFlatSizeSkipDim(const RuntimeShape& shape, int skip_dim, - const RuntimeShape& check_shape_0) { - const int dims_count = shape.DimensionsCount(); - for (int i = 0; i < dims_count; ++i) { - if (i != skip_dim) { - TFLITE_DCHECK_EQ(shape.Dims(i), check_shape_0.Dims(i)); - } - } - return FlatSizeSkipDim(shape, skip_dim); -} - -inline int MatchingFlatSizeSkipDim(const RuntimeShape& shape, int skip_dim, - const RuntimeShape& check_shape_0, - const RuntimeShape& check_shape_1) { - const int dims_count = shape.DimensionsCount(); - for (int i = 0; i < dims_count; ++i) { - if (i != skip_dim) { - TFLITE_DCHECK_EQ(shape.Dims(i), check_shape_0.Dims(i)); - } - } - return MatchingFlatSizeSkipDim(shape, skip_dim, check_shape_1); -} - -inline int MatchingFlatSizeSkipDim(const RuntimeShape& shape, int skip_dim, - const RuntimeShape& check_shape_0, - const RuntimeShape& check_shape_1, - const RuntimeShape& check_shape_2) { - const int dims_count = shape.DimensionsCount(); - for (int i = 0; i < dims_count; ++i) { - if (i != skip_dim) { - TFLITE_DCHECK_EQ(shape.Dims(i), check_shape_0.Dims(i)); - } - } - return MatchingFlatSizeSkipDim(shape, skip_dim, check_shape_1, check_shape_2); -} - -inline int MatchingFlatSizeSkipDim(const RuntimeShape& shape, int skip_dim, - const RuntimeShape& check_shape_0, - const RuntimeShape& check_shape_1, - const RuntimeShape& check_shape_2, - const RuntimeShape& check_shape_3) { - const int dims_count = shape.DimensionsCount(); - for (int i = 0; i < dims_count; ++i) { - if (i != skip_dim) { - TFLITE_DCHECK_EQ(shape.Dims(i), check_shape_0.Dims(i)); - } - } - return MatchingFlatSizeSkipDim(shape, skip_dim, check_shape_1, check_shape_2, - check_shape_3); -} - -template -bool IsPackedWithoutStrides(const Dims& dims) { - int expected_stride = 1; - for (int d = 0; d < N; d++) { - if (dims.strides[d] != expected_stride) return false; - expected_stride *= dims.sizes[d]; - } - return true; -} - -template -void ComputeStrides(Dims* dims) { - dims->strides[0] = 1; - for (int d = 1; d < N; d++) { - dims->strides[d] = dims->strides[d - 1] * dims->sizes[d - 1]; - } -} - -enum class BroadcastableOpCategory : uint8_t { - kNone, - kNonBroadcast, // Matching input shapes. - kFirstInputBroadcastsFast, // Fivefold nested loops. - kSecondInputBroadcastsFast, // Fivefold nested loops. - kGenericBroadcast, // Fall-back. -}; - -struct MinMax { - float min; - float max; -}; -static_assert(sizeof(MinMax) == 8, ""); - -struct ActivationParams { - FusedActivationFunctionType activation_type; - // uint8_t, etc, activation params. - int32_t quantized_activation_min; - int32_t quantized_activation_max; -}; - -struct ReluParams : public ActivationParams { - int32_t input_offset; - int32_t output_offset; - int32_t output_multiplier; - int output_shift; -}; - -// Styles of resizing op usages. For example, kImageStyle can be used with a Pad -// op for pattern-specific optimization. -enum class ResizingCategory : uint8_t { - kNone, - kImageStyle, // 4D, operating on inner dimensions, say {0, a, b, 0}. - kGenericResize, -}; - -// For Add, Sub, Mul ops. -struct ArithmeticParams { - // Shape dependent / common to data / op types. - BroadcastableOpCategory broadcast_category; - // uint8_t inference params. - int32_t input1_offset; - int32_t input2_offset; - int32_t output_offset; - int32_t output_multiplier; - int output_shift; - // Add / Sub, not Mul, uint8_t inference params. - int left_shift; - int32_t input1_multiplier; - int input1_shift; - int32_t input2_multiplier; - int input2_shift; - - // TODO(b/158622529): Union the following activation params. - // uint8_t, etc, activation params. - int32_t quantized_activation_min; - int32_t quantized_activation_max; - // float activation params. - float float_activation_min; - float float_activation_max; - // int64_t activation params. - int64_t int64_activation_min; - int64_t int64_activation_max; - - // Processed output dimensions. - // Let input "a" be the one that broadcasts in the faster-changing dimension. - // Then, after coalescing, for shapes {a0, a1, a2, a3, a4} and - // {b0, b1, b2, b3, b4}, - // broadcast_shape[4] = b0 = a0. - // broadcast_shape[3] = b1; a1 = 1. - // broadcast_shape[2] = b2 = a2. - // broadcast_shape[1] = a3; b3 = 1. - // broadcast_shape[0] = b4 = a4. - int broadcast_shape[5]; -}; - -struct ConcatenationParams { - int8_t axis; - const int32_t* input_zeropoint; - const float* input_scale; - uint16_t inputs_count; - int32_t output_zeropoint; - float output_scale; -}; - -struct ComparisonParams { - // uint8_t inference params. - int left_shift; - int32_t input1_offset; - int32_t input1_multiplier; - int input1_shift; - int32_t input2_offset; - int32_t input2_multiplier; - int input2_shift; - // Shape dependent / common to inference types. - bool is_broadcast; -}; - -struct ConvParams { - PaddingType padding_type; - PaddingValues padding_values; - // TODO(starka): This was just "stride", so check that width+height is OK. - int16_t stride_width; - int16_t stride_height; - int16_t dilation_width_factor; - int16_t dilation_height_factor; - // uint8_t inference params. - // TODO(b/65838351): Use smaller types if appropriate. - int32_t input_offset; - int32_t weights_offset; - int32_t output_offset; - int32_t output_multiplier; - int output_shift; - // uint8_t, etc, activation params. - int32_t quantized_activation_min; - int32_t quantized_activation_max; - // float activation params. - float float_activation_min; - float float_activation_max; -}; - -struct DepthToSpaceParams { - int32_t block_size; -}; - -struct DepthwiseParams { - PaddingType padding_type; - PaddingValues padding_values; - int16_t stride_width; - int16_t stride_height; - int16_t dilation_width_factor; - int16_t dilation_height_factor; - int16_t depth_multiplier; - // uint8_t inference params. - // TODO(b/65838351): Use smaller types if appropriate. - int32_t input_offset; - int32_t weights_offset; - int32_t output_offset; - int32_t output_multiplier; - int output_shift; - // uint8_t, etc, activation params. - int32_t quantized_activation_min; - int32_t quantized_activation_max; - // float activation params. - float float_activation_min; - float float_activation_max; - const int32_t* output_multiplier_per_channel; - const int32_t* output_shift_per_channel; -}; - -struct DequantizationParams { - double scale; - int32_t zero_point; -}; - -struct PerChannelDequantizationParams { - const float* scale; - const int32_t* zero_point; - int32_t quantized_dimension; -}; - -struct FakeQuantParams { - MinMax minmax; - int32_t num_bits; -}; - -struct FullyConnectedParams { - // uint8_t inference params. - // TODO(b/65838351): Use smaller types if appropriate. - int32_t input_offset; - int32_t weights_offset; - int32_t output_offset; - int32_t output_multiplier; - int output_shift; - // uint8_t, etc, activation params. - int32_t quantized_activation_min; - int32_t quantized_activation_max; - // float activation params. - float float_activation_min; - float float_activation_max; - // Mark the operands as cacheable if they are unchanging, e.g. weights. - bool lhs_cacheable; - bool rhs_cacheable; - FullyConnectedWeightsFormat weights_format; -}; - -struct GatherParams { - int16_t axis; -}; - -struct L2NormalizationParams { - // uint8_t inference params. - int32_t input_zero_point; -}; - -struct LocalResponseNormalizationParams { - int32_t range; - double bias; - double alpha; - double beta; -}; - -struct HardSwishParams { - // zero_point of the input activations. - int16_t input_zero_point; - // zero_point of the output activations. - int16_t output_zero_point; - // 16bit fixed-point component of the multiplier to apply to go from the - // "high-res input scale", which is the input scale multiplied by 2^7, to the - // "relu-ish scale", which 3.0/32768. - // See the implementation of HardSwishPrepare. - int16_t reluish_multiplier_fixedpoint_int16; - // exponent/bit-shift component of the aforementioned multiplier. - int reluish_multiplier_exponent; - // 16bit fixed-point component of the multiplier to apply to go from the - // "high-res input scale", which is the input scale multiplied by 2^7, to the - // output scale. - // See the implementation of HardSwishPrepare. - int16_t output_multiplier_fixedpoint_int16; - // exponent/bit-shift component of the aforementioned multiplier. - int output_multiplier_exponent; -}; - -struct LogisticParams { - // uint8_t inference params. - int32_t input_zero_point; - int32_t input_range_radius; - int32_t input_multiplier; - int input_left_shift; -}; - -struct LstmCellParams { - int32_t weights_zero_point; - int32_t accum_multiplier; - int accum_shift; - int state_integer_bits; -}; - -struct MeanParams { - int8_t axis_count; - int16_t axis[4]; -}; - -struct PackParams { - int8_t axis; - const int32_t* input_zeropoint; - const float* input_scale; - uint16_t inputs_count; - int32_t output_zeropoint; - float output_scale; -}; - -struct PadParams { - int8_t left_padding_count; - int32_t left_padding[4]; - int8_t right_padding_count; - int32_t right_padding[4]; - ResizingCategory resizing_category; -}; - -struct PreluParams { - int32_t input_offset; - int32_t alpha_offset; - int32_t output_offset; - int32_t output_multiplier_1; - int output_shift_1; - int32_t output_multiplier_2; - int output_shift_2; -}; - -struct PoolParams { - FusedActivationFunctionType activation; - PaddingType padding_type; - PaddingValues padding_values; - int stride_height; - int stride_width; - int filter_height; - int filter_width; - // uint8_t, etc, activation params. - int32_t quantized_activation_min; - int32_t quantized_activation_max; - // float activation params. - float float_activation_min; - float float_activation_max; -}; - -struct ReshapeParams { - int8_t shape_count; - int32_t shape[4]; -}; - -struct ResizeBilinearParams { - bool align_corners; - // half_pixel_centers assumes pixels are of half the actual dimensions, and - // yields more accurate resizes. Corresponds to the same argument for the - // original TensorFlow op in TF2.0. - bool half_pixel_centers; -}; - -struct ResizeNearestNeighborParams { - bool align_corners; - bool half_pixel_centers; -}; - -struct SliceParams { - int8_t begin_count; - int32_t begin[4]; - int8_t size_count; - int32_t size[4]; -}; - -struct SoftmaxParams { - // beta is not really used (not a Tensorflow parameter) and not implemented - // for LogSoftmax. - double beta; - // uint8_t inference params. Used even when beta defaults to 1.0. - int32_t input_multiplier; - int32_t input_left_shift; - // Reverse scaling is only used by LogSoftmax. - int32_t reverse_scaling_divisor; - int32_t reverse_scaling_right_shift; - int diff_min; - int32_t zero_point; - float scale; - float* table; - // int16 LUT for exp(x), where x uniform distributed between [-10.0 , 0.0] - int16_t* exp_lut; - // int16 LUT for 1 / (1 + x), where x uniform distributed between [0.0 , 1.0] - int16_t* one_over_one_plus_x_lut; - uint8_t* uint8_table1; - uint8_t* uint8_table2; -}; - -struct SpaceToBatchParams { - // "Zero" padding for uint8_t means padding with the output offset. - int32_t output_offset; -}; - -struct SpaceToDepthParams { - int32_t block_size; -}; - -struct SplitParams { - // Graphs that split into, say, 2000 nodes are encountered. The indices in - // OperatorEdges are of type uint16_t. - uint16_t num_split; - int16_t axis; -}; - -struct SqueezeParams { - int8_t squeeze_dims_count; - int32_t squeeze_dims[4]; -}; - -struct StridedSliceParams { - int8_t start_indices_count; - int32_t start_indices[5]; - int8_t stop_indices_count; - int32_t stop_indices[5]; - int8_t strides_count; - int32_t strides[5]; - - int16_t begin_mask; - int16_t ellipsis_mask; - int16_t end_mask; - int16_t new_axis_mask; - int16_t shrink_axis_mask; -}; - -struct TanhParams { - int32_t input_zero_point; - int32_t input_range_radius; - int32_t input_multiplier; - int input_left_shift; -}; - -struct TransposeParams { - int8_t perm_count; - int32_t perm[5]; -}; - -struct UnpackParams { - uint16_t num_split; - int16_t axis; -}; - -struct LeakyReluParams { - float alpha; - int32_t input_offset; - int32_t output_offset; - int32_t output_multiplier_alpha; - int32_t output_shift_alpha; - int32_t output_multiplier_identity; - int32_t output_shift_identity; -}; - -template -inline void SetActivationParams(float min, float max, P* params) { - params->float_activation_min = min; - params->float_activation_max = max; -} - -template -inline void SetActivationParams(int32_t min, int32_t max, P* params) { - params->quantized_activation_min = min; - params->quantized_activation_max = max; -} - -template -inline void SetActivationParams(int64_t min, int64_t max, P* params) { - params->int64_activation_min = min; - params->int64_activation_max = max; -} - -template -inline void GetActivationParams(const P& params, int32_t* min, int32_t* max) { - *min = params.quantized_activation_min; - *max = params.quantized_activation_max; -} - -template -inline void GetActivationParams(const P& params, float* min, float* max) { - *min = params.float_activation_min; - *max = params.float_activation_max; -} - -template -inline void GetActivationParams(const P& params, int64_t* min, int64_t* max) { - *min = params.int64_activation_min; - *max = params.int64_activation_max; -} -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_INTERNAL_TYPES_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/kernel_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/kernel_util.h deleted file mode 100644 index 06f24b8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/kernel_util.h +++ /dev/null @@ -1,289 +0,0 @@ -/* Copyright 2017 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_KERNELS_KERNEL_UTIL_H_ -#define TENSORFLOW_LITE_KERNELS_KERNEL_UTIL_H_ - -#include - -#include - -#include "tensorflow/lite/c/builtin_op_data.h" -#include "tensorflow/lite/c/common.h" - -namespace tflite { - -// A fair number of functions in this header have historically been inline. -// It is ok to change functions to not be inline if the latency with -// benchmark_model for MobileNet + MobileBERT is unaffected. If such a change is -// made, move the newly non-inlined function declarations to the top of this -// header file. - -// Note: You must check if result is not null: -// -// TfLiteTensor* my_tensor = GetInput(context, node, kMyTensorIdx); -// TF_LITE_ENSURE(context, my_tensor != nullptr); -// -// This is because the index might point to the optional tensor constant -// (kTfLiteOptionalTensor) in which case there is no tensor to return. -const TfLiteTensor* GetInput(const TfLiteContext* context, - const TfLiteNode* node, int index); - -// Same as `GetInput` but returns boolean and uses output argument for tensor. -// -// TfLiteTensor* my_tensor; -// TF_LITE_ENSURE_OK(context, -// GetInputSafe(context, node, kMyTensorIdx, &my_tensor)); -// // can use my_tensor directly from here onwards, it is not nullptr -// -// Should be used in cases where the binary size is too large. -TfLiteStatus GetInputSafe(const TfLiteContext* context, const TfLiteNode* node, - int index, const TfLiteTensor** tensor); - -// Note: You must check if result is not null: -// -// TfLiteTensor* my_tensor = GetVariableInput(context, node, kMyTensorIdx); -// TF_LITE_ENSURE(context, my_tensor != nullptr); -// -// This is because the index might point to the optional tensor constant -// (kTfLiteOptionalTensor) in which case there is no tensor to return. -TfLiteTensor* GetVariableInput(TfLiteContext* context, const TfLiteNode* node, - int index); - -// Note: You must check if result is not null: -// -// TfLiteTensor* my_tensor = GetOutput(context, node, kMyTensorIdx); -// TF_LITE_ENSURE(context, my_tensor != nullptr); -// -// This is because the index might point to the optional tensor constant -// (kTfLiteOptionalTensor) in which case there is no tensor to return. -TfLiteTensor* GetOutput(TfLiteContext* context, const TfLiteNode* node, - int index); - -// Same as `GetOutput` but returns boolean and uses output argument for tensor. -// -// TfLiteTensor* my_tensor; -// TF_LITE_ENSURE_OK(context, -// GetOutputSafe(context, node, kMyTensorIdx, &my_tensor)); -// // can use my_tensor directly from here onwards, it is not nullptr -// -// Should be used in cases where the binary size is too large. -TfLiteStatus GetOutputSafe(const TfLiteContext* context, const TfLiteNode* node, - int index, TfLiteTensor** tensor); - -// Note: You must check if result is not null: -// -// TfLiteTensor* my_tensor = GetOptionalInputTensor(context, node, kIdx); -// TF_LITE_ENSURE(context, my_tensor != nullptr); -// -// This is because the index might point to the optional tensor constant -// (kTfLiteOptionalTensor) in which case there is no tensor to return. -// -// Deprecated. GetInput has the same functionality. -const TfLiteTensor* GetOptionalInputTensor(const TfLiteContext* context, - const TfLiteNode* node, int index); - -#ifndef TF_LITE_STATIC_MEMORY -// Note: You must check if result is not null: -// -// TfLiteTensor* my_tensor = GetTemporary(context, node, kMyTensorIdx); -// TF_LITE_ENSURE(context, my_tensor != nullptr); -// -// This is because the index might point to the optional tensor constant -// (kTfLiteOptionalTensor) in which case there is no tensor to return. -TfLiteTensor* GetTemporary(TfLiteContext* context, const TfLiteNode* node, - int index); - -// Same as `GetTemporary` but returns boolean and uses output argument for -// tensor. -// -// TfLiteTensor* my_tensor; -// TF_LITE_ENSURE_OK(context, -// GetTemporarySafe(context, node, kMyTensorIdx, -// &my_tensor)); -// // can use my_tensor directly from here onwards, it is not nullptr -// -// Should be used in cases where the binary size is too large. -TfLiteStatus GetTemporarySafe(const TfLiteContext* context, - const TfLiteNode* node, int index, - TfLiteTensor** tensor); - -// Note: You must check if result is not null: -// -// TfLiteTensor* my_tensor = GetIntermediates(context, node, kMyTensorIdx); -// TF_LITE_ENSURE(context, my_tensor != nullptr); -// -// This is because the index might point to the optional tensor constant -// (kTfLiteOptionalTensor) in which case there is no tensor to return. -const TfLiteTensor* GetIntermediates(TfLiteContext* context, - const TfLiteNode* node, int index); - -// Same as `GetIntermediates` but returns boolean and uses output argument for -// tensor. -// -// TfLiteTensor* my_tensor; -// TF_LITE_ENSURE_OK(context, -// GetIntermediatesSafe(context, node, kMyTensorIdx, -// &my_tensor)); -// // can use my_tensor directly from here onwards, it is not nullptr -// -// Should be used in cases where the binary size is too large. -TfLiteStatus GetIntermediatesSafe(const TfLiteContext* context, - const TfLiteNode* node, int index, - TfLiteTensor** tensor); -#endif // TF_LITE_STATIC_MEMORY - -inline int NumDimensions(const TfLiteTensor* t) { return t->dims->size; } -inline int SizeOfDimension(const TfLiteTensor* t, int dim) { - return t->dims->data[dim]; -} - -inline int NumInputs(const TfLiteNode* node) { return node->inputs->size; } -inline int NumOutputs(const TfLiteNode* node) { return node->outputs->size; } - -#ifndef TF_LITE_STATIC_MEMORY -inline int NumIntermediates(const TfLiteNode* node) { - return node->intermediates->size; -} -#endif // TF_LITE_STATIC_MEMORY - -inline int64_t NumElements(const TfLiteIntArray* dims) { - int64_t count = 1; - for (int i = 0; i < dims->size; ++i) { - count *= dims->data[i]; - } - return count; -} - -inline int64_t NumElements(const TfLiteTensor* t) { - return NumElements(t->dims); -} - -// Determines whether tensor is constant. -// TODO(b/138199592): Introduce new query which checks for constant OR -// persistent-read-only, which would be useful for most tensor kernels that -// are potentially dynamic based on the input tensor value availability at the -// time of prepare. -inline bool IsConstantTensor(const TfLiteTensor* tensor) { - return tensor->allocation_type == kTfLiteMmapRo; -} - -// Determines whether tensor is dynamic. Note that a tensor can be non-const and -// not dynamic. This function specifically checks for a dynamic tensor. -inline bool IsDynamicTensor(const TfLiteTensor* tensor) { - return tensor->allocation_type == kTfLiteDynamic; -} - -// Sets tensor to dynamic. -inline void SetTensorToDynamic(TfLiteTensor* tensor) { - if (tensor->allocation_type != kTfLiteDynamic) { - tensor->allocation_type = kTfLiteDynamic; - tensor->data.raw = nullptr; - } -} - -// Sets tensor to persistent and read-only. -inline void SetTensorToPersistentRo(TfLiteTensor* tensor) { - if (tensor->allocation_type != kTfLitePersistentRo) { - tensor->allocation_type = kTfLitePersistentRo; - tensor->data.raw = nullptr; - } -} - -// Determines whether it is a hybrid op - one that has float inputs and -// quantized weights. -inline bool IsHybridOp(const TfLiteTensor* input, const TfLiteTensor* weight) { - return ((weight->type == kTfLiteUInt8 || weight->type == kTfLiteInt8) && - input->type == kTfLiteFloat32); -} - -// Check dimensionality match and populate OpData for Conv and DepthwiseConv. -TfLiteStatus PopulateConvolutionQuantizationParams( - TfLiteContext* context, const TfLiteTensor* input, - const TfLiteTensor* filter, const TfLiteTensor* bias, TfLiteTensor* output, - const TfLiteFusedActivation& activation, int32_t* multiplier, int* shift, - int32_t* output_activation_min, int32_t* output_activation_max, - int32_t* per_channel_multiplier, int* per_channel_shift); - -TfLiteStatus PopulateConvolutionQuantizationParams( - TfLiteContext* context, const TfLiteTensor* input, - const TfLiteTensor* filter, const TfLiteTensor* bias, TfLiteTensor* output, - const TfLiteFusedActivation& activation, int32_t* multiplier, int* shift, - int32_t* output_activation_min, int32_t* output_activation_max, - int32_t* per_channel_multiplier, int* per_channel_shift, int num_channels); - -// Calculates the multiplication factor for a quantized convolution (or -// quantized depthwise convolution) involving the given tensors. Returns an -// error if the scales of the tensors are not compatible. -TfLiteStatus GetQuantizedConvolutionMultipler(TfLiteContext* context, - const TfLiteTensor* input, - const TfLiteTensor* filter, - const TfLiteTensor* bias, - TfLiteTensor* output, - double* multiplier); - -TfLiteStatus GetQuantizedConvolutionMultipler(TfLiteContext* context, - const TfLiteTensor* input, - const TfLiteTensor* filter, - TfLiteTensor* output, - double* multiplier); - -// Calculates the useful quantized range of an activation layer given its -// activation tensor. -TfLiteStatus CalculateActivationRangeQuantized(TfLiteContext* context, - TfLiteFusedActivation activation, - TfLiteTensor* output, - int32_t* act_min, - int32_t* act_max); - -// Calculates the useful range of an activation layer given its activation -// tensor.a -template -void CalculateActivationRange(TfLiteFusedActivation activation, - T* activation_min, T* activation_max) { - if (activation == kTfLiteActRelu) { - *activation_min = 0; - *activation_max = std::numeric_limits::max(); - } else if (activation == kTfLiteActRelu6) { - *activation_min = 0; - *activation_max = 6; - } else if (activation == kTfLiteActReluN1To1) { - *activation_min = -1; - *activation_max = 1; - } else { - *activation_min = std::numeric_limits::lowest(); - *activation_max = std::numeric_limits::max(); - } -} - -// Return true if the given tensors have the same shape. -bool HaveSameShapes(const TfLiteTensor* input1, const TfLiteTensor* input2); - -// Calculates the output_shape that is necessary for element-wise operations -// with broadcasting involving the two input tensors. -TfLiteStatus CalculateShapeForBroadcast(TfLiteContext* context, - const TfLiteTensor* input1, - const TfLiteTensor* input2, - TfLiteIntArray** output_shape); - -// Calculates the output_shape that is necessary for element-wise operations -// with broadcasting involving the three input tensors. -TfLiteStatus CalculateShapeForBroadcast(TfLiteContext* context, - const TfLiteTensor* input1, - const TfLiteTensor* input2, - const TfLiteTensor* input3, - TfLiteIntArray** output_shape); -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_KERNEL_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/lstm_eval.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/lstm_eval.h deleted file mode 100644 index 6e28662..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/lstm_eval.h +++ /dev/null @@ -1,228 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_LSTM_EVAL_H_ -#define TENSORFLOW_LITE_KERNELS_LSTM_EVAL_H_ - -#include -#include - -#include "tensorflow/lite/c/builtin_op_data.h" -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/cpu_backend_context.h" - -namespace tflite { -namespace ops { -namespace builtin { -namespace lstm_eval { - -// Pamameters for integer LSTM. -// Consider split this into two Integer Parameters if more fields are added. -struct IntegerLstmParameter { - int32_t effective_input_to_input_scale_a; - int32_t effective_input_to_input_scale_b; - int32_t effective_recurrent_to_input_scale_a; - int32_t effective_recurrent_to_input_scale_b; - int32_t effective_cell_to_input_scale_a; - int32_t effective_cell_to_input_scale_b; - int32_t effective_input_to_forget_scale_a; - int32_t effective_input_to_forget_scale_b; - int32_t effective_recurrent_to_forget_scale_a; - int32_t effective_recurrent_to_forget_scale_b; - int32_t effective_cell_to_forget_scale_a; - int32_t effective_cell_to_forget_scale_b; - int32_t effective_input_to_cell_scale_a; - int32_t effective_input_to_cell_scale_b; - int32_t effective_recurrent_to_cell_scale_a; - int32_t effective_recurrent_to_cell_scale_b; - int32_t effective_input_to_output_scale_a; - int32_t effective_input_to_output_scale_b; - int32_t effective_recurrent_to_output_scale_a; - int32_t effective_recurrent_to_output_scale_b; - int32_t effective_cell_to_output_scale_a; - int32_t effective_cell_to_output_scale_b; - int32_t effective_proj_scale_a; - int32_t effective_proj_scale_b; - int32_t effective_hidden_scale_a; - int32_t effective_hidden_scale_b; - int32_t layer_norm_input_scale_a; - int32_t layer_norm_input_scale_b; - int32_t layer_norm_forget_scale_a; - int32_t layer_norm_forget_scale_b; - int32_t layer_norm_cell_scale_a; - int32_t layer_norm_cell_scale_b; - int32_t layer_norm_output_scale_a; - int32_t layer_norm_output_scale_b; - // Quantized clip value for cell and projection. Zero value means no clipping. - int16_t quantized_cell_clip; - int8_t quantized_proj_clip; - int32_t hidden_zp; - int32_t cell_scale; - - int32_t input_variance_guard; - int32_t forget_variance_guard; - int32_t cell_variance_guard; - int32_t output_variance_guard; - - // Pre-calculate bias + zero_point * weight. - // Unabled to use temporary tensors since those are used in Prepare() and - // scratch buffer is only allocated after Preapre(). - std::unique_ptr input_to_forget_effective_bias; - std::unique_ptr recurrent_to_forget_effective_bias; - std::unique_ptr input_to_cell_effective_bias; - std::unique_ptr recurrent_to_cell_effective_bias; - std::unique_ptr input_to_output_effective_bias; - std::unique_ptr recurrent_to_output_effective_bias; - std::unique_ptr input_to_input_effective_bias; - std::unique_ptr recurrent_to_input_effective_bias; - std::unique_ptr projection_effective_bias; - - // Scale and zero point for intermediate tensors. - // Used only in the 8x8_8 case. - int32_t intermediate_scale_a[8]; - int32_t intermediate_scale_b[8]; - int32_t intermediate_zp[12]; -}; - -TfLiteStatus EvalFloat( - const TfLiteTensor* input, const TfLiteTensor* input_to_input_weights, - const TfLiteTensor* input_to_forget_weights, - const TfLiteTensor* input_to_cell_weights, - const TfLiteTensor* input_to_output_weights, - const TfLiteTensor* recurrent_to_input_weights, - const TfLiteTensor* recurrent_to_forget_weights, - const TfLiteTensor* recurrent_to_cell_weights, - const TfLiteTensor* recurrent_to_output_weights, - const TfLiteTensor* cell_to_input_weights, - const TfLiteTensor* cell_to_forget_weights, - const TfLiteTensor* cell_to_output_weights, - const TfLiteTensor* input_layer_norm_coefficients, - const TfLiteTensor* forget_layer_norm_coefficients, - const TfLiteTensor* cell_layer_norm_coefficients, - const TfLiteTensor* output_layer_norm_coefficients, - const TfLiteTensor* aux_input, - const TfLiteTensor* aux_input_to_input_weights, - const TfLiteTensor* aux_input_to_forget_weights, - const TfLiteTensor* aux_input_to_cell_weights, - const TfLiteTensor* aux_input_to_output_weights, - const TfLiteTensor* input_gate_bias, const TfLiteTensor* forget_gate_bias, - const TfLiteTensor* cell_gate_bias, const TfLiteTensor* output_gate_bias, - const TfLiteTensor* projection_weights, const TfLiteTensor* projection_bias, - const TfLiteLSTMParams* params, bool forward_sequence, bool time_major, - int output_offset, TfLiteTensor* scratch_buffer, TfLiteTensor* output_state, - TfLiteTensor* cell_state, TfLiteTensor* output); - -TfLiteStatus EvalHybrid( - const TfLiteTensor* input, const TfLiteTensor* input_to_input_weights, - const TfLiteTensor* input_to_input_weights_ledger, - const TfLiteTensor* input_to_forget_weights, - const TfLiteTensor* input_to_forget_weights_ledger, - const TfLiteTensor* input_to_cell_weights, - const TfLiteTensor* input_to_cell_weights_ledger, - const TfLiteTensor* input_to_output_weights, - const TfLiteTensor* input_to_output_weights_ledger, - const TfLiteTensor* recurrent_to_input_weights, - const TfLiteTensor* recurrent_to_input_weights_ledger, - const TfLiteTensor* recurrent_to_forget_weights, - const TfLiteTensor* recurrent_to_forget_weights_ledger, - const TfLiteTensor* recurrent_to_cell_weights, - const TfLiteTensor* recurrent_to_cell_weights_ledger, - const TfLiteTensor* recurrent_to_output_weights, - const TfLiteTensor* recurrent_to_output_weights_ledger, - const TfLiteTensor* cell_to_input_weights, - const TfLiteTensor* cell_to_forget_weights, - const TfLiteTensor* cell_to_output_weights, - const TfLiteTensor* input_layer_norm_coefficients, - const TfLiteTensor* forget_layer_norm_coefficients, - const TfLiteTensor* cell_layer_norm_coefficients, - const TfLiteTensor* output_layer_norm_coefficients, - const TfLiteTensor* aux_input, - const TfLiteTensor* aux_input_to_input_weights, - const TfLiteTensor* aux_input_to_forget_weights, - const TfLiteTensor* aux_input_to_cell_weights, - const TfLiteTensor* aux_input_to_output_weights, - const TfLiteTensor* input_gate_bias, const TfLiteTensor* forget_gate_bias, - const TfLiteTensor* cell_gate_bias, const TfLiteTensor* output_gate_bias, - const TfLiteTensor* projection_weights, - const TfLiteTensor* projection_weights_ledger, - const TfLiteTensor* projection_bias, const TfLiteLSTMParams* params, - bool forward_sequence, bool time_major, int output_offset, - TfLiteTensor* scratch_buffer, TfLiteTensor* input_sf, - TfLiteTensor* aux_input_sf, TfLiteTensor* output_state_sf, - TfLiteTensor* prod_scaling_factors, TfLiteTensor* recovered_cell_weights, - TfLiteTensor* input_quantized, TfLiteTensor* aux_input_quantized, - TfLiteTensor* output_state_quantized, TfLiteTensor* cell_state_quantized, - TfLiteTensor* output_state, TfLiteTensor* cell_state, - TfLiteTensor* output_scratch_buffer, TfLiteTensor* output, - TfLiteTensor* input_zp, TfLiteTensor* aux_input_zp, - TfLiteTensor* output_state_zp, TfLiteTensor* row_sums, int row_sums_size, - bool* compute_row_sums, CpuBackendContext* context); - -TfLiteStatus EvalInteger8x8_16( - const TfLiteTensor* input, const TfLiteTensor* input_to_input_weights, - const TfLiteTensor* input_to_forget_weights, - const TfLiteTensor* input_to_cell_weights, - const TfLiteTensor* input_to_output_weights, - const TfLiteTensor* recurrent_to_input_weights, - const TfLiteTensor* recurrent_to_forget_weights, - const TfLiteTensor* recurrent_to_cell_weights, - const TfLiteTensor* recurrent_to_output_weights, - const TfLiteTensor* cell_to_input_weights, - const TfLiteTensor* cell_to_forget_weights, - const TfLiteTensor* cell_to_output_weights, - const TfLiteTensor* input_layer_norm_coefficients, - const TfLiteTensor* forget_layer_norm_coefficients, - const TfLiteTensor* cell_layer_norm_coefficients, - const TfLiteTensor* output_layer_norm_coefficients, - const TfLiteTensor* input_gate_bias, const TfLiteTensor* forget_gate_bias, - const TfLiteTensor* cell_gate_bias, const TfLiteTensor* output_gate_bias, - const TfLiteTensor* projection_weights, const TfLiteTensor* projection_bias, - const TfLiteLSTMParams* params, bool forward_sequence, bool time_major, - const lstm_eval::IntegerLstmParameter* integer_lstm_param, - TfLiteTensor* output_state, TfLiteTensor* cell_state, TfLiteTensor* output, - TfLiteTensor* scratch0, TfLiteTensor* scratch1, TfLiteTensor* scratch2, - TfLiteTensor* scratch3, TfLiteTensor* scratch4, TfLiteTensor* scratch5, - CpuBackendContext* context); - -TfLiteStatus EvalInteger8x8_8( - const TfLiteTensor* input, const TfLiteTensor* input_to_input_weights, - const TfLiteTensor* input_to_forget_weights, - const TfLiteTensor* input_to_cell_weights, - const TfLiteTensor* input_to_output_weights, - const TfLiteTensor* recurrent_to_input_weights, - const TfLiteTensor* recurrent_to_forget_weights, - const TfLiteTensor* recurrent_to_cell_weights, - const TfLiteTensor* recurrent_to_output_weights, - const TfLiteTensor* cell_to_input_weights, - const TfLiteTensor* cell_to_forget_weights, - const TfLiteTensor* cell_to_output_weights, - const TfLiteTensor* input_layer_norm_coefficients, - const TfLiteTensor* forget_layer_norm_coefficients, - const TfLiteTensor* cell_layer_norm_coefficients, - const TfLiteTensor* output_layer_norm_coefficients, - const TfLiteTensor* input_gate_bias, const TfLiteTensor* forget_gate_bias, - const TfLiteTensor* cell_gate_bias, const TfLiteTensor* output_gate_bias, - const TfLiteTensor* projection_weights, const TfLiteTensor* projection_bias, - const TfLiteLSTMParams* params, TfLiteTensor* output_state, - TfLiteTensor* cell_state, TfLiteTensor* output, - const lstm_eval::IntegerLstmParameter* integer_lstm_param, - TfLiteTensor* scratch0, TfLiteTensor* scratch1, TfLiteTensor* scratch2, - TfLiteTensor* scratch3, TfLiteTensor* scratch4, TfLiteTensor* scratch5, - TfLiteTensor* scratch6, TfLiteTensor* scratch7); - -} // namespace lstm_eval -} // namespace builtin -} // namespace ops -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_LSTM_EVAL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/lstm_shared.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/lstm_shared.h deleted file mode 100644 index 0907be9..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/lstm_shared.h +++ /dev/null @@ -1,78 +0,0 @@ -/* 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_KERNELS_LSTM_SHARED_H_ -#define TENSORFLOW_LITE_KERNELS_LSTM_SHARED_H_ - -namespace tflite { -namespace ops { -namespace builtin { -namespace lstm { -// For full inputs kernel (24-inputs). -// Please note the 20-input full kernel is deprecated and only kept -// here for backward compatibility. -namespace full { - -// Input Tensors of size {n_batch, n_input} -constexpr int kInputTensor = 0; - -// Input weight tensors of size: {n_cell, n_input} -constexpr int kInputToInputWeightsTensor = 1; // Optional -constexpr int kInputToForgetWeightsTensor = 2; -constexpr int kInputToCellWeightsTensor = 3; -constexpr int kInputToOutputWeightsTensor = 4; - -// Recurrent weight tensors of size {n_cell, n_output} -constexpr int kRecurrentToInputWeightsTensor = 5; // Optional -constexpr int kRecurrentToForgetWeightsTensor = 6; -constexpr int kRecurrentToCellWeightsTensor = 7; -constexpr int kRecurrentToOutputWeightsTensor = 8; - -// Peephole weights tensors of size {n_cell}, representing a diagonal matrix. -constexpr int kCellToInputWeightsTensor = 9; // Optional -constexpr int kCellToForgetWeightsTensor = 10; // Optional -constexpr int kCellToOutputWeightsTensor = 11; // Optional - -// Gates bias tensors of size {n_cell} -constexpr int kInputGateBiasTensor = 12; // Optional -constexpr int kForgetGateBiasTensor = 13; -constexpr int kCellGateBiasTensor = 14; -constexpr int kOutputGateBiasTensor = 15; - -// Projection weight tensor of size {n_output, n_cell} -constexpr int kProjectionWeightsTensor = 16; // Optional -// Projection bias tensor of size {n_output} -constexpr int kProjectionBiasTensor = 17; // Optional - -// These state tensors are defined as variable tensors, and will be modified by -// this op. -constexpr int kOutputStateTensor = 18; -constexpr int kCellStateTensor = 19; - -// Layer norm coefficient tensors of size {n_cell}, representing a diagonal -// matrix. -constexpr int kInputLayerNormCoefficientsTensor = 20; // Optional -constexpr int kForgetLayerNormCoefficientsTensor = 21; // Optional -constexpr int kCellLayerNormCoefficientsTensor = 22; // Optional -constexpr int kOutputLayerNormCoefficientsTensor = 23; // Optional - -// Output tensors. -constexpr int kOutputTensor = 0; -} // namespace full - -} // namespace lstm -} // namespace builtin -} // namespace ops -} // namespace tflite -#endif // TENSORFLOW_LITE_KERNELS_LSTM_SHARED_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/op_macros.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/op_macros.h deleted file mode 100644 index 5786756..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/op_macros.h +++ /dev/null @@ -1,83 +0,0 @@ -/* Copyright 2017 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_KERNELS_OP_MACROS_H_ -#define TENSORFLOW_LITE_KERNELS_OP_MACROS_H_ - -// If we're on a platform without standard IO functions, fall back to a -// non-portable function. -#ifdef TF_LITE_MCU_DEBUG_LOG - -#include "tensorflow/lite/micro/debug_log.h" - -#define DEBUG_LOG(x) \ - do { \ - DebugLog(x); \ - } while (0) - -inline void InfiniteLoop() { - DEBUG_LOG("HALTED\n"); - while (1) { - } -} - -#define TFLITE_ABORT InfiniteLoop(); - -#else // TF_LITE_MCU_DEBUG_LOG - -#include -#include - -#define DEBUG_LOG(x) \ - do { \ - fprintf(stderr, "%s", (x)); \ - } while (0) - -// Report Error for unsupported type by op 'op_name' and returns kTfLiteError. -#define TF_LITE_UNSUPPORTED_TYPE(context, type, op_name) \ - do { \ - TF_LITE_KERNEL_LOG((context), "%s:%d Type %s is unsupported by op %s.", \ - __FILE__, __LINE__, TfLiteTypeGetName(type), \ - (op_name)); \ - return kTfLiteError; \ - } while (0) - -#define TFLITE_ABORT abort() - -#endif // TF_LITE_MCU_DEBUG_LOG - -#ifdef NDEBUG -#define TFLITE_ASSERT_FALSE (static_cast(0)) -#else -#define TFLITE_ASSERT_FALSE TFLITE_ABORT -#endif - -#define TF_LITE_FATAL(msg) \ - do { \ - DEBUG_LOG(msg); \ - DEBUG_LOG("\nFATAL\n"); \ - TFLITE_ABORT; \ - } while (0) - -#define TF_LITE_ASSERT(x) \ - do { \ - if (!(x)) TF_LITE_FATAL(#x); \ - } while (0) - -#define TF_LITE_ASSERT_EQ(x, y) \ - do { \ - if ((x) != (y)) TF_LITE_FATAL(#x " didn't equal " #y); \ - } while (0) - -#endif // TENSORFLOW_LITE_KERNELS_OP_MACROS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/padding.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/padding.h deleted file mode 100644 index 6b4ab7f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/padding.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2017 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_KERNELS_PADDING_H_ -#define TENSORFLOW_LITE_KERNELS_PADDING_H_ - -#include "tensorflow/lite/c/builtin_op_data.h" - -namespace tflite { - -// TODO(renjieliu): Migrate others to use ComputePaddingWithLeftover. -inline int ComputePadding(int stride, int dilation_rate, int in_size, - int filter_size, int out_size) { - int effective_filter_size = (filter_size - 1) * dilation_rate + 1; - int padding = ((out_size - 1) * stride + effective_filter_size - in_size) / 2; - return padding > 0 ? padding : 0; -} - -// It's not guaranteed that padding is symmetric. It's important to keep -// offset for algorithms need all paddings. -inline int ComputePaddingWithOffset(int stride, int dilation_rate, int in_size, - int filter_size, int out_size, - int* offset) { - int effective_filter_size = (filter_size - 1) * dilation_rate + 1; - int total_padding = - ((out_size - 1) * stride + effective_filter_size - in_size); - total_padding = total_padding > 0 ? total_padding : 0; - *offset = total_padding % 2; - return total_padding / 2; -} - -// Matching GetWindowedOutputSize in TensorFlow. -inline int ComputeOutSize(TfLitePadding padding, int image_size, - int filter_size, int stride, int dilation_rate = 1) { - int effective_filter_size = (filter_size - 1) * dilation_rate + 1; - - // TODO(b/186448822): This uses 0 since the function has no other way to - // report error case - if (stride == 0) return 0; - - switch (padding) { - case kTfLitePaddingSame: - return (image_size + stride - 1) / stride; - case kTfLitePaddingValid: - return (image_size + stride - effective_filter_size) / stride; - default: - return 0; - } -} - -inline TfLitePaddingValues ComputePaddingHeightWidth( - int stride_height, int stride_width, int dilation_rate_height, - int dilation_rate_width, int in_height, int in_width, int filter_height, - int filter_width, TfLitePadding padding, int* out_height, int* out_width) { - *out_width = ComputeOutSize(padding, in_width, filter_width, stride_width, - dilation_rate_width); - *out_height = ComputeOutSize(padding, in_height, filter_height, stride_height, - dilation_rate_height); - - TfLitePaddingValues padding_values; - int offset = 0; - padding_values.height = - ComputePaddingWithOffset(stride_height, dilation_rate_height, in_height, - filter_height, *out_height, &offset); - padding_values.height_offset = offset; - padding_values.width = - ComputePaddingWithOffset(stride_width, dilation_rate_width, in_width, - filter_width, *out_width, &offset); - padding_values.width_offset = offset; - return padding_values; -} -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_PADDING_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/register.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/register.h deleted file mode 100644 index f40798f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/register.h +++ /dev/null @@ -1,47 +0,0 @@ -/* Copyright 2017 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_KERNELS_REGISTER_H_ -#define TENSORFLOW_LITE_KERNELS_REGISTER_H_ - -#include "tensorflow/lite/model.h" // Legacy. -#include "tensorflow/lite/mutable_op_resolver.h" - -namespace tflite { -namespace ops { -namespace builtin { - -// This built-in op resolver provides a list of TfLite delegates that could be -// applied by TfLite interpreter by default. -class BuiltinOpResolver : public MutableOpResolver { - public: - BuiltinOpResolver(); - OpResolver::TfLiteDelegatePtrVector GetDelegates( - int num_threads) const override; -}; - -// TfLite interpreter could apply a TfLite delegate by default. To completely -// disable this behavior, one could choose to use the following class -// BuiltinOpResolverWithoutDefaultDelegates. -class BuiltinOpResolverWithoutDefaultDelegates : public BuiltinOpResolver { - public: - BuiltinOpResolverWithoutDefaultDelegates() : BuiltinOpResolver() {} - OpResolver::TfLiteDelegatePtrVector GetDelegates(int num_threads) const final; -}; - -} // namespace builtin -} // namespace ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_REGISTER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/register_ref.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/register_ref.h deleted file mode 100644 index 406fad8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/register_ref.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2018 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_KERNELS_REGISTER_REF_H_ -#define TENSORFLOW_LITE_KERNELS_REGISTER_REF_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/mutable_op_resolver.h" -#include "tensorflow/lite/schema/schema_generated.h" - -namespace tflite { -namespace ops { -namespace builtin { - -class BuiltinRefOpResolver : public MutableOpResolver { - public: - BuiltinRefOpResolver(); - - const TfLiteRegistration* FindOp(tflite::BuiltinOperator op, - int version) const override; - const TfLiteRegistration* FindOp(const char* op, int version) const override; -}; - -} // namespace builtin -} // namespace ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_REGISTER_REF_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/reshape_test_common.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/reshape_test_common.h deleted file mode 100644 index 662c163..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/reshape_test_common.h +++ /dev/null @@ -1,136 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_RESHAPE_TEST_COMMON_H_ -#define TENSORFLOW_LITE_KERNELS_RESHAPE_TEST_COMMON_H_ - -#include - -#include -#include -#include - -#include "tensorflow/lite/kernels/test_util.h" -#include "tensorflow/lite/schema/schema_generated.h" -#include "tensorflow/lite/string_type.h" - -namespace tflite { -// There are three ways to specify the output shape of a Reshape -// op. -enum class ShapeSpecificationType { - // The output shape is hardcoded in the ReshapeOptions object. - kAsReshapeOption, - // The output shape is specified as an input tensor, which is connected to a - // Const node, which is guaranteed not to change once inference starts. The - // shape is also hardcoded as in kAsReshapeOption. - kAsConstantTensor, - // The output shape is specified as an input tensor that can change based on - // external input. That is, the shape is not know before the inference - // starts. The shape is also hardcoded as in kAsReshapeOption. - kAsTensor, -}; - -template -class ReshapeOpModel : public BASE { - public: - ReshapeOpModel(std::initializer_list input_shape, - std::initializer_list shape_shape, - std::initializer_list shape_data, - ShapeSpecificationType shape_type) { - switch (shape_type) { - case ShapeSpecificationType::kAsTensor: - this->BuildWithTensorShape(input_shape, shape_shape, shape_data); - break; - case ShapeSpecificationType::kAsConstantTensor: - this->BuildWithConstantTensorShape(input_shape, shape_shape, - shape_data); - break; - case ShapeSpecificationType::kAsReshapeOption: - // In this case the shape of the new shape doesn't matter. It is - // always hardcoded as a flat vector. - this->BuildWithHardcodedShape(input_shape, shape_data); - break; - } - } - - void SetInput(std::vector data) { - this->template PopulateTensor(input_, data); - } - - void SetStringInput(std::initializer_list data) { - this->PopulateStringTensor(input_, data); - } - - std::vector GetOutput() { - return this->template ExtractVector(output_); - } - std::vector GetOutputShape() { return this->GetTensorShape(output_); } - - private: - void BuildWithHardcodedShape(std::initializer_list input_shape, - std::initializer_list shape_data) { - input_ = this->AddInput({GetTensorType(), input_shape}); - output_ = this->AddOutput(GetTensorType()); - this->SetBuiltinOp( - BuiltinOperator_RESHAPE, BuiltinOptions_ReshapeOptions, - CreateReshapeOptions( - this->builder_, - this->builder_.template CreateVector(shape_data)) - .Union()); - this->BuildInterpreter({this->GetShape(input_)}); - } - - void BuildWithTensorShape(std::initializer_list input_shape, - std::initializer_list shape_shape, - std::initializer_list shape_data) { - input_ = this->AddInput({GetTensorType(), input_shape}); - output_ = this->AddOutput(GetTensorType()); - int shape_input_tensor = this->AddInput({TensorType_INT32, shape_shape}); - // Note how shape also appears in ReshapeOptions - this->SetBuiltinOp( - BuiltinOperator_RESHAPE, BuiltinOptions_ReshapeOptions, - CreateReshapeOptions( - this->builder_, - this->builder_.template CreateVector(shape_data)) - .Union()); - this->BuildInterpreter( - {this->GetShape(input_), this->GetShape(shape_input_tensor)}); - if (shape_data.size() != 0) { - this->template PopulateTensor(shape_input_tensor, shape_data); - } - } - - void BuildWithConstantTensorShape(std::initializer_list input_shape, - std::initializer_list shape_shape, - std::initializer_list shape_data) { - input_ = this->AddInput({GetTensorType(), input_shape}); - output_ = this->AddOutput(GetTensorType()); - this->AddConstInput(TensorType_INT32, shape_data, shape_shape); - // Note how the shape also appears in the ReshapeOptions. - this->SetBuiltinOp( - BuiltinOperator_RESHAPE, BuiltinOptions_ReshapeOptions, - CreateReshapeOptions( - this->builder_, - this->builder_.template CreateVector(shape_data)) - .Union()); - this->BuildInterpreter({this->GetShape(input_)}); - } - - int input_; - int output_; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_RESHAPE_TEST_COMMON_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/subgraph_test_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/subgraph_test_util.h deleted file mode 100644 index 7306f82..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/subgraph_test_util.h +++ /dev/null @@ -1,128 +0,0 @@ -/* 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. -==============================================================================*/ - -// This module provides helper functions for testing the interaction between -// control flow ops and subgraphs. -// For convenience, we mostly only use `kTfLiteInt32` in this module. - -#ifndef TENSORFLOW_LITE_KERNELS_SUBGRAPH_TEST_UTIL_H_ -#define TENSORFLOW_LITE_KERNELS_SUBGRAPH_TEST_UTIL_H_ - -#include - -#include -#include - -#include -#include "tensorflow/lite/core/subgraph.h" -#include "tensorflow/lite/interpreter.h" - -namespace tflite { -namespace subgraph_test_util { - -// TODO(ycling): This file should be renamed as -// `control_flow_test_util` to avoid confusion. I'll do it immediately -// in a separated change. -class SubgraphBuilder { - public: - ~SubgraphBuilder(); - - // Build a subgraph with a single Add op. - // 2 inputs. 1 output. - void BuildAddSubgraph(Subgraph* subgraph); - - // Build a subgraph with a single Mul op. - // 2 inputs. 1 output. - void BuildMulSubgraph(Subgraph* subgraph); - - // Build a subgraph with a single Pad op. - // 2 inputs. 1 output. - void BuildPadSubgraph(Subgraph* subgraph); - - // Build a subgraph with a single If op. - // 3 inputs: - // The 1st input is condition with boolean type. - // The 2nd and 3rd inputs are feed input the branch subgraphs. - // 1 output. - void BuildIfSubgraph(Subgraph* subgraph); - - // Build a subgraph with a single Less op. - // The subgraph is used as the condition subgraph for testing `While` op. - // 2 inputs: - // The 1st input is a counter with `kTfLiteInt32` type. - // The 2nd input is ignored in this subgraph. - // 1 output with `kTfLiteBool` type. - // Equivalent to (input < rhs). - void BuildLessEqualCondSubgraph(Subgraph* subgraph, int rhs); - - // An accumulate loop body subgraph. Used to produce triangle number - // sequence. 2 inputs and 2 outputs - // Equivalent to (counter, value) -> (counter + 1, counter + 1 + value) - void BuildAccumulateLoopBodySubgraph(Subgraph* subgraph); - - // A pad loop body subgraph. When used in a loop it will repeatively enlarge - // the - // tensor. - // 2 inputs and 2 outputs. - // Equivalent to (counter, value) -> (counter + 1, tf.pad(value, padding)) - // Note the padding is created as a constant tensor. - void BuildPadLoopBodySubgraph(Subgraph* subgraph, - const std::vector padding); - - // Build a subgraph with a single While op. - // 2 inputs, 2 outputs. - void BuildWhileSubgraph(Subgraph* subgraph); - - private: - void CreateConstantInt32Tensor(Subgraph* subgraph, int tensor_index, - const std::vector& shape, - const std::vector& data); - std::vector buffers_; -}; - -class ControlFlowOpTest : public ::testing::Test { - public: - ControlFlowOpTest() - : interpreter_(new Interpreter), builder_(new SubgraphBuilder) {} - - ~ControlFlowOpTest() override { - interpreter_.reset(); - builder_.reset(); - } - - protected: - std::unique_ptr interpreter_; - std::unique_ptr builder_; -}; - -// Fill a `TfLiteTensor` with a 32-bits integer vector. -// Preconditions: -// * The tensor must have `kTfLiteInt32` type. -// * The tensor must be allocated. -// * The element count of the tensor must be equal to the length or -// the vector. -void FillIntTensor(TfLiteTensor* tensor, const std::vector& data); - -// Check if the shape and int32 data of a tensor is as expected. -void CheckIntTensor(const TfLiteTensor* tensor, const std::vector& shape, - const std::vector& data); -// Check if the shape and bool data of a tensor is as expected. -void CheckBoolTensor(const TfLiteTensor* tensor, const std::vector& shape, - const std::vector& data); - -} // namespace subgraph_test_util -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_SUBGRAPH_TEST_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/test_delegate_providers.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/test_delegate_providers.h deleted file mode 100644 index 668441c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/test_delegate_providers.h +++ /dev/null @@ -1,71 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_KERNELS_TEST_DELEGATE_PROVIDERS_H_ -#define TENSORFLOW_LITE_KERNELS_TEST_DELEGATE_PROVIDERS_H_ - -#include - -#include "tensorflow/lite/tools/delegates/delegate_provider.h" -#include "tensorflow/lite/tools/tool_params.h" - -namespace tflite { -// A utility class to provide TfLite delegate creations for kernel tests. The -// options of a particular delegate could be specified from commandline flags by -// using the delegate provider registrar as implemented in lite/tools/delegates -// directory. -class KernelTestDelegateProviders { - public: - // Returns a global KernelTestDelegateProviders instance. - static KernelTestDelegateProviders* Get(); - - KernelTestDelegateProviders(); - - // Initialize delegate-related parameters from commandline arguments and - // returns true if successful. - bool InitFromCmdlineArgs(int* argc, const char** argv); - - // This provides a way to overwrite parameter values programmatically before - // creating TfLite delegates. Note, changes to the returned ToolParams will - // have a global impact on creating TfLite delegates. - // If a local-only change is preferred, recommend using the following workflow - // create TfLite delegates via delegate providers: - // tools::ToolParams local_params; - // local_params.Merge(KernelTestDelegateProviders::Get()->ConstParams()); - // Overwrite params in local_params by calling local_params.Set<...>(...); - // Get TfLite delegates via - // KernelTestDelegateProviders::Get()->CreateAllDelegates(local_params); - tools::ToolParams* MutableParams() { return ¶ms_; } - const tools::ToolParams& ConstParams() const { return params_; } - - // Create a list of TfLite delegates based on the provided parameters - // `params`. - std::vector CreateAllDelegates( - const tools::ToolParams& params) const; - - // Similar to the above, but creating a list of TfLite delegates based on what - // have been initialized (i.e. 'params_'). - std::vector CreateAllDelegates() const { - return CreateAllDelegates(params_); - } - - private: - // Contain delegate-related parameters that are initialized from command-line - // flags. - tools::ToolParams params_; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_TEST_DELEGATE_PROVIDERS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/test_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/test_util.h deleted file mode 100644 index 9cd272f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/kernels/test_util.h +++ /dev/null @@ -1,1011 +0,0 @@ -/* Copyright 2017 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_KERNELS_TEST_UTIL_H_ -#define TENSORFLOW_LITE_KERNELS_TEST_UTIL_H_ - -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include "flatbuffers/flatbuffers.h" // from @flatbuffers -#include "tensorflow/core/platform/logging.h" -#include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/interpreter.h" -#include "tensorflow/lite/kernels/internal/tensor_utils.h" -#include "tensorflow/lite/schema/schema_generated.h" -#include "tensorflow/lite/string_type.h" -#include "tensorflow/lite/string_util.h" -#include "tensorflow/lite/testing/util.h" // IWYU pragma: keep -#include "tensorflow/lite/tools/optimize/quantization_utils.h" -#include "tensorflow/lite/tools/optimize/sparsity/format_converter.h" -#include "tensorflow/lite/type_to_tflitetype.h" - -namespace tflite { - -// A gmock matcher that check that elements of a float vector match to a given -// tolerance. -std::vector<::testing::Matcher> ArrayFloatNear( - const std::vector& values, float max_abs_error = 1e-5); - -// A gmock matcher that check that elements of a complex vector match to a given -// tolerance. -std::vector<::testing::Matcher>> ArrayComplex64Near( - const std::vector>& values, float max_abs_error = 1e-5); - -template -inline std::vector Quantize(const std::vector& data, float scale, - int32_t zero_point) { - std::vector q; - for (const auto& f : data) { - q.push_back(static_cast(std::max( - std::numeric_limits::min(), - std::min(std::numeric_limits::max(), - std::round(zero_point + (f / scale)))))); - } - return q; -} - -template -inline std::vector Dequantize(const std::vector& data, float scale, - int32_t zero_point) { - std::vector f; - f.reserve(data.size()); - for (const T& q : data) { - f.push_back(scale * (q - zero_point)); - } - return f; -} - -// A test model that contains a single operator. All operator inputs and -// output are external to the model, so the tests can directly access them. -// Typical usage: -// SingleOpModel m; -// int a = m.AddInput({TensorType_FLOAT32, a_shape}); -// int b = m.AddInput({TensorType_FLOAT32, b_shape}); -// int c = m.AddOutput({TensorType_FLOAT32, {}}); -// m.SetBuiltinOp(...); -// m.BuildInterpreter({GetShape(a), GetShape(b)}); -// m.PopulateTensor(a, {...}); -// m.PopulateTensor(b, {...}); -// m.Invoke(); -// EXPECT_THAT(m.ExtractVector(c), ArrayFloatNear({...})); -// - -// A helper struct to construct test tensors. This is particularly useful for -// quantized tensor which must have their scale and zero_point defined before -// the actual data is known. This mimics what happens in practice: quantization -// parameters are calculated during training or post training.. -struct TensorData { - // NOLINTNEXTLINE - TensorData(TensorType type = TensorType_FLOAT32, std::vector shape = {}, - float min = 0.0f, float max = 0.0f, float scale = 0.0f, - int32_t zero_point = 0, bool per_channel_quantization = false, - std::vector per_channel_quantization_scales = {}, - std::vector per_channel_quantization_offsets = {}, - int32_t channel_index = 0, std::vector traversal_order = {}, - std::vector format = {}, - std::vector block_size = {}, std::vector block_map = {}, - std::vector shape_signature = {}) - : type(type), - shape(shape), - min(min), - max(max), - scale(scale), - zero_point(zero_point), - per_channel_quantization(per_channel_quantization), - per_channel_quantization_scales( - std::move(per_channel_quantization_scales)), - per_channel_quantization_offsets( - std::move(per_channel_quantization_offsets)), - channel_index(channel_index), - traversal_order(traversal_order), - format(format), - block_size(block_size), - block_map(block_map), - shape_signature(shape_signature) {} - TensorType type; - std::vector shape; - float min; - float max; - float scale; - int32_t zero_point; - bool per_channel_quantization; - std::vector per_channel_quantization_scales; - std::vector per_channel_quantization_offsets; - int32_t channel_index; - std::vector traversal_order; - std::vector format; - std::vector block_size; - std::vector block_map; - std::vector shape_signature; -}; - -class SingleOpResolver : public OpResolver { - public: - SingleOpResolver(const BuiltinOperator op, TfLiteRegistration* registration, - int version = 1) - : op_(op), registration_(*registration) { - registration_.builtin_code = static_cast(op); - registration_.version = version; - } - const TfLiteRegistration* FindOp(BuiltinOperator op, - int version) const override { - if (op == op_) { - return ®istration_; - } - return nullptr; - } - const TfLiteRegistration* FindOp(const char* op, int version) const override { - return nullptr; - } - - private: - const BuiltinOperator op_; - TfLiteRegistration registration_; -}; - -class SingleOpModel { - public: - SingleOpModel() {} - ~SingleOpModel(); - - // Set a delegate that is applied right after graph is prepared. This is - // useful for testing other runtimes like NN API or GPU. - void SetDelegate(TfLiteDelegate* delegate) { delegate_ = delegate; } - - TfLiteStatus ApplyDelegate(); - - // Copying or assignment is disallowed to simplify ownership semantics. - SingleOpModel(const SingleOpModel&) = delete; - SingleOpModel& operator=(const SingleOpModel&) = delete; - - // Add a TensorType input tensor and return its index. - int AddInput(const TensorData& t); - int AddVariableInput(const TensorData& t); - - int AddIntermediate(TensorType type, const std::vector& scale, - const std::vector& zero_point); - - // Templated version of AddConstInput(). - template - int AddConstInput(const TensorData& t, std::initializer_list data) { - int id = 0; - if (t.per_channel_quantization) { - id = AddTensorPerChannelQuant(t, data); - } else { - id = AddTensor(t, data); - } - inputs_.push_back(id); - return id; - } - template - int AddConstInput(TensorType type, std::initializer_list data, - std::initializer_list shape) { - return AddConstInput(TensorData{type, shape}, data); - } - - // TODO(b/166202747): Use a better way to do type specialization. Reduce - // duplicate code in the two functions below. - int AddConstSparseInput(const TensorData& t, - const std::vector& data) { - int id = tensors_.size(); - const int dims_count = t.traversal_order.size(); - std::vector dense_data(data); - - tflite::optimize::sparsity::FormatConverter converter( - t.shape, t.traversal_order, t.format, t.block_size, t.block_map); - converter.DenseToSparse(dense_data.data()); - - const auto dim_metadata = converter.GetDimMetadata(); - const auto sparse_data = converter.GetData(); - - // Build sparsity parameter. - std::vector> fb_dim_metadata( - dims_count); - for (int i = 0; i < dims_count; i++) { - const int metadata_idx = 2 * i; - if (i < t.shape.size() && - t.format[t.traversal_order[i]] == kTfLiteDimSparseCSR) { - auto array_segments = - CreateInt32Vector(builder_, - builder_.CreateVector(dim_metadata[metadata_idx])) - .Union(); - auto array_indices = - CreateInt32Vector( - builder_, builder_.CreateVector(dim_metadata[metadata_idx + 1])) - .Union(); - fb_dim_metadata[i] = CreateDimensionMetadata( - builder_, DimensionType_SPARSE_CSR, 0, - SparseIndexVector_Int32Vector, array_segments, - SparseIndexVector_Int32Vector, array_indices); - } else { - fb_dim_metadata[i] = CreateDimensionMetadata( - builder_, DimensionType_DENSE, dim_metadata[metadata_idx][0]); - } - } - - flatbuffers::Offset s_param = CreateSparsityParameters( - builder_, builder_.CreateVector(t.traversal_order), - builder_.CreateVector(t.block_map), - builder_.CreateVector(fb_dim_metadata)); - - int buffer_id = 0; - if (!data.empty()) { - // Initialize buffers list with empty buffer to allow for non-const - // tensors. - if (buffers_.empty()) { - buffers_.push_back(CreateBuffer(builder_, builder_.CreateVector({}))); - } - - // Add compressed data as a Buffer to buffers list. - buffer_id = buffers_.size(); - auto data_buffer = builder_.CreateVector( - reinterpret_cast(sparse_data.data()), - sparse_data.size()); - buffers_.push_back(CreateBuffer(builder_, data_buffer)); - } - - tensors_.push_back(CreateTensor( - builder_, builder_.CreateVector(t.shape), t.type, - /*buffer=*/buffer_id, - /*name=*/0, /*quantization=*/0, /*is_variable=*/false, s_param)); - - inputs_.push_back(id); - tensor_data_[id] = t; - - return id; - } - - // Add a constant sparse tensor as input. - template - int AddConstSparseInput(const TensorData& t, const std::vector& data, - bool symmetric_quantize = false) { - int id = tensors_.size(); - const int dims_count = t.traversal_order.size(); - std::vector dense_data(data); - - tflite::optimize::sparsity::FormatConverter converter( - t.shape, t.traversal_order, t.format, t.block_size, t.block_map); - converter.DenseToSparse(dense_data.data()); - - const auto dim_metadata = converter.GetDimMetadata(); - const auto sparse_data = converter.GetData(); - - // Build sparsity parameter. - std::vector> fb_dim_metadata( - dims_count); - for (int i = 0; i < dims_count; i++) { - const int metadata_idx = 2 * i; - if (i < t.shape.size() && - t.format[t.traversal_order[i]] == kTfLiteDimSparseCSR) { - auto array_segments = - CreateInt32Vector(builder_, - builder_.CreateVector(dim_metadata[metadata_idx])) - .Union(); - auto array_indices = - CreateInt32Vector( - builder_, builder_.CreateVector(dim_metadata[metadata_idx + 1])) - .Union(); - fb_dim_metadata[i] = CreateDimensionMetadata( - builder_, DimensionType_SPARSE_CSR, 0, - SparseIndexVector_Int32Vector, array_segments, - SparseIndexVector_Int32Vector, array_indices); - } else { - fb_dim_metadata[i] = CreateDimensionMetadata( - builder_, DimensionType_DENSE, dim_metadata[metadata_idx][0]); - } - } - - flatbuffers::Offset s_param = CreateSparsityParameters( - builder_, builder_.CreateVector(t.traversal_order), - builder_.CreateVector(t.block_map), - builder_.CreateVector(fb_dim_metadata)); - - flatbuffers::Offset q_params = 0; - int buffer_id = 0; - if (!data.empty()) { - // Initialize buffers list with empty buffer to allow for non-const - // tensors. - if (buffers_.empty()) { - buffers_.push_back(CreateBuffer(builder_, builder_.CreateVector({}))); - } - - // Add compressed data as a Buffer to buffers list. - buffer_id = buffers_.size(); - if (symmetric_quantize) { - const int length = sparse_data.size(); - std::vector q(length); - float min, max, scaling_factor; - tensor_utils::SymmetricQuantizeFloats( - sparse_data.data(), length, q.data(), &min, &max, &scaling_factor); - q_params = CreateQuantizationParameters( - builder_, 0, 0, builder_.CreateVector({scaling_factor}), - builder_.CreateVector({0})); - auto data_buffer = builder_.CreateVector( - reinterpret_cast(q.data()), q.size()); - buffers_.push_back(CreateBuffer(builder_, data_buffer)); - } else { - auto data_buffer = builder_.CreateVector( - reinterpret_cast(sparse_data.data()), - sizeof(T) * sparse_data.size()); - buffers_.push_back(CreateBuffer(builder_, data_buffer)); - } - } - - tensors_.push_back( - CreateTensor(builder_, builder_.CreateVector(t.shape), - symmetric_quantize ? TensorType_INT8 : t.type, - /*buffer=*/buffer_id, - /*name=*/0, q_params, /*is_variable=*/false, s_param)); - - inputs_.push_back(id); - tensor_data_[id] = t; - - return id; - } - - // Add a null input tensor (optional input) and return kTfLiteOptionalTensor. - int AddNullInput(); - - // Add a TensorType output tensor and return its index. - int AddOutput(const TensorData& t); - - template - void QuantizeAndPopulate(int index, const std::vector& data) { - TfLiteTensor* t = interpreter_->tensor(index); - auto q = Quantize(data, t->params.scale, t->params.zero_point); - PopulateTensor(index, 0, q.data(), q.data() + q.size()); - } - - void SymmetricQuantizeAndPopulate(int index, const std::vector& data) { - std::vector q = QuantizeTensor(index, data); - PopulateTensor(index, /*offset=*/0, reinterpret_cast(q.data()), - reinterpret_cast(q.data() + q.size())); - } - - void SignedSymmetricQuantizeAndPopulate(int index, - const std::vector& data) { - std::vector q = QuantizeTensor(index, data); - PopulateTensor(index, /*offset=*/0, q.data(), q.data() + q.size()); - } - - // Quantize and populate data for filter with per channel quantization. - void PerChannelSymmetricQuantizeAndPopulate( - int index, const std::vector& input_data) { - TfLiteTensor* t = interpreter_->tensor(index); - auto* params = - reinterpret_cast(t->quantization.params); - const int channel_index = params->quantized_dimension; - - std::vector shape(t->dims->size); - for (size_t i = 0; i < shape.size(); ++i) { - shape[i] = t->dims->data[i]; - } - const int32_t num_inputs = input_data.size(); - const int32_t num_channel = shape[channel_index]; - std::vector quantized_output(num_inputs); - std::vector scales_inv(num_channel); - for (int i = 0; i < num_channel; ++i) { - const float scale = params->scale->size == 1 ? params->scale->data[0] - : params->scale->data[i]; - scales_inv[i] = 1.0f / scale; - } - optimize::utils::SymmetricPerChannelQuantizeValues( - input_data.data(), scales_inv, shape, channel_index, &quantized_output); - - PopulateTensor(index, /*offset=*/0, quantized_output.data(), - quantized_output.data() + quantized_output.size()); - } - - template - void PerChannelQuantizeBiasPopulateTensor( - const std::vector& input_data, int index, - TfLiteAffineQuantization* params) { - const int32_t num_inputs = input_data.size(); - std::vector quantized_output(num_inputs); - for (int i = 0; i < num_inputs; ++i) { - const float scale = params->scale->size == 1 ? params->scale->data[0] - : params->scale->data[i]; - quantized_output[i] = input_data[i] / scale; - } - } - - template - void PerChannelQuantizeBiasPopulateTensor( - int index, const std::vector& input_data, - const TfLiteAffineQuantization* params) { - const int32_t num_inputs = input_data.size(); - std::vector quantized_output(num_inputs); - for (int i = 0; i < num_inputs; ++i) { - const float scale = params->scale->size == 1 ? params->scale->data[0] - : params->scale->data[i]; - quantized_output[i] = input_data[i] / scale; - } - PopulateTensor(index, /*offset=*/0, quantized_output.data(), - quantized_output.data() + quantized_output.size()); - } - - // Quantize and populate data for bias with per channel quantization. - void PerChannelQuantizeBias(int index, const std::vector& input_data) { - TfLiteTensor* t = interpreter_->tensor(index); - auto* params = - reinterpret_cast(t->quantization.params); - CHECK(t->type == kTfLiteInt32 || t->type == kTfLiteInt64); - if (t->type == kTfLiteInt32) { - PerChannelQuantizeBiasPopulateTensor(index, input_data, params); - } else { - PerChannelQuantizeBiasPopulateTensor(index, input_data, params); - } - } - - const std::vector& GetShape(int id) { return tensor_data_.at(id).shape; } - - float GetScale(int id) { return tensor_data_.at(id).scale; } - int32_t GetZeroPoint(int id) { return tensor_data_.at(id).zero_point; } - - // Define the operator in this model. - void SetBuiltinOp(BuiltinOperator type, BuiltinOptions builtin_options_type, - flatbuffers::Offset builtin_options); - void SetCustomOp(const string& name, - const std::vector& custom_option, - const std::function& registration); - - // Allocate tensors and apply delegate. - // Note that this is called by default in BuiltInterpreter(). - void AllocateAndDelegate(bool apply_delegate); - - // Build the interpreter for this model. Also, resize and allocate all - // tensors given the shapes of the inputs. - // Note: 'apply_delegate' also serves to tell whether default TfLite delegates - // should be applied implicitly for a test case. For example, when testing the - // specific implementation of a TfLite delegate, it might be necessary to set - // this to false. - void BuildInterpreter(std::vector> input_shapes, - int num_threads, bool allow_fp32_relax_to_fp16, - bool apply_delegate, bool allocate_and_delegate = true); - - void BuildInterpreter(std::vector> input_shapes); - - // Executes inference, asserting success. - void Invoke(); - - // Executes inference *without* asserting success. - TfLiteStatus InvokeUnchecked(); - - void PopulateStringTensor(int index, const std::vector& content) { - auto tensor = interpreter_->tensor(index); - DynamicBuffer buf; - for (const string& s : content) { - buf.AddString(s.data(), s.length()); - } - buf.WriteToTensor(tensor, /*new_shape=*/nullptr); - } - - // Populate the tensor given its index. - // TODO(b/110696148) clean up and merge with vector-taking variant below. - template - void PopulateTensor(int index, const std::initializer_list& data) { - T* v = interpreter_->typed_tensor(index); - if (!v) { - auto* t = interpreter_->tensor(index); - CHECK(t) << "No tensor with index " << index << "."; - CHECK(t->data.raw) << "Empty data for tensor with index " << index << "."; - CHECK_EQ(t->type, typeToTfLiteType()) - << "Type mismatch for tensor with index " << index << ". Requested " - << TfLiteTypeGetName(typeToTfLiteType()) << ", got " - << TfLiteTypeGetName(t->type) << "."; - LOG(FATAL) << "Unknown tensor error."; - } - for (const T& f : data) { - *v = f; - ++v; - } - } - - // Populate the tensor given its index. - // TODO(b/110696148) clean up and merge with initializer_list-taking variant - // above. - template - void PopulateTensor(int index, const std::vector& data) { - T* v = interpreter_->typed_tensor(index); - if (!v) { - auto* t = interpreter_->tensor(index); - CHECK(t) << "No tensor with index " << index << "."; - CHECK(t->data.raw) << "Empty data for tensor with index " << index << "."; - CHECK_EQ(t->type, typeToTfLiteType()) - << "Type mismatch for tensor with index " << index << ". Requested " - << TfLiteTypeGetName(typeToTfLiteType()) << ", got " - << TfLiteTypeGetName(t->type) << "."; - LOG(FATAL) << "Unknown tensor error."; - } - for (const T& f : data) { - *v = f; - ++v; - } - } - - // Partially populate the tensor, starting at the given offset. - template - void PopulateTensor(int index, int offset, T* begin, T* end) { - T* v = interpreter_->typed_tensor(index); - if (!v) { - auto* t = interpreter_->tensor(index); - CHECK(t) << "No tensor with index " << index << "."; - CHECK(t->data.raw) << "Empty data for tensor with index " << index << "."; - CHECK(v) << "Type mismatch for tensor with index " << index - << ". Requested " << typeToTfLiteType() << ", got " - << t->type; - } - memcpy(v + offset, begin, (end - begin) * sizeof(T)); - } - - // Return a vector with the flattened contents of a tensor. - template - std::vector ExtractVector(int index) const { - const T* v = interpreter_->typed_tensor(index); - const auto* tensor = interpreter_->tensor(index); - CHECK(v) << "Could not extract vector at index: " << index; - int tensor_size; - if (tensor->sparsity) { - // Getting the size of the sparse buffer this way is based on the - // assumption that the last dimension of the tensor is a compressed - // dimension. - tensor_size = tensor->sparsity - ->dim_metadata[tensor->sparsity->dim_metadata_size - 1] - .array_indices->size; - } else { - tensor_size = GetTensorSize(index); - } - - return std::vector(v, v + tensor_size); - } - - // Return the TFLite model buffer, only available after BuildInterpreter. - const uint8_t* GetModelBuffer() { return builder_.GetBufferPointer(); } - - std::vector GetTensorShape(int index) { - std::vector result; - TfLiteTensor* t = interpreter_->tensor(index); - result.reserve(t->dims->size); - for (int i = 0; i < t->dims->size; ++i) { - result.push_back(t->dims->data[i]); - } - return result; - } - - void SetNumThreads(int num_threads) { - CHECK(interpreter_ != nullptr); - interpreter_->SetNumThreads(num_threads); - } - - void SetResolver(std::unique_ptr resolver) { - resolver_ = std::move(resolver); - } - - // Indicate whether the test has the NNAPI delegate applied. - static bool GetForceUseNnapi(); - int CountOpsExecutedByCpuKernel(); - - protected: - int32_t GetTensorSize(int index) const; - - flatbuffers::FlatBufferBuilder builder_; - std::unique_ptr interpreter_; - std::unique_ptr resolver_; - - std::vector> opcodes_; - std::vector> operators_; - std::map> custom_registrations_; - - template - int AddTensor(TensorData t, std::initializer_list data, - bool is_variable = false) { - int id = tensors_.size(); - - // This is slightly different depending on whether we are adding a - // quantized or a regular tensor. - bool is_quantized = (t.min != 0 || t.max != 0 || t.scale != 0); - - flatbuffers::Offset q_params = 0; - - if (is_quantized) { - if (t.min != 0 || t.max != 0) { - if (t.type == TensorType_UINT8) { - std::tie(t.scale, t.zero_point) = - QuantizationParams(t.min, t.max); - } else if (t.type == TensorType_INT8) { - std::tie(t.scale, t.zero_point) = - QuantizationParams(t.min, t.max); - } else if (t.type == TensorType_INT32) { - std::tie(t.scale, t.zero_point) = - QuantizationParams(t.min, t.max); - } else if (t.type == TensorType_INT16) { - std::tie(t.scale, t.zero_point) = - QuantizationParams(t.min, t.max); - } else { - LOG(FATAL) << "No support for the requested quantized type"; - } - t.min = 0; - t.max = 0; - } - - q_params = CreateQuantizationParameters( - builder_, /*min=*/0, /*max=*/0, - builder_.CreateVector({t.scale}), - builder_.CreateVector({t.zero_point})); - } - - int buffer_id = 0; - if (data.size()) { - // Initialize buffers list with empty buffer to allow for non-const - // tensors. - if (buffers_.empty()) { - buffers_.push_back(CreateBuffer(builder_, builder_.CreateVector({}))); - } - - // Add data as a Buffer to buffers list. - buffer_id = buffers_.size(); - auto data_buffer = - builder_.CreateVector(reinterpret_cast(data.begin()), - sizeof(T) * data.size()); - buffers_.push_back(CreateBuffer(builder_, data_buffer)); - } - - tensors_.push_back(CreateTensor( - builder_, builder_.CreateVector(t.shape), t.type, - /*buffer=*/buffer_id, - /*name=*/0, q_params, is_variable, - /*sparsity=*/0, builder_.CreateVector(t.shape_signature))); - - tensor_data_[id] = t; - - return id; - } - - private: - template - std::pair QuantizationParams(float f_min, float f_max) { - int32_t zero_point = 0; - float scale = 0; - const T qmin = std::numeric_limits::min(); - const T qmax = std::numeric_limits::max(); - const float qmin_double = qmin; - const float qmax_double = qmax; - // 0 should always be a representable value. Let's assume that the initial - // min,max range contains 0. - CHECK_LE(f_min, 0); - CHECK_GE(f_max, 0); - if (f_min == f_max) { - // Special case where the min,max range is a point. Should be {0}. - CHECK_EQ(f_min, 0); - CHECK_EQ(f_max, 0); - return {scale, zero_point}; - } - - // General case. - // - // First determine the scale. - scale = (f_max - f_min) / (qmax_double - qmin_double); - - // Zero-point computation. - // First the initial floating-point computation. The zero-point can be - // determined from solving an affine equation for any known pair - // (real value, corresponding quantized value). - // We know two such pairs: (rmin, qmin) and (rmax, qmax). - // The arithmetic error on the zero point computed from either pair - // will be roughly machine_epsilon * (sum of absolute values of terms) - // so we want to use the variant that adds the smaller terms. - const float zero_point_from_min = qmin_double - f_min / scale; - const float zero_point_from_max = qmax_double - f_max / scale; - - const float zero_point_from_min_error = - std::abs(qmin_double) + std::abs(f_min / scale); - - const float zero_point_from_max_error = - std::abs(qmax_double) + std::abs(f_max / scale); - - const float zero_point_double = - zero_point_from_min_error < zero_point_from_max_error - ? zero_point_from_min - : zero_point_from_max; - - // Now we need to nudge the zero point to be an integer - // (our zero points are integer, and this is motivated by the requirement - // to be able to represent the real value "0" exactly as a quantized value, - // which is required in multiple places, for example in Im2col with SAME - // padding). - - T nudged_zero_point = 0; - if (zero_point_double < qmin_double) { - nudged_zero_point = qmin; - } else if (zero_point_double > qmax_double) { - nudged_zero_point = qmax; - } else { - nudged_zero_point = static_cast(std::round(zero_point_double)); - } - - // The zero point should always be in the range of quantized value, - // // [qmin, qmax]. - CHECK_GE(nudged_zero_point, qmin); - CHECK_LE(nudged_zero_point, qmax); - - zero_point = nudged_zero_point; - // finally, return the values - return {scale, zero_point}; - } - - int AddTensorPerChannelQuant(const TensorData& t) { - // type does not matter when adding empty data. - return AddTensorPerChannelQuant(t, {}); - } - - template - int AddTensorPerChannelQuant(const TensorData& t, - const std::initializer_list& data) { - const int id = tensors_.size(); - flatbuffers::Offset q_params = 0; - q_params = CreateQuantizationParameters( - builder_, /*min=*/0, /*max=*/0, - /*scale=*/ - builder_.CreateVector(t.per_channel_quantization_scales), - /*zero point=*/ - builder_.CreateVector(t.per_channel_quantization_offsets), - QuantizationDetails_NONE, 0, t.channel_index); - - int buffer_id = 0; - if (data.size()) { - // Initialize buffers list with empty buffer to allow for non-const - // tensors. - if (buffers_.empty()) { - buffers_.push_back(CreateBuffer(builder_, builder_.CreateVector({}))); - } - - // Add data as a Buffer to buffers list. - buffer_id = buffers_.size(); - auto data_buffer = - builder_.CreateVector(reinterpret_cast(data.begin()), - sizeof(T) * data.size()); - buffers_.push_back(CreateBuffer(builder_, data_buffer)); - } - - tensors_.push_back( - CreateTensor(builder_, builder_.CreateVector(t.shape), t.type, - /*buffer=*/buffer_id, - /*name=*/0, q_params, /*is_variable=*/false)); - tensor_data_[id] = t; - return id; - } - - std::vector QuantizeTensor(int index, - const std::vector& data) { - TfLiteTensor* t = interpreter_->tensor(index); - const int length = data.size(); - std::vector q(length); - float min, max, scaling_factor; - tensor_utils::SymmetricQuantizeFloats(data.data(), length, q.data(), &min, - &max, &scaling_factor); - // Update quantization params. - t->params.scale = scaling_factor; - t->params.zero_point = 0; - // Populate the new quantization params. - TfLiteQuantizationFree(&t->quantization); - t->quantization.type = kTfLiteAffineQuantization; - auto* affine_quantization = reinterpret_cast( - malloc(sizeof(TfLiteAffineQuantization))); - affine_quantization->quantized_dimension = 0; - affine_quantization->scale = TfLiteFloatArrayCreate(1); - affine_quantization->zero_point = TfLiteIntArrayCreate(1); - affine_quantization->scale->data[0] = scaling_factor; - affine_quantization->zero_point->data[0] = 0; - t->quantization.params = affine_quantization; - return q; - } - - // Checks if acceleration has been done as expected. - // Currently supports only NNAPI. - // It verifies if the test was configured to run with NNAPI acceleration - // or not (SetForceUseNnapi(true)). - // In affirmative case it checks if: - // - the test case has been listed in the list of nnapi-accelerated cases - // - the test is running on a device (NNAPI has been loaded) - // - // The list of nnapi-accelerated test cases is a file containing regex to - // include or exclude specific test cases plus the minimum android SDK version - // the acceleration should be enabled for. For example: - // To enable the test BorderFloat in TopKV2OpTest only from - // android_sdk_version 29: - // - // TopKV2OpTest/BorderFloat,29 - // - // And to have it always excluded while enabling all other Float tests - // (the order of the rules is important, the first one matching is used): - // - // -TopKV2OpTest/BorderFloat - // TopKV2OpTest/.+Float - - void ValidateAcceleration(); - - // If the test was configured to use NNAPI and NNAPI was actually loaded, - // checks if the single operation in the model has been accelerated. - void ExpectOpAcceleratedWithNnapi(const std::string& test_id); - - std::map tensor_data_; - std::vector inputs_; - std::vector intermediates_; - std::vector outputs_; - std::vector> tensors_; - std::vector> buffers_; - TfLiteDelegate* delegate_ = nullptr; - int num_applied_delegates_ = 0; -}; - -// Populate string tensors. -template <> -inline void SingleOpModel::PopulateTensor( - int index, const std::initializer_list& data) { - PopulateStringTensor(index, data); -} - -// Base class for single op unit tests. -// The tests are parameterized to test multiple kernels for a single op. -// The parameters are strings like "optimized" and "reference" to have better -// readability in test reports. -// -// To use this class: -// * Define a constant map from strings to TfLiteRegistration. -// * Implement a test class that inherits SingleOpTest. -// * Instantiate the test cases with SingleOpTest::GetKernelTags helper -// function. -// * Call GetRegistration to get the TfLiteRegistration to be used before -// building the interpreter. -class SingleOpTest : public ::testing::TestWithParam { - public: - static std::vector GetKernelTags( - const std::map& kernel_map) { - std::vector tags; - tags.reserve(kernel_map.size()); - for (const auto& it : kernel_map) { - tags.push_back(it.first); - } - return tags; - } - - protected: - virtual const std::map& GetKernelMap() = 0; - TfLiteRegistration* GetRegistration() { - return GetKernelMap().at(GetParam()); - } -}; - -// Returns the corresponding TensorType given the type T. -template -TensorType GetTensorType() { - if (std::is_same::value) return TensorType_FLOAT32; - if (std::is_same::value) return TensorType_FLOAT16; - if (std::is_same::value) return TensorType_FLOAT64; - if (std::is_same::value) return TensorType_INT8; - if (std::is_same::value) return TensorType_INT16; - if (std::is_same::value) return TensorType_INT32; - if (std::is_same::value) return TensorType_INT64; - if (std::is_same::value) return TensorType_UINT8; - if (std::is_same::value) return TensorType_STRING; - if (std::is_same::value) return TensorType_BOOL; - return TensorType_MIN; // default value -} - -// Strings have a special implementation that is in test_util.cc -template <> -std::vector SingleOpModel::ExtractVector(int index) const; - -// The TypeUnion struct specializations hold a collection of related types. -// Each struct holds: 1. a primitive type (e.g. float), 2. a TensorType (e.g. -// TensorType_FLOAT32, and 3. a TfLiteType (e.g. kTfLiteFloat32). The latter -// two are actually enum values and not raw types, but these specializations -// make it easy to use gUnit Typed Test Suite: -// https://github.com/google/googletest/blob/master/googletest/docs/advanced.md#typed-tests -template -struct TypeUnion; - -template <> -struct TypeUnion { - public: - // NOLINTNEXTLINE - static constexpr TensorType tensor_type = TensorType::TensorType_FLOAT32; - // NOLINTNEXTLINE - static constexpr TfLiteType tflite_type = TfLiteType::kTfLiteFloat32; - typedef float ScalarType; -}; - -template <> -struct TypeUnion { - public: - // NOLINTNEXTLINE - static constexpr TensorType tensor_type = TensorType::TensorType_INT32; - // NOLINTNEXTLINE - static constexpr TfLiteType tflite_type = TfLiteType::kTfLiteInt32; - typedef int32_t ScalarType; -}; - -template <> -struct TypeUnion { - public: - // NOLINTNEXTLINE - static constexpr TensorType tensor_type = TensorType::TensorType_INT16; - // NOLINTNEXTLINE - static constexpr TfLiteType tflite_type = TfLiteType::kTfLiteInt16; - typedef int16_t ScalarType; -}; - -template <> -struct TypeUnion { - public: - // NOLINTNEXTLINE - static constexpr TensorType tensor_type = TensorType::TensorType_INT8; - // NOLINTNEXTLINE - static constexpr TfLiteType tflite_type = TfLiteType::kTfLiteInt8; - typedef int8_t ScalarType; -}; - -template <> -struct TypeUnion { - public: - // NOLINTNEXTLINE - static constexpr TensorType tensor_type = TensorType::TensorType_UINT8; - // NOLINTNEXTLINE - static constexpr TfLiteType tflite_type = TfLiteType::kTfLiteUInt8; - typedef uint8_t ScalarType; -}; - -class MultiOpModel : public SingleOpModel { - public: - MultiOpModel() : SingleOpModel() {} - ~MultiOpModel() {} - - void AddBuiltinOp(BuiltinOperator type, BuiltinOptions builtin_options_type, - const flatbuffers::Offset& builtin_options, - const std::vector& inputs, - const std::vector& outputs); - - void AddCustomOp(const string& name, - const std::vector& custom_option, - const std::function& registration, - const std::vector& inputs, - const std::vector& outputs); - - template - int AddInnerTensor(TensorData t) { - return AddTensor(t, {}, false); - } -}; -} // namespace tflite - -#endif // TENSORFLOW_LITE_KERNELS_TEST_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/memory_planner.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/memory_planner.h deleted file mode 100644 index e4b6aee..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/memory_planner.h +++ /dev/null @@ -1,66 +0,0 @@ -/* Copyright 2017 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_MEMORY_PLANNER_H_ -#define TENSORFLOW_LITE_MEMORY_PLANNER_H_ - -#include "tensorflow/lite/c/common.h" - -namespace tflite { - -// A MemoryPlanner is responsible for planning and executing a number of -// memory-related operations that are necessary in TF Lite. -class MemoryPlanner { - public: - virtual ~MemoryPlanner() {} - - // Plans the necessary memory allocations. This is the MemoryPlanner's - // pre-processing step and is called when the graph structure is known but - // actual size of the tensors is not. - virtual TfLiteStatus PlanAllocations() = 0; - - // Allocates the necessary memory to execute all nodes in the interval - // [first_node, last_node]. - virtual TfLiteStatus ExecuteAllocations(int first_node, int last_node) = 0; - - // Invalidates allocations made earlier. This is called when tensors sizes - // have changed. All planned allocations remain, but can't be used until - // ExecuteAllocations() is called. - virtual TfLiteStatus ResetAllocations() = 0; - - // Invalidates allocations after the given node execution. - virtual TfLiteStatus ResetAllocationsAfter(int node) = 0; - - // NOTE: The following two methods modify the data pointers for all tensors on - // the non-persistent arena (inputs, outputs, intermediates). If the user has - // manually set the pointers for any of these, they would need to be set - // again. - - // This releases memory allocated for non-persistent tensors. - // It does NOT clear the allocation plan, but the memory can't be used - // until AcquireNonPersistentMemory() is called. - // It is safe to call Reset/PlanAllocations after this method, without calling - // ReleaseTemporaryAllocations in case tensor sizes change. - virtual TfLiteStatus ReleaseNonPersistentMemory() = 0; - - // Allocates the necessary memory to contain non-persistent tensors. - virtual TfLiteStatus AcquireNonPersistentMemory() = 0; - - // Returns true if the non-persistent memory is available. - virtual bool HasNonPersistentMemory() = 0; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MEMORY_PLANNER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/all_ops_resolver.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/all_ops_resolver.h deleted file mode 100644 index e8105b9..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/all_ops_resolver.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2018 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_MICRO_ALL_OPS_RESOLVER_H_ -#define TENSORFLOW_LITE_MICRO_ALL_OPS_RESOLVER_H_ - -#include "tensorflow/lite/micro/compatibility.h" -#include "tensorflow/lite/micro/micro_mutable_op_resolver.h" - -namespace tflite { - -// The magic number in the template parameter is the maximum number of ops that -// can be added to AllOpsResolver. It can be increased if needed. And most -// applications that care about the memory footprint will want to directly use -// MicroMutableOpResolver and have an application specific template parameter. -// The examples directory has sample code for this. -class AllOpsResolver : public MicroMutableOpResolver<128> { - public: - AllOpsResolver(); - - private: - TF_LITE_REMOVE_VIRTUAL_DELETE -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_ALL_OPS_RESOLVER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/benchmarks/keyword_scrambled_model_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/benchmarks/keyword_scrambled_model_data.h deleted file mode 100644 index ce34426..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/benchmarks/keyword_scrambled_model_data.h +++ /dev/null @@ -1,22 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_BENCHMARKS_KEYWORD_SCRAMBLED_MODEL_DATA_H_ -#define TENSORFLOW_LITE_MICRO_BENCHMARKS_KEYWORD_SCRAMBLED_MODEL_DATA_H_ - -extern const unsigned char g_keyword_scrambled_model_data[]; -extern const unsigned int g_keyword_scrambled_model_data_length; - -#endif // TENSORFLOW_LITE_MICRO_BENCHMARKS_KEYWORD_SCRAMBLED_MODEL_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/benchmarks/micro_benchmark.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/benchmarks/micro_benchmark.h deleted file mode 100644 index 83b5cbb..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/benchmarks/micro_benchmark.h +++ /dev/null @@ -1,118 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_BENCHMARKS_MICRO_BENCHMARK_H_ -#define TENSORFLOW_LITE_MICRO_BENCHMARKS_MICRO_BENCHMARK_H_ - -#include - -#include "tensorflow/lite/micro/micro_error_reporter.h" -#include "tensorflow/lite/micro/micro_interpreter.h" -#include "tensorflow/lite/micro/micro_op_resolver.h" -#include "tensorflow/lite/micro/micro_time.h" - -namespace micro_benchmark { -extern tflite::ErrorReporter* reporter; -} // namespace micro_benchmark - -#define TF_LITE_MICRO_BENCHMARKS_BEGIN \ - namespace micro_benchmark { \ - tflite::ErrorReporter* reporter; \ - } \ - \ - int main(int argc, char** argv) { \ - tflite::MicroErrorReporter error_reporter; \ - micro_benchmark::reporter = &error_reporter; \ - int32_t start_ticks; \ - int32_t duration_ticks; \ - int32_t duration_ms; - -#define TF_LITE_MICRO_BENCHMARKS_END \ - return 0; \ - } - -#define TF_LITE_MICRO_BENCHMARK(func) \ - if (tflite::ticks_per_second() == 0) { \ - TF_LITE_REPORT_ERROR(micro_benchmark::reporter, \ - "no timer implementation found"); \ - return 0; \ - } \ - start_ticks = tflite::GetCurrentTimeTicks(); \ - func; \ - duration_ticks = tflite::GetCurrentTimeTicks() - start_ticks; \ - if (duration_ticks > INT_MAX / 1000) { \ - duration_ms = duration_ticks / (tflite::ticks_per_second() / 1000); \ - } else { \ - duration_ms = (duration_ticks * 1000) / tflite::ticks_per_second(); \ - } \ - micro_benchmark::reporter->Report("%s took %d ticks (%d ms)", #func, \ - duration_ticks, duration_ms); - -template -class MicroBenchmarkRunner { - public: - // The lifetimes of model, op_resolver and tensor_arena must exceed that of - // the created MicroBenchmarkRunner object. - MicroBenchmarkRunner(const uint8_t* model, - const tflite::MicroOpResolver* op_resolver, - uint8_t* tensor_arena, int tensor_arena_size) - : model_(tflite::GetModel(model)), - reporter_(µ_reporter_), - interpreter_(model_, *op_resolver, tensor_arena, tensor_arena_size, - reporter_) { - interpreter_.AllocateTensors(); - } - - void RunSingleIteration() { - // Run the model on this input and make sure it succeeds. - TfLiteStatus invoke_status = interpreter_.Invoke(); - if (invoke_status != kTfLiteOk) { - TF_LITE_REPORT_ERROR(reporter_, "Invoke failed."); - } - } - - void SetRandomInput(const int random_seed) { - // The pseudo-random number generator is initialized to a constant seed - std::srand(random_seed); - TfLiteTensor* input = interpreter_.input(0); - - // Pre-populate input tensor with random values. - int input_length = input->bytes / sizeof(inputT); - inputT* input_values = tflite::GetTensorData(input); - for (int i = 0; i < input_length; i++) { - // Pre-populate input tensor with a random value based on a constant seed. - input_values[i] = static_cast( - std::rand() % (std::numeric_limits::max() - - std::numeric_limits::min() + 1)); - } - } - - void SetInput(const inputT* custom_input) { - TfLiteTensor* input = interpreter_.input(0); - inputT* input_buffer = tflite::GetTensorData(input); - int input_length = input->bytes / sizeof(inputT); - for (int i = 0; i < input_length; i++) { - input_buffer[i] = custom_input[i]; - } - } - - private: - const tflite::Model* model_; - tflite::MicroErrorReporter micro_reporter_; - tflite::ErrorReporter* reporter_; - tflite::MicroInterpreter interpreter_; -}; - -#endif // TENSORFLOW_LITE_MICRO_BENCHMARKS_MICRO_BENCHMARK_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/compatibility.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/compatibility.h deleted file mode 100644 index 49acb28..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/compatibility.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2018 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_MICRO_COMPATIBILITY_H_ -#define TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_ - -// C++ will automatically create class-specific delete operators for virtual -// objects, which by default call the global delete function. For embedded -// applications we want to avoid this, and won't be calling new/delete on these -// objects, so we need to override the default implementation with one that does -// nothing to avoid linking in ::delete(). -// This macro needs to be included in all subclasses of a virtual base class in -// the private section. -#ifdef TF_LITE_STATIC_MEMORY -#define TF_LITE_REMOVE_VIRTUAL_DELETE \ - void operator delete(void* p) {} -#else -#define TF_LITE_REMOVE_VIRTUAL_DELETE -#endif - -#endif // TENSORFLOW_LITE_MICRO_COMPATIBILITY_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/debug_log.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/debug_log.h deleted file mode 100644 index c2840d0..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/debug_log.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2018 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_MICRO_DEBUG_LOG_H_ -#define TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_ - -#ifdef __cplusplus -extern "C" { -#endif // __cplusplus - -// This function should be implemented by each target platform, and provide a -// way for strings to be output to some text stream. For more information, see -// tensorflow/lite/micro/debug_log.cc. -void DebugLog(const char* s); - -#ifdef __cplusplus -} // extern "C" -#endif // __cplusplus - -#endif // TENSORFLOW_LITE_MICRO_DEBUG_LOG_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/constants.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/constants.h deleted file mode 100644 index f452893..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/constants.h +++ /dev/null @@ -1,32 +0,0 @@ -/* 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_MICRO_EXAMPLES_HELLO_WORLD_CONSTANTS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_CONSTANTS_H_ - -// This constant represents the range of x values our model was trained on, -// which is from 0 to (2 * Pi). We approximate Pi to avoid requiring additional -// libraries. -const float kXrange = 2.f * 3.14159265359f; - -// This constant determines the number of inferences to perform across the range -// of x values defined above. Since each inference takes time, the higher this -// number, the more time it will take to run through the entire range. The value -// of this constant can be tuned so that one full cycle takes a desired amount -// of time. Since different devices take different amounts of time to perform -// inference, this value should be defined per-device. -extern const int kInferencesPerCycle; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_CONSTANTS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/main_functions.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/main_functions.h deleted file mode 100644 index a1ea715..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/main_functions.h +++ /dev/null @@ -1,37 +0,0 @@ -/* 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_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_ - -// Expose a C friendly interface for main functions. -#ifdef __cplusplus -extern "C" { -#endif - -// Initializes all data needed for the example. The name is important, and needs -// to be setup() for Arduino compatibility. -void setup(); - -// Runs one iteration of data gathering and inference. This should be called -// repeatedly from the application code. The name needs to be loop() for Arduino -// compatibility. -void loop(); - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MAIN_FUNCTIONS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/model.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/model.h deleted file mode 100644 index 488f47b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/model.h +++ /dev/null @@ -1,31 +0,0 @@ -/* 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. -==============================================================================*/ - -// Automatically created from a TensorFlow Lite flatbuffer using the command: -// xxd -i model.tflite > model.cc - -// This is a standard TensorFlow Lite model file that has been converted into a -// C data array, so it can be easily compiled into a binary for devices that -// don't have a file system. - -// See train/README.md for a full description of the creation process. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MODEL_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MODEL_H_ - -extern const unsigned char g_model[]; -extern const int g_model_len; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_MODEL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/output_handler.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/output_handler.h deleted file mode 100644 index 14e9d70..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/hello_world/output_handler.h +++ /dev/null @@ -1,26 +0,0 @@ -/* 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_MICRO_EXAMPLES_HELLO_WORLD_OUTPUT_HANDLER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_OUTPUT_HANDLER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -// Called by the main loop to produce some output based on the x and y values -void HandleOutput(tflite::ErrorReporter* error_reporter, float x_value, - float y_value); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_HELLO_WORLD_OUTPUT_HANDLER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/image_provider.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/image_provider.h deleted file mode 100644 index b466796..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/image_provider.h +++ /dev/null @@ -1,41 +0,0 @@ -/* 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_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_IMAGE_PROVIDER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_IMAGE_PROVIDER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -TfLiteStatus InitCamera(tflite::ErrorReporter* error_reporter); - -// This is an abstraction around an image source like a camera, and is -// expected to return 8-bit sample data. The assumption is that this will be -// called in a low duty-cycle fashion in a low-power application. In these -// cases, the imaging sensor need not be run in a streaming mode, but rather can -// be idled in a relatively low-power mode between calls to GetImage(). The -// assumption is that the overhead and time of bringing the low-power sensor out -// of this standby mode is commensurate with the expected duty cycle of the -// application. The underlying sensor may actually be put into a streaming -// configuration, but the image buffer provided to GetImage should not be -// overwritten by the driver code until the next call to GetImage(); -// -// The reference implementation can have no platform-specific dependencies, so -// it just returns a static image. For real applications, you should -// ensure there's a specialized implementation that accesses hardware APIs. -TfLiteStatus GetImage(tflite::ErrorReporter* error_reporter, int image_width, - int image_height, int channels, uint8_t* image_data); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_IMAGE_PROVIDER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/image_recognition_model.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/image_recognition_model.h deleted file mode 100644 index a32dcd0..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/image_recognition_model.h +++ /dev/null @@ -1,27 +0,0 @@ -/* 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. -==============================================================================*/ - -// This is a standard TensorFlow Lite model file that has been converted into a -// C data array, so it can be easily compiled into a binary for devices that -// don't have a file system. It can be created using the command: -// xxd -i image_recognition_model.tflite > image_recognition_model.cc - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_IMAGE_RECOGNITION_MODEL_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_IMAGE_RECOGNITION_MODEL_H_ - -extern const unsigned char image_recognition_model_data[]; -extern const unsigned int image_recognition_model_data_len; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_IMAGE_RECOGNITION_MODEL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/stm32f746_discovery/display_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/stm32f746_discovery/display_util.h deleted file mode 100644 index b114812..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/stm32f746_discovery/display_util.h +++ /dev/null @@ -1,33 +0,0 @@ -/* 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_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_STM32F746_DISCOVERY_DISPLAY_UTIL_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_STM32F746_DISCOVERY_DISPLAY_UTIL_H_ - -#include - -void init_lcd(); - -void display_image_rgb888(int x_dim, int y_dim, const uint8_t* image_data, - int x_loc, int y_loc); - -void display_image_rgb565(int x_dim, int y_dim, const uint8_t* image_data, - int x_loc, int y_loc); - -void print_prediction(const char* prediction); - -void print_confidence(uint8_t max_score); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_STM32F746_DISCOVERY_DISPLAY_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/stm32f746_discovery/image_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/stm32f746_discovery/image_util.h deleted file mode 100644 index 5e8a7e6..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/stm32f746_discovery/image_util.h +++ /dev/null @@ -1,32 +0,0 @@ -/* 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_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_STM32F746_DISCOVERY_IMAGE_UTIL_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_STM32F746_DISCOVERY_IMAGE_UTIL_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -#define NUM_IN_CH 2 -#define IN_IMG_WIDTH 160 -#define IN_IMG_HEIGHT 120 - -void ResizeConvertImage(tflite::ErrorReporter* error_reporter, - int in_frame_width, int in_frame_height, - int num_in_channels, int out_frame_width, - int out_frame_height, int channels, - const uint8_t* in_frame, uint8_t* out_frame); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_STM32F746_DISCOVERY_IMAGE_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/util.h deleted file mode 100644 index 7927e1b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/image_recognition_experimental/util.h +++ /dev/null @@ -1,64 +0,0 @@ -/* 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_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_UTIL_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_UTIL_H_ - -#include -#include - -#define IMAGE_SIZE 3072 -#define CHANNEL_SIZE 1024 -#define R_CHANNEL_OFFSET 0 -#define G_CHANNEL_OFFSET CHANNEL_SIZE -#define B_CHANNEL_OFFSET (CHANNEL_SIZE * 2) - -int get_top_prediction(const uint8_t* predictions, int num_categories) { - int max_score = predictions[0]; - int guess = 0; - - for (int category_index = 1; category_index < num_categories; - category_index++) { - const uint8_t category_score = predictions[category_index]; - if (category_score > max_score) { - max_score = category_score; - guess = category_index; - } - } - - return guess; -} - -void reshape_cifar_image(uint8_t* image_data, int num_bytes) { - uint8_t temp_data[IMAGE_SIZE]; - - memcpy(temp_data, image_data, num_bytes); - - int k = 0; - for (int i = 0; i < CHANNEL_SIZE; i++) { - int r_ind = R_CHANNEL_OFFSET + i; - int g_ind = G_CHANNEL_OFFSET + i; - int b_ind = B_CHANNEL_OFFSET + i; - - image_data[k] = temp_data[r_ind]; - k++; - image_data[k] = temp_data[g_ind]; - k++; - image_data[k] = temp_data[b_ind]; - k++; - } -} - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_IMAGE_RECOGNITION_EXPERIMENTAL_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.h deleted file mode 100644 index 5174cc0..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/accelerometer_handler.h +++ /dev/null @@ -1,29 +0,0 @@ -/* 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_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_ - -#define kChannelNumber 3 - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -extern int begin_index; -extern TfLiteStatus SetupAccelerometer(tflite::ErrorReporter* error_reporter); -extern bool ReadAccelerometer(tflite::ErrorReporter* error_reporter, - float* input, int length); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/constants.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/constants.h deleted file mode 100644 index 3f0da6c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/constants.h +++ /dev/null @@ -1,38 +0,0 @@ -/* 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_MICRO_EXAMPLES_MAGIC_WAND_CONSTANTS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_CONSTANTS_H_ - -// The expected accelerometer data sample frequency -const float kTargetHz = 25; - -// What gestures are supported. -constexpr int kGestureCount = 4; -constexpr int kWingGesture = 0; -constexpr int kRingGesture = 1; -constexpr int kSlopeGesture = 2; -constexpr int kNoGesture = 3; - -// These control the sensitivity of the detection algorithm. If you're seeing -// too many false positives or not enough true positives, you can try tweaking -// these thresholds. Often, increasing the size of the training set will give -// more robust results though, so consider retraining if you are seeing poor -// predictions. -constexpr float kDetectionThreshold = 0.8f; -constexpr int kPredictionHistoryLength = 5; -constexpr int kPredictionSuppressionDuration = 25; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_CONSTANTS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/gesture_predictor.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/gesture_predictor.h deleted file mode 100644 index 713cb56..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/gesture_predictor.h +++ /dev/null @@ -1,21 +0,0 @@ -/* 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_MICRO_EXAMPLES_MAGIC_WAND_GESTURE_PREDICTOR_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_GESTURE_PREDICTOR_H_ - -extern int PredictGesture(float* output); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_GESTURE_PREDICTOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/magic_wand_model_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/magic_wand_model_data.h deleted file mode 100644 index 40a0b4d..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/magic_wand_model_data.h +++ /dev/null @@ -1,27 +0,0 @@ -/* 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. -==============================================================================*/ - -// This is a standard TensorFlow Lite model file that has been converted into a -// C data array, so it can be easily compiled into a binary for devices that -// don't have a file system. It was created using the command: -// xxd -i magic_wand_model.tflite > magic_wand_model_data.cc - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAGIC_WAND_MODEL_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAGIC_WAND_MODEL_DATA_H_ - -extern const unsigned char g_magic_wand_model_data[]; -extern const int g_magic_wand_model_data_len; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAGIC_WAND_MODEL_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/main_functions.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/main_functions.h deleted file mode 100644 index d69755b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/main_functions.h +++ /dev/null @@ -1,37 +0,0 @@ -/* 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_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_ - -// Expose a C friendly interface for main functions. -#ifdef __cplusplus -extern "C" { -#endif - -// Initializes all data needed for the example. The name is important, and needs -// to be setup() for Arduino compatibility. -void setup(); - -// Runs one iteration of data gathering and inference. This should be called -// repeatedly from the application code. The name needs to be loop() for Arduino -// compatibility. -void loop(); - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_MAIN_FUNCTIONS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/output_handler.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/output_handler.h deleted file mode 100644 index 7b85254..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/output_handler.h +++ /dev/null @@ -1,24 +0,0 @@ -/* 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_MICRO_EXAMPLES_MAGIC_WAND_OUTPUT_HANDLER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_OUTPUT_HANDLER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -void HandleOutput(tflite::ErrorReporter* error_reporter, int kind); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_OUTPUT_HANDLER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/ring_micro_features_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/ring_micro_features_data.h deleted file mode 100644 index 9cd02cd..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/ring_micro_features_data.h +++ /dev/null @@ -1,23 +0,0 @@ -/* 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_MICRO_EXAMPLES_MAGIC_WAND_RING_MICRO_FEATURES_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_RING_MICRO_FEATURES_DATA_H_ - -extern const int g_ring_micro_f9643d42_nohash_4_length; -extern const int g_ring_micro_f9643d42_nohash_4_dim; -extern const float g_ring_micro_f9643d42_nohash_4_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_RING_MICRO_FEATURES_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/slope_micro_features_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/slope_micro_features_data.h deleted file mode 100644 index 6ed0c3c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/slope_micro_features_data.h +++ /dev/null @@ -1,23 +0,0 @@ -/* 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_MICRO_EXAMPLES_MAGIC_WAND_SLOPE_MICRO_FEATURES_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_SLOPE_MICRO_FEATURES_DATA_H_ - -extern const int g_slope_micro_f2e59fea_nohash_1_length; -extern const int g_slope_micro_f2e59fea_nohash_1_dim; -extern const float g_slope_micro_f2e59fea_nohash_1_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_SLOPE_MICRO_FEATURES_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/zephyr_riscv/src/accelerometer_handler.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/zephyr_riscv/src/accelerometer_handler.h deleted file mode 100644 index 5b3fb54..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/magic_wand/zephyr_riscv/src/accelerometer_handler.h +++ /dev/null @@ -1,29 +0,0 @@ -/* 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_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_ - -#define kChannelNumber 3 - -#include "tensorflow/lite/c/c_api_internal.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -extern int begin_index; -extern TfLiteStatus SetupAccelerometer(tflite::ErrorReporter* error_reporter); -extern bool ReadAccelerometer(tflite::ErrorReporter* error_reporter, - float* input, int length, bool reset_buffer); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MAGIC_WAND_ACCELEROMETER_HANDLER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/CMSIS/hanning.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/CMSIS/hanning.h deleted file mode 100644 index eedd4c4..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/CMSIS/hanning.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright 2018 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_MICRO_EXAMPLES_MICRO_SPEECH_CMSIS_HANNING_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_CMSIS_HANNING_H_ - -#include - -extern const int g_hanning_size; -extern const int16_t g_hanning[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_CMSIS_HANNING_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/CMSIS/sin_1k.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/CMSIS/sin_1k.h deleted file mode 100644 index 41551cd..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/CMSIS/sin_1k.h +++ /dev/null @@ -1,24 +0,0 @@ -/* Copyright 2018 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_MICRO_EXAMPLES_MICRO_SPEECH_CMSIS_SIN_1K_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_CMSIS_SIN_1K_H_ - -#include - -extern const int g_sin_1k_size; -extern const int16_t g_sin_1k[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_CMSIS_SIN_1K_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/audio_provider.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/audio_provider.h deleted file mode 100644 index c51cc5f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/audio_provider.h +++ /dev/null @@ -1,46 +0,0 @@ -/* Copyright 2018 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_MICRO_EXAMPLES_MICRO_SPEECH_AUDIO_PROVIDER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_AUDIO_PROVIDER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -// This is an abstraction around an audio source like a microphone, and is -// expected to return 16-bit PCM sample data for a given point in time. The -// sample data itself should be used as quickly as possible by the caller, since -// to allow memory optimizations there are no guarantees that the samples won't -// be overwritten by new data in the future. In practice, implementations should -// ensure that there's a reasonable time allowed for clients to access the data -// before any reuse. -// The reference implementation can have no platform-specific dependencies, so -// it just returns an array filled with zeros. For real applications, you should -// ensure there's a specialized implementation that accesses hardware APIs. -TfLiteStatus GetAudioSamples(tflite::ErrorReporter* error_reporter, - int start_ms, int duration_ms, - int* audio_samples_size, int16_t** audio_samples); - -// Returns the time that audio data was last captured in milliseconds. There's -// no contract about what time zero represents, the accuracy, or the granularity -// of the result. Subsequent calls will generally not return a lower value, but -// even that's not guaranteed if there's an overflow wraparound. -// The reference implementation of this function just returns a constantly -// incrementing value for each call, since it would need a non-portable platform -// call to access time information. For real applications, you'll need to write -// your own platform-specific implementation. -int32_t LatestAudioTimestamp(); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_AUDIO_PROVIDER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/command_responder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/command_responder.h deleted file mode 100644 index ac3f448..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/command_responder.h +++ /dev/null @@ -1,32 +0,0 @@ -/* 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. -==============================================================================*/ - -// Provides an interface to take an action based on an audio command. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_COMMAND_RESPONDER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_COMMAND_RESPONDER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -// Called every time the results of an audio recognition run are available. The -// human-readable name of any recognized command is in the `found_command` -// argument, `score` has the numerical confidence, and `is_new_command` is set -// if the previous command was different to this one. -void RespondToCommand(tflite::ErrorReporter* error_reporter, - int32_t current_time, const char* found_command, - uint8_t score, bool is_new_command); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_COMMAND_RESPONDER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/esp/ringbuf.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/esp/ringbuf.h deleted file mode 100644 index 191afce..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/esp/ringbuf.h +++ /dev/null @@ -1,74 +0,0 @@ -/* 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_MICRO_EXAMPLES_MICRO_SPEECH_ESP_RINGBUF_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_ESP_RINGBUF_H_ - -#include -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -#define RB_FAIL ESP_FAIL -#define RB_ABORT -1 -#define RB_WRITER_FINISHED -2 -#define RB_READER_UNBLOCK -3 - -typedef struct ringbuf { - char *name; - uint8_t *base; /**< Original pointer */ - /* XXX: these need to be volatile? */ - uint8_t *volatile readptr; /**< Read pointer */ - uint8_t *volatile writeptr; /**< Write pointer */ - volatile ssize_t fill_cnt; /**< Number of filled slots */ - ssize_t size; /**< Buffer size */ - xSemaphoreHandle can_read; - xSemaphoreHandle can_write; - xSemaphoreHandle lock; - int abort_read; - int abort_write; - int writer_finished; // to prevent infinite blocking for buffer read - int reader_unblock; -} ringbuf_t; - -ringbuf_t *rb_init(const char *rb_name, uint32_t size); -void rb_abort_read(ringbuf_t *rb); -void rb_abort_write(ringbuf_t *rb); -void rb_abort(ringbuf_t *rb); -void rb_reset(ringbuf_t *rb); -/** - * @brief Special function to reset the buffer while keeping rb_write aborted. - * This rb needs to be reset again before being useful. - */ -void rb_reset_and_abort_write(ringbuf_t *rb); -void rb_stat(ringbuf_t *rb); -ssize_t rb_filled(ringbuf_t *rb); -ssize_t rb_available(ringbuf_t *rb); -int rb_read(ringbuf_t *rb, uint8_t *buf, int len, uint32_t ticks_to_wait); -int rb_write(ringbuf_t *rb, const uint8_t *buf, int len, - uint32_t ticks_to_wait); -void rb_cleanup(ringbuf_t *rb); -void rb_signal_writer_finished(ringbuf_t *rb); -void rb_wakeup_reader(ringbuf_t *rb); -int rb_is_writer_finished(ringbuf_t *rb); - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_ESP_RINGBUF_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/feature_provider.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/feature_provider.h deleted file mode 100644 index d086e01..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/feature_provider.h +++ /dev/null @@ -1,52 +0,0 @@ -/* Copyright 2018 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_MICRO_EXAMPLES_MICRO_SPEECH_FEATURE_PROVIDER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_FEATURE_PROVIDER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -// Binds itself to an area of memory intended to hold the input features for an -// audio-recognition neural network model, and fills that data area with the -// features representing the current audio input, for example from a microphone. -// The audio features themselves are a two-dimensional array, made up of -// horizontal slices representing the frequencies at one point in time, stacked -// on top of each other to form a spectrogram showing how those frequencies -// changed over time. -class FeatureProvider { - public: - // Create the provider, and bind it to an area of memory. This memory should - // remain accessible for the lifetime of the provider object, since subsequent - // calls will fill it with feature data. The provider does no memory - // management of this data. - FeatureProvider(int feature_size, int8_t* feature_data); - ~FeatureProvider(); - - // Fills the feature data with information from audio inputs, and returns how - // many feature slices were updated. - TfLiteStatus PopulateFeatureData(tflite::ErrorReporter* error_reporter, - int32_t last_time_in_ms, int32_t time_in_ms, - int* how_many_new_slices); - - private: - int feature_size_; - int8_t* feature_data_; - // Make sure we don't try to use cached information if this is the first call - // into the provider. - bool is_first_run_; -}; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_FEATURE_PROVIDER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/main_functions.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/main_functions.h deleted file mode 100644 index 0ac0677..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/main_functions.h +++ /dev/null @@ -1,37 +0,0 @@ -/* 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_MICRO_EXAMPLES_MICRO_SPEECH_MAIN_FUNCTIONS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MAIN_FUNCTIONS_H_ - -// Expose a C friendly interface for main functions. -#ifdef __cplusplus -extern "C" { -#endif - -// Initializes all data needed for the example. The name is important, and needs -// to be setup() for Arduino compatibility. -void setup(); - -// Runs one iteration of data gathering and inference. This should be called -// repeatedly from the application code. The name needs to be loop() for Arduino -// compatibility. -void loop(); - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MAIN_FUNCTIONS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_features_generator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_features_generator.h deleted file mode 100644 index 2930423..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_features_generator.h +++ /dev/null @@ -1,32 +0,0 @@ -/* 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_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MICRO_FEATURES_GENERATOR_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MICRO_FEATURES_GENERATOR_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -// Sets up any resources needed for the feature generation pipeline. -TfLiteStatus InitializeMicroFeatures(tflite::ErrorReporter* error_reporter); - -// Converts audio sample data into a more compact form that's appropriate for -// feeding into a neural network. -TfLiteStatus GenerateMicroFeatures(tflite::ErrorReporter* error_reporter, - const int16_t* input, int input_size, - int output_size, int8_t* output, - size_t* num_samples_read); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MICRO_FEATURES_GENERATOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h deleted file mode 100644 index e542213..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h +++ /dev/null @@ -1,43 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MICRO_MODEL_SETTINGS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MICRO_MODEL_SETTINGS_H_ - -// Keeping these as constant expressions allow us to allocate fixed-sized arrays -// on the stack for our working memory. - -// The size of the input time series data we pass to the FFT to produce the -// frequency information. This has to be a power of two, and since we're dealing -// with 30ms of 16KHz inputs, which means 480 samples, this is the next value. -constexpr int kMaxAudioSampleSize = 512; -constexpr int kAudioSampleFrequency = 16000; - -// The following values are derived from values used during model training. -// If you change the way you preprocess the input, update all these constants. -constexpr int kFeatureSliceSize = 40; -constexpr int kFeatureSliceCount = 49; -constexpr int kFeatureElementCount = (kFeatureSliceSize * kFeatureSliceCount); -constexpr int kFeatureSliceStrideMs = 20; -constexpr int kFeatureSliceDurationMs = 30; - -// Variables for the model's output categories. -constexpr int kSilenceIndex = 0; -constexpr int kUnknownIndex = 1; -// If you modify the output categories, you need to update the following values. -constexpr int kCategoryCount = 4; -extern const char* kCategoryLabels[kCategoryCount]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MICRO_MODEL_SETTINGS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/model.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/model.h deleted file mode 100644 index deec2d6..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/model.h +++ /dev/null @@ -1,27 +0,0 @@ -/* 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. -==============================================================================*/ - -// This is a standard TensorFlow Lite FlatBuffer model file that has been -// converted into a C data array, so it can be easily compiled into a binary -// for devices that don't have a file system. It was created using the command: -// xxd -i model.tflite > model.cc - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MODEL_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MODEL_H_ - -extern const unsigned char g_model[]; -extern const int g_model_len; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_MODEL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/no_feature_data_slice.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/no_feature_data_slice.h deleted file mode 100644 index 7c27379..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/no_feature_data_slice.h +++ /dev/null @@ -1,29 +0,0 @@ -/* 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. -==============================================================================*/ - -// This data was extracted from the larger feature data held in -// no_features_data.cc and consists of the 29th spectrogram slice of 43 values. -// This is the expected result of running the sample data in -// no_30ms_sample_data.cc through through the preprocessing pipeline. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_NO_FEATURE_DATA_SLICE_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_NO_FEATURE_DATA_SLICE_H_ - -#include - -constexpr int g_no_feature_data_slice_size = 40; -extern const int8_t g_no_feature_data_slice[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_NO_FEATURE_DATA_SLICE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.h deleted file mode 100644 index 8c1b6d5..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/no_micro_features_data.h +++ /dev/null @@ -1,23 +0,0 @@ -/* 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_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_NO_MICRO_FEATURES_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_NO_MICRO_FEATURES_DATA_H_ - -extern const int g_no_micro_f9643d42_nohash_4_width; -extern const int g_no_micro_f9643d42_nohash_4_height; -extern const signed char g_no_micro_f9643d42_nohash_4_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_NO_MICRO_FEATURES_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/static_alloc.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/static_alloc.h deleted file mode 100644 index 602445d..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/static_alloc.h +++ /dev/null @@ -1,33 +0,0 @@ -/* 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_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_STATIC_ALLOC_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_STATIC_ALLOC_H_ - -// Checks to ensure that the C-style array passed in has a compile-time size of -// at least the number of bytes requested. This doesn't work with raw pointers -// since sizeof() doesn't know their actual length, so only use this to check -// statically-allocated arrays with known sizes. -#define STATIC_ALLOC_ENSURE_ARRAY_SIZE(A, N) \ - do { \ - if (sizeof(A) < (N)) { \ - TF_LITE_REPORT_ERROR(error_reporter, \ - #A " too small (%d bytes, wanted %d) at %s:%d", \ - sizeof(A), (N), __FILE__, __LINE__); \ - return 0; \ - } \ - } while (0) - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_STATIC_ALLOC_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/yes_feature_data_slice.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/yes_feature_data_slice.h deleted file mode 100644 index 2427ee7..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/yes_feature_data_slice.h +++ /dev/null @@ -1,29 +0,0 @@ -/* 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. -==============================================================================*/ - -// This data was extracted from the larger feature data held in -// no_micro_features_data.cc and consists of the 26th spectrogram slice of 40 -// values. This is the expected result of running the sample data in -// yes_30ms_sample_data.cc through through the preprocessing pipeline. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_YES_FEATURE_DATA_SLICE_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_YES_FEATURE_DATA_SLICE_H_ - -#include - -constexpr int g_yes_feature_data_slice_size = 40; -extern const int8_t g_yes_feature_data_slice[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_YES_FEATURE_DATA_SLICE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.h deleted file mode 100644 index cd1ad10..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/micro_features/yes_micro_features_data.h +++ /dev/null @@ -1,23 +0,0 @@ -/* 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_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_YES_MICRO_FEATURES_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_YES_MICRO_FEATURES_DATA_H_ - -extern const int g_yes_micro_f2e59fea_nohash_1_width; -extern const int g_yes_micro_f2e59fea_nohash_1_height; -extern const signed char g_yes_micro_f2e59fea_nohash_1_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_MICRO_FEATURES_YES_MICRO_FEATURES_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/no_1000ms_sample_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/no_1000ms_sample_data.h deleted file mode 100644 index ab2d67b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/no_1000ms_sample_data.h +++ /dev/null @@ -1,29 +0,0 @@ -/* 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. -==============================================================================*/ - -// This data was created from the PCM data in a WAV file held in v2 of the -// Speech Commands test dataset, at the path: -// speech_commands_test_set_v0.02/no/f9643d42_nohash_4.wav -// This should contain all 16,000 samples from the one-second file. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_NO_1000MS_SAMPLE_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_NO_1000MS_SAMPLE_DATA_H_ - -#include - -extern const int g_no_1000ms_sample_data_size; -extern const int16_t g_no_1000ms_sample_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_NO_1000MS_SAMPLE_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/no_30ms_sample_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/no_30ms_sample_data.h deleted file mode 100644 index 1eecca2..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/no_30ms_sample_data.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2018 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. -==============================================================================*/ - -// This data was created from the PCM data in a WAV file held in v2 of the -// Speech Commands test dataset, at the path: -// speech_commands_test_set_v0.02/no/f9643d42_nohash_4.wav -// The data was extracted starting at an offset of 8,960, which corresponds to -// the 29th spectrogram slice. It's designed to be used to test the -// preprocessing pipeline, to ensure that the expected spectrogram slice is -// produced given this input. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_NO_30MS_SAMPLE_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_NO_30MS_SAMPLE_DATA_H_ - -#include - -extern const int g_no_30ms_sample_data_size; -extern const int16_t g_no_30ms_sample_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_NO_30MS_SAMPLE_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/recognize_commands.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/recognize_commands.h deleted file mode 100644 index 67bdb31..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/recognize_commands.h +++ /dev/null @@ -1,159 +0,0 @@ -/* Copyright 2017 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_MICRO_EXAMPLES_MICRO_SPEECH_RECOGNIZE_COMMANDS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_RECOGNIZE_COMMANDS_H_ - -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/examples/micro_speech/micro_features/micro_model_settings.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -// Partial implementation of std::dequeue, just providing the functionality -// that's needed to keep a record of previous neural network results over a -// short time period, so they can be averaged together to produce a more -// accurate overall prediction. This doesn't use any dynamic memory allocation -// so it's a better fit for microcontroller applications, but this does mean -// there are hard limits on the number of results it can store. -class PreviousResultsQueue { - public: - PreviousResultsQueue(tflite::ErrorReporter* error_reporter) - : error_reporter_(error_reporter), front_index_(0), size_(0) {} - - // Data structure that holds an inference result, and the time when it - // was recorded. - struct Result { - Result() : time_(0), scores() {} - Result(int32_t time, int8_t* input_scores) : time_(time) { - for (int i = 0; i < kCategoryCount; ++i) { - scores[i] = input_scores[i]; - } - } - int32_t time_; - int8_t scores[kCategoryCount]; - }; - - int size() { return size_; } - bool empty() { return size_ == 0; } - Result& front() { return results_[front_index_]; } - Result& back() { - int back_index = front_index_ + (size_ - 1); - if (back_index >= kMaxResults) { - back_index -= kMaxResults; - } - return results_[back_index]; - } - - void push_back(const Result& entry) { - if (size() >= kMaxResults) { - TF_LITE_REPORT_ERROR( - error_reporter_, - "Couldn't push_back latest result, too many already!"); - return; - } - size_ += 1; - back() = entry; - } - - Result pop_front() { - if (size() <= 0) { - TF_LITE_REPORT_ERROR(error_reporter_, - "Couldn't pop_front result, none present!"); - return Result(); - } - Result result = front(); - front_index_ += 1; - if (front_index_ >= kMaxResults) { - front_index_ = 0; - } - size_ -= 1; - return result; - } - - // Most of the functions are duplicates of dequeue containers, but this - // is a helper that makes it easy to iterate through the contents of the - // queue. - Result& from_front(int offset) { - if ((offset < 0) || (offset >= size_)) { - TF_LITE_REPORT_ERROR(error_reporter_, - "Attempt to read beyond the end of the queue!"); - offset = size_ - 1; - } - int index = front_index_ + offset; - if (index >= kMaxResults) { - index -= kMaxResults; - } - return results_[index]; - } - - private: - tflite::ErrorReporter* error_reporter_; - static constexpr int kMaxResults = 50; - Result results_[kMaxResults]; - - int front_index_; - int size_; -}; - -// This class is designed to apply a very primitive decoding model on top of the -// instantaneous results from running an audio recognition model on a single -// window of samples. It applies smoothing over time so that noisy individual -// label scores are averaged, increasing the confidence that apparent matches -// are real. -// To use it, you should create a class object with the configuration you -// want, and then feed results from running a TensorFlow model into the -// processing method. The timestamp for each subsequent call should be -// increasing from the previous, since the class is designed to process a stream -// of data over time. -class RecognizeCommands { - public: - // labels should be a list of the strings associated with each one-hot score. - // The window duration controls the smoothing. Longer durations will give a - // higher confidence that the results are correct, but may miss some commands. - // The detection threshold has a similar effect, with high values increasing - // the precision at the cost of recall. The minimum count controls how many - // results need to be in the averaging window before it's seen as a reliable - // average. This prevents erroneous results when the averaging window is - // initially being populated for example. The suppression argument disables - // further recognitions for a set time after one has been triggered, which can - // help reduce spurious recognitions. - explicit RecognizeCommands(tflite::ErrorReporter* error_reporter, - int32_t average_window_duration_ms = 1000, - uint8_t detection_threshold = 200, - int32_t suppression_ms = 1500, - int32_t minimum_count = 3); - - // Call this with the results of running a model on sample data. - TfLiteStatus ProcessLatestResults(const TfLiteTensor* latest_results, - const int32_t current_time_ms, - const char** found_command, uint8_t* score, - bool* is_new_command); - - private: - // Configuration - tflite::ErrorReporter* error_reporter_; - int32_t average_window_duration_ms_; - uint8_t detection_threshold_; - int32_t suppression_ms_; - int32_t minimum_count_; - - // Working variables - PreviousResultsQueue previous_results_; - const char* previous_top_label_; - int32_t previous_top_label_time_; -}; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_RECOGNIZE_COMMANDS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/model.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/model.h deleted file mode 100644 index b3e705e..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/model.h +++ /dev/null @@ -1,27 +0,0 @@ -/* 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. -==============================================================================*/ - -// This is a standard TensorFlow Lite FlatBuffer model file that has been -// converted into a C data array, so it can be easily compiled into a binary -// for devices that don't have a file system. It was created using the command: -// xxd -i model.tflite > model.cc - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_MODEL_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_MODEL_H_ - -extern const unsigned char g_model[]; -extern const int g_model_len; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_MODEL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/no_power_spectrum_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/no_power_spectrum_data.h deleted file mode 100644 index 463a495..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/no_power_spectrum_data.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2018 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. -==============================================================================*/ - -// This data was extracted from the larger feature data held in -// no_features_data.cc and consists of the 29th spectrogram slice of 43 values. -// This is the expected result of running the sample data in -// no_30ms_sample_data.cc through through the preprocessing pipeline. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_NO_POWER_SPECTRUM_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_NO_POWER_SPECTRUM_DATA_H_ - -#include - -constexpr int g_no_power_spectrum_data_size = 43; -extern const uint8_t g_no_power_spectrum_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_NO_POWER_SPECTRUM_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/no_simple_features_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/no_simple_features_data.h deleted file mode 100644 index ff46134..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/no_simple_features_data.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2018 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_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_NO_SIMPLE_FEATURES_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_NO_SIMPLE_FEATURES_DATA_H_ - -extern const int g_no_simple_f9643d42_nohash_4_width; -extern const int g_no_simple_f9643d42_nohash_4_height; -extern const unsigned char g_no_simple_f9643d42_nohash_4_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_NO_SIMPLE_FEATURES_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_features_generator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_features_generator.h deleted file mode 100644 index 6d47bc4..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_features_generator.h +++ /dev/null @@ -1,31 +0,0 @@ -/* Copyright 2018 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_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_SIMPLE_FEATURES_GENERATOR_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_SIMPLE_FEATURES_GENERATOR_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -// Converts audio sample data into a more compact form that's appropriate for -// feeding into a neural network. There are reference implementations that use -// both floating point and fixed point available, but because the calculations -// involved can be time-consuming, it's recommended that you use or write -// specialized versions for your platform. -TfLiteStatus GenerateSimpleFeatures(tflite::ErrorReporter* error_reporter, - const int16_t* input, int input_size, - int output_size, uint8_t* output); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_SIMPLE_FEATURES_GENERATOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_model_settings.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_model_settings.h deleted file mode 100644 index 9d129c8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/simple_model_settings.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright 2018 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_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_SIMPLE_MODEL_SETTINGS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_SIMPLE_MODEL_SETTINGS_H_ - -// Keeping these as constant expressions allow us to allocate fixed-sized arrays -// on the stack for our working memory. - -// The size of the input time series data we pass to the FFT to produce the -// frequency information. This has to be a power of two, and since we're dealing -// with 30ms of 16KHz inputs, which means 480 samples, this is the next value. -constexpr int kMaxAudioSampleSize = 512; -constexpr int kAudioSampleFrequency = 16000; - -// All of these values are derived from the values used during model training, -// if you change your model you'll need to update these constants. -constexpr int kAverageWindowSize = 6; -constexpr int kFeatureSliceSize = - ((kMaxAudioSampleSize / 2) + (kAverageWindowSize - 1)) / kAverageWindowSize; -constexpr int kFeatureSliceCount = 49; -constexpr int kFeatureElementCount = (kFeatureSliceSize * kFeatureSliceCount); -constexpr int kFeatureSliceStrideMs = 20; -constexpr int kFeatureSliceDurationMs = 30; - -constexpr int kCategoryCount = 4; -constexpr int kSilenceIndex = 0; -constexpr int kUnknownIndex = 1; -extern const char* kCategoryLabels[kCategoryCount]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_SIMPLE_MODEL_SETTINGS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_power_spectrum_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_power_spectrum_data.h deleted file mode 100644 index 7e0c146..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_power_spectrum_data.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2018 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. -==============================================================================*/ - -// This data was extracted from the larger feature data held in -// no_features_data.cc and consists of the 26th spectrogram slice of 43 values. -// This is the expected result of running the sample data in -// yes_30ms_sample_data.cc through through the preprocessing pipeline. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_YES_POWER_SPECTRUM_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_YES_POWER_SPECTRUM_DATA_H_ - -#include - -constexpr int g_yes_power_spectrum_data_size = 43; -extern const uint8_t g_yes_power_spectrum_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_YES_POWER_SPECTRUM_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_simple_features_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_simple_features_data.h deleted file mode 100644 index 98c7e42..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/simple_features/yes_simple_features_data.h +++ /dev/null @@ -1,23 +0,0 @@ -/* Copyright 2018 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_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_YES_SIMPLE_FEATURES_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_YES_SIMPLE_FEATURES_DATA_H_ - -extern const int g_yes_simple_f2e59fea_nohash_1_width; -extern const int g_yes_simple_f2e59fea_nohash_1_height; -extern const unsigned char g_yes_simple_f2e59fea_nohash_1_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_SIMPLE_FEATURES_YES_SIMPLE_FEATURES_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/yes_1000ms_sample_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/yes_1000ms_sample_data.h deleted file mode 100644 index 5d09866..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/yes_1000ms_sample_data.h +++ /dev/null @@ -1,29 +0,0 @@ -/* 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. -==============================================================================*/ - -// This data was created from the PCM data in a WAV file held in v2 of the -// Speech Commands test dataset, at the path: -// speech_commands_test_set_v0.02/yes/f2e59fea_nohash_1.wav -// This should contain all 16,000 samples from the one-second file. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_YES_1000MS_SAMPLE_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_YES_1000MS_SAMPLE_DATA_H_ - -#include - -extern const int g_yes_1000ms_sample_data_size; -extern const int16_t g_yes_1000ms_sample_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_YES_1000MS_SAMPLE_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/yes_30ms_sample_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/yes_30ms_sample_data.h deleted file mode 100644 index cfe201a..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/micro_speech/yes_30ms_sample_data.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2018 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. -==============================================================================*/ - -// This data was created from the PCM data in a WAV file held in v2 of the -// Speech Commands test dataset, at the path: -// speech_commands_test_set_v0.02/yes/f2e59fea_nohash_1.wav -// The data was extracted starting at an offset of 8,000, which corresponds to -// the 26th spectrogram slice. It's designed to be used to test the -// preprocessing pipeline, to ensure that the expected spectrogram slice is -// produced given this input. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_YES_30MS_SAMPLE_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_YES_30MS_SAMPLE_DATA_H_ - -#include - -extern const int g_yes_30ms_sample_data_size; -extern const int16_t g_yes_30ms_sample_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_MICRO_SPEECH_YES_30MS_SAMPLE_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/network_tester/expected_output_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/network_tester/expected_output_data.h deleted file mode 100644 index 18937a9..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/network_tester/expected_output_data.h +++ /dev/null @@ -1,21 +0,0 @@ -/* 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_MICRO_EXAMPLES_NETWORK_TESTER_EXPECTED_OUTPUT_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_NETWORK_TESTER_EXPECTED_OUTPUT_DATA_H_ - -static unsigned char expected_output_data[1][4] = {6, 8, 14, 16}; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_NETWORK_TESTER_EXPECTED_OUTPUT_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/network_tester/input_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/network_tester/input_data.h deleted file mode 100644 index a94f6f9..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/network_tester/input_data.h +++ /dev/null @@ -1,23 +0,0 @@ -/* 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_MICRO_EXAMPLES_NETWORK_TESTER_INPUT_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_NETWORK_TESTER_INPUT_DATA_H_ - -static const int input_data_len = 16; -static const unsigned char input_data[1][16] = { - {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16}}; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_NETWORK_TESTER_INPUT_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/network_tester/network_model.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/network_tester/network_model.h deleted file mode 100644 index 5b4b4cf..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/network_tester/network_model.h +++ /dev/null @@ -1,70 +0,0 @@ -/* 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_MICRO_EXAMPLES_NETWORK_TESTER_NETWORK_MODEL_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_NETWORK_TESTER_NETWORK_MODEL_H_ - -const unsigned char network_model[] = { - 0x18, 0x00, 0x00, 0x00, 0x54, 0x46, 0x4c, 0x33, 0x00, 0x00, 0x0e, 0x00, - 0x18, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x08, 0x02, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x38, 0x00, 0x00, 0x00, 0x0f, 0x00, 0x00, 0x00, - 0x54, 0x4f, 0x43, 0x4f, 0x20, 0x43, 0x6f, 0x6e, 0x76, 0x65, 0x72, 0x74, - 0x65, 0x64, 0x2e, 0x00, 0x03, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, - 0xfc, 0xff, 0xff, 0xff, 0x04, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, - 0xf8, 0xfe, 0xff, 0xff, 0x20, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, - 0x08, 0x00, 0x00, 0x00, 0x3c, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x94, 0x00, 0x00, 0x00, - 0x7e, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, - 0x64, 0x61, 0x74, 0x61, 0x2f, 0x50, 0x6c, 0x61, 0x63, 0x65, 0x68, 0x6f, - 0x6c, 0x64, 0x65, 0x72, 0x00, 0x00, 0x00, 0x00, 0x6c, 0xff, 0xff, 0xff, - 0x30, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, - 0x18, 0x00, 0x08, 0x00, 0x07, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x10, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, - 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x17, 0x00, 0x00, 0x00, - 0x70, 0x6f, 0x6f, 0x6c, 0x31, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, - 0x6c, 0x32, 0x44, 0x2f, 0x4d, 0x61, 0x78, 0x50, 0x6f, 0x6f, 0x6c, 0x00, - 0x0c, 0x00, 0x14, 0x00, 0x04, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x3f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x43, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x14, 0x00, 0x18, 0x00, 0x00, 0x00, 0x08, 0x00, - 0x0c, 0x00, 0x07, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x05, 0x10, 0x00, 0x00, 0x00, - 0x14, 0x00, 0x00, 0x00, 0x2c, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x00, - 0x18, 0x00, 0x07, 0x00, 0x08, 0x00, 0x0c, 0x00, 0x10, 0x00, 0x14, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, - 0x08, 0x00, 0x07, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11}; -const unsigned int network_model_len = 576; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_NETWORK_TESTER_NETWORK_MODEL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/arduino/HM01B0_platform.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/arduino/HM01B0_platform.h deleted file mode 100644 index 50835f9..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/arduino/HM01B0_platform.h +++ /dev/null @@ -1,25 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_ARDUINO_HM01B0_PLATFORM_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_ARDUINO_HM01B0_PLATFORM_H_ - -#if defined(ARDUINO) && defined(ARDUINO_SFE_EDGE) -#include "hm01b0_platform_edge.h" -#define HM01B0_PIN_TRIG 0 // unused -#define HM01B0_PIN_INT 0 // unused -#endif // defined(ARDUINO) && defined(ARDUINO_SFE_EDGE) - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_ARDUINO_HM01B0_PLATFORM_H_ \ No newline at end of file diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/detection_responder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/detection_responder.h deleted file mode 100644 index a7c709d..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/detection_responder.h +++ /dev/null @@ -1,34 +0,0 @@ -/* 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. -==============================================================================*/ - -// Provides an interface to take an action based on the output from the person -// detection model. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_DETECTION_RESPONDER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_DETECTION_RESPONDER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -// Called every time the results of a person detection run are available. The -// `person_score` has the numerical confidence that the captured image contains -// a person, and `no_person_score` has the numerical confidence that the image -// does not contain a person. Typically if person_score > no person score, the -// image is considered to contain a person. This threshold may be adjusted for -// particular applications. -void RespondToDetection(tflite::ErrorReporter* error_reporter, - uint8_t person_score, uint8_t no_person_score); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_DETECTION_RESPONDER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/esp/app_camera_esp.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/esp/app_camera_esp.h deleted file mode 100644 index 83a7fdb..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/esp/app_camera_esp.h +++ /dev/null @@ -1,178 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_ESP_APP_CAMERA_ESP_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_ESP_APP_CAMERA_ESP_H_ - -#include "esp_camera.h" -#include "esp_log.h" -#include "esp_system.h" -#include "sensor.h" - -/** - * PIXFORMAT_RGB565, // 2BPP/RGB565 - * PIXFORMAT_YUV422, // 2BPP/YUV422 - * PIXFORMAT_GRAYSCALE, // 1BPP/GRAYSCALE - * PIXFORMAT_JPEG, // JPEG/COMPRESSED - * PIXFORMAT_RGB888, // 3BPP/RGB888 - */ -#define CAMERA_PIXEL_FORMAT PIXFORMAT_GRAYSCALE - -/* - * FRAMESIZE_96X96, // 96x96 - * FRAMESIZE_QQVGA, // 160x120 - * FRAMESIZE_QQVGA2, // 128x160 - * FRAMESIZE_QCIF, // 176x144 - * FRAMESIZE_HQVGA, // 240x176 - * FRAMESIZE_QVGA, // 320x240 - * FRAMESIZE_CIF, // 400x296 - * FRAMESIZE_VGA, // 640x480 - * FRAMESIZE_SVGA, // 800x600 - * FRAMESIZE_XGA, // 1024x768 - * FRAMESIZE_SXGA, // 1280x1024 - * FRAMESIZE_UXGA, // 1600x1200 - */ -#define CAMERA_FRAME_SIZE FRAMESIZE_96X96 - -#if CONFIG_CAMERA_MODEL_WROVER_KIT -#define PWDN_GPIO_NUM -1 -#define RESET_GPIO_NUM -1 -#define XCLK_GPIO_NUM 21 -#define SIOD_GPIO_NUM 26 -#define SIOC_GPIO_NUM 27 - -#define Y9_GPIO_NUM 35 -#define Y8_GPIO_NUM 34 -#define Y7_GPIO_NUM 39 -#define Y6_GPIO_NUM 36 -#define Y5_GPIO_NUM 19 -#define Y4_GPIO_NUM 18 -#define Y3_GPIO_NUM 5 -#define Y2_GPIO_NUM 4 -#define VSYNC_GPIO_NUM 25 -#define HREF_GPIO_NUM 23 -#define PCLK_GPIO_NUM 22 - -#elif CONFIG_CAMERA_MODEL_ESP_EYE -#define PWDN_GPIO_NUM -1 -#define RESET_GPIO_NUM -1 -#define XCLK_GPIO_NUM 4 -#define SIOD_GPIO_NUM 18 -#define SIOC_GPIO_NUM 23 - -#define Y9_GPIO_NUM 36 -#define Y8_GPIO_NUM 37 -#define Y7_GPIO_NUM 38 -#define Y6_GPIO_NUM 39 -#define Y5_GPIO_NUM 35 -#define Y4_GPIO_NUM 14 -#define Y3_GPIO_NUM 13 -#define Y2_GPIO_NUM 34 -#define VSYNC_GPIO_NUM 5 -#define HREF_GPIO_NUM 27 -#define PCLK_GPIO_NUM 25 - -#elif CONFIG_CAMERA_MODEL_M5STACK_PSRAM -#define PWDN_GPIO_NUM -1 -#define RESET_GPIO_NUM 15 -#define XCLK_GPIO_NUM 27 -#define SIOD_GPIO_NUM 25 -#define SIOC_GPIO_NUM 23 - -#define Y9_GPIO_NUM 19 -#define Y8_GPIO_NUM 36 -#define Y7_GPIO_NUM 18 -#define Y6_GPIO_NUM 39 -#define Y5_GPIO_NUM 5 -#define Y4_GPIO_NUM 34 -#define Y3_GPIO_NUM 35 -#define Y2_GPIO_NUM 32 -#define VSYNC_GPIO_NUM 22 -#define HREF_GPIO_NUM 26 -#define PCLK_GPIO_NUM 21 - -#elif CONFIG_CAMERA_MODEL_M5STACK_WIDE -#define PWDN_GPIO_NUM -1 -#define RESET_GPIO_NUM 15 -#define XCLK_GPIO_NUM 27 -#define SIOD_GPIO_NUM 22 -#define SIOC_GPIO_NUM 23 - -#define Y9_GPIO_NUM 19 -#define Y8_GPIO_NUM 36 -#define Y7_GPIO_NUM 18 -#define Y6_GPIO_NUM 39 -#define Y5_GPIO_NUM 5 -#define Y4_GPIO_NUM 34 -#define Y3_GPIO_NUM 35 -#define Y2_GPIO_NUM 32 -#define VSYNC_GPIO_NUM 25 -#define HREF_GPIO_NUM 26 -#define PCLK_GPIO_NUM 21 - -#elif CONFIG_CAMERA_MODEL_AI_THINKER -#define PWDN_GPIO_NUM 32 -#define RESET_GPIO_NUM -1 -#define XCLK_GPIO_NUM 0 -#define SIOD_GPIO_NUM 26 -#define SIOC_GPIO_NUM 27 - -#define Y9_GPIO_NUM 35 -#define Y8_GPIO_NUM 34 -#define Y7_GPIO_NUM 39 -#define Y6_GPIO_NUM 36 -#define Y5_GPIO_NUM 21 -#define Y4_GPIO_NUM 19 -#define Y3_GPIO_NUM 18 -#define Y2_GPIO_NUM 5 -#define VSYNC_GPIO_NUM 25 -#define HREF_GPIO_NUM 23 -#define PCLK_GPIO_NUM 22 - -#elif CONFIG_CAMERA_MODEL_CUSTOM -#define PWDN_GPIO_NUM CONFIG_CAMERA_PIN_PWDN -#define RESET_GPIO_NUM CONFIG_CAMERA_PIN_RESET -#define XCLK_GPIO_NUM CONFIG_CAMERA_PIN_XCLK -#define SIOD_GPIO_NUM CONFIG_CAMERA_PIN_SIOD -#define SIOC_GPIO_NUM CONFIG_CAMERA_PIN_SIOC - -#define Y9_GPIO_NUM CONFIG_CAMERA_PIN_Y9 -#define Y8_GPIO_NUM CONFIG_CAMERA_PIN_Y8 -#define Y7_GPIO_NUM CONFIG_CAMERA_PIN_Y7 -#define Y6_GPIO_NUM CONFIG_CAMERA_PIN_Y6 -#define Y5_GPIO_NUM CONFIG_CAMERA_PIN_Y5 -#define Y4_GPIO_NUM CONFIG_CAMERA_PIN_Y4 -#define Y3_GPIO_NUM CONFIG_CAMERA_PIN_Y3 -#define Y2_GPIO_NUM CONFIG_CAMERA_PIN_Y2 -#define VSYNC_GPIO_NUM CONFIG_CAMERA_PIN_VSYNC -#define HREF_GPIO_NUM CONFIG_CAMERA_PIN_HREF -#define PCLK_GPIO_NUM CONFIG_CAMERA_PIN_PCLK - -#else -#error "No camera module configured, please configure in menuconfig" -#endif - -#define XCLK_FREQ 20000000 - -#ifdef __cplusplus -extern "C" { -#endif - -int app_camera_init(); - -#ifdef __cplusplus -} -#endif -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_ESP_APP_CAMERA_ESP_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0.h deleted file mode 100644 index c7ec4e6..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0.h +++ /dev/null @@ -1,413 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_H_ - -#if defined(ARDUINO) && !defined(ARDUINO_SFE_EDGE) -#define ARDUINO_EXCLUDE_CODE -#endif // defined(ARDUINO) && !defined(ARDUINO_SFE_EDGE) - -#ifdef __cplusplus -extern "C" { -#endif - -#ifndef ARDUINO_EXCLUDE_CODE -#include "am_bsp.h" // NOLINT -#include "am_mcu_apollo.h" // NOLINT -#include "am_util.h" // NOLINT -#endif // ARDUINO_EXCLUDE_CODE - -#if defined(ARDUINO) -#include "tensorflow/lite/micro/examples/person_detection/arduino/HM01B0_platform.h" -#endif // defined(ARDUINO) - -#define HM01B0_DRV_VERSION (0) -#define HM01B0_DRV_SUBVERSION (3) - -#define HM01B0_DEFAULT_ADDRESS (0x24) - -#define HM01B0_PIXEL_X_NUM (324) -#define HM01B0_PIXEL_Y_NUM (244) - -#define HM01B0_REG_MODEL_ID_H (0x0000) -#define HM01B0_REG_MODEL_ID_L (0x0001) -#define HM01B0_REG_SILICON_REV (0x0002) -#define HM01B0_REG_FRAME_COUNT (0x0005) -#define HM01B0_REG_PIXEL_ORDER (0x0006) - -#define HM01B0_REG_MODE_SELECT (0x0100) -#define HM01B0_REG_IMAGE_ORIENTATION (0x0101) -#define HM01B0_REG_SW_RESET (0x0103) -#define HM01B0_REG_GRP_PARAM_HOLD (0x0104) - -#define HM01B0_REG_I2C_ID_SEL (0x3400) -#define HM01B0_REG_I2C_ID_REG (0x3401) - -#define HM01B0_REG_PMU_PROGRAMMABLE_FRAMECNT (0x3020) - -// #define HM01B0_REG_MODE_SELECT (0x0100) -#define HM01B0_REG_MODE_SELECT_STANDBY (0x00) -#define HM01B0_REG_MODE_SELECT_STREAMING (0x01) -#define HM01B0_REG_MODE_SELECT_STREAMING_NFRAMES (0x03) -#define HM01B0_REG_MODE_SELECT_STREAMING_HW_TRIGGER (0x05) - -// #define HM01B0_REG_IMAGE_ORIENTATION (0x0101) -#define HM01B0_REG_IMAGE_ORIENTATION_DEFAULT (0x00) -#define HM01B0_REG_IMAGE_ORIENTATION_HMIRROR (0x01) -#define HM01B0_REG_IMAGE_ORIENTATION_VMIRROR (0x02) -#define HM01B0_REG_IMAGE_ORIENTATION_HVMIRROR \ - (HM01B0_REG_IMAGE_ORIENTATION_HMIRROR | HM01B0_REG_IMAGE_ORIENTATION_HVMIRROR) - -// #define HM01B0_REG_GRP_PARAM_HOLD (0x0104) -#define HM01B0_REG_GRP_PARAM_HOLD_CONSUME (0x00) -#define HM01B0_REG_GRP_PARAM_HOLD_HOLD (0x01) - -// Helpers for reading raw values from the camera. -#define read_vsync() \ - (AM_REGVAL(AM_REGADDR(GPIO, RDA)) & (1 << HM01B0_PIN_VSYNC)) -#define read_hsync() \ - (AM_REGVAL(AM_REGADDR(GPIO, RDA)) & (1 << HM01B0_PIN_HSYNC)) -#define read_pclk() (AM_REGVAL(AM_REGADDR(GPIO, RDA)) & (1 << HM01B0_PIN_PCLK)) -#define read_byte() (APBDMA->BBINPUT) - -enum { - HM01B0_ERR_OK = 0x00, - HM01B0_ERR_I2C, - HM01B0_ERR_MODE, -}; - -typedef struct { - uint16_t ui16Reg; - uint8_t ui8Val; -} hm_script_t; - -typedef struct { - uint16_t ui16SlvAddr; - am_hal_iom_mode_e eIOMMode; - uint32_t ui32IOMModule; - am_hal_iom_config_t sIOMCfg; - void *pIOMHandle; - - uint32_t ui32CTimerModule; - uint32_t ui32CTimerSegment; - uint32_t ui32CTimerOutputPin; - - uint8_t ui8PinSCL; - uint8_t ui8PinSDA; - uint8_t ui8PinD0; - uint8_t ui8PinD1; - uint8_t ui8PinD2; - uint8_t ui8PinD3; - uint8_t ui8PinD4; - uint8_t ui8PinD5; - uint8_t ui8PinD6; - uint8_t ui8PinD7; - uint8_t ui8PinVSYNC; - uint8_t ui8PinHSYNC; - uint8_t ui8PinPCLK; - - uint8_t ui8PinTrig; - uint8_t ui8PinInt; - void (*pfnGpioIsr)(void); -} hm01b0_cfg_t; - -//***************************************************************************** -// -//! @brief Write HM01B0 registers -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param ui16Reg - Register address. -//! @param pui8Value - Pointer to the data to be written. -//! @param ui32NumBytes - Length of the data in bytes to be written. -//! -//! This function writes value to HM01B0 registers. -//! -//! @return Error code. -// -//***************************************************************************** -static uint32_t hm01b0_write_reg(hm01b0_cfg_t *psCfg, uint16_t ui16Reg, - uint8_t *pui8Value, uint32_t ui32NumBytes); - -//***************************************************************************** -// -//! @brief Read HM01B0 registers -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param ui16Reg - Register address. -//! @param pui8Value - Pointer to the buffer for read data to be put -//! into. -//! @param ui32NumBytes - Length of the data to be read. -//! -//! This function reads value from HM01B0 registers. -//! -//! @return Error code. -// -//***************************************************************************** -static uint32_t hm01b0_read_reg(hm01b0_cfg_t *psCfg, uint16_t ui16Reg, - uint8_t *pui8Value, uint32_t ui32NumBytes); - -//***************************************************************************** -// -//! @brief Load HM01B0 a given script -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param psScrip - Pointer to the script to be loaded. -//! @param ui32ScriptCmdNum - Number of entries in a given script. -//! -//! This function loads HM01B0 a given script. -//! -//! @return Error code. -// -//***************************************************************************** -static uint32_t hm01b0_load_script(hm01b0_cfg_t *psCfg, hm_script_t *psScript, - uint32_t ui32ScriptCmdNum); - -//***************************************************************************** -// -//! @brief Power up HM01B0 -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function powers up HM01B0. -//! -//! @return none. -// -//***************************************************************************** -void hm01b0_power_up(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Power down HM01B0 -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function powers up HM01B0. -//! -//! @return none. -// -//***************************************************************************** -void hm01b0_power_down(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Enable MCLK -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function utilizes CTimer to generate MCLK for HM01B0. -//! -//! @return none. -// -//***************************************************************************** -void hm01b0_mclk_enable(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Disable MCLK -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function disable CTimer to stop MCLK for HM01B0. -//! -//! @return none. -// -//***************************************************************************** -void hm01b0_mclk_disable(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Initialize interfaces -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function initializes interfaces. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_init_if(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Deinitialize interfaces -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function deinitializes interfaces. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_deinit_if(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Get HM01B0 Model ID -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param pui16MID - Pointer to buffer for the read back model ID. -//! -//! This function reads back HM01B0 model ID. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_get_modelid(hm01b0_cfg_t *psCfg, uint16_t *pui16MID); - -//***************************************************************************** -// -//! @brief Initialize HM01B0 -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param psScript - Pointer to HM01B0 initialization script. -//! @param ui32ScriptCmdNum - No. of commands in HM01B0 initialization -//! script. -//! -//! This function initializes HM01B0 with a given script. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_init_system(hm01b0_cfg_t *psCfg, hm_script_t *psScript, - uint32_t ui32ScriptCmdNum); - -//***************************************************************************** -// -//! @brief Set HM01B0 in the walking 1s test mode -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function sets HM01B0 in the walking 1s test mode. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_test_walking1s(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Software reset HM01B0 -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function resets HM01B0 by issuing a reset command. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_reset_sw(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Get current HM01B0 operation mode. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param pui8Mode - Pointer to buffer -//! - for the read back operation mode to be put into -//! -//! This function get HM01B0 operation mode. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_get_mode(hm01b0_cfg_t *psCfg, uint8_t *pui8Mode); - -//***************************************************************************** -// -//! @brief Set HM01B0 operation mode. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param ui8Mode - Operation mode. One of: -//! HM01B0_REG_MODE_SELECT_STANDBY -//! HM01B0_REG_MODE_SELECT_STREAMING -//! HM01B0_REG_MODE_SELECT_STREAMING_NFRAMES -//! HM01B0_REG_MODE_SELECT_STREAMING_HW_TRIGGER -//! @param framecnt - Frame count for -//! HM01B0_REG_MODE_SELECT_STREAMING_NFRAMES. -//! - Discarded if other modes. -//! -//! This function set HM01B0 operation mode. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_set_mode(hm01b0_cfg_t *psCfg, uint8_t ui8Mode, - uint8_t framecnt); - -//***************************************************************************** -// -//! @brief Hardware trigger HM01B0 to stream. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param bTrigger - True to start streaming -//! - False to stop streaming -//! -//! This function triggers HM01B0 to stream by toggling the TRIG pin. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_hardware_trigger_streaming(hm01b0_cfg_t *psCfg, bool bTrigger); - -//***************************************************************************** -// -//! @brief Set HM01B0 mirror mode. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param bHmirror - Horizontal mirror -//! @param bVmirror - Vertical mirror -//! -//! This function set HM01B0 mirror mode. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_set_mirror(hm01b0_cfg_t *psCfg, bool bHmirror, bool bVmirror); - -//***************************************************************************** -// -//! @brief Read data of one frame from HM01B0. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param pui8Buffer - Pointer to the frame buffer. -//! @param ui32BufferLen - Framebuffer size. -//! -//! This function read data of one frame from HM01B0. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_blocking_read_oneframe(hm01b0_cfg_t *psCfg, uint8_t *pui8Buffer, - uint32_t ui32BufferLen); - -//***************************************************************************** -// -//! @brief Read data of one frame from HM01B0. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function wakes up the camera and captures a single frame. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_single_frame_capture(hm01b0_cfg_t *psCfg); - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_RAW8_QVGA_8bits_lsb_5fps.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_RAW8_QVGA_8bits_lsb_5fps.h deleted file mode 100644 index 32897ca..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_RAW8_QVGA_8bits_lsb_5fps.h +++ /dev/null @@ -1,510 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_RAW8_QVGA_8BITS_LSB_5FPS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_RAW8_QVGA_8BITS_LSB_5FPS_H_ - -#include "HM01B0.h" - -const hm_script_t sHM01B0InitScript[] = { - // ;************************************************************************* - // ; Sensor: HM01B0 - // ; I2C ID: 24 - // ; Resolution: 324x244 - // ; Lens: - // ; Flicker: - // ; Frequency: - // ; Description: AE control enable - // ; 8-bit mode, LSB first - // ; - // ; - // ; Note: - // ; - // ; $Revision: 1338 $ - // ; $Date:: 2017-04-11 15:43:45 +0800#$ - // ;************************************************************************* - // - // // --------------------------------------------------- - // // HUB system initial - // // --------------------------------------------------- - // W 20 8A04 01 2 1 - // W 20 8A00 22 2 1 - // W 20 8A01 00 2 1 - // W 20 8A02 01 2 1 - // W 20 0035 93 2 1 ; [3]&[1] hub616 20bits in, [5:4]=1 mclk=48/2=24mhz - // W 20 0036 00 2 1 - // W 20 0011 09 2 1 - // W 20 0012 B6 2 1 - // W 20 0014 08 2 1 - // W 20 0015 98 2 1 - // ;W 20 0130 16 2 1 ; 3m soc, signal buffer control - // ;W 20 0100 44 2 1 ; [6] hub616 20bits in - // W 20 0100 04 2 1 ; [6] hub616 20bits in - // W 20 0121 01 2 1 ; [0] Q1 Intf enable, [1]:4bit mode, [2] msb first, [3] - // serial mode - // W 20 0150 00 2 1 ; - // W 20 0150 04 2 1 ; - // - // - // //--------------------------------------------------- - // // Initial - // //--------------------------------------------------- - // W 24 0103 00 2 1 ; software reset-> was 0x22 - { - 0x0103, - 0x00, - }, - // W 24 0100 00 2 1; power up - { - 0x0100, - 0x00, - }, - // - // - // - // //--------------------------------------------------- - // // Analog - // //--------------------------------------------------- - // L HM01B0_analog_setting.txt - { - 0x1003, - 0x08, - }, - { - 0x1007, - 0x08, - }, - { - 0x3044, - 0x0A, - }, - { - 0x3045, - 0x00, - }, - { - 0x3047, - 0x0A, - }, - { - 0x3050, - 0xC0, - }, - { - 0x3051, - 0x42, - }, - { - 0x3052, - 0x50, - }, - { - 0x3053, - 0x00, - }, - { - 0x3054, - 0x03, - }, - { - 0x3055, - 0xF7, - }, - { - 0x3056, - 0xF8, - }, - { - 0x3057, - 0x29, - }, - { - 0x3058, - 0x1F, - }, - { - 0x3059, - 0x1E, - }, - { - 0x3064, - 0x00, - }, - { - 0x3065, - 0x04, - }, - // - // - // //--------------------------------------------------- - // // Digital function - // //--------------------------------------------------- - // - // // BLC - // W 24 1000 43 2 1 ; BLC_on, IIR - { - 0x1000, - 0x43, - }, - // W 24 1001 40 2 1 ; [6] : BLC dithering en - { - 0x1001, - 0x40, - }, - // W 24 1002 32 2 1 ; // blc_darkpixel_thd - { - 0x1002, - 0x32, - }, - // - // // Dgain - // W 24 0350 7F 2 1 ; Dgain Control - { - 0x0350, - 0x7F, - }, - // - // // BLI - // W 24 1006 01 2 1 ; [0] : bli enable - { - 0x1006, - 0x01, - }, - // - // // DPC - // W 24 1008 00 2 1 ; [2:0] : DPC option 0: DPC off 1 : mono 3 : bayer1 5 : - // bayer2 - { - 0x1008, - 0x00, - }, - // W 24 1009 A0 2 1 ; cluster hot pixel th - { - 0x1009, - 0xA0, - }, - // W 24 100A 60 2 1 ; cluster cold pixel th - { - 0x100A, - 0x60, - }, - // W 24 100B 90 2 1 ; single hot pixel th - { - 0x100B, - 0x90, - }, - // W 24 100C 40 2 1 ; single cold pixel th - { - 0x100C, - 0x40, - }, - // // - // advance VSYNC by 1 row - { - 0x3022, - 0x01, - }, - // W 24 1012 00 2 1 ; Sync. enable VSYNC shift - { - 0x1012, - 0x01, - }, - - // - // // ROI Statistic - // W 24 2000 07 2 1 ; [0] : AE stat en [1] : MD LROI stat en [2] : MD GROI - // stat en [3] : RGB stat ratio en [4] : IIR selection (1 -> 16, 0 -> 8) - { - 0x2000, - 0x07, - }, - // W 24 2003 00 2 1 ; MD GROI 0 y start HB - { - 0x2003, - 0x00, - }, - // W 24 2004 1C 2 1 ; MD GROI 0 y start LB - { - 0x2004, - 0x1C, - }, - // W 24 2007 00 2 1 ; MD GROI 1 y start HB - { - 0x2007, - 0x00, - }, - // W 24 2008 58 2 1 ; MD GROI 1 y start LB - { - 0x2008, - 0x58, - }, - // W 24 200B 00 2 1 ; MD GROI 2 y start HB - { - 0x200B, - 0x00, - }, - // W 24 200C 7A 2 1 ; MD GROI 2 y start LB - { - 0x200C, - 0x7A, - }, - // W 24 200F 00 2 1 ; MD GROI 3 y start HB - { - 0x200F, - 0x00, - }, - // W 24 2010 B8 2 1 ; MD GROI 3 y start LB - { - 0x2010, - 0xB8, - }, - // - // W 24 2013 00 2 1 ; MD LRIO y start HB - { - 0x2013, - 0x00, - }, - // W 24 2014 58 2 1 ; MD LROI y start LB - { - 0x2014, - 0x58, - }, - // W 24 2017 00 2 1 ; MD LROI y end HB - { - 0x2017, - 0x00, - }, - // W 24 2018 9B 2 1 ; MD LROI y end LB - { - 0x2018, - 0x9B, - }, - // - // // AE - // W 24 2100 01 2 1 ; [0]: AE control enable - { - 0x2100, - 0x01, - }, - // W 24 2101 07 2 1 ; AE target mean - { - 0x2101, - 0x5F, - }, - // W 24 2102 0A 2 1 ; AE min mean - { - 0x2102, - 0x0A, - }, - // W 24 2104 03 2 1 ; AE Threshold - { - 0x2103, - 0x03, - }, - // W 24 2104 05 2 1 ; AE Threshold - { - 0x2104, - 0x05, - }, - // W 24 2105 01 2 1 ; max INTG Hb - { - 0x2105, - 0x02, - }, - // W 24 2106 54 2 1 ; max INTG Lb - { - 0x2106, - 0x14, - }, - // W 24 2108 02 2 1 ; max AGain in full - { - 0x2107, - 0x02, - }, - // W 24 2108 03 2 1 ; max AGain in full - { - 0x2108, - 0x03, - }, - // W 24 2109 04 2 1 ; max AGain in bin2 - { - 0x2109, - 0x03, - }, - // W 24 210A 00 2 1 ; min AGAIN - { - 0x210A, - 0x00, - }, - // W 24 210B C0 2 1 ; max DGain - { - 0x210B, - 0x80, - }, - // W 24 210C 40 2 1 ; min DGain - { - 0x210C, - 0x40, - }, - // W 24 210D 20 2 1 ; damping factor - { - 0x210D, - 0x20, - }, - // W 24 210E 03 2 1 ; FS ctrl - { - 0x210E, - 0x03, - }, - // W 24 210F 00 2 1 ; FS 60Hz Hb - { - 0x210F, - 0x00, - }, - // W 24 2110 85 2 1 ; FS 60Hz Lb - { - 0x2110, - 0x85, - }, - // W 24 2111 00 2 1 ; Fs 50Hz Hb - { - 0x2111, - 0x00, - }, - // W 24 2112 A0 2 1 ; FS 50Hz Lb - { - 0x2112, - 0xA0, - }, - - // - // - // // MD - // W 24 2150 03 2 1 ; [0] : MD LROI en [1] : MD GROI en - { - 0x2150, - 0x03, - }, - // - // - // //--------------------------------------------------- - // // frame rate : 5 FPS - // //--------------------------------------------------- - // W 24 0340 0C 2 1 ; smia frame length Hb - { - 0x0340, - 0x0C, - }, - // W 24 0341 7A 2 1 ; smia frame length Lb 3192 - { - 0x0341, - 0x7A, - }, - // - // W 24 0342 01 2 1 ; smia line length Hb - { - 0x0342, - 0x01, - }, - // W 24 0343 77 2 1 ; smia line length Lb 375 - { - 0x0343, - 0x77, - }, - // - // //--------------------------------------------------- - // // Resolution : QVGA 324x244 - // //--------------------------------------------------- - // W 24 3010 01 2 1 ; [0] : window mode 0 : full frame 324x324 1 : QVGA - { - 0x3010, - 0x01, - }, - // - // - // W 24 0383 01 2 1 ; - { - 0x0383, - 0x01, - }, - // W 24 0387 01 2 1 ; - { - 0x0387, - 0x01, - }, - // W 24 0390 00 2 1 ; - { - 0x0390, - 0x00, - }, - // - // //--------------------------------------------------- - // // bit width Selection - // //--------------------------------------------------- - // W 24 3011 70 2 1 ; [0] : 6 bit mode enable - { - 0x3011, - 0x70, - }, - // - // - // W 24 3059 02 2 1 ; [7]: Self OSC En, [6]: 4bit mode, [5]: serial mode, - // [4:0]: keep value as 0x02 - { - 0x3059, - 0x02, - }, - // W 24 3060 01 2 1 ; [5]: gated_clock, [4]: msb first, - { - 0x3060, - 0x20, - }, - // ; [3:2]: vt_reg_div -> div by 4/8/1/2 - // ; [1;0]: vt_sys_div -> div by 8/4/2/1 - // - // - { - 0x0101, - 0x01, - }, - // //--------------------------------------------------- - // // CMU update - // //--------------------------------------------------- - // - // W 24 0104 01 2 1 ; was 0100 - { - 0x0104, - 0x01, - }, - // - // - // - // //--------------------------------------------------- - // // Turn on rolling shutter - // //--------------------------------------------------- - // W 24 0100 01 2 1 ; was 0005 ; mode_select 00 : standby - wait fir I2C SW - // trigger 01 : streaming 03 : output "N" frame, then enter standby 04 : - // standby - wait for HW trigger (level), then continuous video out til HW - // TRIG goes off 06 : standby - wait for HW trigger (edge), then output "N" - // frames then enter standby - { - 0x0100, - 0x01, - }, - // - // ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -}; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_RAW8_QVGA_8BITS_LSB_5FPS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_Walking1s_01.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_Walking1s_01.h deleted file mode 100644 index 712b232..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_Walking1s_01.h +++ /dev/null @@ -1,56 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_WALKING1S_01_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_WALKING1S_01_H_ - -#include "HM01B0.h" - -const hm_script_t sHM01b0TestModeScript_Walking1s[] = { - { - 0x2100, - 0x00, - }, // W 24 2100 00 2 1 ; AE - { - 0x1000, - 0x00, - }, // W 24 1000 00 2 1 ; BLC - { - 0x1008, - 0x00, - }, // W 24 1008 00 2 1 ; DPC - { - 0x0205, - 0x00, - }, // W 24 0205 00 2 1 ; AGain - { - 0x020E, - 0x01, - }, // W 24 020E 01 2 1 ; DGain - { - 0x020F, - 0x00, - }, // W 24 020F 00 2 1 ; DGain - { - 0x0601, - 0x11, - }, // W 24 0601 11 2 1 ; Test pattern - { - 0x0104, - 0x01, - }, // W 24 0104 01 2 1 ; -}; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_WALKING1S_01_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_debug.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_debug.h deleted file mode 100644 index 61b3699..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_debug.h +++ /dev/null @@ -1,49 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_DEBUG_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_DEBUG_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "HM01B0.h" - -//***************************************************************************** -// -//! @brief Read one frame of data from HM01B0 scaled to 96x96 RGB. -//! -//! @param buffer - Pointer to the frame buffer. -//! @param w - Image width. -//! @param h - Image height. -//! @param channels - Number of channels per pixel. -//! -//! This function reads data of one frame from HM01B0. It trims the image to an -//! even power of two multiple of the requested width and height. It down -//! samples the original image and duplicates the greyscale value for each color -//! channel. -//! -//! @return Error code. -// -//***************************************************************************** - -void hm01b0_framebuffer_dump(uint8_t* frame, uint32_t len); - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_DEBUG_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_optimized.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_optimized.h deleted file mode 100644 index 0c3f912..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/himax_driver/HM01B0_optimized.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_OPTIMIZED_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_OPTIMIZED_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "HM01B0.h" - -//***************************************************************************** -// -//! @brief Read one frame of data from HM01B0 scaled to 96x96 RGB. -//! -//! @param buffer - Pointer to the frame buffer. -//! @param w - Image width. -//! @param h - Image height. -//! @param channels - Number of channels per pixel. -//! -//! This function reads data of one frame from HM01B0. It trims the image to an -//! even power of two multiple of the requested width and height. It down -//! samples the original image and duplicates the greyscale value for each color -//! channel. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_blocking_read_oneframe_scaled(hm01b0_cfg_t* psCfg, - uint8_t* buffer, int w, int h, - int channels); - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_HIMAX_DRIVER_HM01B0_OPTIMIZED_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/image_provider.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/image_provider.h deleted file mode 100644 index cb31099..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/image_provider.h +++ /dev/null @@ -1,39 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_IMAGE_PROVIDER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_IMAGE_PROVIDER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -// This is an abstraction around an image source like a camera, and is -// expected to return 8-bit sample data. The assumption is that this will be -// called in a low duty-cycle fashion in a low-power application. In these -// cases, the imaging sensor need not be run in a streaming mode, but rather can -// be idled in a relatively low-power mode between calls to GetImage(). The -// assumption is that the overhead and time of bringing the low-power sensor out -// of this standby mode is commensurate with the expected duty cycle of the -// application. The underlying sensor may actually be put into a streaming -// configuration, but the image buffer provided to GetImage should not be -// overwritten by the driver code until the next call to GetImage(); -// -// The reference implementation can have no platform-specific dependencies, so -// it just returns a static image. For real applications, you should -// ensure there's a specialized implementation that accesses hardware APIs. -TfLiteStatus GetImage(tflite::ErrorReporter* error_reporter, int image_width, - int image_height, int channels, uint8_t* image_data); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_IMAGE_PROVIDER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/main_functions.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/main_functions.h deleted file mode 100644 index 2620097..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/main_functions.h +++ /dev/null @@ -1,37 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_MAIN_FUNCTIONS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_MAIN_FUNCTIONS_H_ - -// Expose a C friendly interface for main functions. -#ifdef __cplusplus -extern "C" { -#endif - -// Initializes all data needed for the example. The name is important, and needs -// to be setup() for Arduino compatibility. -void setup(); - -// Runs one iteration of data gathering and inference. This should be called -// repeatedly from the application code. The name needs to be loop() for Arduino -// compatibility. -void loop(); - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_MAIN_FUNCTIONS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/model_settings.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/model_settings.h deleted file mode 100644 index e666f82..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/model_settings.h +++ /dev/null @@ -1,35 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_MODEL_SETTINGS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_MODEL_SETTINGS_H_ - -// Keeping these as constant expressions allow us to allocate fixed-sized arrays -// on the stack for our working memory. - -// All of these values are derived from the values used during model training, -// if you change your model you'll need to update these constants. -constexpr int kNumCols = 96; -constexpr int kNumRows = 96; -constexpr int kNumChannels = 1; - -constexpr int kMaxImageSize = kNumCols * kNumRows * kNumChannels; - -constexpr int kCategoryCount = 3; -constexpr int kPersonIndex = 1; -constexpr int kNotAPersonIndex = 2; -extern const char* kCategoryLabels[kCategoryCount]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_MODEL_SETTINGS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/no_person_image_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/no_person_image_data.h deleted file mode 100644 index 4e026af..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/no_person_image_data.h +++ /dev/null @@ -1,30 +0,0 @@ -/* 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. -==============================================================================*/ - -// This data was created from a sample image from without a person in it. -// Convert original image to simpler format: -// convert -resize 96x96\! noperson.PNG noperson.bmp3 -// Skip the 54 byte bmp3 header and add the reset of the bytes to a C array: -// xxd -s 54 -i /tmp/noperson.bmp3 > /tmp/noperson.cc - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_NO_PERSON_IMAGE_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_NO_PERSON_IMAGE_DATA_H_ - -#include - -extern const int g_no_person_data_size; -extern const uint8_t g_no_person_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_NO_PERSON_IMAGE_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/person_detect_model_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/person_detect_model_data.h deleted file mode 100644 index 86471b3..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/person_detect_model_data.h +++ /dev/null @@ -1,27 +0,0 @@ -/* 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. -==============================================================================*/ - -// This is a standard TensorFlow Lite model file that has been converted into a -// C data array, so it can be easily compiled into a binary for devices that -// don't have a file system. It was created using the command: -// xxd -i person_detect.tflite > person_detect_model_data.cc - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_PERSON_DETECT_MODEL_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_PERSON_DETECT_MODEL_DATA_H_ - -extern const unsigned char g_person_detect_model_data[]; -extern const int g_person_detect_model_data_len; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_PERSON_DETECT_MODEL_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/person_image_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/person_image_data.h deleted file mode 100644 index 1e677ed..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection/person_image_data.h +++ /dev/null @@ -1,30 +0,0 @@ -/* 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. -==============================================================================*/ - -// This data was created from a sample image from with a person in it. -// Convert original image to simpler format: -// convert -resize 96x96\! person.PNG person.bmp3 -// Skip the 54 byte bmp3 header and add the reset of the bytes to a C array: -// xxd -s 54 -i /tmp/person.bmp3 > /tmp/person.cc - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_PERSON_IMAGE_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_PERSON_IMAGE_DATA_H_ - -#include - -extern const int g_person_data_size; -extern const uint8_t g_person_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_PERSON_IMAGE_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/detection_responder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/detection_responder.h deleted file mode 100644 index aadad3b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/detection_responder.h +++ /dev/null @@ -1,34 +0,0 @@ -/* 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. -==============================================================================*/ - -// Provides an interface to take an action based on the output from the person -// detection model. - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_DETECTION_RESPONDER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_DETECTION_RESPONDER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -// Called every time the results of a person detection run are available. The -// `person_score` has the numerical confidence that the captured image contains -// a person, and `no_person_score` has the numerical confidence that the image -// does not contain a person. Typically if person_score > no person score, the -// image is considered to contain a person. This threshold may be adjusted for -// particular applications. -void RespondToDetection(tflite::ErrorReporter* error_reporter, - int8_t person_score, int8_t no_person_score); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_DETECTION_RESPONDER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0.h deleted file mode 100644 index f95ee7b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0.h +++ /dev/null @@ -1,402 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_H_ - -#ifdef __cplusplus -extern "C" { -#endif -#include "am_bsp.h" // NOLINT -#include "am_mcu_apollo.h" // NOLINT -#include "am_util.h" // NOLINT - -#define HM01B0_DRV_VERSION (0) -#define HM01B0_DRV_SUBVERSION (3) - -#define HM01B0_DEFAULT_ADDRESS (0x24) - -#define HM01B0_PIXEL_X_NUM (324) -#define HM01B0_PIXEL_Y_NUM (244) - -#define HM01B0_REG_MODEL_ID_H (0x0000) -#define HM01B0_REG_MODEL_ID_L (0x0001) -#define HM01B0_REG_SILICON_REV (0x0002) -#define HM01B0_REG_FRAME_COUNT (0x0005) -#define HM01B0_REG_PIXEL_ORDER (0x0006) - -#define HM01B0_REG_MODE_SELECT (0x0100) -#define HM01B0_REG_IMAGE_ORIENTATION (0x0101) -#define HM01B0_REG_SW_RESET (0x0103) -#define HM01B0_REG_GRP_PARAM_HOLD (0x0104) - -#define HM01B0_REG_I2C_ID_SEL (0x3400) -#define HM01B0_REG_I2C_ID_REG (0x3401) - -#define HM01B0_REG_PMU_PROGRAMMABLE_FRAMECNT (0x3020) - -// #define HM01B0_REG_MODE_SELECT (0x0100) -#define HM01B0_REG_MODE_SELECT_STANDBY (0x00) -#define HM01B0_REG_MODE_SELECT_STREAMING (0x01) -#define HM01B0_REG_MODE_SELECT_STREAMING_NFRAMES (0x03) -#define HM01B0_REG_MODE_SELECT_STREAMING_HW_TRIGGER (0x05) - -// #define HM01B0_REG_IMAGE_ORIENTATION (0x0101) -#define HM01B0_REG_IMAGE_ORIENTATION_DEFAULT (0x00) -#define HM01B0_REG_IMAGE_ORIENTATION_HMIRROR (0x01) -#define HM01B0_REG_IMAGE_ORIENTATION_VMIRROR (0x02) -#define HM01B0_REG_IMAGE_ORIENTATION_HVMIRROR \ - (HM01B0_REG_IMAGE_ORIENTATION_HMIRROR | HM01B0_REG_IMAGE_ORIENTATION_HVMIRROR) - -// #define HM01B0_REG_GRP_PARAM_HOLD (0x0104) -#define HM01B0_REG_GRP_PARAM_HOLD_CONSUME (0x00) -#define HM01B0_REG_GRP_PARAM_HOLD_HOLD (0x01) - -// Helpers for reading raw values from the camera. -#define read_vsync() \ - (AM_REGVAL(AM_REGADDR(GPIO, RDA)) & (1 << HM01B0_PIN_VSYNC)) -#define read_hsync() \ - (AM_REGVAL(AM_REGADDR(GPIO, RDA)) & (1 << HM01B0_PIN_HSYNC)) -#define read_pclk() (AM_REGVAL(AM_REGADDR(GPIO, RDA)) & (1 << HM01B0_PIN_PCLK)) -#define read_byte() (APBDMA->BBINPUT) - -enum { - HM01B0_ERR_OK = 0x00, - HM01B0_ERR_I2C, - HM01B0_ERR_MODE, -}; - -typedef struct { - uint16_t ui16Reg; - uint8_t ui8Val; -} hm_script_t; - -typedef struct { - uint16_t ui16SlvAddr; - am_hal_iom_mode_e eIOMMode; - uint32_t ui32IOMModule; - am_hal_iom_config_t sIOMCfg; - void *pIOMHandle; - - uint32_t ui32CTimerModule; - uint32_t ui32CTimerSegment; - uint32_t ui32CTimerOutputPin; - - uint8_t ui8PinSCL; - uint8_t ui8PinSDA; - uint8_t ui8PinD0; - uint8_t ui8PinD1; - uint8_t ui8PinD2; - uint8_t ui8PinD3; - uint8_t ui8PinD4; - uint8_t ui8PinD5; - uint8_t ui8PinD6; - uint8_t ui8PinD7; - uint8_t ui8PinVSYNC; - uint8_t ui8PinHSYNC; - uint8_t ui8PinPCLK; - - uint8_t ui8PinTrig; - uint8_t ui8PinInt; - void (*pfnGpioIsr)(void); -} hm01b0_cfg_t; - -//***************************************************************************** -// -//! @brief Write HM01B0 registers -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param ui16Reg - Register address. -//! @param pui8Value - Pointer to the data to be written. -//! @param ui32NumBytes - Length of the data in bytes to be written. -//! -//! This function writes value to HM01B0 registers. -//! -//! @return Error code. -// -//***************************************************************************** -static uint32_t hm01b0_write_reg(hm01b0_cfg_t *psCfg, uint16_t ui16Reg, - uint8_t *pui8Value, uint32_t ui32NumBytes); - -//***************************************************************************** -// -//! @brief Read HM01B0 registers -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param ui16Reg - Register address. -//! @param pui8Value - Pointer to the buffer for read data to be put -//! into. -//! @param ui32NumBytes - Length of the data to be read. -//! -//! This function reads value from HM01B0 registers. -//! -//! @return Error code. -// -//***************************************************************************** -static uint32_t hm01b0_read_reg(hm01b0_cfg_t *psCfg, uint16_t ui16Reg, - uint8_t *pui8Value, uint32_t ui32NumBytes); - -//***************************************************************************** -// -//! @brief Load HM01B0 a given script -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param psScrip - Pointer to the script to be loaded. -//! @param ui32ScriptCmdNum - Number of entries in a given script. -//! -//! This function loads HM01B0 a given script. -//! -//! @return Error code. -// -//***************************************************************************** -static uint32_t hm01b0_load_script(hm01b0_cfg_t *psCfg, hm_script_t *psScript, - uint32_t ui32ScriptCmdNum); - -//***************************************************************************** -// -//! @brief Power up HM01B0 -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function powers up HM01B0. -//! -//! @return none. -// -//***************************************************************************** -void hm01b0_power_up(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Power down HM01B0 -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function powers up HM01B0. -//! -//! @return none. -// -//***************************************************************************** -void hm01b0_power_down(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Enable MCLK -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function utilizes CTimer to generate MCLK for HM01B0. -//! -//! @return none. -// -//***************************************************************************** -void hm01b0_mclk_enable(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Disable MCLK -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function disable CTimer to stop MCLK for HM01B0. -//! -//! @return none. -// -//***************************************************************************** -void hm01b0_mclk_disable(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Initialize interfaces -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function initializes interfaces. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_init_if(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Deinitialize interfaces -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function deinitializes interfaces. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_deinit_if(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Get HM01B0 Model ID -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param pui16MID - Pointer to buffer for the read back model ID. -//! -//! This function reads back HM01B0 model ID. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_get_modelid(hm01b0_cfg_t *psCfg, uint16_t *pui16MID); - -//***************************************************************************** -// -//! @brief Initialize HM01B0 -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param psScript - Pointer to HM01B0 initialization script. -//! @param ui32ScriptCmdNum - No. of commands in HM01B0 initialization -//! script. -//! -//! This function initilizes HM01B0 with a given script. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_init_system(hm01b0_cfg_t *psCfg, hm_script_t *psScript, - uint32_t ui32ScriptCmdNum); - -//***************************************************************************** -// -//! @brief Set HM01B0 in the walking 1s test mode -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function sets HM01B0 in the walking 1s test mode. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_test_walking1s(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Software reset HM01B0 -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function resets HM01B0 by issuing a reset command. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_reset_sw(hm01b0_cfg_t *psCfg); - -//***************************************************************************** -// -//! @brief Get current HM01B0 operation mode. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param pui8Mode - Pointer to buffer -//! - for the read back operation mode to be put into -//! -//! This function get HM01B0 operation mode. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_get_mode(hm01b0_cfg_t *psCfg, uint8_t *pui8Mode); - -//***************************************************************************** -// -//! @brief Set HM01B0 operation mode. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param ui8Mode - Operation mode. One of: -//! HM01B0_REG_MODE_SELECT_STANDBY -//! HM01B0_REG_MODE_SELECT_STREAMING -//! HM01B0_REG_MODE_SELECT_STREAMING_NFRAMES -//! HM01B0_REG_MODE_SELECT_STREAMING_HW_TRIGGER -//! @param framecnt - Frame count for -//! HM01B0_REG_MODE_SELECT_STREAMING_NFRAMES. -//! - Discarded if other modes. -//! -//! This function set HM01B0 operation mode. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_set_mode(hm01b0_cfg_t *psCfg, uint8_t ui8Mode, - uint8_t framecnt); - -//***************************************************************************** -// -//! @brief Hardware trigger HM01B0 to stream. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param bTrigger - True to start streaming -//! - False to stop streaming -//! -//! This function triggers HM01B0 to stream by toggling the TRIG pin. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_hardware_trigger_streaming(hm01b0_cfg_t *psCfg, bool bTrigger); - -//***************************************************************************** -// -//! @brief Set HM01B0 mirror mode. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param bHmirror - Horizontal mirror -//! @param bVmirror - Vertical mirror -//! -//! This function set HM01B0 mirror mode. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_set_mirror(hm01b0_cfg_t *psCfg, bool bHmirror, bool bVmirror); - -//***************************************************************************** -// -//! @brief Read data of one frame from HM01B0. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! @param pui8Buffer - Pointer to the frame buffer. -//! @param ui32BufferLen - Framebuffer size. -//! -//! This function read data of one frame from HM01B0. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_blocking_read_oneframe(hm01b0_cfg_t *psCfg, uint8_t *pui8Buffer, - uint32_t ui32BufferLen); - -//***************************************************************************** -// -//! @brief Read data of one frame from HM01B0. -//! -//! @param psCfg - Pointer to HM01B0 configuration structure. -//! -//! This function wakes up the camera and captures a single frame. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_single_frame_capture(hm01b0_cfg_t *psCfg); - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_RAW8_QVGA_8bits_lsb_5fps.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_RAW8_QVGA_8bits_lsb_5fps.h deleted file mode 100644 index ae78ca8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_RAW8_QVGA_8bits_lsb_5fps.h +++ /dev/null @@ -1,510 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_RAW8_QVGA_8BITS_LSB_5FPS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_RAW8_QVGA_8BITS_LSB_5FPS_H_ - -#include "HM01B0.h" - -const hm_script_t sHM01B0InitScript[] = { - // ;************************************************************************* - // ; Sensor: HM01B0 - // ; I2C ID: 24 - // ; Resolution: 324x244 - // ; Lens: - // ; Flicker: - // ; Frequency: - // ; Description: AE control enable - // ; 8-bit mode, LSB first - // ; - // ; - // ; Note: - // ; - // ; $Revision: 1338 $ - // ; $Date:: 2017-04-11 15:43:45 +0800#$ - // ;************************************************************************* - // - // // --------------------------------------------------- - // // HUB system initial - // // --------------------------------------------------- - // W 20 8A04 01 2 1 - // W 20 8A00 22 2 1 - // W 20 8A01 00 2 1 - // W 20 8A02 01 2 1 - // W 20 0035 93 2 1 ; [3]&[1] hub616 20bits in, [5:4]=1 mclk=48/2=24mhz - // W 20 0036 00 2 1 - // W 20 0011 09 2 1 - // W 20 0012 B6 2 1 - // W 20 0014 08 2 1 - // W 20 0015 98 2 1 - // ;W 20 0130 16 2 1 ; 3m soc, signal buffer control - // ;W 20 0100 44 2 1 ; [6] hub616 20bits in - // W 20 0100 04 2 1 ; [6] hub616 20bits in - // W 20 0121 01 2 1 ; [0] Q1 Intf enable, [1]:4bit mode, [2] msb first, [3] - // serial mode - // W 20 0150 00 2 1 ; - // W 20 0150 04 2 1 ; - // - // - // //--------------------------------------------------- - // // Initial - // //--------------------------------------------------- - // W 24 0103 00 2 1 ; software reset-> was 0x22 - { - 0x0103, - 0x00, - }, - // W 24 0100 00 2 1; power up - { - 0x0100, - 0x00, - }, - // - // - // - // //--------------------------------------------------- - // // Analog - // //--------------------------------------------------- - // L HM01B0_analog_setting.txt - { - 0x1003, - 0x08, - }, - { - 0x1007, - 0x08, - }, - { - 0x3044, - 0x0A, - }, - { - 0x3045, - 0x00, - }, - { - 0x3047, - 0x0A, - }, - { - 0x3050, - 0xC0, - }, - { - 0x3051, - 0x42, - }, - { - 0x3052, - 0x50, - }, - { - 0x3053, - 0x00, - }, - { - 0x3054, - 0x03, - }, - { - 0x3055, - 0xF7, - }, - { - 0x3056, - 0xF8, - }, - { - 0x3057, - 0x29, - }, - { - 0x3058, - 0x1F, - }, - { - 0x3059, - 0x1E, - }, - { - 0x3064, - 0x00, - }, - { - 0x3065, - 0x04, - }, - // - // - // //--------------------------------------------------- - // // Digital function - // //--------------------------------------------------- - // - // // BLC - // W 24 1000 43 2 1 ; BLC_on, IIR - { - 0x1000, - 0x43, - }, - // W 24 1001 40 2 1 ; [6] : BLC dithering en - { - 0x1001, - 0x40, - }, - // W 24 1002 32 2 1 ; // blc_darkpixel_thd - { - 0x1002, - 0x32, - }, - // - // // Dgain - // W 24 0350 7F 2 1 ; Dgain Control - { - 0x0350, - 0x7F, - }, - // - // // BLI - // W 24 1006 01 2 1 ; [0] : bli enable - { - 0x1006, - 0x01, - }, - // - // // DPC - // W 24 1008 00 2 1 ; [2:0] : DPC option 0: DPC off 1 : mono 3 : bayer1 5 : - // bayer2 - { - 0x1008, - 0x00, - }, - // W 24 1009 A0 2 1 ; cluster hot pixel th - { - 0x1009, - 0xA0, - }, - // W 24 100A 60 2 1 ; cluster cold pixel th - { - 0x100A, - 0x60, - }, - // W 24 100B 90 2 1 ; single hot pixel th - { - 0x100B, - 0x90, - }, - // W 24 100C 40 2 1 ; single cold pixel th - { - 0x100C, - 0x40, - }, - // // - // advance VSYNC by 1 row - { - 0x3022, - 0x01, - }, - // W 24 1012 00 2 1 ; Sync. enable VSYNC shift - { - 0x1012, - 0x01, - }, - - // - // // ROI Statistic - // W 24 2000 07 2 1 ; [0] : AE stat en [1] : MD LROI stat en [2] : MD GROI - // stat en [3] : RGB stat ratio en [4] : IIR selection (1 -> 16, 0 -> 8) - { - 0x2000, - 0x07, - }, - // W 24 2003 00 2 1 ; MD GROI 0 y start HB - { - 0x2003, - 0x00, - }, - // W 24 2004 1C 2 1 ; MD GROI 0 y start LB - { - 0x2004, - 0x1C, - }, - // W 24 2007 00 2 1 ; MD GROI 1 y start HB - { - 0x2007, - 0x00, - }, - // W 24 2008 58 2 1 ; MD GROI 1 y start LB - { - 0x2008, - 0x58, - }, - // W 24 200B 00 2 1 ; MD GROI 2 y start HB - { - 0x200B, - 0x00, - }, - // W 24 200C 7A 2 1 ; MD GROI 2 y start LB - { - 0x200C, - 0x7A, - }, - // W 24 200F 00 2 1 ; MD GROI 3 y start HB - { - 0x200F, - 0x00, - }, - // W 24 2010 B8 2 1 ; MD GROI 3 y start LB - { - 0x2010, - 0xB8, - }, - // - // W 24 2013 00 2 1 ; MD LRIO y start HB - { - 0x2013, - 0x00, - }, - // W 24 2014 58 2 1 ; MD LROI y start LB - { - 0x2014, - 0x58, - }, - // W 24 2017 00 2 1 ; MD LROI y end HB - { - 0x2017, - 0x00, - }, - // W 24 2018 9B 2 1 ; MD LROI y end LB - { - 0x2018, - 0x9B, - }, - // - // // AE - // W 24 2100 01 2 1 ; [0]: AE control enable - { - 0x2100, - 0x01, - }, - // W 24 2101 07 2 1 ; AE target mean - { - 0x2101, - 0x5F, - }, - // W 24 2102 0A 2 1 ; AE min mean - { - 0x2102, - 0x0A, - }, - // W 24 2104 03 2 1 ; AE Threshold - { - 0x2103, - 0x03, - }, - // W 24 2104 05 2 1 ; AE Threshold - { - 0x2104, - 0x05, - }, - // W 24 2105 01 2 1 ; max INTG Hb - { - 0x2105, - 0x02, - }, - // W 24 2106 54 2 1 ; max INTG Lb - { - 0x2106, - 0x14, - }, - // W 24 2108 02 2 1 ; max AGain in full - { - 0x2107, - 0x02, - }, - // W 24 2108 03 2 1 ; max AGain in full - { - 0x2108, - 0x03, - }, - // W 24 2109 04 2 1 ; max AGain in bin2 - { - 0x2109, - 0x03, - }, - // W 24 210A 00 2 1 ; min AGAIN - { - 0x210A, - 0x00, - }, - // W 24 210B C0 2 1 ; max DGain - { - 0x210B, - 0x80, - }, - // W 24 210C 40 2 1 ; min DGain - { - 0x210C, - 0x40, - }, - // W 24 210D 20 2 1 ; damping factor - { - 0x210D, - 0x20, - }, - // W 24 210E 03 2 1 ; FS ctrl - { - 0x210E, - 0x03, - }, - // W 24 210F 00 2 1 ; FS 60Hz Hb - { - 0x210F, - 0x00, - }, - // W 24 2110 85 2 1 ; FS 60Hz Lb - { - 0x2110, - 0x85, - }, - // W 24 2111 00 2 1 ; Fs 50Hz Hb - { - 0x2111, - 0x00, - }, - // W 24 2112 A0 2 1 ; FS 50Hz Lb - { - 0x2112, - 0xA0, - }, - - // - // - // // MD - // W 24 2150 03 2 1 ; [0] : MD LROI en [1] : MD GROI en - { - 0x2150, - 0x03, - }, - // - // - // //--------------------------------------------------- - // // frame rate : 5 FPS - // //--------------------------------------------------- - // W 24 0340 0C 2 1 ; smia frame length Hb - { - 0x0340, - 0x0C, - }, - // W 24 0341 7A 2 1 ; smia frame length Lb 3192 - { - 0x0341, - 0x7A, - }, - // - // W 24 0342 01 2 1 ; smia line length Hb - { - 0x0342, - 0x01, - }, - // W 24 0343 77 2 1 ; smia line length Lb 375 - { - 0x0343, - 0x77, - }, - // - // //--------------------------------------------------- - // // Resolution : QVGA 324x244 - // //--------------------------------------------------- - // W 24 3010 01 2 1 ; [0] : window mode 0 : full frame 324x324 1 : QVGA - { - 0x3010, - 0x01, - }, - // - // - // W 24 0383 01 2 1 ; - { - 0x0383, - 0x01, - }, - // W 24 0387 01 2 1 ; - { - 0x0387, - 0x01, - }, - // W 24 0390 00 2 1 ; - { - 0x0390, - 0x00, - }, - // - // //--------------------------------------------------- - // // bit width Selection - // //--------------------------------------------------- - // W 24 3011 70 2 1 ; [0] : 6 bit mode enable - { - 0x3011, - 0x70, - }, - // - // - // W 24 3059 02 2 1 ; [7]: Self OSC En, [6]: 4bit mode, [5]: serial mode, - // [4:0]: keep value as 0x02 - { - 0x3059, - 0x02, - }, - // W 24 3060 01 2 1 ; [5]: gated_clock, [4]: msb first, - { - 0x3060, - 0x20, - }, - // ; [3:2]: vt_reg_div -> div by 4/8/1/2 - // ; [1;0]: vt_sys_div -> div by 8/4/2/1 - // - // - { - 0x0101, - 0x01, - }, - // //--------------------------------------------------- - // // CMU update - // //--------------------------------------------------- - // - // W 24 0104 01 2 1 ; was 0100 - { - 0x0104, - 0x01, - }, - // - // - // - // //--------------------------------------------------- - // // Turn on rolling shutter - // //--------------------------------------------------- - // W 24 0100 01 2 1 ; was 0005 ; mode_select 00 : standby - wait fir I2C SW - // trigger 01 : streaming 03 : output "N" frame, then enter standby 04 : - // standby - wait for HW trigger (level), then continuous video out til HW - // TRIG goes off 06 : standby - wait for HW trigger (edge), then output "N" - // frames then enter standby - { - 0x0100, - 0x01, - }, - // - // ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -}; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_RAW8_QVGA_8BITS_LSB_5FPS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_Walking1s_01.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_Walking1s_01.h deleted file mode 100644 index 8818e24..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_Walking1s_01.h +++ /dev/null @@ -1,56 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_WALKING1S_01_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_WALKING1S_01_H_ - -#include "HM01B0.h" - -const hm_script_t sHM01b0TestModeScript_Walking1s[] = { - { - 0x2100, - 0x00, - }, // W 24 2100 00 2 1 ; AE - { - 0x1000, - 0x00, - }, // W 24 1000 00 2 1 ; BLC - { - 0x1008, - 0x00, - }, // W 24 1008 00 2 1 ; DPC - { - 0x0205, - 0x00, - }, // W 24 0205 00 2 1 ; AGain - { - 0x020E, - 0x01, - }, // W 24 020E 01 2 1 ; DGain - { - 0x020F, - 0x00, - }, // W 24 020F 00 2 1 ; DGain - { - 0x0601, - 0x11, - }, // W 24 0601 11 2 1 ; Test pattern - { - 0x0104, - 0x01, - }, // W 24 0104 01 2 1 ; -}; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_WALKING1S_01_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_debug.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_debug.h deleted file mode 100644 index 88d9a0a..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_debug.h +++ /dev/null @@ -1,49 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_DEBUG_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_DEBUG_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "HM01B0.h" - -//***************************************************************************** -// -//! @brief Read one frame of data from HM01B0 scaled to 96x96 RGB. -//! -//! @param buffer - Pointer to the frame buffer. -//! @param w - Image width. -//! @param h - Image height. -//! @param channels - Number of channels per pixel. -//! -//! This function reads data of one frame from HM01B0. It trims the image to an -//! even power of two multiple of the requested width and height. It down -//! samples the original image and duplicates the greyscale value for each color -//! channel. -//! -//! @return Error code. -// -//***************************************************************************** - -void hm01b0_framebuffer_dump(uint8_t* frame, uint32_t len); - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_DEBUG_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_optimized.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_optimized.h deleted file mode 100644 index 61d9b92..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/HM01B0_optimized.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_OPTIMIZED_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_OPTIMIZED_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "HM01B0.h" - -//***************************************************************************** -// -//! @brief Read one frame of data from HM01B0 scaled to 96x96 RGB. -//! -//! @param buffer - Pointer to the frame buffer. -//! @param w - Image width. -//! @param h - Image height. -//! @param channels - Number of channels per pixel. -//! -//! This function reads data of one frame from HM01B0. It trims the image to an -//! even power of two multiple of the requested width and height. It down -//! samples the original image and duplicates the greyscale value for each color -//! channel. -//! -//! @return Error code. -// -//***************************************************************************** -uint32_t hm01b0_blocking_read_oneframe_scaled(hm01b0_cfg_t* psCfg, - int8_t* buffer, int w, int h, - int channels); - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_HM01B0_OPTIMIZED_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/platform_Sparkfun_Edge.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/platform_Sparkfun_Edge.h deleted file mode 100644 index a9dac43..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/himax_driver/platform_Sparkfun_Edge.h +++ /dev/null @@ -1,54 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_PLATFORM_SPARKFUN_EDGE_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_PLATFORM_SPARKFUN_EDGE_H_ - -#ifdef __cplusplus -extern "C" { -#endif - -#define HM01B0_PIN_D0 24 -#define HM01B0_PIN_D1 25 -#define HM01B0_PIN_D2 26 -#define HM01B0_PIN_D3 27 -#define HM01B0_PIN_D4 28 -#define HM01B0_PIN_D5 5 -#define HM01B0_PIN_D6 6 -#define HM01B0_PIN_D7 7 -#define HM01B0_PIN_VSYNC 15 -#define HM01B0_PIN_HSYNC 22 -#define HM01B0_PIN_PCLK 23 -#define HM01B0_PIN_TRIG 12 -#define HM01B0_PIN_INT 4 -#define HM01B0_PIN_SCL 8 -#define HM01B0_PIN_SDA 9 -#define HM01B0_PIN_DVDD_EN 10 - -// Define AP3B's CTIMER and output pin for HM01B0 MCLK generation -#define HM01B0_MCLK_GENERATOR_MOD 0 -#define HM01B0_MCLK_GENERATOR_SEG AM_HAL_CTIMER_TIMERB -#define HM01B0_PIN_MCLK 13 - -// Deifne I2C controller and SCL(pin8)/SDA(pin9) are configured automatically. -#define HM01B0_IOM_MODE AM_HAL_IOM_I2C_MODE -#define HM01B0_IOM_MODULE 1 -#define HM01B0_I2C_CLOCK_FREQ AM_HAL_IOM_100KHZ - -#ifdef __cplusplus -} -#endif - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_HIMAX_DRIVER_PLATFORM_SPARKFUN_EDGE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/image_provider.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/image_provider.h deleted file mode 100644 index 089729c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/image_provider.h +++ /dev/null @@ -1,39 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_IMAGE_PROVIDER_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_IMAGE_PROVIDER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/micro/micro_error_reporter.h" - -// This is an abstraction around an image source like a camera, and is -// expected to return 8-bit sample data. The assumption is that this will be -// called in a low duty-cycle fashion in a low-power application. In these -// cases, the imaging sensor need not be run in a streaming mode, but rather can -// be idled in a relatively low-power mode between calls to GetImage(). The -// assumption is that the overhead and time of bringing the low-power sensor out -// of this standby mode is commensurate with the expected duty cycle of the -// application. The underlying sensor may actually be put into a streaming -// configuration, but the image buffer provided to GetImage should not be -// overwritten by the driver code until the next call to GetImage(); -// -// The reference implementation can have no platform-specific dependencies, so -// it just returns a static image. For real applications, you should -// ensure there's a specialized implementation that accesses hardware APIs. -TfLiteStatus GetImage(tflite::ErrorReporter* error_reporter, int image_width, - int image_height, int channels, int8_t* image_data); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_IMAGE_PROVIDER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/main_functions.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/main_functions.h deleted file mode 100644 index 7bfedf1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/main_functions.h +++ /dev/null @@ -1,28 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_MAIN_FUNCTIONS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_MAIN_FUNCTIONS_H_ - -// Initializes all data needed for the example. The name is important, and needs -// to be setup() for Arduino compatibility. -void setup(); - -// Runs one iteration of data gathering and inference. This should be called -// repeatedly from the application code. The name needs to be loop() for Arduino -// compatibility. -void loop(); - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_MAIN_FUNCTIONS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/model_settings.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/model_settings.h deleted file mode 100644 index f6c968e..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/model_settings.h +++ /dev/null @@ -1,35 +0,0 @@ -/* 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_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_MODEL_SETTINGS_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_MODEL_SETTINGS_H_ - -// Keeping these as constant expressions allow us to allocate fixed-sized arrays -// on the stack for our working memory. - -// All of these values are derived from the values used during model training, -// if you change your model you'll need to update these constants. -constexpr int kNumCols = 96; -constexpr int kNumRows = 96; -constexpr int kNumChannels = 1; - -constexpr int kMaxImageSize = kNumCols * kNumRows * kNumChannels; - -constexpr int kCategoryCount = 2; -constexpr int kPersonIndex = 1; -constexpr int kNotAPersonIndex = 0; -extern const char* kCategoryLabels[kCategoryCount]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_MODEL_SETTINGS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/no_person_image_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/no_person_image_data.h deleted file mode 100644 index d3db7be..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/no_person_image_data.h +++ /dev/null @@ -1,30 +0,0 @@ -/* 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. -==============================================================================*/ - -// This data was created from a sample image from without a person in it. -// Convert original image to simpler format: -// convert -resize 96x96\! noperson.PNG noperson.bmp3 -// Skip the 54 byte bmp3 header and add the reset of the bytes to a C array: -// xxd -s 54 -i /tmp/noperson.bmp3 > /tmp/noperson.cc - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_NO_PERSON_IMAGE_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_NO_PERSON_IMAGE_DATA_H_ - -#include - -extern const int g_no_person_data_size; -extern const uint8_t g_no_person_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_NO_PERSON_IMAGE_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/person_detect_model_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/person_detect_model_data.h deleted file mode 100644 index 5d1b59f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/person_detect_model_data.h +++ /dev/null @@ -1,27 +0,0 @@ -/* 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. -==============================================================================*/ - -// This is a standard TensorFlow Lite model file that has been converted into a -// C data array, so it can be easily compiled into a binary for devices that -// don't have a file system. It was created using the command: -// xxd -i person_detect.tflite > person_detect_model_data.cc - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_PERSON_DETECT_MODEL_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_PERSON_DETECT_MODEL_DATA_H_ - -extern const unsigned char g_person_detect_model_data[]; -extern const int g_person_detect_model_data_len; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_PERSON_DETECT_MODEL_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/person_image_data.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/person_image_data.h deleted file mode 100644 index 13e1666..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/examples/person_detection_experimental/person_image_data.h +++ /dev/null @@ -1,30 +0,0 @@ -/* 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. -==============================================================================*/ - -// This data was created from a sample image from with a person in it. -// Convert original image to simpler format: -// convert -resize 96x96\! person.PNG person.bmp3 -// Skip the 54 byte bmp3 header and add the reset of the bytes to a C array: -// xxd -s 54 -i /tmp/person.bmp3 > /tmp/person.cc - -#ifndef TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_PERSON_IMAGE_DATA_H_ -#define TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_PERSON_IMAGE_DATA_H_ - -#include - -extern const int g_person_data_size; -extern const uint8_t g_person_data[]; - -#endif // TENSORFLOW_LITE_MICRO_EXAMPLES_PERSON_DETECTION_EXPERIMENTAL_PERSON_IMAGE_DATA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/activation_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/activation_utils.h deleted file mode 100644 index 95ecc26..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/activation_utils.h +++ /dev/null @@ -1,57 +0,0 @@ -/* 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_MICRO_KERNELS_ACTIVATION_UTILS_H_ -#define TENSORFLOW_LITE_MICRO_KERNELS_ACTIVATION_UTILS_H_ - -#include -#include - -#include "tensorflow/lite/c/builtin_op_data.h" -#include "tensorflow/lite/kernels/internal/cppmath.h" -#include "tensorflow/lite/kernels/internal/max.h" -#include "tensorflow/lite/kernels/internal/min.h" - -namespace tflite { -namespace ops { -namespace micro { - -// Returns the floating point value for a fused activation: -inline float ActivationValFloat(TfLiteFusedActivation act, float a) { - switch (act) { - case kTfLiteActNone: - return a; - case kTfLiteActRelu: - return TfLiteMax(0.0f, a); - case kTfLiteActReluN1To1: - return TfLiteMax(-1.0f, TfLiteMin(a, 1.0f)); - case kTfLiteActRelu6: - return TfLiteMax(0.0f, TfLiteMin(a, 6.0f)); - case kTfLiteActTanh: - return std::tanh(a); - case kTfLiteActSignBit: - return std::signbit(a); - case kTfLiteActSigmoid: - return 1.0f / (1.0f + std::exp(-a)); - } - return 0.0f; // To indicate an unsupported activation (i.e. when a new fused - // activation is added to the enum and not handled here). -} - -} // namespace micro -} // namespace ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_KERNELS_ACTIVATION_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/mli_slicers.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/mli_slicers.h deleted file mode 100644 index b21a5b6..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/mli_slicers.h +++ /dev/null @@ -1,56 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_SLICERS_H_ -#define TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_SLICERS_H_ - -#include "mli_api.h" // NOLINT -namespace tflite { -namespace ops { -namespace micro { - -class TensorSlicer { - public: - TensorSlicer(const mli_tensor* full_tensor, int slice_dim, int slice_size, - int padding_pre = 0, int padding_post = 0, int overlap = 0, - bool interleave_mode = false); - ~TensorSlicer() = default; - - void Next(); - bool Done(); - int GetPaddingPre(); - int GetPaddingPost(); - - mli_tensor* Sub(); - - // Default constructor is deleted - TensorSlicer() = delete; - - private: - const mli_tensor* full_tensor_; - mli_tensor sub_tensor_; - mli_sub_tensor_cfg sub_cfg_; - bool done_; - int sliceDim_; - int pad_pre_, pad_post_, overlap_; - int actual_padding_pre, actual_padding_post; - - void ComputeSubTensor(); -}; - -} // namespace micro -} // namespace ops -} // namespace tflite -#endif // TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_SLICERS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/mli_tf_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/mli_tf_utils.h deleted file mode 100644 index 2888ad5..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/mli_tf_utils.h +++ /dev/null @@ -1,111 +0,0 @@ -/* 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_MICRO_KERNELS_ARC_MLI_TF_UTILS_H_ -#define TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_TF_UTILS_H_ - -#include "mli_api.h" // NOLINT -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/tensor_ctypes.h" - -constexpr int kFracBitsQ15 = 15; -constexpr int kFracBitsQ31 = 31; - -namespace tflite { -namespace ops { -namespace micro { - -template -static void ConvertToMliTensorData(const TfLiteTensor* tfT, mli_tensor* mliT) { - mliT->data = (void*)GetTensorData(tfT); - if (tfT->type == kTfLiteInt8) { - mliT->el_type = MLI_EL_ASYM_I8; - } else if (tfT->type == kTfLiteInt32) { - mliT->el_type = MLI_EL_ASYM_I32; - } else { - TF_LITE_FATAL("Wrong data type. Expected int8_t or int32_t."); - } - - mliT->capacity = tfT->bytes; - mliT->rank = GetTensorShape(tfT).DimensionsCount(); - for (int i = 0; i < GetTensorShape(tfT).DimensionsCount(); i++) { - mliT->shape[i] = GetTensorShape(tfT).Dims(i); - } -} - -static void ConvertToMliQuantParams(const TfLiteTensor* tfT, mli_tensor* mliT) { - mliT->el_params.asym.dim = -1; - mliT->el_params.asym.zero_point.i16 = tfT->params.zero_point; - float fscale = tfT->params.scale; - int exp; - frexpf(fscale, &exp); - int frac_bits = kFracBitsQ31 - exp; - int32_t iscale = (int32_t)((1ll << frac_bits) * fscale + 0.5f); - mliT->el_params.asym.scale_frac_bits = frac_bits; - mliT->el_params.asym.scale.i32 = (int32_t)iscale; -} - -static inline void ConvertToMliQuantParamsPerChannel(const TfLiteTensor* tfT, - mli_tensor* mliT) { - // mli tensor scale and zero_point arrays should be allocated at this point - TFLITE_DCHECK_NE(mliT->el_params.asym.scale.pi16, 0); - TFLITE_DCHECK_NE(mliT->el_params.asym.zero_point.pi16, 0); - - // get per channel quantization parameters - const auto* affine_quantization = - reinterpret_cast(tfT->quantization.params); - mliT->el_params.asym.dim = affine_quantization->quantized_dimension; - - // find frac_bits - const int num_channels = - mliT->shape[affine_quantization->quantized_dimension]; - int min_frac_bits; - float* fscale = affine_quantization->scale->data; - for (int i = 0; i < num_channels; i++) { - int exp; - frexpf(fscale[i], &exp); - int cur_frac_bits = kFracBitsQ31 - exp; - if (i == 0) { - min_frac_bits = cur_frac_bits; - } else { - min_frac_bits = - min_frac_bits < cur_frac_bits ? min_frac_bits : cur_frac_bits; - } - } - mliT->el_params.asym.scale_frac_bits = min_frac_bits; - - for (int i = 0; i < num_channels; i++) { - int32_t iscale = (int32_t)((1ll << min_frac_bits) * fscale[i] + 0.5f); - mliT->el_params.asym.scale.pi32[i] = iscale; - } -} - -template -static void ConvertToMliTensor(const TfLiteTensor* tfT, mli_tensor* mliT) { - ConvertToMliTensorData(tfT, mliT); - ConvertToMliQuantParams(tfT, mliT); -} - -template -static void ConvertToMliTensorPerChannel(const TfLiteTensor* tfT, - mli_tensor* mliT) { - ConvertToMliTensorData(tfT, mliT); - ConvertToMliQuantParamsPerChannel(tfT, mliT); -} -} // namespace micro -} // namespace ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_KERNELS_ARC_MLI_TF_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/scratch_buf_mgr.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/scratch_buf_mgr.h deleted file mode 100644 index 0db2db5..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/scratch_buf_mgr.h +++ /dev/null @@ -1,129 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_ARC_SCRATCH_BUF_MGR_H_ -#define TENSORFLOW_LITE_MICRO_ARC_SCRATCH_BUF_MGR_H_ - -#include "mli_api.h" // NOLINT -#include "tensorflow/lite/c/common.h" - -namespace tflite { -namespace ops { -namespace micro { - -/** - * @brief Function to allocate scratch buffers for the convolution tensors - * - * @detail This function will update the data pointers in the 4 tensors with - * pointers to scratch buffers in fast local memory. - * - * @param context [I] pointer to TfLite context (needed for error handling) - * @param in [IO] pointer to the input tensor - * @param weights [IO] pointer to the weights tensor - * @param bias [IO] pointer to the bias tensor - * @param output [IO] pointer to the output tensor - * - * @return Tf Lite status code - */ -TfLiteStatus get_arc_scratch_buffer_for_conv_tensors(TfLiteContext* context, - mli_tensor* in, - mli_tensor* weights, - mli_tensor* bias, - mli_tensor* out); - -/** - * @brief Function to allocate scratch buffers for pooling kernels with only - * input and output buffers - * - * @detail This function will update the data pointers in the 2 tensors with - * pointers to scratch buffers in fast local memory. - * - * @param context [I] pointer to TfLite context (needed for error handling) - * @param in [IO] pointer to the input tensor - * @param output [IO] pointer to the output tensor - * - * @return Tf Lite status code - */ -TfLiteStatus get_arc_scratch_buffer_for_pooling_tensors(TfLiteContext* context, - mli_tensor* in, - mli_tensor* out); - -/** - * @brief Function to allocate scratch buffers for the fully connect tensors - * - * @detail This function will update the data pointers in the 4 tensors with - * pointers to scratch buffers in fast local memory. - * - * @param context [I] pointer to TfLite context (needed for error handling) - * @param in [IO] pointer to the input tensor - * @param weights [IO] pointer to the weights tensor - * @param bias [IO] pointer to the bias tensor - * @param output [IO] pointer to the output tensor - * - * @return Tf Lite status code - */ -TfLiteStatus get_arc_scratch_buffer_for_fully_connect_tensors( - TfLiteContext* context, mli_tensor* in, mli_tensor* weights, - mli_tensor* bias, mli_tensor* out); - -/** - * @brief Function to calculate slice size for io tensors - * - * @detail This function will calculate the slice size in the height dimension - * for input and output tensors. it takes into account the kernel size and the - * padding. the function will look at the capacity filed in the in and out - * tensor to determine the available buffersize. - * - * @param in [I] pointer to the input tensor - * @param out [I] pointer to the output tensor - * @param kernelHeight [I] size of the kernel in height dimension - * @param strideHeight [I] input stride in height dimension - * @param padding_top [I] number of lines with zeros at the top - * @param padding_bot [I] number of lines with zeros at the bottom - * @param inSliceHeight [O] slice size in height dimension for the input tensor - * @param outSliceHeight [O] slice size in height dimension for the output - * tensor - * - * @return Tf Lite status code - */ -TfLiteStatus arc_scratch_buffer_calc_slice_size_io( - const mli_tensor* in, const mli_tensor* out, const int kernelHeight, - const int strideHeight, const int padding_top, const int padding_bot, - int* in_slice_height, int* out_slice_height); - -/** - * @brief Function to calculate slice size for weight slicing - * - * @detail This function will calculate the slice size in the output channel - * dimension for weight and bias tensors. the function will look at the capacity - * filed in the weights and bias tensor to determine the available buffersize. - * - * @param weights [I] pointer to the input tensor - * @param bias [I] pointer to the output tensor - * @param weightOutChDimension [I] dimension of the output channels in the - * weights tensor - * @param sliceChannels [O] slice size in output channel dimension - * - * @return Tf Lite status code - */ -TfLiteStatus arc_scratch_buffer_calc_slice_size_weights( - const mli_tensor* weights, const mli_tensor* bias, - const int weight_out_ch_dimension, int* slice_channels); - -} // namespace micro -} // namespace ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_ARC_SCRATCH_BUF_MGR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/scratch_buffers.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/scratch_buffers.h deleted file mode 100644 index 6e3feb3..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/arc_mli/scratch_buffers.h +++ /dev/null @@ -1,68 +0,0 @@ -/* 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_MICRO_ARC_SCRATCH_BUFFERS_H_ -#define TENSORFLOW_LITE_MICRO_ARC_SCRATCH_BUFFERS_H_ - -#include "mli_api.h" // NOLINT -#include "tensorflow/lite/c/common.h" - -namespace tflite { -namespace ops { -namespace micro { - -void init_arc_scratch_buffers(void); -void* get_arc_scratch_buffer(int size); // Function to assign fast memory - // from one of 3 scratch buffers. - -void get_arc_scratch_buffer_max_size(int* size); -void get_arc_scratch_buffer_two_max_sizes(int* size1, int* size2); - -static inline bool inside_arc_dccm(void* p) { -#if core_config_dccm_present - return ((unsigned)p >= core_config_dccm_base) && - ((unsigned)p < core_config_dccm_base + core_config_dccm_size); -#else - return false; -#endif -} - -static inline bool inside_arc_xccm(void* p) { -#if core_config_xy - return ((unsigned)p >= core_config_xy_x_base) && - ((unsigned)p < core_config_xy_x_base + core_config_xy_size); -#else - return false; -#endif -} - -static inline bool inside_arc_yccm(void* p) { -#if core_config_xy - return ((unsigned)p >= core_config_xy_y_base) && - ((unsigned)p < core_config_xy_y_base + core_config_xy_size); -#else - return false; -#endif -} - -static inline bool inside_arc_ccm(void* p) { - return inside_arc_dccm(p) || inside_arc_xccm(p) || inside_arc_yccm(p); -} - -} // namespace micro -} // namespace ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_ARC_SCRATCH_BUFFERS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/fully_connected.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/fully_connected.h deleted file mode 100644 index 3e64671..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/fully_connected.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_MICRO_KERNELS_FULLY_CONNECTED_H_ -#define TENSORFLOW_LITE_MICRO_KERNELS_FULLY_CONNECTED_H_ - -#include "tensorflow/lite/c/common.h" - -namespace tflite { - -// This is the most generic TfLiteRegistration. The actual supported types may -// still be target dependent. The only requirement is that every implementation -// (reference or optimized) must define this function. -TfLiteRegistration Register_FULLY_CONNECTED(); - -#if defined(CMSIS_NN) || defined(ARDUINO) -// The Arduino is a special case where we use the CMSIS kernels, but because of -// the current approach to building for Arduino, we do not support -DCMSIS_NN as -// part of the build. As a result, we use defined(ARDUINO) as proxy for the -// CMSIS kernels for this one special case. - -// Returns a TfLiteRegistration struct for cmsis-nn kernel variant that only -// supports int8. -TfLiteRegistration Register_FULLY_CONNECTED_INT8(); - -#else -// Note that while this block gets used for both reference and optimized kernels -// that do not have any specialized implementations, the only goal here is to -// define fallback implementation that allow reference kernels to still be used -// from applications that call a more specific kernel variant. - -inline TfLiteRegistration Register_FULLY_CONNECTED_INT8() { - return Register_FULLY_CONNECTED(); -} - -#endif -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_KERNELS_FULLY_CONNECTED_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/kernel_runner.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/kernel_runner.h deleted file mode 100644 index 45d107e..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/kernel_runner.h +++ /dev/null @@ -1,83 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_KERNELS_KERNEL_RUNNER_H_ -#define TENSORFLOW_LITE_MICRO_KERNELS_KERNEL_RUNNER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/micro/simple_memory_allocator.h" - -namespace tflite { -namespace micro { - -// Helper class to perform a simulated kernel (i.e. TfLiteRegistration) lifecyle -// (init, prepare, invoke). All internal allocations are handled by this class. -// Simply pass in the registration, list of required tensors, inputs array, -// outputs array, and any pre-builtin data. Calling Invoke() will automatically -// walk the kernl and outputs will be ready on the the TfLiteTensor output -// provided during construction. -class KernelRunner { - public: - KernelRunner(const TfLiteRegistration& registration, TfLiteTensor* tensors, - int tensors_size, TfLiteIntArray* inputs, - TfLiteIntArray* outputs, void* builtin_data, - ErrorReporter* error_reporter); - - // Calls init and prepare on the kernel (i.e. TfLiteRegistration) struct. Any - // exceptions will be reported through the error_reporter and returned as a - // status code here. - TfLiteStatus InitAndPrepare(const char* init_data = nullptr); - - // Calls init, prepare, and invoke on a given TfLiteRegistration pointer. - // After successful invoke, results will be available in the output tensor as - // passed into the constructor of this class. - TfLiteStatus Invoke(); - - protected: - static TfLiteTensor* GetTensor(const struct TfLiteContext* context, - int tensor_index); - static TfLiteEvalTensor* GetEvalTensor(const struct TfLiteContext* context, - int tensor_index); - static void* AllocatePersistentBuffer(TfLiteContext* context, size_t bytes); - static TfLiteStatus RequestScratchBufferInArena(TfLiteContext* context, - size_t bytes, - int* buffer_index); - static void* GetScratchBuffer(TfLiteContext* context, int buffer_index); - static void ReportOpError(struct TfLiteContext* context, const char* format, - ...); - - private: - static constexpr int kNumScratchBuffers_ = 5; - - static constexpr int kKernelRunnerBufferSize_ = 10000; - static uint8_t kKernelRunnerBuffer_[kKernelRunnerBufferSize_]; - - SimpleMemoryAllocator* allocator_ = nullptr; - const TfLiteRegistration& registration_; - TfLiteTensor* tensors_ = nullptr; - ErrorReporter* error_reporter_ = nullptr; - - TfLiteContext context_ = {}; - TfLiteNode node_ = {}; - - int scratch_buffer_count_ = 0; - uint8_t* scratch_buffers_[kNumScratchBuffers_]; -}; - -} // namespace micro -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_KERNELS_KERNEL_RUNNER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/kernel_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/kernel_util.h deleted file mode 100644 index 79cd58e..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/kernel_util.h +++ /dev/null @@ -1,75 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_KERNELS_KERNEL_UTIL_H_ -#define TENSORFLOW_LITE_MICRO_KERNELS_KERNEL_UTIL_H_ - -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace tflite { -namespace micro { - -// Returns a mutable tensor for a given input index. is_variable must be checked -// during prepare when the full TfLiteTensor is available. -inline TfLiteEvalTensor* GetMutableEvalInput(const TfLiteContext* context, - const TfLiteNode* node, - int index) { - TFLITE_DCHECK(context != nullptr); - TFLITE_DCHECK(node != nullptr); - return context->GetEvalTensor(context, node->inputs->data[index]); -} - -// Returns the TfLiteEvalTensor struct for a given input index in a node. -inline const TfLiteEvalTensor* GetEvalInput(const TfLiteContext* context, - const TfLiteNode* node, int index) { - return GetMutableEvalInput(context, node, index); -} - -// Returns the TfLiteEvalTensor struct for a given output index in a node. -inline TfLiteEvalTensor* GetEvalOutput(const TfLiteContext* context, - const TfLiteNode* node, int index) { - TFLITE_DCHECK(context != nullptr); - TFLITE_DCHECK(node != nullptr); - return context->GetEvalTensor(context, node->outputs->data[index]); -} - -// Returns data for a TfLiteEvalTensor struct. -template -T* GetTensorData(TfLiteEvalTensor* tensor) { - return tensor != nullptr ? reinterpret_cast(tensor->data.raw) : nullptr; -} - -// Returns const data for a TfLiteEvalTensor struct. -template -const T* GetTensorData(const TfLiteEvalTensor* tensor) { - TFLITE_DCHECK(tensor != nullptr); - return reinterpret_cast(tensor->data.raw); -} - -// Returns the shape of a TfLiteEvalTensor struct. -const RuntimeShape GetTensorShape(const TfLiteEvalTensor* tensor); - -// Return true if the given tensors have the same shape. -bool HaveSameShapes(const TfLiteEvalTensor* input1, - const TfLiteEvalTensor* input2); - -} // namespace micro -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_KERNELS_KERNEL_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/micro_ops.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/micro_ops.h deleted file mode 100644 index a65fc4f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/micro_ops.h +++ /dev/null @@ -1,100 +0,0 @@ -/* 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_MICRO_KERNELS_MICRO_OPS_H_ -#define TENSORFLOW_LITE_MICRO_KERNELS_MICRO_OPS_H_ - -#include "tensorflow/lite/c/common.h" - -// Forward declaration of all micro op kernel registration methods. These -// registrations are included with the standard `BuiltinOpResolver`. -// -// This header is particularly useful in cases where only a subset of ops are -// needed. In such cases, the client can selectively add only the registrations -// their model requires, using a custom `(Micro)MutableOpResolver`. Selective -// registration in turn allows the linker to strip unused kernels. - -namespace tflite { - -// TFLM is incrementally moving towards a flat tflite namespace -// (https://abseil.io/tips/130). Any new ops (or cleanup of existing ops should -// have their Register function declarations in the tflite namespace. - -TfLiteRegistration Register_CONV_2D(); -TfLiteRegistration Register_DEPTHWISE_CONV_2D(); -TfLiteRegistration Register_QUANTIZE(); -TfLiteRegistration Register_SHAPE(); -TfLiteRegistration Register_SOFTMAX(); -TfLiteRegistration Register_SVDF(); - -namespace ops { -namespace micro { - -TfLiteRegistration Register_ABS(); -TfLiteRegistration Register_ADD(); -TfLiteRegistration Register_ARG_MAX(); -TfLiteRegistration Register_ARG_MIN(); -TfLiteRegistration Register_AVERAGE_POOL_2D(); -TfLiteRegistration Register_CEIL(); -// TODO(b/160234179): Change custom OPs to also return by value. -TfLiteRegistration* Register_CIRCULAR_BUFFER(); -TfLiteRegistration Register_CONCATENATION(); -TfLiteRegistration Register_COS(); -TfLiteRegistration Register_DEQUANTIZE(); -TfLiteRegistration Register_EQUAL(); -TfLiteRegistration Register_FLOOR(); -TfLiteRegistration Register_GREATER(); -TfLiteRegistration Register_GREATER_EQUAL(); -TfLiteRegistration Register_HARD_SWISH(); -TfLiteRegistration Register_LESS(); -TfLiteRegistration Register_LESS_EQUAL(); -TfLiteRegistration Register_LOG(); -TfLiteRegistration Register_LOGICAL_AND(); -TfLiteRegistration Register_LOGICAL_NOT(); -TfLiteRegistration Register_LOGICAL_OR(); -TfLiteRegistration Register_LOGISTIC(); -TfLiteRegistration Register_MAXIMUM(); -TfLiteRegistration Register_MAX_POOL_2D(); -TfLiteRegistration Register_MEAN(); -TfLiteRegistration Register_MINIMUM(); -TfLiteRegistration Register_MUL(); -TfLiteRegistration Register_NEG(); -TfLiteRegistration Register_NOT_EQUAL(); -TfLiteRegistration Register_PACK(); -TfLiteRegistration Register_PAD(); -TfLiteRegistration Register_PADV2(); -TfLiteRegistration Register_PRELU(); -TfLiteRegistration Register_REDUCE_MAX(); -TfLiteRegistration Register_RELU(); -TfLiteRegistration Register_RELU6(); -TfLiteRegistration Register_RESHAPE(); -TfLiteRegistration Register_RESIZE_NEAREST_NEIGHBOR(); -TfLiteRegistration Register_ROUND(); -TfLiteRegistration Register_RSQRT(); -TfLiteRegistration Register_SIN(); -TfLiteRegistration Register_SPLIT(); -TfLiteRegistration Register_SPLIT_V(); -TfLiteRegistration Register_SQRT(); -TfLiteRegistration Register_SQUARE(); -TfLiteRegistration Register_STRIDED_SLICE(); -TfLiteRegistration Register_SUB(); -TfLiteRegistration Register_UNPACK(); -TfLiteRegistration Register_L2_NORMALIZATION(); -TfLiteRegistration Register_TANH(); - -} // namespace micro -} // namespace ops -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_KERNELS_MICRO_OPS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/micro_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/micro_utils.h deleted file mode 100644 index 85db263..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/micro_utils.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2018 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_MICRO_KERNELS_MICRO_UTILS_H_ -#define TENSORFLOW_LITE_MICRO_KERNELS_MICRO_UTILS_H_ -namespace tflite { -namespace ops { -namespace micro { - -// Same as gtl::Greater but defined here to reduce dependencies and -// binary size for micro environment. -struct Greater { - template - bool operator()(const T& x, const T& y) const { - return x > y; - } -}; - -struct Less { - template - bool operator()(const T& x, const T& y) const { - return x < y; - } -}; - -} // namespace micro -} // namespace ops -} // namespace tflite -#endif // TENSORFLOW_LITE_MICRO_KERNELS_MICRO_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifi/xtensa_tf_micro_common.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifi/xtensa_tf_micro_common.h deleted file mode 100755 index cf74128..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifi/xtensa_tf_micro_common.h +++ /dev/null @@ -1,80 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2019 Cadence Design Systems, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to use this Software with Cadence processor cores only and - * not with any other processors and platforms, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ******************************************************************************/ - -/* Copyright 2018 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 __XTENSA_TF_MICRO_COMMON__ -#define __XTENSA_TF_MICRO_COMMON__ - -#include "xa_nnlib_api.h" -#include "xa_nnlib_standards.h" - -#define CHECK_ERR_HIFI_NNLIB_KER(ret, err_msg) \ - if (ret != 0) { \ - TF_LITE_KERNEL_LOG(context, err_msg); \ - return kTfLiteError; \ - } - -#ifndef XTENSA_NNLIB_MAX_SCRATCH_SIZE -#define XTENSA_NNLIB_MAX_SCRATCH_SIZE (70 * 1024) -#endif - -#define ALLOCATE_XTENSA_NNLIB_SCRATCH_MEM \ - uint8_t xtensa_nnlib_scratch_buf[XTENSA_NNLIB_MAX_SCRATCH_SIZE]; - -#define MIN(a, b) (a) < (b) ? (a) : (b); -#define MAX(a, b) (a) > (b) ? (a) : (b); - -#define ACTIVATION_MIN_MAX(data_type, out, inp, min, max) \ - { \ - data_type temp = MAX(inp, min); \ - out = MIN(temp, max); \ - } - -#define ACTIVATION_MIN_MAX_F32(out, inp, min, max) \ - { \ - float temp = MAX(inp, min); \ - out = MIN(temp, max); \ - } - -#define ACTIVATION_MIN_MAX_ASYM8(out, inp, min, max) \ - { \ - int32_t temp = MAX((int32_t)inp, min); \ - out = (uint8_t)MIN(temp, max); \ - } - -#define ALIGNED_SIZE(x, bytes) (((x) + (bytes - 1)) & (~(bytes - 1))) -#define ALIGN_PTR(x, bytes) ((((unsigned)(x)) + (bytes - 1)) & (~(bytes - 1))) - -#endif /* __XTENSA_TF_MICRO_COMMON__ */ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini/fixedpoint_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini/fixedpoint_utils.h deleted file mode 100644 index a1d14df..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini/fixedpoint_utils.h +++ /dev/null @@ -1,137 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_HIFIMINI_FIXEDPOINT_UTILS_H_ -#define TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_HIFIMINI_FIXEDPOINT_UTILS_H_ - -#include - -#include -#include -#include - -#include "tensorflow/lite/kernels/internal/compatibility.h" - -namespace tflite { - -// INT24 MIN/MAX -#define INT24_MIN -8388608 -#define INT24_MAX 8388607 - -// Multiply 24bit value by a quantized multiplier (w/ shift) and returns a 48bit -// aligned value in the QR register. -inline ae_q56s MultiplyByQuantizedMultiplier(ae_p24x2s x_24x2, - int32_t quantized_multiplier, - int shift) { - // A value with 1 sign bit, N integer bits and M fractional bits is - // represented as QN+1.M since the sign bit is included in the integer bits. - // - // The Q notation in this method explains the values represented in each - // variable, along with an implicit division since the quantized_multiplier - // represents a value between 0.5 and 1.0 (Q1.X-1 where X is the bit precision - // of the type). - // - // Load the quantized multiplier into the PR register. - // NOTE: This method assumes that this param has been calculated for 24bit - // space - not 32bits. - // Q32.0 / 2^23 -> Q24.0 / 2^23 representing a Q1.23 multiplier. - ae_p24x2s quantized_multiplier_24x2 = AE_MOVPA24(quantized_multiplier); - // Shift right by 23 - 16 bits minus the specified shift. This is because we - // keep 16 fractional bits until the end to perform rounding. Subtract shift - // since shift is a left shift, and the 23-16 is a right shift. - int shift_amount = 7 - shift; - - // Find the product of x and the quantized_multiplier. - // Q24.0 / 2^23 * Q24.0 = Q48.0 / 2^23 - // Q48.0 / 2^23 >> 7 = Q48.0 / 2^16 - ae_q56s result_56 = AE_MULP24S_HH(x_24x2, quantized_multiplier_24x2); - - // Shift right if shift amount is positive, left if shift amount is negative. - if (shift_amount >= 0) { - result_56 = AE_Q56S_SRA(result_56, shift_amount); - } else { - result_56 = AE_Q56S_SLA(result_56, -shift_amount); - } - - // Round off the bottom 16 bits. - // Q48.0 / 2^16 -> Q32.0 aligned to 48 bits. - result_56 = AE_ROUNDSQ32SYM(result_56); - return result_56; -} - -// Multiply 32bit value by a quantized multiplier (w/ shift) and returns a 48bit -// aligned value in the QR register. -inline ae_q56s MultiplyByQuantizedMultiplierResult48Bit( - int32_t x, int32_t quantized_multiplier, int shift) { - // Convert x into a 2x24bit PR register file. If x is outside the numerical - // limits of a 24bit integer, the "fractional" or lower 8bits are discarded. - // If x is within the range of a 24 bit integer, the "signed" or upper 8bits - // are discarded. - ae_p24x2s x_24x2; - if (x > INT24_MIN && x < INT24_MAX) { - x_24x2 = AE_MOVPA24(x); - } else { - x_24x2 = static_cast(*reinterpret_cast(&x)); - shift += 8; - } - - return MultiplyByQuantizedMultiplier(x_24x2, quantized_multiplier, shift); -} - -// Calculate quantization params for 24bit runtimes. -inline void QuantizeMultiplierForInt24(float multiplier, - int32_t* quantized_multiplier, - int* shift) { - if (multiplier == 0.0f) { - *quantized_multiplier = 0; - *shift = 0; - return; - } - - // Special cased to 24bit: - const float q = std::frexp(multiplier, shift); - auto q_fixed = static_cast(std::round(q * (1 << 23))); - - TFLITE_CHECK(q_fixed <= (1 << 23)); - if (q_fixed == (1 << 23)) { - q_fixed /= 2; - ++*shift; - } - TFLITE_CHECK_LE(q_fixed, INT24_MAX); - - // Ensure shift does not exceed 24-bit range. - TFLITE_CHECK_LE(*shift, 23); - if (*shift < -23) { - *shift = 0; - q_fixed = 0; - } - *quantized_multiplier = static_cast(q_fixed); -} - -// Convert a floating point number to a Q representation for 24 bit integers. -inline int CreateQConstantForInt24(int integer_bits, float f) { - const float min_bounds = static_cast(INT24_MIN); - const float max_bounds = static_cast(INT24_MAX); - - int fractional_bits = 23 - integer_bits; - float raw = std::round(f * static_cast(1 << fractional_bits)); - raw = std::max(raw, min_bounds); - raw = std::min(raw, max_bounds); - return static_cast(raw); -} - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_KERNELS_XTENSA_HIFIMINI_FIXEDPOINT_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_api_defs.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_api_defs.h deleted file mode 100644 index a3eac67..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_api_defs.h +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019-2020 Cadence Design Systems, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to use this Software with Cadence processor cores only and - * not with any other processors and platforms, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ******************************************************************************/ - -/* Copyright 2018 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 __XA_API_DEFS_H__ -#define __XA_API_DEFS_H__ - -/*****************************************************************************/ -/* Constant hash defines */ -/*****************************************************************************/ -/* A constant to let API copy small strings to buffers outside */ -#define XA_API_STR_LEN 30 -#define XA_APIVERSION_MAJOR 1 -#define XA_APIVERSION_MINOR 0 - -/* last compatible version */ -/* sometimes a new API version is just for a bugfix, or a added feature in */ -/* this case it is better to use a newer version even though a library was */ -/* made for an older version, library API can then be upgraded to newer API */ -/* version after checking for compatibility or by adding features */ -#define XA_LASTCOMP_APIVERSION_MAJOR 1 -#define XA_LASTCOMP_APIVERSION_MINOR 0 - -#define XA_STR(str) #str -#define XA_MAKE_VERSION_STR(maj, min) XA_STR(maj) "." XA_STR(min) -#define XA_APIVERSION \ - XA_MAKE_VERSION_STR(XA_APIVERSION_MAJOR, XA_APIVERSION_MINOR) - -#define XA_LAST_COMP_APIVERSION \ - XA_MAKE_VERSION_STR(XA_LASTCOMP_APIVERSION_MAJOR, \ - XA_LASTCOMP_APIVERSION_MINOR) - -#endif /* __XA_API_DEFS_H__ */ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_common.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_common.h deleted file mode 100644 index 71e6682..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_common.h +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019-2020 Cadence Design Systems, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to use this Software with Cadence processor cores only and - * not with any other processors and platforms, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ******************************************************************************/ - -/* Copyright 2018 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 __XA_NNLIB_COMMON_H__ -#define __XA_NNLIB_COMMON_H__ - -#include -#include -#include -#include -#include -#include -#if XCHAL_HAVE_HIFI4_VFPU -#include -#endif - -#include "tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_err_chk.h" -#include "tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_kernels_api.h" -#include "tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_standards.h" -#include "tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/xa_type_def.h" - -#endif /* __XA_NNLIB_COMMON_H__ */ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_common_macros.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_common_macros.h deleted file mode 100644 index d04752b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_common_macros.h +++ /dev/null @@ -1,921 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019-2020 Cadence Design Systems, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to use this Software with Cadence processor cores only and - * not with any other processors and platforms, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ******************************************************************************/ - -/* Copyright 2018 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 __XA_NNLIB_COMMON_MACROS_H__ -#define __XA_NNLIB_COMMON_MACROS_H__ - -#ifndef NULL -#define NULL (void *)0 -#endif /* NULL */ - -#define ALIGNMENT 8 - -/* Macro for zero value */ -#define ZERO64 AE_MOVINT64_FROMINT32X2(AE_MOVDA32(0)) -#define ZERO16X4 AE_MOVDA16(0) -#define ZERO16 (0) -#define ZERO32 (0) - -/* Macro for 1 */ -#define ONE16X4 AE_MOVDA16(1) - -/* Value of ROW_UNROLL currently supported are 1,2,4,8 only */ -#ifndef ROW_UNROLL -#define ROW_UNROLL 8 -#endif -#define VEC_UNROLL 2 - -#define ACC_LSH_AFTER_FIRST_MATXVEC 0 - -/* Increment in bytes required for particular load - * instructions. */ -#define INCREMENT_IN_BYTES_FOR_WORD8 1 -#define INCREMENT_IN_BYTES_FOR_INT16 2 -#define INCREMENT_IN_BYTES_FOR_INT32 (INCREMENT_IN_BYTES_FOR_INT16 * 2) -#define INCREMENT_IN_BYTES_FOR_WORD8X4 (INCREMENT_IN_BYTES_FOR_WORD8 * 4) -#define INCREMENT_IN_BYTES_FOR_INT16X4 (INCREMENT_IN_BYTES_FOR_INT16 * 4) -#define INCREMENT_IN_BYTES_FOR_INT64 INCREMENT_IN_BYTES_FOR_INT16X4 -#define INCREMENT_IN_BYTES_FOR_FLOAT32 4 -#define INCREMENT_IN_BYTES_FOR_FLOAT32x2 (INCREMENT_IN_BYTES_FOR_FLOAT32 * 2) - -#define HF2_AE_ADDCIRC16X4_XC(ptr, offset) \ - ptr = ptr + offset; \ - if (ptr >= p_end) ptr = ptr - size; - -#define MULTIPLY_BY_QUANTIZED_MULTIPLIER(q_out, inp, out_multiplier, \ - left_shift, right_shift) \ - { \ - ae_q56s d1; \ - ae_p24x2s d_mul; \ - d_mul = AE_CVTP24A16X2_HL(out_multiplier, out_multiplier); \ - d1 = AE_CVTQ48A32S(inp); \ - d1 = AE_SLLAQ56(d1, left_shift); \ - q_out = AE_MULFQ32SP16U_L(d1, d_mul); \ - q_out = AE_SRAIQ56(q_out, 16); \ - AE_MULAFQ32SP16S_H(q_out, d1, d_mul); \ - q_out = AE_SRAAQ56(q_out, right_shift); \ - q_out = AE_ROUNDSQ32SYM(q_out); \ - } - -/* Limit effective bias_shift and acc_shift to [-63 ... 63] */ -#define LIMIT_VARIABLE(_var, _left_limit, _right_limit) \ - _var = _var > _right_limit ? _right_limit \ - : _var < _left_limit ? _left_limit : _var; - -#define LIMIT_ACC_LSH LIMIT_VARIABLE(acc_shift, -63, 63); - -#define LIMIT_BIAS_LSH LIMIT_VARIABLE(bias_shift, -63, 63); - -#define BW(_datatype) sizeof(_datatype) - -#define ADJUST_VAR_AxB(A, B) (((8 * (4 - (BW(A) + BW(B)))))) - -#define ADJUST_VAR_C(C) (((64 - (8 * BW(C))))) - -#define ADJUST_ACC_LSH_AxB_C(A, B, C) \ - acc_shift = acc_shift + 32; \ - LIMIT_ACC_LSH; - -#define ADJUST_BIAS_LSH_AxB(A, B) LIMIT_BIAS_LSH; - -#define ADJUST_ACC_LSH_AND_BIAS_LSH_AxB_C(A, B, C) \ - ADJUST_ACC_LSH_AxB_C(A, B, C); \ - ADJUST_BIAS_LSH_AxB(A, B); - -/* ==================================================================================================== - */ -#define SETUP_BIAS_f32 \ - xtfloat _xtfloat_bias = (xtfloat)0.0f; \ - xtfloat *_xtfloat_p_bias = (xtfloat *)p_bias; - -#define SETUP_BIAS_ASYM8b \ - WORD32 _WORD32_bias; \ - ae_int64 _ae_int64_sat_bias = ZERO64; \ - WORD32 *_WORD32_p_bias = (WORD32 *)p_bias; - -#define SETUP_BIAS_8b \ - WORD8 _WORD8_bias; \ - UWORD32 _UWORD32_bias; \ - ae_int64 _ae_int64_bias = ZERO64; \ - ae_int64 _ae_int64_sat_bias = ZERO64; \ - WORD8 *_WORD8_p_bias = (WORD8 *)p_bias; - -#define SETUP_BIAS_8b_BATCH \ - WORD8 _WORD8_bias; \ - WORD16 _WORD16_bias; \ - ae_int16 _ae_int16_bias = ZERO16; \ - ae_int16 *_ae_int16_p_bias = &_ae_int16_bias; \ - ae_int64 _ae_int64_sat_bias = ZERO64; \ - WORD8 *_WORD8_p_bias = (WORD8 *)p_bias; - -#define SETUP_BIAS_32b \ - ae_int32 _ae_int32_bias = ZERO32; \ - ae_int64 _ae_int64_sat_bias = ZERO64; \ - ae_int32 *_ae_int32_p_bias = (ae_int32 *)p_bias; - -#define SETUP_BIAS_16b \ - ae_int16 _ae_int16_bias = ZERO16; \ - ae_int64 _ae_int64_sat_bias = ZERO64; \ - ae_int16 *_ae_int16_p_bias = (ae_int16 *)p_bias; - -#define SETUP_BIAS_64b \ - ae_int64 _ae_int64_bias = ZERO64; \ - ae_int64 _ae_int64_sat_bias = ZERO64; \ - ae_int64 *_ae_int64_p_bias = (ae_int64 *)p_bias; - -#define SETUP_ACC_FOR_8bx8b(idx) SETUP_ACC_64b(idx) -#define SETUP_ACC_FOR_8bx16b(idx) SETUP_ACC_64b(idx) -#define SETUP_ACC_FOR_16bx8b(idx) SETUP_ACC_64b(idx) -#define SETUP_ACC_FOR_16bx16b(idx) SETUP_ACC_64b(idx) -#define SETUP_ACC_FOR_ASYM8bxASYM8b(idx) SETUP_ACC_64b(idx) - -/*------------------ time batching macros ----------------- */ - -#define SETUP_ACC_BATCH_ROW_FOR_16bx8b SETUP_ACC_BATCH_ROW_FOR_16bx16b -#define SETUP_ACC_BATCH_ROW_FOR_8bx16b SETUP_ACC_BATCH_ROW_FOR_16bx16b -#define SETUP_ACC_BATCH_ROW_FOR_8bx8b SETUP_ACC_BATCH_ROW_FOR_16bx16b -#define SETUP_ACC_BATCH_ROW_FOR_ASYM8bxASYM8b SETUP_ACC_BATCH_ROW_FOR_16bx16b - -#define SETUP_ACC_BATCH_FOR_16bx8b SETUP_ACC_BATCH_FOR_16bx16b -#define SETUP_ACC_BATCH_FOR_8bx16b SETUP_ACC_BATCH_FOR_16bx16b -#define SETUP_ACC_BATCH_FOR_8bx8b SETUP_ACC_BATCH_FOR_16bx16b -#define SETUP_ACC_BATCH_FOR_ASYM8bxASYM8b SETUP_ACC_BATCH_FOR_16bx16b - -#define SETUP_ACC_BATCH_ROW_FOR_16bx16b(idx_row) \ - SETUP_ACC_BATCH_VEC_UNROLL(idx_row); - -#define SETUP_ACC_BATCH_FOR_16bx16b(idx_row, idx_vec) \ - ae_int64 _ae_int64_acc_##idx_row##_##idx_vec = ZERO64; - -#define SETUP_ACC_BATCH_ROW_FOR_f32(idx_row) \ - SETUP_ACC_BATCH_VEC_UNROLL(idx_row); - -#define SETUP_ACC_BATCH_FOR_f32(idx_row, idx_vec) \ - xtfloatx2 _xtfloatx2_acc_##idx_row##_##idx_vec = (xtfloatx2)0.0f; \ - xtfloat _xtfloat_acc_##idx_row##_##idx_vec = (xtfloat)0.0f; \ - /*---------------------------------------------------------*/ - -#define SETUP_ACC_64b(idx) ae_int64 _ae_int64_acc_##idx = ZERO64; - -#define SETUP_VEC1_8b \ - ae_int16x4 _ae_int16x4_vec1 = ZERO16X4; \ - WORD8 *_WORD8_p_vec1 = (WORD8 *)p_vec1; - -#define SETUP_VEC2_8b \ - ae_int16x4 _ae_int16x4_vec2 = ZERO16X4; \ - WORD8 *_WORD8_p_vec2 = (WORD8 *)p_vec2; - -#define SETUP_VEC1_16b \ - ae_int16x4 _ae_int16x4_vec1 = ZERO16X4; \ - ae_int16x4 *_ae_int16x4_p_vec1 = (ae_int16x4 *)p_vec1; - -#define SETUP_VEC2_16b \ - ae_int16x4 _ae_int16x4_vec2 = ZERO16X4; \ - ae_int16x4 *_ae_int16x4_p_vec2 = (ae_int16x4 *)p_vec2; - -#define SETUP_VEC1_ASYM8b SETUP_VEC1_8b -#define SETUP_VEC2_ASYM8b SETUP_VEC2_8b -/*------------------ time batching macros ----------------- */ - -#define SETUP_VEC_BATCH_8b(idx_vec) \ - ae_int16x4 _ae_int16x4_vec_batch_##idx_vec = ZERO16X4; \ - WORD8 *_WORD8_p_vec_batch_##idx_vec = (WORD8 *)(p_vec1[vec_itr + idx_vec]); - -#define SETUP_VEC_BATCH_16b(idx_vec) \ - ae_int16x4 _ae_int16x4_vec_batch_##idx_vec = ZERO16X4; \ - ae_int16x4 *_ae_int16x4_p_vec_batch_##idx_vec = \ - (ae_int16x4 *)(p_vec1[vec_itr + idx_vec]); - -#define SETUP_VEC_OFFSET_BATCH_16b(idx_vec) \ - ae_int16x4 _ae_int16x4_vec_batch_##idx_vec = ZERO16X4; \ - ae_int16x4 *_ae_int16x4_p_vec_batch_##idx_vec = \ - (ae_int16x4 *)(p_vec1 + (vec_itr + idx_vec) * vec_offset); - -#define SETUP_VEC_BATCH_f32(idx_vec) \ - xtfloatx2 _xtfloatx2_vec_batch_##idx_vec = (xtfloatx2)0.0f; \ - xtfloatx2 *_xtfloatx2_p_vec_batch_##idx_vec = \ - (xtfloatx2 *)(p_vec1[vec_itr + idx_vec]); - -#define SETUP_VEC_BATCH_ASYM8b SETUP_VEC_BATCH_8b -/*---------------------------------------------------------*/ - -#define SETUP_MAT1_8b(idx) \ - ae_int16x4 _ae_int16x4_mat1_##idx = ZERO16X4; \ - WORD8 *_WORD8_p_mat1_##idx = (WORD8 *)&p_mat1[(m_itr + idx) * row_stride1]; - -#define SETUP_MAT2_8b(idx) \ - ae_int16x4 _ae_int16x4_mat2_##idx = ZERO16X4; \ - WORD8 *_WORD8_p_mat2_##idx = (WORD8 *)&p_mat2[(m_itr + idx) * row_stride2]; - -#define SETUP_MAT1_16b(idx) \ - ae_int16x4 _ae_int16x4_mat1_##idx = ZERO16X4; \ - ae_int16x4 *_ae_int16x4_p_mat1_##idx = \ - (ae_int16x4 *)&p_mat1[(m_itr + idx) * row_stride1]; - -#define SETUP_MAT2_16b(idx) \ - ae_int16x4 _ae_int16x4_mat2_##idx = ZERO16X4; \ - ae_int16x4 *_ae_int16x4_p_mat2_##idx = \ - (ae_int16x4 *)&p_mat2[(m_itr + idx) * row_stride2]; - -#define SETUP_MAT1_f32(idx) \ - xtfloatx2 _xtfloatx2_mat1_##idx = (xtfloatx2)0.0f; \ - xtfloatx2 *_xtfloatx2_p_mat1_##idx = \ - (xtfloatx2 *)&p_mat1[(m_itr + idx) * row_stride1]; - -#define SETUP_MAT1_ASYM8b SETUP_MAT1_8b -#define SETUP_MAT2_ASYM8b SETUP_MAT2_8b -/* ====================================================================== */ - -#define LOAD_VEC1_8b \ - AE_L8X4F_IP(_ae_int16x4_vec1, _WORD8_p_vec1, INCREMENT_IN_BYTES_FOR_WORD8X4); - -#define LOAD_VEC2_8b \ - AE_L8X4F_IP(_ae_int16x4_vec2, _WORD8_p_vec2, INCREMENT_IN_BYTES_FOR_WORD8X4); - -#define LOAD_VEC1_16b \ - AE_L16X4_IP(_ae_int16x4_vec1, _ae_int16x4_p_vec1, \ - INCREMENT_IN_BYTES_FOR_INT16X4); - -#define LOAD_VEC2_16b \ - AE_L16X4_IP(_ae_int16x4_vec2, _ae_int16x4_p_vec2, \ - INCREMENT_IN_BYTES_FOR_INT16X4); - -#define LOAD_VEC1_ASYM8b \ - AE_L8X4F_IP(_ae_int16x4_vec1, _WORD8_p_vec1, \ - INCREMENT_IN_BYTES_FOR_WORD8X4); \ - _ae_int16x4_vec1 = AE_MOVF16X4_FROMF64( \ - AE_SRLI64(AE_MOVF64_FROMF16X4(_ae_int16x4_vec1), 8)); \ - _ae_int16x4_vec1 = AE_ADD16(_ae_int16x4_vec1, AE_MOVDA16(vec1_zero_bias)); - -#define LOAD_VEC2_ASYM8b \ - AE_L8X4F_IP(_ae_int16x4_vec2, _WORD8_p_vec2, \ - INCREMENT_IN_BYTES_FOR_WORD8X4); \ - _ae_int16x4_vec2 = AE_MOVF16X4_FROMF64( \ - AE_SRLI64(AE_MOVF64_FROMF16X4(_ae_int16x4_vec2), 8)); \ - _ae_int16x4_vec2 = AE_ADD16(_ae_int16x4_vec2, AE_MOVDA16(vec2_zero_bias)); \ -/*------------------ time batching macros ----------------- */ -#define LOAD_VEC_BATCH_f32(idx_vec) \ - XT_LSX2IP(_xtfloatx2_vec_batch_##idx_vec, _xtfloatx2_p_vec_batch_##idx_vec, \ - INCREMENT_IN_BYTES_FOR_FLOAT32x2); - -#define LOAD_VEC_BATCH_8b(idx_vec) \ - AE_L8X4F_IP(_ae_int16x4_vec_batch_##idx_vec, _WORD8_p_vec_batch_##idx_vec, \ - INCREMENT_IN_BYTES_FOR_WORD8X4); - -#define LOAD_VEC_BATCH_16b(idx_vec) \ - AE_L16X4_IP(_ae_int16x4_vec_batch_##idx_vec, \ - _ae_int16x4_p_vec_batch_##idx_vec, \ - INCREMENT_IN_BYTES_FOR_INT16X4); - -#define LOAD_VEC_BATCH_ASYM8b(idx_vec) \ - AE_L8X4F_IP(_ae_int16x4_vec_batch_##idx_vec, _WORD8_p_vec_batch_##idx_vec, \ - INCREMENT_IN_BYTES_FOR_WORD8X4); \ - _ae_int16x4_vec_batch_##idx_vec = AE_MOVF16X4_FROMF64( \ - AE_SRLI64(AE_MOVF64_FROMF16X4(_ae_int16x4_vec_batch_##idx_vec), 8)); \ - _ae_int16x4_vec_batch_##idx_vec = \ - AE_ADD16(_ae_int16x4_vec_batch_##idx_vec, AE_MOVDA16(vec1_zero_bias)); - -#define LOAD_BIAS_8b_FOR_8bx8b \ - _WORD8_bias = *_WORD8_p_bias++; \ - _WORD16_bias = _WORD8_bias; \ - *((WORD16 *)_ae_int16_p_bias) = _WORD16_bias; \ - _ae_int64_sat_bias = AE_SLAA64S(((ae_int64)_ae_int16_bias), bias_shift); - -#define LOAD_BIAS_16b_FOR_8bx16b \ - ae_int16_loadip(_ae_int16_bias, _ae_int16_p_bias, \ - INCREMENT_IN_BYTES_FOR_INT16); \ - _ae_int64_sat_bias = AE_SLAA64S(((ae_int64)_ae_int16_bias), bias_shift); - -#define LOAD_BIAS_16b_FOR_16bx8b LOAD_BIAS_16b_FOR_8bx16b - -#define LOAD_BIAS_16b_FOR_16bx16b \ - ae_int16_loadip(_ae_int16_bias, _ae_int16_p_bias, \ - INCREMENT_IN_BYTES_FOR_INT16); \ - _ae_int64_sat_bias = AE_SLAA64S(((ae_int64)_ae_int16_bias), bias_shift); - -#define LOAD_BIAS_f32 \ - XT_LSIP(_xtfloat_bias, _xtfloat_p_bias, INCREMENT_IN_BYTES_FOR_FLOAT32); - -#define LOAD_BIAS_ASYM8b \ - _WORD32_bias = *_WORD32_p_bias++; \ - _ae_int64_sat_bias = \ - AE_SRAI64(AE_MOVINT64_FROMINT32X2(AE_MOVDA32(_WORD32_bias)), 32); \ -/*---------------------------------------------------------*/ -#define LOAD_ROW_MAT1_8b(idx) \ - AE_L8X4F_IP(_ae_int16x4_mat1_##idx, _WORD8_p_mat1_##idx, \ - INCREMENT_IN_BYTES_FOR_WORD8X4); - -#define LOAD_ROW_MAT2_8b(idx) \ - AE_L8X4F_IP(_ae_int16x4_mat2_##idx, _WORD8_p_mat2_##idx, \ - INCREMENT_IN_BYTES_FOR_WORD8X4); - -#define LOAD_ROW_MAT1_16b(idx) \ - AE_L16X4_IP(_ae_int16x4_mat1_##idx, _ae_int16x4_p_mat1_##idx, \ - INCREMENT_IN_BYTES_FOR_INT16X4); - -#define LOAD_ROW_MAT2_16b(idx) \ - AE_L16X4_IP(_ae_int16x4_mat2_##idx, _ae_int16x4_p_mat2_##idx, \ - INCREMENT_IN_BYTES_FOR_INT16X4); - -#define LOAD_ROW_MAT1_f32(idx) \ - XT_LSX2IP(_xtfloatx2_mat1_##idx, _xtfloatx2_p_mat1_##idx, \ - INCREMENT_IN_BYTES_FOR_FLOAT32x2); - -#define LOAD_ROW_MAT1_ASYM8b(idx) \ - AE_L8X4F_IP(_ae_int16x4_mat1_##idx, _WORD8_p_mat1_##idx, \ - INCREMENT_IN_BYTES_FOR_WORD8X4); \ - _ae_int16x4_mat1_##idx = AE_MOVF16X4_FROMF64( \ - AE_SRLI64(AE_MOVF64_FROMF16X4(_ae_int16x4_mat1_##idx), 8)); \ - _ae_int16x4_mat1_##idx = \ - AE_ADD16(_ae_int16x4_mat1_##idx, AE_MOVDA16(mat1_zero_bias)); - -#define LOAD_ROW_MAT2_ASYM8b(idx) \ - AE_L8X4F_IP(_ae_int16x4_mat2_##idx, _WORD8_p_mat2_##idx, \ - INCREMENT_IN_BYTES_FOR_WORD8X4); \ - _ae_int16x4_mat2_##idx = AE_MOVF16X4_FROMF64( \ - AE_SRLI64(AE_MOVF64_FROMF16X4(_ae_int16x4_mat2_##idx), 8)); \ - _ae_int16x4_mat2_##idx = \ - AE_ADD16(_ae_int16x4_mat2_##idx, AE_MOVDA16(mat2_zero_bias)); - -#define KERNEL_MAT1_VEC1_8b_8b(idx) \ - LOAD_ROW_MAT1_8b(idx); \ - AE_MULAAAAQ16(_ae_int64_acc_##idx, _ae_int16x4_vec1, _ae_int16x4_mat1_##idx); - -#define KERNEL_MAT2_VEC2_8b_8b(idx) \ - LOAD_ROW_MAT2_8b(idx); \ - AE_MULAAAAQ16(_ae_int64_acc_##idx, _ae_int16x4_vec2, _ae_int16x4_mat2_##idx); - -#define KERNEL_MAT1_VEC1_16b_8b(idx) \ - LOAD_ROW_MAT1_16b(idx); \ - AE_MULAAAAQ16(_ae_int64_acc_##idx, _ae_int16x4_vec1, _ae_int16x4_mat1_##idx); - -#define KERNEL_MAT2_VEC2_16b_8b(idx) \ - LOAD_ROW_MAT2_16b(idx); \ - AE_MULAAAAQ16(_ae_int64_acc_##idx, _ae_int16x4_vec2, _ae_int16x4_mat2_##idx); - -#define KERNEL_MAT1_VEC1_8b_16b(idx) \ - LOAD_ROW_MAT1_8b(idx); \ - AE_MULAAAAQ16(_ae_int64_acc_##idx, _ae_int16x4_vec1, _ae_int16x4_mat1_##idx); - -#define KERNEL_MAT2_VEC2_8b_16b(idx) \ - LOAD_ROW_MAT2_8b(idx); \ - AE_MULAAAAQ16(_ae_int64_acc_##idx, _ae_int16x4_vec2, _ae_int16x4_mat2_##idx); - -#define KERNEL_MAT1_VEC1_16b_16b(idx) \ - LOAD_ROW_MAT1_16b(idx); \ - AE_MULAAAAQ16(_ae_int64_acc_##idx, _ae_int16x4_vec1, _ae_int16x4_mat1_##idx); - -#define KERNEL_MAT2_VEC2_16b_16b(idx) \ - LOAD_ROW_MAT2_16b(idx); \ - AE_MULAAAAQ16(_ae_int64_acc_##idx, _ae_int16x4_vec2, _ae_int16x4_mat2_##idx); - -#define KERNEL_MAT1_VEC1_ASYM8b_ASYM8b(idx) \ - LOAD_ROW_MAT1_ASYM8b(idx); \ - AE_MULAAAAQ16(_ae_int64_acc_##idx, _ae_int16x4_vec1, _ae_int16x4_mat1_##idx); - -#define KERNEL_MAT2_VEC2_ASYM8b_ASYM8b(idx) \ - LOAD_ROW_MAT2_ASYM8b(idx); \ - AE_MULAAAAQ16(_ae_int64_acc_##idx, _ae_int16x4_vec2, _ae_int16x4_mat2_##idx); - -/*------------------ time batching macros ----------------- */ - -#define KERNEL_MAT1_VEC_BATCH_ROW_8b_8b KERNEL_MAT1_VEC_BATCH_ROW_16b_16b -#define KERNEL_MAT1_VEC_BATCH_ROW_16b_8b KERNEL_MAT1_VEC_BATCH_ROW_16b_16b -#define KERNEL_MAT1_VEC_BATCH_ROW_8b_16b KERNEL_MAT1_VEC_BATCH_ROW_16b_16b -#define KERNEL_MAT1_VEC_BATCH_ROW_ASYM8b_ASYM8b \ - KERNEL_MAT1_VEC_BATCH_ROW_16b_16b -#define KERNEL_MAT1_VEC_BATCH_8b_8b KERNEL_MAT1_VEC_BATCH_16b_16b -#define KERNEL_MAT1_VEC_BATCH_16b_8b KERNEL_MAT1_VEC_BATCH_16b_16b -#define KERNEL_MAT1_VEC_BATCH_8b_16b KERNEL_MAT1_VEC_BATCH_16b_16b -#define KERNEL_MAT1_VEC_BATCH_ASYM8b_ASYM8b KERNEL_MAT1_VEC_BATCH_16b_16b - -#define KERNEL_MAT1_VEC_BATCH_ROW_16b_16b(idx_row) \ - KERNEL_MAT1_VEC_BATCH_VEC_UNROLL(idx_row); - -#define KERNEL_MAT1_VEC_BATCH_16b_16b(idx_row, idx_vec) \ - AE_MULAAAAQ16(_ae_int64_acc_##idx_row##_##idx_vec, \ - _ae_int16x4_vec_batch_##idx_vec, _ae_int16x4_mat1_##idx_row); - -#define KERNEL_MAT1_VEC_BATCH_ROW_f32(idx_row) \ - KERNEL_MAT1_VEC_BATCH_VEC_UNROLL(idx_row); - -#define KERNEL_MAT1_VEC_BATCH_f32(idx_row, idx_vec) \ - XT_MADD_SX2(_xtfloatx2_acc_##idx_row##_##idx_vec, \ - _xtfloatx2_vec_batch_##idx_vec, _xtfloatx2_mat1_##idx_row); - -/*---------------------------------------------------------*/ -#define ADD_BIAS_8b_ACC_FOR_8bx8b(idx) \ - /* Load 8b bias */ \ - _WORD8_bias = *_WORD8_p_bias++; \ - /* Copy 8-bits to unsigned 32-bits */ \ - _UWORD32_bias = _WORD8_bias; \ - /*Move unsigned 32 bit value to DR register*/ \ - _ae_int64_bias = AE_MOVINT64_FROMINT32X2((AE_MOVDA32X2(_UWORD32_bias, 0))); \ - _ae_int64_bias = AE_SRAA64(_ae_int64_bias, 32); \ - _ae_int64_sat_bias = AE_SLAA64S(_ae_int64_bias, bias_shift); \ - _ae_int64_acc_##idx = AE_SRAA64(_ae_int64_acc_##idx, 16); \ - _ae_int64_acc_##idx = AE_ADD64S(_ae_int64_acc_##idx, _ae_int64_sat_bias); - -#define ADD_BIAS_32b_ACC_FOR_8bx8b(idx) \ - ae_int32_loadip(_ae_int32_bias, _ae_int32_p_bias, \ - INCREMENT_IN_BYTES_FOR_INT32); \ - _ae_int64_sat_bias = AE_SLAA64S(((ae_int64)_ae_int32_bias), bias_shift); \ - _ae_int64_acc_##idx = AE_SRAA64(_ae_int64_acc_##idx, 16); \ - _ae_int64_acc_##idx = AE_ADD64S(_ae_int64_acc_##idx, _ae_int64_sat_bias); - -#define ADD_BIAS_16b_ACC_FOR_8bx16b(idx) \ - ae_int16_loadip(_ae_int16_bias, _ae_int16_p_bias, \ - INCREMENT_IN_BYTES_FOR_INT16); \ - /* Saturate 16b bias after shift to 64b */ \ - _ae_int64_sat_bias = AE_SLAA64S(((ae_int64)_ae_int16_bias), bias_shift); \ - _ae_int64_acc_##idx = AE_SRAA64(_ae_int64_acc_##idx, 8); \ - _ae_int64_acc_##idx = AE_ADD64S(_ae_int64_acc_##idx, _ae_int64_sat_bias); - -#define ADD_BIAS_16b_ACC_FOR_16bx8b ADD_BIAS_16b_ACC_FOR_8bx16b - -#define ADD_BIAS_64b_ACC_FOR_8bx16b(idx) \ - ae_int64_loadip(_ae_int64_bias, _ae_int64_p_bias, \ - INCREMENT_IN_BYTES_FOR_INT64); \ - /* Saturate 64b bias after shift to 64b */ \ - _ae_int64_sat_bias = AE_SLAA64S(((ae_int64)_ae_int64_bias), bias_shift); \ - _ae_int64_acc_##idx = AE_SRAA64(_ae_int64_acc_##idx, 8); \ - _ae_int64_acc_##idx = AE_ADD64S(_ae_int64_acc_##idx, _ae_int64_sat_bias); - -#define ADD_BIAS_16b_ACC_FOR_16bx16b(idx) \ - ae_int16_loadip(_ae_int16_bias, _ae_int16_p_bias, \ - INCREMENT_IN_BYTES_FOR_INT16); \ - /* Saturate 16b bias after shift to 64b */ \ - _ae_int64_sat_bias = AE_SLAA64S(((ae_int64)_ae_int16_bias), bias_shift); \ - _ae_int64_acc_##idx = AE_ADD64S(_ae_int64_acc_##idx, _ae_int64_sat_bias); - -#define ADD_BIAS_64b_ACC_FOR_16bx16b(idx) \ - ae_int64_loadip(_ae_int64_bias, _ae_int64_p_bias, \ - INCREMENT_IN_BYTES_FOR_INT64); \ - /* Saturate 64b bias after shift to 64b */ \ - _ae_int64_sat_bias = AE_SLAA64S(((ae_int64)_ae_int64_bias), bias_shift); \ - _ae_int64_acc_##idx = AE_ADD64S(_ae_int64_acc_##idx, _ae_int64_sat_bias); - -#define ADD_BIAS_ASYM8b_ACC_FOR_ASYM8bxASYM8b(idx) \ - /* Load 32b bias */ \ - _WORD32_bias = *_WORD32_p_bias++; \ - _ae_int64_sat_bias = \ - AE_SRAI64(AE_MOVINT64_FROMINT32X2(AE_MOVDA32(_WORD32_bias)), 32); \ - _ae_int64_acc_##idx = AE_ADD64S(_ae_int64_acc_##idx, _ae_int64_sat_bias); - -/*------------------ time batching macros ----------------- */ -#define ADD_BIAS_BATCH_ROW_8b_ACC_FOR_8bx8b(idx_row) \ - LOAD_BIAS_8b_FOR_8bx8b; \ - ADD_BIAS_BATCH_ACC_VEC_UNROLL(idx_row); - -#define ADD_BIAS_BATCH_ROW_16b_ACC_FOR_8bx16b(idx_row) \ - LOAD_BIAS_16b_FOR_8bx16b; \ - ADD_BIAS_BATCH_ACC_VEC_UNROLL(idx_row); - -#define ADD_BIAS_BATCH_ROW_16b_ACC_FOR_16bx8b(idx_row) \ - LOAD_BIAS_16b_FOR_16bx8b; \ - ADD_BIAS_BATCH_ACC_VEC_UNROLL(idx_row); - -#define ADD_BIAS_BATCH_ROW_16b_ACC_FOR_16bx16b(idx_row) \ - LOAD_BIAS_16b_FOR_16bx16b; \ - ADD_BIAS_BATCH_ACC_VEC_UNROLL(idx_row); - -#define ADD_BIAS_BATCH_ROW_ASYM8b_ACC_FOR_ASYM8bxASYM8b(idx_row) \ - LOAD_BIAS_ASYM8b ADD_BIAS_BATCH_ACC_VEC_UNROLL(idx_row); - -#define ADD_BIAS_BATCH_8b_ACC_FOR_8bx8b(idx_row, idx_vec) \ - _ae_int64_acc_##idx_row##_##idx_vec = \ - AE_SRAA64(_ae_int64_acc_##idx_row##_##idx_vec, 16); \ - _ae_int64_acc_##idx_row##_##idx_vec = \ - AE_ADD64S(_ae_int64_acc_##idx_row##_##idx_vec, _ae_int64_sat_bias); - -#define ADD_BIAS_BATCH_16b_ACC_FOR_8bx16b(idx_row, idx_vec) \ - _ae_int64_acc_##idx_row##_##idx_vec = \ - AE_SRAA64(_ae_int64_acc_##idx_row##_##idx_vec, 8); \ - _ae_int64_acc_##idx_row##_##idx_vec = \ - AE_ADD64S(_ae_int64_acc_##idx_row##_##idx_vec, _ae_int64_sat_bias); - -#define ADD_BIAS_BATCH_16b_ACC_FOR_16bx16b(idx_row, idx_vec) \ - _ae_int64_acc_##idx_row##_##idx_vec = \ - AE_ADD64S(_ae_int64_acc_##idx_row##_##idx_vec, _ae_int64_sat_bias); - -#define ADD_BIAS_BATCH_16b_ACC_FOR_16bx8b ADD_BIAS_BATCH_16b_ACC_FOR_8bx16b -#define ADD_BIAS_BATCH_ASYM8b_ACC_FOR_ASYM8bxASYM8b \ - ADD_BIAS_BATCH_16b_ACC_FOR_16bx16b - -#define ADD_BIAS_BATCH_ROW_ACC_FOR_f32(idx_row) \ - LOAD_BIAS_f32; \ - ADD_BIAS_BATCH_ACC_VEC_UNROLL(idx_row); - -#define ADD_BIAS_BATCH_ACC_FOR_f32(idx_row, idx_vec) \ - _xtfloat_acc_##idx_row##_##idx_vec = \ - XT_RADD_SX2(_xtfloatx2_acc_##idx_row##_##idx_vec); \ - _xtfloat_acc_##idx_row##_##idx_vec = \ - XT_ADD_S(_xtfloat_acc_##idx_row##_##idx_vec, _xtfloat_bias); - -#define STORE_ACC_8bx8b_AT_SCRATCH_32b(idx) \ - (*((ae_int32 *)p_scratch + m_itr + idx)) = \ - AE_ROUND32F64SSYM(AE_SLAA64S(_ae_int64_acc_##idx, acc_shift)); - -#define STORE_ACC_8bx8b_AT_OUT_8b(idx) \ - ae_int32 _ae_int32_tmp_var_##idx; \ - ae_f32x2 _ae_f32x2_tmp_var_##idx = AE_SLAA32S( \ - AE_ROUND32F64SSYM(AE_SLAA64S(_ae_int64_acc_##idx, acc_shift)), 24); \ - _ae_int32_tmp_var_##idx = AE_SLAA32S(_ae_f32x2_tmp_var_##idx, -24); \ - (*((WORD8 *)p_out + m_itr + idx)) = (*((UWORD32 *)&_ae_int32_tmp_var_##idx)); - -#define STORE_ACC_8bx8b_AT_OUT_16b(idx) \ - ae_int32 _ae_int32_tmp_var_##idx; \ - ae_f32x2 _ae_f32x2_tmp_var_##idx = AE_SLAA32S( \ - AE_ROUND32F64SSYM(AE_SLAA64S(_ae_int64_acc_##idx, acc_shift)), 16); \ - _ae_int32_tmp_var_##idx = AE_SLAA32S(_ae_f32x2_tmp_var_##idx, -16); \ - (*((WORD16 *)p_out + m_itr + idx)) = (*((UWORD32 *)&_ae_int32_tmp_var_##idx)); - -#define STORE_ACC_8bx8b_AT_OUT_32b(idx) \ - (*((ae_int32 *)p_out + m_itr + idx)) = \ - AE_ROUND32F64SSYM(AE_SLAA64S(_ae_int64_acc_##idx, acc_shift)); - -#define STORE_ACC_ASYM8bxASYM8b_AT_OUT_ASYM8b(idx) \ - _ae_int32x2_acc_##idx = AE_MIN32( \ - AE_MAX32(_ae_int32x2_acc_##idx, AE_MOVDA32(0)), AE_MOVDA32(255)); \ - (*((UWORD8 *)p_out + m_itr + idx)) = \ - (UWORD8)AE_MOVAD32_L(_ae_int32x2_acc_##idx); - -/* ==================================================================================================== - */ -#define STORE_ACC_8bx16b_AT_SCRATCH_32b(idx) \ - (*((ae_int32 *)p_scratch + m_itr + idx)) = \ - AE_ROUND32F64SSYM(AE_SLAA64S(_ae_int64_acc_##idx, acc_shift)); - -#define STORE_ACC_8bx16b_AT_OUT_16b(idx) \ - ae_int32 _ae_int32_tmp_var_##idx; \ - ae_f32x2 _ae_f32x2_tmp_var_##idx = AE_SLAA32S( \ - AE_ROUND32F64SSYM(AE_SLAA64S(_ae_int64_acc_##idx, acc_shift)), 16); \ - _ae_int32_tmp_var_##idx = AE_SLAA32S(_ae_f32x2_tmp_var_##idx, -16); \ - (*((WORD16 *)p_out + m_itr + idx)) = (*((UWORD32 *)&_ae_int32_tmp_var_##idx)); - -#define STORE_ACC_16bx8b_AT_OUT_16b STORE_ACC_8bx16b_AT_OUT_16b - -#define STORE_ACC_8bx16b_AT_OUT_32b(idx) \ - (*((ae_int32 *)p_out + m_itr + idx)) = \ - AE_ROUND32F64SSYM(AE_SLAA64S(_ae_int64_acc_##idx, acc_shift)); - -#define STORE_ACC_8bx16b_AT_OUT_64b(idx) \ - (*((ae_int64 *)p_out + m_itr + idx)) = \ - AE_SLAA64S(_ae_int64_acc_##idx, acc_shift); - -/* ==================================================================================================== - */ -#define STORE_ACC_16bx16b_AT_SCRATCH_32b(idx) \ - (*((ae_int32 *)p_scratch + m_itr + idx)) = \ - AE_ROUND32F64SSYM(AE_SLAA64S(_ae_int64_acc_##idx, acc_shift)); - -#define STORE_ACC_16bx16b_AT_OUT_16b(idx) \ - ae_int32 _ae_int32_tmp_var_##idx; \ - ae_f32x2 _ae_f32x2_tmp_var_##idx = AE_SLAA32S( \ - AE_ROUND32F64SSYM(AE_SLAA64S(_ae_int64_acc_##idx, acc_shift)), 16); \ - _ae_int32_tmp_var_##idx = AE_SLAA32S(_ae_f32x2_tmp_var_##idx, -16); \ - (*((WORD16 *)p_out + m_itr + idx)) = (*((UWORD32 *)&_ae_int32_tmp_var_##idx)); - -#define STORE_ACC_16bx16b_AT_OUT_32b(idx) \ - (*((ae_int32 *)p_out + m_itr + idx)) = \ - AE_ROUND32F64SSYM(AE_SLAA64S(_ae_int64_acc_##idx, acc_shift)); - -#define STORE_ACC_16bx16b_AT_OUT_64b(idx) \ - (*((ae_int64 *)p_out + m_itr + idx)) = \ - AE_SLAA64S(_ae_int64_acc_##idx, acc_shift); - -/*------------------ time batching macros ----------------- */ -#define STORE_ACC_BATCH_ROW_8bx8b_AT_OUT_32b(idx_row) \ - STORE_ACC_BATCH_VEC_UNROLL(idx_row); - -#define STORE_ACC_BATCH_ROW_8bx8b_AT_OUT_8b(idx_row) \ - STORE_ACC_BATCH_VEC_UNROLL(idx_row); - -#define STORE_ACC_BATCH_8bx8b_AT_OUT_32b(idx_row, idx_vec) \ - (*((ae_int32 *)p_out[vec_itr + idx_vec] + m_itr + idx_row)) = \ - AE_ROUND32F64SSYM( \ - AE_SLAA64S(_ae_int64_acc_##idx_row##_##idx_vec, acc_shift)); - -#define STORE_ACC_BATCH_8bx8b_AT_OUT_8b(idx_row, idx_vec) \ - ae_int32 _ae_int32_tmp_var_##idx_row##_##idx_vec; \ - ae_f32x2 _ae_f32x2_tmp_var_##idx_row##_##idx_vec = \ - AE_SLAA32S(AE_ROUND32F64SSYM(AE_SLAA64S( \ - _ae_int64_acc_##idx_row##_##idx_vec, acc_shift)), \ - 24); \ - _ae_int32_tmp_var_##idx_row##_##idx_vec = \ - AE_SLAA32S(_ae_f32x2_tmp_var_##idx_row##_##idx_vec, -24); \ - (*((WORD8 *)p_out[vec_itr + idx_vec] + m_itr + idx_row)) = \ - (*((UWORD32 *)&_ae_int32_tmp_var_##idx_row##_##idx_vec)); - -#define STORE_ACC_BATCH_ROW_8bx16b_AT_OUT_64b(idx_row) \ - STORE_ACC_BATCH_VEC_UNROLL(idx_row); - -#define STORE_ACC_BATCH_ROW_16bx8b_AT_OUT_16b \ - STORE_ACC_BATCH_ROW_8bx16b_AT_OUT_64b - -#define STORE_ACC_BATCH_ROW_8bx16b_AT_OUT_16b \ - STORE_ACC_BATCH_ROW_8bx16b_AT_OUT_64b - -#define STORE_ACC_BATCH_8bx16b_AT_OUT_64b(idx_row, idx_vec) \ - (*((ae_int64 *)p_out[vec_itr + idx_vec] + m_itr + idx_row)) = \ - AE_SLAA64S(_ae_int64_acc_##idx_row##_##idx_vec, acc_shift); - -#define STORE_ACC_BATCH_8bx16b_AT_OUT_16b(idx_row, idx_vec) \ - STORE_ACC_BATCH_16bx16b_AT_OUT_16b(idx_row, idx_vec); - -#define STORE_ACC_BATCH_ROW_16bx16b_AT_OUT_64b(idx_row) \ - STORE_ACC_BATCH_VEC_UNROLL(idx_row); - -#define STORE_ACC_BATCH_ROW_16bx16b_AT_OUT_16b \ - STORE_ACC_BATCH_ROW_16bx16b_AT_OUT_64b - -#define STORE_ACC_BATCH_16bx16b_AT_OUT_64b(idx_row, idx_vec) \ - (*((ae_int64 *)p_out[vec_itr + idx_vec] + m_itr + idx_row)) = \ - AE_SLAA64S(_ae_int64_acc_##idx_row##_##idx_vec, acc_shift); - -#define STORE_STRIDE_ACC_BATCH_16bx16b_AT_OUT_16b(idx_row, idx_vec) \ - ae_int32 _ae_int32_tmp_var_##idx_row##_##idx_vec; \ - ae_f32x2 _ae_f32x2_tmp_var_##idx_row##_##idx_vec = \ - AE_SLAA32S(AE_ROUND32F64SSYM(AE_SLAA64S( \ - _ae_int64_acc_##idx_row##_##idx_vec, acc_shift)), \ - 16); \ - _ae_int32_tmp_var_##idx_row##_##idx_vec = \ - AE_SLAA32S(_ae_f32x2_tmp_var_##idx_row##_##idx_vec, -16); \ - (*((WORD16 *)p_out + (vec_itr + idx_vec) * out_offset + \ - (m_itr + idx_row) * out_stride)) = \ - (*((UWORD32 *)&_ae_int32_tmp_var_##idx_row##_##idx_vec)); - -#define STORE_ACC_BATCH_ROW_AT_OUT_f32(idx_row) \ - STORE_ACC_BATCH_VEC_UNROLL(idx_row); - -#define STORE_ACC_BATCH_AT_OUT_f32(idx_row, idx_vec) \ - /*p_out value stored in a tmp pointer to make it inout for ISA */ \ - p_out_tmp = (p_out[vec_itr + idx_vec] + m_itr + idx_row); \ - XT_SSIP(_xtfloat_acc_##idx_row##_##idx_vec, p_out_tmp, 0); - -#define STORE_ACC_BATCH_ROW_ASYM8bxASYM8b_AT_OUT_ASYM8b(idx_row) \ - STORE_ACC_BATCH_VEC_UNROLL(idx_row); - -#define STORE_ACC_BATCH_ASYM8bxASYM8b_AT_OUT_ASYM8b(idx_row, idx_vec) \ - _ae_int32x2_acc_##idx_row##_##idx_vec = \ - AE_MIN32(AE_MAX32(_ae_int32x2_acc_##idx_row##_##idx_vec, AE_MOVDA32(0)), \ - AE_MOVDA32(255)); \ - (*((UWORD8 *)(p_out[vec_itr + idx_vec] + m_itr + idx_row))) = \ - (UWORD8)AE_MOVAD32_L(_ae_int32x2_acc_##idx_row##_##idx_vec); - -/*---------------------------------------------------------*/ -/* Specific macros needed for extra calculations involved - for ASYM8b */ - -/* This is written to match with Tensorflow */ -#define ADJUST_ACC_ASYM8b(idx) \ - /* Multiply accumulator with 'out_multiplier', same as Tensorflow */ \ - ae_int32x2 _ae_int32x2_acc_##idx = \ - AE_SLAA32(AE_MOVINT32X2_FROMINT64(_ae_int64_acc_##idx), left_shift); \ - _ae_int32x2_acc_##idx = \ - AE_MULFP32X2RAS(_ae_int32x2_acc_##idx, AE_MOVDA32(out_multiplier)); \ - /* Shift by out_shift, same as Tensorflow */ \ - _ae_int64_acc_##idx = \ - AE_SLAI64(AE_MOVINT64_FROMINT32X2(_ae_int32x2_acc_##idx), 32); \ - _ae_int64_acc_##idx = AE_SRAA64(_ae_int64_acc_##idx, right_shift); \ - _ae_int32x2_acc_##idx = AE_ROUND32F64SSYM(_ae_int64_acc_##idx); \ - /* Add output zero point */ \ - (_ae_int32x2_acc_##idx) = \ - AE_ADD32S(_ae_int32x2_acc_##idx, AE_MOVDA32(out_zero_bias)); - -/* For time batching */ -#define ADJUST_ACC_BATCH_ROW_ASYM8b(idx_row) \ - ADJUST_ACC_BATCH_VEC_UNROLL(idx_row); - -/* For time batching */ -#define ADJUST_ACC_BATCH_ASYM8b(idx_row, idx_vec) \ - /* Multiply accumulator with 'out_multiplier', same as Tensorflow */ \ - ae_int32x2 _ae_int32x2_acc_##idx_row##_##idx_vec = \ - AE_SLAA32(AE_MOVINT32X2_FROMINT64(_ae_int64_acc_##idx_row##_##idx_vec), \ - left_shift); \ - _ae_int32x2_acc_##idx_row##_##idx_vec = AE_MULFP32X2RAS( \ - _ae_int32x2_acc_##idx_row##_##idx_vec, AE_MOVDA32(out_multiplier)); \ - /* Shift by out_shift, same as Tensorflow */ \ - _ae_int64_acc_##idx_row##_##idx_vec = AE_SLAI64( \ - AE_MOVINT64_FROMINT32X2(_ae_int32x2_acc_##idx_row##_##idx_vec), 32); \ - _ae_int64_acc_##idx_row##_##idx_vec = \ - AE_SRAA64(_ae_int64_acc_##idx_row##_##idx_vec, right_shift); \ - _ae_int32x2_acc_##idx_row##_##idx_vec = \ - AE_ROUND32F64SSYM(_ae_int64_acc_##idx_row##_##idx_vec); \ - /* Add output zero point */ \ - (_ae_int32x2_acc_##idx_row##_##idx_vec) = AE_ADD32S( \ - _ae_int32x2_acc_##idx_row##_##idx_vec, AE_MOVDA32(out_zero_bias)); - -/*---------------------------------------------------------*/ -/* ==================================================================================================== - */ -#if (ROW_UNROLL == 1) -#define SETUP_ACC UNROLL_SETUP_ACC(0) -#define SETUP_MAT1 UNROLL_SETUP_MAT1(0) -#define SETUP_MAT2 UNROLL_SETUP_MAT2(0) -#define KERNEL_MAT1_VEC1 UNROLL_KERNEL_MAT1_VEC1(0) -#define KERNEL_MAT2_VEC2 UNROLL_KERNEL_MAT2_VEC2(0) -#define ADD_BIAS_ACC UNROLL_ADD_BIAS_ACC(0) -#define ADJUST_ACC UNROLL_ADJUST_ACC(0) -#define STORE_ACC UNROLL_STORE_ACC(0) - -#elif (ROW_UNROLL == 2) -#define SETUP_ACC UNROLL_SETUP_ACC(0) UNROLL_SETUP_ACC(1) -#define SETUP_MAT1 UNROLL_SETUP_MAT1(0) UNROLL_SETUP_MAT1(1) -#define SETUP_MAT2 UNROLL_SETUP_MAT2(0) UNROLL_SETUP_MAT2(1) -#define KERNEL_MAT1_VEC1 UNROLL_KERNEL_MAT1_VEC1(0) UNROLL_KERNEL_MAT1_VEC1(1) -#define KERNEL_MAT2_VEC2 UNROLL_KERNEL_MAT2_VEC2(0) UNROLL_KERNEL_MAT2_VEC2(1) -#define ADD_BIAS_ACC UNROLL_ADD_BIAS_ACC(0) UNROLL_ADD_BIAS_ACC(1) -#define ADJUST_ACC UNROLL_ADJUST_ACC(0) UNROLL_ADJUST_ACC(1) -#define STORE_ACC UNROLL_STORE_ACC(0) UNROLL_STORE_ACC(1) - -#elif (ROW_UNROLL == 4) -#define SETUP_ACC \ - UNROLL_SETUP_ACC(0) \ - UNROLL_SETUP_ACC(1) UNROLL_SETUP_ACC(2) UNROLL_SETUP_ACC(3) -#define SETUP_MAT1 \ - UNROLL_SETUP_MAT1(0) \ - UNROLL_SETUP_MAT1(1) UNROLL_SETUP_MAT1(2) UNROLL_SETUP_MAT1(3) -#define SETUP_MAT2 \ - UNROLL_SETUP_MAT2(0) \ - UNROLL_SETUP_MAT2(1) UNROLL_SETUP_MAT2(2) UNROLL_SETUP_MAT2(3) -#define KERNEL_MAT1_VEC1 \ - UNROLL_KERNEL_MAT1_VEC1(0) \ - UNROLL_KERNEL_MAT1_VEC1(1) \ - UNROLL_KERNEL_MAT1_VEC1(2) UNROLL_KERNEL_MAT1_VEC1(3) -#define KERNEL_MAT2_VEC2 \ - UNROLL_KERNEL_MAT2_VEC2(0) \ - UNROLL_KERNEL_MAT2_VEC2(1) \ - UNROLL_KERNEL_MAT2_VEC2(2) UNROLL_KERNEL_MAT2_VEC2(3) -#define ADD_BIAS_ACC \ - UNROLL_ADD_BIAS_ACC(0) \ - UNROLL_ADD_BIAS_ACC(1) UNROLL_ADD_BIAS_ACC(2) UNROLL_ADD_BIAS_ACC(3) -#define ADJUST_ACC \ - UNROLL_ADJUST_ACC(0) \ - UNROLL_ADJUST_ACC(1) UNROLL_ADJUST_ACC(2) UNROLL_ADJUST_ACC(3) -#define STORE_ACC \ - UNROLL_STORE_ACC(0) \ - UNROLL_STORE_ACC(1) UNROLL_STORE_ACC(2) UNROLL_STORE_ACC(3) - -#elif (ROW_UNROLL == 8) -#define SETUP_ACC \ - UNROLL_SETUP_ACC(0) \ - UNROLL_SETUP_ACC(1) \ - UNROLL_SETUP_ACC(2) \ - UNROLL_SETUP_ACC(3) \ - UNROLL_SETUP_ACC(4) \ - UNROLL_SETUP_ACC(5) UNROLL_SETUP_ACC(6) UNROLL_SETUP_ACC(7) -#define SETUP_MAT1 \ - UNROLL_SETUP_MAT1(0) \ - UNROLL_SETUP_MAT1(1) \ - UNROLL_SETUP_MAT1(2) \ - UNROLL_SETUP_MAT1(3) \ - UNROLL_SETUP_MAT1(4) \ - UNROLL_SETUP_MAT1(5) UNROLL_SETUP_MAT1(6) UNROLL_SETUP_MAT1(7) -#define SETUP_MAT2 \ - UNROLL_SETUP_MAT2(0) \ - UNROLL_SETUP_MAT2(1) \ - UNROLL_SETUP_MAT2(2) \ - UNROLL_SETUP_MAT2(3) \ - UNROLL_SETUP_MAT2(4) \ - UNROLL_SETUP_MAT2(5) UNROLL_SETUP_MAT2(6) UNROLL_SETUP_MAT2(7) -#define KERNEL_MAT1_VEC1 \ - UNROLL_KERNEL_MAT1_VEC1(0) \ - UNROLL_KERNEL_MAT1_VEC1(1) \ - UNROLL_KERNEL_MAT1_VEC1(2) \ - UNROLL_KERNEL_MAT1_VEC1(3) \ - UNROLL_KERNEL_MAT1_VEC1(4) \ - UNROLL_KERNEL_MAT1_VEC1(5) \ - UNROLL_KERNEL_MAT1_VEC1(6) UNROLL_KERNEL_MAT1_VEC1(7) -#define KERNEL_MAT2_VEC2 \ - UNROLL_KERNEL_MAT2_VEC2(0) \ - UNROLL_KERNEL_MAT2_VEC2(1) \ - UNROLL_KERNEL_MAT2_VEC2(2) \ - UNROLL_KERNEL_MAT2_VEC2(3) \ - UNROLL_KERNEL_MAT2_VEC2(4) \ - UNROLL_KERNEL_MAT2_VEC2(5) \ - UNROLL_KERNEL_MAT2_VEC2(6) UNROLL_KERNEL_MAT2_VEC2(7) -#define ADD_BIAS_ACC \ - UNROLL_ADD_BIAS_ACC(0) \ - UNROLL_ADD_BIAS_ACC(1) \ - UNROLL_ADD_BIAS_ACC(2) \ - UNROLL_ADD_BIAS_ACC(3) \ - UNROLL_ADD_BIAS_ACC(4) \ - UNROLL_ADD_BIAS_ACC(5) UNROLL_ADD_BIAS_ACC(6) UNROLL_ADD_BIAS_ACC(7) -#define ADJUST_ACC \ - UNROLL_ADJUST_ACC(0) \ - UNROLL_ADJUST_ACC(1) \ - UNROLL_ADJUST_ACC(2) \ - UNROLL_ADJUST_ACC(3) \ - UNROLL_ADJUST_ACC(4) \ - UNROLL_ADJUST_ACC(5) UNROLL_ADJUST_ACC(6) UNROLL_ADJUST_ACC(7) -#define STORE_ACC \ - UNROLL_STORE_ACC(0) \ - UNROLL_STORE_ACC(1) \ - UNROLL_STORE_ACC(2) \ - UNROLL_STORE_ACC(3) \ - UNROLL_STORE_ACC(4) \ - UNROLL_STORE_ACC(5) UNROLL_STORE_ACC(6) UNROLL_STORE_ACC(7) - -#endif /* (ROW_UNROLL == 1) */ - -#if (ROW_UNROLL == 4 && VEC_UNROLL == 2) - -#define SETUP_VEC_BATCH UNROLL_SETUP_VEC_BATCH(0) UNROLL_SETUP_VEC_BATCH(1) - -#define SETUP_ACC_BATCH \ - UNROLL_ROW_SETUP_ACC_BATCH(0) \ - UNROLL_ROW_SETUP_ACC_BATCH(1) \ - UNROLL_ROW_SETUP_ACC_BATCH(2) UNROLL_ROW_SETUP_ACC_BATCH(3) -#define SETUP_ACC_BATCH_VEC_UNROLL(idx_row) \ - UNROLL_SETUP_ACC_BATCH(idx_row, 0) UNROLL_SETUP_ACC_BATCH(idx_row, 1) -#define SETUP_ACC_BATCH_TAIL \ - UNROLL_SETUP_ACC_BATCH(0, 0) \ - UNROLL_SETUP_ACC_BATCH(1, 0) \ - UNROLL_SETUP_ACC_BATCH(2, 0) UNROLL_SETUP_ACC_BATCH(3, 0) - -#define LOAD_VEC_BATCH UNROLL_LOAD_VEC_BATCH(0) UNROLL_LOAD_VEC_BATCH(1) -#define LOAD_MAT1 \ - UNROLL_LOAD_ROW_MAT1(0) \ - UNROLL_LOAD_ROW_MAT1(1) UNROLL_LOAD_ROW_MAT1(2) UNROLL_LOAD_ROW_MAT1(3) - -#define KERNEL_MAT1_VEC_BATCH \ - UNROLL_ROW_KERNEL_MAT1_VEC_BATCH(0) \ - UNROLL_ROW_KERNEL_MAT1_VEC_BATCH(1) \ - UNROLL_ROW_KERNEL_MAT1_VEC_BATCH(2) UNROLL_ROW_KERNEL_MAT1_VEC_BATCH(3) -#define KERNEL_MAT1_VEC_BATCH_VEC_UNROLL(idx_row) \ - UNROLL_KERNEL_MAT1_VEC_BATCH(idx_row, 0) \ - UNROLL_KERNEL_MAT1_VEC_BATCH(idx_row, 1) -#define KERNEL_MAT1_VEC_BATCH_TAIL \ - UNROLL_KERNEL_MAT1_VEC_BATCH(0, 0) \ - UNROLL_KERNEL_MAT1_VEC_BATCH(1, 0) \ - UNROLL_KERNEL_MAT1_VEC_BATCH(2, 0) UNROLL_KERNEL_MAT1_VEC_BATCH(3, 0) - -#define ADD_BIAS_ACC_BATCH \ - UNROLL_ROW_ADD_BIAS_ACC(0) \ - UNROLL_ROW_ADD_BIAS_ACC(1) \ - UNROLL_ROW_ADD_BIAS_ACC(2) UNROLL_ROW_ADD_BIAS_ACC(3) -#define ADD_BIAS_BATCH_ACC_VEC_UNROLL(idx_row) \ - UNROLL_ADD_BIAS_ACC_BATCH(idx_row, 0) UNROLL_ADD_BIAS_ACC_BATCH(idx_row, 1) -#define ADD_BIAS_ACC_BATCH_TAIL \ - LOAD_BIAS UNROLL_ADD_BIAS_ACC_BATCH(0, 0) \ - LOAD_BIAS UNROLL_ADD_BIAS_ACC_BATCH(1, 0) \ - LOAD_BIAS UNROLL_ADD_BIAS_ACC_BATCH(2, 0) \ - LOAD_BIAS UNROLL_ADD_BIAS_ACC_BATCH(3, 0) - -#define STORE_ACC_BATCH \ - UNROLL_ROW_STORE_ACC(0) \ - UNROLL_ROW_STORE_ACC(1) UNROLL_ROW_STORE_ACC(2) UNROLL_ROW_STORE_ACC(3) -#define STORE_ACC_BATCH_VEC_UNROLL(idx_row) \ - UNROLL_STORE_ACC_BATCH(idx_row, 0) UNROLL_STORE_ACC_BATCH(idx_row, 1) -#define STORE_ACC_BATCH_TAIL \ - UNROLL_STORE_ACC_BATCH(0, 0) \ - UNROLL_STORE_ACC_BATCH(1, 0) \ - UNROLL_STORE_ACC_BATCH(2, 0) UNROLL_STORE_ACC_BATCH(3, 0) - -#define ADJUST_ACC_BATCH_TAIL \ - UNROLL_ADJUST_ACC_BATCH(0, 0) \ - UNROLL_ADJUST_ACC_BATCH(1, 0) \ - UNROLL_ADJUST_ACC_BATCH(2, 0) UNROLL_ADJUST_ACC_BATCH(3, 0) -#define ADJUST_ACC_BATCH \ - UNROLL_ROW_ADJUST_ACC(0) \ - UNROLL_ROW_ADJUST_ACC(1) UNROLL_ROW_ADJUST_ACC(2) UNROLL_ROW_ADJUST_ACC(3) -#define ADJUST_ACC_BATCH_VEC_UNROLL(idx_row) \ - UNROLL_ADJUST_ACC_BATCH(idx_row, 0) UNROLL_ADJUST_ACC_BATCH(idx_row, 1) - -#endif /* (ROW_UNROLL == 4 && VEC_UNROLL == 2)*/ - -#endif /* __XA_NNLIB_COMMON_MACROS_H__ */ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_definitions.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_definitions.h deleted file mode 100644 index 7199887..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_definitions.h +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019-2020 Cadence Design Systems, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to use this Software with Cadence processor cores only and - * not with any other processors and platforms, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ******************************************************************************/ - -/* Copyright 2018 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 __XA_OPUS_CODEC_DEFINITIONS_H__ -#define __XA_OPUS_CODEC_DEFINITIONS_H__ - -#include "tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_api_defs.h" - -/* Identification Strings */ -#define LIBNAME "HiFi Mini Neural Network Library" -#define LIBVERSION "0.6.0" - -#define LIB_APIVERSION_MAJOR 1 -#define LIB_APIVERSION_MINOR 0 - -#if LIB_APIVERSION_MAJOR != XA_APIVERSION_MAJOR || \ - LIB_APIVERSION_MINOR != XA_APIVERSION_MINOR -// #error "Version Mismatch" -#endif - -#define LIB_APIVERSION \ - XA_MAKE_VERSION_STR(LIB_APIVERSION_MAJOR, LIB_APIVERSION_MINOR) - -#endif /* __XA_OPUS_CODEC_DEFINITIONS_H__ */ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_err_chk.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_err_chk.h deleted file mode 100644 index 8508e54..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/algo/common/include/xa_nnlib_err_chk.h +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019-2020 Cadence Design Systems, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to use this Software with Cadence processor cores only and - * not with any other processors and platforms, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ******************************************************************************/ - -/* Copyright 2018 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 __XA_NNLIB_ERR_CHK_H__ -#define __XA_NNLIB_ERR_CHK_H__ - -#ifndef NULL -#define NULL (void *)0 -#endif /* NULL */ - -#ifndef DISABLE_ARG_CHK - -#define XA_NNLIB_ARG_CHK_PTR(_ptr, _err) \ - do { \ - if ((_ptr) == NULL) return (_err); \ - } while (0) - -#define XA_NNLIB_ARG_CHK_ALIGN(_ptr, _align, _err) \ - do { \ - if (((unsigned int)(_ptr) & ((_align)-1)) != 0) return (_err); \ - } while (0) - -#define XA_NNLIB_ARG_CHK_COND(_cond, _err) \ - do { \ - if ((_cond)) return (_err); \ - } while (0) - -#else /* DISABLE_ARG_CHK */ - -#define XA_NNLIB_ARG_CHK_PTR(_ptr, _err) -#define XA_NNLIB_ARG_CHK_ALIGN(_ptr, _align, _err) -#define XA_NNLIB_ARG_CHK_COND(_cond, _err) - -#endif /* DISABLE_ARG_CHK */ - -#define XA_NNLIB_CHK_PTR(_ptr, _err) \ - do { \ - if ((_ptr) == NULL) return (_err); \ - } while (0) - -#define XA_NNLIB_CHK_ALIGN(_ptr, _align, _err) \ - do { \ - if (((unsigned int)(_ptr) & ((_align)-1)) != 0) return (_err); \ - } while (0) - -#define XA_NNLIB_CHK_COND(_cond, _err) \ - do { \ - if ((_cond)) return (_err); \ - } while (0) - -#endif /* __XA_NNLIB_ERR_CHK_H__ */ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_api.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_api.h deleted file mode 100644 index e499e1e..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_api.h +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019-2020 Cadence Design Systems, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to use this Software with Cadence processor cores only and - * not with any other processors and platforms, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ******************************************************************************/ - -/* Copyright 2018 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 __XA_NNLIB_API_H__ -#define __XA_NNLIB_API_H__ - -#include "tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_kernels_api.h" -#include "tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/xa_type_def.h" - -#endif /* __XA_NNLIB_API_H__ */ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_kernels_api.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_kernels_api.h deleted file mode 100644 index d3a5e29..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_kernels_api.h +++ /dev/null @@ -1,300 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019-2020 Cadence Design Systems, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to use this Software with Cadence processor cores only and - * not with any other processors and platforms, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ******************************************************************************/ - -/* Copyright 2018 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 __XA_NNLIB_KERNELS_API_H__ -#define __XA_NNLIB_KERNELS_API_H__ - -/** - * @file xa_nnlib_kernels_api.h - * @brief This file gives the API definition for the HiFi NNLIB - * - * matXvec KERNELS API NAMING CONVENTION
- *
- * xa_nn_matXvec__[m]x[n]_[p]_, where - * - : Optional 'batch' tag to indicate time batching routine - * - [m]: Matrix precision in bits - * - [n]: Vector (and bias for non-activation routines) precision in bits - * - [p]: Output precision in bits - * - : optional activation tag 'sigmoid' / 'tanh' - * - * These set of kernels perform dual matXvec followed by optional - * activation function. There are several variants based on the input, - * output precision and use of activation functions. - * - * Restriction, - * - All pointers (p_out, p_mat1, p_mat2, p_vec1, p_vec2, p_bias, p_scratch) - * must be SIMD (64-bit) aligned and should not overlap. - * - p_mat2, p_vec2 can be 'NULL', but other pointers cannot be 'NULL' - * - Variables cols1, cols2, row_stride1, row_stride2 must be multiple of 4 - * - * Usage of few critical variables, - * - acc_shift: - * -# In case of valid activation tag i.e. : shift to be - * applied on accumulator to match accumulator's Q format with activation - * function's input's Q format - * -# In case of bypass i.e. no activation tag: shift to be applied on - * accumulator. - * -# Positive value denotes left shift, and negative value denotes right - * shift. - * - bias_shift: shift which is to be applied on bias to match bias's - * Q format with accumulator's Q format. Positive value denotes left shift, - * and negative value denotes right shift. - * - bias_precision: This represents bias precision - * -# For 16x16, and 8x16 apis, valid values are '16' and '64' - * -# For 8x8 apis, valid values are '8' and '32' - * - * Output 8b, 16b, 32b of fixed point apis (only for bypass variants) is - * extracted from 64b accumulator with symmetric rounding. Output 64b of fixed - * point apis (only for bypass variants) is extracted from 64b accumulator. - * Output 8b, 16b of fixed point apis (only for activation variants) is - * symmetrically rounded. - * - * matXvec 16x16 Kernels, - * - Bypass kernels with 16, 32, 64 bit output: 3 - * - Fused kernel with 2 activation variants: 2 - * - Time batching kernel: 1 (Not implemented) - * - Total: 6 - * - * matXvec 8x16 Kernels, - * - Bypass kernels with 16, 32, 64 bit output: 3 - * - Fused kernel with 2 activation variants: 2 - * - Time batching kernel: 1 (Not implemented) - * - Total: 6 - * - * matXvec 8x8 Kernels, - * - Bypass kernels with 8, 16, 32 bit output: 3 - * - Fused kernel with 2 activation variants: 2 - * - Time batching kernel: 1 (Not implemented) - * - Total: 6 - * - * matXvec float32 x float32 Kernels, - * - Bypass kernels 32 bit output: 1 - * - Fused kernel with 2 activation variants: 2 - * - Time batching kernel: 1 (Not implemented) - * - Total: 4 - * - * ACTIVATION KERNELS API NAMING CONVENTION
- *
- * xa_nn_vec_[activation]_[n]_[p] for fixed point
- * xa_nn_vec_[activation]_f32_f32 for floating point, where - * - [activation]: One of activations - sigmoid/tanh/relu/relu1/relu6/softmax - * - [n]: Input precision in bits - * - [p]: Output precision in bits - * - * Possible values, - * - 'n' takes value '32', and expects input in Q6.25 format. - * - 'p' takes values '32' and '16', gives output in Q16.15 and Q0.15 formats - * respectively. - * - * There is WORD32 datatype variable 'threshold' for 'relu' related apis, which - * expects value in Q16.15 format. - * - * Restriction, - * - All pointers (p_out, p_vec) must be 32-bit aligned and should not overlap. - * - * activation 32_32 kernels, - * - Vector activation kernels: 6 - * - Total: 6 - * - * activation f32_f32 kernels, - * - Vector activation kernels: 6 - * - Total: 6 - * - * activation 32_16 kernels, - * - Vector activation kernels: 2 - * - Total: 2 - */ - -#include "tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/xa_type_def.h" - -#if defined(__cplusplus) -extern "C" { -#endif - -WORD32 xa_nn_conv2d_depthwise_getsize( - WORD32 input_height, WORD32 input_width, WORD32 input_channels, - WORD32 kernel_height, WORD32 kernel_width, WORD32 channels_multiplier, - WORD32 x_stride, WORD32 y_stride, WORD32 x_padding, WORD32 y_padding, - WORD32 output_height, WORD32 output_width, WORD32 circ_buf_precision, - WORD32 inp_data_format); - -WORD32 xa_nn_vec_activation_min_max_asym8u_asym8u( - UWORD8 *__restrict__ p_out, const UWORD8 *__restrict__ p_vec, - int activation_min, int activation_max, WORD32 vec_length); - -WORD32 xa_nn_vec_activation_min_max_asym8s_asym8s( - WORD8 *__restrict__ p_out, const WORD8 *__restrict__ p_vec, - int activation_min, int activation_max, WORD32 vec_length); - -WORD32 xa_nn_conv2d_std_getsize(WORD32 input_height, WORD32 input_channels, - WORD32 kernel_height, WORD32 kernel_width, - WORD32 y_stride, WORD32 y_padding, - WORD32 out_height, WORD32 input_precision); - -WORD32 xa_nn_conv2d_std_asym8uxasym8u( - UWORD8 *__restrict__ p_out, const UWORD8 *__restrict__ p_inp, - const UWORD8 *__restrict__ p_kernel, const WORD32 *__restrict__ p_bias, - WORD32 input_height, WORD32 input_width, WORD32 input_channels, - WORD32 kernel_height, WORD32 kernel_width, WORD32 out_channels, - WORD32 x_stride, WORD32 y_stride, WORD32 x_padding, WORD32 y_padding, - WORD32 out_height, WORD32 out_width, WORD32 input_zero_bias, - WORD32 kernel_zero_bias, WORD32 out_multiplier, WORD32 out_shift, - WORD32 out_zero_bias, WORD32 out_data_format, VOID *p_scratch); - -WORD32 xa_nn_conv2d_std_per_chan_sym8sxasym8s( - WORD8 *__restrict__ p_out, const WORD8 *__restrict__ p_inp, - const WORD8 *__restrict__ p_kernel, const WORD32 *__restrict__ p_bias, - WORD32 input_height, WORD32 input_width, WORD32 input_channels, - WORD32 kernel_height, WORD32 kernel_width, WORD32 out_channels, - WORD32 x_stride, WORD32 y_stride, WORD32 x_padding, WORD32 y_padding, - WORD32 out_height, WORD32 out_width, WORD32 input_zero_bias, - WORD32 *p_out_multiplier, WORD32 *p_out_shift, WORD32 out_zero_bias, - WORD32 out_data_format, VOID *p_scratch); - -WORD32 xa_nn_conv2d_depthwise_asym8uxasym8u( - pUWORD8 __restrict__ p_out, const UWORD8 *__restrict__ p_kernel, - const UWORD8 *__restrict__ p_inp, const WORD32 *__restrict__ p_bias, - WORD32 input_height, WORD32 input_width, WORD32 input_channels, - WORD32 kernel_height, WORD32 kernel_width, WORD32 channels_multiplier, - WORD32 x_stride, WORD32 y_stride, WORD32 x_padding, WORD32 y_padding, - WORD32 out_height, WORD32 out_width, WORD32 input_zero_bias, - WORD32 kernel_zero_bias, WORD32 out_multiplier, WORD32 out_shift, - WORD32 out_zero_bias, WORD32 inp_data_format, WORD32 out_data_format, - pVOID p_scratch); - -WORD32 xa_nn_conv2d_depthwise_per_chan_sym8sxasym8s( - WORD8 *__restrict__ p_out, const WORD8 *__restrict__ p_kernel, - const WORD8 *__restrict__ p_inp, const WORD32 *__restrict__ p_bias, - WORD32 input_height, WORD32 input_width, WORD32 input_channels, - WORD32 kernel_height, WORD32 kernel_width, WORD32 channels_multiplier, - WORD32 x_stride, WORD32 y_stride, WORD32 x_padding, WORD32 y_padding, - WORD32 out_height, WORD32 out_width, WORD32 input_zero_bias, - const WORD32 *p_out_multiplier, const WORD32 *p_out_shift, - WORD32 out_zero_bias, WORD32 inp_data_format, WORD32 out_data_format, - pVOID p_scratch); - -WORD32 xa_nn_fully_connected_asym8uxasym8u_asym8u( - pUWORD8 __restrict__ p_out, const UWORD8 *__restrict__ p_weight, - const UWORD8 *__restrict__ p_inp, const WORD32 *__restrict__ p_bias, - WORD32 weight_depth, WORD32 out_depth, WORD32 input_zero_bias, - WORD32 weight_zero_bias, WORD32 out_multiplier, WORD32 out_shift, - WORD32 out_zero_bias); - -WORD32 xa_nn_fully_connected_sym8sxasym8s_asym8s( - pWORD8 __restrict__ p_out, const WORD8 *__restrict__ p_weight, - const WORD8 *__restrict__ p_inp, const WORD32 *__restrict__ p_bias, - WORD32 weight_depth, WORD32 out_depth, WORD32 input_zero_bias, - WORD32 out_multiplier, WORD32 out_shift, WORD32 out_zero_bias); - -WORD32 xa_nn_fully_connected_asym8sxasym8s_asym8s( - WORD8 *__restrict__ p_out, const WORD8 *__restrict__ p_weight, - const WORD8 *__restrict__ p_inp, const WORD32 *__restrict__ p_bias, - WORD32 weight_depth, WORD32 out_depth, WORD32 weight_zero_bias, - WORD32 input_zero_bias, WORD32 out_multiplier, WORD32 out_shift, - WORD32 out_zero_bias); - -WORD32 xa_nn_vec_softmax_asym8u_8(UWORD8 *__restrict__ p_out, - const UWORD8 *__restrict__ p_vec, - WORD32 diffmin, WORD32 input_left_shift, - WORD32 input_multiplier, WORD32 vec_length, - pVOID p_scratch); - -WORD32 xa_nn_vec_softmax_asym8s_16(WORD16 *__restrict__ p_out, - const WORD8 *__restrict__ p_vec, - WORD32 diffmin, WORD32 input_left_shift, - WORD32 input_multiplier, WORD32 vec_length, - pVOID p_scratch); - -WORD32 xa_nn_vec_softmax_asym8s_8(WORD8 *__restrict__ p_out, - const WORD8 *__restrict__ p_vec, - WORD32 diffmin, WORD32 input_left_shift, - WORD32 input_multiplier, WORD32 vec_length, - pVOID p_scratch); - -int xa_nn_get_softmax_scratch_size(int inp_precision, int out_precision, - int length); - -WORD32 xa_nn_matXvec_out_stride_asym8uxasym8u_asym8u( - UWORD8 *__restrict__ p_out, const UWORD8 *__restrict__ p_mat1, - const UWORD8 *__restrict__ p_vec1, const WORD32 *__restrict__ p_bias, - WORD32 rows, WORD32 cols1, WORD32 row_stride1, WORD32 out_stride, - WORD32 mat1_zero_bias, WORD32 vec1_zero_bias, WORD32 out_multiplier, - WORD32 out_shift, WORD32 out_zero_bias); - -WORD32 xa_nn_matXvec_out_stride_sym8sxasym8s_asym8s( - WORD8 *__restrict__ p_out, const WORD8 *__restrict__ p_mat1, - const WORD8 *__restrict__ p_vec1, const WORD32 *__restrict__ p_bias, - WORD32 rows, WORD32 cols1, WORD32 row_stride1, WORD32 out_stride, - WORD32 vec1_zero_bias, WORD32 out_multiplier, WORD32 out_shift, - WORD32 out_zero_bias); - -WORD32 xa_nn_matXvec_out_stride_asym8sxasym8s_asym8s( - WORD8 *__restrict__ p_out, const WORD8 *__restrict__ p_mat1, - const WORD8 *__restrict__ p_vec1, const WORD32 *__restrict__ p_bias, - WORD32 rows, WORD32 cols1, WORD32 row_stride1, WORD32 out_stride, - WORD32 mat1_zero_bias, WORD32 vec1_zero_bias, WORD32 out_multiplier, - WORD32 out_shift, WORD32 out_zero_bias); - -WORD32 xa_nn_matXvec_out_stride_sym8sxasym8s_16( - WORD16 *__restrict__ p_out, const WORD8 *__restrict__ p_mat1, - const WORD8 *__restrict__ p_vec1, const WORD32 *__restrict__ p_bias, - WORD32 rows, WORD32 cols1, WORD32 row_stride1, WORD32 out_stride, - WORD32 vec1_zero_bias, WORD32 out_multiplier, WORD32 out_shift); - -WORD32 xa_nn_dot_prod_16x16_asym8s( - WORD8 *__restrict__ p_out, /* pointer to output */ - const WORD16 *__restrict__ p_inp1_start, /* pointer to input1 */ - const WORD16 *__restrict__ p_inp2_start, /* pointer to input2 */ - const WORD32 *bias_ptr, WORD32 vec_length, WORD32 out_multiplier, - WORD32 out_shift, WORD32 out_zero_bias, WORD32 vec_count); - -/* Mapping the functions names from previous naming convension for backward - * compatibility */ -#define xa_nn_vec_activation_min_max_asym8_asym8 \ - xa_nn_vec_activation_min_max_asym8u_asym8u -#define xa_nn_conv2d_std_asym8xasym8 xa_nn_conv2d_std_asym8uxasym8u -#define xa_nn_conv2d_depthwise_asym8xasym8 xa_nn_conv2d_depthwise_asym8uxasym8u -#define xa_nn_fully_connected_asym8xasym8_asym8 \ - xa_nn_fully_connected_asym8uxasym8u_asym8u -#define xa_nn_vec_softmax_asym8_asym8 xa_nn_vec_softmax_asym8u_asym8u -#define xa_nn_dot_prod_asym8xasym8_asym8 xa_nn_dot_prod_asym8uxasym8u_asym8u -#define xa_nn_matXvec_out_stride_asym8xasym8_asym8 \ - xa_nn_matXvec_out_stride_asym8uxasym8u_asym8u - -#if defined(__cplusplus) -} -#endif -#endif /* __XA_NNLIB_KERNELS_API_H__ */ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_standards.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_standards.h deleted file mode 100644 index 36ea75d..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_standards.h +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019-2020 Cadence Design Systems, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to use this Software with Cadence processor cores only and - * not with any other processors and platforms, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ******************************************************************************/ - -/* Copyright 2018 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 __STANDARDS_H__ -#define __STANDARDS_H__ - -#if defined(__cplusplus) -extern "C" { -#endif - -typedef double flt64; -typedef char Int4; -typedef char Int8; -typedef int16_t Int16; -typedef int Int32; -typedef int Int24; -typedef int64_t Int64; -typedef int Bool; -typedef float Flt32; - -#ifdef MODEL_FLT64 -typedef double vect_t; -typedef double coeff_t; -typedef double accu_t; - -#elif MODEL_INT16 -typedef int16_t vect_t; -typedef int16_t coeff_t; -typedef signed char coeff8_t; -typedef int64_t accu_t; -typedef float coefff32_t; -#endif - -typedef struct xa_nnlib_opaque { - Int32 _; -} * xa_nnlib_handle_t; - -typedef enum _xa_nnlib_prec_t { - PREC_8 = 8, - PREC_16 = 16, - PREC_32 = 32, - PREC_F32 = -1, - PREC_F16 = -2, - PREC_ASYM8U = -3, - PREC_ASYM8S = -4, - PREC_SYM8S = -5 -} xa_nnlib_prec_t; - -typedef enum _xa_nnlib_shape_type_t { - SHAPE_UNKNOWN_T = 0, - SHAPE_VECTOR_T = 1, - SHAPE_MATRIX_T = 2, - SHAPE_CUBE_DWH_T = 3, - SHAPE_CUBE_WHD_T = 4 -} xa_nnlib_shape_type_t; - -typedef struct _xa_nnlib_shape_t { - xa_nnlib_shape_type_t shape_type; - Int32 n_shapes; - Int32 shape_offset; // Offest between current shape and next shape - union { - struct { - Int32 height; - Int32 height_offset; - Int32 width; - Int32 width_offset; - Int32 depth; - Int32 depth_offset; - } cube; - - struct { - Int32 length; - } vector; - struct { - Int32 rows; - Int32 row_offset; // Offset between current row and next row - Int32 cols; - } matrix; - } dim; -} xa_nnlib_shape_t; - -/*****************************************************************************/ -/* Constant hash defines */ -/*****************************************************************************/ -#define XA_NNLIB_NO_ERROR 0 -/* error handling 'AND' definition */ -#define XA_FATAL_ERROR 0x80000000 - -enum xa_error_severity { - xa_severity_nonfatal = 0, - xa_severity_fatal = (int)0xffffffff -}; - -enum xa_error_class { - xa_class_nnlib = 0, - xa_class_config = 1, - xa_class_execute = 2 -}; - -#define XA_NNLIB_GENERIC 0 - -#define XA_ERROR_CODE(severity, class, codec, index) \ - ((severity << 31) | (class << 12) | (codec << 7) | index) -#define XA_ERROR_SEVERITY(code) (((code)&XA_FATAL_ERROR) != 0) -#define XA_ERROR_CLASS(code) (((code) >> 12) & 0x0f) -#define XA_ERROR_CODEC(code) (((code) >> 7) & 0x1f) -#define XA_ERROR_SUBCODE(code) (((code) >> 0) & 0x3f) - -/* Our convention is that only nnlib-class errors can be generic ones. */ - -/*****************************************************************************/ -/* Class 0: NNLib Errors */ -/*****************************************************************************/ -/* Non Fatal Errors */ -/* (none) */ -/* Fatal Errors */ -enum xa_error_fatal_nnlib_generic { - XA_NNLIB_FATAL_MEM_ALLOC = - XA_ERROR_CODE(xa_severity_fatal, xa_class_nnlib, XA_NNLIB_GENERIC, 0), - XA_NNLIB_FATAL_MEM_ALIGN = - XA_ERROR_CODE(xa_severity_fatal, xa_class_nnlib, XA_NNLIB_GENERIC, 1), - XA_NNLIB_FATAL_INVALID_SHAPE = - XA_ERROR_CODE(xa_severity_fatal, xa_class_nnlib, XA_NNLIB_GENERIC, 3) -}; - -/*****************************************************************************/ -/* NNLib Startup Functions */ -/*****************************************************************************/ -const Int8* xa_nnlib_get_lib_name_string(void); -const Int8* xa_nnlib_get_lib_version_string(void); -const Int8* xa_nnlib_get_lib_api_version_string(void); - -#if defined(__cplusplus) -} -#endif - -#endif /* __STANDARDS_H__ */ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/xa_type_def.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/xa_type_def.h deleted file mode 100644 index 13a7469..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/xa_type_def.h +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2019-2020 Cadence Design Systems, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to use this Software with Cadence processor cores only and - * not with any other processors and platforms, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ******************************************************************************/ - -/* Copyright 2018 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 __XA_TYPE_DEF_H__ -#define __XA_TYPE_DEF_H__ - -#include - -/****************************************************************************/ -/* types type define prefix examples bytes */ -/************************ *********** ****** **************** ***** */ -typedef signed char WORD8; /* b WORD8 b_name 1 */ -typedef signed char* pWORD8; /* pb pWORD8 pb_nmae 1 */ -typedef unsigned char UWORD8; /* ub UWORD8 ub_count 1 */ -typedef unsigned char* pUWORD8; /* pub pUWORD8 pub_count 1 */ - -typedef int16_t WORD16; /* s WORD16 s_count 2 */ -typedef int16_t* pWORD16; /* ps pWORD16 ps_count 2 */ -typedef uint16_t UWORD16; /* us UWORD16 us_count 2 */ -typedef uint16_t* pUWORD16; /* pus pUWORD16 pus_count 2 */ - -typedef signed int WORD24; /* k WORD24 k_count 3 */ -typedef signed int* pWORD24; /* pk pWORD24 pk_count 3 */ -typedef unsigned int UWORD24; /* uk UWORD24 uk_count 3 */ -typedef unsigned int* pUWORD24; /* puk pUWORD24 puk_count 3 */ - -typedef signed int WORD32; /* i WORD32 i_count 4 */ -typedef signed int* pWORD32; /* pi pWORD32 pi_count 4 */ -typedef unsigned int UWORD32; /* ui UWORD32 ui_count 4 */ -typedef unsigned int* pUWORD32; /* pui pUWORD32 pui_count 4 */ - -typedef int64_t WORD40; /* m WORD40 m_count 5 */ -typedef int64_t* pWORD40; /* pm pWORD40 pm_count 5 */ -typedef uint64_t UWORD40; /* um UWORD40 um_count 5 */ -typedef uint64_t* pUWORD40; /* pum pUWORD40 pum_count 5 */ - -typedef int64_t WORD64; /* h WORD64 h_count 8 */ -typedef int64_t* pWORD64; /* ph pWORD64 ph_count 8 */ -typedef uint64_t UWORD64; /* uh UWORD64 uh_count 8 */ -typedef uint64_t* pUWORD64; /* puh pUWORD64 puh_count 8 */ - -typedef float FLOAT32; /* f FLOAT32 f_count 4 */ -typedef float* pFLOAT32; /* pf pFLOAT32 pf_count 4 */ -typedef double FLOAT64; /* d UFLOAT64 d_count 8 */ -typedef double* pFlOAT64; /* pd pFLOAT64 pd_count 8 */ - -typedef void VOID; /* v VOID v_flag 4 */ -typedef void* pVOID; /* pv pVOID pv_flag 4 */ - -/* variable size types: platform optimized implementation */ -typedef signed int BOOL; /* bool BOOL bool_true */ -typedef unsigned int UBOOL; /* ubool BOOL ubool_true */ -typedef signed int FLAG; /* flag FLAG flag_false */ -typedef unsigned int UFLAG; /* uflag FLAG uflag_false */ -typedef signed int LOOPIDX; /* lp LOOPIDX lp_index */ -typedef unsigned int ULOOPIDX; /* ulp SLOOPIDX ulp_index */ -typedef signed int WORD; /* lp LOOPIDX lp_index */ -typedef unsigned int UWORD; /* ulp SLOOPIDX ulp_index */ - -typedef LOOPIDX LOOPINDEX; /* lp LOOPIDX lp_index */ -typedef ULOOPIDX ULOOPINDEX; /* ulp SLOOPIDX ulp_index */ - -#define PLATFORM_INLINE __inline - -typedef struct xa_codec_opaque { - WORD32 _; -} * xa_codec_handle_t; - -typedef int XA_ERRORCODE; - -typedef XA_ERRORCODE xa_codec_func_t(xa_codec_handle_t p_xa_module_obj, - WORD32 i_cmd, WORD32 i_idx, - pVOID pv_value); - -#endif /* __XA_TYPE_DEF_H__ */ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xtensa_tf_micro_common.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xtensa_tf_micro_common.h deleted file mode 100644 index 81847b6..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xtensa_tf_micro_common.h +++ /dev/null @@ -1,88 +0,0 @@ -/****************************************************************************** - * Copyright (C) 2019 Cadence Design Systems, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to use this Software with Cadence processor cores only and - * not with any other processors and platforms, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ******************************************************************************/ - -/* Copyright 2018 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 __XTENSA_TF_MICRO_COMMON__ -#define __XTENSA_TF_MICRO_COMMON__ - -#if defined HIFI_NNLIB_OPT || defined HIFI_MINI_NNLIB_OPT -#include "tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_api.h" -#include "tensorflow/lite/micro/kernels/xtensa_hifimini_staging/xa_nnlib/include/nnlib/xa_nnlib_standards.h" - -#define CHECK_ERR_HIFI_NNLIB_KER(ret, err_msg) \ - if (ret != 0) { \ - TF_LITE_KERNEL_LOG(context, err_msg); \ - return kTfLiteError; \ - } - -#ifndef XTENSA_NNLIB_MAX_SCRATCH_SIZE -#define XTENSA_NNLIB_MAX_SCRATCH_SIZE (70 * 1024) -#endif - -#define ALLOCATE_XTENSA_NNLIB_SCRATCH_MEM \ - uint8_t xtensa_nnlib_scratch_buf[XTENSA_NNLIB_MAX_SCRATCH_SIZE]; - -#define MIN(a, b) (a) < (b) ? (a) : (b); -#define MAX(a, b) (a) > (b) ? (a) : (b); - -#define ACTIVATION_MIN_MAX(data_type, out, inp, min, max) \ - { \ - data_type temp = MAX(inp, min); \ - out = MIN(temp, max); \ - } - -#define ACTIVATION_MIN_MAX_F32(out, inp, min, max) \ - { \ - float temp = MAX(inp, min); \ - out = MIN(temp, max); \ - } - -#define ACTIVATION_MIN_MAX_ASYM8(out, inp, min, max) \ - { \ - int32_t temp = MAX((int32_t)inp, min); \ - out = (uint8_t)MIN(temp, max); \ - } - -#define ALIGNED_SIZE(x, bytes) (((x) + (bytes - 1)) & (~(bytes - 1))) -#define ALIGN_PTR(x, bytes) ((((unsigned)(x)) + (bytes - 1)) & (~(bytes - 1))) - -#define PRINT_VAR(var) \ - printf("%s = %d\n", #var, var); \ - fflush(stdout); \ - fflush(stderr); - -#endif /* HIFI_NNLIB_OPT */ - -#endif /* __XTENSA_TF_MICRO_COMMON__ */ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_helpers.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_helpers.h deleted file mode 100644 index 8f5526c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_helpers.h +++ /dev/null @@ -1,59 +0,0 @@ -/* 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_MICRO_MEMORY_HELPERS_H_ -#define TENSORFLOW_LITE_MICRO_MEMORY_HELPERS_H_ - -#include -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/core/api/error_reporter.h" -#include "tensorflow/lite/schema/schema_generated.h" - -namespace tflite { - -// Returns the next pointer address aligned to the given alignment. -uint8_t* AlignPointerUp(uint8_t* data, size_t alignment); - -// Returns the previous pointer address aligned to the given alignment. -uint8_t* AlignPointerDown(uint8_t* data, size_t alignment); - -// Returns an increased size that's a multiple of alignment. -size_t AlignSizeUp(size_t size, size_t alignment); - -// Returns size in bytes for a given TfLiteType. -TfLiteStatus TfLiteTypeSizeOf(TfLiteType type, size_t* size); - -// How many bytes are needed to hold a tensor's contents. -TfLiteStatus BytesRequiredForTensor(const tflite::Tensor& flatbuffer_tensor, - size_t* bytes, size_t* type_size, - ErrorReporter* error_reporter); - -// How many bytes are used in a TfLiteEvalTensor instance. The byte length is -// returned in out_bytes. -TfLiteStatus TfLiteEvalTensorByteLength(const TfLiteEvalTensor* eval_tensor, - size_t* out_bytes); - -// Deduce output dimensions from input and allocate given size. -// Useful for operators with two inputs where the largest input should equal the -// output dimension. -TfLiteStatus AllocateOutputDimensionsFromInput(TfLiteContext* context, - const TfLiteTensor* input1, - const TfLiteTensor* input2, - TfLiteTensor* output); - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_MEMORY_HELPERS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h deleted file mode 100644 index f5f26a8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_planner/greedy_memory_planner.h +++ /dev/null @@ -1,163 +0,0 @@ -/* 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_MICRO_MEMORY_PLANNER_GREEDY_MEMORY_PLANNER_H_ -#define TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_GREEDY_MEMORY_PLANNER_H_ - -#include "tensorflow/lite/micro/compatibility.h" -#include "tensorflow/lite/micro/memory_planner/memory_planner.h" - -namespace tflite { - -constexpr int kOnlinePlannedBuffer = -1; - -// A memory planner that uses a greedy algorithm to arrange buffers in memory -// to minimize the overall arena size needed. -// -// The algorithm works like this: -// - The client enters the buffer information through AddBuffer(). -// - When a function like GetOffsetForBuffer() is called, the -// CalculateOffsetsIfNeeded() method is invoked. -// - If an up to date plan is not already present, one will be calculated. -// - The buffers are sorted in descending order of size. -// - The largest buffer is placed at offset zero. -// - The rest of the buffers are looped through in descending size order. -// - The other buffers that need to be in memory at the same time are found. -// - The first gap between simultaneously active buffers that the current -// buffer fits into will be used. -// - If no large-enough gap is found, the current buffer is placed after the -// last buffer that's simultaneously active. -// - This continues until all buffers are placed, and the offsets stored. -// -// This is not guaranteed to produce the best placement, since that's an -// NP-Complete problem, but in practice it should produce one that's decent. -class GreedyMemoryPlanner : public MemoryPlanner { - public: - // You need to pass in an area of memory to be used for planning. This memory - // needs to have a lifetime as long as the planner, but isn't owned by this - // object, so management should be handled by the client. This is so it can be - // stack or globally allocated if necessary on devices without dynamic memory - // allocation. How many buffers can be planned for will depend on the size of - // this scratch memory, so you should enlarge it if you see an error when - // calling AddBuffer(). The memory can be reused once you're done with the - // planner, as long as you copy the calculated offsets to another location. - // Each buffer requires about 36 bytes of scratch. - GreedyMemoryPlanner(unsigned char* scratch_buffer, int scratch_buffer_size); - ~GreedyMemoryPlanner() override; - - // Record details of a buffer we want to place. - TfLiteStatus AddBuffer(ErrorReporter* error_reporter, int size, - int first_time_used, int last_time_used) override; - - // Record details of an offline planned buffer offset we want to place. - // offline_offset is the buffer offset from the start of the arena. - TfLiteStatus AddBuffer(ErrorReporter* error_reporter, int size, - int first_time_used, int last_time_used, - int offline_offset); - - // Returns the high-water mark of used memory. This is the minimum size of a - // memory arena you'd need to allocate to hold these buffers. - size_t GetMaximumMemorySize() override; - - // How many buffers have been recorded. - int GetBufferCount() override; - - // Where a given buffer should be placed in the memory arena. - // This information is stored in the memory arena itself, so once the arena - // is used for inference, it will be overwritten. - TfLiteStatus GetOffsetForBuffer(ErrorReporter* error_reporter, - int buffer_index, int* offset) override; - - // Prints an ascii-art diagram of the buffer layout plan. - void PrintMemoryPlan(ErrorReporter* error_reporter); - - // Debug method to check whether any buffer allocations are overlapping. This - // is an O(N^2) complexity operation, so only use for testing. - bool DoAnyBuffersOverlap(ErrorReporter* error_reporter); - - // Used to store a list of buffers ordered by their offset. - struct ListEntry { - int offset; - int requirements_index; - int next_entry_index; - }; - - // Number of bytes required in order to plan a buffer. - static size_t per_buffer_size() { - const int per_buffer_size = - sizeof(BufferRequirements) + // requirements_ - sizeof(int) + // buffer_sizes_sorted_ - sizeof(int) + // buffer_ids_sorted_ - sizeof(ListEntry) + // buffers_sorted_by_offset_ - sizeof(int); // buffer_offsets_; - return per_buffer_size; - } - - private: - // Whether a buffer is active in a given time range. - bool DoesEntryOverlapInTime(const ListEntry* entry, const int first_time_used, - const int last_time_used) const; - - // Walks the list to return the next buffer that is active in a given time - // range, or a null pointer if there are none. - ListEntry* NextSimultaneouslyActiveBuffer(const ListEntry* start, - const int first_time_used, - const int last_time_used); - - // If there isn't an up to date plan, calculate a new one. - void CalculateOffsetsIfNeeded(); - - // How many buffers we can plan for, based on the arena size we're given in - // the constructor. - int max_buffer_count_; - - // The number of buffers added so far. - int buffer_count_; - - // Records the client-provided information about each buffer. - struct BufferRequirements { - int size; - int offline_offset; - int first_time_used; - int last_time_used; - }; - - // Working arrays used during the layout algorithm. - BufferRequirements* requirements_; - // buffer_sizes_sorted_ and buffer_ids_sorted_ are sorted according to: - // { - // offline planned buffers, - // online planned buffers sorted by size - // } - int* buffer_sizes_sorted_; - int* buffer_ids_sorted_; - ListEntry* buffers_sorted_by_offset_; - int next_free_entry_; // Index of the next free entry of - // buffers_sorted_by_offset_ - int first_entry_index_; // Index of the first entry (smallest offset) of - // buffers_sorted_by_offset_ - - // Stores the outcome of the plan, the location of each buffer in the arena. - int* buffer_offsets_; - - // Whether buffers have been added since the last plan was calculated. - bool need_to_calculate_offsets_; - - TF_LITE_REMOVE_VIRTUAL_DELETE -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_GREEDY_MEMORY_PLANNER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_planner/linear_memory_planner.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_planner/linear_memory_planner.h deleted file mode 100644 index 4d77e77..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_planner/linear_memory_planner.h +++ /dev/null @@ -1,50 +0,0 @@ -/* 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_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ -#define TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ - -#include "tensorflow/lite/micro/compatibility.h" -#include "tensorflow/lite/micro/memory_planner/memory_planner.h" - -namespace tflite { - -// The simplest possible memory planner that just lays out all buffers at -// increasing offsets without trying to reuse memory. -class LinearMemoryPlanner : public MemoryPlanner { - public: - LinearMemoryPlanner(); - ~LinearMemoryPlanner() override; - - TfLiteStatus AddBuffer(tflite::ErrorReporter* error_reporter, int size, - int first_time_used, int last_time_used) override; - - size_t GetMaximumMemorySize() override; - int GetBufferCount() override; - TfLiteStatus GetOffsetForBuffer(tflite::ErrorReporter* error_reporter, - int buffer_index, int* offset) override; - - private: - static constexpr int kMaxBufferCount = 1024; - size_t buffer_offsets_[kMaxBufferCount]; - int current_buffer_count_; - size_t next_free_offset_; - - TF_LITE_REMOVE_VIRTUAL_DELETE -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_LINEAR_MEMORY_PLANNER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_planner/memory_planner.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_planner/memory_planner.h deleted file mode 100644 index 2c39fbe..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/memory_planner/memory_planner.h +++ /dev/null @@ -1,71 +0,0 @@ -/* 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_MICRO_MEMORY_PLANNER_MEMORY_PLANNER_H_ -#define TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_MEMORY_PLANNER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/core/api/error_reporter.h" - -namespace tflite { - -// Interface class for planning the layout of memory buffers during the -// execution of a graph. -// It's designed to be used by a client that iterates in any order through the -// buffers it wants to lay out, and then calls the getter functions for -// information about the calculated layout. For example: -// -// SomeMemoryPlanner planner; -// planner.AddBuffer(reporter, 100, 0, 1); // Buffer 0 -// planner.AddBuffer(reporter, 50, 2, 3); // Buffer 1 -// planner.AddBuffer(reporter, 50, 2, 3); // Buffer 2 -// -// int offset0; -// TF_EXPECT_OK(planner.GetOffsetForBuffer(reporter, 0, &offset0)); -// int offset1; -// TF_EXPECT_OK(planner.GetOffsetForBuffer(reporter, 1, &offset1)); -// int offset2; -// TF_EXPECT_OK(planner.GetOffsetForBuffer(reporter, 2, &offset2)); -// const int arena_size_needed = planner.GetMaximumMemorySize(); -// -// The goal is for applications to be able to experiment with different layout -// strategies without changing their client code, by swapping out classes that -// implement this interface.= -class MemoryPlanner { - public: - MemoryPlanner() {} - virtual ~MemoryPlanner() {} - - // Pass information about a buffer's size and lifetime to the layout - // algorithm. The order this is called implicitly assigns an index to the - // result, so the buffer information that's passed into the N-th call of - // this method will be used as the buffer_index argument to - // GetOffsetForBuffer(). - virtual TfLiteStatus AddBuffer(tflite::ErrorReporter* error_reporter, - int size, int first_time_used, - int last_time_used) = 0; - - // The largest contiguous block of memory that's needed to hold the layout. - virtual size_t GetMaximumMemorySize() = 0; - // How many buffers have been added to the planner. - virtual int GetBufferCount() = 0; - // Calculated layout offset for the N-th buffer added to the planner. - virtual TfLiteStatus GetOffsetForBuffer(tflite::ErrorReporter* error_reporter, - int buffer_index, int* offset) = 0; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_MEMORY_PLANNER_MEMORY_PLANNER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_allocator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_allocator.h deleted file mode 100644 index 39a12ea..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_allocator.h +++ /dev/null @@ -1,279 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_MICRO_MICRO_ALLOCATOR_H_ -#define TENSORFLOW_LITE_MICRO_MICRO_ALLOCATOR_H_ - -#include -#include - -#include "flatbuffers/flatbuffers.h" // from @flatbuffers -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/core/api/error_reporter.h" -#include "tensorflow/lite/micro/compatibility.h" -#include "tensorflow/lite/micro/micro_op_resolver.h" -#include "tensorflow/lite/micro/simple_memory_allocator.h" -#include "tensorflow/lite/schema/schema_generated.h" - -namespace tflite { - -namespace internal { - -// Sets up all of the data structure members for a TfLiteTensor based on the -// contents of a serialized tensor in the flatbuffer. -// TODO(b/162311891): Drop this method when the interpreter has an API for -// returning buffers on TfLiteEvalTensor. -TfLiteStatus InitializeTfLiteTensorFromFlatbuffer( - SimpleMemoryAllocator* allocator, bool allocate_temp, - const tflite::Tensor& flatbuffer_tensor, - const flatbuffers::Vector>* buffers, - ErrorReporter* error_reporter, TfLiteTensor* result); - -// Holds placeholder information for a scratch buffer request from a kernel. -// This struct is only used during the model prepare stage. Each request from a -// kernel is stored in the head section. During the prepare stage, the head -// section will at least hold kMaxScratchBuffersPerOp number of requests plus -// any requests from previous kernel requests. -// -// When the memory plan is finalized, these structs are no longer used in favor -// of a sequential, array of ScratchBufferHandle allocations in the tail -// section. These allocations are indexed by the request API defined in the -// TfLiteContext struct. -typedef struct { - // Number of bytes required by the buffer. The actual allocated size might be - // greater than `bytes` due to buffer alignment. - size_t bytes; - // Node where the buffer is allocated for. This provides useful information to - // determine the lifetime of the buffer. In AllocationInfo, this buffer will - // have `before` = node_idx and `after` = node_idx. - int node_idx; -} ScratchBufferRequest; - -} // namespace internal - -typedef struct { - TfLiteNode node; - const TfLiteRegistration* registration; -} NodeAndRegistration; - -// Holds a pointer to a buffer for a scratch buffer requested by a kernel during -// the model prepare stage. This struct is allocated in-place and allows for -// quick pointer-indexed lookup for speed during model inference. -typedef struct { - // Pointer to location of the scratch buffer: - uint8_t* data; -} ScratchBufferHandle; - -// Allocator responsible for allocating memory for all intermediate tensors -// necessary to invoke a model. -// -// The lifetime of the model, tensor arena and error reporter must be at -// least as long as that of the allocator object, since the allocator needs -// them to be accessible during its entire lifetime. -// -// The MicroAllocator simply plans out additional allocations that are required -// to standup a model for inference in TF Micro. This class currently relies on -// an additional allocator - SimpleMemoryAllocator - for all allocations from an -// arena. These allocations are divided into head (non-persistent) and tail -// (persistent) regions: -// -// Memory layout to help understand how it works -// This information could change in the future version. -// ************** .memory_allocator->GetBuffer() -// Tensors/Scratch buffers (head) -// ************** .head_watermark -// unused memory -// ************** .memory_allocator->GetBuffer() + ->GetMaxBufferSize() -// - ->GetDataSize() -// persistent area (tail) -// ************** .memory_allocator->GetBuffer() + ->GetMaxBufferSize() -class MicroAllocator { - public: - // Creates a MicroAllocator instance from a given tensor arena. This arena - // will be managed by the created instance. - // Note: Please use __declspec(align(16)) to make sure tensor_arena is 16 - // bytes aligned, otherwise some head room will be wasted. - // TODO(b/157615197): Cleanup constructor + factory usage. - static MicroAllocator* Create(uint8_t* tensor_arena, size_t arena_size, - ErrorReporter* error_reporter); - - // Creates a MicroAllocator instance using the provided SimpleMemoryAllocator - // intance. This allocator instance will use the SimpleMemoryAllocator - // instance to manage allocations internally. - static MicroAllocator* Create(SimpleMemoryAllocator* memory_allocator, - ErrorReporter* error_reporter); - - // Begin allocating internal resources required for model inference. - // This method will run through the flatbuffer data supplied in the model to - // properly allocate tensor, node, and op registration data. This method is - // expected to be followed with a call to FinishModelAllocation() before - // resuming allocation with another model. All persistent tensor buffers are - // stored in the out-param eval_tensors. This value is allocated from the - // persistent memory arena and will be used to host runtime tensor buffers. - TfLiteStatus StartModelAllocation( - const Model* model, const MicroOpResolver& op_resolver, - NodeAndRegistration** node_and_registrations, - TfLiteEvalTensor** eval_tensors); - - // Finish allocating internal resources required for model inference. - // This method will plan non-persistent buffers and commit a memory plan to - // the 'head' section of the memory arena. All variable tensor data will also - // be allocated. This method should be called after assigning model resources - // in StartModelAllocation(). The eval_tensors pointer should be the value - // passed into this class during StartModelAllocation(). Scratch buffer - // handles are stored in the out-param `scratch_buffer_handles`. This value - // will be used in `GetScratchBuffer` call to retrieve scratch buffers. - TfLiteStatus FinishModelAllocation( - const Model* model, TfLiteEvalTensor* eval_tensors, - ScratchBufferHandle** scratch_buffer_handles); - - // Allocates a TfLiteTensor struct and populates the returned value with - // properties from the model flatbuffer. This struct is allocated from - // persistent arena memory is only guaranteed for the lifetime of the - // application. The eval_tensors pointer should be the value passed into this - // class during StartModelAllocation() and contains the source-of-truth for - // buffers. - virtual TfLiteTensor* AllocatePersistentTfLiteTensor( - const Model* model, TfLiteEvalTensor* eval_tensors, int tensor_index); - - // Allocates a TfLiteTensor struct and populates the returned value with - // properties from the model flatbuffer. This struct is allocated from - // temporary arena memory is only guaranteed until a call is made to - // ResetTempAllocations(). The eval_tensors pointer should be the value passed - // into this class during StartModelAllocation() and contains the - // source-of-truth for buffers. - virtual TfLiteTensor* AllocateTempTfLiteTensor(const Model* model, - TfLiteEvalTensor* eval_tensors, - int tensor_index); - - // Resets all temporary allocations. This method should be called after a - // chain of temp allocations (e.g. chain of TfLiteTensor objects via - // AllocateTfLiteTensor()). - virtual void ResetTempAllocations(); - - // Allocates persistent buffer which has the same life time as the allocator. - // The memory is immediately available and is allocated from the tail of the - // arena. - virtual void* AllocatePersistentBuffer(size_t bytes); - - // Register a scratch buffer of size `bytes` for Node with `node_id`. - // This method only requests a buffer with a given size to be used after a - // model has finished allocation via FinishModelAllocation(). All requested - // buffers will be accessible by the out-param in that method. - TfLiteStatus RequestScratchBufferInArena(size_t bytes, int* buffer_idx); - - // Finish allocating a specific NodeAndRegistration prepare block (kernel - // entry for a model) with a given node ID. This call ensures that any scratch - // buffer requests and temporary allocations are handled and ready for the - // next node prepare block. - TfLiteStatus FinishPrepareNodeAllocations(int node_id); - - // Returns the arena usage in bytes, only available after - // `FinishModelAllocation`. Otherwise, it will return 0. - size_t used_bytes() const; - - protected: - MicroAllocator(SimpleMemoryAllocator* memory_allocator, - ErrorReporter* error_reporter); - virtual ~MicroAllocator(); - - // Allocates an array in the arena to hold pointers to the node and - // registration pointers required to represent the inference graph of the - // model. - virtual TfLiteStatus AllocateNodeAndRegistrations( - const Model* model, NodeAndRegistration** node_and_registrations); - - // Populates node and registration pointers representing the inference graph - // of the model from values inside the flatbuffer (loaded from the TfLiteModel - // instance). Persistent data (e.g. operator data) is allocated from the - // arena. - virtual TfLiteStatus PrepareNodeAndRegistrationDataFromFlatbuffer( - const Model* model, const MicroOpResolver& op_resolver, - NodeAndRegistration* node_and_registrations); - - // Allocates the list of persistent TfLiteEvalTensors that are used for the - // "eval" phase of model inference. These structs will be the source of truth - // for all tensor buffers. Allocation results are stored in the out-param - // eval_tensors. - virtual TfLiteStatus AllocateTfLiteEvalTensors( - const Model* model, TfLiteEvalTensor** eval_tensors); - - // Allocates persistent tensor buffers for variable tensors in the subgraph. - virtual TfLiteStatus AllocateVariables(const SubGraph* subgraph, - TfLiteEvalTensor* eval_tensors); - - // Allocate and return a persistent TfLiteTensor. - // TODO(b/162311891): Drop this method when the interpreter has an API for - // accessing TfLiteEvalTensor structs. - virtual TfLiteTensor* AllocatePersistentTfLiteTensorInternal( - const Model* model, TfLiteEvalTensor* eval_tensors, int tensor_index); - - // Populates a TfLiteTensor struct with data from the model flatbuffer. Any - // quantization data is allocated from either the tail (persistent) or temp - // sections of the arena based on the allocation flag. - virtual TfLiteStatus PopulateTfLiteTensorFromFlatbuffer( - const Model* model, const SubGraph* subgraph, TfLiteTensor* tensor, - int tensor_index, bool allocate_temp); - - ErrorReporter* error_reporter() const; - - // Returns the first subgraph from the model. - const SubGraph* GetSubGraphFromModel(const Model* model); - - private: - // Commits a memory plan for all non-persistent buffer allocations in the - // 'head' section of the memory arena. The eval_tensors pointer is the list of - // pre-allocated TfLiteEvalTensor structs that will point to the buffers that - // will be allocated into the head section in this function call. The - // scratch_buffer_handles pointer is the array of pre-allocated - // ScratchBufferHandle structs that will point to allocated buffers also in - // the head section. - virtual TfLiteStatus CommitStaticMemoryPlan( - const Model* model, const SubGraph* subgraph, - TfLiteEvalTensor* eval_tensors, - ScratchBufferHandle* scratch_buffer_handles); - - // Allocates an array of ScratchBufferHandle structs in the tail section for a - // given number of handles. - virtual TfLiteStatus AllocateScratchBufferHandles( - ScratchBufferHandle** scratch_buffer_handles, size_t handle_count); - - // Clears all internal scratch buffer request counts and resets the head to - // prepare for kernels to request scratch buffer data when a model is - // preparing. - TfLiteStatus InitScratchBufferData(); - - // Returns the pointer for the array of ScratchBufferRequest allocations in - // the head section. - internal::ScratchBufferRequest* GetScratchBufferRequests(); - - // A simple memory allocator that always allocate from the arena tail or head. - SimpleMemoryAllocator* memory_allocator_; - - ErrorReporter* error_reporter_; - bool model_is_allocating_; - - // Holds the number of ScratchBufferRequest instances stored in the head - // section when a model is allocating. - size_t scratch_buffer_request_count_ = 0; - - // Holds the byte length of the memory plan with the largest head usage. Used - // to ensure that multi-tenant allocations can share the head for buffers. - size_t max_head_buffer_usage_ = 0; - - TF_LITE_REMOVE_VIRTUAL_DELETE -}; - -} // namespace tflite -#endif // TENSORFLOW_LITE_MICRO_MICRO_ALLOCATOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_error_reporter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_error_reporter.h deleted file mode 100644 index e2c073a..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_error_reporter.h +++ /dev/null @@ -1,36 +0,0 @@ -/* Copyright 2018 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_MICRO_MICRO_ERROR_REPORTER_H_ -#define TENSORFLOW_LITE_MICRO_MICRO_ERROR_REPORTER_H_ - -#include - -#include "tensorflow/lite/core/api/error_reporter.h" -#include "tensorflow/lite/micro/compatibility.h" - -namespace tflite { - -class MicroErrorReporter : public ErrorReporter { - public: - ~MicroErrorReporter() override {} - int Report(const char* format, va_list args) override; - - private: - TF_LITE_REMOVE_VIRTUAL_DELETE -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_MICRO_ERROR_REPORTER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_interpreter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_interpreter.h deleted file mode 100644 index 31720c8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_interpreter.h +++ /dev/null @@ -1,211 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_MICRO_MICRO_INTERPRETER_H_ -#define TENSORFLOW_LITE_MICRO_MICRO_INTERPRETER_H_ - -#include -#include - -#include "flatbuffers/flatbuffers.h" // from @flatbuffers -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/core/api/error_reporter.h" -#include "tensorflow/lite/core/api/profiler.h" -#include "tensorflow/lite/kernels/internal/tensor_ctypes.h" -#include "tensorflow/lite/micro/micro_allocator.h" -#include "tensorflow/lite/micro/micro_op_resolver.h" -#include "tensorflow/lite/portable_type_to_tflitetype.h" -#include "tensorflow/lite/schema/schema_generated.h" - -namespace tflite { - -namespace internal { - -// A helper class to encapsulate the implementation of APIs in Context. -// context->impl_ points to an instance of this class. -// Check tensorflow/lite/c/common.h for detailed descriptions. -// TODO(b/16157777): Consider rolling this class into MicroInterpreter. -class ContextHelper { - public: - explicit ContextHelper(ErrorReporter* error_reporter, - MicroAllocator* allocator, const Model* model); - - // Functions that will be assigned to function pointers on TfLiteContext: - static void* AllocatePersistentBuffer(TfLiteContext* ctx, size_t bytes); - static TfLiteStatus RequestScratchBufferInArena(TfLiteContext* ctx, - size_t bytes, - int* buffer_idx); - static void* GetScratchBuffer(TfLiteContext* ctx, int buffer_idx); - static void ReportOpError(struct TfLiteContext* context, const char* format, - ...); - static TfLiteTensor* GetTensor(const struct TfLiteContext* context, - int tensor_idx); - static TfLiteEvalTensor* GetEvalTensor(const struct TfLiteContext* context, - int tensor_idx); - - // Sets the pointer to a list of TfLiteEvalTensor instances. - void SetTfLiteEvalTensors(TfLiteEvalTensor* eval_tensors); - - // Sets the pointer to a list of ScratchBufferHandle instances. - void SetScratchBufferHandles(ScratchBufferHandle* scratch_buffer_handles); - - private: - MicroAllocator* allocator_ = nullptr; - ErrorReporter* error_reporter_ = nullptr; - const Model* model_ = nullptr; - TfLiteEvalTensor* eval_tensors_ = nullptr; - ScratchBufferHandle* scratch_buffer_handles_ = nullptr; -}; - -} // namespace internal - -class MicroInterpreter { - public: - // The lifetime of the model, op resolver, tensor arena, error reporter and - // profiler must be at least as long as that of the interpreter object, since - // the interpreter may need to access them at any time. This means that you - // should usually create them with the same scope as each other, for example - // having them all allocated on the stack as local variables through a - // top-level function. The interpreter doesn't do any deallocation of any of - // the pointed-to objects, ownership remains with the caller. - MicroInterpreter(const Model* model, const MicroOpResolver& op_resolver, - uint8_t* tensor_arena, size_t tensor_arena_size, - ErrorReporter* error_reporter, - tflite::Profiler* profiler = nullptr); - - // Create an interpreter instance using an existing MicroAllocator instance. - // This constructor should be used when creating an allocator that needs to - // have allocation handled in more than one interpreter or for recording - // allocations inside the interpreter. The lifetime of the allocator must be - // as long as that of the interpreter object. - MicroInterpreter(const Model* model, const MicroOpResolver& op_resolver, - MicroAllocator* allocator, ErrorReporter* error_reporter, - tflite::Profiler* profiler = nullptr); - - ~MicroInterpreter(); - - // Runs through the model and allocates all necessary input, output and - // intermediate tensors. - TfLiteStatus AllocateTensors(); - - // In order to support partial graph runs for strided models, this can return - // values other than kTfLiteOk and kTfLiteError. - // TODO(b/149795762): Add this to the TfLiteStatus enum. - TfLiteStatus Invoke(); - - size_t tensors_size() const { return context_.tensors_size; } - TfLiteTensor* tensor(size_t tensor_index); - template - T* typed_tensor(int tensor_index) { - if (TfLiteTensor* tensor_ptr = tensor(tensor_index)) { - if (tensor_ptr->type == typeToTfLiteType()) { - return GetTensorData(tensor_ptr); - } - } - return nullptr; - } - - TfLiteTensor* input(size_t index); - size_t inputs_size() const { return subgraph_->inputs()->Length(); } - const flatbuffers::Vector& inputs() const { - return *subgraph_->inputs(); - } - TfLiteTensor* input_tensor(size_t index) { return input(index); } - template - T* typed_input_tensor(int tensor_index) { - if (TfLiteTensor* tensor_ptr = input_tensor(tensor_index)) { - if (tensor_ptr->type == typeToTfLiteType()) { - return GetTensorData(tensor_ptr); - } - } - return nullptr; - } - - TfLiteTensor* output(size_t index); - size_t outputs_size() const { return subgraph_->outputs()->Length(); } - const flatbuffers::Vector& outputs() const { - return *subgraph_->outputs(); - } - TfLiteTensor* output_tensor(size_t index) { return output(index); } - template - T* typed_output_tensor(int tensor_index) { - if (TfLiteTensor* tensor_ptr = output_tensor(tensor_index)) { - if (tensor_ptr->type == typeToTfLiteType()) { - return GetTensorData(tensor_ptr); - } - } - return nullptr; - } - - // Reset all variable tensors to the default value. - TfLiteStatus ResetVariableTensors(); - - TfLiteStatus initialization_status() const { return initialization_status_; } - - size_t operators_size() const { return subgraph_->operators()->size(); } - - // For debugging only. - const NodeAndRegistration node_and_registration(int node_index) const { - return node_and_registrations_[node_index]; - } - - // For debugging only. - // Returns the actual used arena in bytes. This method gives the optimal arena - // size. It's only available after `AllocateTensors` has been called. - // Note that normally `tensor_arena` requires 16 bytes alignment to fully - // utilize the space. If it's not the case, the optimial arena size would be - // arena_used_bytes() + 16. - size_t arena_used_bytes() const { return allocator_.used_bytes(); } - - protected: - const MicroAllocator& allocator() const { return allocator_; } - const TfLiteContext& context() const { return context_; } - - private: - // TODO(b/158263161): Consider switching to Create() function to enable better - // error reporting during initialization. - void Init(tflite::Profiler* profiler); - - void CorrectTensorEndianness(TfLiteEvalTensor* tensorCorr); - - template - void CorrectTensorDataEndianness(T* data, int32_t size); - - NodeAndRegistration* node_and_registrations_ = nullptr; - - const Model* model_; - const MicroOpResolver& op_resolver_; - ErrorReporter* error_reporter_; - TfLiteContext context_ = {}; - MicroAllocator& allocator_; - bool tensors_allocated_; - - TfLiteStatus initialization_status_; - - const SubGraph* subgraph_ = nullptr; - TfLiteEvalTensor* eval_tensors_ = nullptr; - ScratchBufferHandle* scratch_buffer_handles_ = nullptr; - - // TODO(b/16157777): Drop this reference: - internal::ContextHelper context_helper_; - - // TODO(b/162311891): Clean these pointers up when this class supports buffers - // from TfLiteEvalTensor. - TfLiteTensor* input_tensor_; - TfLiteTensor* output_tensor_; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_MICRO_INTERPRETER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_mutable_op_resolver.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_mutable_op_resolver.h deleted file mode 100644 index 0175c8d..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_mutable_op_resolver.h +++ /dev/null @@ -1,470 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_MICRO_MICRO_MUTABLE_OP_RESOLVER_H_ -#define TENSORFLOW_LITE_MICRO_MICRO_MUTABLE_OP_RESOLVER_H_ - -#include -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/core/api/error_reporter.h" -#include "tensorflow/lite/core/api/flatbuffer_conversions.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/op_macros.h" -#include "tensorflow/lite/micro/compatibility.h" -#include "tensorflow/lite/micro/kernels/fully_connected.h" -#include "tensorflow/lite/micro/kernels/micro_ops.h" -#include "tensorflow/lite/micro/micro_op_resolver.h" -#include "tensorflow/lite/schema/schema_generated.h" - -namespace tflite { - -template -class MicroMutableOpResolver : public MicroOpResolver { - public: - explicit MicroMutableOpResolver(ErrorReporter* error_reporter = nullptr) - : error_reporter_(error_reporter) {} - - const TfLiteRegistration* FindOp(tflite::BuiltinOperator op) const override { - if (op == BuiltinOperator_CUSTOM) return nullptr; - - for (unsigned int i = 0; i < registrations_len_; ++i) { - const TfLiteRegistration& registration = registrations_[i]; - if (registration.builtin_code == op) { - return ®istration; - } - } - return nullptr; - } - - const TfLiteRegistration* FindOp(const char* op) const override { - for (unsigned int i = 0; i < registrations_len_; ++i) { - const TfLiteRegistration& registration = registrations_[i]; - if ((registration.builtin_code == BuiltinOperator_CUSTOM) && - (strcmp(registration.custom_name, op) == 0)) { - return ®istration; - } - } - return nullptr; - } - - MicroOpResolver::BuiltinParseFunction GetOpDataParser( - BuiltinOperator op) const override { - TFLITE_DCHECK(num_buitin_ops_ <= tOpCount); - for (unsigned int i = 0; i < num_buitin_ops_; ++i) { - if (builtin_codes_[i] == op) return builtin_parsers_[i]; - } - return nullptr; - } - - // Registers a Custom Operator with the MicroOpResolver. - // - // Only the first call for a given name will be successful. i.e. if this - // function is called again for a previously added Custom Operator, the - // MicroOpResolver will be unchanged and this function will return - // kTfLiteError. - TfLiteStatus AddCustom(const char* name, TfLiteRegistration* registration) { - if (registrations_len_ >= tOpCount) { - if (error_reporter_) { - TF_LITE_REPORT_ERROR( - error_reporter_, - "Couldn't register custom op '%s', resolver size is too small (%d)", - name, tOpCount); - } - return kTfLiteError; - } - - if (FindOp(name) != nullptr) { - if (error_reporter_ != nullptr) { - TF_LITE_REPORT_ERROR(error_reporter_, - "Calling AddCustom for the same op more than once " - "is not supported (Op: %s).", - name); - } - return kTfLiteError; - } - - TfLiteRegistration* new_registration = ®istrations_[registrations_len_]; - registrations_len_ += 1; - - *new_registration = *registration; - new_registration->builtin_code = BuiltinOperator_CUSTOM; - new_registration->custom_name = name; - return kTfLiteOk; - } - - // The Add* functions below add the various Builtin operators to the - // MicroMutableOpResolver object. - - TfLiteStatus AddAbs() { - return AddBuiltin(BuiltinOperator_ABS, tflite::ops::micro::Register_ABS(), - ParseAbs); - } - - TfLiteStatus AddAdd() { - return AddBuiltin(BuiltinOperator_ADD, tflite::ops::micro::Register_ADD(), - ParseAdd); - } - - TfLiteStatus AddArgMax() { - return AddBuiltin(BuiltinOperator_ARG_MAX, - tflite::ops::micro::Register_ARG_MAX(), ParseArgMax); - } - - TfLiteStatus AddArgMin() { - return AddBuiltin(BuiltinOperator_ARG_MIN, - tflite::ops::micro::Register_ARG_MIN(), ParseArgMin); - } - - TfLiteStatus AddAveragePool2D() { - return AddBuiltin(BuiltinOperator_AVERAGE_POOL_2D, - tflite::ops::micro::Register_AVERAGE_POOL_2D(), - ParsePool); - } - - TfLiteStatus AddCeil() { - return AddBuiltin(BuiltinOperator_CEIL, tflite::ops::micro::Register_CEIL(), - ParseCeil); - } - - TfLiteStatus AddCircularBuffer() { - return AddCustom("CIRCULAR_BUFFER", - tflite::ops::micro::Register_CIRCULAR_BUFFER()); - } - - TfLiteStatus AddConcatenation() { - return AddBuiltin(BuiltinOperator_CONCATENATION, - tflite::ops::micro::Register_CONCATENATION(), - ParseConcatenation); - } - - TfLiteStatus AddConv2D() { - return AddBuiltin(BuiltinOperator_CONV_2D, Register_CONV_2D(), ParseConv2D); - } - - TfLiteStatus AddCos() { - return AddBuiltin(BuiltinOperator_COS, tflite::ops::micro::Register_COS(), - ParseCos); - } - - TfLiteStatus AddDepthwiseConv2D() { - return AddBuiltin(BuiltinOperator_DEPTHWISE_CONV_2D, - Register_DEPTHWISE_CONV_2D(), ParseDepthwiseConv2D); - } - - TfLiteStatus AddDequantize() { - return AddBuiltin(BuiltinOperator_DEQUANTIZE, - tflite::ops::micro::Register_DEQUANTIZE(), - ParseDequantize); - } - - TfLiteStatus AddEqual() { - return AddBuiltin(BuiltinOperator_EQUAL, - tflite::ops::micro::Register_EQUAL(), ParseEqual); - } - - TfLiteStatus AddFloor() { - return AddBuiltin(BuiltinOperator_FLOOR, - tflite::ops::micro::Register_FLOOR(), ParseFloor); - } - - TfLiteStatus AddFullyConnected( - const TfLiteRegistration& registration = Register_FULLY_CONNECTED()) { - return AddBuiltin(BuiltinOperator_FULLY_CONNECTED, registration, - ParseFullyConnected); - } - - TfLiteStatus AddGreater() { - return AddBuiltin(BuiltinOperator_GREATER, - tflite::ops::micro::Register_GREATER(), ParseGreater); - } - - TfLiteStatus AddGreaterEqual() { - return AddBuiltin(BuiltinOperator_GREATER_EQUAL, - tflite::ops::micro::Register_GREATER_EQUAL(), - ParseGreaterEqual); - } - - TfLiteStatus AddHardSwish() { - return AddBuiltin(BuiltinOperator_HARD_SWISH, - tflite::ops::micro::Register_HARD_SWISH(), - ParseHardSwish); - } - - TfLiteStatus AddL2Normalization() { - return AddBuiltin(BuiltinOperator_L2_NORMALIZATION, - tflite::ops::micro::Register_L2_NORMALIZATION(), - ParseL2Normalization); - } - - TfLiteStatus AddLess() { - return AddBuiltin(BuiltinOperator_LESS, tflite::ops::micro::Register_LESS(), - ParseLess); - } - - TfLiteStatus AddLessEqual() { - return AddBuiltin(BuiltinOperator_LESS_EQUAL, - tflite::ops::micro::Register_LESS_EQUAL(), - ParseLessEqual); - } - - TfLiteStatus AddLog() { - return AddBuiltin(BuiltinOperator_LOG, tflite::ops::micro::Register_LOG(), - ParseLog); - } - - TfLiteStatus AddLogicalAnd() { - return AddBuiltin(BuiltinOperator_LOGICAL_AND, - tflite::ops::micro::Register_LOGICAL_AND(), - ParseLogicalAnd); - } - - TfLiteStatus AddLogicalNot() { - return AddBuiltin(BuiltinOperator_LOGICAL_NOT, - tflite::ops::micro::Register_LOGICAL_NOT(), - ParseLogicalNot); - } - - TfLiteStatus AddLogicalOr() { - return AddBuiltin(BuiltinOperator_LOGICAL_OR, - tflite::ops::micro::Register_LOGICAL_OR(), - ParseLogicalOr); - } - - TfLiteStatus AddLogistic() { - return AddBuiltin(BuiltinOperator_LOGISTIC, - tflite::ops::micro::Register_LOGISTIC(), ParseLogistic); - } - - TfLiteStatus AddMaximum() { - return AddBuiltin(BuiltinOperator_MAXIMUM, - tflite::ops::micro::Register_MAXIMUM(), ParseMaximum); - } - - TfLiteStatus AddMaxPool2D() { - return AddBuiltin(BuiltinOperator_MAX_POOL_2D, - tflite::ops::micro::Register_MAX_POOL_2D(), ParsePool); - } - - TfLiteStatus AddMean() { - return AddBuiltin(BuiltinOperator_MEAN, tflite::ops::micro::Register_MEAN(), - ParseReducer); - } - - TfLiteStatus AddMinimum() { - return AddBuiltin(BuiltinOperator_MINIMUM, - tflite::ops::micro::Register_MINIMUM(), ParseMinimum); - } - - TfLiteStatus AddMul() { - return AddBuiltin(BuiltinOperator_MUL, tflite::ops::micro::Register_MUL(), - ParseMul); - } - - TfLiteStatus AddNeg() { - return AddBuiltin(BuiltinOperator_NEG, tflite::ops::micro::Register_NEG(), - ParseNeg); - } - - TfLiteStatus AddNotEqual() { - return AddBuiltin(BuiltinOperator_NOT_EQUAL, - tflite::ops::micro::Register_NOT_EQUAL(), ParseNotEqual); - } - - TfLiteStatus AddPack() { - return AddBuiltin(BuiltinOperator_PACK, tflite::ops::micro::Register_PACK(), - ParsePack); - } - - TfLiteStatus AddPad() { - return AddBuiltin(BuiltinOperator_PAD, tflite::ops::micro::Register_PAD(), - ParsePad); - } - - TfLiteStatus AddPadV2() { - return AddBuiltin(BuiltinOperator_PADV2, - tflite::ops::micro::Register_PADV2(), ParsePadV2); - } - - TfLiteStatus AddPrelu() { - return AddBuiltin(BuiltinOperator_PRELU, - tflite::ops::micro::Register_PRELU(), ParsePrelu); - } - - TfLiteStatus AddQuantize() { - return AddBuiltin(BuiltinOperator_QUANTIZE, Register_QUANTIZE(), - ParseQuantize); - } - - TfLiteStatus AddReduceMax() { - return AddBuiltin(BuiltinOperator_REDUCE_MAX, - tflite::ops::micro::Register_REDUCE_MAX(), ParseReducer); - } - - TfLiteStatus AddRelu() { - return AddBuiltin(BuiltinOperator_RELU, tflite::ops::micro::Register_RELU(), - ParseRelu); - } - - TfLiteStatus AddRelu6() { - return AddBuiltin(BuiltinOperator_RELU6, - tflite::ops::micro::Register_RELU6(), ParseRelu6); - } - - TfLiteStatus AddReshape() { - return AddBuiltin(BuiltinOperator_RESHAPE, - tflite::ops::micro::Register_RESHAPE(), ParseReshape); - } - - TfLiteStatus AddResizeNearestNeighbor() { - return AddBuiltin(BuiltinOperator_RESIZE_NEAREST_NEIGHBOR, - tflite::ops::micro::Register_RESIZE_NEAREST_NEIGHBOR(), - ParseResizeNearestNeighbor); - } - - TfLiteStatus AddRound() { - return AddBuiltin(BuiltinOperator_ROUND, - tflite::ops::micro::Register_ROUND(), ParseRound); - } - - TfLiteStatus AddRsqrt() { - return AddBuiltin(BuiltinOperator_RSQRT, - tflite::ops::micro::Register_RSQRT(), ParseRsqrt); - } - - TfLiteStatus AddShape() { - return AddBuiltin(BuiltinOperator_SHAPE, Register_SHAPE(), ParseShape); - } - - TfLiteStatus AddSin() { - return AddBuiltin(BuiltinOperator_SIN, tflite::ops::micro::Register_SIN(), - ParseSin); - } - - TfLiteStatus AddSoftmax() { - return AddBuiltin(BuiltinOperator_SOFTMAX, Register_SOFTMAX(), - ParseSoftmax); - } - - TfLiteStatus AddSplit() { - return AddBuiltin(BuiltinOperator_SPLIT, - tflite::ops::micro::Register_SPLIT(), ParseSplit); - } - - TfLiteStatus AddSplitV() { - return AddBuiltin(BuiltinOperator_SPLIT_V, - tflite::ops::micro::Register_SPLIT_V(), ParseSplitV); - } - - TfLiteStatus AddSqrt() { - return AddBuiltin(BuiltinOperator_SQRT, tflite::ops::micro::Register_SQRT(), - ParseSqrt); - } - - TfLiteStatus AddSquare() { - return AddBuiltin(BuiltinOperator_SQUARE, - tflite::ops::micro::Register_SQUARE(), ParseSquare); - } - - TfLiteStatus AddStridedSlice() { - return AddBuiltin(BuiltinOperator_STRIDED_SLICE, - tflite::ops::micro::Register_STRIDED_SLICE(), - ParseStridedSlice); - } - - TfLiteStatus AddSub() { - return AddBuiltin(BuiltinOperator_SUB, tflite::ops::micro::Register_SUB(), - ParseSub); - } - - TfLiteStatus AddSvdf() { - return AddBuiltin(BuiltinOperator_SVDF, Register_SVDF(), ParseSvdf); - } - - TfLiteStatus AddTanh() { - return AddBuiltin(BuiltinOperator_TANH, tflite::ops::micro::Register_TANH(), - ParseTanh); - } - - TfLiteStatus AddUnpack() { - return AddBuiltin(BuiltinOperator_UNPACK, - tflite::ops::micro::Register_UNPACK(), ParseUnpack); - } - - unsigned int GetRegistrationLength() { return registrations_len_; } - - private: - TF_LITE_REMOVE_VIRTUAL_DELETE - - TfLiteStatus AddBuiltin(tflite::BuiltinOperator op, - const TfLiteRegistration& registration, - MicroOpResolver::BuiltinParseFunction parser) { - if (op == BuiltinOperator_CUSTOM) { - if (error_reporter_ != nullptr) { - TF_LITE_REPORT_ERROR(error_reporter_, - "Invalid parameter BuiltinOperator_CUSTOM to the " - "AddBuiltin function."); - } - return kTfLiteError; - } - - if (FindOp(op) != nullptr) { - if (error_reporter_ != nullptr) { - TF_LITE_REPORT_ERROR(error_reporter_, - "Calling AddBuiltin with the same op more than " - "once is not supported (Op: #%d).", - op); - } - return kTfLiteError; - } - - if (registrations_len_ >= tOpCount) { - if (error_reporter_) { - TF_LITE_REPORT_ERROR(error_reporter_, - "Couldn't register builtin op #%d, resolver size " - "is too small (%d).", - op, tOpCount); - } - return kTfLiteError; - } - - registrations_[registrations_len_] = registration; - // Strictly speaking, the builtin_code is not necessary for TFLM but filling - // it in regardless. - registrations_[registrations_len_].builtin_code = op; - registrations_len_++; - - builtin_codes_[num_buitin_ops_] = op; - builtin_parsers_[num_buitin_ops_] = parser; - num_buitin_ops_++; - - return kTfLiteOk; - } - - TfLiteRegistration registrations_[tOpCount]; - unsigned int registrations_len_ = 0; - - // Arrays (and counter) to store the builtin codes and their corresponding - // parse functions as these are registered with the Op Resolver. - BuiltinOperator builtin_codes_[tOpCount]; - MicroOpResolver::BuiltinParseFunction builtin_parsers_[tOpCount]; - unsigned int num_buitin_ops_ = 0; - - ErrorReporter* error_reporter_; -}; - -}; // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_MICRO_MUTABLE_OP_RESOLVER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_op_resolver.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_op_resolver.h deleted file mode 100644 index 757b6b8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_op_resolver.h +++ /dev/null @@ -1,73 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_MICRO_MICRO_OP_RESOLVER_H_ -#define TENSORFLOW_LITE_MICRO_MICRO_OP_RESOLVER_H_ - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/core/api/error_reporter.h" -#include "tensorflow/lite/core/api/flatbuffer_conversions.h" -#include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/schema/schema_generated.h" - -namespace tflite { - -// This is an interface for the OpResolver for TFLiteMicro. The differences from -// the TFLite OpResolver base class are to: -// * explicitly remove support for Op versions -// * allow for finer grained registration of the Builtin Ops to reduce code -// size for TFLiteMicro. -// -// We need an interface class instead of directly using MicroMutableOpResolver -// because MicroMutableOpResolver is a class template with the number of -// registered Ops as the template parameter. -class MicroOpResolver : public OpResolver { - public: - typedef TfLiteStatus (*BuiltinParseFunction)(const Operator* op, - ErrorReporter* error_reporter, - BuiltinDataAllocator* allocator, - void** builtin_data); - - // Returns the Op registration struct corresponding to the enum code from the - // flatbuffer schema. Returns nullptr if the op is not found or if op == - // BuiltinOperator_CUSTOM. - virtual const TfLiteRegistration* FindOp(BuiltinOperator op) const = 0; - - // Returns the Op registration struct corresponding to the custom operator by - // name. - virtual const TfLiteRegistration* FindOp(const char* op) const = 0; - - // This implementation exists for compatibility with the OpResolver base class - // and disregards the version parameter. - const TfLiteRegistration* FindOp(BuiltinOperator op, - int version) const final { - return FindOp(op); - } - - // This implementation exists for compatibility with the OpResolver base class - // and disregards the version parameter. - const TfLiteRegistration* FindOp(const char* op, int version) const final { - return FindOp(op); - } - - // Returns the operator specific parsing function for the OpData for a - // BuiltinOperator (if registered), else nullptr. - virtual BuiltinParseFunction GetOpDataParser(BuiltinOperator op) const = 0; - - ~MicroOpResolver() override {} -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_MICRO_OP_RESOLVER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_profiler.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_profiler.h deleted file mode 100644 index a3144b3..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_profiler.h +++ /dev/null @@ -1,71 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_MICRO_PROFILER_H_ -#define TENSORFLOW_LITE_MICRO_MICRO_PROFILER_H_ - -#include "tensorflow/lite/core/api/error_reporter.h" -#include "tensorflow/lite/core/api/profiler.h" -#include "tensorflow/lite/micro/compatibility.h" - -namespace tflite { - -// MicroProfiler creates a common way to gain fine-grained insight into runtime -// performance. Bottleck operators can be identified along with slow code -// sections. This can be used in conjunction with running the relevant micro -// benchmark to evaluate end-to-end performance. -// -// Usage example: -// MicroProfiler profiler(error_reporter); -// { -// ScopedProfile scoped_profile(profiler, tag); -// work_to_profile(); -// } -// -// This will call the following methods in order: -// int event_handle = profiler->BeginEvent(op_name, EventType::DEFAULT, 0) -// work_to_profile(); -// profiler->EndEvent(event_handle) -class MicroProfiler : public tflite::Profiler { - public: - explicit MicroProfiler(tflite::ErrorReporter* reporter); - ~MicroProfiler() override = default; - - // AddEvent is unused for Tf Micro. - void AddEvent(const char* tag, EventType event_type, uint64_t start, - uint64_t end, int64_t event_metadata1, - int64_t event_metadata2) override{}; - - // BeginEvent followed by code followed by EndEvent will profile the code - // enclosed. Multiple concurrent events are unsupported, so the return value - // is always 0. Event_metadata1 and event_metadata2 are unused. The tag - // pointer must be valid until EndEvent is called. - uint32_t BeginEvent(const char* tag, EventType event_type, - int64_t event_metadata1, - int64_t event_metadata2) override; - - // Event_handle is ignored since TF Micro does not support concurrent events. - void EndEvent(uint32_t event_handle) override; - - private: - tflite::ErrorReporter* reporter_; - int32_t start_time_; - const char* event_tag_; - TF_LITE_REMOVE_VIRTUAL_DELETE -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_MICRO_PROFILER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_string.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_string.h deleted file mode 100644 index 59303e8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_string.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2018 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_MICRO_MICRO_STRING_H_ -#define TENSORFLOW_LITE_MICRO_MICRO_STRING_H_ - -#include - -// Implements simple string formatting for numeric types. Returns the number of -// bytes written to output. -extern "C" { -// Functionally equivalent to vsnprintf, trimmed down for TFLite Micro. -// MicroSnprintf() is implemented using MicroVsnprintf(). -int MicroVsnprintf(char* output, int len, const char* format, va_list args); -// Functionally equavalent to snprintf, trimmed down for TFLite Micro. -// For example, MicroSnprintf(buffer, 10, "int %d", 10) will put the string -// "int 10" in the buffer. -// Floating point values are logged in exponent notation (1.XXX*2^N). -int MicroSnprintf(char* output, int len, const char* format, ...); -} - -#endif // TENSORFLOW_LITE_MICRO_MICRO_STRING_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_time.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_time.h deleted file mode 100644 index 465490a..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_time.h +++ /dev/null @@ -1,31 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ -#define TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ - -#include - -namespace tflite { - -// These functions should be implemented by each target platform, and provide an -// accurate tick count along with how many ticks there are per second. -int32_t ticks_per_second(); - -// Return time in ticks. The meaning of a tick varies per platform. -int32_t GetCurrentTimeTicks(); - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_MICRO_TIME_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_utils.h deleted file mode 100644 index b9a3121..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/micro_utils.h +++ /dev/null @@ -1,134 +0,0 @@ -/* 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_MICRO_MICRO_UTILS_H_ -#define TENSORFLOW_LITE_MICRO_MICRO_UTILS_H_ - -#include -#include -#include - -#include "tensorflow/lite/c/common.h" - -namespace tflite { - -// Returns number of elements in the shape array. - -int ElementCount(const TfLiteIntArray& dims); - -// Converts a float value into a quantized value. Note that large values (close -// to max int and min int) may see significant error due to a lack of floating -// point granularity for large values. -template -T FloatToQuantizedType(const float value, const float scale, int zero_point) { - int32_t result = round(value / scale) + zero_point; - result = - std::max(static_cast(std::numeric_limits::min()), result); - result = - std::min(static_cast(std::numeric_limits::max()), result); - return result; -} - -template -T FloatToSymmetricQuantizedType(const float value, const float scale) { - int32_t result = round(value / scale); - result = - std::max(static_cast(std::numeric_limits::min() + 1), result); - result = - std::min(static_cast(std::numeric_limits::max()), result); - return result; -} - -// Helper methods to quantize arrays of floats to the desired format. -// -// There are several key flavors of quantization in TfLite: -// asymmetric symmetric per channel -// int8_t | X | X | X | -// uint8_t | X | X | | -// int16_t | X | | | -// int32_t | | X | X | -// -// The per-op quantization spec can be found here: -// https://www.tensorflow.org/lite/performance/quantization_spec -template -void Quantize(const float* input, T* output, int num_elements, float scale, - int zero_point) { - for (int i = 0; i < num_elements; i++) { - output[i] = FloatToQuantizedType(input[i], scale, zero_point); - } -} - -template -void SymmetricQuantize(const float* input, T* output, int num_elements, - float scale) { - for (int i = 0; i < num_elements; i++) { - output[i] = FloatToSymmetricQuantizedType(input[i], scale); - } -} - -template -void SymmetricPerChannelQuantize(const float* input, T* output, - int num_elements, int num_channels, - float* scales) { - int elements_per_channel = num_elements / num_channels; - for (int i = 0; i < num_channels; i++) { - for (int j = 0; j < elements_per_channel; j++) { - output[i * elements_per_channel + j] = FloatToSymmetricQuantizedType( - input[i * elements_per_channel + j], scales[i]); - } - } -} - -void SignedSymmetricPerChannelQuantize(const float* values, - TfLiteIntArray* dims, - int quantized_dimension, - int8_t* quantized_values, - float* scaling_factor); - -// Quantizes inputs based on the values provided, choosing the smallest range -// which includes all input values. -template -void SymmetricQuantizeCalculateScales(const float* values, TfLiteIntArray* dims, - T* output, float* scale) { - int input_size = ElementCount(*dims); - - float min = 0; - float max = 0; - for (int i = 0; i < input_size; i++) { - min = fminf(min, values[i]); - max = fmaxf(max, values[i]); - } - *scale = fmaxf(std::abs(min), std::abs(max)) / std::numeric_limits::max(); - for (int i = 0; i < input_size; i++) { - const int32_t quantized_value = - static_cast(roundf(values[i] / *scale)); - // Clamp: just in case some odd numeric offset. - quantized_value = fminf(std::numeric_limits::max(), quantized_value); - quantized_value = fmaxf(std::numeric_limits::min() + 1, quantized_value); - output[i] = quantized_value; - } -} - -template -void Dequantize(const T* values, const int size, const float scale, - int zero_point, float* dequantized_values) { - for (int i = 0; i < size; ++i) { - dequantized_values[i] = (values[i] - zero_point) * scale; - } -} - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_MICRO_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/recording_micro_allocator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/recording_micro_allocator.h deleted file mode 100644 index 47246e1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/recording_micro_allocator.h +++ /dev/null @@ -1,125 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_RECORDING_MICRO_ALLOCATOR_H_ -#define TENSORFLOW_LITE_MICRO_RECORDING_MICRO_ALLOCATOR_H_ - -#include "tensorflow/lite/micro/compatibility.h" -#include "tensorflow/lite/micro/micro_allocator.h" -#include "tensorflow/lite/micro/recording_simple_memory_allocator.h" - -namespace tflite { - -// List of buckets currently recorded by this class. Each type keeps a list of -// allocated information during model initialization. -// TODO(b/169834511): Add tracking for scratch buffer allocations. -enum class RecordedAllocationType { - kTfLiteEvalTensorData, - kPersistentTfLiteTensorData, - kPersistentTfLiteTensorQuantizationData, - kPersistentBufferData, - kTfLiteTensorVariableBufferData, - kNodeAndRegistrationArray, - kOpData, -}; - -// Container for holding information about allocation recordings by a given -// type. Each recording contains the number of bytes requested, the actual bytes -// allocated (can defer from requested by alignment), and the number of items -// allocated. -struct RecordedAllocation { - size_t requested_bytes; - size_t used_bytes; - size_t count; -}; - -// Utility subclass of MicroAllocator that records all allocations -// inside the arena. A summary of allocations can be logged through the -// ErrorReporter by invoking LogAllocations(). This special allocator requires -// an instance of RecordingSimpleMemoryAllocator to capture allocations in the -// head and tail. Arena allocation recording can be retrieved by type through -// the GetRecordedAllocation() function. This class should only be used for -// auditing memory usage or integration testing. -class RecordingMicroAllocator : public MicroAllocator { - public: - static RecordingMicroAllocator* Create(uint8_t* tensor_arena, - size_t arena_size, - ErrorReporter* error_reporter); - - // Returns the recorded allocations information for a given allocation type. - RecordedAllocation GetRecordedAllocation( - RecordedAllocationType allocation_type) const; - - const RecordingSimpleMemoryAllocator* GetSimpleMemoryAllocator() const; - - // Logs out through the ErrorReporter all allocation recordings by type - // defined in RecordedAllocationType. - void PrintAllocations() const; - - void* AllocatePersistentBuffer(size_t bytes) override; - - protected: - TfLiteStatus AllocateNodeAndRegistrations( - const Model* model, - NodeAndRegistration** node_and_registrations) override; - TfLiteStatus PrepareNodeAndRegistrationDataFromFlatbuffer( - const Model* model, const MicroOpResolver& op_resolver, - NodeAndRegistration* node_and_registrations) override; - TfLiteStatus AllocateTfLiteEvalTensors( - const Model* model, TfLiteEvalTensor** eval_tensors) override; - TfLiteStatus AllocateVariables(const SubGraph* subgraph, - TfLiteEvalTensor* eval_tensors) override; - // TODO(b/162311891): Once all kernels have been updated to the new API drop - // this method. It is only used to record TfLiteTensor persistent allocations. - TfLiteTensor* AllocatePersistentTfLiteTensorInternal( - const Model* model, TfLiteEvalTensor* eval_tensors, - int tensor_index) override; - // TODO(b/162311891): Once all kernels have been updated to the new API drop - // this function since all allocations for quantized data will take place in - // the temp section. - TfLiteStatus PopulateTfLiteTensorFromFlatbuffer(const Model* model, - const SubGraph* subgraph, - TfLiteTensor* tensor, - int tensor_index, - bool allocate_temp) override; - - private: - RecordingMicroAllocator(RecordingSimpleMemoryAllocator* memory_allocator, - ErrorReporter* error_reporter); - - void PrintRecordedAllocation(RecordedAllocationType allocation_type, - const char* allocation_name, - const char* allocation_description) const; - - RecordedAllocation SnapshotAllocationUsage() const; - void RecordAllocationUsage(const RecordedAllocation& snapshotted_allocation, - RecordedAllocation& recorded_allocation); - - const RecordingSimpleMemoryAllocator* recording_memory_allocator_; - - RecordedAllocation recorded_tflite_eval_tensor_data_ = {}; - RecordedAllocation recorded_persistent_tflite_tensor_data_ = {}; - RecordedAllocation recorded_persistent_tflite_tensor_quantization_data_ = {}; - RecordedAllocation recorded_persistent_buffer_data_ = {}; - RecordedAllocation recorded_tflite_tensor_variable_buffer_data_ = {}; - RecordedAllocation recorded_node_and_registration_array_data_ = {}; - RecordedAllocation recorded_op_data_ = {}; - - TF_LITE_REMOVE_VIRTUAL_DELETE -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_RECORDING_MICRO_ALLOCATOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/recording_micro_interpreter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/recording_micro_interpreter.h deleted file mode 100644 index 0a579b0..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/recording_micro_interpreter.h +++ /dev/null @@ -1,65 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_RECORDING_MICRO_INTERPRETER_H_ -#define TENSORFLOW_LITE_MICRO_RECORDING_MICRO_INTERPRETER_H_ - -#include "tensorflow/lite/micro/micro_interpreter.h" -#include "tensorflow/lite/micro/recording_micro_allocator.h" - -namespace tflite { - -// Utility subclass that enables internal recordings of the MicroInterpreter. -// This class should be used to audit and analyze memory arena usage for a given -// model and interpreter. -// -// After construction and the first Invoke() or AllocateTensors() call - the -// memory usage is recorded and available through the GetMicroAllocator() -// function. See RecordingMicroAlloctor for more details on what is currently -// recorded from arena allocations. -// -// It is recommended for users to increase the tensor arena size by at least 1kb -// to ensure enough additional memory is available for internal recordings. -class RecordingMicroInterpreter : public MicroInterpreter { - public: - RecordingMicroInterpreter(const Model* model, - const MicroOpResolver& op_resolver, - uint8_t* tensor_arena, size_t tensor_arena_size, - ErrorReporter* error_reporter) - : MicroInterpreter(model, op_resolver, - RecordingMicroAllocator::Create( - tensor_arena, tensor_arena_size, error_reporter), - error_reporter), - recording_micro_allocator_( - static_cast(allocator())) {} - - RecordingMicroInterpreter(const Model* model, - const MicroOpResolver& op_resolver, - RecordingMicroAllocator* allocator, - ErrorReporter* error_reporter) - : MicroInterpreter(model, op_resolver, allocator, error_reporter), - recording_micro_allocator_(*allocator) {} - - const RecordingMicroAllocator& GetMicroAllocator() const { - return recording_micro_allocator_; - } - - private: - const RecordingMicroAllocator& recording_micro_allocator_; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_RECORDING_MICRO_INTERPRETER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/recording_simple_memory_allocator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/recording_simple_memory_allocator.h deleted file mode 100644 index 3526716..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/recording_simple_memory_allocator.h +++ /dev/null @@ -1,64 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_RECORDING_SIMPLE_MEMORY_ALLOCATOR_H_ -#define TENSORFLOW_LITE_MICRO_RECORDING_SIMPLE_MEMORY_ALLOCATOR_H_ - -#include "tensorflow/lite/micro/compatibility.h" -#include "tensorflow/lite/micro/simple_memory_allocator.h" - -namespace tflite { - -// Utility class used to log allocations of a SimpleMemoryAllocator. Should only -// be used in debug/evaluation settings or unit tests to evaluate allocation -// usage. -class RecordingSimpleMemoryAllocator : public SimpleMemoryAllocator { - public: - RecordingSimpleMemoryAllocator(ErrorReporter* error_reporter, - uint8_t* buffer_head, size_t buffer_size); - // TODO(b/157615197): Cleanup constructors/destructor and use factory - // functions. - ~RecordingSimpleMemoryAllocator() override; - - static RecordingSimpleMemoryAllocator* Create(ErrorReporter* error_reporter, - uint8_t* buffer_head, - size_t buffer_size); - - // Returns the number of bytes requested from the head or tail. - size_t GetRequestedBytes() const; - - // Returns the number of bytes actually allocated from the head or tail. This - // value will be >= to the number of requested bytes due to padding and - // alignment. - size_t GetUsedBytes() const; - - // Returns the number of alloc calls from the head or tail. - size_t GetAllocatedCount() const; - - TfLiteStatus SetHeadBufferSize(size_t size, size_t alignment) override; - uint8_t* AllocateFromTail(size_t size, size_t alignment) override; - - private: - size_t requested_head_bytes_; - size_t requested_tail_bytes_; - size_t used_bytes_; - size_t alloc_count_; - - TF_LITE_REMOVE_VIRTUAL_DELETE -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_RECORDING_SIMPLE_MEMORY_ALLOCATOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/simple_memory_allocator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/simple_memory_allocator.h deleted file mode 100644 index 35adaf1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/simple_memory_allocator.h +++ /dev/null @@ -1,112 +0,0 @@ -/* 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. -==============================================================================*/ - -#ifndef TENSORFLOW_LITE_MICRO_SIMPLE_MEMORY_ALLOCATOR_H_ -#define TENSORFLOW_LITE_MICRO_SIMPLE_MEMORY_ALLOCATOR_H_ - -#include -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/core/api/error_reporter.h" -#include "tensorflow/lite/micro/compatibility.h" - -namespace tflite { - -// TODO(petewarden): This allocator never frees up or reuses any memory, even -// though we have enough information about lifetimes of the tensors to do so. -// This makes it pretty wasteful, so we should use a more intelligent method. -class SimpleMemoryAllocator { - public: - // TODO(b/157615197): Cleanup constructors/destructor and use factory - // functions. - SimpleMemoryAllocator(ErrorReporter* error_reporter, uint8_t* buffer_head, - uint8_t* buffer_tail); - SimpleMemoryAllocator(ErrorReporter* error_reporter, uint8_t* buffer, - size_t buffer_size); - virtual ~SimpleMemoryAllocator(); - - // Creates a new SimpleMemoryAllocator from a given buffer head and size. - static SimpleMemoryAllocator* Create(ErrorReporter* error_reporter, - uint8_t* buffer_head, - size_t buffer_size); - - // Adjusts the head (lowest address and moving upwards) memory allocation to a - // given size. Calls to this method will also invalidate all temporary - // allocation values (it sets the location of temp space at the end of the - // head section). This call will fail if a chain of allocations through - // AllocateTemp() have not been cleaned up with a call to - // ResetTempAllocations(). - virtual TfLiteStatus SetHeadBufferSize(size_t size, size_t alignment); - - // Allocates memory starting at the tail of the arena (highest address and - // moving downwards). - virtual uint8_t* AllocateFromTail(size_t size, size_t alignment); - - // Allocates a temporary buffer from the head of the arena (lowest address and - // moving upwards) but does not update the actual head allocation size or - // position. The returned buffer is guaranteed until either - // ResetTempAllocations() is called or another call to AllocateFromHead(). - // Repeat calls to this function will create a chain of temp allocations. All - // calls to AllocateTemp() must end with a call to ResetTempAllocations(). If - // AllocateFromHead() is called before a call to ResetTempAllocations(), it - // will fail with an error message. - virtual uint8_t* AllocateTemp(size_t size, size_t alignment); - - // Resets a chain of temporary allocations back to the current head of the - // arena (lowest address). - virtual void ResetTempAllocations(); - - // Returns a pointer to the buffer currently assigned to the head section. - // This buffer is set by calling SetHeadSize(). - uint8_t* GetHeadBuffer() const; - - // Returns the size of the head section in bytes. - size_t GetHeadUsedBytes() const; - - // Returns the size of all allocations in the tail section in bytes. - size_t GetTailUsedBytes() const; - - // Returns the number of bytes available with a given alignment. This number - // takes in account any temporary allocations. - size_t GetAvailableMemory(size_t alignment) const; - - // Returns the number of used bytes in the allocator. This number takes in - // account any temporary allocations. - size_t GetUsedBytes() const; - - protected: - // Returns a pointer to the current end of the head buffer. - uint8_t* head() const; - - // Returns a pointer to the current end of the tail buffer. - uint8_t* tail() const; - - private: - size_t GetBufferSize() const; - - ErrorReporter* error_reporter_; - uint8_t* buffer_head_; - uint8_t* buffer_tail_; - uint8_t* head_; - uint8_t* tail_; - uint8_t* temp_; - - TF_LITE_REMOVE_VIRTUAL_DELETE -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_SIMPLE_MEMORY_ALLOCATOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/test_helpers.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/test_helpers.h deleted file mode 100644 index 1db0d81..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/micro/test_helpers.h +++ /dev/null @@ -1,223 +0,0 @@ -/* 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_MICRO_TEST_HELPERS_H_ -#define TENSORFLOW_LITE_MICRO_TEST_HELPERS_H_ - -// Useful functions for writing tests. - -#include -#include - -#include "flatbuffers/flatbuffers.h" // from @flatbuffers -#include "tensorflow/lite//kernels/internal/tensor_ctypes.h" -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/micro/all_ops_resolver.h" -#include "tensorflow/lite/micro/micro_utils.h" -#include "tensorflow/lite/portable_type_to_tflitetype.h" -#include "tensorflow/lite/schema/schema_generated.h" - -namespace tflite { -namespace testing { - -constexpr int kOfflinePlannerHeaderSize = 3; - -struct NodeConnection_ { - std::initializer_list input; - std::initializer_list output; -}; -typedef struct NodeConnection_ NodeConnection; - -// A simple operator that returns the median of the input with the number of -// times the kernel was invoked. The implementation below is deliberately -// complicated, just to demonstrate how kernel memory planning works. -class SimpleStatefulOp { - static constexpr int kBufferNotAllocated = 0; - // Inputs: - static constexpr int kInputTensor = 0; - // Outputs: - static constexpr int kMedianTensor = 0; - static constexpr int kInvokeCount = 1; - struct OpData { - int* invoke_count = nullptr; - int sorting_buffer = kBufferNotAllocated; - }; - - public: - static const TfLiteRegistration* getRegistration(); - static TfLiteRegistration* GetMutableRegistration(); - static void* Init(TfLiteContext* context, const char* buffer, size_t length); - static TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node); - static TfLiteStatus Invoke(TfLiteContext* context, TfLiteNode* node); -}; - -class MockCustom { - public: - static const TfLiteRegistration* getRegistration(); - static TfLiteRegistration* GetMutableRegistration(); - static void* Init(TfLiteContext* context, const char* buffer, size_t length); - static void Free(TfLiteContext* context, void* buffer); - static TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node); - static TfLiteStatus Invoke(TfLiteContext* context, TfLiteNode* node); - - static bool freed_; -}; - -// Returns an Op Resolver that can be used in the testing code. -AllOpsResolver GetOpResolver(); - -// Returns a simple example flatbuffer TensorFlow Lite model. Contains 1 input, -// 1 layer of weights, 1 output Tensor, and 1 operator. -const Model* GetSimpleMockModel(); - -// Returns a flatbuffer TensorFlow Lite model with more inputs, variable -// tensors, and operators. -const Model* GetComplexMockModel(); - -// Returns a simple flatbuffer model with two branches. -const Model* GetSimpleModelWithBranch(); - -// Returns a simple flatbuffer model with offline planned tensors -// @param[in] num_tensors Number of tensors in the model. -// @param[in] metadata_buffer Metadata for offline planner. -// @param[in] node_con List of connections, i.e. operators -// in the model. -// @param[in] num_conns Number of connections. -// @param[in] num_subgraph_inputs How many of the input tensors are in -// the subgraph inputs. The default value -// of 0 means all of the input tensors -// are in the subgraph input list. There -// must be at least 1 input tensor in the -// subgraph input list. -const Model* GetModelWithOfflinePlanning(int num_tensors, - const int32_t* metadata_buffer, - NodeConnection* node_conn, - int num_conns, - int num_subgraph_inputs = 0); - -// Returns a flatbuffer model with `simple_stateful_op` -const Model* GetSimpleStatefulModel(); - -// Builds a one-dimensional flatbuffer tensor of the given size. -const Tensor* Create1dFlatbufferTensor(int size, bool is_variable = false); - -// Builds a one-dimensional flatbuffer tensor of the given size with -// quantization metadata. -const Tensor* CreateQuantizedFlatbufferTensor(int size); - -// Creates a one-dimensional tensor with no quantization metadata. -const Tensor* CreateMissingQuantizationFlatbufferTensor(int size); - -// Creates a vector of flatbuffer buffers. -const flatbuffers::Vector>* -CreateFlatbufferBuffers(); - -// Performs a simple string comparison without requiring standard C library. -int TestStrcmp(const char* a, const char* b); - -// Wrapper to forward kernel errors to the interpreter's error reporter. -void ReportOpError(struct TfLiteContext* context, const char* format, ...); - -void PopulateContext(TfLiteTensor* tensors, int tensors_size, - TfLiteContext* context); - -// Create a TfLiteIntArray from an array of ints. The first element in the -// supplied array must be the size of the array expressed as an int. -TfLiteIntArray* IntArrayFromInts(const int* int_array); - -// Create a TfLiteFloatArray from an array of floats. The first element in the -// supplied array must be the size of the array expressed as a float. -TfLiteFloatArray* FloatArrayFromFloats(const float* floats); - -template -TfLiteTensor CreateTensor(const T* data, TfLiteIntArray* dims, - const bool is_variable = false) { - TfLiteTensor result; - result.dims = dims; - result.params = {}; - result.quantization = {kTfLiteNoQuantization, nullptr}; - result.is_variable = is_variable; - result.allocation_type = kTfLiteMemNone; - result.type = typeToTfLiteType(); - // Const cast is used to allow passing in const and non-const arrays within a - // single CreateTensor method. A Const array should be used for immutable - // input tensors and non-const array should be used for mutable and output - // tensors. - result.data.data = const_cast(data); - result.quantization = {kTfLiteAffineQuantization, nullptr}; - result.bytes = ElementCount(*dims) * sizeof(T); - return result; -} - -template -TfLiteTensor CreateQuantizedTensor(const T* data, TfLiteIntArray* dims, - const float scale, const int zero_point = 0, - const bool is_variable = false) { - TfLiteTensor result = CreateTensor(data, dims, is_variable); - result.params = {scale, zero_point}; - result.quantization = {kTfLiteAffineQuantization, nullptr}; - return result; -} - -template -TfLiteTensor CreateQuantizedTensor(const float* input, T* quantized, - TfLiteIntArray* dims, float scale, - int zero_point, bool is_variable = false) { - int input_size = ElementCount(*dims); - tflite::Quantize(input, quantized, input_size, scale, zero_point); - return CreateQuantizedTensor(quantized, dims, scale, zero_point, is_variable); -} - -TfLiteTensor CreateQuantizedBiasTensor(const float* data, int32_t* quantized, - TfLiteIntArray* dims, float input_scale, - float weights_scale, - bool is_variable = false); - -// Quantizes int32_t bias tensor with per-channel weights determined by input -// scale multiplied by weight scale for each channel. -TfLiteTensor CreatePerChannelQuantizedBiasTensor( - const float* input, int32_t* quantized, TfLiteIntArray* dims, - float input_scale, float* weight_scales, float* scales, int* zero_points, - TfLiteAffineQuantization* affine_quant, int quantized_dimension, - bool is_variable = false); - -TfLiteTensor CreateSymmetricPerChannelQuantizedTensor( - const float* input, int8_t* quantized, TfLiteIntArray* dims, float* scales, - int* zero_points, TfLiteAffineQuantization* affine_quant, - int quantized_dimension, bool is_variable = false); - -// Returns the number of tensors in the default subgraph for a tflite::Model. -size_t GetModelTensorCount(const Model* model); - -// Derives the quantization scaling factor from a min and max range. -template -inline float ScaleFromMinMax(const float min, const float max) { - return (max - min) / - static_cast((std::numeric_limits::max() * 1.0) - - std::numeric_limits::min()); -} - -// Derives the quantization zero point from a min and max range. -template -inline int ZeroPointFromMinMax(const float min, const float max) { - return static_cast(std::numeric_limits::min()) + - static_cast(-min / ScaleFromMinMax(min, max) + 0.5f); -} - -} // namespace testing -} // namespace tflite - -#endif // TENSORFLOW_LITE_MICRO_TEST_HELPERS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/minimal_logging.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/minimal_logging.h deleted file mode 100644 index 5f42bc7..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/minimal_logging.h +++ /dev/null @@ -1,81 +0,0 @@ -/* 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_MINIMAL_LOGGING_H_ -#define TENSORFLOW_LITE_MINIMAL_LOGGING_H_ - -#include - -namespace tflite { - -enum LogSeverity { - TFLITE_LOG_INFO = 0, - TFLITE_LOG_WARNING = 1, - TFLITE_LOG_ERROR = 2, -}; - -namespace logging_internal { - -// Helper class for simple platform-specific console logging. Note that we -// explicitly avoid the convenience of ostream-style logging to minimize binary -// size impact. -class MinimalLogger { - public: - // Logging hook that takes variadic args. - static void Log(LogSeverity severity, const char* format, ...); - - // Logging hook that takes a formatted va_list. - static void LogFormatted(LogSeverity severity, const char* format, - va_list args); - - private: - static const char* GetSeverityName(LogSeverity severity); -}; - -} // namespace logging_internal -} // namespace tflite - -// Convenience macro for basic internal logging in production builds. -// Note: This should never be used for debug-type logs, as it will *not* be -// stripped in release optimized builds. In general, prefer the error reporting -// APIs for developer-facing errors, and only use this for diagnostic output -// that should always be logged in user builds. -#define TFLITE_LOG_PROD(severity, format, ...) \ - tflite::logging_internal::MinimalLogger::Log(severity, format, ##__VA_ARGS__); - -// Convenience macro for logging a statement *once* for a given process lifetime -// in production builds. -#define TFLITE_LOG_PROD_ONCE(severity, format, ...) \ - do { \ - static const bool s_logged = [&] { \ - TFLITE_LOG_PROD(severity, format, ##__VA_ARGS__) \ - return true; \ - }(); \ - (void)s_logged; \ - } while (false); - -#ifndef NDEBUG -// In debug builds, always log. -#define TFLITE_LOG TFLITE_LOG_PROD -#define TFLITE_LOG_ONCE TFLITE_LOG_PROD_ONCE -#else -// In prod builds, never log, but ensure the code is well-formed and compiles. -#define TFLITE_LOG(severity, format, ...) \ - while (false) { \ - TFLITE_LOG_PROD(severity, format, ##__VA_ARGS__); \ - } -#define TFLITE_LOG_ONCE TFLITE_LOG -#endif - -#endif // TENSORFLOW_LITE_MINIMAL_LOGGING_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/model.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/model.h deleted file mode 100644 index 39c7fd7..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/model.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright 2017 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. -==============================================================================*/ -/// \file -/// Defines tflite::Interpreter and tflite::InterpreterBuilder. -/// -#ifndef TENSORFLOW_LITE_MODEL_H_ -#define TENSORFLOW_LITE_MODEL_H_ - -#include "tensorflow/lite/interpreter_builder.h" -#include "tensorflow/lite/model_builder.h" - -// TODO(b/168725050): Address the issue of proxy header in this file. - -#endif // TENSORFLOW_LITE_MODEL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/model_builder.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/model_builder.h deleted file mode 100644 index 9ffb54c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/model_builder.h +++ /dev/null @@ -1,171 +0,0 @@ -/* Copyright 2017 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. -==============================================================================*/ -/// \file -/// Deserialization infrastructure for tflite. Provides functionality -/// to go from a serialized tflite model in flatbuffer format to an -/// in-memory representation of the model. -/// -#ifndef TENSORFLOW_LITE_MODEL_BUILDER_H_ -#define TENSORFLOW_LITE_MODEL_BUILDER_H_ - -#include - -#include "tensorflow/lite/allocation.h" -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/core/api/error_reporter.h" -#include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/core/api/verifier.h" -#include "tensorflow/lite/mutable_op_resolver.h" -#include "tensorflow/lite/schema/schema_generated.h" -#include "tensorflow/lite/stderr_reporter.h" - -namespace tflite { - -/// An RAII object that represents a read-only tflite model, copied from disk, -/// or mmapped. This uses flatbuffers as the serialization format. -/// -/// NOTE: The current API requires that a FlatBufferModel instance be kept alive -/// by the client as long as it is in use by any dependent Interpreter -/// instances. -///

-/// using namespace tflite;
-/// StderrReporter error_reporter;
-/// auto model = FlatBufferModel::BuildFromFile("interesting_model.tflite",
-///                                             &error_reporter);
-/// MyOpResolver resolver;  // You need to subclass OpResolver to provide
-///                         // implementations.
-/// InterpreterBuilder builder(*model, resolver);
-/// std::unique_ptr interpreter;
-/// if(builder(&interpreter) == kTfLiteOk) {
-///   .. run model inference with interpreter
-/// }
-/// 
-/// -/// OpResolver must be defined to provide your kernel implementations to the -/// interpreter. This is environment specific and may consist of just the -/// builtin ops, or some custom operators you defined to extend tflite. -class FlatBufferModel { - public: - /// Builds a model based on a file. - /// Caller retains ownership of `error_reporter` and must ensure its lifetime - /// is longer than the FlatBufferModel instance. - /// Returns a nullptr in case of failure. - static std::unique_ptr BuildFromFile( - const char* filename, - ErrorReporter* error_reporter = DefaultErrorReporter()); - - /// Verifies whether the content of the file is legit, then builds a model - /// based on the file. - /// The extra_verifier argument is an additional optional verifier for the - /// file contents. By default, we always check with tflite::VerifyModelBuffer. - /// If extra_verifier is supplied, the file contents is also checked against - /// the extra_verifier after the check against tflite::VerifyModelBuilder. - /// Caller retains ownership of `error_reporter` and must ensure its lifetime - /// is longer than the FlatBufferModel instance. - /// Returns a nullptr in case of failure. - static std::unique_ptr VerifyAndBuildFromFile( - const char* filename, TfLiteVerifier* extra_verifier = nullptr, - ErrorReporter* error_reporter = DefaultErrorReporter()); - - /// Builds a model based on a pre-loaded flatbuffer. - /// Caller retains ownership of the buffer and should keep it alive until - /// the returned object is destroyed. Caller also retains ownership of - /// `error_reporter` and must ensure its lifetime is longer than the - /// FlatBufferModel instance. - /// Returns a nullptr in case of failure. - /// NOTE: this does NOT validate the buffer so it should NOT be called on - /// invalid/untrusted input. Use VerifyAndBuildFromBuffer in that case - static std::unique_ptr BuildFromBuffer( - const char* caller_owned_buffer, size_t buffer_size, - ErrorReporter* error_reporter = DefaultErrorReporter()); - - /// Verifies whether the content of the buffer is legit, then builds a model - /// based on the pre-loaded flatbuffer. - /// The extra_verifier argument is an additional optional verifier for the - /// buffer. By default, we always check with tflite::VerifyModelBuffer. If - /// extra_verifier is supplied, the buffer is checked against the - /// extra_verifier after the check against tflite::VerifyModelBuilder. The - /// caller retains ownership of the buffer and should keep it alive until the - /// returned object is destroyed. Caller retains ownership of `error_reporter` - /// and must ensure its lifetime is longer than the FlatBufferModel instance. - /// Returns a nullptr in case of failure. - static std::unique_ptr VerifyAndBuildFromBuffer( - const char* caller_owned_buffer, size_t buffer_size, - TfLiteVerifier* extra_verifier = nullptr, - ErrorReporter* error_reporter = DefaultErrorReporter()); - - /// Builds a model directly from a flatbuffer pointer - /// Caller retains ownership of the buffer and should keep it alive until the - /// returned object is destroyed. Caller retains ownership of `error_reporter` - /// and must ensure its lifetime is longer than the FlatBufferModel instance. - /// Returns a nullptr in case of failure. - static std::unique_ptr BuildFromModel( - const tflite::Model* caller_owned_model_spec, - ErrorReporter* error_reporter = DefaultErrorReporter()); - - // Releases memory or unmaps mmaped memory. - ~FlatBufferModel(); - - // Copying or assignment is disallowed to simplify ownership semantics. - FlatBufferModel(const FlatBufferModel&) = delete; - FlatBufferModel& operator=(const FlatBufferModel&) = delete; - - bool initialized() const { return model_ != nullptr; } - const tflite::Model* operator->() const { return model_; } - const tflite::Model* GetModel() const { return model_; } - ErrorReporter* error_reporter() const { return error_reporter_; } - const Allocation* allocation() const { return allocation_.get(); } - - // Returns the minimum runtime version from the flatbuffer. This runtime - // version encodes the minimum required interpreter version to run the - // flatbuffer model. If the minimum version can't be determined, an empty - // string will be returned. - // Note that the returned minimum version is a lower-bound but not a strict - // lower-bound; ops in the graph may not have an associated runtime version, - // in which case the actual required runtime might be greater than the - // reported minimum. - std::string GetMinimumRuntime() const; - - /// Returns true if the model identifier is correct (otherwise false and - /// reports an error). - bool CheckModelIdentifier() const; - - private: - /// Loads a model from a given allocation. FlatBufferModel will take over the - /// ownership of `allocation`, and delete it in destructor. The ownership of - /// `error_reporter`remains with the caller and must have lifetime at least - /// as much as FlatBufferModel. This is to allow multiple models to use the - /// same ErrorReporter instance. - FlatBufferModel(std::unique_ptr allocation, - ErrorReporter* error_reporter = DefaultErrorReporter()); - - /// Loads a model from Model flatbuffer. The `model` has to remain alive and - /// unchanged until the end of this flatbuffermodel's lifetime. - FlatBufferModel(const Model* model, ErrorReporter* error_reporter); - - /// Flatbuffer traverser pointer. (Model* is a pointer that is within the - /// allocated memory of the data allocated by allocation's internals. - const tflite::Model* model_ = nullptr; - /// The error reporter to use for model errors and subsequent errors when - /// the interpreter is created - ErrorReporter* error_reporter_; - /// The allocator used for holding memory of the model. Note that this will - /// be null if the client provides a tflite::Model directly. - std::unique_ptr allocation_; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MODEL_BUILDER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/mutable_op_resolver.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/mutable_op_resolver.h deleted file mode 100644 index 69ecbbd..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/mutable_op_resolver.h +++ /dev/null @@ -1,87 +0,0 @@ -/* Copyright 2018 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_MUTABLE_OP_RESOLVER_H_ -#define TENSORFLOW_LITE_MUTABLE_OP_RESOLVER_H_ - -#include -#include - -#include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/util.h" - -namespace tflite { - -// Some versions of gcc don't support partial specialization in class scope, -// so these are defined in a namescope. -namespace op_resolver_hasher { -template -struct ValueHasher { - size_t operator()(const V& v) const { return std::hash()(v); } -}; - -template <> -struct ValueHasher { - size_t operator()(const tflite::BuiltinOperator& v) const { - return std::hash()(static_cast(v)); - } -}; - -template -struct OperatorKeyHasher { - size_t operator()(const T& x) const { - size_t a = ValueHasher()(x.first); - size_t b = ValueHasher()(x.second); - return CombineHashes({a, b}); - } -}; -} // namespace op_resolver_hasher - -// An OpResolver that is mutable, also used as the op in gen_op_registration. -// A typical usage: -// MutableOpResolver resolver; -// resolver.AddBuiltin(BuiltinOperator_ADD, Register_ADD()); -// resolver.AddCustom("CustomOp", Register_CUSTOM_OP()); -// InterpreterBuilder(model, resolver)(&interpreter); -class MutableOpResolver : public OpResolver { - public: - const TfLiteRegistration* FindOp(tflite::BuiltinOperator op, - int version) const override; - const TfLiteRegistration* FindOp(const char* op, int version) const override; - void AddBuiltin(tflite::BuiltinOperator op, - const TfLiteRegistration* registration, int version = 1); - void AddBuiltin(tflite::BuiltinOperator op, - const TfLiteRegistration* registration, int min_version, - int max_version); - void AddCustom(const char* name, const TfLiteRegistration* registration, - int version = 1); - void AddCustom(const char* name, const TfLiteRegistration* registration, - int min_version, int max_version); - void AddAll(const MutableOpResolver& other); - - private: - typedef std::pair BuiltinOperatorKey; - typedef std::pair CustomOperatorKey; - - std::unordered_map > - builtins_; - std::unordered_map > - custom_ops_; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_MUTABLE_OP_RESOLVER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/NeuralNetworksShim.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/NeuralNetworksShim.h deleted file mode 100644 index 94e1141..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/NeuralNetworksShim.h +++ /dev/null @@ -1,1696 +0,0 @@ -/* Copyright 2017 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_NNAPI_NEURALNETWORKSSHIM_H_ -#define TENSORFLOW_LITE_NNAPI_NEURALNETWORKSSHIM_H_ - -#include -#include -#include -#include - -#include "tensorflow/lite/nnapi/NeuralNetworksTypes.h" - -// This interface is now deprecated. You should use instead -// nnapi_implementation. - -// TODO(b/123017568): Update all current usages of this file. - -// helpers - -#define NNAPI_LOG(format, ...) fprintf(stderr, format "\n", __VA_ARGS__); -#define LOAD_FUNCTION(name) \ - static name##_fn fn = reinterpret_cast(loadFunction(#name)); -#define EXECUTE_FUNCTION(...) \ - if (fn != nullptr) { \ - fn(__VA_ARGS__); \ - } -#define EXECUTE_FUNCTION_RETURN(...) return fn != nullptr ? fn(__VA_ARGS__) : 0; - -inline void* loadLibrary(const char* name) { - // TODO: change RTLD_LOCAL? Assumes there can be multiple instances of nn - // api RT - void* handle = nullptr; -#ifdef __ANDROID__ - handle = dlopen(name, RTLD_LAZY | RTLD_LOCAL); - if (handle == nullptr) { - NNAPI_LOG("nnapi error: unable to open library %s", name); - } -#endif - return handle; -} - -// ASharedMemory_create was added in Android 8.0, so safe to use with NNAPI -// which was added in 8.1. -inline int ASharedMemory_create(const char* name, size_t size) { - static void* handle = loadLibrary("libandroid.so"); - static ASharedMemory_create_fn fn = - handle != nullptr ? reinterpret_cast( - dlsym(handle, "ASharedMemory_create")) - : nullptr; - int fd = fn != nullptr ? fn(name, size) : -1; - return fd; -} - -inline void* getLibraryHandle() { - static void* handle = loadLibrary("libneuralnetworks.so"); - return handle; -} - -inline void* loadFunction(const char* name) { - void* fn = nullptr; - if (getLibraryHandle() != nullptr) { - fn = dlsym(getLibraryHandle(), name); - } - if (fn == nullptr) { - NNAPI_LOG("nnapi error: unable to open function %s", name); - } - return fn; -} - -inline bool NNAPIExists() { - static bool nnapi_is_available = getLibraryHandle(); - return nnapi_is_available; -} - -// NN api types based on NNAPI header file -// https://developer.android.com/ndk/reference/group/neural-networks - -/** - * Creates a shared memory object from a file descriptor. - * - * The shared memory is backed by a file descriptor via mmap. - * See {@link ANeuralNetworksMemory} for a description on how to use - * this shared memory. - * - * @param size The requested size in bytes. - * Must not be larger than the file size. - * @param prot The desired memory protection for the mapping. - * It is either PROT_NONE or the bitwise OR of one or - * more of the following flags: PROT_READ, PROT_WRITE. - * @param fd The requested file descriptor. - * The file descriptor has to be mmap-able. The file - * descriptor will be duplicated. - * @param offset The offset to the beginning of the file of the area to map. - * The offset has to be aligned to a page size. - * @param memory The memory object to be created. - * Set to NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if the request completed normally. - */ -inline int ANeuralNetworksMemory_createFromFd(size_t size, int protect, int fd, - size_t offset, - ANeuralNetworksMemory** memory) { - LOAD_FUNCTION(ANeuralNetworksMemory_createFromFd); - EXECUTE_FUNCTION_RETURN(size, protect, fd, offset, memory); -} - -/** - * Delete a memory object. - * - * Destroys the object used by the run time to keep track of the memory. - * This will free the underlying actual memory if no other code has open - * handles to this memory. - * - * @param memory The memory object to be freed. - */ -inline void ANeuralNetworksMemory_free(ANeuralNetworksMemory* memory) { - LOAD_FUNCTION(ANeuralNetworksMemory_free); - EXECUTE_FUNCTION(memory); -} - -/** - * Create an empty {@link ANeuralNetworksModel}. - * - *

This only creates the object. Computation is performed once - * {@link ANeuralNetworksExecution_startCompute} is invoked. - * - * The model should be constructed with calls to - * {@link ANeuralNetworksModel_addOperation} and - * {@link ANeuralNetworksModel_addOperand} - * - *

{@link ANeuralNetworksModel_finish} should be called once the model - * has been fully constructed.

- * - *

{@link ANeuralNetworksModel_free} should be called once the model - * is no longer needed.

- * - * @param model The {@link ANeuralNetworksModel} to be created. - * Set to NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksModel_create(ANeuralNetworksModel** model) { - LOAD_FUNCTION(ANeuralNetworksModel_create); - EXECUTE_FUNCTION_RETURN(model); -} - -/** - * Destroy a model. - * - * The model need not have been finished by a call to - * {@link ANeuralNetworksModel_finish}. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @param model The model to be destroyed. Passing NULL is acceptable and - * results in no operation. - */ -inline void ANeuralNetworksModel_free(ANeuralNetworksModel* model) { - LOAD_FUNCTION(ANeuralNetworksModel_free); - EXECUTE_FUNCTION(model); -} - -/** - * Indicate that we have finished modifying a model. Required before - * calling {@link ANeuralNetworksCompilation_compile}. - * - * An application is responsible to make sure that no other thread uses - * the model at the same time. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @param model The model to be finished. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksModel_finish(ANeuralNetworksModel* model) { - LOAD_FUNCTION(ANeuralNetworksModel_finish); - EXECUTE_FUNCTION_RETURN(model); -} - -/** - * Add an operand to a model. - * - * The order in which the operands are added is important. The first one added - * to a model will have the index value 0, the second 1, etc. These indexes are - * used as operand identifiers in {@link ANeuralNetworksModel_addOperation}, - * {@link ANeuralNetworksExecution_setInput}, - * {@link ANeuralNetworksExecution_setInputFromMemory}, - * {@link ANeuralNetworksExecution_setOutput}, - * {@link ANeuralNetworksExecution_setOutputFromMemory} and - * {@link ANeuralNetworksExecution_setOperandValue}. - * - * To build a model that can accommodate inputs of various sizes, as you may - * want to do for a CNN, set the size of the dimensions that will vary at run - * time to 0. If you do so, provide the full dimensions when calling - * {@link ANeuralNetworksExecution_setInput} or {@link - * ANeuralNetworksExecution_setInputFromMemory}. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @param model The model to be modified. - * @param type The {@link ANeuralNetworksOperandType} that describes the shape - * of the operand. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksModel_addOperand( - ANeuralNetworksModel* model, const ANeuralNetworksOperandType* type) { - LOAD_FUNCTION(ANeuralNetworksModel_addOperand); - EXECUTE_FUNCTION_RETURN(model, type); -} - -/** - * Sets an operand to a constant value. - * - * For scalar values, the content of buffer is copied into the model. - * - * For tensor values, a pointer to the buffer is stored within the model. - * The application is responsible for not changing the content of this region - * until all executions using this model have completed. As the data may - * be copied during processing, modifying the data after this call yields - * undefined results. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @param model The model to be modified. - * @param index The index of the model operand we're setting. - * @param buffer A pointer to the data to use. - * @param length The size in bytes of the data value. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksModel_setOperandValue(ANeuralNetworksModel* model, - int32_t index, - const void* buffer, - size_t length) { - LOAD_FUNCTION(ANeuralNetworksModel_setOperandValue); - EXECUTE_FUNCTION_RETURN(model, index, buffer, length); -} - -/** - * Sets an operand's per channel quantization parameters. - * - * Sets parameters required by a tensor of type - * {@link ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL}. - * This function must be called for every tensor of type - * {@link ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL} before - * calling {@link ANeuralNetworksModel_finish}. - * - * Available since API level 29. - * - * @param model The model to be modified. - * @param index The index of the model operand we're setting. - * @param channelQuant The per channel quantization parameters for the operand. - * No memory in this struct needs to outlive the call to - * this function. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksModel_setOperandSymmPerChannelQuantParams( - ANeuralNetworksModel* model, int32_t index, - const ANeuralNetworksSymmPerChannelQuantParams* channelQuant) { - LOAD_FUNCTION(ANeuralNetworksModel_setOperandSymmPerChannelQuantParams); - EXECUTE_FUNCTION_RETURN(model, index, channelQuant); -} - -/** - * Sets an operand to a value stored in a memory object. - * - * The content of the memory is not copied. A reference to that memory is stored - * inside the model. The application is responsible for not changing the content - * of the memory region until all executions using this model have completed. - * As the data may be copied during processing, modifying the data after this - * call yields undefined results. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @param model The model to be modified. - * @param index The index of the model operand we're setting. - * @param buffer A pointer to the data to use. - * @param memory The memory containing the data. - * @param offset This specifies the location of the data within the memory. - * The offset is in bytes from the start of memory. - * @param length The size in bytes of the data value. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksModel_setOperandValueFromMemory( - ANeuralNetworksModel* model, int32_t index, - const ANeuralNetworksMemory* memory, size_t offset, size_t length) { - LOAD_FUNCTION(ANeuralNetworksModel_setOperandValueFromMemory); - EXECUTE_FUNCTION_RETURN(model, index, memory, offset, length); -} - -/** - * Add an operation to a model. - * - * @param model The model to be modified. - * @param type The type of the operation. - * @param inputCount The number of entries in the inputs array. - * @param inputs An array of indexes identifying each operand. - * @param outputCount The number of entries in the outputs array. - * @param outputs An array of indexes identifying each operand. - * - * The operands specified by inputs and outputs must have been - * previously added by calls to {@link ANeuralNetworksModel_addOperand}. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksModel_addOperation(ANeuralNetworksModel* model, - ANeuralNetworksOperationType type, - uint32_t inputCount, - const uint32_t* inputs, - uint32_t outputCount, - const uint32_t* outputs) { - LOAD_FUNCTION(ANeuralNetworksModel_addOperation); - EXECUTE_FUNCTION_RETURN(model, type, inputCount, inputs, outputCount, - outputs); -} - -/** - * Specifies which operands will be the model's inputs and outputs. - * - * An operand cannot be used for both input and output. Doing so will - * return an error. - * - * @param model The model to be modified. - * @param inputCount The number of entries in the inputs array. - * @param inputs An array of indexes identifying the input operands. - * @param outputCount The number of entries in the outputs array. - * @param outputs An array of indexes identifying the output operands. - * - * The operands specified by inputs and outputs must have been - * previously added by calls to {@link ANeuralNetworksModel_addOperand}. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - */ -inline int ANeuralNetworksModel_identifyInputsAndOutputs( - ANeuralNetworksModel* model, uint32_t inputCount, const uint32_t* inputs, - uint32_t outputCount, const uint32_t* outputs) { - LOAD_FUNCTION(ANeuralNetworksModel_identifyInputsAndOutputs); - EXECUTE_FUNCTION_RETURN(model, inputCount, inputs, outputCount, outputs); -} - -/** - * Specifies whether {@link ANEURALNETWORKS_TENSOR_FLOAT32} is allowed to be - * calculated with range and/or precision as low as that of the IEEE 754 16-bit - * floating-point format. By default, {@link ANEURALNETWORKS_TENSOR_FLOAT32} - * must be calculated using at least the range and precision of the IEEE 754 - * 32-bit floating-point format. - * - * @param model The model to be modified. - * @param allow 'true' indicates {@link ANEURALNETWORKS_TENSOR_FLOAT32} may be - * calculated with range and/or precision as low as that of the - * IEEE 754 16-bit floating point format. 'false' indicates - * {@link ANEURALNETWORKS_TENSOR_FLOAT32} must be calculated using - * at least the range and precision of the IEEE 754 32-bit floating - * point format. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * Available since API level 28. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - */ -inline int ANeuralNetworksModel_relaxComputationFloat32toFloat16( - ANeuralNetworksModel* model, bool allow) { - LOAD_FUNCTION(ANeuralNetworksModel_relaxComputationFloat32toFloat16); - EXECUTE_FUNCTION_RETURN(model, allow); -} - -/** - * Create a {@link ANeuralNetworksCompilation} to compile the given model. - * This only creates the object. Compilation is only performed once - * {@link ANeuralNetworksCompilation_start} is invoked. - * - *

The provided model must outlive the compilation.

- * - * The model must already have been finished by a call to - * {@link ANeuralNetworksModel_finish}. - * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * @param model The {@link ANeuralNetworksModel} to be compiled. - * @param compilation The newly created object or NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA - * if the model is invalid. - */ -inline int ANeuralNetworksCompilation_create( - ANeuralNetworksModel* model, ANeuralNetworksCompilation** compilation) { - LOAD_FUNCTION(ANeuralNetworksCompilation_create); - EXECUTE_FUNCTION_RETURN(model, compilation); -} - -/** - * Destroy a compilation. - * - *

If called on a compilation for which - * {@link ANeuralNetworksCompilation_start} has been called, the - * function will return immediately but will mark the compilation to be deleted - * once the compilation completes. The {@link ANeuralNetworksCompilation_wait} - * will return ERROR_DELETED. - * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * @param compilation The compilation to be destroyed. Passing NULL is - * acceptable and results in no operation. - */ -inline void ANeuralNetworksCompilation_free( - ANeuralNetworksCompilation* compilation) { - LOAD_FUNCTION(ANeuralNetworksCompilation_free); - EXECUTE_FUNCTION(compilation); -} - -/** - * Sets the execution preference. - * - *

Provides guidance to the runtime when trade-offs are possible.

- * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * @param compilation The compilation to be modified. - * @param preference Either {@link PREFER_LOW_POWER}, - * {@link PREFER_SINGLE_FAST_ANSWER}, or - * {@link PREFER_SUSTAINED_SPEED}. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksCompilation_setPreference( - ANeuralNetworksCompilation* compilation, int32_t preference) { - LOAD_FUNCTION(ANeuralNetworksCompilation_setPreference); - EXECUTE_FUNCTION_RETURN(compilation, preference); -} - -/** - * Waits until the compilation completes. - * - * More than one thread can wait on a compilation. When the compilation - * completes, all threads will be released. - * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * @return ANEURALNETWORKS_NO_ERROR if the compilation completed normally. - */ -inline int ANeuralNetworksCompilation_finish( - ANeuralNetworksCompilation* compilation) { - LOAD_FUNCTION(ANeuralNetworksCompilation_finish); - EXECUTE_FUNCTION_RETURN(compilation); -} -/** - * Create a {@link ANeuralNetworksExecution} to apply the given compilation. - * This only creates the object. Computation is only performed once - * {@link ANeuralNetworksExecution_startCompute} is invoked. - * - *

The provided compilation must outlive the execution.

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - * - * @param compilation The {@link ANeuralNetworksCompilation} to be evaluated. - * @param execution The newly created object or NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA - * if the compilation is invalid. - */ -inline int ANeuralNetworksExecution_create( - ANeuralNetworksCompilation* compilation, - ANeuralNetworksExecution** execution) { - LOAD_FUNCTION(ANeuralNetworksExecution_create); - EXECUTE_FUNCTION_RETURN(compilation, execution); -} - -/** - * Destroy an execution. - * - *

If called on an execution for which - * {@link ANeuralNetworksExecution_startCompute} has been called, the - * function will return immediately but will mark the execution to be deleted - * once the computation completes. The {link ANeuralNetworksExecution_wait} - * will return ANEURALNETWORKS_ERROR_DELETED. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - * - * @param execution The execution to be destroyed. Passing NULL is acceptable - * and results in no operation. - */ -inline void ANeuralNetworksExecution_free(ANeuralNetworksExecution* execution) { - LOAD_FUNCTION(ANeuralNetworksExecution_free); - EXECUTE_FUNCTION(execution); -} - -/** - * Associate a user buffer with an input of the model of the - * {@link ANeuralNetworksExecution}. - * - *

The provided buffer must outlive the execution.

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - * - * @param execution The execution to be modified. - * @param index The index of the input argument we are setting. It is - * an index into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is not - * the index associated with {@link - * ANeuralNetworksModel_addOperand}. - * @param type The type of the operand. This should be used to specify the - * dimensions that were set to 0 when the operand was added to the - * model. All other properties of the type must be the same as - * specified in the model. If the type is the same as specified - * when the model was built, NULL can be passed. - * @param buffer The buffer containing the data. - * @param length The length in bytes of the buffer. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if - * the name is not recognized or the buffer is too small for the input. - */ -inline int ANeuralNetworksExecution_setInput( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, const void* buffer, size_t length) { - LOAD_FUNCTION(ANeuralNetworksExecution_setInput); - EXECUTE_FUNCTION_RETURN(execution, index, type, buffer, length); -} - -/** - * Associate part of a memory object with an input of the model of the - * {@link ANeuralNetworksExecution}. - * - *

The provided memory must outlive the execution.

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - * - * @param execution The execution to be modified. - * @param index The index of the input argument we are setting. It is - * an index into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is not - * the index associated with {@link - * ANeuralNetworksModel_addOperand}. - * @param type The type of the operand. This can be used to specify the - * dimensions that were set to 0 when the operand was added to the - * model. All other values must be the same as specified in the - * model. If the type is the same as specified when the model - * was built, NULL can be passed. - * @param memory The memory containing the data. - * @param offset This specifies the location of the data within the memory. - * The offset is in bytes from the start of memory. - * @param length The size in bytes of the data value. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if - * the name is not recognized or the buffer is too small for the input. - */ -inline int ANeuralNetworksExecution_setInputFromMemory( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, const ANeuralNetworksMemory* memory, - size_t offset, size_t length) { - LOAD_FUNCTION(ANeuralNetworksExecution_setInputFromMemory); - EXECUTE_FUNCTION_RETURN(execution, index, type, memory, offset, length); -} - -/** - * Associate a user buffer with an output of the model of the - * {@link ANeuralNetworksExecution}. - * - *

The provided buffer must outlive the execution.

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - * - * @param execution The execution to be modified. - * @param index The index of the output argument we are setting. It is - * an index into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is not - * the index associated with {@link - * ANeuralNetworksModel_addOperand}. - * @param type The type of the operand. This can be used to specify the - * dimensions that were set to 0 when the operand was added to the - * model. All other values must be the same as specified in the - * model. If the type is the same as specified when the model - * was built, NULL can be passed. - * @param buffer The buffer where the data is to be written. - * @param length The length in bytes of the buffer. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if - * the name is not recognized or the buffer is too small for the output. - */ -inline int ANeuralNetworksExecution_setOutput( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, void* buffer, size_t length) { - LOAD_FUNCTION(ANeuralNetworksExecution_setOutput); - EXECUTE_FUNCTION_RETURN(execution, index, type, buffer, length); -} - -/** - * Associate part of a memory object with an output of the model of the - * {@link ANeuralNetworksExecution}. - * - *

The provided memory must outlive the execution.

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - * - * @param execution The execution to be modified. - * @param index The index of the output argument we are setting. It is - * an index into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is not - * the index associated with {@link - * ANeuralNetworksModel_addOperand}. - * @param type The type of the operand. This can be used to specify the - * dimensions that were set to 0 when the operand was added to the - * model. All other values must be the same as specified in the - * model. If the type is the same as specified when the model - * was built, NULL can be passed. - * @param memory The memory where the data is to be stored. - * @param offset This specifies the location of the data within the memory. - * The offset is in bytes from the start of memory. - * @param length The length in bytes of the data value. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if - * the name is not recognized or the buffer is too small for the output. - */ -inline int ANeuralNetworksExecution_setOutputFromMemory( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, const ANeuralNetworksMemory* memory, - size_t offset, size_t length) { - LOAD_FUNCTION(ANeuralNetworksExecution_setOutputFromMemory); - EXECUTE_FUNCTION_RETURN(execution, index, type, memory, offset, length); -} - -/** - * Schedule evaluation of the execution. - * - *

Schedules evaluation of the execution. Once the model has been - * applied and the outputs are ready to be consumed, the execution will be - * signaled. Use {@link ANeuralNetworksExecution_wait} to wait for that signal. - *

- * - * Multiple executions can be scheduled and evaluated concurrently, and - * compilations can be performed concurrently with executions. The runtime makes - * no guarantee on the ordering of the completion of compilations and - * executions. If it's important to the application, the application should - * enforce the ordering by using {@link ANeuralNetworksCompilation_wait} and - * {@link ANeuralNetworksExecution_wait}. - * - * ANeuralNetworksExecution_wait must be called to recuperate the resources used - * by the execution. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - * - * @param execution The execution to be scheduled and executed. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksExecution_startCompute( - ANeuralNetworksExecution* execution, ANeuralNetworksEvent** event) { - LOAD_FUNCTION(ANeuralNetworksExecution_startCompute); - EXECUTE_FUNCTION_RETURN(execution, event); -} - -/** - * Waits until the execution completes. - * - * More than one thread can wait on an event. When the execution completes, - * all threads will be released. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - * - * @return ANEURALNETWORKS_NO_ERROR if the execution completed normally. - */ -inline int ANeuralNetworksEvent_wait(ANeuralNetworksEvent* event) { - LOAD_FUNCTION(ANeuralNetworksEvent_wait); - EXECUTE_FUNCTION_RETURN(event); -} - -/** - * Destroys the event. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - */ -inline void ANeuralNetworksEvent_free(ANeuralNetworksEvent* event) { - LOAD_FUNCTION(ANeuralNetworksEvent_free); - EXECUTE_FUNCTION(event); -} - -/** - * Get the number of available devices. - * - * @param numDevices Used to return the number of devices. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ -inline int ANeuralNetworks_getDeviceCount(uint32_t* numDevices) { - LOAD_FUNCTION(ANeuralNetworks_getDeviceCount); - EXECUTE_FUNCTION_RETURN(numDevices); -} - -/** - * Get the representation of the specified device. - * - * @param devIndex The index of the specified device. Must be less than the - * number of available devices. - * @param device The representation of the specified device. - * The same representation will always be returned for the - * specified device. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ - -inline int ANeuralNetworks_getDevice(uint32_t devIndex, - ANeuralNetworksDevice** device) { - LOAD_FUNCTION(ANeuralNetworks_getDevice); - EXECUTE_FUNCTION_RETURN(devIndex, device); -} - -/** - * Get the name of the specified device. - * - * @param device The representation of the specified device. - * @param name The returned name of the specified device. The name will be in - * UTF-8 and will be null-terminated. It will be recognizable as a - * known device name rather than a cryptic string. For devices - * with API level 29 and above, the format of the name is - * {VENDOR}-{DEVICE}, e.g. “google-ipu”. For devices with feature - * level 28 or lower, the name will always be “unknown-device”. - * The name will remain valid for the duration of the application. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ -inline int ANeuralNetworksDevice_getName(const ANeuralNetworksDevice* device, - const char** name) { - LOAD_FUNCTION(ANeuralNetworksDevice_getName); - EXECUTE_FUNCTION_RETURN(device, name); -} - -/** - * Get the version of the driver implementation of the specified device. - * - * It’s the responsibility of the driver implementor to insure that this version - * string uniquely distinguishes this implementation from all previous - * implementations. - * - * This version string must not be confused with the feature level which is - * solely defined by {@link ANeuralNetworksDevice_getFeatureLevel}. There is no - * implicit ordering of the versions. For example, it is not possible to filter - * all drivers older than a certain version. - * - * Application developers may use this version string to avoid or prefer - * specific driver implementations. For example, an application may want to do - * so because: - * - A specific version of the driver does not provide the required - * performance, perhaps because of a performance regression. - * - A specific version of the driver has a bug or returns results that - * don’t match the minimum precision requirement for the application. - * - * @param device The representation of the specified device. - * @param version The returned version string of the driver for the specified - * device. The string will be in UTF-8 and will be - * null-terminated. For devices with feature level 28 or lower, - * "UNKNOWN" will be returned. The version string will remain - * valid for the duration of the application. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ -inline int ANeuralNetworksDevice_getVersion(const ANeuralNetworksDevice* device, - const char** version) { - LOAD_FUNCTION(ANeuralNetworksDevice_getVersion); - EXECUTE_FUNCTION_RETURN(device, version); -} - -/** - * Get the supported NNAPI version of the specified device. - * - * Each device has a supported feature level, which is the most advanced feature - * this driver implements. For example, if the driver implements the features - * introduced in Android P, but does not implement the features introduced after - * Android P, the value would be 28. Developers could decide whether or not the - * specified device should be used for a Model that has certain feature - * requirements. - * - * @param device The representation of the specified device. - * @param featureLevel The API level of the most advanced feature this driver - * implements. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ -inline int ANeuralNetworksDevice_getFeatureLevel( - const ANeuralNetworksDevice* device, int64_t* featureLevel) { - LOAD_FUNCTION(ANeuralNetworksDevice_getFeatureLevel); - EXECUTE_FUNCTION_RETURN(device, featureLevel); -} - -/** - * Get the supported operations for a specified set of devices. If multiple - * devices are selected, the supported operation list is a union of supported - * operations of all selected devices. - * - * @param model The model to be queried. - * @param devices The set of devices. Must not contain duplicates. - * @param numDevices The number of devices in the set. - * @param supportedOps The boolean array to be filled. True means supported. The - * size of the boolean array must be at least as large as - * the number of operations in the model. The order of - * elements in the supportedOps array matches the order in - * which the corresponding operations were added to the - * model. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ -inline int ANeuralNetworksModel_getSupportedOperationsForDevices( - const ANeuralNetworksModel* model, - const ANeuralNetworksDevice* const* devices, uint32_t numDevices, - bool* supportedOps) { - LOAD_FUNCTION(ANeuralNetworksModel_getSupportedOperationsForDevices); - EXECUTE_FUNCTION_RETURN(model, devices, numDevices, supportedOps); -} - -/** - * Create a {@link ANeuralNetworksCompilation} to compile the given model for a - * specified set of devices. If more than one device is specified, the - * compilation will distribute the workload automatically across the devices. - * The model must be fully supported by the specified set of devices. This means - * that ANeuralNetworksModel_getSupportedOperationsForDevices() must have - * returned true for every operation for that model/devices pair. - * - * @param model The {@link ANeuralNetworksModel} to be compiled. - * @param devices The set of devices. Must not contain duplicates. - * @param numDevices The number of devices in the set. - * @param compilation The newly created object or NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA - * if the model is invalid. - * - * Available since API level 29. - */ -inline int ANeuralNetworksCompilation_createForDevices( - ANeuralNetworksModel* model, const ANeuralNetworksDevice* const* devices, - uint32_t numDevices, ANeuralNetworksCompilation** compilation) { - LOAD_FUNCTION(ANeuralNetworksCompilation_createForDevices); - EXECUTE_FUNCTION_RETURN(model, devices, numDevices, compilation); -} - -/** - * Sets the compilation caching signature and the cache directory. - * - * Provides optional caching information to the runtime for faster repeated - * compilation. - * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * @param compilation The compilation to be modified. - * @param cacheDir The cache directory to store and retrieve caching data. It is - * recommended to use the code_cache provided by the Android - * runtime. If not using the code_cache, the user should choose - * a directory local to the application, and is responsible to - * manage and clean the cache entries. - * @param token The token provided by the user to specify a model, must be of - * length ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN. The user should - * ensure that the token is unique to a model within the - * application. The NNAPI runtime will not detected token - * collisions. If there is a collision, the compilation outcome may - * be incorrect without notifying with error. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ -inline int ANeuralNetworksCompilation_setCaching( - ANeuralNetworksCompilation* compilation, const char* cacheDir, - const uint8_t* token) { - LOAD_FUNCTION(ANeuralNetworksCompilation_setCaching); - EXECUTE_FUNCTION_RETURN(compilation, cacheDir, token); -} - -/** - * Schedule synchronous evaluation of the execution. - * - *

Schedules synchronous evaluation of the execution. Returns once the - * execution has completed and the outputs are ready to be consumed. - *

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - * - * See {@link ANeuralNetworksExecution_startCompute} for asynchronous execution. - * Synchronous execution incurs lower overhead than asynchronous execution. - * - * Available since API level 29. - * - * @param execution The execution to be scheduled and executed. - * - * @return ANEURALNETWORKS_NO_ERROR if the execution completed normally. - * ANEURALNETWORKS_UNMAPPABLE if the execution input or output memory - * cannot be properly mapped. - */ -inline int ANeuralNetworksExecution_compute( - ANeuralNetworksExecution* execution) { - LOAD_FUNCTION(ANeuralNetworksExecution_compute); - EXECUTE_FUNCTION_RETURN(execution); -} - -/** - * Get the dimensional information of the specified output operand of the model - * of the - * {@link ANeuralNetworksExecution}. - * - * On asynchronous execution initiated by {@link - * ANeuralNetworksExecution_startCompute}, - * {@link ANeuralNetworksEvent_wait} must be called prior to this function to - * recuperate the resources used by the execution. - * - * @param execution The execution to be queried. - * @param index The index of the output argument we are querying. It is - * an index into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is not - * the index associated with {@link - * ANeuralNetworksModel_addOperand}. - * @param rank The rank of the output operand. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, - * ANEURALNETWORKS_OUTPUT_INSUFFICIENT_SIZE if the target output is provided an - * insufficient buffer at execution time, ANEURALNETWORKS_BAD_DATA if the index - * is invalid. - * - * Available since API level 29. - */ -inline int ANeuralNetworksExecution_getOutputOperandRank( - ANeuralNetworksExecution* execution, int32_t index, uint32_t* rank) { - LOAD_FUNCTION(ANeuralNetworksExecution_getOutputOperandRank); - EXECUTE_FUNCTION_RETURN(execution, index, rank); -} - -/** - * Get the dimensional information of the specified output operand of the model - * of the - * {@link ANeuralNetworksExecution}. The target output operand cannot be a - * scalar. - * - * On asynchronous execution initiated by - * {@link ANeuralNetworksExecution_startCompute}, - * {@link ANeuralNetworksEvent_wait} must be called prior to this function to - * recuperate the resources used by the execution. - * - * @param execution The execution to be queried. - * @param index The index of the output argument we are querying. It is an index - * into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is not - * the index associated with - * {@link ANeuralNetworksModel_addOperand}. - * @param dimensions The dimension array to be filled. The size of the array - * must be exactly as large as the rank of the output operand - * to be queried in the model. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, - * ANEURALNETWORKS_OUTPUT_INSUFFICIENT_SIZE if the target output is provided an - * insufficient buffer at execution time, ANEURALNETWORKS_BAD_DATA if the index - * is invalid or if the target is a scalar. - * - * Available since API level 29. - */ -inline int ANeuralNetworksExecution_getOutputOperandDimensions( - ANeuralNetworksExecution* execution, int32_t index, uint32_t* dimensions) { - LOAD_FUNCTION(ANeuralNetworksExecution_getOutputOperandDimensions); - EXECUTE_FUNCTION_RETURN(execution, index, dimensions); -} - -/** - * Create a {@link ANeuralNetworksBurst} to apply the given compilation. - * This only creates the burst object. Computation is only performed once - * {@link ANeuralNetworksExecution_burstCompute} is invoked with a valid - * {@link ANeuralNetworksExecution} and {@link ANeuralNetworksBurst}. - * - *

The provided compilation must outlive the burst object.

- * - * Available since API level 29. - * - * @param compilation The {@link ANeuralNetworksCompilation} to be evaluated. - * @param burst The newly created object or NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA - * if the compilation is invalid. - */ -inline int ANeuralNetworksBurst_create(ANeuralNetworksCompilation* compilation, - ANeuralNetworksBurst** burst) { - LOAD_FUNCTION(ANeuralNetworksBurst_create); - EXECUTE_FUNCTION_RETURN(compilation, burst); -} - -/** - * Destroys the burst object. - * - * Available since API level 29. - * - * @param burst The burst object to be destroyed. Passing NULL is acceptable and - * results in no operation. - */ -inline void ANeuralNetworksBurst_free(ANeuralNetworksBurst* burst) { - LOAD_FUNCTION(ANeuralNetworksBurst_free); - EXECUTE_FUNCTION(burst); -} - -/** - * Schedule synchronous evaluation of the execution on a burst object. - * - *

Schedules synchronous evaluation of the execution. Returns once the - * execution has completed and the outputs are ready to be consumed.

- * - *

There must be at most one {@link ANeuralNetworksExecution} processing at - * any given time for any given burst object. Any - * {@link ANeuralNetworksExecution} launched before the previous has finished - * will result in ANEURALNETWORKS_BAD_STATE.

- * - * Available since API level 29. - * - * @param burst The burst object to execute on. - * @param execution The execution to be scheduled and executed. The execution - * must be created from the same {@link - * ANeuralNetworksCompilation} as the burst object. - * - * @return ANEURALNETWORKS_NO_ERROR if the execution completed normally. - */ -inline int ANeuralNetworksExecution_burstCompute( - ANeuralNetworksExecution* execution, ANeuralNetworksBurst* burst) { - LOAD_FUNCTION(ANeuralNetworksExecution_burstCompute); - EXECUTE_FUNCTION_RETURN(execution, burst); -} - -/** - * Creates a shared memory object from an AHardwareBuffer handle. - * - * If the shared memory is backed by an AHardwareBuffer of - * AHARDWAREBUFFER_FORMAT_BLOB format, it can be used the same way as shared - * memory created from a file handle. See - * {@link ANeuralNetworksMemory} for a description on how to use this shared - * memory. - * - * If the shared memory is backed by an AHardwareBuffer of a format other than - * AHARDWAREBUFFER_FORMAT_BLOB, it can only be used for Model inputs and - * outputs. When calling {@link ANeuralNetworksExecution_setInputFromMemory} or - * {@link ANeuralNetworksExecution_setOutputFromMemory} with the shared memory, - * both offset and length must be set to zero and the entire memory region will - * be associated with the specified input or output operand. There is no - * guarantee that an arbitrary AHardwareBuffer_Format and - * AHardwareBuffer_UsageFlags combination can be used by arbitrary devices. The - * execution will fail if selected set of devices cannot consume the buffer. - * - * Calling {@link ANeuralNetworksModel_setOperandValueFromMemory} with shared - * memory backed by an AHardwareBuffer of a format other than - * AHARDWAREBUFFER_FORMAT_BLOB is disallowed. - * - * TODO(miaowang): add documentation about intended usage with introspection - * API. - * - * Available since API level 29. - * - * @param ahwb The AHardwareBuffer handle. - * @param memory The memory object to be created. - * Set to NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if the request completed normally. - * - * @see AHardwareBuffer - */ -inline int ANeuralNetworksMemory_createFromAHardwareBuffer( - const AHardwareBuffer* ahwb, ANeuralNetworksMemory** memory) { - LOAD_FUNCTION(ANeuralNetworksMemory_createFromAHardwareBuffer); - EXECUTE_FUNCTION_RETURN(ahwb, memory); -} - -/** - * Specifies whether duration of the {@link ANeuralNetworksExecution} is to be - * measured. By default, duration is not measured. - * - * The {@link ANeuralNetworksExecution} must have been created with - * {@link ANeuralNetworksCompilation_createForDevices} with numDevices = 1. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - * - * Available since API level 29. - * - * @param execution The execution to be modified. - * @param measure 'true' if duration is to be measured, 'false' if not. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksExecution_setMeasureTiming( - ANeuralNetworksExecution* execution, bool measure) { - LOAD_FUNCTION(ANeuralNetworksExecution_setMeasureTiming); - EXECUTE_FUNCTION_RETURN(execution, measure); -} - -/** - * Get the time spent in the specified {@link ANeuralNetworksExecution}, in - * nanoseconds. The execution must have completed. - * - * @param execution The execution to be queried. - * @param durationCode The measurement to be queried, specified by {@link - * DurationCode}. - * @param duration The returned duration. If no measurement was requested by - * {@link ANeuralNetworksExecution_setMeasureTiming}, or for - * some other reason the duration is not available, UINT64_MAX will be returned. - * A particular device need not support any given measurement. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksExecution_getDuration( - const ANeuralNetworksExecution* execution, int32_t durationCode, - uint64_t* duration) { - LOAD_FUNCTION(ANeuralNetworksExecution_getDuration); - EXECUTE_FUNCTION_RETURN(execution, durationCode, duration); -} - -/** - * Queries whether an extension is supported by the driver implementation of - * the specified device. - * - * @param device The representation of the specified device. - * @param extension The extension name. - * @param isExtensionSupported The boolean value indicating whether the - * extension is supported. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ -inline int ANeuralNetworksDevice_getExtensionSupport( - const ANeuralNetworksDevice* device, const char* extensionName, - bool* isExtensionSupported) { - LOAD_FUNCTION(ANeuralNetworksDevice_getExtensionSupport); - EXECUTE_FUNCTION_RETURN(device, extensionName, isExtensionSupported); -} - -/** - * Creates an operand type from an extension name and an extension operand code. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * Available since API level 29. - * - * @param model The model to contain the operand. - * @param extensionName The extension name. - * @param operandCodeWithinExtension The extension operand code. - * @param type The operand type. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksModel_getExtensionOperandType( - ANeuralNetworksModel* model, const char* extensionName, - uint16_t operandCodeWithinExtension, int32_t* type) { - LOAD_FUNCTION(ANeuralNetworksModel_getExtensionOperandType); - EXECUTE_FUNCTION_RETURN(model, extensionName, operandCodeWithinExtension, - type); -} - -/** - * Creates an operation type from an extension name and an extension operation - * code. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * Available since API level 29. - * - * @param model The model to contain the operation. - * @param extensionName The extension name. - * @param operationCodeWithinExtension The extension operation code. - * @param type The operation type. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksModel_getExtensionOperationType( - ANeuralNetworksModel* model, const char* extensionName, - uint16_t operationCodeWithinExtension, ANeuralNetworksOperationType* type) { - LOAD_FUNCTION(ANeuralNetworksModel_getExtensionOperationType); - EXECUTE_FUNCTION_RETURN(model, extensionName, operationCodeWithinExtension, - type); -} - -/** - * Sets extension operand parameters. - * - * Available since API level 29. - * - * @param model The model to be modified. - * @param index The index of the model operand we're setting. - * @param data A pointer to the extension operand data. - * The data does not have to outlive the call to this function. - * @param length The size in bytes of the data value. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksModel_setOperandExtensionData( - ANeuralNetworksModel* model, int32_t index, const void* data, - size_t length) { - LOAD_FUNCTION(ANeuralNetworksModel_setOperandExtensionData); - EXECUTE_FUNCTION_RETURN(model, index, data, length); -} - -/** - * Create a {@link ANeuralNetworksMemoryDesc} with no properties. - * - * This only creates the memory descriptor. Its properties should be set with - * calls to - * {@link ANeuralNetworksMemoryDesc_addInputRole}, - * {@link ANeuralNetworksMemoryDesc_addOutputRole}, and - * {@link ANeuralNetworksMemoryDesc_setDimensions}. - * - * {@link ANeuralNetworksMemoryDesc_finish} must be called once all properties - * have been set. - * - * {@link ANeuralNetworksMemoryDesc_free} must be called once the memory - * descriptor is no longer needed. - * - * Available since API level 30. - * - * @param desc The {@link ANeuralNetworksMemoryDesc} to be created. - * Set to NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksMemoryDesc_create(ANeuralNetworksMemoryDesc** desc) { - LOAD_FUNCTION(ANeuralNetworksMemoryDesc_create); - EXECUTE_FUNCTION_RETURN(desc); -} - -/** - * Destroy a memory descriptor. - * - * The memory descriptor need not have been finished by a call to - * {@link ANeuralNetworksMemoryDesc_finish}. - * - * See {@link ANeuralNetworksMemoryDesc} for information on multithreaded usage. - * - * Available since API level 30. - * - * @param desc The memory descriptor to be destroyed. Passing NULL is acceptable - * and results in no operation. - */ -inline void ANeuralNetworksMemoryDesc_free(ANeuralNetworksMemoryDesc* desc) { - LOAD_FUNCTION(ANeuralNetworksMemoryDesc_free); - EXECUTE_FUNCTION(desc); -} - -/** - * Specify that a memory object will be playing the role of an output to an - * execution created from a particular compilation. - * - * The compilation and the output index fully specify an output operand. This - * function may be invoked multiple times on the same memory descriptor with - * different output operands, and the same output operand may be specified on - * multiple memory descriptors. However, specifying the same output operand on - * the same memory descriptor object more than once will return an error. - * - * The dimensions of the corresponding model operands of all the roles specified - * by - * {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole} must be compatible with each - * other. Two dimensions are incompatible if both ranks are fully specified but - * have different values, or if there is at least one axis that is fully - * specified in both but has different values. - * - * At least one of {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole} must be called on the memory - * descriptor before invoking {@link ANeuralNetworksMemoryDesc_finish}. - * - * Attempting to modify a memory descriptor once - * {@link ANeuralNetworksMemoryDesc_finish} has been called will return an - * error. - * - * See {@link ANeuralNetworksMemoryDesc} for information on multithreaded usage. - * - * Available since API level 30. - * - * @param desc The memory descriptor to be modified. - * @param compilation The compilation object. It must already have been finished - * by calling {@link ANeuralNetworksCompilation_finish}, and must outlive the - * memory descriptor. - * @param index The index of the output argument we are referencing from the - * compilation. It is an index into the outputs list passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is not - * the index associated with {@link - * ANeuralNetworksModel_addOperand}. - * @param frequency A floating-point value within the range (0.0, 1.0]. - * Describes how likely the memory is to be used in the specified role. This is - * provided as a hint to optimize the case when multiple roles - * prefer different memory locations or data layouts. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksMemoryDesc_addOutputRole( - ANeuralNetworksMemoryDesc* desc, - const ANeuralNetworksCompilation* compilation, int32_t index, - float frequency) { - LOAD_FUNCTION(ANeuralNetworksMemoryDesc_addOutputRole); - EXECUTE_FUNCTION_RETURN(desc, compilation, index, frequency); -} - -/** - * Specify that a memory object will be playing the role of an input to an - * execution created from a particular compilation. - * - * The compilation and the input index fully specify an input operand. This - * function may be invoked multiple times on the same memory descriptor with - * different input operands, and the same input operand may be specified on - * multiple memory descriptors. However, specifying the same input operand on - * the same memory descriptor more than once will return an error. - * - * The dimensions of the corresponding model operands of all the roles specified - * by - * {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole} must be compatible with each - * other. Two dimensions are incompatible if both ranks are fully specified but - * have different values, or if there is at least one axis that is fully - * specified in both but has different values. - * - * At least one of {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole} must be called on a memory - * descriptor before invoking {@link ANeuralNetworksMemoryDesc_finish}. - * - * Attempting to modify a memory descriptor once - * {@link ANeuralNetworksMemoryDesc_finish} has been called will return an - * error. - * - * See {@link ANeuralNetworksMemoryDesc} for information on multithreaded usage. - * - * Available since API level 30. - * - * @param desc The memory descriptor to be modified. - * @param compilation The compilation object. It must already have been finished - * by calling {@link ANeuralNetworksCompilation_finish}, and must outlive the - * memory descriptor. - * @param index The index of the input argument we are referencing from the - * compilation. It is an index into the inputs list passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is not - * the index associated with {@link - * ANeuralNetworksModel_addOperand}. - * @param frequency A floating-point value within the range (0.0, 1.0]. - * Describes how likely the memory is to be used in the specified role. This is - * provided as a hint to optimize the case when different roles - * prefer different memory locations or data layouts. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksMemoryDesc_addInputRole( - ANeuralNetworksMemoryDesc* desc, - const ANeuralNetworksCompilation* compilation, uint32_t index, - float frequency) { - LOAD_FUNCTION(ANeuralNetworksMemoryDesc_addInputRole); - EXECUTE_FUNCTION_RETURN(desc, compilation, index, frequency); -} - -/** - * Set the dimensional information of the memory descriptor. - * - * The specified dimensions must be compatible with the dimensions of the - * corresponding model operands of all the roles specified by - * {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole}. Two dimensions are - * incompatible if both ranks are fully specified but have different values, or - * if there is at least one axis that is fully specified in both but has - * different values. - * - * Attempting to modify a memory descriptor once - * {@link ANeuralNetworksMemoryDesc_finish} has been called will return an - * error. - * - * See {@link ANeuralNetworksMemoryDesc} for information on multithreaded usage. - * - * Available since API level 30. - * - * @param desc The memory descriptor to be modified. - * @param rank The number of dimensions. Must be 0 for scalars. - * @param dimensions An array of dimensions. An entry with the value 0 indicates - * that the corresponding axis has an unknown size. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksMemoryDesc_setDimensions( - ANeuralNetworksMemoryDesc* desc, uint32_t rank, - const uint32_t* dimensions) { - LOAD_FUNCTION(ANeuralNetworksMemoryDesc_setDimensions); - EXECUTE_FUNCTION_RETURN(desc, rank, dimensions); -} - -/** - * Indicate that we have finished modifying a memory descriptor. Required before - * calling - * {@link ANeuralNetworksMemory_createFromDesc}. - * - * This function must only be called once for a given memory descriptor. - * - * See {@link ANeuralNetworksMemoryDesc} for information on multithreaded usage. - * - * Available since API level 30. - * - * @param desc The memory descriptor to be finished. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksMemoryDesc_finish(ANeuralNetworksMemoryDesc* desc) { - LOAD_FUNCTION(ANeuralNetworksMemoryDesc_finish); - EXECUTE_FUNCTION_RETURN(desc); -} - -/** - * Creates a memory object from a memory descriptor. - * - * The memory object is created with an uninitialized buffer. A memory object - * with an uninitialized buffer may only be used according to the roles - * specified by - * {@link ANeuralNetworksMemoryDesc_addOutputRole}, or as the destination memory - * in - * {@link ANeuralNetworksMemory_copy}. The buffer of a memory object is - * initialized after the memory object is used as an output in a successful - * execution, or used as the destination memory in a successful {@link - * ANeuralNetworksMemory_copy}. A memory object with an initialized buffer may - * be used according to all roles specified in - * {@link ANeuralNetworksMemoryDesc}, or as the source or destination memory in - * {@link ANeuralNetworksMemory_copy}. The buffer of a memory object will return - * to the uninitialized state if the memory object is used as an output in a - * failed execution, or used as the destination memory in a failed {@link - * ANeuralNetworksMemory_copy}. - * - * The dimensions of the memory descriptor are deduced from the dimensions of - * the corresponding model operands of all the roles specified by - * {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole}, as well as the dimensions - * set by the call to {@link ANeuralNetworksMemoryDesc_setDimensions}, if any. - * The memory descriptor may have unspecified dimensions or rank. In such a - * case, the same memory object may be used with different shapes of outputs in - * different executions. When the memory is used as an input, the input shape - * must be the same as the output shape from the last execution using this - * memory object as an output, or the last - * {@link ANeuralNetworkMemory_copy} using this memory object as the destination - * memory. Creating a memory object with unspecified dimensions or rank may fail - * for certain sets of roles. - * - * Using the memory in roles or shapes that are not compatible with the rules - * specified above will return an error. - * - * When calling {@link ANeuralNetworksExecution_setInputFromMemory} or - * {@link ANeuralNetworksExecution_setOutputFromMemory} with the memory object, - * both offset and length must be set to zero and the entire memory region will - * be associated with the specified input or output operand. - * - * Calling {@link ANeuralNetworksModel_setOperandValueFromMemory} with the - * memory created from this function will return an error. - * - * {@link ANeuralNetworksMemory_free} must be called once the memory is no - * longer needed. - * - * Attempting to create memory from an unfinished memory descriptor will return - * an error. - * - * The provided {@link ANeuralNetworksMemoryDesc} need not outlive the - * {@link ANeuralNetworksMemory} object. - * - * Available since API level 30. - * - * @param desc The memory descriptor. - * @param memory The memory object to be created. - * Set to NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful; ANEURALNETWORKS_OP_FAILED if - * the memory is created with unspecified dimensions or rank and it is not - * supported for this set of roles. - */ -inline int ANeuralNetworksMemory_createFromDesc( - const ANeuralNetworksMemoryDesc* desc, ANeuralNetworksMemory** memory) { - LOAD_FUNCTION(ANeuralNetworksMemory_createFromDesc); - EXECUTE_FUNCTION_RETURN(desc, memory); -} - -/** - * Copies data from one memory object to another. - * - * If at most one of the src and dst is created from - * {@link ANeuralNetworksMemory_createFromDesc}, the src and dst must have the - * same logical size: - * - If the memory is created from {@link ANeuralNetworksMemory_createFromFd}, - * or if it is created from {@link - * ANeuralNetworksMemory_createFromAHardwareBuffer} with format of - * AHARDWAREBUFFER_FORMAT_BLOB, the logical size equals the size of the memory. - * - If the memory is created from - * {@link ANeuralNetworksMemory_createFromAHardwareBuffer} with a format other - * than AHARDWAREBUFFER_FORMAT_BLOB, the logical size equals the size when there - * is no padding and the data is tightly packed. This function may fail if the - * AHardwareBuffer cannot be accessed. - * - If the memory is created from {@link ANeuralNetworksMemory_createFromDesc}, - * the logical size equals the size indicated by the {@link OperandCode} - * multiplied by the number of elements. This function will fail if the number - * of elements is unknown. - * - * If both src and dst are created from {@link - * ANeuralNetworksMemory_createFromDesc}, they must have compatible dimensions. - * Two dimensions are incompatible if both ranks are fully specified but have - * different values, or if there is at least one axis that is fully specified in - * both but has different values. The dst may have unspecified dimensions or - * rank. In such a case, the dimensions of dst will get updated according to the - * dimensions of the src. - * - * In both cases, if the src is created from - * {@link ANeuralNetworksMemory_createFromDesc}, it must have been used as an - * output in a successful execution, or used as the destination memory in a - * successful - * {@link ANeuralNetworksMemory_copy}. - * - * The src and dst may have different data layout, in which case the data - * copying is performed logically with data layout transformation. - * - * Available since API level 30. - * - * @param src The source memory object. - * @param dst The destination memory object. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ -inline int ANeuralNetworksMemory_copy(const ANeuralNetworksMemory* src, - const ANeuralNetworksMemory* dst) { - LOAD_FUNCTION(ANeuralNetworksMemory_copy); - EXECUTE_FUNCTION_RETURN(src, dst); -} - -/** - * Create a {@link ANeuralNetworksEvent} from a sync_fence file descriptor. - * - * The newly created ANeuralNetworksEvent does not take ownership of the - * provided sync_fence_fd, it will instead dup the provided sync_fence_fd and - * own the duplicate. - * - * @param sync_fence_fd The sync_fence file descriptor. - * @param event The newly created object or NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 30. - */ -inline int ANeuralNetworksEvent_createFromSyncFenceFd( - int sync_fence_fd, ANeuralNetworksEvent** event) { - LOAD_FUNCTION(ANeuralNetworksEvent_createFromSyncFenceFd); - EXECUTE_FUNCTION_RETURN(sync_fence_fd, event); -} - -/** - * Get sync_fence file descriptor from the event. - * - * If the ANeuralNetworksEvent is not backed by a sync fence, the sync_fence_fd - * will be set to -1, and ANEURALNETWORKS_BAD_DATA will be returned. - * - * See {@link ANeuralNetworksEvent_createFromSyncFenceFd} and - * {@link ANeuralNetworksExecution_startComputeWithDependencies} to see how to - * create an event backed by a sync fence. - * - * The user takes ownership of the returned fd, and must close the returned file - * descriptor when it is no longer needed. - * - * @param event An event that is backed by a sync fence. - * @param sync_fence_fd The sync_fence file descriptor. The file descriptor will - * be set to -1 if there is an error. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 30. - */ -inline int ANeuralNetworksEvent_getSyncFenceFd( - const ANeuralNetworksEvent* event, int* sync_fence_fd) { - LOAD_FUNCTION(ANeuralNetworksEvent_getSyncFenceFd); - EXECUTE_FUNCTION_RETURN(event, sync_fence_fd); -} - -/** - * Schedule asynchronous evaluation of the execution with dependencies. - * - * The execution will wait for all the depending events to be signaled before - * starting the evaluation. Once the execution has completed and the outputs - * are ready to be consumed, the returned event will be signaled. Depending on - * which devices are handling the execution, the event could be backed by a sync - * fence. Use {@link ANeuralNetworksEvent_wait} to wait for that event. - * - * ANeuralNetworksEvent_wait must be called to recurperate the resources used - * by the execution. - * - * If parts of the execution are scheduled on devices that do not support fenced - * execution, the function call may wait for such parts to finish before - * returning. - * - * The function will return an error if any of the events in dependencies is - * already in a bad state. After the execution is scheduled, if any of the - * events in dependencies does not complete normally, the execution will fail, - * and {@link ANeuralNetworksEvent_wait} on the returned event will return an - * error. - * - * The function will return an error if any of the execution outputs has a - * tensor operand type that is not fully specified. - * - * The function can be passed a timeout duration in nanoseconds. This timeout - * duration acts as a hint to drivers in the same way that the timeout durations - * in {@link ANeuralNetworksCompilation_setTimeout} and {@link - * ANeuralNetworksExecution_setTimeout} act as hints to drivers. The duration - * begins when all waitFor sync fences have been signaled, and can be used - * together with {@link ANeuralNetworksExecution_setTimeout} which specifies the - * maximum timeout duration beginning at the call to - * {@link ANeuralNetworksExecution_startComputeWithDependencies}. - * If the duration is non-zero, the {@link ANeuralNetworksExecution} must have - * been created from an {@link ANeuralNetworksCompilation} which in turn was - * created from - * {@link ANeuralNetworksCompilation_createForDevices} with numDevices = 1, - * otherwise this function will fail with ANEURALNETWORKS_BAD_DATA. If either - * the timeout duration from {@link ANeuralNetworksExecution_setTimeout} or the - * timeout duration passed to this call is exceeded, the execution may be - * aborted, in which case {@link ANEURALNETWORKS_MISSED_DEADLINE_*} will be - * returned through {@link - * ANeuralNetworksExecution_startComputeWithDependencies} or {@link - * ANeuralNetworksEvent_wait} on the event object. If the device has a feature - * level reported by {@link ANeuralNetworksDevice_getFeatureLevel} that is lower - * than 30, then the timeout duration hints will be ignored. - * - * If this execution contains a {@link ANEURALNETWORKS_WHILE} operation, and - * the condition model does not output false within the loop timeout duration, - * then execution will be aborted and {@link ANEURALNETWORKS_MISSED_DEADLINE_*} - * will be returned through {@link ANeuralNetworksEvent_wait} on the event - * object. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded usage. - * - * See {@link ANeuralNetworksExecution_compute} for synchronous execution. - * See {@link ANeuralNetworksExecution_burstCompute} for burst synchronous - * execution. See {@link ANeuralNetworksExecution_startCompute} for regular - * asynchronous execution. - * - * @param execution The execution to be scheduled and executed. - * @param dependencies A set of depending events. The actual evaluation will not - * start until all the events are signaled. - * @param num_dependencies The number of events in the dependencies set. - * @param duration The maximum amount of time in nanoseconds that is expected to - * be spent executing the model after all dependencies are - * signaled. If set to 0, the timeout duration is considered - * infinite. - * @param event The event that will be signaled on completion. event is set to - * NULL if there's an error. - * - * @return ANEURALNETWORKS_NO_ERROR if the evaluation is successfully scheduled. - * - * Available since API level 30. - */ -inline int ANeuralNetworksExecution_startComputeWithDependencies( - ANeuralNetworksExecution* execution, - const ANeuralNetworksEvent* const* dependencies, uint32_t num_dependencies, - uint64_t duration, ANeuralNetworksEvent** event) { - LOAD_FUNCTION(ANeuralNetworksExecution_startComputeWithDependencies); - EXECUTE_FUNCTION_RETURN(execution, dependencies, num_dependencies, duration, - event); -} - -#endif // TENSORFLOW_LITE_NNAPI_NEURALNETWORKSSHIM_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/NeuralNetworksTypes.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/NeuralNetworksTypes.h deleted file mode 100644 index 4c21e69..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/NeuralNetworksTypes.h +++ /dev/null @@ -1,711 +0,0 @@ -/* Copyright 2017 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_NNAPI_NEURALNETWORKSTYPES_H_ -#define TENSORFLOW_LITE_NNAPI_NEURALNETWORKSTYPES_H_ - -#include -#include - -#include - -typedef struct AHardwareBuffer AHardwareBuffer; - -// NN api types based on NNAPI header file -// https://developer.android.com/ndk/reference/group/neural-networks - -/** - * Operand types. - * - * The type of operands that can be added to a model. - * - * Although we define many types, most operators accept just a few - * types. Most used are ANEURALNETWORKS_TENSOR_FLOAT32, - * ANEURALNETWORKS_TENSOR_QUANT8_ASYMM, and ANEURALNETWORKS_INT32. - */ -enum { - ANEURALNETWORKS_FLOAT32 = 0, - ANEURALNETWORKS_INT32 = 1, - ANEURALNETWORKS_UINT32 = 2, - ANEURALNETWORKS_TENSOR_FLOAT32 = 3, - ANEURALNETWORKS_TENSOR_INT32 = 4, - ANEURALNETWORKS_TENSOR_QUANT8_ASYMM = 5, - ANEURALNETWORKS_BOOL = 6, - ANEURALNETWORKS_TENSOR_BOOL8 = 9, - ANEURALNETWORKS_TENSOR_QUANT16_SYMM = 7, - ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL = 11, - ANEURALNETWORKS_TENSOR_QUANT8_SYMM = 13, - ANEURALNETWORKS_TENSOR_QUANT8_ASYMM_SIGNED = 14, -}; - -/** - * Operation types. - * - * The type of operations that can be added to a model. - */ -enum { - ANEURALNETWORKS_ADD = 0, - ANEURALNETWORKS_AVERAGE_POOL_2D = 1, - ANEURALNETWORKS_CONCATENATION = 2, - ANEURALNETWORKS_CONV_2D = 3, - ANEURALNETWORKS_DEPTHWISE_CONV_2D = 4, - ANEURALNETWORKS_DEPTH_TO_SPACE = 5, - ANEURALNETWORKS_DEQUANTIZE = 6, - ANEURALNETWORKS_EMBEDDING_LOOKUP = 7, - ANEURALNETWORKS_FLOOR = 8, - ANEURALNETWORKS_FULLY_CONNECTED = 9, - ANEURALNETWORKS_HASHTABLE_LOOKUP = 10, - ANEURALNETWORKS_L2_NORMALIZATION = 11, - ANEURALNETWORKS_L2_POOL_2D = 12, - ANEURALNETWORKS_LOCAL_RESPONSE_NORMALIZATION = 13, - ANEURALNETWORKS_LOGISTIC = 14, - ANEURALNETWORKS_LSH_PROJECTION = 15, - ANEURALNETWORKS_LSTM = 16, - ANEURALNETWORKS_MAX_POOL_2D = 17, - ANEURALNETWORKS_MUL = 18, - ANEURALNETWORKS_RELU = 19, - ANEURALNETWORKS_RELU1 = 20, - ANEURALNETWORKS_RELU6 = 21, - ANEURALNETWORKS_RESHAPE = 22, - ANEURALNETWORKS_RESIZE_BILINEAR = 23, - ANEURALNETWORKS_RNN = 24, - ANEURALNETWORKS_SOFTMAX = 25, - ANEURALNETWORKS_SPACE_TO_DEPTH = 26, - ANEURALNETWORKS_SVDF = 27, - ANEURALNETWORKS_TANH = 28, - ANEURALNETWORKS_BATCH_TO_SPACE_ND = 29, - ANEURALNETWORKS_DIV = 30, - ANEURALNETWORKS_MEAN = 31, - ANEURALNETWORKS_PAD = 32, - ANEURALNETWORKS_SPACE_TO_BATCH_ND = 33, - ANEURALNETWORKS_SQUEEZE = 34, - ANEURALNETWORKS_STRIDED_SLICE = 35, - ANEURALNETWORKS_SUB = 36, - ANEURALNETWORKS_TRANSPOSE = 37, - ANEURALNETWORKS_ABS = 38, - ANEURALNETWORKS_ARGMAX = 39, - ANEURALNETWORKS_ARGMIN = 40, - ANEURALNETWORKS_BIDIRECTIONAL_SEQUENCE_LSTM = 42, - ANEURALNETWORKS_CAST = 45, - ANEURALNETWORKS_EQUAL = 48, - ANEURALNETWORKS_EXP = 49, - ANEURALNETWORKS_EXPAND_DIMS = 50, - ANEURALNETWORKS_GATHER = 51, - ANEURALNETWORKS_GREATER = 53, - ANEURALNETWORKS_GREATER_EQUAL = 54, - ANEURALNETWORKS_LESS = 58, - ANEURALNETWORKS_LESS_EQUAL = 59, - ANEURALNETWORKS_LOG = 60, - ANEURALNETWORKS_LOGICAL_AND = 61, - ANEURALNETWORKS_LOGICAL_NOT = 62, - ANEURALNETWORKS_LOGICAL_OR = 63, - ANEURALNETWORKS_LOG_SOFTMAX = 64, - ANEURALNETWORKS_MAXIMUM = 65, - ANEURALNETWORKS_MINIMUM = 66, - ANEURALNETWORKS_NEG = 67, - ANEURALNETWORKS_NOT_EQUAL = 68, - ANEURALNETWORKS_PAD_V2 = 69, - ANEURALNETWORKS_POW = 70, - ANEURALNETWORKS_PRELU = 71, - ANEURALNETWORKS_QUANTIZE = 72, - ANEURALNETWORKS_QUANTIZED_16BIT_LSTM = 73, - ANEURALNETWORKS_REDUCE_ANY = 76, - ANEURALNETWORKS_REDUCE_MAX = 77, - ANEURALNETWORKS_REDUCE_MIN = 78, - ANEURALNETWORKS_REDUCE_PROD = 79, - ANEURALNETWORKS_REDUCE_SUM = 80, - ANEURALNETWORKS_RSQRT = 83, - ANEURALNETWORKS_SELECT = 84, - ANEURALNETWORKS_SIN = 85, - ANEURALNETWORKS_SLICE = 86, - ANEURALNETWORKS_SPLIT = 87, - ANEURALNETWORKS_SQRT = 88, - ANEURALNETWORKS_TILE = 89, - ANEURALNETWORKS_TOPK_V2 = 90, - ANEURALNETWORKS_TRANSPOSE_CONV = 91, - ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_LSTM = 92, - ANEURALNETWORKS_UNIDIRECTIONAL_SEQUENCE_RNN = 93, - ANEURALNETWORKS_RESIZE_NEAREST_NEIGHBOR = 94, - ANEURALNETWORKS_QUANTIZED_LSTM = 95, - ANEURALNETWORKS_IF = 96, - ANEURALNETWORKS_WHILE = 97, - ANEURALNETWORKS_ELU = 98, - ANEURALNETWORKS_HARD_SWISH = 99, - ANEURALNETWORKS_FILL = 100, - ANEURALNETWORKS_RANK = 101, -}; - -/** - * Fused activation function types. - * - */ -enum { - ANEURALNETWORKS_FUSED_NONE = 0, - ANEURALNETWORKS_FUSED_RELU = 1, - ANEURALNETWORKS_FUSED_RELU1 = 2, - ANEURALNETWORKS_FUSED_RELU6 = 3, -}; - -/** - * Execution preferences. - */ -enum { - ANEURALNETWORKS_PREFER_LOW_POWER = 0, - ANEURALNETWORKS_PREFER_FAST_SINGLE_ANSWER = 1, - ANEURALNETWORKS_PREFER_SUSTAINED_SPEED = 2, -}; - -/** - * Result codes. - */ -// LINT.IfChange -enum { - ANEURALNETWORKS_NO_ERROR = 0, - ANEURALNETWORKS_OUT_OF_MEMORY = 1, - ANEURALNETWORKS_INCOMPLETE = 2, - ANEURALNETWORKS_UNEXPECTED_NULL = 3, - ANEURALNETWORKS_BAD_DATA = 4, - ANEURALNETWORKS_OP_FAILED = 5, - ANEURALNETWORKS_BAD_STATE = 6, - ANEURALNETWORKS_UNMAPPABLE = 7, - ANEURALNETWORKS_OUTPUT_INSUFFICIENT_SIZE = 8, - ANEURALNETWORKS_UNAVAILABLE_DEVICE = 9, - ANEURALNETWORKS_MISSED_DEADLINE_TRANSIENT = 10, - ANEURALNETWORKS_MISSED_DEADLINE_PERSISTENT = 11, - ANEURALNETWORKS_RESOURCE_EXHAUSTED_TRANSIENT = 12, - ANEURALNETWORKS_RESOURCE_EXHAUSTED_PERSISTENT = 13, - ANEURALNETWORKS_DEAD_OBJECT = 14, -}; -// LINT.ThenChange(//tensorflow/lite/delegates/nnapi/nnapi_delegate.cc:NnApiErrorDescription) - -/** - * Implicit padding algorithms. - */ -enum { - ANEURALNETWORKS_PADDING_SAME = 1, - ANEURALNETWORKS_PADDING_VALID = 2, -}; - -/** - * Device types. - * - * The type of NNAPI device. - */ -enum { - /** The device type cannot be provided. */ - ANEURALNETWORKS_DEVICE_UNKNOWN = 0, - /** The device does not fall into any category below. */ - ANEURALNETWORKS_DEVICE_OTHER = 1, - /** The device runs NNAPI models on single or multi-core CPU. */ - ANEURALNETWORKS_DEVICE_CPU = 2, - /** The device can run NNAPI models and also accelerate graphics APIs such - * as OpenGL ES and Vulkan. */ - ANEURALNETWORKS_DEVICE_GPU = 3, - /** Dedicated accelerator for Machine Learning workloads. */ - ANEURALNETWORKS_DEVICE_ACCELERATOR = 4, -}; - -/** - * Relative execution priority. - * - * Available since API level 30. - */ -enum { - ANEURALNETWORKS_PRIORITY_LOW = 90, - ANEURALNETWORKS_PRIORITY_MEDIUM = 100, - ANEURALNETWORKS_PRIORITY_HIGH = 110, - ANEURALNETWORKS_PRIORITY_DEFAULT = ANEURALNETWORKS_PRIORITY_MEDIUM, -}; -/** - * ANeuralNetworksMemoryDesc is an opaque type that represents a memory - * descriptor. - * - * A memory descriptor describes the properties of a memory object, and is used - * by - * {@link ANeuralNetworksMemory_createFromDesc}. - * - * To use: - * - Create a new memory descriptor by calling - * {@link ANeuralNetworksMemoryDesc_create}. - * - Specify all of the intended input and output roles by calling - * {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole}. - * - Optionally, specify the memory dimensions by calling - * {@link ANeuralNetworksMemoryDesc_setDimensions}. - * - Complete the memory descriptor with {@link - * ANeuralNetworksMemoryDesc_finish}. - * - Use the memory descriptor as many times as needed with - * {@link ANeuralNetworksMemory_createFromDesc}. - * - Destroy the memory descriptor with {@link - * ANeuralNetworksMemoryDesc_free}. - * - * A memory descriptor is completed by calling {@link - * ANeuralNetworksMemoryDesc_finish}. A memory descriptor is destroyed by - * calling {@link ANeuralNetworksMemoryDesc_free}. - * - * A memory descriptor must not be modified once - * {@link ANeuralNetworksMemoryDesc_finish} - * has been called on it. - * - * It is the application's responsibility to make sure that only - * one thread modifies a memory descriptor at a given time. It is however - * safe for more than one thread to use the memory descriptor once - * {@link ANeuralNetworksMemoryDesc_finish} has returned. - * - * It is also the application's responsibility to ensure that there are no other - * uses of the memory descriptor after calling {@link - * ANeuralNetworksMemoryDesc_free}. It is however safe to continue using a - * {@link ANeuralNetworksMemory} object created from the memory descriptor. - * - * Available since API level 30. - */ -typedef struct ANeuralNetworksMemoryDesc ANeuralNetworksMemoryDesc; - -/** - * ANeuralNetworksMemory is an opaque type that represents memory. - * - * This type is used to represent shared memory, memory mapped files, - * and similar memories. - * - * By using shared memory, a program can efficiently communicate to the - * runtime and drivers the tensors that define a model. See - * {@link ANeuralNetworksModel_setOperandValueFromMemory}. An application - * should typically create one shared memory object that contains every tensor - * needed to define a model. {@link ANeuralNetworksMemory_createFromFd} can be - * used to create shared memory from a file handle. {@link - * ANeuralNetworksMemory_createShared} can be used to directly created shared - * memory. - * - * Memory objects can also be used to specify the input and output arguments of - * an execution. See {@link ANeuralNetworksExecution_setInputFromMemory} - * and {@link ANeuralNetworksExecution_setOutputFromMemory}. - */ -typedef struct ANeuralNetworksMemory ANeuralNetworksMemory; - -/** - * ANeuralNetworksModel is an opaque type that contains a description of the - * mathematical operations that constitute the model. - * - *

The model will be built by calling

    - *
  • {@link ANeuralNetworksModel_create},
  • - *
  • {@link ANeuralNetworksModel_addOperation},
  • - *
  • {@link ANeuralNetworksModel_addOperand},
  • - *
- * - * A model is completed by calling {@link ANeuralNetworksModel_finish}. - * A model is destroyed by calling {@link ANeuralNetworksModel_free}. - * - *

It is the application's responsibility to make sure that only one thread - * modifies a model at a given time. It is however safe for more than one - * thread to use the model once {@link ANeuralNetworksModel_finish} has - * returned.

- * - *

It is also the application's responsibility to ensure that there are no - * other uses of the model after calling {@link ANeuralNetworksModel_free}. This - * includes any compilation or execution object created using the model.

- */ -typedef struct ANeuralNetworksModel ANeuralNetworksModel; - -/** - * ANeuralNetworksCompilation is an opaque type that can be used to compile - * a machine learning model. - * - *

To use:

    - *
  • Create a new compilation instance by calling the - * {@link ANeuralNetworksCompilation_create} function.
  • - *
  • Perform the compilation with {@link - * ANeuralNetworksCompilation_start}.
  • Wait for the compilation to - * complete with {@link ANeuralNetworksCompilation_wait}.
  • Use the - * compilation as many times as needed with {@link - * ANeuralNetworksExecution_create}.
  • Destroy the compilation with - * {@link ANeuralNetworksCompilation_free} once all executions using the - * compilation have completed.

- * - *

A compilation cannot be modified once {@link - * ANeuralNetworksCompilation_start} has been called on it.

- * - *

It is the application's responsibility to make sure that only one thread - * modifies a compilation at a given time. It is however safe for more than one - * thread to use {@link ANeuralNetworksCompilation_wait} at the same time. - * It is also safe for multiple threads to use a compilation object once - * {@link ANeuralNetworksCompilation_wait} has completed.

- * - *

It is also the application's responsibility to ensure that there are no - * other uses of the compilation after calling {@link - * ANeuralNetworksCompilation_free}. This includes any execution object created - * using the compilation.

- */ -typedef struct ANeuralNetworksCompilation ANeuralNetworksCompilation; - -/** - * ANeuralNetworksExecution is an opaque type that can be used to apply a - * machine learning model to a set of inputs. - * - *

To use:

    - *
  • Create a new execution instance by calling the - * {@link ANeuralNetworksExecution_create} function.
  • - *
  • Associate data to the model inputs with - * {@link ANeuralNetworksExecution_setInput} or - * {@link ANeuralNetworksExecution_setInputFromMemory}.
  • - *
  • Associate output buffers to the model outputs with - * {@link ANeuralNetworksExecution_setOutput} or - * {@link ANeuralNetworksExecution_setOutputFromMemory}.
  • - *
  • Apply the model with {@link - * ANeuralNetworksExecution_startCompute}.
  • Wait for the execution to - * complete with {@link ANeuralNetworksExecution_wait}.
  • Destroy the - * execution with - * {@link ANeuralNetworksExecution_free}.

- * - *

An execution cannot be modified once {@link - * ANeuralNetworksExecution_start} has been called on it.

- * - *

An execution can be applied to a model with - * {@link ANeuralNetworksExecution_startCompute} only once. Create new - * executions to do new evaluations of the model.

- * - *

It is the application's responsibility to make sure that only one thread - * modifies an execution at a given time. It is however safe for more than one - * thread to use {@link ANeuralNetworksExecution_wait} at the same time.

- * - *

It is also the application's responsibility to ensure that there are no - * other uses of the request after calling {@link - * ANeuralNetworksRequest_free}.

- */ -typedef struct ANeuralNetworksExecution ANeuralNetworksExecution; - -/** - * Parameters for ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL operand. - */ -typedef struct ANeuralNetworksSymmPerChannelQuantParams { - /* The index of the channel dimension. */ - uint32_t channelDim; - /** The size of the scale array. Should be equal to dimension[channelDim] of - * the Operand. */ - uint32_t scaleCount; - /** The array of scaling values for each channel. Each value must be greater - * than zero. */ - const float* scales; -} ANeuralNetworksSymmPerChannelQuantParams; - -/** - * ANeuralNetworksBurst is an opaque type that can be used to reduce the latency - * of a rapid sequence of executions. It will likely cause overhead if only used - * for a single execution. - * - * ANeuralNetworksBurst serves as a context object for any number of inferences - * using {@link ANeuralNetworksExecution} objects. An ANeuralNetworksBurst - * object and the {@link ANeuralNetworksExecution} objects used with it must all - * have been created from the same {@link ANeuralNetworksCompilation} object. - * - * This object is also used as a hint to drivers, providing insight to the - * lifetime of a rapid sequence of executions. For example, a driver may choose - * to increase the clock frequency of its accelerator for the lifetime of a - * burst object. - * - *

To use:

    - *
  • Create a new burst object by calling the - * {@link ANeuralNetworksBurst_create} function.
  • - *
  • For each execution:
    • - *
    • Create {@link ANeuralNetworksExecution} and configure its - * properties (see {@link ANeuralNetworksExecution} for - * details).
    • Apply the model synchronously with - * {@link ANeuralNetworksExecution_burstCompute}, reusing the same - * {@link ANeuralNetworksBurst} with the new - * {@link ANeuralNetworksExecution}.
    • - *
    • Use and free the {@link ANeuralNetworksExecution}.
    - *
  • Destroy the burst with - * {@link ANeuralNetworksBurst_free}.

- * - * Available since API level 29. - */ -typedef struct ANeuralNetworksBurst ANeuralNetworksBurst; - -/** - * ANeuralNetworksOperandType describes the type of an operand. - * This structure is used to describe both scalars and tensors. - */ -typedef struct ANeuralNetworksOperandType { - /** The data type, e.g ANEURALNETWORKS_INT8. */ - int32_t type; - /** The number of dimensions. It should be 0 for scalars. */ - uint32_t dimensionCount; - /** The dimensions of the tensor. It should be nullptr for scalars. */ - const uint32_t* dimensions; - /** These two fields are only used for quantized tensors. - * They should be zero for scalars and non-fixed point tensors. - * The dequantized value of each entry is (value - offset) * scale. - */ - float scale; - int32_t zeroPoint; -} ANeuralNetworksOperandType; - -/** - * ANeuralNetworksEvent is an opaque type that represents an event - * that will be signaled once an execution completes. - */ -typedef struct ANeuralNetworksEvent ANeuralNetworksEvent; - -typedef int32_t ANeuralNetworksOperationType; - -/** - * ANeuralNetworksDevice is an opaque type that represents a device. - * - * This type is used to query basic properties and supported operations of the - * corresponding device, and control which device(s) a model is to be run on. - * - * Available since API level 29. - */ -typedef struct ANeuralNetworksDevice ANeuralNetworksDevice; - -// nn api function types - -typedef int (*ANeuralNetworksMemory_createFromFd_fn)( - size_t size, int protect, int fd, size_t offset, - ANeuralNetworksMemory** memory); - -typedef void (*ANeuralNetworksMemory_free_fn)(ANeuralNetworksMemory* memory); - -typedef int (*ANeuralNetworksModel_create_fn)(ANeuralNetworksModel** model); - -typedef int (*ANeuralNetworksModel_finish_fn)(ANeuralNetworksModel* model); - -typedef void (*ANeuralNetworksModel_free_fn)(ANeuralNetworksModel* model); - -typedef int (*ANeuralNetworksCompilation_create_fn)( - ANeuralNetworksModel* model, ANeuralNetworksCompilation** compilation); - -typedef void (*ANeuralNetworksCompilation_free_fn)( - ANeuralNetworksCompilation* compilation); - -typedef int (*ANeuralNetworksCompilation_setPreference_fn)( - ANeuralNetworksCompilation* compilation, int32_t preference); - -typedef int (*ANeuralNetworksCompilation_finish_fn)( - ANeuralNetworksCompilation* compilation); - -typedef int (*ANeuralNetworksModel_addOperand_fn)( - ANeuralNetworksModel* model, const ANeuralNetworksOperandType* type); - -typedef int (*ANeuralNetworksModel_setOperandValue_fn)( - ANeuralNetworksModel* model, int32_t index, const void* buffer, - size_t length); - -typedef int (*ANeuralNetworksModel_setOperandSymmPerChannelQuantParams_fn)( - ANeuralNetworksModel* model, int32_t index, - const ANeuralNetworksSymmPerChannelQuantParams* channelQuant); - -typedef int (*ANeuralNetworksModel_setOperandValueFromMemory_fn)( - ANeuralNetworksModel* model, int32_t index, - const ANeuralNetworksMemory* memory, size_t offset, size_t length); - -typedef int (*ANeuralNetworksModel_addOperation_fn)( - ANeuralNetworksModel* model, ANeuralNetworksOperationType type, - uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, - const uint32_t* outputs); - -typedef int (*ANeuralNetworksModel_identifyInputsAndOutputs_fn)( - ANeuralNetworksModel* model, uint32_t inputCount, const uint32_t* inputs, - uint32_t outputCount, const uint32_t* outputs); - -typedef int (*ANeuralNetworksModel_relaxComputationFloat32toFloat16_fn)( - ANeuralNetworksModel* model, bool allow); - -typedef int (*ANeuralNetworksExecution_create_fn)( - ANeuralNetworksCompilation* compilation, - ANeuralNetworksExecution** execution); - -typedef void (*ANeuralNetworksExecution_free_fn)( - ANeuralNetworksExecution* execution); - -typedef int (*ANeuralNetworksExecution_setInput_fn)( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, const void* buffer, size_t length); - -typedef int (*ANeuralNetworksExecution_setInputFromMemory_fn)( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, const ANeuralNetworksMemory* memory, - size_t offset, size_t length); - -typedef int (*ANeuralNetworksExecution_setOutput_fn)( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, void* buffer, size_t length); - -typedef int (*ANeuralNetworksExecution_setOutputFromMemory_fn)( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, const ANeuralNetworksMemory* memory, - size_t offset, size_t length); - -typedef int (*ANeuralNetworksExecution_startCompute_fn)( - ANeuralNetworksExecution* execution, ANeuralNetworksEvent** event); - -typedef int (*ANeuralNetworksEvent_wait_fn)(ANeuralNetworksEvent* event); - -typedef void (*ANeuralNetworksEvent_free_fn)(ANeuralNetworksEvent* event); - -typedef int (*ASharedMemory_create_fn)(const char* name, size_t size); - -typedef int (*ANeuralNetworks_getDeviceCount_fn)(uint32_t* numDevices); - -typedef int (*ANeuralNetworks_getDevice_fn)(uint32_t devIndex, - ANeuralNetworksDevice** device); - -typedef int (*ANeuralNetworksDevice_getName_fn)( - const ANeuralNetworksDevice* device, const char** name); - -typedef int (*ANeuralNetworksDevice_getType_fn)( - const ANeuralNetworksDevice* device, int32_t* type); - -typedef int (*ANeuralNetworksDevice_getVersion_fn)( - const ANeuralNetworksDevice* device, const char** version); - -typedef int (*ANeuralNetworksDevice_getFeatureLevel_fn)( - const ANeuralNetworksDevice* device, int64_t* featureLevel); - -typedef int (*ANeuralNetworksModel_getSupportedOperationsForDevices_fn)( - const ANeuralNetworksModel* model, - const ANeuralNetworksDevice* const* devices, uint32_t numDevices, - bool* supportedOps); - -typedef int (*ANeuralNetworksCompilation_createForDevices_fn)( - ANeuralNetworksModel* model, const ANeuralNetworksDevice* const* devices, - uint32_t numDevices, ANeuralNetworksCompilation** compilation); - -typedef int (*ANeuralNetworksCompilation_setCaching_fn)( - ANeuralNetworksCompilation* compilation, const char* cacheDir, - const uint8_t* token); - -typedef int (*ANeuralNetworksCompilation_setTimeout_fn)( - ANeuralNetworksCompilation* compilation, uint64_t duration); - -typedef int (*ANeuralNetworksCompilation_setPriority_fn)( - ANeuralNetworksCompilation* compilation, int priority); - -typedef int (*ANeuralNetworksExecution_compute_fn)( - ANeuralNetworksExecution* execution); - -typedef int (*ANeuralNetworksExecution_setTimeout_fn)( - ANeuralNetworksExecution* execution, uint64_t duration); - -typedef int (*ANeuralNetworksExecution_setLoopTimeout_fn)( - ANeuralNetworksExecution* execution, uint64_t duration); - -typedef int (*ANeuralNetworksExecution_getOutputOperandRank_fn)( - ANeuralNetworksExecution* execution, int32_t index, uint32_t* rank); - -typedef int (*ANeuralNetworksExecution_getOutputOperandDimensions_fn)( - ANeuralNetworksExecution* execution, int32_t index, uint32_t* dimensions); - -typedef int (*ANeuralNetworksBurst_create_fn)( - ANeuralNetworksCompilation* compilation, ANeuralNetworksBurst** burst); - -typedef void (*ANeuralNetworksBurst_free_fn)(ANeuralNetworksBurst* burst); - -typedef int (*ANeuralNetworksExecution_burstCompute_fn)( - ANeuralNetworksExecution* execution, ANeuralNetworksBurst* burst); - -typedef int (*ANeuralNetworksMemory_createFromAHardwareBuffer_fn)( - const AHardwareBuffer* ahwb, ANeuralNetworksMemory** memory); - -typedef int (*ANeuralNetworksExecution_setMeasureTiming_fn)( - ANeuralNetworksExecution* execution, bool measure); - -typedef enum { - // Execution time on hardware (not driver, which runs on host processor). - ANEURALNETWORKS_DURATION_ON_HARDWARE = 0, - // Execution time in driver (including time on hardware). Excludes overhead - // such as that of the runtime itself and the IPC needed for the runtime to - // communicate with the driver. - ANEURALNETWORKS_DURATION_IN_DRIVER = 1, - // Execution time on hardware, after all dependencies have been signaled. - // If no dependencies specified (for example, if the execution was scheduled - // other - // than with {@link ANeuralNetworksExecution_startComputeWithDependencies}), - // the - // reported time will be the same as ANEURALNETWORKS_DURATION_ON_HARDWARE. - // Available since API level 30. - ANEURALNETWORKS_FENCED_DURATION_ON_HARDWARE = 2, - // Execution time in driver, after all dependencies have been signaled. - // Excludes - // overhead such as that of the runtime itself and the IPC needed for the - // runtime - // to communicate with the driver. - // If no dependencies specified (for example, if the execution was scheduled - // other - // than with {@link ANeuralNetworksExecution_startComputeWithDependencies}), - // the - // reported time will be the same as ANEURALNETWORKS_DURATION_IN_DRIVER. - // Available since API level 30. - ANEURALNETWORKS_FENCED_DURATION_IN_DRIVER = 3, -} DurationCode; - -typedef int (*ANeuralNetworksExecution_getDuration_fn)( - const ANeuralNetworksExecution* execution, int32_t durationCode, - uint64_t* duration); - -typedef int (*ANeuralNetworksDevice_getExtensionSupport_fn)( - const ANeuralNetworksDevice* device, const char* extensionName, - bool* isExtensionSupported); - -typedef int (*ANeuralNetworksModel_getExtensionOperandType_fn)( - ANeuralNetworksModel* model, const char* extensionName, - uint16_t operandCodeWithinExtension, int32_t* type); - -typedef int (*ANeuralNetworksModel_getExtensionOperationType_fn)( - ANeuralNetworksModel* model, const char* extensionName, - uint16_t operationCodeWithinExtension, ANeuralNetworksOperationType* type); - -typedef int (*ANeuralNetworksModel_setOperandExtensionData_fn)( - ANeuralNetworksModel* model, int32_t index, const void* data, - size_t length); - -typedef int (*ANeuralNetworksMemoryDesc_create_fn)( - ANeuralNetworksMemoryDesc** desc); - -typedef void (*ANeuralNetworksMemoryDesc_free_fn)( - ANeuralNetworksMemoryDesc* desc); - -typedef int (*ANeuralNetworksMemoryDesc_addInputRole_fn)( - ANeuralNetworksMemoryDesc* desc, - const ANeuralNetworksCompilation* compilation, int32_t index, - float frequency); - -typedef int (*ANeuralNetworksMemoryDesc_addOutputRole_fn)( - ANeuralNetworksMemoryDesc* desc, - const ANeuralNetworksCompilation* compilation, uint32_t index, - float frequency); - -typedef int (*ANeuralNetworksMemoryDesc_setDimensions_fn)( - ANeuralNetworksMemoryDesc* desc, uint32_t rank, const uint32_t* dimensions); - -typedef int (*ANeuralNetworksMemoryDesc_finish_fn)( - ANeuralNetworksMemoryDesc* desc); - -typedef int (*ANeuralNetworksMemory_createFromDesc_fn)( - const ANeuralNetworksMemoryDesc* desc, ANeuralNetworksMemory** memory); - -typedef int (*ANeuralNetworksMemory_copy_fn)(const ANeuralNetworksMemory* src, - const ANeuralNetworksMemory* dst); - -typedef int (*ANeuralNetworksEvent_createFromSyncFenceFd_fn)( - int sync_fence_fd, ANeuralNetworksEvent** event); - -typedef int (*ANeuralNetworksEvent_getSyncFenceFd_fn)( - const ANeuralNetworksEvent* event, int* sync_fence_fd); - -typedef int (*ANeuralNetworksExecution_startComputeWithDependencies_fn)( - ANeuralNetworksExecution* execution, - const ANeuralNetworksEvent* const* dependencies, uint32_t num_dependencies, - uint64_t duration, ANeuralNetworksEvent** event); - -#endif // TENSORFLOW_LITE_NNAPI_NEURALNETWORKSTYPES_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/nnapi_handler.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/nnapi_handler.h deleted file mode 100644 index 16e1e9f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/nnapi_handler.h +++ /dev/null @@ -1,342 +0,0 @@ -/* 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_NNAPI_NNAPI_HANDLER_H_ -#define TENSORFLOW_LITE_NNAPI_NNAPI_HANDLER_H_ - -#include "tensorflow/core/platform/logging.h" -#include "tensorflow/lite/nnapi/NeuralNetworksTypes.h" -#include "tensorflow/lite/nnapi/nnapi_implementation.h" - -namespace tflite { -namespace nnapi { - -// Offers an interface to alter the behaviour of the NNAPI instance. -// As for NNAPI, it is designed to be a singleton. -// It allows to change the behaviour of some of the methods with some stub -// implementation and then to reset the behavior to the original one using -// Reset(). -// -class NnApiHandler { - public: - // No destructor defined to allow this class to be used as singleton. - - // Factory method, only one instance per process/jni library. - static NnApiHandler* Instance(); - - // Makes the current object a transparent proxy again, resetting any - // applied changes to its methods. - void Reset(); - - // Using templates in the ...Returns methods because the functions need to be - // stateless and the template generated code is more readable than using a - // file-local variable in the method implementation to store the configured - // result. - - template - void GetDeviceCountReturns() { - nnapi_->ANeuralNetworks_getDeviceCount = [](uint32_t* numDevices) -> int { - *numDevices = 1; - return Value; - }; - } - - template - void GetDeviceCountReturnsCount() { - nnapi_->ANeuralNetworks_getDeviceCount = [](uint32_t* numDevices) -> int { - *numDevices = DeviceCount; - return ANEURALNETWORKS_NO_ERROR; - }; - } - - void StubGetDeviceCountWith(int(stub)(uint32_t*)) { - nnapi_->ANeuralNetworks_getDeviceCount = stub; - } - - template - void GetDeviceReturns() { - nnapi_->ANeuralNetworks_getDevice = - [](uint32_t devIndex, ANeuralNetworksDevice** device) -> int { - *device = - reinterpret_cast(NnApiHandler::kNnapiDevice); - return Value; - }; - } - - void StubGetDeviceWith(int(stub)(uint32_t, ANeuralNetworksDevice**)) { - nnapi_->ANeuralNetworks_getDevice = stub; - } - - template - void GetDeviceNameReturns() { - nnapi_->ANeuralNetworksDevice_getName = - [](const ANeuralNetworksDevice* device, const char** name) -> int { - *name = NnApiHandler::nnapi_device_name_; - return Value; - }; - } - - void GetDeviceNameReturnsName(const std::string& name); - - void StubGetDeviceNameWith(int(stub)(const ANeuralNetworksDevice*, - const char**)) { - nnapi_->ANeuralNetworksDevice_getName = stub; - } - - // Configure all the functions related to device browsing to support - // a device with the given name and the cpu fallback nnapi-reference. - // The extra device will return support the specified feature level - void SetNnapiSupportedDevice(const std::string& name, int feature_level = 29); - - template - void ModelCreateReturns() { - nnapi_->ANeuralNetworksModel_create = [](ANeuralNetworksModel** model) { - *model = reinterpret_cast(1); - return Value; - }; - } - - void StubModelCreateWith(int(stub)(ANeuralNetworksModel** model)) { - nnapi_->ANeuralNetworksModel_create = stub; - } - - template - void AddOperandReturns() { - nnapi_->ANeuralNetworksModel_addOperand = - [](ANeuralNetworksModel* model, - const ANeuralNetworksOperandType* type) { return Value; }; - } - - void StubAddOperandWith(int(stub)(ANeuralNetworksModel* model, - const ANeuralNetworksOperandType* type)) { - nnapi_->ANeuralNetworksModel_addOperand = stub; - } - - template - void SetOperandValueReturns() { - nnapi_->ANeuralNetworksModel_setOperandValue = - [](ANeuralNetworksModel* model, int32_t index, const void* buffer, - size_t length) { return Value; }; - } - - template - void AddOperationReturns() { - nnapi_->ANeuralNetworksModel_addOperation = - [](ANeuralNetworksModel* model, ANeuralNetworksOperationType type, - uint32_t inputCount, const uint32_t* inputs, uint32_t outputCount, - const uint32_t* outputs) { return Value; }; - } - - void StubAddOperationWith( - int(stub)(ANeuralNetworksModel* model, ANeuralNetworksOperationType type, - uint32_t inputCount, const uint32_t* inputs, - uint32_t outputCount, const uint32_t* outputs)) { - nnapi_->ANeuralNetworksModel_addOperation = stub; - } - - template - void IdentifyInputAndOutputsReturns() { - nnapi_->ANeuralNetworksModel_identifyInputsAndOutputs = - [](ANeuralNetworksModel* model, uint32_t inputCount, - const uint32_t* inputs, uint32_t outputCount, - const uint32_t* outputs) { return Value; }; - } - - template - void RelaxComputationFloatReturns() { - nnapi_->ANeuralNetworksModel_relaxComputationFloat32toFloat16 = - [](ANeuralNetworksModel* model, bool allow) { return Value; }; - } - - template - void ModelFinishReturns() { - nnapi_->ANeuralNetworksModel_finish = [](ANeuralNetworksModel* model) { - return Value; - }; - } - - template - void MemoryCreateFromFdReturns() { - nnapi_->ANeuralNetworksMemory_createFromFd = - [](size_t size, int protect, int fd, size_t offset, - ANeuralNetworksMemory** memory) { - *memory = reinterpret_cast(2); - return Value; - }; - } - - template - void CompilationCreateReturns() { - nnapi_->ANeuralNetworksCompilation_create = - [](ANeuralNetworksModel* model, - ANeuralNetworksCompilation** compilation) { - *compilation = reinterpret_cast(3); - return Value; - }; - } - - template - void CompilationCreateForDevicesReturns() { - nnapi_->ANeuralNetworksCompilation_createForDevices = - [](ANeuralNetworksModel* model, - const ANeuralNetworksDevice* const* devices, uint32_t numDevices, - ANeuralNetworksCompilation** compilation) { - *compilation = reinterpret_cast(3); - return Value; - }; - } - - void StubCompilationCreateForDevicesWith(int(stub)( - ANeuralNetworksModel* model, const ANeuralNetworksDevice* const* devices, - uint32_t numDevices, ANeuralNetworksCompilation** compilation)) { - nnapi_->ANeuralNetworksCompilation_createForDevices = stub; - } - - template - void CompilationFinishReturns() { - nnapi_->ANeuralNetworksCompilation_finish = - [](ANeuralNetworksCompilation* compilation) { return Value; }; - } - - template - void ExecutionCreateReturns() { - nnapi_->ANeuralNetworksExecution_create = - [](ANeuralNetworksCompilation* compilation, - ANeuralNetworksExecution** execution) { - if (compilation == nullptr) return 1; - *execution = reinterpret_cast(4); - return Value; - }; - } - template - void ExecutionSetInputFromMemoryReturns() { - nnapi_->ANeuralNetworksExecution_setInputFromMemory = - [](ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, - const ANeuralNetworksMemory* memory, size_t offset, - size_t length) { return Value; }; - } - template - void ExecutionSetOutputFromMemoryReturns() { - nnapi_->ANeuralNetworksExecution_setOutputFromMemory = - [](ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, - const ANeuralNetworksMemory* memory, size_t offset, - size_t length) { return Value; }; - } - - template - void ExecutionComputeReturns() { - nnapi_->ANeuralNetworksExecution_compute = - [](ANeuralNetworksExecution* execution) { return Value; }; - } - - template - void GetSupportedOperationsForDevicesReturns() { - nnapi_->ANeuralNetworksModel_getSupportedOperationsForDevices = - [](const ANeuralNetworksModel* model, - const ANeuralNetworksDevice* const* devices, uint32_t numDevices, - bool* supportedOps) { return Value; }; - } - - void StubGetSupportedOperationsForDevicesWith( - int(stub)(const ANeuralNetworksModel* model, - const ANeuralNetworksDevice* const* devices, - uint32_t numDevices, bool* supportedOps)) { - nnapi_->ANeuralNetworksModel_getSupportedOperationsForDevices = stub; - } - - template - void ExecutionStartComputeReturns() { - nnapi_->ANeuralNetworksExecution_startCompute = - [](ANeuralNetworksExecution* execution, ANeuralNetworksEvent** event) { - *event = reinterpret_cast(1); - return Value; - }; - } - - template - void EventWaitReturns() { - nnapi_->ANeuralNetworksEvent_wait = [](ANeuralNetworksEvent* event) { - return Value; - }; - } - - template - void SetPriorityReturns() { - nnapi_->ANeuralNetworksCompilation_setPriority = - [](ANeuralNetworksCompilation* compilation, int priority) -> int { - return Value; - }; - } - - template - void SetOperandSymmPerChannelQuantParamsReturns() { - nnapi_->ANeuralNetworksModel_setOperandSymmPerChannelQuantParams = - [](ANeuralNetworksModel* model, int32_t index, - const ANeuralNetworksSymmPerChannelQuantParams* channelQuant) { - return Value; - }; - } - - /* - * Sets the SDK Version in the nnapi structure. - * If set_unsupported_ops_to_null is set to true, all the functions not - * available at the given sdk level will be set to null too. - */ - void SetAndroidSdkVersion(int version, - bool set_unsupported_ops_to_null = false); - - const NnApi* GetNnApi() { return nnapi_; } - - protected: - explicit NnApiHandler(NnApi* nnapi) : nnapi_(nnapi) { DCHECK(nnapi); } - - NnApi* nnapi_; - - static const char kNnapiReferenceDeviceName[]; - static const int kNnapiReferenceDevice; - static const int kNnapiDevice; - - static void SetDeviceName(const std::string& name); - - private: - static char* nnapi_device_name_; - static int nnapi_device_feature_level_; -}; - -// Returns a pointer to an unaltered instance of NNAPI. Is intended -// to be used by stub methods when wanting to pass-through to original -// implementation for example: -// -// NnApiTestUtility()->StubGetDeviceWith( -// [](uint32_t devIndex, ANeuralNetworksDevice** device) -> int { -// static int count = 0; -// if (count++ < 1) { -// NnApiPassthroughInstance()->ANeuralNetworks_getDevice( -// devIndex, device); -// } else { -// return ANEURALNETWORKS_BAD_DATA; -// } -// }); -const NnApi* NnApiPassthroughInstance(); - -// Returns an instance of NnApiProxy that can be used to alter -// the behaviour of the TFLite wide instance of NnApi. -NnApiHandler* NnApiProxyInstance(); - -} // namespace nnapi -} // namespace tflite - -#endif // TENSORFLOW_LITE_NNAPI_NNAPI_HANDLER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/nnapi_implementation.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/nnapi_implementation.h deleted file mode 100644 index a15db09..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/nnapi_implementation.h +++ /dev/null @@ -1,1668 +0,0 @@ -/* Copyright 2017 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_NNAPI_NNAPI_IMPLEMENTATION_H_ -#define TENSORFLOW_LITE_NNAPI_NNAPI_IMPLEMENTATION_H_ - -#include -#include -#include - -#include "tensorflow/lite/nnapi/NeuralNetworksTypes.h" - -struct NnApi { - bool nnapi_exists; - int32_t android_sdk_version; - - /** - * Creates a shared memory object from a file descriptor. - * - * The shared memory is backed by a file descriptor via mmap. - * See {@link ANeuralNetworksMemory} for a description on how to use - * this shared memory. - * - * @param size The requested size in bytes. - * Must not be larger than the file size. - * @param prot The desired memory protection for the mapping. - * It is either PROT_NONE or the bitwise OR of one or - * more of the following flags: PROT_READ, PROT_WRITE. - * @param fd The requested file descriptor. - * The file descriptor has to be mmap-able. The file - * descriptor will be duplicated. - * @param offset The offset to the beginning of the file of the area to map. - * The offset has to be aligned to a page size. - * @param memory The memory object to be created. - * Set to NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if the request completed normally. - */ - int (*ANeuralNetworksMemory_createFromFd)(size_t size, int protect, int fd, - size_t offset, - ANeuralNetworksMemory** memory); - - /** - * Delete a memory object. - * - * Destroys the object used by the run time to keep track of the memory. - * This will free the underlying actual memory if no other code has open - * handles to this memory. - * - * @param memory The memory object to be freed. - */ - void (*ANeuralNetworksMemory_free)(ANeuralNetworksMemory* memory); - - /** - * Create an empty {@link ANeuralNetworksModel}. - * - *

This only creates the object. Computation is performed once - * {@link ANeuralNetworksExecution_startCompute} is invoked. - * - * The model should be constructed with calls to - * {@link ANeuralNetworksModel_addOperation} and - * {@link ANeuralNetworksModel_addOperand} - * - *

{@link ANeuralNetworksModel_finish} should be called once the model - * has been fully constructed.

- * - *

{@link ANeuralNetworksModel_free} should be called once the model - * is no longer needed.

- * - * @param model The {@link ANeuralNetworksModel} to be created. - * Set to NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_create)(ANeuralNetworksModel** model); - - /** - * Destroy a model. - * - * The model need not have been finished by a call to - * {@link ANeuralNetworksModel_finish}. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @param model The model to be destroyed. Passing NULL is acceptable and - * results in no operation. - */ - void (*ANeuralNetworksModel_free)(ANeuralNetworksModel* model); - - /** - * Indicate that we have finished modifying a model. Required before - * calling {@link ANeuralNetworksCompilation_compile}. - * - * An application is responsible to make sure that no other thread uses - * the model at the same time. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @param model The model to be finished. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_finish)(ANeuralNetworksModel* model); - - /** - * Add an operand to a model. - * - * The order in which the operands are added is important. The first one added - * to a model will have the index value 0, the second 1, etc. These indexes - * are used as operand identifiers in - * {@link ANeuralNetworksModel_addOperation}, - * {@link ANeuralNetworksExecution_setInput}, - * {@link ANeuralNetworksExecution_setInputFromMemory}, - * {@link ANeuralNetworksExecution_setOutput}, - * {@link ANeuralNetworksExecution_setOutputFromMemory} and - * {@link ANeuralNetworksExecution_setOperandValue}. - * - * To build a model that can accommodate inputs of various sizes, as you may - * want to do for a CNN, set the size of the dimensions that will vary at run - * time to 0. If you do so, provide the full dimensions when calling - * {@link ANeuralNetworksExecution_setInput} or {@link - * ANeuralNetworksExecution_setInputFromMemory}. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @param model The model to be modified. - * @param type The {@link ANeuralNetworksOperandType} that describes the shape - * of the operand. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_addOperand)( - ANeuralNetworksModel* model, const ANeuralNetworksOperandType* type); - - /** - * Sets an operand to a constant value. - * - * For scalar values, the content of buffer is copied into the model. - * - * For tensor values, a pointer to the buffer is stored within the model. - * The application is responsible for not changing the content of this region - * until all executions using this model have completed. As the data may - * be copied during processing, modifying the data after this call yields - * undefined results. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @param model The model to be modified. - * @param index The index of the model operand we're setting. - * @param buffer A pointer to the data to use. - * @param length The size in bytes of the data value. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_setOperandValue)(ANeuralNetworksModel* model, - int32_t index, const void* buffer, - size_t length); - - /** - * Sets an operand's per channel quantization parameters. - * - * Sets parameters required by a tensor of type - * {@link ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL}. - * This function must be called for every tensor of type - * {@link ANEURALNETWORKS_TENSOR_QUANT8_SYMM_PER_CHANNEL} before - * calling {@link ANeuralNetworksModel_finish}. - * - * Available since API level 29. - * - * @param model The model to be modified. - * @param index The index of the model operand we're setting. - * @param channelQuant The per channel quantization parameters for the - * operand. No memory in this struct needs to outlive the - * call to this function. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_setOperandSymmPerChannelQuantParams)( - ANeuralNetworksModel* model, int32_t index, - const ANeuralNetworksSymmPerChannelQuantParams* channelQuant); - - /** - * Sets an operand to a value stored in a memory object. - * - * The content of the memory is not copied. A reference to that memory is - * stored inside the model. The application is responsible for not changing - * the content of the memory region until all executions using this model have - * completed. - * As the data may be copied during processing, modifying the data after this - * call yields undefined results. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @param model The model to be modified. - * @param index The index of the model operand we're setting. - * @param buffer A pointer to the data to use. - * @param memory The memory containing the data. - * @param offset This specifies the location of the data within the memory. - * The offset is in bytes from the start of memory. - * @param length The size in bytes of the data value. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_setOperandValueFromMemory)( - ANeuralNetworksModel* model, int32_t index, - const ANeuralNetworksMemory* memory, size_t offset, size_t length); - - /** - * Add an operation to a model. - * - * @param model The model to be modified. - * @param type The type of the operation. - * @param inputCount The number of entries in the inputs array. - * @param inputs An array of indexes identifying each operand. - * @param outputCount The number of entries in the outputs array. - * @param outputs An array of indexes identifying each operand. - * - * The operands specified by inputs and outputs must have been - * previously added by calls to {@link ANeuralNetworksModel_addOperand}. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_addOperation)(ANeuralNetworksModel* model, - ANeuralNetworksOperationType type, - uint32_t inputCount, - const uint32_t* inputs, - uint32_t outputCount, - const uint32_t* outputs); - - /** - * Specifies which operands will be the model's inputs and outputs. - * - * An operand cannot be used for both input and output. Doing so will - * return an error. - * - * @param model The model to be modified. - * @param inputCount The number of entries in the inputs array. - * @param inputs An array of indexes identifying the input operands. - * @param outputCount The number of entries in the outputs array. - * @param outputs An array of indexes identifying the output operands. - * - * The operands specified by inputs and outputs must have been - * previously added by calls to {@link ANeuralNetworksModel_addOperand}. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_identifyInputsAndOutputs)( - ANeuralNetworksModel* model, uint32_t inputCount, const uint32_t* inputs, - uint32_t outputCount, const uint32_t* outputs); - - /** - * Specifies whether {@link ANEURALNETWORKS_TENSOR_FLOAT32} is allowed to be - * calculated with range and/or precision as low as that of the - * IEEE 754 16-bit floating-point format. By default, - * {@link ANEURALNETWORKS_TENSOR_FLOAT32} must be calculated using at least - * the range and precision of the IEEE 754 32-bit floating-point format. - * - * @param model The model to be modified. - * @param allow 'true' indicates {@link ANEURALNETWORKS_TENSOR_FLOAT32} may be - * calculated with range and/or precision as low as that of the - * IEEE 754 16-bit floating point format. 'false' indicates - * {@link ANEURALNETWORKS_TENSOR_FLOAT32} must be calculated - * using at least the range and precision of the IEEE 754 32-bit - * floating point format. - * - * Attempting to modify a model once {@link ANeuralNetworksModel_finish} has - * been called will return an error. - * - * Available since API level 28. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_relaxComputationFloat32toFloat16)( - ANeuralNetworksModel* model, bool allow); - - /** - * Create a {@link ANeuralNetworksCompilation} to compile the given model. - * This only creates the object. Compilation is only performed once - * {@link ANeuralNetworksCompilation_start} is invoked. - * - *

The provided model must outlive the compilation.

- * - * The model must already have been finished by a call to - * {@link ANeuralNetworksModel_finish}. - * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * @param model The {@link ANeuralNetworksModel} to be compiled. - * @param compilation The newly created object or NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA - * if the model is invalid. - */ - int (*ANeuralNetworksCompilation_create)( - ANeuralNetworksModel* model, ANeuralNetworksCompilation** compilation); - - /** - * Destroy a compilation. - * - *

If called on a compilation for which - * {@link ANeuralNetworksCompilation_start} has been called, the - * function will return immediately but will mark the compilation to be - * deleted once the compilation completes. The - * {@link ANeuralNetworksCompilation_wait} will return ERROR_DELETED. - * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * @param compilation The compilation to be destroyed. Passing NULL is - * acceptable and results in no operation. - */ - void (*ANeuralNetworksCompilation_free)( - ANeuralNetworksCompilation* compilation); - - /** - * Sets the execution preference. - * - *

Provides guidance to the runtime when trade-offs are possible.

- * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * @param compilation The compilation to be modified. - * @param preference Either {@link PREFER_LOW_POWER}, - * {@link PREFER_SINGLE_FAST_ANSWER}, or - * {@link PREFER_SUSTAINED_SPEED}. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksCompilation_setPreference)( - ANeuralNetworksCompilation* compilation, int32_t preference); - - /** - * Waits until the compilation completes. - * - * More than one thread can wait on a compilation. When the compilation - * completes, all threads will be released. - * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * @return ANEURALNETWORKS_NO_ERROR if the compilation completed normally. - */ - int (*ANeuralNetworksCompilation_finish)( - ANeuralNetworksCompilation* compilation); - - /** - * Create a {@link ANeuralNetworksExecution} to apply the given compilation. - * This only creates the object. Computation is only performed once - * {@link ANeuralNetworksExecution_startCompute} is invoked. - * - *

The provided compilation must outlive the execution.

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * @param compilation The {@link ANeuralNetworksCompilation} to be evaluated. - * @param execution The newly created object or NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA - * if the compilation is invalid. - */ - int (*ANeuralNetworksExecution_create)( - ANeuralNetworksCompilation* compilation, - ANeuralNetworksExecution** execution); - - /** - * Destroy an execution. - * - *

If called on an execution for which - * {@link ANeuralNetworksExecution_startCompute} has been called, the - * function will return immediately but will mark the execution to be deleted - * once the computation completes. The {link ANeuralNetworksExecution_wait} - * will return ANEURALNETWORKS_ERROR_DELETED. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * @param execution The execution to be destroyed. Passing NULL is acceptable - * and results in no operation. - */ - void (*ANeuralNetworksExecution_free)(ANeuralNetworksExecution* execution); - - /** - * Associate a user buffer with an input of the model of the - * {@link ANeuralNetworksExecution}. - * - *

The provided buffer must outlive the execution.

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * @param execution The execution to be modified. - * @param index The index of the input argument we are setting. It is - * an index into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is - * not the index associated with {@link - * ANeuralNetworksModel_addOperand}. - * @param type The type of the operand. This should be used to specify the - * dimensions that were set to 0 when the operand was added to the - * model. All other properties of the type must be the same as - * specified in the model. If the type is the same as specified - * when the model was built, NULL can be passed. - * @param buffer The buffer containing the data. - * @param length The length in bytes of the buffer. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if - * the name is not recognized or the buffer is too small for the input. - */ - int (*ANeuralNetworksExecution_setInput)( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, const void* buffer, - size_t length); - - /** - * Associate part of a memory object with an input of the model of the - * {@link ANeuralNetworksExecution}. - * - *

The provided memory must outlive the execution.

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * @param execution The execution to be modified. - * @param index The index of the input argument we are setting. It is - * an index into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is - * not the index associated with {@link - * ANeuralNetworksModel_addOperand}. - * @param type The type of the operand. This can be used to specify the - * dimensions that were set to 0 when the operand was added to the - * model. All other values must be the same as specified in the - * model. If the type is the same as specified when the model - * was built, NULL can be passed. - * @param memory The memory containing the data. - * @param offset This specifies the location of the data within the memory. - * The offset is in bytes from the start of memory. - * @param length The size in bytes of the data value. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if - * the name is not recognized or the buffer is too small for the input. - */ - int (*ANeuralNetworksExecution_setInputFromMemory)( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, - const ANeuralNetworksMemory* memory, size_t offset, size_t length); - - /** - * Associate a user buffer with an output of the model of the - * {@link ANeuralNetworksExecution}. - * - *

The provided buffer must outlive the execution.

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * @param execution The execution to be modified. - * @param index The index of the output argument we are setting. It is - * an index into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is - * not the index associated with {@link - * ANeuralNetworksModel_addOperand}. - * @param type The type of the operand. This can be used to specify the - * dimensions that were set to 0 when the operand was added to the - * model. All other values must be the same as specified in the - * model. If the type is the same as specified when the model - * was built, NULL can be passed. - * @param buffer The buffer where the data is to be written. - * @param length The length in bytes of the buffer. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if - * the name is not recognized or the buffer is too small for the output. - */ - int (*ANeuralNetworksExecution_setOutput)( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, void* buffer, size_t length); - - /** - * Associate part of a memory object with an output of the model of the - * {@link ANeuralNetworksExecution}. - * - *

The provided memory must outlive the execution.

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * @param execution The execution to be modified. - * @param index The index of the output argument we are setting. It is - * an index into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is - * not the index associated with {@link - * ANeuralNetworksModel_addOperand}. - * @param type The type of the operand. This can be used to specify the - * dimensions that were set to 0 when the operand was added to the - * model. All other values must be the same as specified in the - * model. If the type is the same as specified when the model - * was built, NULL can be passed. - * @param memory The memory where the data is to be stored. - * @param offset This specifies the location of the data within the memory. - * The offset is in bytes from the start of memory. - * @param length The length in bytes of the data value. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA if - * the name is not recognized or the buffer is too small for the output. - */ - int (*ANeuralNetworksExecution_setOutputFromMemory)( - ANeuralNetworksExecution* execution, int32_t index, - const ANeuralNetworksOperandType* type, - const ANeuralNetworksMemory* memory, size_t offset, size_t length); - - /** - * Schedule evaluation of the execution. - * - *

Schedules evaluation of the execution. Once the model has been - * applied and the outputs are ready to be consumed, the execution will be - * signaled. Use {@link ANeuralNetworksExecution_wait} to wait for that - * signal. - *

- * - * Multiple executions can be scheduled and evaluated concurrently, and - * compilations can be performed concurrently with executions. The runtime - * makes no guarantee on the ordering of the completion of compilations and - * executions. If it's important to the application, the application should - * enforce the ordering by using {@link ANeuralNetworksCompilation_wait} and - * {@link ANeuralNetworksExecution_wait}. - * - * ANeuralNetworksExecution_wait must be called to recuperate the resources - * used by the execution. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * @param execution The execution to be scheduled and executed. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksExecution_startCompute)( - ANeuralNetworksExecution* execution, ANeuralNetworksEvent** event); - - /** - * Waits until the execution completes. - * - * More than one thread can wait on an event. When the execution completes, - * all threads will be released. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * @return ANEURALNETWORKS_NO_ERROR if the execution completed normally. - */ - int (*ANeuralNetworksEvent_wait)(ANeuralNetworksEvent* event); - - /** - * Destroys the event. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - */ - void (*ANeuralNetworksEvent_free)(ANeuralNetworksEvent* event); - - // ASharedMemory_create was added in Android 8.0, so safe to use with NNAPI - // which was added in 8.1. - int (*ASharedMemory_create)(const char* name, size_t size); - - /** - * Get the number of available devices. - * - * @param numDevices Used to return the number of devices. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ - int (*ANeuralNetworks_getDeviceCount)(uint32_t* numDevices); - - /** - * Get the representation of the specified device. - * - * @param devIndex The index of the specified device. Must be less than the - * number of available devices. - * @param device The representation of the specified device. - * The same representation will always be returned for the - * specified device. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ - - int (*ANeuralNetworks_getDevice)(uint32_t devIndex, - ANeuralNetworksDevice** device); - - /** - * Get the name of the specified device. - * - * @param device The representation of the specified device. - * @param name The returned name of the specified device. The name will be - * in UTF-8 and will be null-terminated. It will be recognizable - * as a known device name rather than a cryptic string. For - * devices with API level 29 and above, the format of the name is - * {VENDOR}-{DEVICE}, e.g. “google-ipu”. For devices with feature - * level 28 or lower, the name will always be “unknown-device”. - * The name will remain valid for the duration of the application. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ - int (*ANeuralNetworksDevice_getName)(const ANeuralNetworksDevice* device, - const char** name); - - /** - * Get the version of the driver implementation of the specified device. - * - * It’s the responsibility of the driver implementor to insure that this - * version string uniquely distinguishes this implementation from all previous - * implementations. - * - * This version string must not be confused with the feature level which is - * solely defined by {@link ANeuralNetworksDevice_getFeatureLevel}. There is - * no implicit ordering of the versions. For example, it is not possible to - * filter all drivers older than a certain version. - * - * Application developers may use this version string to avoid or prefer - * specific driver implementations. For example, an application may want to do - * so because: - * - A specific version of the driver does not provide the required - * performance, perhaps because of a performance regression. - * - A specific version of the driver has a bug or returns results that - * don’t match the minimum precision requirement for the application. - * - * @param device The representation of the specified device. - * @param version The returned version string of the driver for the specified - * device. The string will be in UTF-8 and will be - * null-terminated. For devices with feature level 28 or lower, - * "UNKNOWN" will be returned. The version string will remain - * valid for the duration of the application. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ - int (*ANeuralNetworksDevice_getVersion)(const ANeuralNetworksDevice* device, - const char** version); - - /** - * Get the supported NNAPI version of the specified device. - * - * Each device has a supported feature level, which is the most advanced - * feature this driver implements. For example, if the driver implements the - * features introduced in Android P, but does not implement the features - * introduced after Android P, the value would be 28. Developers could decide - * whether or not the specified device should be used for a Model that has - * certain feature requirements. - * - * @param device The representation of the specified device. - * @param featureLevel The API level of the most advanced feature this driver - * implements. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ - int (*ANeuralNetworksDevice_getFeatureLevel)( - const ANeuralNetworksDevice* device, int64_t* featureLevel); - - /** - * Get the type of a given device. - * - * The device type can be used to help application developers to distribute - * Machine Learning workloads and other workloads such as graphical rendering. - * E.g., for an app which renders AR scenes based on real time object - * detection results, the developer could choose an ACCELERATOR type device - * for ML workloads, and reserve GPU for graphical rendering. - * - * @param device The representation of the specified device. - * @param type The returned {@link DeviceTypeCode} of the specified device. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ - int (*ANeuralNetworksDevice_getType)(const ANeuralNetworksDevice* device, - int32_t* type); - - /** - * Get the supported operations for a specified set of devices. If multiple - * devices are selected, the supported operation list is a union of supported - * operations of all selected devices. - * - * @param model The model to be queried. - * @param devices The set of devices. Must not contain duplicates. - * @param numDevices The number of devices in the set. - * @param supportedOps The boolean array to be filled. True means supported. - * The size of the boolean array must be at least as large - * as the number of operations in the model. The order of - * elements in the supportedOps array matches the order in - * which the corresponding operations were added to the - * model. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ - int (*ANeuralNetworksModel_getSupportedOperationsForDevices)( - const ANeuralNetworksModel* model, - const ANeuralNetworksDevice* const* devices, uint32_t numDevices, - bool* supportedOps); - - /** - * Create a {@link ANeuralNetworksCompilation} to compile the given model for - * a specified set of devices. If more than one device is specified, the - * compilation will distribute the workload automatically across the devices. - * The model must be fully supported by the specified set of devices. This - * means that ANeuralNetworksModel_getSupportedOperationsForDevices() must - * have returned true for every operation for that model/devices pair. - * - * @param model The {@link ANeuralNetworksModel} to be compiled. - * @param devices The set of devices. Must not contain duplicates. - * @param numDevices The number of devices in the set. - * @param compilation The newly created object or NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA - * if the model is invalid. - * - * Available since API level 29. - */ - int (*ANeuralNetworksCompilation_createForDevices)( - ANeuralNetworksModel* model, const ANeuralNetworksDevice* const* devices, - uint32_t numDevices, ANeuralNetworksCompilation** compilation); - - /** - * Sets the compilation caching signature and the cache directory. - * - * Provides optional caching information to the runtime for faster repeated - * compilation. - * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * @param compilation The compilation to be modified. - * @param cacheDir The cache directory to store and retrieve caching data. It - * is recommended to use the code_cache provided by the - * Android runtime. If not using the code_cache, the user - * should choose a directory local to the application, and is - * responsible to manage and clean the cache entries. - * @param token The token provided by the user to specify a model, must be of - * length ANEURALNETWORKS_BYTE_SIZE_OF_CACHE_TOKEN. The user - * should ensure that the token is unique to a model within the - * application. The NNAPI runtime will not detected token - * collisions. If there is a collision, the compilation outcome - * may be incorrect without notifying with error. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ - int (*ANeuralNetworksCompilation_setCaching)( - ANeuralNetworksCompilation* compilation, const char* cacheDir, - const uint8_t* token); - - /** - * Set the maximum expected duration for compiling the model. - * - * If the device is not able to complete the compilation within the specified - * duration, the compilation may be aborted. The timeout duration begins at - * the call to {@link ANeuralNetworksCompilation_finish}. - * - * This timeout duration acts as a hint to drivers, and can be used to both - * free up compute resources within the driver and return control back to the - * application quicker than is possible without the hint. It enables drivers - * that are able to estimate how long a compilation will take to abort the - * compilation before it has even started if the driver believes the - * compilation cannot be completed within the timeout duration. Similarly, it - * enables drivers to abort an ongoing compilation if it is taking too long. - * However, this call does not guarantee that the compilation will complete or - * abort within the timeout duration. - * - * By default (i.e., unless ANeuralNetworksCompilation_setTimeout is called), - * the timeout duration for compiling the model is considered infinite. - * - * The {@link ANeuralNetworksCompilation} must have been created with - * {@link ANeuralNetworksCompilation_createForDevices} with numDevices = 1, - * otherwise this function will fail with ANEURALNETWORKS_BAD_DATA. If the - * device has a feature level reported by - * {@link ANeuralNetworksDevice_getFeatureLevel} that is lower than 30, then - * the timeout duration hint will be ignored. - * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * @param compilation The compilation to be modified. - * @param duration The maximum amount of time in nanoseconds that is expected - * to be spent finishing a compilation. If this duration is exceeded, the - * compilation may be aborted. If set to 0, the timeout duration is - * considered infinite. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 30. - */ - int (*ANeuralNetworksCompilation_setTimeout)( - ANeuralNetworksCompilation* compilation, uint64_t duration); - - /** - * Set the execution priority. - * - * Execution priorities are relative to other executions created by the same - * application (specifically same uid) for the same device. Specifically, - * priorities of executions from one application will not affect executions - * from another application. Similarly, priorities of executions on one device - * will not affect executions on another device. - * - * Higher priority executions may use more compute resources than lower - * priority executions, and may preempt or starve lower priority executions. - * - * See {@link ANeuralNetworksCompilation} for information on multithreaded - * usage. - * - * Available since API level 30. - * - * @param compilation The compilation to be modified. - * @param priority The relative priority of the execution compared to other - * executions created by the application. Must be one of - * ANEURALNETWORKS_PRIORITY_*. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksCompilation_setPriority)( - ANeuralNetworksCompilation* compilation, int priority); - - /** - * Schedule synchronous evaluation of the execution. - * - *

Schedules synchronous evaluation of the execution. Returns once the - * execution has completed and the outputs are ready to be consumed. - *

- * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * See {@link ANeuralNetworksExecution_startCompute} for asynchronous - * execution. Synchronous execution incurs lower overhead than asynchronous - * execution. - * - * Available since API level 29. - * - * @param execution The execution to be scheduled and executed. - * - * @return ANEURALNETWORKS_NO_ERROR if the execution completed normally. - * ANEURALNETWORKS_UNMAPPABLE if the execution input or output memory - * cannot be properly mapped. - */ - int (*ANeuralNetworksExecution_compute)(ANeuralNetworksExecution* execution); - - /** - * Set the maximum expected duration of the specified execution. - * - * If the device is not able to complete the execution within the specified - * duration, the execution may be aborted. The timeout duration begins at a - * call to one of: - * - {@link ANeuralNetworksExecution_burstCompute} - * - {@link ANeuralNetworksExecution_compute} - * - {@link ANeuralNetworksExecution_startCompute} - * - {@link ANeuralNetworksExecution_startComputeWithDependencies} - * - * This timeout duration acts as a hint to drivers, and can be used to both - * free up compute resources within the driver and return control back to the - * application quicker than is possible without the hint. It enables drivers - * that are able to estimate how long an execution will take to abort the - * execution before it has even started if the driver believes the execution - * cannot be completed within the timeout duration. Similarly, it enables - * drivers to abort an ongoing execution if it is taking too long. However, - * this call does not guarantee that the execution will complete or abort - * within the timeout duration. - * - * By default (i.e., unless ANeuralNetworksExecution_setTimeout is called), - * the timeout duration for execution is considered infinite. - * - * The {@link ANeuralNetworksExecution} must have been created from an - * {@link ANeuralNetworksCompilation} which in turn was created from - * {@link ANeuralNetworksCompilation_createForDevices} with numDevices = 1, - * otherwise this function will fail with ANEURALNETWORKS_BAD_DATA. If the - * device has a feature level reported by - * {@link ANeuralNetworksDevice_getFeatureLevel} that is lower than 30, then - * the timeout duration hint will be ignored. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * @param execution The execution to be modified. - * @param duration The maximum amount of time in nanoseconds that is expected - * to be spent executing a model. If this duration is exceeded, the execution - * may be aborted. If set to 0, the timeout duration is considered - * infinite. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 30. - */ - int (*ANeuralNetworksExecution_setTimeout)( - ANeuralNetworksExecution* execution, uint64_t duration); - - /** - * Set the maximum duration of WHILE loops in the specified execution. - * - * This is a fuzzy per-loop timeout intended to prevent infinite loops. - * - * If a WHILE loop condition model does not output false within the specified - * duration, the execution will be aborted. - * - * See {@link ANeuralNetworks_getDefaultLoopTimeout} and - * {@link ANeuralNetworks_getMaximumLoopTimeout} for the default - * and maximum timeout values. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * @param execution The execution to be modified. - * @param duration The maximum amount of time in nanoseconds that can be spent - * executing a WHILE loop. If the specified duration value exceeds the - * value produced by {@link ANeuralNetworks_getMaximumLoopTimeout}, it will be - * overridden by that value. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * ANEURALNETWORKS_BAD_STATE if execution has started. - * ANEURALNETWORKS_UNEXPECTED_NULL if execution is NULL. - * - * Available since API level 30. - */ - int (*ANeuralNetworksExecution_setLoopTimeout)( - ANeuralNetworksExecution* execution, uint64_t duration); - - /** - * Get the dimensional information of the specified output operand of the - * model of the - * {@link ANeuralNetworksExecution}. - * - * On asynchronous execution initiated by {@link - * ANeuralNetworksExecution_startCompute}, - * {@link ANeuralNetworksEvent_wait} must be called prior to this function to - * recuperate the resources used by the execution. - * - * @param execution The execution to be queried. - * @param index The index of the output argument we are querying. It is - * an index into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is - * not the index associated with - * {@link ANeuralNetworksModel_addOperand}. - * @param rank The rank of the output operand. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, - * ANEURALNETWORKS_OUTPUT_INSUFFICIENT_SIZE if the target output is - * provided an insufficient buffer at execution time, - * ANEURALNETWORKS_BAD_DATA if the index is invalid. - * - * Available since API level 29. - */ - int (*ANeuralNetworksExecution_getOutputOperandRank)( - ANeuralNetworksExecution* execution, int32_t index, uint32_t* rank); - - /** - * Get the dimensional information of the specified output operand of the - * model of the - * {@link ANeuralNetworksExecution}. The target output operand cannot be a - * scalar. - * - * On asynchronous execution initiated by {@link - * ANeuralNetworksExecution_startCompute}, - * {@link ANeuralNetworksEvent_wait} must be called prior to this function to - * recuperate the resources used by the execution. - * - * @param execution The execution to be queried. - * @param index The index of the output argument we are querying. It is an - * index into the lists passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is - * not the index associated with - * {@link ANeuralNetworksModel_addOperand}. - * @param dimensions The dimension array to be filled. The size of the array - * must be exactly as large as the rank of the output - * operand to be queried in the model. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, - * ANEURALNETWORKS_OUTPUT_INSUFFICIENT_SIZE if the target output is - * provided an insufficient buffer at execution time, - * ANEURALNETWORKS_BAD_DATA if the index is invalid or if the target - * is a scalar. - * - * Available since API level 29. - */ - int (*ANeuralNetworksExecution_getOutputOperandDimensions)( - ANeuralNetworksExecution* execution, int32_t index, uint32_t* dimensions); - - /** - * Create a {@link ANeuralNetworksBurst} to apply the given compilation. - * This only creates the burst object. Computation is only performed once - * {@link ANeuralNetworksExecution_burstCompute} is invoked with a valid - * {@link ANeuralNetworksExecution} and {@link ANeuralNetworksBurst}. - * - *

The provided compilation must outlive the burst object.

- * - * Available since API level 29. - * - * @param compilation The {@link ANeuralNetworksCompilation} to be evaluated. - * @param burst The newly created object or NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful, ANEURALNETWORKS_BAD_DATA - * if the compilation is invalid. - */ - int (*ANeuralNetworksBurst_create)(ANeuralNetworksCompilation* compilation, - ANeuralNetworksBurst** burst); - - /** - * Destroys the burst object. - * - * Available since API level 29. - * - * @param burst The burst object to be destroyed. Passing NULL is acceptable - * and results in no operation. - */ - void (*ANeuralNetworksBurst_free)(ANeuralNetworksBurst* burst); - - /** - * Schedule synchronous evaluation of the execution on a burst object. - * - *

Schedules synchronous evaluation of the execution. Returns once the - * execution has completed and the outputs are ready to be consumed.

- * - *

There must be at most one {@link ANeuralNetworksExecution} processing at - * any given time for any given burst object. Any - * {@link ANeuralNetworksExecution} launched before the previous has finished - * will result in ANEURALNETWORKS_BAD_STATE.

- * - * Available since API level 29. - * - * @param burst The burst object to execute on. - * @param execution The execution to be scheduled and executed. The execution - * must be created from the same {@link - * ANeuralNetworksCompilation} as the burst object. - * - * @return ANEURALNETWORKS_NO_ERROR if the execution completed normally. - */ - int (*ANeuralNetworksExecution_burstCompute)( - ANeuralNetworksExecution* execution, ANeuralNetworksBurst* burst); - - /** - * Creates a shared memory object from an AHardwareBuffer handle. - * - * If the shared memory is backed by an AHardwareBuffer of - * AHARDWAREBUFFER_FORMAT_BLOB format, it can be used the same way as - * shared memory created from a file handle. See - * {@link ANeuralNetworksMemory} for a description on how to use this - * shared memory. - * - * If the shared memory is backed by an AHardwareBuffer of a format other - * than AHARDWAREBUFFER_FORMAT_BLOB, it can only be used for Model inputs - * and outputs. When calling - * {@link ANeuralNetworksExecution_setInputFromMemory} or - * {@link ANeuralNetworksExecution_setOutputFromMemory} with the shared - * memory, both offset and length must be set to zero and the entire - * memory region will be associated with the specified input or output - * operand. There is no guarantee that an arbitrary AHardwareBuffer_Format - * and AHardwareBuffer_UsageFlags combination can be used by arbitrary - * devices. The execution will fail if selected set of devices cannot - * consume the buffer. - * - * Calling {@link ANeuralNetworksModel_setOperandValueFromMemory} with - * shared memory backed by an AHardwareBuffer of a format other than - * AHARDWAREBUFFER_FORMAT_BLOB is disallowed. - * - * TODO(miaowang): add documentation about intended usage with - * introspection API. - * - * Available since API level 29. - * - * @param ahwb The AHardwareBuffer handle. - * @param memory The memory object to be created. - * Set to NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if the request completed normally. - * - * @see AHardwareBuffer - */ - int (*ANeuralNetworksMemory_createFromAHardwareBuffer)( - const AHardwareBuffer* ahwb, ANeuralNetworksMemory** memory); - - /** - * Specifies whether duration of the {@link ANeuralNetworksExecution} is to be - * measured. By default, duration is not measured. - * - * The {@link ANeuralNetworksExecution} must have been created with - * {@link ANeuralNetworksCompilation_createForDevices} with numDevices = 1. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * Available since API level 29. - * - * @param execution The execution to be modified. - * @param measure 'true' if duration is to be measured, 'false' if not. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksExecution_setMeasureTiming)( - ANeuralNetworksExecution* execution, bool measure); - - /** - * Get the time spent in the specified {@link ANeuralNetworksExecution}, in - * nanoseconds. The execution must have completed. - * - * @param execution The execution to be queried. - * @param durationCode The measurement to be queried, specified by {@link - * DurationCode}. - * @param duration The returned duration. If no measurement was requested by - * {@link ANeuralNetworksExecution_setMeasureTiming}, or for - * some other reason the duration is not available, UINT64_MAX will be - * returned. A particular device need not support any given measurement. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksExecution_getDuration)( - const ANeuralNetworksExecution* execution, int32_t durationCode, - uint64_t* duration); - - /** - * Queries whether an extension is supported by the driver implementation of - * the specified device. - * - * @param device The representation of the specified device. - * @param isExtensionSupported The boolean value indicating whether the - * extension is supported. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 29. - */ - int (*ANeuralNetworksDevice_getExtensionSupport)( - const ANeuralNetworksDevice* device, const char* extensionName, - bool* isExtensionSupported); - - /** - * Creates an operand type from an extension name and an extension operand - * code. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * Available since API level 29. - * - * @param model The model to contain the operand. - * @param extensionName The extension name. - * @param operandCodeWithinExtension The extension operand code. - * @param type The operand type. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_getExtensionOperandType)( - ANeuralNetworksModel* model, const char* extensionName, - uint16_t operandCodeWithinExtension, int32_t* type); - - /** - * Creates an operation type from an extension name and an extension operation - * code. - * - * See {@link ANeuralNetworksModel} for information on multithreaded usage. - * - * Available since API level 29. - * - * @param model The model to contain the operation. - * @param extensionName The extension name. - * @param operationCodeWithinExtension The extension operation code. - * @param type The operation type. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_getExtensionOperationType)( - ANeuralNetworksModel* model, const char* extensionName, - uint16_t operationCodeWithinExtension, - ANeuralNetworksOperationType* type); - - /** - * Sets extension operand parameters. - * - * Available since API level 29. - * - * @param model The model to be modified. - * @param index The index of the model operand we're setting. - * @param data A pointer to the extension operand data. - * The data does not have to outlive the call to this function. - * @param length The size in bytes of the data value. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksModel_setOperandExtensionData)( - ANeuralNetworksModel* model, int32_t index, const void* data, - size_t length); - - /** - * Create a {@link ANeuralNetworksMemoryDesc} with no properties. - * - * This only creates the memory descriptor. Its properties should be set with - * calls to - * {@link ANeuralNetworksMemoryDesc_addInputRole}, - * {@link ANeuralNetworksMemoryDesc_addOutputRole}, and - * {@link ANeuralNetworksMemoryDesc_setDimensions}. - * - * {@link ANeuralNetworksMemoryDesc_finish} must be called once all properties - * have been set. - * - * {@link ANeuralNetworksMemoryDesc_free} must be called once the memory - * descriptor is no longer needed. - * - * Available since API level 30. - * - * @param desc The {@link ANeuralNetworksMemoryDesc} to be created. - * Set to NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksMemoryDesc_create)(ANeuralNetworksMemoryDesc** desc); - - /** - * Destroy a memory descriptor. - * - * The memory descriptor need not have been finished by a call to - * {@link ANeuralNetworksMemoryDesc_finish}. - * - * See {@link ANeuralNetworksMemoryDesc} for information on multithreaded - * usage. - * - * Available since API level 30. - * - * @param desc The memory descriptor to be destroyed. Passing NULL is - * acceptable and results in no operation. - */ - void (*ANeuralNetworksMemoryDesc_free)(ANeuralNetworksMemoryDesc* desc); - - /** - * Specify that a memory object will be playing the role of an input to an - * execution created from a particular compilation. - * - * The compilation and the input index fully specify an input operand. This - * function may be invoked multiple times on the same memory descriptor with - * different input operands, and the same input operand may be specified on - * multiple memory descriptors. However, specifying the same input operand on - * the same memory descriptor more than once will return an error. - * - * The dimensions of the corresponding model operands of all the roles - * specified by - * {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole} must be compatible with - * each other. Two dimensions are incompatible if both ranks are fully - * specified but have different values, or if there is at least one axis that - * is fully specified in both but has different values. - * - * At least one of {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole} must be called on a memory - * descriptor before invoking {@link ANeuralNetworksMemoryDesc_finish}. - * - * Attempting to modify a memory descriptor once - * {@link ANeuralNetworksMemoryDesc_finish} has been called will return an - * error. - * - * See {@link ANeuralNetworksMemoryDesc} for information on multithreaded - * usage. - * - * Available since API level 30. - * - * @param desc The memory descriptor to be modified. - * @param compilation The compilation object. It must already have been - * finished by calling {@link ANeuralNetworksCompilation_finish}, and must - * outlive the memory descriptor. - * @param index The index of the input argument we are referencing from the - * compilation. It is an index into the inputs list passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is - * not the index associated with {@link ANeuralNetworksModel_addOperand}. - * @param frequency A floating-point value within the range (0.0, 1.0]. - * Describes how likely the memory is to be used in the specified role. This - * is provided as a hint to optimize the case when different roles prefer - * different memory locations or data layouts. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksMemoryDesc_addInputRole)( - ANeuralNetworksMemoryDesc* desc, - const ANeuralNetworksCompilation* compilation, int32_t index, - float frequency); - - /** - * Specify that a memory object will be playing the role of an output to an - * execution created from a particular compilation. - * - * The compilation and the output index fully specify an output operand. This - * function may be invoked multiple times on the same memory descriptor with - * different output operands, and the same output operand may be specified on - * multiple memory descriptors. However, specifying the same output operand on - * the same memory descriptor object more than once will return an error. - * - * The dimensions of the corresponding model operands of all the roles - * specified by - * {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole} must be compatible with - * each other. Two dimensions are incompatible if both ranks are fully - * specified but have different values, or if there is at least one axis that - * is fully specified in both but has different values. - * - * At least one of {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole} must be called on the - * memory descriptor before invoking {@link ANeuralNetworksMemoryDesc_finish}. - * - * Attempting to modify a memory descriptor once - * {@link ANeuralNetworksMemoryDesc_finish} has been called will return an - * error. - * - * See {@link ANeuralNetworksMemoryDesc} for information on multithreaded - * usage. - * - * Available since API level 30. - * - * @param desc The memory descriptor to be modified. - * @param compilation The compilation object. It must already have been - * finished by calling {@link ANeuralNetworksCompilation_finish}, and must - * outlive the memory descriptor. - * @param index The index of the output argument we are referencing from the - * compilation. It is an index into the outputs list passed to - * {@link ANeuralNetworksModel_identifyInputsAndOutputs}. It is - * not the index associated with {@link ANeuralNetworksModel_addOperand}. - * @param frequency A floating-point value within the range (0.0, 1.0]. - * Describes how likely the memory is to be used in the specified role. This - * is provided as a hint to optimize the case when multiple roles prefer - * different memory locations or data layouts. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksMemoryDesc_addOutputRole)( - ANeuralNetworksMemoryDesc* desc, - const ANeuralNetworksCompilation* compilation, uint32_t index, - float frequency); - - /** - * Set the dimensional information of the memory descriptor. - * - * The specified dimensions must be compatible with the dimensions of the - * corresponding model operands of all the roles specified by - * {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole}. Two dimensions are - * incompatible if both ranks are fully specified but have different values, - * or if there is at least one axis that is fully specified in both but has - * different values. - * - * Attempting to modify a memory descriptor once - * {@link ANeuralNetworksMemoryDesc_finish} has been called will return an - * error. - * - * See {@link ANeuralNetworksMemoryDesc} for information on multithreaded - * usage. - * - * Available since API level 30. - * - * @param desc The memory descriptor to be modified. - * @param rank The number of dimensions. Must be 0 for scalars. - * @param dimensions An array of dimensions. An entry with the value 0 - * indicates that the corresponding axis has an unknown size. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksMemoryDesc_setDimensions)( - ANeuralNetworksMemoryDesc* desc, uint32_t rank, - const uint32_t* dimensions); - - /** - * Indicate that we have finished modifying a memory descriptor. Required - * before calling - * {@link ANeuralNetworksMemory_createFromDesc}. - * - * This function must only be called once for a given memory descriptor. - * - * See {@link ANeuralNetworksMemoryDesc} for information on multithreaded - * usage. - * - * Available since API level 30. - * - * @param desc The memory descriptor to be finished. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksMemoryDesc_finish)(ANeuralNetworksMemoryDesc* desc); - - /** - * Creates a memory object from a memory descriptor. - * - * The memory object is created with an uninitialized buffer. A memory object - * with an uninitialized buffer may only be used according to the roles - * specified by - * {@link ANeuralNetworksMemoryDesc_addOutputRole}, or as the destination - * memory in - * {@link ANeuralNetworksMemory_copy}. The buffer of a memory object is - * initialized after the memory object is used as an output in a successful - * execution, or used as the destination memory in a successful {@link - * ANeuralNetworksMemory_copy}. A memory object with an initialized buffer may - * be used according to all roles specified in - * {@link ANeuralNetworksMemoryDesc}, or as the source or destination memory - * in - * {@link ANeuralNetworksMemory_copy}. The buffer of a memory object will - * return to the uninitialized state if the memory object is used as an output - * in a failed execution, or used as the destination memory in a failed {@link - * ANeuralNetworksMemory_copy}. - * - * The dimensions of the memory descriptor are deduced from the dimensions of - * the corresponding model operands of all the roles specified by - * {@link ANeuralNetworksMemoryDesc_addInputRole} and - * {@link ANeuralNetworksMemoryDesc_addOutputRole}, as well as the dimensions - * set by the call to {@link ANeuralNetworksMemoryDesc_setDimensions}, if any. - * The memory descriptor may have unspecified dimensions or rank. In such a - * case, the same memory object may be used with different shapes of outputs - * in different executions. When the memory is used as an input, the input - * shape must be the same as the output shape from the last execution using - * this memory object as an output, or the last - * {@link ANeuralNetworkMemory_copy} using this memory object as the - * destination memory. Creating a memory object with unspecified dimensions or - * rank may fail for certain sets of roles. - * - * Using the memory in roles or shapes that are not compatible with the rules - * specified above will return an error. - * - * When calling {@link ANeuralNetworksExecution_setInputFromMemory} or - * {@link ANeuralNetworksExecution_setOutputFromMemory} with the memory - * object, both offset and length must be set to zero and the entire memory - * region will be associated with the specified input or output operand. - * - * Calling {@link ANeuralNetworksModel_setOperandValueFromMemory} with the - * memory created from this function will return an error. - * - * {@link ANeuralNetworksMemory_free} must be called once the memory is no - * longer needed. - * - * Attempting to create memory from an unfinished memory descriptor will - * return an error. - * - * The provided {@link ANeuralNetworksMemoryDesc} need not outlive the - * {@link ANeuralNetworksMemory} object. - * - * Available since API level 30. - * - * @param desc The memory descriptor. - * @param memory The memory object to be created. - * Set to NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful; ANEURALNETWORKS_OP_FAILED - * if the memory is created with unspecified dimensions or rank and it is not - * supported for this set of roles. - */ - int (*ANeuralNetworksMemory_createFromDesc)( - const ANeuralNetworksMemoryDesc* desc, ANeuralNetworksMemory** memory); - - /** - * Copies data from one memory object to another. - * - * If at most one of the src and dst is created from - * {@link ANeuralNetworksMemory_createFromDesc}, the src and dst must have the - * same logical size: - * - If the memory is created from {@link ANeuralNetworksMemory_createFromFd}, - * or if it is created from {@link - * ANeuralNetworksMemory_createFromAHardwareBuffer} with format of - * AHARDWAREBUFFER_FORMAT_BLOB, the logical size equals the size of the - * memory. - * - If the memory is created from - * {@link ANeuralNetworksMemory_createFromAHardwareBuffer} with a format - * other than AHARDWAREBUFFER_FORMAT_BLOB, the logical size equals the size - * when there is no padding and the data is tightly packed. This function may - * fail if the AHardwareBuffer cannot be accessed. - * - If the memory is created from {@link - * ANeuralNetworksMemory_createFromDesc}, the logical size equals the size - * indicated by the {@link OperandCode} multiplied by the number of elements. - * This function will fail if the number of elements is unknown. - * - * If both src and dst are created from {@link - * ANeuralNetworksMemory_createFromDesc}, they must have compatible - * dimensions. Two dimensions are incompatible if both ranks are fully - * specified but have different values, or if there is at least one axis that - * is fully specified in both but has different values. The dst may have - * unspecified dimensions or rank. In such a case, the dimensions of dst will - * get updated according to the dimensions of the src. - * - * In both cases, if the src is created from - * {@link ANeuralNetworksMemory_createFromDesc}, it must have been used as an - * output in a successful execution, or used as the destination memory in a - * successful - * {@link ANeuralNetworksMemory_copy}. - * - * The src and dst may have different data layout, in which case the data - * copying is performed logically with data layout transformation. - * - * Available since API level 30. - * - * @param src The source memory object. - * @param dst The destination memory object. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - */ - int (*ANeuralNetworksMemory_copy)(const ANeuralNetworksMemory* src, - const ANeuralNetworksMemory* dst); - - /** - * Create a {@link ANeuralNetworksEvent} from a sync_fence file descriptor. - * - * The newly created ANeuralNetworksEvent does not take ownership of the - * provided sync_fence_fd, it will instead dup the provided sync_fence_fd and - * own the duplicate. - * - * @param sync_fence_fd The sync_fence file descriptor. - * @param event The newly created object or NULL if unsuccessful. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 30. - */ - int (*ANeuralNetworksEvent_createFromSyncFenceFd)( - int sync_fence_fd, ANeuralNetworksEvent** event); - - /** - * Get sync_fence file descriptor from the event. - * - * If the ANeuralNetworksEvent is not backed by a sync fence, the - * sync_fence_fd will be set to -1, and ANEURALNETWORKS_BAD_DATA will be - * returned. - * - * See {@link ANeuralNetworksEvent_createFromSyncFenceFd} and - * {@link ANeuralNetworksExecution_startComputeWithDependencies} to see how to - * create an event backed by a sync fence. - * - * The user takes ownership of the returned fd, and must close the returned - * file descriptor when it is no longer needed. - * - * @param event An event that is backed by a sync fence. - * @param sync_fence_fd The sync_fence file descriptor. The file descriptor - * will be set to -1 if there is an error. - * - * @return ANEURALNETWORKS_NO_ERROR if successful. - * - * Available since API level 30. - */ - int (*ANeuralNetworksEvent_getSyncFenceFd)(const ANeuralNetworksEvent* event, - int* sync_fence_fd); - - /** - * Schedule asynchronous evaluation of the execution with dependencies. - * - * The execution will wait for all the depending events to be signaled before - * starting the evaluation. Once the execution has completed and the outputs - * are ready to be consumed, the returned event will be signaled. Depending on - * which devices are handling the execution, the event could be backed by a - * sync fence. Use {@link ANeuralNetworksEvent_wait} to wait for that event. - * - * ANeuralNetworksEvent_wait must be called to recurperate the resources used - * by the execution. - * - * If parts of the execution are scheduled on devices that do not support - * fenced execution, the function call may wait for such parts to finish - * before returning. - * - * The function will return an error if any of the events in dependencies is - * already in a bad state. After the execution is scheduled, if any of the - * events in dependencies does not complete normally, the execution will fail, - * and {@link ANeuralNetworksEvent_wait} on the returned event will return an - * error. - * - * The function will return an error if any of the execution outputs has a - * tensor operand type that is not fully specified. - * - * The function can be passed a timeout duration in nanoseconds. This timeout - * duration acts as a hint to drivers in the same way that the timeout - * durations in {@link ANeuralNetworksCompilation_setTimeout} and {@link - * ANeuralNetworksExecution_setTimeout} act as hints to drivers. The duration - * begins when all waitFor sync fences have been signaled, and can be used - * together with {@link ANeuralNetworksExecution_setTimeout} which specifies - * the maximum timeout duration beginning at the call to - * {@link ANeuralNetworksExecution_startComputeWithDependencies}. - * If the duration is non-zero, the {@link ANeuralNetworksExecution} must have - * been created from an {@link ANeuralNetworksCompilation} which in turn was - * created from - * {@link ANeuralNetworksCompilation_createForDevices} with numDevices = 1, - * otherwise this function will fail with ANEURALNETWORKS_BAD_DATA. If either - * the timeout duration from {@link ANeuralNetworksExecution_setTimeout} or - * the timeout duration passed to this call is exceeded, the execution may be - * aborted, in which case {@link ANEURALNETWORKS_MISSED_DEADLINE_*} will be - * returned through {@link - * ANeuralNetworksExecution_startComputeWithDependencies} or {@link - * ANeuralNetworksEvent_wait} on the event object. If the device has a feature - * level reported by {@link ANeuralNetworksDevice_getFeatureLevel} that is - * lower than 30, then the timeout duration hints will be ignored. - * - * If this execution contains a {@link ANEURALNETWORKS_WHILE} operation, and - * the condition model does not output false within the loop timeout duration, - * then execution will be aborted and {@link - * ANEURALNETWORKS_MISSED_DEADLINE_*} will be returned through {@link - * ANeuralNetworksEvent_wait} on the event object. - * - * See {@link ANeuralNetworksExecution} for information on multithreaded - * usage. - * - * See {@link ANeuralNetworksExecution_compute} for synchronous execution. - * See {@link ANeuralNetworksExecution_burstCompute} for burst synchronous - * execution. See {@link ANeuralNetworksExecution_startCompute} for regular - * asynchronous execution. - * - * @param execution The execution to be scheduled and executed. - * @param dependencies A set of depending events. The actual evaluation will - * not start until all the events are signaled. - * @param num_dependencies The number of events in the dependencies set. - * @param duration The maximum amount of time in nanoseconds that is expected - * to be spent executing the model after all dependencies are signaled. If set - * to 0, the timeout duration is considered infinite. - * @param event The event that will be signaled on completion. event is set to - * NULL if there's an error. - * - * @return ANEURALNETWORKS_NO_ERROR if the evaluation is successfully - * scheduled. - * - * Available since API level 30. - */ - int (*ANeuralNetworksExecution_startComputeWithDependencies)( - ANeuralNetworksExecution* execution, - const ANeuralNetworksEvent* const* dependencies, - uint32_t num_dependencies, uint64_t duration, - ANeuralNetworksEvent** event); -}; - -/** - * Load the NNAPI implementation from the shared libraries. - * The NnApi structure is filled with all the pointers. If one function doesn't - * exist, a null pointer is stored. - */ -const NnApi* NnApiImplementation(); - -#endif // TENSORFLOW_LITE_NNAPI_NNAPI_IMPLEMENTATION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/nnapi_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/nnapi_util.h deleted file mode 100644 index f4277d1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/nnapi/nnapi_util.h +++ /dev/null @@ -1,38 +0,0 @@ -/* 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. -==============================================================================*/ - -// This file provides general C++ utility functions for interacting with NNAPI. - -#ifndef TENSORFLOW_LITE_NNAPI_NNAPI_UTIL_H_ -#define TENSORFLOW_LITE_NNAPI_NNAPI_UTIL_H_ - -#include -#include - -namespace tflite { -namespace nnapi { - -// Return std::vector consisting of pointers to null-terminated device names. -// These names are guaranteed valid for the lifetime of the application. -std::vector GetDeviceNamesList(); - -// Return a string containing the names of all available devices. -// Will take the format: "DeviceA,DeviceB,DeviceC" -std::string GetStringDeviceNamesList(); - -} // namespace nnapi -} // namespace tflite - -#endif // TENSORFLOW_LITE_NNAPI_NNAPI_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/op_resolver.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/op_resolver.h deleted file mode 100644 index 96490d4..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/op_resolver.h +++ /dev/null @@ -1,22 +0,0 @@ -/* Copyright 2018 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. -==============================================================================*/ -// Compatibility shim for moved header location. -#ifndef TENSORFLOW_LITE_OP_RESOLVER_H_ -#define TENSORFLOW_LITE_OP_RESOLVER_H_ - -#include "tensorflow/lite/core/api/op_resolver.h" -#include "tensorflow/lite/mutable_op_resolver.h" - -#endif // TENSORFLOW_LITE_OP_RESOLVER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/optional_debug_tools.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/optional_debug_tools.h deleted file mode 100644 index 2337f8c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/optional_debug_tools.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2017 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. -==============================================================================*/ -/// \file -/// Optional debugging functionality. -/// For small sized binaries, these are not needed. -#ifndef TENSORFLOW_LITE_OPTIONAL_DEBUG_TOOLS_H_ -#define TENSORFLOW_LITE_OPTIONAL_DEBUG_TOOLS_H_ - -#include "tensorflow/lite/interpreter.h" - -namespace tflite { - -// Prints a dump of what tensors and what nodes are in the interpreter. -void PrintInterpreterState(Interpreter* interpreter); - -} // namespace tflite - -#endif // TENSORFLOW_LITE_OPTIONAL_DEBUG_TOOLS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/portable_type_to_tflitetype.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/portable_type_to_tflitetype.h deleted file mode 100644 index 208efcc..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/portable_type_to_tflitetype.h +++ /dev/null @@ -1,74 +0,0 @@ -/* 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_PORTABLE_TYPE_TO_TFLITETYPE_H_ -#define TENSORFLOW_LITE_PORTABLE_TYPE_TO_TFLITETYPE_H_ - -// Most of the definitions have been moved to this subheader so that Micro -// can include it without relying on , which isn't available on all -// platforms. - -// Arduino build defines abs as a macro here. That is invalid C++, and breaks -// libc++'s header, undefine it. -#ifdef abs -#undef abs -#endif - -#include - -#include "tensorflow/lite/c/common.h" - -namespace tflite { - -// Map statically from a C++ type to a TfLiteType. Used in interpreter for -// safe casts. -// Example: -// typeToTfLiteType() -> kTfLiteBool -template -constexpr TfLiteType typeToTfLiteType() { - return kTfLiteNoType; -} -// Map from TfLiteType to the corresponding C++ type. -// Example: -// TfLiteTypeToType::Type -> bool -template -struct TfLiteTypeToType {}; // Specializations below - -// Template specialization for both typeToTfLiteType and TfLiteTypeToType. -#define MATCH_TYPE_AND_TFLITE_TYPE(CPP_TYPE, TFLITE_TYPE_ENUM) \ - template <> \ - constexpr TfLiteType typeToTfLiteType() { \ - return TFLITE_TYPE_ENUM; \ - } \ - template <> \ - struct TfLiteTypeToType { \ - using Type = CPP_TYPE; \ - } - -// No string mapping is included here, since the TF Lite packed representation -// doesn't correspond to a C++ type well. -MATCH_TYPE_AND_TFLITE_TYPE(int, kTfLiteInt32); -MATCH_TYPE_AND_TFLITE_TYPE(int16_t, kTfLiteInt16); -MATCH_TYPE_AND_TFLITE_TYPE(int64_t, kTfLiteInt64); -MATCH_TYPE_AND_TFLITE_TYPE(float, kTfLiteFloat32); -MATCH_TYPE_AND_TFLITE_TYPE(unsigned char, kTfLiteUInt8); -MATCH_TYPE_AND_TFLITE_TYPE(int8_t, kTfLiteInt8); -MATCH_TYPE_AND_TFLITE_TYPE(bool, kTfLiteBool); -MATCH_TYPE_AND_TFLITE_TYPE(std::complex, kTfLiteComplex64); -MATCH_TYPE_AND_TFLITE_TYPE(std::complex, kTfLiteComplex128); -MATCH_TYPE_AND_TFLITE_TYPE(TfLiteFloat16, kTfLiteFloat16); -MATCH_TYPE_AND_TFLITE_TYPE(double, kTfLiteFloat64); - -} // namespace tflite -#endif // TENSORFLOW_LITE_PORTABLE_TYPE_TO_TFLITETYPE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/schema/builtin_ops_header/generator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/schema/builtin_ops_header/generator.h deleted file mode 100644 index eca4fe8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/schema/builtin_ops_header/generator.h +++ /dev/null @@ -1,39 +0,0 @@ -/* Copyright 2018 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. -==============================================================================*/ -// An utility library to generate pure C header for builtin ops definition. -#ifndef TENSORFLOW_LITE_SCHEMA_BUILTIN_OPS_HEADER_GENERATOR_H_ -#define TENSORFLOW_LITE_SCHEMA_BUILTIN_OPS_HEADER_GENERATOR_H_ - -#include -#include - -namespace tflite { -namespace builtin_ops_header { - -// Check if the input enum name (from the Flatbuffer definition) is valid. -bool IsValidInputEnumName(const std::string& name); - -// Convert the enum name from Flatbuffer convention to C enum name convention. -// E.g. `L2_POOL_2D` becomes `kTfLiteBuiltinL2Pool2d`. -std::string ConstantizeVariableName(const std::string& name); - -// The function generates a pure C header for builtin ops definition, and write -// it to the output stream. -bool GenerateHeader(std::ostream& os); - -} // namespace builtin_ops_header -} // namespace tflite - -#endif // TENSORFLOW_LITE_SCHEMA_BUILTIN_OPS_HEADER_GENERATOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/schema/schema_generated.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/schema/schema_generated.h deleted file mode 100755 index e7d91a9..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/schema/schema_generated.h +++ /dev/null @@ -1,16755 +0,0 @@ -/* Copyright 2018 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. -==============================================================================*/ -// automatically generated by the FlatBuffers compiler, do not modify - - -#ifndef FLATBUFFERS_GENERATED_SCHEMA_TFLITE_H_ -#define FLATBUFFERS_GENERATED_SCHEMA_TFLITE_H_ - -#include "flatbuffers/flatbuffers.h" - -namespace tflite { - -struct CustomQuantization; -struct CustomQuantizationT; - -struct QuantizationParameters; -struct QuantizationParametersT; - -struct Int32Vector; -struct Int32VectorT; - -struct Uint16Vector; -struct Uint16VectorT; - -struct Uint8Vector; -struct Uint8VectorT; - -struct DimensionMetadata; -struct DimensionMetadataT; - -struct SparsityParameters; -struct SparsityParametersT; - -struct Tensor; -struct TensorT; - -struct Conv2DOptions; -struct Conv2DOptionsT; - -struct Pool2DOptions; -struct Pool2DOptionsT; - -struct DepthwiseConv2DOptions; -struct DepthwiseConv2DOptionsT; - -struct ConcatEmbeddingsOptions; -struct ConcatEmbeddingsOptionsT; - -struct LSHProjectionOptions; -struct LSHProjectionOptionsT; - -struct SVDFOptions; -struct SVDFOptionsT; - -struct RNNOptions; -struct RNNOptionsT; - -struct SequenceRNNOptions; -struct SequenceRNNOptionsT; - -struct BidirectionalSequenceRNNOptions; -struct BidirectionalSequenceRNNOptionsT; - -struct FullyConnectedOptions; -struct FullyConnectedOptionsT; - -struct SoftmaxOptions; -struct SoftmaxOptionsT; - -struct ConcatenationOptions; -struct ConcatenationOptionsT; - -struct AddOptions; -struct AddOptionsT; - -struct MulOptions; -struct MulOptionsT; - -struct L2NormOptions; -struct L2NormOptionsT; - -struct LocalResponseNormalizationOptions; -struct LocalResponseNormalizationOptionsT; - -struct LSTMOptions; -struct LSTMOptionsT; - -struct UnidirectionalSequenceLSTMOptions; -struct UnidirectionalSequenceLSTMOptionsT; - -struct BidirectionalSequenceLSTMOptions; -struct BidirectionalSequenceLSTMOptionsT; - -struct ResizeBilinearOptions; -struct ResizeBilinearOptionsT; - -struct ResizeNearestNeighborOptions; -struct ResizeNearestNeighborOptionsT; - -struct CallOptions; -struct CallOptionsT; - -struct PadOptions; -struct PadOptionsT; - -struct PadV2Options; -struct PadV2OptionsT; - -struct ReshapeOptions; -struct ReshapeOptionsT; - -struct SpaceToBatchNDOptions; -struct SpaceToBatchNDOptionsT; - -struct BatchToSpaceNDOptions; -struct BatchToSpaceNDOptionsT; - -struct SkipGramOptions; -struct SkipGramOptionsT; - -struct SpaceToDepthOptions; -struct SpaceToDepthOptionsT; - -struct DepthToSpaceOptions; -struct DepthToSpaceOptionsT; - -struct SubOptions; -struct SubOptionsT; - -struct DivOptions; -struct DivOptionsT; - -struct TopKV2Options; -struct TopKV2OptionsT; - -struct EmbeddingLookupSparseOptions; -struct EmbeddingLookupSparseOptionsT; - -struct GatherOptions; -struct GatherOptionsT; - -struct TransposeOptions; -struct TransposeOptionsT; - -struct ExpOptions; -struct ExpOptionsT; - -struct CosOptions; -struct CosOptionsT; - -struct ReducerOptions; -struct ReducerOptionsT; - -struct SqueezeOptions; -struct SqueezeOptionsT; - -struct SplitOptions; -struct SplitOptionsT; - -struct SplitVOptions; -struct SplitVOptionsT; - -struct StridedSliceOptions; -struct StridedSliceOptionsT; - -struct LogSoftmaxOptions; -struct LogSoftmaxOptionsT; - -struct CastOptions; -struct CastOptionsT; - -struct DequantizeOptions; -struct DequantizeOptionsT; - -struct MaximumMinimumOptions; -struct MaximumMinimumOptionsT; - -struct TileOptions; -struct TileOptionsT; - -struct ArgMaxOptions; -struct ArgMaxOptionsT; - -struct ArgMinOptions; -struct ArgMinOptionsT; - -struct GreaterOptions; -struct GreaterOptionsT; - -struct GreaterEqualOptions; -struct GreaterEqualOptionsT; - -struct LessOptions; -struct LessOptionsT; - -struct LessEqualOptions; -struct LessEqualOptionsT; - -struct NegOptions; -struct NegOptionsT; - -struct SelectOptions; -struct SelectOptionsT; - -struct SliceOptions; -struct SliceOptionsT; - -struct TransposeConvOptions; -struct TransposeConvOptionsT; - -struct ExpandDimsOptions; -struct ExpandDimsOptionsT; - -struct SparseToDenseOptions; -struct SparseToDenseOptionsT; - -struct EqualOptions; -struct EqualOptionsT; - -struct NotEqualOptions; -struct NotEqualOptionsT; - -struct ShapeOptions; -struct ShapeOptionsT; - -struct RankOptions; -struct RankOptionsT; - -struct PowOptions; -struct PowOptionsT; - -struct FakeQuantOptions; -struct FakeQuantOptionsT; - -struct PackOptions; -struct PackOptionsT; - -struct LogicalOrOptions; -struct LogicalOrOptionsT; - -struct OneHotOptions; -struct OneHotOptionsT; - -struct AbsOptions; -struct AbsOptionsT; - -struct HardSwishOptions; -struct HardSwishOptionsT; - -struct LogicalAndOptions; -struct LogicalAndOptionsT; - -struct LogicalNotOptions; -struct LogicalNotOptionsT; - -struct UnpackOptions; -struct UnpackOptionsT; - -struct FloorDivOptions; -struct FloorDivOptionsT; - -struct SquareOptions; -struct SquareOptionsT; - -struct ZerosLikeOptions; -struct ZerosLikeOptionsT; - -struct FillOptions; -struct FillOptionsT; - -struct FloorModOptions; -struct FloorModOptionsT; - -struct RangeOptions; -struct RangeOptionsT; - -struct LeakyReluOptions; -struct LeakyReluOptionsT; - -struct SquaredDifferenceOptions; -struct SquaredDifferenceOptionsT; - -struct MirrorPadOptions; -struct MirrorPadOptionsT; - -struct UniqueOptions; -struct UniqueOptionsT; - -struct ReverseV2Options; -struct ReverseV2OptionsT; - -struct AddNOptions; -struct AddNOptionsT; - -struct GatherNdOptions; -struct GatherNdOptionsT; - -struct WhereOptions; -struct WhereOptionsT; - -struct ReverseSequenceOptions; -struct ReverseSequenceOptionsT; - -struct MatrixDiagOptions; -struct MatrixDiagOptionsT; - -struct QuantizeOptions; -struct QuantizeOptionsT; - -struct MatrixSetDiagOptions; -struct MatrixSetDiagOptionsT; - -struct IfOptions; -struct IfOptionsT; - -struct WhileOptions; -struct WhileOptionsT; - -struct NonMaxSuppressionV4Options; -struct NonMaxSuppressionV4OptionsT; - -struct NonMaxSuppressionV5Options; -struct NonMaxSuppressionV5OptionsT; - -struct ScatterNdOptions; -struct ScatterNdOptionsT; - -struct SelectV2Options; -struct SelectV2OptionsT; - -struct DensifyOptions; -struct DensifyOptionsT; - -struct SegmentSumOptions; -struct SegmentSumOptionsT; - -struct BatchMatMulOptions; -struct BatchMatMulOptionsT; - -struct CumsumOptions; -struct CumsumOptionsT; - -struct OperatorCode; -struct OperatorCodeT; - -struct Operator; -struct OperatorT; - -struct SubGraph; -struct SubGraphT; - -struct Buffer; -struct BufferT; - -struct Metadata; -struct MetadataT; - -struct TensorMap; -struct TensorMapT; - -struct SignatureDef; -struct SignatureDefT; - -struct Model; -struct ModelT; - -enum TensorType { - TensorType_FLOAT32 = 0, - TensorType_FLOAT16 = 1, - TensorType_INT32 = 2, - TensorType_UINT8 = 3, - TensorType_INT64 = 4, - TensorType_STRING = 5, - TensorType_BOOL = 6, - TensorType_INT16 = 7, - TensorType_COMPLEX64 = 8, - TensorType_INT8 = 9, - TensorType_FLOAT64 = 10, - TensorType_COMPLEX128 = 11, - TensorType_MIN = TensorType_FLOAT32, - TensorType_MAX = TensorType_COMPLEX128 -}; - -inline const TensorType (&EnumValuesTensorType())[12] { - static const TensorType values[] = { - TensorType_FLOAT32, - TensorType_FLOAT16, - TensorType_INT32, - TensorType_UINT8, - TensorType_INT64, - TensorType_STRING, - TensorType_BOOL, - TensorType_INT16, - TensorType_COMPLEX64, - TensorType_INT8, - TensorType_FLOAT64, - TensorType_COMPLEX128 - }; - return values; -} - -inline const char * const *EnumNamesTensorType() { - static const char * const names[13] = { - "FLOAT32", - "FLOAT16", - "INT32", - "UINT8", - "INT64", - "STRING", - "BOOL", - "INT16", - "COMPLEX64", - "INT8", - "FLOAT64", - "COMPLEX128", - nullptr - }; - return names; -} - -inline const char *EnumNameTensorType(TensorType e) { - if (flatbuffers::IsOutRange(e, TensorType_FLOAT32, TensorType_COMPLEX128)) return ""; - const size_t index = static_cast(e); - return EnumNamesTensorType()[index]; -} - -enum QuantizationDetails { - QuantizationDetails_NONE = 0, - QuantizationDetails_CustomQuantization = 1, - QuantizationDetails_MIN = QuantizationDetails_NONE, - QuantizationDetails_MAX = QuantizationDetails_CustomQuantization -}; - -inline const QuantizationDetails (&EnumValuesQuantizationDetails())[2] { - static const QuantizationDetails values[] = { - QuantizationDetails_NONE, - QuantizationDetails_CustomQuantization - }; - return values; -} - -inline const char * const *EnumNamesQuantizationDetails() { - static const char * const names[3] = { - "NONE", - "CustomQuantization", - nullptr - }; - return names; -} - -inline const char *EnumNameQuantizationDetails(QuantizationDetails e) { - if (flatbuffers::IsOutRange(e, QuantizationDetails_NONE, QuantizationDetails_CustomQuantization)) return ""; - const size_t index = static_cast(e); - return EnumNamesQuantizationDetails()[index]; -} - -template struct QuantizationDetailsTraits { - static const QuantizationDetails enum_value = QuantizationDetails_NONE; -}; - -template<> struct QuantizationDetailsTraits { - static const QuantizationDetails enum_value = QuantizationDetails_CustomQuantization; -}; - -struct QuantizationDetailsUnion { - QuantizationDetails type; - void *value; - - QuantizationDetailsUnion() : type(QuantizationDetails_NONE), value(nullptr) {} - QuantizationDetailsUnion(QuantizationDetailsUnion&& u) FLATBUFFERS_NOEXCEPT : - type(QuantizationDetails_NONE), value(nullptr) - { std::swap(type, u.type); std::swap(value, u.value); } - QuantizationDetailsUnion(const QuantizationDetailsUnion &) FLATBUFFERS_NOEXCEPT; - QuantizationDetailsUnion &operator=(const QuantizationDetailsUnion &u) FLATBUFFERS_NOEXCEPT - { QuantizationDetailsUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; } - QuantizationDetailsUnion &operator=(QuantizationDetailsUnion &&u) FLATBUFFERS_NOEXCEPT - { std::swap(type, u.type); std::swap(value, u.value); return *this; } - ~QuantizationDetailsUnion() { Reset(); } - - void Reset(); - -#ifndef FLATBUFFERS_CPP98_STL - template - void Set(T&& val) { - using RT = typename std::remove_reference::type; - Reset(); - type = QuantizationDetailsTraits::enum_value; - if (type != QuantizationDetails_NONE) { - value = new RT(std::forward(val)); - } - } -#endif // FLATBUFFERS_CPP98_STL - - static void *UnPack(const void *obj, QuantizationDetails type, const flatbuffers::resolver_function_t *resolver); - flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const; - - tflite::CustomQuantizationT *AsCustomQuantization() { - return type == QuantizationDetails_CustomQuantization ? - reinterpret_cast(value) : nullptr; - } - const tflite::CustomQuantizationT *AsCustomQuantization() const { - return type == QuantizationDetails_CustomQuantization ? - reinterpret_cast(value) : nullptr; - } -}; - -bool VerifyQuantizationDetails(flatbuffers::Verifier &verifier, const void *obj, QuantizationDetails type); -bool VerifyQuantizationDetailsVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types); - -enum DimensionType { - DimensionType_DENSE = 0, - DimensionType_SPARSE_CSR = 1, - DimensionType_MIN = DimensionType_DENSE, - DimensionType_MAX = DimensionType_SPARSE_CSR -}; - -inline const DimensionType (&EnumValuesDimensionType())[2] { - static const DimensionType values[] = { - DimensionType_DENSE, - DimensionType_SPARSE_CSR - }; - return values; -} - -inline const char * const *EnumNamesDimensionType() { - static const char * const names[3] = { - "DENSE", - "SPARSE_CSR", - nullptr - }; - return names; -} - -inline const char *EnumNameDimensionType(DimensionType e) { - if (flatbuffers::IsOutRange(e, DimensionType_DENSE, DimensionType_SPARSE_CSR)) return ""; - const size_t index = static_cast(e); - return EnumNamesDimensionType()[index]; -} - -enum SparseIndexVector { - SparseIndexVector_NONE = 0, - SparseIndexVector_Int32Vector = 1, - SparseIndexVector_Uint16Vector = 2, - SparseIndexVector_Uint8Vector = 3, - SparseIndexVector_MIN = SparseIndexVector_NONE, - SparseIndexVector_MAX = SparseIndexVector_Uint8Vector -}; - -inline const SparseIndexVector (&EnumValuesSparseIndexVector())[4] { - static const SparseIndexVector values[] = { - SparseIndexVector_NONE, - SparseIndexVector_Int32Vector, - SparseIndexVector_Uint16Vector, - SparseIndexVector_Uint8Vector - }; - return values; -} - -inline const char * const *EnumNamesSparseIndexVector() { - static const char * const names[5] = { - "NONE", - "Int32Vector", - "Uint16Vector", - "Uint8Vector", - nullptr - }; - return names; -} - -inline const char *EnumNameSparseIndexVector(SparseIndexVector e) { - if (flatbuffers::IsOutRange(e, SparseIndexVector_NONE, SparseIndexVector_Uint8Vector)) return ""; - const size_t index = static_cast(e); - return EnumNamesSparseIndexVector()[index]; -} - -template struct SparseIndexVectorTraits { - static const SparseIndexVector enum_value = SparseIndexVector_NONE; -}; - -template<> struct SparseIndexVectorTraits { - static const SparseIndexVector enum_value = SparseIndexVector_Int32Vector; -}; - -template<> struct SparseIndexVectorTraits { - static const SparseIndexVector enum_value = SparseIndexVector_Uint16Vector; -}; - -template<> struct SparseIndexVectorTraits { - static const SparseIndexVector enum_value = SparseIndexVector_Uint8Vector; -}; - -struct SparseIndexVectorUnion { - SparseIndexVector type; - void *value; - - SparseIndexVectorUnion() : type(SparseIndexVector_NONE), value(nullptr) {} - SparseIndexVectorUnion(SparseIndexVectorUnion&& u) FLATBUFFERS_NOEXCEPT : - type(SparseIndexVector_NONE), value(nullptr) - { std::swap(type, u.type); std::swap(value, u.value); } - SparseIndexVectorUnion(const SparseIndexVectorUnion &) FLATBUFFERS_NOEXCEPT; - SparseIndexVectorUnion &operator=(const SparseIndexVectorUnion &u) FLATBUFFERS_NOEXCEPT - { SparseIndexVectorUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; } - SparseIndexVectorUnion &operator=(SparseIndexVectorUnion &&u) FLATBUFFERS_NOEXCEPT - { std::swap(type, u.type); std::swap(value, u.value); return *this; } - ~SparseIndexVectorUnion() { Reset(); } - - void Reset(); - -#ifndef FLATBUFFERS_CPP98_STL - template - void Set(T&& val) { - using RT = typename std::remove_reference::type; - Reset(); - type = SparseIndexVectorTraits::enum_value; - if (type != SparseIndexVector_NONE) { - value = new RT(std::forward(val)); - } - } -#endif // FLATBUFFERS_CPP98_STL - - static void *UnPack(const void *obj, SparseIndexVector type, const flatbuffers::resolver_function_t *resolver); - flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const; - - tflite::Int32VectorT *AsInt32Vector() { - return type == SparseIndexVector_Int32Vector ? - reinterpret_cast(value) : nullptr; - } - const tflite::Int32VectorT *AsInt32Vector() const { - return type == SparseIndexVector_Int32Vector ? - reinterpret_cast(value) : nullptr; - } - tflite::Uint16VectorT *AsUint16Vector() { - return type == SparseIndexVector_Uint16Vector ? - reinterpret_cast(value) : nullptr; - } - const tflite::Uint16VectorT *AsUint16Vector() const { - return type == SparseIndexVector_Uint16Vector ? - reinterpret_cast(value) : nullptr; - } - tflite::Uint8VectorT *AsUint8Vector() { - return type == SparseIndexVector_Uint8Vector ? - reinterpret_cast(value) : nullptr; - } - const tflite::Uint8VectorT *AsUint8Vector() const { - return type == SparseIndexVector_Uint8Vector ? - reinterpret_cast(value) : nullptr; - } -}; - -bool VerifySparseIndexVector(flatbuffers::Verifier &verifier, const void *obj, SparseIndexVector type); -bool VerifySparseIndexVectorVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types); - -enum BuiltinOperator { - BuiltinOperator_ADD = 0, - BuiltinOperator_AVERAGE_POOL_2D = 1, - BuiltinOperator_CONCATENATION = 2, - BuiltinOperator_CONV_2D = 3, - BuiltinOperator_DEPTHWISE_CONV_2D = 4, - BuiltinOperator_DEPTH_TO_SPACE = 5, - BuiltinOperator_DEQUANTIZE = 6, - BuiltinOperator_EMBEDDING_LOOKUP = 7, - BuiltinOperator_FLOOR = 8, - BuiltinOperator_FULLY_CONNECTED = 9, - BuiltinOperator_HASHTABLE_LOOKUP = 10, - BuiltinOperator_L2_NORMALIZATION = 11, - BuiltinOperator_L2_POOL_2D = 12, - BuiltinOperator_LOCAL_RESPONSE_NORMALIZATION = 13, - BuiltinOperator_LOGISTIC = 14, - BuiltinOperator_LSH_PROJECTION = 15, - BuiltinOperator_LSTM = 16, - BuiltinOperator_MAX_POOL_2D = 17, - BuiltinOperator_MUL = 18, - BuiltinOperator_RELU = 19, - BuiltinOperator_RELU_N1_TO_1 = 20, - BuiltinOperator_RELU6 = 21, - BuiltinOperator_RESHAPE = 22, - BuiltinOperator_RESIZE_BILINEAR = 23, - BuiltinOperator_RNN = 24, - BuiltinOperator_SOFTMAX = 25, - BuiltinOperator_SPACE_TO_DEPTH = 26, - BuiltinOperator_SVDF = 27, - BuiltinOperator_TANH = 28, - BuiltinOperator_CONCAT_EMBEDDINGS = 29, - BuiltinOperator_SKIP_GRAM = 30, - BuiltinOperator_CALL = 31, - BuiltinOperator_CUSTOM = 32, - BuiltinOperator_EMBEDDING_LOOKUP_SPARSE = 33, - BuiltinOperator_PAD = 34, - BuiltinOperator_UNIDIRECTIONAL_SEQUENCE_RNN = 35, - BuiltinOperator_GATHER = 36, - BuiltinOperator_BATCH_TO_SPACE_ND = 37, - BuiltinOperator_SPACE_TO_BATCH_ND = 38, - BuiltinOperator_TRANSPOSE = 39, - BuiltinOperator_MEAN = 40, - BuiltinOperator_SUB = 41, - BuiltinOperator_DIV = 42, - BuiltinOperator_SQUEEZE = 43, - BuiltinOperator_UNIDIRECTIONAL_SEQUENCE_LSTM = 44, - BuiltinOperator_STRIDED_SLICE = 45, - BuiltinOperator_BIDIRECTIONAL_SEQUENCE_RNN = 46, - BuiltinOperator_EXP = 47, - BuiltinOperator_TOPK_V2 = 48, - BuiltinOperator_SPLIT = 49, - BuiltinOperator_LOG_SOFTMAX = 50, - BuiltinOperator_DELEGATE = 51, - BuiltinOperator_BIDIRECTIONAL_SEQUENCE_LSTM = 52, - BuiltinOperator_CAST = 53, - BuiltinOperator_PRELU = 54, - BuiltinOperator_MAXIMUM = 55, - BuiltinOperator_ARG_MAX = 56, - BuiltinOperator_MINIMUM = 57, - BuiltinOperator_LESS = 58, - BuiltinOperator_NEG = 59, - BuiltinOperator_PADV2 = 60, - BuiltinOperator_GREATER = 61, - BuiltinOperator_GREATER_EQUAL = 62, - BuiltinOperator_LESS_EQUAL = 63, - BuiltinOperator_SELECT = 64, - BuiltinOperator_SLICE = 65, - BuiltinOperator_SIN = 66, - BuiltinOperator_TRANSPOSE_CONV = 67, - BuiltinOperator_SPARSE_TO_DENSE = 68, - BuiltinOperator_TILE = 69, - BuiltinOperator_EXPAND_DIMS = 70, - BuiltinOperator_EQUAL = 71, - BuiltinOperator_NOT_EQUAL = 72, - BuiltinOperator_LOG = 73, - BuiltinOperator_SUM = 74, - BuiltinOperator_SQRT = 75, - BuiltinOperator_RSQRT = 76, - BuiltinOperator_SHAPE = 77, - BuiltinOperator_POW = 78, - BuiltinOperator_ARG_MIN = 79, - BuiltinOperator_FAKE_QUANT = 80, - BuiltinOperator_REDUCE_PROD = 81, - BuiltinOperator_REDUCE_MAX = 82, - BuiltinOperator_PACK = 83, - BuiltinOperator_LOGICAL_OR = 84, - BuiltinOperator_ONE_HOT = 85, - BuiltinOperator_LOGICAL_AND = 86, - BuiltinOperator_LOGICAL_NOT = 87, - BuiltinOperator_UNPACK = 88, - BuiltinOperator_REDUCE_MIN = 89, - BuiltinOperator_FLOOR_DIV = 90, - BuiltinOperator_REDUCE_ANY = 91, - BuiltinOperator_SQUARE = 92, - BuiltinOperator_ZEROS_LIKE = 93, - BuiltinOperator_FILL = 94, - BuiltinOperator_FLOOR_MOD = 95, - BuiltinOperator_RANGE = 96, - BuiltinOperator_RESIZE_NEAREST_NEIGHBOR = 97, - BuiltinOperator_LEAKY_RELU = 98, - BuiltinOperator_SQUARED_DIFFERENCE = 99, - BuiltinOperator_MIRROR_PAD = 100, - BuiltinOperator_ABS = 101, - BuiltinOperator_SPLIT_V = 102, - BuiltinOperator_UNIQUE = 103, - BuiltinOperator_CEIL = 104, - BuiltinOperator_REVERSE_V2 = 105, - BuiltinOperator_ADD_N = 106, - BuiltinOperator_GATHER_ND = 107, - BuiltinOperator_COS = 108, - BuiltinOperator_WHERE = 109, - BuiltinOperator_RANK = 110, - BuiltinOperator_ELU = 111, - BuiltinOperator_REVERSE_SEQUENCE = 112, - BuiltinOperator_MATRIX_DIAG = 113, - BuiltinOperator_QUANTIZE = 114, - BuiltinOperator_MATRIX_SET_DIAG = 115, - BuiltinOperator_ROUND = 116, - BuiltinOperator_HARD_SWISH = 117, - BuiltinOperator_IF = 118, - BuiltinOperator_WHILE = 119, - BuiltinOperator_NON_MAX_SUPPRESSION_V4 = 120, - BuiltinOperator_NON_MAX_SUPPRESSION_V5 = 121, - BuiltinOperator_SCATTER_ND = 122, - BuiltinOperator_SELECT_V2 = 123, - BuiltinOperator_DENSIFY = 124, - BuiltinOperator_SEGMENT_SUM = 125, - BuiltinOperator_BATCH_MATMUL = 126, - BuiltinOperator_PLACEHOLDER_FOR_GREATER_OP_CODES = 127, - BuiltinOperator_CUMSUM = 128, - BuiltinOperator_MIN = BuiltinOperator_ADD, - BuiltinOperator_MAX = BuiltinOperator_CUMSUM -}; - -inline const BuiltinOperator (&EnumValuesBuiltinOperator())[129] { - static const BuiltinOperator values[] = { - BuiltinOperator_ADD, - BuiltinOperator_AVERAGE_POOL_2D, - BuiltinOperator_CONCATENATION, - BuiltinOperator_CONV_2D, - BuiltinOperator_DEPTHWISE_CONV_2D, - BuiltinOperator_DEPTH_TO_SPACE, - BuiltinOperator_DEQUANTIZE, - BuiltinOperator_EMBEDDING_LOOKUP, - BuiltinOperator_FLOOR, - BuiltinOperator_FULLY_CONNECTED, - BuiltinOperator_HASHTABLE_LOOKUP, - BuiltinOperator_L2_NORMALIZATION, - BuiltinOperator_L2_POOL_2D, - BuiltinOperator_LOCAL_RESPONSE_NORMALIZATION, - BuiltinOperator_LOGISTIC, - BuiltinOperator_LSH_PROJECTION, - BuiltinOperator_LSTM, - BuiltinOperator_MAX_POOL_2D, - BuiltinOperator_MUL, - BuiltinOperator_RELU, - BuiltinOperator_RELU_N1_TO_1, - BuiltinOperator_RELU6, - BuiltinOperator_RESHAPE, - BuiltinOperator_RESIZE_BILINEAR, - BuiltinOperator_RNN, - BuiltinOperator_SOFTMAX, - BuiltinOperator_SPACE_TO_DEPTH, - BuiltinOperator_SVDF, - BuiltinOperator_TANH, - BuiltinOperator_CONCAT_EMBEDDINGS, - BuiltinOperator_SKIP_GRAM, - BuiltinOperator_CALL, - BuiltinOperator_CUSTOM, - BuiltinOperator_EMBEDDING_LOOKUP_SPARSE, - BuiltinOperator_PAD, - BuiltinOperator_UNIDIRECTIONAL_SEQUENCE_RNN, - BuiltinOperator_GATHER, - BuiltinOperator_BATCH_TO_SPACE_ND, - BuiltinOperator_SPACE_TO_BATCH_ND, - BuiltinOperator_TRANSPOSE, - BuiltinOperator_MEAN, - BuiltinOperator_SUB, - BuiltinOperator_DIV, - BuiltinOperator_SQUEEZE, - BuiltinOperator_UNIDIRECTIONAL_SEQUENCE_LSTM, - BuiltinOperator_STRIDED_SLICE, - BuiltinOperator_BIDIRECTIONAL_SEQUENCE_RNN, - BuiltinOperator_EXP, - BuiltinOperator_TOPK_V2, - BuiltinOperator_SPLIT, - BuiltinOperator_LOG_SOFTMAX, - BuiltinOperator_DELEGATE, - BuiltinOperator_BIDIRECTIONAL_SEQUENCE_LSTM, - BuiltinOperator_CAST, - BuiltinOperator_PRELU, - BuiltinOperator_MAXIMUM, - BuiltinOperator_ARG_MAX, - BuiltinOperator_MINIMUM, - BuiltinOperator_LESS, - BuiltinOperator_NEG, - BuiltinOperator_PADV2, - BuiltinOperator_GREATER, - BuiltinOperator_GREATER_EQUAL, - BuiltinOperator_LESS_EQUAL, - BuiltinOperator_SELECT, - BuiltinOperator_SLICE, - BuiltinOperator_SIN, - BuiltinOperator_TRANSPOSE_CONV, - BuiltinOperator_SPARSE_TO_DENSE, - BuiltinOperator_TILE, - BuiltinOperator_EXPAND_DIMS, - BuiltinOperator_EQUAL, - BuiltinOperator_NOT_EQUAL, - BuiltinOperator_LOG, - BuiltinOperator_SUM, - BuiltinOperator_SQRT, - BuiltinOperator_RSQRT, - BuiltinOperator_SHAPE, - BuiltinOperator_POW, - BuiltinOperator_ARG_MIN, - BuiltinOperator_FAKE_QUANT, - BuiltinOperator_REDUCE_PROD, - BuiltinOperator_REDUCE_MAX, - BuiltinOperator_PACK, - BuiltinOperator_LOGICAL_OR, - BuiltinOperator_ONE_HOT, - BuiltinOperator_LOGICAL_AND, - BuiltinOperator_LOGICAL_NOT, - BuiltinOperator_UNPACK, - BuiltinOperator_REDUCE_MIN, - BuiltinOperator_FLOOR_DIV, - BuiltinOperator_REDUCE_ANY, - BuiltinOperator_SQUARE, - BuiltinOperator_ZEROS_LIKE, - BuiltinOperator_FILL, - BuiltinOperator_FLOOR_MOD, - BuiltinOperator_RANGE, - BuiltinOperator_RESIZE_NEAREST_NEIGHBOR, - BuiltinOperator_LEAKY_RELU, - BuiltinOperator_SQUARED_DIFFERENCE, - BuiltinOperator_MIRROR_PAD, - BuiltinOperator_ABS, - BuiltinOperator_SPLIT_V, - BuiltinOperator_UNIQUE, - BuiltinOperator_CEIL, - BuiltinOperator_REVERSE_V2, - BuiltinOperator_ADD_N, - BuiltinOperator_GATHER_ND, - BuiltinOperator_COS, - BuiltinOperator_WHERE, - BuiltinOperator_RANK, - BuiltinOperator_ELU, - BuiltinOperator_REVERSE_SEQUENCE, - BuiltinOperator_MATRIX_DIAG, - BuiltinOperator_QUANTIZE, - BuiltinOperator_MATRIX_SET_DIAG, - BuiltinOperator_ROUND, - BuiltinOperator_HARD_SWISH, - BuiltinOperator_IF, - BuiltinOperator_WHILE, - BuiltinOperator_NON_MAX_SUPPRESSION_V4, - BuiltinOperator_NON_MAX_SUPPRESSION_V5, - BuiltinOperator_SCATTER_ND, - BuiltinOperator_SELECT_V2, - BuiltinOperator_DENSIFY, - BuiltinOperator_SEGMENT_SUM, - BuiltinOperator_BATCH_MATMUL, - BuiltinOperator_PLACEHOLDER_FOR_GREATER_OP_CODES, - BuiltinOperator_CUMSUM - }; - return values; -} - -inline const char * const *EnumNamesBuiltinOperator() { - static const char * const names[130] = { - "ADD", - "AVERAGE_POOL_2D", - "CONCATENATION", - "CONV_2D", - "DEPTHWISE_CONV_2D", - "DEPTH_TO_SPACE", - "DEQUANTIZE", - "EMBEDDING_LOOKUP", - "FLOOR", - "FULLY_CONNECTED", - "HASHTABLE_LOOKUP", - "L2_NORMALIZATION", - "L2_POOL_2D", - "LOCAL_RESPONSE_NORMALIZATION", - "LOGISTIC", - "LSH_PROJECTION", - "LSTM", - "MAX_POOL_2D", - "MUL", - "RELU", - "RELU_N1_TO_1", - "RELU6", - "RESHAPE", - "RESIZE_BILINEAR", - "RNN", - "SOFTMAX", - "SPACE_TO_DEPTH", - "SVDF", - "TANH", - "CONCAT_EMBEDDINGS", - "SKIP_GRAM", - "CALL", - "CUSTOM", - "EMBEDDING_LOOKUP_SPARSE", - "PAD", - "UNIDIRECTIONAL_SEQUENCE_RNN", - "GATHER", - "BATCH_TO_SPACE_ND", - "SPACE_TO_BATCH_ND", - "TRANSPOSE", - "MEAN", - "SUB", - "DIV", - "SQUEEZE", - "UNIDIRECTIONAL_SEQUENCE_LSTM", - "STRIDED_SLICE", - "BIDIRECTIONAL_SEQUENCE_RNN", - "EXP", - "TOPK_V2", - "SPLIT", - "LOG_SOFTMAX", - "DELEGATE", - "BIDIRECTIONAL_SEQUENCE_LSTM", - "CAST", - "PRELU", - "MAXIMUM", - "ARG_MAX", - "MINIMUM", - "LESS", - "NEG", - "PADV2", - "GREATER", - "GREATER_EQUAL", - "LESS_EQUAL", - "SELECT", - "SLICE", - "SIN", - "TRANSPOSE_CONV", - "SPARSE_TO_DENSE", - "TILE", - "EXPAND_DIMS", - "EQUAL", - "NOT_EQUAL", - "LOG", - "SUM", - "SQRT", - "RSQRT", - "SHAPE", - "POW", - "ARG_MIN", - "FAKE_QUANT", - "REDUCE_PROD", - "REDUCE_MAX", - "PACK", - "LOGICAL_OR", - "ONE_HOT", - "LOGICAL_AND", - "LOGICAL_NOT", - "UNPACK", - "REDUCE_MIN", - "FLOOR_DIV", - "REDUCE_ANY", - "SQUARE", - "ZEROS_LIKE", - "FILL", - "FLOOR_MOD", - "RANGE", - "RESIZE_NEAREST_NEIGHBOR", - "LEAKY_RELU", - "SQUARED_DIFFERENCE", - "MIRROR_PAD", - "ABS", - "SPLIT_V", - "UNIQUE", - "CEIL", - "REVERSE_V2", - "ADD_N", - "GATHER_ND", - "COS", - "WHERE", - "RANK", - "ELU", - "REVERSE_SEQUENCE", - "MATRIX_DIAG", - "QUANTIZE", - "MATRIX_SET_DIAG", - "ROUND", - "HARD_SWISH", - "IF", - "WHILE", - "NON_MAX_SUPPRESSION_V4", - "NON_MAX_SUPPRESSION_V5", - "SCATTER_ND", - "SELECT_V2", - "DENSIFY", - "SEGMENT_SUM", - "BATCH_MATMUL", - "PLACEHOLDER_FOR_GREATER_OP_CODES", - "CUMSUM", - nullptr - }; - return names; -} - -inline const char *EnumNameBuiltinOperator(BuiltinOperator e) { - if (flatbuffers::IsOutRange(e, BuiltinOperator_ADD, BuiltinOperator_CUMSUM)) return ""; - const size_t index = static_cast(e); - return EnumNamesBuiltinOperator()[index]; -} - -enum BuiltinOptions { - BuiltinOptions_NONE = 0, - BuiltinOptions_Conv2DOptions = 1, - BuiltinOptions_DepthwiseConv2DOptions = 2, - BuiltinOptions_ConcatEmbeddingsOptions = 3, - BuiltinOptions_LSHProjectionOptions = 4, - BuiltinOptions_Pool2DOptions = 5, - BuiltinOptions_SVDFOptions = 6, - BuiltinOptions_RNNOptions = 7, - BuiltinOptions_FullyConnectedOptions = 8, - BuiltinOptions_SoftmaxOptions = 9, - BuiltinOptions_ConcatenationOptions = 10, - BuiltinOptions_AddOptions = 11, - BuiltinOptions_L2NormOptions = 12, - BuiltinOptions_LocalResponseNormalizationOptions = 13, - BuiltinOptions_LSTMOptions = 14, - BuiltinOptions_ResizeBilinearOptions = 15, - BuiltinOptions_CallOptions = 16, - BuiltinOptions_ReshapeOptions = 17, - BuiltinOptions_SkipGramOptions = 18, - BuiltinOptions_SpaceToDepthOptions = 19, - BuiltinOptions_EmbeddingLookupSparseOptions = 20, - BuiltinOptions_MulOptions = 21, - BuiltinOptions_PadOptions = 22, - BuiltinOptions_GatherOptions = 23, - BuiltinOptions_BatchToSpaceNDOptions = 24, - BuiltinOptions_SpaceToBatchNDOptions = 25, - BuiltinOptions_TransposeOptions = 26, - BuiltinOptions_ReducerOptions = 27, - BuiltinOptions_SubOptions = 28, - BuiltinOptions_DivOptions = 29, - BuiltinOptions_SqueezeOptions = 30, - BuiltinOptions_SequenceRNNOptions = 31, - BuiltinOptions_StridedSliceOptions = 32, - BuiltinOptions_ExpOptions = 33, - BuiltinOptions_TopKV2Options = 34, - BuiltinOptions_SplitOptions = 35, - BuiltinOptions_LogSoftmaxOptions = 36, - BuiltinOptions_CastOptions = 37, - BuiltinOptions_DequantizeOptions = 38, - BuiltinOptions_MaximumMinimumOptions = 39, - BuiltinOptions_ArgMaxOptions = 40, - BuiltinOptions_LessOptions = 41, - BuiltinOptions_NegOptions = 42, - BuiltinOptions_PadV2Options = 43, - BuiltinOptions_GreaterOptions = 44, - BuiltinOptions_GreaterEqualOptions = 45, - BuiltinOptions_LessEqualOptions = 46, - BuiltinOptions_SelectOptions = 47, - BuiltinOptions_SliceOptions = 48, - BuiltinOptions_TransposeConvOptions = 49, - BuiltinOptions_SparseToDenseOptions = 50, - BuiltinOptions_TileOptions = 51, - BuiltinOptions_ExpandDimsOptions = 52, - BuiltinOptions_EqualOptions = 53, - BuiltinOptions_NotEqualOptions = 54, - BuiltinOptions_ShapeOptions = 55, - BuiltinOptions_PowOptions = 56, - BuiltinOptions_ArgMinOptions = 57, - BuiltinOptions_FakeQuantOptions = 58, - BuiltinOptions_PackOptions = 59, - BuiltinOptions_LogicalOrOptions = 60, - BuiltinOptions_OneHotOptions = 61, - BuiltinOptions_LogicalAndOptions = 62, - BuiltinOptions_LogicalNotOptions = 63, - BuiltinOptions_UnpackOptions = 64, - BuiltinOptions_FloorDivOptions = 65, - BuiltinOptions_SquareOptions = 66, - BuiltinOptions_ZerosLikeOptions = 67, - BuiltinOptions_FillOptions = 68, - BuiltinOptions_BidirectionalSequenceLSTMOptions = 69, - BuiltinOptions_BidirectionalSequenceRNNOptions = 70, - BuiltinOptions_UnidirectionalSequenceLSTMOptions = 71, - BuiltinOptions_FloorModOptions = 72, - BuiltinOptions_RangeOptions = 73, - BuiltinOptions_ResizeNearestNeighborOptions = 74, - BuiltinOptions_LeakyReluOptions = 75, - BuiltinOptions_SquaredDifferenceOptions = 76, - BuiltinOptions_MirrorPadOptions = 77, - BuiltinOptions_AbsOptions = 78, - BuiltinOptions_SplitVOptions = 79, - BuiltinOptions_UniqueOptions = 80, - BuiltinOptions_ReverseV2Options = 81, - BuiltinOptions_AddNOptions = 82, - BuiltinOptions_GatherNdOptions = 83, - BuiltinOptions_CosOptions = 84, - BuiltinOptions_WhereOptions = 85, - BuiltinOptions_RankOptions = 86, - BuiltinOptions_ReverseSequenceOptions = 87, - BuiltinOptions_MatrixDiagOptions = 88, - BuiltinOptions_QuantizeOptions = 89, - BuiltinOptions_MatrixSetDiagOptions = 90, - BuiltinOptions_HardSwishOptions = 91, - BuiltinOptions_IfOptions = 92, - BuiltinOptions_WhileOptions = 93, - BuiltinOptions_DepthToSpaceOptions = 94, - BuiltinOptions_NonMaxSuppressionV4Options = 95, - BuiltinOptions_NonMaxSuppressionV5Options = 96, - BuiltinOptions_ScatterNdOptions = 97, - BuiltinOptions_SelectV2Options = 98, - BuiltinOptions_DensifyOptions = 99, - BuiltinOptions_SegmentSumOptions = 100, - BuiltinOptions_BatchMatMulOptions = 101, - BuiltinOptions_CumsumOptions = 102, - BuiltinOptions_MIN = BuiltinOptions_NONE, - BuiltinOptions_MAX = BuiltinOptions_CumsumOptions -}; - -inline const BuiltinOptions (&EnumValuesBuiltinOptions())[103] { - static const BuiltinOptions values[] = { - BuiltinOptions_NONE, - BuiltinOptions_Conv2DOptions, - BuiltinOptions_DepthwiseConv2DOptions, - BuiltinOptions_ConcatEmbeddingsOptions, - BuiltinOptions_LSHProjectionOptions, - BuiltinOptions_Pool2DOptions, - BuiltinOptions_SVDFOptions, - BuiltinOptions_RNNOptions, - BuiltinOptions_FullyConnectedOptions, - BuiltinOptions_SoftmaxOptions, - BuiltinOptions_ConcatenationOptions, - BuiltinOptions_AddOptions, - BuiltinOptions_L2NormOptions, - BuiltinOptions_LocalResponseNormalizationOptions, - BuiltinOptions_LSTMOptions, - BuiltinOptions_ResizeBilinearOptions, - BuiltinOptions_CallOptions, - BuiltinOptions_ReshapeOptions, - BuiltinOptions_SkipGramOptions, - BuiltinOptions_SpaceToDepthOptions, - BuiltinOptions_EmbeddingLookupSparseOptions, - BuiltinOptions_MulOptions, - BuiltinOptions_PadOptions, - BuiltinOptions_GatherOptions, - BuiltinOptions_BatchToSpaceNDOptions, - BuiltinOptions_SpaceToBatchNDOptions, - BuiltinOptions_TransposeOptions, - BuiltinOptions_ReducerOptions, - BuiltinOptions_SubOptions, - BuiltinOptions_DivOptions, - BuiltinOptions_SqueezeOptions, - BuiltinOptions_SequenceRNNOptions, - BuiltinOptions_StridedSliceOptions, - BuiltinOptions_ExpOptions, - BuiltinOptions_TopKV2Options, - BuiltinOptions_SplitOptions, - BuiltinOptions_LogSoftmaxOptions, - BuiltinOptions_CastOptions, - BuiltinOptions_DequantizeOptions, - BuiltinOptions_MaximumMinimumOptions, - BuiltinOptions_ArgMaxOptions, - BuiltinOptions_LessOptions, - BuiltinOptions_NegOptions, - BuiltinOptions_PadV2Options, - BuiltinOptions_GreaterOptions, - BuiltinOptions_GreaterEqualOptions, - BuiltinOptions_LessEqualOptions, - BuiltinOptions_SelectOptions, - BuiltinOptions_SliceOptions, - BuiltinOptions_TransposeConvOptions, - BuiltinOptions_SparseToDenseOptions, - BuiltinOptions_TileOptions, - BuiltinOptions_ExpandDimsOptions, - BuiltinOptions_EqualOptions, - BuiltinOptions_NotEqualOptions, - BuiltinOptions_ShapeOptions, - BuiltinOptions_PowOptions, - BuiltinOptions_ArgMinOptions, - BuiltinOptions_FakeQuantOptions, - BuiltinOptions_PackOptions, - BuiltinOptions_LogicalOrOptions, - BuiltinOptions_OneHotOptions, - BuiltinOptions_LogicalAndOptions, - BuiltinOptions_LogicalNotOptions, - BuiltinOptions_UnpackOptions, - BuiltinOptions_FloorDivOptions, - BuiltinOptions_SquareOptions, - BuiltinOptions_ZerosLikeOptions, - BuiltinOptions_FillOptions, - BuiltinOptions_BidirectionalSequenceLSTMOptions, - BuiltinOptions_BidirectionalSequenceRNNOptions, - BuiltinOptions_UnidirectionalSequenceLSTMOptions, - BuiltinOptions_FloorModOptions, - BuiltinOptions_RangeOptions, - BuiltinOptions_ResizeNearestNeighborOptions, - BuiltinOptions_LeakyReluOptions, - BuiltinOptions_SquaredDifferenceOptions, - BuiltinOptions_MirrorPadOptions, - BuiltinOptions_AbsOptions, - BuiltinOptions_SplitVOptions, - BuiltinOptions_UniqueOptions, - BuiltinOptions_ReverseV2Options, - BuiltinOptions_AddNOptions, - BuiltinOptions_GatherNdOptions, - BuiltinOptions_CosOptions, - BuiltinOptions_WhereOptions, - BuiltinOptions_RankOptions, - BuiltinOptions_ReverseSequenceOptions, - BuiltinOptions_MatrixDiagOptions, - BuiltinOptions_QuantizeOptions, - BuiltinOptions_MatrixSetDiagOptions, - BuiltinOptions_HardSwishOptions, - BuiltinOptions_IfOptions, - BuiltinOptions_WhileOptions, - BuiltinOptions_DepthToSpaceOptions, - BuiltinOptions_NonMaxSuppressionV4Options, - BuiltinOptions_NonMaxSuppressionV5Options, - BuiltinOptions_ScatterNdOptions, - BuiltinOptions_SelectV2Options, - BuiltinOptions_DensifyOptions, - BuiltinOptions_SegmentSumOptions, - BuiltinOptions_BatchMatMulOptions, - BuiltinOptions_CumsumOptions - }; - return values; -} - -inline const char * const *EnumNamesBuiltinOptions() { - static const char * const names[104] = { - "NONE", - "Conv2DOptions", - "DepthwiseConv2DOptions", - "ConcatEmbeddingsOptions", - "LSHProjectionOptions", - "Pool2DOptions", - "SVDFOptions", - "RNNOptions", - "FullyConnectedOptions", - "SoftmaxOptions", - "ConcatenationOptions", - "AddOptions", - "L2NormOptions", - "LocalResponseNormalizationOptions", - "LSTMOptions", - "ResizeBilinearOptions", - "CallOptions", - "ReshapeOptions", - "SkipGramOptions", - "SpaceToDepthOptions", - "EmbeddingLookupSparseOptions", - "MulOptions", - "PadOptions", - "GatherOptions", - "BatchToSpaceNDOptions", - "SpaceToBatchNDOptions", - "TransposeOptions", - "ReducerOptions", - "SubOptions", - "DivOptions", - "SqueezeOptions", - "SequenceRNNOptions", - "StridedSliceOptions", - "ExpOptions", - "TopKV2Options", - "SplitOptions", - "LogSoftmaxOptions", - "CastOptions", - "DequantizeOptions", - "MaximumMinimumOptions", - "ArgMaxOptions", - "LessOptions", - "NegOptions", - "PadV2Options", - "GreaterOptions", - "GreaterEqualOptions", - "LessEqualOptions", - "SelectOptions", - "SliceOptions", - "TransposeConvOptions", - "SparseToDenseOptions", - "TileOptions", - "ExpandDimsOptions", - "EqualOptions", - "NotEqualOptions", - "ShapeOptions", - "PowOptions", - "ArgMinOptions", - "FakeQuantOptions", - "PackOptions", - "LogicalOrOptions", - "OneHotOptions", - "LogicalAndOptions", - "LogicalNotOptions", - "UnpackOptions", - "FloorDivOptions", - "SquareOptions", - "ZerosLikeOptions", - "FillOptions", - "BidirectionalSequenceLSTMOptions", - "BidirectionalSequenceRNNOptions", - "UnidirectionalSequenceLSTMOptions", - "FloorModOptions", - "RangeOptions", - "ResizeNearestNeighborOptions", - "LeakyReluOptions", - "SquaredDifferenceOptions", - "MirrorPadOptions", - "AbsOptions", - "SplitVOptions", - "UniqueOptions", - "ReverseV2Options", - "AddNOptions", - "GatherNdOptions", - "CosOptions", - "WhereOptions", - "RankOptions", - "ReverseSequenceOptions", - "MatrixDiagOptions", - "QuantizeOptions", - "MatrixSetDiagOptions", - "HardSwishOptions", - "IfOptions", - "WhileOptions", - "DepthToSpaceOptions", - "NonMaxSuppressionV4Options", - "NonMaxSuppressionV5Options", - "ScatterNdOptions", - "SelectV2Options", - "DensifyOptions", - "SegmentSumOptions", - "BatchMatMulOptions", - "CumsumOptions", - nullptr - }; - return names; -} - -inline const char *EnumNameBuiltinOptions(BuiltinOptions e) { - if (flatbuffers::IsOutRange(e, BuiltinOptions_NONE, BuiltinOptions_CumsumOptions)) return ""; - const size_t index = static_cast(e); - return EnumNamesBuiltinOptions()[index]; -} - -template struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_NONE; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_Conv2DOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_DepthwiseConv2DOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ConcatEmbeddingsOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_LSHProjectionOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_Pool2DOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SVDFOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_RNNOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_FullyConnectedOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SoftmaxOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ConcatenationOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_AddOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_L2NormOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_LocalResponseNormalizationOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_LSTMOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ResizeBilinearOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_CallOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ReshapeOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SkipGramOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SpaceToDepthOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_EmbeddingLookupSparseOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_MulOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_PadOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_GatherOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_BatchToSpaceNDOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SpaceToBatchNDOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_TransposeOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ReducerOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SubOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_DivOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SqueezeOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SequenceRNNOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_StridedSliceOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ExpOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_TopKV2Options; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SplitOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_LogSoftmaxOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_CastOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_DequantizeOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_MaximumMinimumOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ArgMaxOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_LessOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_NegOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_PadV2Options; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_GreaterOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_GreaterEqualOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_LessEqualOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SelectOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SliceOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_TransposeConvOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SparseToDenseOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_TileOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ExpandDimsOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_EqualOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_NotEqualOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ShapeOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_PowOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ArgMinOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_FakeQuantOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_PackOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_LogicalOrOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_OneHotOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_LogicalAndOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_LogicalNotOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_UnpackOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_FloorDivOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SquareOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ZerosLikeOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_FillOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_BidirectionalSequenceLSTMOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_BidirectionalSequenceRNNOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_UnidirectionalSequenceLSTMOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_FloorModOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_RangeOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ResizeNearestNeighborOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_LeakyReluOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SquaredDifferenceOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_MirrorPadOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_AbsOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SplitVOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_UniqueOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ReverseV2Options; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_AddNOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_GatherNdOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_CosOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_WhereOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_RankOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ReverseSequenceOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_MatrixDiagOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_QuantizeOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_MatrixSetDiagOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_HardSwishOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_IfOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_WhileOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_DepthToSpaceOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_NonMaxSuppressionV4Options; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_NonMaxSuppressionV5Options; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_ScatterNdOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SelectV2Options; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_DensifyOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_SegmentSumOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_BatchMatMulOptions; -}; - -template<> struct BuiltinOptionsTraits { - static const BuiltinOptions enum_value = BuiltinOptions_CumsumOptions; -}; - -struct BuiltinOptionsUnion { - BuiltinOptions type; - void *value; - - BuiltinOptionsUnion() : type(BuiltinOptions_NONE), value(nullptr) {} - BuiltinOptionsUnion(BuiltinOptionsUnion&& u) FLATBUFFERS_NOEXCEPT : - type(BuiltinOptions_NONE), value(nullptr) - { std::swap(type, u.type); std::swap(value, u.value); } - BuiltinOptionsUnion(const BuiltinOptionsUnion &) FLATBUFFERS_NOEXCEPT; - BuiltinOptionsUnion &operator=(const BuiltinOptionsUnion &u) FLATBUFFERS_NOEXCEPT - { BuiltinOptionsUnion t(u); std::swap(type, t.type); std::swap(value, t.value); return *this; } - BuiltinOptionsUnion &operator=(BuiltinOptionsUnion &&u) FLATBUFFERS_NOEXCEPT - { std::swap(type, u.type); std::swap(value, u.value); return *this; } - ~BuiltinOptionsUnion() { Reset(); } - - void Reset(); - -#ifndef FLATBUFFERS_CPP98_STL - template - void Set(T&& val) { - using RT = typename std::remove_reference::type; - Reset(); - type = BuiltinOptionsTraits::enum_value; - if (type != BuiltinOptions_NONE) { - value = new RT(std::forward(val)); - } - } -#endif // FLATBUFFERS_CPP98_STL - - static void *UnPack(const void *obj, BuiltinOptions type, const flatbuffers::resolver_function_t *resolver); - flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher = nullptr) const; - - tflite::Conv2DOptionsT *AsConv2DOptions() { - return type == BuiltinOptions_Conv2DOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::Conv2DOptionsT *AsConv2DOptions() const { - return type == BuiltinOptions_Conv2DOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::DepthwiseConv2DOptionsT *AsDepthwiseConv2DOptions() { - return type == BuiltinOptions_DepthwiseConv2DOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::DepthwiseConv2DOptionsT *AsDepthwiseConv2DOptions() const { - return type == BuiltinOptions_DepthwiseConv2DOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ConcatEmbeddingsOptionsT *AsConcatEmbeddingsOptions() { - return type == BuiltinOptions_ConcatEmbeddingsOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ConcatEmbeddingsOptionsT *AsConcatEmbeddingsOptions() const { - return type == BuiltinOptions_ConcatEmbeddingsOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::LSHProjectionOptionsT *AsLSHProjectionOptions() { - return type == BuiltinOptions_LSHProjectionOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::LSHProjectionOptionsT *AsLSHProjectionOptions() const { - return type == BuiltinOptions_LSHProjectionOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::Pool2DOptionsT *AsPool2DOptions() { - return type == BuiltinOptions_Pool2DOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::Pool2DOptionsT *AsPool2DOptions() const { - return type == BuiltinOptions_Pool2DOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SVDFOptionsT *AsSVDFOptions() { - return type == BuiltinOptions_SVDFOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SVDFOptionsT *AsSVDFOptions() const { - return type == BuiltinOptions_SVDFOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::RNNOptionsT *AsRNNOptions() { - return type == BuiltinOptions_RNNOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::RNNOptionsT *AsRNNOptions() const { - return type == BuiltinOptions_RNNOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::FullyConnectedOptionsT *AsFullyConnectedOptions() { - return type == BuiltinOptions_FullyConnectedOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::FullyConnectedOptionsT *AsFullyConnectedOptions() const { - return type == BuiltinOptions_FullyConnectedOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SoftmaxOptionsT *AsSoftmaxOptions() { - return type == BuiltinOptions_SoftmaxOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SoftmaxOptionsT *AsSoftmaxOptions() const { - return type == BuiltinOptions_SoftmaxOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ConcatenationOptionsT *AsConcatenationOptions() { - return type == BuiltinOptions_ConcatenationOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ConcatenationOptionsT *AsConcatenationOptions() const { - return type == BuiltinOptions_ConcatenationOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::AddOptionsT *AsAddOptions() { - return type == BuiltinOptions_AddOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::AddOptionsT *AsAddOptions() const { - return type == BuiltinOptions_AddOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::L2NormOptionsT *AsL2NormOptions() { - return type == BuiltinOptions_L2NormOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::L2NormOptionsT *AsL2NormOptions() const { - return type == BuiltinOptions_L2NormOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::LocalResponseNormalizationOptionsT *AsLocalResponseNormalizationOptions() { - return type == BuiltinOptions_LocalResponseNormalizationOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::LocalResponseNormalizationOptionsT *AsLocalResponseNormalizationOptions() const { - return type == BuiltinOptions_LocalResponseNormalizationOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::LSTMOptionsT *AsLSTMOptions() { - return type == BuiltinOptions_LSTMOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::LSTMOptionsT *AsLSTMOptions() const { - return type == BuiltinOptions_LSTMOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ResizeBilinearOptionsT *AsResizeBilinearOptions() { - return type == BuiltinOptions_ResizeBilinearOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ResizeBilinearOptionsT *AsResizeBilinearOptions() const { - return type == BuiltinOptions_ResizeBilinearOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::CallOptionsT *AsCallOptions() { - return type == BuiltinOptions_CallOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::CallOptionsT *AsCallOptions() const { - return type == BuiltinOptions_CallOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ReshapeOptionsT *AsReshapeOptions() { - return type == BuiltinOptions_ReshapeOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ReshapeOptionsT *AsReshapeOptions() const { - return type == BuiltinOptions_ReshapeOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SkipGramOptionsT *AsSkipGramOptions() { - return type == BuiltinOptions_SkipGramOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SkipGramOptionsT *AsSkipGramOptions() const { - return type == BuiltinOptions_SkipGramOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SpaceToDepthOptionsT *AsSpaceToDepthOptions() { - return type == BuiltinOptions_SpaceToDepthOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SpaceToDepthOptionsT *AsSpaceToDepthOptions() const { - return type == BuiltinOptions_SpaceToDepthOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::EmbeddingLookupSparseOptionsT *AsEmbeddingLookupSparseOptions() { - return type == BuiltinOptions_EmbeddingLookupSparseOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::EmbeddingLookupSparseOptionsT *AsEmbeddingLookupSparseOptions() const { - return type == BuiltinOptions_EmbeddingLookupSparseOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::MulOptionsT *AsMulOptions() { - return type == BuiltinOptions_MulOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::MulOptionsT *AsMulOptions() const { - return type == BuiltinOptions_MulOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::PadOptionsT *AsPadOptions() { - return type == BuiltinOptions_PadOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::PadOptionsT *AsPadOptions() const { - return type == BuiltinOptions_PadOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::GatherOptionsT *AsGatherOptions() { - return type == BuiltinOptions_GatherOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::GatherOptionsT *AsGatherOptions() const { - return type == BuiltinOptions_GatherOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::BatchToSpaceNDOptionsT *AsBatchToSpaceNDOptions() { - return type == BuiltinOptions_BatchToSpaceNDOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::BatchToSpaceNDOptionsT *AsBatchToSpaceNDOptions() const { - return type == BuiltinOptions_BatchToSpaceNDOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SpaceToBatchNDOptionsT *AsSpaceToBatchNDOptions() { - return type == BuiltinOptions_SpaceToBatchNDOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SpaceToBatchNDOptionsT *AsSpaceToBatchNDOptions() const { - return type == BuiltinOptions_SpaceToBatchNDOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::TransposeOptionsT *AsTransposeOptions() { - return type == BuiltinOptions_TransposeOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::TransposeOptionsT *AsTransposeOptions() const { - return type == BuiltinOptions_TransposeOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ReducerOptionsT *AsReducerOptions() { - return type == BuiltinOptions_ReducerOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ReducerOptionsT *AsReducerOptions() const { - return type == BuiltinOptions_ReducerOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SubOptionsT *AsSubOptions() { - return type == BuiltinOptions_SubOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SubOptionsT *AsSubOptions() const { - return type == BuiltinOptions_SubOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::DivOptionsT *AsDivOptions() { - return type == BuiltinOptions_DivOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::DivOptionsT *AsDivOptions() const { - return type == BuiltinOptions_DivOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SqueezeOptionsT *AsSqueezeOptions() { - return type == BuiltinOptions_SqueezeOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SqueezeOptionsT *AsSqueezeOptions() const { - return type == BuiltinOptions_SqueezeOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SequenceRNNOptionsT *AsSequenceRNNOptions() { - return type == BuiltinOptions_SequenceRNNOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SequenceRNNOptionsT *AsSequenceRNNOptions() const { - return type == BuiltinOptions_SequenceRNNOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::StridedSliceOptionsT *AsStridedSliceOptions() { - return type == BuiltinOptions_StridedSliceOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::StridedSliceOptionsT *AsStridedSliceOptions() const { - return type == BuiltinOptions_StridedSliceOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ExpOptionsT *AsExpOptions() { - return type == BuiltinOptions_ExpOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ExpOptionsT *AsExpOptions() const { - return type == BuiltinOptions_ExpOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::TopKV2OptionsT *AsTopKV2Options() { - return type == BuiltinOptions_TopKV2Options ? - reinterpret_cast(value) : nullptr; - } - const tflite::TopKV2OptionsT *AsTopKV2Options() const { - return type == BuiltinOptions_TopKV2Options ? - reinterpret_cast(value) : nullptr; - } - tflite::SplitOptionsT *AsSplitOptions() { - return type == BuiltinOptions_SplitOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SplitOptionsT *AsSplitOptions() const { - return type == BuiltinOptions_SplitOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::LogSoftmaxOptionsT *AsLogSoftmaxOptions() { - return type == BuiltinOptions_LogSoftmaxOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::LogSoftmaxOptionsT *AsLogSoftmaxOptions() const { - return type == BuiltinOptions_LogSoftmaxOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::CastOptionsT *AsCastOptions() { - return type == BuiltinOptions_CastOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::CastOptionsT *AsCastOptions() const { - return type == BuiltinOptions_CastOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::DequantizeOptionsT *AsDequantizeOptions() { - return type == BuiltinOptions_DequantizeOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::DequantizeOptionsT *AsDequantizeOptions() const { - return type == BuiltinOptions_DequantizeOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::MaximumMinimumOptionsT *AsMaximumMinimumOptions() { - return type == BuiltinOptions_MaximumMinimumOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::MaximumMinimumOptionsT *AsMaximumMinimumOptions() const { - return type == BuiltinOptions_MaximumMinimumOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ArgMaxOptionsT *AsArgMaxOptions() { - return type == BuiltinOptions_ArgMaxOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ArgMaxOptionsT *AsArgMaxOptions() const { - return type == BuiltinOptions_ArgMaxOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::LessOptionsT *AsLessOptions() { - return type == BuiltinOptions_LessOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::LessOptionsT *AsLessOptions() const { - return type == BuiltinOptions_LessOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::NegOptionsT *AsNegOptions() { - return type == BuiltinOptions_NegOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::NegOptionsT *AsNegOptions() const { - return type == BuiltinOptions_NegOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::PadV2OptionsT *AsPadV2Options() { - return type == BuiltinOptions_PadV2Options ? - reinterpret_cast(value) : nullptr; - } - const tflite::PadV2OptionsT *AsPadV2Options() const { - return type == BuiltinOptions_PadV2Options ? - reinterpret_cast(value) : nullptr; - } - tflite::GreaterOptionsT *AsGreaterOptions() { - return type == BuiltinOptions_GreaterOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::GreaterOptionsT *AsGreaterOptions() const { - return type == BuiltinOptions_GreaterOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::GreaterEqualOptionsT *AsGreaterEqualOptions() { - return type == BuiltinOptions_GreaterEqualOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::GreaterEqualOptionsT *AsGreaterEqualOptions() const { - return type == BuiltinOptions_GreaterEqualOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::LessEqualOptionsT *AsLessEqualOptions() { - return type == BuiltinOptions_LessEqualOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::LessEqualOptionsT *AsLessEqualOptions() const { - return type == BuiltinOptions_LessEqualOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SelectOptionsT *AsSelectOptions() { - return type == BuiltinOptions_SelectOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SelectOptionsT *AsSelectOptions() const { - return type == BuiltinOptions_SelectOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SliceOptionsT *AsSliceOptions() { - return type == BuiltinOptions_SliceOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SliceOptionsT *AsSliceOptions() const { - return type == BuiltinOptions_SliceOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::TransposeConvOptionsT *AsTransposeConvOptions() { - return type == BuiltinOptions_TransposeConvOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::TransposeConvOptionsT *AsTransposeConvOptions() const { - return type == BuiltinOptions_TransposeConvOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SparseToDenseOptionsT *AsSparseToDenseOptions() { - return type == BuiltinOptions_SparseToDenseOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SparseToDenseOptionsT *AsSparseToDenseOptions() const { - return type == BuiltinOptions_SparseToDenseOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::TileOptionsT *AsTileOptions() { - return type == BuiltinOptions_TileOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::TileOptionsT *AsTileOptions() const { - return type == BuiltinOptions_TileOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ExpandDimsOptionsT *AsExpandDimsOptions() { - return type == BuiltinOptions_ExpandDimsOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ExpandDimsOptionsT *AsExpandDimsOptions() const { - return type == BuiltinOptions_ExpandDimsOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::EqualOptionsT *AsEqualOptions() { - return type == BuiltinOptions_EqualOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::EqualOptionsT *AsEqualOptions() const { - return type == BuiltinOptions_EqualOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::NotEqualOptionsT *AsNotEqualOptions() { - return type == BuiltinOptions_NotEqualOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::NotEqualOptionsT *AsNotEqualOptions() const { - return type == BuiltinOptions_NotEqualOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ShapeOptionsT *AsShapeOptions() { - return type == BuiltinOptions_ShapeOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ShapeOptionsT *AsShapeOptions() const { - return type == BuiltinOptions_ShapeOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::PowOptionsT *AsPowOptions() { - return type == BuiltinOptions_PowOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::PowOptionsT *AsPowOptions() const { - return type == BuiltinOptions_PowOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ArgMinOptionsT *AsArgMinOptions() { - return type == BuiltinOptions_ArgMinOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ArgMinOptionsT *AsArgMinOptions() const { - return type == BuiltinOptions_ArgMinOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::FakeQuantOptionsT *AsFakeQuantOptions() { - return type == BuiltinOptions_FakeQuantOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::FakeQuantOptionsT *AsFakeQuantOptions() const { - return type == BuiltinOptions_FakeQuantOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::PackOptionsT *AsPackOptions() { - return type == BuiltinOptions_PackOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::PackOptionsT *AsPackOptions() const { - return type == BuiltinOptions_PackOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::LogicalOrOptionsT *AsLogicalOrOptions() { - return type == BuiltinOptions_LogicalOrOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::LogicalOrOptionsT *AsLogicalOrOptions() const { - return type == BuiltinOptions_LogicalOrOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::OneHotOptionsT *AsOneHotOptions() { - return type == BuiltinOptions_OneHotOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::OneHotOptionsT *AsOneHotOptions() const { - return type == BuiltinOptions_OneHotOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::LogicalAndOptionsT *AsLogicalAndOptions() { - return type == BuiltinOptions_LogicalAndOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::LogicalAndOptionsT *AsLogicalAndOptions() const { - return type == BuiltinOptions_LogicalAndOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::LogicalNotOptionsT *AsLogicalNotOptions() { - return type == BuiltinOptions_LogicalNotOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::LogicalNotOptionsT *AsLogicalNotOptions() const { - return type == BuiltinOptions_LogicalNotOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::UnpackOptionsT *AsUnpackOptions() { - return type == BuiltinOptions_UnpackOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::UnpackOptionsT *AsUnpackOptions() const { - return type == BuiltinOptions_UnpackOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::FloorDivOptionsT *AsFloorDivOptions() { - return type == BuiltinOptions_FloorDivOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::FloorDivOptionsT *AsFloorDivOptions() const { - return type == BuiltinOptions_FloorDivOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SquareOptionsT *AsSquareOptions() { - return type == BuiltinOptions_SquareOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SquareOptionsT *AsSquareOptions() const { - return type == BuiltinOptions_SquareOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ZerosLikeOptionsT *AsZerosLikeOptions() { - return type == BuiltinOptions_ZerosLikeOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ZerosLikeOptionsT *AsZerosLikeOptions() const { - return type == BuiltinOptions_ZerosLikeOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::FillOptionsT *AsFillOptions() { - return type == BuiltinOptions_FillOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::FillOptionsT *AsFillOptions() const { - return type == BuiltinOptions_FillOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::BidirectionalSequenceLSTMOptionsT *AsBidirectionalSequenceLSTMOptions() { - return type == BuiltinOptions_BidirectionalSequenceLSTMOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::BidirectionalSequenceLSTMOptionsT *AsBidirectionalSequenceLSTMOptions() const { - return type == BuiltinOptions_BidirectionalSequenceLSTMOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::BidirectionalSequenceRNNOptionsT *AsBidirectionalSequenceRNNOptions() { - return type == BuiltinOptions_BidirectionalSequenceRNNOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::BidirectionalSequenceRNNOptionsT *AsBidirectionalSequenceRNNOptions() const { - return type == BuiltinOptions_BidirectionalSequenceRNNOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::UnidirectionalSequenceLSTMOptionsT *AsUnidirectionalSequenceLSTMOptions() { - return type == BuiltinOptions_UnidirectionalSequenceLSTMOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::UnidirectionalSequenceLSTMOptionsT *AsUnidirectionalSequenceLSTMOptions() const { - return type == BuiltinOptions_UnidirectionalSequenceLSTMOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::FloorModOptionsT *AsFloorModOptions() { - return type == BuiltinOptions_FloorModOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::FloorModOptionsT *AsFloorModOptions() const { - return type == BuiltinOptions_FloorModOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::RangeOptionsT *AsRangeOptions() { - return type == BuiltinOptions_RangeOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::RangeOptionsT *AsRangeOptions() const { - return type == BuiltinOptions_RangeOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ResizeNearestNeighborOptionsT *AsResizeNearestNeighborOptions() { - return type == BuiltinOptions_ResizeNearestNeighborOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ResizeNearestNeighborOptionsT *AsResizeNearestNeighborOptions() const { - return type == BuiltinOptions_ResizeNearestNeighborOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::LeakyReluOptionsT *AsLeakyReluOptions() { - return type == BuiltinOptions_LeakyReluOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::LeakyReluOptionsT *AsLeakyReluOptions() const { - return type == BuiltinOptions_LeakyReluOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SquaredDifferenceOptionsT *AsSquaredDifferenceOptions() { - return type == BuiltinOptions_SquaredDifferenceOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SquaredDifferenceOptionsT *AsSquaredDifferenceOptions() const { - return type == BuiltinOptions_SquaredDifferenceOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::MirrorPadOptionsT *AsMirrorPadOptions() { - return type == BuiltinOptions_MirrorPadOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::MirrorPadOptionsT *AsMirrorPadOptions() const { - return type == BuiltinOptions_MirrorPadOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::AbsOptionsT *AsAbsOptions() { - return type == BuiltinOptions_AbsOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::AbsOptionsT *AsAbsOptions() const { - return type == BuiltinOptions_AbsOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SplitVOptionsT *AsSplitVOptions() { - return type == BuiltinOptions_SplitVOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SplitVOptionsT *AsSplitVOptions() const { - return type == BuiltinOptions_SplitVOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::UniqueOptionsT *AsUniqueOptions() { - return type == BuiltinOptions_UniqueOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::UniqueOptionsT *AsUniqueOptions() const { - return type == BuiltinOptions_UniqueOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ReverseV2OptionsT *AsReverseV2Options() { - return type == BuiltinOptions_ReverseV2Options ? - reinterpret_cast(value) : nullptr; - } - const tflite::ReverseV2OptionsT *AsReverseV2Options() const { - return type == BuiltinOptions_ReverseV2Options ? - reinterpret_cast(value) : nullptr; - } - tflite::AddNOptionsT *AsAddNOptions() { - return type == BuiltinOptions_AddNOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::AddNOptionsT *AsAddNOptions() const { - return type == BuiltinOptions_AddNOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::GatherNdOptionsT *AsGatherNdOptions() { - return type == BuiltinOptions_GatherNdOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::GatherNdOptionsT *AsGatherNdOptions() const { - return type == BuiltinOptions_GatherNdOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::CosOptionsT *AsCosOptions() { - return type == BuiltinOptions_CosOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::CosOptionsT *AsCosOptions() const { - return type == BuiltinOptions_CosOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::WhereOptionsT *AsWhereOptions() { - return type == BuiltinOptions_WhereOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::WhereOptionsT *AsWhereOptions() const { - return type == BuiltinOptions_WhereOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::RankOptionsT *AsRankOptions() { - return type == BuiltinOptions_RankOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::RankOptionsT *AsRankOptions() const { - return type == BuiltinOptions_RankOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::ReverseSequenceOptionsT *AsReverseSequenceOptions() { - return type == BuiltinOptions_ReverseSequenceOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ReverseSequenceOptionsT *AsReverseSequenceOptions() const { - return type == BuiltinOptions_ReverseSequenceOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::MatrixDiagOptionsT *AsMatrixDiagOptions() { - return type == BuiltinOptions_MatrixDiagOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::MatrixDiagOptionsT *AsMatrixDiagOptions() const { - return type == BuiltinOptions_MatrixDiagOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::QuantizeOptionsT *AsQuantizeOptions() { - return type == BuiltinOptions_QuantizeOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::QuantizeOptionsT *AsQuantizeOptions() const { - return type == BuiltinOptions_QuantizeOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::MatrixSetDiagOptionsT *AsMatrixSetDiagOptions() { - return type == BuiltinOptions_MatrixSetDiagOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::MatrixSetDiagOptionsT *AsMatrixSetDiagOptions() const { - return type == BuiltinOptions_MatrixSetDiagOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::HardSwishOptionsT *AsHardSwishOptions() { - return type == BuiltinOptions_HardSwishOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::HardSwishOptionsT *AsHardSwishOptions() const { - return type == BuiltinOptions_HardSwishOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::IfOptionsT *AsIfOptions() { - return type == BuiltinOptions_IfOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::IfOptionsT *AsIfOptions() const { - return type == BuiltinOptions_IfOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::WhileOptionsT *AsWhileOptions() { - return type == BuiltinOptions_WhileOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::WhileOptionsT *AsWhileOptions() const { - return type == BuiltinOptions_WhileOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::DepthToSpaceOptionsT *AsDepthToSpaceOptions() { - return type == BuiltinOptions_DepthToSpaceOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::DepthToSpaceOptionsT *AsDepthToSpaceOptions() const { - return type == BuiltinOptions_DepthToSpaceOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::NonMaxSuppressionV4OptionsT *AsNonMaxSuppressionV4Options() { - return type == BuiltinOptions_NonMaxSuppressionV4Options ? - reinterpret_cast(value) : nullptr; - } - const tflite::NonMaxSuppressionV4OptionsT *AsNonMaxSuppressionV4Options() const { - return type == BuiltinOptions_NonMaxSuppressionV4Options ? - reinterpret_cast(value) : nullptr; - } - tflite::NonMaxSuppressionV5OptionsT *AsNonMaxSuppressionV5Options() { - return type == BuiltinOptions_NonMaxSuppressionV5Options ? - reinterpret_cast(value) : nullptr; - } - const tflite::NonMaxSuppressionV5OptionsT *AsNonMaxSuppressionV5Options() const { - return type == BuiltinOptions_NonMaxSuppressionV5Options ? - reinterpret_cast(value) : nullptr; - } - tflite::ScatterNdOptionsT *AsScatterNdOptions() { - return type == BuiltinOptions_ScatterNdOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::ScatterNdOptionsT *AsScatterNdOptions() const { - return type == BuiltinOptions_ScatterNdOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SelectV2OptionsT *AsSelectV2Options() { - return type == BuiltinOptions_SelectV2Options ? - reinterpret_cast(value) : nullptr; - } - const tflite::SelectV2OptionsT *AsSelectV2Options() const { - return type == BuiltinOptions_SelectV2Options ? - reinterpret_cast(value) : nullptr; - } - tflite::DensifyOptionsT *AsDensifyOptions() { - return type == BuiltinOptions_DensifyOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::DensifyOptionsT *AsDensifyOptions() const { - return type == BuiltinOptions_DensifyOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::SegmentSumOptionsT *AsSegmentSumOptions() { - return type == BuiltinOptions_SegmentSumOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::SegmentSumOptionsT *AsSegmentSumOptions() const { - return type == BuiltinOptions_SegmentSumOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::BatchMatMulOptionsT *AsBatchMatMulOptions() { - return type == BuiltinOptions_BatchMatMulOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::BatchMatMulOptionsT *AsBatchMatMulOptions() const { - return type == BuiltinOptions_BatchMatMulOptions ? - reinterpret_cast(value) : nullptr; - } - tflite::CumsumOptionsT *AsCumsumOptions() { - return type == BuiltinOptions_CumsumOptions ? - reinterpret_cast(value) : nullptr; - } - const tflite::CumsumOptionsT *AsCumsumOptions() const { - return type == BuiltinOptions_CumsumOptions ? - reinterpret_cast(value) : nullptr; - } -}; - -bool VerifyBuiltinOptions(flatbuffers::Verifier &verifier, const void *obj, BuiltinOptions type); -bool VerifyBuiltinOptionsVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types); - -enum Padding { - Padding_SAME = 0, - Padding_VALID = 1, - Padding_MIN = Padding_SAME, - Padding_MAX = Padding_VALID -}; - -inline const Padding (&EnumValuesPadding())[2] { - static const Padding values[] = { - Padding_SAME, - Padding_VALID - }; - return values; -} - -inline const char * const *EnumNamesPadding() { - static const char * const names[3] = { - "SAME", - "VALID", - nullptr - }; - return names; -} - -inline const char *EnumNamePadding(Padding e) { - if (flatbuffers::IsOutRange(e, Padding_SAME, Padding_VALID)) return ""; - const size_t index = static_cast(e); - return EnumNamesPadding()[index]; -} - -enum ActivationFunctionType { - ActivationFunctionType_NONE = 0, - ActivationFunctionType_RELU = 1, - ActivationFunctionType_RELU_N1_TO_1 = 2, - ActivationFunctionType_RELU6 = 3, - ActivationFunctionType_TANH = 4, - ActivationFunctionType_SIGN_BIT = 5, - ActivationFunctionType_MIN = ActivationFunctionType_NONE, - ActivationFunctionType_MAX = ActivationFunctionType_SIGN_BIT -}; - -inline const ActivationFunctionType (&EnumValuesActivationFunctionType())[6] { - static const ActivationFunctionType values[] = { - ActivationFunctionType_NONE, - ActivationFunctionType_RELU, - ActivationFunctionType_RELU_N1_TO_1, - ActivationFunctionType_RELU6, - ActivationFunctionType_TANH, - ActivationFunctionType_SIGN_BIT - }; - return values; -} - -inline const char * const *EnumNamesActivationFunctionType() { - static const char * const names[7] = { - "NONE", - "RELU", - "RELU_N1_TO_1", - "RELU6", - "TANH", - "SIGN_BIT", - nullptr - }; - return names; -} - -inline const char *EnumNameActivationFunctionType(ActivationFunctionType e) { - if (flatbuffers::IsOutRange(e, ActivationFunctionType_NONE, ActivationFunctionType_SIGN_BIT)) return ""; - const size_t index = static_cast(e); - return EnumNamesActivationFunctionType()[index]; -} - -enum LSHProjectionType { - LSHProjectionType_UNKNOWN = 0, - LSHProjectionType_SPARSE = 1, - LSHProjectionType_DENSE = 2, - LSHProjectionType_MIN = LSHProjectionType_UNKNOWN, - LSHProjectionType_MAX = LSHProjectionType_DENSE -}; - -inline const LSHProjectionType (&EnumValuesLSHProjectionType())[3] { - static const LSHProjectionType values[] = { - LSHProjectionType_UNKNOWN, - LSHProjectionType_SPARSE, - LSHProjectionType_DENSE - }; - return values; -} - -inline const char * const *EnumNamesLSHProjectionType() { - static const char * const names[4] = { - "UNKNOWN", - "SPARSE", - "DENSE", - nullptr - }; - return names; -} - -inline const char *EnumNameLSHProjectionType(LSHProjectionType e) { - if (flatbuffers::IsOutRange(e, LSHProjectionType_UNKNOWN, LSHProjectionType_DENSE)) return ""; - const size_t index = static_cast(e); - return EnumNamesLSHProjectionType()[index]; -} - -enum FullyConnectedOptionsWeightsFormat { - FullyConnectedOptionsWeightsFormat_DEFAULT = 0, - FullyConnectedOptionsWeightsFormat_SHUFFLED4x16INT8 = 1, - FullyConnectedOptionsWeightsFormat_MIN = FullyConnectedOptionsWeightsFormat_DEFAULT, - FullyConnectedOptionsWeightsFormat_MAX = FullyConnectedOptionsWeightsFormat_SHUFFLED4x16INT8 -}; - -inline const FullyConnectedOptionsWeightsFormat (&EnumValuesFullyConnectedOptionsWeightsFormat())[2] { - static const FullyConnectedOptionsWeightsFormat values[] = { - FullyConnectedOptionsWeightsFormat_DEFAULT, - FullyConnectedOptionsWeightsFormat_SHUFFLED4x16INT8 - }; - return values; -} - -inline const char * const *EnumNamesFullyConnectedOptionsWeightsFormat() { - static const char * const names[3] = { - "DEFAULT", - "SHUFFLED4x16INT8", - nullptr - }; - return names; -} - -inline const char *EnumNameFullyConnectedOptionsWeightsFormat(FullyConnectedOptionsWeightsFormat e) { - if (flatbuffers::IsOutRange(e, FullyConnectedOptionsWeightsFormat_DEFAULT, FullyConnectedOptionsWeightsFormat_SHUFFLED4x16INT8)) return ""; - const size_t index = static_cast(e); - return EnumNamesFullyConnectedOptionsWeightsFormat()[index]; -} - -enum LSTMKernelType { - LSTMKernelType_FULL = 0, - LSTMKernelType_BASIC = 1, - LSTMKernelType_MIN = LSTMKernelType_FULL, - LSTMKernelType_MAX = LSTMKernelType_BASIC -}; - -inline const LSTMKernelType (&EnumValuesLSTMKernelType())[2] { - static const LSTMKernelType values[] = { - LSTMKernelType_FULL, - LSTMKernelType_BASIC - }; - return values; -} - -inline const char * const *EnumNamesLSTMKernelType() { - static const char * const names[3] = { - "FULL", - "BASIC", - nullptr - }; - return names; -} - -inline const char *EnumNameLSTMKernelType(LSTMKernelType e) { - if (flatbuffers::IsOutRange(e, LSTMKernelType_FULL, LSTMKernelType_BASIC)) return ""; - const size_t index = static_cast(e); - return EnumNamesLSTMKernelType()[index]; -} - -enum CombinerType { - CombinerType_SUM = 0, - CombinerType_MEAN = 1, - CombinerType_SQRTN = 2, - CombinerType_MIN = CombinerType_SUM, - CombinerType_MAX = CombinerType_SQRTN -}; - -inline const CombinerType (&EnumValuesCombinerType())[3] { - static const CombinerType values[] = { - CombinerType_SUM, - CombinerType_MEAN, - CombinerType_SQRTN - }; - return values; -} - -inline const char * const *EnumNamesCombinerType() { - static const char * const names[4] = { - "SUM", - "MEAN", - "SQRTN", - nullptr - }; - return names; -} - -inline const char *EnumNameCombinerType(CombinerType e) { - if (flatbuffers::IsOutRange(e, CombinerType_SUM, CombinerType_SQRTN)) return ""; - const size_t index = static_cast(e); - return EnumNamesCombinerType()[index]; -} - -enum MirrorPadMode { - MirrorPadMode_REFLECT = 0, - MirrorPadMode_SYMMETRIC = 1, - MirrorPadMode_MIN = MirrorPadMode_REFLECT, - MirrorPadMode_MAX = MirrorPadMode_SYMMETRIC -}; - -inline const MirrorPadMode (&EnumValuesMirrorPadMode())[2] { - static const MirrorPadMode values[] = { - MirrorPadMode_REFLECT, - MirrorPadMode_SYMMETRIC - }; - return values; -} - -inline const char * const *EnumNamesMirrorPadMode() { - static const char * const names[3] = { - "REFLECT", - "SYMMETRIC", - nullptr - }; - return names; -} - -inline const char *EnumNameMirrorPadMode(MirrorPadMode e) { - if (flatbuffers::IsOutRange(e, MirrorPadMode_REFLECT, MirrorPadMode_SYMMETRIC)) return ""; - const size_t index = static_cast(e); - return EnumNamesMirrorPadMode()[index]; -} - -enum CustomOptionsFormat { - CustomOptionsFormat_FLEXBUFFERS = 0, - CustomOptionsFormat_MIN = CustomOptionsFormat_FLEXBUFFERS, - CustomOptionsFormat_MAX = CustomOptionsFormat_FLEXBUFFERS -}; - -inline const CustomOptionsFormat (&EnumValuesCustomOptionsFormat())[1] { - static const CustomOptionsFormat values[] = { - CustomOptionsFormat_FLEXBUFFERS - }; - return values; -} - -inline const char * const *EnumNamesCustomOptionsFormat() { - static const char * const names[2] = { - "FLEXBUFFERS", - nullptr - }; - return names; -} - -inline const char *EnumNameCustomOptionsFormat(CustomOptionsFormat e) { - if (flatbuffers::IsOutRange(e, CustomOptionsFormat_FLEXBUFFERS, CustomOptionsFormat_FLEXBUFFERS)) return ""; - const size_t index = static_cast(e); - return EnumNamesCustomOptionsFormat()[index]; -} - -struct CustomQuantizationT : public flatbuffers::NativeTable { - typedef CustomQuantization TableType; - std::vector custom; - CustomQuantizationT() { - } -}; - -struct CustomQuantization FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef CustomQuantizationT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_CUSTOM = 4 - }; - const flatbuffers::Vector *custom() const { - return GetPointer *>(VT_CUSTOM); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_CUSTOM) && - verifier.VerifyVector(custom()) && - verifier.EndTable(); - } - CustomQuantizationT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(CustomQuantizationT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const CustomQuantizationT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct CustomQuantizationBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_custom(flatbuffers::Offset> custom) { - fbb_.AddOffset(CustomQuantization::VT_CUSTOM, custom); - } - explicit CustomQuantizationBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - CustomQuantizationBuilder &operator=(const CustomQuantizationBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateCustomQuantization( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> custom = 0) { - CustomQuantizationBuilder builder_(_fbb); - builder_.add_custom(custom); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateCustomQuantizationDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *custom = nullptr) { - if (custom) { _fbb.ForceVectorAlignment(custom->size(), sizeof(uint8_t), 16); } - auto custom__ = custom ? _fbb.CreateVector(*custom) : 0; - return tflite::CreateCustomQuantization( - _fbb, - custom__); -} - -flatbuffers::Offset CreateCustomQuantization(flatbuffers::FlatBufferBuilder &_fbb, const CustomQuantizationT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct QuantizationParametersT : public flatbuffers::NativeTable { - typedef QuantizationParameters TableType; - std::vector min; - std::vector max; - std::vector scale; - std::vector zero_point; - tflite::QuantizationDetailsUnion details; - int32_t quantized_dimension; - QuantizationParametersT() - : quantized_dimension(0) { - } -}; - -struct QuantizationParameters FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef QuantizationParametersT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_MIN = 4, - VT_MAX = 6, - VT_SCALE = 8, - VT_ZERO_POINT = 10, - VT_DETAILS_TYPE = 12, - VT_DETAILS = 14, - VT_QUANTIZED_DIMENSION = 16 - }; - const flatbuffers::Vector *min() const { - return GetPointer *>(VT_MIN); - } - const flatbuffers::Vector *max() const { - return GetPointer *>(VT_MAX); - } - const flatbuffers::Vector *scale() const { - return GetPointer *>(VT_SCALE); - } - const flatbuffers::Vector *zero_point() const { - return GetPointer *>(VT_ZERO_POINT); - } - tflite::QuantizationDetails details_type() const { - return static_cast(GetField(VT_DETAILS_TYPE, 0)); - } - const void *details() const { - return GetPointer(VT_DETAILS); - } - template const T *details_as() const; - const tflite::CustomQuantization *details_as_CustomQuantization() const { - return details_type() == tflite::QuantizationDetails_CustomQuantization ? static_cast(details()) : nullptr; - } - int32_t quantized_dimension() const { - return GetField(VT_QUANTIZED_DIMENSION, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_MIN) && - verifier.VerifyVector(min()) && - VerifyOffset(verifier, VT_MAX) && - verifier.VerifyVector(max()) && - VerifyOffset(verifier, VT_SCALE) && - verifier.VerifyVector(scale()) && - VerifyOffset(verifier, VT_ZERO_POINT) && - verifier.VerifyVector(zero_point()) && - VerifyField(verifier, VT_DETAILS_TYPE) && - VerifyOffset(verifier, VT_DETAILS) && - VerifyQuantizationDetails(verifier, details(), details_type()) && - VerifyField(verifier, VT_QUANTIZED_DIMENSION) && - verifier.EndTable(); - } - QuantizationParametersT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(QuantizationParametersT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const QuantizationParametersT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -template<> inline const tflite::CustomQuantization *QuantizationParameters::details_as() const { - return details_as_CustomQuantization(); -} - -struct QuantizationParametersBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_min(flatbuffers::Offset> min) { - fbb_.AddOffset(QuantizationParameters::VT_MIN, min); - } - void add_max(flatbuffers::Offset> max) { - fbb_.AddOffset(QuantizationParameters::VT_MAX, max); - } - void add_scale(flatbuffers::Offset> scale) { - fbb_.AddOffset(QuantizationParameters::VT_SCALE, scale); - } - void add_zero_point(flatbuffers::Offset> zero_point) { - fbb_.AddOffset(QuantizationParameters::VT_ZERO_POINT, zero_point); - } - void add_details_type(tflite::QuantizationDetails details_type) { - fbb_.AddElement(QuantizationParameters::VT_DETAILS_TYPE, static_cast(details_type), 0); - } - void add_details(flatbuffers::Offset details) { - fbb_.AddOffset(QuantizationParameters::VT_DETAILS, details); - } - void add_quantized_dimension(int32_t quantized_dimension) { - fbb_.AddElement(QuantizationParameters::VT_QUANTIZED_DIMENSION, quantized_dimension, 0); - } - explicit QuantizationParametersBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - QuantizationParametersBuilder &operator=(const QuantizationParametersBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateQuantizationParameters( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> min = 0, - flatbuffers::Offset> max = 0, - flatbuffers::Offset> scale = 0, - flatbuffers::Offset> zero_point = 0, - tflite::QuantizationDetails details_type = tflite::QuantizationDetails_NONE, - flatbuffers::Offset details = 0, - int32_t quantized_dimension = 0) { - QuantizationParametersBuilder builder_(_fbb); - builder_.add_quantized_dimension(quantized_dimension); - builder_.add_details(details); - builder_.add_zero_point(zero_point); - builder_.add_scale(scale); - builder_.add_max(max); - builder_.add_min(min); - builder_.add_details_type(details_type); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateQuantizationParametersDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *min = nullptr, - const std::vector *max = nullptr, - const std::vector *scale = nullptr, - const std::vector *zero_point = nullptr, - tflite::QuantizationDetails details_type = tflite::QuantizationDetails_NONE, - flatbuffers::Offset details = 0, - int32_t quantized_dimension = 0) { - auto min__ = min ? _fbb.CreateVector(*min) : 0; - auto max__ = max ? _fbb.CreateVector(*max) : 0; - auto scale__ = scale ? _fbb.CreateVector(*scale) : 0; - auto zero_point__ = zero_point ? _fbb.CreateVector(*zero_point) : 0; - return tflite::CreateQuantizationParameters( - _fbb, - min__, - max__, - scale__, - zero_point__, - details_type, - details, - quantized_dimension); -} - -flatbuffers::Offset CreateQuantizationParameters(flatbuffers::FlatBufferBuilder &_fbb, const QuantizationParametersT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct Int32VectorT : public flatbuffers::NativeTable { - typedef Int32Vector TableType; - std::vector values; - Int32VectorT() { - } -}; - -struct Int32Vector FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef Int32VectorT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_VALUES = 4 - }; - const flatbuffers::Vector *values() const { - return GetPointer *>(VT_VALUES); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_VALUES) && - verifier.VerifyVector(values()) && - verifier.EndTable(); - } - Int32VectorT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(Int32VectorT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const Int32VectorT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct Int32VectorBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_values(flatbuffers::Offset> values) { - fbb_.AddOffset(Int32Vector::VT_VALUES, values); - } - explicit Int32VectorBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - Int32VectorBuilder &operator=(const Int32VectorBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateInt32Vector( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> values = 0) { - Int32VectorBuilder builder_(_fbb); - builder_.add_values(values); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateInt32VectorDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *values = nullptr) { - auto values__ = values ? _fbb.CreateVector(*values) : 0; - return tflite::CreateInt32Vector( - _fbb, - values__); -} - -flatbuffers::Offset CreateInt32Vector(flatbuffers::FlatBufferBuilder &_fbb, const Int32VectorT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct Uint16VectorT : public flatbuffers::NativeTable { - typedef Uint16Vector TableType; - std::vector values; - Uint16VectorT() { - } -}; - -struct Uint16Vector FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef Uint16VectorT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_VALUES = 4 - }; - const flatbuffers::Vector *values() const { - return GetPointer *>(VT_VALUES); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_VALUES) && - verifier.VerifyVector(values()) && - verifier.EndTable(); - } - Uint16VectorT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(Uint16VectorT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const Uint16VectorT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct Uint16VectorBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_values(flatbuffers::Offset> values) { - fbb_.AddOffset(Uint16Vector::VT_VALUES, values); - } - explicit Uint16VectorBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - Uint16VectorBuilder &operator=(const Uint16VectorBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateUint16Vector( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> values = 0) { - Uint16VectorBuilder builder_(_fbb); - builder_.add_values(values); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateUint16VectorDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *values = nullptr) { - if (values) { _fbb.ForceVectorAlignment(values->size(), sizeof(uint16_t), 4); } - auto values__ = values ? _fbb.CreateVector(*values) : 0; - return tflite::CreateUint16Vector( - _fbb, - values__); -} - -flatbuffers::Offset CreateUint16Vector(flatbuffers::FlatBufferBuilder &_fbb, const Uint16VectorT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct Uint8VectorT : public flatbuffers::NativeTable { - typedef Uint8Vector TableType; - std::vector values; - Uint8VectorT() { - } -}; - -struct Uint8Vector FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef Uint8VectorT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_VALUES = 4 - }; - const flatbuffers::Vector *values() const { - return GetPointer *>(VT_VALUES); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_VALUES) && - verifier.VerifyVector(values()) && - verifier.EndTable(); - } - Uint8VectorT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(Uint8VectorT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const Uint8VectorT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct Uint8VectorBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_values(flatbuffers::Offset> values) { - fbb_.AddOffset(Uint8Vector::VT_VALUES, values); - } - explicit Uint8VectorBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - Uint8VectorBuilder &operator=(const Uint8VectorBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateUint8Vector( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> values = 0) { - Uint8VectorBuilder builder_(_fbb); - builder_.add_values(values); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateUint8VectorDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *values = nullptr) { - if (values) { _fbb.ForceVectorAlignment(values->size(), sizeof(uint8_t), 4); } - auto values__ = values ? _fbb.CreateVector(*values) : 0; - return tflite::CreateUint8Vector( - _fbb, - values__); -} - -flatbuffers::Offset CreateUint8Vector(flatbuffers::FlatBufferBuilder &_fbb, const Uint8VectorT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct DimensionMetadataT : public flatbuffers::NativeTable { - typedef DimensionMetadata TableType; - tflite::DimensionType format; - int32_t dense_size; - tflite::SparseIndexVectorUnion array_segments; - tflite::SparseIndexVectorUnion array_indices; - DimensionMetadataT() - : format(tflite::DimensionType_DENSE), - dense_size(0) { - } -}; - -struct DimensionMetadata FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef DimensionMetadataT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FORMAT = 4, - VT_DENSE_SIZE = 6, - VT_ARRAY_SEGMENTS_TYPE = 8, - VT_ARRAY_SEGMENTS = 10, - VT_ARRAY_INDICES_TYPE = 12, - VT_ARRAY_INDICES = 14 - }; - tflite::DimensionType format() const { - return static_cast(GetField(VT_FORMAT, 0)); - } - int32_t dense_size() const { - return GetField(VT_DENSE_SIZE, 0); - } - tflite::SparseIndexVector array_segments_type() const { - return static_cast(GetField(VT_ARRAY_SEGMENTS_TYPE, 0)); - } - const void *array_segments() const { - return GetPointer(VT_ARRAY_SEGMENTS); - } - template const T *array_segments_as() const; - const tflite::Int32Vector *array_segments_as_Int32Vector() const { - return array_segments_type() == tflite::SparseIndexVector_Int32Vector ? static_cast(array_segments()) : nullptr; - } - const tflite::Uint16Vector *array_segments_as_Uint16Vector() const { - return array_segments_type() == tflite::SparseIndexVector_Uint16Vector ? static_cast(array_segments()) : nullptr; - } - const tflite::Uint8Vector *array_segments_as_Uint8Vector() const { - return array_segments_type() == tflite::SparseIndexVector_Uint8Vector ? static_cast(array_segments()) : nullptr; - } - tflite::SparseIndexVector array_indices_type() const { - return static_cast(GetField(VT_ARRAY_INDICES_TYPE, 0)); - } - const void *array_indices() const { - return GetPointer(VT_ARRAY_INDICES); - } - template const T *array_indices_as() const; - const tflite::Int32Vector *array_indices_as_Int32Vector() const { - return array_indices_type() == tflite::SparseIndexVector_Int32Vector ? static_cast(array_indices()) : nullptr; - } - const tflite::Uint16Vector *array_indices_as_Uint16Vector() const { - return array_indices_type() == tflite::SparseIndexVector_Uint16Vector ? static_cast(array_indices()) : nullptr; - } - const tflite::Uint8Vector *array_indices_as_Uint8Vector() const { - return array_indices_type() == tflite::SparseIndexVector_Uint8Vector ? static_cast(array_indices()) : nullptr; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FORMAT) && - VerifyField(verifier, VT_DENSE_SIZE) && - VerifyField(verifier, VT_ARRAY_SEGMENTS_TYPE) && - VerifyOffset(verifier, VT_ARRAY_SEGMENTS) && - VerifySparseIndexVector(verifier, array_segments(), array_segments_type()) && - VerifyField(verifier, VT_ARRAY_INDICES_TYPE) && - VerifyOffset(verifier, VT_ARRAY_INDICES) && - VerifySparseIndexVector(verifier, array_indices(), array_indices_type()) && - verifier.EndTable(); - } - DimensionMetadataT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(DimensionMetadataT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const DimensionMetadataT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -template<> inline const tflite::Int32Vector *DimensionMetadata::array_segments_as() const { - return array_segments_as_Int32Vector(); -} - -template<> inline const tflite::Uint16Vector *DimensionMetadata::array_segments_as() const { - return array_segments_as_Uint16Vector(); -} - -template<> inline const tflite::Uint8Vector *DimensionMetadata::array_segments_as() const { - return array_segments_as_Uint8Vector(); -} - -template<> inline const tflite::Int32Vector *DimensionMetadata::array_indices_as() const { - return array_indices_as_Int32Vector(); -} - -template<> inline const tflite::Uint16Vector *DimensionMetadata::array_indices_as() const { - return array_indices_as_Uint16Vector(); -} - -template<> inline const tflite::Uint8Vector *DimensionMetadata::array_indices_as() const { - return array_indices_as_Uint8Vector(); -} - -struct DimensionMetadataBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_format(tflite::DimensionType format) { - fbb_.AddElement(DimensionMetadata::VT_FORMAT, static_cast(format), 0); - } - void add_dense_size(int32_t dense_size) { - fbb_.AddElement(DimensionMetadata::VT_DENSE_SIZE, dense_size, 0); - } - void add_array_segments_type(tflite::SparseIndexVector array_segments_type) { - fbb_.AddElement(DimensionMetadata::VT_ARRAY_SEGMENTS_TYPE, static_cast(array_segments_type), 0); - } - void add_array_segments(flatbuffers::Offset array_segments) { - fbb_.AddOffset(DimensionMetadata::VT_ARRAY_SEGMENTS, array_segments); - } - void add_array_indices_type(tflite::SparseIndexVector array_indices_type) { - fbb_.AddElement(DimensionMetadata::VT_ARRAY_INDICES_TYPE, static_cast(array_indices_type), 0); - } - void add_array_indices(flatbuffers::Offset array_indices) { - fbb_.AddOffset(DimensionMetadata::VT_ARRAY_INDICES, array_indices); - } - explicit DimensionMetadataBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - DimensionMetadataBuilder &operator=(const DimensionMetadataBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateDimensionMetadata( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::DimensionType format = tflite::DimensionType_DENSE, - int32_t dense_size = 0, - tflite::SparseIndexVector array_segments_type = tflite::SparseIndexVector_NONE, - flatbuffers::Offset array_segments = 0, - tflite::SparseIndexVector array_indices_type = tflite::SparseIndexVector_NONE, - flatbuffers::Offset array_indices = 0) { - DimensionMetadataBuilder builder_(_fbb); - builder_.add_array_indices(array_indices); - builder_.add_array_segments(array_segments); - builder_.add_dense_size(dense_size); - builder_.add_array_indices_type(array_indices_type); - builder_.add_array_segments_type(array_segments_type); - builder_.add_format(format); - return builder_.Finish(); -} - -flatbuffers::Offset CreateDimensionMetadata(flatbuffers::FlatBufferBuilder &_fbb, const DimensionMetadataT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SparsityParametersT : public flatbuffers::NativeTable { - typedef SparsityParameters TableType; - std::vector traversal_order; - std::vector block_map; - std::vector> dim_metadata; - SparsityParametersT() { - } -}; - -struct SparsityParameters FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SparsityParametersT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_TRAVERSAL_ORDER = 4, - VT_BLOCK_MAP = 6, - VT_DIM_METADATA = 8 - }; - const flatbuffers::Vector *traversal_order() const { - return GetPointer *>(VT_TRAVERSAL_ORDER); - } - const flatbuffers::Vector *block_map() const { - return GetPointer *>(VT_BLOCK_MAP); - } - const flatbuffers::Vector> *dim_metadata() const { - return GetPointer> *>(VT_DIM_METADATA); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_TRAVERSAL_ORDER) && - verifier.VerifyVector(traversal_order()) && - VerifyOffset(verifier, VT_BLOCK_MAP) && - verifier.VerifyVector(block_map()) && - VerifyOffset(verifier, VT_DIM_METADATA) && - verifier.VerifyVector(dim_metadata()) && - verifier.VerifyVectorOfTables(dim_metadata()) && - verifier.EndTable(); - } - SparsityParametersT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SparsityParametersT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SparsityParametersT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SparsityParametersBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_traversal_order(flatbuffers::Offset> traversal_order) { - fbb_.AddOffset(SparsityParameters::VT_TRAVERSAL_ORDER, traversal_order); - } - void add_block_map(flatbuffers::Offset> block_map) { - fbb_.AddOffset(SparsityParameters::VT_BLOCK_MAP, block_map); - } - void add_dim_metadata(flatbuffers::Offset>> dim_metadata) { - fbb_.AddOffset(SparsityParameters::VT_DIM_METADATA, dim_metadata); - } - explicit SparsityParametersBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SparsityParametersBuilder &operator=(const SparsityParametersBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSparsityParameters( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> traversal_order = 0, - flatbuffers::Offset> block_map = 0, - flatbuffers::Offset>> dim_metadata = 0) { - SparsityParametersBuilder builder_(_fbb); - builder_.add_dim_metadata(dim_metadata); - builder_.add_block_map(block_map); - builder_.add_traversal_order(traversal_order); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateSparsityParametersDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *traversal_order = nullptr, - const std::vector *block_map = nullptr, - const std::vector> *dim_metadata = nullptr) { - auto traversal_order__ = traversal_order ? _fbb.CreateVector(*traversal_order) : 0; - auto block_map__ = block_map ? _fbb.CreateVector(*block_map) : 0; - auto dim_metadata__ = dim_metadata ? _fbb.CreateVector>(*dim_metadata) : 0; - return tflite::CreateSparsityParameters( - _fbb, - traversal_order__, - block_map__, - dim_metadata__); -} - -flatbuffers::Offset CreateSparsityParameters(flatbuffers::FlatBufferBuilder &_fbb, const SparsityParametersT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct TensorT : public flatbuffers::NativeTable { - typedef Tensor TableType; - std::vector shape; - tflite::TensorType type; - uint32_t buffer; - std::string name; - std::unique_ptr quantization; - bool is_variable; - std::unique_ptr sparsity; - std::vector shape_signature; - TensorT() - : type(tflite::TensorType_FLOAT32), - buffer(0), - is_variable(false) { - } -}; - -struct Tensor FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef TensorT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SHAPE = 4, - VT_TYPE = 6, - VT_BUFFER = 8, - VT_NAME = 10, - VT_QUANTIZATION = 12, - VT_IS_VARIABLE = 14, - VT_SPARSITY = 16, - VT_SHAPE_SIGNATURE = 18 - }; - const flatbuffers::Vector *shape() const { - return GetPointer *>(VT_SHAPE); - } - tflite::TensorType type() const { - return static_cast(GetField(VT_TYPE, 0)); - } - uint32_t buffer() const { - return GetField(VT_BUFFER, 0); - } - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); - } - const tflite::QuantizationParameters *quantization() const { - return GetPointer(VT_QUANTIZATION); - } - bool is_variable() const { - return GetField(VT_IS_VARIABLE, 0) != 0; - } - const tflite::SparsityParameters *sparsity() const { - return GetPointer(VT_SPARSITY); - } - const flatbuffers::Vector *shape_signature() const { - return GetPointer *>(VT_SHAPE_SIGNATURE); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_SHAPE) && - verifier.VerifyVector(shape()) && - VerifyField(verifier, VT_TYPE) && - VerifyField(verifier, VT_BUFFER) && - VerifyOffset(verifier, VT_NAME) && - verifier.VerifyString(name()) && - VerifyOffset(verifier, VT_QUANTIZATION) && - verifier.VerifyTable(quantization()) && - VerifyField(verifier, VT_IS_VARIABLE) && - VerifyOffset(verifier, VT_SPARSITY) && - verifier.VerifyTable(sparsity()) && - VerifyOffset(verifier, VT_SHAPE_SIGNATURE) && - verifier.VerifyVector(shape_signature()) && - verifier.EndTable(); - } - TensorT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(TensorT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const TensorT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct TensorBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_shape(flatbuffers::Offset> shape) { - fbb_.AddOffset(Tensor::VT_SHAPE, shape); - } - void add_type(tflite::TensorType type) { - fbb_.AddElement(Tensor::VT_TYPE, static_cast(type), 0); - } - void add_buffer(uint32_t buffer) { - fbb_.AddElement(Tensor::VT_BUFFER, buffer, 0); - } - void add_name(flatbuffers::Offset name) { - fbb_.AddOffset(Tensor::VT_NAME, name); - } - void add_quantization(flatbuffers::Offset quantization) { - fbb_.AddOffset(Tensor::VT_QUANTIZATION, quantization); - } - void add_is_variable(bool is_variable) { - fbb_.AddElement(Tensor::VT_IS_VARIABLE, static_cast(is_variable), 0); - } - void add_sparsity(flatbuffers::Offset sparsity) { - fbb_.AddOffset(Tensor::VT_SPARSITY, sparsity); - } - void add_shape_signature(flatbuffers::Offset> shape_signature) { - fbb_.AddOffset(Tensor::VT_SHAPE_SIGNATURE, shape_signature); - } - explicit TensorBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TensorBuilder &operator=(const TensorBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateTensor( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> shape = 0, - tflite::TensorType type = tflite::TensorType_FLOAT32, - uint32_t buffer = 0, - flatbuffers::Offset name = 0, - flatbuffers::Offset quantization = 0, - bool is_variable = false, - flatbuffers::Offset sparsity = 0, - flatbuffers::Offset> shape_signature = 0) { - TensorBuilder builder_(_fbb); - builder_.add_shape_signature(shape_signature); - builder_.add_sparsity(sparsity); - builder_.add_quantization(quantization); - builder_.add_name(name); - builder_.add_buffer(buffer); - builder_.add_shape(shape); - builder_.add_is_variable(is_variable); - builder_.add_type(type); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateTensorDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *shape = nullptr, - tflite::TensorType type = tflite::TensorType_FLOAT32, - uint32_t buffer = 0, - const char *name = nullptr, - flatbuffers::Offset quantization = 0, - bool is_variable = false, - flatbuffers::Offset sparsity = 0, - const std::vector *shape_signature = nullptr) { - auto shape__ = shape ? _fbb.CreateVector(*shape) : 0; - auto name__ = name ? _fbb.CreateString(name) : 0; - auto shape_signature__ = shape_signature ? _fbb.CreateVector(*shape_signature) : 0; - return tflite::CreateTensor( - _fbb, - shape__, - type, - buffer, - name__, - quantization, - is_variable, - sparsity, - shape_signature__); -} - -flatbuffers::Offset CreateTensor(flatbuffers::FlatBufferBuilder &_fbb, const TensorT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct Conv2DOptionsT : public flatbuffers::NativeTable { - typedef Conv2DOptions TableType; - tflite::Padding padding; - int32_t stride_w; - int32_t stride_h; - tflite::ActivationFunctionType fused_activation_function; - int32_t dilation_w_factor; - int32_t dilation_h_factor; - Conv2DOptionsT() - : padding(tflite::Padding_SAME), - stride_w(0), - stride_h(0), - fused_activation_function(tflite::ActivationFunctionType_NONE), - dilation_w_factor(1), - dilation_h_factor(1) { - } -}; - -struct Conv2DOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef Conv2DOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_PADDING = 4, - VT_STRIDE_W = 6, - VT_STRIDE_H = 8, - VT_FUSED_ACTIVATION_FUNCTION = 10, - VT_DILATION_W_FACTOR = 12, - VT_DILATION_H_FACTOR = 14 - }; - tflite::Padding padding() const { - return static_cast(GetField(VT_PADDING, 0)); - } - int32_t stride_w() const { - return GetField(VT_STRIDE_W, 0); - } - int32_t stride_h() const { - return GetField(VT_STRIDE_H, 0); - } - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - int32_t dilation_w_factor() const { - return GetField(VT_DILATION_W_FACTOR, 1); - } - int32_t dilation_h_factor() const { - return GetField(VT_DILATION_H_FACTOR, 1); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_PADDING) && - VerifyField(verifier, VT_STRIDE_W) && - VerifyField(verifier, VT_STRIDE_H) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_DILATION_W_FACTOR) && - VerifyField(verifier, VT_DILATION_H_FACTOR) && - verifier.EndTable(); - } - Conv2DOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(Conv2DOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const Conv2DOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct Conv2DOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_padding(tflite::Padding padding) { - fbb_.AddElement(Conv2DOptions::VT_PADDING, static_cast(padding), 0); - } - void add_stride_w(int32_t stride_w) { - fbb_.AddElement(Conv2DOptions::VT_STRIDE_W, stride_w, 0); - } - void add_stride_h(int32_t stride_h) { - fbb_.AddElement(Conv2DOptions::VT_STRIDE_H, stride_h, 0); - } - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(Conv2DOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_dilation_w_factor(int32_t dilation_w_factor) { - fbb_.AddElement(Conv2DOptions::VT_DILATION_W_FACTOR, dilation_w_factor, 1); - } - void add_dilation_h_factor(int32_t dilation_h_factor) { - fbb_.AddElement(Conv2DOptions::VT_DILATION_H_FACTOR, dilation_h_factor, 1); - } - explicit Conv2DOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - Conv2DOptionsBuilder &operator=(const Conv2DOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateConv2DOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::Padding padding = tflite::Padding_SAME, - int32_t stride_w = 0, - int32_t stride_h = 0, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - int32_t dilation_w_factor = 1, - int32_t dilation_h_factor = 1) { - Conv2DOptionsBuilder builder_(_fbb); - builder_.add_dilation_h_factor(dilation_h_factor); - builder_.add_dilation_w_factor(dilation_w_factor); - builder_.add_stride_h(stride_h); - builder_.add_stride_w(stride_w); - builder_.add_fused_activation_function(fused_activation_function); - builder_.add_padding(padding); - return builder_.Finish(); -} - -flatbuffers::Offset CreateConv2DOptions(flatbuffers::FlatBufferBuilder &_fbb, const Conv2DOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct Pool2DOptionsT : public flatbuffers::NativeTable { - typedef Pool2DOptions TableType; - tflite::Padding padding; - int32_t stride_w; - int32_t stride_h; - int32_t filter_width; - int32_t filter_height; - tflite::ActivationFunctionType fused_activation_function; - Pool2DOptionsT() - : padding(tflite::Padding_SAME), - stride_w(0), - stride_h(0), - filter_width(0), - filter_height(0), - fused_activation_function(tflite::ActivationFunctionType_NONE) { - } -}; - -struct Pool2DOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef Pool2DOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_PADDING = 4, - VT_STRIDE_W = 6, - VT_STRIDE_H = 8, - VT_FILTER_WIDTH = 10, - VT_FILTER_HEIGHT = 12, - VT_FUSED_ACTIVATION_FUNCTION = 14 - }; - tflite::Padding padding() const { - return static_cast(GetField(VT_PADDING, 0)); - } - int32_t stride_w() const { - return GetField(VT_STRIDE_W, 0); - } - int32_t stride_h() const { - return GetField(VT_STRIDE_H, 0); - } - int32_t filter_width() const { - return GetField(VT_FILTER_WIDTH, 0); - } - int32_t filter_height() const { - return GetField(VT_FILTER_HEIGHT, 0); - } - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_PADDING) && - VerifyField(verifier, VT_STRIDE_W) && - VerifyField(verifier, VT_STRIDE_H) && - VerifyField(verifier, VT_FILTER_WIDTH) && - VerifyField(verifier, VT_FILTER_HEIGHT) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - verifier.EndTable(); - } - Pool2DOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(Pool2DOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const Pool2DOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct Pool2DOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_padding(tflite::Padding padding) { - fbb_.AddElement(Pool2DOptions::VT_PADDING, static_cast(padding), 0); - } - void add_stride_w(int32_t stride_w) { - fbb_.AddElement(Pool2DOptions::VT_STRIDE_W, stride_w, 0); - } - void add_stride_h(int32_t stride_h) { - fbb_.AddElement(Pool2DOptions::VT_STRIDE_H, stride_h, 0); - } - void add_filter_width(int32_t filter_width) { - fbb_.AddElement(Pool2DOptions::VT_FILTER_WIDTH, filter_width, 0); - } - void add_filter_height(int32_t filter_height) { - fbb_.AddElement(Pool2DOptions::VT_FILTER_HEIGHT, filter_height, 0); - } - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(Pool2DOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - explicit Pool2DOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - Pool2DOptionsBuilder &operator=(const Pool2DOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreatePool2DOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::Padding padding = tflite::Padding_SAME, - int32_t stride_w = 0, - int32_t stride_h = 0, - int32_t filter_width = 0, - int32_t filter_height = 0, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE) { - Pool2DOptionsBuilder builder_(_fbb); - builder_.add_filter_height(filter_height); - builder_.add_filter_width(filter_width); - builder_.add_stride_h(stride_h); - builder_.add_stride_w(stride_w); - builder_.add_fused_activation_function(fused_activation_function); - builder_.add_padding(padding); - return builder_.Finish(); -} - -flatbuffers::Offset CreatePool2DOptions(flatbuffers::FlatBufferBuilder &_fbb, const Pool2DOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct DepthwiseConv2DOptionsT : public flatbuffers::NativeTable { - typedef DepthwiseConv2DOptions TableType; - tflite::Padding padding; - int32_t stride_w; - int32_t stride_h; - int32_t depth_multiplier; - tflite::ActivationFunctionType fused_activation_function; - int32_t dilation_w_factor; - int32_t dilation_h_factor; - DepthwiseConv2DOptionsT() - : padding(tflite::Padding_SAME), - stride_w(0), - stride_h(0), - depth_multiplier(0), - fused_activation_function(tflite::ActivationFunctionType_NONE), - dilation_w_factor(1), - dilation_h_factor(1) { - } -}; - -struct DepthwiseConv2DOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef DepthwiseConv2DOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_PADDING = 4, - VT_STRIDE_W = 6, - VT_STRIDE_H = 8, - VT_DEPTH_MULTIPLIER = 10, - VT_FUSED_ACTIVATION_FUNCTION = 12, - VT_DILATION_W_FACTOR = 14, - VT_DILATION_H_FACTOR = 16 - }; - tflite::Padding padding() const { - return static_cast(GetField(VT_PADDING, 0)); - } - int32_t stride_w() const { - return GetField(VT_STRIDE_W, 0); - } - int32_t stride_h() const { - return GetField(VT_STRIDE_H, 0); - } - int32_t depth_multiplier() const { - return GetField(VT_DEPTH_MULTIPLIER, 0); - } - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - int32_t dilation_w_factor() const { - return GetField(VT_DILATION_W_FACTOR, 1); - } - int32_t dilation_h_factor() const { - return GetField(VT_DILATION_H_FACTOR, 1); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_PADDING) && - VerifyField(verifier, VT_STRIDE_W) && - VerifyField(verifier, VT_STRIDE_H) && - VerifyField(verifier, VT_DEPTH_MULTIPLIER) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_DILATION_W_FACTOR) && - VerifyField(verifier, VT_DILATION_H_FACTOR) && - verifier.EndTable(); - } - DepthwiseConv2DOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(DepthwiseConv2DOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const DepthwiseConv2DOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct DepthwiseConv2DOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_padding(tflite::Padding padding) { - fbb_.AddElement(DepthwiseConv2DOptions::VT_PADDING, static_cast(padding), 0); - } - void add_stride_w(int32_t stride_w) { - fbb_.AddElement(DepthwiseConv2DOptions::VT_STRIDE_W, stride_w, 0); - } - void add_stride_h(int32_t stride_h) { - fbb_.AddElement(DepthwiseConv2DOptions::VT_STRIDE_H, stride_h, 0); - } - void add_depth_multiplier(int32_t depth_multiplier) { - fbb_.AddElement(DepthwiseConv2DOptions::VT_DEPTH_MULTIPLIER, depth_multiplier, 0); - } - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(DepthwiseConv2DOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_dilation_w_factor(int32_t dilation_w_factor) { - fbb_.AddElement(DepthwiseConv2DOptions::VT_DILATION_W_FACTOR, dilation_w_factor, 1); - } - void add_dilation_h_factor(int32_t dilation_h_factor) { - fbb_.AddElement(DepthwiseConv2DOptions::VT_DILATION_H_FACTOR, dilation_h_factor, 1); - } - explicit DepthwiseConv2DOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - DepthwiseConv2DOptionsBuilder &operator=(const DepthwiseConv2DOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateDepthwiseConv2DOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::Padding padding = tflite::Padding_SAME, - int32_t stride_w = 0, - int32_t stride_h = 0, - int32_t depth_multiplier = 0, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - int32_t dilation_w_factor = 1, - int32_t dilation_h_factor = 1) { - DepthwiseConv2DOptionsBuilder builder_(_fbb); - builder_.add_dilation_h_factor(dilation_h_factor); - builder_.add_dilation_w_factor(dilation_w_factor); - builder_.add_depth_multiplier(depth_multiplier); - builder_.add_stride_h(stride_h); - builder_.add_stride_w(stride_w); - builder_.add_fused_activation_function(fused_activation_function); - builder_.add_padding(padding); - return builder_.Finish(); -} - -flatbuffers::Offset CreateDepthwiseConv2DOptions(flatbuffers::FlatBufferBuilder &_fbb, const DepthwiseConv2DOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ConcatEmbeddingsOptionsT : public flatbuffers::NativeTable { - typedef ConcatEmbeddingsOptions TableType; - int32_t num_channels; - std::vector num_columns_per_channel; - std::vector embedding_dim_per_channel; - ConcatEmbeddingsOptionsT() - : num_channels(0) { - } -}; - -struct ConcatEmbeddingsOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ConcatEmbeddingsOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NUM_CHANNELS = 4, - VT_NUM_COLUMNS_PER_CHANNEL = 6, - VT_EMBEDDING_DIM_PER_CHANNEL = 8 - }; - int32_t num_channels() const { - return GetField(VT_NUM_CHANNELS, 0); - } - const flatbuffers::Vector *num_columns_per_channel() const { - return GetPointer *>(VT_NUM_COLUMNS_PER_CHANNEL); - } - const flatbuffers::Vector *embedding_dim_per_channel() const { - return GetPointer *>(VT_EMBEDDING_DIM_PER_CHANNEL); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_NUM_CHANNELS) && - VerifyOffset(verifier, VT_NUM_COLUMNS_PER_CHANNEL) && - verifier.VerifyVector(num_columns_per_channel()) && - VerifyOffset(verifier, VT_EMBEDDING_DIM_PER_CHANNEL) && - verifier.VerifyVector(embedding_dim_per_channel()) && - verifier.EndTable(); - } - ConcatEmbeddingsOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ConcatEmbeddingsOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ConcatEmbeddingsOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ConcatEmbeddingsOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_num_channels(int32_t num_channels) { - fbb_.AddElement(ConcatEmbeddingsOptions::VT_NUM_CHANNELS, num_channels, 0); - } - void add_num_columns_per_channel(flatbuffers::Offset> num_columns_per_channel) { - fbb_.AddOffset(ConcatEmbeddingsOptions::VT_NUM_COLUMNS_PER_CHANNEL, num_columns_per_channel); - } - void add_embedding_dim_per_channel(flatbuffers::Offset> embedding_dim_per_channel) { - fbb_.AddOffset(ConcatEmbeddingsOptions::VT_EMBEDDING_DIM_PER_CHANNEL, embedding_dim_per_channel); - } - explicit ConcatEmbeddingsOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ConcatEmbeddingsOptionsBuilder &operator=(const ConcatEmbeddingsOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateConcatEmbeddingsOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t num_channels = 0, - flatbuffers::Offset> num_columns_per_channel = 0, - flatbuffers::Offset> embedding_dim_per_channel = 0) { - ConcatEmbeddingsOptionsBuilder builder_(_fbb); - builder_.add_embedding_dim_per_channel(embedding_dim_per_channel); - builder_.add_num_columns_per_channel(num_columns_per_channel); - builder_.add_num_channels(num_channels); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateConcatEmbeddingsOptionsDirect( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t num_channels = 0, - const std::vector *num_columns_per_channel = nullptr, - const std::vector *embedding_dim_per_channel = nullptr) { - auto num_columns_per_channel__ = num_columns_per_channel ? _fbb.CreateVector(*num_columns_per_channel) : 0; - auto embedding_dim_per_channel__ = embedding_dim_per_channel ? _fbb.CreateVector(*embedding_dim_per_channel) : 0; - return tflite::CreateConcatEmbeddingsOptions( - _fbb, - num_channels, - num_columns_per_channel__, - embedding_dim_per_channel__); -} - -flatbuffers::Offset CreateConcatEmbeddingsOptions(flatbuffers::FlatBufferBuilder &_fbb, const ConcatEmbeddingsOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct LSHProjectionOptionsT : public flatbuffers::NativeTable { - typedef LSHProjectionOptions TableType; - tflite::LSHProjectionType type; - LSHProjectionOptionsT() - : type(tflite::LSHProjectionType_UNKNOWN) { - } -}; - -struct LSHProjectionOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef LSHProjectionOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_TYPE = 4 - }; - tflite::LSHProjectionType type() const { - return static_cast(GetField(VT_TYPE, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_TYPE) && - verifier.EndTable(); - } - LSHProjectionOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(LSHProjectionOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const LSHProjectionOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct LSHProjectionOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_type(tflite::LSHProjectionType type) { - fbb_.AddElement(LSHProjectionOptions::VT_TYPE, static_cast(type), 0); - } - explicit LSHProjectionOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LSHProjectionOptionsBuilder &operator=(const LSHProjectionOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLSHProjectionOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::LSHProjectionType type = tflite::LSHProjectionType_UNKNOWN) { - LSHProjectionOptionsBuilder builder_(_fbb); - builder_.add_type(type); - return builder_.Finish(); -} - -flatbuffers::Offset CreateLSHProjectionOptions(flatbuffers::FlatBufferBuilder &_fbb, const LSHProjectionOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SVDFOptionsT : public flatbuffers::NativeTable { - typedef SVDFOptions TableType; - int32_t rank; - tflite::ActivationFunctionType fused_activation_function; - bool asymmetric_quantize_inputs; - SVDFOptionsT() - : rank(0), - fused_activation_function(tflite::ActivationFunctionType_NONE), - asymmetric_quantize_inputs(false) { - } -}; - -struct SVDFOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SVDFOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_RANK = 4, - VT_FUSED_ACTIVATION_FUNCTION = 6, - VT_ASYMMETRIC_QUANTIZE_INPUTS = 8 - }; - int32_t rank() const { - return GetField(VT_RANK, 0); - } - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - bool asymmetric_quantize_inputs() const { - return GetField(VT_ASYMMETRIC_QUANTIZE_INPUTS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_RANK) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_ASYMMETRIC_QUANTIZE_INPUTS) && - verifier.EndTable(); - } - SVDFOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SVDFOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SVDFOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SVDFOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_rank(int32_t rank) { - fbb_.AddElement(SVDFOptions::VT_RANK, rank, 0); - } - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(SVDFOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_asymmetric_quantize_inputs(bool asymmetric_quantize_inputs) { - fbb_.AddElement(SVDFOptions::VT_ASYMMETRIC_QUANTIZE_INPUTS, static_cast(asymmetric_quantize_inputs), 0); - } - explicit SVDFOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SVDFOptionsBuilder &operator=(const SVDFOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSVDFOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t rank = 0, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - bool asymmetric_quantize_inputs = false) { - SVDFOptionsBuilder builder_(_fbb); - builder_.add_rank(rank); - builder_.add_asymmetric_quantize_inputs(asymmetric_quantize_inputs); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSVDFOptions(flatbuffers::FlatBufferBuilder &_fbb, const SVDFOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct RNNOptionsT : public flatbuffers::NativeTable { - typedef RNNOptions TableType; - tflite::ActivationFunctionType fused_activation_function; - bool asymmetric_quantize_inputs; - RNNOptionsT() - : fused_activation_function(tflite::ActivationFunctionType_NONE), - asymmetric_quantize_inputs(false) { - } -}; - -struct RNNOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef RNNOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FUSED_ACTIVATION_FUNCTION = 4, - VT_ASYMMETRIC_QUANTIZE_INPUTS = 6 - }; - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - bool asymmetric_quantize_inputs() const { - return GetField(VT_ASYMMETRIC_QUANTIZE_INPUTS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_ASYMMETRIC_QUANTIZE_INPUTS) && - verifier.EndTable(); - } - RNNOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(RNNOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const RNNOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct RNNOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(RNNOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_asymmetric_quantize_inputs(bool asymmetric_quantize_inputs) { - fbb_.AddElement(RNNOptions::VT_ASYMMETRIC_QUANTIZE_INPUTS, static_cast(asymmetric_quantize_inputs), 0); - } - explicit RNNOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - RNNOptionsBuilder &operator=(const RNNOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateRNNOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - bool asymmetric_quantize_inputs = false) { - RNNOptionsBuilder builder_(_fbb); - builder_.add_asymmetric_quantize_inputs(asymmetric_quantize_inputs); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateRNNOptions(flatbuffers::FlatBufferBuilder &_fbb, const RNNOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SequenceRNNOptionsT : public flatbuffers::NativeTable { - typedef SequenceRNNOptions TableType; - bool time_major; - tflite::ActivationFunctionType fused_activation_function; - bool asymmetric_quantize_inputs; - SequenceRNNOptionsT() - : time_major(false), - fused_activation_function(tflite::ActivationFunctionType_NONE), - asymmetric_quantize_inputs(false) { - } -}; - -struct SequenceRNNOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SequenceRNNOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_TIME_MAJOR = 4, - VT_FUSED_ACTIVATION_FUNCTION = 6, - VT_ASYMMETRIC_QUANTIZE_INPUTS = 8 - }; - bool time_major() const { - return GetField(VT_TIME_MAJOR, 0) != 0; - } - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - bool asymmetric_quantize_inputs() const { - return GetField(VT_ASYMMETRIC_QUANTIZE_INPUTS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_TIME_MAJOR) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_ASYMMETRIC_QUANTIZE_INPUTS) && - verifier.EndTable(); - } - SequenceRNNOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SequenceRNNOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SequenceRNNOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SequenceRNNOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_time_major(bool time_major) { - fbb_.AddElement(SequenceRNNOptions::VT_TIME_MAJOR, static_cast(time_major), 0); - } - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(SequenceRNNOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_asymmetric_quantize_inputs(bool asymmetric_quantize_inputs) { - fbb_.AddElement(SequenceRNNOptions::VT_ASYMMETRIC_QUANTIZE_INPUTS, static_cast(asymmetric_quantize_inputs), 0); - } - explicit SequenceRNNOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SequenceRNNOptionsBuilder &operator=(const SequenceRNNOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSequenceRNNOptions( - flatbuffers::FlatBufferBuilder &_fbb, - bool time_major = false, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - bool asymmetric_quantize_inputs = false) { - SequenceRNNOptionsBuilder builder_(_fbb); - builder_.add_asymmetric_quantize_inputs(asymmetric_quantize_inputs); - builder_.add_fused_activation_function(fused_activation_function); - builder_.add_time_major(time_major); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSequenceRNNOptions(flatbuffers::FlatBufferBuilder &_fbb, const SequenceRNNOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct BidirectionalSequenceRNNOptionsT : public flatbuffers::NativeTable { - typedef BidirectionalSequenceRNNOptions TableType; - bool time_major; - tflite::ActivationFunctionType fused_activation_function; - bool merge_outputs; - bool asymmetric_quantize_inputs; - BidirectionalSequenceRNNOptionsT() - : time_major(false), - fused_activation_function(tflite::ActivationFunctionType_NONE), - merge_outputs(false), - asymmetric_quantize_inputs(false) { - } -}; - -struct BidirectionalSequenceRNNOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef BidirectionalSequenceRNNOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_TIME_MAJOR = 4, - VT_FUSED_ACTIVATION_FUNCTION = 6, - VT_MERGE_OUTPUTS = 8, - VT_ASYMMETRIC_QUANTIZE_INPUTS = 10 - }; - bool time_major() const { - return GetField(VT_TIME_MAJOR, 0) != 0; - } - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - bool merge_outputs() const { - return GetField(VT_MERGE_OUTPUTS, 0) != 0; - } - bool asymmetric_quantize_inputs() const { - return GetField(VT_ASYMMETRIC_QUANTIZE_INPUTS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_TIME_MAJOR) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_MERGE_OUTPUTS) && - VerifyField(verifier, VT_ASYMMETRIC_QUANTIZE_INPUTS) && - verifier.EndTable(); - } - BidirectionalSequenceRNNOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(BidirectionalSequenceRNNOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const BidirectionalSequenceRNNOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct BidirectionalSequenceRNNOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_time_major(bool time_major) { - fbb_.AddElement(BidirectionalSequenceRNNOptions::VT_TIME_MAJOR, static_cast(time_major), 0); - } - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(BidirectionalSequenceRNNOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_merge_outputs(bool merge_outputs) { - fbb_.AddElement(BidirectionalSequenceRNNOptions::VT_MERGE_OUTPUTS, static_cast(merge_outputs), 0); - } - void add_asymmetric_quantize_inputs(bool asymmetric_quantize_inputs) { - fbb_.AddElement(BidirectionalSequenceRNNOptions::VT_ASYMMETRIC_QUANTIZE_INPUTS, static_cast(asymmetric_quantize_inputs), 0); - } - explicit BidirectionalSequenceRNNOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - BidirectionalSequenceRNNOptionsBuilder &operator=(const BidirectionalSequenceRNNOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateBidirectionalSequenceRNNOptions( - flatbuffers::FlatBufferBuilder &_fbb, - bool time_major = false, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - bool merge_outputs = false, - bool asymmetric_quantize_inputs = false) { - BidirectionalSequenceRNNOptionsBuilder builder_(_fbb); - builder_.add_asymmetric_quantize_inputs(asymmetric_quantize_inputs); - builder_.add_merge_outputs(merge_outputs); - builder_.add_fused_activation_function(fused_activation_function); - builder_.add_time_major(time_major); - return builder_.Finish(); -} - -flatbuffers::Offset CreateBidirectionalSequenceRNNOptions(flatbuffers::FlatBufferBuilder &_fbb, const BidirectionalSequenceRNNOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct FullyConnectedOptionsT : public flatbuffers::NativeTable { - typedef FullyConnectedOptions TableType; - tflite::ActivationFunctionType fused_activation_function; - tflite::FullyConnectedOptionsWeightsFormat weights_format; - bool keep_num_dims; - bool asymmetric_quantize_inputs; - FullyConnectedOptionsT() - : fused_activation_function(tflite::ActivationFunctionType_NONE), - weights_format(tflite::FullyConnectedOptionsWeightsFormat_DEFAULT), - keep_num_dims(false), - asymmetric_quantize_inputs(false) { - } -}; - -struct FullyConnectedOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef FullyConnectedOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FUSED_ACTIVATION_FUNCTION = 4, - VT_WEIGHTS_FORMAT = 6, - VT_KEEP_NUM_DIMS = 8, - VT_ASYMMETRIC_QUANTIZE_INPUTS = 10 - }; - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - tflite::FullyConnectedOptionsWeightsFormat weights_format() const { - return static_cast(GetField(VT_WEIGHTS_FORMAT, 0)); - } - bool keep_num_dims() const { - return GetField(VT_KEEP_NUM_DIMS, 0) != 0; - } - bool asymmetric_quantize_inputs() const { - return GetField(VT_ASYMMETRIC_QUANTIZE_INPUTS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_WEIGHTS_FORMAT) && - VerifyField(verifier, VT_KEEP_NUM_DIMS) && - VerifyField(verifier, VT_ASYMMETRIC_QUANTIZE_INPUTS) && - verifier.EndTable(); - } - FullyConnectedOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(FullyConnectedOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const FullyConnectedOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct FullyConnectedOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(FullyConnectedOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_weights_format(tflite::FullyConnectedOptionsWeightsFormat weights_format) { - fbb_.AddElement(FullyConnectedOptions::VT_WEIGHTS_FORMAT, static_cast(weights_format), 0); - } - void add_keep_num_dims(bool keep_num_dims) { - fbb_.AddElement(FullyConnectedOptions::VT_KEEP_NUM_DIMS, static_cast(keep_num_dims), 0); - } - void add_asymmetric_quantize_inputs(bool asymmetric_quantize_inputs) { - fbb_.AddElement(FullyConnectedOptions::VT_ASYMMETRIC_QUANTIZE_INPUTS, static_cast(asymmetric_quantize_inputs), 0); - } - explicit FullyConnectedOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - FullyConnectedOptionsBuilder &operator=(const FullyConnectedOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateFullyConnectedOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - tflite::FullyConnectedOptionsWeightsFormat weights_format = tflite::FullyConnectedOptionsWeightsFormat_DEFAULT, - bool keep_num_dims = false, - bool asymmetric_quantize_inputs = false) { - FullyConnectedOptionsBuilder builder_(_fbb); - builder_.add_asymmetric_quantize_inputs(asymmetric_quantize_inputs); - builder_.add_keep_num_dims(keep_num_dims); - builder_.add_weights_format(weights_format); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateFullyConnectedOptions(flatbuffers::FlatBufferBuilder &_fbb, const FullyConnectedOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SoftmaxOptionsT : public flatbuffers::NativeTable { - typedef SoftmaxOptions TableType; - float beta; - SoftmaxOptionsT() - : beta(0.0f) { - } -}; - -struct SoftmaxOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SoftmaxOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_BETA = 4 - }; - float beta() const { - return GetField(VT_BETA, 0.0f); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_BETA) && - verifier.EndTable(); - } - SoftmaxOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SoftmaxOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SoftmaxOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SoftmaxOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_beta(float beta) { - fbb_.AddElement(SoftmaxOptions::VT_BETA, beta, 0.0f); - } - explicit SoftmaxOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SoftmaxOptionsBuilder &operator=(const SoftmaxOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSoftmaxOptions( - flatbuffers::FlatBufferBuilder &_fbb, - float beta = 0.0f) { - SoftmaxOptionsBuilder builder_(_fbb); - builder_.add_beta(beta); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSoftmaxOptions(flatbuffers::FlatBufferBuilder &_fbb, const SoftmaxOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ConcatenationOptionsT : public flatbuffers::NativeTable { - typedef ConcatenationOptions TableType; - int32_t axis; - tflite::ActivationFunctionType fused_activation_function; - ConcatenationOptionsT() - : axis(0), - fused_activation_function(tflite::ActivationFunctionType_NONE) { - } -}; - -struct ConcatenationOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ConcatenationOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_AXIS = 4, - VT_FUSED_ACTIVATION_FUNCTION = 6 - }; - int32_t axis() const { - return GetField(VT_AXIS, 0); - } - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_AXIS) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - verifier.EndTable(); - } - ConcatenationOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ConcatenationOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ConcatenationOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ConcatenationOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_axis(int32_t axis) { - fbb_.AddElement(ConcatenationOptions::VT_AXIS, axis, 0); - } - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(ConcatenationOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - explicit ConcatenationOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ConcatenationOptionsBuilder &operator=(const ConcatenationOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateConcatenationOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t axis = 0, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE) { - ConcatenationOptionsBuilder builder_(_fbb); - builder_.add_axis(axis); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateConcatenationOptions(flatbuffers::FlatBufferBuilder &_fbb, const ConcatenationOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct AddOptionsT : public flatbuffers::NativeTable { - typedef AddOptions TableType; - tflite::ActivationFunctionType fused_activation_function; - bool pot_scale_int16; - AddOptionsT() - : fused_activation_function(tflite::ActivationFunctionType_NONE), - pot_scale_int16(true) { - } -}; - -struct AddOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef AddOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FUSED_ACTIVATION_FUNCTION = 4, - VT_POT_SCALE_INT16 = 6 - }; - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - bool pot_scale_int16() const { - return GetField(VT_POT_SCALE_INT16, 1) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_POT_SCALE_INT16) && - verifier.EndTable(); - } - AddOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(AddOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const AddOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct AddOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(AddOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_pot_scale_int16(bool pot_scale_int16) { - fbb_.AddElement(AddOptions::VT_POT_SCALE_INT16, static_cast(pot_scale_int16), 1); - } - explicit AddOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - AddOptionsBuilder &operator=(const AddOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateAddOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - bool pot_scale_int16 = true) { - AddOptionsBuilder builder_(_fbb); - builder_.add_pot_scale_int16(pot_scale_int16); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateAddOptions(flatbuffers::FlatBufferBuilder &_fbb, const AddOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct MulOptionsT : public flatbuffers::NativeTable { - typedef MulOptions TableType; - tflite::ActivationFunctionType fused_activation_function; - MulOptionsT() - : fused_activation_function(tflite::ActivationFunctionType_NONE) { - } -}; - -struct MulOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef MulOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FUSED_ACTIVATION_FUNCTION = 4 - }; - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - verifier.EndTable(); - } - MulOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(MulOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const MulOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct MulOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(MulOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - explicit MulOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - MulOptionsBuilder &operator=(const MulOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateMulOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE) { - MulOptionsBuilder builder_(_fbb); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateMulOptions(flatbuffers::FlatBufferBuilder &_fbb, const MulOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct L2NormOptionsT : public flatbuffers::NativeTable { - typedef L2NormOptions TableType; - tflite::ActivationFunctionType fused_activation_function; - L2NormOptionsT() - : fused_activation_function(tflite::ActivationFunctionType_NONE) { - } -}; - -struct L2NormOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef L2NormOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FUSED_ACTIVATION_FUNCTION = 4 - }; - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - verifier.EndTable(); - } - L2NormOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(L2NormOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const L2NormOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct L2NormOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(L2NormOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - explicit L2NormOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - L2NormOptionsBuilder &operator=(const L2NormOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateL2NormOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE) { - L2NormOptionsBuilder builder_(_fbb); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateL2NormOptions(flatbuffers::FlatBufferBuilder &_fbb, const L2NormOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct LocalResponseNormalizationOptionsT : public flatbuffers::NativeTable { - typedef LocalResponseNormalizationOptions TableType; - int32_t radius; - float bias; - float alpha; - float beta; - LocalResponseNormalizationOptionsT() - : radius(0), - bias(0.0f), - alpha(0.0f), - beta(0.0f) { - } -}; - -struct LocalResponseNormalizationOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef LocalResponseNormalizationOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_RADIUS = 4, - VT_BIAS = 6, - VT_ALPHA = 8, - VT_BETA = 10 - }; - int32_t radius() const { - return GetField(VT_RADIUS, 0); - } - float bias() const { - return GetField(VT_BIAS, 0.0f); - } - float alpha() const { - return GetField(VT_ALPHA, 0.0f); - } - float beta() const { - return GetField(VT_BETA, 0.0f); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_RADIUS) && - VerifyField(verifier, VT_BIAS) && - VerifyField(verifier, VT_ALPHA) && - VerifyField(verifier, VT_BETA) && - verifier.EndTable(); - } - LocalResponseNormalizationOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(LocalResponseNormalizationOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const LocalResponseNormalizationOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct LocalResponseNormalizationOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_radius(int32_t radius) { - fbb_.AddElement(LocalResponseNormalizationOptions::VT_RADIUS, radius, 0); - } - void add_bias(float bias) { - fbb_.AddElement(LocalResponseNormalizationOptions::VT_BIAS, bias, 0.0f); - } - void add_alpha(float alpha) { - fbb_.AddElement(LocalResponseNormalizationOptions::VT_ALPHA, alpha, 0.0f); - } - void add_beta(float beta) { - fbb_.AddElement(LocalResponseNormalizationOptions::VT_BETA, beta, 0.0f); - } - explicit LocalResponseNormalizationOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LocalResponseNormalizationOptionsBuilder &operator=(const LocalResponseNormalizationOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLocalResponseNormalizationOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t radius = 0, - float bias = 0.0f, - float alpha = 0.0f, - float beta = 0.0f) { - LocalResponseNormalizationOptionsBuilder builder_(_fbb); - builder_.add_beta(beta); - builder_.add_alpha(alpha); - builder_.add_bias(bias); - builder_.add_radius(radius); - return builder_.Finish(); -} - -flatbuffers::Offset CreateLocalResponseNormalizationOptions(flatbuffers::FlatBufferBuilder &_fbb, const LocalResponseNormalizationOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct LSTMOptionsT : public flatbuffers::NativeTable { - typedef LSTMOptions TableType; - tflite::ActivationFunctionType fused_activation_function; - float cell_clip; - float proj_clip; - tflite::LSTMKernelType kernel_type; - bool asymmetric_quantize_inputs; - LSTMOptionsT() - : fused_activation_function(tflite::ActivationFunctionType_NONE), - cell_clip(0.0f), - proj_clip(0.0f), - kernel_type(tflite::LSTMKernelType_FULL), - asymmetric_quantize_inputs(false) { - } -}; - -struct LSTMOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef LSTMOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FUSED_ACTIVATION_FUNCTION = 4, - VT_CELL_CLIP = 6, - VT_PROJ_CLIP = 8, - VT_KERNEL_TYPE = 10, - VT_ASYMMETRIC_QUANTIZE_INPUTS = 12 - }; - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - float cell_clip() const { - return GetField(VT_CELL_CLIP, 0.0f); - } - float proj_clip() const { - return GetField(VT_PROJ_CLIP, 0.0f); - } - tflite::LSTMKernelType kernel_type() const { - return static_cast(GetField(VT_KERNEL_TYPE, 0)); - } - bool asymmetric_quantize_inputs() const { - return GetField(VT_ASYMMETRIC_QUANTIZE_INPUTS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_CELL_CLIP) && - VerifyField(verifier, VT_PROJ_CLIP) && - VerifyField(verifier, VT_KERNEL_TYPE) && - VerifyField(verifier, VT_ASYMMETRIC_QUANTIZE_INPUTS) && - verifier.EndTable(); - } - LSTMOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(LSTMOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const LSTMOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct LSTMOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(LSTMOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_cell_clip(float cell_clip) { - fbb_.AddElement(LSTMOptions::VT_CELL_CLIP, cell_clip, 0.0f); - } - void add_proj_clip(float proj_clip) { - fbb_.AddElement(LSTMOptions::VT_PROJ_CLIP, proj_clip, 0.0f); - } - void add_kernel_type(tflite::LSTMKernelType kernel_type) { - fbb_.AddElement(LSTMOptions::VT_KERNEL_TYPE, static_cast(kernel_type), 0); - } - void add_asymmetric_quantize_inputs(bool asymmetric_quantize_inputs) { - fbb_.AddElement(LSTMOptions::VT_ASYMMETRIC_QUANTIZE_INPUTS, static_cast(asymmetric_quantize_inputs), 0); - } - explicit LSTMOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LSTMOptionsBuilder &operator=(const LSTMOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLSTMOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - float cell_clip = 0.0f, - float proj_clip = 0.0f, - tflite::LSTMKernelType kernel_type = tflite::LSTMKernelType_FULL, - bool asymmetric_quantize_inputs = false) { - LSTMOptionsBuilder builder_(_fbb); - builder_.add_proj_clip(proj_clip); - builder_.add_cell_clip(cell_clip); - builder_.add_asymmetric_quantize_inputs(asymmetric_quantize_inputs); - builder_.add_kernel_type(kernel_type); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateLSTMOptions(flatbuffers::FlatBufferBuilder &_fbb, const LSTMOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct UnidirectionalSequenceLSTMOptionsT : public flatbuffers::NativeTable { - typedef UnidirectionalSequenceLSTMOptions TableType; - tflite::ActivationFunctionType fused_activation_function; - float cell_clip; - float proj_clip; - bool time_major; - bool asymmetric_quantize_inputs; - UnidirectionalSequenceLSTMOptionsT() - : fused_activation_function(tflite::ActivationFunctionType_NONE), - cell_clip(0.0f), - proj_clip(0.0f), - time_major(false), - asymmetric_quantize_inputs(false) { - } -}; - -struct UnidirectionalSequenceLSTMOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef UnidirectionalSequenceLSTMOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FUSED_ACTIVATION_FUNCTION = 4, - VT_CELL_CLIP = 6, - VT_PROJ_CLIP = 8, - VT_TIME_MAJOR = 10, - VT_ASYMMETRIC_QUANTIZE_INPUTS = 12 - }; - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - float cell_clip() const { - return GetField(VT_CELL_CLIP, 0.0f); - } - float proj_clip() const { - return GetField(VT_PROJ_CLIP, 0.0f); - } - bool time_major() const { - return GetField(VT_TIME_MAJOR, 0) != 0; - } - bool asymmetric_quantize_inputs() const { - return GetField(VT_ASYMMETRIC_QUANTIZE_INPUTS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_CELL_CLIP) && - VerifyField(verifier, VT_PROJ_CLIP) && - VerifyField(verifier, VT_TIME_MAJOR) && - VerifyField(verifier, VT_ASYMMETRIC_QUANTIZE_INPUTS) && - verifier.EndTable(); - } - UnidirectionalSequenceLSTMOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(UnidirectionalSequenceLSTMOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const UnidirectionalSequenceLSTMOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct UnidirectionalSequenceLSTMOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(UnidirectionalSequenceLSTMOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_cell_clip(float cell_clip) { - fbb_.AddElement(UnidirectionalSequenceLSTMOptions::VT_CELL_CLIP, cell_clip, 0.0f); - } - void add_proj_clip(float proj_clip) { - fbb_.AddElement(UnidirectionalSequenceLSTMOptions::VT_PROJ_CLIP, proj_clip, 0.0f); - } - void add_time_major(bool time_major) { - fbb_.AddElement(UnidirectionalSequenceLSTMOptions::VT_TIME_MAJOR, static_cast(time_major), 0); - } - void add_asymmetric_quantize_inputs(bool asymmetric_quantize_inputs) { - fbb_.AddElement(UnidirectionalSequenceLSTMOptions::VT_ASYMMETRIC_QUANTIZE_INPUTS, static_cast(asymmetric_quantize_inputs), 0); - } - explicit UnidirectionalSequenceLSTMOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - UnidirectionalSequenceLSTMOptionsBuilder &operator=(const UnidirectionalSequenceLSTMOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateUnidirectionalSequenceLSTMOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - float cell_clip = 0.0f, - float proj_clip = 0.0f, - bool time_major = false, - bool asymmetric_quantize_inputs = false) { - UnidirectionalSequenceLSTMOptionsBuilder builder_(_fbb); - builder_.add_proj_clip(proj_clip); - builder_.add_cell_clip(cell_clip); - builder_.add_asymmetric_quantize_inputs(asymmetric_quantize_inputs); - builder_.add_time_major(time_major); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateUnidirectionalSequenceLSTMOptions(flatbuffers::FlatBufferBuilder &_fbb, const UnidirectionalSequenceLSTMOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct BidirectionalSequenceLSTMOptionsT : public flatbuffers::NativeTable { - typedef BidirectionalSequenceLSTMOptions TableType; - tflite::ActivationFunctionType fused_activation_function; - float cell_clip; - float proj_clip; - bool merge_outputs; - bool time_major; - bool asymmetric_quantize_inputs; - BidirectionalSequenceLSTMOptionsT() - : fused_activation_function(tflite::ActivationFunctionType_NONE), - cell_clip(0.0f), - proj_clip(0.0f), - merge_outputs(false), - time_major(true), - asymmetric_quantize_inputs(false) { - } -}; - -struct BidirectionalSequenceLSTMOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef BidirectionalSequenceLSTMOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FUSED_ACTIVATION_FUNCTION = 4, - VT_CELL_CLIP = 6, - VT_PROJ_CLIP = 8, - VT_MERGE_OUTPUTS = 10, - VT_TIME_MAJOR = 12, - VT_ASYMMETRIC_QUANTIZE_INPUTS = 14 - }; - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - float cell_clip() const { - return GetField(VT_CELL_CLIP, 0.0f); - } - float proj_clip() const { - return GetField(VT_PROJ_CLIP, 0.0f); - } - bool merge_outputs() const { - return GetField(VT_MERGE_OUTPUTS, 0) != 0; - } - bool time_major() const { - return GetField(VT_TIME_MAJOR, 1) != 0; - } - bool asymmetric_quantize_inputs() const { - return GetField(VT_ASYMMETRIC_QUANTIZE_INPUTS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_CELL_CLIP) && - VerifyField(verifier, VT_PROJ_CLIP) && - VerifyField(verifier, VT_MERGE_OUTPUTS) && - VerifyField(verifier, VT_TIME_MAJOR) && - VerifyField(verifier, VT_ASYMMETRIC_QUANTIZE_INPUTS) && - verifier.EndTable(); - } - BidirectionalSequenceLSTMOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(BidirectionalSequenceLSTMOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const BidirectionalSequenceLSTMOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct BidirectionalSequenceLSTMOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(BidirectionalSequenceLSTMOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_cell_clip(float cell_clip) { - fbb_.AddElement(BidirectionalSequenceLSTMOptions::VT_CELL_CLIP, cell_clip, 0.0f); - } - void add_proj_clip(float proj_clip) { - fbb_.AddElement(BidirectionalSequenceLSTMOptions::VT_PROJ_CLIP, proj_clip, 0.0f); - } - void add_merge_outputs(bool merge_outputs) { - fbb_.AddElement(BidirectionalSequenceLSTMOptions::VT_MERGE_OUTPUTS, static_cast(merge_outputs), 0); - } - void add_time_major(bool time_major) { - fbb_.AddElement(BidirectionalSequenceLSTMOptions::VT_TIME_MAJOR, static_cast(time_major), 1); - } - void add_asymmetric_quantize_inputs(bool asymmetric_quantize_inputs) { - fbb_.AddElement(BidirectionalSequenceLSTMOptions::VT_ASYMMETRIC_QUANTIZE_INPUTS, static_cast(asymmetric_quantize_inputs), 0); - } - explicit BidirectionalSequenceLSTMOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - BidirectionalSequenceLSTMOptionsBuilder &operator=(const BidirectionalSequenceLSTMOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateBidirectionalSequenceLSTMOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - float cell_clip = 0.0f, - float proj_clip = 0.0f, - bool merge_outputs = false, - bool time_major = true, - bool asymmetric_quantize_inputs = false) { - BidirectionalSequenceLSTMOptionsBuilder builder_(_fbb); - builder_.add_proj_clip(proj_clip); - builder_.add_cell_clip(cell_clip); - builder_.add_asymmetric_quantize_inputs(asymmetric_quantize_inputs); - builder_.add_time_major(time_major); - builder_.add_merge_outputs(merge_outputs); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateBidirectionalSequenceLSTMOptions(flatbuffers::FlatBufferBuilder &_fbb, const BidirectionalSequenceLSTMOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ResizeBilinearOptionsT : public flatbuffers::NativeTable { - typedef ResizeBilinearOptions TableType; - bool align_corners; - bool half_pixel_centers; - ResizeBilinearOptionsT() - : align_corners(false), - half_pixel_centers(false) { - } -}; - -struct ResizeBilinearOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ResizeBilinearOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ALIGN_CORNERS = 8, - VT_HALF_PIXEL_CENTERS = 10 - }; - bool align_corners() const { - return GetField(VT_ALIGN_CORNERS, 0) != 0; - } - bool half_pixel_centers() const { - return GetField(VT_HALF_PIXEL_CENTERS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ALIGN_CORNERS) && - VerifyField(verifier, VT_HALF_PIXEL_CENTERS) && - verifier.EndTable(); - } - ResizeBilinearOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ResizeBilinearOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ResizeBilinearOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ResizeBilinearOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_align_corners(bool align_corners) { - fbb_.AddElement(ResizeBilinearOptions::VT_ALIGN_CORNERS, static_cast(align_corners), 0); - } - void add_half_pixel_centers(bool half_pixel_centers) { - fbb_.AddElement(ResizeBilinearOptions::VT_HALF_PIXEL_CENTERS, static_cast(half_pixel_centers), 0); - } - explicit ResizeBilinearOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ResizeBilinearOptionsBuilder &operator=(const ResizeBilinearOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateResizeBilinearOptions( - flatbuffers::FlatBufferBuilder &_fbb, - bool align_corners = false, - bool half_pixel_centers = false) { - ResizeBilinearOptionsBuilder builder_(_fbb); - builder_.add_half_pixel_centers(half_pixel_centers); - builder_.add_align_corners(align_corners); - return builder_.Finish(); -} - -flatbuffers::Offset CreateResizeBilinearOptions(flatbuffers::FlatBufferBuilder &_fbb, const ResizeBilinearOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ResizeNearestNeighborOptionsT : public flatbuffers::NativeTable { - typedef ResizeNearestNeighborOptions TableType; - bool align_corners; - bool half_pixel_centers; - ResizeNearestNeighborOptionsT() - : align_corners(false), - half_pixel_centers(false) { - } -}; - -struct ResizeNearestNeighborOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ResizeNearestNeighborOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ALIGN_CORNERS = 4, - VT_HALF_PIXEL_CENTERS = 6 - }; - bool align_corners() const { - return GetField(VT_ALIGN_CORNERS, 0) != 0; - } - bool half_pixel_centers() const { - return GetField(VT_HALF_PIXEL_CENTERS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ALIGN_CORNERS) && - VerifyField(verifier, VT_HALF_PIXEL_CENTERS) && - verifier.EndTable(); - } - ResizeNearestNeighborOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ResizeNearestNeighborOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ResizeNearestNeighborOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ResizeNearestNeighborOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_align_corners(bool align_corners) { - fbb_.AddElement(ResizeNearestNeighborOptions::VT_ALIGN_CORNERS, static_cast(align_corners), 0); - } - void add_half_pixel_centers(bool half_pixel_centers) { - fbb_.AddElement(ResizeNearestNeighborOptions::VT_HALF_PIXEL_CENTERS, static_cast(half_pixel_centers), 0); - } - explicit ResizeNearestNeighborOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ResizeNearestNeighborOptionsBuilder &operator=(const ResizeNearestNeighborOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateResizeNearestNeighborOptions( - flatbuffers::FlatBufferBuilder &_fbb, - bool align_corners = false, - bool half_pixel_centers = false) { - ResizeNearestNeighborOptionsBuilder builder_(_fbb); - builder_.add_half_pixel_centers(half_pixel_centers); - builder_.add_align_corners(align_corners); - return builder_.Finish(); -} - -flatbuffers::Offset CreateResizeNearestNeighborOptions(flatbuffers::FlatBufferBuilder &_fbb, const ResizeNearestNeighborOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct CallOptionsT : public flatbuffers::NativeTable { - typedef CallOptions TableType; - uint32_t subgraph; - CallOptionsT() - : subgraph(0) { - } -}; - -struct CallOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef CallOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SUBGRAPH = 4 - }; - uint32_t subgraph() const { - return GetField(VT_SUBGRAPH, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SUBGRAPH) && - verifier.EndTable(); - } - CallOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(CallOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const CallOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct CallOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_subgraph(uint32_t subgraph) { - fbb_.AddElement(CallOptions::VT_SUBGRAPH, subgraph, 0); - } - explicit CallOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - CallOptionsBuilder &operator=(const CallOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateCallOptions( - flatbuffers::FlatBufferBuilder &_fbb, - uint32_t subgraph = 0) { - CallOptionsBuilder builder_(_fbb); - builder_.add_subgraph(subgraph); - return builder_.Finish(); -} - -flatbuffers::Offset CreateCallOptions(flatbuffers::FlatBufferBuilder &_fbb, const CallOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct PadOptionsT : public flatbuffers::NativeTable { - typedef PadOptions TableType; - PadOptionsT() { - } -}; - -struct PadOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef PadOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - PadOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(PadOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const PadOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct PadOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit PadOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - PadOptionsBuilder &operator=(const PadOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreatePadOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - PadOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreatePadOptions(flatbuffers::FlatBufferBuilder &_fbb, const PadOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct PadV2OptionsT : public flatbuffers::NativeTable { - typedef PadV2Options TableType; - PadV2OptionsT() { - } -}; - -struct PadV2Options FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef PadV2OptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - PadV2OptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(PadV2OptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const PadV2OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct PadV2OptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit PadV2OptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - PadV2OptionsBuilder &operator=(const PadV2OptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreatePadV2Options( - flatbuffers::FlatBufferBuilder &_fbb) { - PadV2OptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreatePadV2Options(flatbuffers::FlatBufferBuilder &_fbb, const PadV2OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ReshapeOptionsT : public flatbuffers::NativeTable { - typedef ReshapeOptions TableType; - std::vector new_shape; - ReshapeOptionsT() { - } -}; - -struct ReshapeOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ReshapeOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NEW_SHAPE = 4 - }; - const flatbuffers::Vector *new_shape() const { - return GetPointer *>(VT_NEW_SHAPE); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_NEW_SHAPE) && - verifier.VerifyVector(new_shape()) && - verifier.EndTable(); - } - ReshapeOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ReshapeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReshapeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ReshapeOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_new_shape(flatbuffers::Offset> new_shape) { - fbb_.AddOffset(ReshapeOptions::VT_NEW_SHAPE, new_shape); - } - explicit ReshapeOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ReshapeOptionsBuilder &operator=(const ReshapeOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateReshapeOptions( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> new_shape = 0) { - ReshapeOptionsBuilder builder_(_fbb); - builder_.add_new_shape(new_shape); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateReshapeOptionsDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *new_shape = nullptr) { - auto new_shape__ = new_shape ? _fbb.CreateVector(*new_shape) : 0; - return tflite::CreateReshapeOptions( - _fbb, - new_shape__); -} - -flatbuffers::Offset CreateReshapeOptions(flatbuffers::FlatBufferBuilder &_fbb, const ReshapeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SpaceToBatchNDOptionsT : public flatbuffers::NativeTable { - typedef SpaceToBatchNDOptions TableType; - SpaceToBatchNDOptionsT() { - } -}; - -struct SpaceToBatchNDOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SpaceToBatchNDOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - SpaceToBatchNDOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SpaceToBatchNDOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SpaceToBatchNDOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SpaceToBatchNDOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit SpaceToBatchNDOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SpaceToBatchNDOptionsBuilder &operator=(const SpaceToBatchNDOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSpaceToBatchNDOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - SpaceToBatchNDOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSpaceToBatchNDOptions(flatbuffers::FlatBufferBuilder &_fbb, const SpaceToBatchNDOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct BatchToSpaceNDOptionsT : public flatbuffers::NativeTable { - typedef BatchToSpaceNDOptions TableType; - BatchToSpaceNDOptionsT() { - } -}; - -struct BatchToSpaceNDOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef BatchToSpaceNDOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - BatchToSpaceNDOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(BatchToSpaceNDOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const BatchToSpaceNDOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct BatchToSpaceNDOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit BatchToSpaceNDOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - BatchToSpaceNDOptionsBuilder &operator=(const BatchToSpaceNDOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateBatchToSpaceNDOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - BatchToSpaceNDOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateBatchToSpaceNDOptions(flatbuffers::FlatBufferBuilder &_fbb, const BatchToSpaceNDOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SkipGramOptionsT : public flatbuffers::NativeTable { - typedef SkipGramOptions TableType; - int32_t ngram_size; - int32_t max_skip_size; - bool include_all_ngrams; - SkipGramOptionsT() - : ngram_size(0), - max_skip_size(0), - include_all_ngrams(false) { - } -}; - -struct SkipGramOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SkipGramOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NGRAM_SIZE = 4, - VT_MAX_SKIP_SIZE = 6, - VT_INCLUDE_ALL_NGRAMS = 8 - }; - int32_t ngram_size() const { - return GetField(VT_NGRAM_SIZE, 0); - } - int32_t max_skip_size() const { - return GetField(VT_MAX_SKIP_SIZE, 0); - } - bool include_all_ngrams() const { - return GetField(VT_INCLUDE_ALL_NGRAMS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_NGRAM_SIZE) && - VerifyField(verifier, VT_MAX_SKIP_SIZE) && - VerifyField(verifier, VT_INCLUDE_ALL_NGRAMS) && - verifier.EndTable(); - } - SkipGramOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SkipGramOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SkipGramOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SkipGramOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_ngram_size(int32_t ngram_size) { - fbb_.AddElement(SkipGramOptions::VT_NGRAM_SIZE, ngram_size, 0); - } - void add_max_skip_size(int32_t max_skip_size) { - fbb_.AddElement(SkipGramOptions::VT_MAX_SKIP_SIZE, max_skip_size, 0); - } - void add_include_all_ngrams(bool include_all_ngrams) { - fbb_.AddElement(SkipGramOptions::VT_INCLUDE_ALL_NGRAMS, static_cast(include_all_ngrams), 0); - } - explicit SkipGramOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SkipGramOptionsBuilder &operator=(const SkipGramOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSkipGramOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t ngram_size = 0, - int32_t max_skip_size = 0, - bool include_all_ngrams = false) { - SkipGramOptionsBuilder builder_(_fbb); - builder_.add_max_skip_size(max_skip_size); - builder_.add_ngram_size(ngram_size); - builder_.add_include_all_ngrams(include_all_ngrams); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSkipGramOptions(flatbuffers::FlatBufferBuilder &_fbb, const SkipGramOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SpaceToDepthOptionsT : public flatbuffers::NativeTable { - typedef SpaceToDepthOptions TableType; - int32_t block_size; - SpaceToDepthOptionsT() - : block_size(0) { - } -}; - -struct SpaceToDepthOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SpaceToDepthOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_BLOCK_SIZE = 4 - }; - int32_t block_size() const { - return GetField(VT_BLOCK_SIZE, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_BLOCK_SIZE) && - verifier.EndTable(); - } - SpaceToDepthOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SpaceToDepthOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SpaceToDepthOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SpaceToDepthOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_block_size(int32_t block_size) { - fbb_.AddElement(SpaceToDepthOptions::VT_BLOCK_SIZE, block_size, 0); - } - explicit SpaceToDepthOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SpaceToDepthOptionsBuilder &operator=(const SpaceToDepthOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSpaceToDepthOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t block_size = 0) { - SpaceToDepthOptionsBuilder builder_(_fbb); - builder_.add_block_size(block_size); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSpaceToDepthOptions(flatbuffers::FlatBufferBuilder &_fbb, const SpaceToDepthOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct DepthToSpaceOptionsT : public flatbuffers::NativeTable { - typedef DepthToSpaceOptions TableType; - int32_t block_size; - DepthToSpaceOptionsT() - : block_size(0) { - } -}; - -struct DepthToSpaceOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef DepthToSpaceOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_BLOCK_SIZE = 4 - }; - int32_t block_size() const { - return GetField(VT_BLOCK_SIZE, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_BLOCK_SIZE) && - verifier.EndTable(); - } - DepthToSpaceOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(DepthToSpaceOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const DepthToSpaceOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct DepthToSpaceOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_block_size(int32_t block_size) { - fbb_.AddElement(DepthToSpaceOptions::VT_BLOCK_SIZE, block_size, 0); - } - explicit DepthToSpaceOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - DepthToSpaceOptionsBuilder &operator=(const DepthToSpaceOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateDepthToSpaceOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t block_size = 0) { - DepthToSpaceOptionsBuilder builder_(_fbb); - builder_.add_block_size(block_size); - return builder_.Finish(); -} - -flatbuffers::Offset CreateDepthToSpaceOptions(flatbuffers::FlatBufferBuilder &_fbb, const DepthToSpaceOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SubOptionsT : public flatbuffers::NativeTable { - typedef SubOptions TableType; - tflite::ActivationFunctionType fused_activation_function; - bool pot_scale_int16; - SubOptionsT() - : fused_activation_function(tflite::ActivationFunctionType_NONE), - pot_scale_int16(true) { - } -}; - -struct SubOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SubOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FUSED_ACTIVATION_FUNCTION = 4, - VT_POT_SCALE_INT16 = 6 - }; - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - bool pot_scale_int16() const { - return GetField(VT_POT_SCALE_INT16, 1) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - VerifyField(verifier, VT_POT_SCALE_INT16) && - verifier.EndTable(); - } - SubOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SubOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SubOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SubOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(SubOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - void add_pot_scale_int16(bool pot_scale_int16) { - fbb_.AddElement(SubOptions::VT_POT_SCALE_INT16, static_cast(pot_scale_int16), 1); - } - explicit SubOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SubOptionsBuilder &operator=(const SubOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSubOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE, - bool pot_scale_int16 = true) { - SubOptionsBuilder builder_(_fbb); - builder_.add_pot_scale_int16(pot_scale_int16); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSubOptions(flatbuffers::FlatBufferBuilder &_fbb, const SubOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct DivOptionsT : public flatbuffers::NativeTable { - typedef DivOptions TableType; - tflite::ActivationFunctionType fused_activation_function; - DivOptionsT() - : fused_activation_function(tflite::ActivationFunctionType_NONE) { - } -}; - -struct DivOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef DivOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_FUSED_ACTIVATION_FUNCTION = 4 - }; - tflite::ActivationFunctionType fused_activation_function() const { - return static_cast(GetField(VT_FUSED_ACTIVATION_FUNCTION, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_FUSED_ACTIVATION_FUNCTION) && - verifier.EndTable(); - } - DivOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(DivOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const DivOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct DivOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_fused_activation_function(tflite::ActivationFunctionType fused_activation_function) { - fbb_.AddElement(DivOptions::VT_FUSED_ACTIVATION_FUNCTION, static_cast(fused_activation_function), 0); - } - explicit DivOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - DivOptionsBuilder &operator=(const DivOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateDivOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::ActivationFunctionType fused_activation_function = tflite::ActivationFunctionType_NONE) { - DivOptionsBuilder builder_(_fbb); - builder_.add_fused_activation_function(fused_activation_function); - return builder_.Finish(); -} - -flatbuffers::Offset CreateDivOptions(flatbuffers::FlatBufferBuilder &_fbb, const DivOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct TopKV2OptionsT : public flatbuffers::NativeTable { - typedef TopKV2Options TableType; - TopKV2OptionsT() { - } -}; - -struct TopKV2Options FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef TopKV2OptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - TopKV2OptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(TopKV2OptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const TopKV2OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct TopKV2OptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit TopKV2OptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TopKV2OptionsBuilder &operator=(const TopKV2OptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateTopKV2Options( - flatbuffers::FlatBufferBuilder &_fbb) { - TopKV2OptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateTopKV2Options(flatbuffers::FlatBufferBuilder &_fbb, const TopKV2OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct EmbeddingLookupSparseOptionsT : public flatbuffers::NativeTable { - typedef EmbeddingLookupSparseOptions TableType; - tflite::CombinerType combiner; - EmbeddingLookupSparseOptionsT() - : combiner(tflite::CombinerType_SUM) { - } -}; - -struct EmbeddingLookupSparseOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef EmbeddingLookupSparseOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_COMBINER = 4 - }; - tflite::CombinerType combiner() const { - return static_cast(GetField(VT_COMBINER, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_COMBINER) && - verifier.EndTable(); - } - EmbeddingLookupSparseOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(EmbeddingLookupSparseOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const EmbeddingLookupSparseOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct EmbeddingLookupSparseOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_combiner(tflite::CombinerType combiner) { - fbb_.AddElement(EmbeddingLookupSparseOptions::VT_COMBINER, static_cast(combiner), 0); - } - explicit EmbeddingLookupSparseOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - EmbeddingLookupSparseOptionsBuilder &operator=(const EmbeddingLookupSparseOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateEmbeddingLookupSparseOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::CombinerType combiner = tflite::CombinerType_SUM) { - EmbeddingLookupSparseOptionsBuilder builder_(_fbb); - builder_.add_combiner(combiner); - return builder_.Finish(); -} - -flatbuffers::Offset CreateEmbeddingLookupSparseOptions(flatbuffers::FlatBufferBuilder &_fbb, const EmbeddingLookupSparseOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct GatherOptionsT : public flatbuffers::NativeTable { - typedef GatherOptions TableType; - int32_t axis; - GatherOptionsT() - : axis(0) { - } -}; - -struct GatherOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef GatherOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_AXIS = 4 - }; - int32_t axis() const { - return GetField(VT_AXIS, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_AXIS) && - verifier.EndTable(); - } - GatherOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(GatherOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const GatherOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct GatherOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_axis(int32_t axis) { - fbb_.AddElement(GatherOptions::VT_AXIS, axis, 0); - } - explicit GatherOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - GatherOptionsBuilder &operator=(const GatherOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateGatherOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t axis = 0) { - GatherOptionsBuilder builder_(_fbb); - builder_.add_axis(axis); - return builder_.Finish(); -} - -flatbuffers::Offset CreateGatherOptions(flatbuffers::FlatBufferBuilder &_fbb, const GatherOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct TransposeOptionsT : public flatbuffers::NativeTable { - typedef TransposeOptions TableType; - TransposeOptionsT() { - } -}; - -struct TransposeOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef TransposeOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - TransposeOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(TransposeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const TransposeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct TransposeOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit TransposeOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TransposeOptionsBuilder &operator=(const TransposeOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateTransposeOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - TransposeOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateTransposeOptions(flatbuffers::FlatBufferBuilder &_fbb, const TransposeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ExpOptionsT : public flatbuffers::NativeTable { - typedef ExpOptions TableType; - ExpOptionsT() { - } -}; - -struct ExpOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ExpOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - ExpOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ExpOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ExpOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ExpOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit ExpOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ExpOptionsBuilder &operator=(const ExpOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateExpOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - ExpOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateExpOptions(flatbuffers::FlatBufferBuilder &_fbb, const ExpOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct CosOptionsT : public flatbuffers::NativeTable { - typedef CosOptions TableType; - CosOptionsT() { - } -}; - -struct CosOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef CosOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - CosOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(CosOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const CosOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct CosOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit CosOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - CosOptionsBuilder &operator=(const CosOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateCosOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - CosOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateCosOptions(flatbuffers::FlatBufferBuilder &_fbb, const CosOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ReducerOptionsT : public flatbuffers::NativeTable { - typedef ReducerOptions TableType; - bool keep_dims; - ReducerOptionsT() - : keep_dims(false) { - } -}; - -struct ReducerOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ReducerOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_KEEP_DIMS = 4 - }; - bool keep_dims() const { - return GetField(VT_KEEP_DIMS, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_KEEP_DIMS) && - verifier.EndTable(); - } - ReducerOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ReducerOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReducerOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ReducerOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_keep_dims(bool keep_dims) { - fbb_.AddElement(ReducerOptions::VT_KEEP_DIMS, static_cast(keep_dims), 0); - } - explicit ReducerOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ReducerOptionsBuilder &operator=(const ReducerOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateReducerOptions( - flatbuffers::FlatBufferBuilder &_fbb, - bool keep_dims = false) { - ReducerOptionsBuilder builder_(_fbb); - builder_.add_keep_dims(keep_dims); - return builder_.Finish(); -} - -flatbuffers::Offset CreateReducerOptions(flatbuffers::FlatBufferBuilder &_fbb, const ReducerOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SqueezeOptionsT : public flatbuffers::NativeTable { - typedef SqueezeOptions TableType; - std::vector squeeze_dims; - SqueezeOptionsT() { - } -}; - -struct SqueezeOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SqueezeOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SQUEEZE_DIMS = 4 - }; - const flatbuffers::Vector *squeeze_dims() const { - return GetPointer *>(VT_SQUEEZE_DIMS); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_SQUEEZE_DIMS) && - verifier.VerifyVector(squeeze_dims()) && - verifier.EndTable(); - } - SqueezeOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SqueezeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SqueezeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SqueezeOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_squeeze_dims(flatbuffers::Offset> squeeze_dims) { - fbb_.AddOffset(SqueezeOptions::VT_SQUEEZE_DIMS, squeeze_dims); - } - explicit SqueezeOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SqueezeOptionsBuilder &operator=(const SqueezeOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSqueezeOptions( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> squeeze_dims = 0) { - SqueezeOptionsBuilder builder_(_fbb); - builder_.add_squeeze_dims(squeeze_dims); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateSqueezeOptionsDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *squeeze_dims = nullptr) { - auto squeeze_dims__ = squeeze_dims ? _fbb.CreateVector(*squeeze_dims) : 0; - return tflite::CreateSqueezeOptions( - _fbb, - squeeze_dims__); -} - -flatbuffers::Offset CreateSqueezeOptions(flatbuffers::FlatBufferBuilder &_fbb, const SqueezeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SplitOptionsT : public flatbuffers::NativeTable { - typedef SplitOptions TableType; - int32_t num_splits; - SplitOptionsT() - : num_splits(0) { - } -}; - -struct SplitOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SplitOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NUM_SPLITS = 4 - }; - int32_t num_splits() const { - return GetField(VT_NUM_SPLITS, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_NUM_SPLITS) && - verifier.EndTable(); - } - SplitOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SplitOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SplitOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SplitOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_num_splits(int32_t num_splits) { - fbb_.AddElement(SplitOptions::VT_NUM_SPLITS, num_splits, 0); - } - explicit SplitOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SplitOptionsBuilder &operator=(const SplitOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSplitOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t num_splits = 0) { - SplitOptionsBuilder builder_(_fbb); - builder_.add_num_splits(num_splits); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSplitOptions(flatbuffers::FlatBufferBuilder &_fbb, const SplitOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SplitVOptionsT : public flatbuffers::NativeTable { - typedef SplitVOptions TableType; - int32_t num_splits; - SplitVOptionsT() - : num_splits(0) { - } -}; - -struct SplitVOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SplitVOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NUM_SPLITS = 4 - }; - int32_t num_splits() const { - return GetField(VT_NUM_SPLITS, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_NUM_SPLITS) && - verifier.EndTable(); - } - SplitVOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SplitVOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SplitVOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SplitVOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_num_splits(int32_t num_splits) { - fbb_.AddElement(SplitVOptions::VT_NUM_SPLITS, num_splits, 0); - } - explicit SplitVOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SplitVOptionsBuilder &operator=(const SplitVOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSplitVOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t num_splits = 0) { - SplitVOptionsBuilder builder_(_fbb); - builder_.add_num_splits(num_splits); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSplitVOptions(flatbuffers::FlatBufferBuilder &_fbb, const SplitVOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct StridedSliceOptionsT : public flatbuffers::NativeTable { - typedef StridedSliceOptions TableType; - int32_t begin_mask; - int32_t end_mask; - int32_t ellipsis_mask; - int32_t new_axis_mask; - int32_t shrink_axis_mask; - StridedSliceOptionsT() - : begin_mask(0), - end_mask(0), - ellipsis_mask(0), - new_axis_mask(0), - shrink_axis_mask(0) { - } -}; - -struct StridedSliceOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef StridedSliceOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_BEGIN_MASK = 4, - VT_END_MASK = 6, - VT_ELLIPSIS_MASK = 8, - VT_NEW_AXIS_MASK = 10, - VT_SHRINK_AXIS_MASK = 12 - }; - int32_t begin_mask() const { - return GetField(VT_BEGIN_MASK, 0); - } - int32_t end_mask() const { - return GetField(VT_END_MASK, 0); - } - int32_t ellipsis_mask() const { - return GetField(VT_ELLIPSIS_MASK, 0); - } - int32_t new_axis_mask() const { - return GetField(VT_NEW_AXIS_MASK, 0); - } - int32_t shrink_axis_mask() const { - return GetField(VT_SHRINK_AXIS_MASK, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_BEGIN_MASK) && - VerifyField(verifier, VT_END_MASK) && - VerifyField(verifier, VT_ELLIPSIS_MASK) && - VerifyField(verifier, VT_NEW_AXIS_MASK) && - VerifyField(verifier, VT_SHRINK_AXIS_MASK) && - verifier.EndTable(); - } - StridedSliceOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(StridedSliceOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const StridedSliceOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct StridedSliceOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_begin_mask(int32_t begin_mask) { - fbb_.AddElement(StridedSliceOptions::VT_BEGIN_MASK, begin_mask, 0); - } - void add_end_mask(int32_t end_mask) { - fbb_.AddElement(StridedSliceOptions::VT_END_MASK, end_mask, 0); - } - void add_ellipsis_mask(int32_t ellipsis_mask) { - fbb_.AddElement(StridedSliceOptions::VT_ELLIPSIS_MASK, ellipsis_mask, 0); - } - void add_new_axis_mask(int32_t new_axis_mask) { - fbb_.AddElement(StridedSliceOptions::VT_NEW_AXIS_MASK, new_axis_mask, 0); - } - void add_shrink_axis_mask(int32_t shrink_axis_mask) { - fbb_.AddElement(StridedSliceOptions::VT_SHRINK_AXIS_MASK, shrink_axis_mask, 0); - } - explicit StridedSliceOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - StridedSliceOptionsBuilder &operator=(const StridedSliceOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateStridedSliceOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t begin_mask = 0, - int32_t end_mask = 0, - int32_t ellipsis_mask = 0, - int32_t new_axis_mask = 0, - int32_t shrink_axis_mask = 0) { - StridedSliceOptionsBuilder builder_(_fbb); - builder_.add_shrink_axis_mask(shrink_axis_mask); - builder_.add_new_axis_mask(new_axis_mask); - builder_.add_ellipsis_mask(ellipsis_mask); - builder_.add_end_mask(end_mask); - builder_.add_begin_mask(begin_mask); - return builder_.Finish(); -} - -flatbuffers::Offset CreateStridedSliceOptions(flatbuffers::FlatBufferBuilder &_fbb, const StridedSliceOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct LogSoftmaxOptionsT : public flatbuffers::NativeTable { - typedef LogSoftmaxOptions TableType; - LogSoftmaxOptionsT() { - } -}; - -struct LogSoftmaxOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef LogSoftmaxOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - LogSoftmaxOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(LogSoftmaxOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const LogSoftmaxOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct LogSoftmaxOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit LogSoftmaxOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LogSoftmaxOptionsBuilder &operator=(const LogSoftmaxOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLogSoftmaxOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - LogSoftmaxOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateLogSoftmaxOptions(flatbuffers::FlatBufferBuilder &_fbb, const LogSoftmaxOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct CastOptionsT : public flatbuffers::NativeTable { - typedef CastOptions TableType; - tflite::TensorType in_data_type; - tflite::TensorType out_data_type; - CastOptionsT() - : in_data_type(tflite::TensorType_FLOAT32), - out_data_type(tflite::TensorType_FLOAT32) { - } -}; - -struct CastOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef CastOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_IN_DATA_TYPE = 4, - VT_OUT_DATA_TYPE = 6 - }; - tflite::TensorType in_data_type() const { - return static_cast(GetField(VT_IN_DATA_TYPE, 0)); - } - tflite::TensorType out_data_type() const { - return static_cast(GetField(VT_OUT_DATA_TYPE, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_IN_DATA_TYPE) && - VerifyField(verifier, VT_OUT_DATA_TYPE) && - verifier.EndTable(); - } - CastOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(CastOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const CastOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct CastOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_in_data_type(tflite::TensorType in_data_type) { - fbb_.AddElement(CastOptions::VT_IN_DATA_TYPE, static_cast(in_data_type), 0); - } - void add_out_data_type(tflite::TensorType out_data_type) { - fbb_.AddElement(CastOptions::VT_OUT_DATA_TYPE, static_cast(out_data_type), 0); - } - explicit CastOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - CastOptionsBuilder &operator=(const CastOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateCastOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::TensorType in_data_type = tflite::TensorType_FLOAT32, - tflite::TensorType out_data_type = tflite::TensorType_FLOAT32) { - CastOptionsBuilder builder_(_fbb); - builder_.add_out_data_type(out_data_type); - builder_.add_in_data_type(in_data_type); - return builder_.Finish(); -} - -flatbuffers::Offset CreateCastOptions(flatbuffers::FlatBufferBuilder &_fbb, const CastOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct DequantizeOptionsT : public flatbuffers::NativeTable { - typedef DequantizeOptions TableType; - DequantizeOptionsT() { - } -}; - -struct DequantizeOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef DequantizeOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - DequantizeOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(DequantizeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const DequantizeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct DequantizeOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit DequantizeOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - DequantizeOptionsBuilder &operator=(const DequantizeOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateDequantizeOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - DequantizeOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateDequantizeOptions(flatbuffers::FlatBufferBuilder &_fbb, const DequantizeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct MaximumMinimumOptionsT : public flatbuffers::NativeTable { - typedef MaximumMinimumOptions TableType; - MaximumMinimumOptionsT() { - } -}; - -struct MaximumMinimumOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef MaximumMinimumOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - MaximumMinimumOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(MaximumMinimumOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const MaximumMinimumOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct MaximumMinimumOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit MaximumMinimumOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - MaximumMinimumOptionsBuilder &operator=(const MaximumMinimumOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateMaximumMinimumOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - MaximumMinimumOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateMaximumMinimumOptions(flatbuffers::FlatBufferBuilder &_fbb, const MaximumMinimumOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct TileOptionsT : public flatbuffers::NativeTable { - typedef TileOptions TableType; - TileOptionsT() { - } -}; - -struct TileOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef TileOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - TileOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(TileOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const TileOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct TileOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit TileOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TileOptionsBuilder &operator=(const TileOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateTileOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - TileOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateTileOptions(flatbuffers::FlatBufferBuilder &_fbb, const TileOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ArgMaxOptionsT : public flatbuffers::NativeTable { - typedef ArgMaxOptions TableType; - tflite::TensorType output_type; - ArgMaxOptionsT() - : output_type(tflite::TensorType_FLOAT32) { - } -}; - -struct ArgMaxOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ArgMaxOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_OUTPUT_TYPE = 4 - }; - tflite::TensorType output_type() const { - return static_cast(GetField(VT_OUTPUT_TYPE, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_OUTPUT_TYPE) && - verifier.EndTable(); - } - ArgMaxOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ArgMaxOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ArgMaxOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ArgMaxOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_output_type(tflite::TensorType output_type) { - fbb_.AddElement(ArgMaxOptions::VT_OUTPUT_TYPE, static_cast(output_type), 0); - } - explicit ArgMaxOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ArgMaxOptionsBuilder &operator=(const ArgMaxOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateArgMaxOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::TensorType output_type = tflite::TensorType_FLOAT32) { - ArgMaxOptionsBuilder builder_(_fbb); - builder_.add_output_type(output_type); - return builder_.Finish(); -} - -flatbuffers::Offset CreateArgMaxOptions(flatbuffers::FlatBufferBuilder &_fbb, const ArgMaxOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ArgMinOptionsT : public flatbuffers::NativeTable { - typedef ArgMinOptions TableType; - tflite::TensorType output_type; - ArgMinOptionsT() - : output_type(tflite::TensorType_FLOAT32) { - } -}; - -struct ArgMinOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ArgMinOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_OUTPUT_TYPE = 4 - }; - tflite::TensorType output_type() const { - return static_cast(GetField(VT_OUTPUT_TYPE, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_OUTPUT_TYPE) && - verifier.EndTable(); - } - ArgMinOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ArgMinOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ArgMinOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ArgMinOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_output_type(tflite::TensorType output_type) { - fbb_.AddElement(ArgMinOptions::VT_OUTPUT_TYPE, static_cast(output_type), 0); - } - explicit ArgMinOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ArgMinOptionsBuilder &operator=(const ArgMinOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateArgMinOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::TensorType output_type = tflite::TensorType_FLOAT32) { - ArgMinOptionsBuilder builder_(_fbb); - builder_.add_output_type(output_type); - return builder_.Finish(); -} - -flatbuffers::Offset CreateArgMinOptions(flatbuffers::FlatBufferBuilder &_fbb, const ArgMinOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct GreaterOptionsT : public flatbuffers::NativeTable { - typedef GreaterOptions TableType; - GreaterOptionsT() { - } -}; - -struct GreaterOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef GreaterOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - GreaterOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(GreaterOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const GreaterOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct GreaterOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit GreaterOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - GreaterOptionsBuilder &operator=(const GreaterOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateGreaterOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - GreaterOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateGreaterOptions(flatbuffers::FlatBufferBuilder &_fbb, const GreaterOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct GreaterEqualOptionsT : public flatbuffers::NativeTable { - typedef GreaterEqualOptions TableType; - GreaterEqualOptionsT() { - } -}; - -struct GreaterEqualOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef GreaterEqualOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - GreaterEqualOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(GreaterEqualOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const GreaterEqualOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct GreaterEqualOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit GreaterEqualOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - GreaterEqualOptionsBuilder &operator=(const GreaterEqualOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateGreaterEqualOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - GreaterEqualOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateGreaterEqualOptions(flatbuffers::FlatBufferBuilder &_fbb, const GreaterEqualOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct LessOptionsT : public flatbuffers::NativeTable { - typedef LessOptions TableType; - LessOptionsT() { - } -}; - -struct LessOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef LessOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - LessOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(LessOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const LessOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct LessOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit LessOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LessOptionsBuilder &operator=(const LessOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLessOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - LessOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateLessOptions(flatbuffers::FlatBufferBuilder &_fbb, const LessOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct LessEqualOptionsT : public flatbuffers::NativeTable { - typedef LessEqualOptions TableType; - LessEqualOptionsT() { - } -}; - -struct LessEqualOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef LessEqualOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - LessEqualOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(LessEqualOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const LessEqualOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct LessEqualOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit LessEqualOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LessEqualOptionsBuilder &operator=(const LessEqualOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLessEqualOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - LessEqualOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateLessEqualOptions(flatbuffers::FlatBufferBuilder &_fbb, const LessEqualOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct NegOptionsT : public flatbuffers::NativeTable { - typedef NegOptions TableType; - NegOptionsT() { - } -}; - -struct NegOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef NegOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - NegOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(NegOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const NegOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct NegOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit NegOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - NegOptionsBuilder &operator=(const NegOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateNegOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - NegOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateNegOptions(flatbuffers::FlatBufferBuilder &_fbb, const NegOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SelectOptionsT : public flatbuffers::NativeTable { - typedef SelectOptions TableType; - SelectOptionsT() { - } -}; - -struct SelectOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SelectOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - SelectOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SelectOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SelectOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SelectOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit SelectOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SelectOptionsBuilder &operator=(const SelectOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSelectOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - SelectOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSelectOptions(flatbuffers::FlatBufferBuilder &_fbb, const SelectOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SliceOptionsT : public flatbuffers::NativeTable { - typedef SliceOptions TableType; - SliceOptionsT() { - } -}; - -struct SliceOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SliceOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - SliceOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SliceOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SliceOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SliceOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit SliceOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SliceOptionsBuilder &operator=(const SliceOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSliceOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - SliceOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSliceOptions(flatbuffers::FlatBufferBuilder &_fbb, const SliceOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct TransposeConvOptionsT : public flatbuffers::NativeTable { - typedef TransposeConvOptions TableType; - tflite::Padding padding; - int32_t stride_w; - int32_t stride_h; - TransposeConvOptionsT() - : padding(tflite::Padding_SAME), - stride_w(0), - stride_h(0) { - } -}; - -struct TransposeConvOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef TransposeConvOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_PADDING = 4, - VT_STRIDE_W = 6, - VT_STRIDE_H = 8 - }; - tflite::Padding padding() const { - return static_cast(GetField(VT_PADDING, 0)); - } - int32_t stride_w() const { - return GetField(VT_STRIDE_W, 0); - } - int32_t stride_h() const { - return GetField(VT_STRIDE_H, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_PADDING) && - VerifyField(verifier, VT_STRIDE_W) && - VerifyField(verifier, VT_STRIDE_H) && - verifier.EndTable(); - } - TransposeConvOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(TransposeConvOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const TransposeConvOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct TransposeConvOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_padding(tflite::Padding padding) { - fbb_.AddElement(TransposeConvOptions::VT_PADDING, static_cast(padding), 0); - } - void add_stride_w(int32_t stride_w) { - fbb_.AddElement(TransposeConvOptions::VT_STRIDE_W, stride_w, 0); - } - void add_stride_h(int32_t stride_h) { - fbb_.AddElement(TransposeConvOptions::VT_STRIDE_H, stride_h, 0); - } - explicit TransposeConvOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TransposeConvOptionsBuilder &operator=(const TransposeConvOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateTransposeConvOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::Padding padding = tflite::Padding_SAME, - int32_t stride_w = 0, - int32_t stride_h = 0) { - TransposeConvOptionsBuilder builder_(_fbb); - builder_.add_stride_h(stride_h); - builder_.add_stride_w(stride_w); - builder_.add_padding(padding); - return builder_.Finish(); -} - -flatbuffers::Offset CreateTransposeConvOptions(flatbuffers::FlatBufferBuilder &_fbb, const TransposeConvOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ExpandDimsOptionsT : public flatbuffers::NativeTable { - typedef ExpandDimsOptions TableType; - ExpandDimsOptionsT() { - } -}; - -struct ExpandDimsOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ExpandDimsOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - ExpandDimsOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ExpandDimsOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ExpandDimsOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ExpandDimsOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit ExpandDimsOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ExpandDimsOptionsBuilder &operator=(const ExpandDimsOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateExpandDimsOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - ExpandDimsOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateExpandDimsOptions(flatbuffers::FlatBufferBuilder &_fbb, const ExpandDimsOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SparseToDenseOptionsT : public flatbuffers::NativeTable { - typedef SparseToDenseOptions TableType; - bool validate_indices; - SparseToDenseOptionsT() - : validate_indices(false) { - } -}; - -struct SparseToDenseOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SparseToDenseOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_VALIDATE_INDICES = 4 - }; - bool validate_indices() const { - return GetField(VT_VALIDATE_INDICES, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_VALIDATE_INDICES) && - verifier.EndTable(); - } - SparseToDenseOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SparseToDenseOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SparseToDenseOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SparseToDenseOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_validate_indices(bool validate_indices) { - fbb_.AddElement(SparseToDenseOptions::VT_VALIDATE_INDICES, static_cast(validate_indices), 0); - } - explicit SparseToDenseOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SparseToDenseOptionsBuilder &operator=(const SparseToDenseOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSparseToDenseOptions( - flatbuffers::FlatBufferBuilder &_fbb, - bool validate_indices = false) { - SparseToDenseOptionsBuilder builder_(_fbb); - builder_.add_validate_indices(validate_indices); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSparseToDenseOptions(flatbuffers::FlatBufferBuilder &_fbb, const SparseToDenseOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct EqualOptionsT : public flatbuffers::NativeTable { - typedef EqualOptions TableType; - EqualOptionsT() { - } -}; - -struct EqualOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef EqualOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - EqualOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(EqualOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const EqualOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct EqualOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit EqualOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - EqualOptionsBuilder &operator=(const EqualOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateEqualOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - EqualOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateEqualOptions(flatbuffers::FlatBufferBuilder &_fbb, const EqualOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct NotEqualOptionsT : public flatbuffers::NativeTable { - typedef NotEqualOptions TableType; - NotEqualOptionsT() { - } -}; - -struct NotEqualOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef NotEqualOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - NotEqualOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(NotEqualOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const NotEqualOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct NotEqualOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit NotEqualOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - NotEqualOptionsBuilder &operator=(const NotEqualOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateNotEqualOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - NotEqualOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateNotEqualOptions(flatbuffers::FlatBufferBuilder &_fbb, const NotEqualOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ShapeOptionsT : public flatbuffers::NativeTable { - typedef ShapeOptions TableType; - tflite::TensorType out_type; - ShapeOptionsT() - : out_type(tflite::TensorType_FLOAT32) { - } -}; - -struct ShapeOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ShapeOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_OUT_TYPE = 4 - }; - tflite::TensorType out_type() const { - return static_cast(GetField(VT_OUT_TYPE, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_OUT_TYPE) && - verifier.EndTable(); - } - ShapeOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ShapeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ShapeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ShapeOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_out_type(tflite::TensorType out_type) { - fbb_.AddElement(ShapeOptions::VT_OUT_TYPE, static_cast(out_type), 0); - } - explicit ShapeOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ShapeOptionsBuilder &operator=(const ShapeOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateShapeOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::TensorType out_type = tflite::TensorType_FLOAT32) { - ShapeOptionsBuilder builder_(_fbb); - builder_.add_out_type(out_type); - return builder_.Finish(); -} - -flatbuffers::Offset CreateShapeOptions(flatbuffers::FlatBufferBuilder &_fbb, const ShapeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct RankOptionsT : public flatbuffers::NativeTable { - typedef RankOptions TableType; - RankOptionsT() { - } -}; - -struct RankOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef RankOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - RankOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(RankOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const RankOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct RankOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit RankOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - RankOptionsBuilder &operator=(const RankOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateRankOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - RankOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateRankOptions(flatbuffers::FlatBufferBuilder &_fbb, const RankOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct PowOptionsT : public flatbuffers::NativeTable { - typedef PowOptions TableType; - PowOptionsT() { - } -}; - -struct PowOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef PowOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - PowOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(PowOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const PowOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct PowOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit PowOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - PowOptionsBuilder &operator=(const PowOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreatePowOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - PowOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreatePowOptions(flatbuffers::FlatBufferBuilder &_fbb, const PowOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct FakeQuantOptionsT : public flatbuffers::NativeTable { - typedef FakeQuantOptions TableType; - float min; - float max; - int32_t num_bits; - bool narrow_range; - FakeQuantOptionsT() - : min(0.0f), - max(0.0f), - num_bits(0), - narrow_range(false) { - } -}; - -struct FakeQuantOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef FakeQuantOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_MIN = 4, - VT_MAX = 6, - VT_NUM_BITS = 8, - VT_NARROW_RANGE = 10 - }; - float min() const { - return GetField(VT_MIN, 0.0f); - } - float max() const { - return GetField(VT_MAX, 0.0f); - } - int32_t num_bits() const { - return GetField(VT_NUM_BITS, 0); - } - bool narrow_range() const { - return GetField(VT_NARROW_RANGE, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_MIN) && - VerifyField(verifier, VT_MAX) && - VerifyField(verifier, VT_NUM_BITS) && - VerifyField(verifier, VT_NARROW_RANGE) && - verifier.EndTable(); - } - FakeQuantOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(FakeQuantOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const FakeQuantOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct FakeQuantOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_min(float min) { - fbb_.AddElement(FakeQuantOptions::VT_MIN, min, 0.0f); - } - void add_max(float max) { - fbb_.AddElement(FakeQuantOptions::VT_MAX, max, 0.0f); - } - void add_num_bits(int32_t num_bits) { - fbb_.AddElement(FakeQuantOptions::VT_NUM_BITS, num_bits, 0); - } - void add_narrow_range(bool narrow_range) { - fbb_.AddElement(FakeQuantOptions::VT_NARROW_RANGE, static_cast(narrow_range), 0); - } - explicit FakeQuantOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - FakeQuantOptionsBuilder &operator=(const FakeQuantOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateFakeQuantOptions( - flatbuffers::FlatBufferBuilder &_fbb, - float min = 0.0f, - float max = 0.0f, - int32_t num_bits = 0, - bool narrow_range = false) { - FakeQuantOptionsBuilder builder_(_fbb); - builder_.add_num_bits(num_bits); - builder_.add_max(max); - builder_.add_min(min); - builder_.add_narrow_range(narrow_range); - return builder_.Finish(); -} - -flatbuffers::Offset CreateFakeQuantOptions(flatbuffers::FlatBufferBuilder &_fbb, const FakeQuantOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct PackOptionsT : public flatbuffers::NativeTable { - typedef PackOptions TableType; - int32_t values_count; - int32_t axis; - PackOptionsT() - : values_count(0), - axis(0) { - } -}; - -struct PackOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef PackOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_VALUES_COUNT = 4, - VT_AXIS = 6 - }; - int32_t values_count() const { - return GetField(VT_VALUES_COUNT, 0); - } - int32_t axis() const { - return GetField(VT_AXIS, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_VALUES_COUNT) && - VerifyField(verifier, VT_AXIS) && - verifier.EndTable(); - } - PackOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(PackOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const PackOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct PackOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_values_count(int32_t values_count) { - fbb_.AddElement(PackOptions::VT_VALUES_COUNT, values_count, 0); - } - void add_axis(int32_t axis) { - fbb_.AddElement(PackOptions::VT_AXIS, axis, 0); - } - explicit PackOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - PackOptionsBuilder &operator=(const PackOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreatePackOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t values_count = 0, - int32_t axis = 0) { - PackOptionsBuilder builder_(_fbb); - builder_.add_axis(axis); - builder_.add_values_count(values_count); - return builder_.Finish(); -} - -flatbuffers::Offset CreatePackOptions(flatbuffers::FlatBufferBuilder &_fbb, const PackOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct LogicalOrOptionsT : public flatbuffers::NativeTable { - typedef LogicalOrOptions TableType; - LogicalOrOptionsT() { - } -}; - -struct LogicalOrOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef LogicalOrOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - LogicalOrOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(LogicalOrOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const LogicalOrOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct LogicalOrOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit LogicalOrOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LogicalOrOptionsBuilder &operator=(const LogicalOrOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLogicalOrOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - LogicalOrOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateLogicalOrOptions(flatbuffers::FlatBufferBuilder &_fbb, const LogicalOrOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct OneHotOptionsT : public flatbuffers::NativeTable { - typedef OneHotOptions TableType; - int32_t axis; - OneHotOptionsT() - : axis(0) { - } -}; - -struct OneHotOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef OneHotOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_AXIS = 4 - }; - int32_t axis() const { - return GetField(VT_AXIS, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_AXIS) && - verifier.EndTable(); - } - OneHotOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(OneHotOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const OneHotOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct OneHotOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_axis(int32_t axis) { - fbb_.AddElement(OneHotOptions::VT_AXIS, axis, 0); - } - explicit OneHotOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - OneHotOptionsBuilder &operator=(const OneHotOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateOneHotOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t axis = 0) { - OneHotOptionsBuilder builder_(_fbb); - builder_.add_axis(axis); - return builder_.Finish(); -} - -flatbuffers::Offset CreateOneHotOptions(flatbuffers::FlatBufferBuilder &_fbb, const OneHotOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct AbsOptionsT : public flatbuffers::NativeTable { - typedef AbsOptions TableType; - AbsOptionsT() { - } -}; - -struct AbsOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef AbsOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - AbsOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(AbsOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const AbsOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct AbsOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit AbsOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - AbsOptionsBuilder &operator=(const AbsOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateAbsOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - AbsOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateAbsOptions(flatbuffers::FlatBufferBuilder &_fbb, const AbsOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct HardSwishOptionsT : public flatbuffers::NativeTable { - typedef HardSwishOptions TableType; - HardSwishOptionsT() { - } -}; - -struct HardSwishOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef HardSwishOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - HardSwishOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(HardSwishOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const HardSwishOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct HardSwishOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit HardSwishOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - HardSwishOptionsBuilder &operator=(const HardSwishOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateHardSwishOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - HardSwishOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateHardSwishOptions(flatbuffers::FlatBufferBuilder &_fbb, const HardSwishOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct LogicalAndOptionsT : public flatbuffers::NativeTable { - typedef LogicalAndOptions TableType; - LogicalAndOptionsT() { - } -}; - -struct LogicalAndOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef LogicalAndOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - LogicalAndOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(LogicalAndOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const LogicalAndOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct LogicalAndOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit LogicalAndOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LogicalAndOptionsBuilder &operator=(const LogicalAndOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLogicalAndOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - LogicalAndOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateLogicalAndOptions(flatbuffers::FlatBufferBuilder &_fbb, const LogicalAndOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct LogicalNotOptionsT : public flatbuffers::NativeTable { - typedef LogicalNotOptions TableType; - LogicalNotOptionsT() { - } -}; - -struct LogicalNotOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef LogicalNotOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - LogicalNotOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(LogicalNotOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const LogicalNotOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct LogicalNotOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit LogicalNotOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LogicalNotOptionsBuilder &operator=(const LogicalNotOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLogicalNotOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - LogicalNotOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateLogicalNotOptions(flatbuffers::FlatBufferBuilder &_fbb, const LogicalNotOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct UnpackOptionsT : public flatbuffers::NativeTable { - typedef UnpackOptions TableType; - int32_t num; - int32_t axis; - UnpackOptionsT() - : num(0), - axis(0) { - } -}; - -struct UnpackOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef UnpackOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NUM = 4, - VT_AXIS = 6 - }; - int32_t num() const { - return GetField(VT_NUM, 0); - } - int32_t axis() const { - return GetField(VT_AXIS, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_NUM) && - VerifyField(verifier, VT_AXIS) && - verifier.EndTable(); - } - UnpackOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(UnpackOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const UnpackOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct UnpackOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_num(int32_t num) { - fbb_.AddElement(UnpackOptions::VT_NUM, num, 0); - } - void add_axis(int32_t axis) { - fbb_.AddElement(UnpackOptions::VT_AXIS, axis, 0); - } - explicit UnpackOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - UnpackOptionsBuilder &operator=(const UnpackOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateUnpackOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t num = 0, - int32_t axis = 0) { - UnpackOptionsBuilder builder_(_fbb); - builder_.add_axis(axis); - builder_.add_num(num); - return builder_.Finish(); -} - -flatbuffers::Offset CreateUnpackOptions(flatbuffers::FlatBufferBuilder &_fbb, const UnpackOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct FloorDivOptionsT : public flatbuffers::NativeTable { - typedef FloorDivOptions TableType; - FloorDivOptionsT() { - } -}; - -struct FloorDivOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef FloorDivOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - FloorDivOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(FloorDivOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const FloorDivOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct FloorDivOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit FloorDivOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - FloorDivOptionsBuilder &operator=(const FloorDivOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateFloorDivOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - FloorDivOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateFloorDivOptions(flatbuffers::FlatBufferBuilder &_fbb, const FloorDivOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SquareOptionsT : public flatbuffers::NativeTable { - typedef SquareOptions TableType; - SquareOptionsT() { - } -}; - -struct SquareOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SquareOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - SquareOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SquareOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SquareOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SquareOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit SquareOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SquareOptionsBuilder &operator=(const SquareOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSquareOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - SquareOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSquareOptions(flatbuffers::FlatBufferBuilder &_fbb, const SquareOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ZerosLikeOptionsT : public flatbuffers::NativeTable { - typedef ZerosLikeOptions TableType; - ZerosLikeOptionsT() { - } -}; - -struct ZerosLikeOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ZerosLikeOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - ZerosLikeOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ZerosLikeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ZerosLikeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ZerosLikeOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit ZerosLikeOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ZerosLikeOptionsBuilder &operator=(const ZerosLikeOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateZerosLikeOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - ZerosLikeOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateZerosLikeOptions(flatbuffers::FlatBufferBuilder &_fbb, const ZerosLikeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct FillOptionsT : public flatbuffers::NativeTable { - typedef FillOptions TableType; - FillOptionsT() { - } -}; - -struct FillOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef FillOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - FillOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(FillOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const FillOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct FillOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit FillOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - FillOptionsBuilder &operator=(const FillOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateFillOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - FillOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateFillOptions(flatbuffers::FlatBufferBuilder &_fbb, const FillOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct FloorModOptionsT : public flatbuffers::NativeTable { - typedef FloorModOptions TableType; - FloorModOptionsT() { - } -}; - -struct FloorModOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef FloorModOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - FloorModOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(FloorModOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const FloorModOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct FloorModOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit FloorModOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - FloorModOptionsBuilder &operator=(const FloorModOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateFloorModOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - FloorModOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateFloorModOptions(flatbuffers::FlatBufferBuilder &_fbb, const FloorModOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct RangeOptionsT : public flatbuffers::NativeTable { - typedef RangeOptions TableType; - RangeOptionsT() { - } -}; - -struct RangeOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef RangeOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - RangeOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(RangeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const RangeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct RangeOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit RangeOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - RangeOptionsBuilder &operator=(const RangeOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateRangeOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - RangeOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateRangeOptions(flatbuffers::FlatBufferBuilder &_fbb, const RangeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct LeakyReluOptionsT : public flatbuffers::NativeTable { - typedef LeakyReluOptions TableType; - float alpha; - LeakyReluOptionsT() - : alpha(0.0f) { - } -}; - -struct LeakyReluOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef LeakyReluOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ALPHA = 4 - }; - float alpha() const { - return GetField(VT_ALPHA, 0.0f); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ALPHA) && - verifier.EndTable(); - } - LeakyReluOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(LeakyReluOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const LeakyReluOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct LeakyReluOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_alpha(float alpha) { - fbb_.AddElement(LeakyReluOptions::VT_ALPHA, alpha, 0.0f); - } - explicit LeakyReluOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - LeakyReluOptionsBuilder &operator=(const LeakyReluOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateLeakyReluOptions( - flatbuffers::FlatBufferBuilder &_fbb, - float alpha = 0.0f) { - LeakyReluOptionsBuilder builder_(_fbb); - builder_.add_alpha(alpha); - return builder_.Finish(); -} - -flatbuffers::Offset CreateLeakyReluOptions(flatbuffers::FlatBufferBuilder &_fbb, const LeakyReluOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SquaredDifferenceOptionsT : public flatbuffers::NativeTable { - typedef SquaredDifferenceOptions TableType; - SquaredDifferenceOptionsT() { - } -}; - -struct SquaredDifferenceOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SquaredDifferenceOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - SquaredDifferenceOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SquaredDifferenceOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SquaredDifferenceOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SquaredDifferenceOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit SquaredDifferenceOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SquaredDifferenceOptionsBuilder &operator=(const SquaredDifferenceOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSquaredDifferenceOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - SquaredDifferenceOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSquaredDifferenceOptions(flatbuffers::FlatBufferBuilder &_fbb, const SquaredDifferenceOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct MirrorPadOptionsT : public flatbuffers::NativeTable { - typedef MirrorPadOptions TableType; - tflite::MirrorPadMode mode; - MirrorPadOptionsT() - : mode(tflite::MirrorPadMode_REFLECT) { - } -}; - -struct MirrorPadOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef MirrorPadOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_MODE = 4 - }; - tflite::MirrorPadMode mode() const { - return static_cast(GetField(VT_MODE, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_MODE) && - verifier.EndTable(); - } - MirrorPadOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(MirrorPadOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const MirrorPadOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct MirrorPadOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_mode(tflite::MirrorPadMode mode) { - fbb_.AddElement(MirrorPadOptions::VT_MODE, static_cast(mode), 0); - } - explicit MirrorPadOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - MirrorPadOptionsBuilder &operator=(const MirrorPadOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateMirrorPadOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::MirrorPadMode mode = tflite::MirrorPadMode_REFLECT) { - MirrorPadOptionsBuilder builder_(_fbb); - builder_.add_mode(mode); - return builder_.Finish(); -} - -flatbuffers::Offset CreateMirrorPadOptions(flatbuffers::FlatBufferBuilder &_fbb, const MirrorPadOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct UniqueOptionsT : public flatbuffers::NativeTable { - typedef UniqueOptions TableType; - tflite::TensorType idx_out_type; - UniqueOptionsT() - : idx_out_type(tflite::TensorType_INT32) { - } -}; - -struct UniqueOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef UniqueOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_IDX_OUT_TYPE = 4 - }; - tflite::TensorType idx_out_type() const { - return static_cast(GetField(VT_IDX_OUT_TYPE, 2)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_IDX_OUT_TYPE) && - verifier.EndTable(); - } - UniqueOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(UniqueOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const UniqueOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct UniqueOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_idx_out_type(tflite::TensorType idx_out_type) { - fbb_.AddElement(UniqueOptions::VT_IDX_OUT_TYPE, static_cast(idx_out_type), 2); - } - explicit UniqueOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - UniqueOptionsBuilder &operator=(const UniqueOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateUniqueOptions( - flatbuffers::FlatBufferBuilder &_fbb, - tflite::TensorType idx_out_type = tflite::TensorType_INT32) { - UniqueOptionsBuilder builder_(_fbb); - builder_.add_idx_out_type(idx_out_type); - return builder_.Finish(); -} - -flatbuffers::Offset CreateUniqueOptions(flatbuffers::FlatBufferBuilder &_fbb, const UniqueOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ReverseV2OptionsT : public flatbuffers::NativeTable { - typedef ReverseV2Options TableType; - ReverseV2OptionsT() { - } -}; - -struct ReverseV2Options FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ReverseV2OptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - ReverseV2OptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ReverseV2OptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReverseV2OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ReverseV2OptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit ReverseV2OptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ReverseV2OptionsBuilder &operator=(const ReverseV2OptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateReverseV2Options( - flatbuffers::FlatBufferBuilder &_fbb) { - ReverseV2OptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateReverseV2Options(flatbuffers::FlatBufferBuilder &_fbb, const ReverseV2OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct AddNOptionsT : public flatbuffers::NativeTable { - typedef AddNOptions TableType; - AddNOptionsT() { - } -}; - -struct AddNOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef AddNOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - AddNOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(AddNOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const AddNOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct AddNOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit AddNOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - AddNOptionsBuilder &operator=(const AddNOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateAddNOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - AddNOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateAddNOptions(flatbuffers::FlatBufferBuilder &_fbb, const AddNOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct GatherNdOptionsT : public flatbuffers::NativeTable { - typedef GatherNdOptions TableType; - GatherNdOptionsT() { - } -}; - -struct GatherNdOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef GatherNdOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - GatherNdOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(GatherNdOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const GatherNdOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct GatherNdOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit GatherNdOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - GatherNdOptionsBuilder &operator=(const GatherNdOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateGatherNdOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - GatherNdOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateGatherNdOptions(flatbuffers::FlatBufferBuilder &_fbb, const GatherNdOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct WhereOptionsT : public flatbuffers::NativeTable { - typedef WhereOptions TableType; - WhereOptionsT() { - } -}; - -struct WhereOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef WhereOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - WhereOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(WhereOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const WhereOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct WhereOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit WhereOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - WhereOptionsBuilder &operator=(const WhereOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateWhereOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - WhereOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateWhereOptions(flatbuffers::FlatBufferBuilder &_fbb, const WhereOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ReverseSequenceOptionsT : public flatbuffers::NativeTable { - typedef ReverseSequenceOptions TableType; - int32_t seq_dim; - int32_t batch_dim; - ReverseSequenceOptionsT() - : seq_dim(0), - batch_dim(0) { - } -}; - -struct ReverseSequenceOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ReverseSequenceOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_SEQ_DIM = 4, - VT_BATCH_DIM = 6 - }; - int32_t seq_dim() const { - return GetField(VT_SEQ_DIM, 0); - } - int32_t batch_dim() const { - return GetField(VT_BATCH_DIM, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_SEQ_DIM) && - VerifyField(verifier, VT_BATCH_DIM) && - verifier.EndTable(); - } - ReverseSequenceOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ReverseSequenceOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReverseSequenceOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ReverseSequenceOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_seq_dim(int32_t seq_dim) { - fbb_.AddElement(ReverseSequenceOptions::VT_SEQ_DIM, seq_dim, 0); - } - void add_batch_dim(int32_t batch_dim) { - fbb_.AddElement(ReverseSequenceOptions::VT_BATCH_DIM, batch_dim, 0); - } - explicit ReverseSequenceOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ReverseSequenceOptionsBuilder &operator=(const ReverseSequenceOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateReverseSequenceOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t seq_dim = 0, - int32_t batch_dim = 0) { - ReverseSequenceOptionsBuilder builder_(_fbb); - builder_.add_batch_dim(batch_dim); - builder_.add_seq_dim(seq_dim); - return builder_.Finish(); -} - -flatbuffers::Offset CreateReverseSequenceOptions(flatbuffers::FlatBufferBuilder &_fbb, const ReverseSequenceOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct MatrixDiagOptionsT : public flatbuffers::NativeTable { - typedef MatrixDiagOptions TableType; - MatrixDiagOptionsT() { - } -}; - -struct MatrixDiagOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef MatrixDiagOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - MatrixDiagOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(MatrixDiagOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const MatrixDiagOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct MatrixDiagOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit MatrixDiagOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - MatrixDiagOptionsBuilder &operator=(const MatrixDiagOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateMatrixDiagOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - MatrixDiagOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateMatrixDiagOptions(flatbuffers::FlatBufferBuilder &_fbb, const MatrixDiagOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct QuantizeOptionsT : public flatbuffers::NativeTable { - typedef QuantizeOptions TableType; - QuantizeOptionsT() { - } -}; - -struct QuantizeOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef QuantizeOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - QuantizeOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(QuantizeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const QuantizeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct QuantizeOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit QuantizeOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - QuantizeOptionsBuilder &operator=(const QuantizeOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateQuantizeOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - QuantizeOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateQuantizeOptions(flatbuffers::FlatBufferBuilder &_fbb, const QuantizeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct MatrixSetDiagOptionsT : public flatbuffers::NativeTable { - typedef MatrixSetDiagOptions TableType; - MatrixSetDiagOptionsT() { - } -}; - -struct MatrixSetDiagOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef MatrixSetDiagOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - MatrixSetDiagOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(MatrixSetDiagOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const MatrixSetDiagOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct MatrixSetDiagOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit MatrixSetDiagOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - MatrixSetDiagOptionsBuilder &operator=(const MatrixSetDiagOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateMatrixSetDiagOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - MatrixSetDiagOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateMatrixSetDiagOptions(flatbuffers::FlatBufferBuilder &_fbb, const MatrixSetDiagOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct IfOptionsT : public flatbuffers::NativeTable { - typedef IfOptions TableType; - int32_t then_subgraph_index; - int32_t else_subgraph_index; - IfOptionsT() - : then_subgraph_index(0), - else_subgraph_index(0) { - } -}; - -struct IfOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef IfOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_THEN_SUBGRAPH_INDEX = 4, - VT_ELSE_SUBGRAPH_INDEX = 6 - }; - int32_t then_subgraph_index() const { - return GetField(VT_THEN_SUBGRAPH_INDEX, 0); - } - int32_t else_subgraph_index() const { - return GetField(VT_ELSE_SUBGRAPH_INDEX, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_THEN_SUBGRAPH_INDEX) && - VerifyField(verifier, VT_ELSE_SUBGRAPH_INDEX) && - verifier.EndTable(); - } - IfOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(IfOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const IfOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct IfOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_then_subgraph_index(int32_t then_subgraph_index) { - fbb_.AddElement(IfOptions::VT_THEN_SUBGRAPH_INDEX, then_subgraph_index, 0); - } - void add_else_subgraph_index(int32_t else_subgraph_index) { - fbb_.AddElement(IfOptions::VT_ELSE_SUBGRAPH_INDEX, else_subgraph_index, 0); - } - explicit IfOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - IfOptionsBuilder &operator=(const IfOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateIfOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t then_subgraph_index = 0, - int32_t else_subgraph_index = 0) { - IfOptionsBuilder builder_(_fbb); - builder_.add_else_subgraph_index(else_subgraph_index); - builder_.add_then_subgraph_index(then_subgraph_index); - return builder_.Finish(); -} - -flatbuffers::Offset CreateIfOptions(flatbuffers::FlatBufferBuilder &_fbb, const IfOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct WhileOptionsT : public flatbuffers::NativeTable { - typedef WhileOptions TableType; - int32_t cond_subgraph_index; - int32_t body_subgraph_index; - WhileOptionsT() - : cond_subgraph_index(0), - body_subgraph_index(0) { - } -}; - -struct WhileOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef WhileOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_COND_SUBGRAPH_INDEX = 4, - VT_BODY_SUBGRAPH_INDEX = 6 - }; - int32_t cond_subgraph_index() const { - return GetField(VT_COND_SUBGRAPH_INDEX, 0); - } - int32_t body_subgraph_index() const { - return GetField(VT_BODY_SUBGRAPH_INDEX, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_COND_SUBGRAPH_INDEX) && - VerifyField(verifier, VT_BODY_SUBGRAPH_INDEX) && - verifier.EndTable(); - } - WhileOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(WhileOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const WhileOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct WhileOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_cond_subgraph_index(int32_t cond_subgraph_index) { - fbb_.AddElement(WhileOptions::VT_COND_SUBGRAPH_INDEX, cond_subgraph_index, 0); - } - void add_body_subgraph_index(int32_t body_subgraph_index) { - fbb_.AddElement(WhileOptions::VT_BODY_SUBGRAPH_INDEX, body_subgraph_index, 0); - } - explicit WhileOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - WhileOptionsBuilder &operator=(const WhileOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateWhileOptions( - flatbuffers::FlatBufferBuilder &_fbb, - int32_t cond_subgraph_index = 0, - int32_t body_subgraph_index = 0) { - WhileOptionsBuilder builder_(_fbb); - builder_.add_body_subgraph_index(body_subgraph_index); - builder_.add_cond_subgraph_index(cond_subgraph_index); - return builder_.Finish(); -} - -flatbuffers::Offset CreateWhileOptions(flatbuffers::FlatBufferBuilder &_fbb, const WhileOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct NonMaxSuppressionV4OptionsT : public flatbuffers::NativeTable { - typedef NonMaxSuppressionV4Options TableType; - NonMaxSuppressionV4OptionsT() { - } -}; - -struct NonMaxSuppressionV4Options FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef NonMaxSuppressionV4OptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - NonMaxSuppressionV4OptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(NonMaxSuppressionV4OptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const NonMaxSuppressionV4OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct NonMaxSuppressionV4OptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit NonMaxSuppressionV4OptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - NonMaxSuppressionV4OptionsBuilder &operator=(const NonMaxSuppressionV4OptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateNonMaxSuppressionV4Options( - flatbuffers::FlatBufferBuilder &_fbb) { - NonMaxSuppressionV4OptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateNonMaxSuppressionV4Options(flatbuffers::FlatBufferBuilder &_fbb, const NonMaxSuppressionV4OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct NonMaxSuppressionV5OptionsT : public flatbuffers::NativeTable { - typedef NonMaxSuppressionV5Options TableType; - NonMaxSuppressionV5OptionsT() { - } -}; - -struct NonMaxSuppressionV5Options FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef NonMaxSuppressionV5OptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - NonMaxSuppressionV5OptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(NonMaxSuppressionV5OptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const NonMaxSuppressionV5OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct NonMaxSuppressionV5OptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit NonMaxSuppressionV5OptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - NonMaxSuppressionV5OptionsBuilder &operator=(const NonMaxSuppressionV5OptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateNonMaxSuppressionV5Options( - flatbuffers::FlatBufferBuilder &_fbb) { - NonMaxSuppressionV5OptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateNonMaxSuppressionV5Options(flatbuffers::FlatBufferBuilder &_fbb, const NonMaxSuppressionV5OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ScatterNdOptionsT : public flatbuffers::NativeTable { - typedef ScatterNdOptions TableType; - ScatterNdOptionsT() { - } -}; - -struct ScatterNdOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ScatterNdOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - ScatterNdOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ScatterNdOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ScatterNdOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ScatterNdOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit ScatterNdOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ScatterNdOptionsBuilder &operator=(const ScatterNdOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateScatterNdOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - ScatterNdOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateScatterNdOptions(flatbuffers::FlatBufferBuilder &_fbb, const ScatterNdOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SelectV2OptionsT : public flatbuffers::NativeTable { - typedef SelectV2Options TableType; - SelectV2OptionsT() { - } -}; - -struct SelectV2Options FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SelectV2OptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - SelectV2OptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SelectV2OptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SelectV2OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SelectV2OptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit SelectV2OptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SelectV2OptionsBuilder &operator=(const SelectV2OptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSelectV2Options( - flatbuffers::FlatBufferBuilder &_fbb) { - SelectV2OptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSelectV2Options(flatbuffers::FlatBufferBuilder &_fbb, const SelectV2OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct DensifyOptionsT : public flatbuffers::NativeTable { - typedef DensifyOptions TableType; - DensifyOptionsT() { - } -}; - -struct DensifyOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef DensifyOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - DensifyOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(DensifyOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const DensifyOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct DensifyOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit DensifyOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - DensifyOptionsBuilder &operator=(const DensifyOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateDensifyOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - DensifyOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateDensifyOptions(flatbuffers::FlatBufferBuilder &_fbb, const DensifyOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SegmentSumOptionsT : public flatbuffers::NativeTable { - typedef SegmentSumOptions TableType; - SegmentSumOptionsT() { - } -}; - -struct SegmentSumOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SegmentSumOptionsT NativeTableType; - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - verifier.EndTable(); - } - SegmentSumOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SegmentSumOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SegmentSumOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SegmentSumOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - explicit SegmentSumOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SegmentSumOptionsBuilder &operator=(const SegmentSumOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSegmentSumOptions( - flatbuffers::FlatBufferBuilder &_fbb) { - SegmentSumOptionsBuilder builder_(_fbb); - return builder_.Finish(); -} - -flatbuffers::Offset CreateSegmentSumOptions(flatbuffers::FlatBufferBuilder &_fbb, const SegmentSumOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct BatchMatMulOptionsT : public flatbuffers::NativeTable { - typedef BatchMatMulOptions TableType; - bool adj_x; - bool adj_y; - BatchMatMulOptionsT() - : adj_x(false), - adj_y(false) { - } -}; - -struct BatchMatMulOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef BatchMatMulOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_ADJ_X = 4, - VT_ADJ_Y = 6 - }; - bool adj_x() const { - return GetField(VT_ADJ_X, 0) != 0; - } - bool adj_y() const { - return GetField(VT_ADJ_Y, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_ADJ_X) && - VerifyField(verifier, VT_ADJ_Y) && - verifier.EndTable(); - } - BatchMatMulOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(BatchMatMulOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const BatchMatMulOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct BatchMatMulOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_adj_x(bool adj_x) { - fbb_.AddElement(BatchMatMulOptions::VT_ADJ_X, static_cast(adj_x), 0); - } - void add_adj_y(bool adj_y) { - fbb_.AddElement(BatchMatMulOptions::VT_ADJ_Y, static_cast(adj_y), 0); - } - explicit BatchMatMulOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - BatchMatMulOptionsBuilder &operator=(const BatchMatMulOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateBatchMatMulOptions( - flatbuffers::FlatBufferBuilder &_fbb, - bool adj_x = false, - bool adj_y = false) { - BatchMatMulOptionsBuilder builder_(_fbb); - builder_.add_adj_y(adj_y); - builder_.add_adj_x(adj_x); - return builder_.Finish(); -} - -flatbuffers::Offset CreateBatchMatMulOptions(flatbuffers::FlatBufferBuilder &_fbb, const BatchMatMulOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct CumsumOptionsT : public flatbuffers::NativeTable { - typedef CumsumOptions TableType; - bool exclusive; - bool reverse; - CumsumOptionsT() - : exclusive(false), - reverse(false) { - } -}; - -struct CumsumOptions FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef CumsumOptionsT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_EXCLUSIVE = 4, - VT_REVERSE = 6 - }; - bool exclusive() const { - return GetField(VT_EXCLUSIVE, 0) != 0; - } - bool reverse() const { - return GetField(VT_REVERSE, 0) != 0; - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_EXCLUSIVE) && - VerifyField(verifier, VT_REVERSE) && - verifier.EndTable(); - } - CumsumOptionsT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(CumsumOptionsT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const CumsumOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct CumsumOptionsBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_exclusive(bool exclusive) { - fbb_.AddElement(CumsumOptions::VT_EXCLUSIVE, static_cast(exclusive), 0); - } - void add_reverse(bool reverse) { - fbb_.AddElement(CumsumOptions::VT_REVERSE, static_cast(reverse), 0); - } - explicit CumsumOptionsBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - CumsumOptionsBuilder &operator=(const CumsumOptionsBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateCumsumOptions( - flatbuffers::FlatBufferBuilder &_fbb, - bool exclusive = false, - bool reverse = false) { - CumsumOptionsBuilder builder_(_fbb); - builder_.add_reverse(reverse); - builder_.add_exclusive(exclusive); - return builder_.Finish(); -} - -flatbuffers::Offset CreateCumsumOptions(flatbuffers::FlatBufferBuilder &_fbb, const CumsumOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct OperatorCodeT : public flatbuffers::NativeTable { - typedef OperatorCode TableType; - int8_t deprecated_builtin_code; - std::string custom_code; - int32_t version; - tflite::BuiltinOperator builtin_code; - OperatorCodeT() - : deprecated_builtin_code(0), - version(1), - builtin_code(tflite::BuiltinOperator_ADD) { - } -}; - -struct OperatorCode FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef OperatorCodeT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_DEPRECATED_BUILTIN_CODE = 4, - VT_CUSTOM_CODE = 6, - VT_VERSION = 8, - VT_BUILTIN_CODE = 10 - }; - int8_t deprecated_builtin_code() const { - return GetField(VT_DEPRECATED_BUILTIN_CODE, 0); - } - const flatbuffers::String *custom_code() const { - return GetPointer(VT_CUSTOM_CODE); - } - int32_t version() const { - return GetField(VT_VERSION, 1); - } - tflite::BuiltinOperator builtin_code() const { - return static_cast(GetField(VT_BUILTIN_CODE, 0)); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_DEPRECATED_BUILTIN_CODE) && - VerifyOffset(verifier, VT_CUSTOM_CODE) && - verifier.VerifyString(custom_code()) && - VerifyField(verifier, VT_VERSION) && - VerifyField(verifier, VT_BUILTIN_CODE) && - verifier.EndTable(); - } - OperatorCodeT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(OperatorCodeT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const OperatorCodeT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct OperatorCodeBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_deprecated_builtin_code(int8_t deprecated_builtin_code) { - fbb_.AddElement(OperatorCode::VT_DEPRECATED_BUILTIN_CODE, deprecated_builtin_code, 0); - } - void add_custom_code(flatbuffers::Offset custom_code) { - fbb_.AddOffset(OperatorCode::VT_CUSTOM_CODE, custom_code); - } - void add_version(int32_t version) { - fbb_.AddElement(OperatorCode::VT_VERSION, version, 1); - } - void add_builtin_code(tflite::BuiltinOperator builtin_code) { - fbb_.AddElement(OperatorCode::VT_BUILTIN_CODE, static_cast(builtin_code), 0); - } - explicit OperatorCodeBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - OperatorCodeBuilder &operator=(const OperatorCodeBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateOperatorCode( - flatbuffers::FlatBufferBuilder &_fbb, - int8_t deprecated_builtin_code = 0, - flatbuffers::Offset custom_code = 0, - int32_t version = 1, - tflite::BuiltinOperator builtin_code = tflite::BuiltinOperator_ADD) { - OperatorCodeBuilder builder_(_fbb); - builder_.add_builtin_code(builtin_code); - builder_.add_version(version); - builder_.add_custom_code(custom_code); - builder_.add_deprecated_builtin_code(deprecated_builtin_code); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateOperatorCodeDirect( - flatbuffers::FlatBufferBuilder &_fbb, - int8_t deprecated_builtin_code = 0, - const char *custom_code = nullptr, - int32_t version = 1, - tflite::BuiltinOperator builtin_code = tflite::BuiltinOperator_ADD) { - auto custom_code__ = custom_code ? _fbb.CreateString(custom_code) : 0; - return tflite::CreateOperatorCode( - _fbb, - deprecated_builtin_code, - custom_code__, - version, - builtin_code); -} - -flatbuffers::Offset CreateOperatorCode(flatbuffers::FlatBufferBuilder &_fbb, const OperatorCodeT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct OperatorT : public flatbuffers::NativeTable { - typedef Operator TableType; - uint32_t opcode_index; - std::vector inputs; - std::vector outputs; - tflite::BuiltinOptionsUnion builtin_options; - std::vector custom_options; - tflite::CustomOptionsFormat custom_options_format; - std::vector mutating_variable_inputs; - std::vector intermediates; - OperatorT() - : opcode_index(0), - custom_options_format(tflite::CustomOptionsFormat_FLEXBUFFERS) { - } -}; - -struct Operator FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef OperatorT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_OPCODE_INDEX = 4, - VT_INPUTS = 6, - VT_OUTPUTS = 8, - VT_BUILTIN_OPTIONS_TYPE = 10, - VT_BUILTIN_OPTIONS = 12, - VT_CUSTOM_OPTIONS = 14, - VT_CUSTOM_OPTIONS_FORMAT = 16, - VT_MUTATING_VARIABLE_INPUTS = 18, - VT_INTERMEDIATES = 20 - }; - uint32_t opcode_index() const { - return GetField(VT_OPCODE_INDEX, 0); - } - const flatbuffers::Vector *inputs() const { - return GetPointer *>(VT_INPUTS); - } - const flatbuffers::Vector *outputs() const { - return GetPointer *>(VT_OUTPUTS); - } - tflite::BuiltinOptions builtin_options_type() const { - return static_cast(GetField(VT_BUILTIN_OPTIONS_TYPE, 0)); - } - const void *builtin_options() const { - return GetPointer(VT_BUILTIN_OPTIONS); - } - template const T *builtin_options_as() const; - const tflite::Conv2DOptions *builtin_options_as_Conv2DOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_Conv2DOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::DepthwiseConv2DOptions *builtin_options_as_DepthwiseConv2DOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_DepthwiseConv2DOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ConcatEmbeddingsOptions *builtin_options_as_ConcatEmbeddingsOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ConcatEmbeddingsOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::LSHProjectionOptions *builtin_options_as_LSHProjectionOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_LSHProjectionOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::Pool2DOptions *builtin_options_as_Pool2DOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_Pool2DOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SVDFOptions *builtin_options_as_SVDFOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SVDFOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::RNNOptions *builtin_options_as_RNNOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_RNNOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::FullyConnectedOptions *builtin_options_as_FullyConnectedOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_FullyConnectedOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SoftmaxOptions *builtin_options_as_SoftmaxOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SoftmaxOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ConcatenationOptions *builtin_options_as_ConcatenationOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ConcatenationOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::AddOptions *builtin_options_as_AddOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_AddOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::L2NormOptions *builtin_options_as_L2NormOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_L2NormOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::LocalResponseNormalizationOptions *builtin_options_as_LocalResponseNormalizationOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_LocalResponseNormalizationOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::LSTMOptions *builtin_options_as_LSTMOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_LSTMOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ResizeBilinearOptions *builtin_options_as_ResizeBilinearOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ResizeBilinearOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::CallOptions *builtin_options_as_CallOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_CallOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ReshapeOptions *builtin_options_as_ReshapeOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ReshapeOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SkipGramOptions *builtin_options_as_SkipGramOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SkipGramOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SpaceToDepthOptions *builtin_options_as_SpaceToDepthOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SpaceToDepthOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::EmbeddingLookupSparseOptions *builtin_options_as_EmbeddingLookupSparseOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_EmbeddingLookupSparseOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::MulOptions *builtin_options_as_MulOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_MulOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::PadOptions *builtin_options_as_PadOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_PadOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::GatherOptions *builtin_options_as_GatherOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_GatherOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::BatchToSpaceNDOptions *builtin_options_as_BatchToSpaceNDOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_BatchToSpaceNDOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SpaceToBatchNDOptions *builtin_options_as_SpaceToBatchNDOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SpaceToBatchNDOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::TransposeOptions *builtin_options_as_TransposeOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_TransposeOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ReducerOptions *builtin_options_as_ReducerOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ReducerOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SubOptions *builtin_options_as_SubOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SubOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::DivOptions *builtin_options_as_DivOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_DivOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SqueezeOptions *builtin_options_as_SqueezeOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SqueezeOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SequenceRNNOptions *builtin_options_as_SequenceRNNOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SequenceRNNOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::StridedSliceOptions *builtin_options_as_StridedSliceOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_StridedSliceOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ExpOptions *builtin_options_as_ExpOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ExpOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::TopKV2Options *builtin_options_as_TopKV2Options() const { - return builtin_options_type() == tflite::BuiltinOptions_TopKV2Options ? static_cast(builtin_options()) : nullptr; - } - const tflite::SplitOptions *builtin_options_as_SplitOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SplitOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::LogSoftmaxOptions *builtin_options_as_LogSoftmaxOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_LogSoftmaxOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::CastOptions *builtin_options_as_CastOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_CastOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::DequantizeOptions *builtin_options_as_DequantizeOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_DequantizeOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::MaximumMinimumOptions *builtin_options_as_MaximumMinimumOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_MaximumMinimumOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ArgMaxOptions *builtin_options_as_ArgMaxOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ArgMaxOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::LessOptions *builtin_options_as_LessOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_LessOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::NegOptions *builtin_options_as_NegOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_NegOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::PadV2Options *builtin_options_as_PadV2Options() const { - return builtin_options_type() == tflite::BuiltinOptions_PadV2Options ? static_cast(builtin_options()) : nullptr; - } - const tflite::GreaterOptions *builtin_options_as_GreaterOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_GreaterOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::GreaterEqualOptions *builtin_options_as_GreaterEqualOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_GreaterEqualOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::LessEqualOptions *builtin_options_as_LessEqualOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_LessEqualOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SelectOptions *builtin_options_as_SelectOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SelectOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SliceOptions *builtin_options_as_SliceOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SliceOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::TransposeConvOptions *builtin_options_as_TransposeConvOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_TransposeConvOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SparseToDenseOptions *builtin_options_as_SparseToDenseOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SparseToDenseOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::TileOptions *builtin_options_as_TileOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_TileOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ExpandDimsOptions *builtin_options_as_ExpandDimsOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ExpandDimsOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::EqualOptions *builtin_options_as_EqualOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_EqualOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::NotEqualOptions *builtin_options_as_NotEqualOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_NotEqualOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ShapeOptions *builtin_options_as_ShapeOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ShapeOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::PowOptions *builtin_options_as_PowOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_PowOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ArgMinOptions *builtin_options_as_ArgMinOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ArgMinOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::FakeQuantOptions *builtin_options_as_FakeQuantOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_FakeQuantOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::PackOptions *builtin_options_as_PackOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_PackOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::LogicalOrOptions *builtin_options_as_LogicalOrOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_LogicalOrOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::OneHotOptions *builtin_options_as_OneHotOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_OneHotOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::LogicalAndOptions *builtin_options_as_LogicalAndOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_LogicalAndOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::LogicalNotOptions *builtin_options_as_LogicalNotOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_LogicalNotOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::UnpackOptions *builtin_options_as_UnpackOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_UnpackOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::FloorDivOptions *builtin_options_as_FloorDivOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_FloorDivOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SquareOptions *builtin_options_as_SquareOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SquareOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ZerosLikeOptions *builtin_options_as_ZerosLikeOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ZerosLikeOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::FillOptions *builtin_options_as_FillOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_FillOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::BidirectionalSequenceLSTMOptions *builtin_options_as_BidirectionalSequenceLSTMOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_BidirectionalSequenceLSTMOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::BidirectionalSequenceRNNOptions *builtin_options_as_BidirectionalSequenceRNNOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_BidirectionalSequenceRNNOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::UnidirectionalSequenceLSTMOptions *builtin_options_as_UnidirectionalSequenceLSTMOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_UnidirectionalSequenceLSTMOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::FloorModOptions *builtin_options_as_FloorModOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_FloorModOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::RangeOptions *builtin_options_as_RangeOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_RangeOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ResizeNearestNeighborOptions *builtin_options_as_ResizeNearestNeighborOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ResizeNearestNeighborOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::LeakyReluOptions *builtin_options_as_LeakyReluOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_LeakyReluOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SquaredDifferenceOptions *builtin_options_as_SquaredDifferenceOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SquaredDifferenceOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::MirrorPadOptions *builtin_options_as_MirrorPadOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_MirrorPadOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::AbsOptions *builtin_options_as_AbsOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_AbsOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SplitVOptions *builtin_options_as_SplitVOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SplitVOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::UniqueOptions *builtin_options_as_UniqueOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_UniqueOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ReverseV2Options *builtin_options_as_ReverseV2Options() const { - return builtin_options_type() == tflite::BuiltinOptions_ReverseV2Options ? static_cast(builtin_options()) : nullptr; - } - const tflite::AddNOptions *builtin_options_as_AddNOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_AddNOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::GatherNdOptions *builtin_options_as_GatherNdOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_GatherNdOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::CosOptions *builtin_options_as_CosOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_CosOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::WhereOptions *builtin_options_as_WhereOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_WhereOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::RankOptions *builtin_options_as_RankOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_RankOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::ReverseSequenceOptions *builtin_options_as_ReverseSequenceOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ReverseSequenceOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::MatrixDiagOptions *builtin_options_as_MatrixDiagOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_MatrixDiagOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::QuantizeOptions *builtin_options_as_QuantizeOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_QuantizeOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::MatrixSetDiagOptions *builtin_options_as_MatrixSetDiagOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_MatrixSetDiagOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::HardSwishOptions *builtin_options_as_HardSwishOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_HardSwishOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::IfOptions *builtin_options_as_IfOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_IfOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::WhileOptions *builtin_options_as_WhileOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_WhileOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::DepthToSpaceOptions *builtin_options_as_DepthToSpaceOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_DepthToSpaceOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::NonMaxSuppressionV4Options *builtin_options_as_NonMaxSuppressionV4Options() const { - return builtin_options_type() == tflite::BuiltinOptions_NonMaxSuppressionV4Options ? static_cast(builtin_options()) : nullptr; - } - const tflite::NonMaxSuppressionV5Options *builtin_options_as_NonMaxSuppressionV5Options() const { - return builtin_options_type() == tflite::BuiltinOptions_NonMaxSuppressionV5Options ? static_cast(builtin_options()) : nullptr; - } - const tflite::ScatterNdOptions *builtin_options_as_ScatterNdOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_ScatterNdOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SelectV2Options *builtin_options_as_SelectV2Options() const { - return builtin_options_type() == tflite::BuiltinOptions_SelectV2Options ? static_cast(builtin_options()) : nullptr; - } - const tflite::DensifyOptions *builtin_options_as_DensifyOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_DensifyOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::SegmentSumOptions *builtin_options_as_SegmentSumOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_SegmentSumOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::BatchMatMulOptions *builtin_options_as_BatchMatMulOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_BatchMatMulOptions ? static_cast(builtin_options()) : nullptr; - } - const tflite::CumsumOptions *builtin_options_as_CumsumOptions() const { - return builtin_options_type() == tflite::BuiltinOptions_CumsumOptions ? static_cast(builtin_options()) : nullptr; - } - const flatbuffers::Vector *custom_options() const { - return GetPointer *>(VT_CUSTOM_OPTIONS); - } - tflite::CustomOptionsFormat custom_options_format() const { - return static_cast(GetField(VT_CUSTOM_OPTIONS_FORMAT, 0)); - } - const flatbuffers::Vector *mutating_variable_inputs() const { - return GetPointer *>(VT_MUTATING_VARIABLE_INPUTS); - } - const flatbuffers::Vector *intermediates() const { - return GetPointer *>(VT_INTERMEDIATES); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_OPCODE_INDEX) && - VerifyOffset(verifier, VT_INPUTS) && - verifier.VerifyVector(inputs()) && - VerifyOffset(verifier, VT_OUTPUTS) && - verifier.VerifyVector(outputs()) && - VerifyField(verifier, VT_BUILTIN_OPTIONS_TYPE) && - VerifyOffset(verifier, VT_BUILTIN_OPTIONS) && - VerifyBuiltinOptions(verifier, builtin_options(), builtin_options_type()) && - VerifyOffset(verifier, VT_CUSTOM_OPTIONS) && - verifier.VerifyVector(custom_options()) && - VerifyField(verifier, VT_CUSTOM_OPTIONS_FORMAT) && - VerifyOffset(verifier, VT_MUTATING_VARIABLE_INPUTS) && - verifier.VerifyVector(mutating_variable_inputs()) && - VerifyOffset(verifier, VT_INTERMEDIATES) && - verifier.VerifyVector(intermediates()) && - verifier.EndTable(); - } - OperatorT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(OperatorT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const OperatorT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -template<> inline const tflite::Conv2DOptions *Operator::builtin_options_as() const { - return builtin_options_as_Conv2DOptions(); -} - -template<> inline const tflite::DepthwiseConv2DOptions *Operator::builtin_options_as() const { - return builtin_options_as_DepthwiseConv2DOptions(); -} - -template<> inline const tflite::ConcatEmbeddingsOptions *Operator::builtin_options_as() const { - return builtin_options_as_ConcatEmbeddingsOptions(); -} - -template<> inline const tflite::LSHProjectionOptions *Operator::builtin_options_as() const { - return builtin_options_as_LSHProjectionOptions(); -} - -template<> inline const tflite::Pool2DOptions *Operator::builtin_options_as() const { - return builtin_options_as_Pool2DOptions(); -} - -template<> inline const tflite::SVDFOptions *Operator::builtin_options_as() const { - return builtin_options_as_SVDFOptions(); -} - -template<> inline const tflite::RNNOptions *Operator::builtin_options_as() const { - return builtin_options_as_RNNOptions(); -} - -template<> inline const tflite::FullyConnectedOptions *Operator::builtin_options_as() const { - return builtin_options_as_FullyConnectedOptions(); -} - -template<> inline const tflite::SoftmaxOptions *Operator::builtin_options_as() const { - return builtin_options_as_SoftmaxOptions(); -} - -template<> inline const tflite::ConcatenationOptions *Operator::builtin_options_as() const { - return builtin_options_as_ConcatenationOptions(); -} - -template<> inline const tflite::AddOptions *Operator::builtin_options_as() const { - return builtin_options_as_AddOptions(); -} - -template<> inline const tflite::L2NormOptions *Operator::builtin_options_as() const { - return builtin_options_as_L2NormOptions(); -} - -template<> inline const tflite::LocalResponseNormalizationOptions *Operator::builtin_options_as() const { - return builtin_options_as_LocalResponseNormalizationOptions(); -} - -template<> inline const tflite::LSTMOptions *Operator::builtin_options_as() const { - return builtin_options_as_LSTMOptions(); -} - -template<> inline const tflite::ResizeBilinearOptions *Operator::builtin_options_as() const { - return builtin_options_as_ResizeBilinearOptions(); -} - -template<> inline const tflite::CallOptions *Operator::builtin_options_as() const { - return builtin_options_as_CallOptions(); -} - -template<> inline const tflite::ReshapeOptions *Operator::builtin_options_as() const { - return builtin_options_as_ReshapeOptions(); -} - -template<> inline const tflite::SkipGramOptions *Operator::builtin_options_as() const { - return builtin_options_as_SkipGramOptions(); -} - -template<> inline const tflite::SpaceToDepthOptions *Operator::builtin_options_as() const { - return builtin_options_as_SpaceToDepthOptions(); -} - -template<> inline const tflite::EmbeddingLookupSparseOptions *Operator::builtin_options_as() const { - return builtin_options_as_EmbeddingLookupSparseOptions(); -} - -template<> inline const tflite::MulOptions *Operator::builtin_options_as() const { - return builtin_options_as_MulOptions(); -} - -template<> inline const tflite::PadOptions *Operator::builtin_options_as() const { - return builtin_options_as_PadOptions(); -} - -template<> inline const tflite::GatherOptions *Operator::builtin_options_as() const { - return builtin_options_as_GatherOptions(); -} - -template<> inline const tflite::BatchToSpaceNDOptions *Operator::builtin_options_as() const { - return builtin_options_as_BatchToSpaceNDOptions(); -} - -template<> inline const tflite::SpaceToBatchNDOptions *Operator::builtin_options_as() const { - return builtin_options_as_SpaceToBatchNDOptions(); -} - -template<> inline const tflite::TransposeOptions *Operator::builtin_options_as() const { - return builtin_options_as_TransposeOptions(); -} - -template<> inline const tflite::ReducerOptions *Operator::builtin_options_as() const { - return builtin_options_as_ReducerOptions(); -} - -template<> inline const tflite::SubOptions *Operator::builtin_options_as() const { - return builtin_options_as_SubOptions(); -} - -template<> inline const tflite::DivOptions *Operator::builtin_options_as() const { - return builtin_options_as_DivOptions(); -} - -template<> inline const tflite::SqueezeOptions *Operator::builtin_options_as() const { - return builtin_options_as_SqueezeOptions(); -} - -template<> inline const tflite::SequenceRNNOptions *Operator::builtin_options_as() const { - return builtin_options_as_SequenceRNNOptions(); -} - -template<> inline const tflite::StridedSliceOptions *Operator::builtin_options_as() const { - return builtin_options_as_StridedSliceOptions(); -} - -template<> inline const tflite::ExpOptions *Operator::builtin_options_as() const { - return builtin_options_as_ExpOptions(); -} - -template<> inline const tflite::TopKV2Options *Operator::builtin_options_as() const { - return builtin_options_as_TopKV2Options(); -} - -template<> inline const tflite::SplitOptions *Operator::builtin_options_as() const { - return builtin_options_as_SplitOptions(); -} - -template<> inline const tflite::LogSoftmaxOptions *Operator::builtin_options_as() const { - return builtin_options_as_LogSoftmaxOptions(); -} - -template<> inline const tflite::CastOptions *Operator::builtin_options_as() const { - return builtin_options_as_CastOptions(); -} - -template<> inline const tflite::DequantizeOptions *Operator::builtin_options_as() const { - return builtin_options_as_DequantizeOptions(); -} - -template<> inline const tflite::MaximumMinimumOptions *Operator::builtin_options_as() const { - return builtin_options_as_MaximumMinimumOptions(); -} - -template<> inline const tflite::ArgMaxOptions *Operator::builtin_options_as() const { - return builtin_options_as_ArgMaxOptions(); -} - -template<> inline const tflite::LessOptions *Operator::builtin_options_as() const { - return builtin_options_as_LessOptions(); -} - -template<> inline const tflite::NegOptions *Operator::builtin_options_as() const { - return builtin_options_as_NegOptions(); -} - -template<> inline const tflite::PadV2Options *Operator::builtin_options_as() const { - return builtin_options_as_PadV2Options(); -} - -template<> inline const tflite::GreaterOptions *Operator::builtin_options_as() const { - return builtin_options_as_GreaterOptions(); -} - -template<> inline const tflite::GreaterEqualOptions *Operator::builtin_options_as() const { - return builtin_options_as_GreaterEqualOptions(); -} - -template<> inline const tflite::LessEqualOptions *Operator::builtin_options_as() const { - return builtin_options_as_LessEqualOptions(); -} - -template<> inline const tflite::SelectOptions *Operator::builtin_options_as() const { - return builtin_options_as_SelectOptions(); -} - -template<> inline const tflite::SliceOptions *Operator::builtin_options_as() const { - return builtin_options_as_SliceOptions(); -} - -template<> inline const tflite::TransposeConvOptions *Operator::builtin_options_as() const { - return builtin_options_as_TransposeConvOptions(); -} - -template<> inline const tflite::SparseToDenseOptions *Operator::builtin_options_as() const { - return builtin_options_as_SparseToDenseOptions(); -} - -template<> inline const tflite::TileOptions *Operator::builtin_options_as() const { - return builtin_options_as_TileOptions(); -} - -template<> inline const tflite::ExpandDimsOptions *Operator::builtin_options_as() const { - return builtin_options_as_ExpandDimsOptions(); -} - -template<> inline const tflite::EqualOptions *Operator::builtin_options_as() const { - return builtin_options_as_EqualOptions(); -} - -template<> inline const tflite::NotEqualOptions *Operator::builtin_options_as() const { - return builtin_options_as_NotEqualOptions(); -} - -template<> inline const tflite::ShapeOptions *Operator::builtin_options_as() const { - return builtin_options_as_ShapeOptions(); -} - -template<> inline const tflite::PowOptions *Operator::builtin_options_as() const { - return builtin_options_as_PowOptions(); -} - -template<> inline const tflite::ArgMinOptions *Operator::builtin_options_as() const { - return builtin_options_as_ArgMinOptions(); -} - -template<> inline const tflite::FakeQuantOptions *Operator::builtin_options_as() const { - return builtin_options_as_FakeQuantOptions(); -} - -template<> inline const tflite::PackOptions *Operator::builtin_options_as() const { - return builtin_options_as_PackOptions(); -} - -template<> inline const tflite::LogicalOrOptions *Operator::builtin_options_as() const { - return builtin_options_as_LogicalOrOptions(); -} - -template<> inline const tflite::OneHotOptions *Operator::builtin_options_as() const { - return builtin_options_as_OneHotOptions(); -} - -template<> inline const tflite::LogicalAndOptions *Operator::builtin_options_as() const { - return builtin_options_as_LogicalAndOptions(); -} - -template<> inline const tflite::LogicalNotOptions *Operator::builtin_options_as() const { - return builtin_options_as_LogicalNotOptions(); -} - -template<> inline const tflite::UnpackOptions *Operator::builtin_options_as() const { - return builtin_options_as_UnpackOptions(); -} - -template<> inline const tflite::FloorDivOptions *Operator::builtin_options_as() const { - return builtin_options_as_FloorDivOptions(); -} - -template<> inline const tflite::SquareOptions *Operator::builtin_options_as() const { - return builtin_options_as_SquareOptions(); -} - -template<> inline const tflite::ZerosLikeOptions *Operator::builtin_options_as() const { - return builtin_options_as_ZerosLikeOptions(); -} - -template<> inline const tflite::FillOptions *Operator::builtin_options_as() const { - return builtin_options_as_FillOptions(); -} - -template<> inline const tflite::BidirectionalSequenceLSTMOptions *Operator::builtin_options_as() const { - return builtin_options_as_BidirectionalSequenceLSTMOptions(); -} - -template<> inline const tflite::BidirectionalSequenceRNNOptions *Operator::builtin_options_as() const { - return builtin_options_as_BidirectionalSequenceRNNOptions(); -} - -template<> inline const tflite::UnidirectionalSequenceLSTMOptions *Operator::builtin_options_as() const { - return builtin_options_as_UnidirectionalSequenceLSTMOptions(); -} - -template<> inline const tflite::FloorModOptions *Operator::builtin_options_as() const { - return builtin_options_as_FloorModOptions(); -} - -template<> inline const tflite::RangeOptions *Operator::builtin_options_as() const { - return builtin_options_as_RangeOptions(); -} - -template<> inline const tflite::ResizeNearestNeighborOptions *Operator::builtin_options_as() const { - return builtin_options_as_ResizeNearestNeighborOptions(); -} - -template<> inline const tflite::LeakyReluOptions *Operator::builtin_options_as() const { - return builtin_options_as_LeakyReluOptions(); -} - -template<> inline const tflite::SquaredDifferenceOptions *Operator::builtin_options_as() const { - return builtin_options_as_SquaredDifferenceOptions(); -} - -template<> inline const tflite::MirrorPadOptions *Operator::builtin_options_as() const { - return builtin_options_as_MirrorPadOptions(); -} - -template<> inline const tflite::AbsOptions *Operator::builtin_options_as() const { - return builtin_options_as_AbsOptions(); -} - -template<> inline const tflite::SplitVOptions *Operator::builtin_options_as() const { - return builtin_options_as_SplitVOptions(); -} - -template<> inline const tflite::UniqueOptions *Operator::builtin_options_as() const { - return builtin_options_as_UniqueOptions(); -} - -template<> inline const tflite::ReverseV2Options *Operator::builtin_options_as() const { - return builtin_options_as_ReverseV2Options(); -} - -template<> inline const tflite::AddNOptions *Operator::builtin_options_as() const { - return builtin_options_as_AddNOptions(); -} - -template<> inline const tflite::GatherNdOptions *Operator::builtin_options_as() const { - return builtin_options_as_GatherNdOptions(); -} - -template<> inline const tflite::CosOptions *Operator::builtin_options_as() const { - return builtin_options_as_CosOptions(); -} - -template<> inline const tflite::WhereOptions *Operator::builtin_options_as() const { - return builtin_options_as_WhereOptions(); -} - -template<> inline const tflite::RankOptions *Operator::builtin_options_as() const { - return builtin_options_as_RankOptions(); -} - -template<> inline const tflite::ReverseSequenceOptions *Operator::builtin_options_as() const { - return builtin_options_as_ReverseSequenceOptions(); -} - -template<> inline const tflite::MatrixDiagOptions *Operator::builtin_options_as() const { - return builtin_options_as_MatrixDiagOptions(); -} - -template<> inline const tflite::QuantizeOptions *Operator::builtin_options_as() const { - return builtin_options_as_QuantizeOptions(); -} - -template<> inline const tflite::MatrixSetDiagOptions *Operator::builtin_options_as() const { - return builtin_options_as_MatrixSetDiagOptions(); -} - -template<> inline const tflite::HardSwishOptions *Operator::builtin_options_as() const { - return builtin_options_as_HardSwishOptions(); -} - -template<> inline const tflite::IfOptions *Operator::builtin_options_as() const { - return builtin_options_as_IfOptions(); -} - -template<> inline const tflite::WhileOptions *Operator::builtin_options_as() const { - return builtin_options_as_WhileOptions(); -} - -template<> inline const tflite::DepthToSpaceOptions *Operator::builtin_options_as() const { - return builtin_options_as_DepthToSpaceOptions(); -} - -template<> inline const tflite::NonMaxSuppressionV4Options *Operator::builtin_options_as() const { - return builtin_options_as_NonMaxSuppressionV4Options(); -} - -template<> inline const tflite::NonMaxSuppressionV5Options *Operator::builtin_options_as() const { - return builtin_options_as_NonMaxSuppressionV5Options(); -} - -template<> inline const tflite::ScatterNdOptions *Operator::builtin_options_as() const { - return builtin_options_as_ScatterNdOptions(); -} - -template<> inline const tflite::SelectV2Options *Operator::builtin_options_as() const { - return builtin_options_as_SelectV2Options(); -} - -template<> inline const tflite::DensifyOptions *Operator::builtin_options_as() const { - return builtin_options_as_DensifyOptions(); -} - -template<> inline const tflite::SegmentSumOptions *Operator::builtin_options_as() const { - return builtin_options_as_SegmentSumOptions(); -} - -template<> inline const tflite::BatchMatMulOptions *Operator::builtin_options_as() const { - return builtin_options_as_BatchMatMulOptions(); -} - -template<> inline const tflite::CumsumOptions *Operator::builtin_options_as() const { - return builtin_options_as_CumsumOptions(); -} - -struct OperatorBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_opcode_index(uint32_t opcode_index) { - fbb_.AddElement(Operator::VT_OPCODE_INDEX, opcode_index, 0); - } - void add_inputs(flatbuffers::Offset> inputs) { - fbb_.AddOffset(Operator::VT_INPUTS, inputs); - } - void add_outputs(flatbuffers::Offset> outputs) { - fbb_.AddOffset(Operator::VT_OUTPUTS, outputs); - } - void add_builtin_options_type(tflite::BuiltinOptions builtin_options_type) { - fbb_.AddElement(Operator::VT_BUILTIN_OPTIONS_TYPE, static_cast(builtin_options_type), 0); - } - void add_builtin_options(flatbuffers::Offset builtin_options) { - fbb_.AddOffset(Operator::VT_BUILTIN_OPTIONS, builtin_options); - } - void add_custom_options(flatbuffers::Offset> custom_options) { - fbb_.AddOffset(Operator::VT_CUSTOM_OPTIONS, custom_options); - } - void add_custom_options_format(tflite::CustomOptionsFormat custom_options_format) { - fbb_.AddElement(Operator::VT_CUSTOM_OPTIONS_FORMAT, static_cast(custom_options_format), 0); - } - void add_mutating_variable_inputs(flatbuffers::Offset> mutating_variable_inputs) { - fbb_.AddOffset(Operator::VT_MUTATING_VARIABLE_INPUTS, mutating_variable_inputs); - } - void add_intermediates(flatbuffers::Offset> intermediates) { - fbb_.AddOffset(Operator::VT_INTERMEDIATES, intermediates); - } - explicit OperatorBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - OperatorBuilder &operator=(const OperatorBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateOperator( - flatbuffers::FlatBufferBuilder &_fbb, - uint32_t opcode_index = 0, - flatbuffers::Offset> inputs = 0, - flatbuffers::Offset> outputs = 0, - tflite::BuiltinOptions builtin_options_type = tflite::BuiltinOptions_NONE, - flatbuffers::Offset builtin_options = 0, - flatbuffers::Offset> custom_options = 0, - tflite::CustomOptionsFormat custom_options_format = tflite::CustomOptionsFormat_FLEXBUFFERS, - flatbuffers::Offset> mutating_variable_inputs = 0, - flatbuffers::Offset> intermediates = 0) { - OperatorBuilder builder_(_fbb); - builder_.add_intermediates(intermediates); - builder_.add_mutating_variable_inputs(mutating_variable_inputs); - builder_.add_custom_options(custom_options); - builder_.add_builtin_options(builtin_options); - builder_.add_outputs(outputs); - builder_.add_inputs(inputs); - builder_.add_opcode_index(opcode_index); - builder_.add_custom_options_format(custom_options_format); - builder_.add_builtin_options_type(builtin_options_type); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateOperatorDirect( - flatbuffers::FlatBufferBuilder &_fbb, - uint32_t opcode_index = 0, - const std::vector *inputs = nullptr, - const std::vector *outputs = nullptr, - tflite::BuiltinOptions builtin_options_type = tflite::BuiltinOptions_NONE, - flatbuffers::Offset builtin_options = 0, - const std::vector *custom_options = nullptr, - tflite::CustomOptionsFormat custom_options_format = tflite::CustomOptionsFormat_FLEXBUFFERS, - const std::vector *mutating_variable_inputs = nullptr, - const std::vector *intermediates = nullptr) { - auto inputs__ = inputs ? _fbb.CreateVector(*inputs) : 0; - auto outputs__ = outputs ? _fbb.CreateVector(*outputs) : 0; - auto custom_options__ = custom_options ? _fbb.CreateVector(*custom_options) : 0; - auto mutating_variable_inputs__ = mutating_variable_inputs ? _fbb.CreateVector(*mutating_variable_inputs) : 0; - auto intermediates__ = intermediates ? _fbb.CreateVector(*intermediates) : 0; - return tflite::CreateOperator( - _fbb, - opcode_index, - inputs__, - outputs__, - builtin_options_type, - builtin_options, - custom_options__, - custom_options_format, - mutating_variable_inputs__, - intermediates__); -} - -flatbuffers::Offset CreateOperator(flatbuffers::FlatBufferBuilder &_fbb, const OperatorT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SubGraphT : public flatbuffers::NativeTable { - typedef SubGraph TableType; - std::vector> tensors; - std::vector inputs; - std::vector outputs; - std::vector> operators; - std::string name; - SubGraphT() { - } -}; - -struct SubGraph FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SubGraphT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_TENSORS = 4, - VT_INPUTS = 6, - VT_OUTPUTS = 8, - VT_OPERATORS = 10, - VT_NAME = 12 - }; - const flatbuffers::Vector> *tensors() const { - return GetPointer> *>(VT_TENSORS); - } - const flatbuffers::Vector *inputs() const { - return GetPointer *>(VT_INPUTS); - } - const flatbuffers::Vector *outputs() const { - return GetPointer *>(VT_OUTPUTS); - } - const flatbuffers::Vector> *operators() const { - return GetPointer> *>(VT_OPERATORS); - } - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_TENSORS) && - verifier.VerifyVector(tensors()) && - verifier.VerifyVectorOfTables(tensors()) && - VerifyOffset(verifier, VT_INPUTS) && - verifier.VerifyVector(inputs()) && - VerifyOffset(verifier, VT_OUTPUTS) && - verifier.VerifyVector(outputs()) && - VerifyOffset(verifier, VT_OPERATORS) && - verifier.VerifyVector(operators()) && - verifier.VerifyVectorOfTables(operators()) && - VerifyOffset(verifier, VT_NAME) && - verifier.VerifyString(name()) && - verifier.EndTable(); - } - SubGraphT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SubGraphT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SubGraphT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SubGraphBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_tensors(flatbuffers::Offset>> tensors) { - fbb_.AddOffset(SubGraph::VT_TENSORS, tensors); - } - void add_inputs(flatbuffers::Offset> inputs) { - fbb_.AddOffset(SubGraph::VT_INPUTS, inputs); - } - void add_outputs(flatbuffers::Offset> outputs) { - fbb_.AddOffset(SubGraph::VT_OUTPUTS, outputs); - } - void add_operators(flatbuffers::Offset>> operators) { - fbb_.AddOffset(SubGraph::VT_OPERATORS, operators); - } - void add_name(flatbuffers::Offset name) { - fbb_.AddOffset(SubGraph::VT_NAME, name); - } - explicit SubGraphBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SubGraphBuilder &operator=(const SubGraphBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSubGraph( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset>> tensors = 0, - flatbuffers::Offset> inputs = 0, - flatbuffers::Offset> outputs = 0, - flatbuffers::Offset>> operators = 0, - flatbuffers::Offset name = 0) { - SubGraphBuilder builder_(_fbb); - builder_.add_name(name); - builder_.add_operators(operators); - builder_.add_outputs(outputs); - builder_.add_inputs(inputs); - builder_.add_tensors(tensors); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateSubGraphDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector> *tensors = nullptr, - const std::vector *inputs = nullptr, - const std::vector *outputs = nullptr, - const std::vector> *operators = nullptr, - const char *name = nullptr) { - auto tensors__ = tensors ? _fbb.CreateVector>(*tensors) : 0; - auto inputs__ = inputs ? _fbb.CreateVector(*inputs) : 0; - auto outputs__ = outputs ? _fbb.CreateVector(*outputs) : 0; - auto operators__ = operators ? _fbb.CreateVector>(*operators) : 0; - auto name__ = name ? _fbb.CreateString(name) : 0; - return tflite::CreateSubGraph( - _fbb, - tensors__, - inputs__, - outputs__, - operators__, - name__); -} - -flatbuffers::Offset CreateSubGraph(flatbuffers::FlatBufferBuilder &_fbb, const SubGraphT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct BufferT : public flatbuffers::NativeTable { - typedef Buffer TableType; - std::vector data; - BufferT() { - } -}; - -struct Buffer FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef BufferT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_DATA = 4 - }; - const flatbuffers::Vector *data() const { - return GetPointer *>(VT_DATA); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_DATA) && - verifier.VerifyVector(data()) && - verifier.EndTable(); - } - BufferT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(BufferT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const BufferT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct BufferBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_data(flatbuffers::Offset> data) { - fbb_.AddOffset(Buffer::VT_DATA, data); - } - explicit BufferBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - BufferBuilder &operator=(const BufferBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateBuffer( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset> data = 0) { - BufferBuilder builder_(_fbb); - builder_.add_data(data); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateBufferDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector *data = nullptr) { - if (data) { _fbb.ForceVectorAlignment(data->size(), sizeof(uint8_t), 16); } - auto data__ = data ? _fbb.CreateVector(*data) : 0; - return tflite::CreateBuffer( - _fbb, - data__); -} - -flatbuffers::Offset CreateBuffer(flatbuffers::FlatBufferBuilder &_fbb, const BufferT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct MetadataT : public flatbuffers::NativeTable { - typedef Metadata TableType; - std::string name; - uint32_t buffer; - MetadataT() - : buffer(0) { - } -}; - -struct Metadata FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef MetadataT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NAME = 4, - VT_BUFFER = 6 - }; - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); - } - uint32_t buffer() const { - return GetField(VT_BUFFER, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_NAME) && - verifier.VerifyString(name()) && - VerifyField(verifier, VT_BUFFER) && - verifier.EndTable(); - } - MetadataT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(MetadataT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const MetadataT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct MetadataBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_name(flatbuffers::Offset name) { - fbb_.AddOffset(Metadata::VT_NAME, name); - } - void add_buffer(uint32_t buffer) { - fbb_.AddElement(Metadata::VT_BUFFER, buffer, 0); - } - explicit MetadataBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - MetadataBuilder &operator=(const MetadataBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateMetadata( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset name = 0, - uint32_t buffer = 0) { - MetadataBuilder builder_(_fbb); - builder_.add_buffer(buffer); - builder_.add_name(name); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateMetadataDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *name = nullptr, - uint32_t buffer = 0) { - auto name__ = name ? _fbb.CreateString(name) : 0; - return tflite::CreateMetadata( - _fbb, - name__, - buffer); -} - -flatbuffers::Offset CreateMetadata(flatbuffers::FlatBufferBuilder &_fbb, const MetadataT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct TensorMapT : public flatbuffers::NativeTable { - typedef TensorMap TableType; - std::string name; - uint32_t tensor_index; - TensorMapT() - : tensor_index(0) { - } -}; - -struct TensorMap FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef TensorMapT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_NAME = 4, - VT_TENSOR_INDEX = 6 - }; - const flatbuffers::String *name() const { - return GetPointer(VT_NAME); - } - uint32_t tensor_index() const { - return GetField(VT_TENSOR_INDEX, 0); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_NAME) && - verifier.VerifyString(name()) && - VerifyField(verifier, VT_TENSOR_INDEX) && - verifier.EndTable(); - } - TensorMapT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(TensorMapT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const TensorMapT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct TensorMapBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_name(flatbuffers::Offset name) { - fbb_.AddOffset(TensorMap::VT_NAME, name); - } - void add_tensor_index(uint32_t tensor_index) { - fbb_.AddElement(TensorMap::VT_TENSOR_INDEX, tensor_index, 0); - } - explicit TensorMapBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - TensorMapBuilder &operator=(const TensorMapBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateTensorMap( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset name = 0, - uint32_t tensor_index = 0) { - TensorMapBuilder builder_(_fbb); - builder_.add_tensor_index(tensor_index); - builder_.add_name(name); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateTensorMapDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const char *name = nullptr, - uint32_t tensor_index = 0) { - auto name__ = name ? _fbb.CreateString(name) : 0; - return tflite::CreateTensorMap( - _fbb, - name__, - tensor_index); -} - -flatbuffers::Offset CreateTensorMap(flatbuffers::FlatBufferBuilder &_fbb, const TensorMapT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct SignatureDefT : public flatbuffers::NativeTable { - typedef SignatureDef TableType; - std::vector> inputs; - std::vector> outputs; - std::string method_name; - std::string key; - SignatureDefT() { - } -}; - -struct SignatureDef FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef SignatureDefT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_INPUTS = 4, - VT_OUTPUTS = 6, - VT_METHOD_NAME = 8, - VT_KEY = 10 - }; - const flatbuffers::Vector> *inputs() const { - return GetPointer> *>(VT_INPUTS); - } - const flatbuffers::Vector> *outputs() const { - return GetPointer> *>(VT_OUTPUTS); - } - const flatbuffers::String *method_name() const { - return GetPointer(VT_METHOD_NAME); - } - const flatbuffers::String *key() const { - return GetPointer(VT_KEY); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyOffset(verifier, VT_INPUTS) && - verifier.VerifyVector(inputs()) && - verifier.VerifyVectorOfTables(inputs()) && - VerifyOffset(verifier, VT_OUTPUTS) && - verifier.VerifyVector(outputs()) && - verifier.VerifyVectorOfTables(outputs()) && - VerifyOffset(verifier, VT_METHOD_NAME) && - verifier.VerifyString(method_name()) && - VerifyOffset(verifier, VT_KEY) && - verifier.VerifyString(key()) && - verifier.EndTable(); - } - SignatureDefT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(SignatureDefT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const SignatureDefT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct SignatureDefBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_inputs(flatbuffers::Offset>> inputs) { - fbb_.AddOffset(SignatureDef::VT_INPUTS, inputs); - } - void add_outputs(flatbuffers::Offset>> outputs) { - fbb_.AddOffset(SignatureDef::VT_OUTPUTS, outputs); - } - void add_method_name(flatbuffers::Offset method_name) { - fbb_.AddOffset(SignatureDef::VT_METHOD_NAME, method_name); - } - void add_key(flatbuffers::Offset key) { - fbb_.AddOffset(SignatureDef::VT_KEY, key); - } - explicit SignatureDefBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - SignatureDefBuilder &operator=(const SignatureDefBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateSignatureDef( - flatbuffers::FlatBufferBuilder &_fbb, - flatbuffers::Offset>> inputs = 0, - flatbuffers::Offset>> outputs = 0, - flatbuffers::Offset method_name = 0, - flatbuffers::Offset key = 0) { - SignatureDefBuilder builder_(_fbb); - builder_.add_key(key); - builder_.add_method_name(method_name); - builder_.add_outputs(outputs); - builder_.add_inputs(inputs); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateSignatureDefDirect( - flatbuffers::FlatBufferBuilder &_fbb, - const std::vector> *inputs = nullptr, - const std::vector> *outputs = nullptr, - const char *method_name = nullptr, - const char *key = nullptr) { - auto inputs__ = inputs ? _fbb.CreateVector>(*inputs) : 0; - auto outputs__ = outputs ? _fbb.CreateVector>(*outputs) : 0; - auto method_name__ = method_name ? _fbb.CreateString(method_name) : 0; - auto key__ = key ? _fbb.CreateString(key) : 0; - return tflite::CreateSignatureDef( - _fbb, - inputs__, - outputs__, - method_name__, - key__); -} - -flatbuffers::Offset CreateSignatureDef(flatbuffers::FlatBufferBuilder &_fbb, const SignatureDefT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -struct ModelT : public flatbuffers::NativeTable { - typedef Model TableType; - uint32_t version; - std::vector> operator_codes; - std::vector> subgraphs; - std::string description; - std::vector> buffers; - std::vector metadata_buffer; - std::vector> metadata; - std::vector> signature_defs; - ModelT() - : version(0) { - } -}; - -struct Model FLATBUFFERS_FINAL_CLASS : private flatbuffers::Table { - typedef ModelT NativeTableType; - enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE { - VT_VERSION = 4, - VT_OPERATOR_CODES = 6, - VT_SUBGRAPHS = 8, - VT_DESCRIPTION = 10, - VT_BUFFERS = 12, - VT_METADATA_BUFFER = 14, - VT_METADATA = 16, - VT_SIGNATURE_DEFS = 18 - }; - uint32_t version() const { - return GetField(VT_VERSION, 0); - } - const flatbuffers::Vector> *operator_codes() const { - return GetPointer> *>(VT_OPERATOR_CODES); - } - const flatbuffers::Vector> *subgraphs() const { - return GetPointer> *>(VT_SUBGRAPHS); - } - const flatbuffers::String *description() const { - return GetPointer(VT_DESCRIPTION); - } - const flatbuffers::Vector> *buffers() const { - return GetPointer> *>(VT_BUFFERS); - } - const flatbuffers::Vector *metadata_buffer() const { - return GetPointer *>(VT_METADATA_BUFFER); - } - const flatbuffers::Vector> *metadata() const { - return GetPointer> *>(VT_METADATA); - } - const flatbuffers::Vector> *signature_defs() const { - return GetPointer> *>(VT_SIGNATURE_DEFS); - } - bool Verify(flatbuffers::Verifier &verifier) const { - return VerifyTableStart(verifier) && - VerifyField(verifier, VT_VERSION) && - VerifyOffset(verifier, VT_OPERATOR_CODES) && - verifier.VerifyVector(operator_codes()) && - verifier.VerifyVectorOfTables(operator_codes()) && - VerifyOffset(verifier, VT_SUBGRAPHS) && - verifier.VerifyVector(subgraphs()) && - verifier.VerifyVectorOfTables(subgraphs()) && - VerifyOffset(verifier, VT_DESCRIPTION) && - verifier.VerifyString(description()) && - VerifyOffset(verifier, VT_BUFFERS) && - verifier.VerifyVector(buffers()) && - verifier.VerifyVectorOfTables(buffers()) && - VerifyOffset(verifier, VT_METADATA_BUFFER) && - verifier.VerifyVector(metadata_buffer()) && - VerifyOffset(verifier, VT_METADATA) && - verifier.VerifyVector(metadata()) && - verifier.VerifyVectorOfTables(metadata()) && - VerifyOffset(verifier, VT_SIGNATURE_DEFS) && - verifier.VerifyVector(signature_defs()) && - verifier.VerifyVectorOfTables(signature_defs()) && - verifier.EndTable(); - } - ModelT *UnPack(const flatbuffers::resolver_function_t *_resolver = nullptr) const; - void UnPackTo(ModelT *_o, const flatbuffers::resolver_function_t *_resolver = nullptr) const; - static flatbuffers::Offset Pack(flatbuffers::FlatBufferBuilder &_fbb, const ModelT* _o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); -}; - -struct ModelBuilder { - flatbuffers::FlatBufferBuilder &fbb_; - flatbuffers::uoffset_t start_; - void add_version(uint32_t version) { - fbb_.AddElement(Model::VT_VERSION, version, 0); - } - void add_operator_codes(flatbuffers::Offset>> operator_codes) { - fbb_.AddOffset(Model::VT_OPERATOR_CODES, operator_codes); - } - void add_subgraphs(flatbuffers::Offset>> subgraphs) { - fbb_.AddOffset(Model::VT_SUBGRAPHS, subgraphs); - } - void add_description(flatbuffers::Offset description) { - fbb_.AddOffset(Model::VT_DESCRIPTION, description); - } - void add_buffers(flatbuffers::Offset>> buffers) { - fbb_.AddOffset(Model::VT_BUFFERS, buffers); - } - void add_metadata_buffer(flatbuffers::Offset> metadata_buffer) { - fbb_.AddOffset(Model::VT_METADATA_BUFFER, metadata_buffer); - } - void add_metadata(flatbuffers::Offset>> metadata) { - fbb_.AddOffset(Model::VT_METADATA, metadata); - } - void add_signature_defs(flatbuffers::Offset>> signature_defs) { - fbb_.AddOffset(Model::VT_SIGNATURE_DEFS, signature_defs); - } - explicit ModelBuilder(flatbuffers::FlatBufferBuilder &_fbb) - : fbb_(_fbb) { - start_ = fbb_.StartTable(); - } - ModelBuilder &operator=(const ModelBuilder &); - flatbuffers::Offset Finish() { - const auto end = fbb_.EndTable(start_); - auto o = flatbuffers::Offset(end); - return o; - } -}; - -inline flatbuffers::Offset CreateModel( - flatbuffers::FlatBufferBuilder &_fbb, - uint32_t version = 0, - flatbuffers::Offset>> operator_codes = 0, - flatbuffers::Offset>> subgraphs = 0, - flatbuffers::Offset description = 0, - flatbuffers::Offset>> buffers = 0, - flatbuffers::Offset> metadata_buffer = 0, - flatbuffers::Offset>> metadata = 0, - flatbuffers::Offset>> signature_defs = 0) { - ModelBuilder builder_(_fbb); - builder_.add_signature_defs(signature_defs); - builder_.add_metadata(metadata); - builder_.add_metadata_buffer(metadata_buffer); - builder_.add_buffers(buffers); - builder_.add_description(description); - builder_.add_subgraphs(subgraphs); - builder_.add_operator_codes(operator_codes); - builder_.add_version(version); - return builder_.Finish(); -} - -inline flatbuffers::Offset CreateModelDirect( - flatbuffers::FlatBufferBuilder &_fbb, - uint32_t version = 0, - const std::vector> *operator_codes = nullptr, - const std::vector> *subgraphs = nullptr, - const char *description = nullptr, - const std::vector> *buffers = nullptr, - const std::vector *metadata_buffer = nullptr, - const std::vector> *metadata = nullptr, - const std::vector> *signature_defs = nullptr) { - auto operator_codes__ = operator_codes ? _fbb.CreateVector>(*operator_codes) : 0; - auto subgraphs__ = subgraphs ? _fbb.CreateVector>(*subgraphs) : 0; - auto description__ = description ? _fbb.CreateString(description) : 0; - auto buffers__ = buffers ? _fbb.CreateVector>(*buffers) : 0; - auto metadata_buffer__ = metadata_buffer ? _fbb.CreateVector(*metadata_buffer) : 0; - auto metadata__ = metadata ? _fbb.CreateVector>(*metadata) : 0; - auto signature_defs__ = signature_defs ? _fbb.CreateVector>(*signature_defs) : 0; - return tflite::CreateModel( - _fbb, - version, - operator_codes__, - subgraphs__, - description__, - buffers__, - metadata_buffer__, - metadata__, - signature_defs__); -} - -flatbuffers::Offset CreateModel(flatbuffers::FlatBufferBuilder &_fbb, const ModelT *_o, const flatbuffers::rehasher_function_t *_rehasher = nullptr); - -inline CustomQuantizationT *CustomQuantization::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new CustomQuantizationT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void CustomQuantization::UnPackTo(CustomQuantizationT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = custom(); if (_e) { _o->custom.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->custom.begin()); } } -} - -inline flatbuffers::Offset CustomQuantization::Pack(flatbuffers::FlatBufferBuilder &_fbb, const CustomQuantizationT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateCustomQuantization(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateCustomQuantization(flatbuffers::FlatBufferBuilder &_fbb, const CustomQuantizationT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const CustomQuantizationT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - _fbb.ForceVectorAlignment(_o->custom.size(), sizeof(uint8_t), 16); - auto _custom = _o->custom.size() ? _fbb.CreateVector(_o->custom) : 0; - return tflite::CreateCustomQuantization( - _fbb, - _custom); -} - -inline QuantizationParametersT *QuantizationParameters::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new QuantizationParametersT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void QuantizationParameters::UnPackTo(QuantizationParametersT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = min(); if (_e) { _o->min.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->min[_i] = _e->Get(_i); } } } - { auto _e = max(); if (_e) { _o->max.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->max[_i] = _e->Get(_i); } } } - { auto _e = scale(); if (_e) { _o->scale.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->scale[_i] = _e->Get(_i); } } } - { auto _e = zero_point(); if (_e) { _o->zero_point.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->zero_point[_i] = _e->Get(_i); } } } - { auto _e = details_type(); _o->details.type = _e; } - { auto _e = details(); if (_e) _o->details.value = tflite::QuantizationDetailsUnion::UnPack(_e, details_type(), _resolver); } - { auto _e = quantized_dimension(); _o->quantized_dimension = _e; } -} - -inline flatbuffers::Offset QuantizationParameters::Pack(flatbuffers::FlatBufferBuilder &_fbb, const QuantizationParametersT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateQuantizationParameters(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateQuantizationParameters(flatbuffers::FlatBufferBuilder &_fbb, const QuantizationParametersT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const QuantizationParametersT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _min = _o->min.size() ? _fbb.CreateVector(_o->min) : 0; - auto _max = _o->max.size() ? _fbb.CreateVector(_o->max) : 0; - auto _scale = _o->scale.size() ? _fbb.CreateVector(_o->scale) : 0; - auto _zero_point = _o->zero_point.size() ? _fbb.CreateVector(_o->zero_point) : 0; - auto _details_type = _o->details.type; - auto _details = _o->details.Pack(_fbb); - auto _quantized_dimension = _o->quantized_dimension; - return tflite::CreateQuantizationParameters( - _fbb, - _min, - _max, - _scale, - _zero_point, - _details_type, - _details, - _quantized_dimension); -} - -inline Int32VectorT *Int32Vector::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new Int32VectorT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void Int32Vector::UnPackTo(Int32VectorT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = values(); if (_e) { _o->values.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->values[_i] = _e->Get(_i); } } } -} - -inline flatbuffers::Offset Int32Vector::Pack(flatbuffers::FlatBufferBuilder &_fbb, const Int32VectorT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateInt32Vector(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateInt32Vector(flatbuffers::FlatBufferBuilder &_fbb, const Int32VectorT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const Int32VectorT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _values = _o->values.size() ? _fbb.CreateVector(_o->values) : 0; - return tflite::CreateInt32Vector( - _fbb, - _values); -} - -inline Uint16VectorT *Uint16Vector::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new Uint16VectorT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void Uint16Vector::UnPackTo(Uint16VectorT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = values(); if (_e) { _o->values.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->values[_i] = _e->Get(_i); } } } -} - -inline flatbuffers::Offset Uint16Vector::Pack(flatbuffers::FlatBufferBuilder &_fbb, const Uint16VectorT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateUint16Vector(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateUint16Vector(flatbuffers::FlatBufferBuilder &_fbb, const Uint16VectorT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const Uint16VectorT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - _fbb.ForceVectorAlignment(_o->values.size(), sizeof(uint16_t), 4); - auto _values = _o->values.size() ? _fbb.CreateVector(_o->values) : 0; - return tflite::CreateUint16Vector( - _fbb, - _values); -} - -inline Uint8VectorT *Uint8Vector::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new Uint8VectorT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void Uint8Vector::UnPackTo(Uint8VectorT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = values(); if (_e) { _o->values.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->values.begin()); } } -} - -inline flatbuffers::Offset Uint8Vector::Pack(flatbuffers::FlatBufferBuilder &_fbb, const Uint8VectorT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateUint8Vector(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateUint8Vector(flatbuffers::FlatBufferBuilder &_fbb, const Uint8VectorT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const Uint8VectorT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - _fbb.ForceVectorAlignment(_o->values.size(), sizeof(uint8_t), 4); - auto _values = _o->values.size() ? _fbb.CreateVector(_o->values) : 0; - return tflite::CreateUint8Vector( - _fbb, - _values); -} - -inline DimensionMetadataT *DimensionMetadata::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new DimensionMetadataT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void DimensionMetadata::UnPackTo(DimensionMetadataT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = format(); _o->format = _e; } - { auto _e = dense_size(); _o->dense_size = _e; } - { auto _e = array_segments_type(); _o->array_segments.type = _e; } - { auto _e = array_segments(); if (_e) _o->array_segments.value = tflite::SparseIndexVectorUnion::UnPack(_e, array_segments_type(), _resolver); } - { auto _e = array_indices_type(); _o->array_indices.type = _e; } - { auto _e = array_indices(); if (_e) _o->array_indices.value = tflite::SparseIndexVectorUnion::UnPack(_e, array_indices_type(), _resolver); } -} - -inline flatbuffers::Offset DimensionMetadata::Pack(flatbuffers::FlatBufferBuilder &_fbb, const DimensionMetadataT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateDimensionMetadata(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateDimensionMetadata(flatbuffers::FlatBufferBuilder &_fbb, const DimensionMetadataT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const DimensionMetadataT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _format = _o->format; - auto _dense_size = _o->dense_size; - auto _array_segments_type = _o->array_segments.type; - auto _array_segments = _o->array_segments.Pack(_fbb); - auto _array_indices_type = _o->array_indices.type; - auto _array_indices = _o->array_indices.Pack(_fbb); - return tflite::CreateDimensionMetadata( - _fbb, - _format, - _dense_size, - _array_segments_type, - _array_segments, - _array_indices_type, - _array_indices); -} - -inline SparsityParametersT *SparsityParameters::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SparsityParametersT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SparsityParameters::UnPackTo(SparsityParametersT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = traversal_order(); if (_e) { _o->traversal_order.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->traversal_order[_i] = _e->Get(_i); } } } - { auto _e = block_map(); if (_e) { _o->block_map.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->block_map[_i] = _e->Get(_i); } } } - { auto _e = dim_metadata(); if (_e) { _o->dim_metadata.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->dim_metadata[_i] = std::unique_ptr(_e->Get(_i)->UnPack(_resolver)); } } } -} - -inline flatbuffers::Offset SparsityParameters::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SparsityParametersT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSparsityParameters(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSparsityParameters(flatbuffers::FlatBufferBuilder &_fbb, const SparsityParametersT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SparsityParametersT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _traversal_order = _o->traversal_order.size() ? _fbb.CreateVector(_o->traversal_order) : 0; - auto _block_map = _o->block_map.size() ? _fbb.CreateVector(_o->block_map) : 0; - auto _dim_metadata = _o->dim_metadata.size() ? _fbb.CreateVector> (_o->dim_metadata.size(), [](size_t i, _VectorArgs *__va) { return CreateDimensionMetadata(*__va->__fbb, __va->__o->dim_metadata[i].get(), __va->__rehasher); }, &_va ) : 0; - return tflite::CreateSparsityParameters( - _fbb, - _traversal_order, - _block_map, - _dim_metadata); -} - -inline TensorT *Tensor::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new TensorT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void Tensor::UnPackTo(TensorT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = shape(); if (_e) { _o->shape.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->shape[_i] = _e->Get(_i); } } } - { auto _e = type(); _o->type = _e; } - { auto _e = buffer(); _o->buffer = _e; } - { auto _e = name(); if (_e) _o->name = _e->str(); } - { auto _e = quantization(); if (_e) _o->quantization = std::unique_ptr(_e->UnPack(_resolver)); } - { auto _e = is_variable(); _o->is_variable = _e; } - { auto _e = sparsity(); if (_e) _o->sparsity = std::unique_ptr(_e->UnPack(_resolver)); } - { auto _e = shape_signature(); if (_e) { _o->shape_signature.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->shape_signature[_i] = _e->Get(_i); } } } -} - -inline flatbuffers::Offset Tensor::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TensorT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateTensor(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateTensor(flatbuffers::FlatBufferBuilder &_fbb, const TensorT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TensorT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _shape = _o->shape.size() ? _fbb.CreateVector(_o->shape) : 0; - auto _type = _o->type; - auto _buffer = _o->buffer; - auto _name = _o->name.empty() ? 0 : _fbb.CreateString(_o->name); - auto _quantization = _o->quantization ? CreateQuantizationParameters(_fbb, _o->quantization.get(), _rehasher) : 0; - auto _is_variable = _o->is_variable; - auto _sparsity = _o->sparsity ? CreateSparsityParameters(_fbb, _o->sparsity.get(), _rehasher) : 0; - auto _shape_signature = _o->shape_signature.size() ? _fbb.CreateVector(_o->shape_signature) : 0; - return tflite::CreateTensor( - _fbb, - _shape, - _type, - _buffer, - _name, - _quantization, - _is_variable, - _sparsity, - _shape_signature); -} - -inline Conv2DOptionsT *Conv2DOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new Conv2DOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void Conv2DOptions::UnPackTo(Conv2DOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = padding(); _o->padding = _e; } - { auto _e = stride_w(); _o->stride_w = _e; } - { auto _e = stride_h(); _o->stride_h = _e; } - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = dilation_w_factor(); _o->dilation_w_factor = _e; } - { auto _e = dilation_h_factor(); _o->dilation_h_factor = _e; } -} - -inline flatbuffers::Offset Conv2DOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const Conv2DOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateConv2DOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateConv2DOptions(flatbuffers::FlatBufferBuilder &_fbb, const Conv2DOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const Conv2DOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _padding = _o->padding; - auto _stride_w = _o->stride_w; - auto _stride_h = _o->stride_h; - auto _fused_activation_function = _o->fused_activation_function; - auto _dilation_w_factor = _o->dilation_w_factor; - auto _dilation_h_factor = _o->dilation_h_factor; - return tflite::CreateConv2DOptions( - _fbb, - _padding, - _stride_w, - _stride_h, - _fused_activation_function, - _dilation_w_factor, - _dilation_h_factor); -} - -inline Pool2DOptionsT *Pool2DOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new Pool2DOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void Pool2DOptions::UnPackTo(Pool2DOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = padding(); _o->padding = _e; } - { auto _e = stride_w(); _o->stride_w = _e; } - { auto _e = stride_h(); _o->stride_h = _e; } - { auto _e = filter_width(); _o->filter_width = _e; } - { auto _e = filter_height(); _o->filter_height = _e; } - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } -} - -inline flatbuffers::Offset Pool2DOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const Pool2DOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreatePool2DOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreatePool2DOptions(flatbuffers::FlatBufferBuilder &_fbb, const Pool2DOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const Pool2DOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _padding = _o->padding; - auto _stride_w = _o->stride_w; - auto _stride_h = _o->stride_h; - auto _filter_width = _o->filter_width; - auto _filter_height = _o->filter_height; - auto _fused_activation_function = _o->fused_activation_function; - return tflite::CreatePool2DOptions( - _fbb, - _padding, - _stride_w, - _stride_h, - _filter_width, - _filter_height, - _fused_activation_function); -} - -inline DepthwiseConv2DOptionsT *DepthwiseConv2DOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new DepthwiseConv2DOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void DepthwiseConv2DOptions::UnPackTo(DepthwiseConv2DOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = padding(); _o->padding = _e; } - { auto _e = stride_w(); _o->stride_w = _e; } - { auto _e = stride_h(); _o->stride_h = _e; } - { auto _e = depth_multiplier(); _o->depth_multiplier = _e; } - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = dilation_w_factor(); _o->dilation_w_factor = _e; } - { auto _e = dilation_h_factor(); _o->dilation_h_factor = _e; } -} - -inline flatbuffers::Offset DepthwiseConv2DOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const DepthwiseConv2DOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateDepthwiseConv2DOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateDepthwiseConv2DOptions(flatbuffers::FlatBufferBuilder &_fbb, const DepthwiseConv2DOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const DepthwiseConv2DOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _padding = _o->padding; - auto _stride_w = _o->stride_w; - auto _stride_h = _o->stride_h; - auto _depth_multiplier = _o->depth_multiplier; - auto _fused_activation_function = _o->fused_activation_function; - auto _dilation_w_factor = _o->dilation_w_factor; - auto _dilation_h_factor = _o->dilation_h_factor; - return tflite::CreateDepthwiseConv2DOptions( - _fbb, - _padding, - _stride_w, - _stride_h, - _depth_multiplier, - _fused_activation_function, - _dilation_w_factor, - _dilation_h_factor); -} - -inline ConcatEmbeddingsOptionsT *ConcatEmbeddingsOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ConcatEmbeddingsOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ConcatEmbeddingsOptions::UnPackTo(ConcatEmbeddingsOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = num_channels(); _o->num_channels = _e; } - { auto _e = num_columns_per_channel(); if (_e) { _o->num_columns_per_channel.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->num_columns_per_channel[_i] = _e->Get(_i); } } } - { auto _e = embedding_dim_per_channel(); if (_e) { _o->embedding_dim_per_channel.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->embedding_dim_per_channel[_i] = _e->Get(_i); } } } -} - -inline flatbuffers::Offset ConcatEmbeddingsOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ConcatEmbeddingsOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateConcatEmbeddingsOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateConcatEmbeddingsOptions(flatbuffers::FlatBufferBuilder &_fbb, const ConcatEmbeddingsOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ConcatEmbeddingsOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _num_channels = _o->num_channels; - auto _num_columns_per_channel = _o->num_columns_per_channel.size() ? _fbb.CreateVector(_o->num_columns_per_channel) : 0; - auto _embedding_dim_per_channel = _o->embedding_dim_per_channel.size() ? _fbb.CreateVector(_o->embedding_dim_per_channel) : 0; - return tflite::CreateConcatEmbeddingsOptions( - _fbb, - _num_channels, - _num_columns_per_channel, - _embedding_dim_per_channel); -} - -inline LSHProjectionOptionsT *LSHProjectionOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new LSHProjectionOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void LSHProjectionOptions::UnPackTo(LSHProjectionOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = type(); _o->type = _e; } -} - -inline flatbuffers::Offset LSHProjectionOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LSHProjectionOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateLSHProjectionOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateLSHProjectionOptions(flatbuffers::FlatBufferBuilder &_fbb, const LSHProjectionOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const LSHProjectionOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _type = _o->type; - return tflite::CreateLSHProjectionOptions( - _fbb, - _type); -} - -inline SVDFOptionsT *SVDFOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SVDFOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SVDFOptions::UnPackTo(SVDFOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = rank(); _o->rank = _e; } - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = asymmetric_quantize_inputs(); _o->asymmetric_quantize_inputs = _e; } -} - -inline flatbuffers::Offset SVDFOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SVDFOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSVDFOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSVDFOptions(flatbuffers::FlatBufferBuilder &_fbb, const SVDFOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SVDFOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _rank = _o->rank; - auto _fused_activation_function = _o->fused_activation_function; - auto _asymmetric_quantize_inputs = _o->asymmetric_quantize_inputs; - return tflite::CreateSVDFOptions( - _fbb, - _rank, - _fused_activation_function, - _asymmetric_quantize_inputs); -} - -inline RNNOptionsT *RNNOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new RNNOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void RNNOptions::UnPackTo(RNNOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = asymmetric_quantize_inputs(); _o->asymmetric_quantize_inputs = _e; } -} - -inline flatbuffers::Offset RNNOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const RNNOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateRNNOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateRNNOptions(flatbuffers::FlatBufferBuilder &_fbb, const RNNOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const RNNOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _fused_activation_function = _o->fused_activation_function; - auto _asymmetric_quantize_inputs = _o->asymmetric_quantize_inputs; - return tflite::CreateRNNOptions( - _fbb, - _fused_activation_function, - _asymmetric_quantize_inputs); -} - -inline SequenceRNNOptionsT *SequenceRNNOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SequenceRNNOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SequenceRNNOptions::UnPackTo(SequenceRNNOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = time_major(); _o->time_major = _e; } - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = asymmetric_quantize_inputs(); _o->asymmetric_quantize_inputs = _e; } -} - -inline flatbuffers::Offset SequenceRNNOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SequenceRNNOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSequenceRNNOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSequenceRNNOptions(flatbuffers::FlatBufferBuilder &_fbb, const SequenceRNNOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SequenceRNNOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _time_major = _o->time_major; - auto _fused_activation_function = _o->fused_activation_function; - auto _asymmetric_quantize_inputs = _o->asymmetric_quantize_inputs; - return tflite::CreateSequenceRNNOptions( - _fbb, - _time_major, - _fused_activation_function, - _asymmetric_quantize_inputs); -} - -inline BidirectionalSequenceRNNOptionsT *BidirectionalSequenceRNNOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new BidirectionalSequenceRNNOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void BidirectionalSequenceRNNOptions::UnPackTo(BidirectionalSequenceRNNOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = time_major(); _o->time_major = _e; } - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = merge_outputs(); _o->merge_outputs = _e; } - { auto _e = asymmetric_quantize_inputs(); _o->asymmetric_quantize_inputs = _e; } -} - -inline flatbuffers::Offset BidirectionalSequenceRNNOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const BidirectionalSequenceRNNOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateBidirectionalSequenceRNNOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateBidirectionalSequenceRNNOptions(flatbuffers::FlatBufferBuilder &_fbb, const BidirectionalSequenceRNNOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const BidirectionalSequenceRNNOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _time_major = _o->time_major; - auto _fused_activation_function = _o->fused_activation_function; - auto _merge_outputs = _o->merge_outputs; - auto _asymmetric_quantize_inputs = _o->asymmetric_quantize_inputs; - return tflite::CreateBidirectionalSequenceRNNOptions( - _fbb, - _time_major, - _fused_activation_function, - _merge_outputs, - _asymmetric_quantize_inputs); -} - -inline FullyConnectedOptionsT *FullyConnectedOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new FullyConnectedOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void FullyConnectedOptions::UnPackTo(FullyConnectedOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = weights_format(); _o->weights_format = _e; } - { auto _e = keep_num_dims(); _o->keep_num_dims = _e; } - { auto _e = asymmetric_quantize_inputs(); _o->asymmetric_quantize_inputs = _e; } -} - -inline flatbuffers::Offset FullyConnectedOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const FullyConnectedOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateFullyConnectedOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateFullyConnectedOptions(flatbuffers::FlatBufferBuilder &_fbb, const FullyConnectedOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const FullyConnectedOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _fused_activation_function = _o->fused_activation_function; - auto _weights_format = _o->weights_format; - auto _keep_num_dims = _o->keep_num_dims; - auto _asymmetric_quantize_inputs = _o->asymmetric_quantize_inputs; - return tflite::CreateFullyConnectedOptions( - _fbb, - _fused_activation_function, - _weights_format, - _keep_num_dims, - _asymmetric_quantize_inputs); -} - -inline SoftmaxOptionsT *SoftmaxOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SoftmaxOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SoftmaxOptions::UnPackTo(SoftmaxOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = beta(); _o->beta = _e; } -} - -inline flatbuffers::Offset SoftmaxOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SoftmaxOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSoftmaxOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSoftmaxOptions(flatbuffers::FlatBufferBuilder &_fbb, const SoftmaxOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SoftmaxOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _beta = _o->beta; - return tflite::CreateSoftmaxOptions( - _fbb, - _beta); -} - -inline ConcatenationOptionsT *ConcatenationOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ConcatenationOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ConcatenationOptions::UnPackTo(ConcatenationOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = axis(); _o->axis = _e; } - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } -} - -inline flatbuffers::Offset ConcatenationOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ConcatenationOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateConcatenationOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateConcatenationOptions(flatbuffers::FlatBufferBuilder &_fbb, const ConcatenationOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ConcatenationOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _axis = _o->axis; - auto _fused_activation_function = _o->fused_activation_function; - return tflite::CreateConcatenationOptions( - _fbb, - _axis, - _fused_activation_function); -} - -inline AddOptionsT *AddOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new AddOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void AddOptions::UnPackTo(AddOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = pot_scale_int16(); _o->pot_scale_int16 = _e; } -} - -inline flatbuffers::Offset AddOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const AddOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateAddOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateAddOptions(flatbuffers::FlatBufferBuilder &_fbb, const AddOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const AddOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _fused_activation_function = _o->fused_activation_function; - auto _pot_scale_int16 = _o->pot_scale_int16; - return tflite::CreateAddOptions( - _fbb, - _fused_activation_function, - _pot_scale_int16); -} - -inline MulOptionsT *MulOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new MulOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void MulOptions::UnPackTo(MulOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } -} - -inline flatbuffers::Offset MulOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MulOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateMulOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateMulOptions(flatbuffers::FlatBufferBuilder &_fbb, const MulOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MulOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _fused_activation_function = _o->fused_activation_function; - return tflite::CreateMulOptions( - _fbb, - _fused_activation_function); -} - -inline L2NormOptionsT *L2NormOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new L2NormOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void L2NormOptions::UnPackTo(L2NormOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } -} - -inline flatbuffers::Offset L2NormOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const L2NormOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateL2NormOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateL2NormOptions(flatbuffers::FlatBufferBuilder &_fbb, const L2NormOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const L2NormOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _fused_activation_function = _o->fused_activation_function; - return tflite::CreateL2NormOptions( - _fbb, - _fused_activation_function); -} - -inline LocalResponseNormalizationOptionsT *LocalResponseNormalizationOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new LocalResponseNormalizationOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void LocalResponseNormalizationOptions::UnPackTo(LocalResponseNormalizationOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = radius(); _o->radius = _e; } - { auto _e = bias(); _o->bias = _e; } - { auto _e = alpha(); _o->alpha = _e; } - { auto _e = beta(); _o->beta = _e; } -} - -inline flatbuffers::Offset LocalResponseNormalizationOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LocalResponseNormalizationOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateLocalResponseNormalizationOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateLocalResponseNormalizationOptions(flatbuffers::FlatBufferBuilder &_fbb, const LocalResponseNormalizationOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const LocalResponseNormalizationOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _radius = _o->radius; - auto _bias = _o->bias; - auto _alpha = _o->alpha; - auto _beta = _o->beta; - return tflite::CreateLocalResponseNormalizationOptions( - _fbb, - _radius, - _bias, - _alpha, - _beta); -} - -inline LSTMOptionsT *LSTMOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new LSTMOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void LSTMOptions::UnPackTo(LSTMOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = cell_clip(); _o->cell_clip = _e; } - { auto _e = proj_clip(); _o->proj_clip = _e; } - { auto _e = kernel_type(); _o->kernel_type = _e; } - { auto _e = asymmetric_quantize_inputs(); _o->asymmetric_quantize_inputs = _e; } -} - -inline flatbuffers::Offset LSTMOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LSTMOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateLSTMOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateLSTMOptions(flatbuffers::FlatBufferBuilder &_fbb, const LSTMOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const LSTMOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _fused_activation_function = _o->fused_activation_function; - auto _cell_clip = _o->cell_clip; - auto _proj_clip = _o->proj_clip; - auto _kernel_type = _o->kernel_type; - auto _asymmetric_quantize_inputs = _o->asymmetric_quantize_inputs; - return tflite::CreateLSTMOptions( - _fbb, - _fused_activation_function, - _cell_clip, - _proj_clip, - _kernel_type, - _asymmetric_quantize_inputs); -} - -inline UnidirectionalSequenceLSTMOptionsT *UnidirectionalSequenceLSTMOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new UnidirectionalSequenceLSTMOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void UnidirectionalSequenceLSTMOptions::UnPackTo(UnidirectionalSequenceLSTMOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = cell_clip(); _o->cell_clip = _e; } - { auto _e = proj_clip(); _o->proj_clip = _e; } - { auto _e = time_major(); _o->time_major = _e; } - { auto _e = asymmetric_quantize_inputs(); _o->asymmetric_quantize_inputs = _e; } -} - -inline flatbuffers::Offset UnidirectionalSequenceLSTMOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const UnidirectionalSequenceLSTMOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateUnidirectionalSequenceLSTMOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateUnidirectionalSequenceLSTMOptions(flatbuffers::FlatBufferBuilder &_fbb, const UnidirectionalSequenceLSTMOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const UnidirectionalSequenceLSTMOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _fused_activation_function = _o->fused_activation_function; - auto _cell_clip = _o->cell_clip; - auto _proj_clip = _o->proj_clip; - auto _time_major = _o->time_major; - auto _asymmetric_quantize_inputs = _o->asymmetric_quantize_inputs; - return tflite::CreateUnidirectionalSequenceLSTMOptions( - _fbb, - _fused_activation_function, - _cell_clip, - _proj_clip, - _time_major, - _asymmetric_quantize_inputs); -} - -inline BidirectionalSequenceLSTMOptionsT *BidirectionalSequenceLSTMOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new BidirectionalSequenceLSTMOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void BidirectionalSequenceLSTMOptions::UnPackTo(BidirectionalSequenceLSTMOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = cell_clip(); _o->cell_clip = _e; } - { auto _e = proj_clip(); _o->proj_clip = _e; } - { auto _e = merge_outputs(); _o->merge_outputs = _e; } - { auto _e = time_major(); _o->time_major = _e; } - { auto _e = asymmetric_quantize_inputs(); _o->asymmetric_quantize_inputs = _e; } -} - -inline flatbuffers::Offset BidirectionalSequenceLSTMOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const BidirectionalSequenceLSTMOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateBidirectionalSequenceLSTMOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateBidirectionalSequenceLSTMOptions(flatbuffers::FlatBufferBuilder &_fbb, const BidirectionalSequenceLSTMOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const BidirectionalSequenceLSTMOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _fused_activation_function = _o->fused_activation_function; - auto _cell_clip = _o->cell_clip; - auto _proj_clip = _o->proj_clip; - auto _merge_outputs = _o->merge_outputs; - auto _time_major = _o->time_major; - auto _asymmetric_quantize_inputs = _o->asymmetric_quantize_inputs; - return tflite::CreateBidirectionalSequenceLSTMOptions( - _fbb, - _fused_activation_function, - _cell_clip, - _proj_clip, - _merge_outputs, - _time_major, - _asymmetric_quantize_inputs); -} - -inline ResizeBilinearOptionsT *ResizeBilinearOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ResizeBilinearOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ResizeBilinearOptions::UnPackTo(ResizeBilinearOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = align_corners(); _o->align_corners = _e; } - { auto _e = half_pixel_centers(); _o->half_pixel_centers = _e; } -} - -inline flatbuffers::Offset ResizeBilinearOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ResizeBilinearOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateResizeBilinearOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateResizeBilinearOptions(flatbuffers::FlatBufferBuilder &_fbb, const ResizeBilinearOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ResizeBilinearOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _align_corners = _o->align_corners; - auto _half_pixel_centers = _o->half_pixel_centers; - return tflite::CreateResizeBilinearOptions( - _fbb, - _align_corners, - _half_pixel_centers); -} - -inline ResizeNearestNeighborOptionsT *ResizeNearestNeighborOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ResizeNearestNeighborOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ResizeNearestNeighborOptions::UnPackTo(ResizeNearestNeighborOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = align_corners(); _o->align_corners = _e; } - { auto _e = half_pixel_centers(); _o->half_pixel_centers = _e; } -} - -inline flatbuffers::Offset ResizeNearestNeighborOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ResizeNearestNeighborOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateResizeNearestNeighborOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateResizeNearestNeighborOptions(flatbuffers::FlatBufferBuilder &_fbb, const ResizeNearestNeighborOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ResizeNearestNeighborOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _align_corners = _o->align_corners; - auto _half_pixel_centers = _o->half_pixel_centers; - return tflite::CreateResizeNearestNeighborOptions( - _fbb, - _align_corners, - _half_pixel_centers); -} - -inline CallOptionsT *CallOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new CallOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void CallOptions::UnPackTo(CallOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = subgraph(); _o->subgraph = _e; } -} - -inline flatbuffers::Offset CallOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const CallOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateCallOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateCallOptions(flatbuffers::FlatBufferBuilder &_fbb, const CallOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const CallOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _subgraph = _o->subgraph; - return tflite::CreateCallOptions( - _fbb, - _subgraph); -} - -inline PadOptionsT *PadOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new PadOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void PadOptions::UnPackTo(PadOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset PadOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const PadOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreatePadOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreatePadOptions(flatbuffers::FlatBufferBuilder &_fbb, const PadOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const PadOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreatePadOptions( - _fbb); -} - -inline PadV2OptionsT *PadV2Options::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new PadV2OptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void PadV2Options::UnPackTo(PadV2OptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset PadV2Options::Pack(flatbuffers::FlatBufferBuilder &_fbb, const PadV2OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreatePadV2Options(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreatePadV2Options(flatbuffers::FlatBufferBuilder &_fbb, const PadV2OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const PadV2OptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreatePadV2Options( - _fbb); -} - -inline ReshapeOptionsT *ReshapeOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ReshapeOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ReshapeOptions::UnPackTo(ReshapeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = new_shape(); if (_e) { _o->new_shape.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->new_shape[_i] = _e->Get(_i); } } } -} - -inline flatbuffers::Offset ReshapeOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReshapeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateReshapeOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateReshapeOptions(flatbuffers::FlatBufferBuilder &_fbb, const ReshapeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ReshapeOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _new_shape = _o->new_shape.size() ? _fbb.CreateVector(_o->new_shape) : 0; - return tflite::CreateReshapeOptions( - _fbb, - _new_shape); -} - -inline SpaceToBatchNDOptionsT *SpaceToBatchNDOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SpaceToBatchNDOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SpaceToBatchNDOptions::UnPackTo(SpaceToBatchNDOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset SpaceToBatchNDOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SpaceToBatchNDOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSpaceToBatchNDOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSpaceToBatchNDOptions(flatbuffers::FlatBufferBuilder &_fbb, const SpaceToBatchNDOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SpaceToBatchNDOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateSpaceToBatchNDOptions( - _fbb); -} - -inline BatchToSpaceNDOptionsT *BatchToSpaceNDOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new BatchToSpaceNDOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void BatchToSpaceNDOptions::UnPackTo(BatchToSpaceNDOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset BatchToSpaceNDOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const BatchToSpaceNDOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateBatchToSpaceNDOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateBatchToSpaceNDOptions(flatbuffers::FlatBufferBuilder &_fbb, const BatchToSpaceNDOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const BatchToSpaceNDOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateBatchToSpaceNDOptions( - _fbb); -} - -inline SkipGramOptionsT *SkipGramOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SkipGramOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SkipGramOptions::UnPackTo(SkipGramOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = ngram_size(); _o->ngram_size = _e; } - { auto _e = max_skip_size(); _o->max_skip_size = _e; } - { auto _e = include_all_ngrams(); _o->include_all_ngrams = _e; } -} - -inline flatbuffers::Offset SkipGramOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SkipGramOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSkipGramOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSkipGramOptions(flatbuffers::FlatBufferBuilder &_fbb, const SkipGramOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SkipGramOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _ngram_size = _o->ngram_size; - auto _max_skip_size = _o->max_skip_size; - auto _include_all_ngrams = _o->include_all_ngrams; - return tflite::CreateSkipGramOptions( - _fbb, - _ngram_size, - _max_skip_size, - _include_all_ngrams); -} - -inline SpaceToDepthOptionsT *SpaceToDepthOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SpaceToDepthOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SpaceToDepthOptions::UnPackTo(SpaceToDepthOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = block_size(); _o->block_size = _e; } -} - -inline flatbuffers::Offset SpaceToDepthOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SpaceToDepthOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSpaceToDepthOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSpaceToDepthOptions(flatbuffers::FlatBufferBuilder &_fbb, const SpaceToDepthOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SpaceToDepthOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _block_size = _o->block_size; - return tflite::CreateSpaceToDepthOptions( - _fbb, - _block_size); -} - -inline DepthToSpaceOptionsT *DepthToSpaceOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new DepthToSpaceOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void DepthToSpaceOptions::UnPackTo(DepthToSpaceOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = block_size(); _o->block_size = _e; } -} - -inline flatbuffers::Offset DepthToSpaceOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const DepthToSpaceOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateDepthToSpaceOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateDepthToSpaceOptions(flatbuffers::FlatBufferBuilder &_fbb, const DepthToSpaceOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const DepthToSpaceOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _block_size = _o->block_size; - return tflite::CreateDepthToSpaceOptions( - _fbb, - _block_size); -} - -inline SubOptionsT *SubOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SubOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SubOptions::UnPackTo(SubOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } - { auto _e = pot_scale_int16(); _o->pot_scale_int16 = _e; } -} - -inline flatbuffers::Offset SubOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SubOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSubOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSubOptions(flatbuffers::FlatBufferBuilder &_fbb, const SubOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SubOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _fused_activation_function = _o->fused_activation_function; - auto _pot_scale_int16 = _o->pot_scale_int16; - return tflite::CreateSubOptions( - _fbb, - _fused_activation_function, - _pot_scale_int16); -} - -inline DivOptionsT *DivOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new DivOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void DivOptions::UnPackTo(DivOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = fused_activation_function(); _o->fused_activation_function = _e; } -} - -inline flatbuffers::Offset DivOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const DivOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateDivOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateDivOptions(flatbuffers::FlatBufferBuilder &_fbb, const DivOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const DivOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _fused_activation_function = _o->fused_activation_function; - return tflite::CreateDivOptions( - _fbb, - _fused_activation_function); -} - -inline TopKV2OptionsT *TopKV2Options::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new TopKV2OptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void TopKV2Options::UnPackTo(TopKV2OptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset TopKV2Options::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TopKV2OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateTopKV2Options(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateTopKV2Options(flatbuffers::FlatBufferBuilder &_fbb, const TopKV2OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TopKV2OptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateTopKV2Options( - _fbb); -} - -inline EmbeddingLookupSparseOptionsT *EmbeddingLookupSparseOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new EmbeddingLookupSparseOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void EmbeddingLookupSparseOptions::UnPackTo(EmbeddingLookupSparseOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = combiner(); _o->combiner = _e; } -} - -inline flatbuffers::Offset EmbeddingLookupSparseOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const EmbeddingLookupSparseOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateEmbeddingLookupSparseOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateEmbeddingLookupSparseOptions(flatbuffers::FlatBufferBuilder &_fbb, const EmbeddingLookupSparseOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const EmbeddingLookupSparseOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _combiner = _o->combiner; - return tflite::CreateEmbeddingLookupSparseOptions( - _fbb, - _combiner); -} - -inline GatherOptionsT *GatherOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new GatherOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void GatherOptions::UnPackTo(GatherOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = axis(); _o->axis = _e; } -} - -inline flatbuffers::Offset GatherOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const GatherOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateGatherOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateGatherOptions(flatbuffers::FlatBufferBuilder &_fbb, const GatherOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const GatherOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _axis = _o->axis; - return tflite::CreateGatherOptions( - _fbb, - _axis); -} - -inline TransposeOptionsT *TransposeOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new TransposeOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void TransposeOptions::UnPackTo(TransposeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset TransposeOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TransposeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateTransposeOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateTransposeOptions(flatbuffers::FlatBufferBuilder &_fbb, const TransposeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TransposeOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateTransposeOptions( - _fbb); -} - -inline ExpOptionsT *ExpOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ExpOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ExpOptions::UnPackTo(ExpOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset ExpOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ExpOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateExpOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateExpOptions(flatbuffers::FlatBufferBuilder &_fbb, const ExpOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ExpOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateExpOptions( - _fbb); -} - -inline CosOptionsT *CosOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new CosOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void CosOptions::UnPackTo(CosOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset CosOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const CosOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateCosOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateCosOptions(flatbuffers::FlatBufferBuilder &_fbb, const CosOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const CosOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateCosOptions( - _fbb); -} - -inline ReducerOptionsT *ReducerOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ReducerOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ReducerOptions::UnPackTo(ReducerOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = keep_dims(); _o->keep_dims = _e; } -} - -inline flatbuffers::Offset ReducerOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReducerOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateReducerOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateReducerOptions(flatbuffers::FlatBufferBuilder &_fbb, const ReducerOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ReducerOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _keep_dims = _o->keep_dims; - return tflite::CreateReducerOptions( - _fbb, - _keep_dims); -} - -inline SqueezeOptionsT *SqueezeOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SqueezeOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SqueezeOptions::UnPackTo(SqueezeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = squeeze_dims(); if (_e) { _o->squeeze_dims.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->squeeze_dims[_i] = _e->Get(_i); } } } -} - -inline flatbuffers::Offset SqueezeOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SqueezeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSqueezeOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSqueezeOptions(flatbuffers::FlatBufferBuilder &_fbb, const SqueezeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SqueezeOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _squeeze_dims = _o->squeeze_dims.size() ? _fbb.CreateVector(_o->squeeze_dims) : 0; - return tflite::CreateSqueezeOptions( - _fbb, - _squeeze_dims); -} - -inline SplitOptionsT *SplitOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SplitOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SplitOptions::UnPackTo(SplitOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = num_splits(); _o->num_splits = _e; } -} - -inline flatbuffers::Offset SplitOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SplitOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSplitOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSplitOptions(flatbuffers::FlatBufferBuilder &_fbb, const SplitOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SplitOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _num_splits = _o->num_splits; - return tflite::CreateSplitOptions( - _fbb, - _num_splits); -} - -inline SplitVOptionsT *SplitVOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SplitVOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SplitVOptions::UnPackTo(SplitVOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = num_splits(); _o->num_splits = _e; } -} - -inline flatbuffers::Offset SplitVOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SplitVOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSplitVOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSplitVOptions(flatbuffers::FlatBufferBuilder &_fbb, const SplitVOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SplitVOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _num_splits = _o->num_splits; - return tflite::CreateSplitVOptions( - _fbb, - _num_splits); -} - -inline StridedSliceOptionsT *StridedSliceOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new StridedSliceOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void StridedSliceOptions::UnPackTo(StridedSliceOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = begin_mask(); _o->begin_mask = _e; } - { auto _e = end_mask(); _o->end_mask = _e; } - { auto _e = ellipsis_mask(); _o->ellipsis_mask = _e; } - { auto _e = new_axis_mask(); _o->new_axis_mask = _e; } - { auto _e = shrink_axis_mask(); _o->shrink_axis_mask = _e; } -} - -inline flatbuffers::Offset StridedSliceOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const StridedSliceOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateStridedSliceOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateStridedSliceOptions(flatbuffers::FlatBufferBuilder &_fbb, const StridedSliceOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const StridedSliceOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _begin_mask = _o->begin_mask; - auto _end_mask = _o->end_mask; - auto _ellipsis_mask = _o->ellipsis_mask; - auto _new_axis_mask = _o->new_axis_mask; - auto _shrink_axis_mask = _o->shrink_axis_mask; - return tflite::CreateStridedSliceOptions( - _fbb, - _begin_mask, - _end_mask, - _ellipsis_mask, - _new_axis_mask, - _shrink_axis_mask); -} - -inline LogSoftmaxOptionsT *LogSoftmaxOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new LogSoftmaxOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void LogSoftmaxOptions::UnPackTo(LogSoftmaxOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset LogSoftmaxOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LogSoftmaxOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateLogSoftmaxOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateLogSoftmaxOptions(flatbuffers::FlatBufferBuilder &_fbb, const LogSoftmaxOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const LogSoftmaxOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateLogSoftmaxOptions( - _fbb); -} - -inline CastOptionsT *CastOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new CastOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void CastOptions::UnPackTo(CastOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = in_data_type(); _o->in_data_type = _e; } - { auto _e = out_data_type(); _o->out_data_type = _e; } -} - -inline flatbuffers::Offset CastOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const CastOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateCastOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateCastOptions(flatbuffers::FlatBufferBuilder &_fbb, const CastOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const CastOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _in_data_type = _o->in_data_type; - auto _out_data_type = _o->out_data_type; - return tflite::CreateCastOptions( - _fbb, - _in_data_type, - _out_data_type); -} - -inline DequantizeOptionsT *DequantizeOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new DequantizeOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void DequantizeOptions::UnPackTo(DequantizeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset DequantizeOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const DequantizeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateDequantizeOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateDequantizeOptions(flatbuffers::FlatBufferBuilder &_fbb, const DequantizeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const DequantizeOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateDequantizeOptions( - _fbb); -} - -inline MaximumMinimumOptionsT *MaximumMinimumOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new MaximumMinimumOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void MaximumMinimumOptions::UnPackTo(MaximumMinimumOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset MaximumMinimumOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MaximumMinimumOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateMaximumMinimumOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateMaximumMinimumOptions(flatbuffers::FlatBufferBuilder &_fbb, const MaximumMinimumOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MaximumMinimumOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateMaximumMinimumOptions( - _fbb); -} - -inline TileOptionsT *TileOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new TileOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void TileOptions::UnPackTo(TileOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset TileOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TileOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateTileOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateTileOptions(flatbuffers::FlatBufferBuilder &_fbb, const TileOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TileOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateTileOptions( - _fbb); -} - -inline ArgMaxOptionsT *ArgMaxOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ArgMaxOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ArgMaxOptions::UnPackTo(ArgMaxOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = output_type(); _o->output_type = _e; } -} - -inline flatbuffers::Offset ArgMaxOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ArgMaxOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateArgMaxOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateArgMaxOptions(flatbuffers::FlatBufferBuilder &_fbb, const ArgMaxOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ArgMaxOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _output_type = _o->output_type; - return tflite::CreateArgMaxOptions( - _fbb, - _output_type); -} - -inline ArgMinOptionsT *ArgMinOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ArgMinOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ArgMinOptions::UnPackTo(ArgMinOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = output_type(); _o->output_type = _e; } -} - -inline flatbuffers::Offset ArgMinOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ArgMinOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateArgMinOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateArgMinOptions(flatbuffers::FlatBufferBuilder &_fbb, const ArgMinOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ArgMinOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _output_type = _o->output_type; - return tflite::CreateArgMinOptions( - _fbb, - _output_type); -} - -inline GreaterOptionsT *GreaterOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new GreaterOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void GreaterOptions::UnPackTo(GreaterOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset GreaterOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const GreaterOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateGreaterOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateGreaterOptions(flatbuffers::FlatBufferBuilder &_fbb, const GreaterOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const GreaterOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateGreaterOptions( - _fbb); -} - -inline GreaterEqualOptionsT *GreaterEqualOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new GreaterEqualOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void GreaterEqualOptions::UnPackTo(GreaterEqualOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset GreaterEqualOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const GreaterEqualOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateGreaterEqualOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateGreaterEqualOptions(flatbuffers::FlatBufferBuilder &_fbb, const GreaterEqualOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const GreaterEqualOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateGreaterEqualOptions( - _fbb); -} - -inline LessOptionsT *LessOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new LessOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void LessOptions::UnPackTo(LessOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset LessOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LessOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateLessOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateLessOptions(flatbuffers::FlatBufferBuilder &_fbb, const LessOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const LessOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateLessOptions( - _fbb); -} - -inline LessEqualOptionsT *LessEqualOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new LessEqualOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void LessEqualOptions::UnPackTo(LessEqualOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset LessEqualOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LessEqualOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateLessEqualOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateLessEqualOptions(flatbuffers::FlatBufferBuilder &_fbb, const LessEqualOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const LessEqualOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateLessEqualOptions( - _fbb); -} - -inline NegOptionsT *NegOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new NegOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void NegOptions::UnPackTo(NegOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset NegOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const NegOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateNegOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateNegOptions(flatbuffers::FlatBufferBuilder &_fbb, const NegOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const NegOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateNegOptions( - _fbb); -} - -inline SelectOptionsT *SelectOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SelectOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SelectOptions::UnPackTo(SelectOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset SelectOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SelectOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSelectOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSelectOptions(flatbuffers::FlatBufferBuilder &_fbb, const SelectOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SelectOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateSelectOptions( - _fbb); -} - -inline SliceOptionsT *SliceOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SliceOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SliceOptions::UnPackTo(SliceOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset SliceOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SliceOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSliceOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSliceOptions(flatbuffers::FlatBufferBuilder &_fbb, const SliceOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SliceOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateSliceOptions( - _fbb); -} - -inline TransposeConvOptionsT *TransposeConvOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new TransposeConvOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void TransposeConvOptions::UnPackTo(TransposeConvOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = padding(); _o->padding = _e; } - { auto _e = stride_w(); _o->stride_w = _e; } - { auto _e = stride_h(); _o->stride_h = _e; } -} - -inline flatbuffers::Offset TransposeConvOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TransposeConvOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateTransposeConvOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateTransposeConvOptions(flatbuffers::FlatBufferBuilder &_fbb, const TransposeConvOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TransposeConvOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _padding = _o->padding; - auto _stride_w = _o->stride_w; - auto _stride_h = _o->stride_h; - return tflite::CreateTransposeConvOptions( - _fbb, - _padding, - _stride_w, - _stride_h); -} - -inline ExpandDimsOptionsT *ExpandDimsOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ExpandDimsOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ExpandDimsOptions::UnPackTo(ExpandDimsOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset ExpandDimsOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ExpandDimsOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateExpandDimsOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateExpandDimsOptions(flatbuffers::FlatBufferBuilder &_fbb, const ExpandDimsOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ExpandDimsOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateExpandDimsOptions( - _fbb); -} - -inline SparseToDenseOptionsT *SparseToDenseOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SparseToDenseOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SparseToDenseOptions::UnPackTo(SparseToDenseOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = validate_indices(); _o->validate_indices = _e; } -} - -inline flatbuffers::Offset SparseToDenseOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SparseToDenseOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSparseToDenseOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSparseToDenseOptions(flatbuffers::FlatBufferBuilder &_fbb, const SparseToDenseOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SparseToDenseOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _validate_indices = _o->validate_indices; - return tflite::CreateSparseToDenseOptions( - _fbb, - _validate_indices); -} - -inline EqualOptionsT *EqualOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new EqualOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void EqualOptions::UnPackTo(EqualOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset EqualOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const EqualOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateEqualOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateEqualOptions(flatbuffers::FlatBufferBuilder &_fbb, const EqualOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const EqualOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateEqualOptions( - _fbb); -} - -inline NotEqualOptionsT *NotEqualOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new NotEqualOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void NotEqualOptions::UnPackTo(NotEqualOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset NotEqualOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const NotEqualOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateNotEqualOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateNotEqualOptions(flatbuffers::FlatBufferBuilder &_fbb, const NotEqualOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const NotEqualOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateNotEqualOptions( - _fbb); -} - -inline ShapeOptionsT *ShapeOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ShapeOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ShapeOptions::UnPackTo(ShapeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = out_type(); _o->out_type = _e; } -} - -inline flatbuffers::Offset ShapeOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ShapeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateShapeOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateShapeOptions(flatbuffers::FlatBufferBuilder &_fbb, const ShapeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ShapeOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _out_type = _o->out_type; - return tflite::CreateShapeOptions( - _fbb, - _out_type); -} - -inline RankOptionsT *RankOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new RankOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void RankOptions::UnPackTo(RankOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset RankOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const RankOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateRankOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateRankOptions(flatbuffers::FlatBufferBuilder &_fbb, const RankOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const RankOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateRankOptions( - _fbb); -} - -inline PowOptionsT *PowOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new PowOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void PowOptions::UnPackTo(PowOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset PowOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const PowOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreatePowOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreatePowOptions(flatbuffers::FlatBufferBuilder &_fbb, const PowOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const PowOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreatePowOptions( - _fbb); -} - -inline FakeQuantOptionsT *FakeQuantOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new FakeQuantOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void FakeQuantOptions::UnPackTo(FakeQuantOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = min(); _o->min = _e; } - { auto _e = max(); _o->max = _e; } - { auto _e = num_bits(); _o->num_bits = _e; } - { auto _e = narrow_range(); _o->narrow_range = _e; } -} - -inline flatbuffers::Offset FakeQuantOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const FakeQuantOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateFakeQuantOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateFakeQuantOptions(flatbuffers::FlatBufferBuilder &_fbb, const FakeQuantOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const FakeQuantOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _min = _o->min; - auto _max = _o->max; - auto _num_bits = _o->num_bits; - auto _narrow_range = _o->narrow_range; - return tflite::CreateFakeQuantOptions( - _fbb, - _min, - _max, - _num_bits, - _narrow_range); -} - -inline PackOptionsT *PackOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new PackOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void PackOptions::UnPackTo(PackOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = values_count(); _o->values_count = _e; } - { auto _e = axis(); _o->axis = _e; } -} - -inline flatbuffers::Offset PackOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const PackOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreatePackOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreatePackOptions(flatbuffers::FlatBufferBuilder &_fbb, const PackOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const PackOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _values_count = _o->values_count; - auto _axis = _o->axis; - return tflite::CreatePackOptions( - _fbb, - _values_count, - _axis); -} - -inline LogicalOrOptionsT *LogicalOrOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new LogicalOrOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void LogicalOrOptions::UnPackTo(LogicalOrOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset LogicalOrOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LogicalOrOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateLogicalOrOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateLogicalOrOptions(flatbuffers::FlatBufferBuilder &_fbb, const LogicalOrOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const LogicalOrOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateLogicalOrOptions( - _fbb); -} - -inline OneHotOptionsT *OneHotOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new OneHotOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void OneHotOptions::UnPackTo(OneHotOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = axis(); _o->axis = _e; } -} - -inline flatbuffers::Offset OneHotOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const OneHotOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateOneHotOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateOneHotOptions(flatbuffers::FlatBufferBuilder &_fbb, const OneHotOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const OneHotOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _axis = _o->axis; - return tflite::CreateOneHotOptions( - _fbb, - _axis); -} - -inline AbsOptionsT *AbsOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new AbsOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void AbsOptions::UnPackTo(AbsOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset AbsOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const AbsOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateAbsOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateAbsOptions(flatbuffers::FlatBufferBuilder &_fbb, const AbsOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const AbsOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateAbsOptions( - _fbb); -} - -inline HardSwishOptionsT *HardSwishOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new HardSwishOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void HardSwishOptions::UnPackTo(HardSwishOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset HardSwishOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const HardSwishOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateHardSwishOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateHardSwishOptions(flatbuffers::FlatBufferBuilder &_fbb, const HardSwishOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const HardSwishOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateHardSwishOptions( - _fbb); -} - -inline LogicalAndOptionsT *LogicalAndOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new LogicalAndOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void LogicalAndOptions::UnPackTo(LogicalAndOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset LogicalAndOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LogicalAndOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateLogicalAndOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateLogicalAndOptions(flatbuffers::FlatBufferBuilder &_fbb, const LogicalAndOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const LogicalAndOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateLogicalAndOptions( - _fbb); -} - -inline LogicalNotOptionsT *LogicalNotOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new LogicalNotOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void LogicalNotOptions::UnPackTo(LogicalNotOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset LogicalNotOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LogicalNotOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateLogicalNotOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateLogicalNotOptions(flatbuffers::FlatBufferBuilder &_fbb, const LogicalNotOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const LogicalNotOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateLogicalNotOptions( - _fbb); -} - -inline UnpackOptionsT *UnpackOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new UnpackOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void UnpackOptions::UnPackTo(UnpackOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = num(); _o->num = _e; } - { auto _e = axis(); _o->axis = _e; } -} - -inline flatbuffers::Offset UnpackOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const UnpackOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateUnpackOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateUnpackOptions(flatbuffers::FlatBufferBuilder &_fbb, const UnpackOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const UnpackOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _num = _o->num; - auto _axis = _o->axis; - return tflite::CreateUnpackOptions( - _fbb, - _num, - _axis); -} - -inline FloorDivOptionsT *FloorDivOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new FloorDivOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void FloorDivOptions::UnPackTo(FloorDivOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset FloorDivOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const FloorDivOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateFloorDivOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateFloorDivOptions(flatbuffers::FlatBufferBuilder &_fbb, const FloorDivOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const FloorDivOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateFloorDivOptions( - _fbb); -} - -inline SquareOptionsT *SquareOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SquareOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SquareOptions::UnPackTo(SquareOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset SquareOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SquareOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSquareOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSquareOptions(flatbuffers::FlatBufferBuilder &_fbb, const SquareOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SquareOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateSquareOptions( - _fbb); -} - -inline ZerosLikeOptionsT *ZerosLikeOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ZerosLikeOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ZerosLikeOptions::UnPackTo(ZerosLikeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset ZerosLikeOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ZerosLikeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateZerosLikeOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateZerosLikeOptions(flatbuffers::FlatBufferBuilder &_fbb, const ZerosLikeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ZerosLikeOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateZerosLikeOptions( - _fbb); -} - -inline FillOptionsT *FillOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new FillOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void FillOptions::UnPackTo(FillOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset FillOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const FillOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateFillOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateFillOptions(flatbuffers::FlatBufferBuilder &_fbb, const FillOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const FillOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateFillOptions( - _fbb); -} - -inline FloorModOptionsT *FloorModOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new FloorModOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void FloorModOptions::UnPackTo(FloorModOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset FloorModOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const FloorModOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateFloorModOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateFloorModOptions(flatbuffers::FlatBufferBuilder &_fbb, const FloorModOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const FloorModOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateFloorModOptions( - _fbb); -} - -inline RangeOptionsT *RangeOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new RangeOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void RangeOptions::UnPackTo(RangeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset RangeOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const RangeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateRangeOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateRangeOptions(flatbuffers::FlatBufferBuilder &_fbb, const RangeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const RangeOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateRangeOptions( - _fbb); -} - -inline LeakyReluOptionsT *LeakyReluOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new LeakyReluOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void LeakyReluOptions::UnPackTo(LeakyReluOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = alpha(); _o->alpha = _e; } -} - -inline flatbuffers::Offset LeakyReluOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const LeakyReluOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateLeakyReluOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateLeakyReluOptions(flatbuffers::FlatBufferBuilder &_fbb, const LeakyReluOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const LeakyReluOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _alpha = _o->alpha; - return tflite::CreateLeakyReluOptions( - _fbb, - _alpha); -} - -inline SquaredDifferenceOptionsT *SquaredDifferenceOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SquaredDifferenceOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SquaredDifferenceOptions::UnPackTo(SquaredDifferenceOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset SquaredDifferenceOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SquaredDifferenceOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSquaredDifferenceOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSquaredDifferenceOptions(flatbuffers::FlatBufferBuilder &_fbb, const SquaredDifferenceOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SquaredDifferenceOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateSquaredDifferenceOptions( - _fbb); -} - -inline MirrorPadOptionsT *MirrorPadOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new MirrorPadOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void MirrorPadOptions::UnPackTo(MirrorPadOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = mode(); _o->mode = _e; } -} - -inline flatbuffers::Offset MirrorPadOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MirrorPadOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateMirrorPadOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateMirrorPadOptions(flatbuffers::FlatBufferBuilder &_fbb, const MirrorPadOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MirrorPadOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _mode = _o->mode; - return tflite::CreateMirrorPadOptions( - _fbb, - _mode); -} - -inline UniqueOptionsT *UniqueOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new UniqueOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void UniqueOptions::UnPackTo(UniqueOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = idx_out_type(); _o->idx_out_type = _e; } -} - -inline flatbuffers::Offset UniqueOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const UniqueOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateUniqueOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateUniqueOptions(flatbuffers::FlatBufferBuilder &_fbb, const UniqueOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const UniqueOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _idx_out_type = _o->idx_out_type; - return tflite::CreateUniqueOptions( - _fbb, - _idx_out_type); -} - -inline ReverseV2OptionsT *ReverseV2Options::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ReverseV2OptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ReverseV2Options::UnPackTo(ReverseV2OptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset ReverseV2Options::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReverseV2OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateReverseV2Options(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateReverseV2Options(flatbuffers::FlatBufferBuilder &_fbb, const ReverseV2OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ReverseV2OptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateReverseV2Options( - _fbb); -} - -inline AddNOptionsT *AddNOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new AddNOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void AddNOptions::UnPackTo(AddNOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset AddNOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const AddNOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateAddNOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateAddNOptions(flatbuffers::FlatBufferBuilder &_fbb, const AddNOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const AddNOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateAddNOptions( - _fbb); -} - -inline GatherNdOptionsT *GatherNdOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new GatherNdOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void GatherNdOptions::UnPackTo(GatherNdOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset GatherNdOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const GatherNdOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateGatherNdOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateGatherNdOptions(flatbuffers::FlatBufferBuilder &_fbb, const GatherNdOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const GatherNdOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateGatherNdOptions( - _fbb); -} - -inline WhereOptionsT *WhereOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new WhereOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void WhereOptions::UnPackTo(WhereOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset WhereOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const WhereOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateWhereOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateWhereOptions(flatbuffers::FlatBufferBuilder &_fbb, const WhereOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const WhereOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateWhereOptions( - _fbb); -} - -inline ReverseSequenceOptionsT *ReverseSequenceOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ReverseSequenceOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ReverseSequenceOptions::UnPackTo(ReverseSequenceOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = seq_dim(); _o->seq_dim = _e; } - { auto _e = batch_dim(); _o->batch_dim = _e; } -} - -inline flatbuffers::Offset ReverseSequenceOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ReverseSequenceOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateReverseSequenceOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateReverseSequenceOptions(flatbuffers::FlatBufferBuilder &_fbb, const ReverseSequenceOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ReverseSequenceOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _seq_dim = _o->seq_dim; - auto _batch_dim = _o->batch_dim; - return tflite::CreateReverseSequenceOptions( - _fbb, - _seq_dim, - _batch_dim); -} - -inline MatrixDiagOptionsT *MatrixDiagOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new MatrixDiagOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void MatrixDiagOptions::UnPackTo(MatrixDiagOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset MatrixDiagOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MatrixDiagOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateMatrixDiagOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateMatrixDiagOptions(flatbuffers::FlatBufferBuilder &_fbb, const MatrixDiagOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MatrixDiagOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateMatrixDiagOptions( - _fbb); -} - -inline QuantizeOptionsT *QuantizeOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new QuantizeOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void QuantizeOptions::UnPackTo(QuantizeOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset QuantizeOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const QuantizeOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateQuantizeOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateQuantizeOptions(flatbuffers::FlatBufferBuilder &_fbb, const QuantizeOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const QuantizeOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateQuantizeOptions( - _fbb); -} - -inline MatrixSetDiagOptionsT *MatrixSetDiagOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new MatrixSetDiagOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void MatrixSetDiagOptions::UnPackTo(MatrixSetDiagOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset MatrixSetDiagOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MatrixSetDiagOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateMatrixSetDiagOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateMatrixSetDiagOptions(flatbuffers::FlatBufferBuilder &_fbb, const MatrixSetDiagOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MatrixSetDiagOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateMatrixSetDiagOptions( - _fbb); -} - -inline IfOptionsT *IfOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new IfOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void IfOptions::UnPackTo(IfOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = then_subgraph_index(); _o->then_subgraph_index = _e; } - { auto _e = else_subgraph_index(); _o->else_subgraph_index = _e; } -} - -inline flatbuffers::Offset IfOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const IfOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateIfOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateIfOptions(flatbuffers::FlatBufferBuilder &_fbb, const IfOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const IfOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _then_subgraph_index = _o->then_subgraph_index; - auto _else_subgraph_index = _o->else_subgraph_index; - return tflite::CreateIfOptions( - _fbb, - _then_subgraph_index, - _else_subgraph_index); -} - -inline WhileOptionsT *WhileOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new WhileOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void WhileOptions::UnPackTo(WhileOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = cond_subgraph_index(); _o->cond_subgraph_index = _e; } - { auto _e = body_subgraph_index(); _o->body_subgraph_index = _e; } -} - -inline flatbuffers::Offset WhileOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const WhileOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateWhileOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateWhileOptions(flatbuffers::FlatBufferBuilder &_fbb, const WhileOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const WhileOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _cond_subgraph_index = _o->cond_subgraph_index; - auto _body_subgraph_index = _o->body_subgraph_index; - return tflite::CreateWhileOptions( - _fbb, - _cond_subgraph_index, - _body_subgraph_index); -} - -inline NonMaxSuppressionV4OptionsT *NonMaxSuppressionV4Options::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new NonMaxSuppressionV4OptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void NonMaxSuppressionV4Options::UnPackTo(NonMaxSuppressionV4OptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset NonMaxSuppressionV4Options::Pack(flatbuffers::FlatBufferBuilder &_fbb, const NonMaxSuppressionV4OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateNonMaxSuppressionV4Options(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateNonMaxSuppressionV4Options(flatbuffers::FlatBufferBuilder &_fbb, const NonMaxSuppressionV4OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const NonMaxSuppressionV4OptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateNonMaxSuppressionV4Options( - _fbb); -} - -inline NonMaxSuppressionV5OptionsT *NonMaxSuppressionV5Options::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new NonMaxSuppressionV5OptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void NonMaxSuppressionV5Options::UnPackTo(NonMaxSuppressionV5OptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset NonMaxSuppressionV5Options::Pack(flatbuffers::FlatBufferBuilder &_fbb, const NonMaxSuppressionV5OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateNonMaxSuppressionV5Options(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateNonMaxSuppressionV5Options(flatbuffers::FlatBufferBuilder &_fbb, const NonMaxSuppressionV5OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const NonMaxSuppressionV5OptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateNonMaxSuppressionV5Options( - _fbb); -} - -inline ScatterNdOptionsT *ScatterNdOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ScatterNdOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void ScatterNdOptions::UnPackTo(ScatterNdOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset ScatterNdOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ScatterNdOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateScatterNdOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateScatterNdOptions(flatbuffers::FlatBufferBuilder &_fbb, const ScatterNdOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ScatterNdOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateScatterNdOptions( - _fbb); -} - -inline SelectV2OptionsT *SelectV2Options::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SelectV2OptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SelectV2Options::UnPackTo(SelectV2OptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset SelectV2Options::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SelectV2OptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSelectV2Options(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSelectV2Options(flatbuffers::FlatBufferBuilder &_fbb, const SelectV2OptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SelectV2OptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateSelectV2Options( - _fbb); -} - -inline DensifyOptionsT *DensifyOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new DensifyOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void DensifyOptions::UnPackTo(DensifyOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset DensifyOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const DensifyOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateDensifyOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateDensifyOptions(flatbuffers::FlatBufferBuilder &_fbb, const DensifyOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const DensifyOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateDensifyOptions( - _fbb); -} - -inline SegmentSumOptionsT *SegmentSumOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SegmentSumOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SegmentSumOptions::UnPackTo(SegmentSumOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; -} - -inline flatbuffers::Offset SegmentSumOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SegmentSumOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSegmentSumOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSegmentSumOptions(flatbuffers::FlatBufferBuilder &_fbb, const SegmentSumOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SegmentSumOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - return tflite::CreateSegmentSumOptions( - _fbb); -} - -inline BatchMatMulOptionsT *BatchMatMulOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new BatchMatMulOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void BatchMatMulOptions::UnPackTo(BatchMatMulOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = adj_x(); _o->adj_x = _e; } - { auto _e = adj_y(); _o->adj_y = _e; } -} - -inline flatbuffers::Offset BatchMatMulOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const BatchMatMulOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateBatchMatMulOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateBatchMatMulOptions(flatbuffers::FlatBufferBuilder &_fbb, const BatchMatMulOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const BatchMatMulOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _adj_x = _o->adj_x; - auto _adj_y = _o->adj_y; - return tflite::CreateBatchMatMulOptions( - _fbb, - _adj_x, - _adj_y); -} - -inline CumsumOptionsT *CumsumOptions::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new CumsumOptionsT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void CumsumOptions::UnPackTo(CumsumOptionsT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = exclusive(); _o->exclusive = _e; } - { auto _e = reverse(); _o->reverse = _e; } -} - -inline flatbuffers::Offset CumsumOptions::Pack(flatbuffers::FlatBufferBuilder &_fbb, const CumsumOptionsT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateCumsumOptions(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateCumsumOptions(flatbuffers::FlatBufferBuilder &_fbb, const CumsumOptionsT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const CumsumOptionsT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _exclusive = _o->exclusive; - auto _reverse = _o->reverse; - return tflite::CreateCumsumOptions( - _fbb, - _exclusive, - _reverse); -} - -inline OperatorCodeT *OperatorCode::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new OperatorCodeT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void OperatorCode::UnPackTo(OperatorCodeT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = deprecated_builtin_code(); _o->deprecated_builtin_code = _e; } - { auto _e = custom_code(); if (_e) _o->custom_code = _e->str(); } - { auto _e = version(); _o->version = _e; } - { auto _e = builtin_code(); _o->builtin_code = _e; } -} - -inline flatbuffers::Offset OperatorCode::Pack(flatbuffers::FlatBufferBuilder &_fbb, const OperatorCodeT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateOperatorCode(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateOperatorCode(flatbuffers::FlatBufferBuilder &_fbb, const OperatorCodeT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const OperatorCodeT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _deprecated_builtin_code = _o->deprecated_builtin_code; - auto _custom_code = _o->custom_code.empty() ? 0 : _fbb.CreateString(_o->custom_code); - auto _version = _o->version; - auto _builtin_code = _o->builtin_code; - return tflite::CreateOperatorCode( - _fbb, - _deprecated_builtin_code, - _custom_code, - _version, - _builtin_code); -} - -inline OperatorT *Operator::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new OperatorT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void Operator::UnPackTo(OperatorT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = opcode_index(); _o->opcode_index = _e; } - { auto _e = inputs(); if (_e) { _o->inputs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->inputs[_i] = _e->Get(_i); } } } - { auto _e = outputs(); if (_e) { _o->outputs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->outputs[_i] = _e->Get(_i); } } } - { auto _e = builtin_options_type(); _o->builtin_options.type = _e; } - { auto _e = builtin_options(); if (_e) _o->builtin_options.value = tflite::BuiltinOptionsUnion::UnPack(_e, builtin_options_type(), _resolver); } - { auto _e = custom_options(); if (_e) { _o->custom_options.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->custom_options.begin()); } } - { auto _e = custom_options_format(); _o->custom_options_format = _e; } - { auto _e = mutating_variable_inputs(); if (_e) { _o->mutating_variable_inputs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->mutating_variable_inputs[_i] = _e->Get(_i) != 0; } } } - { auto _e = intermediates(); if (_e) { _o->intermediates.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->intermediates[_i] = _e->Get(_i); } } } -} - -inline flatbuffers::Offset Operator::Pack(flatbuffers::FlatBufferBuilder &_fbb, const OperatorT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateOperator(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateOperator(flatbuffers::FlatBufferBuilder &_fbb, const OperatorT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const OperatorT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _opcode_index = _o->opcode_index; - auto _inputs = _o->inputs.size() ? _fbb.CreateVector(_o->inputs) : 0; - auto _outputs = _o->outputs.size() ? _fbb.CreateVector(_o->outputs) : 0; - auto _builtin_options_type = _o->builtin_options.type; - auto _builtin_options = _o->builtin_options.Pack(_fbb); - auto _custom_options = _o->custom_options.size() ? _fbb.CreateVector(_o->custom_options) : 0; - auto _custom_options_format = _o->custom_options_format; - auto _mutating_variable_inputs = _o->mutating_variable_inputs.size() ? _fbb.CreateVector(_o->mutating_variable_inputs) : 0; - auto _intermediates = _o->intermediates.size() ? _fbb.CreateVector(_o->intermediates) : 0; - return tflite::CreateOperator( - _fbb, - _opcode_index, - _inputs, - _outputs, - _builtin_options_type, - _builtin_options, - _custom_options, - _custom_options_format, - _mutating_variable_inputs, - _intermediates); -} - -inline SubGraphT *SubGraph::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SubGraphT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SubGraph::UnPackTo(SubGraphT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = tensors(); if (_e) { _o->tensors.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->tensors[_i] = std::unique_ptr(_e->Get(_i)->UnPack(_resolver)); } } } - { auto _e = inputs(); if (_e) { _o->inputs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->inputs[_i] = _e->Get(_i); } } } - { auto _e = outputs(); if (_e) { _o->outputs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->outputs[_i] = _e->Get(_i); } } } - { auto _e = operators(); if (_e) { _o->operators.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->operators[_i] = std::unique_ptr(_e->Get(_i)->UnPack(_resolver)); } } } - { auto _e = name(); if (_e) _o->name = _e->str(); } -} - -inline flatbuffers::Offset SubGraph::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SubGraphT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSubGraph(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSubGraph(flatbuffers::FlatBufferBuilder &_fbb, const SubGraphT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SubGraphT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _tensors = _o->tensors.size() ? _fbb.CreateVector> (_o->tensors.size(), [](size_t i, _VectorArgs *__va) { return CreateTensor(*__va->__fbb, __va->__o->tensors[i].get(), __va->__rehasher); }, &_va ) : 0; - auto _inputs = _o->inputs.size() ? _fbb.CreateVector(_o->inputs) : 0; - auto _outputs = _o->outputs.size() ? _fbb.CreateVector(_o->outputs) : 0; - auto _operators = _o->operators.size() ? _fbb.CreateVector> (_o->operators.size(), [](size_t i, _VectorArgs *__va) { return CreateOperator(*__va->__fbb, __va->__o->operators[i].get(), __va->__rehasher); }, &_va ) : 0; - auto _name = _o->name.empty() ? 0 : _fbb.CreateString(_o->name); - return tflite::CreateSubGraph( - _fbb, - _tensors, - _inputs, - _outputs, - _operators, - _name); -} - -inline BufferT *Buffer::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new BufferT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void Buffer::UnPackTo(BufferT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = data(); if (_e) { _o->data.resize(_e->size()); std::copy(_e->begin(), _e->end(), _o->data.begin()); } } -} - -inline flatbuffers::Offset Buffer::Pack(flatbuffers::FlatBufferBuilder &_fbb, const BufferT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateBuffer(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateBuffer(flatbuffers::FlatBufferBuilder &_fbb, const BufferT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const BufferT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - _fbb.ForceVectorAlignment(_o->data.size(), sizeof(uint8_t), 16); - auto _data = _o->data.size() ? _fbb.CreateVector(_o->data) : 0; - return tflite::CreateBuffer( - _fbb, - _data); -} - -inline MetadataT *Metadata::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new MetadataT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void Metadata::UnPackTo(MetadataT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = name(); if (_e) _o->name = _e->str(); } - { auto _e = buffer(); _o->buffer = _e; } -} - -inline flatbuffers::Offset Metadata::Pack(flatbuffers::FlatBufferBuilder &_fbb, const MetadataT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateMetadata(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateMetadata(flatbuffers::FlatBufferBuilder &_fbb, const MetadataT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const MetadataT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _name = _o->name.empty() ? 0 : _fbb.CreateString(_o->name); - auto _buffer = _o->buffer; - return tflite::CreateMetadata( - _fbb, - _name, - _buffer); -} - -inline TensorMapT *TensorMap::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new TensorMapT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void TensorMap::UnPackTo(TensorMapT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = name(); if (_e) _o->name = _e->str(); } - { auto _e = tensor_index(); _o->tensor_index = _e; } -} - -inline flatbuffers::Offset TensorMap::Pack(flatbuffers::FlatBufferBuilder &_fbb, const TensorMapT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateTensorMap(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateTensorMap(flatbuffers::FlatBufferBuilder &_fbb, const TensorMapT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const TensorMapT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _name = _o->name.empty() ? 0 : _fbb.CreateString(_o->name); - auto _tensor_index = _o->tensor_index; - return tflite::CreateTensorMap( - _fbb, - _name, - _tensor_index); -} - -inline SignatureDefT *SignatureDef::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new SignatureDefT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void SignatureDef::UnPackTo(SignatureDefT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = inputs(); if (_e) { _o->inputs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->inputs[_i] = std::unique_ptr(_e->Get(_i)->UnPack(_resolver)); } } } - { auto _e = outputs(); if (_e) { _o->outputs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->outputs[_i] = std::unique_ptr(_e->Get(_i)->UnPack(_resolver)); } } } - { auto _e = method_name(); if (_e) _o->method_name = _e->str(); } - { auto _e = key(); if (_e) _o->key = _e->str(); } -} - -inline flatbuffers::Offset SignatureDef::Pack(flatbuffers::FlatBufferBuilder &_fbb, const SignatureDefT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateSignatureDef(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateSignatureDef(flatbuffers::FlatBufferBuilder &_fbb, const SignatureDefT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const SignatureDefT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _inputs = _o->inputs.size() ? _fbb.CreateVector> (_o->inputs.size(), [](size_t i, _VectorArgs *__va) { return CreateTensorMap(*__va->__fbb, __va->__o->inputs[i].get(), __va->__rehasher); }, &_va ) : 0; - auto _outputs = _o->outputs.size() ? _fbb.CreateVector> (_o->outputs.size(), [](size_t i, _VectorArgs *__va) { return CreateTensorMap(*__va->__fbb, __va->__o->outputs[i].get(), __va->__rehasher); }, &_va ) : 0; - auto _method_name = _o->method_name.empty() ? 0 : _fbb.CreateString(_o->method_name); - auto _key = _o->key.empty() ? 0 : _fbb.CreateString(_o->key); - return tflite::CreateSignatureDef( - _fbb, - _inputs, - _outputs, - _method_name, - _key); -} - -inline ModelT *Model::UnPack(const flatbuffers::resolver_function_t *_resolver) const { - auto _o = new ModelT(); - UnPackTo(_o, _resolver); - return _o; -} - -inline void Model::UnPackTo(ModelT *_o, const flatbuffers::resolver_function_t *_resolver) const { - (void)_o; - (void)_resolver; - { auto _e = version(); _o->version = _e; } - { auto _e = operator_codes(); if (_e) { _o->operator_codes.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->operator_codes[_i] = std::unique_ptr(_e->Get(_i)->UnPack(_resolver)); } } } - { auto _e = subgraphs(); if (_e) { _o->subgraphs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->subgraphs[_i] = std::unique_ptr(_e->Get(_i)->UnPack(_resolver)); } } } - { auto _e = description(); if (_e) _o->description = _e->str(); } - { auto _e = buffers(); if (_e) { _o->buffers.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->buffers[_i] = std::unique_ptr(_e->Get(_i)->UnPack(_resolver)); } } } - { auto _e = metadata_buffer(); if (_e) { _o->metadata_buffer.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->metadata_buffer[_i] = _e->Get(_i); } } } - { auto _e = metadata(); if (_e) { _o->metadata.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->metadata[_i] = std::unique_ptr(_e->Get(_i)->UnPack(_resolver)); } } } - { auto _e = signature_defs(); if (_e) { _o->signature_defs.resize(_e->size()); for (flatbuffers::uoffset_t _i = 0; _i < _e->size(); _i++) { _o->signature_defs[_i] = std::unique_ptr(_e->Get(_i)->UnPack(_resolver)); } } } -} - -inline flatbuffers::Offset Model::Pack(flatbuffers::FlatBufferBuilder &_fbb, const ModelT* _o, const flatbuffers::rehasher_function_t *_rehasher) { - return CreateModel(_fbb, _o, _rehasher); -} - -inline flatbuffers::Offset CreateModel(flatbuffers::FlatBufferBuilder &_fbb, const ModelT *_o, const flatbuffers::rehasher_function_t *_rehasher) { - (void)_rehasher; - (void)_o; - struct _VectorArgs { flatbuffers::FlatBufferBuilder *__fbb; const ModelT* __o; const flatbuffers::rehasher_function_t *__rehasher; } _va = { &_fbb, _o, _rehasher}; (void)_va; - auto _version = _o->version; - auto _operator_codes = _o->operator_codes.size() ? _fbb.CreateVector> (_o->operator_codes.size(), [](size_t i, _VectorArgs *__va) { return CreateOperatorCode(*__va->__fbb, __va->__o->operator_codes[i].get(), __va->__rehasher); }, &_va ) : 0; - auto _subgraphs = _o->subgraphs.size() ? _fbb.CreateVector> (_o->subgraphs.size(), [](size_t i, _VectorArgs *__va) { return CreateSubGraph(*__va->__fbb, __va->__o->subgraphs[i].get(), __va->__rehasher); }, &_va ) : 0; - auto _description = _o->description.empty() ? 0 : _fbb.CreateString(_o->description); - auto _buffers = _o->buffers.size() ? _fbb.CreateVector> (_o->buffers.size(), [](size_t i, _VectorArgs *__va) { return CreateBuffer(*__va->__fbb, __va->__o->buffers[i].get(), __va->__rehasher); }, &_va ) : 0; - auto _metadata_buffer = _o->metadata_buffer.size() ? _fbb.CreateVector(_o->metadata_buffer) : 0; - auto _metadata = _o->metadata.size() ? _fbb.CreateVector> (_o->metadata.size(), [](size_t i, _VectorArgs *__va) { return CreateMetadata(*__va->__fbb, __va->__o->metadata[i].get(), __va->__rehasher); }, &_va ) : 0; - auto _signature_defs = _o->signature_defs.size() ? _fbb.CreateVector> (_o->signature_defs.size(), [](size_t i, _VectorArgs *__va) { return CreateSignatureDef(*__va->__fbb, __va->__o->signature_defs[i].get(), __va->__rehasher); }, &_va ) : 0; - return tflite::CreateModel( - _fbb, - _version, - _operator_codes, - _subgraphs, - _description, - _buffers, - _metadata_buffer, - _metadata, - _signature_defs); -} - -inline bool VerifyQuantizationDetails(flatbuffers::Verifier &verifier, const void *obj, QuantizationDetails type) { - switch (type) { - case QuantizationDetails_NONE: { - return true; - } - case QuantizationDetails_CustomQuantization: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - default: return true; - } -} - -inline bool VerifyQuantizationDetailsVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types) { - if (!values || !types) return !values && !types; - if (values->size() != types->size()) return false; - for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { - if (!VerifyQuantizationDetails( - verifier, values->Get(i), types->GetEnum(i))) { - return false; - } - } - return true; -} - -inline void *QuantizationDetailsUnion::UnPack(const void *obj, QuantizationDetails type, const flatbuffers::resolver_function_t *resolver) { - switch (type) { - case QuantizationDetails_CustomQuantization: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - default: return nullptr; - } -} - -inline flatbuffers::Offset QuantizationDetailsUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const { - switch (type) { - case QuantizationDetails_CustomQuantization: { - auto ptr = reinterpret_cast(value); - return CreateCustomQuantization(_fbb, ptr, _rehasher).Union(); - } - default: return 0; - } -} - -inline QuantizationDetailsUnion::QuantizationDetailsUnion(const QuantizationDetailsUnion &u) FLATBUFFERS_NOEXCEPT : type(u.type), value(nullptr) { - switch (type) { - case QuantizationDetails_CustomQuantization: { - value = new tflite::CustomQuantizationT(*reinterpret_cast(u.value)); - break; - } - default: - break; - } -} - -inline void QuantizationDetailsUnion::Reset() { - switch (type) { - case QuantizationDetails_CustomQuantization: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - default: break; - } - value = nullptr; - type = QuantizationDetails_NONE; -} - -inline bool VerifySparseIndexVector(flatbuffers::Verifier &verifier, const void *obj, SparseIndexVector type) { - switch (type) { - case SparseIndexVector_NONE: { - return true; - } - case SparseIndexVector_Int32Vector: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case SparseIndexVector_Uint16Vector: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case SparseIndexVector_Uint8Vector: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - default: return true; - } -} - -inline bool VerifySparseIndexVectorVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types) { - if (!values || !types) return !values && !types; - if (values->size() != types->size()) return false; - for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { - if (!VerifySparseIndexVector( - verifier, values->Get(i), types->GetEnum(i))) { - return false; - } - } - return true; -} - -inline void *SparseIndexVectorUnion::UnPack(const void *obj, SparseIndexVector type, const flatbuffers::resolver_function_t *resolver) { - switch (type) { - case SparseIndexVector_Int32Vector: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case SparseIndexVector_Uint16Vector: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case SparseIndexVector_Uint8Vector: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - default: return nullptr; - } -} - -inline flatbuffers::Offset SparseIndexVectorUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const { - switch (type) { - case SparseIndexVector_Int32Vector: { - auto ptr = reinterpret_cast(value); - return CreateInt32Vector(_fbb, ptr, _rehasher).Union(); - } - case SparseIndexVector_Uint16Vector: { - auto ptr = reinterpret_cast(value); - return CreateUint16Vector(_fbb, ptr, _rehasher).Union(); - } - case SparseIndexVector_Uint8Vector: { - auto ptr = reinterpret_cast(value); - return CreateUint8Vector(_fbb, ptr, _rehasher).Union(); - } - default: return 0; - } -} - -inline SparseIndexVectorUnion::SparseIndexVectorUnion(const SparseIndexVectorUnion &u) FLATBUFFERS_NOEXCEPT : type(u.type), value(nullptr) { - switch (type) { - case SparseIndexVector_Int32Vector: { - value = new tflite::Int32VectorT(*reinterpret_cast(u.value)); - break; - } - case SparseIndexVector_Uint16Vector: { - value = new tflite::Uint16VectorT(*reinterpret_cast(u.value)); - break; - } - case SparseIndexVector_Uint8Vector: { - value = new tflite::Uint8VectorT(*reinterpret_cast(u.value)); - break; - } - default: - break; - } -} - -inline void SparseIndexVectorUnion::Reset() { - switch (type) { - case SparseIndexVector_Int32Vector: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case SparseIndexVector_Uint16Vector: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case SparseIndexVector_Uint8Vector: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - default: break; - } - value = nullptr; - type = SparseIndexVector_NONE; -} - -inline bool VerifyBuiltinOptions(flatbuffers::Verifier &verifier, const void *obj, BuiltinOptions type) { - switch (type) { - case BuiltinOptions_NONE: { - return true; - } - case BuiltinOptions_Conv2DOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_DepthwiseConv2DOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ConcatEmbeddingsOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_LSHProjectionOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_Pool2DOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SVDFOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_RNNOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_FullyConnectedOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SoftmaxOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ConcatenationOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_AddOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_L2NormOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_LocalResponseNormalizationOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_LSTMOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ResizeBilinearOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_CallOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ReshapeOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SkipGramOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SpaceToDepthOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_EmbeddingLookupSparseOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_MulOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_PadOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_GatherOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_BatchToSpaceNDOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SpaceToBatchNDOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_TransposeOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ReducerOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SubOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_DivOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SqueezeOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SequenceRNNOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_StridedSliceOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ExpOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_TopKV2Options: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SplitOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_LogSoftmaxOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_CastOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_DequantizeOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_MaximumMinimumOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ArgMaxOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_LessOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_NegOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_PadV2Options: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_GreaterOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_GreaterEqualOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_LessEqualOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SelectOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SliceOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_TransposeConvOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SparseToDenseOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_TileOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ExpandDimsOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_EqualOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_NotEqualOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ShapeOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_PowOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ArgMinOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_FakeQuantOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_PackOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_LogicalOrOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_OneHotOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_LogicalAndOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_LogicalNotOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_UnpackOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_FloorDivOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SquareOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ZerosLikeOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_FillOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_BidirectionalSequenceLSTMOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_BidirectionalSequenceRNNOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_UnidirectionalSequenceLSTMOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_FloorModOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_RangeOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ResizeNearestNeighborOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_LeakyReluOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SquaredDifferenceOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_MirrorPadOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_AbsOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SplitVOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_UniqueOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ReverseV2Options: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_AddNOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_GatherNdOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_CosOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_WhereOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_RankOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ReverseSequenceOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_MatrixDiagOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_QuantizeOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_MatrixSetDiagOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_HardSwishOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_IfOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_WhileOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_DepthToSpaceOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_NonMaxSuppressionV4Options: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_NonMaxSuppressionV5Options: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_ScatterNdOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SelectV2Options: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_DensifyOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_SegmentSumOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_BatchMatMulOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - case BuiltinOptions_CumsumOptions: { - auto ptr = reinterpret_cast(obj); - return verifier.VerifyTable(ptr); - } - default: return true; - } -} - -inline bool VerifyBuiltinOptionsVector(flatbuffers::Verifier &verifier, const flatbuffers::Vector> *values, const flatbuffers::Vector *types) { - if (!values || !types) return !values && !types; - if (values->size() != types->size()) return false; - for (flatbuffers::uoffset_t i = 0; i < values->size(); ++i) { - if (!VerifyBuiltinOptions( - verifier, values->Get(i), types->GetEnum(i))) { - return false; - } - } - return true; -} - -inline void *BuiltinOptionsUnion::UnPack(const void *obj, BuiltinOptions type, const flatbuffers::resolver_function_t *resolver) { - switch (type) { - case BuiltinOptions_Conv2DOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_DepthwiseConv2DOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ConcatEmbeddingsOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_LSHProjectionOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_Pool2DOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SVDFOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_RNNOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_FullyConnectedOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SoftmaxOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ConcatenationOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_AddOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_L2NormOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_LocalResponseNormalizationOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_LSTMOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ResizeBilinearOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_CallOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ReshapeOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SkipGramOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SpaceToDepthOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_EmbeddingLookupSparseOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_MulOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_PadOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_GatherOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_BatchToSpaceNDOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SpaceToBatchNDOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_TransposeOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ReducerOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SubOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_DivOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SqueezeOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SequenceRNNOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_StridedSliceOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ExpOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_TopKV2Options: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SplitOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_LogSoftmaxOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_CastOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_DequantizeOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_MaximumMinimumOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ArgMaxOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_LessOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_NegOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_PadV2Options: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_GreaterOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_GreaterEqualOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_LessEqualOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SelectOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SliceOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_TransposeConvOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SparseToDenseOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_TileOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ExpandDimsOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_EqualOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_NotEqualOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ShapeOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_PowOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ArgMinOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_FakeQuantOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_PackOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_LogicalOrOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_OneHotOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_LogicalAndOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_LogicalNotOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_UnpackOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_FloorDivOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SquareOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ZerosLikeOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_FillOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_BidirectionalSequenceLSTMOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_BidirectionalSequenceRNNOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_UnidirectionalSequenceLSTMOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_FloorModOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_RangeOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ResizeNearestNeighborOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_LeakyReluOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SquaredDifferenceOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_MirrorPadOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_AbsOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SplitVOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_UniqueOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ReverseV2Options: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_AddNOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_GatherNdOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_CosOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_WhereOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_RankOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ReverseSequenceOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_MatrixDiagOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_QuantizeOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_MatrixSetDiagOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_HardSwishOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_IfOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_WhileOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_DepthToSpaceOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_NonMaxSuppressionV4Options: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_NonMaxSuppressionV5Options: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_ScatterNdOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SelectV2Options: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_DensifyOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_SegmentSumOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_BatchMatMulOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - case BuiltinOptions_CumsumOptions: { - auto ptr = reinterpret_cast(obj); - return ptr->UnPack(resolver); - } - default: return nullptr; - } -} - -inline flatbuffers::Offset BuiltinOptionsUnion::Pack(flatbuffers::FlatBufferBuilder &_fbb, const flatbuffers::rehasher_function_t *_rehasher) const { - switch (type) { - case BuiltinOptions_Conv2DOptions: { - auto ptr = reinterpret_cast(value); - return CreateConv2DOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_DepthwiseConv2DOptions: { - auto ptr = reinterpret_cast(value); - return CreateDepthwiseConv2DOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ConcatEmbeddingsOptions: { - auto ptr = reinterpret_cast(value); - return CreateConcatEmbeddingsOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_LSHProjectionOptions: { - auto ptr = reinterpret_cast(value); - return CreateLSHProjectionOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_Pool2DOptions: { - auto ptr = reinterpret_cast(value); - return CreatePool2DOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SVDFOptions: { - auto ptr = reinterpret_cast(value); - return CreateSVDFOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_RNNOptions: { - auto ptr = reinterpret_cast(value); - return CreateRNNOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_FullyConnectedOptions: { - auto ptr = reinterpret_cast(value); - return CreateFullyConnectedOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SoftmaxOptions: { - auto ptr = reinterpret_cast(value); - return CreateSoftmaxOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ConcatenationOptions: { - auto ptr = reinterpret_cast(value); - return CreateConcatenationOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_AddOptions: { - auto ptr = reinterpret_cast(value); - return CreateAddOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_L2NormOptions: { - auto ptr = reinterpret_cast(value); - return CreateL2NormOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_LocalResponseNormalizationOptions: { - auto ptr = reinterpret_cast(value); - return CreateLocalResponseNormalizationOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_LSTMOptions: { - auto ptr = reinterpret_cast(value); - return CreateLSTMOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ResizeBilinearOptions: { - auto ptr = reinterpret_cast(value); - return CreateResizeBilinearOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_CallOptions: { - auto ptr = reinterpret_cast(value); - return CreateCallOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ReshapeOptions: { - auto ptr = reinterpret_cast(value); - return CreateReshapeOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SkipGramOptions: { - auto ptr = reinterpret_cast(value); - return CreateSkipGramOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SpaceToDepthOptions: { - auto ptr = reinterpret_cast(value); - return CreateSpaceToDepthOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_EmbeddingLookupSparseOptions: { - auto ptr = reinterpret_cast(value); - return CreateEmbeddingLookupSparseOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_MulOptions: { - auto ptr = reinterpret_cast(value); - return CreateMulOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_PadOptions: { - auto ptr = reinterpret_cast(value); - return CreatePadOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_GatherOptions: { - auto ptr = reinterpret_cast(value); - return CreateGatherOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_BatchToSpaceNDOptions: { - auto ptr = reinterpret_cast(value); - return CreateBatchToSpaceNDOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SpaceToBatchNDOptions: { - auto ptr = reinterpret_cast(value); - return CreateSpaceToBatchNDOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_TransposeOptions: { - auto ptr = reinterpret_cast(value); - return CreateTransposeOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ReducerOptions: { - auto ptr = reinterpret_cast(value); - return CreateReducerOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SubOptions: { - auto ptr = reinterpret_cast(value); - return CreateSubOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_DivOptions: { - auto ptr = reinterpret_cast(value); - return CreateDivOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SqueezeOptions: { - auto ptr = reinterpret_cast(value); - return CreateSqueezeOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SequenceRNNOptions: { - auto ptr = reinterpret_cast(value); - return CreateSequenceRNNOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_StridedSliceOptions: { - auto ptr = reinterpret_cast(value); - return CreateStridedSliceOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ExpOptions: { - auto ptr = reinterpret_cast(value); - return CreateExpOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_TopKV2Options: { - auto ptr = reinterpret_cast(value); - return CreateTopKV2Options(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SplitOptions: { - auto ptr = reinterpret_cast(value); - return CreateSplitOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_LogSoftmaxOptions: { - auto ptr = reinterpret_cast(value); - return CreateLogSoftmaxOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_CastOptions: { - auto ptr = reinterpret_cast(value); - return CreateCastOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_DequantizeOptions: { - auto ptr = reinterpret_cast(value); - return CreateDequantizeOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_MaximumMinimumOptions: { - auto ptr = reinterpret_cast(value); - return CreateMaximumMinimumOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ArgMaxOptions: { - auto ptr = reinterpret_cast(value); - return CreateArgMaxOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_LessOptions: { - auto ptr = reinterpret_cast(value); - return CreateLessOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_NegOptions: { - auto ptr = reinterpret_cast(value); - return CreateNegOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_PadV2Options: { - auto ptr = reinterpret_cast(value); - return CreatePadV2Options(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_GreaterOptions: { - auto ptr = reinterpret_cast(value); - return CreateGreaterOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_GreaterEqualOptions: { - auto ptr = reinterpret_cast(value); - return CreateGreaterEqualOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_LessEqualOptions: { - auto ptr = reinterpret_cast(value); - return CreateLessEqualOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SelectOptions: { - auto ptr = reinterpret_cast(value); - return CreateSelectOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SliceOptions: { - auto ptr = reinterpret_cast(value); - return CreateSliceOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_TransposeConvOptions: { - auto ptr = reinterpret_cast(value); - return CreateTransposeConvOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SparseToDenseOptions: { - auto ptr = reinterpret_cast(value); - return CreateSparseToDenseOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_TileOptions: { - auto ptr = reinterpret_cast(value); - return CreateTileOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ExpandDimsOptions: { - auto ptr = reinterpret_cast(value); - return CreateExpandDimsOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_EqualOptions: { - auto ptr = reinterpret_cast(value); - return CreateEqualOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_NotEqualOptions: { - auto ptr = reinterpret_cast(value); - return CreateNotEqualOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ShapeOptions: { - auto ptr = reinterpret_cast(value); - return CreateShapeOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_PowOptions: { - auto ptr = reinterpret_cast(value); - return CreatePowOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ArgMinOptions: { - auto ptr = reinterpret_cast(value); - return CreateArgMinOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_FakeQuantOptions: { - auto ptr = reinterpret_cast(value); - return CreateFakeQuantOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_PackOptions: { - auto ptr = reinterpret_cast(value); - return CreatePackOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_LogicalOrOptions: { - auto ptr = reinterpret_cast(value); - return CreateLogicalOrOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_OneHotOptions: { - auto ptr = reinterpret_cast(value); - return CreateOneHotOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_LogicalAndOptions: { - auto ptr = reinterpret_cast(value); - return CreateLogicalAndOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_LogicalNotOptions: { - auto ptr = reinterpret_cast(value); - return CreateLogicalNotOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_UnpackOptions: { - auto ptr = reinterpret_cast(value); - return CreateUnpackOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_FloorDivOptions: { - auto ptr = reinterpret_cast(value); - return CreateFloorDivOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SquareOptions: { - auto ptr = reinterpret_cast(value); - return CreateSquareOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ZerosLikeOptions: { - auto ptr = reinterpret_cast(value); - return CreateZerosLikeOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_FillOptions: { - auto ptr = reinterpret_cast(value); - return CreateFillOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_BidirectionalSequenceLSTMOptions: { - auto ptr = reinterpret_cast(value); - return CreateBidirectionalSequenceLSTMOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_BidirectionalSequenceRNNOptions: { - auto ptr = reinterpret_cast(value); - return CreateBidirectionalSequenceRNNOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_UnidirectionalSequenceLSTMOptions: { - auto ptr = reinterpret_cast(value); - return CreateUnidirectionalSequenceLSTMOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_FloorModOptions: { - auto ptr = reinterpret_cast(value); - return CreateFloorModOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_RangeOptions: { - auto ptr = reinterpret_cast(value); - return CreateRangeOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ResizeNearestNeighborOptions: { - auto ptr = reinterpret_cast(value); - return CreateResizeNearestNeighborOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_LeakyReluOptions: { - auto ptr = reinterpret_cast(value); - return CreateLeakyReluOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SquaredDifferenceOptions: { - auto ptr = reinterpret_cast(value); - return CreateSquaredDifferenceOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_MirrorPadOptions: { - auto ptr = reinterpret_cast(value); - return CreateMirrorPadOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_AbsOptions: { - auto ptr = reinterpret_cast(value); - return CreateAbsOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SplitVOptions: { - auto ptr = reinterpret_cast(value); - return CreateSplitVOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_UniqueOptions: { - auto ptr = reinterpret_cast(value); - return CreateUniqueOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ReverseV2Options: { - auto ptr = reinterpret_cast(value); - return CreateReverseV2Options(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_AddNOptions: { - auto ptr = reinterpret_cast(value); - return CreateAddNOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_GatherNdOptions: { - auto ptr = reinterpret_cast(value); - return CreateGatherNdOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_CosOptions: { - auto ptr = reinterpret_cast(value); - return CreateCosOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_WhereOptions: { - auto ptr = reinterpret_cast(value); - return CreateWhereOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_RankOptions: { - auto ptr = reinterpret_cast(value); - return CreateRankOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ReverseSequenceOptions: { - auto ptr = reinterpret_cast(value); - return CreateReverseSequenceOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_MatrixDiagOptions: { - auto ptr = reinterpret_cast(value); - return CreateMatrixDiagOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_QuantizeOptions: { - auto ptr = reinterpret_cast(value); - return CreateQuantizeOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_MatrixSetDiagOptions: { - auto ptr = reinterpret_cast(value); - return CreateMatrixSetDiagOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_HardSwishOptions: { - auto ptr = reinterpret_cast(value); - return CreateHardSwishOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_IfOptions: { - auto ptr = reinterpret_cast(value); - return CreateIfOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_WhileOptions: { - auto ptr = reinterpret_cast(value); - return CreateWhileOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_DepthToSpaceOptions: { - auto ptr = reinterpret_cast(value); - return CreateDepthToSpaceOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_NonMaxSuppressionV4Options: { - auto ptr = reinterpret_cast(value); - return CreateNonMaxSuppressionV4Options(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_NonMaxSuppressionV5Options: { - auto ptr = reinterpret_cast(value); - return CreateNonMaxSuppressionV5Options(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_ScatterNdOptions: { - auto ptr = reinterpret_cast(value); - return CreateScatterNdOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SelectV2Options: { - auto ptr = reinterpret_cast(value); - return CreateSelectV2Options(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_DensifyOptions: { - auto ptr = reinterpret_cast(value); - return CreateDensifyOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_SegmentSumOptions: { - auto ptr = reinterpret_cast(value); - return CreateSegmentSumOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_BatchMatMulOptions: { - auto ptr = reinterpret_cast(value); - return CreateBatchMatMulOptions(_fbb, ptr, _rehasher).Union(); - } - case BuiltinOptions_CumsumOptions: { - auto ptr = reinterpret_cast(value); - return CreateCumsumOptions(_fbb, ptr, _rehasher).Union(); - } - default: return 0; - } -} - -inline BuiltinOptionsUnion::BuiltinOptionsUnion(const BuiltinOptionsUnion &u) FLATBUFFERS_NOEXCEPT : type(u.type), value(nullptr) { - switch (type) { - case BuiltinOptions_Conv2DOptions: { - value = new tflite::Conv2DOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_DepthwiseConv2DOptions: { - value = new tflite::DepthwiseConv2DOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ConcatEmbeddingsOptions: { - value = new tflite::ConcatEmbeddingsOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_LSHProjectionOptions: { - value = new tflite::LSHProjectionOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_Pool2DOptions: { - value = new tflite::Pool2DOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SVDFOptions: { - value = new tflite::SVDFOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_RNNOptions: { - value = new tflite::RNNOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_FullyConnectedOptions: { - value = new tflite::FullyConnectedOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SoftmaxOptions: { - value = new tflite::SoftmaxOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ConcatenationOptions: { - value = new tflite::ConcatenationOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_AddOptions: { - value = new tflite::AddOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_L2NormOptions: { - value = new tflite::L2NormOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_LocalResponseNormalizationOptions: { - value = new tflite::LocalResponseNormalizationOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_LSTMOptions: { - value = new tflite::LSTMOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ResizeBilinearOptions: { - value = new tflite::ResizeBilinearOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_CallOptions: { - value = new tflite::CallOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ReshapeOptions: { - value = new tflite::ReshapeOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SkipGramOptions: { - value = new tflite::SkipGramOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SpaceToDepthOptions: { - value = new tflite::SpaceToDepthOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_EmbeddingLookupSparseOptions: { - value = new tflite::EmbeddingLookupSparseOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_MulOptions: { - value = new tflite::MulOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_PadOptions: { - value = new tflite::PadOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_GatherOptions: { - value = new tflite::GatherOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_BatchToSpaceNDOptions: { - value = new tflite::BatchToSpaceNDOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SpaceToBatchNDOptions: { - value = new tflite::SpaceToBatchNDOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_TransposeOptions: { - value = new tflite::TransposeOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ReducerOptions: { - value = new tflite::ReducerOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SubOptions: { - value = new tflite::SubOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_DivOptions: { - value = new tflite::DivOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SqueezeOptions: { - value = new tflite::SqueezeOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SequenceRNNOptions: { - value = new tflite::SequenceRNNOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_StridedSliceOptions: { - value = new tflite::StridedSliceOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ExpOptions: { - value = new tflite::ExpOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_TopKV2Options: { - value = new tflite::TopKV2OptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SplitOptions: { - value = new tflite::SplitOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_LogSoftmaxOptions: { - value = new tflite::LogSoftmaxOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_CastOptions: { - value = new tflite::CastOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_DequantizeOptions: { - value = new tflite::DequantizeOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_MaximumMinimumOptions: { - value = new tflite::MaximumMinimumOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ArgMaxOptions: { - value = new tflite::ArgMaxOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_LessOptions: { - value = new tflite::LessOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_NegOptions: { - value = new tflite::NegOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_PadV2Options: { - value = new tflite::PadV2OptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_GreaterOptions: { - value = new tflite::GreaterOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_GreaterEqualOptions: { - value = new tflite::GreaterEqualOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_LessEqualOptions: { - value = new tflite::LessEqualOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SelectOptions: { - value = new tflite::SelectOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SliceOptions: { - value = new tflite::SliceOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_TransposeConvOptions: { - value = new tflite::TransposeConvOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SparseToDenseOptions: { - value = new tflite::SparseToDenseOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_TileOptions: { - value = new tflite::TileOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ExpandDimsOptions: { - value = new tflite::ExpandDimsOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_EqualOptions: { - value = new tflite::EqualOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_NotEqualOptions: { - value = new tflite::NotEqualOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ShapeOptions: { - value = new tflite::ShapeOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_PowOptions: { - value = new tflite::PowOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ArgMinOptions: { - value = new tflite::ArgMinOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_FakeQuantOptions: { - value = new tflite::FakeQuantOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_PackOptions: { - value = new tflite::PackOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_LogicalOrOptions: { - value = new tflite::LogicalOrOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_OneHotOptions: { - value = new tflite::OneHotOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_LogicalAndOptions: { - value = new tflite::LogicalAndOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_LogicalNotOptions: { - value = new tflite::LogicalNotOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_UnpackOptions: { - value = new tflite::UnpackOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_FloorDivOptions: { - value = new tflite::FloorDivOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SquareOptions: { - value = new tflite::SquareOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ZerosLikeOptions: { - value = new tflite::ZerosLikeOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_FillOptions: { - value = new tflite::FillOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_BidirectionalSequenceLSTMOptions: { - value = new tflite::BidirectionalSequenceLSTMOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_BidirectionalSequenceRNNOptions: { - value = new tflite::BidirectionalSequenceRNNOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_UnidirectionalSequenceLSTMOptions: { - value = new tflite::UnidirectionalSequenceLSTMOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_FloorModOptions: { - value = new tflite::FloorModOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_RangeOptions: { - value = new tflite::RangeOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ResizeNearestNeighborOptions: { - value = new tflite::ResizeNearestNeighborOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_LeakyReluOptions: { - value = new tflite::LeakyReluOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SquaredDifferenceOptions: { - value = new tflite::SquaredDifferenceOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_MirrorPadOptions: { - value = new tflite::MirrorPadOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_AbsOptions: { - value = new tflite::AbsOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SplitVOptions: { - value = new tflite::SplitVOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_UniqueOptions: { - value = new tflite::UniqueOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ReverseV2Options: { - value = new tflite::ReverseV2OptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_AddNOptions: { - value = new tflite::AddNOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_GatherNdOptions: { - value = new tflite::GatherNdOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_CosOptions: { - value = new tflite::CosOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_WhereOptions: { - value = new tflite::WhereOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_RankOptions: { - value = new tflite::RankOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ReverseSequenceOptions: { - value = new tflite::ReverseSequenceOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_MatrixDiagOptions: { - value = new tflite::MatrixDiagOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_QuantizeOptions: { - value = new tflite::QuantizeOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_MatrixSetDiagOptions: { - value = new tflite::MatrixSetDiagOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_HardSwishOptions: { - value = new tflite::HardSwishOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_IfOptions: { - value = new tflite::IfOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_WhileOptions: { - value = new tflite::WhileOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_DepthToSpaceOptions: { - value = new tflite::DepthToSpaceOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_NonMaxSuppressionV4Options: { - value = new tflite::NonMaxSuppressionV4OptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_NonMaxSuppressionV5Options: { - value = new tflite::NonMaxSuppressionV5OptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_ScatterNdOptions: { - value = new tflite::ScatterNdOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SelectV2Options: { - value = new tflite::SelectV2OptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_DensifyOptions: { - value = new tflite::DensifyOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_SegmentSumOptions: { - value = new tflite::SegmentSumOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_BatchMatMulOptions: { - value = new tflite::BatchMatMulOptionsT(*reinterpret_cast(u.value)); - break; - } - case BuiltinOptions_CumsumOptions: { - value = new tflite::CumsumOptionsT(*reinterpret_cast(u.value)); - break; - } - default: - break; - } -} - -inline void BuiltinOptionsUnion::Reset() { - switch (type) { - case BuiltinOptions_Conv2DOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_DepthwiseConv2DOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ConcatEmbeddingsOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_LSHProjectionOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_Pool2DOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SVDFOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_RNNOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_FullyConnectedOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SoftmaxOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ConcatenationOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_AddOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_L2NormOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_LocalResponseNormalizationOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_LSTMOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ResizeBilinearOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_CallOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ReshapeOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SkipGramOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SpaceToDepthOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_EmbeddingLookupSparseOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_MulOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_PadOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_GatherOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_BatchToSpaceNDOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SpaceToBatchNDOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_TransposeOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ReducerOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SubOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_DivOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SqueezeOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SequenceRNNOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_StridedSliceOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ExpOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_TopKV2Options: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SplitOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_LogSoftmaxOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_CastOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_DequantizeOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_MaximumMinimumOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ArgMaxOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_LessOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_NegOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_PadV2Options: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_GreaterOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_GreaterEqualOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_LessEqualOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SelectOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SliceOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_TransposeConvOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SparseToDenseOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_TileOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ExpandDimsOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_EqualOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_NotEqualOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ShapeOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_PowOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ArgMinOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_FakeQuantOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_PackOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_LogicalOrOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_OneHotOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_LogicalAndOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_LogicalNotOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_UnpackOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_FloorDivOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SquareOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ZerosLikeOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_FillOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_BidirectionalSequenceLSTMOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_BidirectionalSequenceRNNOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_UnidirectionalSequenceLSTMOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_FloorModOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_RangeOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ResizeNearestNeighborOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_LeakyReluOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SquaredDifferenceOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_MirrorPadOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_AbsOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SplitVOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_UniqueOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ReverseV2Options: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_AddNOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_GatherNdOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_CosOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_WhereOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_RankOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ReverseSequenceOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_MatrixDiagOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_QuantizeOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_MatrixSetDiagOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_HardSwishOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_IfOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_WhileOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_DepthToSpaceOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_NonMaxSuppressionV4Options: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_NonMaxSuppressionV5Options: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_ScatterNdOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SelectV2Options: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_DensifyOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_SegmentSumOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_BatchMatMulOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - case BuiltinOptions_CumsumOptions: { - auto ptr = reinterpret_cast(value); - delete ptr; - break; - } - default: break; - } - value = nullptr; - type = BuiltinOptions_NONE; -} - -inline const tflite::Model *GetModel(const void *buf) { - return flatbuffers::GetRoot(buf); -} - -inline const tflite::Model *GetSizePrefixedModel(const void *buf) { - return flatbuffers::GetSizePrefixedRoot(buf); -} - -inline const char *ModelIdentifier() { - return "TFL3"; -} - -inline bool ModelBufferHasIdentifier(const void *buf) { - return flatbuffers::BufferHasIdentifier( - buf, ModelIdentifier()); -} - -inline bool VerifyModelBuffer( - flatbuffers::Verifier &verifier) { - return verifier.VerifyBuffer(ModelIdentifier()); -} - -inline bool VerifySizePrefixedModelBuffer( - flatbuffers::Verifier &verifier) { - return verifier.VerifySizePrefixedBuffer(ModelIdentifier()); -} - -inline const char *ModelExtension() { - return "tflite"; -} - -inline void FinishModelBuffer( - flatbuffers::FlatBufferBuilder &fbb, - flatbuffers::Offset root) { - fbb.Finish(root, ModelIdentifier()); -} - -inline void FinishSizePrefixedModelBuffer( - flatbuffers::FlatBufferBuilder &fbb, - flatbuffers::Offset root) { - fbb.FinishSizePrefixed(root, ModelIdentifier()); -} - -inline std::unique_ptr UnPackModel( - const void *buf, - const flatbuffers::resolver_function_t *res = nullptr) { - return std::unique_ptr(GetModel(buf)->UnPack(res)); -} - -inline std::unique_ptr UnPackSizePrefixedModel( - const void *buf, - const flatbuffers::resolver_function_t *res = nullptr) { - return std::unique_ptr(GetSizePrefixedModel(buf)->UnPack(res)); -} - -} // namespace tflite - -#endif // FLATBUFFERS_GENERATED_SCHEMA_TFLITE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/schema/schema_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/schema/schema_utils.h deleted file mode 100644 index 315a8d0..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/schema/schema_utils.h +++ /dev/null @@ -1,49 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_SCHEMA_SCHEMA_UTILS_H_ -#define TENSORFLOW_LITE_SCHEMA_SCHEMA_UTILS_H_ - -#include "flatbuffers/flatbuffers.h" -#include "tensorflow/lite/schema/schema_generated.h" - -namespace tflite { - -// The following methods are introduced to resolve op builtin code shortage -// problem. The new builtin opreator will be assigned to the extended builtin -// code field in the flatbuffer schema. Those methods helps to hide builtin code -// details. -BuiltinOperator GetBuiltinCode(const OperatorCode *op_code); - -BuiltinOperator GetBuiltinCode(const OperatorCodeT *op_code); - -int8_t ConvertBuiltinCodeToDeprecatedBuiltinCode( - const BuiltinOperator builtin_code); - -// The following methods are for backward compatibility for the early version -// three, which does not have an extended builtin code. -flatbuffers::Offset CreateOperatorCode( - flatbuffers::FlatBufferBuilder &_fbb, - BuiltinOperator builtin_code = BuiltinOperator_ADD, - flatbuffers::Offset custom_code = 0, - int32_t version = 1); - -flatbuffers::Offset CreateOperatorCodeDirect( - flatbuffers::FlatBufferBuilder &_fbb, - BuiltinOperator builtin_code = BuiltinOperator_ADD, - const char *custom_code = nullptr, int32_t version = 1); - -} // namespace tflite - -#endif // TENSORFLOW_LITE_SCHEMA_SCHEMA_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/shared_library.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/shared_library.h deleted file mode 100644 index a7bd91b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/shared_library.h +++ /dev/null @@ -1,63 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_SHARED_LIBRARY_H_ -#define TENSORFLOW_LITE_SHARED_LIBRARY_H_ - -#if defined(_WIN32) -// Windows does not have dlfcn.h/dlsym, use GetProcAddress() instead. -#include -#else -#include -#endif // defined(_WIN32) - -namespace tflite { - -// SharedLibrary provides a uniform set of APIs across different platforms to -// handle dynamic library operations -class SharedLibrary { - public: -#if defined(_WIN32) - static inline void* LoadLibrary(const char* lib) { - return ::LoadLibrary(lib); - } - static inline void* GetLibrarySymbol(void* handle, const char* symbol) { - return reinterpret_cast( - GetProcAddress(static_cast(handle), symbol)); - } - static inline void* GetSymbol(const char* symbol) { - return reinterpret_cast(GetProcAddress(nullptr, symbol)); - } - static inline int UnLoadLibrary(void* handle) { - return FreeLibrary(static_cast(handle)); - } - static inline const char* GetError() { return "Unknown"; } -#else - static inline void* LoadLibrary(const char* lib) { - return dlopen(lib, RTLD_LAZY | RTLD_LOCAL); - } - static inline void* GetLibrarySymbol(void* handle, const char* symbol) { - return dlsym(handle, symbol); - } - static inline void* GetSymbol(const char* symbol) { - return dlsym(RTLD_DEFAULT, symbol); - } - static inline int UnLoadLibrary(void* handle) { return dlclose(handle); } - static inline const char* GetError() { return dlerror(); } -#endif // defined(_WIN32) -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_SHARED_LIBRARY_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/simple_memory_arena.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/simple_memory_arena.h deleted file mode 100644 index 803b8be..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/simple_memory_arena.h +++ /dev/null @@ -1,120 +0,0 @@ -/* Copyright 2017 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_SIMPLE_MEMORY_ARENA_H_ -#define TENSORFLOW_LITE_SIMPLE_MEMORY_ARENA_H_ - -#include -#include -#include - -#include "tensorflow/lite/c/common.h" - -namespace tflite { - -// This little structure holds the offset and the size for a dynamic memory -// allocation in the memory arena as well as first_node and last_node that use -// corresponding tensor. It means that continuous part of memory with this size -// needs to be allocated before execution of operation in the first node and can -// be deallocated after execution of the operation in the last_node. When the -// arena is committed and the underlying buffer is set, the alloc can be -// resolved into an actual memory pointer. -struct ArenaAllocWithUsageInterval { - ArenaAllocWithUsageInterval() { reset(); } - - size_t offset; - size_t size; - int32_t tensor; - int32_t first_node; - int32_t last_node; - - inline void reset() { - offset = 0; - size = 0; - tensor = -1; - first_node = -1; - last_node = -1; - } - - inline bool operator<(const ArenaAllocWithUsageInterval& other) const { - return offset < other.offset; - } -}; - -// This small class is responsible for allocating, deallocating and reusing -// dynamic memory from a common underlying buffer. The arena can be used in -// scenarios when the pattern of memory allocations and deallocations is -// repetitive, e.g. running NN inference in multiple iterations. Note that -// zero-sized allocations are explicitly allowed, and will resolve to null. -class SimpleMemoryArena { - public: - explicit SimpleMemoryArena(size_t arena_alignment) - : committed_(false), - arena_alignment_(arena_alignment), - high_water_mark_(0), - underlying_buffer_size_(0), - ordered_allocs_() {} - - // Schedule memory allocation for a tensor with a given size, assuming that it - // needs to be allocated before the execution of first_node, and deallocated - // after the execution of last_node. - TfLiteStatus Allocate(TfLiteContext* context, size_t alignment, size_t size, - int32_t tensor, int32_t first_node, int32_t last_node, - ArenaAllocWithUsageInterval* new_alloc); - - TfLiteStatus Deallocate(TfLiteContext* context, - const ArenaAllocWithUsageInterval& alloc); - - inline size_t RequiredBufferSize() { - // Add in a small amount of padding to reduce the chance of resize events - // for small allocations. - size_t padding = arena_alignment_; - return arena_alignment_ + high_water_mark_ + padding; - } - - TfLiteStatus Commit(TfLiteContext* context); - - TfLiteStatus ResolveAlloc(TfLiteContext* context, - const ArenaAllocWithUsageInterval& alloc, - char** output_ptr); - - // This clears allocation details but does not release the underlying buffer. - // New allocations should be committed & resolved before using this arena - // again. - TfLiteStatus ClearPlan(); - - // This releases the underlying buffer but does not clear the allocation plan. - // Since all associated pointers are invalidated, the arena cannot be used - // again until Commit() is called & tensor allocations are resolved. - TfLiteStatus ReleaseBuffer(); - - size_t GetBufferSize() { return underlying_buffer_size_; } - - std::intptr_t BasePointer() const { - return reinterpret_cast(underlying_buffer_aligned_ptr_); - } - - private: - bool committed_; - size_t arena_alignment_; - size_t high_water_mark_; - std::unique_ptr underlying_buffer_; - size_t underlying_buffer_size_; - char* underlying_buffer_aligned_ptr_; - std::vector ordered_allocs_; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_SIMPLE_MEMORY_ARENA_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/stateful_error_reporter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/stateful_error_reporter.h deleted file mode 100644 index cf66934..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/stateful_error_reporter.h +++ /dev/null @@ -1,34 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_STATEFUL_ERROR_REPORTER_H_ -#define TENSORFLOW_LITE_STATEFUL_ERROR_REPORTER_H_ - -#include - -#include "tensorflow/lite/core/api/error_reporter.h" - -namespace tflite { - -// Similar to tflite::ErrorReporter, except that it allows callers to get the -// last error message. -class StatefulErrorReporter : public ErrorReporter { - public: - // Returns last error message. Returns empty string if no error is reported. - virtual std::string message() = 0; -}; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_STATEFUL_ERROR_REPORTER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/stderr_reporter.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/stderr_reporter.h deleted file mode 100644 index de8644c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/stderr_reporter.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2017 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_STDERR_REPORTER_H_ -#define TENSORFLOW_LITE_STDERR_REPORTER_H_ - -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/core/api/error_reporter.h" - -namespace tflite { - -// An error reporter that simply writes the message to stderr. -struct StderrReporter : public ErrorReporter { - int Report(const char* format, va_list args) override; -}; - -// Return the default error reporter (output to stderr). -ErrorReporter* DefaultErrorReporter(); - -} // namespace tflite - -#endif // TENSORFLOW_LITE_STDERR_REPORTER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/string_type.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/string_type.h deleted file mode 100644 index f5a7f83..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/string_type.h +++ /dev/null @@ -1,27 +0,0 @@ -/* Copyright 2017 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. -==============================================================================*/ -// Abstract string. We don't want even absl at this level. -#ifndef TENSORFLOW_LITE_STRING_TYPE_H_ -#define TENSORFLOW_LITE_STRING_TYPE_H_ - -#include - -namespace tflite { - -using std::string; - -} // namespace tflite - -#endif // TENSORFLOW_LITE_STRING_TYPE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/string_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/string_util.h deleted file mode 100644 index b8f3fcd..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/string_util.h +++ /dev/null @@ -1,106 +0,0 @@ -/* Copyright 2017 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. -==============================================================================*/ - -// Util methods to read and write String tensors. -// String tensors are considered to be char tensor with protocol. -// [0, 3] 4 bytes: N, num of strings in the tensor in little endian. -// [(i+1)*4, (i+1)*4+3] 4 bytes: offset of i-th string in little endian, -// for i from 0 to N-1. -// [(N+1)*4, (N+1)*4+3] 4 bytes: length of the whole char buffer. -// [offset(i), offset(i+1) - 1] : content of i-th string. -// Example of a string tensor: -// [ -// 2, 0, 0, 0, # 2 strings. -// 16, 0, 0, 0, # 0-th string starts from index 16. -// 18, 0, 0, 0, # 1-st string starts from index 18. -// 18, 0, 0, 0, # total length of array. -// 'A', 'B', # 0-th string [16..17]: "AB" -// ] # 1-th string, empty -// -// A typical usage: -// In op.Eval(context, node): -// DynamicBuffer buf; -// # Add string "AB" to tensor, string is stored in dynamic buffer. -// buf.AddString("AB", 2); -// # Write content of DynamicBuffer to tensor in format of string tensor -// # described above. -// buf.WriteToTensor(tensor, nullptr) - -#ifndef TENSORFLOW_LITE_STRING_UTIL_H_ -#define TENSORFLOW_LITE_STRING_UTIL_H_ - -#include - -#include "tensorflow/lite/c/common.h" -#include "tensorflow/lite/string_type.h" - -namespace tflite { - -// Convenient structure to store string pointer and length. -typedef struct { - const char* str; - int len; -} StringRef; - -// DynamicBuffer holds temporary buffer that will be used to create a dynamic -// tensor. A typical usage is to initialize a DynamicBuffer object, fill in -// content and call CreateStringTensor in op.Eval(). -class DynamicBuffer { - public: - DynamicBuffer() : offset_({0}) {} - - // Add string to dynamic buffer by resizing the buffer and copying the data. - void AddString(const StringRef& string); - - // Add string to dynamic buffer by resizing the buffer and copying the data. - void AddString(const char* str, size_t len); - - // Join a list of string with separator, and add as a single string to the - // buffer. - void AddJoinedString(const std::vector& strings, char separator); - void AddJoinedString(const std::vector& strings, - StringRef separator); - - // Fill content into a buffer and returns the number of bytes stored. - // The function allocates space for the buffer but does NOT take ownership. - int WriteToBuffer(char** buffer); - - // Fill content into a string tensor, with the given new_shape. The new shape - // must match the number of strings in this object. Caller relinquishes - // ownership of new_shape. If 'new_shape' is nullptr, keep the tensor's - // existing shape. - void WriteToTensor(TfLiteTensor* tensor, TfLiteIntArray* new_shape); - - // Fill content into a string tensor. Set shape to {num_strings}. - void WriteToTensorAsVector(TfLiteTensor* tensor); - - private: - // Data buffer to store contents of strings, not including headers. - std::vector data_; - // Offset of the starting index of each string in data buffer. - std::vector offset_; -}; - -// Return num of strings in a String tensor. -int GetStringCount(const void* raw_buffer); -int GetStringCount(const TfLiteTensor* tensor); - -// Get String pointer and length of index-th string in tensor. -// NOTE: This will not create a copy of string data. -StringRef GetString(const void* raw_buffer, int string_index); -StringRef GetString(const TfLiteTensor* tensor, int string_index); -} // namespace tflite - -#endif // TENSORFLOW_LITE_STRING_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/tflite_with_xnnpack_optional.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/tflite_with_xnnpack_optional.h deleted file mode 100644 index afbdbd1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/tflite_with_xnnpack_optional.h +++ /dev/null @@ -1,26 +0,0 @@ -/* 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. -==============================================================================*/ -#ifndef TENSORFLOW_LITE_TFLITE_WITH_XNNPACK_OPTIONAL_H_ -#define TENSORFLOW_LITE_TFLITE_WITH_XNNPACK_OPTIONAL_H_ -#include - -#include "tensorflow/lite/c/common.h" - -namespace tflite { -std::unique_ptr -MaybeCreateXNNPACKDelegate(int num_threads); -} // namespace tflite - -#endif // TENSORFLOW_LITE_TFLITE_WITH_XNNPACK_OPTIONAL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/allocate_transient_arrays.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/allocate_transient_arrays.h deleted file mode 100644 index 5d43d4c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/allocate_transient_arrays.h +++ /dev/null @@ -1,44 +0,0 @@ -/* Copyright 2017 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_TOCO_ALLOCATE_TRANSIENT_ARRAYS_H_ -#define TENSORFLOW_LITE_TOCO_ALLOCATE_TRANSIENT_ARRAYS_H_ - -#include "tensorflow/lite/toco/model.h" - -namespace toco { - -// We align the allocated sizes to the next multiple of a cache line, -// to get simple performance characteristics without side effects of -// accesses to one buffer on accesses to another buffer. -// That also takes care of data type alignment for any reasonable type -// (no reasonable data type should have alignment greater than a cache line). -// Here we make CPU-centric assumptions, in particular, we assume 64-byte cache -// lines. Getting this wrong by a factor of 2x (if this ever changes) wouldn't -// be terrible. -// Embedded architectures may use a different value for alignment. -constexpr std::size_t kDefaultTransientDataAlignment = 64; - -// Rounds up dividend to a value divisible by divisor. -inline std::size_t RoundUpToNextMultipleOf(std::size_t dividend, - std::size_t divisor) { - return ((dividend + divisor - 1) / divisor) * divisor; -} - -void AllocateTransientArrays(Model* model, - std::size_t transient_data_alignment); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_ALLOCATE_TRANSIENT_ARRAYS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/args.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/args.h deleted file mode 100644 index e1fe209..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/args.h +++ /dev/null @@ -1,196 +0,0 @@ -/* Copyright 2017 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. -==============================================================================*/ -// This abstracts command line arguments in toco. -// Arg is a parseable type that can register a default value, be able to -// parse itself, and keep track of whether it was specified. -#ifndef TENSORFLOW_LITE_TOCO_ARGS_H_ -#define TENSORFLOW_LITE_TOCO_ARGS_H_ - -#include -#include -#include -#include "tensorflow/lite/toco/toco_port.h" -#include "absl/strings/numbers.h" -#include "absl/strings/str_split.h" -#include "tensorflow/lite/toco/toco_types.h" - -namespace toco { - -// Since std::vector is in the std namespace, and we are not allowed -// to add ParseFlag/UnparseFlag to std, we introduce a simple wrapper type -// to use as the flag type: -struct IntList { - std::vector elements; -}; -struct StringMapList { - std::vector> elements; -}; - -// command_line_flags.h don't track whether or not a flag is specified. Arg -// contains the value (which will be default if not specified) and also -// whether the flag is specified. -// TODO(aselle): consider putting doc string and ability to construct the -// tensorflow argument into this, so declaration of parameters can be less -// distributed. -// Every template specialization of Arg is required to implement -// default_value(), specified(), value(), parse(), bind(). -template -class Arg final { - public: - explicit Arg(T default_ = T()) : value_(default_) {} - virtual ~Arg() {} - - // Provide default_value() to arg list - T default_value() const { return value_; } - // Return true if the command line argument was specified on the command line. - bool specified() const { return specified_; } - // Const reference to parsed value. - const T& value() const { return value_; } - - // Parsing callback for the tensorflow::Flags code - bool Parse(T value_in) { - value_ = value_in; - specified_ = true; - return true; - } - - // Bind the parse member function so tensorflow::Flags can call it. - std::function bind() { - return std::bind(&Arg::Parse, this, std::placeholders::_1); - } - - private: - // Becomes true after parsing if the value was specified - bool specified_ = false; - // Value of the argument (initialized to the default in the constructor). - T value_; -}; - -template <> -class Arg final { - public: - // Provide default_value() to arg list - std::string default_value() const { return ""; } - // Return true if the command line argument was specified on the command line. - bool specified() const { return specified_; } - // Bind the parse member function so tensorflow::Flags can call it. - bool Parse(std::string text); - - std::function bind() { - return std::bind(&Arg::Parse, this, std::placeholders::_1); - } - - const toco::IntList& value() const { return parsed_value_; } - - private: - toco::IntList parsed_value_; - bool specified_ = false; -}; - -template <> -class Arg final { - public: - // Provide default_value() to StringMapList - std::string default_value() const { return ""; } - // Return true if the command line argument was specified on the command line. - bool specified() const { return specified_; } - // Bind the parse member function so tensorflow::Flags can call it. - - bool Parse(std::string text); - - std::function bind() { - return std::bind(&Arg::Parse, this, std::placeholders::_1); - } - - const toco::StringMapList& value() const { return parsed_value_; } - - private: - toco::StringMapList parsed_value_; - bool specified_ = false; -}; - -// Flags that describe a model. See model_cmdline_flags.cc for details. -struct ParsedModelFlags { - Arg input_array; - Arg input_arrays; - Arg output_array; - Arg output_arrays; - Arg input_shapes; - Arg batch_size = Arg(1); - Arg mean_value = Arg(0.f); - Arg mean_values; - Arg std_value = Arg(1.f); - Arg std_values; - Arg input_data_type; - Arg input_data_types; - Arg variable_batch = Arg(false); - Arg input_shape; - Arg rnn_states; - Arg model_checks; - Arg change_concat_input_ranges = Arg(true); - // Debugging output options. - // TODO(benoitjacob): these shouldn't be ModelFlags. - Arg graphviz_first_array; - Arg graphviz_last_array; - Arg dump_graphviz; - Arg dump_graphviz_video = Arg(false); - Arg conversion_summary_dir; - Arg allow_nonexistent_arrays = Arg(false); - Arg allow_nonascii_arrays = Arg(false); - Arg arrays_extra_info_file; - Arg model_flags_file; -}; - -// Flags that describe the operation you would like to do (what conversion -// you want). See toco_cmdline_flags.cc for details. -struct ParsedTocoFlags { - Arg input_file; - Arg savedmodel_directory; - Arg output_file; - Arg input_format = Arg("TENSORFLOW_GRAPHDEF"); - Arg output_format = Arg("TFLITE"); - Arg savedmodel_tagset; - // TODO(aselle): command_line_flags doesn't support doubles - Arg default_ranges_min = Arg(0.); - Arg default_ranges_max = Arg(0.); - Arg default_int16_ranges_min = Arg(0.); - Arg default_int16_ranges_max = Arg(0.); - Arg inference_type; - Arg inference_input_type; - Arg drop_fake_quant = Arg(false); - Arg reorder_across_fake_quant = Arg(false); - Arg allow_custom_ops = Arg(false); - Arg allow_dynamic_tensors = Arg(true); - Arg custom_opdefs; - Arg post_training_quantize = Arg(false); - Arg quantize_to_float16 = Arg(false); - // Deprecated flags - Arg quantize_weights = Arg(false); - Arg input_type; - Arg input_types; - Arg debug_disable_recurrent_cell_fusion = Arg(false); - Arg drop_control_dependency = Arg(false); - Arg propagate_fake_quant_num_bits = Arg(false); - Arg allow_nudging_weights_to_use_fast_gemm_kernel = Arg(false); - Arg dedupe_array_min_size_bytes = Arg(64); - Arg split_tflite_lstm_inputs = Arg(true); - // WARNING: Experimental interface, subject to change - Arg enable_select_tf_ops = Arg(false); - // WARNING: Experimental interface, subject to change - Arg force_select_tf_ops = Arg(false); -}; - -} // namespace toco -#endif // TENSORFLOW_LITE_TOCO_ARGS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/dump_graphviz.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/dump_graphviz.h deleted file mode 100644 index 0e84789..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/dump_graphviz.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2017 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_TOCO_DUMP_GRAPHVIZ_H_ -#define TENSORFLOW_LITE_TOCO_DUMP_GRAPHVIZ_H_ - -#include - -#include "tensorflow/lite/toco/model.h" - -namespace toco { - -void DumpGraphviz(const Model& model, std::string* output_file_contents, - const std::string& graph_name); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_DUMP_GRAPHVIZ_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/export_tensorflow.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/export_tensorflow.h deleted file mode 100644 index bc7ccd8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/export_tensorflow.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright 2017 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_TOCO_EXPORT_TENSORFLOW_H_ -#define TENSORFLOW_LITE_TOCO_EXPORT_TENSORFLOW_H_ - -#include -#include "tensorflow/lite/toco/model.h" - -namespace toco { - -void ExportTensorFlowGraphDef(const Model& model, - std::string* output_file_contents); - -void EncodeConstantArraysMinMaxByWrappingThemInFakeQuantNodes(Model* model); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_EXPORT_TENSORFLOW_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/format_port.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/format_port.h deleted file mode 100644 index 47d3906..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/format_port.h +++ /dev/null @@ -1,71 +0,0 @@ -/* Copyright 2017 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. -==============================================================================*/ -// This file is used to provide equivalents of internal absl::FormatF -// and absl::StrAppendFormat. Unfortunately, type safety is not as good as a -// a full C++ example. -// TODO(aselle): When absl adds support for StrFormat, use that instead. -#ifndef TENSORFLOW_LITE_TOCO_FORMAT_PORT_H_ -#define TENSORFLOW_LITE_TOCO_FORMAT_PORT_H_ - -#include "tensorflow/lite/toco/toco_types.h" -#include "tensorflow/core/lib/strings/stringprintf.h" - -namespace toco { -namespace port { - -/// Identity (default case) -template -T IdentityOrConvertStringToRaw(T foo) { - return foo; -} - -// Overloaded case where we return std::string. -inline const char* IdentityOrConvertStringToRaw(const std::string& foo) { - return foo.c_str(); -} - -// Delegate to TensorFlow Appendf function until absl has an equivalent. -template -inline void AppendFHelper(std::string* destination, const char* fmt, - Args&&... args) { - tensorflow::strings::Appendf(destination, fmt, args...); -} - -// Specialization for no argument format string (avoid security bug). -inline void AppendFHelper(std::string* destination, const char* fmt) { - tensorflow::strings::Appendf(destination, "%s", fmt); -} - -// Append formatted string (with format fmt and args args) to the string -// pointed to by destination. fmt follows C printf semantics. -// One departure is that %s can be driven by a std::string or string. -template -inline void AppendF(std::string* destination, const char* fmt, Args&&... args) { - AppendFHelper(destination, fmt, IdentityOrConvertStringToRaw(args)...); -} - -// Return formatted string (with format fmt and args args). fmt follows C printf -// semantics. One departure is that %s can be driven by a std::string or string. -template -inline std::string StringF(const char* fmt, Args&&... args) { - std::string result; - AppendFHelper(&result, fmt, IdentityOrConvertStringToRaw(args)...); - return result; -} - -} // namespace port -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_FORMAT_PORT_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/graph_transformations.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/graph_transformations.h deleted file mode 100644 index 4d7278f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/graph_transformations.h +++ /dev/null @@ -1,307 +0,0 @@ -/* Copyright 2017 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_TOCO_GRAPH_TRANSFORMATIONS_GRAPH_TRANSFORMATIONS_H_ -#define TENSORFLOW_LITE_TOCO_GRAPH_TRANSFORMATIONS_GRAPH_TRANSFORMATIONS_H_ - -#include -#include -#include -#include - -#include "tensorflow/lite/toco/model.h" -#include "tensorflow/lite/toco/toco_port.h" - -namespace toco { - -class GraphTransformation { - public: - virtual ::tensorflow::Status Run(Model* model, std::size_t op_index, - bool* modified) = 0; - virtual const char* Name() const = 0; - virtual ~GraphTransformation() {} - // Returns the list of messages that this graph transformation - // generated since ClearMessages() was called. - const std::vector& Messages() const { return messages_; } - // Clears the list of messages; should be called after every - // run of this graph transformation. - void ClearMessages() { return messages_.clear(); } - // Adds a message; normally only called by the graph transformation - // itself during its run (this function could be protected). - template - void AddMessageF(const char* format, const Args&... args) { - return messages_.push_back(toco::port::StringF(format, args...)); - } - - protected: - GraphTransformation() {} - - // List of messages generated by this graph transformation. - std::vector messages_; - - private: - GraphTransformation(const GraphTransformation& other) = delete; - GraphTransformation(const GraphTransformation&& other) = delete; -}; - -class GraphTransformationsSet { - public: - // The choice of a container with fully-specified iteration order - // ensures that graph transformations are always run in the same order, - // which avoids having toco randomly fail or produce different results - // depending on the toolchain. Ideally success/results should be independent - // of the order in which graph transformations are run, but that's - // unfortunately not currently guaranteed to be the case. - using TransformationsContainer = - std::vector>; - - GraphTransformationsSet() {} - GraphTransformationsSet( - const std::initializer_list transformations) { - for (GraphTransformation* t : transformations) { - Add(t); - } - } - void Add(GraphTransformation* transformation) { - const std::string& name = transformation->Name(); - CHECK(!names_.count(name)); - names_.insert(name); - transformations_.emplace_back(transformation); - } - TransformationsContainer::const_iterator begin() const { - return transformations_.begin(); - } - TransformationsContainer::const_iterator end() const { - return transformations_.end(); - } - bool empty() const { return transformations_.empty(); } - - private: - GraphTransformationsSet(const GraphTransformationsSet& other) = delete; - GraphTransformationsSet(const GraphTransformationsSet&& other) = delete; - std::vector> transformations_; - // Names of transformations in the set. Only used to guard against dupes. - std::unordered_set names_; -}; - -// Run the given list of graph transformations on the model. -// The message is only for logging purposes. -// The transformations is a rvalue reference, indicating that -// nothing else will use these pointers. The user is supposed to -// construct GraphTransformation objects by using 'new', pass us -// the resulting raw pointers, and this RunGraphTransformations -// takes care of delete'ing these pointers. -tensorflow::Status RunGraphTransformationsWithStatus( - Model* model, const std::string& msg, - const GraphTransformationsSet& transformations); - -inline void RunGraphTransformations( - Model* model, const std::string& msg, - const GraphTransformationsSet& transformations) { - auto s = RunGraphTransformationsWithStatus(model, msg, transformations); - CHECK(s.ok()) << s.error_message(); -} - -#define DECLARE_GRAPH_TRANSFORMATION(GTName) \ - class GTName : public GraphTransformation { \ - public: \ - ::tensorflow::Status Run(Model* model, std::size_t op_index, \ - bool* modified) override; \ - const char* Name() const override { return #GTName; } \ - }; - -// List of all graph transformations -DECLARE_GRAPH_TRANSFORMATION(ConvertExpandDimsToReshape) -DECLARE_GRAPH_TRANSFORMATION(ConvertMatrixSetDiagV2OrV3ToV1) -DECLARE_GRAPH_TRANSFORMATION(ConvertMatrixDiagV2OrV3ToV1) -DECLARE_GRAPH_TRANSFORMATION(ConvertPureConvToDepthwise) -DECLARE_GRAPH_TRANSFORMATION(ConvertReorderAxes) -DECLARE_GRAPH_TRANSFORMATION(ConvertSqueezeToReshape) -DECLARE_GRAPH_TRANSFORMATION(ConvertTrivialAddNToAdd) -DECLARE_GRAPH_TRANSFORMATION(ConvertTrivialPackToReshape) -DECLARE_GRAPH_TRANSFORMATION(ConvertTrivialTileToConcat) -DECLARE_GRAPH_TRANSFORMATION(ConvertTrivialTransposeToReshape) -DECLARE_GRAPH_TRANSFORMATION(EnsureBiasVectors) -DECLARE_GRAPH_TRANSFORMATION(FuseActivationFunctions) -DECLARE_GRAPH_TRANSFORMATION(FuseBinaryIntoFollowingAffine) -DECLARE_GRAPH_TRANSFORMATION(FuseBinaryIntoPrecedingAffine) -DECLARE_GRAPH_TRANSFORMATION(FuseBroadcastIntoFollowingBinary) -DECLARE_GRAPH_TRANSFORMATION(GroupBidirectionalSequenceLstm) -DECLARE_GRAPH_TRANSFORMATION(GroupBidirectionalSequenceRnn) -DECLARE_GRAPH_TRANSFORMATION(GroupDynamicBidirectionalSequenceLstm) -DECLARE_GRAPH_TRANSFORMATION(GroupDynamicBidirectionalSequenceRnn) -DECLARE_GRAPH_TRANSFORMATION(IdentifyL2Normalization) -DECLARE_GRAPH_TRANSFORMATION(IdentifyL2Pool) -DECLARE_GRAPH_TRANSFORMATION(IdentifyLstmCell) -DECLARE_GRAPH_TRANSFORMATION(IdentifyHardSwish) -DECLARE_GRAPH_TRANSFORMATION(SplitLstmCellInputs) -DECLARE_GRAPH_TRANSFORMATION(MergeLstmCellInputs) -DECLARE_GRAPH_TRANSFORMATION(MergeReshapeIntoPrecedingTranspose) -DECLARE_GRAPH_TRANSFORMATION(IdentifyRelu1) -DECLARE_GRAPH_TRANSFORMATION(IdentifyPRelu) -DECLARE_GRAPH_TRANSFORMATION(MakeInitialDequantizeOperator) -DECLARE_GRAPH_TRANSFORMATION(MoveBinaryOperatorBeforeReshape) -DECLARE_GRAPH_TRANSFORMATION(PropagateActivationFunctionIntoConstants) -DECLARE_GRAPH_TRANSFORMATION(PropagateArrayDataTypes) -DECLARE_GRAPH_TRANSFORMATION(PropagateFakeQuantNumBits) -DECLARE_GRAPH_TRANSFORMATION(PropagateFixedSizes) -DECLARE_GRAPH_TRANSFORMATION(HardcodeMinMax) -DECLARE_GRAPH_TRANSFORMATION(Quantize) -DECLARE_GRAPH_TRANSFORMATION(RemoveFinalDequantizeOp) -DECLARE_GRAPH_TRANSFORMATION(RemoveSuccessiveTranspose) -DECLARE_GRAPH_TRANSFORMATION(RemoveTensorFlowAssert) -DECLARE_GRAPH_TRANSFORMATION(RemoveTensorFlowIdentity) -DECLARE_GRAPH_TRANSFORMATION(RemoveTrivialBinaryOperator) -DECLARE_GRAPH_TRANSFORMATION(RemoveTrivialConcatenation) -DECLARE_GRAPH_TRANSFORMATION(RemoveTrivialConcatenationInput) -DECLARE_GRAPH_TRANSFORMATION(RemoveTrivialFakeQuant) -DECLARE_GRAPH_TRANSFORMATION(RemoveTrivialSlice) -DECLARE_GRAPH_TRANSFORMATION(RemoveTrivialQuantizedActivationFunc) -DECLARE_GRAPH_TRANSFORMATION(RemoveTrivialQuantizedMinMax) -DECLARE_GRAPH_TRANSFORMATION(RemoveUnusedOp) -DECLARE_GRAPH_TRANSFORMATION(ResolveBatchNormalization) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantBinaryOperator) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantUnaryOperator) -DECLARE_GRAPH_TRANSFORMATION(CreateIm2colArrays) -DECLARE_GRAPH_TRANSFORMATION(DropIm2colArrays) -DECLARE_GRAPH_TRANSFORMATION(ReadArrayMinmaxAndNarrowRangeFromFakeQuant) -DECLARE_GRAPH_TRANSFORMATION(ReorderElementwiseUnary) -DECLARE_GRAPH_TRANSFORMATION(ReorderReshapeTranspose) -DECLARE_GRAPH_TRANSFORMATION(ResolveReorderAxes) -DECLARE_GRAPH_TRANSFORMATION(ResolveTensorFlowConcat) -DECLARE_GRAPH_TRANSFORMATION(ResolveTensorFlowMatMul) -DECLARE_GRAPH_TRANSFORMATION(ResolveTensorFlowMerge) -DECLARE_GRAPH_TRANSFORMATION(ResolveSqueezeAttributes) -DECLARE_GRAPH_TRANSFORMATION(ResolveTensorFlowSwitch) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantConcatenation) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantReshape) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantTranspose) -DECLARE_GRAPH_TRANSFORMATION(DropFakeQuant) -DECLARE_GRAPH_TRANSFORMATION(UnfuseActivationFunctions) -DECLARE_GRAPH_TRANSFORMATION(UnrollBatchMatMul) -DECLARE_GRAPH_TRANSFORMATION(ResolveSpaceToBatchNDAttributes) -DECLARE_GRAPH_TRANSFORMATION(ResolveBatchToSpaceNDAttributes) -DECLARE_GRAPH_TRANSFORMATION(ResolvePadAttributes) -DECLARE_GRAPH_TRANSFORMATION(ResolvePadV2Attributes) -DECLARE_GRAPH_TRANSFORMATION(ResolveReduceAttributes) -DECLARE_GRAPH_TRANSFORMATION(ResolveReshapeAttributes) -DECLARE_GRAPH_TRANSFORMATION(ResolveSliceAttributes) -DECLARE_GRAPH_TRANSFORMATION(ResolveStridedSliceAttributes) -DECLARE_GRAPH_TRANSFORMATION(ResolveTransposeAttributes) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantPack) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantRandomUniform) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantRange) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantShapeOrRank) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantSlice) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantStridedSlice) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantFill) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantGather) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantSelect) -DECLARE_GRAPH_TRANSFORMATION(ResolveConstantTile) -DECLARE_GRAPH_TRANSFORMATION(ResolveMultiplyByZero) -DECLARE_GRAPH_TRANSFORMATION(Dequantize) -DECLARE_GRAPH_TRANSFORMATION(UnpartitionEmbeddingLookup) -DECLARE_GRAPH_TRANSFORMATION(ShuffleFCWeights) -DECLARE_GRAPH_TRANSFORMATION(ResolveFakeQuantArgsFromVars) -DECLARE_GRAPH_TRANSFORMATION(ResolveGatherAttributes) -DECLARE_GRAPH_TRANSFORMATION(IdentifyNearestUpsample) - -class PropagateDefaultMinMax : public GraphTransformation { - public: - ::tensorflow::Status Run(Model* model, std::size_t op_index, - bool* modified) override; - const char* Name() const override { return "PropagateDefaultMinMax"; } - - bool has_any_ranges_defined() const { return !type_ranges_.empty(); } - void DefineTypeRange(ArrayDataType data_type, double min, double max) { - MinMax minmax; - minmax.min = min; - minmax.max = max; - type_ranges_.emplace_back(data_type, minmax); - } - - private: - bool SetArrayMinMax(const std::string& array_name, Array* array); - std::vector> type_ranges_; -}; - -class RemoveTrivialReshape : public GraphTransformation { - public: - ::tensorflow::Status Run(Model* model, std::size_t op_index, - bool* modified) override; - const char* Name() const override { return "RemoveTrivialReshape"; } - bool treat_expand_dims_as_trivial() const { - return treat_expand_dims_as_trivial_; - } - void set_treat_expand_dims_as_trivial(bool val) { - treat_expand_dims_as_trivial_ = val; - } - - private: - bool treat_expand_dims_as_trivial_ = false; -}; - -class ResolveConstantFakeQuant : public GraphTransformation { - public: - ::tensorflow::Status Run(Model* model, std::size_t op_index, - bool* modified) override; - const char* Name() const override { return "ResolveConstantFakeQuant"; } - - // True if the num_bits should adjust the final data type. - bool propagate_fake_quant_num_bits() const { - return propagate_fake_quant_num_bits_; - } - void set_propagate_fake_quant_num_bits(bool val) { - propagate_fake_quant_num_bits_ = val; - } - - private: - bool propagate_fake_quant_num_bits_ = false; -}; - -class EnsureUint8WeightsSafeForFastInt8Kernels : public GraphTransformation { - public: - ::tensorflow::Status Run(Model* model, std::size_t op_index, - bool* modified) override; - const char* Name() const override { - return "EnsureUint8WeightsSafeForFastInt8Kernels"; - } - bool allow_nudging_weights() const { return allow_nudging_weights_; } - void set_allow_nudging_weights(bool val) { allow_nudging_weights_ = val; } - - bool has_default_ranges_flag() const { return has_default_ranges_flag_; } - void set_has_default_ranges_flag(bool val) { has_default_ranges_flag_ = val; } - - private: - bool allow_nudging_weights_ = false; - bool has_default_ranges_flag_ = false; -}; - -class IdentifyDilatedConv : public GraphTransformation { - public: - ::tensorflow::Status Run(Model* model, std::size_t op_index, - bool* modified) override; - const char* Name() const override { return "IdentifyDilatedConv"; } - bool identify_depthwise_conv() const { return identify_depthwise_conv_; } - void set_identify_depthwise_conv(bool val) { identify_depthwise_conv_ = val; } - - private: - bool identify_depthwise_conv_ = true; -}; - -#undef DECLARE_GRAPH_TRANSFORMATION - -} // end namespace toco - -#endif // TENSORFLOW_LITE_TOCO_GRAPH_TRANSFORMATIONS_GRAPH_TRANSFORMATIONS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/identify_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/identify_util.h deleted file mode 100644 index 1a79231..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/identify_util.h +++ /dev/null @@ -1,37 +0,0 @@ -/* 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_TOCO_GRAPH_TRANSFORMATIONS_IDENTIFY_UTIL_H_ -#define TENSORFLOW_LITE_TOCO_GRAPH_TRANSFORMATIONS_IDENTIFY_UTIL_H_ -#include - -#include "tensorflow/lite/toco/model.h" - -namespace toco { - -namespace util { - -bool IsBinaryOp( - const Operator* op, OperatorType optype, - FusedActivationFunctionType act = FusedActivationFunctionType::kNone); - -// Returns true if given array is a scalar and is val. -bool CheckArrayIsScalarFloat(Model* model, const std::string& name, float val); - -// Returns index of scalar input that is equal to val, returns -1 otherwise. -int GetSingleScalarInputIndexOfBinaryOp(Model* model, const Operator* op, - float val); -} // namespace util -} // namespace toco -#endif // TENSORFLOW_LITE_TOCO_GRAPH_TRANSFORMATIONS_IDENTIFY_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/lstm_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/lstm_utils.h deleted file mode 100644 index 102fe7d..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/lstm_utils.h +++ /dev/null @@ -1,112 +0,0 @@ -/* Copyright 2018 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_TOCO_GRAPH_TRANSFORMATIONS_LSTM_UTILS_H_ -#define TENSORFLOW_LITE_TOCO_GRAPH_TRANSFORMATIONS_LSTM_UTILS_H_ - -#include -#include -#include - -#include "tensorflow/lite/toco/model.h" -#include "tensorflow/lite/toco/tooling_util.h" - -namespace toco { - -// For consistency with the parameters defined in extended LstmCell's kernel -// (tensorflow/lite/kernels/lstm.cc), -// use lowercase for these constants. - -enum ExtendedLstmCellInputs { - kInputTensor = 0, - kInputToInputWeightsTensor = 1, // Optional - kInputToForgetWeightsTensor = 2, - kInputToCellWeightsTensor = 3, - kInputToOutputWeightsTensor = 4, - kRecurrentToInputWeightsTensor = 5, // Optional - kRecurrentToForgetWeightsTensor = 6, - kRecurrentToCellWeightsTensor = 7, - kRecurrentToOutputWeightsTensor = 8, - kCellToInputWeightsTensor = 9, // Optional - kCellToForgetWeightsTensor = 10, // Optional - kCellToOutputWeightsTensor = 11, // Optional - kInputGateBiasTensor = 12, // Optional - kForgetGateBiasTensor = 13, - kCellGateBiasTensor = 14, - kOutputGateBiasTensor = 15, - kProjectionWeightsTensor = 16, // Optional - kProjectionBiasTensor = 17, // Optional - kInputActivationStateTensor = 18, - // The op can handle 18 inputs or 20 inputs. - kInputCellStateTensor = 19, - kExtendedLstmInputCount = 20, -}; - -enum ExtendedLstmCellOutputs { - // TODO(ycling): Make the 2 output state tensors optional. - kOutputStateTensor = 0, - kCellStateTensor = 1, - kOutputTensor = 2, - kExtendedLstmOutputCount = 3 -}; - -// Create optional array used for optional tensor in ExtendedLstmCell inputs. -void CreateOptionalArray(Model* model, std::string* input_array_buffer, - const std::string& array_name); - -// Create float array and get its buffer. -Buffer* CreateFloatArrayBuffer(Model* model, - std::string* array_name, - const Shape& shape); - -// Copy data from one array to the other one (supports 1D and 2D array), -// for 1D array, the 2nd dim's size is 1. -// Arguments: -// src_buffer: the source buffer -// src_stride: the stride of source buffer, i.e., 2nd dim's size -// src_start_idx1: the 1st dim index of start point in src matrix -// src_start_idx2: the 2nd dim index of start point in src matrix -// dst_buffer: the destination buffer -// dst_stride: the stride of destination buffer, i.e., 2nd dim's size -// dst_start_idx1: the 1st dim index of start point in dst matrix -// dst_start_idx2: the 2nd dim index of start point in dst matrix -// dim1_copy_size: 1st dim size of copy data -// dim2_copy_size: 2nd dim size of copy data -void CopyArrayData(const Buffer& src_buffer, - int src_stride, int src_start_idx1, int src_start_idx2, - Buffer* dst_buffer, int dst_stride, - int dst_start_idx1, int dst_start_idx2, int dim1_copy_size, - int dim2_copy_size); - -// Copy a subset of array data and create a smaller array, -// mostly used for spliting weights and bias for Lstm cell. -void CopySubArrayToArray(Model* model, std::string* array_name, - const std::string& tensor_name, int dim1_size, - int dim2_size, const Array& original_array, - int start_idx1, int start_idx2); - -// Copy array data to a large array's submatrix, -// mostly used for merging weights and bias for Lstm cell. -void CopyArrayToSubArray(Buffer& tensor_buffer, - int tensor_stride, const Array& sub_array, - int start_idx1, int start_idx2); - -// Get mating rnn array inputs using rnn_states flag. -bool GetMatchingRnnArray(Model* model, - const std::string& back_edge_source_array, - std::string* rnn_array); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_GRAPH_TRANSFORMATIONS_LSTM_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/quantization_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/quantization_util.h deleted file mode 100644 index d1d72b9..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/quantization_util.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2018 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_TOCO_GRAPH_TRANSFORMATIONS_QUANTIZATION_UTIL_H_ -#define TENSORFLOW_LITE_TOCO_GRAPH_TRANSFORMATIONS_QUANTIZATION_UTIL_H_ - -#include "tensorflow/lite/kernels/internal/quantization_util.h" -#include "tensorflow/lite/toco/graph_transformations/graph_transformations.h" -#include "tensorflow/lite/toco/model.h" - -namespace toco { - -// Gets the target quantized data type of an array based on the fake quant op. -// For example, if the num_bits is 8 the data type will be kUint8. -bool InferQuantizedDataTypeFromFakeQuant( - const FakeQuantOperator& op, ArrayDataType* out_quantized_data_type); - -// Gets the min/max numerical range for the given quantized data type. -// For example, kUint8 will return [0,255]. -// Returns true if the ranges were set and false if the type is not quantized. -bool GetQuantizedDataTypeNumericalRange(ArrayDataType data_type, - double* out_min_value, - double* out_max_value); - -// Returns the quantized data type of an array, falling back to the provided -// default data type. -ArrayDataType GetQuantizedDataType(const Array& array, - ArrayDataType default_type); - -// Chooses the quantization params for a given array and a given target -// quantized data type (which may not be the array's current data type). -void ChooseQuantizationParamsForArrayAndQuantizedDataType( - const Array& array, ArrayDataType quantized_data_type, - QuantizationParams* quantization_params); - -// Quantizes an array by setting its data type and (if constant) quantizing -// all values in the array. -void QuantizeArray(GraphTransformation* transformation, Model* model, - const std::string& name, ArrayDataType quantized_data_type, - const QuantizationParams& quantization_params); - -// Returns true if the given array, when quantized, contains only values between -// the provided clamp min/max. -// Either clamp_min or clamp_max may be +/-infinity to indicate that the value -// is unbounded on that side. -bool IsArrayQuantizedRangeSubset(GraphTransformation* transformation, - const Array& array, double clamp_min, - double clamp_max); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_GRAPH_TRANSFORMATIONS_QUANTIZATION_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/remove_trivial_passthrough.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/remove_trivial_passthrough.h deleted file mode 100644 index 315edc0..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/graph_transformations/remove_trivial_passthrough.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2017 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_TOCO_GRAPH_TRANSFORMATIONS_REMOVE_TRIVIAL_PASSTHROUGH_H_ -#define TENSORFLOW_LITE_TOCO_GRAPH_TRANSFORMATIONS_REMOVE_TRIVIAL_PASSTHROUGH_H_ - -#include "tensorflow/lite/toco/graph_transformations/graph_transformations.h" -#include "tensorflow/lite/toco/model.h" - -namespace toco { - -// A "passthrough op" is an op that satisfies the following conditions: -// 1. One of its inputs is (per the semantics of that op) its "main input" -// for some notion of "main input" that is operator-specific; for example, -// for a Reshape op, the main input is the array being reshaped, not the -// other input which gives the new shape. -// 2. It has exactly one output. -// 3. It forwards exactly its main input to its single output. -// -// Examples include: -// 1. TensorFlow Identity ops. (Have one input). -// 2. TensorFlow Reshape ops when the input and output shapes agree. -// 3. Any binary operator, one of whose two inputs is a constant and is the -// neutral value for that operation. For example, a binary Add operator -// where one of its inputs is a constant array filled with zeros. -// -// A passthrough op is "trivial" and can be removed when it is possible to -// discard either its main input or output array, rerouting any -// edge involving it to the other of these two arrays. -// -// It is only possible to discard such an array if it is not explicitly -// designated as a global input/output array of the graph, e.g. the model's -// input arrays, output arrays, and any array involved in a RNN back-edge -// specified by the model. -// -// This function does not check that the given operator is a passthrough op: -// that's the responsibility of the caller. -// Given that it is a passthrough op, this function checks whether it is trivial -// and then discards it and returns true, or, if it's not trivial (if neither -// the input nor the output may be discarded), returns false. -bool RemoveTrivialPassthroughOp(GraphTransformation* transformation, - Model* model, std::size_t op_index, - int input_index = -1); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_GRAPH_TRANSFORMATIONS_REMOVE_TRIVIAL_PASSTHROUGH_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/import_tensorflow.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/import_tensorflow.h deleted file mode 100644 index a95cfee..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/import_tensorflow.h +++ /dev/null @@ -1,53 +0,0 @@ -/* Copyright 2017 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_TOCO_IMPORT_TENSORFLOW_H_ -#define TENSORFLOW_LITE_TOCO_IMPORT_TENSORFLOW_H_ - -#include -#include -#include "tensorflow/core/framework/graph.pb.h" -#include "tensorflow/lite/toco/model.h" -#include "tensorflow/lite/toco/model_flags.pb.h" - -namespace toco { - -struct TensorFlowImportFlags { - // If true, control dependencies will be dropped immediately - // during the import of the TensorFlow GraphDef. - bool drop_control_dependency = false; - - // Do not recognize any op and import all ops as - // `TensorFlowUnsupportedOperator`. This is used to populated with the - // `force_select_tf_ops` flag. - bool import_all_ops_as_unsupported = false; -}; - -// Converts TOCO model from TensorFlow GraphDef with given flags. -std::unique_ptr ImportTensorFlowGraphDef( - const ModelFlags& model_flags, const TensorFlowImportFlags& tf_import_flags, - const tensorflow::GraphDef& graph_def); - -// Converts TOCO model from the file content of TensorFlow GraphDef with given -// flags. -std::unique_ptr ImportTensorFlowGraphDef( - const ModelFlags& model_flags, const TensorFlowImportFlags& tf_import_flags, - const std::string& input_file_contents); - -// Gets a list of supported ops by their names. -std::vector GetPotentiallySupportedOps(); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_IMPORT_TENSORFLOW_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/logging/conversion_log_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/logging/conversion_log_util.h deleted file mode 100644 index c21ec07..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/logging/conversion_log_util.h +++ /dev/null @@ -1,64 +0,0 @@ -/* 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_TOCO_LOGGING_CONVERSION_LOG_UTIL_H_ -#define TENSORFLOW_LITE_TOCO_LOGGING_CONVERSION_LOG_UTIL_H_ - -#include -#include - -#include "tensorflow/lite/toco/logging/toco_conversion_log.pb.h" -#include "tensorflow/lite/toco/model.h" - -namespace toco { - -// This function scans through the error message string, extracts the part about -// missing ops and prunes away all other information in the error info. -std::string SanitizeErrorMessage(const std::string& error_message); - -// Populates the TocoConversionLog proto after analyzing the model. -void PopulateConversionLog(const Model& model, TocoConversionLog* log); - -// Returns the names of the operators in the model. -std::vector GetOperatorNames(const Model& model); - -// Counts the number of different types of operators in the model: -// Built-in ops, custom ops and select ops. -// Each map is mapping from the name of the operator (such as 'Conv') to its -// total number of occurrences in the model. -void CountOperatorsByType(const Model& model, - std::map* built_in_ops, - std::map* custom_ops, - std::map* select_ops); - -// Gets the input and output types of the model. The input and output is -// specified by model.flags.input_arrays and model.flags.output_arrays. -void GetInputAndOutputTypes( - const Model& model, - TFLITE_PROTO_NS::RepeatedPtrField* input_types, - TFLITE_PROTO_NS::RepeatedPtrField* output_types); - -// Calculates signatures for all the ops in the model. An op signature is -// defined by its input/output shapes and types, op name and its version. -void GetOpSignatures( - const Model& model, - TFLITE_PROTO_NS::RepeatedPtrField* op_signatures); - -// TODO(b/123519920): Implement this. -// Calculates a unique hash for the model. -std::string GetModelHash(const Model& model); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_LOGGING_CONVERSION_LOG_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/model.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/model.h deleted file mode 100644 index b42fed6..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/model.h +++ /dev/null @@ -1,2490 +0,0 @@ -/* Copyright 2017 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_TOCO_MODEL_H_ -#define TENSORFLOW_LITE_TOCO_MODEL_H_ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "absl/types/optional.h" -#include "tensorflow/core/platform/logging.h" -#include "tensorflow/lite/toco/model_flags.pb.h" -#include "tensorflow/lite/toco/runtime/types.h" -#include "tensorflow/lite/toco/toco_port.h" -#include "tensorflow/lite/toco/toco_types.h" - -namespace toco { - -using tflite::QuantizationParams; - -enum class OperatorType : uint8 { - kNone, - // General-purpose neural network operators. - kAdd, - kAddN, - kAveragePool, - kBatchMatMul, - kBatchNormalization, - kCeil, - kConv, - kConcatenation, - kCos, - kDepthwiseConv, - kDepthToSpace, - kSpaceToDepth, - kDequantize, - kDiv, - kExp, - kExpandDims, - kFill, - kFloorDiv, - kFloorMod, - kFullyConnected, - kL2Normalization, - kL2Pool, - kLstmCell, - kUnidirectionalSequenceLstm, - kLocalResponseNormalization, - kLog, - kLogistic, - kMaxPool, - kFakeQuant, - kMul, - kOneHot, - kRandomUniform, - kRange, - kRank, - kRelu, - kRelu1, - kRelu6, - kPRelu, - kHardSwish, - kSoftmax, - kLogSoftmax, - kSub, - kTanh, - kTransposeConv, - kCast, - kFloor, - kRound, - kGather, - kResizeBilinear, - kSin, - kSpaceToBatchND, - kPack, - kBatchToSpaceND, - kPad, - kPadV2, - kReduceProd, // Reduction product - kStridedSlice, - kSlice, - kSqueeze, - kMean, - kArgMax, - // The SVDF Op is a decomposition of a densely connected Op into - // low rank filters. For details: - // https://research.google.com/pubs/pub43813.html - kSvdf, - // Special operators used for importing TensorFlow nodes. - // The general intent is to have some graph transformation either - // drop them or rewrite them as general-purpose operators. - kAll, - kAssert, - kConcat, - kConcatV2, - kGreater, - kGreaterEqual, - kIdentity, - kLess, - kLessEqual, - kReduceMax, // Reduction Max - kMaximum, // Element-wise Maximum - kReduceMin, // Reduction Min - kMinimum, // Element-wise Minimum - kMatMul, - kMerge, - kNeg, - kReshape, - kRsqrt, - kShape, - kSplit, - kSplitV, - kSqrt, - kSquare, - kSquaredDifference, - kSum, - kSwitch, - kTile, - kTranspose, - kTopK_V2, - kDynamicPartition, - kDynamicStitch, - // An unsupported TF operation. It's only needed to be able to represent TF - // graph internally and is expected to be dropped by graph transformations. - kUnsupported, - // Finally, TensorFlow uses different conventions for axes ordering, - // see AxesOrder, and this cannot always be resolved at the time of importing - // nodes, as TensorFlow parameters may be constant-expression subgraphs - // instead of being given as plain constant arrays. So we need to insert - // special nodes in the graph to shuffle axes. - kReorderAxes, - kSegmentSum, - kSelect, - kSelectV2, - kSparseToDense, - kEqual, - kNotEqual, - kPow, - kArgMin, - kAny, - kLogicalAnd, - kLogicalNot, - kLogicalOr, - kCTCBeamSearchDecoder, - kUnpack, - kZerosLike, - kResizeNearestNeighbor, - kLeakyRelu, - kAbs, - kMirrorPad, - kUnique, - kUnidirectionalSequenceRnn, - kBidirectionalSequenceLstm, - kReverseV2, - kBidirectionalSequenceRnn, - kGatherNd, - kWhere, - kElu, - kReverseSequence, - kMatrixDiag, - kMatrixSetDiag, - kMatrixDiagV2, - kMatrixSetDiagV2, - kMatrixDiagV3, - kMatrixSetDiagV3, - kScatterNd, - // Debugging operators. - kNumericVerify -}; - -// Helper to deal with TensorFlow arrays using a different ordering of -// dimensions -// ("axes") than our own. -// TODO(benoitjacob): Ultimately, we shouldn't have any "ordering" of axes, -// we should have associative arrays mapping symbolic axes identifiers (like -// "output_depth") to dimensions. We would then not need this anymore. -enum class AxesOrder { - kOneAxis, // one-dimensional array, one unique axis. - kCR, // column-major matrix storage order. Our standard. - kRC, // row-major matrix storage order. TensorFlow default. - kOHWI, // Our standard for conv weights - kHWIO, // TensorFlow conv weights - k1HWO, // Our standard for DepthwiseConv weights - kHWIM, // TensorFlow DepthwiseConv weights - kNHWC, // TensorFlow activations - kHWOI, // TensorFlow back-prop conv weights -}; - -// The type of the scalars in an array. -// Note that the type does not by itself tell whether the values in the array -// are non-quantized (can be accessed directly) or quantized (must be -// interpreted in conjunction with QuantizationParams). -// -// In practice though: -// float values are never quantized -// uint8 values are always quantized -// int32 values are sometimes quantized (depending on whether -// QuantizationParams are present). -// complex values are never quantized -// other types are never quantized at the moment. -// -// kNone means that we don't know the data type yet, or that we don't care -// because we'll be dropping the array anyway (e.g. some exotic array types -// may be involved only in debug-only subgraphs that we may not be interested -// in actually supporting). -enum class ArrayDataType : uint8 { - kNone, // 0 - kBool, - kFloat, - kInt8, - kUint8, - kInt16, // 5 - kUint16, - kInt32, - kUint32, - kInt64, - kUint64, // 10 - kString, - kComplex64, - kFloat16, - kFloat64, - kComplex128, -}; - -// Compile-time logic to map ArrayDataType to the corresponding C++ scalar type -template -struct DataTypeImpl {}; -template <> -struct DataTypeImpl { - typedef int Type; -}; -template <> -struct DataTypeImpl { - typedef bool Type; -}; -template <> -struct DataTypeImpl { - typedef float Type; -}; -template <> -struct DataTypeImpl { - typedef int8 Type; -}; -template <> -struct DataTypeImpl { - typedef uint8 Type; -}; -template <> -struct DataTypeImpl { - typedef int16 Type; -}; -template <> -struct DataTypeImpl { - typedef uint16 Type; -}; -template <> -struct DataTypeImpl { - typedef int32 Type; -}; -template <> -struct DataTypeImpl { - typedef uint32 Type; -}; -template <> -struct DataTypeImpl { - typedef int64 Type; -}; -template <> -struct DataTypeImpl { - typedef uint64 Type; -}; -template <> -struct DataTypeImpl { - typedef std::string Type; -}; -template <> -struct DataTypeImpl { - typedef std::complex Type; -}; - -template -using DataType = typename DataTypeImpl::Type; - -// Base class for type-specific buffer types. -struct GenericBuffer { - // Non-default-constructible: only ArrayDataType-specific subclass - // objects may be constructed. - GenericBuffer() = delete; - // Non-copyable-or-movable: we should only store pointers-to-Buffer - // in containers, not Operators themselves, so there should be no - // copy or move. - GenericBuffer(const GenericBuffer&) = delete; - GenericBuffer(const GenericBuffer&&) = delete; - - // We need a virtual destructor so we can store pointers-to-Buffer - // in containers and have the containers call the right subclass destructor. - virtual ~GenericBuffer() {} - - virtual int Length() const = 0; - - const ArrayDataType type; - - protected: - // Constructor used by subclasses for specific ArrayDataType's. - explicit GenericBuffer(ArrayDataType t) : type(t) {} -}; - -// Type-specific buffer, containing type-specific storage. -template -struct Buffer : GenericBuffer { - Buffer() : GenericBuffer(A) {} - - int Length() const override { return data.size(); } - - std::vector> data; -}; - -class Shape { - public: - // For Shape, we stick to half-way encapsulation for now: - // we hide the raw dims_ member, but expose it raw by accessors - // because from some brainstorming, it's not at all easy to - // anticipate which flavor of more hermetic encapsulation would - // actually buy us future-proof-ness without being needlessly - // cumbersome. - Shape() {} - Shape(std::initializer_list dim_list) : dims_(dim_list) {} - - void ReplaceDims(std::initializer_list dim_list) { - dims_ = std::vector(dim_list); - } - - const std::vector& dims() const { return dims_; } - std::vector* mutable_dims() { return &dims_; } - const int dimensions_count() const { return dims_.size(); } - - // We still have that one convenience accessor to avoid - // the awkward double bracket issue: shape.dims()[i]. - int dims(int i) const { - // Always check for out-of-bounds accesses, even in optimized builds where - // standard assertions are disabled. Out-of-bounds access here is a common - // occurrence. - CHECK_GE(i, 0); - CHECK_GT(dims_.size(), i); - return dims_[i]; - } - - bool operator==(const Shape& comp) const { - return (this->dims_ == comp.dims()); - } - - bool operator!=(const Shape& comp) const { return !((*this) == comp); } - - private: - std::vector dims_; -}; - -// Base class for all operator classes. -struct Operator { - // Non-default-constructible: only OperatorType-specific subclass - // objects may be constructed. - Operator() = delete; - // Non-copyable-or-movable: we should only store pointers-to-Operator - // in containers, not Operators themselves, so there should be no - // copy or move. - Operator(const Operator&) = delete; - Operator(const Operator&&) = delete; - - // We need a virtual destructor so we can store pointers-to-Operator - // in containers and have the containers call the right subclass destructor. - virtual ~Operator() {} - - // The specific type of operator. Corresponds 1:1 to subclasses. - const OperatorType type; - - // The activation function that may be fused into this operator, - // or None if no activation function is fused. - FusedActivationFunctionType fused_activation_function; - - // Input arrays: either activation arrays or constant array parameters. - // We refer to them by their name, not by their address; the mapping of - // names to addresses is given by the Model, which owns both Operator's and - // Array's. Thus, an Operator on its own doesn't contain much information, - // it is meant to be used in conjunction with the Model that owns it. - std::vector inputs; - - // Output activation arrays. Same comments as for inputs apply here too. - std::vector outputs; - - // If true, the operator has more outputs than are listed in the 'outputs' - // member. These need to be resolved by some graph transformation. - // This flag is only here to indicate that an operator should not be - // discarded as unused, even if from its 'outputs' member alone it - // looks unused. - bool unresolved_outputs = false; - - // A serialized tensorflow::NodeDef string. - // The field is filled only when importing from TensorFlow. - // It's guaranteed to be filled for `TensorFlowUnsupportedOperator`. - // It's not guaranteed to be filled for other ops. Ops created by graph - // transformations won't have TensorFlow NodeDef. - std::string tensorflow_node_def; - - protected: - // Constructor used by subclasses for specific OperatorType's. - explicit Operator(OperatorType t) - : type(t), - fused_activation_function(FusedActivationFunctionType::kNone) {} -}; - -// Padding types for Conv-like operators. This is how padding is typically -// specified in model files. But for inference, we will need to resolve this -// to a FixedPadding, see below. -enum class PaddingType { kNone, kSame, kValid }; - -// Padding as resolved for a specific layer shape, as needed for inference. -// For a given layer shape, a given padding type will resolve to a choice of -// a number of padding rows and columns, which we call the padding height and -// width respectively. -struct FixedPadding { - int width = 0; - int height = 0; -}; - -// "Universal" padding struct containing both a generic PaddingType (as -// represented in a model file), and a FixedPadding (as needed for inference). -// The latter is resolved during the PropagateFixedSizes pass. -struct Padding { - FixedPadding& GetOrCreateFixedPadding() { - if (!fixed) { - FixedPadding* ptr = new FixedPadding; - fixed = std::unique_ptr(ptr); - } - return *fixed; - } - - Padding() : type(PaddingType::kNone) {} - PaddingType type; - std::unique_ptr fixed; -}; - -// "Convolutional" layer, as represented in model files. -// -// Inputs: -// inputs[0]: required: the input activations array -// inputs[1]: required: the Conv weights -// inputs[2]: optional: the bias vector, specifying the biases for each output -// channel. -// -// Outputs: -// outputs[0]: required: the output activations array -// outputs[1]: optional: the intermediate array of im2col-replicated input -// activations. Present when targeting implementations -// of Conv layers as Im2col+GEMM. -// -// TensorFlow equivalent: Conv2D -struct ConvOperator : Operator { - ConvOperator() : Operator(OperatorType::kConv) {} - Padding padding; - int stride_width = 0; - int stride_height = 0; - // A dilation_rate of 0 is invalid and this field is an optional attribute. - // Thus initializing it to 1 to allow default conv behavior when the - // attribute is not present. - int dilation_width_factor = 1; - int dilation_height_factor = 1; -}; - -// CTCBeamSearchDecoder operator: -// -// Inputs: -// inputs[0]: required: the logits. -// inputs[1]: required: sequence length. -// inputs[2]: optional: beam width. -// inputs[3]: optional: top paths. -// inputs[4]: optional: merge repeated. -// -// Outputs: -// outputs[0]: decoded. -// outputs[1]: log probability. -// -// TensorFlow equivalent: CTCBeamSearchDecoder -struct CTCBeamSearchDecoderOperator : Operator { - CTCBeamSearchDecoderOperator() - : Operator(OperatorType::kCTCBeamSearchDecoder) {} - int beam_width; - int top_paths; - bool merge_repeated = true; -}; - -// Depthwise-separable convolution operator. -// -// Inputs: -// inputs[0]: required: the input activations array -// inputs[1]: required: the DepthwiseConv weights -// inputs[2]: optional: the bias vector, specifying the biases for each output -// channel. -// -// TensorFlow equivalent: DepthwiseConv2dNative -struct DepthwiseConvOperator : Operator { - DepthwiseConvOperator() : Operator(OperatorType::kDepthwiseConv) {} - Padding padding; - int stride_height = 0; - int stride_width = 0; - int depth_multiplier = 0; - // A dilation_rate of 0 is invalid and this field is an optional attribute. - // Thus initializing it to 1 to allow default conv behavior when the - // attribute is not present. - int dilation_width_factor = 1; - int dilation_height_factor = 1; -}; - -// Depth-to-space transform operator. -// -// Inputs: -// inputs[0]: required: the input activations array -// -// TensorFlow equivalent: DepthToSpace -struct DepthToSpaceOperator : Operator { - DepthToSpaceOperator() : Operator(OperatorType::kDepthToSpace) {} - int block_size = 0; -}; - -// Space-to-depth transform operator. -// -// Inputs: -// inputs[0]: required: the input activations array -// -// TensorFlow equivalent: SpaceToDepth -struct SpaceToDepthOperator : Operator { - SpaceToDepthOperator() : Operator(OperatorType::kSpaceToDepth) {} - int block_size = 0; -}; - -// Fully-connected operator. -// -// Inputs: -// inputs[0]: required: the input activations array -// inputs[1]: required: the FullyConnected weights -// inputs[2]: optional: the bias vector, specifying the biases for each output -// channel. -// -// TensorFlow equivalent: a pair consisting of a Reshape node reshaping the -// input activations as a matrix, followed by a MatMul node. -struct FullyConnectedOperator : Operator { - FullyConnectedOperator() : Operator(OperatorType::kFullyConnected) {} - FullyConnectedWeightsFormat weights_format = - FullyConnectedWeightsFormat::kDefault; - - // `keep_num_dims` is supported in the FullyConnected kernel version 5, but - // it's never supported by Toco. - bool keep_num_dims = false; -}; - -// Dequantization operator, converting a quantized array of integers with -// quantization parameters specifying how these integers correspond to real -// numbers -// (see QuantizationParams) to an output activations array of floating-point -// values. -// -// In floating-point image models, there is typically a Dequantization operator -// at the very beginning, converting the input image RGB data, consisting of -// uint8 integer values, to floating-point input activations. That is where -// image model parameters such as "mean_value" and "std_value" are typically -// handled. -// -// This is the only operator type that converts from quantized to -// floating-point, -// and there is at the moment no operator type at all to convert from -// floating-point -// to quantized. Every other operator does either float->float or -// quantized->quantized. -// -// Inputs: -// inputs[0]: required: the input quantized activations array -// -// TensorFlow equivalent: Dequantize -struct DequantizeOperator : Operator { - DequantizeOperator() : Operator(OperatorType::kDequantize) {} -}; - -// Numeric verification operator, converting a quantized array of integers with -// quantization parameters specifying how these integers correspond to real -// numbers -// (see QuantizationParams) and verify them with an array of floating-point -// values. - -// Inputs: -// inputs[0]: required: the input quantized activations array -// inputs[1]: required: the input reference activations array -// -// TensorFlow equivalent: Dequantize -struct NumericVerifyOperator : Operator { - NumericVerifyOperator() : Operator(OperatorType::kNumericVerify) {} -}; - -// Batch-normalization operator. -// -// We only support batch-normalization using pre-learned moments, so this is -// just -// computing (input - mean) * multiplier + offset. As such, this can be -// expressed as a combination of Add and Mul nodes, and indeed this is how -// we break it down during tooling for the purpose of fusing it into -// other operators. -// -// Inputs: -// inputs[0]: required: the input activations array -// inputs[1]: required: the learned mean array -// inputs[2]: required: the learned multiplier array -// inputs[3]: required: the learned offset array -// -// TensorFlow equivalent: a combination of Add and Mul nodes -struct BatchNormalizationOperator : Operator { - BatchNormalizationOperator() - : Operator(OperatorType::kBatchNormalization), - global_normalization(false) {} - bool global_normalization; -}; - -// L2-normalization operator. -// -// Inputs: -// inputs[0]: required: the input activations array -// -// TensorFlow equivalent: none. In TensorFlow, L2 normalization is implemented -// by a sub-graph of operators implementing L2-normalization -// from lower-level arithmetic nodes; during tooling, we identify such -// sub-graphs -// and replace them by L2NormalizationOperator's. See IdentifyL2Normalization. -struct L2NormalizationOperator : Operator { - L2NormalizationOperator() : Operator(OperatorType::kL2Normalization) {} -}; - -// LSTM Cell operator. -// -// Inputs: -// inputs[0]: required: the input data array -// inputs[1]: required: the previous output activations array -// inputs[2]: required: the learned weights array -// inputs[3]: required: the learned biases array -// inputs[4]: required: the previous output state -// outputs[0]: required: the output activations array -// outputs[1]: required: the new state array -// -// TensorFlow equivalent: none. In TensorFlow, an LSTM is implemented -// with a sub-graph of lower-level arithmetic nodes; during tooling, we identify -// such sub-graphs and replace them with LstmCells. See IdentifyLstmCell(). -struct LstmCellOperator : Operator { - enum Inputs { - DATA_INPUT = 0, - PREV_ACTIV_INPUT = 1, - WEIGHTS_INPUT = 2, - BIASES_INPUT = 3, - PREV_STATE_INPUT = 4, - NUM_INPUTS = 5 - }; - enum Outputs { - ACTIV_OUTPUT = 0, - STATE_OUTPUT = 1, - CONCAT_TEMP = 2, - ACTIV_TEMP = 3, - NUM_OUTPUTS = 4 - }; - enum KernelType { - KERNEL_BASIC = 0, - KERNEL_FULL = 1, - }; - - LstmCellOperator() - : Operator(OperatorType::kLstmCell), kernel_type(KERNEL_BASIC) {} - - KernelType kernel_type; -}; - -struct UnidirectionalSequenceLstmOperator : Operator { - UnidirectionalSequenceLstmOperator() - : Operator(OperatorType::kUnidirectionalSequenceLstm) {} -}; - -struct BidirectionalSequenceLstmOperator : Operator { - BidirectionalSequenceLstmOperator() - : Operator(OperatorType::kBidirectionalSequenceLstm) {} - bool merge_outputs; -}; - -struct BidirectionalSequenceRnnOperator : Operator { - BidirectionalSequenceRnnOperator() - : Operator(OperatorType::kBidirectionalSequenceRnn) {} - bool merge_outputs; -}; - -// Element-wise multiplication operator. -// -// Inputs: -// inputs[0]: required: the left-hand side array -// inputs[1]: required: the right-hand side array -// -// TensorFlow equivalent: Mul -struct MulOperator : Operator { - MulOperator() : Operator(OperatorType::kMul) {} -}; - -// Element-wise Abs operator: -// x -> abs(x) -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: abs -struct AbsOperator : Operator { - AbsOperator() : Operator(OperatorType::kAbs) {} -}; - -// Element-wise HardSwish operator: -// x -> x * relu6(x+3)/6 -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: hard_swish -struct HardSwishOperator : Operator { - HardSwishOperator() : Operator(OperatorType::kHardSwish) {} -}; - -// Elu -// f(x) -> exp(x) - 1 for x < 0, x for x >= 0. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Elu -struct EluOperator : Operator { - EluOperator() : Operator(OperatorType::kElu) {} -}; - -// Element-wise Relu operator: -// x -> max(0, x) -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Relu -struct ReluOperator : Operator { - ReluOperator() : Operator(OperatorType::kRelu) {} -}; - -// Element-wise Relu1 operator: -// x -> min(max(x, -1), 1) -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: none. We can construct the operator with Minimum -// and Maximum operations -struct Relu1Operator : Operator { - Relu1Operator() : Operator(OperatorType::kRelu1) {} -}; - -// Element-wise Relu6 operator: -// x -> max(0, min(6, x)) -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Relu6 -struct Relu6Operator : Operator { - Relu6Operator() : Operator(OperatorType::kRelu6) {} -}; - -// PRelu -// f(x) = alpha * x for x < 0, f(x) = x for x >= 0. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: required: the alpha array -// -// Equivalent to keras.layers.PReLU. -struct PReluOperator : Operator { - PReluOperator() : Operator(OperatorType::kPRelu) {} -}; - -// LeakyRelu -// x -> max(x, alpha * x) -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: LeakyRelu -struct LeakyReluOperator : Operator { - LeakyReluOperator() : Operator(OperatorType::kLeakyRelu) {} - - float alpha = 0.2f; // 0.2 matches the default value for the TF op attribute. -}; - -// Element-wise Logistic operator: -// x -> Logistic(x) = 1 / (1 + exp(-x)) -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Sigmoid -struct LogisticOperator : Operator { - LogisticOperator() : Operator(OperatorType::kLogistic) {} -}; - -// Element-wise natural log operator: -// x -> ln(x) -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Log -struct LogOperator : Operator { - LogOperator() : Operator(OperatorType::kLog) {} -}; - -// Element-wise Tanh operator: -// x -> Tanh(x) = (exp(x) - exp(-x)) / (exp(x) + exp(-x)) -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Tanh -struct TanhOperator : Operator { - TanhOperator() : Operator(OperatorType::kTanh) {} -}; - -// Element-wise Sin operator: -// x -> Sin(x) = sin(x) -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Sin -struct SinOperator : Operator { - SinOperator() : Operator(OperatorType::kSin) {} -}; - -// Element-wise addition operator. -// -// Inputs: -// inputs[0]: required: the left-hand side array -// inputs[1]: required: the right-hand side array -// -// TensorFlow equivalent: Add -struct AddOperator : Operator { - AddOperator() : Operator(OperatorType::kAdd) {} -}; - -// Element-wise addition operator for N inputs. -// -// Inputs: -// inputs[i]: The i-th array to add together to form the output. -// -// TensorFlow equivalent: AddN -struct AddNOperator : Operator { - AddNOperator() : Operator(OperatorType::kAddN) {} -}; - -// Concatenation operator: concatenates its inputs -// along the axis. -// -// Inputs: this operator accepts any number >= 1 of inputs. -// inputs[i]: the i-th array to concatenate. -// -// TensorFlow equivalent: Concat. -struct ConcatenationOperator : Operator { - ConcatenationOperator() : Operator(OperatorType::kConcatenation) {} - int axis = 0; -}; - -// Reordering dimensions. Used only during tooling to transform graphs from -// the TensorFlow format. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: none. This is only useful to convert between formats. -struct ReorderAxesOperator : Operator { - ReorderAxesOperator() : Operator(OperatorType::kReorderAxes) {} - AxesOrder input_axes_order; - AxesOrder output_axes_order; -}; - -// Average-pooling operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: AveragePool -struct AveragePoolOperator : Operator { - AveragePoolOperator() : Operator(OperatorType::kAveragePool) {} - Padding padding; - int stride_height = 0; - int stride_width = 0; - int kheight = 0; - int kwidth = 0; -}; - -// Local response normalization operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: LRN -struct LocalResponseNormalizationOperator : Operator { - LocalResponseNormalizationOperator() - : Operator(OperatorType::kLocalResponseNormalization) {} - - int range = 0; - float bias = 0.f; - float alpha = 0.f; - float beta = 0.f; -}; - -// Max-pooling operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: MaxPool -struct MaxPoolOperator : Operator { - MaxPoolOperator() : Operator(OperatorType::kMaxPool) {} - Padding padding; - int stride_height = 0; - int stride_width = 0; - int kheight = 0; - int kwidth = 0; -}; - -// L2-pooling operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: none. Can be shimmed by squaring+avgpool+sqrt. -struct L2PoolOperator : Operator { - L2PoolOperator() : Operator(OperatorType::kL2Pool) {} - Padding padding; - int stride_height = 0; - int stride_width = 0; - int kheight = 0; - int kwidth = 0; -}; - -// The expected [min, max] range of values in a given array. -// Used for quantization only. -// This information typically comes from special nodes found in quantized -// models, see FakeQuantOperator, and is used during quantization to resolve -// actual quantization parameters (see QuantizationParams). -struct MinMax { - double min = 0.; - double max = 0.; -}; - -inline bool operator==(const MinMax& m1, const MinMax& m2) { - return m1.min == m2.min && m1.max == m2.max; -} - -inline bool operator!=(const MinMax& m1, const MinMax& m2) { - return m1.min != m2.min || m1.max != m2.max; -} - -// Fake-quantization operator. This does two things: -// - Annotate its input and output arrays with MinMax information, -// - Arithmetic-wise, this operator rounds incoming activation values -// to the nearest representable value on the scale of 256 -// values from the min to the max value dictated by its MinMax info. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: optional: the 'min' value, if it has not yet been resolved -// to a constant. -// inputs[2]: optional: the 'max' value, if it has not yet been resolved -// to a constant. -// -// TensorFlow equivalent: FakeQuantWithMinMaxVars, FakeQuantWithMinMaxArgs. -struct FakeQuantOperator : Operator { - FakeQuantOperator() : Operator(OperatorType::kFakeQuant) {} - std::unique_ptr minmax; - int num_bits = 8; - bool narrow_range = false; -}; - -// Element-wise division operator. -// -// Inputs: -// inputs[0]: required: the left-hand side array -// inputs[1]: required: the right-hand side array -// -// TensorFlow equivalent: Div -struct DivOperator : Operator { - DivOperator() : Operator(OperatorType::kDiv) {} -}; - -// Element-wise identity (x->x) operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Identity -struct TensorFlowIdentityOperator : Operator { - TensorFlowIdentityOperator() : Operator(OperatorType::kIdentity) {} -}; - -// Batch matrix multiplication operator. This comes from a tf.matmul where one -// of the operands has rank 3 or more. -// -// Inputs: -// inputs[0]: required: the left-hand side matrix -// inputs[1]: required: the right-hand side matrix -// -// TensorFlow equivalent: MatMul -struct BatchMatMulOperator : Operator { - BatchMatMulOperator() : Operator(OperatorType::kBatchMatMul) {} - bool adj_x = false; - bool adj_y = false; -}; - -// General matrix multiplication operator. We don't want to support general -// matrix multiplication at inference time, so we resolve it during tooling -// to more specific operator types, namely, FullyConnected. -// -// Inputs: -// inputs[0]: required: the left-hand side matrix -// inputs[1]: required: the right-hand side matrix -// -// TensorFlow equivalent: MatMul -struct TensorFlowMatMulOperator : Operator { - TensorFlowMatMulOperator() : Operator(OperatorType::kMatMul) {} - bool transpose_a = false; - bool transpose_b = false; -}; - -// Padding operator. Pads a tensor with zeros. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: required: the padding array -// -// This operation pads a `input` with zeros according to the `paddings` you -// specify. `paddings` is an integer tensor with shape `[Dn, 2]`, where n is the -// rank of `input`. For each dimension D of `input`, `paddings[D, 0]` indicates -// how many zeros to add before the contents of `input` in that dimension, and -// `paddings[D, 1]` indicates how many zeros to add after the contents of -// `input` in that dimension. -// -// TensorFlow equivalent: Pad -struct PadOperator : Operator { - PadOperator() : Operator(OperatorType::kPad) {} - - std::vector left_padding; - std::vector right_padding; -}; - -// PaddingV2 operator. Pads a tensor with the given constant value. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: required: the padding array -// inputs[2]: required: the scalar constant_values -// -// This operation pads input according to the paddings and constant_values you -// specify. paddings is an integer tensor with shape [Dn, 2], where n is the -// rank of input. For each dimension D of input, paddings[D, 0] indicates how -// many padding values to add before the contents of input in that dimension, -// and paddings[D, 1] indicates how many padding values to add after the -// contents of input in that dimension. constant_values is a scalar tensor of -// the same type as input that indicates the value to use for padding input. -// -// TensorFlow equivalent: PadV2 -struct PadV2Operator : Operator { - PadV2Operator() : Operator(OperatorType::kPadV2) {} - - std::vector left_padding; - std::vector right_padding; -}; - -// Strided slice operator. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: required: the begin array -// inputs[2]: required: the end array -// inputs[3]: optional: the strides array -// -// TensorFlow equivalent: StridedSlice -struct StridedSliceOperator : Operator { - StridedSliceOperator() : Operator(OperatorType::kStridedSlice) {} - - std::vector start_indices; - std::vector stop_indices; - std::vector strides; - - int begin_mask; - int ellipsis_mask; - int end_mask; - int new_axis_mask; - int shrink_axis_mask; - - StridedSliceOperator(const StridedSliceOperator& other) - : Operator(OperatorType::kStridedSlice) { - inputs = other.inputs; - outputs = other.outputs; - - start_indices = other.start_indices; - stop_indices = other.stop_indices; - strides = other.strides; - - begin_mask = other.begin_mask; - ellipsis_mask = other.ellipsis_mask; - end_mask = other.end_mask; - new_axis_mask = other.new_axis_mask; - shrink_axis_mask = other.shrink_axis_mask; - } - - void PadIndices(int dim_count) { - // Add indices and mask bits to fully include extra dimensions - CHECK_GE(dim_count, start_indices.size()); - CHECK_EQ(start_indices.size(), stop_indices.size()); - CHECK_EQ(stop_indices.size(), strides.size()); - - for (int i = start_indices.size(); i < dim_count; i++) { - start_indices.push_back(0); - stop_indices.push_back(0); - strides.push_back(1); - begin_mask |= 1 << i; - end_mask |= 1 << i; - } - } - - void ReverseIndices() { - CHECK_EQ(start_indices.size(), stop_indices.size()); - CHECK_EQ(stop_indices.size(), strides.size()); - - std::reverse(start_indices.begin(), start_indices.end()); - std::reverse(stop_indices.begin(), stop_indices.end()); - std::reverse(strides.begin(), strides.end()); - - begin_mask = toco::port::ReverseBits32(static_cast(begin_mask)) >> - (32 - start_indices.size()); - ellipsis_mask = - toco::port::ReverseBits32(static_cast(ellipsis_mask)) >> - (32 - start_indices.size()); - end_mask = toco::port::ReverseBits32(static_cast(end_mask)) >> - (32 - start_indices.size()); - new_axis_mask = - toco::port::ReverseBits32(static_cast(new_axis_mask)) >> - (32 - start_indices.size()); - shrink_axis_mask = - toco::port::ReverseBits32(static_cast(shrink_axis_mask)) >> - (32 - start_indices.size()); - } -}; - -// Reshaping operator, reshaping its input array to a two-dimensional shape -// (a "matrix"). This is used in the TensorFlow format, in conjunction with -// MatMul nodes, to implement fully-connected layers. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: optional: the output tensor shape -// -// TensorFlow equivalent: Reshape --- except that we only support a special case -// here, where the output shape is a matrix (2D) shape. -struct TensorFlowReshapeOperator : Operator { - TensorFlowReshapeOperator() : Operator(OperatorType::kReshape) {} - std::vector shape; -}; - -// Removes dimensions of size 1 from the shape of a tensor. -// https://www.tensorflow.org/api_docs/python/tf/squeeze -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Squeeze -struct SqueezeOperator : Operator { - SqueezeOperator() : Operator(OperatorType::kSqueeze) {} - - std::vector squeeze_dims; -}; - -// Inputs: -// inputs[0]: required: the output shape -// inputs[1]: required: the weights -// inputs[2]: required: the input activations array -// inputs[3]: optional: the bias vector, specifying the biases for each output -// channel. -// NOTE: The input activations is NOT the first input. -// -// -// Outputs: -// outputs[0]: required: the output activations array -// -// TensorFlow equivalent: Conv2DBackpropInput -struct TransposeConvOperator : Operator { - enum Inputs { - OUTPUT_SHAPE = 0, - WEIGHTS = 1, - DATA_INPUT = 2, - BIAS = 3, - }; - - TransposeConvOperator() : Operator(OperatorType::kTransposeConv) {} - Padding padding; - int stride_width = 0; - int stride_height = 0; - // Dilation is possible with transpose convolution, but Tensorflow does not - // currently support it, so we omit it. -}; - -// Given a tensor input, this operation calculates element-wise exponential -// (y = e^x). -// -// Inputs: -// inputs[0]: required: input tensor -// -// TensorFlow equivalent: Exp -struct ExpOperator : Operator { - ExpOperator() : Operator(OperatorType::kExp) {} -}; - -// Given a tensor input, this operation calculates element-wise exponential -// (y = cos(x)). -// -// Inputs: -// inputs[0]: required: input tensor -// -// TensorFlow equivalent: Cos -struct CosOperator : Operator { - CosOperator() : Operator(OperatorType::kCos) {} -}; - -// Given a tensor input, this operation inserts a dimension of 1 at the -// dimension index axis of input's shape. The dimension index axis starts at -// zero; if you specify a negative number for axis it is counted backward from -// the end. -// -// Inputs: -// inputs[0]: required: input tensor -// inputs[1]: required: 0-D (scalar). Specifies the dimension index at which -// to expand the shape of input -// -// TensorFlow equivalent: ExpandDims -struct ExpandDimsOperator : Operator { - ExpandDimsOperator() : Operator(OperatorType::kExpandDims) {} -}; - -// Creates a tensor of shape dims and fills it with the given scalar value. -// Output type will be the same as the given scalar value. -// -// Inputs: -// inputs[0]: required: 1-D (int32) - the shape of the output tensor -// inputs[1]: required: 0-D (scalar) - value to fill the tensor with -// -// TensorFlow equivalent: Fill -struct FillOperator : Operator { - FillOperator() : Operator(OperatorType::kFill) {} -}; - -// Element-wise floor division operator. -// -// Inputs: -// inputs[0]: required: the left-hand side array -// inputs[1]: required: the right-hand side array -// -// TensorFlow equivalent: FloorDiv -struct FloorDivOperator : Operator { - FloorDivOperator() : Operator(OperatorType::kFloorDiv) {} -}; - -// Element-wise floor mod operator. -// -// Inputs: -// inputs[0]: required: the left-hand side array -// inputs[1]: required: the right-hand side array -// -// TensorFlow equivalent: FloorMod -struct FloorModOperator : Operator { - FloorModOperator() : Operator(OperatorType::kFloorMod) {} -}; - -struct RandomUniformOperator : Operator { - RandomUniformOperator() : Operator(OperatorType::kRandomUniform) {} - ArrayDataType dtype = ArrayDataType::kNone; - int64 seed; - int64 seed2; -}; - -// Creates a sequence of numbers that begins at start and extends by increments -// of delta up to but not including limit. -// -// The dtype of the resulting tensor is inferred from the inputs unless it is -// provided explicitly. -// -// Inputs: -// inputs[0]: required: the start -// inputs[1]: required: the limit -// inputs[2]: required: the delta -// -// TensorFlow equivalent: Range -struct RangeOperator : Operator { - RangeOperator() : Operator(OperatorType::kRange) {} - ArrayDataType dtype = ArrayDataType::kNone; -}; - -// Rank operator. Extracts the rank of the tensor. -// -// Inputs: -// inputs[0]: required: the input array -// -// This operation outputs a 0-D int32 Tensor representing the rank of input. -// -// TensorFlow equivalent: Rank. -struct TensorFlowRankOperator : Operator { - TensorFlowRankOperator() : Operator(OperatorType::kRank) {} - ArrayDataType output_data_type = ArrayDataType::kInt32; -}; - -// Element-wise negation (-x) operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Neg -struct NegOperator : Operator { - NegOperator() : Operator(OperatorType::kNeg) {} -}; - -// Element-wise select operator choosing elements from inputs[1] or input[2] -// -// Inputs: -// inputs[0]: required: boolean mask per index -// inputs[1]: required: tensor of values if true -// inputs[2]: required: tensor of values if false -// -// TensorFlow equivalent: Select -struct SelectOperator : Operator { - SelectOperator() : Operator(OperatorType::kSelect) {} -}; - -// Element-wise reciprocal-square-root (x^-0.5) operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Rsqrt -struct TensorFlowRsqrtOperator : Operator { - TensorFlowRsqrtOperator() : Operator(OperatorType::kRsqrt) {} -}; - -// Stacks a list of rank-R tensors into one rank-(R+1) tensor. -// -// Packs the list of tensors in values into a tensor with rank one higher than -// each tensor in values, by packing them along the axis dimension. Given a list -// of length N of tensors of shape (A, B, C);. -// -// Inputs: this operator accepts any number >= 1 of inputs. -// inputs[i]: the i-th array to merge. -// -// TensorFlow equivalent: Pack -struct PackOperator : Operator { - PackOperator() : Operator(OperatorType::kPack) {} - int values_count; - int axis = 0; - ArrayDataType dtype = ArrayDataType::kNone; -}; - -// Shape operator. Extracts the shape of the tensor. -// -// Inputs: -// inputs[0]: required: the input array -// -// This operation outputs a 1-D integer tensor representing the shape of -// the input. -// -// TensorFlow equivalent: Shape. -struct TensorFlowShapeOperator : Operator { - TensorFlowShapeOperator() : Operator(OperatorType::kShape) {} - ArrayDataType output_data_type = ArrayDataType::kInt32; -}; - -// Element-wise square-root (x^0.5) operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Sqrt -struct TensorFlowSqrtOperator : Operator { - TensorFlowSqrtOperator() : Operator(OperatorType::kSqrt) {} -}; - -// Element-wise square (x*x) operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Square -struct TensorFlowSquareOperator : Operator { - TensorFlowSquareOperator() : Operator(OperatorType::kSquare) {} -}; - -// Element-wise squared difference ((x-y)*(x-y)) operator. -// -// Inputs: -// inputs[0]: required: the left-hand side array -// inputs[1]: required: the right-hand side array -// -// TensorFlow equivalent: SquaredDifference -struct SquaredDifferenceOperator : Operator { - SquaredDifferenceOperator() : Operator(OperatorType::kSquaredDifference) {} -}; - -// Transposes a tensor. -// -// By default, this operation performs a regular matrix transpose on 2-D input -// tensors. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Transpose -struct TransposeOperator : Operator { - TransposeOperator() : Operator(OperatorType::kTranspose) {} - std::vector perm; -}; - -// Element-wise subtraction operator. -// -// Inputs: -// inputs[0]: required: the left-hand side array -// inputs[1]: required: the right-hand side array -// -// TensorFlow equivalent: Sub -struct SubOperator : Operator { - SubOperator() : Operator(OperatorType::kSub) {} -}; - -// Sum reduction: computes the sum of all of entries across the axes. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Sum -struct TensorFlowSumOperator : Operator { - TensorFlowSumOperator() : Operator(OperatorType::kSum) {} - std::vector axis; - bool keep_dims = false; -}; - -// Prod reduction: computes the product of all of entries across the axes. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Prod -struct TensorFlowProdOperator : Operator { - TensorFlowProdOperator() : Operator(OperatorType::kReduceProd) {} - std::vector axis; - bool keep_dims = false; -}; - -// TensorFlow Tile equivalent. Refer to TensorFlow documentation for details. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: required: int array with length of rank(input[0]) -struct TensorFlowTileOperator : Operator { - TensorFlowTileOperator() : Operator(OperatorType::kTile) {} -}; - -// TensorFlow Slice equivalent. Refer to TensorFlow documentation for details. -struct SliceOperator : Operator { - SliceOperator() : Operator(OperatorType::kSlice) {} - - std::vector begin; - std::vector size; -}; - -// TensorFlow Split equivalent. Refer to TensorFlow documentation for details. -// Not fully supported, just a placeholder to handle TensorFlow graphs and -// support graph transformations to other operator types by matching sub-graphs. -struct TensorFlowSplitOperator : Operator { - TensorFlowSplitOperator() : Operator(OperatorType::kSplit) {} - int num_split = 0; -}; - -// TensorFlow SplitV equivalent. Refer to TensorFlow documentation for details. -struct TensorFlowSplitVOperator : Operator { - TensorFlowSplitVOperator() : Operator(OperatorType::kSplitV) {} - int num_split = 0; -}; - -// TensorFlow Concat equivalent. Refer to TensorFlow documentation for details. -// Not fully supported, just a placeholder to handle TensorFlow graphs and -// support graph transformations to other operator types by matching sub-graphs. -// Concretely, once the concat dim becomes known, if it is the depth -// dimension then we can change this op into a DepthConcatenation op. -// Otherwise, we hope for some other graph transformation to drop this node. -struct TensorFlowConcatOperator : Operator { - TensorFlowConcatOperator() : Operator(OperatorType::kConcat) {} -}; - -// TensorFlow ConcatV2 equivalent. Refer to TensorFlow documentation for -// details. -// Not fully supported, just a placeholder to handle TensorFlow graphs and -// support graph transformations to other operator types by matching sub-graphs. -// Concretely, once the concat dim becomes known, if it is the depth -// dimension then we can change this op into a DepthConcatenation op. -// Otherwise, we hope for some other graph transformation to drop this node. -struct TensorFlowConcatV2Operator : Operator { - TensorFlowConcatV2Operator() : Operator(OperatorType::kConcatV2) {} -}; - -// TensorFlow Merge equivalent. Refer to TensorFlow documentation for details. -// -// Inputs: this operator accepts any number >= 1 of inputs. -// inputs[i]: the i-th array to merge. -// -// It is expected that graph transformations will drop all but exactly one -// of the inputs, at which point the Merge node will be equivalent to an -// Identity node forwarding the remaining input. -// -// Note: We do not currently support runtime control flow: we only support -// control flow that can be resolved at tooling time (independently of input -// activations). -struct TensorFlowMergeOperator : Operator { - TensorFlowMergeOperator() : Operator(OperatorType::kMerge) {} -}; - -// TensorFlow Switch equivalent. Refer to TensorFlow documentation for details. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: required: the boolean predicate, given as an array of size 1 -// and of type kBool, will determine which output gets selected. -// -// Outputs: a TensorFlow Switch node always has exactly two outputs. Depending -// on the boolean value that the input predicate resolves to (see note below), -// one or the other of the outputs will be 'selected': the input array will be -// forwarded to the 'selected output' as if by a Identity node, while the other -// output will be discarded, and any graph edge connecting that discarded output -// will be dropped. The rule for selecting outputs is as follows: -// outputs[0] will be selected if the input predicate resolves to 'true'. -// outputs[1] will be selected if the input predicate resolves to 'false'. -// -// Note: We do not currently support runtime control flow: we only support -// control flow that can be resolved at tooling time (independently of input -// activations). -struct TensorFlowSwitchOperator : Operator { - TensorFlowSwitchOperator() : Operator(OperatorType::kSwitch) {} -}; - -// TensorFlow All equivalent. Refer to TensorFlow documentation for details. -// Not fully supported, just a placeholder to handle TensorFlow graphs and -// support graph transformations to other operator types by matching sub-graphs. -// Typically, this is only used as an input to an Assert node, so can be -// removed as an unused node as we drop Assert nodes. -struct TensorFlowAllOperator : Operator { - TensorFlowAllOperator() : Operator(OperatorType::kAll) {} -}; - -// TensorFlow Assert equivalent. Refer to TensorFlow documentation for details. -// Not fully supported, just a placeholder to handle TensorFlow graphs and -// support graph transformations to other operator types by matching sub-graphs. -// Typically, we just drop Assert nodes. -struct TensorFlowAssertOperator : Operator { - TensorFlowAssertOperator() : Operator(OperatorType::kAssert) {} -}; - -// TensorFlow Less equivalent. Refer to TensorFlow documentation for details. -// Not fully supported, just a placeholder to handle TensorFlow graphs and -// support graph transformations to other operator types by matching sub-graphs. -// Typically, this is only used as an input to an Assert node, so can be -// removed as an unused node as we drop Assert nodes. -struct TensorFlowLessOperator : Operator { - TensorFlowLessOperator() : Operator(OperatorType::kLess) {} -}; - -// TensorFlow LessEqual equivalent. Refer to TensorFlow documentation for -// details. -// Not fully supported, just a placeholder to handle TensorFlow graphs and -// support graph transformations to other operator types by matching sub-graphs. -// Typically, this is only used as an input to an Assert node, so can be -// removed as an unused node as we drop Assert nodes. -struct TensorFlowLessEqualOperator : Operator { - TensorFlowLessEqualOperator() : Operator(OperatorType::kLessEqual) {} -}; - -// TensorFlow Less equivalent. Refer to TensorFlow documentation for details. -// Not fully supported, just a placeholder to handle TensorFlow graphs and -// support graph transformations to other operator types by matching sub-graphs. -// Typically, this is only used as an input to an Assert node, so can be -// removed as an unused node as we drop Assert nodes. -struct TensorFlowGreaterOperator : Operator { - TensorFlowGreaterOperator() : Operator(OperatorType::kGreater) {} -}; - -// TensorFlow GreaterEqual equivalent. Refer to TensorFlow documentation for -// details. -// Not fully supported, just a placeholder to handle TensorFlow graphs and -// support graph transformations to other operator types by matching sub-graphs. -// Typically, this is only used as an input to an Assert node, so can be -// removed as an unused node as we drop Assert nodes. -struct TensorFlowGreaterEqualOperator : Operator { - TensorFlowGreaterEqualOperator() : Operator(OperatorType::kGreaterEqual) {} -}; - -// TensorFlow Equal equivalent. Refer to TensorFlow documentation for -// details. -// Not fully supported, just a placeholder to handle TensorFlow graphs and -// support graph transformations to other operator types by matching sub-graphs. -// Typically, this is only used as an input to an Assert node, so can be -// removed as an unused node as we drop Assert nodes. -struct TensorFlowEqualOperator : Operator { - TensorFlowEqualOperator() : Operator(OperatorType::kEqual) {} -}; - -// TensorFlow Not Equal equivalent. Refer to TensorFlow documentation for -// details. -struct TensorFlowNotEqualOperator : Operator { - TensorFlowNotEqualOperator() : Operator(OperatorType::kNotEqual) {} -}; - -// Max reduction: computes the max of all of entries across the axes. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Max -struct TensorFlowMaxOperator : Operator { - TensorFlowMaxOperator() : Operator(OperatorType::kReduceMax) {} - std::vector axis; - bool keep_dims = false; -}; - -// Min reduction: computes the min of all of entries across the axes. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Min -struct TensorFlowMinOperator : Operator { - TensorFlowMinOperator() : Operator(OperatorType::kReduceMin) {} - std::vector axis; - bool keep_dims = false; -}; - -// Element-wise maximum operator. Currently it only supports scalar as -// the second operand. -// -// Inputs: -// inputs[0]: required: the left-hand side array -// inputs[1]: required: the right-hand side array -// -// TensorFlow equivalent: Maximum -struct TensorFlowMaximumOperator : Operator { - TensorFlowMaximumOperator() : Operator(OperatorType::kMaximum) {} -}; - -// Element-wise minimum operator. Currently it only supports scalar as -// the second operand. -// -// Inputs: -// inputs[0]: required: the left-hand side array -// inputs[1]: required: the right-hand side array -// -// TensorFlow equivalent: Minimum -struct TensorFlowMinimumOperator : Operator { - TensorFlowMinimumOperator() : Operator(OperatorType::kMinimum) {} -}; - -// General TF operation, unsupported by tf.mini. Expected to be dropped by -// graph transformations. -struct TensorFlowUnsupportedOperator : Operator { - TensorFlowUnsupportedOperator() : Operator(OperatorType::kUnsupported) {} - - // The original TF operation type. Used for diagnostic purposes. - std::string tensorflow_op; - // A boolean indicating if the unsupported op should be treated as quantized. - bool quantized = false; - // A boolean indicating if the unsupported op output should allow float values - // in quantized mode. - bool support_output_type_float_in_quantized_op = false; - // Output data types - std::vector output_data_types; - // Output shapes. - std::vector output_shapes; -}; - -// Softmax activation function. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Softmax -struct SoftmaxOperator : Operator { - SoftmaxOperator() : Operator(OperatorType::kSoftmax) {} - float beta = 0.f; -}; - -// LogSoftmax activation function. -// -// Inputs: -// inputs[0]: required: the logits input array -// -// TensorFlow equivalent: LogSoftmax -struct LogSoftmaxOperator : Operator { - LogSoftmaxOperator() : Operator(OperatorType::kLogSoftmax) {} - - // LogSoftmax can in principal have very large negative output, depending on - // the input size. However, input x_i that is less than x_max-10 is - // accumulated as exp(x_i-x_max), which is truncated to zero. - // - // Since we effectively disregard smallish inputs in the normalizing factor, - // we also drop them in the output (set to minimum output), and in doing so - // make better use of the quantization range / resolution. - static constexpr float kOutputRangeMin = -16.0; -}; - -// Cast operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Cast -struct CastOperator : Operator { - CastOperator() : Operator(OperatorType::kCast) {} - ArrayDataType src_data_type = ArrayDataType::kNone; - ArrayDataType dst_data_type = ArrayDataType::kNone; -}; - -// Floor operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Floor -struct FloorOperator : Operator { - FloorOperator() : Operator(OperatorType::kFloor) {} -}; - -// Ceil operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Ceil -struct CeilOperator : Operator { - CeilOperator() : Operator(OperatorType::kCeil) {} -}; - -// Round operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Round -struct RoundOperator : Operator { - RoundOperator() : Operator(OperatorType::kRound) {} -}; - -// Gather operator. It gathers slices from params according to indices. -// Only 1-D indices are supported at the moment. -// -// Inputs: -// inputs[0]: required: the params array -// inputs[1]: required: the indices to gather -// inputs[2]: optional: axis -// -// TensorFlow equivalent: Gather -struct GatherOperator : Operator { - GatherOperator() : Operator(OperatorType::kGather) {} - // Axis is populated explicitly or implicitly from the axis input by - // ResolveGatherAttributes. An empty axis indicates that the axis has not yet - // be resolved. - absl::optional axis; - - // This field is not used by the standard TF Lite export but it is still need - // for legacy Gather implementations. - int input_rank = 0; -}; - -// GatherNd operator. It gathers slices from params according to indices. -// -// Inputs: -// inputs[0]: required: the params array -// inputs[1]: required: the indices to gather -// -// TensorFlow equivalent: GatherNd -struct GatherNdOperator : Operator { - GatherNdOperator() : Operator(OperatorType::kGatherNd) {} -}; - -// ArgMax operator. It returns the index of the maximum value along axis. -// -// Inputs: -// inputs[0]: required: the input tensor -// inputs[1]: optional: 0-D (scalar) axis -// -// TensorFlow equivalent: ArgMax -struct ArgMaxOperator : Operator { - ArgMaxOperator() : Operator(OperatorType::kArgMax) {} - ArrayDataType output_data_type = ArrayDataType::kInt64; -}; - -// ArgMin operator. It returns the index of the minimum value along axis. -// -// Inputs: -// inputs[0]: required: the input tensor -// inputs[1]: optional: 0-D (scalar) axis -// -// TensorFlow equivalent: ArgMin -struct ArgMinOperator : Operator { - ArgMinOperator() : Operator(OperatorType::kArgMin) {} - ArrayDataType output_data_type = ArrayDataType::kInt64; -}; - -// ResizeBilinear operator. It resizes input images with bilinear interpolation. -// It does not support align_corners at the moment. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: required: the new image size -// -// TensorFlow equivalent: ResizeBilinear -struct ResizeBilinearOperator : Operator { - ResizeBilinearOperator() : Operator(OperatorType::kResizeBilinear) {} - - bool align_corners = false; - bool half_pixel_centers = false; -}; - -// ResizeNearestNeighborOperator operator. It resizes input images with nearest -// neighbor interpolation. It does not support align_corners at the moment. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: required: the new image size -// -// TensorFlow equivalent: ResizeNearestNeighbor -struct ResizeNearestNeighborOperator : Operator { - ResizeNearestNeighborOperator() - : Operator(OperatorType::kResizeNearestNeighbor) {} - - bool align_corners = false; - bool half_pixel_centers = false; -}; - -// SpaceToBatchND operator. It divides spatial dimensions into a grid of -// blocks and interleaves these blocks with the batch dimension. Currently, -// only 2-d blocks are supported. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: required: the block shape -// inputs[2]: required: the paddings -// -// TensorFlow equivalent: SpaceToBatchND -struct SpaceToBatchNDOperator : Operator { - SpaceToBatchNDOperator() : Operator(OperatorType::kSpaceToBatchND) {} - - std::vector block_shape; - std::vector before_paddings; - std::vector after_paddings; -}; - -// BatchToSpaceND operator. Rearranges data from batch into blocks of -// spatial data. Currently, only 2-d blocks are supported. -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: required: the block shape -// inputs[2]: required: the crops -// -// TensorFlow equivalent: BatchToSpaceND -struct BatchToSpaceNDOperator : Operator { - BatchToSpaceNDOperator() : Operator(OperatorType::kBatchToSpaceND) {} - - std::vector block_shape; - std::vector before_crops; - std::vector after_crops; -}; - -// Mean operator. -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Mean -struct MeanOperator : Operator { - MeanOperator() : Operator(OperatorType::kMean) {} - - std::vector axis; - bool keep_dims = false; -}; - -// Svdf operator: -// -// Inputs: -// inputs[0]: required: the input array -// inputs[1]: required: weights_feature -// inputs[2]: required: weights_time -// inputs[3]: optional: bias -struct SvdfOperator : Operator { - SvdfOperator() : Operator(OperatorType::kSvdf) {} - int rank; -}; - -// TopKV2 operator. -// -// Inputs: -// input tensor and top_k scalar. -struct TopKV2Operator : Operator { - TopKV2Operator() : Operator(OperatorType::kTopK_V2) {} -}; - -// DynamicPartition operator: -// -// Inputs: -// inputs[0]: required: data. -// inputs[1]: required: partitions. -// -// TensorFlow equivalent: DynamicPartition -struct DynamicPartitionOperator : Operator { - DynamicPartitionOperator() : Operator(OperatorType::kDynamicPartition) {} - int num_partitions; -}; - -// DynamicStitch operator: -// -// Inputs: -// inputs[0,N): required: indices. -// inputs[N,2N): required: data. -// -// TensorFlow equivalent: DynamicStitch/ParallelDynamicStitch -struct DynamicStitchOperator : Operator { - DynamicStitchOperator() : Operator(OperatorType::kDynamicStitch) {} - int num_partitions; -}; - -// SparseToDense operator: -// -// Inputs: -// Inputs[0]: required: sparse_indices. -// Inputs[1]: required: output_shape. -// Inputs[2]: required: sparse_values. -// -// TensorFlow equivalent: SparseToDense. -struct SparseToDenseOperator : Operator { - SparseToDenseOperator() : Operator(OperatorType::kSparseToDense) {} - bool validate_indices; -}; - -// Pow operator: -// -// Inputs: -// Inputs[0]: required: A tensor. -// Inputs[1]: required: A tensor. -// -// TensorFlow equivalent: Pow. -struct PowOperator : Operator { - PowOperator() : Operator(OperatorType::kPow) {} -}; - -// Any operator: -// -// Inputs: -// Inputs[0]: required: A boolean input tensor. -// Inputs[1]: required: reduction_indices. -// -// TensorFlow equivalent: tf.reduce_any. -struct TensorFlowAnyOperator : Operator { - TensorFlowAnyOperator() : Operator(OperatorType::kAny) {} - std::vector axis; - bool keep_dims = false; -}; - -// LogicalAnd operator: -// -// Inputs: -// Inputs[0]: required: A boolean tensor. -// Inputs[1]: required: A boolean tensor. -// -// TensorFlow equivalent: tf.logical_and. -struct LogicalAndOperator : Operator { - LogicalAndOperator() : Operator(OperatorType::kLogicalAnd) {} -}; - -// LogicalNot operator: -// -// Inputs: -// Inputs[0]: required: A boolean tensor. -// -// TensorFlow equivalent: tf.logical_not. -struct LogicalNotOperator : Operator { - LogicalNotOperator() : Operator(OperatorType::kLogicalNot) {} -}; - -// OneHot operator: -// -// Inputs: -// Inputs[0]: required: indices. -// Inputs[1]: required: depth. -// Inputs[2]: required: on_value. -// Inputs[3]: required: off_value. -// -// TensorFlow equivalent: OneHot. -struct OneHotOperator : Operator { - enum Inputs { - INDICES_INPUT = 0, - DEPTH_INPUT = 1, - ON_VALUE_INPUT = 2, - OFF_VALUE_INPUT = 3, - }; - - OneHotOperator() : Operator(OperatorType::kOneHot) {} - int axis = -1; -}; - -// LogicalOr operator: -// -// Inputs: -// Inputs[0]: required: A Bool tensor. -// Inputs[1]: required: A Bool tensor. -// -// TensorFlow equivalent: LogicalOr. -struct LogicalOrOperator : Operator { - LogicalOrOperator() : Operator(OperatorType::kLogicalOr) {} -}; - -// Unpack operator: -// -// Inputs: -// Inputs[0]: required: A boolean input tensor. -// Inputs[1]: required: reduction_indices. -// -// TensorFlow equivalent: tf.unstack. -struct UnpackOperator : Operator { - UnpackOperator() : Operator(OperatorType::kUnpack) {} - int num; - int axis; - ArrayDataType dtype = ArrayDataType::kNone; -}; - -// ZerosLike operator: -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: tf.zeros_like -struct TensorFlowZerosLikeOperator : Operator { - TensorFlowZerosLikeOperator() : Operator(OperatorType::kZerosLike) {} -}; - -// ReverseV2 operator: -// -// Inputs: -// Inputs[0]: required: the input array. -// -// TensorFlow equivalent: ReverseV2. -struct ReverseV2Operator : Operator { - ReverseV2Operator() : Operator(OperatorType::kReverseV2) {} -}; - -enum class MirrorPadMode { kNone, kSymmetric, kReflect }; - -// MirrorPad Operator: -// -// Inputs: -// Inputs[0]: required: input tensor to be padded. -// Inputs[1]: required: 2 Column matrix specifying padding sizes. The number of -// rows must be the same as the rank of the input. -// Inputs[2]: required: REFLECT or SYMMETRIC. -// -// TensorFlow equivalent: MirrorPad. -struct MirrorPadOperator : Operator { - MirrorPadOperator() : Operator(OperatorType::kMirrorPad) {} - // mode is either SYMMETRIC or REFLECT. - MirrorPadMode mode; -}; - -// ReverseSequence operator: -// -// Inputs: -// Inputs[0]: required: the input array. -// Inputs[1]: required: the lengths of the elements to be reversed. -// -// TensorFlow equivalent: tf.reverse_sequence. -struct ReverseSequenceOperator : Operator { - ReverseSequenceOperator() : Operator(OperatorType::kReverseSequence) {} - int seq_dim; - int batch_dim = 0; -}; - -// Unique Operator: -// -// Inputs: -// inputs[0]: required: the input array -// -// TensorFlow equivalent: Unique -struct UniqueOperator : Operator { - UniqueOperator() : Operator(OperatorType::kUnique) {} - ArrayDataType idx_out_type = ArrayDataType::kInt32; -}; - -struct UnidirectionalSequenceRnnOperator : Operator { - UnidirectionalSequenceRnnOperator() - : Operator(OperatorType::kUnidirectionalSequenceRnn) {} - bool time_major; - FusedActivationFunctionType fused_activation_function; -}; - -// Where Operator: -// Return the coordinates of the true values in condition tensor in row-major -// order. -// -// Inputs: -// inputs[0]: required: boolean condition tensor -// -// TensorFlow equivalent: Where -struct WhereOperator : Operator { - WhereOperator() : Operator(OperatorType::kWhere) {} -}; - -// Matrix Diag Operator: -// Construct a batched diagonal tensor with given batched diagonal values. -// Inputs: A tensor of values that will be on the diagonal of the returned -// tensor. -struct MatrixDiagOperator : Operator { - MatrixDiagOperator() : Operator(OperatorType::kMatrixDiag) {} -}; - -// Matrix Diag Operator V2: -// Construct a batched diagonal tensor with given batched diagonal values. -// Not fully supported, contains 4 extra inputs compared to MatrixDiag. Behave -// like MatrixDiag when default parameters are used. -struct MatrixDiagV2Operator : Operator { - MatrixDiagV2Operator() : Operator(OperatorType::kMatrixDiagV2) {} -}; - -// Matrix Diag Operator V3: -// Construct a batched diagonal tensor with given batched diagonal values. -// Not fully supported, contains 5 extra inputs compared to MatrixDiag. Behave -// like MatrixDiag when default parameters are used. -// V3 is only different from V2 because it has an extra attribute (align) which -// controls the alignment of diagonals in the band matrix (compact) format. -// The alignment in V2 contradicts with the default alignment in V3 so V2 is -// skipped. (It has never been, and should never be, exposed in the public API.) -struct MatrixDiagV3Operator : Operator { - MatrixDiagV3Operator() : Operator(OperatorType::kMatrixDiagV3) {} -}; - -// Matrix Set Diag Operator: -// Construct a batched diagonal tensor with given input and diagonal values. -// Input is a rank (k+1) tensor of values. -// diagonal is a rank (k) tensor of values that will be on the diagonal -// of the returned output. Output is rank k+1. -// tensor. -struct MatrixSetDiagOperator : Operator { - MatrixSetDiagOperator() : Operator(OperatorType::kMatrixSetDiag) {} -}; - -// Matrix Set Diag Operator V2: -// Construct a batched diagonal tensor with given input and diagonal values. -// Not fully supported, contains 1 extra inputs compared to MatrixSetDiag. -// Behave like MatrixSetDiag when default parameters are used. -struct MatrixSetDiagV2Operator : Operator { - MatrixSetDiagV2Operator() : Operator(OperatorType::kMatrixSetDiagV2) {} -}; - -// Matrix Set Diag Operator V3: -// Construct a batched diagonal tensor with given input and diagonal values. -// Not fully supported, contains 2 extra inputs compared to MatrixSetDiag. -// Behave like MatrixSetDiag when default parameters are used. -// V3 is only different from V2 because it has an extra attribute (align) which -// controls the alignment of diagonals in the band matrix (compact) format. -// The alignment in V2 contradicts with the default alignment in V3 so V2 is -// skipped. (It has never been, and should never be, exposed in the public API.) -struct MatrixSetDiagV3Operator : Operator { - MatrixSetDiagV3Operator() : Operator(OperatorType::kMatrixSetDiagV3) {} -}; - -struct ScatterNdOperator : Operator { - ScatterNdOperator() : Operator(OperatorType::kScatterNd) {} -}; - -struct SegmentSumOperator : Operator { - SegmentSumOperator() : Operator(OperatorType::kSegmentSum) {} -}; - -// Alloc's are used for transient arrays only. An Alloc specifies which interval -// of the "transient_data" workspace buffer passed to inference functions, is to -// be used for the transient array at hand. The 'start' and 'end' values are -// offsets from the start of the workspace buffer, expressed in bytes. -struct Alloc { - int64 start = 0; - int64 end = 0; -}; - -inline bool operator<(const Alloc& a, const Alloc& b) { - return a.start < b.start; -} - -// Array represents an array (either a constant parameter array or an -// activations array) in a Model. -struct Array { - template - const Buffer& GetBuffer() const { - DCHECK(buffer); - DCHECK(buffer->type == A); - return *static_cast*>(buffer.get()); - } - template - Buffer& GetMutableBuffer() { - if (!buffer) { - Buffer* ptr = new Buffer; - buffer = std::unique_ptr(ptr); - } - DCHECK(buffer); - DCHECK(buffer->type == A); - return *static_cast*>(buffer.get()); - } - Alloc& GetOrCreateAlloc() { - if (!alloc) { - alloc = std::unique_ptr(new Alloc); - } - return *alloc; - } - MinMax& GetOrCreateMinMax() { - if (!minmax) { - minmax = std::unique_ptr(new MinMax); - } - return *minmax; - } - MinMax& GetMinMax() const { - DCHECK(minmax); - return *minmax; - } - QuantizationParams& GetOrCreateQuantizationParams() { - if (!quantization_params) { - quantization_params = - std::unique_ptr(new QuantizationParams); - } - return *quantization_params; - } - QuantizationParams& GetQuantizationParams() const { - DCHECK(quantization_params); - return *quantization_params; - } - - // The data type of the actual elements of this array, that is: - // - If there is a buffer (see 'buffer' member), it must be of the same - // type. - // - If there is no buffer, meaning that this is a runtime (i.e. activations) - // array, then this specifies the type of elements that there will be - // at runtime. - // - // Note that this only specifies the storage type of elements; this does - // not specify whether these are to be treated as 'real' or 'quantized' - // values. - // That is decided by whether the 'quantization_params' member is null. - ArrayDataType data_type = ArrayDataType::kNone; - // The final value that data_type should have at the end of graph - // transformations - ArrayDataType final_data_type = ArrayDataType::kNone; - // The dimensions of this array --- this specifies both sizes and strides - // (the storage layout). - // - // Issues with shape handling that remain include: - // - No way to distinguish between 0-dimensional dims and missing dims. - // - No way to describe dims that may be runtime-variable. - // - Addressing of dims by integer index differs in different graph formats - // (TensorFlow vs. other frameworks vs. what we have informally grown - // within toco). - // This is currently quite messy; see ReorderAxesOperator which is how we - // bridge some of these discrepancies at the moment. This is overdue for - // a redesign; I'm thinking that it would be nice to have more flexible - // dims that allow mapping 1:1, cleanly, dims as they are in various - // formats, - // then explicitly convert between different conventions. - - // Proto-style accessors - bool has_shape() const { return array_shape != nullptr; } - const Shape& shape() const { - CHECK(has_shape()); - return *array_shape; - } - Shape* mutable_shape() { - if (!array_shape) { - array_shape.reset(new Shape); - } - return array_shape.get(); - } - void copy_shape(const Shape& src_shape) { *mutable_shape() = src_shape; } - void clear_shape() { array_shape = nullptr; } - - // The constant buffer backing this array. This is non-null if and only if - // this is a constant parameter array. Conversely, this is null for - // activations arrays. - // - // Note that this buffer is pure storage. In the case of quantized values, - // it only stores the quantized values, it does not know by itself about the - // quantization parameters necessary to interprete these values, that is - // in the separate 'quantization_params' field. In fact, this 'buffer' field - // does no even know whether values are quantized. It only has a data_type, - // which must equal the 'data_type' member here, and which only describes - // the storage type of element, does not tell whether they are quantized i.e. - // whether they are to be interpreted with quantization_params. - std::unique_ptr buffer; - // Only for activation arrays (i.e. when 'buffer' is null). - // Only for code generation. - // - // Describes the allocation of this array within the workspace buffer - // allocated - // for all transient arrays. - std::unique_ptr alloc; - // Describes the [min, max] range of values - // to be assumed when determining quantization_params. - // - // Only used for quantization. In fact, only used for determining - // quantization_params. - // - // Used for both constant arrays (those having a 'buffer') and non-constant - // arrays (activations). Indeed, it is important to use the same min-max range - // as was used during training, even if that min-max range is slightly wrong - // w.r.t. actual buffer elements. Doing otherwise would defeat the point of - // re-training for quantization. - std::unique_ptr minmax; - // Quantization parameters. The non-null-ness of this pointer is what - // defines whether this array is quantized or not. - // - // If this is non-null, then these quantization parameters are to be used - // to assign a meaning as real numbers to the elements of this array. - std::unique_ptr quantization_params; - // narrow_range is a detail of how toco handles FakeQuant operators with - // narrow_range, see - // https://www.tensorflow.org/api_docs/python/tf/fake_quant_with_min_max_vars - // - // For more context about what that is useful for, see the big comment in - // graph_transformations/ensure_uint8_weights_safe_for_fast_int8_kernels.cc - // - // The narrow_range flag applies only to quantized arrays, and changes - // their quantization in the following way when it is set to 'true': - // 1. The computation of {zero_point, scale} from {min, max} needs to be - // amended so that the real min value will get quantized to - // (min_quantized_value + 1) instead of just (min_quantized_value). - // E.g. for uint8 quantization, the real min value should get quantized to - // the uint8 value 1, not 0. - // 2. Quantized values should get clamped to the interval - // [min_quantized_value + 1, max_value]. Equivalently, the - // min_quantized_value should get nudged to (min_quantized_value + 1). - // The reason why 1. does not imply 2. is that real values may not belong to - // the stated [min, max] interval. Concretely, weights recorded at the last - // learning step may not fall in the [min, max] interval recorded over - // previous learning steps, as the values evolve across learning steps. - // - // Rationale why this is directly a field on Array: - // - This can't be just a field on FakeQuantOperator, because - // FakeQuantOperators are gone (DropFakeQuant) before we get to using that - // information (Quantize). We need a place to store that bit in the interim. - // - This can't be in QuantizationParams because we need to record this - // ahead of quantization, and QuantizationParams are only created during - // quantization. - // - This could be in MinMax, but that would be an abuse of what MinMax is - // about, and would break existing code that assumes that a MinMax is just - // a min and a max. Unlike MinMax which is agnostic as to the quantized - // data type, narrow_range refers to values in the quantized data type. - bool narrow_range = false; - - private: - std::unique_ptr array_shape; -}; - -// Our Model struct, represents an entire model (our "top-level" struct). -// Owns everything. -class Model { - public: - using ArrayMap = std::unordered_map>; - - bool HasArray(const std::string& name) const { - return arrays.count(name) > 0; - } - Array& GetArray(const std::string& name) const { - DCHECK(HasArray(name)) << "Array not found: " << name; - return *arrays.at(name); - } - Array& GetOrCreateArray(const std::string& name) { - // Make sure name is not used by an optional array - DCHECK(!optional_arrays.count(name)); - if (!HasArray(name)) { - Array* ptr = new Array; - arrays[name] = std::unique_ptr(ptr); - } - Array& result = GetArray(name); - return result; - } - void CreateOptionalArray(const std::string& name) { - DCHECK(!arrays.count(name) && !optional_arrays.count(name)); - optional_arrays.insert(name); - } - bool IsOptionalArray(const std::string& name) const { - return optional_arrays.count(name); - } - - // Note that this invalidates all array iterators. - void EraseArray(const std::string& name) { arrays.erase(name); } - void EraseArrays(std::function discardable) { - for (auto it = arrays.begin(); it != arrays.end();) { - if (discardable(it->first)) { - it = arrays.erase(it); - } else { - ++it; - } - } - } - const ArrayMap& GetArrayMap() const { return arrays; } - ArrayMap& GetMutableArrayMap() { return arrays; } - - int64 ArithmeticOpsCount() const { return ops_count; } - - void AddInvalidInputArray(std::string invalid_input_array) { - invalid_input_arrays_.insert(invalid_input_array); - } - - const std::unordered_set& GetInvalidInputArrays() const { - return invalid_input_arrays_; - } - - // Optional arrays are used for optional tensors, - // these tensors do not have data, but with reserved names as op inputs. - std::set optional_arrays; - - // The list of operators. Notice how it's a list of unique_ptr's, implying - // that the Model is what owns Operator's and keeps them alive. - std::vector> operators; - - // Generic flags, a place where we combine information passed to us via - // command-line parameters (e.g. --input_width=N) with information that - // we may or may not find in the input model file. - ModelFlags flags; - // For code-generation only: required size of the transient_data buffer - std::size_t transient_data_size = 0; - // For code-generation only: required alignment of the transient_data buffer - std::size_t transient_data_alignment = 0; - // Arithmetic operations performed in the model. - int64 ops_count = 0; - - private: - // The associative array mapping names to Array's. - // Notice how it's a container of unique_ptr's, implying - // that the Model is what owns Array's and keeps them alive. - // The Operator's refer to these Array's by their name strings, not by their - // addresses. See Operator::inputs, Operator::outputs. - std::unordered_map> arrays; - - // Invalid input arrays. - std::unordered_set invalid_input_arrays_; -}; - -// OperatorSignature contains the information required to making versioning -// decisions. -struct OperatorSignature { - // The operator. - const Operator* op; - - // The model in which the operator resides. - const Model* model; -}; -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_MODEL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/model_cmdline_flags.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/model_cmdline_flags.h deleted file mode 100644 index 23e79e6..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/model_cmdline_flags.h +++ /dev/null @@ -1,43 +0,0 @@ -/* Copyright 2017 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_TOCO_MODEL_CMDLINE_FLAGS_H_ -#define TENSORFLOW_LITE_TOCO_MODEL_CMDLINE_FLAGS_H_ - -#include -#include -#include - -#include "tensorflow/lite/toco/args.h" -#include "tensorflow/lite/toco/model_flags.pb.h" -#include "tensorflow/lite/toco/types.pb.h" - -namespace toco { -// Parse and remove arguments for models (in toco). Returns true if parsing -// is successful. msg has the usage string if there was an error or -// "--help" was specified -bool ParseModelFlagsFromCommandLineFlags( - int* argc, char* argv[], std::string* msg, - ParsedModelFlags* parsed_model_flags_ptr); -// Populate the ModelFlags proto with model data. -void ReadModelFlagsFromCommandLineFlags( - const ParsedModelFlags& parsed_model_flags, ModelFlags* model_flags); -// Parse the global model flags to a static -void ParseModelFlagsOrDie(int* argc, char* argv[]); -// Get the global parsed model flags -ParsedModelFlags* GlobalParsedModelFlags(); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_MODEL_CMDLINE_FLAGS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/python/toco_python_api.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/python/toco_python_api.h deleted file mode 100644 index df9d6e1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/python/toco_python_api.h +++ /dev/null @@ -1,57 +0,0 @@ -/* Copyright 2017 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_TOCO_PYTHON_TOCO_PYTHON_API_H_ -#define TENSORFLOW_LITE_TOCO_PYTHON_TOCO_PYTHON_API_H_ - -#include - -#include - -namespace toco { - -// Convert a model represented in `input_contents`. `model_flags_proto` -// describes model parameters. `toco_flags_proto` describes conversion -// parameters (see relevant .protos for more information). Returns a string -// representing the contents of the converted model. When extended_return -// flag is set to true returns a dictionary that contains string representation -// of the converted model and some statistics like arithmetic ops count. -// `debug_info_str` contains the `GraphDebugInfo` proto. When -// `enable_mlir_converter` is True, use MLIR-based conversion instead of -// TOCO conversion. -PyObject* TocoConvert(PyObject* model_flags_proto_txt_raw, - PyObject* toco_flags_proto_txt_raw, - PyObject* input_contents_txt_raw, - bool extended_return = false, - PyObject* debug_info_txt_raw = nullptr, - bool enable_mlir_converter = false); - -// Returns a list of names of all ops potentially supported by tflite. -PyObject* TocoGetPotentiallySupportedOps(); - -// Quantize the model with calibration data. Throw errors if `fully_quantize` -// is specified by the calibration data are not sufficient to quantize the -// model. -PyObject* MlirQuantizeModel(PyObject* data, bool disable_per_channel, - bool fully_quantize, int inference_type); - -// Sparsifies model to encode sparse tensors with proper format. Throws error if -// sparsification fails. -PyObject* MlirSparsifyModel(PyObject* data); - -// Registers the given custom opdefs to TensorFlow global op registry. -PyObject* RegisterCustomOpdefs(PyObject* list); -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_PYTHON_TOCO_PYTHON_API_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/runtime/common.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/runtime/common.h deleted file mode 100644 index 1f83be8..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/runtime/common.h +++ /dev/null @@ -1,26 +0,0 @@ -/* Copyright 2017 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_TOCO_RUNTIME_COMMON_H_ -#define TENSORFLOW_LITE_TOCO_RUNTIME_COMMON_H_ - -#ifndef ALLOW_SLOW_GENERIC_DEPTHWISECONV_FALLBACK -#ifdef GEMMLOWP_ALLOW_SLOW_SCALAR_FALLBACK -#define ALLOW_SLOW_GENERIC_DEPTHWISECONV_FALLBACK -#endif -#endif - -#include "tensorflow/lite/kernels/internal/common.h" - -#endif // TENSORFLOW_LITE_TOCO_RUNTIME_COMMON_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/runtime/types.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/runtime/types.h deleted file mode 100644 index eac9b8a..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/runtime/types.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2017 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_TOCO_RUNTIME_TYPES_H_ -#define TENSORFLOW_LITE_TOCO_RUNTIME_TYPES_H_ - -#include "tensorflow/lite/kernels/internal/common.h" -#include "tensorflow/lite/kernels/internal/compatibility.h" -#include "tensorflow/lite/kernels/internal/types.h" - -namespace toco { - -// TODO(ahentz): These are just stopgaps for now, untils we move all -// the code over to tflite. -using tflite::Dims; -using tflite::FullyConnectedWeightsFormat; -using tflite::FusedActivationFunctionType; -using tflite::RequiredBufferSizeForDims; - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_RUNTIME_TYPES_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/cluster.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/cluster.h deleted file mode 100644 index 7dc79f1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/cluster.h +++ /dev/null @@ -1,101 +0,0 @@ -/* Copyright 2017 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_TOCO_TENSORFLOW_GRAPH_MATCHING_CLUSTER_H_ -#define TENSORFLOW_LITE_TOCO_TENSORFLOW_GRAPH_MATCHING_CLUSTER_H_ - -#include -#include - -#include "tensorflow/lite/toco/model.h" -#include "tensorflow/lite/toco/tensorflow_graph_matching/cluster_utils.h" -#include "tensorflow/lite/toco/tooling_util.h" -#include "tensorflow/core/framework/attr_value.pb.h" -#include "tensorflow/core/framework/graph.pb.h" -#include "tensorflow/core/framework/node_def.pb.h" -#include "tensorflow/core/framework/tensor.pb.h" -#include "tensorflow/core/framework/tensor_shape.pb.h" - -namespace toco { - -// The base class for Cluster. A cluster is group of nodes all related to each -// other because their name match a given "pattern", which shows they all belong -// to a composite op supported in TFLite. The nodes in a cluster will be -// collapsed into a single composite op node plus a series of constant nodes -// holding the input parameters to that node. The nodes in a cluster are assumed -// to be using the same device. By changing the "pattern" we can have different -// subclasses of the base Cluster class. -class Cluster { - public: - virtual ~Cluster() {} - - virtual void CreateNodes() = 0; - - // Save the following info from the original GraphDef this cluster is from: - // 1- a pointer to the GraphDef - // 2- All the nodes in GraphDef which belong to this cluster. - void SetGraphDefInfo(const tensorflow::GraphDef* graph_def); - - const std::string& GetName() const { return name_; } - - const std::vector>& GetNewNodes() const { - return new_nodes_; - } - - const std::vector& GetNodes() { return nodes_; } - - void SetName(const std::string& name) { name_ = name; } - - void SetDevice(const std::string& device) { device_ = device; } - - // Find the input(s) and output(s) of this Cluster. - bool FindClusterInputsAndOutputs(); - - protected: - std::string name_; - std::string device_; - std::vector inputs_; - std::vector outputs_; - - // Used to hold the pointers to nodes which are in this cluster. These nodes - // are pointing to the nodes in graph_def_. - std::vector nodes_; - - // Used to cache the newly generated nodes: like the nodes created by - // collapsing Const nodes, or the nodes which is used to show the composite - // op. - std::vector> new_nodes_; - - const tensorflow::GraphDef* graph_def_; /*Not owned*/ -}; - -// A factory interface for cluster class. -// It defines a virtual function interface which is responsible for creating -// a cluster. Each cluster factory is responsible to pack a cluster of nodes -// into a cluster using a name-based pattern matching approach. -class ClusterFactoryInterface { - public: - virtual ~ClusterFactoryInterface() {} - - // Creates a cluster of nodes using a name-based pattern matching approach. It - // uses a node as a seed and if its name matches a certain pattern, then it - // builds the cluster around that node. - virtual std::unique_ptr CreateCluster( - const tensorflow::NodeDef& node, - const tensorflow::GraphDef& graph_def) const = 0; -}; - -} // end namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TENSORFLOW_GRAPH_MATCHING_CLUSTER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/cluster_utils.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/cluster_utils.h deleted file mode 100644 index 96303a0..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/cluster_utils.h +++ /dev/null @@ -1,33 +0,0 @@ -/* Copyright 2017 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_TOCO_TENSORFLOW_GRAPH_MATCHING_CLUSTER_UTILS_H_ -#define TENSORFLOW_LITE_TOCO_TENSORFLOW_GRAPH_MATCHING_CLUSTER_UTILS_H_ - -#include - -namespace toco { - -// Check if string x includes string search_pattern. -bool StrContains(const std::string& x, const std::string& search_pattern); - -// Transpose a 2D tensor of size row * col pointed by "tensor" and return the -// results in "transposed_tensor". "transposed_tensor" must be pre-allocated -// by the same size as "tensor". -void Transpose2DTensor(const float* tensor, int row, int col, - float* transposed_tensor); - -} // end namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TENSORFLOW_GRAPH_MATCHING_CLUSTER_UTILS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/resolve_cluster.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/resolve_cluster.h deleted file mode 100644 index 5215114..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/resolve_cluster.h +++ /dev/null @@ -1,63 +0,0 @@ -/* Copyright 2017 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_TOCO_TENSORFLOW_GRAPH_MATCHING_RESOLVE_CLUSTER_H_ -#define TENSORFLOW_LITE_TOCO_TENSORFLOW_GRAPH_MATCHING_RESOLVE_CLUSTER_H_ - -#include -#include -#include - -#include "tensorflow/lite/toco/tensorflow_graph_matching/cluster.h" -#include "tensorflow/lite/toco/tensorflow_graph_matching/resolve_svdf.h" -#include "tensorflow/core/framework/graph.pb.h" -#include "tensorflow/core/framework/node_def.pb.h" - -namespace toco { - -// Given a graph info and a list of cluster classes (cluster_factories), it -// partitions the graph to clusters, and then collapses each cluster into their -// corresponding composite ops. It generates a new graph using the newly -// generated composite ops. Each cluster factory is responsible to recognize a -// cluster of nodes into a cluster using a name-based pattern matching approach. -std::unique_ptr MaybeResolveClusters( - const tensorflow::GraphDef& graph_def, - const std::vector& cluster_factories); - -// Adds a node to a given graph. The added node will be a copy of a given source -// node, except for the inputs. If the inputs are coming from a node which -// belongs to another cluster, then those inputs are renamed to the source -// cluster name. -void AddNodeToGraph(const tensorflow::NodeDef& node, - const std::vector& cluster_names, - tensorflow::GraphDef* graph); - -// Given a graph and a cluster class, it finds all the nodes which belong to a -// given class factory, encapsulate them inside a cluster of the given type and -// returns a vector of those clusters. It also labels the nodes in that graph if -// they belong to the generated clusters. -bool FindCluster(const ClusterFactoryInterface& cluster_factory, - const tensorflow::GraphDef& graph_def, - std::unordered_map* is_node_in_cluster, - std::vector>* clusters); - -// Receives a graph and generates another graph by replacing the cluster of -// nodes which matches a given composite op. Each composite op is represented -// using a class factory. -std::unique_ptr MaybeReplaceCompositeSubgraph( - const tensorflow::GraphDef& tf_graph); - -} // end namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TENSORFLOW_GRAPH_MATCHING_RESOLVE_CLUSTER_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/resolve_svdf.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/resolve_svdf.h deleted file mode 100644 index b584301..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_graph_matching/resolve_svdf.h +++ /dev/null @@ -1,82 +0,0 @@ -/* Copyright 2017 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_TOCO_TENSORFLOW_GRAPH_MATCHING_RESOLVE_SVDF_H_ -#define TENSORFLOW_LITE_TOCO_TENSORFLOW_GRAPH_MATCHING_RESOLVE_SVDF_H_ - -#include -#include - -#include "tensorflow/lite/toco/model.h" -#include "tensorflow/lite/toco/tensorflow_graph_matching/cluster.h" -#include "tensorflow/lite/toco/tensorflow_graph_matching/cluster_utils.h" -#include "tensorflow/lite/toco/tooling_util.h" -#include "tensorflow/core/framework/attr_value.pb.h" -#include "tensorflow/core/framework/graph.pb.h" -#include "tensorflow/core/framework/node_def.pb.h" - -namespace toco { - -class SvdfCluster : public Cluster { - public: - // For this cluster, it collapses all the nodes in nodes_ into a composite op - // and it returns all the newly generated ops in new_nodes_. - void CreateNodes() override; - - // A helper function to set the pattern of Const nodes which CreateNodes() - // should handle specially. - void AddConstNodePattern(const std::string& const_pattern) { - const_node_patterns_.push_back(const_pattern); - } - - virtual ~SvdfCluster() {} - - private: - // The main function which is used to create Const nodes for this cluster. - // These Const nodes are the inputs to the composite op generated for this - // cluster. - void CreateConstNode(const std::string& const_pattern); - - // Receives a vector of Const nodes, merge them (if necessary) and returns - // only one Const node holding all the arrays contents. It transposes it if - // needed. - void MaybeMergeConstNodes( - const std::vector& const_node_parts, - bool transpose_tensor_value, - const std::unique_ptr& merged_node); - - // Infer the value of Svdf filter rank, by looking up a reshape operator which - // is used for 'output' which reshapes output from [num_filters, batch, 1] - // shape to [num_units, rank, batch] shape. The 2nd shape element is rank. - int InferFilterRank(); - - std::vector const_node_patterns_; -}; - -class SvdfClusterFactory : public ClusterFactoryInterface { - public: - // Creates a cluster of nodes using a name-based pattern matching approach. It - // uses a node as a seed and if its name matches a certain pattern, then it - // builds the cluster around that node. - // This factory expects nodes which have "SVDF_weights_feature" and - // "SVDF_weights_time" pattern in their names (and optionally "SVDF_bias") - // and it creates an SVDF Op from them. - std::unique_ptr CreateCluster( - const tensorflow::NodeDef& node, - const tensorflow::GraphDef& graph_def) const; -}; - -} // end namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TENSORFLOW_GRAPH_MATCHING_RESOLVE_SVDF_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_util.h deleted file mode 100644 index 6abad52..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tensorflow_util.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2017 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_TOCO_TENSORFLOW_UTIL_H_ -#define TENSORFLOW_LITE_TOCO_TENSORFLOW_UTIL_H_ - -#include -#include - -#include "tensorflow/lite/toco/model.h" -#include "tensorflow/core/framework/graph.pb.h" -#include "tensorflow/core/framework/tensor_shape.pb.h" - -namespace toco { - -void LogDumpGraphDef(int log_level, const std::string& message, - const tensorflow::GraphDef& tf_graph); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TENSORFLOW_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/builtin_operator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/builtin_operator.h deleted file mode 100644 index 070fab4..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/builtin_operator.h +++ /dev/null @@ -1,85 +0,0 @@ -/* Copyright 2017 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_TOCO_TFLITE_BUILTIN_OPERATOR_H_ -#define TENSORFLOW_LITE_TOCO_TFLITE_BUILTIN_OPERATOR_H_ - -#include "absl/memory/memory.h" -#include "tensorflow/lite/toco/tflite/operator.h" - -namespace toco { - -namespace tflite { - -// Builtin operators have special TF Lite objects describing their options. -// This class has the boilerplate code for creating those. -// -// Template arguments: -// - T1 must derive from ::toco::Operator. -// - T2 must be one of TF Lite's objects defining Builtin Options, such as -// ::tflite::Conv2DOptions. -template -class BuiltinOperator : public BaseOperator { - public: - using TocoOperator = T1; - using TfLiteOptions = T2; - - BuiltinOperator(::tflite::BuiltinOperator op, OperatorType type) - : BaseOperator(::tflite::EnumNameBuiltinOperator(op), type), - builtin_op_(op) {} - - // Build the configuration object in the given flatbuffer builder. Return - // its offset. - virtual flatbuffers::Offset WriteOptions( - const TocoOperator& op, - flatbuffers::FlatBufferBuilder* builder) const = 0; - - // Read options from the TF Lite object and set the corresponding values in - // the tf.mini operator. - virtual void ReadOptions(const TfLiteOptions& opt, - TocoOperator* op) const = 0; - - Options Serialize(const Operator& op, - flatbuffers::FlatBufferBuilder* builder) const override { - auto options = WriteOptions(static_cast(op), builder); - return Options::Builtin(TfLiteEnum, options.Union()); - } - - std::unique_ptr Deserialize( - const BuiltinOptions* builtin_options, - const CustomOptions* custom_options) const override { - auto op = absl::make_unique(); - auto* options = static_cast(builtin_options); - if (options) { - ReadOptions(*options, op.get()); - } - return std::unique_ptr(op.release()); - } - - int GetVersion(const OperatorSignature& op_signature) const override { - return ::tflite::GetBuiltinOperatorVersion( - GetVersioningOpSig(builtin_op_, op_signature)); - } - - ::tflite::BuiltinOperator builtin_op() const { return builtin_op_; } - - private: - const ::tflite::BuiltinOperator builtin_op_; -}; - -} // namespace tflite - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TFLITE_BUILTIN_OPERATOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/custom_operator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/custom_operator.h deleted file mode 100644 index 2ca740b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/custom_operator.h +++ /dev/null @@ -1,74 +0,0 @@ -/* Copyright 2017 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_TOCO_TFLITE_CUSTOM_OPERATOR_H_ -#define TENSORFLOW_LITE_TOCO_TFLITE_CUSTOM_OPERATOR_H_ - -#include "flatbuffers/flexbuffers.h" -#include "absl/memory/memory.h" -#include "tensorflow/lite/toco/tflite/operator.h" - -namespace toco { - -namespace tflite { - -// Custom operators have a generic byte buffer describing their options. This -// class provides the boilerplate code for populating those options using -// flexbuffers. Note that most of toco's operators will likely be supported -// as builtin operators in TF Lite. -// -// Template argument T must derive from ::toco::Operator. -template -class CustomOperator : public BaseOperator { - public: - using TocoOperator = T; - using BaseOperator::BaseOperator; - - // Populate the given flexbuffer with options obtained from the tf.mini - // operator. - virtual void WriteOptions(const TocoOperator& op, - flexbuffers::Builder* fbb) const {} - - // Set options in the given tf.mini operator using values from the flexbuffer - // map. - virtual void ReadOptions(const flexbuffers::Map& m, TocoOperator* op) const {} - - Options Serialize(const Operator& op, - flatbuffers::FlatBufferBuilder* builder) const override { - flexbuffers::Builder fbb; - fbb.Map( - [&]() { WriteOptions(static_cast(op), &fbb); }); - fbb.Finish(); - return Options::Custom(builder->CreateVector(fbb.GetBuffer())); - } - - std::unique_ptr Deserialize( - const BuiltinOptions* builtin_options, - const CustomOptions* custom_options) const override { - auto op = absl::make_unique(); - if (custom_options) { - auto flexbuffer_map = - flexbuffers::GetRoot(custom_options->data(), custom_options->size()) - .AsMap(); - ReadOptions(flexbuffer_map, op.get()); - } - return std::unique_ptr(op.release()); - } -}; - -} // namespace tflite - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TFLITE_CUSTOM_OPERATOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/export.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/export.h deleted file mode 100644 index 64f7c7b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/export.h +++ /dev/null @@ -1,179 +0,0 @@ -/* Copyright 2017 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_TOCO_TFLITE_EXPORT_H_ -#define TENSORFLOW_LITE_TOCO_TFLITE_EXPORT_H_ - -#include "tensorflow/lite/toco/model.h" -#include "tensorflow/lite/toco/tflite/operator.h" -#include "tensorflow/lite/util.h" - -namespace toco { - -namespace tflite { - -enum class QuantizedBufferType { NONE, INT8, FLOAT16 }; - -// The parameters for exporting a TFLite model. -struct ExportParams { - bool allow_custom_ops = false; - bool allow_dynamic_tensors = true; - bool enable_select_tf_ops = false; - QuantizedBufferType quantize_weights = QuantizedBufferType::NONE; -}; - -// Transform the given tf.mini model into a TF Lite flatbuffer and deposit the -// result in the given string. -tensorflow::Status Export(const Model& model, std::string* output_file_contents, - const ExportParams& params); - -// Export API with custom TFLite operator mapping. -tensorflow::Status Export( - const Model& model, std::string* output_file_contents, - const ExportParams& params, - const std::map>& ops_by_type); - -// This is for backward-compatibility. -// TODO(ycling): Remove the deprecated entry functions. -inline void Export(const Model& model, bool allow_custom_ops, - bool quantize_weights, std::string* output_file_contents) { - ExportParams params; - params.allow_custom_ops = allow_custom_ops; - params.quantize_weights = - quantize_weights ? QuantizedBufferType::INT8 : QuantizedBufferType::NONE; - auto status = Export(model, output_file_contents, params); - if (!status.ok()) LOG(QFATAL) << status.error_message(); -} - -// This is for backward-compatibility. -// TODO(ycling): Remove the deprecated entry functions. -inline void Export( - const Model& model, bool allow_custom_ops, bool quantize_weights, - std::string* output_file_contents, - const std::map>& ops_by_type) { - ExportParams params; - params.allow_custom_ops = allow_custom_ops; - params.quantize_weights = - quantize_weights ? QuantizedBufferType::INT8 : QuantizedBufferType::NONE; - auto status = Export(model, output_file_contents, params, ops_by_type); - if (!status.ok()) LOG(QFATAL) << status.error_message(); -} - -// This is for backward-compatibility. -// TODO(ycling): Remove the deprecated entry functions. -inline void Export(const Model& model, std::string* output_file_contents) { - ExportParams params; - params.allow_custom_ops = true; - auto status = Export(model, output_file_contents, params); - if (!status.ok()) LOG(QFATAL) << status.error_message(); -} - -namespace details { - -// A map from tensor name to its final position in the TF Lite buffer. -using TensorsMap = std::unordered_map; - -// A key to identify an operator. -// Only when `type` is `kUnsupported`, `custom_code` is filled to -// identify which operation is used. -class OperatorKey { - public: - OperatorKey() {} - - // Construct OperatorKey by Toco op. - OperatorKey( - const ::toco::OperatorSignature& op_signature, - const std::map>& ops_by_type, - bool enable_select_tf_ops); - - // Construct OperatorKey by type, custom code and version. - // Note that this construct doesn't set the additional information including - // `is_custom_op`, `is_flex_op`, `is_unsupported_flex_op`. - OperatorKey(::tflite::BuiltinOperator type, const std::string& custom_code, - int version) - : type_(type), custom_code_(custom_code), version_(version) {} - - // Only `type`, `custom_code` and `version` is used to compute hash and - // identity. - ::tflite::BuiltinOperator type() const { return type_; } - const std::string& custom_code() const { return custom_code_; } - int version() const { return version_; } - - // The attributes below are not used to compute hash and identity. - // - // Return true if the op is a custom op. Note it will return false for Flex - // ops. - bool is_custom_op() const { return is_custom_op_; } - // Return true if the op is a Flex op. - bool is_flex_op() const { return is_flex_op_; } - // Return true if the op is a Flex op but it's knwon that the op is not - // supported by Flex runtime. - bool is_unsupported_flex_op() const { return is_unsupported_flex_op_; } - // Return the original TensorFlow op name for a Flex op. - const std::string& flex_tensorflow_op() const { return flex_tensorflow_op_; } - - bool operator<(const OperatorKey& other) const { - if (type_ < other.type_) - return true; - else if (type_ > other.type_) - return false; - else if (custom_code_ < other.custom_code_) - return true; - else if (custom_code_ > other.custom_code_) - return false; - else - return version_ < other.version_; - } - - bool operator==(const OperatorKey& other) const { - return type_ == other.type_ && custom_code_ == other.custom_code_ && - version_ == other.version_; - } - - struct Hash { - size_t operator()(const OperatorKey& key) const { - return ::tflite::CombineHashes( - {std::hash()(static_cast(key.type())), - std::hash()(key.custom_code()), - std::hash()(key.version())}); - } - }; - - private: - ::tflite::BuiltinOperator type_ = ::tflite::BuiltinOperator_CUSTOM; - std::string custom_code_; - int version_ = 1; - - bool is_custom_op_ = false; - bool is_flex_op_ = false; - bool is_unsupported_flex_op_ = false; - // The original TensorFlow op name for the flex op. Filled only when - // `is_flex_op` is true. - std::string flex_tensorflow_op_; -}; - -// A map from OperatorKey to its final position in the TF Lite buffer. -using OperatorsMap = std::unordered_map; - -void LoadTensorsMap(const Model& model, TensorsMap* tensors_map); -void LoadOperatorsMap( - const Model& model, OperatorsMap* operators_map, - const std::map>& ops_by_type, - bool enable_select_tf_ops); - -} // namespace details -} // namespace tflite -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TFLITE_EXPORT_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/import.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/import.h deleted file mode 100644 index bac55aa..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/import.h +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright 2017 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_TOCO_TFLITE_IMPORT_H_ -#define TENSORFLOW_LITE_TOCO_TFLITE_IMPORT_H_ - -#include "tensorflow/lite/schema/schema_generated.h" -#include "tensorflow/lite/toco/model.h" - -namespace toco { - -namespace tflite { - -// Parse the given string as TF Lite flatbuffer and return a new tf.mini model. -std::unique_ptr Import(const ModelFlags &model_flags, - const std::string &input_file_contents); - -namespace details { - -// The names of all tensors found in a TF Lite model. -using TensorsTable = std::vector; - -// The names of all operators found in TF Lite model. If the operator is -// builtin, the string representation of the corresponding enum value is used -// as name. -using OperatorsTable = std::vector; - -void LoadTensorsTable(const ::tflite::Model &input_model, - TensorsTable *tensors_table); -void LoadOperatorsTable(const ::tflite::Model &input_model, - OperatorsTable *operators_table); - -} // namespace details -} // namespace tflite - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TFLITE_IMPORT_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/op_version.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/op_version.h deleted file mode 100644 index 54a7750..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/op_version.h +++ /dev/null @@ -1,32 +0,0 @@ -/* 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_TOCO_TFLITE_OP_VERSION_H_ -#define TENSORFLOW_LITE_TOCO_TFLITE_OP_VERSION_H_ - -#include "tensorflow/lite/toco/model.h" - -namespace toco { -namespace tflite { - -// Get the minimum TF Lite runtime required to run a model. Each built-in -// operator in the model will have its own minimum requirement of a runtime, and -// the model's minimum requirement of runtime is defined as the maximum of all -// the built-in operators' minimum runtime. -std::string GetMinimumRuntimeVersionForModel(const Model& model); - -} // namespace tflite -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TFLITE_OP_VERSION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/operator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/operator.h deleted file mode 100644 index fb79b97..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/operator.h +++ /dev/null @@ -1,132 +0,0 @@ -/* Copyright 2017 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_TOCO_TFLITE_OPERATOR_H_ -#define TENSORFLOW_LITE_TOCO_TFLITE_OPERATOR_H_ - -#include "flatbuffers/flatbuffers.h" -#include "flatbuffers/flexbuffers.h" -#include "tensorflow/lite/schema/schema_generated.h" -#include "tensorflow/lite/toco/model.h" -#include "tensorflow/lite/tools/versioning/op_version.h" - -namespace toco { - -namespace tflite { - -class BaseOperator; - -// Return a map contained all know TF Lite Operators, keyed by their names. -// TODO(ycling): The pattern to propagate parameters (e.g. enable_select_tf_ops) -// is ugly here. Consider refactoring. -std::map> BuildOperatorByNameMap( - bool enable_select_tf_ops = false); - -// Return a map contained all know TF Lite Operators, keyed by the type of -// their tf.mini counterparts. -std::map> BuildOperatorByTypeMap( - bool enable_select_tf_ops = false); - -// Write the custom option FlexBuffer with a serialized TensorFlow NodeDef -// for a Flex op. -std::unique_ptr WriteFlexOpOptions( - const std::string& tensorflow_node_def); - -// These are the flatbuffer types for custom and builtin options. -using CustomOptions = flatbuffers::Vector; -using BuiltinOptions = void; - -// A simple wrapper around the flatbuffer objects used to describe options that -// configure operators. -struct Options { - // Build custom options. - static Options Custom(flatbuffers::Offset offset) { - return {::tflite::BuiltinOptions_NONE, 0, offset}; - } - - // Build builtin options of the given type. - static Options Builtin(::tflite::BuiltinOptions type, - flatbuffers::Offset offset) { - return {type, offset, 0}; - } - - ::tflite::BuiltinOptions type; - flatbuffers::Offset builtin; - flatbuffers::Offset custom; -}; - -// A BaseOperator encapsulates the relationship between operators in tf.mini -// and TF lite, and provides methods for converting between those two formats. -class BaseOperator { - public: - // Build an operator with the given TF Lite name and tf.mini type. - BaseOperator(const std::string& name, OperatorType type) - : name_(name), type_(type) {} - virtual ~BaseOperator() = default; - - std::string name() const { return name_; } - OperatorType type() const { return type_; } - - // Given a tf.mini operator, create the corresponding flatbuffer options and - // return their offsets. - virtual Options Serialize(const Operator& op, - flatbuffers::FlatBufferBuilder* builder) const = 0; - - // Read TF Lite options and create the appropriate tf.mini operator. - virtual std::unique_ptr Deserialize( - const BuiltinOptions* builtin_options, - const CustomOptions* custom_options) const = 0; - - // Get the op version using the OperatorSignature. - // The function needs to be overridden to return the op version based on the - // parameters. Note: - // * The first version for each op should be 1 (to be consistent with the - // default value in Flatbuffer. `return 1;` is okay for newly implemented - // ops. - // * When multiple versions are defined for an op, this function could be - // overridden. (See example in `operator_test.cc` and - // 'tools/versioning/op_version.cc`) - virtual int GetVersion(const OperatorSignature& op_signature) const = 0; - - // Given a Toco `Operator`, return a list of booleans indicating the op - // mutates which input variables. - // * If the op mutates any input variables, it should return a list of bool - // with the same length as inputs. - // * Otherwise, it will return an empty list. - virtual std::vector GetMutatingInputVariables( - const Operator& op) const { - // Most ops don't have variable tensors. This function can be overridden. - return std::vector(); - } - - private: - std::string name_; - OperatorType type_; -}; - -// Helper function to create ::tflite::OpSignature from the given -// ::tflite::BuiltinOperator and OperatorSignature. -::tflite::OpSignature GetVersioningOpSig(const ::tflite::BuiltinOperator op, - const OperatorSignature& op_signature); - -// Helper function to determine if a unsupported TensorFlow op should be -// exported as an Flex op or a regular custom op. -bool ShouldExportAsFlexOp(bool enable_select_tf_ops, - const std::string& tensorflow_op_name); - -} // namespace tflite - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TFLITE_OPERATOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/simple_operator.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/simple_operator.h deleted file mode 100644 index 150b0d0..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/simple_operator.h +++ /dev/null @@ -1,65 +0,0 @@ -/* Copyright 2017 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_TOCO_TFLITE_SIMPLE_OPERATOR_H_ -#define TENSORFLOW_LITE_TOCO_TFLITE_SIMPLE_OPERATOR_H_ - -#include "tensorflow/lite/toco/tflite/operator.h" - -namespace toco { - -namespace tflite { - -// Simple operators don't have any configuration options and can be trivially -// serialized and deserialized. Note that most of toco's operators will -// likely be supported as builtin operators in TF Lite. Simple (and custom) -// operators are mostly a convenience for the times when tf.mini supports more -// operators than TF Lite. -// -// Template argument T must derive from ::toco::Operator. -template -class SimpleOperator : public BaseOperator { - public: - using BaseOperator::BaseOperator; - - SimpleOperator(::tflite::BuiltinOperator op, OperatorType type) - : BaseOperator(::tflite::EnumNameBuiltinOperator(op), type), - builtin_op_(op) {} - - Options Serialize(const Operator& op, - flatbuffers::FlatBufferBuilder* builder) const override { - return Options(); - } - std::unique_ptr Deserialize( - const BuiltinOptions* builtin_options, - const CustomOptions* custom_options) const override { - return std::unique_ptr(new T); - } - - int GetVersion(const OperatorSignature& op_signature) const override { - return ::tflite::GetBuiltinOperatorVersion( - GetVersioningOpSig(builtin_op_, op_signature)); - } - - ::tflite::BuiltinOperator builtin_op() const { return builtin_op_; } - - private: - const ::tflite::BuiltinOperator builtin_op_; -}; - -} // namespace tflite - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TFLITE_SIMPLE_OPERATOR_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/types.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/types.h deleted file mode 100644 index bc2edb7..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tflite/types.h +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright 2017 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_TOCO_TFLITE_TYPES_H_ -#define TENSORFLOW_LITE_TOCO_TFLITE_TYPES_H_ - -#include "tensorflow/lite/schema/schema_generated.h" -#include "tensorflow/lite/toco/model.h" - -namespace toco { - -namespace tflite { - -struct DataType { - static ::tflite::TensorType Serialize(ArrayDataType array_data_type); - static ArrayDataType Deserialize(int tensor_type); -}; - -struct DataBuffer { - using FlatBufferOffset = flatbuffers::Offset>; - - // Build the flatbuffer representation of a toco's Array and return the - // corresponding offset into the flatbuffer. Note that data from the array - // will be copied into the flatbuffer. - static FlatBufferOffset Serialize(const Array& array, - flatbuffers::FlatBufferBuilder* builder); - // Copy data from the given tensor into toco's Array. - static void Deserialize(const ::tflite::Tensor& tensor, - const ::tflite::Buffer& buffer, Array* array); -}; - -struct Padding { - static ::tflite::Padding Serialize(PaddingType padding_type); - static PaddingType Deserialize(int padding); -}; - -struct ActivationFunction { - static ::tflite::ActivationFunctionType Serialize( - FusedActivationFunctionType faf_type); - static FusedActivationFunctionType Deserialize(int activation_function); -}; - -} // namespace tflite - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TFLITE_TYPES_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_cmdline_flags.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_cmdline_flags.h deleted file mode 100644 index 278c49d..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_cmdline_flags.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2017 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_TOCO_TOCO_CMDLINE_FLAGS_H_ -#define TENSORFLOW_LITE_TOCO_TOCO_CMDLINE_FLAGS_H_ - -#include -#include -#include "tensorflow/lite/toco/args.h" -#include "tensorflow/lite/toco/toco_flags.pb.h" -#include "tensorflow/lite/toco/types.pb.h" - -namespace toco { -// Parse and remove arguments handled from toco. Returns true if parsing -// is successful. msg has the usage string if there was an error or -// "--help" was specified -bool ParseTocoFlagsFromCommandLineFlags(int* argc, char* argv[], - std::string* msg, - ParsedTocoFlags* parsed_toco_flags_ptr); -// Populate the TocoFlags proto with parsed_toco_flags data. -void ReadTocoFlagsFromCommandLineFlags(const ParsedTocoFlags& parsed_toco_flags, - TocoFlags* toco_flags); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TOCO_CMDLINE_FLAGS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_convert.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_convert.h deleted file mode 100644 index 85abcfc..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_convert.h +++ /dev/null @@ -1,35 +0,0 @@ -/* Copyright 2018 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_TOCO_TOCO_CONVERT_H_ -#define TENSORFLOW_LITE_TOCO_TOCO_CONVERT_H_ - -#include "tensorflow/core/lib/core/status.h" -#include "tensorflow/lite/toco/args.h" -#include "tensorflow/lite/toco/model_flags.pb.h" -#include "tensorflow/lite/toco/toco_flags.pb.h" - -namespace toco { - -tensorflow::Status Convert(const std::string& graph_def_contents, - const TocoFlags& toco_flags, - const ModelFlags& model_flags, - std::string* output_file_contents, - int64* arithmetic_ops_count = nullptr); - -tensorflow::Status Convert(const ParsedTocoFlags& parsed_toco_flags, - const ParsedModelFlags& parsed_model_flags); -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TOCO_CONVERT_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_graphviz_dump_options.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_graphviz_dump_options.h deleted file mode 100644 index 00d9cd1..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_graphviz_dump_options.h +++ /dev/null @@ -1,32 +0,0 @@ -/* Copyright 2017 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_TOCO_TOCO_GRAPHVIZ_DUMP_OPTIONS_H_ -#define TENSORFLOW_LITE_TOCO_TOCO_GRAPHVIZ_DUMP_OPTIONS_H_ - -#include - -namespace toco { - -// Global data for determining whether to output graph viz format from toco. -struct GraphVizDumpOptions { - std::string dump_graphviz; - bool dump_graphviz_video = false; - - static GraphVizDumpOptions* singleton(); -}; - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TOCO_GRAPHVIZ_DUMP_OPTIONS_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_port.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_port.h deleted file mode 100644 index e57420f..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_port.h +++ /dev/null @@ -1,119 +0,0 @@ -/* Copyright 2017 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_TOCO_TOCO_PORT_H_ -#define TENSORFLOW_LITE_TOCO_TOCO_PORT_H_ - -// Portability layer for toco tool. Mainly, abstract filesystem access so we -// can build and use on google internal environments and on OSX. - -#include -#include "google/protobuf/text_format.h" -#include "tensorflow/lite/toco/format_port.h" -#include "tensorflow/core/lib/core/status.h" -#include "tensorflow/core/platform/logging.h" -#include "tensorflow/core/platform/platform.h" -#if defined(PLATFORM_GOOGLE) -#include "absl/strings/cord.h" -#endif // PLATFORM_GOOGLE - -#ifdef PLATFORM_GOOGLE -#define TFLITE_PROTO_NS proto2 -#else -#define TFLITE_PROTO_NS google::protobuf -#endif - -#ifdef __ANDROID__ -#include -namespace std { - -template -std::string to_string(T value) -{ - std::ostringstream os ; - os << value ; - return os.str() ; -} - -#ifdef __ARM_ARCH_7A__ -double round(double x); -#endif -} -#endif - -namespace toco { -namespace port { - -// Things like tests use other initialization routines that need control -// of flags. However, for testing we still want to use toco_port.h facilities. -// This function sets initialized flag trivially. -void InitGoogleWasDoneElsewhere(); -void InitGoogle(const char* usage, int* argc, char*** argv, bool remove_flags); -void CheckInitGoogleIsDone(const char* message); - -namespace file { -class Options {}; -inline Options Defaults() { - Options o; - return o; -} -tensorflow::Status GetContents(const std::string& filename, - std::string* contents, const Options& options); -tensorflow::Status SetContents(const std::string& filename, - const std::string& contents, - const Options& options); -std::string JoinPath(const std::string& base, const std::string& filename); -tensorflow::Status Writable(const std::string& filename); -tensorflow::Status Readable(const std::string& filename, - const Options& options); -tensorflow::Status Exists(const std::string& filename, const Options& options); -} // namespace file - -// Copy `src` string to `dest`. User must ensure `dest` has enough space. -#if defined(PLATFORM_GOOGLE) -void CopyToBuffer(const ::absl::Cord& src, char* dest); -#endif // PLATFORM_GOOGLE -void CopyToBuffer(const std::string& src, char* dest); - -inline uint32 ReverseBits32(uint32 n) { - n = ((n >> 1) & 0x55555555) | ((n & 0x55555555) << 1); - n = ((n >> 2) & 0x33333333) | ((n & 0x33333333) << 2); - n = ((n >> 4) & 0x0F0F0F0F) | ((n & 0x0F0F0F0F) << 4); - return (((n & 0xFF) << 24) | ((n & 0xFF00) << 8) | ((n & 0xFF0000) >> 8) | - ((n & 0xFF000000) >> 24)); -} -} // namespace port - -inline bool ParseFromStringOverload(const std::string& in, - TFLITE_PROTO_NS::Message* proto) { - return TFLITE_PROTO_NS::TextFormat::ParseFromString(in, proto); -} - -template -bool ParseFromStringEitherTextOrBinary(const std::string& input_file_contents, - Proto* proto) { - if (proto->ParseFromString(input_file_contents)) { - return true; - } - - if (ParseFromStringOverload(input_file_contents, proto)) { - return true; - } - - return false; -} - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TOCO_PORT_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_tooling.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_tooling.h deleted file mode 100644 index 581df4b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_tooling.h +++ /dev/null @@ -1,59 +0,0 @@ -/* Copyright 2017 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_TOCO_TOCO_TOOLING_H_ -#define TENSORFLOW_LITE_TOCO_TOCO_TOOLING_H_ - -#include -#include - -#include "tensorflow/lite/toco/model.h" -#include "tensorflow/lite/toco/model_flags.pb.h" -#include "tensorflow/lite/toco/toco_flags.pb.h" - -namespace toco { - -// Imports the input file into a Model object. -std::unique_ptr Import(const TocoFlags& toco_flags, - const ModelFlags& model_flags, - const std::string& input_file_contents); - -// Transforms a Model. The resulting Model is ready to be passed -// to Export with the exact same toco_flags. -tensorflow::Status TransformWithStatus(const TocoFlags& toco_flags, - Model* model); -inline void Transform(const TocoFlags& toco_flags, Model* model) { - auto s = TransformWithStatus(toco_flags, model); - CHECK(s.ok()) << s.error_message(); -} - -// Exports the Model, which must be of the 'lowered' form returned by -// Transform, to a file of the format given by -// toco_flags.output_format(). -tensorflow::Status Export(const TocoFlags& toco_flags, const Model& model, - bool allow_custom_ops, - std::string* output_file_contents); - -// This if for backward-compatibility with internal tools. -inline void Export(const TocoFlags& toco_flags, const Model& model, - std::string* output_file_contents) { - auto status = Export(toco_flags, model, true, output_file_contents); - if (!status.ok()) { - LOG(QFATAL) << status.error_message(); - } -} - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TOCO_TOOLING_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_types.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_types.h deleted file mode 100644 index 43e708c..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/toco_types.h +++ /dev/null @@ -1,37 +0,0 @@ -/* Copyright 2017 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_TOCO_TOCO_TYPES_H_ -#define TENSORFLOW_LITE_TOCO_TOCO_TYPES_H_ - -#include - -#include "tensorflow/core/platform/platform.h" -#include "tensorflow/core/platform/types.h" - -namespace toco { - -using std::string; -using tensorflow::int16; -using tensorflow::int32; -using tensorflow::int64; -using tensorflow::int8; -using tensorflow::uint16; -using tensorflow::uint32; -using tensorflow::uint64; -using tensorflow::uint8; - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TOCO_TYPES_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tooling_util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tooling_util.h deleted file mode 100644 index 438ce19..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/toco/tooling_util.h +++ /dev/null @@ -1,372 +0,0 @@ -/* Copyright 2017 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_TOCO_TOOLING_UTIL_H_ -#define TENSORFLOW_LITE_TOCO_TOOLING_UTIL_H_ - -#include -#include -#include -#include -#include -#include -#include - -#include "absl/strings/string_view.h" -#include "tensorflow/core/platform/logging.h" -#if TOCO_SUPPORT_PORTABLE_PROTOS -#include "third_party/protobuf/include/google/protobuf/text_format.h" -#endif // TOCO_SUPPORT_PORTABLE_PROTOS -#include "tensorflow/lite/kernels/internal/types.h" -#include "tensorflow/lite/toco/model.h" -#include "tensorflow/lite/toco/model_flags.pb.h" -#include "tensorflow/lite/toco/runtime/types.h" -#include "tensorflow/lite/toco/toco_flags.pb.h" -#include "tensorflow/lite/toco/types.pb.h" -#include "tensorflow/core/lib/core/errors.h" -#include "tensorflow/core/lib/core/status.h" - -// TODO(aselle): Replace with using a container specific hash override instead. -namespace std { -template <> -struct hash { - size_t operator()(const toco::OperatorType& op) const { - return std::hash()(static_cast(op)); - } -}; -} // namespace std - -namespace toco { - -constexpr int kLogLevelModelChanged = 1; -constexpr int kLogLevelModelUnchanged = 2; - -absl::string_view FindLongestCommonPrefix(absl::string_view a, - absl::string_view b); -std::string LogName(const Operator& op); - -std::string ArrayDataTypeName(ArrayDataType data_type); - -// Returns true if the given array is specified as a model input array. -bool IsInputArray(const Model& model, const std::string& array_name); -// Returns true if the given array is specified as a model output array. -bool IsOutputArray(const Model& model, const std::string& array_name); - -bool IsArrayConsumed(const Model& model, const std::string& name); -int CountTrueOutputs(const Model& model, const Operator& op); - -int CountOpsWithInput(const Model& model, const std::string& array_name); -bool DeleteArrayIfUnused(const std::string& array_name, Model* model); - -// Deletes the op and any of its input and output arrays if they are unused -// after the op has been deleted. -void DeleteOpAndArrays(Model* model, const Operator* op); - -std::vector>::const_iterator FindOpWithOutput( - const Model& model, const std::string& array_name); -Operator* GetOpWithOutput(const Model& model, const std::string& array_name); - -std::vector>::iterator FindOpWithOutput( - Model& model, const std::string& array_name); - -std::vector>::const_iterator FindOpWithInput( - const Model& model, const std::string& array_name); - -std::vector>::iterator FindOpWithInput( - Model& model, const std::string& array_name); - -Operator* GetOpWithInput(const Model& model, const std::string& array_name); -Operator* GetFirstOpWithInput(const Model& model, - const std::string& array_name); - -// Replaces all uses of the |old_array_name| with the |new_array_name|. -void ReplaceArrayUsage(Model* model, const std::string& old_array_name, - const std::string& new_array_name); - -std::vector>::const_iterator FindOp( - const Model& model, const Operator* op); -std::vector>::iterator FindOp(Model& model, - const Operator* op); - -const char* OperatorTypeName(OperatorType type); -std::string HelpfulOperatorTypeName(const Operator& op); - -// Whether the operator can be fused with an activation function. Note that this -// will return false by default for new operators; fusing support is opt-in. -bool OperatorSupportsFusedActivation(OperatorType type); - -void DumpGraphvizVideoFrame(const Model& model); -void LogDump(int log_level, const std::string& message, const Model& model); -void LogSummary(int log_level, const std::string& message, const Model& model); - -// TODO(b/36075966): Clean up when dims superseded by array shape. -void ExtendShape(Shape* shape, int new_shape_size); - -// TODO(b/36075966): Clean up when dims superseded by array shape. -void UnextendShape(Shape* shape, int new_shape_size); - -// Checks that all dimensions of 'shape' are at least 1. Note that scalars, -// lacking dimensions, satisfy this condition and are considered non-empty. -bool IsNonEmpty(const Shape& shape); - -// Given two shapes with potentially different dimensionality and dimension -// arrays d0 and d1. Without loss of generality, assume that shape0 may have -// higher dimensionality (length(d0) >= length(d1)). Then shape0 and shape1 -// "agree up to broadcasting" if: -// - When walking the d0 and d1 from back to front with indices i0, i1, -// d0[i0] == d1[i1] or d0[i0] == 1 or d1[i1] == 1, for each dimension until -// i1 == 0 (inclusive). -bool ShapesAgreeUpToBroadcasting(const Shape& shape0, const Shape& shape1); - -// A stricter constraint than ShapesAgreeUpToBroadcasting(). -// -// Given two shapes with potentially different dimensionality and dimension -// arrays d0 and d1. Without loss of generality, assume that shape0 may have -// higher dimensionality (length(d0) >= length(d1)). Then shape0 and shape1 -// "agree up to extending" if: -// - When walking the d0 and d1 from back to front with indices i0, i1, -// d0[i0] == d1[i1] for each dimension until i1 == 0 (inclusive). -// - For the remaining indices [0..i0), d0[i0] == 1. -bool ShapesAgreeUpToExtending(const Shape& shape0, const Shape& shape1); - -inline ::tflite::RuntimeShape ToRuntimeShape(const Shape& shape) { - return ::tflite::RuntimeShape(shape.dimensions_count(), shape.dims().data()); -} - -bool IsArrayFullyConnectedWeights(const Model& model, const std::string& name); - -// If there is a wildcard dimension (-1), this may return a negative value. -int RequiredBufferSizeForShape(const Shape& shape); - -bool IsConstantParameterArray(const Model& model, const std::string& name); - -// Compares two constant parameter arrays for exact equality. -bool CompareConstantArrays(const Array& lhs_array, const Array& rhs_array); - -void CheckNoMissingArray(const Model& model); -void CheckInvariants(const Model& model); - -void CheckModelCounts(const Model& model); - -void FixOperatorOrdering(Model* model); -void FixNoMissingArray(Model* model); -void FixNoOrphanedArray(Model* model); - -// Fixes input/output arrays that may have issues during export or inference. -void FixEdgeArrays(Model* model); - -// Finds and deduplicates large constant arrays in the model. -// After constant propagation runs it's possible to end up with several of the -// same large array (whether they be zeros or otherwise). -// -// |min_size| is used to adjust the minimum size in bytes of an array before -// it's considered for deduping. As deduping can make the graphs more difficult -// to read this helps prevent small arrays from spidering out. -void DedupeConstantArrays(Model* model, size_t min_size); - -// Copies the contents of an array into another. -// Expects that the shape and data type match. -template -void CopyArrayBuffer(const Array& source_array, Array* target_array) { - int source_buffer_size = RequiredBufferSizeForShape(source_array.shape()); - int target_buffer_size = RequiredBufferSizeForShape(target_array->shape()); - CHECK_EQ(source_buffer_size, target_buffer_size) - << "Buffer sizes must match in element count"; - CHECK(source_array.data_type == target_array->data_type) - << "Data types must match"; - if (source_array.buffer) { - const auto& source_buffer = source_array.GetBuffer(); - auto& target_buffer = target_array->GetMutableBuffer(); - target_buffer.data = source_buffer.data; - } -} - -// Inserts a no-op reshape operator between the source array and the target -// array. This effectively just copies the data. -void InsertCopyOperator(Model* model, const std::string& source_array_name, - const std::string& target_array_name); - -// Clones an array with all data and parameters. -void CloneArray(Model* model, const std::string& source_array_name, - const std::string& target_array_name); - -void ResolveModelFlags(const ModelFlags& model_flags, Model* model); - -template -T ConvertOperator(Operator* o, OperatorType type) { - if (o != nullptr && o->type == type) { - return static_cast(o); - } - - return nullptr; -} - -void CheckIsReadyForQuantization(const Model& model); - -bool ReshapeIsEquivalentToTranspose(const Model& model, - const TensorFlowReshapeOperator* op, - bool allow_extra_unary_dims); - -inline int Offset(const Shape& shape, const std::vector& indices) { - DCHECK_EQ(shape.dimensions_count(), indices.size()); - const int dims_count = shape.dimensions_count(); - int offset = 0; - for (int i = 0; i < dims_count; i++) { - const int index = indices[i]; - DCHECK(index >= 0 && index < shape.dims(i)); - offset *= shape.dims(i); - offset += index; - } - return offset; -} - -inline std::vector ReverseOffset(const Shape& shape, int index) { - DCHECK_GE(index, 0); - DCHECK_LT(index, RequiredBufferSizeForShape(shape)); - const int dims_count = shape.dimensions_count(); - std::vector indices(dims_count); - int residual = index; - for (int i = dims_count - 1; i >= 0; i--) { - indices[i] = residual % shape.dims(i); - residual /= shape.dims(i); - } - return indices; -} - -int ElementSize(ArrayDataType data_type); - -void DropMinMax(Model* model, const std::string& array_name); - -bool IsAllocatableTransientArray(const Model& model, - const std::string& array_name); - -void CreateOrCheckRnnStateArray(const std::string& name, int size, - int state_num_dims, Model* model); - -std::string AvailableArrayName(const Model& model, const std::string& name); - -// Formats a shape as a string: [ dims(0), dims(1), ..., dims(num_dims-1) ]. -std::string ShapeToString(const Shape& shape); - -void PrintArrayShape(Model* model, const std::string& name); - -void MakeArrayDims(int num_dims, int batch, int height, int width, int depth, - std::vector* out_dims); - -// Defines a constant int32 array with the provided values formatted for use -// as op parameters. -std::string CreateInt32Array(Model* model, const std::string& param_name, - const std::vector& value); - -bool EstimateArithmeticOpsCount(const Model& model, const Operator& op, - int64* result); -bool EstimateArithmeticOpsCount(const Model& model, int64* result); -std::string FormattedNumber(int64 x); - -int AxesCount(AxesOrder axes_order); - -// Returns the permutation of the dimensions based on the input axes order and -// output axes order. -void GetShuffleShape(AxesOrder input_axes_order, AxesOrder output_axes_order, - std::vector* shuffle); - -// Extend shuffle is designed to match ExtendShape, which pads the shape with -// unit dimensions at the beginning. -void ExtendShuffle(const std::vector& input_shuffle, int newdim, - std::vector* extended_shuffle); - -void ShuffleDims(const Shape& input_shape, AxesOrder input_axes_order, - AxesOrder output_axes_order, Shape* output_shape); -void ShuffleArray(const Shape& input_shape, AxesOrder input_axes_order, - AxesOrder output_axes_order, const Shape& output_shape, - const float* input_data, float* output_data); -void ShuffleArray(const Shape& input_shape, AxesOrder input_axes_order, - AxesOrder output_axes_order, const Shape& output_shape, - const uint8* input_data, uint8* output_data); - -// Returns true if it may be OK for any graph transformation to ever discard -// that array. The idea is that we can't ever discard arrays that are either -// an input or an output of the whole graph, or that appear in RNN back-edges, -// as that would undercut explicit flags that the user might pass. -bool IsDiscardableArray(const Model& model, const std::string& array_name); - -void CheckFinalDataTypesSatisfied(const Model& model); - -ArrayDataType ConvertIODataTypeToArrayDataType(IODataType type); - -// The process of building models varies according to the import format. -// -// (a) In some cases, such as model-proto format, the model should be fully -// specified. In these cases, no extra action should be taken by this function. -// (b) In other cases, such as TF graphdef format, the desired types of RNN -// arrays are not specified directly in the model, neither can they be inferred. -// However, we can set the types of RNN destination arrays to float. This breaks -// any cycles such as when resolution of the type of an RNN source array depends -// on the type of its destination array. -// -// This function is applied after the main import, after resolution of flags and -// after application of ArraysExtraInfo. It only defaults destination RNN arrays -// to float. If the model is subsequently quantized, it is assumed that the -// model contains sufficient information for that to be completed. If it is -// already quantized, then case (a) should hold. -void FinishBuildingRNNStates(Model* model); - -void UseArraysExtraInfo(Model* model, bool quantize_output); - -// Calculates the number of elements in tensor given a shape. Shape elements -// are assumed to be of type T, while the result total is of type U. If U -// doesn't have enough range to represent the sum of elements, an error is -// returned. -template -tensorflow::Status NumElements(const std::vector& shape, U* num_elements) { - static_assert( - std::numeric_limits::max() <= std::numeric_limits::max(), - "vector type exceed capabilities of NumElements"); - - *num_elements = 1; - for (const T& dim : shape) { - if (dim < 0) { - // TensorFlow's shapes sometimes include -1 to represent an "unknown" - // size but TOCO isn't able to create arrays of unknown sizes and will - // crash in RequiredBufferSizeForShape(). - return tensorflow::errors::InvalidArgument( - "Tensor shape should not include negative values"); - } - if (*num_elements != 0 && - static_cast(dim) > - std::numeric_limits::max() / *num_elements) { - *num_elements = 0; - return tensorflow::errors::InvalidArgument("Tensor shape is too large"); - } - *num_elements *= dim; - } - return tensorflow::Status::OK(); -} - -// A model file may have shuffled FC weights. -// When that happens, we want to de-shuffle them immediately on import, -// so that the rest of toco doesn't need to know about shuffled weights. -void UndoWeightsShuffling(Model* model); - -// Copies minmax, quantization_params, and narrow_range. -void CopyMinMaxAndQuantizationRelatedFields(const Array& src, Array* dst); - -// Delete Array if it's discardable and not referenced as input or output array -// by any other op than the specified op. -bool DeleteArrayIfUnusedOutsideOfOp(const std::string& array_name, - const Operator* op, Model* model); - -} // namespace toco - -#endif // TENSORFLOW_LITE_TOCO_TOOLING_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/tools/gen_op_registration.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/tools/gen_op_registration.h deleted file mode 100644 index edb4c98..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/tools/gen_op_registration.h +++ /dev/null @@ -1,42 +0,0 @@ -/* Copyright 2017 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_TOOLS_GEN_OP_REGISTRATION_H_ -#define TENSORFLOW_LITE_TOOLS_GEN_OP_REGISTRATION_H_ - -#include "tensorflow/lite/model.h" -#include "tensorflow/lite/string_type.h" - -namespace tflite { - -// Convert the custom op name to registration name following the convention. -// Example: -// "custom_op" -> "CUSTOM_OP" -// "CustomOp" -> "CUSTOM_OP" -// Note "Register_" suffix will be added later in the tool. -string NormalizeCustomOpName(const string& op); - -// A map from op name to {min_version, max_version}. -typedef std::map> RegisteredOpMap; - -// Read ops from the TFLite model. -// The builtin ops key is the enum name of builtin ops, such as "CONV_2D". -// The custom ops key is stored as it is. -void ReadOpsFromModel(const ::tflite::Model* model, - RegisteredOpMap* builtin_ops, - RegisteredOpMap* custom_ops); - -} // namespace tflite - -#endif // TENSORFLOW_LITE_TOOLS_GEN_OP_REGISTRATION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/type_to_tflitetype.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/type_to_tflitetype.h deleted file mode 100644 index 8409a29..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/type_to_tflitetype.h +++ /dev/null @@ -1,34 +0,0 @@ -/* 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_TYPE_TO_TFLITETYPE_H_ -#define TENSORFLOW_LITE_TYPE_TO_TFLITETYPE_H_ - -#include - -#include "tensorflow/lite/c/common.h" - -// Most of the definitions have been moved to this subheader so that Micro -// can include it without relying on , which isn't available on all -// platforms. -#include "tensorflow/lite/portable_type_to_tflitetype.h" - -namespace tflite { - -// TODO(b/163167649): This string conversion means that only the first entry -// in a string tensor will be returned as a std::string, so it's deprecated. -MATCH_TYPE_AND_TFLITE_TYPE(std::string, kTfLiteString); - -} // namespace tflite -#endif // TENSORFLOW_LITE_TYPE_TO_TFLITETYPE_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/util.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/util.h deleted file mode 100644 index cf4576d..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/util.h +++ /dev/null @@ -1,93 +0,0 @@ -/* Copyright 2017 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. -==============================================================================*/ - -// This file provides general C++ utility functions in TFLite. -// For example: Converting between `TfLiteIntArray`, `std::vector` and -// Flatbuffer vectors. These functions can't live in `context.h` since it's pure -// C. - -#ifndef TENSORFLOW_LITE_UTIL_H_ -#define TENSORFLOW_LITE_UTIL_H_ - -#include -#include -#include - -#include "tensorflow/lite/c/common.h" - -namespace tflite { - -// Memory allocation parameter used by ArenaPlanner. -// Clients (such as delegates) might look at this to ensure interop between -// TFLite memory & hardware buffers. -// NOTE: This only holds for tensors allocated on the arena. -constexpr int kDefaultTensorAlignment = 64; - -// The prefix of Flex op custom code. -// This will be matched agains the `custom_code` field in `OperatorCode` -// Flatbuffer Table. -// WARNING: This is an experimental API and subject to change. -constexpr char kFlexCustomCodePrefix[] = "Flex"; - -// Checks whether the prefix of the custom name indicates the operation is an -// Flex operation. -bool IsFlexOp(const char* custom_name); - -// Converts a `std::vector` to a `TfLiteIntArray`. The caller takes ownership -// of the returned pointer. -TfLiteIntArray* ConvertVectorToTfLiteIntArray(const std::vector& input); - -// Converts an array (of the given size) to a `TfLiteIntArray`. The caller -// takes ownership of the returned pointer, and must make sure 'dims' has at -// least 'rank' elements. -TfLiteIntArray* ConvertArrayToTfLiteIntArray(const int rank, const int* dims); - -// Checks whether a `TfLiteIntArray` and an int array have matching elements. -// The caller must guarantee that 'b' has at least 'b_size' elements. -bool EqualArrayAndTfLiteIntArray(const TfLiteIntArray* a, const int b_size, - const int* b); - -size_t CombineHashes(std::initializer_list hashes); - -struct TfLiteIntArrayDeleter { - void operator()(TfLiteIntArray* a) { - if (a) TfLiteIntArrayFree(a); - } -}; - -// Helper for Building TfLiteIntArray that is wrapped in a unique_ptr, -// So that it is automatically freed when it goes out of the scope. -std::unique_ptr BuildTfLiteIntArray( - const std::vector& data); - -// Populates the size in bytes of a type into `bytes`. Returns kTfLiteOk for -// valid types, and kTfLiteError otherwise. -TfLiteStatus GetSizeOfType(TfLiteContext* context, const TfLiteType type, - size_t* bytes); - -// Creates a stub TfLiteRegistration instance with the provided -// `custom_op_name`. The op will fail if invoked, and is useful as a -// placeholder to defer op resolution. -// Note that `custom_op_name` must remain valid for the returned op's lifetime.. -TfLiteRegistration CreateUnresolvedCustomOp(const char* custom_op_name); - -// Checks whether the provided op is an unresolved custom op. -bool IsUnresolvedCustomOp(const TfLiteRegistration& registration); - -// Returns a descriptive name with the given op TfLiteRegistration. -std::string GetOpNameByRegistration(const TfLiteRegistration& registration); -} // namespace tflite - -#endif // TENSORFLOW_LITE_UTIL_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/version.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/version.h deleted file mode 100644 index f667447..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/externals/tensorflow/lite/version.h +++ /dev/null @@ -1,29 +0,0 @@ -/* Copyright 2017 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_VERSION_H_ -#define TENSORFLOW_LITE_VERSION_H_ - -#include "tensorflow/core/public/version.h" - -// The version number of the Schema. Ideally all changes will be backward -// compatible. If that ever changes, we must ensure that version is the first -// entry in the new tflite root so that we can see that version is not 1. -#define TFLITE_SCHEMA_VERSION (3) - -// TensorFlow Lite Runtime version. -// This value is currently shared with that of TensorFlow. -#define TFLITE_VERSION_STRING TF_VERSION_STRING - -#endif // TENSORFLOW_LITE_VERSION_H_ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/module.modulemap b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/module.modulemap deleted file mode 100644 index 3f86dff..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/module.modulemap +++ /dev/null @@ -1,8 +0,0 @@ -framework module BlurDiscriminatorKit { - export * - - explicit module Private { - umbrella header "InterpreterWrapper.h" - export * - } -} diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/objc_wrapper/InterpreterWrapper.h b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/objc_wrapper/InterpreterWrapper.h deleted file mode 100644 index 4850a7b..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/objc_wrapper/InterpreterWrapper.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// InterpreterWrapper.h -// BlurDiscriminatorKit -// -// Created by syjdev on 2021/09/27. -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface InterpreterWrapper: NSObject - -- (instancetype)initWithModelPath:(NSString *)modelPath andNumberOfThread:(UInt8)numberOfThread; -- (nullable NSData *)interpretWithInputData:(NSData *)inputData; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/objc_wrapper/InterpreterWrapper.mm b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/objc_wrapper/InterpreterWrapper.mm deleted file mode 100644 index 138c422..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/objc_wrapper/InterpreterWrapper.mm +++ /dev/null @@ -1,72 +0,0 @@ -// -// InterpreterWrapper.mm -// BlurDiscriminatorKit -// -// Created by syjdev on 2021/09/27. -// - -#import "InterpreterWrapper.h" - -#include "tensorflow/lite/interpreter.h" -#include "tensorflow/lite/kernels/register.h" -#include "tensorflow/lite/model.h" -#include - -@interface InterpreterWrapper () - -{ - std::unique_ptr _interpreter; - std::unique_ptr _model; - tflite::ops::builtin::BuiltinOpResolver _resolver; -} - -@end - - -@implementation InterpreterWrapper - -- (instancetype)initWithModelPath:(NSString *)modelPath andNumberOfThread:(UInt8)numberOfThread { - self = [super init]; - if (self) { - _model = tflite::FlatBufferModel::BuildFromFile([modelPath UTF8String], nullptr); - NSAssert(_model, @"failed to build model. maybe modelPath was invalid."); - - tflite::InterpreterBuilder(*_model, _resolver)(&_interpreter); - NSAssert(_interpreter, @"failed to build interpreter. maybe tflite model was invalid."); - - _interpreter->SetNumThreads(numberOfThread); - - // 텐서 할당은 입력 크기가 변하지 않는 한 최초 1회면 충분하다. - TfLiteStatus allocationStatus = _interpreter->AllocateTensors(); - NSAssert(allocationStatus == kTfLiteOk, @"failed to allocate tensors."); - (void)allocationStatus; - } - return self; -} - -- (nullable NSData *)interpretWithInputData:(NSData *)inputData { - // Copy raw bytes so the wrapper works for both float32 and uint8 models. - // The converters on the Swift side must produce/consume the matching layout. - TfLiteTensor *inputTensor = _interpreter->input_tensor(0); - NSAssert(inputTensor != nullptr && inputData.length == inputTensor->bytes, - @"input size mismatch. expected %zu bytes, got %lu.", - inputTensor->bytes, (unsigned long)inputData.length); - if (inputTensor == nullptr || inputData.length != inputTensor->bytes) { - return nil; - } - - std::memcpy(inputTensor->data.raw, inputData.bytes, inputTensor->bytes); - - if (_interpreter->Invoke() != kTfLiteOk) { - return nil; - } - - const TfLiteTensor *outputTensor = _interpreter->output_tensor(0); - if (outputTensor == nullptr) { - return nil; - } - - return [NSData dataWithBytes:outputTensor->data.raw length:outputTensor->bytes]; -} - -@end diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/BlurDiscriminatorKitTests.swift b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/BlurDiscriminatorKitTests.swift index 71c0ed6..5bb9a75 100644 --- a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/BlurDiscriminatorKitTests.swift +++ b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/BlurDiscriminatorKitTests.swift @@ -11,55 +11,37 @@ import BlurDiscriminatorKit class BlurDiscriminatorKitTests: XCTestCase { - struct TestData { - let name: String - let expectedBlurRatio: Float - } - - private let testDatas = [TestData(name: "image_f264_horizontal_fliped.jpg", expectedBlurRatio: 0.75), - TestData(name: "image_f67_origin.jpg", expectedBlurRatio: 0.75), - TestData(name: "image_f477_origin.jpg", expectedBlurRatio: 0.73)] - + // CC0 sample images (Wikimedia Commons, public domain) bundled as test fixtures. + private let imageNames = ["cc0_cherry_blossom.jpg", + "cc0_ant_sunflower.jpg", + "cc0_misty_river.jpg"] + private lazy var bundle: Bundle = { return Bundle(for: type(of: self)) }() - private var blurDiscriminator: BlurDiscriminator? - - - override func setUpWithError() throws { - guard let modelPath = bundle.path(forResource: "blur_segmentation_quantized", ofType: "tflite") - else { - fatalError("failed to find `blur_segmentation_quantized.tflite`") - } - - - - blurDiscriminator = BlurDiscriminator(modelPath: modelPath, numberOfThread: 2) - } - - override func tearDownWithError() throws { - blurDiscriminator = nil - } + // The Core ML model ships inside BlurDiscriminatorKit.framework and is loaded + // lazily on the first predict, so creating the discriminator is cheap. + private let blurDiscriminator = BlurDiscriminator() + + + // End-to-end smoke test: the bundled model runs on real images and produces a + // well-formed blur map. The exact blur ratio is model-specific, so we assert the + // output is valid rather than pinning a magic number. + func test_predict_with_images() async throws { + for name in imageNames { + let image = try XCTUnwrap(UIImage(named: name, in: bundle, compatibleWith: nil)?.cgImage, + "failed to find image `\(name)`") + + let observation = try await blurDiscriminator.predict(input: image) - - func test_predict_with_images() throws { - for testData in testDatas { - guard let image = UIImage(named: testData.name, in: bundle, compatibleWith: nil)?.cgImage else { - fatalError("failed to find a image, `\(testData.name)`") - } - - guard let observation = blurDiscriminator?.predict(input: image) else { - fatalError("failed to predict, image name - `\(testData.name)`") - } - - let blurRatio = observation.blurRatio(threshold: 127) - let assertMessage = """ - Result blurRatio of predict should be similar with expectedBlurRatio. - Check this, \(testData.name). result: \(blurRatio), expected: \(testData.expectedBlurRatio) - """ + XCTAssertGreaterThan(observation.grayscaledPixels.count, 0, "\(name): empty blur map") + XCTAssertEqual(observation.blurMap.width * observation.blurMap.height, + observation.grayscaledPixels.count, + "\(name): blur map size and pixel count disagree") - XCTAssert(abs(blurRatio - testData.expectedBlurRatio) < 1, assertMessage) + let ratio = observation.blurRatio() + XCTAssert((0...1).contains(ratio), "\(name): blur ratio \(ratio) out of range") } } diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/BlurDiscriminatorLoadingTests.swift b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/BlurDiscriminatorLoadingTests.swift new file mode 100644 index 0000000..2304a12 --- /dev/null +++ b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/BlurDiscriminatorLoadingTests.swift @@ -0,0 +1,110 @@ +// +// BlurDiscriminatorLoadingTests.swift +// BlurDiscriminatorKitTests +// +// Unit tests for BlurDiscriminator's lazy predictor loading, using an injected +// test double instead of the real Core ML model. +// + +import XCTest +import CoreGraphics +@testable import BlurDiscriminatorKit + + +class BlurDiscriminatorLoadingTests: XCTestCase { + private struct StubError: Error {} + + /// A predictor double that returns a fixed observation. + private final class PredictorStub: BlurPredicting, @unchecked Sendable { + let observation: BlurObservation + + init(observation: BlurObservation) { + self.observation = observation + } + + func predict(input: CGImage) throws -> BlurObservation { + return observation + } + } + + /// Counts loader invocations; lock-guarded because the loader closure is `@Sendable`. + private final class LoadRecorder: @unchecked Sendable { + private let lock = NSLock() + private var count = 0 + + func increment() -> Int { + lock.lock(); defer { lock.unlock() } + count += 1 + return count + } + + var loadCount: Int { + lock.lock(); defer { lock.unlock() } + return count + } + } + + + func test_predictor_is_loaded_once_and_cached() async throws { + let observation = try XCTUnwrap(Self.makeObservation()) + let recorder = LoadRecorder() + let discriminator = BlurDiscriminator(loadPredictor: { + _ = recorder.increment() + return PredictorStub(observation: observation) + }) + let input = try XCTUnwrap(Self.makeGrayImage(width: 1, height: 1)) + + let first = try await discriminator.predict(input: input) + let second = try await discriminator.predict(input: input) + + XCTAssertEqual(recorder.loadCount, 1, "the predictor should be loaded once and cached") + XCTAssertEqual(first.grayscaledPixels, observation.grayscaledPixels) + XCTAssertEqual(second.grayscaledPixels, observation.grayscaledPixels) + } + + + func test_failed_load_is_not_cached_and_can_be_retried() async throws { + let observation = try XCTUnwrap(Self.makeObservation()) + let recorder = LoadRecorder() + let discriminator = BlurDiscriminator(loadPredictor: { + if recorder.increment() == 1 { + throw StubError() + } + return PredictorStub(observation: observation) + }) + let input = try XCTUnwrap(Self.makeGrayImage(width: 1, height: 1)) + + do { + _ = try await discriminator.predict(input: input) + XCTFail("the first predict should rethrow the load failure") + } catch is StubError { + // expected: the load failure reaches the caller + } + + let recovered = try await discriminator.predict(input: input) + + XCTAssertEqual(recorder.loadCount, 2, "a failed load should not be cached") + XCTAssertEqual(recovered.grayscaledPixels, observation.grayscaledPixels) + } + + + // MARK: - fixtures + + private static func makeObservation() -> BlurObservation? { + guard let blurMap = makeGrayImage(width: 1, height: 1) else { return nil } + return BlurObservation(blurMap: blurMap, grayscaledPixels: [255]) + } + + private static func makeGrayImage(width: Int, height: Int) -> CGImage? { + guard let context = CGContext(data: nil, + width: width, + height: height, + bitsPerComponent: 8, + bytesPerRow: width, + space: CGColorSpaceCreateDeviceGray(), + bitmapInfo: CGImageAlphaInfo.none.rawValue) else { + return nil + } + return context.makeImage() + } +} diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/blur_segmentation_quantized.tflite b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/blur_segmentation_quantized.tflite deleted file mode 100644 index 7416054..0000000 Binary files a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/blur_segmentation_quantized.tflite and /dev/null differ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/cc0_ant_sunflower.jpg b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/cc0_ant_sunflower.jpg new file mode 100644 index 0000000..a04ca22 Binary files /dev/null and b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/cc0_ant_sunflower.jpg differ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/cc0_cherry_blossom.jpg b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/cc0_cherry_blossom.jpg new file mode 100644 index 0000000..6ac69a9 Binary files /dev/null and b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/cc0_cherry_blossom.jpg differ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/cc0_misty_river.jpg b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/cc0_misty_river.jpg new file mode 100644 index 0000000..5f7de84 Binary files /dev/null and b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/cc0_misty_river.jpg differ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/image_f264_horizontal_fliped.jpg b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/image_f264_horizontal_fliped.jpg deleted file mode 100644 index 7794415..0000000 Binary files a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/image_f264_horizontal_fliped.jpg and /dev/null differ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/image_f477_origin.jpg b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/image_f477_origin.jpg deleted file mode 100644 index f3ce428..0000000 Binary files a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/image_f477_origin.jpg and /dev/null differ diff --git a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/image_f67_origin.jpg b/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/image_f67_origin.jpg deleted file mode 100644 index 92967d6..0000000 Binary files a/Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKitTests/resources/image_f67_origin.jpg and /dev/null differ diff --git a/Demo/iOS/BlurDiscriminatorKit/build_blurDiscriminator.sh b/Demo/iOS/BlurDiscriminatorKit/build_blurDiscriminator.sh deleted file mode 100755 index c5bd197..0000000 --- a/Demo/iOS/BlurDiscriminatorKit/build_blurDiscriminator.sh +++ /dev/null @@ -1,30 +0,0 @@ -FRAMEWORK_NAME="BlurDiscriminatorKit" - -PATH_OF_ARTIFACT="./artifact" -PATF_OF_DEVICE_FRAMEWORK="${PATH_OF_ARTIFACT}/Build/Products/Release-iphoneos/${FRAMEWORK_NAME}.framework" -PATF_OF_SIMULATOR_FRAMEWORK="${PATH_OF_ARTIFACT}/Build/Products/Release-iphonesimulator/${FRAMEWORK_NAME}.framework" -PATH_OF_XCFRAMEWORK="./built_xcframework" - -xcodebuild build -project BlurDiscriminatorKit.xcodeproj \ - -scheme BlurDiscriminatorKit \ - -sdk iphonesimulator \ - -configuration Release \ - -derivedDataPath "${PATH_OF_ARTIFACT}" - -xcodebuild build -project BlurDiscriminatorKit.xcodeproj \ - -scheme BlurDiscriminatorKit \ - -sdk iphoneos \ - -configuration Release \ - -derivedDataPath "${PATH_OF_ARTIFACT}" - -if [ -e "${PATH_OF_XCFRAMEWORK}" ]; then - rm -rf "${PATH_OF_XCFRAMEWORK}" -fi - -xcodebuild -create-xcframework -framework "${PATF_OF_DEVICE_FRAMEWORK}" \ - -framework "${PATF_OF_SIMULATOR_FRAMEWORK}" \ - -output "built_xcframework/${FRAMEWORK_NAME}.xcframework" - -if [ -e "${PATH_OF_ARTIFACT}" ]; then - rm -rf "${PATH_OF_ARTIFACT}" -fi diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_ant_sunflower.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_ant_sunflower.imageset/Contents.json new file mode 100644 index 0000000..0da5d4a --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_ant_sunflower.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_ant_sunflower.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_ant_sunflower.imageset/cc0_ant_sunflower.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_ant_sunflower.imageset/cc0_ant_sunflower.jpg new file mode 100644 index 0000000..a04ca22 Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_ant_sunflower.imageset/cc0_ant_sunflower.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_cherry_blossom.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_cherry_blossom.imageset/Contents.json new file mode 100644 index 0000000..5e4b9c1 --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_cherry_blossom.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_cherry_blossom.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_cherry_blossom.imageset/cc0_cherry_blossom.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_cherry_blossom.imageset/cc0_cherry_blossom.jpg new file mode 100644 index 0000000..6ac69a9 Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_cherry_blossom.imageset/cc0_cherry_blossom.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_clover_closeup.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_clover_closeup.imageset/Contents.json new file mode 100644 index 0000000..3cba63d --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_clover_closeup.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_clover_closeup.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_clover_closeup.imageset/cc0_clover_closeup.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_clover_closeup.imageset/cc0_clover_closeup.jpg new file mode 100644 index 0000000..f317ac2 Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_clover_closeup.imageset/cc0_clover_closeup.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_dew_grass.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_dew_grass.imageset/Contents.json new file mode 100644 index 0000000..c940588 --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_dew_grass.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_dew_grass.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_dew_grass.imageset/cc0_dew_grass.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_dew_grass.imageset/cc0_dew_grass.jpg new file mode 100644 index 0000000..1a244ee Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_dew_grass.imageset/cc0_dew_grass.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_flower_bokeh.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_flower_bokeh.imageset/Contents.json new file mode 100644 index 0000000..e68cd45 --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_flower_bokeh.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_flower_bokeh.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_flower_bokeh.imageset/cc0_flower_bokeh.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_flower_bokeh.imageset/cc0_flower_bokeh.jpg new file mode 100644 index 0000000..a10079b Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_flower_bokeh.imageset/cc0_flower_bokeh.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_highway_bokeh.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_highway_bokeh.imageset/Contents.json new file mode 100644 index 0000000..026410a --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_highway_bokeh.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_highway_bokeh.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_highway_bokeh.imageset/cc0_highway_bokeh.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_highway_bokeh.imageset/cc0_highway_bokeh.jpg new file mode 100644 index 0000000..b3d4e8b Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_highway_bokeh.imageset/cc0_highway_bokeh.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_icicles.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_icicles.imageset/Contents.json new file mode 100644 index 0000000..350ac82 --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_icicles.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_icicles.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_icicles.imageset/cc0_icicles.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_icicles.imageset/cc0_icicles.jpg new file mode 100644 index 0000000..21ebaa1 Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_icicles.imageset/cc0_icicles.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_love_in_a_cup.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_love_in_a_cup.imageset/Contents.json new file mode 100644 index 0000000..f18fbec --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_love_in_a_cup.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_love_in_a_cup.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_love_in_a_cup.imageset/cc0_love_in_a_cup.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_love_in_a_cup.imageset/cc0_love_in_a_cup.jpg new file mode 100644 index 0000000..98db17a Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_love_in_a_cup.imageset/cc0_love_in_a_cup.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_misty_river.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_misty_river.imageset/Contents.json new file mode 100644 index 0000000..7946630 --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_misty_river.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_misty_river.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_misty_river.imageset/cc0_misty_river.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_misty_river.imageset/cc0_misty_river.jpg new file mode 100644 index 0000000..5f7de84 Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_misty_river.imageset/cc0_misty_river.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_morning_coffee.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_morning_coffee.imageset/Contents.json new file mode 100644 index 0000000..5d717a1 --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_morning_coffee.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_morning_coffee.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_morning_coffee.imageset/cc0_morning_coffee.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_morning_coffee.imageset/cc0_morning_coffee.jpg new file mode 100644 index 0000000..dba5af0 Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_morning_coffee.imageset/cc0_morning_coffee.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_panning_gulls.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_panning_gulls.imageset/Contents.json new file mode 100644 index 0000000..4d40294 --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_panning_gulls.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_panning_gulls.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_panning_gulls.imageset/cc0_panning_gulls.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_panning_gulls.imageset/cc0_panning_gulls.jpg new file mode 100644 index 0000000..2ec2064 Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_panning_gulls.imageset/cc0_panning_gulls.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_street_bokeh.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/cc0_street_bokeh.imageset/Contents.json new file mode 100644 index 0000000..a2960e1 --- /dev/null +++ b/Demo/iOS/demo/Assets.xcassets/cc0_street_bokeh.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "cc0_street_bokeh.jpg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/Demo/iOS/demo/Assets.xcassets/cc0_street_bokeh.imageset/cc0_street_bokeh.jpg b/Demo/iOS/demo/Assets.xcassets/cc0_street_bokeh.imageset/cc0_street_bokeh.jpg new file mode 100644 index 0000000..65d4efa Binary files /dev/null and b/Demo/iOS/demo/Assets.xcassets/cc0_street_bokeh.imageset/cc0_street_bokeh.jpg differ diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0041.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/dut_test_0041.imageset/Contents.json deleted file mode 100644 index 2204fae..0000000 --- a/Demo/iOS/demo/Assets.xcassets/dut_test_0041.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "dut_test_0041.jpg", - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0041.imageset/dut_test_0041.jpg b/Demo/iOS/demo/Assets.xcassets/dut_test_0041.imageset/dut_test_0041.jpg deleted file mode 100644 index d6947d1..0000000 Binary files a/Demo/iOS/demo/Assets.xcassets/dut_test_0041.imageset/dut_test_0041.jpg and /dev/null differ diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0044.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/dut_test_0044.imageset/Contents.json deleted file mode 100644 index 2927034..0000000 --- a/Demo/iOS/demo/Assets.xcassets/dut_test_0044.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "dut_test_0044.jpg", - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0044.imageset/dut_test_0044.jpg b/Demo/iOS/demo/Assets.xcassets/dut_test_0044.imageset/dut_test_0044.jpg deleted file mode 100644 index 89558ef..0000000 Binary files a/Demo/iOS/demo/Assets.xcassets/dut_test_0044.imageset/dut_test_0044.jpg and /dev/null differ diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0055.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/dut_test_0055.imageset/Contents.json deleted file mode 100644 index 7a2dcbb..0000000 --- a/Demo/iOS/demo/Assets.xcassets/dut_test_0055.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "dut_test_0055.jpg", - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0055.imageset/dut_test_0055.jpg b/Demo/iOS/demo/Assets.xcassets/dut_test_0055.imageset/dut_test_0055.jpg deleted file mode 100644 index f87c779..0000000 Binary files a/Demo/iOS/demo/Assets.xcassets/dut_test_0055.imageset/dut_test_0055.jpg and /dev/null differ diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0132.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/dut_test_0132.imageset/Contents.json deleted file mode 100644 index 0e67244..0000000 --- a/Demo/iOS/demo/Assets.xcassets/dut_test_0132.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "dut_test_0132.jpg", - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0132.imageset/dut_test_0132.jpg b/Demo/iOS/demo/Assets.xcassets/dut_test_0132.imageset/dut_test_0132.jpg deleted file mode 100644 index 4be29a6..0000000 Binary files a/Demo/iOS/demo/Assets.xcassets/dut_test_0132.imageset/dut_test_0132.jpg and /dev/null differ diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0184.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/dut_test_0184.imageset/Contents.json deleted file mode 100644 index a55065a..0000000 --- a/Demo/iOS/demo/Assets.xcassets/dut_test_0184.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "dut_test_0184.jpg", - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0184.imageset/dut_test_0184.jpg b/Demo/iOS/demo/Assets.xcassets/dut_test_0184.imageset/dut_test_0184.jpg deleted file mode 100644 index 6d34cdb..0000000 Binary files a/Demo/iOS/demo/Assets.xcassets/dut_test_0184.imageset/dut_test_0184.jpg and /dev/null differ diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0189.imageset/Contents.json b/Demo/iOS/demo/Assets.xcassets/dut_test_0189.imageset/Contents.json deleted file mode 100644 index 67b18b6..0000000 --- a/Demo/iOS/demo/Assets.xcassets/dut_test_0189.imageset/Contents.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "images" : [ - { - "idiom" : "universal", - "scale" : "1x" - }, - { - "filename" : "dut_test_0189.jpg", - "idiom" : "universal", - "scale" : "2x" - }, - { - "idiom" : "universal", - "scale" : "3x" - } - ], - "info" : { - "author" : "xcode", - "version" : 1 - } -} diff --git a/Demo/iOS/demo/Assets.xcassets/dut_test_0189.imageset/dut_test_0189.jpg b/Demo/iOS/demo/Assets.xcassets/dut_test_0189.imageset/dut_test_0189.jpg deleted file mode 100644 index 5a15111..0000000 Binary files a/Demo/iOS/demo/Assets.xcassets/dut_test_0189.imageset/dut_test_0189.jpg and /dev/null differ diff --git a/Demo/iOS/demo/Resources/blur_segmentation_qat.tflite b/Demo/iOS/demo/Resources/blur_segmentation_qat.tflite deleted file mode 100644 index 0ec293a..0000000 Binary files a/Demo/iOS/demo/Resources/blur_segmentation_qat.tflite and /dev/null differ diff --git a/Demo/iOS/demo/ViewController.swift b/Demo/iOS/demo/ViewController.swift index 03191a1..2b8b1db 100644 --- a/Demo/iOS/demo/ViewController.swift +++ b/Demo/iOS/demo/ViewController.swift @@ -7,31 +7,25 @@ import UIKit import BlurDiscriminatorKit -import Accelerate class ViewController: UIViewController { @IBOutlet weak var inputImageView: UIImageView! @IBOutlet weak var outputImageView: UIImageView! @IBOutlet weak var elapsedTimeLabel: UILabel! - let imageNames = ["dut_test_0041", "dut_test_0044", "dut_test_0055", "dut_test_0132", "dut_test_0184", "dut_test_0189"] - private var currentImageIndex: Int = 0 - var blurDiscriminator: BlurDiscriminator! + let imageNames = ["cc0_cherry_blossom", "cc0_flower_bokeh", "cc0_ant_sunflower", "cc0_highway_bokeh", "cc0_misty_river", "cc0_street_bokeh", + "cc0_morning_coffee", "cc0_love_in_a_cup", "cc0_dew_grass", "cc0_panning_gulls", "cc0_clover_closeup", "cc0_icicles"] +// let imageNames = ["cc0_dew_grass"] - override func viewDidLoad() { - super.viewDidLoad() - if blurDiscriminator == nil { - blurDiscriminator = BlurDiscriminator(modelPath: Bundle.main.path(forResource: "blur_segmentation_qat", ofType: "tflite") ?? "", - numberOfThread: 2) - } - } - + //cc0_dew_grass + private var currentImageIndex: Int = 0 + private let blurDiscriminator = BlurDiscriminator() @IBAction func didClickRunButton(_ sender: UIButton) { let selectedImageName = self.imageNames[currentImageIndex] currentImageIndex = (currentImageIndex + 1) % imageNames.count - - guard let originImage = UIImage(named: selectedImageName) else { + + guard let originImage = UIImage(named: selectedImageName)?.orientedUp() else { fatalError("couldn't find the image.") } @@ -43,9 +37,27 @@ class ViewController: UIViewController { let startTime: CFAbsoluteTime = CFAbsoluteTimeGetCurrent() Task { - guard let observation = await blurDiscriminator.predict(input: cgImage) else { return } + guard let observation = try? await blurDiscriminator.predict(input: cgImage) else { return } self.elapsedTimeLabel.text = String(format: "elapsed time : %.3f ms", (CFAbsoluteTimeGetCurrent() - startTime) * 1000) self.outputImageView.image = UIImage(cgImage: observation.blurMap) } } } + + +private extension UIImage { + /// Returns an image whose pixel buffer is oriented `.up`, so `cgImage` matches what is displayed. + /// + /// `UIImage(named:)` honours a photo's EXIF orientation when drawing, but `.cgImage` exposes the + /// raw (possibly rotated) pixel buffer with no orientation. Feeding that raw buffer to the model + /// while showing the EXIF-corrected image makes the blur map look rotated. Normalising here keeps + /// the model input and the displayed image aligned. + func orientedUp() -> UIImage { + guard imageOrientation != .up else { return self } + let format = UIGraphicsImageRendererFormat.default() + format.scale = scale + return UIGraphicsImageRenderer(size: size, format: format).image { _ in + draw(in: CGRect(origin: .zero, size: size)) + } + } +} diff --git a/Demo/iOS/demo/demo.xcodeproj/project.pbxproj b/Demo/iOS/demo/demo.xcodeproj/project.pbxproj index ed43ec3..480dccd 100644 --- a/Demo/iOS/demo/demo.xcodeproj/project.pbxproj +++ b/Demo/iOS/demo/demo.xcodeproj/project.pbxproj @@ -7,7 +7,6 @@ objects = { /* Begin PBXBuildFile section */ - DEB7DBD52FFBD51600B294B6 /* blur_segmentation_qat.tflite in Resources */ = {isa = PBXBuildFile; fileRef = DEB7DBD42FFBD51600B294B6 /* blur_segmentation_qat.tflite */; }; DEEA14AF2732F5A80060812D /* BlurDiscriminatorKit.framework in Embed Frameworks */ = {isa = PBXBuildFile; fileRef = DEEA14AE2732F5A80060812D /* BlurDiscriminatorKit.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, RemoveHeadersOnCopy, ); }; }; DEEAC5EC269C741400D753CA /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEAC5EB269C741400D753CA /* AppDelegate.swift */; }; DEEAC5EE269C741400D753CA /* SceneDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = DEEAC5ED269C741400D753CA /* SceneDelegate.swift */; }; @@ -32,7 +31,6 @@ /* End PBXCopyFilesBuildPhase section */ /* Begin PBXFileReference section */ - DEB7DBD42FFBD51600B294B6 /* blur_segmentation_qat.tflite */ = {isa = PBXFileReference; lastKnownFileType = file; path = blur_segmentation_qat.tflite; sourceTree = ""; }; DEEA14AE2732F5A80060812D /* BlurDiscriminatorKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; path = BlurDiscriminatorKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; DEEAC5E8269C741400D753CA /* demo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = demo.app; sourceTree = BUILT_PRODUCTS_DIR; }; DEEAC5EB269C741400D753CA /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; }; @@ -55,14 +53,6 @@ /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ - DEA8C498269C8FC800BF5107 /* Resources */ = { - isa = PBXGroup; - children = ( - DEB7DBD42FFBD51600B294B6 /* blur_segmentation_qat.tflite */, - ); - path = Resources; - sourceTree = ""; - }; DEEA14AD2732F5A80060812D /* Frameworks */ = { isa = PBXGroup; children = ( @@ -98,7 +88,6 @@ DEEAC5F4269C741600D753CA /* Assets.xcassets */, DEEAC5F9269C741600D753CA /* Info.plist */, DEEAC5F6269C741600D753CA /* LaunchScreen.storyboard */, - DEA8C498269C8FC800BF5107 /* Resources */, ); name = demo; sourceTree = ""; @@ -173,7 +162,6 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - DEB7DBD52FFBD51600B294B6 /* blur_segmentation_qat.tflite in Resources */, DEEAC5F8269C741600D753CA /* LaunchScreen.storyboard in Resources */, DEEAC5F5269C741600D753CA /* Assets.xcassets in Resources */, DEEAC5F3269C741400D753CA /* Main.storyboard in Resources */, @@ -354,10 +342,7 @@ "@executable_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-lc++", - ); + OTHER_LDFLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = syjdev.demo.blur; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -389,10 +374,7 @@ "@executable_path/Frameworks", ); LIBRARY_SEARCH_PATHS = "$(inherited)"; - OTHER_LDFLAGS = ( - "$(inherited)", - "-lc++", - ); + OTHER_LDFLAGS = "$(inherited)"; PRODUCT_BUNDLE_IDENTIFIER = syjdev.demo; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_VERSION = 4.2; diff --git a/LICENSE b/LICENSE index f288702..d645695 100644 --- a/LICENSE +++ b/LICENSE @@ -1,674 +1,202 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + 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. diff --git a/MODEL_LICENSE.md b/MODEL_LICENSE.md new file mode 100644 index 0000000..1fddadc --- /dev/null +++ b/MODEL_LICENSE.md @@ -0,0 +1,70 @@ +# Model License & Provenance + +This document covers the **machine-learning model artifacts** in this +repository — they are licensed **separately** from the source code. + +| Artifact | Path | +|---|---| +| Core ML model | `Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurSegmentation.mlpackage` | +| TensorFlow Lite model | `model/blur_segmentation_qat.tflite` | + +> The **source code** in this repository is licensed under **Apache-2.0** +> (see [`LICENSE`](LICENSE)). The Apache-2.0 license does **not** apply to the +> model artifacts listed above. + +## Provenance + +These models were trained on **two** academic datasets, **both** of which are +distributed for research with **no explicit license granting commercial use**: + +1. **CUHK Blur Detection Dataset** + (J. Shi, L. Xu, J. Jia, *"Discriminative Blur Detection Features"*, CVPR 2014) — + +2. **DUT-DBD Dataset** + (W. Zhao, F. Zhao, D. Wang, H. Lu, *"Defocus Blur Detection via Multi-stream + Bottom-Top-Bottom Fully Convolutional Network"*, CVPR 2018) — + + +Because the model derives from both, commercial use requires clearing **both** +datasets — permission for one alone is not sufficient. + +## Current status: NON-COMMERCIAL only ⚠️ + +As of this writing, **commercial-use rights for the underlying dataset have not +been secured**, and the dataset page states no explicit license. Other datasets +from the same lab are marked "cannot be used commercially." Accordingly: + +- The model artifacts are provided for **research / non-commercial use only**. +- **Do not embed these models in a closed-source or commercial application.** +- Whether trained model weights constitute a derivative work of their training + data is a legally unsettled question; this restriction is the conservative, + good-faith position and is **not legal advice**. + +## Demo & test images — resolved (now CC0) ✅ + +Earlier the repository redistributed original **dataset** images (`dut_test_*`, +`motion*`, `out_of_focus*`) as demo assets and test fixtures. Academic datasets +generally do not grant redistribution rights, so those have been **removed** and +replaced with **CC0 / public-domain** images from Wikimedia Commons (no +attribution required, commercial use allowed). See [`CREDITS.md`](CREDITS.md). + +The datasets above therefore now affect **only the trained model weights**, not +the bundled sample images. + +> **Note on git history:** the old dataset images still exist in earlier commits. +> Removing them going forward does not purge them from history — a history rewrite +> (`git filter-repo` / BFG) is required to remove them completely. + +## To make the model commercially embeddable + +One of the following must be resolved **before** shipping the model in a +commercial product: + +1. **Obtain written permission / a commercial license** from the authors of + **both** the CUHK and DUT-DBD datasets for commercial use of models trained on + them, and record it here (and in `NOTICE`). +2. **Retrain** the model on a dataset whose license permits commercial use (or + on self-collected data), and replace the artifacts above. + +Until then, only the **Apache-2.0-licensed source code** may be reused +commercially — the bundled model may not. diff --git a/NOTICE b/NOTICE new file mode 100644 index 0000000..599f6b6 --- /dev/null +++ b/NOTICE @@ -0,0 +1,23 @@ +BlurDiscriminator +Copyright 2021 syjdev + +This product includes software developed by syjdev. + +The source code in this repository is licensed under the Apache License, +Version 2.0 (see LICENSE). + +------------------------------------------------------------------------ +Bundled machine-learning model — SEPARATE TERMS +------------------------------------------------------------------------ + +The Core ML model bundled in this repository +(Demo/iOS/BlurDiscriminatorKit/BlurDiscriminatorKit/BlurSegmentation.mlpackage) +and the TensorFlow Lite model (model/blur_segmentation_qat.tflite) are NOT +covered by the Apache-2.0 license above. They were trained on the CUHK Blur +Detection Dataset (CVPR 2014) and the DUT-DBD Dataset (CVPR 2018), and are +distributed under separate, more restrictive (non-commercial) terms. + +The demo/test sample images bundled in this repository are CC0 / public-domain +images from Wikimedia Commons (not from the datasets above); see CREDITS.md. + +See MODEL_LICENSE.md before using, redistributing, or embedding the model. diff --git a/README.md b/README.md index 90d60a7..441bd01 100644 --- a/README.md +++ b/README.md @@ -19,22 +19,41 @@ BlurDiscriminator classify clear pixels & blurry pixels of image, as below. # Dataset -For Learning Model, I used [Blur Detection Dataset](http://www.cse.cuhk.edu.hk/~leojia/projects/dblurdetect/dataset.html).
+The model was trained on two datasets: + +- [CUHK Blur Detection Dataset](http://www.cse.cuhk.edu.hk/~leojia/projects/dblurdetect/dataset.html) (Shi et al., CVPR 2014) +- [DUT-DBD Dataset](http://ice.dlut.edu.cn/ZhaoWenda/BTBCRLNet.html) (Zhao et al., CVPR 2018) + +Both are research datasets — see [`MODEL_LICENSE.md`](MODEL_LICENSE.md) for usage terms.
# License + +The **source code** is licensed under the **Apache License 2.0** — see +[`LICENSE`](LICENSE) and [`NOTICE`](NOTICE). It may be reused in closed-source +and commercial applications. + +The **bundled ML models** (`BlurSegmentation.mlpackage`, +`model/blur_segmentation_qat.tflite`) are **NOT** covered by Apache-2.0. They were +trained on the CUHK Blur Detection Dataset (CVPR 2014) and the DUT-DBD Dataset +(CVPR 2018), and are provided for **research / non-commercial use only**. See +[`MODEL_LICENSE.md`](MODEL_LICENSE.md) before embedding a model in a commercial +product. + +The **demo/test images** are CC0 / public-domain images from Wikimedia Commons +(see [`CREDITS.md`](CREDITS.md)) — not dataset images. + ``` -Copyright (C) 2021 syjdev. +Copyright 2021 syjdev -This program is free software: you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. +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 -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. + http://www.apache.org/licenses/LICENSE-2.0 -You should have received a copy of the GNU General Public License -along with this program. If not, see +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. ```