react-native-executorch 0.4.8 → 0.5.1-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/android/CMakeLists.txt +17 -0
- package/android/build.gradle +76 -13
- package/android/libs/classes.jar +0 -0
- package/android/src/main/cpp/CMakeLists.txt +73 -0
- package/android/src/main/cpp/ETInstallerModule.cpp +76 -0
- package/android/src/main/cpp/ETInstallerModule.h +43 -0
- package/android/src/main/java/com/swmansion/rnexecutorch/ETInstaller.kt +66 -0
- package/android/src/main/java/com/swmansion/rnexecutorch/LLM.kt +3 -3
- package/android/src/main/java/com/swmansion/rnexecutorch/RnExecutorchPackage.kt +7 -113
- package/common/ada/ada.cpp +17406 -0
- package/common/ada/ada.h +10274 -0
- package/common/pfft/pfft.c +2205 -0
- package/common/pfft/pfft.h +185 -0
- package/common/rnexecutorch/Log.h +489 -0
- package/common/rnexecutorch/RnExecutorchInstaller.cpp +78 -0
- package/common/rnexecutorch/RnExecutorchInstaller.h +112 -0
- package/common/rnexecutorch/TokenizerModule.cpp +52 -0
- package/common/rnexecutorch/TokenizerModule.h +26 -0
- package/common/rnexecutorch/data_processing/FFT.cpp +21 -0
- package/common/rnexecutorch/data_processing/FFT.h +23 -0
- package/common/rnexecutorch/data_processing/FileUtils.h +30 -0
- package/common/rnexecutorch/data_processing/ImageProcessing.cpp +240 -0
- package/common/rnexecutorch/data_processing/ImageProcessing.h +55 -0
- package/common/rnexecutorch/data_processing/Numerical.cpp +82 -0
- package/common/rnexecutorch/data_processing/Numerical.h +23 -0
- package/common/rnexecutorch/data_processing/base64.cpp +110 -0
- package/common/rnexecutorch/data_processing/base64.h +46 -0
- package/common/rnexecutorch/data_processing/dsp.cpp +65 -0
- package/common/rnexecutorch/data_processing/dsp.h +12 -0
- package/common/rnexecutorch/host_objects/JSTensorViewIn.h +12 -0
- package/common/rnexecutorch/host_objects/JSTensorViewOut.h +22 -0
- package/common/rnexecutorch/host_objects/JsiConversions.h +410 -0
- package/common/rnexecutorch/host_objects/ModelHostObject.h +239 -0
- package/common/rnexecutorch/jsi/JsiHostObject.cpp +108 -0
- package/common/rnexecutorch/jsi/JsiHostObject.h +87 -0
- package/common/rnexecutorch/jsi/OwningArrayBuffer.h +40 -0
- package/common/rnexecutorch/jsi/Promise.cpp +20 -0
- package/common/rnexecutorch/jsi/Promise.h +69 -0
- package/common/rnexecutorch/jsi/RuntimeAwareCache.h +58 -0
- package/common/rnexecutorch/jsi/RuntimeLifecycleMonitor.cpp +53 -0
- package/common/rnexecutorch/jsi/RuntimeLifecycleMonitor.h +35 -0
- package/common/rnexecutorch/metaprogramming/ConstructorHelpers.h +131 -0
- package/common/rnexecutorch/metaprogramming/FunctionHelpers.h +50 -0
- package/common/rnexecutorch/metaprogramming/TypeConcepts.h +37 -0
- package/common/rnexecutorch/models/BaseModel.cpp +181 -0
- package/common/rnexecutorch/models/BaseModel.h +47 -0
- package/common/rnexecutorch/models/EncoderDecoderBase.cpp +21 -0
- package/common/rnexecutorch/models/EncoderDecoderBase.h +31 -0
- package/common/rnexecutorch/models/classification/Classification.cpp +72 -0
- package/common/rnexecutorch/models/classification/Classification.h +26 -0
- package/{ios/RnExecutorch/models/classification/Constants.mm → common/rnexecutorch/models/classification/Constants.h} +7 -2
- package/common/rnexecutorch/models/embeddings/BaseEmbeddings.cpp +27 -0
- package/common/rnexecutorch/models/embeddings/BaseEmbeddings.h +17 -0
- package/common/rnexecutorch/models/embeddings/image/ImageEmbeddings.cpp +45 -0
- package/common/rnexecutorch/models/embeddings/image/ImageEmbeddings.h +23 -0
- package/common/rnexecutorch/models/embeddings/text/TextEmbeddings.cpp +61 -0
- package/common/rnexecutorch/models/embeddings/text/TextEmbeddings.h +26 -0
- package/{ios/RnExecutorch/models/image_segmentation/Constants.mm → common/rnexecutorch/models/image_segmentation/Constants.h} +7 -2
- package/common/rnexecutorch/models/image_segmentation/ImageSegmentation.cpp +173 -0
- package/common/rnexecutorch/models/image_segmentation/ImageSegmentation.h +43 -0
- package/{ios/RnExecutorch/utils/Constants.mm → common/rnexecutorch/models/object_detection/Constants.h} +9 -2
- package/common/rnexecutorch/models/object_detection/ObjectDetection.cpp +82 -0
- package/common/rnexecutorch/models/object_detection/ObjectDetection.h +31 -0
- package/{ios/RnExecutorch/utils/ObjectDetectionUtils.mm → common/rnexecutorch/models/object_detection/Utils.cpp} +10 -30
- package/common/rnexecutorch/models/object_detection/Utils.h +17 -0
- package/common/rnexecutorch/models/ocr/CTCLabelConverter.cpp +88 -0
- package/common/rnexecutorch/models/ocr/CTCLabelConverter.h +29 -0
- package/common/rnexecutorch/models/ocr/Constants.h +34 -0
- package/common/rnexecutorch/models/ocr/Detector.cpp +102 -0
- package/common/rnexecutorch/models/ocr/Detector.h +30 -0
- package/common/rnexecutorch/models/ocr/DetectorUtils.cpp +703 -0
- package/common/rnexecutorch/models/ocr/DetectorUtils.h +80 -0
- package/common/rnexecutorch/models/ocr/OCR.cpp +52 -0
- package/common/rnexecutorch/models/ocr/OCR.h +36 -0
- package/common/rnexecutorch/models/ocr/RecognitionHandler.cpp +107 -0
- package/common/rnexecutorch/models/ocr/RecognitionHandler.h +40 -0
- package/common/rnexecutorch/models/ocr/RecognitionHandlerUtils.cpp +153 -0
- package/common/rnexecutorch/models/ocr/RecognitionHandlerUtils.h +72 -0
- package/common/rnexecutorch/models/ocr/Recognizer.cpp +80 -0
- package/common/rnexecutorch/models/ocr/Recognizer.h +36 -0
- package/common/rnexecutorch/models/ocr/RecognizerUtils.cpp +202 -0
- package/common/rnexecutorch/models/ocr/RecognizerUtils.h +70 -0
- package/common/rnexecutorch/models/ocr/Types.h +37 -0
- package/common/rnexecutorch/models/speech_to_text/MoonshineStrategy.cpp +31 -0
- package/common/rnexecutorch/models/speech_to_text/MoonshineStrategy.h +21 -0
- package/common/rnexecutorch/models/speech_to_text/SpeechToText.cpp +70 -0
- package/common/rnexecutorch/models/speech_to_text/SpeechToText.h +31 -0
- package/common/rnexecutorch/models/speech_to_text/SpeechToTextStrategy.h +26 -0
- package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.cpp +38 -0
- package/common/rnexecutorch/models/speech_to_text/WhisperStrategy.h +25 -0
- package/common/rnexecutorch/models/style_transfer/StyleTransfer.cpp +55 -0
- package/common/rnexecutorch/models/style_transfer/StyleTransfer.h +29 -0
- package/common/rnexecutorch/models/vertical_ocr/VerticalDetector.cpp +92 -0
- package/common/rnexecutorch/models/vertical_ocr/VerticalDetector.h +49 -0
- package/common/rnexecutorch/models/vertical_ocr/VerticalOCR.cpp +180 -0
- package/common/rnexecutorch/models/vertical_ocr/VerticalOCR.h +78 -0
- package/common/rnexecutorch/tests/LogTest.cpp +530 -0
- package/common/rnexecutorch/tests/README.md +20 -0
- package/common/rnexecutorch/tests/run_all_tests.sh +14 -0
- package/common/rnexecutorch/tests/run_test.sh +18 -0
- package/ios/ExecutorchLib.xcframework/Info.plist +4 -4
- package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/ExecutorchLib +0 -0
- package/ios/ExecutorchLib.xcframework/ios-arm64/ExecutorchLib.framework/Info.plist +0 -0
- package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/ExecutorchLib +0 -0
- package/ios/ExecutorchLib.xcframework/ios-arm64-simulator/ExecutorchLib.framework/Info.plist +0 -0
- package/ios/RnExecutorch/ETInstaller.h +8 -0
- package/ios/RnExecutorch/ETInstaller.mm +56 -0
- package/ios/RnExecutorch/utils/Conversions.h +8 -9
- package/ios/RnExecutorch/utils/Numerical.h +2 -0
- package/ios/RnExecutorch.xcodeproj/project.pbxproj +73 -0
- package/lib/common/Logger.d.ts +8 -0
- package/lib/common/Logger.js +19 -0
- package/lib/constants/modelUrls.d.ts +89 -0
- package/lib/constants/modelUrls.js +116 -0
- package/lib/constants/sttDefaults.js +66 -0
- package/lib/controllers/LLMController.js +210 -0
- package/lib/controllers/OCRController.js +65 -0
- package/lib/controllers/SpeechToTextController.d.ts +52 -0
- package/lib/controllers/SpeechToTextController.js +343 -0
- package/lib/hooks/natural_language_processing/useSpeechToText.js +44 -0
- package/lib/index.d.ts +50 -0
- package/{src/index.tsx → lib/index.js} +22 -10
- package/lib/module/Error.js +2 -0
- package/lib/module/Error.js.map +1 -1
- package/lib/module/common/Logger.js +23 -0
- package/lib/module/common/Logger.js.map +1 -0
- package/lib/module/constants/llmDefaults.js +8 -0
- package/lib/module/constants/llmDefaults.js.map +1 -1
- package/lib/module/constants/modelUrls.js +300 -84
- package/lib/module/constants/modelUrls.js.map +1 -1
- package/lib/module/constants/ocr/models.js +181 -286
- package/lib/module/constants/ocr/models.js.map +1 -1
- package/lib/module/constants/ocr/symbols.js +63 -63
- package/lib/module/constants/sttDefaults.js +12 -10
- package/lib/module/constants/sttDefaults.js.map +1 -1
- package/lib/module/controllers/LLMController.js +17 -11
- package/lib/module/controllers/LLMController.js.map +1 -1
- package/lib/module/controllers/OCRController.js +16 -9
- package/lib/module/controllers/OCRController.js.map +1 -1
- package/lib/module/controllers/SpeechToTextController.js +32 -19
- package/lib/module/controllers/SpeechToTextController.js.map +1 -1
- package/lib/module/controllers/VerticalOCRController.js +16 -9
- package/lib/module/controllers/VerticalOCRController.js.map +1 -1
- package/lib/module/hooks/computer_vision/useClassification.js +5 -5
- package/lib/module/hooks/computer_vision/useClassification.js.map +1 -1
- package/lib/module/hooks/computer_vision/useImageEmbeddings.js +13 -0
- package/lib/module/hooks/computer_vision/useImageEmbeddings.js.map +1 -0
- package/lib/module/hooks/computer_vision/useImageSegmentation.js +4 -4
- package/lib/module/hooks/computer_vision/useImageSegmentation.js.map +1 -1
- package/lib/module/hooks/computer_vision/useOCR.js +14 -15
- package/lib/module/hooks/computer_vision/useOCR.js.map +1 -1
- package/lib/module/hooks/computer_vision/useObjectDetection.js +5 -5
- package/lib/module/hooks/computer_vision/useObjectDetection.js.map +1 -1
- package/lib/module/hooks/computer_vision/useStyleTransfer.js +5 -5
- package/lib/module/hooks/computer_vision/useStyleTransfer.js.map +1 -1
- package/lib/module/hooks/computer_vision/useVerticalOCR.js +16 -17
- package/lib/module/hooks/computer_vision/useVerticalOCR.js.map +1 -1
- package/lib/module/hooks/general/useExecutorchModule.js +5 -3
- package/lib/module/hooks/general/useExecutorchModule.js.map +1 -1
- package/lib/module/hooks/natural_language_processing/useLLM.js +22 -25
- package/lib/module/hooks/natural_language_processing/useLLM.js.map +1 -1
- package/lib/module/hooks/natural_language_processing/useSpeechToText.js +16 -14
- package/lib/module/hooks/natural_language_processing/useSpeechToText.js.map +1 -1
- package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js +4 -5
- package/lib/module/hooks/natural_language_processing/useTextEmbeddings.js.map +1 -1
- package/lib/module/hooks/natural_language_processing/useTokenizer.js +20 -19
- package/lib/module/hooks/natural_language_processing/useTokenizer.js.map +1 -1
- package/lib/module/hooks/useNonStaticModule.js +52 -0
- package/lib/module/hooks/useNonStaticModule.js.map +1 -0
- package/lib/module/index.js +16 -2
- package/lib/module/index.js.map +1 -1
- package/lib/module/modules/BaseModule.js +6 -3
- package/lib/module/modules/BaseModule.js.map +1 -1
- package/lib/module/modules/BaseNonStaticModule.js +17 -0
- package/lib/module/modules/BaseNonStaticModule.js.map +1 -0
- package/lib/module/modules/computer_vision/ClassificationModule.js +13 -8
- package/lib/module/modules/computer_vision/ClassificationModule.js.map +1 -1
- package/lib/module/modules/computer_vision/ImageEmbeddingsModule.js +19 -0
- package/lib/module/modules/computer_vision/ImageEmbeddingsModule.js.map +1 -0
- package/lib/module/modules/computer_vision/ImageSegmentationModule.js +21 -19
- package/lib/module/modules/computer_vision/ImageSegmentationModule.js.map +1 -1
- package/lib/module/modules/computer_vision/OCRModule.js +13 -10
- package/lib/module/modules/computer_vision/OCRModule.js.map +1 -1
- package/lib/module/modules/computer_vision/ObjectDetectionModule.js +13 -8
- package/lib/module/modules/computer_vision/ObjectDetectionModule.js.map +1 -1
- package/lib/module/modules/computer_vision/StyleTransferModule.js +13 -8
- package/lib/module/modules/computer_vision/StyleTransferModule.js.map +1 -1
- package/lib/module/modules/computer_vision/VerticalOCRModule.js +15 -10
- package/lib/module/modules/computer_vision/VerticalOCRModule.js.map +1 -1
- package/lib/module/modules/general/ExecutorchModule.js +10 -36
- package/lib/module/modules/general/ExecutorchModule.js.map +1 -1
- package/lib/module/modules/natural_language_processing/LLMModule.js +18 -22
- package/lib/module/modules/natural_language_processing/LLMModule.js.map +1 -1
- package/lib/module/modules/natural_language_processing/SpeechToTextModule.js +27 -16
- package/lib/module/modules/natural_language_processing/SpeechToTextModule.js.map +1 -1
- package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js +15 -8
- package/lib/module/modules/natural_language_processing/TextEmbeddingsModule.js.map +1 -1
- package/lib/module/modules/natural_language_processing/TokenizerModule.js +20 -14
- package/lib/module/modules/natural_language_processing/TokenizerModule.js.map +1 -1
- package/lib/module/native/NativeETInstaller.js +5 -0
- package/lib/module/native/NativeETInstaller.js.map +1 -0
- package/lib/module/native/RnExecutorchModules.js +2 -11
- package/lib/module/native/RnExecutorchModules.js.map +1 -1
- package/lib/module/types/common.js +25 -8
- package/lib/module/types/common.js.map +1 -1
- package/lib/module/types/stt.js +6 -0
- package/lib/module/types/stt.js.map +1 -1
- package/lib/module/utils/ResourceFetcher.js +276 -114
- package/lib/module/utils/ResourceFetcher.js.map +1 -1
- package/lib/module/utils/ResourceFetcherUtils.js +155 -0
- package/lib/module/utils/ResourceFetcherUtils.js.map +1 -0
- package/lib/module/utils/llm.js +41 -1
- package/lib/module/utils/llm.js.map +1 -1
- package/lib/modules/natural_language_processing/SpeechToTextModule.d.ts +14 -0
- package/lib/modules/natural_language_processing/SpeechToTextModule.js +30 -0
- package/lib/modules/natural_language_processing/TokenizerModule.js +29 -0
- package/lib/native/RnExecutorchModules.d.ts +3 -0
- package/lib/native/RnExecutorchModules.js +16 -0
- package/lib/typescript/Error.d.ts +2 -0
- package/lib/typescript/Error.d.ts.map +1 -1
- package/lib/typescript/common/Logger.d.ts +9 -0
- package/lib/typescript/common/Logger.d.ts.map +1 -0
- package/lib/typescript/constants/llmDefaults.d.ts +1 -0
- package/lib/typescript/constants/llmDefaults.d.ts.map +1 -1
- package/lib/typescript/constants/modelUrls.d.ts +223 -79
- package/lib/typescript/constants/modelUrls.d.ts.map +1 -1
- package/lib/typescript/constants/ocr/models.d.ts +882 -284
- package/lib/typescript/constants/ocr/models.d.ts.map +1 -1
- package/lib/typescript/constants/sttDefaults.d.ts +1 -0
- package/lib/typescript/constants/sttDefaults.d.ts.map +1 -1
- package/lib/typescript/controllers/LLMController.d.ts +3 -4
- package/lib/typescript/controllers/LLMController.d.ts.map +1 -1
- package/lib/typescript/controllers/OCRController.d.ts +5 -6
- package/lib/typescript/controllers/OCRController.d.ts.map +1 -1
- package/lib/typescript/controllers/SpeechToTextController.d.ts +11 -6
- package/lib/typescript/controllers/SpeechToTextController.d.ts.map +1 -1
- package/lib/typescript/controllers/VerticalOCRController.d.ts +5 -6
- package/lib/typescript/controllers/VerticalOCRController.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useClassification.d.ts +8 -6
- package/lib/typescript/hooks/computer_vision/useClassification.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useImageEmbeddings.d.ts +16 -0
- package/lib/typescript/hooks/computer_vision/useImageEmbeddings.d.ts.map +1 -0
- package/lib/typescript/hooks/computer_vision/useImageSegmentation.d.ts +5 -3
- package/lib/typescript/hooks/computer_vision/useImageSegmentation.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useOCR.d.ts +4 -4
- package/lib/typescript/hooks/computer_vision/useOCR.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useObjectDetection.d.ts +5 -3
- package/lib/typescript/hooks/computer_vision/useObjectDetection.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useStyleTransfer.d.ts +5 -3
- package/lib/typescript/hooks/computer_vision/useStyleTransfer.d.ts.map +1 -1
- package/lib/typescript/hooks/computer_vision/useVerticalOCR.d.ts +3 -5
- package/lib/typescript/hooks/computer_vision/useVerticalOCR.d.ts.map +1 -1
- package/lib/typescript/hooks/general/useExecutorchModule.d.ts +1 -1
- package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts +6 -4
- package/lib/typescript/hooks/natural_language_processing/useLLM.d.ts.map +1 -1
- package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts +7 -5
- package/lib/typescript/hooks/natural_language_processing/useSpeechToText.d.ts.map +1 -1
- package/lib/typescript/hooks/natural_language_processing/useTextEmbeddings.d.ts +9 -5
- package/lib/typescript/hooks/natural_language_processing/useTextEmbeddings.d.ts.map +1 -1
- package/lib/typescript/hooks/natural_language_processing/useTokenizer.d.ts +6 -4
- package/lib/typescript/hooks/natural_language_processing/useTokenizer.d.ts.map +1 -1
- package/lib/typescript/hooks/useNonStaticModule.d.ts +21 -0
- package/lib/typescript/hooks/useNonStaticModule.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +18 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/modules/BaseModule.d.ts +1 -1
- package/lib/typescript/modules/BaseModule.d.ts.map +1 -1
- package/lib/typescript/modules/BaseNonStaticModule.d.ts +10 -0
- package/lib/typescript/modules/BaseNonStaticModule.d.ts.map +1 -0
- package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts +6 -6
- package/lib/typescript/modules/computer_vision/ClassificationModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/ImageEmbeddingsModule.d.ts +9 -0
- package/lib/typescript/modules/computer_vision/ImageEmbeddingsModule.d.ts.map +1 -0
- package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts +8 -28
- package/lib/typescript/modules/computer_vision/ImageSegmentationModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/OCRModule.d.ts +8 -7
- package/lib/typescript/modules/computer_vision/OCRModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts +7 -5
- package/lib/typescript/modules/computer_vision/ObjectDetectionModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts +6 -5
- package/lib/typescript/modules/computer_vision/StyleTransferModule.d.ts.map +1 -1
- package/lib/typescript/modules/computer_vision/VerticalOCRModule.d.ts +7 -8
- package/lib/typescript/modules/computer_vision/VerticalOCRModule.d.ts.map +1 -1
- package/lib/typescript/modules/general/ExecutorchModule.d.ts +5 -8
- package/lib/typescript/modules/general/ExecutorchModule.d.ts.map +1 -1
- package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts +16 -16
- package/lib/typescript/modules/natural_language_processing/LLMModule.d.ts.map +1 -1
- package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts +19 -9
- package/lib/typescript/modules/natural_language_processing/SpeechToTextModule.d.ts.map +1 -1
- package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts +7 -5
- package/lib/typescript/modules/natural_language_processing/TextEmbeddingsModule.d.ts.map +1 -1
- package/lib/typescript/modules/natural_language_processing/TokenizerModule.d.ts +10 -9
- package/lib/typescript/modules/natural_language_processing/TokenizerModule.d.ts.map +1 -1
- package/lib/typescript/native/{NativeStyleTransfer.d.ts → NativeETInstaller.d.ts} +2 -3
- package/lib/typescript/native/NativeETInstaller.d.ts.map +1 -0
- package/lib/typescript/native/RnExecutorchModules.d.ts +3 -21
- package/lib/typescript/native/RnExecutorchModules.d.ts.map +1 -1
- package/lib/typescript/types/common.d.ts +30 -2
- package/lib/typescript/types/common.d.ts.map +1 -1
- package/lib/typescript/types/stt.d.ts +5 -1
- package/lib/typescript/types/stt.d.ts.map +1 -1
- package/lib/typescript/utils/ResourceFetcher.d.ts +18 -10
- package/lib/typescript/utils/ResourceFetcher.d.ts.map +1 -1
- package/lib/typescript/utils/ResourceFetcherUtils.d.ts +55 -0
- package/lib/typescript/utils/ResourceFetcherUtils.d.ts.map +1 -0
- package/lib/typescript/utils/llm.d.ts +4 -0
- package/lib/typescript/utils/llm.d.ts.map +1 -1
- package/lib/utils/ResourceFetcherUtils.js +119 -0
- package/lib/utils/llm.js +72 -0
- package/package.json +22 -64
- package/react-native-executorch.podspec +75 -3
- package/src/Error.ts +2 -0
- package/src/common/Logger.ts +25 -0
- package/src/constants/llmDefaults.ts +11 -0
- package/src/constants/modelUrls.ts +365 -168
- package/src/constants/ocr/models.ts +826 -395
- package/src/constants/ocr/symbols.ts +63 -63
- package/src/constants/sttDefaults.ts +14 -18
- package/src/controllers/LLMController.ts +28 -18
- package/src/controllers/OCRController.ts +24 -15
- package/src/controllers/SpeechToTextController.ts +53 -40
- package/src/controllers/VerticalOCRController.ts +24 -14
- package/src/hooks/computer_vision/useClassification.ts +10 -11
- package/src/hooks/computer_vision/useImageEmbeddings.ts +15 -0
- package/src/hooks/computer_vision/useImageSegmentation.ts +5 -8
- package/src/hooks/computer_vision/useOCR.ts +29 -21
- package/src/hooks/computer_vision/useObjectDetection.ts +6 -9
- package/src/hooks/computer_vision/useStyleTransfer.ts +6 -6
- package/src/hooks/computer_vision/useVerticalOCR.ts +30 -27
- package/src/hooks/general/useExecutorchModule.ts +3 -3
- package/src/hooks/natural_language_processing/useLLM.ts +38 -28
- package/src/hooks/natural_language_processing/useSpeechToText.ts +34 -26
- package/src/hooks/natural_language_processing/useTextEmbeddings.ts +11 -11
- package/src/hooks/natural_language_processing/useTokenizer.ts +22 -22
- package/src/hooks/useNonStaticModule.ts +74 -0
- package/src/index.ts +108 -0
- package/src/modules/BaseModule.ts +9 -3
- package/src/modules/BaseNonStaticModule.ts +26 -0
- package/src/modules/computer_vision/ClassificationModule.ts +20 -11
- package/src/modules/computer_vision/ImageEmbeddingsModule.ts +26 -0
- package/src/modules/computer_vision/ImageSegmentationModule.ts +35 -27
- package/src/modules/computer_vision/OCRModule.ts +23 -15
- package/src/modules/computer_vision/ObjectDetectionModule.ts +24 -11
- package/src/modules/computer_vision/StyleTransferModule.ts +20 -11
- package/src/modules/computer_vision/VerticalOCRModule.ts +25 -21
- package/src/modules/general/ExecutorchModule.ts +18 -48
- package/src/modules/natural_language_processing/LLMModule.ts +27 -30
- package/src/modules/natural_language_processing/SpeechToTextModule.ts +42 -37
- package/src/modules/natural_language_processing/TextEmbeddingsModule.ts +27 -12
- package/src/modules/natural_language_processing/TokenizerModule.ts +27 -17
- package/src/native/NativeETInstaller.ts +8 -0
- package/src/native/RnExecutorchModules.ts +4 -46
- package/src/types/common.ts +40 -12
- package/src/types/stt.ts +5 -1
- package/src/utils/ResourceFetcher.ts +338 -119
- package/src/utils/ResourceFetcherUtils.ts +186 -0
- package/src/utils/llm.ts +65 -1
- package/third-party/android/libs/executorch/arm64-v8a/libexecutorch.so +0 -0
- package/third-party/android/libs/executorch/x86_64/libexecutorch.so +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_core.a +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_features2d.a +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_highgui.a +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_imgproc.a +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_photo.a +0 -0
- package/third-party/android/libs/opencv/arm64-v8a/libopencv_video.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_core.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_features2d.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_highgui.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_imgproc.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_photo.a +0 -0
- package/third-party/android/libs/opencv/x86_64/libopencv_video.a +0 -0
- package/third-party/android/libs/opencv-third-party/arm64-v8a/libkleidicv.a +0 -0
- package/third-party/android/libs/opencv-third-party/arm64-v8a/libkleidicv_hal.a +0 -0
- package/third-party/android/libs/opencv-third-party/arm64-v8a/libkleidicv_thread.a +0 -0
- package/third-party/include/c10/macros/Export.h +163 -0
- package/third-party/include/c10/macros/Macros.h +497 -0
- package/third-party/include/c10/util/BFloat16-inl.h +342 -0
- package/third-party/include/c10/util/BFloat16-math.h +266 -0
- package/third-party/include/c10/util/BFloat16.h +125 -0
- package/third-party/include/c10/util/Half-inl.h +347 -0
- package/third-party/include/c10/util/Half.h +416 -0
- package/third-party/include/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/include/c10/util/bit_cast.h +43 -0
- package/third-party/include/c10/util/floating_point_utils.h +33 -0
- package/third-party/include/c10/util/irange.h +107 -0
- package/third-party/include/executorch/ExecuTorch.h +13 -0
- package/third-party/include/executorch/ExecuTorchError.h +16 -0
- package/third-party/include/executorch/ExecuTorchLog.h +76 -0
- package/third-party/include/executorch/ExecuTorchModule.h +286 -0
- package/third-party/include/executorch/ExecuTorchTensor.h +742 -0
- package/third-party/include/executorch/ExecuTorchValue.h +219 -0
- package/third-party/include/executorch/extension/module/module.h +492 -0
- package/third-party/include/executorch/extension/tensor/tensor.h +13 -0
- package/third-party/include/executorch/extension/tensor/tensor_accessor.h +190 -0
- package/third-party/include/executorch/extension/tensor/tensor_ptr.h +347 -0
- package/third-party/include/executorch/extension/tensor/tensor_ptr_maker.h +653 -0
- package/third-party/include/executorch/runtime/backend/backend_execution_context.h +71 -0
- package/third-party/include/executorch/runtime/backend/backend_init_context.h +72 -0
- package/third-party/include/executorch/runtime/backend/interface.h +166 -0
- package/third-party/include/executorch/runtime/core/array_ref.h +235 -0
- package/third-party/include/executorch/runtime/core/data_loader.h +136 -0
- package/third-party/include/executorch/runtime/core/defines.h +20 -0
- package/third-party/include/executorch/runtime/core/error.h +229 -0
- package/third-party/include/executorch/runtime/core/evalue.h +521 -0
- package/third-party/include/executorch/runtime/core/event_tracer.h +565 -0
- package/third-party/include/executorch/runtime/core/event_tracer_hooks.h +323 -0
- package/third-party/include/executorch/runtime/core/event_tracer_hooks_delegate.h +197 -0
- package/third-party/include/executorch/runtime/core/exec_aten/exec_aten.h +147 -0
- package/third-party/include/executorch/runtime/core/exec_aten/util/dim_order_util.h +263 -0
- package/third-party/include/executorch/runtime/core/exec_aten/util/scalar_type_util.h +1331 -0
- package/third-party/include/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +21 -0
- package/third-party/include/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +69 -0
- package/third-party/include/executorch/runtime/core/exec_aten/util/tensor_util.h +1250 -0
- package/third-party/include/executorch/runtime/core/freeable_buffer.h +107 -0
- package/third-party/include/executorch/runtime/core/hierarchical_allocator.h +107 -0
- package/third-party/include/executorch/runtime/core/memory_allocator.h +198 -0
- package/third-party/include/executorch/runtime/core/named_data_map.h +86 -0
- package/third-party/include/executorch/runtime/core/portable_type/bfloat16.h +27 -0
- package/third-party/include/executorch/runtime/core/portable_type/bfloat16_math.h +14 -0
- package/third-party/include/executorch/runtime/core/portable_type/bits_types.h +83 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +163 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +497 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +342 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +266 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +125 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +347 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/Half.h +416 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +43 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +33 -0
- package/third-party/include/executorch/runtime/core/portable_type/c10/c10/util/irange.h +107 -0
- package/third-party/include/executorch/runtime/core/portable_type/complex.h +44 -0
- package/third-party/include/executorch/runtime/core/portable_type/device.h +70 -0
- package/third-party/include/executorch/runtime/core/portable_type/half.h +27 -0
- package/third-party/include/executorch/runtime/core/portable_type/optional.h +36 -0
- package/third-party/include/executorch/runtime/core/portable_type/qint_types.h +83 -0
- package/third-party/include/executorch/runtime/core/portable_type/scalar.h +110 -0
- package/third-party/include/executorch/runtime/core/portable_type/scalar_type.h +154 -0
- package/third-party/include/executorch/runtime/core/portable_type/string_view.h +29 -0
- package/third-party/include/executorch/runtime/core/portable_type/tensor.h +142 -0
- package/third-party/include/executorch/runtime/core/portable_type/tensor_impl.h +261 -0
- package/third-party/include/executorch/runtime/core/portable_type/tensor_options.h +60 -0
- package/third-party/include/executorch/runtime/core/result.h +258 -0
- package/third-party/include/executorch/runtime/core/span.h +93 -0
- package/third-party/include/executorch/runtime/core/tag.h +71 -0
- package/third-party/include/executorch/runtime/core/tensor_layout.h +79 -0
- package/third-party/include/executorch/runtime/core/tensor_shape_dynamism.h +39 -0
- package/third-party/include/executorch/runtime/executor/memory_manager.h +113 -0
- package/third-party/include/executorch/runtime/executor/method.h +387 -0
- package/third-party/include/executorch/runtime/executor/method_meta.h +251 -0
- package/third-party/include/executorch/runtime/executor/program.h +320 -0
- package/third-party/include/executorch/runtime/executor/pte_data_map.h +144 -0
- package/third-party/include/executorch/runtime/executor/tensor_parser.h +156 -0
- package/third-party/include/executorch/runtime/kernel/kernel_runtime_context.h +122 -0
- package/third-party/include/executorch/runtime/kernel/operator_registry.h +278 -0
- package/third-party/include/executorch/runtime/platform/abort.h +36 -0
- package/third-party/include/executorch/runtime/platform/assert.h +119 -0
- package/third-party/include/executorch/runtime/platform/clock.h +43 -0
- package/third-party/include/executorch/runtime/platform/compat_unistd.h +75 -0
- package/third-party/include/executorch/runtime/platform/compiler.h +191 -0
- package/third-party/include/executorch/runtime/platform/log.h +177 -0
- package/third-party/include/executorch/runtime/platform/platform.h +133 -0
- package/third-party/include/executorch/runtime/platform/profiler.h +292 -0
- package/third-party/include/executorch/runtime/platform/runtime.h +35 -0
- package/third-party/include/executorch/runtime/platform/system.h +49 -0
- package/third-party/include/executorch/runtime/platform/types.h +24 -0
- package/third-party/include/executorch/schema/extended_header.h +76 -0
- package/third-party/include/opencv2/core/affine.hpp +676 -0
- package/third-party/include/opencv2/core/async.hpp +107 -0
- package/third-party/include/opencv2/core/base.hpp +735 -0
- package/third-party/include/opencv2/core/bindings_utils.hpp +279 -0
- package/third-party/include/opencv2/core/bufferpool.hpp +39 -0
- package/third-party/include/opencv2/core/check.hpp +231 -0
- package/third-party/include/opencv2/core/core.hpp +55 -0
- package/third-party/include/opencv2/core/core_c.h +3261 -0
- package/third-party/include/opencv2/core/cv_cpu_dispatch.h +404 -0
- package/third-party/include/opencv2/core/cv_cpu_helper.h +856 -0
- package/third-party/include/opencv2/core/cvdef.h +1003 -0
- package/third-party/include/opencv2/core/cvstd.hpp +196 -0
- package/third-party/include/opencv2/core/cvstd.inl.hpp +188 -0
- package/third-party/include/opencv2/core/cvstd_wrapper.hpp +187 -0
- package/third-party/include/opencv2/core/detail/async_promise.hpp +73 -0
- package/third-party/include/opencv2/core/detail/dispatch_helper.impl.hpp +48 -0
- package/third-party/include/opencv2/core/detail/exception_ptr.hpp +24 -0
- package/third-party/include/opencv2/core/dualquaternion.hpp +1054 -0
- package/third-party/include/opencv2/core/dualquaternion.inl.hpp +464 -0
- package/third-party/include/opencv2/core/eigen.hpp +405 -0
- package/third-party/include/opencv2/core/fast_math.hpp +433 -0
- package/third-party/include/opencv2/core/hal/hal.hpp +451 -0
- package/third-party/include/opencv2/core/hal/interface.h +191 -0
- package/third-party/include/opencv2/core/hal/intrin.hpp +1222 -0
- package/third-party/include/opencv2/core/hal/intrin_avx.hpp +3378 -0
- package/third-party/include/opencv2/core/hal/intrin_avx512.hpp +3688 -0
- package/third-party/include/opencv2/core/hal/intrin_cpp.hpp +3446 -0
- package/third-party/include/opencv2/core/hal/intrin_forward.hpp +195 -0
- package/third-party/include/opencv2/core/hal/intrin_lasx.hpp +3243 -0
- package/third-party/include/opencv2/core/hal/intrin_lsx.hpp +2671 -0
- package/third-party/include/opencv2/core/hal/intrin_math.hpp +772 -0
- package/third-party/include/opencv2/core/hal/intrin_msa.hpp +1973 -0
- package/third-party/include/opencv2/core/hal/intrin_neon.hpp +2710 -0
- package/third-party/include/opencv2/core/hal/intrin_rvv071.hpp +3452 -0
- package/third-party/include/opencv2/core/hal/intrin_rvv_scalable.hpp +2559 -0
- package/third-party/include/opencv2/core/hal/intrin_sse.hpp +3528 -0
- package/third-party/include/opencv2/core/hal/intrin_sse_em.hpp +175 -0
- package/third-party/include/opencv2/core/hal/intrin_vsx.hpp +1756 -0
- package/third-party/include/opencv2/core/hal/intrin_wasm.hpp +2911 -0
- package/third-party/include/opencv2/core/hal/msa_macros.h +2079 -0
- package/third-party/include/opencv2/core/hal/simd_utils.impl.hpp +313 -0
- package/third-party/include/opencv2/core/mat.hpp +3842 -0
- package/third-party/include/opencv2/core/mat.inl.hpp +2753 -0
- package/third-party/include/opencv2/core/matx.hpp +603 -0
- package/third-party/include/opencv2/core/matx.inl.hpp +1132 -0
- package/third-party/include/opencv2/core/neon_utils.hpp +127 -0
- package/third-party/include/opencv2/core/operations.hpp +610 -0
- package/third-party/include/opencv2/core/optim.hpp +362 -0
- package/third-party/include/opencv2/core/parallel/backend/parallel_for.openmp.hpp +66 -0
- package/third-party/include/opencv2/core/parallel/backend/parallel_for.tbb.hpp +148 -0
- package/third-party/include/opencv2/core/parallel/parallel_backend.hpp +108 -0
- package/third-party/include/opencv2/core/persistence.hpp +1321 -0
- package/third-party/include/opencv2/core/quaternion.hpp +1889 -0
- package/third-party/include/opencv2/core/quaternion.inl.hpp +907 -0
- package/third-party/include/opencv2/core/saturate.hpp +347 -0
- package/third-party/include/opencv2/core/simd_intrinsics.hpp +90 -0
- package/third-party/include/opencv2/core/softfloat.hpp +657 -0
- package/third-party/include/opencv2/core/sse_utils.hpp +861 -0
- package/third-party/include/opencv2/core/traits.hpp +417 -0
- package/third-party/include/opencv2/core/types.hpp +2368 -0
- package/third-party/include/opencv2/core/types_c.h +2064 -0
- package/third-party/include/opencv2/core/utility.hpp +1296 -0
- package/third-party/include/opencv2/core/utils/allocator_stats.hpp +31 -0
- package/third-party/include/opencv2/core/utils/allocator_stats.impl.hpp +111 -0
- package/third-party/include/opencv2/core/utils/filesystem.hpp +91 -0
- package/third-party/include/opencv2/core/utils/fp_control_utils.hpp +70 -0
- package/third-party/include/opencv2/core/utils/instrumentation.hpp +127 -0
- package/third-party/include/opencv2/core/utils/logger.defines.hpp +50 -0
- package/third-party/include/opencv2/core/utils/logger.hpp +258 -0
- package/third-party/include/opencv2/core/utils/logtag.hpp +27 -0
- package/third-party/include/opencv2/core/utils/tls.hpp +230 -0
- package/third-party/include/opencv2/core/utils/trace.hpp +281 -0
- package/third-party/include/opencv2/core/version.hpp +29 -0
- package/third-party/include/opencv2/core/vsx_utils.hpp +1115 -0
- package/third-party/include/opencv2/core.hpp +3699 -0
- package/third-party/include/opencv2/cvconfig.h +155 -0
- package/third-party/include/opencv2/dnn/dnn.hpp +51 -0
- package/third-party/include/opencv2/dnn.hpp +17 -0
- package/third-party/include/opencv2/features2d/features2d.hpp +55 -0
- package/third-party/include/opencv2/features2d/hal/interface.h +32 -0
- package/third-party/include/opencv2/features2d.hpp +1756 -0
- package/third-party/include/opencv2/highgui/highgui.hpp +113 -0
- package/third-party/include/opencv2/highgui.hpp +17 -0
- package/third-party/include/opencv2/imgproc/bindings.hpp +34 -0
- package/third-party/include/opencv2/imgproc/detail/gcgraph.hpp +355 -0
- package/third-party/include/opencv2/imgproc/detail/legacy.hpp +35 -0
- package/third-party/include/opencv2/imgproc/hal/hal.hpp +246 -0
- package/third-party/include/opencv2/imgproc/hal/interface.h +52 -0
- package/third-party/include/opencv2/imgproc/imgproc.hpp +55 -0
- package/third-party/include/opencv2/imgproc/imgproc_c.h +1261 -0
- package/third-party/include/opencv2/imgproc/segmentation.hpp +168 -0
- package/third-party/include/opencv2/imgproc/types_c.h +632 -0
- package/third-party/include/opencv2/imgproc.hpp +5956 -0
- package/third-party/include/opencv2/opencv.hpp +102 -0
- package/third-party/include/opencv2/opencv_modules.hpp +19 -0
- package/third-party/include/opencv2/photo/legacy/constants_c.h +10 -0
- package/third-party/include/opencv2/photo/photo.hpp +55 -0
- package/third-party/include/opencv2/photo.hpp +975 -0
- package/third-party/include/opencv2/video/background_segm.hpp +341 -0
- package/third-party/include/opencv2/video/detail/tracking.detail.hpp +435 -0
- package/third-party/include/opencv2/video/legacy/constants_c.h +15 -0
- package/third-party/include/opencv2/video/tracking.hpp +1014 -0
- package/third-party/include/opencv2/video/video.hpp +55 -0
- package/third-party/include/opencv2/video.hpp +65 -0
- package/third-party/include/tokenizers-cpp/tokenizers_c.h +61 -0
- package/third-party/include/tokenizers-cpp/tokenizers_cpp.h +118 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/ETModel.h +27 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/ETModel.mm +249 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/HuggingFaceTokenizer.h +14 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/HuggingFaceTokenizer.mm +80 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/LLaMARunner.h +32 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Exported/LLaMARunner.mm +95 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/InputType.h +12 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/Utils.hpp +217 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/model/Model.cpp +11 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/model/Model.h +11 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/irunner.h +48 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/runner.cpp +278 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/runner.h +67 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/stats.h +164 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_decoder_runner.cpp +65 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_decoder_runner.h +105 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_prefiller.cpp +91 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_prefiller.h +51 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/text_token_generator.h +162 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/runner/util.h +108 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/sampler/sampler.cpp +193 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/sampler/sampler.h +64 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/base64.h +202 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/bpe_tokenizer.cpp +313 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/bpe_tokenizer.h +57 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/llama_tiktoken.cpp +78 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/llama_tiktoken.h +23 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tiktoken.cpp +427 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tiktoken.h +87 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib/tokenizer/tokenizer.h +76 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.pbxproj +683 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/project.xcworkspace/xcuserdata/norbertklockiewicz.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/third-party/ios/ExecutorchLib/ExecutorchLib.xcodeproj/xcuserdata/norbertklockiewicz.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/third-party/ios/ExecutorchLib/build.sh +44 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/ios-arm64/libbackend_coreml_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_coreml.xcframework/ios-arm64-simulator/libbackend_coreml_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/ios-arm64/libbackend_mps_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_mps.xcframework/ios-arm64-simulator/libbackend_mps_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/ios-arm64/libbackend_xnnpack_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/backend_xnnpack.xcframework/ios-arm64-simulator/libbackend_xnnpack_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/Info.plist +47 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/macros/Export.h +163 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/macros/Macros.h +497 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16-inl.h +342 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16-math.h +266 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/BFloat16.h +125 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/Half-inl.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/Half.h +416 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/bit_cast.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/floating_point_utils.h +33 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/c10/util/irange.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorch.h +13 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchError.h +16 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchLog.h +76 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchModule.h +286 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchTensor.h +742 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/ExecuTorchValue.h +219 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/module/module.h +492 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor.h +13 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_accessor.h +190 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_ptr.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/extension/tensor/tensor_ptr_maker.h +653 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/backend_execution_context.h +71 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/backend_init_context.h +72 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/backend/interface.h +166 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/array_ref.h +235 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/data_loader.h +136 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/defines.h +20 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/error.h +229 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/evalue.h +521 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer.h +565 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer_hooks.h +323 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/event_tracer_hooks_delegate.h +197 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/exec_aten.h +147 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/dim_order_util.h +263 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/scalar_type_util.h +1331 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +21 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +69 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/exec_aten/util/tensor_util.h +1250 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/freeable_buffer.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/hierarchical_allocator.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/memory_allocator.h +198 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/named_data_map.h +86 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bfloat16.h +27 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bfloat16_math.h +14 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/bits_types.h +83 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +163 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +497 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +342 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +266 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +125 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half.h +416 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +33 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/c10/c10/util/irange.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/complex.h +44 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/device.h +70 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/half.h +27 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/optional.h +36 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/qint_types.h +83 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/scalar.h +110 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/scalar_type.h +154 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/string_view.h +29 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor.h +142 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor_impl.h +261 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/portable_type/tensor_options.h +60 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/result.h +258 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/span.h +93 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tag.h +71 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tensor_layout.h +79 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/core/tensor_shape_dynamism.h +39 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/memory_manager.h +113 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/method.h +387 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/method_meta.h +251 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/program.h +320 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/pte_data_map.h +144 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/executor/tensor_parser.h +156 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/kernel/kernel_runtime_context.h +122 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/kernel/operator_registry.h +278 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/abort.h +36 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/assert.h +119 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/clock.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/compat_unistd.h +75 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/compiler.h +191 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/log.h +177 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/platform.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/profiler.h +292 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/runtime.h +35 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/system.h +49 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/runtime/platform/types.h +24 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/executorch/schema/extended_header.h +76 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/Headers/module.modulemap +5 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64/libexecutorch_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/macros/Export.h +163 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/macros/Macros.h +497 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16-inl.h +342 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16-math.h +266 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/BFloat16.h +125 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/Half-inl.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/Half.h +416 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/bit_cast.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/floating_point_utils.h +33 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/c10/util/irange.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorch.h +13 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchError.h +16 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchLog.h +76 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchModule.h +286 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchTensor.h +742 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/ExecuTorchValue.h +219 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/module/module.h +492 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor.h +13 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_accessor.h +190 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_ptr.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/extension/tensor/tensor_ptr_maker.h +653 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/backend_execution_context.h +71 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/backend_init_context.h +72 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/backend/interface.h +166 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/array_ref.h +235 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/data_loader.h +136 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/defines.h +20 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/error.h +229 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/evalue.h +521 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer.h +565 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer_hooks.h +323 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/event_tracer_hooks_delegate.h +197 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/exec_aten.h +147 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/dim_order_util.h +263 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/scalar_type_util.h +1331 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h +21 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_shape_to_c_string.h +69 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/exec_aten/util/tensor_util.h +1250 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/freeable_buffer.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/hierarchical_allocator.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/memory_allocator.h +198 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/named_data_map.h +86 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bfloat16.h +27 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bfloat16_math.h +14 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/bits_types.h +83 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Export.h +163 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/macros/Macros.h +497 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-inl.h +342 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16-math.h +266 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/BFloat16.h +125 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half-inl.h +347 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/Half.h +416 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/TypeSafeSignMath.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/bit_cast.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/floating_point_utils.h +33 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/c10/c10/util/irange.h +107 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/complex.h +44 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/device.h +70 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/half.h +27 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/optional.h +36 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/qint_types.h +83 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/scalar.h +110 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/scalar_type.h +154 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/string_view.h +29 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor.h +142 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor_impl.h +261 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/portable_type/tensor_options.h +60 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/result.h +258 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/span.h +93 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tag.h +71 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tensor_layout.h +79 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/core/tensor_shape_dynamism.h +39 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/memory_manager.h +113 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/method.h +387 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/method_meta.h +251 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/program.h +320 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/pte_data_map.h +144 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/executor/tensor_parser.h +156 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/kernel/kernel_runtime_context.h +122 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/kernel/operator_registry.h +278 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/abort.h +36 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/assert.h +119 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/clock.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/compat_unistd.h +75 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/compiler.h +191 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/log.h +177 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/platform.h +133 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/profiler.h +292 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/runtime.h +35 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/system.h +49 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/runtime/platform/types.h +24 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/executorch/schema/extended_header.h +76 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/Headers/module.modulemap +5 -0
- package/third-party/ios/ExecutorchLib/frameworks/executorch.xcframework/ios-arm64-simulator/libexecutorch_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/ios-arm64/libkernels_custom_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_custom.xcframework/ios-arm64-simulator/libkernels_custom_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/ios-arm64/libkernels_optimized_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_optimized.xcframework/ios-arm64-simulator/libkernels_optimized_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/ios-arm64/libkernels_portable_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_portable.xcframework/ios-arm64-simulator/libkernels_portable_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/ios-arm64/libkernels_quantized_ios.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/kernels_quantized.xcframework/ios-arm64-simulator/libkernels_quantized_simulator.a +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/Info.plist +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/bitmap256.h +82 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/filtered_re2.h +111 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/pod_array.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prefilter.h +130 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prefilter_tree.h +139 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/prog.h +483 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/re2.h +994 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/regexp.h +692 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/set.h +85 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/sparse_array.h +367 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/sparse_set.h +241 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/stringpiece.h +205 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/unicode_casefold.h +78 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/unicode_groups.h +64 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Headers/walker-inl.h +235 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/Info.plist +26 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64/re2.framework/re2 +0 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/bitmap256.h +82 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/filtered_re2.h +111 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/pod_array.h +43 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prefilter.h +130 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prefilter_tree.h +139 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/prog.h +483 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/re2.h +994 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/regexp.h +692 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/set.h +85 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/sparse_array.h +367 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/sparse_set.h +241 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/stringpiece.h +205 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/unicode_casefold.h +78 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/unicode_groups.h +64 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Headers/walker-inl.h +235 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/Info.plist +26 -0
- package/third-party/ios/ExecutorchLib/frameworks/re2.xcframework/ios-arm64-simulator/re2.framework/re2 +0 -0
- package/third-party/ios/ios.toolchain.cmake +1122 -0
- package/LICENSE +0 -79
- package/README.md +0 -148
- package/android/src/main/java/com/swmansion/rnexecutorch/Classification.kt +0 -64
- package/android/src/main/java/com/swmansion/rnexecutorch/ETModule.kt +0 -90
- package/android/src/main/java/com/swmansion/rnexecutorch/ImageSegmentation.kt +0 -58
- package/android/src/main/java/com/swmansion/rnexecutorch/OCR.kt +0 -90
- package/android/src/main/java/com/swmansion/rnexecutorch/ObjectDetection.kt +0 -64
- package/android/src/main/java/com/swmansion/rnexecutorch/SpeechToText.kt +0 -91
- package/android/src/main/java/com/swmansion/rnexecutorch/StyleTransfer.kt +0 -54
- package/android/src/main/java/com/swmansion/rnexecutorch/TextEmbeddings.kt +0 -51
- package/android/src/main/java/com/swmansion/rnexecutorch/Tokenizer.kt +0 -86
- package/android/src/main/java/com/swmansion/rnexecutorch/VerticalOCR.kt +0 -179
- package/android/src/main/java/com/swmansion/rnexecutorch/models/BaseModel.kt +0 -54
- package/android/src/main/java/com/swmansion/rnexecutorch/models/TextEmbeddings/TextEmbeddingsModel.kt +0 -48
- package/android/src/main/java/com/swmansion/rnexecutorch/models/TextEmbeddings/TextEmbeddingsUtils.kt +0 -37
- package/android/src/main/java/com/swmansion/rnexecutorch/models/classification/ClassificationModel.kt +0 -46
- package/android/src/main/java/com/swmansion/rnexecutorch/models/classification/Constants.kt +0 -1005
- package/android/src/main/java/com/swmansion/rnexecutorch/models/imageSegmentation/Constants.kt +0 -26
- package/android/src/main/java/com/swmansion/rnexecutorch/models/imageSegmentation/ImageSegmentationModel.kt +0 -142
- package/android/src/main/java/com/swmansion/rnexecutorch/models/objectDetection/SSDLiteLargeModel.kt +0 -74
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/Detector.kt +0 -82
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/RecognitionHandler.kt +0 -117
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/Recognizer.kt +0 -51
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/VerticalDetector.kt +0 -89
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/CTCLabelConverter.kt +0 -58
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/Constants.kt +0 -31
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/DetectorUtils.kt +0 -608
- package/android/src/main/java/com/swmansion/rnexecutorch/models/ocr/utils/RecognizerUtils.kt +0 -430
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/BaseS2TDecoder.kt +0 -39
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/BaseS2TModule.kt +0 -43
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/Moonshine.kt +0 -16
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/MoonshineDecoder.kt +0 -23
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/MoonshineEncoder.kt +0 -20
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/Whisper.kt +0 -16
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/WhisperDecoder.kt +0 -22
- package/android/src/main/java/com/swmansion/rnexecutorch/models/speechToText/WhisperEncoder.kt +0 -29
- package/android/src/main/java/com/swmansion/rnexecutorch/models/styleTransfer/StyleTransferModel.kt +0 -43
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/ArrayUtils.kt +0 -87
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/ETError.kt +0 -34
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/ImageProcessor.kt +0 -237
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/Numerical.kt +0 -8
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/ObjectDetectionUtils.kt +0 -201
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/STFT.kt +0 -50
- package/android/src/main/java/com/swmansion/rnexecutorch/utils/TensorUtils.kt +0 -103
- package/ios/RnExecutorch/Classification.h +0 -5
- package/ios/RnExecutorch/Classification.mm +0 -54
- package/ios/RnExecutorch/ETModule.h +0 -5
- package/ios/RnExecutorch/ETModule.mm +0 -75
- package/ios/RnExecutorch/ImageSegmentation.h +0 -5
- package/ios/RnExecutorch/ImageSegmentation.mm +0 -60
- package/ios/RnExecutorch/OCR.h +0 -5
- package/ios/RnExecutorch/OCR.mm +0 -96
- package/ios/RnExecutorch/ObjectDetection.h +0 -5
- package/ios/RnExecutorch/ObjectDetection.mm +0 -56
- package/ios/RnExecutorch/SpeechToText.h +0 -5
- package/ios/RnExecutorch/SpeechToText.mm +0 -125
- package/ios/RnExecutorch/StyleTransfer.h +0 -5
- package/ios/RnExecutorch/StyleTransfer.mm +0 -55
- package/ios/RnExecutorch/TextEmbeddings.h +0 -5
- package/ios/RnExecutorch/TextEmbeddings.mm +0 -62
- package/ios/RnExecutorch/Tokenizer.h +0 -5
- package/ios/RnExecutorch/Tokenizer.mm +0 -83
- package/ios/RnExecutorch/VerticalOCR.h +0 -5
- package/ios/RnExecutorch/VerticalOCR.mm +0 -183
- package/ios/RnExecutorch/models/BaseModel.h +0 -21
- package/ios/RnExecutorch/models/BaseModel.mm +0 -43
- package/ios/RnExecutorch/models/classification/ClassificationModel.h +0 -10
- package/ios/RnExecutorch/models/classification/ClassificationModel.mm +0 -53
- package/ios/RnExecutorch/models/classification/Constants.h +0 -3
- package/ios/RnExecutorch/models/image_segmentation/Constants.h +0 -4
- package/ios/RnExecutorch/models/image_segmentation/ImageSegmentationModel.h +0 -10
- package/ios/RnExecutorch/models/image_segmentation/ImageSegmentationModel.mm +0 -146
- package/ios/RnExecutorch/models/object_detection/SSDLiteLargeModel.hpp +0 -11
- package/ios/RnExecutorch/models/object_detection/SSDLiteLargeModel.mm +0 -64
- package/ios/RnExecutorch/models/ocr/Detector.h +0 -9
- package/ios/RnExecutorch/models/ocr/Detector.mm +0 -101
- package/ios/RnExecutorch/models/ocr/RecognitionHandler.h +0 -16
- package/ios/RnExecutorch/models/ocr/RecognitionHandler.mm +0 -135
- package/ios/RnExecutorch/models/ocr/Recognizer.h +0 -8
- package/ios/RnExecutorch/models/ocr/Recognizer.mm +0 -77
- package/ios/RnExecutorch/models/ocr/VerticalDetector.h +0 -10
- package/ios/RnExecutorch/models/ocr/VerticalDetector.mm +0 -118
- package/ios/RnExecutorch/models/ocr/utils/CTCLabelConverter.h +0 -16
- package/ios/RnExecutorch/models/ocr/utils/CTCLabelConverter.mm +0 -80
- package/ios/RnExecutorch/models/ocr/utils/Constants.h +0 -26
- package/ios/RnExecutorch/models/ocr/utils/DetectorUtils.h +0 -31
- package/ios/RnExecutorch/models/ocr/utils/DetectorUtils.mm +0 -754
- package/ios/RnExecutorch/models/ocr/utils/OCRUtils.h +0 -10
- package/ios/RnExecutorch/models/ocr/utils/OCRUtils.mm +0 -67
- package/ios/RnExecutorch/models/ocr/utils/RecognizerUtils.h +0 -35
- package/ios/RnExecutorch/models/ocr/utils/RecognizerUtils.mm +0 -331
- package/ios/RnExecutorch/models/stt/Moonshine.hpp +0 -13
- package/ios/RnExecutorch/models/stt/Moonshine.mm +0 -64
- package/ios/RnExecutorch/models/stt/MoonshineDecoder.hpp +0 -16
- package/ios/RnExecutorch/models/stt/MoonshineDecoder.mm +0 -24
- package/ios/RnExecutorch/models/stt/MoonshineEncoder.hpp +0 -15
- package/ios/RnExecutorch/models/stt/MoonshineEncoder.mm +0 -18
- package/ios/RnExecutorch/models/stt/SpeechToTextBaseModel.hpp +0 -26
- package/ios/RnExecutorch/models/stt/SpeechToTextBaseModel.mm +0 -19
- package/ios/RnExecutorch/models/stt/Whisper.hpp +0 -12
- package/ios/RnExecutorch/models/stt/Whisper.mm +0 -68
- package/ios/RnExecutorch/models/stt/WhisperDecoder.hpp +0 -16
- package/ios/RnExecutorch/models/stt/WhisperDecoder.mm +0 -22
- package/ios/RnExecutorch/models/stt/WhisperEncoder.hpp +0 -15
- package/ios/RnExecutorch/models/stt/WhisperEncoder.mm +0 -21
- package/ios/RnExecutorch/models/style_transfer/StyleTransferModel.h +0 -11
- package/ios/RnExecutorch/models/style_transfer/StyleTransferModel.mm +0 -50
- package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsModel.h +0 -15
- package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsModel.mm +0 -45
- package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsUtils.h +0 -8
- package/ios/RnExecutorch/models/text_embeddings/TextEmbeddingsUtils.mm +0 -49
- package/ios/RnExecutorch/utils/Constants.h +0 -8
- package/ios/RnExecutorch/utils/ObjectDetectionUtils.hpp +0 -23
- package/ios/RnExecutorch/utils/SFFT.hpp +0 -13
- package/ios/RnExecutorch/utils/SFFT.mm +0 -71
- package/lib/module/native/NativeClassification.js +0 -5
- package/lib/module/native/NativeClassification.js.map +0 -1
- package/lib/module/native/NativeETModule.js +0 -5
- package/lib/module/native/NativeETModule.js.map +0 -1
- package/lib/module/native/NativeImageSegmentation.js +0 -5
- package/lib/module/native/NativeImageSegmentation.js.map +0 -1
- package/lib/module/native/NativeOCR.js +0 -5
- package/lib/module/native/NativeOCR.js.map +0 -1
- package/lib/module/native/NativeObjectDetection.js +0 -5
- package/lib/module/native/NativeObjectDetection.js.map +0 -1
- package/lib/module/native/NativeSpeechToText.js +0 -5
- package/lib/module/native/NativeSpeechToText.js.map +0 -1
- package/lib/module/native/NativeStyleTransfer.js +0 -5
- package/lib/module/native/NativeStyleTransfer.js.map +0 -1
- package/lib/module/native/NativeTextEmbeddings.js +0 -5
- package/lib/module/native/NativeTextEmbeddings.js.map +0 -1
- package/lib/module/native/NativeTokenizer.js +0 -5
- package/lib/module/native/NativeTokenizer.js.map +0 -1
- package/lib/module/native/NativeVerticalOCR.js +0 -5
- package/lib/module/native/NativeVerticalOCR.js.map +0 -1
- package/lib/module/package.json +0 -1
- package/lib/typescript/native/NativeClassification.d.ts +0 -10
- package/lib/typescript/native/NativeClassification.d.ts.map +0 -1
- package/lib/typescript/native/NativeETModule.d.ts +0 -9
- package/lib/typescript/native/NativeETModule.d.ts.map +0 -1
- package/lib/typescript/native/NativeImageSegmentation.d.ts +0 -10
- package/lib/typescript/native/NativeImageSegmentation.d.ts.map +0 -1
- package/lib/typescript/native/NativeOCR.d.ts +0 -9
- package/lib/typescript/native/NativeOCR.d.ts.map +0 -1
- package/lib/typescript/native/NativeObjectDetection.d.ts +0 -9
- package/lib/typescript/native/NativeObjectDetection.d.ts.map +0 -1
- package/lib/typescript/native/NativeSpeechToText.d.ts +0 -12
- package/lib/typescript/native/NativeSpeechToText.d.ts.map +0 -1
- package/lib/typescript/native/NativeStyleTransfer.d.ts.map +0 -1
- package/lib/typescript/native/NativeTextEmbeddings.d.ts +0 -8
- package/lib/typescript/native/NativeTextEmbeddings.d.ts.map +0 -1
- package/lib/typescript/native/NativeTokenizer.d.ts +0 -12
- package/lib/typescript/native/NativeTokenizer.d.ts.map +0 -1
- package/lib/typescript/native/NativeVerticalOCR.d.ts +0 -9
- package/lib/typescript/native/NativeVerticalOCR.d.ts.map +0 -1
- package/src/native/NativeClassification.ts +0 -9
- package/src/native/NativeETModule.ts +0 -14
- package/src/native/NativeImageSegmentation.ts +0 -14
- package/src/native/NativeOCR.ts +0 -16
- package/src/native/NativeObjectDetection.ts +0 -10
- package/src/native/NativeSpeechToText.ts +0 -17
- package/src/native/NativeStyleTransfer.ts +0 -10
- package/src/native/NativeTextEmbeddings.ts +0 -9
- package/src/native/NativeTokenizer.ts +0 -13
- package/src/native/NativeVerticalOCR.ts +0 -16
|
@@ -0,0 +1,1250 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the BSD-style license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#include <algorithm>
|
|
12
|
+
#include <array> // std::array
|
|
13
|
+
#include <c10/util/irange.h>
|
|
14
|
+
#include <cinttypes> // PRId64
|
|
15
|
+
#include <cmath>
|
|
16
|
+
#include <cstddef> // size_t
|
|
17
|
+
|
|
18
|
+
#include <limits>
|
|
19
|
+
|
|
20
|
+
#include <executorch/runtime/core/array_ref.h>
|
|
21
|
+
#include <executorch/runtime/core/error.h>
|
|
22
|
+
#include <executorch/runtime/core/exec_aten/exec_aten.h>
|
|
23
|
+
#include <executorch/runtime/core/exec_aten/util/dim_order_util.h>
|
|
24
|
+
#include <executorch/runtime/core/exec_aten/util/scalar_type_util.h>
|
|
25
|
+
#include <executorch/runtime/core/exec_aten/util/tensor_dimension_limit.h>
|
|
26
|
+
#include <executorch/runtime/core/span.h>
|
|
27
|
+
#include <executorch/runtime/platform/assert.h>
|
|
28
|
+
#include <executorch/runtime/platform/compiler.h>
|
|
29
|
+
|
|
30
|
+
/// All assertion messages should begin with this prefix.
|
|
31
|
+
#define ET_TENSOR_CHECK_PREFIX__ "Tensors do not match"
|
|
32
|
+
#define ET_MIN2(a, b) (std::min(a, b))
|
|
33
|
+
#define ET_MIN3(a, b, c) (std::min(a, std::min(b, c)))
|
|
34
|
+
|
|
35
|
+
#define ET_NORMALIZE_IX(IX, UPPER_BOUND) IX < 0 ? IX + UPPER_BOUND : IX
|
|
36
|
+
|
|
37
|
+
#define ET_CHECK_VALID_IX(IX, UPPER_BOUND) \
|
|
38
|
+
ET_CHECK_MSG(IX >= -static_cast<int64_t>(UPPER_BOUND) && \
|
|
39
|
+
IX < static_cast<int64_t>(UPPER_BOUND), \
|
|
40
|
+
"index %" PRId64 " must be within range [-%zd, %zd)", IX, \
|
|
41
|
+
UPPER_BOUND, UPPER_BOUND)
|
|
42
|
+
|
|
43
|
+
#define ET_CHECK_VALID_DIM(DIM, UPPER_BOUND) \
|
|
44
|
+
ET_CHECK_MSG(DIM >= -static_cast<int64_t>(UPPER_BOUND) && \
|
|
45
|
+
DIM < static_cast<int64_t>(UPPER_BOUND), \
|
|
46
|
+
"dim %" PRId64 " must be within range [-%zd, %zd)", DIM, \
|
|
47
|
+
UPPER_BOUND, UPPER_BOUND)
|
|
48
|
+
|
|
49
|
+
#define ET_CHECK_NON_ZERO_DIM_SIZE(DIM, T) \
|
|
50
|
+
const size_t udim = ET_NORMALIZE_IX(DIM, T.dim()); \
|
|
51
|
+
ET_CHECK_MSG(T.size(udim) != 0, "Expected dim %zd to have non-zero size.", \
|
|
52
|
+
udim);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Asserts that all tensors have the same shape.
|
|
56
|
+
* This also handles a edge case where there is only one element in all the
|
|
57
|
+
* tensors being compared but the number of dimensions >= 0. In the for loop
|
|
58
|
+
* iterating over the dimensions we make sure that we pick the smallest
|
|
59
|
+
* dimension of all the tensors as the upper bound for the for loop.
|
|
60
|
+
*/
|
|
61
|
+
#define ET_CHECK_SAME_SHAPE2(a__, b__) \
|
|
62
|
+
({ \
|
|
63
|
+
const size_t a_numel__ = (a__).numel(); \
|
|
64
|
+
const size_t b_numel__ = (b__).numel(); \
|
|
65
|
+
const size_t a_dim__ = (a__).dim(); \
|
|
66
|
+
const size_t b_dim__ = (b__).dim(); \
|
|
67
|
+
ET_CHECK_MSG( \
|
|
68
|
+
a_numel__ == b_numel__ && \
|
|
69
|
+
((a_numel__ == 1 && b_numel__ == 1) || (a_dim__ == b_dim__)), \
|
|
70
|
+
ET_TENSOR_CHECK_PREFIX__ ": numel={%zu, %zu}, dim={%zu, %zu}", \
|
|
71
|
+
a_numel__, b_numel__, a_dim__, b_dim__); \
|
|
72
|
+
for (size_t dim__ = 0; dim__ < ET_MIN2(a_dim__, b_dim__); ++dim__) { \
|
|
73
|
+
size_t a_size__ = (a__).size(dim__); \
|
|
74
|
+
size_t b_size__ = (b__).size(dim__); \
|
|
75
|
+
ET_CHECK_MSG(a_size__ == b_size__, \
|
|
76
|
+
ET_TENSOR_CHECK_PREFIX__ " at size(%zu): {%zu, %zu}", \
|
|
77
|
+
dim__, a_size__, b_size__); \
|
|
78
|
+
} \
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
#define ET_CHECK_SAME_SHAPE3(a__, b__, c__) \
|
|
82
|
+
({ \
|
|
83
|
+
const size_t a_numel__ = (a__).numel(); \
|
|
84
|
+
const size_t b_numel__ = (b__).numel(); \
|
|
85
|
+
const size_t c_numel__ = (c__).numel(); \
|
|
86
|
+
const size_t a_dim__ = (a__).dim(); \
|
|
87
|
+
const size_t b_dim__ = (b__).dim(); \
|
|
88
|
+
const size_t c_dim__ = (c__).dim(); \
|
|
89
|
+
ET_CHECK_MSG(a_numel__ == b_numel__ && b_numel__ == c_numel__ && \
|
|
90
|
+
((a_numel__ == 1 && b_numel__ == 1 && c_numel__ == 1) || \
|
|
91
|
+
a_dim__ == b_dim__ && b_dim__ == c_dim__), \
|
|
92
|
+
ET_TENSOR_CHECK_PREFIX__ \
|
|
93
|
+
": numel={%zu, %zu, %zu}, dim={%zu, %zu, %zu}", \
|
|
94
|
+
a_numel__, b_numel__, c_numel__, a_dim__, b_dim__, c_dim__); \
|
|
95
|
+
for (size_t dim__ = 0; dim__ < ET_MIN3(a_dim__, b_dim__, c_dim__); \
|
|
96
|
+
++dim__) { \
|
|
97
|
+
size_t a_size__ = (a__).size(dim__); \
|
|
98
|
+
size_t b_size__ = (b__).size(dim__); \
|
|
99
|
+
size_t c_size__ = (c__).size(dim__); \
|
|
100
|
+
ET_CHECK_MSG(a_size__ == b_size__ && b_size__ == c_size__, \
|
|
101
|
+
ET_TENSOR_CHECK_PREFIX__ " at size(%zu): {%zu, %zu, %zu}", \
|
|
102
|
+
dim__, a_size__, b_size__, c_size__); \
|
|
103
|
+
} \
|
|
104
|
+
})
|
|
105
|
+
|
|
106
|
+
/// Asserts that all tensors have the same dtype.
|
|
107
|
+
#define ET_CHECK_SAME_DTYPE2(a__, b__) \
|
|
108
|
+
({ \
|
|
109
|
+
const ::executorch::aten::ScalarType a_type__ = (a__).scalar_type(); \
|
|
110
|
+
const ::executorch::aten::ScalarType b_type__ = (b__).scalar_type(); \
|
|
111
|
+
ET_CHECK_MSG(a_type__ == b_type__, \
|
|
112
|
+
ET_TENSOR_CHECK_PREFIX__ ": dtype={%" PRId8 ", %" PRId8 "}", \
|
|
113
|
+
static_cast<int8_t>(a_type__), \
|
|
114
|
+
static_cast<int8_t>(b_type__)); \
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
#define ET_CHECK_SAME_DTYPE3(a__, b__, c__) \
|
|
118
|
+
({ \
|
|
119
|
+
const ::executorch::aten::ScalarType a_type__ = (a__).scalar_type(); \
|
|
120
|
+
const ::executorch::aten::ScalarType b_type__ = (b__).scalar_type(); \
|
|
121
|
+
const ::executorch::aten::ScalarType c_type__ = (c__).scalar_type(); \
|
|
122
|
+
ET_CHECK_MSG(a_type__ == b_type__ && b_type__ == c_type__, \
|
|
123
|
+
ET_TENSOR_CHECK_PREFIX__ ": dtype={%" PRId8 ", %" PRId8 \
|
|
124
|
+
", %" PRId8 "}", \
|
|
125
|
+
static_cast<int8_t>(a_type__), static_cast<int8_t>(b_type__), \
|
|
126
|
+
static_cast<int8_t>(c_type__)); \
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Asserts that all tensors have the same shape and dtype.
|
|
131
|
+
*
|
|
132
|
+
* This macro should produce less code/data than calling the SHAPE and DTYPE
|
|
133
|
+
* macros independently, because it only calls ET_CHECK_MSG once.
|
|
134
|
+
*/
|
|
135
|
+
#define ET_CHECK_SAME_SHAPE_AND_DTYPE2(a__, b__) \
|
|
136
|
+
({ \
|
|
137
|
+
const size_t a_numel__ = (a__).numel(); \
|
|
138
|
+
const size_t b_numel__ = (b__).numel(); \
|
|
139
|
+
const size_t a_dim__ = (a__).dim(); \
|
|
140
|
+
const size_t b_dim__ = (b__).dim(); \
|
|
141
|
+
const ::executorch::aten::ScalarType a_type__ = (a__).scalar_type(); \
|
|
142
|
+
const ::executorch::aten::ScalarType b_type__ = (b__).scalar_type(); \
|
|
143
|
+
\
|
|
144
|
+
ET_CHECK_MSG( \
|
|
145
|
+
a_numel__ == b_numel__ && \
|
|
146
|
+
((a_numel__ == 1 && b_numel__ == 1) || a_dim__ == b_dim__) && \
|
|
147
|
+
a_type__ == b_type__, \
|
|
148
|
+
ET_TENSOR_CHECK_PREFIX__ \
|
|
149
|
+
": numel={%zu, %zu}, dim={%zu, %zu}, dtype={%" PRId8 ", %" PRId8 "}", \
|
|
150
|
+
a_numel__, b_numel__, a_dim__, b_dim__, static_cast<int8_t>(a_type__), \
|
|
151
|
+
static_cast<int8_t>(b_type__)); \
|
|
152
|
+
for (size_t dim__ = 0; dim__ < ET_MIN2(a_dim__, b_dim__); ++dim__) { \
|
|
153
|
+
size_t a_size__ = (a__).size(dim__); \
|
|
154
|
+
size_t b_size__ = (b__).size(dim__); \
|
|
155
|
+
ET_CHECK_MSG(a_size__ == b_size__, \
|
|
156
|
+
ET_TENSOR_CHECK_PREFIX__ " at size(%zu): {%zu, %zu}", \
|
|
157
|
+
dim__, a_size__, b_size__); \
|
|
158
|
+
} \
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
#define ET_CHECK_SAME_SHAPE_AND_DTYPE3(a__, b__, c__) \
|
|
162
|
+
({ \
|
|
163
|
+
const size_t a_numel__ = (a__).numel(); \
|
|
164
|
+
const size_t b_numel__ = (b__).numel(); \
|
|
165
|
+
const size_t c_numel__ = (c__).numel(); \
|
|
166
|
+
const size_t a_dim__ = (a__).dim(); \
|
|
167
|
+
const size_t b_dim__ = (b__).dim(); \
|
|
168
|
+
const size_t c_dim__ = (c__).dim(); \
|
|
169
|
+
const ::executorch::aten::ScalarType a_type__ = (a__).scalar_type(); \
|
|
170
|
+
const ::executorch::aten::ScalarType b_type__ = (b__).scalar_type(); \
|
|
171
|
+
const ::executorch::aten::ScalarType c_type__ = (c__).scalar_type(); \
|
|
172
|
+
\
|
|
173
|
+
ET_CHECK_MSG(a_numel__ == b_numel__ && b_numel__ == c_numel__ && \
|
|
174
|
+
((a_numel__ == 1 && b_numel__ == 1 && c_numel__ == 1) || \
|
|
175
|
+
(a_dim__ == b_dim__ && b_dim__ == c_dim__)) && \
|
|
176
|
+
a_type__ == b_type__ && b_type__ == c_type__, \
|
|
177
|
+
ET_TENSOR_CHECK_PREFIX__ \
|
|
178
|
+
": numel={%zu, %zu, %zu}, dim={%zu, %zu, %zu}, " \
|
|
179
|
+
"dtype={%" PRId8 ", %" PRId8 ", %" PRId8 "}", \
|
|
180
|
+
a_numel__, b_numel__, c_numel__, a_dim__, b_dim__, c_dim__, \
|
|
181
|
+
static_cast<int8_t>(a_type__), static_cast<int8_t>(b_type__), \
|
|
182
|
+
static_cast<int8_t>(c_type__)); \
|
|
183
|
+
for (size_t dim__ = 0; dim__ < ET_MIN3(a_dim__, b_dim__, c_dim__); \
|
|
184
|
+
++dim__) { \
|
|
185
|
+
size_t a_size__ = (a__).size(dim__); \
|
|
186
|
+
size_t b_size__ = (b__).size(dim__); \
|
|
187
|
+
size_t c_size__ = (c__).size(dim__); \
|
|
188
|
+
ET_CHECK_MSG(a_size__ == b_size__ && b_size__ == c_size__, \
|
|
189
|
+
ET_TENSOR_CHECK_PREFIX__ " at size(%zu): {%zu, %zu, %zu}", \
|
|
190
|
+
dim__, a_size__, b_size__, c_size__); \
|
|
191
|
+
} \
|
|
192
|
+
})
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Assert that the input tensor is contiguous tensor.
|
|
196
|
+
*/
|
|
197
|
+
#define ET_CHECK_CONTIGUOUS(a__) \
|
|
198
|
+
({ \
|
|
199
|
+
const ::executorch::aten::ArrayRef<executorch::aten::StridesType> \
|
|
200
|
+
strides = a__.strides(); \
|
|
201
|
+
const ::executorch::aten::ArrayRef<executorch::aten::StridesType> sizes = \
|
|
202
|
+
a__.sizes(); \
|
|
203
|
+
ET_CHECK_MSG( \
|
|
204
|
+
strides[strides.size() - 1] == 1, \
|
|
205
|
+
"The stride of the last dimension shall be 1 for contiguous tensor, " \
|
|
206
|
+
"not %d", \
|
|
207
|
+
strides[strides.size() - 1]); \
|
|
208
|
+
for (size_t i = strides.size() - 1; i > 0; i--) { \
|
|
209
|
+
ET_CHECK_MSG(strides[i - 1] == strides[i] * sizes[i], \
|
|
210
|
+
"The stride of the %zu-th dimension shall equal to " \
|
|
211
|
+
"strides[%zu] * sizes[%zu], now is %d and %d", \
|
|
212
|
+
i - 1, i, i, strides[i - 1], strides[i] * sizes[i]); \
|
|
213
|
+
} \
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Assert the input two tensors share same strides.
|
|
218
|
+
* Noted that this function does not make any check or promise on the contiguity
|
|
219
|
+
* of any input tensors.
|
|
220
|
+
*/
|
|
221
|
+
#define ET_CHECK_SAME_STRIDES2(a__, b__) \
|
|
222
|
+
({ \
|
|
223
|
+
ET_CHECK_MSG( \
|
|
224
|
+
a__.dim() == b__.dim(), \
|
|
225
|
+
"Two tensors shall have same number of strides, but not %zu and %zu.", \
|
|
226
|
+
a__.dim(), b__.dim()); \
|
|
227
|
+
const ::executorch::aten::ArrayRef<executorch::aten::StridesType> \
|
|
228
|
+
a_strides = a__.strides(); \
|
|
229
|
+
const ::executorch::aten::ArrayRef<executorch::aten::StridesType> \
|
|
230
|
+
b_strides = b__.strides(); \
|
|
231
|
+
for (size_t i = 0; i < a__.dim(); i++) { \
|
|
232
|
+
ET_CHECK_MSG(a_strides[i] == b_strides[i], \
|
|
233
|
+
"a.strides()[%zu] shall equal to b.strides()[%zu], " \
|
|
234
|
+
"but now is %d and %d.", \
|
|
235
|
+
i, i, (int32_t)a_strides[i], (int32_t)b_strides[i]); \
|
|
236
|
+
} \
|
|
237
|
+
})
|
|
238
|
+
|
|
239
|
+
/**
|
|
240
|
+
* Assert the input three tensors share same strides.
|
|
241
|
+
* Noted that this function does not make any check or promise on the contiguity
|
|
242
|
+
* of any input tensors.
|
|
243
|
+
*/
|
|
244
|
+
#define ET_CHECK_SAME_STRIDES3(a__, b__, c__) \
|
|
245
|
+
({ \
|
|
246
|
+
ET_CHECK_MSG(a__.dim() == b__.dim() && b__.dim() == c__.dim(), \
|
|
247
|
+
"Three tensors shall have same number of strides, " \
|
|
248
|
+
"but not %zu, %zu and %zu.", \
|
|
249
|
+
a__.dim(), b__.dim(), c__.dim()); \
|
|
250
|
+
const ::executorch::aten::ArrayRef<executorch::aten::StridesType> \
|
|
251
|
+
a_strides = a__.strides(); \
|
|
252
|
+
const ::executorch::aten::ArrayRef<executorch::aten::StridesType> \
|
|
253
|
+
b_strides = b__.strides(); \
|
|
254
|
+
const ::executorch::aten::ArrayRef<executorch::aten::StridesType> \
|
|
255
|
+
c_strides = c__.strides(); \
|
|
256
|
+
for (size_t i = 0; i < a__.dim(); i++) { \
|
|
257
|
+
ET_CHECK_MSG(a_strides[i] == b_strides[i] && \
|
|
258
|
+
b_strides[i] == c_strides[i], \
|
|
259
|
+
"a_strides[%zu], b_strides[%zu] and c_strides[%zu] " \
|
|
260
|
+
"shall share same value, but now is %d, %d and %d", \
|
|
261
|
+
i, i, i, (int32_t)a_strides[i], (int32_t)b_strides[i], \
|
|
262
|
+
(int32_t)c_strides[i]); \
|
|
263
|
+
} \
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
#define ET_CHECK_DEFAULT_OR_CHANNELSLAST_DIMORDER(t__) \
|
|
267
|
+
({ \
|
|
268
|
+
ET_CHECK_MSG(is_contiguous_dim_order(t__.dim_order().data(), \
|
|
269
|
+
t__.dim_order().size()) || \
|
|
270
|
+
is_channels_last_dim_order(t__.dim_order().data(), \
|
|
271
|
+
t__.dim_order().size()), \
|
|
272
|
+
"Tensor must have default or channels last dim order"); \
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* DEPRECATED: Please use ET_CHECK_OR_RETURN_FALSE instead and provide
|
|
277
|
+
* an informative message. (For example, the values of any variables used in
|
|
278
|
+
* `cond` would not be reported automatically by this macro.)
|
|
279
|
+
*
|
|
280
|
+
* A convenience macro to be used in utility functions that check whether input
|
|
281
|
+
* tensor(s) are valid, which are expected to return a boolean. Checks whether
|
|
282
|
+
* `cond` is true; if not, log the failed check and return false.
|
|
283
|
+
*
|
|
284
|
+
* @param[in] cond the condition to check
|
|
285
|
+
*/
|
|
286
|
+
#define ET_LOG_AND_RETURN_IF_FALSE(cond) ET_CHECK_OR_RETURN_FALSE(cond, "")
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* DEPRECATED: Please use ET_CHECK_OR_RETURN_FALSE instead.
|
|
290
|
+
*/
|
|
291
|
+
#define ET_LOG_MSG_AND_RETURN_IF_FALSE ET_CHECK_OR_RETURN_FALSE
|
|
292
|
+
|
|
293
|
+
/**
|
|
294
|
+
* If `cond` is false, log `cond` and return from the kernel with a failure
|
|
295
|
+
* state set.
|
|
296
|
+
*
|
|
297
|
+
* @param[in] context the runtime context
|
|
298
|
+
* @param[in] cond the condition to check
|
|
299
|
+
* @param[in] error torch::executor::Error enum value (e.g `InvalidArgument`)
|
|
300
|
+
* @param[in] retval return value of the kernel to allow for early exit
|
|
301
|
+
*/
|
|
302
|
+
#define ET_KERNEL_CHECK(context, cond, error, retval) \
|
|
303
|
+
do { \
|
|
304
|
+
if (!(cond)) { \
|
|
305
|
+
ET_LOG(Error, "Check failed (%s): ", #cond); \
|
|
306
|
+
context.fail(torch::executor::Error::error); \
|
|
307
|
+
return retval; \
|
|
308
|
+
} \
|
|
309
|
+
} while (false)
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* If `cond` is false, log `message` and return from the kernel with a failure
|
|
313
|
+
* state set.
|
|
314
|
+
*
|
|
315
|
+
* @param[in] context the runtime context
|
|
316
|
+
* @param[in] cond the condition to check
|
|
317
|
+
* @param[in] error torch::executor::Error enum value (e.g `InvalidArgument`)
|
|
318
|
+
* @param[in] retval return value of the kernel to allow for early exit
|
|
319
|
+
*/
|
|
320
|
+
#define ET_KERNEL_CHECK_MSG(context, cond, error, retval, message, ...) \
|
|
321
|
+
do { \
|
|
322
|
+
if (!(cond)) { \
|
|
323
|
+
ET_LOG(Error, "Check failed (%s): " message, #cond, ##__VA_ARGS__); \
|
|
324
|
+
context.fail(torch::executor::Error::error); \
|
|
325
|
+
return retval; \
|
|
326
|
+
} \
|
|
327
|
+
} while (false)
|
|
328
|
+
|
|
329
|
+
/**
|
|
330
|
+
* Convenience macro to extract a scalar tensor into a value
|
|
331
|
+
*/
|
|
332
|
+
#define ET_EXTRACT_SCALAR_TENSOR(scalar_tensor, out_val) \
|
|
333
|
+
ET_CHECK_MSG(extract_scalar_tensor(scalar_tensor, &out_val), #scalar_tensor \
|
|
334
|
+
" could not be extracted: wrong type or out of range");
|
|
335
|
+
|
|
336
|
+
namespace executorch {
|
|
337
|
+
namespace runtime {
|
|
338
|
+
|
|
339
|
+
//
|
|
340
|
+
// Utility functions for checking tensor attributes
|
|
341
|
+
//
|
|
342
|
+
//
|
|
343
|
+
|
|
344
|
+
/*
|
|
345
|
+
* Returns true if the given dimension value is between -upper_bound and
|
|
346
|
+
* upper_bound - 1, inclusive.
|
|
347
|
+
*/
|
|
348
|
+
inline bool dim_is_valid(int64_t dim, int64_t upper_bound) {
|
|
349
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
350
|
+
dim >= -upper_bound && dim < upper_bound,
|
|
351
|
+
"Dimension %" PRId64
|
|
352
|
+
" is out of range. Dimension should be between %" PRId64 " and %" PRId64
|
|
353
|
+
", inclusive.",
|
|
354
|
+
dim, -upper_bound, upper_bound - 1);
|
|
355
|
+
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/*
|
|
360
|
+
* Returns the tensor's number of dimensions, except when the tensor is zero
|
|
361
|
+
* dimensional. In this case, it returns 1. This is used to properly handle
|
|
362
|
+
* the zero dimensional tensors in some kernels, that treat them as 1D tensors
|
|
363
|
+
* with a single element.
|
|
364
|
+
*/
|
|
365
|
+
inline ssize_t nonzero_dim(const executorch::aten::Tensor &tensor) {
|
|
366
|
+
return tensor.dim() == 0 ? 1 : tensor.dim();
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
/*
|
|
370
|
+
* Returns the size along a dimension dim, except when the tensor is zero
|
|
371
|
+
* dimensional. In this case, it returns 1. This is used to properly handle
|
|
372
|
+
* the zero dimensional tensors in some kernels, that treat them as 1D tensors
|
|
373
|
+
* with a single element.
|
|
374
|
+
*/
|
|
375
|
+
inline ssize_t nonempty_size(const executorch::aten::Tensor &tensor,
|
|
376
|
+
ssize_t dim) {
|
|
377
|
+
return tensor.dim() == 0 ? 1 : tensor.size(dim);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
inline bool tensor_can_cast_to(executorch::aten::Tensor a,
|
|
381
|
+
executorch::aten::ScalarType dtype) {
|
|
382
|
+
ET_CHECK_OR_RETURN_FALSE(torch::executor::canCast(a.scalar_type(), dtype),
|
|
383
|
+
"Tensor of dtype %s cannot cast to dtype %s",
|
|
384
|
+
torch::executor::toString(a.scalar_type()),
|
|
385
|
+
torch::executor::toString(dtype));
|
|
386
|
+
|
|
387
|
+
return true;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
inline bool tensor_is_bool_type(executorch::aten::Tensor t) {
|
|
391
|
+
ET_CHECK_OR_RETURN_FALSE(t.scalar_type() ==
|
|
392
|
+
executorch::aten::ScalarType::Bool,
|
|
393
|
+
"Expected to find bool type, but tensor has type %s",
|
|
394
|
+
torch::executor::toString(t.scalar_type()));
|
|
395
|
+
|
|
396
|
+
return true;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
inline bool tensor_is_type(executorch::aten::Tensor t,
|
|
400
|
+
executorch::aten::ScalarType dtype) {
|
|
401
|
+
ET_CHECK_OR_RETURN_FALSE(t.scalar_type() == dtype,
|
|
402
|
+
"Expected to find %s type, but tensor has type %s",
|
|
403
|
+
torch::executor::toString(dtype),
|
|
404
|
+
torch::executor::toString(t.scalar_type()));
|
|
405
|
+
|
|
406
|
+
return true;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
inline bool tensor_is_type(executorch::aten::Tensor t,
|
|
410
|
+
executorch::aten::ScalarType dtype,
|
|
411
|
+
executorch::aten::ScalarType dtype2) {
|
|
412
|
+
ET_LOG_MSG_AND_RETURN_IF_FALSE(
|
|
413
|
+
t.scalar_type() == dtype || t.scalar_type() == dtype2,
|
|
414
|
+
"Expected to find %s or %s type, but tensor has type %s",
|
|
415
|
+
torch::executor::toString(dtype), torch::executor::toString(dtype2),
|
|
416
|
+
torch::executor::toString(t.scalar_type()));
|
|
417
|
+
|
|
418
|
+
return true;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
inline bool tensor_is_type(executorch::aten::Tensor t,
|
|
422
|
+
executorch::aten::ScalarType dtype,
|
|
423
|
+
executorch::aten::ScalarType dtype2,
|
|
424
|
+
executorch::aten::ScalarType dtype3) {
|
|
425
|
+
ET_LOG_MSG_AND_RETURN_IF_FALSE(
|
|
426
|
+
t.scalar_type() == dtype || t.scalar_type() == dtype2 ||
|
|
427
|
+
t.scalar_type() == dtype3,
|
|
428
|
+
"Expected to find %s, %s, or %s type, but tensor has type %s",
|
|
429
|
+
torch::executor::toString(dtype), torch::executor::toString(dtype2),
|
|
430
|
+
torch::executor::toString(dtype3),
|
|
431
|
+
torch::executor::toString(t.scalar_type()));
|
|
432
|
+
|
|
433
|
+
return true;
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
inline bool tensor_is_integral_type(executorch::aten::Tensor t,
|
|
437
|
+
bool includeBool = false) {
|
|
438
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
439
|
+
torch::executor::isIntegralType(t.scalar_type(), includeBool),
|
|
440
|
+
"Expected to find a integral type, but tensor has type %s",
|
|
441
|
+
torch::executor::toString(t.scalar_type()));
|
|
442
|
+
|
|
443
|
+
return true;
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
inline bool tensor_is_floating_type(executorch::aten::Tensor t) {
|
|
447
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
448
|
+
torch::executor::isFloatingType(t.scalar_type()),
|
|
449
|
+
"Expected to find a floating type, but tensor has type %s",
|
|
450
|
+
torch::executor::toString(t.scalar_type()));
|
|
451
|
+
|
|
452
|
+
return true;
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
inline bool tensor_is_real_type(executorch::aten::Tensor t) {
|
|
456
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
457
|
+
torch::executor::isRealType(t.scalar_type()),
|
|
458
|
+
"Expected to find a real type, but tensor has type %s",
|
|
459
|
+
torch::executor::toString(t.scalar_type()));
|
|
460
|
+
|
|
461
|
+
return true;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
inline bool tensor_is_realh_type(executorch::aten::Tensor t) {
|
|
465
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
466
|
+
torch::executor::isRealHType(t.scalar_type()),
|
|
467
|
+
"Expected to find a real type, but tensor has type %s",
|
|
468
|
+
torch::executor::toString(t.scalar_type()));
|
|
469
|
+
|
|
470
|
+
return true;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
inline bool tensor_is_realhbf16_type(executorch::aten::Tensor t) {
|
|
474
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
475
|
+
executorch::runtime::isRealHBF16Type(t.scalar_type()),
|
|
476
|
+
"Expected to find a real type, but tensor has type %s",
|
|
477
|
+
torch::executor::toString(t.scalar_type()));
|
|
478
|
+
|
|
479
|
+
return true;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
inline bool tensor_is_realhb_type(executorch::aten::Tensor t) {
|
|
483
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
484
|
+
torch::executor::isRealHBType(t.scalar_type()),
|
|
485
|
+
"Expected to find a real type, but tensor has type %s",
|
|
486
|
+
torch::executor::toString(t.scalar_type()));
|
|
487
|
+
|
|
488
|
+
return true;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
inline bool tensor_is_realhbbf16_type(executorch::aten::Tensor t) {
|
|
492
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
493
|
+
executorch::runtime::isRealHBBF16Type(t.scalar_type()),
|
|
494
|
+
"Expected to find a real type, but tensor has type %s",
|
|
495
|
+
torch::executor::toString(t.scalar_type()));
|
|
496
|
+
|
|
497
|
+
return true;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
inline bool tensor_is_complex_type(executorch::aten::Tensor t) {
|
|
501
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
502
|
+
torch::executor::isComplexType(t.scalar_type()),
|
|
503
|
+
"Expected to find a complex type, but tensor has type %s",
|
|
504
|
+
torch::executor::toString(t.scalar_type()));
|
|
505
|
+
|
|
506
|
+
return true;
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
inline bool tensor_is_bits_type(executorch::aten::Tensor t) {
|
|
510
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
511
|
+
torch::executor::isBitsType(t.scalar_type()),
|
|
512
|
+
"Expected to find a bits type, but tensor has type %s",
|
|
513
|
+
torch::executor::toString(t.scalar_type()));
|
|
514
|
+
|
|
515
|
+
return true;
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
inline bool tensors_have_same_dtype(executorch::aten::Tensor a,
|
|
519
|
+
executorch::aten::Tensor b) {
|
|
520
|
+
ET_CHECK_OR_RETURN_FALSE(a.scalar_type() == b.scalar_type(),
|
|
521
|
+
ET_TENSOR_CHECK_PREFIX__ ": dtype={%s, %s}",
|
|
522
|
+
torch::executor::toString(a.scalar_type()),
|
|
523
|
+
torch::executor::toString(b.scalar_type()));
|
|
524
|
+
return true;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
inline bool tensors_have_same_dtype(executorch::aten::Tensor a,
|
|
528
|
+
executorch::aten::Tensor b,
|
|
529
|
+
executorch::aten::Tensor c) {
|
|
530
|
+
ET_CHECK_OR_RETURN_FALSE(a.scalar_type() == b.scalar_type() &&
|
|
531
|
+
b.scalar_type() == c.scalar_type(),
|
|
532
|
+
ET_TENSOR_CHECK_PREFIX__ ": dtype={%s, %s, %s}",
|
|
533
|
+
torch::executor::toString(a.scalar_type()),
|
|
534
|
+
torch::executor::toString(b.scalar_type()),
|
|
535
|
+
torch::executor::toString(c.scalar_type()));
|
|
536
|
+
return true;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
inline bool tensor_is_rank(executorch::aten::Tensor t, size_t rank) {
|
|
540
|
+
ET_CHECK_OR_RETURN_FALSE(static_cast<size_t>(t.dim()) == rank,
|
|
541
|
+
"Expected tensor.dim() to be %zu, but got %zu",
|
|
542
|
+
static_cast<size_t>(rank),
|
|
543
|
+
static_cast<size_t>(t.dim()));
|
|
544
|
+
|
|
545
|
+
return true;
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
inline bool tensor_has_rank_greater_or_equal_to(executorch::aten::Tensor t,
|
|
549
|
+
size_t rank) {
|
|
550
|
+
ET_CHECK_OR_RETURN_FALSE(static_cast<size_t>(t.dim()) >= rank,
|
|
551
|
+
"Expected tensor.dim() to be >= %zu, but got %zu",
|
|
552
|
+
static_cast<size_t>(rank),
|
|
553
|
+
static_cast<size_t>(t.dim()));
|
|
554
|
+
|
|
555
|
+
return true;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
inline bool tensor_has_rank_smaller_or_equal_to(executorch::aten::Tensor t,
|
|
559
|
+
size_t rank) {
|
|
560
|
+
ET_CHECK_OR_RETURN_FALSE(static_cast<size_t>(t.dim()) <= rank,
|
|
561
|
+
"Expected tensor.dim() to be <= %zu, but got %zu",
|
|
562
|
+
static_cast<size_t>(rank),
|
|
563
|
+
static_cast<size_t>(t.dim()));
|
|
564
|
+
|
|
565
|
+
return true;
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
inline bool tensor_has_dim(executorch::aten::Tensor t, int64_t d) {
|
|
569
|
+
if (t.dim() == 0) {
|
|
570
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
571
|
+
d == 0 || d == -1, "dim must be 0 or -1 for 0-dim tensor, got %" PRId64,
|
|
572
|
+
d);
|
|
573
|
+
} else {
|
|
574
|
+
ET_CHECK_OR_RETURN_FALSE(d > 0 ? d < t.dim() : t.dim() + d >= 0,
|
|
575
|
+
"%zu-dim tensor does not have dim at index %zu",
|
|
576
|
+
static_cast<size_t>(t.dim()),
|
|
577
|
+
static_cast<size_t>(d));
|
|
578
|
+
}
|
|
579
|
+
return true;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
inline bool tensor_has_non_empty_dim(executorch::aten::Tensor t, int64_t d) {
|
|
583
|
+
const size_t udim = ET_NORMALIZE_IX(d, t.dim());
|
|
584
|
+
ET_LOG_AND_RETURN_IF_FALSE(tensor_has_dim(t, d));
|
|
585
|
+
ET_LOG_AND_RETURN_IF_FALSE(t.size(udim) != 0);
|
|
586
|
+
return true;
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
inline bool tensor_dim_has_index(executorch::aten::Tensor t, int64_t d,
|
|
590
|
+
int64_t ix) {
|
|
591
|
+
// Indexing ops don't support zero-dim tensors
|
|
592
|
+
ET_CHECK(t.dim() != 0);
|
|
593
|
+
if (d < 0) {
|
|
594
|
+
d += t.dim();
|
|
595
|
+
}
|
|
596
|
+
// Dimension must have been already checked by tensor_has_dim
|
|
597
|
+
ET_CHECK(d >= 0 && d < t.dim());
|
|
598
|
+
|
|
599
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
600
|
+
ix >= -t.size(d) && ix < t.size(d),
|
|
601
|
+
"index %" PRId64 " out of range [-%zu,%zu) at dimension %" PRId64 ")", ix,
|
|
602
|
+
static_cast<size_t>(t.size(d)), static_cast<size_t>(t.size(d)), d);
|
|
603
|
+
return true;
|
|
604
|
+
}
|
|
605
|
+
|
|
606
|
+
inline bool tensors_have_same_size_at_dims(executorch::aten::Tensor a,
|
|
607
|
+
size_t dim_a,
|
|
608
|
+
executorch::aten::Tensor b,
|
|
609
|
+
size_t dim_b) {
|
|
610
|
+
ET_CHECK_OR_RETURN_FALSE(dim_a < static_cast<size_t>(a.dim()),
|
|
611
|
+
"Cannot retrieve dim %zu from tensor with dim %zu",
|
|
612
|
+
static_cast<size_t>(dim_a),
|
|
613
|
+
static_cast<size_t>(a.dim()));
|
|
614
|
+
ET_CHECK_OR_RETURN_FALSE(dim_b < static_cast<size_t>(b.dim()),
|
|
615
|
+
"Cannot retrieve dim %zu from tensor with dim %zu",
|
|
616
|
+
static_cast<size_t>(dim_b),
|
|
617
|
+
static_cast<size_t>(b.dim()));
|
|
618
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
619
|
+
a.size(dim_a) == b.size(dim_b),
|
|
620
|
+
ET_TENSOR_CHECK_PREFIX__
|
|
621
|
+
": a.size(%zu) = %zu does not match b.size(%zu) = %zu",
|
|
622
|
+
static_cast<size_t>(dim_a), static_cast<size_t>(a.size(dim_a)),
|
|
623
|
+
static_cast<size_t>(dim_b), static_cast<size_t>(b.size(dim_b)));
|
|
624
|
+
|
|
625
|
+
return true;
|
|
626
|
+
}
|
|
627
|
+
|
|
628
|
+
inline bool tensors_have_same_shape(executorch::aten::Tensor a,
|
|
629
|
+
executorch::aten::Tensor b) {
|
|
630
|
+
if (a.numel() == 1 && b.numel() == 1) {
|
|
631
|
+
// PyTorch operators treat all scalar tensors as the same shape even if
|
|
632
|
+
// they have different dims.
|
|
633
|
+
return true;
|
|
634
|
+
}
|
|
635
|
+
if (!(a.sizes() == b.sizes() && a.numel() == b.numel())) {
|
|
636
|
+
ET_LOG(Error,
|
|
637
|
+
ET_TENSOR_CHECK_PREFIX__ ": numel=(%zu, %zu), dim=(%zu, %zu)",
|
|
638
|
+
static_cast<size_t>(a.numel()), static_cast<size_t>(b.numel()),
|
|
639
|
+
static_cast<size_t>(a.dim()), static_cast<size_t>(b.dim()));
|
|
640
|
+
// Using [[maybe_unused]] as ET_LOG may not trigger based on verbosity
|
|
641
|
+
for ([[maybe_unused]] const auto d :
|
|
642
|
+
c10::irange(ET_MIN2(a.dim(), b.dim()))) {
|
|
643
|
+
ET_LOG(Error, " size(%zu): (%zu, %zu)", static_cast<size_t>(d),
|
|
644
|
+
static_cast<size_t>(a.size(d)), static_cast<size_t>(b.size(d)));
|
|
645
|
+
}
|
|
646
|
+
|
|
647
|
+
return false;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
return true;
|
|
651
|
+
}
|
|
652
|
+
|
|
653
|
+
inline bool tensors_have_same_shape(executorch::aten::Tensor a,
|
|
654
|
+
executorch::aten::Tensor b,
|
|
655
|
+
executorch::aten::Tensor c) {
|
|
656
|
+
if (a.numel() == 1 && b.numel() == 1 && c.numel() == 1) {
|
|
657
|
+
// PyTorch operators treat all scalar tensors as the same shape even if
|
|
658
|
+
// they have different dims.
|
|
659
|
+
return true;
|
|
660
|
+
}
|
|
661
|
+
bool cond1 = (a.sizes() == b.sizes()) && (a.numel() == b.numel());
|
|
662
|
+
bool cond2 = (b.sizes() == c.sizes()) && (b.numel() == c.numel());
|
|
663
|
+
|
|
664
|
+
if (!(cond1 && cond2)) {
|
|
665
|
+
ET_LOG(Error,
|
|
666
|
+
ET_TENSOR_CHECK_PREFIX__
|
|
667
|
+
": numel=(%zu, %zu, %zu), dim=(%zu, %zu, %zu)",
|
|
668
|
+
static_cast<size_t>(a.numel()), static_cast<size_t>(b.numel()),
|
|
669
|
+
static_cast<size_t>(c.numel()), static_cast<size_t>(a.dim()),
|
|
670
|
+
static_cast<size_t>(b.dim()), static_cast<size_t>(c.dim()));
|
|
671
|
+
for ([[maybe_unused]] const auto d :
|
|
672
|
+
c10::irange(ET_MIN3(a.dim(), b.dim(), c.dim()))) {
|
|
673
|
+
ET_LOG(Error, " size(%zu): (%zu, %zu, %zu)", static_cast<size_t>(d),
|
|
674
|
+
static_cast<size_t>(a.size(d)), static_cast<size_t>(b.size(d)),
|
|
675
|
+
static_cast<size_t>(c.size(d)));
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
return false;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
return true;
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
inline bool tensors_have_same_shape_and_dtype(executorch::aten::Tensor a,
|
|
685
|
+
executorch::aten::Tensor b) {
|
|
686
|
+
return tensors_have_same_shape(a, b) && tensors_have_same_dtype(a, b);
|
|
687
|
+
}
|
|
688
|
+
|
|
689
|
+
inline bool tensors_have_same_shape_and_dtype(executorch::aten::Tensor a,
|
|
690
|
+
executorch::aten::Tensor b,
|
|
691
|
+
executorch::aten::Tensor c) {
|
|
692
|
+
return tensors_have_same_shape(a, b, c) && tensors_have_same_dtype(a, b, c);
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
inline bool tensor_has_expected_size(
|
|
696
|
+
executorch::aten::Tensor a,
|
|
697
|
+
executorch::aten::ArrayRef<executorch::aten::SizesType> expected_sizes) {
|
|
698
|
+
if (!(a.sizes() == expected_sizes)) {
|
|
699
|
+
ET_LOG(Error, ET_TENSOR_CHECK_PREFIX__ ": dim=(%zu, %zu)",
|
|
700
|
+
static_cast<size_t>(a.dim()),
|
|
701
|
+
static_cast<size_t>(expected_sizes.size()));
|
|
702
|
+
size_t a_dim = static_cast<size_t>(a.dim());
|
|
703
|
+
size_t expected_dim = static_cast<size_t>(expected_sizes.size());
|
|
704
|
+
for ([[maybe_unused]] const auto d :
|
|
705
|
+
c10::irange(ET_MIN2(a_dim, expected_dim))) {
|
|
706
|
+
ET_LOG(Error, " size(%zu): (%zu, %zu)", static_cast<size_t>(d),
|
|
707
|
+
static_cast<size_t>(a.size(d)),
|
|
708
|
+
static_cast<size_t>(expected_sizes[d]));
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
return false;
|
|
712
|
+
}
|
|
713
|
+
return true;
|
|
714
|
+
}
|
|
715
|
+
|
|
716
|
+
inline bool tensors_have_same_strides(executorch::aten::Tensor a,
|
|
717
|
+
executorch::aten::Tensor b) {
|
|
718
|
+
if (a.strides() != b.strides()) {
|
|
719
|
+
ET_LOG(Error, ET_TENSOR_CHECK_PREFIX__ ": dim=(%zu, %zu)",
|
|
720
|
+
static_cast<size_t>(a.dim()), static_cast<size_t>(b.dim()));
|
|
721
|
+
for ([[maybe_unused]] const auto d :
|
|
722
|
+
c10::irange(ET_MIN2(a.dim(), b.dim()))) {
|
|
723
|
+
ET_LOG(Error, " stride(%zu): (%zu, %zu)", static_cast<size_t>(d),
|
|
724
|
+
static_cast<size_t>(a.strides()[d]),
|
|
725
|
+
static_cast<size_t>(b.strides()[d]));
|
|
726
|
+
}
|
|
727
|
+
|
|
728
|
+
return false;
|
|
729
|
+
}
|
|
730
|
+
return true;
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
inline bool tensors_have_same_strides(executorch::aten::Tensor a,
|
|
734
|
+
executorch::aten::Tensor b,
|
|
735
|
+
executorch::aten::Tensor c) {
|
|
736
|
+
if (!(a.strides() == b.strides() && b.strides() == c.strides())) {
|
|
737
|
+
ET_LOG(Error, ET_TENSOR_CHECK_PREFIX__ ": dim=(%zu, %zu, %zu)",
|
|
738
|
+
static_cast<size_t>(a.dim()), static_cast<size_t>(b.dim()),
|
|
739
|
+
static_cast<size_t>(c.dim()));
|
|
740
|
+
for ([[maybe_unused]] const auto d :
|
|
741
|
+
c10::irange(ET_MIN3(a.dim(), b.dim(), c.dim()))) {
|
|
742
|
+
ET_LOG(Error, " stride(%zu): (%zu, %zu, %zu)", static_cast<size_t>(d),
|
|
743
|
+
static_cast<size_t>(a.strides()[d]),
|
|
744
|
+
static_cast<size_t>(b.strides()[d]),
|
|
745
|
+
static_cast<size_t>(c.strides()[d]));
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
return false;
|
|
749
|
+
}
|
|
750
|
+
return true;
|
|
751
|
+
}
|
|
752
|
+
|
|
753
|
+
inline bool tensor_is_contiguous(executorch::aten::Tensor t) {
|
|
754
|
+
const auto strides = t.strides();
|
|
755
|
+
const auto sizes = t.sizes();
|
|
756
|
+
// If tensor is 0-dim (i.e. a scalar tensor) it is contiguous
|
|
757
|
+
if (strides.size() == 0) {
|
|
758
|
+
return true;
|
|
759
|
+
}
|
|
760
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
761
|
+
strides[strides.size() - 1] == 1,
|
|
762
|
+
"Tensor is not contiguous; the stride of the last dimension must be 1, "
|
|
763
|
+
"but got %zu",
|
|
764
|
+
static_cast<size_t>(strides[strides.size() - 1]));
|
|
765
|
+
for (int i = strides.size() - 1; i > 0; --i) {
|
|
766
|
+
ET_CHECK_OR_RETURN_FALSE(
|
|
767
|
+
strides[i - 1] == strides[i] * sizes[i],
|
|
768
|
+
"Tensor is not contiguous; the stride of dim %zu should be equal to "
|
|
769
|
+
"strides[%zu] * sizes[%zu] = %zu, but found %zu",
|
|
770
|
+
static_cast<size_t>(i - 1), static_cast<size_t>(i),
|
|
771
|
+
static_cast<size_t>(i), static_cast<size_t>(strides[i] * sizes[i]),
|
|
772
|
+
static_cast<size_t>(strides[i - 1]));
|
|
773
|
+
}
|
|
774
|
+
return true;
|
|
775
|
+
}
|
|
776
|
+
|
|
777
|
+
inline bool tensors_have_same_rank(executorch::aten::Tensor a,
|
|
778
|
+
executorch::aten::Tensor b) {
|
|
779
|
+
ET_CHECK_OR_RETURN_FALSE(a.dim() == b.dim(),
|
|
780
|
+
ET_TENSOR_CHECK_PREFIX__ ": rank={%zd, %zd}",
|
|
781
|
+
ssize_t(a.dim()), ssize_t(b.dim()));
|
|
782
|
+
return true;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
inline bool tensor_is_scalar(executorch::aten::Tensor t) {
|
|
786
|
+
return t.dim() == 0 && t.numel() == 1;
|
|
787
|
+
}
|
|
788
|
+
|
|
789
|
+
/// Returns the product of dim[0:dim), not including dim.
|
|
790
|
+
inline size_t getLeadingDims(const executorch::aten::Tensor &tensor,
|
|
791
|
+
int64_t dim) {
|
|
792
|
+
ET_CHECK_MSG(dim >= 0 && dim <= tensor.dim(),
|
|
793
|
+
"Ending dimension %" PRId64
|
|
794
|
+
" should be in the range [0, tensor.dim() %zd].",
|
|
795
|
+
dim, ssize_t(tensor.dim()));
|
|
796
|
+
size_t dims = 1;
|
|
797
|
+
for (const auto i : c10::irange(dim)) {
|
|
798
|
+
dims *= static_cast<size_t>(tensor.size(i));
|
|
799
|
+
}
|
|
800
|
+
return dims;
|
|
801
|
+
}
|
|
802
|
+
|
|
803
|
+
/// Returns the product of dim[dim+1:].
|
|
804
|
+
inline size_t getTrailingDims(const executorch::aten::Tensor &tensor,
|
|
805
|
+
int64_t dim) {
|
|
806
|
+
ET_CHECK_MSG(dim >= -1 && dim < tensor.dim(),
|
|
807
|
+
"Starting dimension %" PRId64
|
|
808
|
+
" should be in the range [-1, tensor.dim() -1 %zd).",
|
|
809
|
+
dim, ssize_t(tensor.dim()));
|
|
810
|
+
size_t dims = 1;
|
|
811
|
+
for (size_t i = dim + 1; i < static_cast<size_t>(tensor.dim()); ++i) {
|
|
812
|
+
dims *= static_cast<size_t>(tensor.size(i));
|
|
813
|
+
}
|
|
814
|
+
return dims;
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
/**
|
|
818
|
+
* Given a N-dimensional tensor coordinate, return a linear index that can be
|
|
819
|
+
* used to access the corresponding element in the tensor's data buffer.
|
|
820
|
+
*
|
|
821
|
+
* @param[in] tensor The tensor that will be indexed
|
|
822
|
+
* @param[in] coordinate A n-dimensional array representing the coordinate to
|
|
823
|
+
* index. It is assumed that the array has kTensorDimensionLimit elements.
|
|
824
|
+
* @param[out] index The linear index to element at the specified coordinate
|
|
825
|
+
* in the tensor.
|
|
826
|
+
*/
|
|
827
|
+
inline size_t coordinateToIndex(const executorch::aten::Tensor &tensor,
|
|
828
|
+
const size_t *const coordinate) {
|
|
829
|
+
size_t index = 0;
|
|
830
|
+
for (int d = 0; d < tensor.dim(); ++d) {
|
|
831
|
+
index += coordinate[d] * getTrailingDims(tensor, d);
|
|
832
|
+
}
|
|
833
|
+
return index;
|
|
834
|
+
}
|
|
835
|
+
|
|
836
|
+
/**
|
|
837
|
+
* Produce a memoized array for use with repeated calls to
|
|
838
|
+
* coordinateToIndexWithTrailingDimsMemo, which will be faster than
|
|
839
|
+
* repeated calls to coordinateToIndex.
|
|
840
|
+
*/
|
|
841
|
+
inline void
|
|
842
|
+
memoizeTrailingDims(const executorch::aten::Tensor &tensor,
|
|
843
|
+
size_t trailing_dims_memo[kTensorDimensionLimit]) {
|
|
844
|
+
const auto tensorDim = tensor.dim();
|
|
845
|
+
size_t dims = 1;
|
|
846
|
+
for (int ii = tensorDim - 1; ii >= 0; --ii) {
|
|
847
|
+
trailing_dims_memo[ii] = dims;
|
|
848
|
+
dims *= static_cast<size_t>(tensor.size(ii));
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/**
|
|
853
|
+
* Like coordinateToIndex, but faster for repeated calls with the same
|
|
854
|
+
* tensor. trailing_dims_memo must be produced by a call to
|
|
855
|
+
* memoizeTrailingDims.
|
|
856
|
+
*/
|
|
857
|
+
inline size_t coordinateToIndexWithTrailingDimsMemo(
|
|
858
|
+
const executorch::aten::Tensor &tensor, const size_t *const coordinate,
|
|
859
|
+
const size_t trailing_dims_memo[kTensorDimensionLimit]) {
|
|
860
|
+
size_t index = 0;
|
|
861
|
+
for (int d = 0; d < tensor.dim(); ++d) {
|
|
862
|
+
index += coordinate[d] * trailing_dims_memo[d];
|
|
863
|
+
}
|
|
864
|
+
return index;
|
|
865
|
+
}
|
|
866
|
+
|
|
867
|
+
/**
|
|
868
|
+
* Given the linear index return the N-dimensional tensor coordinate. This is
|
|
869
|
+
* the inverse operation of coordinateToIndex.
|
|
870
|
+
*
|
|
871
|
+
* @param[in] tensor The tensor that will be indexed
|
|
872
|
+
* @param[in] index The linear index to element at the specified coordinate in
|
|
873
|
+
* the tensor.
|
|
874
|
+
* @param[out] coordinate A n-dimensional array representing the coordinate to
|
|
875
|
+
* index. It is assumed that the array has kTensorDimensionLimit elements.
|
|
876
|
+
* @returns void
|
|
877
|
+
*/
|
|
878
|
+
inline void indexToCoordinate(const executorch::aten::Tensor &tensor,
|
|
879
|
+
size_t index, size_t *coordinate) {
|
|
880
|
+
ET_CHECK(index < static_cast<size_t>(tensor.numel()));
|
|
881
|
+
for (auto i = 0; i < tensor.dim(); ++i) {
|
|
882
|
+
auto dim = tensor.dim() - 1 - i;
|
|
883
|
+
size_t dim_size = tensor.size(dim);
|
|
884
|
+
coordinate[dim] = index % dim_size;
|
|
885
|
+
index /= dim_size;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* Extracts an integer value from a scalar Tensor.
|
|
891
|
+
*
|
|
892
|
+
* @param[in] tensor The source of the value to extract.
|
|
893
|
+
* @param[out] out_val The extracted value, on success.
|
|
894
|
+
* @returns `true` if a value was extracted, and sets `*out_val` to that
|
|
895
|
+
* value. `false` if a value could not be extracted: either it was not an
|
|
896
|
+
* integer Scalar Tensor, or the value of that Scalar Tensor could not be
|
|
897
|
+
* represented by INT_T.
|
|
898
|
+
*/
|
|
899
|
+
template <typename INT_T,
|
|
900
|
+
typename std::enable_if<std::is_integral<INT_T>::value &&
|
|
901
|
+
!std::is_same<INT_T, bool>::value,
|
|
902
|
+
bool>::type = true>
|
|
903
|
+
bool extract_scalar_tensor(executorch::aten::Tensor tensor, INT_T *out_val) {
|
|
904
|
+
if (tensor.numel() != 1) {
|
|
905
|
+
return false;
|
|
906
|
+
}
|
|
907
|
+
#define CASE_INT_DTYPE(TENSOR_CTYPE, TENSOR_DTYPE) \
|
|
908
|
+
case executorch::aten::ScalarType::TENSOR_DTYPE: { \
|
|
909
|
+
const TENSOR_CTYPE val = tensor.const_data_ptr<TENSOR_CTYPE>()[0]; \
|
|
910
|
+
if (val < std::numeric_limits<INT_T>::lowest() || \
|
|
911
|
+
val > std::numeric_limits<INT_T>::max()) { \
|
|
912
|
+
return false; \
|
|
913
|
+
} \
|
|
914
|
+
*out_val = static_cast<INT_T>(val); \
|
|
915
|
+
return true; \
|
|
916
|
+
}
|
|
917
|
+
|
|
918
|
+
switch (tensor.scalar_type()) {
|
|
919
|
+
ET_FORALL_INT_TYPES(CASE_INT_DTYPE);
|
|
920
|
+
default:
|
|
921
|
+
return false;
|
|
922
|
+
}
|
|
923
|
+
#undef CASE_INT_DTYPE
|
|
924
|
+
}
|
|
925
|
+
|
|
926
|
+
/**
|
|
927
|
+
* Extracts a floating point value from a scalar Tensor.
|
|
928
|
+
*
|
|
929
|
+
* @param[in] tensor The source of the value to extract.
|
|
930
|
+
* @param[out] out_val The extracted value, on success.
|
|
931
|
+
* @returns `true` if a value was extracted, and sets `*out_val` to that
|
|
932
|
+
* value. `false` if a value could not be extracted: either it was not a
|
|
933
|
+
* floating point Scalar Tensor, or the value of that Scalar Tensor could not
|
|
934
|
+
* be represented by FLOAT_T.
|
|
935
|
+
*/
|
|
936
|
+
template <typename FLOAT_T,
|
|
937
|
+
typename std::enable_if<
|
|
938
|
+
std::is_floating_point_v<FLOAT_T> ||
|
|
939
|
+
std::is_same_v<FLOAT_T, executorch::aten::BFloat16> ||
|
|
940
|
+
std::is_same_v<FLOAT_T, executorch::aten::Half>,
|
|
941
|
+
bool>::type = true>
|
|
942
|
+
bool extract_scalar_tensor(executorch::aten::Tensor tensor, FLOAT_T *out_val) {
|
|
943
|
+
if (tensor.numel() != 1) {
|
|
944
|
+
return false;
|
|
945
|
+
}
|
|
946
|
+
#define CASE_REAL_DTYPE(TENSOR_CTYPE, TENSOR_DTYPE) \
|
|
947
|
+
case executorch::aten::ScalarType::TENSOR_DTYPE: { \
|
|
948
|
+
/* ET_FORALL_REAL_TYPES guarantees TENSOR_CTYPE is a real type. */ \
|
|
949
|
+
double val = \
|
|
950
|
+
static_cast<double>(tensor.const_data_ptr<TENSOR_CTYPE>()[0]); \
|
|
951
|
+
if (std::isfinite(val) && (val < std::numeric_limits<FLOAT_T>::lowest() || \
|
|
952
|
+
val > std::numeric_limits<FLOAT_T>::max())) { \
|
|
953
|
+
return false; \
|
|
954
|
+
} \
|
|
955
|
+
*out_val = static_cast<FLOAT_T>(val); \
|
|
956
|
+
return true; \
|
|
957
|
+
}
|
|
958
|
+
|
|
959
|
+
switch (tensor.scalar_type()) {
|
|
960
|
+
ET_FORALL_REALHBF16_TYPES(CASE_REAL_DTYPE);
|
|
961
|
+
default:
|
|
962
|
+
return false;
|
|
963
|
+
}
|
|
964
|
+
#undef CASE_REAL_DTYPE
|
|
965
|
+
}
|
|
966
|
+
|
|
967
|
+
/**
|
|
968
|
+
* Extracts a boolean value from a Scalar.
|
|
969
|
+
*
|
|
970
|
+
* @param[in] scalar The source of the value to extract.
|
|
971
|
+
* @param[out] out_val The extracted value, on success.
|
|
972
|
+
* @returns `true` if a value was extracted, and sets `*out_val` to that
|
|
973
|
+
* value. `false` if a value could not be extracted, i.e. not a boolean
|
|
974
|
+
*/
|
|
975
|
+
template <typename BOOL_T,
|
|
976
|
+
typename std::enable_if<std::is_same<BOOL_T, bool>::value,
|
|
977
|
+
bool>::type = true>
|
|
978
|
+
bool extract_scalar_tensor(executorch::aten::Tensor tensor, BOOL_T *out_val) {
|
|
979
|
+
if (tensor.scalar_type() != executorch::aten::ScalarType::Bool) {
|
|
980
|
+
return false;
|
|
981
|
+
}
|
|
982
|
+
if (tensor.numel() != 1) {
|
|
983
|
+
return false;
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
bool val = tensor.const_data_ptr<bool>()[0];
|
|
987
|
+
|
|
988
|
+
*out_val = static_cast<BOOL_T>(val);
|
|
989
|
+
|
|
990
|
+
return true;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
/// These APIs should not be used outside of Executor.cpp.
|
|
994
|
+
namespace internal {
|
|
995
|
+
/**
|
|
996
|
+
* Share t_src's data_ptr with t_dst.
|
|
997
|
+
*/
|
|
998
|
+
ET_NODISCARD Error share_tensor_data(const executorch::aten::Tensor &t_dst,
|
|
999
|
+
const executorch::aten::Tensor &t_src);
|
|
1000
|
+
|
|
1001
|
+
/**
|
|
1002
|
+
* Copy t_src's data_ptr to t_dst.
|
|
1003
|
+
*/
|
|
1004
|
+
ET_NODISCARD Error copy_tensor_data(const executorch::aten::Tensor &t_dst,
|
|
1005
|
+
const executorch::aten::Tensor &t_src);
|
|
1006
|
+
|
|
1007
|
+
/**
|
|
1008
|
+
* Set the data_ptr of t to buffer.
|
|
1009
|
+
*/
|
|
1010
|
+
ET_NODISCARD Error set_tensor_data(const executorch::aten::Tensor &t,
|
|
1011
|
+
void *buffer, size_t buffer_size);
|
|
1012
|
+
|
|
1013
|
+
/**
|
|
1014
|
+
* Reset tensor's data_ptr, clear all the storage for at::Tensor.
|
|
1015
|
+
*/
|
|
1016
|
+
void reset_data_ptr(const executorch::aten::Tensor &tensor);
|
|
1017
|
+
|
|
1018
|
+
/**
|
|
1019
|
+
* Resize tensor impl
|
|
1020
|
+
*/
|
|
1021
|
+
ET_NODISCARD Error resize_tensor_impl(
|
|
1022
|
+
executorch::aten::TensorImpl *impl,
|
|
1023
|
+
executorch::aten::ArrayRef<executorch::aten::SizesType> new_sizes);
|
|
1024
|
+
|
|
1025
|
+
} // namespace internal
|
|
1026
|
+
|
|
1027
|
+
/**
|
|
1028
|
+
* Resize a tensor to new_sizes, rank must stay the same. Currently does not
|
|
1029
|
+
* expand the tensor if new size exceeds the current capacity. Currently
|
|
1030
|
+
* fails an ET_CHECK if the tensor cannot be resized.
|
|
1031
|
+
*
|
|
1032
|
+
* WARNING: Placeholder API until discussion around runtime context is
|
|
1033
|
+
* settled, will likely move to be a class method on a TensorResizer object
|
|
1034
|
+
* passed in through runtimeContext.
|
|
1035
|
+
*/
|
|
1036
|
+
ET_NODISCARD inline Error resize_tensor(
|
|
1037
|
+
executorch::aten::Tensor t,
|
|
1038
|
+
executorch::aten::ArrayRef<executorch::aten::SizesType> new_sizes) {
|
|
1039
|
+
return internal::resize_tensor_impl(t.unsafeGetTensorImpl(), new_sizes);
|
|
1040
|
+
}
|
|
1041
|
+
|
|
1042
|
+
/**
|
|
1043
|
+
* Resize a tensor to new_sizes, rank must stay the same. Currently does not
|
|
1044
|
+
* expand the tensor if new size exceeds the current capacity. Currently
|
|
1045
|
+
* fails an ET_CHECK if the tensor cannot be resized.
|
|
1046
|
+
*
|
|
1047
|
+
* WARNING: Placeholder API until discussion around runtime context is
|
|
1048
|
+
* settled, will likely move to be a class method on a TensorResizer object
|
|
1049
|
+
* passed in through runtimeContext.
|
|
1050
|
+
*/
|
|
1051
|
+
template <typename T, typename std::enable_if<
|
|
1052
|
+
!std::is_same<executorch::aten::SizesType, T>::value,
|
|
1053
|
+
int>::type = 0>
|
|
1054
|
+
ET_NODISCARD inline Error
|
|
1055
|
+
resize_tensor(executorch::aten::Tensor t,
|
|
1056
|
+
executorch::aten::ArrayRef<T> new_sizes) {
|
|
1057
|
+
// Need to cast the input array to an array of Tensor::SizesType
|
|
1058
|
+
std::array<executorch::aten::SizesType, kTensorDimensionLimit>
|
|
1059
|
+
new_sizes_casted{};
|
|
1060
|
+
size_t new_sizes_ndim = new_sizes.size();
|
|
1061
|
+
for (size_t i = 0; i < new_sizes_ndim; ++i) {
|
|
1062
|
+
new_sizes_casted[i] =
|
|
1063
|
+
static_cast<executorch::aten::SizesType>(new_sizes[i]);
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
return internal::resize_tensor_impl(
|
|
1067
|
+
t.unsafeGetTensorImpl(), {new_sizes_casted.data(), new_sizes_ndim});
|
|
1068
|
+
}
|
|
1069
|
+
|
|
1070
|
+
/// DEPRECATED: Use `resize_tensor()` instead, which can fail non-fatally.
|
|
1071
|
+
ET_DEPRECATED inline void
|
|
1072
|
+
resize(executorch::aten::Tensor t,
|
|
1073
|
+
executorch::aten::ArrayRef<executorch::aten::SizesType> new_sizes) {
|
|
1074
|
+
Error err = resize_tensor(t, new_sizes);
|
|
1075
|
+
ET_CHECK_MSG(err == Error::Ok,
|
|
1076
|
+
"Could not resize Tensor; see logs for details");
|
|
1077
|
+
}
|
|
1078
|
+
/**
|
|
1079
|
+
* Get dim_order of a Tensor and write it to out_dim_order.
|
|
1080
|
+
* @param tensor The tensor where we want to get dim order from.
|
|
1081
|
+
* @param out_dim_order Pointing to an array of DimOrderType where we write
|
|
1082
|
+
* dim order into it.
|
|
1083
|
+
* @param out_dim_order_size Size of the DimOrderType array.
|
|
1084
|
+
*/
|
|
1085
|
+
ET_NODISCARD Error get_dim_order(const executorch::aten::Tensor &tensor,
|
|
1086
|
+
executorch::aten::DimOrderType *out_dim_order,
|
|
1087
|
+
size_t out_dim_order_size);
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* Checks whether a tensor has a valid dim order. If the dim order could not
|
|
1091
|
+
* be determined, then this function returns false by default.
|
|
1092
|
+
*/
|
|
1093
|
+
bool tensor_has_valid_dim_order(executorch::aten::Tensor t);
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* Checks whether a tensor has either the default of channels last dim order.
|
|
1097
|
+
* If the dim order could not be determined, then this function returns false
|
|
1098
|
+
* by default.
|
|
1099
|
+
*/
|
|
1100
|
+
bool tensor_is_default_or_channels_last_dim_order(executorch::aten::Tensor t);
|
|
1101
|
+
|
|
1102
|
+
/**
|
|
1103
|
+
* Checks whether a tensor has the default dimension order.
|
|
1104
|
+
* Logs an error message if the tensor does not meet the expected criteria.
|
|
1105
|
+
*
|
|
1106
|
+
* @param t The tensor to check the dimension order of.
|
|
1107
|
+
* @return True if the tensor has the default dimension order, false otherwise.
|
|
1108
|
+
*/
|
|
1109
|
+
bool tensor_is_default_dim_order(executorch::aten::Tensor t);
|
|
1110
|
+
|
|
1111
|
+
/**
|
|
1112
|
+
* Checks whether a tensor has the channels last dimension order.
|
|
1113
|
+
* Logs an error message if the tensor does not meet the expected criteria.
|
|
1114
|
+
*
|
|
1115
|
+
* @param t The tensor to check the dimension order of.
|
|
1116
|
+
* @return True if the tensor has the channels last dimension order, false
|
|
1117
|
+
* otherwise.
|
|
1118
|
+
*/
|
|
1119
|
+
bool tensor_is_channels_last_dim_order(executorch::aten::Tensor t);
|
|
1120
|
+
|
|
1121
|
+
/**
|
|
1122
|
+
* Asserts that four tensors have the same dim_order
|
|
1123
|
+
*
|
|
1124
|
+
* Note that this macro only tests dim order, but not others like actual data,
|
|
1125
|
+
* sizes, etc.
|
|
1126
|
+
*
|
|
1127
|
+
*/
|
|
1128
|
+
bool tensors_have_same_dim_order(
|
|
1129
|
+
const executorch::aten::ArrayRef<executorch::aten::Tensor> tensor_list);
|
|
1130
|
+
|
|
1131
|
+
/**
|
|
1132
|
+
* Asserts that two tensors have the same dim_order
|
|
1133
|
+
*
|
|
1134
|
+
* Note that this macro only tests dim order, but not others like actual data,
|
|
1135
|
+
* sizes, etc.
|
|
1136
|
+
*/
|
|
1137
|
+
|
|
1138
|
+
inline bool tensors_have_same_dim_order(const executorch::aten::Tensor &a,
|
|
1139
|
+
const executorch::aten::Tensor &b) {
|
|
1140
|
+
executorch::aten::Tensor tensor_list[2] = {a, b};
|
|
1141
|
+
return tensors_have_same_dim_order(tensor_list);
|
|
1142
|
+
}
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Asserts that three tensors have the same dim_order
|
|
1146
|
+
*
|
|
1147
|
+
* Note that this macro only tests dim order, but not others like actual data,
|
|
1148
|
+
* sizes, etc.
|
|
1149
|
+
*
|
|
1150
|
+
*/
|
|
1151
|
+
|
|
1152
|
+
inline bool tensors_have_same_dim_order(const executorch::aten::Tensor &a,
|
|
1153
|
+
const executorch::aten::Tensor &b,
|
|
1154
|
+
const executorch::aten::Tensor &c) {
|
|
1155
|
+
executorch::aten::Tensor tensor_list[3] = {a, b, c};
|
|
1156
|
+
return tensors_have_same_dim_order(tensor_list);
|
|
1157
|
+
}
|
|
1158
|
+
|
|
1159
|
+
/**
|
|
1160
|
+
* Asserts that four tensors have the same dim_order
|
|
1161
|
+
*
|
|
1162
|
+
* Note that this macro only tests dim order, but not others like actual data,
|
|
1163
|
+
* sizes, etc.
|
|
1164
|
+
*
|
|
1165
|
+
*/
|
|
1166
|
+
|
|
1167
|
+
inline bool tensors_have_same_dim_order(const executorch::aten::Tensor &a,
|
|
1168
|
+
const executorch::aten::Tensor &b,
|
|
1169
|
+
const executorch::aten::Tensor &c,
|
|
1170
|
+
const executorch::aten::Tensor &d) {
|
|
1171
|
+
executorch::aten::Tensor tensor_list[4] = {a, b, c, d};
|
|
1172
|
+
return tensors_have_same_dim_order(tensor_list);
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
/**
|
|
1176
|
+
* Given an n-dimensional coordinate array and an array of tensor strides,
|
|
1177
|
+
* calculates the linear index that can be used to retrieve the value at the
|
|
1178
|
+
* given coordinates.
|
|
1179
|
+
* @param coordinate Pointer to the array of coordinates.
|
|
1180
|
+
* @param strides Pointer to the array of strides.
|
|
1181
|
+
* @param ndim Number of dimensions in the tensor.
|
|
1182
|
+
*/
|
|
1183
|
+
inline size_t
|
|
1184
|
+
calculate_linear_index(const executorch::aten::SizesType *coordinate,
|
|
1185
|
+
const executorch::aten::StridesType *strides,
|
|
1186
|
+
const size_t ndim) {
|
|
1187
|
+
size_t index = 0;
|
|
1188
|
+
for (size_t i = 0; i < ndim; i++) {
|
|
1189
|
+
index += coordinate[i] * strides[i];
|
|
1190
|
+
}
|
|
1191
|
+
return index;
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
} // namespace runtime
|
|
1195
|
+
} // namespace executorch
|
|
1196
|
+
|
|
1197
|
+
namespace torch {
|
|
1198
|
+
namespace executor {
|
|
1199
|
+
// TODO(T197294990): Remove these deprecated aliases once all users have moved
|
|
1200
|
+
// to the new `::executorch` namespaces.
|
|
1201
|
+
using ::executorch::runtime::calculate_linear_index;
|
|
1202
|
+
using ::executorch::runtime::coordinateToIndex;
|
|
1203
|
+
using ::executorch::runtime::dim_is_valid;
|
|
1204
|
+
using ::executorch::runtime::extract_scalar_tensor;
|
|
1205
|
+
using ::executorch::runtime::get_dim_order;
|
|
1206
|
+
using ::executorch::runtime::getLeadingDims;
|
|
1207
|
+
using ::executorch::runtime::getTrailingDims;
|
|
1208
|
+
using ::executorch::runtime::indexToCoordinate;
|
|
1209
|
+
using ::executorch::runtime::kTensorDimensionLimit;
|
|
1210
|
+
using ::executorch::runtime::nonempty_size;
|
|
1211
|
+
using ::executorch::runtime::nonzero_dim;
|
|
1212
|
+
using ::executorch::runtime::resize;
|
|
1213
|
+
using ::executorch::runtime::resize_tensor;
|
|
1214
|
+
using ::executorch::runtime::tensor_can_cast_to;
|
|
1215
|
+
using ::executorch::runtime::tensor_dim_has_index;
|
|
1216
|
+
using ::executorch::runtime::tensor_has_dim;
|
|
1217
|
+
using ::executorch::runtime::tensor_has_expected_size;
|
|
1218
|
+
using ::executorch::runtime::tensor_has_non_empty_dim;
|
|
1219
|
+
using ::executorch::runtime::tensor_has_rank_greater_or_equal_to;
|
|
1220
|
+
using ::executorch::runtime::tensor_has_rank_smaller_or_equal_to;
|
|
1221
|
+
using ::executorch::runtime::tensor_has_valid_dim_order;
|
|
1222
|
+
using ::executorch::runtime::tensor_is_bits_type;
|
|
1223
|
+
using ::executorch::runtime::tensor_is_bool_type;
|
|
1224
|
+
using ::executorch::runtime::tensor_is_complex_type;
|
|
1225
|
+
using ::executorch::runtime::tensor_is_contiguous;
|
|
1226
|
+
using ::executorch::runtime::tensor_is_default_dim_order;
|
|
1227
|
+
using ::executorch::runtime::tensor_is_default_or_channels_last_dim_order;
|
|
1228
|
+
using ::executorch::runtime::tensor_is_floating_type;
|
|
1229
|
+
using ::executorch::runtime::tensor_is_integral_type;
|
|
1230
|
+
using ::executorch::runtime::tensor_is_rank;
|
|
1231
|
+
using ::executorch::runtime::tensor_is_real_type;
|
|
1232
|
+
using ::executorch::runtime::tensor_is_realh_type;
|
|
1233
|
+
using ::executorch::runtime::tensor_is_realhb_type;
|
|
1234
|
+
using ::executorch::runtime::tensor_is_scalar;
|
|
1235
|
+
using ::executorch::runtime::tensors_have_same_dim_order;
|
|
1236
|
+
using ::executorch::runtime::tensors_have_same_dtype;
|
|
1237
|
+
using ::executorch::runtime::tensors_have_same_rank;
|
|
1238
|
+
using ::executorch::runtime::tensors_have_same_shape;
|
|
1239
|
+
using ::executorch::runtime::tensors_have_same_shape_and_dtype;
|
|
1240
|
+
using ::executorch::runtime::tensors_have_same_size_at_dims;
|
|
1241
|
+
using ::executorch::runtime::tensors_have_same_strides;
|
|
1242
|
+
namespace internal {
|
|
1243
|
+
using ::executorch::runtime::internal::copy_tensor_data;
|
|
1244
|
+
using ::executorch::runtime::internal::reset_data_ptr;
|
|
1245
|
+
using ::executorch::runtime::internal::resize_tensor_impl;
|
|
1246
|
+
using ::executorch::runtime::internal::set_tensor_data;
|
|
1247
|
+
using ::executorch::runtime::internal::share_tensor_data;
|
|
1248
|
+
} // namespace internal
|
|
1249
|
+
} // namespace executor
|
|
1250
|
+
} // namespace torch
|