peachsim 0.1.1692 → 0.1.1716

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.
Files changed (991) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +59 -3
  3. package/cli/app-bundle-resources.ts +3 -1
  4. package/cli/app-catalog.ts +10 -0
  5. package/cli/app-fonts.ts +1 -1
  6. package/cli/app-stubs.ts +19 -9
  7. package/cli/bridge-diagnostics.ts +2 -1
  8. package/cli/bridge-flow-runner.ts +61 -39
  9. package/cli/cloud-client.ts +6 -3
  10. package/cli/commands/agent-wrapper.ts +21 -10
  11. package/cli/commands/control.ts +149 -46
  12. package/cli/commands/coverage-swift.ts +19 -1
  13. package/cli/commands/coverage.ts +1 -1
  14. package/cli/commands/detect.ts +85 -25
  15. package/cli/commands/doctor.ts +159 -20
  16. package/cli/commands/flow.ts +4 -1
  17. package/cli/commands/inspect/core.ts +176 -17
  18. package/cli/commands/inspect/settling.ts +17 -5
  19. package/cli/commands/inspect/wait-ready.ts +7 -5
  20. package/cli/commands/inspect.ts +8 -2
  21. package/cli/commands/maestro-compare.ts +25 -99
  22. package/cli/commands/record.ts +263 -32
  23. package/cli/commands/screenshot.ts +2 -13
  24. package/cli/commands/test.ts +49 -101
  25. package/cli/current-sim.ts +4 -4
  26. package/cli/help-core.ts +3 -4
  27. package/cli/hints.ts +1 -6
  28. package/cli/maestro-compare.ts +172 -4
  29. package/cli/main.ts +8 -1
  30. package/cli/metro-bundle-assets.ts +77 -0
  31. package/cli/outbound-endpoints.ts +8 -12
  32. package/cli/run-registry.ts +0 -8
  33. package/cli/scene-video.ts +5 -3
  34. package/cli/ws-bridge.ts +56 -14
  35. package/detox/index.ts +76 -3
  36. package/detox/launch-permissions.ts +325 -0
  37. package/dist-lib/agent-daemon-client.cjs +2 -2
  38. package/dist-lib/agent-events.cjs +2 -2
  39. package/dist-lib/attached-projects.cjs +2 -2
  40. package/dist-lib/auth/shared-session.cjs +2 -2
  41. package/dist-lib/backend-origin.cjs +11 -10
  42. package/dist-lib/beta.cjs +2 -2
  43. package/dist-lib/beta.mjs +1 -1
  44. package/dist-lib/bridge-constants.cjs +6 -2
  45. package/dist-lib/bridge-contract-input.cjs +2 -2
  46. package/dist-lib/bridge-contract-input.mjs +1 -1
  47. package/dist-lib/bridge-contract.cjs +2 -2
  48. package/dist-lib/bridge-contract.mjs +1 -1
  49. package/dist-lib/bundle-channel.cjs +26769 -24228
  50. package/dist-lib/capture-contract.cjs +2 -2
  51. package/dist-lib/capture-contract.mjs +1 -1
  52. package/dist-lib/cloud-contract.cjs +2 -2
  53. package/dist-lib/cloud-contract.mjs +1 -1
  54. package/dist-lib/cloud-test-args.cjs +2 -2
  55. package/dist-lib/cloud-test-args.mjs +1 -1
  56. package/dist-lib/cloud.cjs +3 -2
  57. package/dist-lib/cloud.mjs +2 -1
  58. package/dist-lib/config.cjs +2 -2
  59. package/dist-lib/config.mjs +1 -1
  60. package/dist-lib/detox/index.cjs +256 -14
  61. package/dist-lib/dev-bundle-resolution.cjs +209 -51
  62. package/dist-lib/expo-swift-bundle.cjs +10795 -17575
  63. package/dist-lib/expo-swift-metadata.cjs +2 -2
  64. package/dist-lib/expo-swift-metadata.mjs +1 -1
  65. package/dist-lib/home-paths.cjs +2 -2
  66. package/dist-lib/host/bridge-host.cjs +36893 -31765
  67. package/dist-lib/host/fetch-proxy-handler.cjs +796 -114
  68. package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
  69. package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
  70. package/dist-lib/host/replacement-module-handler.cjs +3 -2
  71. package/dist-lib/host/websocket-proxy.cjs +312 -46
  72. package/dist-lib/index.cjs +2244 -642
  73. package/dist-lib/jump-to-source-babel.cjs +2 -2
  74. package/dist-lib/jump-to-source-native.cjs +2 -2
  75. package/dist-lib/kotlin-host.cjs +2 -2
  76. package/dist-lib/menu.cjs +5 -2
  77. package/dist-lib/menu.mjs +3 -1
  78. package/dist-lib/metro-fingerprint-registry.cjs +2 -2
  79. package/dist-lib/metro-fingerprint-registry.mjs +1 -1
  80. package/dist-lib/metro-production-bundle.cjs +2 -2
  81. package/dist-lib/metro-production-bundle.mjs +1 -1
  82. package/dist-lib/metro.cjs +2088 -612
  83. package/dist-lib/native-app-identity-project.cjs +863 -232
  84. package/dist-lib/native-app-identity-project.mjs +871 -234
  85. package/dist-lib/native-app-identity.cjs +15 -2
  86. package/dist-lib/native-app-identity.mjs +12 -1
  87. package/dist-lib/native-firebase-metadata.cjs +2 -2
  88. package/dist-lib/native-firebase-metadata.mjs +1 -1
  89. package/dist-lib/plist.cjs +2 -2
  90. package/dist-lib/plist.mjs +1 -1
  91. package/dist-lib/profiles.cjs +2 -2
  92. package/dist-lib/public-brand.cjs +2 -2
  93. package/dist-lib/public-origins-lib-esm.json +31 -100
  94. package/dist-lib/public-origins-lib.json +449 -453
  95. package/dist-lib/react-native-host-modules.cjs +98 -4
  96. package/dist-lib/react-native-host-modules.mjs +96 -3
  97. package/dist-lib/reap-browser.cjs +2 -2
  98. package/dist-lib/scripts/dev-server-scanner.cjs +225 -75
  99. package/dist-lib/sdk.cjs +146 -19
  100. package/dist-lib/sdk.mjs +139 -18
  101. package/dist-lib/skills.cjs +53577 -48467
  102. package/dist-lib/swift-compile.cjs +6111 -16733
  103. package/dist-lib/swift-compile.mjs +6052 -16681
  104. package/dist-lib/swift-package.cjs +104 -22
  105. package/dist-lib/swift-package.mjs +99 -21
  106. package/dist-lib/swift-submit.cjs +15 -5
  107. package/dist-lib/swift-submit.mjs +14 -4
  108. package/dist-lib/swift-toolchain.cjs +42 -13
  109. package/dist-lib/swift.cjs +2 -2
  110. package/dist-lib/vite-swift.cjs +13416 -21189
  111. package/dist-lib/vite.cjs +790 -157
  112. package/dist-lib/worklet-executable.cjs +2 -2
  113. package/dist-lib/worklet-executable.mjs +1 -1
  114. package/dist-types/packages/peach-compat/src/stubs/native-seams/react-native-gesture-handler.d.ts +2 -0
  115. package/dist-types/packages/peach-compat/src/stubs/screen-transition-math.d.ts +1 -1
  116. package/dist-types/packages/peach-engine/src/capture/lockstep-clockContract.d.ts +1 -0
  117. package/dist-types/packages/peach-engine/src/engine/fiber-debug-metadata.d.ts +4 -0
  118. package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +2 -2
  119. package/dist-types/packages/peach-engine/src/engine/fontDataContract.d.ts +1 -0
  120. package/dist-types/packages/peach-engine/src/engine/image-loader.d.ts +2 -0
  121. package/dist-types/packages/peach-engine/src/engine/lottie-types.d.ts +3 -0
  122. package/dist-types/packages/peach-engine/src/engine/node.d.ts +6 -3
  123. package/dist-types/packages/peach-engine/src/engine/riveContract.d.ts +5 -0
  124. package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
  125. package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
  126. package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
  127. package/dist-types/packages/peach-engine/src/guest-module-overrides.d.ts +3 -0
  128. package/dist-types/packages/peach-engine/src/ios/chrome-metrics.d.ts +2 -1
  129. package/dist-types/packages/peach-engine/src/permissions/system-permission-types.d.ts +2 -1
  130. package/dist-types/packages/peach-engine/src/react-native/host-services.d.ts +1 -0
  131. package/dist-types/packages/peach-engine/src/react-native/platform-colors.d.ts +1 -0
  132. package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +6 -2
  133. package/dist-types/packages/peach-engine/src/remote-stream/scene-recording.d.ts +4 -0
  134. package/dist-types/packages/peach-engine/src/render-worker/compositor-protocol.d.ts +16 -0
  135. package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +18 -2
  136. package/dist-types/packages/peach-engine/src/render-worker/live-frame-mirror.d.ts +11 -0
  137. package/dist-types/packages/peach-engine/src/render-worker/native-ui-protocol.d.ts +10 -1
  138. package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +11 -0
  139. package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
  140. package/dist-types/packages/peach-engine/src/render-worker/shell-protocol.d.ts +5 -0
  141. package/dist-types/packages/peach-engine/src/render-worker/shell-tree-wire.d.ts +5 -0
  142. package/dist-types/packages/peach-engine/src/render-worker/tree-sync-port.d.ts +5 -0
  143. package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
  144. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime-kind.d.ts +5 -1
  145. package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +9 -4
  146. package/dist-types/packages/peach-engine/src/render-worker/workletThreadIdentityContract.d.ts +4 -0
  147. package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
  148. package/dist-types/packages/peach-globals/src/guestExecutionContract.d.ts +30 -0
  149. package/dist-types/packages/peach-globals/src/index.d.ts +6 -4
  150. package/dist-types/packages/peach-globals/src/nativeBuildOptionsContract.d.ts +1 -0
  151. package/dist-types/packages/peach-globals/src/permissionsBridgeContract.d.ts +11 -0
  152. package/dist-types/packages/peach-globals/src/recordingBridgeContract.d.ts +22 -1
  153. package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
  154. package/dist-types/packages/peach-globals/src/sceneStreamBridgeContract.d.ts +10 -0
  155. package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +9 -0
  156. package/dist-types/packages/peach-globals/src/testBridgeContract.d.ts +3 -0
  157. package/dist-types/packages/peach-kit/src/capabilities.d.ts +1 -0
  158. package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
  159. package/package.json +3 -1
  160. package/runtime-companion.json +1 -1
  161. package/scripts/dev-server-scanner.ts +61 -70
  162. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
  163. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
  164. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
  165. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
  166. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
  167. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
  168. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
  169. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
  170. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
  171. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
  172. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
  173. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
  174. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
  175. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
  176. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
  177. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
  178. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
  179. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
  180. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
  181. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
  182. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
  183. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
  184. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
  185. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
  186. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
  187. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
  188. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
  189. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
  190. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
  191. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
  192. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
  193. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
  194. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
  195. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
  196. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
  197. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
  198. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
  199. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
  200. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
  201. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
  202. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
  203. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
  204. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
  205. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
  206. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
  207. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
  208. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
  209. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
  210. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
  211. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
  212. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
  213. package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
  214. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBATTRequest.h +69 -0
  215. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBAdvertisementData.h +94 -0
  216. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBAttribute.h +34 -0
  217. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCentral.h +41 -0
  218. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCentralManager.h +394 -0
  219. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCentralManagerConstants.h +224 -0
  220. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBCharacteristic.h +187 -0
  221. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBDefines.h +16 -0
  222. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBDescriptor.h +78 -0
  223. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBError.h +75 -0
  224. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBL2CAPChannel.h +50 -0
  225. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBManager.h +88 -0
  226. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeer.h +28 -0
  227. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheral.h +530 -0
  228. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheralManager.h +489 -0
  229. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBPeripheralManagerConstants.h +63 -0
  230. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBService.h +100 -0
  231. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CBUUID.h +144 -0
  232. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CoreBluetooth.apinotes +7 -0
  233. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Headers/CoreBluetooth.h +32 -0
  234. package/sdk/ios/System/Library/Frameworks/CoreBluetooth.framework/Modules/module.modulemap +5 -0
  235. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
  236. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
  237. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
  238. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCGTypes.h +131 -0
  239. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
  240. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
  241. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
  242. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
  243. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
  244. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
  245. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
  246. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
  247. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
  248. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
  249. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
  250. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
  251. package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +13 -223
  252. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGBase.h +359 -2
  253. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CGGeometry.h +328 -0
  254. package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +3 -66
  255. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/CoreNFC.apinotes +258 -0
  256. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/CoreNFC.h +31 -0
  257. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCError.h +103 -0
  258. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCFeliCaTag.h +267 -0
  259. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCISO15693ReaderSession.h +59 -0
  260. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCISO15693Tag.h +739 -0
  261. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCISO7816Tag.h +159 -0
  262. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCMiFareTag.h +94 -0
  263. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFMessage.h +60 -0
  264. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFPayload.h +121 -0
  265. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFReaderSession.h +169 -0
  266. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCNDEFTag.h +93 -0
  267. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCPaymentTagReaderSession.h +58 -0
  268. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCReaderSession.h +156 -0
  269. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCTag.h +127 -0
  270. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCTagReaderSession.h +201 -0
  271. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NFCVASReaderSession.h +237 -0
  272. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Headers/NSUserActivity+CoreNFC.h +35 -0
  273. package/sdk/ios/System/Library/Frameworks/CoreNFC.framework/Modules/module.modulemap +21 -0
  274. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCall.h +53 -0
  275. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCallCenter.h +45 -0
  276. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCarrier.h +87 -0
  277. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularData.h +39 -0
  278. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularPlanProperties.h +46 -0
  279. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularPlanProvisioning.h +33 -0
  280. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularPlanProvisioningRequest.h +36 -0
  281. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTCellularPlanStatus.h +57 -0
  282. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTQuickSwitch.h +53 -0
  283. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriber.h +107 -0
  284. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTSubscriberInfo.h +34 -0
  285. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CTTelephonyNetworkInfo.h +161 -0
  286. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Headers/CoreTelephonyDefines.h +39 -0
  287. package/sdk/ios/System/Library/Frameworks/CoreTelephony.framework/Modules/module.modulemap +5 -0
  288. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTDefines.h +92 -0
  289. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontDescriptor.h +634 -0
  290. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CTFontTraits.h +118 -0
  291. package/sdk/ios/System/Library/Frameworks/CoreText.framework/Headers/CoreText.h +1 -0
  292. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.apinotes +2497 -0
  293. package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +2900 -370
  294. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKAccessPoint.h +110 -0
  295. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKAchievement.h +64 -0
  296. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKAchievementDescription.h +88 -0
  297. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKAchievementViewController.h +30 -0
  298. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKBasePlayer.h +15 -0
  299. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKChallenge.h +199 -0
  300. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKChallengeDefinition.h +71 -0
  301. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKChallengeEventHandler.h +43 -0
  302. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKChallengesViewController.h +33 -0
  303. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKCloudPlayer.h +19 -0
  304. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKDefines.h +17 -0
  305. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKDialogController.h +35 -0
  306. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKError.h +52 -0
  307. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKEventListener.h +36 -0
  308. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKFriendRequestComposeViewController.h +60 -0
  309. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameActivity.h +201 -0
  310. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameActivityDefinition.h +98 -0
  311. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameActivityListener.h +28 -0
  312. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameActivityPlayStyle.h +17 -0
  313. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameActivityState.h +22 -0
  314. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameCenterViewController.h +102 -0
  315. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameSession.h +87 -0
  316. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameSessionError.h +26 -0
  317. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameSessionEventListener.h +25 -0
  318. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKGameSessionSharingViewController.h +33 -0
  319. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLeaderboard.h +205 -0
  320. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLeaderboardEntry.h +23 -0
  321. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLeaderboardScore.h +25 -0
  322. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLeaderboardSet.h +64 -0
  323. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLeaderboardViewController.h +34 -0
  324. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKLocalPlayer.h +321 -0
  325. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKMatch.h +94 -0
  326. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKMatchmaker.h +229 -0
  327. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKMatchmakerViewController.h +100 -0
  328. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKNotificationBanner.h +20 -0
  329. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKPeerPickerController.h +93 -0
  330. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKPlayer.h +82 -0
  331. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKPublicConstants.h +57 -0
  332. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKPublicProtocols.h +71 -0
  333. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKReleaseState.h +16 -0
  334. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKSavedGame.h +41 -0
  335. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKSavedGameListener.h +22 -0
  336. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKScore.h +73 -0
  337. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKSession.h +87 -0
  338. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKSessionError.h +30 -0
  339. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKTurnBasedMatch.h +314 -0
  340. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKTurnBasedMatchmakerViewController.h +69 -0
  341. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKVoiceChat.h +48 -0
  342. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GKVoiceChatService.h +145 -0
  343. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GameKit.apinotes +307 -0
  344. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Headers/GameKit.h +79 -0
  345. package/sdk/ios/System/Library/Frameworks/GameKit.framework/Modules/module.modulemap +6 -0
  346. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKActivitySummary.h +122 -0
  347. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKActivitySummaryQuery.h +48 -0
  348. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAnchoredObjectQuery.h +93 -0
  349. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAppleSleepingBreathingDisturbancesClassification.h +39 -0
  350. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAppleWalkingSteadinessClassification.h +49 -0
  351. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAttachment.h +74 -0
  352. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAttachmentStore.h +95 -0
  353. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAudiogramSample.h +66 -0
  354. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAudiogramSensitivityPoint.h +82 -0
  355. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAudiogramSensitivityPointClampingRange.h +54 -0
  356. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKAudiogramSensitivityTest.h +101 -0
  357. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCDADocumentSample.h +131 -0
  358. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCategorySample.h +92 -0
  359. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCategoryValues.h +279 -0
  360. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCharacteristicObjects.h +79 -0
  361. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCharacteristicValues.h +87 -0
  362. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKClinicalCoding.h +55 -0
  363. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKClinicalRecord.h +53 -0
  364. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKClinicalType.h +68 -0
  365. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKContactsLensSpecification.h +59 -0
  366. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKContactsPrescription.h +74 -0
  367. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCorrelation.h +85 -0
  368. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCorrelationQuery.h +57 -0
  369. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCumulativeQuantitySample.h +36 -0
  370. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKCumulativeQuantitySeriesSample.h +23 -0
  371. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDefines.h +114 -0
  372. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDeletedObject.h +40 -0
  373. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDevice.h +164 -0
  374. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDiscreteQuantitySample.h +67 -0
  375. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDocumentQuery.h +83 -0
  376. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKDocumentSample.h +29 -0
  377. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKElectrocardiogram.h +109 -0
  378. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKElectrocardiogramQuery.h +68 -0
  379. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKFHIRRelease.h +35 -0
  380. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKFHIRResource.h +81 -0
  381. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKFHIRVersion.h +50 -0
  382. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKGAD7Assessment.h +73 -0
  383. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKGlassesLensSpecification.h +81 -0
  384. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKGlassesPrescription.h +66 -0
  385. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHealthConceptIdentifier.h +46 -0
  386. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHealthStore.h +470 -0
  387. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHeartbeatSeriesBuilder.h +104 -0
  388. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHeartbeatSeriesQuery.h +47 -0
  389. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKHeartbeatSeriesSample.h +26 -0
  390. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKLensSpecification.h +53 -0
  391. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKLiveWorkoutBuilder.h +131 -0
  392. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKLiveWorkoutDataSource.h +67 -0
  393. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKLiveWorkoutZoneUpdate.h +25 -0
  394. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKMedicationConcept.h +95 -0
  395. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKMedicationDoseEvent.h +113 -0
  396. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKMetadata.h +583 -0
  397. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKMetadataEnums.h +250 -0
  398. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObject.h +64 -0
  399. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObjectType.h +294 -0
  400. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKObserverQuery.h +48 -0
  401. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKPHQ9Assessment.h +77 -0
  402. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantity.h +55 -0
  403. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantityAggregationStyle.h +30 -0
  404. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantitySample.h +83 -0
  405. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantitySeriesSampleBuilder.h +184 -0
  406. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuantitySeriesSampleQuery.h +90 -0
  407. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQuery.h +722 -0
  408. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQueryAnchor.h +33 -0
  409. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKQueryDescriptor.h +46 -0
  410. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSample.h +48 -0
  411. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSampleQuery.h +95 -0
  412. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKScoredAssessment.h +31 -0
  413. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSeriesBuilder.h +40 -0
  414. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSeriesSample.h +32 -0
  415. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSource.h +45 -0
  416. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSourceQuery.h +42 -0
  417. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKSourceRevision.h +78 -0
  418. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStateOfMind.h +157 -0
  419. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStatistics.h +166 -0
  420. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStatisticsCollectionQuery.h +80 -0
  421. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKStatisticsQuery.h +37 -0
  422. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKTypeIdentifiers.h +359 -0
  423. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKUnit.h +287 -0
  424. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKUserAnnotatedMedication.h +60 -0
  425. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKUserAnnotatedMedicationQuery.h +38 -0
  426. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKVerifiableClinicalRecord.h +131 -0
  427. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKVerifiableClinicalRecordQuery.h +76 -0
  428. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKVerifiableClinicalRecordSubject.h +39 -0
  429. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKVisionPrescription.h +76 -0
  430. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKVisionPrism.h +123 -0
  431. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkout.h +341 -0
  432. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutActivity.h +127 -0
  433. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutActivityType.h +147 -0
  434. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutBuilder.h +264 -0
  435. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutConfiguration.h +62 -0
  436. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutEffortRelationshipQuery.h +80 -0
  437. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutRoute.h +20 -0
  438. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutRouteBuilder.h +102 -0
  439. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutRouteQuery.h +67 -0
  440. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HKWorkoutSession.h +364 -0
  441. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HealthKit.apinotes +5 -0
  442. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Headers/HealthKit.h +101 -0
  443. package/sdk/ios/System/Library/Frameworks/HealthKit.framework/Modules/module.modulemap +5 -0
  444. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MAAudibleMedia.h +41 -0
  445. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MACaptionAppearance.h +406 -0
  446. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MADefinitions.h +38 -0
  447. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MAFlashingLightsProcessing.h +53 -0
  448. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MAImageCaptioning.h +55 -0
  449. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MAMusicHaptics.h +69 -0
  450. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MAVideoAccommodations.h +34 -0
  451. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Headers/MediaAccessibility.h +14 -0
  452. package/sdk/ios/System/Library/Frameworks/MediaAccessibility.framework/Modules/module.modulemap +11 -0
  453. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppProxyFlow.h +142 -0
  454. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppProxyProvider.h +93 -0
  455. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppProxyProviderManager.h +40 -0
  456. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppProxyTCPFlow.h +63 -0
  457. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppProxyUDPFlow.h +86 -0
  458. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppPushManager.h +208 -0
  459. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppPushProvider.h +87 -0
  460. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEAppRule.h +80 -0
  461. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEDNSProxyManager.h +109 -0
  462. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEDNSProxyProvider.h +98 -0
  463. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEDNSProxyProviderProtocol.h +45 -0
  464. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEDNSSettings.h +124 -0
  465. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEDNSSettingsManager.h +116 -0
  466. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEEthernetTunnelNetworkSettings.h +45 -0
  467. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEEthernetTunnelProvider.h +31 -0
  468. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterControlProvider.h +80 -0
  469. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterDataProvider.h +235 -0
  470. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterFlow.h +177 -0
  471. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterManager.h +138 -0
  472. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterPacketProvider.h +99 -0
  473. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterProvider.h +335 -0
  474. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterProviderConfiguration.h +94 -0
  475. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterRule.h +46 -0
  476. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFilterSettings.h +56 -0
  477. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEFlowMetaData.h +45 -0
  478. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEHotspotConfigurationManager.h +493 -0
  479. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEHotspotHelper.h +529 -0
  480. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEHotspotNetwork.h +87 -0
  481. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEIPv4Settings.h +122 -0
  482. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEIPv6Settings.h +121 -0
  483. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NENetworkRule.h +218 -0
  484. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEOnDemandRule.h +210 -0
  485. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEPacket.h +67 -0
  486. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEPacketTunnelFlow.h +62 -0
  487. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEPacketTunnelNetworkSettings.h +135 -0
  488. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEPacketTunnelProvider.h +97 -0
  489. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEProvider.h +160 -0
  490. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEProxySettings.h +140 -0
  491. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NERelay.h +83 -0
  492. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NERelayManager.h +195 -0
  493. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETransparentProxyManager.h +39 -0
  494. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETransparentProxyNetworkSettings.h +62 -0
  495. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETransparentProxyProvider.h +33 -0
  496. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETunnelNetworkSettings.h +57 -0
  497. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETunnelProvider.h +113 -0
  498. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETunnelProviderManager.h +108 -0
  499. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETunnelProviderProtocol.h +44 -0
  500. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NETunnelProviderSession.h +55 -0
  501. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEURLFilter.h +51 -0
  502. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEVPNConnection.h +162 -0
  503. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEVPNManager.h +153 -0
  504. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEVPNProtocol.h +135 -0
  505. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEVPNProtocolIKEv2.h +357 -0
  506. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NEVPNProtocolIPSec.h +71 -0
  507. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWBonjourServiceEndpoint.h +82 -0
  508. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWEndpoint.h +40 -0
  509. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWHostEndpoint.h +68 -0
  510. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWPath.h +93 -0
  511. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWTCPConnection.h +335 -0
  512. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWTLSParameters.h +70 -0
  513. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NWUDPSession.h +207 -0
  514. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NetworkExtension.apinotes +351 -0
  515. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Headers/NetworkExtension.h +74 -0
  516. package/sdk/ios/System/Library/Frameworks/NetworkExtension.framework/Modules/module.modulemap +5 -0
  517. package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
  518. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/ModelIO.h +84 -0
  519. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNAction.h +197 -0
  520. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNAnimation.h +428 -0
  521. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNAudioSource.h +170 -0
  522. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNBoundingVolume.h +50 -0
  523. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNCAAnimationExtensions.h +58 -0
  524. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNCamera.h +356 -0
  525. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNCameraController.h +124 -0
  526. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNConstraint.h +431 -0
  527. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNGeometry.h +591 -0
  528. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNHitTest.h +101 -0
  529. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNJavascript.h +58 -0
  530. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNLevelOfDetail.h +56 -0
  531. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNLight.h +350 -0
  532. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNMaterial.h +349 -0
  533. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNMaterialProperty.h +149 -0
  534. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNMorpher.h +79 -0
  535. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNNode.h +695 -0
  536. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNParametricGeometry.h +727 -0
  537. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNParticleSystem.h +462 -0
  538. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsBehavior.h +219 -0
  539. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsBody.h +148 -0
  540. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsContact.h +34 -0
  541. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsField.h +124 -0
  542. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsShape.h +58 -0
  543. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNPhysicsWorld.h +90 -0
  544. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNReferenceNode.h +80 -0
  545. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNRenderer.h +102 -0
  546. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNScene.h +250 -0
  547. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNSceneRenderer.h +389 -0
  548. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNSceneSource.h +348 -0
  549. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNShadable.h +573 -0
  550. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNSkinner.h +84 -0
  551. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNTechnique.h +320 -0
  552. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNTransaction.h +64 -0
  553. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SCNView.h +170 -0
  554. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKit.apinotes +423 -0
  555. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKit.h +58 -0
  556. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKitAvailability.h +10 -0
  557. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKitDeprecated.h +88 -0
  558. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/SceneKitTypes.h +264 -0
  559. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Headers/scn_metal +75 -0
  560. package/sdk/ios/System/Library/Frameworks/SceneKit.framework/Modules/module.modulemap +12 -0
  561. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/CipherSuite.h +281 -0
  562. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecAccessControl.h +133 -0
  563. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
  564. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
  565. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecIdentity.h +232 -0
  566. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
  567. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecKey.h +1616 -0
  568. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
  569. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecProtocolMetadata.h +429 -0
  570. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecProtocolObject.h +71 -0
  571. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecProtocolOptions.h +775 -0
  572. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecProtocolTypes.h +327 -0
  573. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecRandom.h +84 -0
  574. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
  575. package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +13 -0
  576. package/sdk/ios/System/Library/Frameworks/UIKit.framework/Headers/UIKit.h +19 -0
  577. package/sdk/ios/usr/include/AvailabilityInternal.h +23 -0
  578. package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
  579. package/sdk/ios/usr/include/Block.h +56 -0
  580. package/sdk/ios/usr/include/CommonCrypto/CommonCrypto.h +34 -0
  581. package/sdk/ios/usr/include/CommonCrypto/CommonCryptoError.h +78 -0
  582. package/sdk/ios/usr/include/CommonCrypto/CommonCryptor.h +763 -0
  583. package/sdk/ios/usr/include/CommonCrypto/CommonDigest.h +254 -47
  584. package/sdk/ios/usr/include/CommonCrypto/CommonHMAC.h +162 -0
  585. package/sdk/ios/usr/include/CommonCrypto/CommonKeyDerivation.h +136 -0
  586. package/sdk/ios/usr/include/CommonCrypto/CommonRandom.h +63 -0
  587. package/sdk/ios/usr/include/CommonCrypto/CommonSymmetricKeywrap.h +162 -0
  588. package/sdk/ios/usr/include/CommonCrypto/module.modulemap +15 -0
  589. package/sdk/ios/usr/include/ObjectiveC.apinotes +437 -0
  590. package/sdk/ios/usr/include/TargetConditionals.h +525 -14
  591. package/sdk/ios/usr/include/___wctype.h +193 -0
  592. package/sdk/ios/usr/include/__wctype.h +43 -0
  593. package/sdk/ios/usr/include/_abort.h +36 -0
  594. package/sdk/ios/usr/include/_assert.h +80 -0
  595. package/sdk/ios/usr/include/_static_assert.h +33 -0
  596. package/sdk/ios/usr/include/_stdlib.h +403 -0
  597. package/sdk/ios/usr/include/_string.h +231 -0
  598. package/sdk/ios/usr/include/_strings.h +101 -0
  599. package/sdk/ios/usr/include/_types/_wctrans_t.h +33 -0
  600. package/sdk/ios/usr/include/_types/_wctype_t.h +33 -0
  601. package/sdk/ios/usr/include/_wchar.h +263 -0
  602. package/sdk/ios/usr/include/_wctype.h +129 -0
  603. package/sdk/ios/usr/include/_xlocale.h +47 -0
  604. package/sdk/ios/usr/include/alloca.h +46 -0
  605. package/sdk/ios/usr/include/architecture/byte_order.h +381 -0
  606. package/sdk/ios/usr/include/arm/_limits.h +13 -0
  607. package/sdk/ios/usr/include/arm/arch.h +71 -0
  608. package/sdk/ios/usr/include/arm/limits.h +136 -0
  609. package/sdk/ios/usr/include/arpa/inet.h +100 -0
  610. package/sdk/ios/usr/include/assert.h +77 -10
  611. package/sdk/ios/usr/include/bsm/audit.h +434 -0
  612. package/sdk/ios/usr/include/copyfile.h +143 -0
  613. package/sdk/ios/usr/include/crt_externs.h +50 -0
  614. package/sdk/ios/usr/include/dispatch/base.h +369 -0
  615. package/sdk/ios/usr/include/dispatch/block.h +509 -0
  616. package/sdk/ios/usr/include/dispatch/data.h +290 -0
  617. package/sdk/ios/usr/include/dispatch/dispatch.h +68 -172
  618. package/sdk/ios/usr/include/dispatch/dispatch_swift_shims.h +61 -0
  619. package/sdk/ios/usr/include/dispatch/group.h +289 -0
  620. package/sdk/ios/usr/include/dispatch/introspection.h +190 -0
  621. package/sdk/ios/usr/include/dispatch/io.h +617 -0
  622. package/sdk/ios/usr/include/dispatch/object.h +680 -0
  623. package/sdk/ios/usr/include/dispatch/once.h +128 -0
  624. package/sdk/ios/usr/include/dispatch/queue.h +1824 -0
  625. package/sdk/ios/usr/include/dispatch/semaphore.h +124 -0
  626. package/sdk/ios/usr/include/dispatch/source.h +803 -0
  627. package/sdk/ios/usr/include/dispatch/time.h +144 -0
  628. package/sdk/ios/usr/include/dispatch/workloop.h +178 -0
  629. package/sdk/ios/usr/include/dlfcn.h +320 -7
  630. package/sdk/ios/usr/include/execinfo.h +100 -10
  631. package/sdk/ios/usr/include/ftw.h +63 -0
  632. package/sdk/ios/usr/include/gethostuuid.h +45 -0
  633. package/sdk/ios/usr/include/libkern/arm/OSByteOrder.h +195 -0
  634. package/sdk/ios/usr/include/limits.h +167 -4
  635. package/sdk/ios/usr/include/mach/arm/boolean.h +74 -0
  636. package/sdk/ios/usr/include/mach/arm/exception.h +86 -0
  637. package/sdk/ios/usr/include/mach/arm/kern_return.h +78 -0
  638. package/sdk/ios/usr/include/mach/arm/processor_info.h +76 -0
  639. package/sdk/ios/usr/include/mach/arm/rpc.h +39 -0
  640. package/sdk/ios/usr/include/mach/arm/thread_state.h +42 -0
  641. package/sdk/ios/usr/include/mach/arm/thread_status.h +302 -0
  642. package/sdk/ios/usr/include/mach/arm/vm_param.h +118 -0
  643. package/sdk/ios/usr/include/mach/arm/vm_types.h +162 -0
  644. package/sdk/ios/usr/include/mach/boolean.h +88 -4
  645. package/sdk/ios/usr/include/mach/clock.h +249 -0
  646. package/sdk/ios/usr/include/mach/clock_priv.h +203 -0
  647. package/sdk/ios/usr/include/mach/clock_types.h +127 -0
  648. package/sdk/ios/usr/include/mach/dyld_kernel.h +66 -0
  649. package/sdk/ios/usr/include/mach/error.h +117 -0
  650. package/sdk/ios/usr/include/mach/exc.h +285 -0
  651. package/sdk/ios/usr/include/mach/exception_types.h +204 -25
  652. package/sdk/ios/usr/include/mach/host_info.h +136 -51
  653. package/sdk/ios/usr/include/mach/host_notify.h +39 -0
  654. package/sdk/ios/usr/include/mach/host_priv.h +1167 -0
  655. package/sdk/ios/usr/include/mach/host_security.h +225 -0
  656. package/sdk/ios/usr/include/mach/host_special_ports.h +315 -0
  657. package/sdk/ios/usr/include/mach/kern_return.h +291 -2
  658. package/sdk/ios/usr/include/mach/kmod.h +180 -0
  659. package/sdk/ios/usr/include/mach/mach.h +237 -12
  660. package/sdk/ios/usr/include/mach/mach_error.h +93 -10
  661. package/sdk/ios/usr/include/mach/mach_host.h +1329 -5
  662. package/sdk/ios/usr/include/mach/mach_init.h +112 -13
  663. package/sdk/ios/usr/include/mach/mach_interface.h +52 -0
  664. package/sdk/ios/usr/include/mach/mach_port.h +1935 -4
  665. package/sdk/ios/usr/include/mach/mach_time.h +77 -14
  666. package/sdk/ios/usr/include/mach/mach_traps.h +311 -0
  667. package/sdk/ios/usr/include/mach/mach_types.h +297 -20
  668. package/sdk/ios/usr/include/mach/mach_voucher_types.h +259 -0
  669. package/sdk/ios/usr/include/mach/machine/boolean.h +40 -0
  670. package/sdk/ios/usr/include/mach/machine/exception.h +40 -0
  671. package/sdk/ios/usr/include/mach/machine/kern_return.h +40 -0
  672. package/sdk/ios/usr/include/mach/machine/processor_info.h +40 -0
  673. package/sdk/ios/usr/include/mach/machine/rpc.h +40 -0
  674. package/sdk/ios/usr/include/mach/machine/thread_state.h +44 -0
  675. package/sdk/ios/usr/include/mach/machine/thread_status.h +40 -0
  676. package/sdk/ios/usr/include/mach/machine/vm_param.h +40 -0
  677. package/sdk/ios/usr/include/mach/machine/vm_types.h +40 -0
  678. package/sdk/ios/usr/include/mach/machine.h +456 -142
  679. package/sdk/ios/usr/include/mach/memory_object_types.h +312 -0
  680. package/sdk/ios/usr/include/mach/message.h +972 -0
  681. package/sdk/ios/usr/include/mach/mig.h +180 -0
  682. package/sdk/ios/usr/include/mach/mig_errors.h +125 -0
  683. package/sdk/ios/usr/include/mach/mig_strncpy_zerofill_support.h +35 -0
  684. package/sdk/ios/usr/include/mach/ndr.h +207 -0
  685. package/sdk/ios/usr/include/mach/notify.h +141 -0
  686. package/sdk/ios/usr/include/mach/policy.h +235 -0
  687. package/sdk/ios/usr/include/mach/port.h +648 -0
  688. package/sdk/ios/usr/include/mach/processor.h +364 -0
  689. package/sdk/ios/usr/include/mach/processor_info.h +171 -0
  690. package/sdk/ios/usr/include/mach/processor_set.h +589 -0
  691. package/sdk/ios/usr/include/mach/rpc.h +135 -0
  692. package/sdk/ios/usr/include/mach/semaphore.h +78 -0
  693. package/sdk/ios/usr/include/mach/std_types.h +75 -0
  694. package/sdk/ios/usr/include/mach/sync_policy.h +47 -0
  695. package/sdk/ios/usr/include/mach/task.h +2887 -7
  696. package/sdk/ios/usr/include/mach/task_info.h +584 -19
  697. package/sdk/ios/usr/include/mach/task_inspect.h +57 -0
  698. package/sdk/ios/usr/include/mach/task_policy.h +182 -26
  699. package/sdk/ios/usr/include/mach/task_special_ports.h +135 -0
  700. package/sdk/ios/usr/include/mach/thread_act.h +1550 -5
  701. package/sdk/ios/usr/include/mach/thread_info.h +206 -28
  702. package/sdk/ios/usr/include/mach/thread_policy.h +268 -0
  703. package/sdk/ios/usr/include/mach/thread_special_ports.h +87 -0
  704. package/sdk/ios/usr/include/mach/thread_status.h +100 -0
  705. package/sdk/ios/usr/include/mach/thread_switch.h +77 -0
  706. package/sdk/ios/usr/include/mach/time_value.h +96 -4
  707. package/sdk/ios/usr/include/mach/vm_attributes.h +99 -0
  708. package/sdk/ios/usr/include/mach/vm_behavior.h +86 -0
  709. package/sdk/ios/usr/include/mach/vm_inherit.h +93 -0
  710. package/sdk/ios/usr/include/mach/vm_map.h +1558 -0
  711. package/sdk/ios/usr/include/mach/vm_page_size.h +68 -0
  712. package/sdk/ios/usr/include/mach/vm_prot.h +183 -7
  713. package/sdk/ios/usr/include/mach/vm_purgable.h +166 -0
  714. package/sdk/ios/usr/include/mach/vm_region.h +400 -36
  715. package/sdk/ios/usr/include/mach/vm_statistics.h +387 -96
  716. package/sdk/ios/usr/include/mach/vm_sync.h +84 -0
  717. package/sdk/ios/usr/include/mach/vm_types.h +194 -7
  718. package/sdk/ios/usr/include/mach-o/arch.h +154 -16
  719. package/sdk/ios/usr/include/mach-o/fat.h +89 -0
  720. package/sdk/ios/usr/include/mach-o/getsect.h +146 -12
  721. package/sdk/ios/usr/include/mach-o/loader.h +1679 -139
  722. package/sdk/ios/usr/include/mach_debug/hash_info.h +75 -0
  723. package/sdk/ios/usr/include/mach_debug/ipc_info.h +199 -0
  724. package/sdk/ios/usr/include/mach_debug/lockgroup_info.h +74 -0
  725. package/sdk/ios/usr/include/mach_debug/mach_debug_types.h +200 -0
  726. package/sdk/ios/usr/include/mach_debug/page_info.h +64 -0
  727. package/sdk/ios/usr/include/mach_debug/vm_info.h +149 -0
  728. package/sdk/ios/usr/include/mach_debug/zone_info.h +209 -0
  729. package/sdk/ios/usr/include/machine/limits.h +14 -0
  730. package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
  731. package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
  732. package/sdk/ios/usr/include/malloc/_platform.h +80 -0
  733. package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
  734. package/sdk/ios/usr/include/malloc/malloc.h +768 -0
  735. package/sdk/ios/usr/include/module.modulemap +4 -0
  736. package/sdk/ios/usr/include/net/if_types.h +152 -0
  737. package/sdk/ios/usr/include/objc/NSObjCRuntime.h +10 -0
  738. package/sdk/ios/usr/include/objc/NSObject.h +23 -25
  739. package/sdk/ios/usr/include/objc/objc-api.h +310 -0
  740. package/sdk/ios/usr/include/objc/objc.h +243 -0
  741. package/sdk/ios/usr/include/objc/runtime.h +1933 -0
  742. package/sdk/ios/usr/include/os/availability.h +168 -6
  743. package/sdk/ios/usr/include/os/base.h +351 -0
  744. package/sdk/ios/usr/include/os/clock.h +18 -0
  745. package/sdk/ios/usr/include/os/lock.h +232 -10
  746. package/sdk/ios/usr/include/os/log.h +521 -38
  747. package/sdk/ios/usr/include/os/object.h +320 -3
  748. package/sdk/ios/usr/include/os/trace.h +492 -0
  749. package/sdk/ios/usr/include/os/trace_base.h +167 -0
  750. package/sdk/ios/usr/include/os/workgroup.h +37 -0
  751. package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
  752. package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
  753. package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
  754. package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
  755. package/sdk/ios/usr/include/os.modulemap +6 -0
  756. package/sdk/ios/usr/include/pthread/pthread_impl.h +66 -0
  757. package/sdk/ios/usr/include/pthread/sched.h +46 -0
  758. package/sdk/ios/usr/include/pthread.h +754 -4
  759. package/sdk/ios/usr/include/pwd.h +119 -0
  760. package/sdk/ios/usr/include/sched.h +46 -0
  761. package/sdk/ios/usr/include/secure/_string.h +295 -0
  762. package/sdk/ios/usr/include/secure/_strings.h +96 -0
  763. package/sdk/ios/usr/include/spawn.h +193 -0
  764. package/sdk/ios/usr/include/stddef.h +90 -0
  765. package/sdk/ios/usr/include/stdlib.h +62 -17
  766. package/sdk/ios/usr/include/string.h +62 -8
  767. package/sdk/ios/usr/include/sys/_pthread/_pthread_cond_t.h +32 -0
  768. package/sdk/ios/usr/include/sys/_pthread/_pthread_condattr_t.h +32 -0
  769. package/sdk/ios/usr/include/sys/_pthread/_pthread_key_t.h +32 -0
  770. package/sdk/ios/usr/include/sys/_pthread/_pthread_mutex_t.h +32 -0
  771. package/sdk/ios/usr/include/sys/_pthread/_pthread_mutexattr_t.h +32 -0
  772. package/sdk/ios/usr/include/sys/_pthread/_pthread_once_t.h +32 -0
  773. package/sdk/ios/usr/include/sys/_pthread/_pthread_rwlock_t.h +32 -0
  774. package/sdk/ios/usr/include/sys/_pthread/_pthread_rwlockattr_t.h +32 -0
  775. package/sdk/ios/usr/include/sys/_select.h +57 -0
  776. package/sdk/ios/usr/include/sys/_types/_blkcnt_t.h +32 -0
  777. package/sdk/ios/usr/include/sys/_types/_blksize_t.h +32 -0
  778. package/sdk/ios/usr/include/sys/_types/_caddr_t.h +32 -0
  779. package/sdk/ios/usr/include/sys/_types/_dev_t.h +32 -0
  780. package/sdk/ios/usr/include/sys/_types/_fsblkcnt_t.h +32 -0
  781. package/sdk/ios/usr/include/sys/_types/_fsfilcnt_t.h +32 -0
  782. package/sdk/ios/usr/include/sys/_types/_fsid_t.h +32 -0
  783. package/sdk/ios/usr/include/sys/_types/_fsobj_id_t.h +38 -0
  784. package/sdk/ios/usr/include/sys/_types/_graftdmg_un.h +64 -0
  785. package/sdk/ios/usr/include/sys/_types/_guid_t.h +37 -0
  786. package/sdk/ios/usr/include/sys/_types/_id_t.h +32 -0
  787. package/sdk/ios/usr/include/sys/_types/_ino64_t.h +32 -0
  788. package/sdk/ios/usr/include/sys/_types/_key_t.h +32 -0
  789. package/sdk/ios/usr/include/sys/_types/_mach_port_t.h +51 -0
  790. package/sdk/ios/usr/include/sys/_types/_mbstate_t.h +33 -0
  791. package/sdk/ios/usr/include/sys/_types/_mount_t.h +34 -0
  792. package/sdk/ios/usr/include/sys/_types/_nlink_t.h +32 -0
  793. package/sdk/ios/usr/include/sys/_types/_os_inline.h +34 -0
  794. package/sdk/ios/usr/include/sys/_types/_posix_vdisable.h +30 -0
  795. package/sdk/ios/usr/include/sys/_types/_rsize_t.h +55 -0
  796. package/sdk/ios/usr/include/sys/_types/_suseconds_t.h +32 -0
  797. package/sdk/ios/usr/include/sys/_types/_timeval.h +39 -0
  798. package/sdk/ios/usr/include/sys/_types/_u_char.h +31 -0
  799. package/sdk/ios/usr/include/sys/_types/_u_int.h +31 -0
  800. package/sdk/ios/usr/include/sys/_types/_u_short.h +31 -0
  801. package/sdk/ios/usr/include/sys/_types/_useconds_t.h +32 -0
  802. package/sdk/ios/usr/include/sys/_types/_uuid_t.h +32 -0
  803. package/sdk/ios/usr/include/sys/_types/_vnode_t.h +34 -0
  804. package/sdk/ios/usr/include/sys/acl.h +215 -0
  805. package/sdk/ios/usr/include/sys/attr.h +635 -0
  806. package/sdk/ios/usr/include/sys/cdefs.h +53 -0
  807. package/sdk/ios/usr/include/sys/event.h +388 -0
  808. package/sdk/ios/usr/include/sys/kauth.h +409 -0
  809. package/sdk/ios/usr/include/sys/mount.h +470 -0
  810. package/sdk/ios/usr/include/sys/queue.h +909 -0
  811. package/sdk/ios/usr/include/sys/resource.h +600 -0
  812. package/sdk/ios/usr/include/sys/select.h +134 -0
  813. package/sdk/ios/usr/include/sys/spawn.h +84 -0
  814. package/sdk/ios/usr/include/sys/sysctl.h +803 -57
  815. package/sdk/ios/usr/include/sys/syslimits.h +131 -11
  816. package/sdk/ios/usr/include/sys/types.h +236 -19
  817. package/sdk/ios/usr/include/sys/ucred.h +116 -0
  818. package/sdk/ios/usr/include/sys/un.h +105 -0
  819. package/sdk/ios/usr/include/sys/unistd.h +225 -0
  820. package/sdk/ios/usr/include/sys/vm.h +89 -0
  821. package/sdk/ios/usr/include/sys/wait.h +256 -0
  822. package/sdk/ios/usr/include/sysdir.h +79 -0
  823. package/sdk/ios/usr/include/unistd.h +799 -3
  824. package/sdk/ios/usr/include/uuid/uuid.h +69 -10
  825. package/sdk/ios/usr/include/wchar.h +71 -0
  826. package/sdk/ios/usr/include/wctype.h +35 -0
  827. package/sdk/ios/usr/include/xlocale/___wctype.h +146 -0
  828. package/sdk/ios/usr/include/xlocale/_ctype.h +240 -0
  829. package/sdk/ios/usr/include/xlocale/_stdlib.h +77 -0
  830. package/sdk/ios/usr/include/xlocale/_string.h +43 -0
  831. package/sdk/ios/usr/include/xlocale/_wchar.h +160 -0
  832. package/sdk/ios/usr/include/xlocale/_wctype.h +100 -0
  833. package/sdk/ios/usr/include/xlocale.h +61 -0
  834. package/sdk/ios/usr/include/xpc/availability.h +141 -0
  835. package/sdk/ios/usr/include/xpc/base.h +243 -0
  836. package/sdk/ios/wasm/include/AvailabilityInternal.h +24 -0
  837. package/sdk/ios/wasm/include/TargetConditionals.h +529 -0
  838. package/sdk/ios/wasm/include/_locale.h +3 -0
  839. package/sdk/ios/wasm/include/_locale_posix2008.h +3 -0
  840. package/sdk/ios/wasm/include/_types/_locale_t.h +3 -0
  841. package/sdk/ios/wasm/include/arpa/inet.h +15 -0
  842. package/sdk/ios/wasm/include/dirent.h +52 -0
  843. package/sdk/ios/wasm/include/dlfcn.h +13 -1
  844. package/sdk/ios/wasm/include/errno.h +22 -0
  845. package/sdk/ios/wasm/include/fcntl.h +29 -0
  846. package/sdk/ios/wasm/include/ftw.h +15 -0
  847. package/sdk/ios/wasm/include/libkern/_OSByteOrder.h +6 -0
  848. package/sdk/ios/wasm/include/limits.h +9 -0
  849. package/sdk/ios/wasm/include/mach/machine/boolean.h +1 -1
  850. package/sdk/ios/wasm/include/mach/machine/exception.h +1 -4
  851. package/sdk/ios/wasm/include/mach/machine/kern_return.h +1 -1
  852. package/sdk/ios/wasm/include/mach/machine/processor_info.h +1 -1
  853. package/sdk/ios/wasm/include/mach/machine/rpc.h +1 -1
  854. package/sdk/ios/wasm/include/mach/machine/thread_state.h +1 -2
  855. package/sdk/ios/wasm/include/mach/machine/thread_status.h +1 -2
  856. package/sdk/ios/wasm/include/mach/machine/vm_param.h +1 -2
  857. package/sdk/ios/wasm/include/mach/machine/vm_types.h +1 -17
  858. package/sdk/ios/wasm/include/machine/_endian.h +2 -0
  859. package/sdk/ios/wasm/include/machine/_param.h +2 -0
  860. package/sdk/ios/wasm/include/machine/endian.h +1 -1
  861. package/sdk/ios/wasm/include/machine/limits.h +106 -2
  862. package/sdk/ios/wasm/include/machine/param.h +152 -0
  863. package/sdk/ios/wasm/include/netinet/in.h +11 -0
  864. package/sdk/ios/wasm/include/os/object.h +10 -0
  865. package/sdk/ios/wasm/include/pthread.h +14 -0
  866. package/sdk/ios/wasm/include/stdio.h +12 -0
  867. package/sdk/ios/wasm/include/stdlib.h +13 -0
  868. package/sdk/ios/wasm/include/strings.h +9 -0
  869. package/sdk/ios/wasm/include/sys/_types/_iovec_t.h +6 -0
  870. package/sdk/ios/wasm/include/sys/_types/_mode_t.h +10 -0
  871. package/sdk/ios/wasm/include/sys/mman.h +2 -2
  872. package/sdk/ios/wasm/include/sys/param.h +4 -0
  873. package/sdk/ios/wasm/include/sys/resource.h +43 -0
  874. package/sdk/ios/wasm/include/sys/socket.h +75 -9
  875. package/sdk/ios/wasm/include/sys/stat.h +63 -0
  876. package/sdk/ios/wasm/include/sys/types.h +13 -0
  877. package/sdk/ios/wasm/include/sys/un.h +7 -0
  878. package/sdk/ios/wasm/include/time.h +3 -1
  879. package/sdk/ios/wasm/include/unistd.h +19 -3
  880. package/sdk/ios/wasm/include/xlocale/_stdlib.h +37 -0
  881. package/sdk/ios/wasm/storage-include/TargetConditionals.h +529 -0
  882. package/sdk/ios/wasm/storage-include/mach/machine/boolean.h +2 -0
  883. package/sdk/ios/wasm/storage-include/mach/machine/exception.h +5 -0
  884. package/sdk/ios/wasm/storage-include/mach/machine/kern_return.h +2 -0
  885. package/sdk/ios/wasm/storage-include/mach/machine/processor_info.h +2 -0
  886. package/sdk/ios/wasm/storage-include/mach/machine/rpc.h +2 -0
  887. package/sdk/ios/wasm/storage-include/mach/machine/thread_state.h +3 -0
  888. package/sdk/ios/wasm/storage-include/mach/machine/thread_status.h +3 -0
  889. package/sdk/ios/wasm/storage-include/mach/machine/vm_param.h +3 -0
  890. package/sdk/ios/wasm/storage-include/mach/machine/vm_types.h +18 -0
  891. package/sdk/ios/wasm/storage-include/machine/_endian.h +9 -0
  892. package/sdk/ios/wasm/storage-include/machine/_param.h +8 -0
  893. package/sdk/ios/wasm/storage-include/machine/_types.h +31 -0
  894. package/sdk/ios/wasm/storage-include/machine/endian.h +2 -0
  895. package/sdk/ios/wasm/storage-include/machine/limits.h +2 -0
  896. package/sdk/ios/wasm/storage-include/machine/types.h +15 -0
  897. package/sdk/native-hashes.json +80 -0
  898. package/skills/contrast/SKILL.md +4 -1
  899. package/src/android-root-module.ts +145 -0
  900. package/src/androidRootModuleContract.ts +39 -0
  901. package/src/assetCatalogContract.ts +10 -1
  902. package/src/backend-origin.ts +11 -8
  903. package/src/bridge-constants.ts +7 -0
  904. package/src/bridge-contract.ts +3 -1
  905. package/src/capture-contract.ts +3 -1
  906. package/src/cli-runtime.ts +6 -1
  907. package/src/codex-client.ts +11 -6
  908. package/src/dev-bundle-resolution.ts +124 -48
  909. package/src/device-catalog.ts +10 -4
  910. package/src/expo-discovery-cache.ts +272 -0
  911. package/src/expo-native-workspace.ts +207 -0
  912. package/src/expo-swift-host.ts +824 -33
  913. package/src/expo-swift-ready.ts +56 -38
  914. package/src/expoSwiftContract.ts +4 -1
  915. package/src/generated/swift-c-predefines.json +69 -13
  916. package/src/host/bridge-host.ts +33 -0
  917. package/src/host/fetch-proxy-handler.ts +19 -1
  918. package/src/host/network-policy-proxy.ts +421 -0
  919. package/src/host/network-policy.ts +121 -0
  920. package/src/host/staged-host-files.ts +80 -3
  921. package/src/host/websocket-frame-guard.ts +163 -0
  922. package/src/host/websocket-proxy-headers.ts +29 -0
  923. package/src/host/websocket-proxy.ts +100 -58
  924. package/src/installed-native-build-options.ts +154 -0
  925. package/src/installed-package-versions.ts +70 -50
  926. package/src/material-symbol-fonts.ts +6 -4
  927. package/src/menu.ts +6 -0
  928. package/src/metro-plugin.ts +8 -0
  929. package/src/metro-project-root.ts +44 -33
  930. package/src/native-app-identity-project.ts +5 -0
  931. package/src/native-app-identity.ts +16 -0
  932. package/src/native-dev-bundle-url.ts +0 -18
  933. package/src/native-firebase-config.ts +47 -4
  934. package/src/native-preparation.ts +30 -0
  935. package/src/nativePreparationContract.ts +3 -0
  936. package/src/nitro-adapter.lock.json +1072 -14
  937. package/src/nitro-adapter.ts +33 -24
  938. package/src/nitro-bundle.ts +132 -22
  939. package/src/nitro-compile.ts +47 -7
  940. package/src/nitro-dependencies.ts +226 -0
  941. package/src/nitro-source.ts +200 -40
  942. package/src/nitroAdapterContract.ts +100 -20
  943. package/src/node-http-fetch.ts +116 -0
  944. package/src/packageVersionsContract.ts +79 -0
  945. package/src/react-native-bridge-modules.ts +24 -1
  946. package/src/react-native-host-modules.ts +111 -4
  947. package/src/runtime-assets.ts +10 -0
  948. package/src/serverDiscoveryContract.ts +1 -0
  949. package/src/settingsContract.ts +0 -30
  950. package/src/sim-client.ts +1 -1
  951. package/src/storageSnapshotContract.ts +22 -10
  952. package/src/stub-pattern-matcher.ts +17 -4
  953. package/src/swift-binary-modules.ts +20 -5
  954. package/src/swift-compile.ts +1292 -4123
  955. package/src/swift-compiler-digest.ts +1 -2
  956. package/src/swift-coverage/package.ts +103 -58
  957. package/src/swift-coverage/xcode-assets.ts +26 -5
  958. package/src/swift-coverage/xcode-bridging.ts +1 -12
  959. package/src/swift-coverage/xcode-packages.ts +167 -52
  960. package/src/swift-coverage/xcode.ts +2 -6
  961. package/src/swift-cxx-declarations.ts +205 -0
  962. package/src/swift-cxx-deps.ts +48 -0
  963. package/src/swift-cxx-reachable.ts +297 -0
  964. package/src/swift-cxx-standin.ts +248 -0
  965. package/src/swift-distribution.lock.json +29 -20
  966. package/src/swift-host.ts +229 -24
  967. package/src/swift-objc-compile.ts +638 -219
  968. package/src/swift-objc-import.ts +19 -964
  969. package/src/swift-objc-platform.ts +2 -2
  970. package/src/swift-objc-runtime.ts +7 -0
  971. package/src/swift-objc-standin.ts +314 -64
  972. package/src/swift-package-manifest.ts +179 -38
  973. package/src/swift-package.ts +156 -29
  974. package/src/swift-packages.ts +193 -34
  975. package/src/swift-pdf-raster.ts +114 -0
  976. package/src/swift-shared-sdk.ts +45 -0
  977. package/src/swift-source-file.ts +10 -6
  978. package/src/swift-source-pods.ts +126 -41
  979. package/src/swift-standin-digest.ts +74 -0
  980. package/src/swift-standin-emit.ts +48 -4
  981. package/src/swift-standins.ts +334 -92
  982. package/src/swift-submit.ts +24 -6
  983. package/src/swift-toolchain.ts +49 -9
  984. package/src/swiftContract.ts +58 -29
  985. package/src/vite-plugin.ts +0 -23
  986. package/src/workspace-root.ts +15 -0
  987. package/src/xcode-json-project.ts +52 -1
  988. package/src/xcode-project.ts +355 -65
  989. package/src/settings-flags.ts +0 -107
  990. package/src/swift-objc-export.ts +0 -532
  991. package/src/swift-objc-metadata.ts +0 -534
@@ -0,0 +1,2738 @@
1
+ // Basic Neural Network Subroutines (BNNS)
2
+
3
+ #ifndef __BNNS_HEADER__
4
+ #define __BNNS_HEADER__
5
+
6
+ #if __has_include( <TargetConditionals.h> )
7
+ #include <TargetConditionals.h>
8
+ #endif // __has_include( <TargetConditionals.h> )
9
+
10
+ #include "bnns_constants.h"
11
+ #include "bnns_structures.h"
12
+ #include "bnns_graph.h"
13
+
14
+ #include <sys/types.h>
15
+
16
+ #if __has_include( <Availability.h> )
17
+ #include <Availability.h>
18
+ #else // __has_include( <Availability.h> )
19
+ #define __API_AVAILABLE(...)
20
+ #define __API_DEPRECATED(...)
21
+ #define __API_DEPRECATED_WITH_REPLACEMENT(...)
22
+ #endif // __has_include( <Availability.h> )
23
+
24
+ #if __has_feature(assume_nonnull)
25
+ _Pragma("clang assume_nonnull begin")
26
+ #else
27
+ #define _Null_unspecified
28
+ #define _Nullable
29
+ #define _Nonnull
30
+ #endif
31
+
32
+ #ifdef __cplusplus
33
+ extern "C" {
34
+ #endif
35
+
36
+ /*
37
+
38
+ Logging
39
+
40
+ When a parameter is invalid or an internal error occurs, an error message will be logged.
41
+ Some combinations of parameters may not be supported. In that case, an info message will be logged.
42
+
43
+ */
44
+
45
+ #pragma mark - Filter creation
46
+
47
+ /*!
48
+
49
+ @abstract Filter object
50
+
51
+ */
52
+ typedef void * _Nullable BNNSFilter
53
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(10.12, 15.0), ios(10.0, 18.0), watchos(3.0, 11.0), tvos(10.0, 18.0));
54
+
55
+ /*!
56
+
57
+ @abstract Create a convolution layer filter
58
+
59
+ @discussion
60
+ Creates a filter applying the convolution described in <tt>layer_params</tt>.
61
+ Some combinations of the parameters may not be supported, in which case the call will fail.
62
+
63
+ @param layer_params Layer parameters and input, weights, output, bias and activation descriptors
64
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
65
+
66
+ @return A new non-NULL filter on success, and NULL on failure.
67
+
68
+ */
69
+ BNNSFilter BNNSFilterCreateLayerConvolution(const BNNSLayerParametersConvolution * layer_params,
70
+ const BNNSFilterParameters * _Nullable filter_params)
71
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
72
+
73
+ /*!
74
+
75
+ @abstract Create a transposed convolution layer filter (also known as deconvolution)
76
+
77
+ @discussion
78
+ Creates a filter applying the transposed convolution described in <tt>layer_params</tt>.
79
+ Some combinations of the parameters may not be supported, in which case the call will fail.
80
+ Currently only BNNSDataTypeFloat32 data type is supported.
81
+ @param layer_params Layer parameters and input, weights, output, bias and activation descriptors
82
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
83
+
84
+ @return A new non-NULL filter on success, and NULL on failure.
85
+
86
+ */
87
+ BNNSFilter BNNSFilterCreateLayerTransposedConvolution(const BNNSLayerParametersConvolution * layer_params,
88
+ const BNNSFilterParameters * _Nullable filter_params)
89
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
90
+
91
+ /*!
92
+
93
+ @abstract Create a fully connected layer filter
94
+
95
+ @discussion
96
+ Creates a filter applying the fully connected layer described in <tt>layer_params</tt>.
97
+ Some combinations of the parameters may not be supported, in which case the call will fail.
98
+
99
+ @param layer_params input, weights, output, bias and activation descriptors
100
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
101
+
102
+ @return A new non-NULL filter on success, and NULL on failure.
103
+
104
+ */
105
+ BNNSFilter BNNSFilterCreateLayerFullyConnected(const BNNSLayerParametersFullyConnected * layer_params,
106
+ const BNNSFilterParameters * _Nullable filter_params)
107
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
108
+
109
+ #if !0
110
+
111
+ /*!
112
+
113
+ @abstract Create a pooling layer filter
114
+
115
+ @discussion
116
+ Creates a filter applying the pooling layer described in <tt>layer_params</tt>
117
+ Some combinations of the parameters may not be supported, in which case the call will fail.
118
+
119
+ @param layer_params Layer parameters and input, weights, output, bias and activation descriptors
120
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
121
+
122
+ @return A new non-NULL filter on success, and NULL on failure.
123
+
124
+ */
125
+ BNNSFilter BNNSFilterCreateLayerPooling(const BNNSLayerParametersPooling * layer_params,
126
+ const BNNSFilterParameters * _Nullable filter_params)
127
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
128
+
129
+ #endif
130
+
131
+ /*!
132
+
133
+ @abstract Create a Activation/Conversion layer filter
134
+
135
+ @discussion
136
+ Creates a filter applying the given activation function or conversions.
137
+ Input and output must have the same number of elements.
138
+
139
+ @param layer_params input, output and activation descriptors
140
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
141
+
142
+ @return A new non-NULL filter on success, and NULL on failure.
143
+
144
+ */
145
+ BNNSFilter BNNSFilterCreateLayerActivation(const BNNSLayerParametersActivation * layer_params,
146
+ const BNNSFilterParameters * _Nullable filter_params)
147
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
148
+
149
+ #if !0
150
+
151
+ /*!
152
+
153
+ @abstract Create a Loss layer filter
154
+
155
+ @discussion
156
+ Creates a filter applying loss function and loss reduction.
157
+
158
+ @param layer_params input, output and loss description
159
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
160
+
161
+ @return A new non-NULL filter on success, and NULL on failure.
162
+
163
+ */
164
+ BNNSFilter BNNSFilterCreateLayerLoss(const void * _Nonnull layer_params,
165
+ const BNNSFilterParameters * _Nullable filter_params)
166
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
167
+
168
+ /*!
169
+
170
+ @abstract Create a Normalization layer filter
171
+
172
+ @discussion
173
+ Creates a normalization filter that normalize inputs based on mean, variance and trainable parameters beta and gamma.
174
+
175
+ @param normType type of normalization, currently supporting batch, instance, layer and group norm.
176
+ @param layer_params normalization layer parameters pointer.
177
+ @param filter_params Filter runtime parameters, may be NULL for default parameters.
178
+
179
+ @return A new non-NULL filter on success, and NULL on failure.
180
+
181
+ */
182
+ BNNSFilter BNNSFilterCreateLayerNormalization(BNNSFilterType normType,
183
+ const BNNSLayerParametersNormalization * layer_params,
184
+ const BNNSFilterParameters * _Nullable filter_params)
185
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
186
+
187
+ #endif
188
+
189
+ /*!
190
+
191
+ @abstract Create an Arithmetic layer filter
192
+
193
+ @discussion
194
+ Creates an Arithmetic filter such as add, subtract, multiply.
195
+
196
+ @param layer_params Arithmetic layer parameters pointer.
197
+ @param filter_params Filter runtime parameters, may be NULL for default parameters.
198
+
199
+ @return A new non-NULL filter on success, and NULL on failure.
200
+
201
+ */
202
+ BNNSFilter BNNSFilterCreateLayerArithmetic(const BNNSLayerParametersArithmetic * layer_params,
203
+ const BNNSFilterParameters * _Nullable filter_params)
204
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
205
+
206
+ #if !0
207
+
208
+ /*!
209
+
210
+ @abstract Create a Permute layer filter
211
+
212
+ @discussion
213
+ Creates a permute layer filter that copies one tensor to another whilst permuting the order of the axes
214
+
215
+ @param layer_params Permute layer parameters pointer.
216
+ @param filter_params Filter runtime parameters, may be NULL for default parameters.
217
+
218
+ @return A new non-NULL filter on success, and NULL on failure.
219
+
220
+ */
221
+ BNNSFilter BNNSFilterCreateLayerPermute(const BNNSLayerParametersPermute * layer_params,
222
+ const BNNSFilterParameters * _Nullable filter_params)
223
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
224
+
225
+ /*
226
+ @abstract Create a dropout filter
227
+
228
+ @discussion
229
+ The function will:
230
+ validate correctness of the parameters
231
+ create a new dropout filter
232
+
233
+ @param layer_params dropout layer parameters
234
+ @param filter_params filter parameters
235
+ @return A new non-NULL filter on success, and NULL on failure.
236
+
237
+ */
238
+ BNNSFilter BNNSFilterCreateLayerDropout(const BNNSLayerParametersDropout * layer_params,
239
+ const BNNSFilterParameters * _Nullable filter_params)
240
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
241
+
242
+ /*!
243
+ @abstract Create a padding filter
244
+
245
+ @discussion
246
+ The function will:
247
+ validate correctness of the filter parameters
248
+ create a new padding filter
249
+
250
+ @param layer_params padding layer parameters
251
+ @param filter_params filter parameters
252
+ @return A new non-NULL filter on success, and NULL on failure.
253
+
254
+ */
255
+
256
+ BNNSFilter _Nullable BNNSFilterCreateLayerPadding(const BNNSLayerParametersPadding * layer_params,
257
+ const BNNSFilterParameters * _Nullable filter_params)
258
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
259
+
260
+ #endif
261
+
262
+ /*! @abstract Create a layer representing a broadcast matrix multiplication
263
+ *
264
+ * @discussion See BNNSLayerParametersBroadcastMatMul for a full description of this layer.
265
+ *
266
+ * @seealso BNNSLayerParametersBroadcastMatMul
267
+ *
268
+ * @param layer_params layer description
269
+ * @param filter_params Filter runtime parameters, may be NULL for default parameters
270
+ * @return A new non-NULL filter on success, and NULL on failure.
271
+ */
272
+ BNNSFilter BNNSFilterCreateLayerBroadcastMatMul(const BNNSLayerParametersBroadcastMatMul *layer_params,
273
+ const BNNSFilterParameters * _Nullable filter_params)
274
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
275
+
276
+ /*! @abstract Creates a layer representing an arbitrary tensor contraction
277
+ *
278
+ * @discussion
279
+ * For a full discussion of this layer, see BNNSLayerParametersTensorContraction.
280
+ *
281
+ * @seealso BNNSLayerParametersTensorContraction
282
+ *
283
+ * @param layer_params layer description
284
+ * @param filter_params Filter runtime parameters, may be NULL for default parameters
285
+ * @return A new non-NULL filter on success, and NULL on failure.
286
+ */
287
+ BNNSFilter BNNSFilterCreateLayerTensorContraction(const BNNSLayerParametersTensorContraction *layer_params,
288
+ const BNNSFilterParameters * _Nullable filter_params)
289
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
290
+
291
+ #if !0
292
+
293
+ /*! @abstract Create a layer representing a Gram matrix calculation
294
+ *
295
+ * @discussion
296
+ * Performs the Gram matrix calculation:
297
+ * y[ f, c ] = alpha * sum_{i,j} x[ i, j, f ] * x[ i, j, c ]
298
+ *
299
+ * @seealso BNNSLayerParametersGram
300
+ *
301
+ * @param layer_params layer description
302
+ * @param filter_params Filter runtime parameters, may be NULL for default parameters
303
+ * @return A new non-NULL filter on success, and NULL on failure.
304
+ */
305
+ BNNSFilter BNNSFilterCreateLayerGram(const BNNSLayerParametersGram *layer_params,
306
+ const BNNSFilterParameters * _Nullable filter_params)
307
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
308
+
309
+ /*! @abstract Create a layer representing a resizing in one or more dimensions
310
+ *
311
+ * @discussion See BNNSLayerParametersResize for a full description of this layer.
312
+ *
313
+ * @seealso BNNSLayerParametersResize
314
+ *
315
+ * @param layer_params layer description
316
+ * @param filter_params Filter runtime parameters, may be NULL for default parameters
317
+ * @return A new non-NULL filter on success, and NULL on failure.
318
+ */
319
+ BNNSFilter BNNSFilterCreateLayerResize(const BNNSLayerParametersResize *layer_params,
320
+ const BNNSFilterParameters * _Nullable filter_params)
321
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
322
+
323
+ /*! @abstract Create a multiheaded attention layer
324
+ *
325
+ * @discussion See BNNSLayerParametersMultiheadAttention for a full description of this layer.
326
+ *
327
+ * @seealso BNNSLayerParametersMultiheadAttention
328
+ *
329
+ * @param layer_params layer description
330
+ * @param filter_params Filter runtime parameters, may be NULL for default parameters
331
+ * @return A new non-NULL filter on success, and NULL on failure.
332
+ */
333
+ BNNSFilter BNNSFilterCreateLayerMultiheadAttention(const BNNSLayerParametersMultiheadAttention * layer_params,
334
+ const BNNSFilterParameters * _Nullable filter_params)
335
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
336
+
337
+ /*! @abstract Create a reduction layer
338
+ *
339
+ * @discussion See BNNSLayerParametersReduction for a full description of this layer.
340
+ *
341
+ * @seealso BNNSLayerParametersReduction
342
+ *
343
+ * @param layer_params layer description
344
+ * @param filter_params Filter runtime parameters, may be NULL for default parameters
345
+ * @return A new non-NULL filter on success, and NULL on failure.
346
+ */
347
+ BNNSFilter BNNSFilterCreateLayerReduction(const BNNSLayerParametersReduction * layer_params,
348
+ const BNNSFilterParameters * _Nullable filter_params)
349
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
350
+
351
+ /*!
352
+
353
+ @abstract Create a fused filter
354
+
355
+ @discussion
356
+ Create an N layer fused filter that process input in the following way: input -> filter0 -> filter1 -> ... -> filter N-1 -> output
357
+ first N-1 filters must have activation function BNNSActivationFunctionIdentity in training.
358
+ last filter may have a different activation function. gradient computation restrictions on last activation function are the same as in BNNSFilterApplyBackwardBatch.
359
+ For K between 0 and N-2, the K filter output descriptor and the K+1 filter input descriptor must have the same sizes, strides and data type.
360
+
361
+ Initial implementation support fusing 2 filters in the following configurations:
362
+ Configuration 1: Convolution -> Normalization
363
+ filter0 is convolution and filter1 is normalization. for example, the filter_type and layer_params arrays when using batchnorm should be as follows:
364
+ filter_type: [BNNSConvolution, BNNSBatchNorm]
365
+ layer_params: [pointer to BNNSLayerParametersConvolution, pointer to BNNSLayerParametersNormalization]
366
+
367
+ Configuration 2: FullyConnected -> Normalization
368
+ filter0 is fully connected and filter1 is normalization. for example, the filter_type and layer_params arrays when using batchnorm should be as follows:
369
+ filter_type: [BNNSFullyConnected, BNNSBatchNorm]
370
+ layer_params: [pointer to BNNSLayerParametersFullyConnected, pointer to BNNSLayerParametersNormalization]
371
+
372
+ Configuration 3: Transposed Convolution -> Normalization
373
+ filter0 is transposed convolution and filter1 is normalization. for example, the filter_type and layer_params arrays when using batchnorm should be as follows:
374
+ filter_type: [BNNSTransposedConvolution, BNNSBatchNorm]
375
+ layer_params: [pointer to BNNSLayerParametersConvolution, pointer to BNNSLayerParametersNormalization]
376
+
377
+ Configuration 4: Convolution -> Quantization
378
+ filter0 is convolution and filter1 is quantization. The filter_type and layer_params arrays should be as follows:
379
+ filter_type: [BNNSConvolution, BNNSQuantization]
380
+ layer_params: [pointer to BNNSLayerParametersConvolution, pointer to BNNSLayerParametersQuantization]
381
+ input and output descriptor data pointers in BNNSLayerParametersQuantization are ignored
382
+ Note that if the quantization layer uses batch as an axis with scale and/or bias, the batch size is encoded in the quantization layer parameters. In this case, if the batch size changes, the filter must be destroyed and recreated.
383
+
384
+ Configuration 5: FullyConnected -> Quantization
385
+ filter0 is fully connected and filter1 is quantization. The filter_type and layer_params arrays should be as follows:
386
+ filter_type: [BNNSFullyConnected, BNNSQuantization]
387
+ layer_params: [pointer to BNNSLayerParametersFullyConnected, pointer to BNNSLayerParametersQuantization]
388
+ input and output descriptor data pointers in BNNSLayerParametersQuantization are ignored
389
+ Note that if the quantization layer uses batch as an axis with scale and/or bias, the batch size is encoded in the quantization layer parameters. In this case, if the batch size changes, the filter must be destroyed and recreated.
390
+
391
+ Configuration 6: Transposed Convolution -> Quantization
392
+ filter0 is transposed convolution and filter1 is quantization. The filter_type and layer_params arrays should be as follows:
393
+ filter_type: [BNNSTransposedConvolution, BNNSQuantization]
394
+ layer_params: [pointer to BNNSLayerParametersConvolution, pointer to BNNSLayerParametersQuantization]
395
+ input and output descriptor data pointers in BNNSLayerParametersQuantization are ignored
396
+ Note that if the quantization layer uses batch as an axis with scale and/or bias, the batch size is encoded in the quantization layer parameters. In this case, if the batch size changes, the filter must be destroyed and recreated.
397
+
398
+ Configuration 7: Arithmetic -> Normalization
399
+ filter0 is arithmetic and filter1 is normalization. for example, the filter_type and layer_params arrays when using batchnorm should be as follows:
400
+ filter_type: [BNNSArithmetic, BNNSBatchNorm]
401
+ layer_params: [pointer to BNNSLayerParametersArithmetic, pointer to BNNSLayerParametersNormalization]
402
+
403
+ @param number_of_fused_filters number of filters to fuse
404
+ @param filter_type pointer to an array of filter type, array size must be number_of_fused_filters
405
+ @param layer_params pointer to an array of layer parameter pointers. layer_params array size must be number_of_fused_filters
406
+ every layer parameter structure must be valid and match the type specified in filter_type array, such that layer parameter at index i of layer_params can be used to create a stand-alone filter of the type specified by the filter type in filter_type array at index i.
407
+ @param filter_params Filter runtime parameters, may be NULL for default parameters.
408
+
409
+ @return A new non-NULL filter on success, and NULL on failure.
410
+
411
+ */
412
+ BNNSFilter BNNSFilterCreateFusedLayer(const size_t number_of_fused_filters,
413
+ const BNNSFilterType * filter_type,
414
+ const void *_Nonnull *_Nonnull layer_params,
415
+ const BNNSFilterParameters * _Nullable filter_params)
416
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
417
+
418
+ /*! @abstract Create an embedding layer
419
+ *
420
+ * @discussion
421
+ * See the description of BNNSLayerParametersEmbedding for a full explanation of this layer.
422
+ *
423
+ * @seealso BNNSLayerParametersEmbedding
424
+ *
425
+ * @param layer_params layer description
426
+ * @param filter_params Filter runtime parameters, may be NULL for default parameters
427
+ * @return A new non-NULL filter on success, and NULL on failure.
428
+ */
429
+ BNNSFilter BNNSFilterCreateLayerEmbedding(const BNNSLayerParametersEmbedding * layer_params,
430
+ const BNNSFilterParameters * _Nullable filter_params)
431
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(12.0, 15.0), ios(15.0, 18.0), watchos(8.0, 11.0), tvos(15.0, 18.0));
432
+
433
+ #endif
434
+
435
+ #pragma mark - Inference
436
+
437
+ /*!
438
+ @abstract Apply a filter
439
+
440
+ @param filter Filter to apply
441
+ @param in Pointer to the input data
442
+ @param out Pointer to the output data
443
+
444
+ @return 0 on success, and -1 on failure.
445
+ */
446
+ int BNNSFilterApply(BNNSFilter filter, const void * in, void * out)
447
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(10.12, 15.0), ios(10.0, 18.0), watchos(3.0, 11.0), tvos(10.0, 18.0));
448
+
449
+ /*!
450
+
451
+ @abstract Apply a filter to several pairs of (input, output) data
452
+
453
+ @discussion
454
+ The filter is applied for each of the <tt>batch_size</tt> inputs, and produces <tt>batch_size</tt> outputs.
455
+ <tt>in</tt> (resp. <tt>out</tt>) is expected to point to <tt>batch_size</tt> times the input (resp. output) object size defined when the filter was created.
456
+
457
+ @param filter Filter to apply
458
+ @param batch_size Number of (input, output) pairs to process
459
+ @param in Pointer to the input data
460
+ @param in_stride Increment (in values) between inputs
461
+ @param out Pointer to the output data
462
+ @param out_stride Increment (in values) between outputs
463
+
464
+ @return 0 on success, and -1 on failure.
465
+
466
+ */
467
+
468
+ int BNNSFilterApplyBatch(BNNSFilter filter,
469
+ size_t batch_size,
470
+ const void * in,
471
+ size_t in_stride,
472
+ void * out,
473
+ size_t out_stride)
474
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(10.12, 15.0), ios(10.0, 18.0), watchos(3.0, 11.0), tvos(10.0, 18.0));
475
+
476
+ #if !0
477
+
478
+ /*!
479
+ @abstract Applies a previously created pooling layer filter
480
+
481
+ @discussion
482
+ Pooling layer filter is applied for each of the batch_size inputs, and produces batch_size outputs. indices is optional.
483
+ in (resp. out) is expected to point to batch_size times the input (resp. output) object size defined when the filter was created.
484
+ indices has the same size as output if not null.
485
+
486
+ @param filter Filter to apply
487
+ @param batch_size Number of (input, output, indices) to process
488
+ @param in Pointer to the input data
489
+ @param in_stride Increment (in values) between inputs
490
+ @param out Pointer to the output data
491
+ @param out_stride Increment (in values) between outputs
492
+ @param indices Pointer to the indices data generated by max pooling.
493
+ - max pooling produces indices if not null. indices must have the same dimension and stride as the output data.
494
+ - max unpooling requires a valid pointer. indices must have the same dimension and stride as the input data.
495
+ - ignored for other pooling functions
496
+ @param idx_stride Increment (in values) between indices
497
+ */
498
+ int BNNSPoolingFilterApplyBatch(BNNSFilter filter, size_t batch_size,
499
+ const void * _Nonnull in, size_t in_stride,
500
+ void * _Nonnull out, size_t out_stride,
501
+ size_t * _Nullable indices, size_t idx_stride)
502
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
503
+
504
+ /*!
505
+ @abstract Applies a previously created pooling layer filter, supporting multiple index data types
506
+
507
+ @discussion
508
+ The only difference between this function and BNNSPoolingFilterApplyBatch is that
509
+ BNNSPoolingFilterApplyBatch requires indices to be size_t,
510
+ while BNNSPoolingFilterApplyBatchEx allows indices to have various types.
511
+ Currently, only uint64_t and uint32_t are allowed for indices.
512
+
513
+ @param filter Filter to apply
514
+ @param batch_size Number of (input, output, indices) to process
515
+ @param in Pointer to the input data
516
+ @param in_stride Increment (in values) between inputs
517
+ @param out Pointer to the output data
518
+ @param out_stride Increment (in values) between outputs
519
+ @param indices Pointer to the indices data generated by max pooling.
520
+ - max pooling produces indices if not null. indices must have the same dimension and stride as the output data.
521
+ - max unpooling requires a valid pointer. indices must have the same dimension and stride as the input data.
522
+ - ignored for other pooling functions
523
+ @param idx_stride Increment (in values) between indices
524
+ */
525
+ int BNNSPoolingFilterApplyBatchEx(BNNSFilter filter, size_t batch_size,
526
+ const void * _Nonnull in, size_t in_stride,
527
+ void * _Nonnull out, size_t out_stride,
528
+ const BNNSDataType indices_data_type, void * _Nullable indices, size_t idx_stride)
529
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
530
+
531
+ #endif
532
+
533
+ /*!
534
+
535
+ @abstract Apply a filter
536
+
537
+ @param filter Filter to apply
538
+ @param inA Pointer to the first input tensor
539
+ @param inB Pointer to the second input tensor
540
+ @param out Pointer to the output data
541
+
542
+ @return 0 on success, and -1 on failure.
543
+ */
544
+ int BNNSFilterApplyTwoInput(BNNSFilter filter,
545
+ const void * inA,
546
+ const void * inB,
547
+ void * out)
548
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
549
+
550
+ /*!
551
+
552
+ @abstract Apply a filter to a several pairs of (input, output) data
553
+
554
+ @discussion
555
+ The filter is applied for each of the <tt>batch_size</tt> inputs, and produces <tt>batch_size</tt> outputs.
556
+ <tt>in</tt> (resp. <tt>out</tt>) is expected to point to <tt>batch_size</tt> times the input (resp. output) object size defined when the filter was created.
557
+
558
+ @param filter Filter to apply
559
+ @param batch_size Number of (input, output) pairs to process
560
+ @param inA Pointer to the first input tensor
561
+ @param inA_stride Increment (in values) between inputs in the first tensor
562
+ @param inB Pointer to the second input tensor
563
+ @param inB_stride Increment (in values) between inputs in the second tensor
564
+ @param out Pointer to the output data
565
+ @param out_stride Increment (in values) between outputs
566
+
567
+ @return 0 on success, and -1 on failure.
568
+
569
+ */
570
+ int BNNSFilterApplyTwoInputBatch(BNNSFilter filter,
571
+ size_t batch_size,
572
+ const void * inA,
573
+ size_t inA_stride,
574
+ const void * inB,
575
+ size_t inB_stride,
576
+ void * out,
577
+ size_t out_stride)
578
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
579
+
580
+ #if !0
581
+
582
+ /*!
583
+
584
+ @abstract Apply a normalization filter to several pairs of (input, output) data
585
+
586
+ @discussion
587
+ The filter is applied for each of the <tt>batch_size</tt> inputs, and produces <tt>batch_size</tt> outputs.
588
+ <tt>in</tt> (resp. <tt>out</tt>) is expected to point to <tt>batch_size</tt> times the input (resp. output) object size defined when the filter was created.
589
+
590
+ Normalization filter supports two different modes - training and inference.
591
+ In training mode, only current batch/instance/layer/group statistics are used to normalize the input.
592
+ In addition, training mode may store information internally to be used during backward computation.
593
+ For batch norm and instance norm, moving mean and moving variance are computed during training
594
+ so they can be later used during inference, ignored if null.
595
+ For layer norm and group norm, moving mean and moving variance are not supported and ignored.
596
+
597
+ For batch norm and instance norm, moving mean and moving variance are used to normalize the input during inference if not null.
598
+ Otherwise, current batch/instance/layer/group statistics are used to normalize the input.
599
+
600
+ output address equal to input address (in-place) is supported for both training and inference
601
+
602
+ @param filter Filter to apply
603
+ @param batch_size Number of (input, output) pairs to process
604
+ @param in Pointer to the input data
605
+ @param in_stride Increment (in values) between inputs
606
+ @param out Pointer to the output data
607
+ @param out_stride Increment (in values) between outputs
608
+ @param training true if training, false if inference
609
+
610
+ @return 0 on success, and -1 on failure.
611
+
612
+ */
613
+
614
+ int BNNSNormalizationFilterApplyBatch(BNNSFilter filter,
615
+ size_t batch_size,
616
+ const void * in,
617
+ size_t in_stride,
618
+ void * out,
619
+ size_t out_stride,
620
+ bool training)
621
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
622
+
623
+ /*!
624
+
625
+ @abstract Apply a fused filter to several pairs of (input, output) data
626
+
627
+ @discussion
628
+ The filter is applied for each of the <tt>batch_size</tt> inputs, and produces <tt>batch_size</tt> outputs.
629
+ <tt>in</tt> (resp. <tt>out</tt>) is expected to point to <tt>batch_size</tt> times the input (resp. output) object size defined when the filter was created.
630
+
631
+ @param filter Filter to apply
632
+ @param batch_size Number of (input, output) pairs to process
633
+ @param in Pointer to the input data
634
+ @param in_stride Increment (in values) between inputs
635
+ @param out Pointer to the output data
636
+ @param out_stride Increment (in values) between outputs
637
+ @param training true if training, false if inference
638
+ -ignored if none of the filters is batchnorm
639
+ -see training flag information in BNNSNormalizationFilterApplyBatch
640
+
641
+ @return 0 on success, and -1 on failure.
642
+
643
+ */
644
+
645
+ int BNNSFusedFilterApplyBatch(BNNSFilter filter,
646
+ size_t batch_size,
647
+ const void * in,
648
+ size_t in_stride,
649
+ void * out,
650
+ size_t out_stride,
651
+ bool training)
652
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
653
+
654
+ /*!
655
+
656
+ @abstract Apply a fused filter to several pairs of (input set, output) data
657
+
658
+ @discussion
659
+ The filter is applied for each of the <tt>batch_size</tt> input set, and produces <tt>batch_size</tt> outputs.
660
+ <tt>in</tt> (resp. <tt>out</tt>) is expected to point to <tt>batch_size</tt> times the input (resp. output) object size defined when the filter was created.
661
+
662
+ Currently only fused arithmetic -> normalization configuration is supported.
663
+
664
+ @param filter Filter to apply
665
+ @param batch_size Number of (input sets, output) pairs to process
666
+ @param number_of_inputs number of inputs for the arithmetic operation
667
+ @param in pointer to an array of input pointers. in array size must be number_of_inputs.
668
+ @param in_stride pointer to an array of input strides, each stride is an Increment (in values) between inputs in the batch for a corresponding input in the in array.
669
+ @param out Pointer to the output data
670
+ @param out_stride Increment (in values) between outputs
671
+ @param training true if training, false if inference
672
+ -ignored if none of the filters is batchnorm
673
+ -see training flag information in BNNSNormalizationFilterApplyBatch
674
+
675
+ @return 0 on success, and -1 on failure.
676
+
677
+ */
678
+
679
+ int BNNSFusedFilterApplyMultiInputBatch(BNNSFilter filter,
680
+ size_t batch_size,
681
+ size_t number_of_inputs,
682
+ const void * _Nonnull * _Nonnull in,
683
+ const size_t *_Nonnull in_stride,
684
+ void * _Nonnull out,
685
+ size_t out_stride,
686
+ bool training)
687
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(12.0, 15.0), ios(15.0, 18.0), watchos(8.0, 11.0), tvos(15.0, 18.0));
688
+
689
+ #endif
690
+
691
+ /*!
692
+
693
+ @abstract Apply an arithmetic filter to several pairs of (input set, output) data
694
+
695
+ @discussion
696
+ an input set is composed of the inputs necessary to compute a given arithmetic operation.
697
+
698
+ The filter is applied for each of the <tt>batch_size</tt> inputs, and produces <tt>batch_size</tt> outputs.
699
+ <tt>batch_size</tt> is ignored for an input or output if its type is BNNSConstant or BNNSParameter.
700
+
701
+ <tt>in</tt> is expected to point to an array of arithmetic operation inputs as required by the given arithmetic operation.
702
+ Inputs and output must have the same data layout. Input support broadcasting such that two descriptors are compatible if for every dimension descriptors sizes are equal or one of them is 1.
703
+ for example, a valid addition operation could have input1 size [1,3,4], input2 size [2,3,1] and output size [2,3,4]
704
+ unless specified otherwise, each input size should be equal to output size or be broadcast compatible.
705
+ inputs are allowed to point to a common address (same input), in which case gradients in backward compute must also point to a common address (same gradient).
706
+
707
+ for example, an addition arithmetic operation require two inputs, and therefore the in array size and the in_stride array size is 2.
708
+ each pointer in the in array should point to a valid input.
709
+ in case input1, input2 and output types are all BNNSSample, the output for each output sample in the batch will be the addition of the corresponding batch sample in input1 and in input2.
710
+ if output and input1 are BNNSSample and input2 is BNNSConstant or BNNSParameter, the output for each output sample in the batch will be the addition of the corresponding batch sample in input1 and input2 where batch is ignored for input2.
711
+
712
+ Some arithmetic functions support in-place processing for forward and backward apply operations. That is the input and output (or output_delta and input_delta) may use the same pointer and descriptor in order to save memory (if the layer has multiple inputs, the user may choose which to use in-place).
713
+ The input data is destroyed in the process, thus care must be taken during the forward pass to ensure all required inputs to the backward pass are preserved (noting that this layer’s input is normally the preceding layer’s output).
714
+ In addition, descriptors for input being processed in-place and output must exactly match. in-place descriptor types must also match in case batch size > 1.
715
+
716
+ @param filter Filter to apply
717
+ @param batch_size Number of (input sets, output) pairs to process
718
+ @param number_of_inputs number of inputs for the arithmetic operation
719
+ @param in pointer to an array of input pointers. in array size must be number_of_inputs.
720
+ @param in_stride pointer to an array of input strides, each stride is an Increment (in values) between inputs in the batch for a corresponding input in the in array.
721
+ @param out Pointer to the output data
722
+ @param out_stride Increment (in values) between outputs
723
+
724
+ @return 0 on success, and -1 on failure.
725
+
726
+ */
727
+ int BNNSArithmeticFilterApplyBatch(BNNSFilter filter,
728
+ size_t batch_size,
729
+ size_t number_of_inputs,
730
+ const void *_Nonnull *_Nonnull in,
731
+ const size_t * in_stride,
732
+ void * out,
733
+ size_t out_stride)
734
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
735
+
736
+ #if !0
737
+
738
+ /*! @abstract Applies a previously created multihead attention layer
739
+ *
740
+ * @discussion
741
+ * When training, the backward pass can be accelerated by caching intermediate values from the forward pass.
742
+ * This is done by providing a memory buffer backprop_cache. The recommended size for this buffer may be obtained by calling
743
+ * the function with the pointer backprop_cache_size set to non-NULL, and backprop_cache set to NULL. The recommended size
744
+ * will be stored in *backprop_cache_size (the layer application will not be perfomed).
745
+ * The user may optionally provide a scratch workspace. The required size will depend the size of backprop_cache provided, and
746
+ * if no scratch workspace is provided one will be allocated internally. The size of required workspace can be obtained by calling
747
+ * the routine with a non-NULL workspace_size parameter and a NULL workspace pointer, and the required size will be returned
748
+ * in *workspace_size (the layer application will not be perfomed).
749
+ * If both backprop_cache_size and workspace_size are queried simulateneously, the returned workspace size will assume that
750
+ * the full backprop_cache_size is provided.
751
+ *
752
+ * @param F Filter to apply created by a previous call to BNNSFilterCreateLayerMultiheadAttention()
753
+ * @param batch_size Number of inputs in batch
754
+ * @param query Pointer to data for query input matrix, layout as described by layer_params->query.target_desc
755
+ * @param query_stride Batch stride for query
756
+ * @param key Pointer to data for key input matrix, layout as described by layer_params->key.target_desc
757
+ * @param key_stride Batch stride for key
758
+ * @param key_mask Mask applied to key for ignoring entries. A 1D tensor of type BNNSDataTypeBoolean and shape
759
+ * source_length. Where this tensor evalautes to true, the corresponding elements of the key matrix are
760
+ * ignored in the attention operation. No key mask is applied if NULL is passed.
761
+ * @param key_mask_stride Batch stride for key_mask
762
+ * @param value Pointer to data for value input matrix, layout as described by layer_params->value.target_desc
763
+ * @param value_stride Batch stride for value
764
+ * @param output Pointer to data for output matrix, layout as described by layer_params->output.target_desc
765
+ * @param output_stride Batch stride for output
766
+ * @param add_to_attention Optional, one of:
767
+ * 1) a 2D tensor of shape target_length x source_length; or
768
+ * 2) a 3D tensor of shape num_heads x target_length x source_length; or
769
+ * 3) a 4D tensor of shape batch_size x num_heads x target_length x source_length.
770
+ * This is used as part of the mask function prior to softmax in the attention calculation (the matrix X in the layer description).
771
+ * If the data type is BNNSDataTypeBoolean, true is treated as adding -inf, and false as adding zero (that is to say attention
772
+ * is not permitted in locations indicated by the the mask).
773
+ * No matrix is added if this pointer is NULL.
774
+ * Note: The 3D, 4D and BNNSDataTypeBoolean variants of this parameter are only supported in macOS 12.0, iOS 15.0,
775
+ * watchOS 8.0, tvOS 15.0 and later.
776
+ * @param backprop_cache_size Specifies the size of the array backprop_cache, in bytes.
777
+ * If backprop_cache_size is not-NULL but backprop_cache is NULL, the recommended size for backprop_cache_size
778
+ * will be set, but not other calculations will be performed (except to set workspace_size if requested).
779
+ * @param backprop_cache Is used to store intermediate results that can be used to accelerate a future call to
780
+ * BNNSApplyMultiheadAttentionBackward.
781
+ * @param workspace_size Specifies the size of the array workspace, in bytes.
782
+ * If workspace_size is not-NULL but workspace is NULL, the recommended size for workspace_size
783
+ * will be set, but not other calculations will be performed (except to set backprop_cache_size if requested).
784
+ * @param workspace Is used as a scratch buffer during the calculation.
785
+ */
786
+ int BNNSApplyMultiheadAttention(BNNSFilter F, size_t batch_size,
787
+ void const* query, size_t query_stride,
788
+ void const* key, size_t key_stride,
789
+ BNNSNDArrayDescriptor const* _Nullable key_mask, size_t key_mask_stride,
790
+ void const* value, size_t value_stride,
791
+ void *output, size_t output_stride,
792
+ BNNSNDArrayDescriptor const* _Nullable add_to_attention,
793
+ size_t * _Nullable backprop_cache_size, void * _Nullable backprop_cache,
794
+ size_t * _Nullable workspace_size, void * _Nullable workspace)
795
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
796
+
797
+ /*!
798
+ @abstract Direct Apply a Quantization filter
799
+
800
+ @discussion
801
+ The Quantization layer converts higher precision tensors to lower precision tensors (Quantize) or lower precision tensors to higher precision tensors (Dequantize)
802
+
803
+ @param layer_params Quantizer layer parameters
804
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
805
+ @param batch_size Number of (input, output) pairs to process
806
+ @param input_stride Increment (in values) between inputs
807
+ @param output_stride Increment (in values) between outputs
808
+ @return Zero on success, nonzero on failure.
809
+ */
810
+ int BNNSDirectApplyQuantizer(const BNNSLayerParametersQuantization * layer_params,
811
+ const BNNSFilterParameters * _Nullable filter_params,
812
+ size_t batch_size,
813
+ size_t input_stride,
814
+ size_t output_stride)
815
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(12.0, 15.0), ios(15.0, 18.0), watchos(8.0, 11.0), tvos(15.0, 18.0));
816
+
817
+ #endif
818
+
819
+ #pragma mark - Filter destruction
820
+
821
+ /*!
822
+
823
+ @abstract Destroy filter
824
+
825
+ @discussion Releases all resources allocated for this filter.
826
+
827
+ @param filter Filter to destroy
828
+
829
+ */
830
+ void BNNSFilterDestroy(BNNSFilter filter)
831
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(10.12, 15.0), ios(10.0, 18.0), watchos(3.0, 11.0), tvos(10.0, 18.0));
832
+
833
+ #pragma mark - Training
834
+
835
+ #if !0
836
+
837
+ /*!
838
+
839
+ @abstract Apply a single step of optimization to one or more parameters
840
+
841
+ @discussion
842
+ The optimizer will use the specified optimization algorithm to update a set of parameters such as weights and bias.
843
+ Data layout in memory of parameters, gradients and accumulators arrays must be contiguous, such that stride[0]=1 and for every N>0 stride[N]=stride[N-1]*size[N-1]. strides in the descriptors may be provided as zeros.
844
+ accumulators must be allocated by caller and have the same size as a matching parameter. accumulator descriptor data must be set to zero the first time the filter is applied.
845
+ OptimizerAlgFields pointer is saved internally, changes to the struct fields such as learning_rate for BNNSOptimizerSGDMomentumFields structure are allowed between filter apply calls.
846
+
847
+ Accumulator requirements depend on the optimzation algorithm and its parameters:
848
+
849
+ BNNSOptimzerFunctionSGDMomentum
850
+ ===============================
851
+ Set to NULL for vanilla SGD (indicating momentum is 0).
852
+ Set to a size number_of_parameters array if use of momentum is desired.
853
+
854
+ BNNSOptimizerFunctionAdam
855
+ =======================
856
+ Set to a size 2*number_of_parameters array.
857
+ The first number_of_parameters pointers are used for the first momentum descriptors, and the subsequent number_of_parameters pointers are used for the second momentum descriptors.
858
+
859
+ BNNSOptimizerFunctionAdamAMSGrad
860
+ ===============================
861
+ Set to a size 3*number_of_parameters array.
862
+ The first number_of_parameters pointers are used for the first momentum descriptors, the second number_of_parameters pointers are used for the second momentum descriptors, and the third number_of_parameters pointers are used for the second momentum maxima descriptors.
863
+
864
+ BNNSOptimizerFunctionAdamW
865
+ ========================
866
+ Set to a size 2*number_of_parameters array.
867
+ The first number_of_parameters pointers are used for the first momentum descriptors, and the subsequent number_of_parameters ointers are used for the second momentum descriptors.
868
+
869
+ BNNSOptimizerFunctionAdamWAMSGrad
870
+ ===============================
871
+ Set to a size 3*number_of_parameters array.
872
+ The first number_of_parameters pointers are used for the first momentum descriptors, the second number_of_parameters pointers are used for the second momentum descriptors, and the third number_of_parameters pointers are used for the second momentum maxima descriptors.
873
+
874
+ BNNSOptimizerFunctionRMSProp
875
+ ==========================
876
+ Should be of size k*number_of_parameters, where
877
+ k = 1 + (OptimizerAlgFields.centered ? 1 : 0) + (OptimizerAlgFields.momentum != 0.0).
878
+ That is to say a base of one accumulator per parameter, with one extra accumulator required for each of centering and momentum if they are enabled.
879
+ Using the notation used in the description of BNNSOptimizerRMSPropFields, the first number_of_parameters pointers are used for n_i, the next
880
+ set are used for g_i (iff centering is used) and the next set are used for the momentum Δ_i (iff momentum γ != 0.0).
881
+
882
+ @param function Optimization function (algorithm) to use
883
+ @param OptimizerAlgFields Parameters for optimization function, pointer to a struct whose type is determined by the value of function.
884
+ @param number_of_parameters number of parameters to update
885
+ @param parameters array of parameter descriptors
886
+ @param gradients array of gradient descriptors. Each gradient descriptor data in the array must be the same size as its matching parameter descriptor in the parameters array.
887
+ @param accumulators array of accumulator descriptors. Required number of accumulators varies depending on optimization algorithm and parameters - see function description. In all cases, accumulators must be allocated and initialized to zero by the user prior to the first call optimization step.
888
+ @param filter_params Filter runtime parameters, may be NULL for default parameters.
889
+
890
+ @returns 0 on success, nonzero on failure
891
+ */
892
+ int BNNSOptimizerStep(BNNSOptimizerFunction function, const void *OptimizerAlgFields,
893
+ size_t number_of_parameters,
894
+ BNNSNDArrayDescriptor *_Nonnull *_Nonnull parameters,
895
+ const BNNSNDArrayDescriptor *_Nonnull *_Nonnull gradients,
896
+ BNNSNDArrayDescriptor * _Nullable * _Nullable accumulators,
897
+ const BNNSFilterParameters * _Nullable filter_params)
898
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
899
+
900
+ /*!
901
+
902
+ @abstract Clip tensor values to a specified min and max
903
+
904
+ @discussion
905
+ Given a tensor src, this operation writes to a tensor dest of the same type and shape as src with its values clipped to min_val and max_val.
906
+
907
+ @param dest descriptor for the destination tensor
908
+ @param src descriptor for the source tensor, must be of the same type and shape as the dest descriptor.
909
+ @param min_val The minimum value.
910
+ @param max_val The maximum value.
911
+
912
+ @returns 0 on success, nonzero on failure
913
+ */
914
+ int BNNSClipByValue(BNNSNDArrayDescriptor * _Nonnull dest,
915
+ const BNNSNDArrayDescriptor * _Nonnull src,
916
+ float min_val, float max_val)
917
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(12.0, 15.0), ios(15.0, 18.0), watchos(8.0, 11.0), tvos(15.0, 18.0));
918
+
919
+ /*!
920
+
921
+ @abstract Clip tensor values to a maximum L2-norm.
922
+
923
+ @discussion
924
+ Given a tensor src, this operation writes to a tensor dest of the same type and shape as src with its values clipped such that the L2-norm does not
925
+ exceed max_norm.
926
+
927
+ @param dest descriptor for the destination tensor
928
+ @param src descriptor for the source tensor, must be of the same type and shape as the dest descriptor.
929
+ @param max_norm The maximum L2-norm.
930
+ @param axis_flags The dimensions to use for computing the L2-norm. If 0, uses all dimensions.
931
+
932
+ @returns 0 on success, nonzero on failure
933
+ */
934
+ int BNNSClipByNorm(BNNSNDArrayDescriptor * _Nonnull dest,
935
+ const BNNSNDArrayDescriptor * _Nonnull src,
936
+ float max_norm,
937
+ uint32_t axis_flags)
938
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(12.0, 15.0), ios(15.0, 18.0), watchos(8.0, 11.0), tvos(15.0, 18.0));
939
+
940
+ /*!
941
+
942
+ @abstract Clip values of a list of tensors by a maximum global L2-norm.
943
+
944
+ @discussion
945
+ Given a list of tensors src, and a maximum global L2-norm, max_norm, this operation computes a list of clipped tensors.
946
+ If you already know the global norm of src, you can specify the global norm to use with use_norm.
947
+
948
+ @param dest array of destination tensor descriptors
949
+ @param src array of source tensor descriptors. Each descriptor data in the array must be the same size as its matching dest descriptor in the dest array.
950
+ @param count number of descriptors in the dest and src arrays
951
+ @param max_norm maximum global L2-norm
952
+ @param use_norm The global norm to use. If zero, global norm is computed based on src.
953
+
954
+ @returns 0 on success, nonzero on failure
955
+ */
956
+ int BNNSClipByGlobalNorm(BNNSNDArrayDescriptor * _Nonnull * _Nonnull dest,
957
+ const BNNSNDArrayDescriptor * _Nonnull * _Nonnull src,
958
+ size_t count,
959
+ float max_norm,
960
+ float use_norm)
961
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(12.0, 15.0), ios(15.0, 18.0), watchos(8.0, 11.0), tvos(15.0, 18.0));
962
+
963
+ /*!
964
+
965
+ @abstract Compute the norm of the input tensor.
966
+
967
+ @discussion
968
+ Given a tensor src, this operation compute its specified norm along the specified axes.
969
+
970
+ @param dest descriptor for the destination tensor. The dimensions in axis_flags are removed from the destination shape.
971
+ If axis_flags specifies all dimensions, destination descriptor must be BNNSDataLayoutVector with size[0] = 1.
972
+ @param src descriptor for the source tensor.
973
+ @param norm_type Type of the norm. Currently only L2-norm is supported.
974
+ @param axis_flags The dimensions to use for computing the L2-norm. If 0, uses all dimensions.
975
+
976
+ @returns 0 on success, nonzero on failure
977
+ */
978
+ int BNNSComputeNorm(BNNSNDArrayDescriptor * _Nonnull dest,
979
+ const BNNSNDArrayDescriptor * _Nonnull src,
980
+ BNNSNormType norm_type,
981
+ uint32_t axis_flags)
982
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(12.0, 15.0), ios(15.0, 18.0), watchos(8.0, 11.0), tvos(15.0, 18.0));
983
+
984
+ /*!
985
+
986
+ @abstract Backward path of norm computation to generate input delta.
987
+
988
+ @discussion
989
+ The backward computation uses the output delta (dy) and the forward pass input (x) and output (y) to generate the input delta (dx).
990
+
991
+ @param in Pointer to the forward pass input data
992
+ @param in_delta Pointer to the input delta descriptor
993
+ @param out Pointer to the forward pass output data
994
+ @param out_delta Pointer to the output delta descriptor
995
+ @param norm_type Type of the norm. Currently only L2-norm is supported.
996
+ @param axis_flags The dimensions to use for computing the L2-norm. If 0, uses all dimensions.
997
+
998
+ @returns 0 on success, nonzero on failure
999
+ */
1000
+ int BNNSComputeNormBackward(const void * _Nonnull in,
1001
+ BNNSNDArrayDescriptor * _Nonnull in_delta,
1002
+ const void * _Nonnull out,
1003
+ const BNNSNDArrayDescriptor * _Nonnull out_delta,
1004
+ BNNSNormType norm_type,
1005
+ uint32_t axis_flags)
1006
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(12.0, 15.0), ios(15.0, 18.0), watchos(8.0, 11.0), tvos(15.0, 18.0));
1007
+
1008
+ /*!
1009
+
1010
+ @abstract Apply filter backward to generate input delta, weights delta and bias delta
1011
+
1012
+ @discussion
1013
+ For a general filter f that computes output y by using weights w and bias b
1014
+ The forward pass filter computation can be described as:
1015
+ y = f(x,w,b)
1016
+ for example, the output y of a convolution filter f can be described as
1017
+ y = f(x,w,b) = w*x+b
1018
+
1019
+ The backward computation uses the output delta (dy) to generate the input delta (dx), weight delta (dw) and bias delta (db)
1020
+ In some cases the backward computation function also requires the forward pass input (x) and the forward pass output (y).
1021
+
1022
+ The following arguments are required for the backward computation:
1023
+ out_delta descriptor (dy) are the gradients arriving from the following filter and must be provided.
1024
+ in pointer is the forward pass input (x) and should be provided if not specified it is ignored
1025
+ out pointer is the forward pass output (y) and should be provided if not specified it is ignored
1026
+
1027
+ For dropout processing, it only needs delta of input/output, and the result is independent of forward input/output. So backward apply will ignore input/output.
1028
+
1029
+ The following gradients are generated by the backward computation.
1030
+ in_delta - the input delta (dx)
1031
+ weights_delta - the weight delta (dw)
1032
+ bias_delta - the bias delta (db)
1033
+ NULL descriptor pointers will not be computed. data field of a valid descriptor must point to the delta buffer to be produced.
1034
+
1035
+ Important activation information:
1036
+ For any general activation function, when computing activation layer backward, the forward pass input (x) to the activation is required.
1037
+ However, in most activation functions, it is possible and faster to compute the activation backward from the forward pass output y.
1038
+ In the case of fused computation and activation layers, it is mandatory to provide the forward pass output y.
1039
+ Notice that some activation functions cannot be fused with the computation filters.
1040
+
1041
+ Activation backward functions that can accept either forward pass input or forward pass output (output is prefered):
1042
+ BNNSActivationFunctionIdentity
1043
+ BNNSActivationFunctionRectifiedLinear
1044
+ BNNSActivationFunctionLeakyRectifiedLinear (if alpha > 0.0 and weights_delta is not present)
1045
+ BNNSActivationFunctionSigmoid
1046
+ BNNSActivationFunctionLogSigmoid
1047
+ BNNSActivationFunctionTanh
1048
+ BNNSActivationFunctionLinear
1049
+ BNNSActivationFunctionClamp
1050
+ BNNSActivationFunctionSoftmax
1051
+ BNNSActivationFunctionHardSigmoid
1052
+ BNNSActivationFunctionSoftplus
1053
+ BNNSActivationFunctionSoftsign
1054
+ BNNSActivationFunctionELU
1055
+ BNNSActivationFunctionSELU
1056
+ BNNSActivationFunctionCELU
1057
+ BNNSActivationFunctionClampedLeakyRectifiedLinear (if alpha > 0.0)
1058
+ BNNSActivationFunctionLinearWithBias
1059
+ BNNSActivationFunctionLogSoftmax
1060
+ BNNSActivationFunctionHardShrink
1061
+ BNNSActivationFunctionSoftShrink
1062
+ BNNSActivationFunctionTanhShrink
1063
+ BNNSActivationFunctionThreshold
1064
+ BNNSActivationFunctionGELUApproximationSigmoid
1065
+
1066
+ The activation functions above can be fused with computation in training, only if the forward pass output y is provided in backward apply.
1067
+
1068
+ Other activation functions require forward pass input and does not support fusing computation with activation, such as:
1069
+ BNNSActivationFunctionAbs
1070
+ BNNSActivationFunctionGELUApproximation
1071
+ BNNSActivationFunctionGELUApproximation2
1072
+ BNNSActivationFunctionSiLU
1073
+
1074
+ Additional requirements:
1075
+ BNNSFlagsUseClientPtr flag must be enabled when creating the filter.
1076
+ data_type of all descriptors must be BNNSDataTypeFloat32.
1077
+
1078
+ @param filter Filter to apply backward
1079
+ @param batch_size Number of (input, output) pairs to process
1080
+ @param in Pointer to the forward pass input data (x)
1081
+ - ignored when computing input delta and bias delta unless filter is pooling or filter is activation and backpropagation from output is supported.
1082
+ @param in_stride Increment (in values) between inputs
1083
+ - ignored when computing input delta or bias delta if the filter is not pooling
1084
+ @param in_delta Pointer to the input delta descriptor
1085
+ - not produced if null
1086
+ @param in_delta_stride Increment (in values) between input deltas
1087
+ @param out Pointer to the forward pass output data (y)
1088
+ - out is ignored in all filters if activation is BNNSActivationFunctionIdentity
1089
+ - some activation function backward computation can run faster if provided with the forward output
1090
+ - fused computation and activation filters such as convolution with activation must provide the forward pass output
1091
+ @param out_stride Increment (in values) between outputs
1092
+ @param out_delta Pointer to the output delta descriptor (dy)
1093
+ @param out_delta_stride Increment (in values) between output deltas
1094
+ @param weights_delta Pointer to the weights delta descriptor
1095
+ - delta is aggregated across batch
1096
+ - not produced if null
1097
+ - computed weights_delta layout will match the filter weight layout that was provided at the creation of the filter
1098
+ @param bias_delta Pointer to the bias delta descriptor
1099
+ - not produced if null
1100
+ @return 0 on success, and -1 on failure.
1101
+ */
1102
+ int BNNSFilterApplyBackwardBatch(BNNSFilter filter,
1103
+ size_t batch_size,
1104
+ const void * _Nullable in,
1105
+ size_t in_stride,
1106
+ BNNSNDArrayDescriptor * _Nullable in_delta,
1107
+ size_t in_delta_stride,
1108
+ const void * _Nullable out,
1109
+ size_t out_stride,
1110
+ const BNNSNDArrayDescriptor * out_delta,
1111
+ size_t out_delta_stride,
1112
+ BNNSNDArrayDescriptor * _Nullable weights_delta,
1113
+ BNNSNDArrayDescriptor * _Nullable bias_delta)
1114
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1115
+
1116
+ /*!
1117
+
1118
+ @abstract Apply pooling filter backward to generate input delta and bias delta
1119
+
1120
+ @discussion
1121
+ This is similar to BNNSFilterApplyBackwardBatch, but takes indices as an optional input.
1122
+ It is mandatory to compute all active gradients in a single function call. computation of input delta is not required in case the filter is the first layer in the network
1123
+
1124
+ @param filter Filter to apply backward
1125
+ @param batch_size Number of (input, output, indices) to process
1126
+ @param in Pointer to the forward pass input data (x)
1127
+ @param in_stride Increment (in values) between inputs
1128
+ @param in_delta Pointer to the input delta descriptor
1129
+ - not produced if null
1130
+ @param in_delta_stride Increment (in values) between input deltas
1131
+ @param out Pointer to the forward pass output data (y)
1132
+ - out is ignored if activation is BNNSActivationFunctionIdentity
1133
+ - fused pooling and activation filters must provide the forward pass output
1134
+ @param out_stride Increment (in values) between outputs
1135
+ @param out_delta Pointer to the output delta descriptor (dy)
1136
+ @param out_delta_stride Increment (in values) between output deltas
1137
+ @param bias_delta Pointer to the bias delta descriptor
1138
+ - not produced if null
1139
+ @param indices Pointer to the forward pass indices data generated by max pooling.
1140
+ - max pooling could use indices to reduce computation if not null. indices must have the same dimension and stride as the output data.
1141
+ - max unpooling requires a valid pointer. indices must have the same dimension and stride as the input data.
1142
+ - ignored for other pooling functions
1143
+ @param idx_stride Increment (in values) between indices
1144
+ @return 0 on success, and -1 on failure.
1145
+ */
1146
+ int BNNSPoolingFilterApplyBackwardBatch(BNNSFilter filter,
1147
+ size_t batch_size,
1148
+ const void * _Nullable in,
1149
+ size_t in_stride,
1150
+ BNNSNDArrayDescriptor * _Nullable in_delta,
1151
+ size_t in_delta_stride,
1152
+ const void * _Nullable out,
1153
+ size_t out_stride,
1154
+ BNNSNDArrayDescriptor * _Nonnull out_delta,
1155
+ size_t out_delta_stride,
1156
+ BNNSNDArrayDescriptor * _Nullable bias_delta,
1157
+ const size_t * _Nullable indices,
1158
+ size_t idx_stride)
1159
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1160
+
1161
+ /*!
1162
+
1163
+ @abstract Apply pooling filter backward to generate input delta and bias delta, supporting multiple index data types
1164
+
1165
+ @discussion
1166
+ The only difference between this function and BNNSPoolingFilterApplyBackwardBatch is that
1167
+ BNNSPoolingFilterApplyBackwardBatch requires indices to be size_t,
1168
+ while BNNSPoolingFilterApplyBackwardBatchEx allows indices to have various types.
1169
+ Currently, only uint64_t and uint32_t are allowed for indices.
1170
+
1171
+ @param filter Filter to apply backward
1172
+ @param batch_size Number of (input, output, indices) to process
1173
+ @param in Pointer to the forward pass input data (x)
1174
+ @param in_stride Increment (in values) between inputs
1175
+ @param in_delta Pointer to the input delta descriptor
1176
+ - not produced if null
1177
+ @param in_delta_stride Increment (in values) between input deltas
1178
+ @param out Pointer to the forward pass output data (y)
1179
+ - out is ignored if activation is BNNSActivationFunctionIdentity
1180
+ - fused pooling and activation filters must provide the forward pass output
1181
+ @param out_stride Increment (in values) between outputs
1182
+ @param out_delta Pointer to the output delta descriptor (dy)
1183
+ @param out_delta_stride Increment (in values) between output deltas
1184
+ @param bias_delta Pointer to the bias delta descriptor
1185
+ - not produced if null
1186
+ @param indices_data_type Data type of indices data
1187
+ @param indices Pointer to the forward pass indices data generated by max pooling.
1188
+ - max pooling could use indices to reduce computation if not null. indices must have the same dimension and stride as the output data.
1189
+ - max unpooling requires a valid pointer. indices must have the same dimension and stride as the input data.
1190
+ - ignored for other pooling functions
1191
+ @param idx_stride Increment (in values) between indices
1192
+ @return 0 on success, and -1 on failure.
1193
+ */
1194
+ int BNNSPoolingFilterApplyBackwardBatchEx(BNNSFilter filter,
1195
+ size_t batch_size,
1196
+ const void * _Nullable in,
1197
+ size_t in_stride,
1198
+ BNNSNDArrayDescriptor * _Nullable in_delta,
1199
+ size_t in_delta_stride,
1200
+ const void * _Nullable out,
1201
+ size_t out_stride,
1202
+ BNNSNDArrayDescriptor * _Nonnull out_delta,
1203
+ size_t out_delta_stride,
1204
+ BNNSNDArrayDescriptor * _Nullable bias_delta,
1205
+ const BNNSDataType indices_data_type,
1206
+ const void * _Nullable indices,
1207
+ size_t idx_stride)
1208
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
1209
+
1210
+ /*!
1211
+
1212
+ @abstract Apply filter backward to generate input deltas, weights delta and bias delta (two input version)
1213
+
1214
+ @discussion
1215
+ For a general filter f that computes output y by using weights w and bias b
1216
+ The forward pass filter computation can be described as:
1217
+ y = f(x,w,b)
1218
+ for example, the output y of a convolution filter f can be described as
1219
+ y = f(x,w,b) = w*x+b
1220
+
1221
+ The backward computation uses the output delta (dy) to generate the input deltas (dxA, dxB), weight delta (dw) and bias delta (db) [as applicable]
1222
+ In some cases the backward computation function also requires the forward pass input (x) and the forward pass output (y).
1223
+
1224
+ The following arguments are required for the backward computation:
1225
+ out_delta descriptor (dy) are the gradients arriving from the following filter and must be provided.
1226
+ in pointer is the forward pass input (x) and should be provided if not specified it is ignored
1227
+ out pointer is the forward pass output (y) and should be provided if not specified it is ignored
1228
+
1229
+ The following gradients are generated by the backward computation.
1230
+ in_delta - the input delta (dx)
1231
+ weights_delta - the weight delta (dw)
1232
+ bias_delta - the bias delta (db)
1233
+ NULL descriptor pointers will not be computed. data field of a valid descriptor must point to the delta buffer to be produced.
1234
+
1235
+ Important activation information:
1236
+ For any general activation function, when computing activation layer backward, the forward pass input (x) to the activation is required.
1237
+ However, in most activation functions, it is possible and faster to compute the activation backward from the forward pass output y.
1238
+ In the case of fused computation and activation layers, it is mandatory to provide the forward pass output y.
1239
+ Notice that some activation functions cannot be fused with the computation filters.
1240
+
1241
+ Activation backward functions that can accept either forward pass input or forward pass output (output is prefered):
1242
+ BNNSActivationFunctionIdentity
1243
+ BNNSActivationFunctionRectifiedLinear
1244
+ BNNSActivationFunctionLeakyRectifiedLinear (if alpha >= 0.0)
1245
+ BNNSActivationFunctionSigmoid
1246
+ BNNSActivationFunctionLogSigmoid
1247
+ BNNSActivationFunctionTanh
1248
+ BNNSActivationFunctionLinear
1249
+ BNNSActivationFunctionClamp
1250
+ BNNSActivationFunctionSoftmax
1251
+ BNNSActivationFunctionHardSigmoid
1252
+ BNNSActivationFunctionSoftplus
1253
+ BNNSActivationFunctionSoftsign
1254
+ BNNSActivationFunctionELU
1255
+ BNNSActivationFunctionSELU
1256
+ BNNSActivationFunctionCELU
1257
+ BNNSActivationFunctionClampedLeakyRectifiedLinear (if alpha >= 0.0)
1258
+ BNNSActivationFunctionLinearWithBias
1259
+ BNNSActivationFunctionLogSoftmax
1260
+ BNNSActivationFunctionHardShrink
1261
+ BNNSActivationFunctionSoftShrink
1262
+ BNNSActivationFunctionTanhShrink
1263
+ BNNSActivationFunctionThreshold
1264
+ BNNSActivationFunctionGELUApproximationSigmoid
1265
+
1266
+ The activation functions above can be fused with computation in training, only if the forward pass output y is provided in backward apply.
1267
+
1268
+ Other activation functions require forward pass input and does not support fusing computation with activation, such as:
1269
+ BNNSActivationFunctionAbs
1270
+ BNNSActivationFunctionGELUApproximation
1271
+ BNNSActivationFunctionGELUApproximation2
1272
+ BNNSActivationFunctionSiLU
1273
+
1274
+ Additional requirements:
1275
+ BNNSFlagsUseClientPtr flag must be enabled when creating the filter.
1276
+ data_type of all descriptors must be BNNSDataTypeFloat32.
1277
+
1278
+ @param filter Filter to apply backward
1279
+ @param batch_size Number of (input, output) pairs to process
1280
+ @param inA Pointer to the forward pass input data (x)
1281
+ @param inA_stride Increment (in values) between inputs
1282
+ @param inA_delta Pointer to the input delta descriptor
1283
+ - not produced if null
1284
+ @param inA_delta_stride Increment (in values) between input deltas
1285
+ @param inB Pointer to the forward pass input data (x)
1286
+ @param inB_stride Increment (in values) between inputs
1287
+ @param inB_delta Pointer to the input delta descriptor
1288
+ - not produced if null
1289
+ @param inB_delta_stride Increment (in values) between input deltas
1290
+ @param out Pointer to the forward pass output data (y)
1291
+ @param out_stride Increment (in values) between outputs
1292
+ @param out_delta Pointer to the output delta descriptor (dy)
1293
+ @param out_delta_stride Increment (in values) between output deltas
1294
+ @param weights_delta Pointer to the weights delta descriptor
1295
+ - delta is aggregated across batch
1296
+ - not produced if null
1297
+ - computed weights_delta layout will match the filter weight layout that was provided at the creation of the filter
1298
+ @param bias_delta Pointer to the bias delta descriptor
1299
+ - not produced if null
1300
+ @return 0 on success, and -1 on failure.
1301
+ */
1302
+ int BNNSFilterApplyBackwardTwoInputBatch(BNNSFilter filter,
1303
+ size_t batch_size,
1304
+ const void * _Nullable inA,
1305
+ size_t inA_stride,
1306
+ BNNSNDArrayDescriptor * _Nullable inA_delta,
1307
+ size_t inA_delta_stride,
1308
+ const void * _Nullable inB,
1309
+ size_t inB_stride,
1310
+ BNNSNDArrayDescriptor * _Nullable inB_delta,
1311
+ size_t inB_delta_stride,
1312
+ const void * _Nullable out,
1313
+ size_t out_stride,
1314
+ const BNNSNDArrayDescriptor * out_delta,
1315
+ size_t out_delta_stride,
1316
+ BNNSNDArrayDescriptor * _Nullable weights_delta,
1317
+ BNNSNDArrayDescriptor * _Nullable bias_delta)
1318
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1319
+
1320
+ /*!
1321
+
1322
+ @abstract Apply a normalization filter backward to generate input delta, beta delta and gamma delta
1323
+
1324
+ @discussion
1325
+ similar to BNNSFilterApplyBackwardBatch, but computing input delta, beta delta and gamma delta
1326
+ It is mandatory to compute all active gradients in a single function call. computation of input delta is not required in case the filter is the first layer in the network
1327
+
1328
+ @param filter Filter to apply backward
1329
+ @param batch_size Number of (input, output) pairs to process
1330
+ @param in_delta Pointer to the input delta descriptor
1331
+ - not produced if null
1332
+ - must be in BNNSDataTypeFloat32 or BNNSDataTypeBFloat16
1333
+ @param in_delta_stride Increment (in values) between input deltas
1334
+ @param out Pointer to the forward pass output data (y)
1335
+ - out is ignored if activation is BNNSActivationFunctionIdentity
1336
+ - forward pass output must be provided in case of fused instance normalization and activation
1337
+ @param out_stride Increment (in values) between outputs
1338
+ @param out_delta Pointer to the output delta descriptor (dy)
1339
+ - out delta may be modified in order to save memory allocations when computing fused activation backward
1340
+ - must be in BNNSDataTypeFloat32 or BNNSDataTypeBFloat16
1341
+ @param out_delta_stride Increment (in values) between output deltas
1342
+ @param beta_delta Pointer to the beta delta descriptor
1343
+ - not produced if null
1344
+ - must be in BNNSDataTypeFloat32 or BNNSDataTypeBFloat16
1345
+ @param gamma_delta Pointer to the gamma delta descriptor
1346
+ - not produced if null
1347
+ - must be in BNNSDataTypeFloat32 or BNNSDataTypeBFloat16
1348
+ @return 0 on success, and -1 on failure.
1349
+ */
1350
+ int BNNSNormalizationFilterApplyBackwardBatch(BNNSFilter filter,
1351
+ size_t batch_size,
1352
+ BNNSNDArrayDescriptor * _Nullable in_delta,
1353
+ size_t in_delta_stride,
1354
+ const void * _Nullable out,
1355
+ size_t out_stride,
1356
+ BNNSNDArrayDescriptor * out_delta,
1357
+ size_t out_delta_stride,
1358
+ BNNSNDArrayDescriptor * _Nullable beta_delta,
1359
+ BNNSNDArrayDescriptor * _Nullable gamma_delta)
1360
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1361
+
1362
+ /*!
1363
+
1364
+ @abstract Apply a fused filter backward to generate gradients.
1365
+
1366
+ @discussion
1367
+ similar to BNNSFilterApplyBackwardBatch, but computing gradients of an N layer fused filter.
1368
+ It is mandatory to compute all active parameter delta in a single function call. computation of input delta is not required in case the fused filter is the first layer in the network
1369
+
1370
+ @param filter Filter to apply backward
1371
+ @param batch_size Number of (input, output) pairs to process
1372
+ @param in Pointer to the forward pass computation input data (x)
1373
+ @param in_stride Increment (in values) between inputs
1374
+ - ignored when computing input delta or bias delta if the filter is not pooling
1375
+ @param in_delta Pointer to the computation input delta descriptor
1376
+ - not produced if null
1377
+ @param in_delta_stride Increment (in values) between input deltas
1378
+ @param out Pointer to the forward pass output data (y)
1379
+ - out is ignored if last filter activation is BNNSActivationFunctionIdentity
1380
+ @param out_stride Increment (in values) between outputs
1381
+ @param out_delta Pointer to the last filter output delta descriptor (dy)
1382
+ - out delta may be modified to save memory when computing fused activation backward
1383
+ @param out_delta_stride Increment (in values) between output deltas
1384
+ @param delta_parameters
1385
+ a pointer to an array of parameter delta pointers
1386
+ order of parameter must be first filter parameters followed by second filter parameters until reaching the last filter parameters
1387
+ for each filter parameters, the parameter order must follow the same order as in the stand-alone filter backward apply api
1388
+ all filter parameters must be provided, excluding input delta and output delta which are provided separately
1389
+ null pointer must be used for each non active parameter
1390
+ for example, if first filter is convolution and second filter is batchnorm, parameters could be extracted in the following way:
1391
+ BNNSNDArrayDescriptor* weights_delta = delta_parameters[0]; //weight delta is the first convolution parameter in BNNSFilterApplyBackwardBatch
1392
+ BNNSNDArrayDescriptor* bias_delta = delta_parameters[1]; //bias delta is the second convolution parameter in BNNSFilterApplyBackwardBatch
1393
+ BNNSNDArrayDescriptor* beta_delta = delta_parameters[2]; //first batchnorm parameter in BNNSNormalizationFilterApplyBackwardBatch
1394
+ BNNSNDArrayDescriptor* gamma_delta = delta_parameters[3]; //second batchnorm parameter in BNNSNormalizationFilterApplyBackwardBatch
1395
+
1396
+ @return 0 on success, and -1 on failure.
1397
+ */
1398
+ int BNNSFusedFilterApplyBackwardBatch(BNNSFilter filter,
1399
+ size_t batch_size,
1400
+ const void * _Nullable in,
1401
+ size_t in_stride,
1402
+ BNNSNDArrayDescriptor * _Nullable in_delta,
1403
+ size_t in_delta_stride,
1404
+ const void * _Nullable out,
1405
+ size_t out_stride,
1406
+ BNNSNDArrayDescriptor * out_delta,
1407
+ size_t out_delta_stride,
1408
+ BNNSNDArrayDescriptor * _Nullable * _Nullable delta_parameters)
1409
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1410
+
1411
+ /*!
1412
+
1413
+ @abstract Apply a fused filter backward to generate gradients.
1414
+
1415
+ @discussion
1416
+ similar to BNNSFilterApplyBackwardBatch, but computing gradients of a fused filter.
1417
+ It is mandatory to compute all active parameter delta in a single function call. computation of input delta is not required in case the fused filter is the first layer in the network
1418
+
1419
+ Currently only fused arithmetic -> normalization configuration is supported.
1420
+
1421
+ @param filter Filter to apply backward
1422
+ @param batch_size Number of (input sets, output) pairs to process
1423
+ @param number_of_inputs number of inputs for the arithmetic operation
1424
+ @param in pointer to an array of input pointers. in array size must be number_of_inputs.
1425
+ @param in_stride pointer to an array of input strides, each stride is an Increment (in values) between inputs in the batch for a corresponding input in the in array.
1426
+ @param in_delta pointer to an array of input delta pointers. in array size must be number_of_inputs.
1427
+ @param in_delta_stride pointer to an array of input delta strides, each stride is an Increment (in values) between inputs deltas in the batch for a corresponding input in the in_delta array.
1428
+ @param out Pointer to the forward pass output data (y)
1429
+ - out is ignored if last filter activation is BNNSActivationFunctionIdentity
1430
+ @param out_stride Increment (in values) between outputs
1431
+ @param out_delta Pointer to the last filter output delta descriptor (dy)
1432
+ - out delta may be modified to save memory when computing fused activation backward
1433
+ @param out_delta_stride Increment (in values) between output deltas
1434
+ @param delta_parameters
1435
+ a pointer to an array of parameter delta pointers
1436
+ order of parameter must be first filter parameters followed by second filter parameters until reaching the last filter parameters
1437
+ for each filter parameters, the parameter order must follow the same order as in the stand-alone filter backward apply api
1438
+ all filter parameters must be provided, excluding input delta and output delta which are provided separately
1439
+ null pointer must be used for each non active parameter
1440
+ for example, if first filter is arithmetic and second filter is batchnorm, parameters could be extracted in the following way:
1441
+ BNNSNDArrayDescriptor* beta_delta = delta_parameters[0]; //first batchnorm parameter in BNNSNormalizationFilterApplyBackwardBatch
1442
+ BNNSNDArrayDescriptor* gamma_delta = delta_parameters[1]; //second batchnorm parameter in BNNSNormalizationFilterApplyBackwardBatch
1443
+
1444
+ @return 0 on success, and -1 on failure.
1445
+ */
1446
+ int BNNSFusedFilterApplyBackwardMultiInputBatch(BNNSFilter filter,
1447
+ size_t batch_size,
1448
+ size_t number_of_inputs,
1449
+ const void * _Nullable * _Nullable in,
1450
+ const size_t * _Nullable in_stride,
1451
+ BNNSNDArrayDescriptor * _Nonnull * _Nonnull in_delta,
1452
+ const size_t * _Nonnull in_delta_stride,
1453
+ const void * _Nullable out,
1454
+ const size_t out_stride,
1455
+ BNNSNDArrayDescriptor * _Nonnull out_delta,
1456
+ size_t out_delta_stride,
1457
+ BNNSNDArrayDescriptor * _Nullable * _Nullable delta_parameters)
1458
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(12.0, 15.0), ios(15.0, 18.0), watchos(8.0, 11.0), tvos(15.0, 18.0));
1459
+
1460
+ /*!
1461
+
1462
+ @abstract Apply an arithmetic filter backward to generate input gradients
1463
+
1464
+ @discussion
1465
+ Compute gradients for all arithmetic operation inputs
1466
+ It is mandatory to compute all input gradients in a single function call.
1467
+ if inputs were pointing to a common address during forward computation (same input), gradients should also point to a common address (same gradient)
1468
+ descriptors for output delta and input delta that are being processed in-place must exactly match. in-place descriptor types must also match in case batch size > 1.
1469
+
1470
+ @param filter Filter to apply
1471
+ @param batch_size Number of (input sets, output) pairs to process
1472
+ @param number_of_inputs number of inputs for the arithmetic operation
1473
+ @param in pointer to an array of input pointers. in array size must be number_of_inputs.
1474
+ - in may be NULL for arithmetic layers that support forward in-place processing
1475
+ @param in_stride pointer to an array of input strides, each stride is an Increment (in values) between inputs in the batch for a corresponding input in the in array.
1476
+ @param in_delta pointer to an array of input delta pointers. in array size must be number_of_inputs.
1477
+ @param in_delta_stride pointer to an array of input delta strides, each stride is an Increment (in values) between inputs deltas in the batch for a corresponding input in the in_delta array.
1478
+ @param out Pointer to the forward pass output data (y)
1479
+ - forward pass output must be provided in case of fused arithmetic and activation
1480
+ - out may not be provided when activation is BNNSActivationFunctionIdentity, but in some arithmetic functions, providing the forward output may speedup the backward compute.
1481
+ @param out_stride Increment (in values) between outputs
1482
+ @param out_delta Pointer to the output delta descriptor (dy)
1483
+ @param out_delta_stride Increment (in values) between output deltas
1484
+
1485
+ @return 0 on success, and -1 on failure.
1486
+
1487
+ */
1488
+ int BNNSArithmeticFilterApplyBackwardBatch(BNNSFilter filter,
1489
+ size_t batch_size,
1490
+ size_t number_of_inputs,
1491
+ const void * _Nullable * _Nullable in,
1492
+ const size_t * _Nullable in_stride,
1493
+ BNNSNDArrayDescriptor *_Nonnull *_Nonnull in_delta,
1494
+ const size_t * in_delta_stride,
1495
+ const void * _Nullable out,
1496
+ const size_t out_stride,
1497
+ BNNSNDArrayDescriptor * out_delta,
1498
+ const size_t out_delta_stride)
1499
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1500
+
1501
+ /*!
1502
+
1503
+ @abstract Apply permute filter backward to generate input gradient
1504
+
1505
+ @discussion
1506
+ similar to BNNSFilterApplyBackwardBatch with only the necessary argument subset for permute.
1507
+
1508
+ @param filter Filter to apply
1509
+ @param batch_size Number of (input, output) pairs to process
1510
+ @param in_delta Pointer to the input delta descriptor
1511
+ @param in_delta_stride Increment (in values) between input deltas
1512
+ @param out_delta Pointer to the output delta descriptor
1513
+ @param out_delta_stride Increment (in values) between output deltas
1514
+
1515
+ */
1516
+ int BNNSPermuteFilterApplyBackwardBatch(BNNSFilter filter,
1517
+ size_t batch_size,
1518
+ BNNSNDArrayDescriptor * in_delta,
1519
+ size_t in_delta_stride,
1520
+ const BNNSNDArrayDescriptor * out_delta,
1521
+ size_t out_delta_stride)
1522
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1523
+
1524
+ /*!
1525
+
1526
+ @abstract Apply a loss filter to compute forward loss and loss gradient on a batch with several pairs of (input, labels)
1527
+
1528
+ @discussion
1529
+ The filter is applied for each of the <tt>batch_size</tt> inputs,labels and computes reduced loss and an optional loss gradient.
1530
+ <tt>in</tt> (resp. <tt>out</tt>) is expected to point to <tt>batch_size</tt> times the input (resp. output) object size defined when the filter was created.
1531
+ The function supports forward loss computation, and also backward loss without back propagation from output delta.
1532
+ Input delta computation is an optimization that can be used if the loss layer is the last layer in the network.
1533
+
1534
+ @param filter Loss filter to apply
1535
+ @param batch_size Number of (input, labels) pairs to compute
1536
+ @param in Pointer to the input data
1537
+ @param in_stride Increment (in values) between inputs
1538
+ @param labels Pointer to the labels
1539
+ @param labels_stride Increment (in values) between labels
1540
+ @param weights optional loss computation weight
1541
+ @param weights_size weight size must be one of:
1542
+ for softmax cross entropy:
1543
+ 0 results in no weight loss scaling.
1544
+ 1 results in same weight scaling for all samples in the batch.
1545
+ batch_size results in different weight per each sample in the batch
1546
+ for sigmoid cross enrtopy, mse and huber loss, weights_size must be one of:
1547
+ 0 results in no weight loss scaling.
1548
+ 1 results in same weight scaling for all samples in the batch.
1549
+ batch_size*input_width results in different weight per each sample in the batch
1550
+ @param out Pointer to the computed loss. output size depand on loss function and reduction function.
1551
+ Loss array expected to be consecutive in memory (in case loss is unreduced), such that the stride between loss of consecutive samples in the batch is 1.
1552
+ if loss is reduced, out will be a single result.
1553
+ for softmax cross entropy, if loss is unreduced, out should be large enough to contain batch_size consecutive loss results.
1554
+ for sigmoid cross entropy unreduced loss, mse unreduced loss and huber unreduced loss, out should be large enough to contain batch_size*input_width consecutive loss results, where input_width is size[0] of the input descriptor.
1555
+
1556
+ @param in_delta Pointer to the input delta descriptor
1557
+ - not produced if null
1558
+ @param in_delta_stride Increment (in values) between input deltas
1559
+
1560
+ @return 0 on success, and -1 on failure.
1561
+
1562
+ */
1563
+ int BNNSLossFilterApplyBatch(BNNSFilter filter,
1564
+ size_t batch_size,
1565
+ const void * in,
1566
+ size_t in_stride,
1567
+ const void * labels,
1568
+ size_t labels_stride,
1569
+ const void * _Nullable weights,
1570
+ size_t weights_size,
1571
+ void * out,
1572
+ BNNSNDArrayDescriptor * _Nullable in_delta,
1573
+ size_t in_delta_stride)
1574
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1575
+
1576
+ /*!
1577
+
1578
+ @abstract Apply a loss filter backward to generate gradients.
1579
+
1580
+ @discussion
1581
+ The filter is applied for each of the <tt>batch_size</tt> inputs,labels and computes the backward loss gradient.
1582
+ <tt>in</tt> (resp. <tt>out</tt>) is expected to point to <tt>batch_size</tt> times the input (resp. output) object size defined when the filter was created.
1583
+ Note that if the loss layer is the last layer in the network, the BNNSLossFilterApplyBatch can be used to compute both forward and backward without back propagation from output delta.
1584
+
1585
+ @param filter Loss filter to apply
1586
+ @param batch_size Number of (input, labels) pairs to compute
1587
+ @param in Pointer to the input data
1588
+ @param in_stride Increment (in values) between inputs
1589
+ @param in_delta Pointer to the input delta descriptor
1590
+ @param in_delta_stride Increment (in values) between input deltas
1591
+ @param labels Pointer to the labels
1592
+ @param labels_stride Increment (in values) between labels
1593
+ @param weights optional loss computation weight
1594
+ @param weights_size weight size must be one of:
1595
+ for softmax cross entropy:
1596
+ 0 results in no weight loss scaling.
1597
+ 1 results in same weight scaling for all samples in the batch.
1598
+ batch_size results in different weight per each sample in the batch
1599
+ for sigmoid cross enrtopy, mse and huber loss, weights_size must be one of:
1600
+ 0 results in no weight loss scaling.
1601
+ 1 results in same weight scaling for all samples in the batch.
1602
+ batch_size*input_width results in different weight per each sample in the batch
1603
+ @param out_delta Pointer to the output delta descriptor
1604
+ @param out_delta_stride Increment (in values) between output deltas
1605
+
1606
+ @return 0 on success, and -1 on failure.
1607
+ */
1608
+ int BNNSLossFilterApplyBackwardBatch(BNNSFilter filter,
1609
+ size_t batch_size,
1610
+ const void * in,
1611
+ size_t in_stride,
1612
+ BNNSNDArrayDescriptor * in_delta,
1613
+ size_t in_delta_stride,
1614
+ const void * labels,
1615
+ size_t labels_stride,
1616
+ const void * _Nullable weights,
1617
+ size_t weights_size,
1618
+ const BNNSNDArrayDescriptor * out_delta,
1619
+ size_t out_delta_stride)
1620
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1621
+
1622
+ /*! @abstract Applies a previously created multihead attention layer backwards to obtain gradients
1623
+ *
1624
+ * @discussion
1625
+ * Two common cases are that query=key=value or query=key. In these cases the backpropogated gradient for these parameters
1626
+ * the gradient calculation is then the sum of the individual deltas. If any the pointers query_param_delta.target_desc.data,
1627
+ * key_param_delta.target_desc.data or value_param_delta.target_desc.data are equal to each other, the returned tensor will
1628
+ * be set correctly to the sum of the components.
1629
+ *
1630
+ * @param F Filter to apply created by a previous call to BNNSFilterCreateLayerMultiheadAttention()
1631
+ * @param batch_size Number of inputs in batch
1632
+ * @param query Pointer to data for query input matrix, layout as described by layer_params->query.target_desc
1633
+ * @param query_stride Batch stride for query
1634
+ * @param query_param_delta Pointer to data structure used to hold deltas for corresponding components. A NULL value
1635
+ * in a member's data component indicates that it should not be computed.
1636
+ * The value query_param_delta.target_desc.stride[2] is used as the batch stride for query_param_delta.target_desc.
1637
+ * @param key Pointer to data for key input matrix, layout as described by layer_params->key.target_desc
1638
+ * @param key_stride Batch stride for key
1639
+ * @param key_mask Mask applied to key for ignoring entries, layout as described in forward call.
1640
+ * No mask is applied if this pointer is NULL.
1641
+ * @param key_mask_stride Batch stride for key_mask
1642
+ * @param key_param_delta Pointer to data structure used to hold deltas for corresponding components. A NULL value
1643
+ * in a member's data component indicates that it should not be computed.
1644
+ * The value key_param_delta.target_desc.stride[2] is used as the batch stride for key_param_delta.target_desc.
1645
+ * @param value Pointer to data for value input matrix, layout as described by layer_params->value.target_desc
1646
+ * @param value_stride Batch stride for value
1647
+ * @param value_param_delta Pointer to data structure used to hold deltas for corresponding components. A NULL value
1648
+ * in a member's data component indicates that it should not be computed.
1649
+ * The value value_param_delta.target_desc.stride[2] is used as the batch stride for value_param_delta.target_desc.
1650
+ * @param add_to_attention Optional, a 2D tensor of shape target_length x source_length that is used as part of the mask function prior
1651
+ * to softmax in the attention calculation (the matrix X in the layer description). No matrix is added if this pointer is NULL.
1652
+ * @param output Pointer to data for output matrix, , layout as described by layer_params->output.target_desc
1653
+ * @param output_stride Batch stride for output.
1654
+ * @param output_param_delta Pointer to data structure used to hold deltas for corresponding components. A NULL value
1655
+ * in a member's data component indicates that it should not be computed.
1656
+ * The value output_param_delta.target_desc.stride[2] is used as the batch stride for output_param_delta.target_desc.
1657
+ * @param backprop_cache_size Specifies the size of the array backprop_cache, in bytes. If 0, or backprop_cache is NULL,
1658
+ * backprop_cache is not accessed.
1659
+ * @param backprop_cache Is used to store intermediate results that can be used to accelerate a future call to
1660
+ * BNNSApplyMultiheadAttentionBackward.
1661
+ * @param workspace_size Specifies the size of the array workspace, in bytes.
1662
+ * If workspace_size is not-NULL but workspace is NULL, the recommended size for workspace_size
1663
+ * will be set, but not other calculations will be performed (except to set backprop_cache_size if requested).
1664
+ * @param workspace Is used as a scratch buffer during the calculation.
1665
+ */
1666
+ int BNNSApplyMultiheadAttentionBackward(BNNSFilter F, size_t batch_size,
1667
+ void const * _Nullable query, size_t query_stride,
1668
+ BNNSMHAProjectionParameters * _Nullable query_param_delta,
1669
+ void const * _Nullable key, size_t key_stride,
1670
+ BNNSNDArrayDescriptor const* _Nullable key_mask, size_t key_mask_stride,
1671
+ BNNSMHAProjectionParameters * _Nullable key_param_delta,
1672
+ void const * _Nullable value, size_t value_stride,
1673
+ BNNSMHAProjectionParameters * _Nullable value_param_delta,
1674
+ BNNSNDArrayDescriptor const* _Nullable add_to_attention,
1675
+ BNNSNDArrayDescriptor * _Nullable key_attn_bias_delta,
1676
+ BNNSNDArrayDescriptor * _Nullable value_attn_bias_delta,
1677
+ void const * _Nullable output, size_t output_stride,
1678
+ BNNSMHAProjectionParameters * output_param_delta,
1679
+ size_t backprop_cache_size, void * _Nullable backprop_cache,
1680
+ size_t * _Nullable workspace_size, void * _Nullable workspace
1681
+ )
1682
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1683
+
1684
+ #pragma mark - Direct inference
1685
+
1686
+ /*!
1687
+ @abstract return the minimum bytes capacity of the training cache buffer (used to store intermediate results during the forward pass)
1688
+ @return minimum bytes capacity of the training cache buffer
1689
+ */
1690
+ size_t BNNSComputeLSTMTrainingCacheCapacity(const BNNSLayerParametersLSTM * layer_params)
1691
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1692
+
1693
+ /*!
1694
+
1695
+ @abstract Direct Apply LSTM with training caching
1696
+ @discussion compute LSTM forward and cache intermediate results to accelerate backward computation
1697
+ - the user can query the minimum buffer size for training cache using BNNSComputeLSTMTrainingCacheCapacity
1698
+ - training_cache_ptr == NULL means not to cache
1699
+ - BNNS will return failure when training_cache_capacity is lower than the minimum bytes capacity of the training cache buffer that BNNSComputeLSTMTrainingCacheCapacity returned
1700
+ @param layer_params - layer parameters
1701
+ @param filter_params - filter parameters
1702
+ @param training_cache_ptr - buffer to store intermediate results to accelerate backward computation. if Null, intermediate results aren't cached
1703
+ @param training_cache_capacity - size in bytes of training_cache_ptr
1704
+ @return 0 on success, and -1 on failure.
1705
+
1706
+ */
1707
+ int BNNSDirectApplyLSTMBatchTrainingCaching(const BNNSLayerParametersLSTM * layer_params,
1708
+ const BNNSFilterParameters * _Nullable filter_params,
1709
+ void * _Nullable training_cache_ptr,
1710
+ const size_t training_cache_capacity)
1711
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1712
+
1713
+ #endif
1714
+
1715
+ /*!
1716
+
1717
+ @abstract Direct Apply an Activation/Conversion filter to several pairs of (input, output) data
1718
+
1719
+ @discussion
1720
+ equal to calling BNNSCreateActivation & BNNSFilterApplyBatch & BNNSDestroy
1721
+
1722
+ @param layer_params Layer parameters and input, weights, output, bias and activation descriptors
1723
+ should set i_desc.data pointing to input data and o_desc.data pointing to output data
1724
+
1725
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
1726
+ @param batch_size Number of (input, output) pairs to process
1727
+ @param in_stride Increment (in values) between inputs
1728
+ @param out_stride Increment (in values) between outputs
1729
+
1730
+ @return 0 on success, and -1 on failure.
1731
+
1732
+ */
1733
+ int BNNSDirectApplyActivationBatch(const BNNSLayerParametersActivation * layer_params,
1734
+ const BNNSFilterParameters * _Nullable filter_params,
1735
+ size_t batch_size,
1736
+ size_t in_stride,
1737
+ size_t out_stride)
1738
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1739
+
1740
+ /*!
1741
+
1742
+ @abstract Copies the contents of one BNNSNDArrayDescriptor to another of the same shape.
1743
+ @discussion
1744
+ Equivalent to using a contraction layer with opstring "src_* -> dest_*"
1745
+
1746
+ @param dest The destination tensor
1747
+ @param src The source tensor - must not overlap in memory with the destination tensor
1748
+
1749
+ */
1750
+ int BNNSCopy(BNNSNDArrayDescriptor * dest,
1751
+ BNNSNDArrayDescriptor const * src,
1752
+ const BNNSFilterParameters * _Nullable filter_params)
1753
+ __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
1754
+
1755
+ #if !0
1756
+
1757
+ /*!
1758
+ * @abstract Returns required workspace size for a call to BNNSMatMul() with the given paramters.
1759
+ *
1760
+ * @discussion
1761
+ * This routine does not access the data pointers on the array descriptors, so they need not point to actual data.
1762
+ *
1763
+ * @param transA - if true, transposes the last two dimensions of A
1764
+ * @param transB - if true, transposes the last two dimensions of B
1765
+ * @param alpha - scalar by which to scale the result
1766
+ * @param inputA - descriptor for tensor A
1767
+ * @param inputB - descriptor for tensor B
1768
+ * @param output - descriptor for tensor C
1769
+ * @param filter_params - filter runtime parameters, may be NULL for default parameters
1770
+ *
1771
+ * @returns Required allocation size for workspace paramter to BNNSMatMul, in bytes.
1772
+ * If parameters are invalid, a negative value is returned.
1773
+ */
1774
+ ssize_t BNNSMatMulWorkspaceSize(const bool transA,
1775
+ const bool transB,
1776
+ const float alpha,
1777
+ const BNNSNDArrayDescriptor * inputA,
1778
+ const BNNSNDArrayDescriptor * inputB,
1779
+ const BNNSNDArrayDescriptor * output,
1780
+ const BNNSFilterParameters * _Nullable filter_params)
1781
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
1782
+
1783
+ /*!
1784
+ * @abstract Directly apply a broadcast matrix multiplication layer.
1785
+ *
1786
+ * @discussion
1787
+ * This routine performs to operation C = alpha * op(A) * op(B), with approriate broadcasting if dimensions are absent on one
1788
+ * or more matrices. Matrix multiplication is always on the final two indices of each operand. For example, if we have
1789
+ * A is 4x5x6
1790
+ * B is 6x7
1791
+ * C is 4x5x7
1792
+ * Then the operation performed (if transA=transB=false) is:
1793
+ * c_pij = sum_k a_pik * b_kj
1794
+ * Noting that the matrix B has been broadcast in the p dimension
1795
+ *
1796
+ * Performs the same action as a broadcast matrix multiplication layer without instantiating a BNNSFilter.
1797
+ * This function replaces the deprecated BNNSDirectApplyBroadcastMatMul and allows explicit provision
1798
+ * of workspace memory. If workspace is not null, no allocation is performed internally.
1799
+ *
1800
+ * @param transA - if true, transposes the last two dimensions of A
1801
+ * @param transB - if true, transposes the last two dimensions of B
1802
+ * @param alpha - scalar by which to scale the result
1803
+ * @param inputA - descriptor for tensor A
1804
+ * @param inputB - descriptor for tensor B
1805
+ * @param output - descriptor for tensor C; on output only the data values are changed
1806
+ * @param workspace - pointer to memory region to be used as scratch. Must have size no less than
1807
+ * the value returned by BNNSMatMulWorkspaceSize
1808
+ * @param filter_params - filter runtime parameters, may be NULL for default parameters
1809
+ *
1810
+ * @returns 0 on success, non-zero on failure
1811
+ */
1812
+ int BNNSMatMul(const bool transA,
1813
+ const bool transB,
1814
+ const float alpha,
1815
+ const BNNSNDArrayDescriptor * inputA,
1816
+ const BNNSNDArrayDescriptor * inputB,
1817
+ const BNNSNDArrayDescriptor * output,
1818
+ void * _Nullable workspace,
1819
+ const BNNSFilterParameters * _Nullable filter_params)
1820
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
1821
+
1822
+ /*!
1823
+ * @abstract Directly apply a broadcast matrix multiplication layer.
1824
+ *
1825
+ * @description
1826
+ * Performs the same action as a broadcast matrix multiplication layer without instantiating a BNNSFilter.
1827
+ *
1828
+ * @param transA - if true, transposes the last two dimensions of A
1829
+ * @param transB - if true, transposes the last two dimensions of B
1830
+ * @param alpha - scalar by which to scale the result
1831
+ * @param inputA - descriptor for tensor A
1832
+ * @param inputB - descriptor for tensor B
1833
+ * @param output - descriptor for tensor C; on output only the data values are changed
1834
+ * @param filter_params - filter runtime parameters, may be NULL for default parameters
1835
+ */
1836
+ void BNNSDirectApplyBroadcastMatMul(const bool transA,
1837
+ const bool transB,
1838
+ const float alpha,
1839
+ const BNNSNDArrayDescriptor * inputA,
1840
+ const BNNSNDArrayDescriptor * inputB,
1841
+ const BNNSNDArrayDescriptor * output,
1842
+ const BNNSFilterParameters * _Nullable filter_params)
1843
+ __API_DEPRECATED_WITH_REPLACEMENT("BNNSMatMul", macos(11.0, 13.0), ios(14.0, 16.0), watchos(7.0, 9.0), tvos(14.0, 16.0));
1844
+
1845
+ #endif
1846
+
1847
+ /*! @abstract Transposes a tensor by swapping two of its dimensions.
1848
+ *
1849
+ * @discussion
1850
+ * Users should consider whether a data transposition with memory copy (i.e. this operation) is required, or if the same effect can be
1851
+ * achieved by just switching layout in the descriptor of the same memory (e.g. for a 2D matrix can switching from row major to column
1852
+ * major storage satsify the requirements). Consideration will be needed for both whether individual layers support alternative data
1853
+ * layouts, and runtime performance.
1854
+ *
1855
+ * This routine is not presented as a layer, but as a data manipulation. If deployed in a training scenario, observe that backpropagation
1856
+ * can be achieved by applying exactly the same operation to the output delta as was applied to the original input.
1857
+ *
1858
+ * This operation is equivalent to using the TensorContraction layer with operation string similar to "x_*ij -> y_*ji", only with the appropriate
1859
+ * axes represented for the transposition.
1860
+ *
1861
+ * In place operation is NOT supported.
1862
+ *
1863
+ * @param dest Descriptor for the destination tensor
1864
+ * @param src Descriptor for the source tensor
1865
+ * @param axis0 First axis of transposition
1866
+ * @param axis1 Second axis of transposition
1867
+ * @param filter_params Filter runtime parameters, may be NULL for default parameters
1868
+ */
1869
+ int BNNSTranspose(BNNSNDArrayDescriptor *dest,
1870
+ const BNNSNDArrayDescriptor *src,
1871
+ size_t axis0, size_t axis1,
1872
+ const BNNSFilterParameters * _Nullable filter_params)
1873
+ __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
1874
+
1875
+ #if !0
1876
+
1877
+ /*!
1878
+ @abstract Apply Reduction on selected axis
1879
+ @param layer_params Layer parameters: input descriptor, output descriptor, reduce function and epsilon
1880
+ need to set the pointers:
1881
+ layer_params.i_desc.data - pointer to input buffer
1882
+ layer_params.o_desc.data - pointer to output buffer
1883
+ layer_params.w_desc.data - pointer to weights buffer (set to NULL if not needed)
1884
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
1885
+ @return 0 on success, and -1 on failure.
1886
+ */
1887
+ int BNNSDirectApplyReduction(const BNNSLayerParametersReduction * layer_params,
1888
+ const BNNSFilterParameters * _Nullable filter_params)
1889
+ __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
1890
+
1891
+ /*!
1892
+ @abstract create and return a new tensor of bool type by comparing two input tensors
1893
+
1894
+ @discussion
1895
+ compare two input tensors and generate a tensor of bool type containing the results of element-by-element comparison
1896
+
1897
+ @param in0 pointer to the tensor descriptor of type BNNSNDArrayDescriptor for comparison/logical operations - left side of the operator
1898
+ @param in1 pointer to the tensor descriptor of type BNNSNDArrayDescriptor for comparison/logical operations - right side of the operator
1899
+ @param op type of comparison in BNNSRelationalOperator type
1900
+ @param out pointer to the tensor descriptor of type BNNSNDArrayDescriptor for the output of comparison.
1901
+ The active dimensions should match those of inA/inB, and the type should be BNNSDataTypeBoolean8.
1902
+ @return the error code of the processing - error only if I/O tensor descriptors have invalid or mismatching information
1903
+ */
1904
+ int BNNSCompareTensor(const BNNSNDArrayDescriptor * in0, const BNNSNDArrayDescriptor * in1, BNNSRelationalOperator op, BNNSNDArrayDescriptor * out)
1905
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
1906
+
1907
+ /*!
1908
+ @abstract return a new tensor by replicating the input tensor multiple times
1909
+
1910
+ @discussion
1911
+ The size of output tensor along each dimension should be a multiple of input tensor,
1912
+ and the multiple is the number of repetition.
1913
+
1914
+ @param input Pointer to the input tensor descriptor
1915
+ @param output Pointer to the output tensor descriptor
1916
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
1917
+ @return Zero on success, nonzero on failure.
1918
+ */
1919
+ int BNNSTile(const BNNSNDArrayDescriptor *_Nonnull input,
1920
+ BNNSNDArrayDescriptor *_Nonnull output,
1921
+ const BNNSFilterParameters *_Nullable filter_params)
1922
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
1923
+
1924
+
1925
+ /*!
1926
+ @abstract Returns top K values
1927
+ @discussion
1928
+ Returns a sparse vector of the top K entries from the input.
1929
+ In the case of ties that span the top-K boundary, only the lexigraphically first entries will be returned.
1930
+ Nullability of best_indices is changed to allow passing null pointer.
1931
+ @param K Number of entries to find
1932
+ @param axis Axis along which to find top K entries
1933
+ @param batch_size Number of batches
1934
+ @param input The input tensor
1935
+ @param input_batch_stride The batch stride for input.data
1936
+ @param best_values Descriptor of a K-length vector. On return contains the K best values in descending order.
1937
+ @param best_values_batch_stride The batch stride for best_values
1938
+ @param best_indices Descriptor of a K-length vector. On return contains the indices of the K best values in descending order. (set to NULL if not needed)
1939
+ @param best_indices_batch_stride The batch stride in size_t elements for best_indices
1940
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
1941
+ @return Zero on success, nonzero on failure.
1942
+ */
1943
+ int BNNSDirectApplyTopK(size_t K, size_t axis, size_t batch_size,
1944
+ const BNNSNDArrayDescriptor *input, size_t input_batch_stride,
1945
+ BNNSNDArrayDescriptor *best_values, size_t best_values_batch_stride,
1946
+ #if __MAC_OS_X_VERSION_MIN_REQUIRED >= __MAC_13_0 || \
1947
+ __IPHONE_OS_VERSION_MIN_REQUIRED >= __IPHONE_16_0 || \
1948
+ __WATCH_OS_VERSION_MIN_REQUIRED >= __WATCHOS_9_0 || \
1949
+ __TV_OS_VERSION_MIN_REQUIRED >= __TVOS_16_0
1950
+ BNNSNDArrayDescriptor *_Nullable best_indices, size_t best_indices_batch_stride,
1951
+ #else
1952
+ BNNSNDArrayDescriptor *best_indices, size_t best_indices_batch_stride,
1953
+ #endif
1954
+ const BNNSFilterParameters * _Nullable filter_params)
1955
+ __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
1956
+
1957
+ /*!
1958
+ @abstract Given a tensor index for each member of a batch, returns a boolean vector indicating whether each index
1959
+ corresponds to a top-k value of the input.
1960
+ @discussion
1961
+ Consider the 4x4 tensor in a batch size of 3:
1962
+ X(:,:,0) = [ 1 3 5 7 ] X(:,:,1) = [ 1 8 3 4 ] X(:,:,2) = [ 4 8 7 7 ]
1963
+ [ 2 5 1 9 ] [ 8 1 3 5 ] [ 4 3 8 5 ]
1964
+ [ 1 5 3 2 ] [ 1 7 2 3 ] [ 5 7 3 1 ]
1965
+ and the test indices:
1966
+ T(:, 0) = (0, 3, 1)
1967
+ T(:, 1) = (2, 2, 0)
1968
+ T(:, 2) = (3, 2, 1)
1969
+ with K= 2 and axis=1, the result would be:
1970
+ (F, F, T) from comparing values (1, 1, 5) against the top K sets (5, 7), (5, 9), (3,5) in the first batch
1971
+ (F, F, F) from comparing values (3, 3, 1) against the top K set (4, 8), (5, 8), (3,7) in the second batch
1972
+ (T, T, T) from comparing values (7, 8, 7) against the top K set (7, 8), (5, 8), (5, 7) in the third batch
1973
+ Observe that in the case of ties, all possible entries are included in the top K.
1974
+ @param K Number of entries to find
1975
+ @param axis Axis along which to find top K entries
1976
+ @param batch_size Number of batches
1977
+ @param input The input tensor
1978
+ @param input_batch_stride The batch stride for input.data
1979
+ @param test_indices Test index tensor, shape must match that of input, with the given axis removed
1980
+ @param test_indices_batch_stride The batch stride for test_indices.data
1981
+ @param output The boolean output tensor
1982
+ @param output_batch_stride The batch stride for output.data, of shape matching test_indices
1983
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
1984
+ @return Zero on success, nonzero on failure.
1985
+ */
1986
+ int BNNSDirectApplyInTopK(size_t K, size_t axis, size_t batch_size,
1987
+ const BNNSNDArrayDescriptor *input, size_t input_batch_stride,
1988
+ const BNNSNDArrayDescriptor *test_indices, size_t test_indices_batch_stride,
1989
+ BNNSNDArrayDescriptor *output, size_t output_batch_stride,
1990
+ const BNNSFilterParameters * _Nullable filter_params)
1991
+ __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0));
1992
+
1993
+ /*!
1994
+ @abstract Gather elements along a single axis
1995
+
1996
+ @discussion
1997
+ Maps one n dimensional tensor to another n dimensional tensor, only with indices along the
1998
+ given axis gathered as according to the given indices tensor.
1999
+ output[i_0, ... i_axis, ... i_{n-1}] = input[i_0, ... idx_axis, ... i_{n-1}]
2000
+ where the value idx_axis is drawn from the indices tensor as follows:
2001
+ 1) If indices is a 1d vector, idx_axis = indices[i_axis]
2002
+ 2) If indices shape matches output shape, idx_axis = indices[i_0, ... i_axis, ... i_{n-1}]
2003
+ (Note that in the degeneate case where output is a 1d vector the two definitions are equivalent)
2004
+
2005
+ In both cases, if any indices value is out of range, an error is generated.
2006
+
2007
+ @param axis Axis along which indices are gathered
2008
+ @param input Tensor from which values are gathered
2009
+ @param indices 1D tensor containing indices to gather
2010
+ @param output Tensor in which to store output. Must have shape consistent with input and indices as described above.
2011
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2012
+ */
2013
+ int BNNSGather(size_t axis,
2014
+ const BNNSNDArrayDescriptor *input,
2015
+ const BNNSNDArrayDescriptor *indices,
2016
+ BNNSNDArrayDescriptor *output,
2017
+ const BNNSFilterParameters * _Nullable filter_params)
2018
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
2019
+
2020
+ /*!
2021
+ @abstract Scatter elements along a single axis
2022
+
2023
+ @discussion
2024
+ Given a set of input indices along the given axis, we modify the output tensor setting
2025
+ output[i_0, ... idx_axis, ... i_{n-1}] = input[i_0, ... i_axis, ... i_{n-1}]
2026
+ where the value idx_axis is drawn from the indices tensor as follows:
2027
+ 1) If indices is a 1d vector, idx_axis = indices[i_axis]
2028
+ 2) If indices shape matches input shape, idx_axis = indices[i_0, ... i_axis, ... i_{n-1}]
2029
+ (Note that in the degeneate case where input is a 1d vector the two definitions are equivalent)
2030
+
2031
+ If any indices value is out of range, an error is generated.
2032
+
2033
+ Output values that are scattered to reduced with the existing value as
2034
+ output[output_idx] = op(output[output_idx], input[input_idx]).
2035
+ If multiple input values update the same output element, the order of update operations is undefined.
2036
+ In particular, if op == BNNSReduceFunctionNone there is no guarantee any particular value will result.
2037
+
2038
+ @param axis Axis along which indices are scattered
2039
+ @param op Reduction op used to reduce existing output value with scattered value.
2040
+ At present only BNNSReduceFunctionNone and BNNSReduceFunctionSum are supported.
2041
+ @param input Tensor from which values are scattered
2042
+ @param indices 1D tensor containing indices to gather. Must have the same size as the axis-th dimension of input.
2043
+ @param output Tensor into which indices are scattered
2044
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2045
+ */
2046
+ int BNNSScatter(size_t axis,
2047
+ BNNSReduceFunction op,
2048
+ const BNNSNDArrayDescriptor *input,
2049
+ const BNNSNDArrayDescriptor *indices,
2050
+ BNNSNDArrayDescriptor *output,
2051
+ const BNNSFilterParameters * _Nullable filter_params)
2052
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
2053
+
2054
+ /*!
2055
+ @abstract Gathers a (k-1)-dimensional set of slices or elements from the input array
2056
+
2057
+ @discussion
2058
+ This provides a more comprehensive version of BNNSGather that allows gathering slices of the input array.
2059
+
2060
+ The indices array is interpreted as a (k-1) dimensional set of 1d lookup vectors (thus the indices tensor has (k-1) + 1 = k dimensions total).
2061
+ If the 1d lookup vectors do not give a full set of indices, the remaining indices are treated as a slice.
2062
+ e.g. If the input array is 3 dimensional, then:
2063
+ indices[i] = {1} would gather the 2d slice input[1, :, :]
2064
+ indices[i] = {3,2} would gather the 1d slice input[3, 2, :]
2065
+ indices[i] = {2,1,3} would gather the element input[2, 1, 3]
2066
+ As such, the shape of the output is given by the concatenation of the shape for the first k-1 dimensions of indices and the
2067
+ shape of the slice gathered (which is itself given by the shape of the last p dimensions of the input tensor, where
2068
+ p=ndim(input)-indices.size[k-1]).
2069
+
2070
+ If any indices value are out of range, an error is generated.
2071
+
2072
+ @param input Tensor from which values are gathered
2073
+ @param indices Tensor containing indices to gather
2074
+ @param output Tensor in which to store output. Must have shape consistent with input and indices as described above.
2075
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2076
+ */
2077
+ int BNNSGatherND(const BNNSNDArrayDescriptor *input,
2078
+ const BNNSNDArrayDescriptor *indices,
2079
+ BNNSNDArrayDescriptor *output,
2080
+ const BNNSFilterParameters * _Nullable filter_params)
2081
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
2082
+
2083
+ /*!
2084
+ @abstract Scatters a (k-1)-dimensional set of slices or elements across the output array
2085
+
2086
+ @discussion
2087
+ This is the inverse of the BNNSGatherND operation.
2088
+
2089
+ The indices array is interpreted as a (k-1) dimensional set of 1d lookup vectors (thus the indices tensor has (k-1) + 1 = k dimensions total).
2090
+ If the 1d lookup vectors do not give a full set of indices, the remaining indices are treated as a slice.
2091
+ e.g. If the output array is 3 dimensional, then:
2092
+ indices[i] = {1} would refer to the 2d slice output[1, :, :]
2093
+ indices[i] = {3,2} would refer to the 1d slice output[3, 2, :]
2094
+ indices[i] = {2,1,3} would refer to the output[2, 1, 3]
2095
+ As such, the shape of the input is given by the concatenation of the shape for the first k-1 dimensions of indices and the
2096
+ shape of the slice gathered (which is itself given by the shape of the last p dimensions of the output tensor, where
2097
+ p=ndim(output)-indices.size[k-1]).
2098
+
2099
+ If any indices value are out of range, an error is generated.
2100
+
2101
+ Output values that are scattered to reduced with the existing value as
2102
+ output[output_idx] = op(output[output_idx], input[input_idx]).
2103
+ If multiple input values update the same output element, the order of update operations is undefined.
2104
+ In particular, if op == BNNSReduceFunctionNone there is no guarantee any particular value will result.
2105
+
2106
+ @param op Reduction op used to reduce existing output value with scattered value.
2107
+ At present only BNNSReduceFunctionNone and BNNSReduceFunctionSum are supported.
2108
+ @param input Tensor from which values are scattered
2109
+ @param indices Tensor containing indices to scatter
2110
+ @param output Tensor into which indices are scattered
2111
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2112
+ */
2113
+ int BNNSScatterND(BNNSReduceFunction op,
2114
+ const BNNSNDArrayDescriptor *input,
2115
+ const BNNSNDArrayDescriptor *indices,
2116
+ BNNSNDArrayDescriptor *output,
2117
+ const BNNSFilterParameters * _Nullable filter_params)
2118
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
2119
+
2120
+ /*!
2121
+ @abstract Rearranges elements in a tensor according to shuffle type
2122
+
2123
+ @param type Type of shuffle to perform
2124
+ @param input Pointer to the input tensor descriptor
2125
+ @param output Pointer to the output tensor descriptor
2126
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2127
+ @return Zero on success, nonzero on failure.
2128
+ */
2129
+ int BNNSShuffle(const BNNSShuffleType type,
2130
+ const BNNSNDArrayDescriptor *input,
2131
+ BNNSNDArrayDescriptor *output,
2132
+ const BNNSFilterParameters * _Nullable filter_params)
2133
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
2134
+
2135
+ /*!
2136
+ @abstract Set elements outside a center band to zeros for the innermost matrix (the two dimensions with
2137
+ the lowest stride values)
2138
+ @discussion
2139
+ Currently only works on contiguous input and output
2140
+
2141
+ @param num_lower The number of subdiagonals that the function copies. Set to a negative value to copy the entire lower triangle
2142
+ @param num_upper The number of superdiagonals that the function copies. Set to a negative value to copy the entire upper triangle
2143
+ @param input Pointer to the input tensor descriptor
2144
+ @param output Pointer to the output tensor descriptor
2145
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2146
+ @return Zero on success, nonzero on failure.
2147
+ */
2148
+ int BNNSBandPart(const int num_lower,
2149
+ const int num_upper,
2150
+ const BNNSNDArrayDescriptor *input,
2151
+ BNNSNDArrayDescriptor *output,
2152
+ const BNNSFilterParameters * _Nullable filter_params)
2153
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
2154
+
2155
+ /*!
2156
+ @abstract Resize the spatial dimensions (two dimensions with the smallest strides) of the first input
2157
+ according to the bounding boxes and box indices specified in the second input.
2158
+
2159
+ @discussion
2160
+ Only works on contiguous tensors
2161
+
2162
+ @param layer_params Pointer to layer parameter
2163
+ @param input Pointer to the input tensor descriptor
2164
+ @param roi Pointer to regions of interest tensor descriptor
2165
+ @param output Pointer to the output tensor descriptor
2166
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2167
+ @return Zero on success, nonzero on failure.
2168
+ */
2169
+ int BNNSCropResize(const BNNSLayerParametersCropResize * layer_params,
2170
+ const BNNSNDArrayDescriptor *input,
2171
+ const BNNSNDArrayDescriptor *roi,
2172
+ BNNSNDArrayDescriptor *output,
2173
+ const BNNSFilterParameters * _Nullable filter_params)
2174
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
2175
+
2176
+ #pragma mark - Direct Apply Backward
2177
+
2178
+ /*!
2179
+ @abstract Direct Apply LSTM with training caching
2180
+ @discussion compute LSTM backward
2181
+ @param layer_params - layer parameters
2182
+ @param layer_delta_params - layer delta parameters (include inputs & outputs for backward)
2183
+ @param filter_params - filter parameters
2184
+ @param training_cache_ptr - buffer with intermediate results to accelerate backward computation. if Null, intermediate results weren't cached and forward pass will be recomupted
2185
+ @param training_cache_capacity - size in bytes of training_cache_ptr. return failure when training_cache_capacity is lower than the minimum bytes capacity of the training cache
2186
+ @return 0 on success, and -1 on failure.
2187
+ */
2188
+ int BNNSDirectApplyLSTMBatchBackward(const BNNSLayerParametersLSTM * layer_params,
2189
+ const BNNSLayerParametersLSTM * layer_delta_params,
2190
+ const BNNSFilterParameters * _Nullable filter_params,
2191
+ const void * _Nullable training_cache_ptr,
2192
+ const size_t training_cache_capacity)
2193
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
2194
+
2195
+ /*!
2196
+ @abstract backward path of BNNSTile to calculate input delta from output delta
2197
+
2198
+ @discussion
2199
+ The size of output tensor along each dimension should be a multiple of input tensor,
2200
+ and the multiple is the number of repetition.
2201
+
2202
+ @param in_delta Pointer to the input delta tensor descriptor
2203
+ @param out_delta Pointer to the output delta tensor descriptor
2204
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2205
+ @return Zero on success, nonzero on failure.
2206
+ */
2207
+ int BNNSTileBackward(BNNSNDArrayDescriptor *_Nonnull in_delta,
2208
+ const BNNSNDArrayDescriptor *_Nonnull out_delta,
2209
+ const BNNSFilterParameters *_Nullable filter_params)
2210
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
2211
+
2212
+ /*!
2213
+ @abstract backward path of BNNSCropResize to calculate input delta from output delta
2214
+
2215
+ @discussion
2216
+ Only works on contiguous tensors
2217
+
2218
+ @param layer_params Pointer to layer parameter
2219
+ @param in_delta Pointer to the input delta tensor descriptor
2220
+ @param roi Pointer to regions of interest tensor descriptor
2221
+ @param out_delta Pointer to the output delta tensor descriptor
2222
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2223
+ @return Zero on success, nonzero on failure.
2224
+ */
2225
+ int BNNSCropResizeBackward(const BNNSLayerParametersCropResize * layer_params,
2226
+ BNNSNDArrayDescriptor *in_delta,
2227
+ const BNNSNDArrayDescriptor *roi,
2228
+ const BNNSNDArrayDescriptor *out_delta,
2229
+ const BNNSFilterParameters * _Nullable filter_params)
2230
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
2231
+
2232
+ #pragma mark - Utility
2233
+
2234
+ /*!
2235
+ @abstract Get NDArray descriptor containing reference to filter data member
2236
+
2237
+ @discussion
2238
+ Some filters have potentially trainiable parameters embedded in the filter structure (for example activation layers often have an alpha or beta parameter).
2239
+ To facilitate training or otherwise modifying these parameters after layer creation, we provide the following function.
2240
+ Note that the pointer is only valid until the BNNSFilter is destroyed, and that care must be taken if the filter is used on multiple threads.
2241
+
2242
+ @param filter Filter to obtain pointer into
2243
+ @param target enum specifying what a pointer is required to
2244
+
2245
+ @returns On success, a BNNSNDArrayDescriptor describing the requested parameter.
2246
+ On failure, a BNNSNDArrayDescriptor with data member set to NULL.
2247
+ */
2248
+ BNNSNDArrayDescriptor BNNSGetPointer(BNNSFilter filter, BNNSPointerSpecifier target)
2249
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(11.0, 15.0), ios(14.0, 18.0), watchos(7.0, 11.0), tvos(14.0, 18.0));
2250
+
2251
+ #endif
2252
+
2253
+ /*!
2254
+ @abstract calculate the size in bytes of the array data
2255
+ @return 0 if unable to determine the size (or array->data is null)
2256
+ */
2257
+ size_t BNNSNDArrayGetDataSize(const BNNSNDArrayDescriptor *_Nonnull array)
2258
+ __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
2259
+
2260
+ /*!
2261
+ @abstract calculate the minimum size in bytes of the array data given the shape and stride
2262
+ @return size of allocation sufficient to hold the tensor data, or `SIZE_T_MAX` if unable to
2263
+ determine the size (e.g. due to dynamic shape or overflow)
2264
+ */
2265
+ size_t BNNSTensorGetAllocationSize(const BNNSTensor *_Nonnull tensor)
2266
+ __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0));
2267
+
2268
+ /*!
2269
+ @abstract Determine the rank of the given layout
2270
+ @return The number of dimensions represented by `layout`, or `SIZE_T_MAX` if unable to determine
2271
+ */
2272
+ size_t BNNSDataLayoutGetRank(BNNSDataLayout layout)
2273
+ __API_AVAILABLE(macos(14.4), ios(17.4), watchos(10.4), tvos(17.4));
2274
+
2275
+ #if !0
2276
+
2277
+ /*!
2278
+ @abstract Converts sparse tensor from the standardized COO layout to a device specific sparse layout used by FullyConnected
2279
+ @discussion The COO format is similar to that used in tensorflow and described at https://www.tensorflow.org/guide/sparse_tensor
2280
+ - If the developer preallocates the workspace, it must be at least twice the size of the dense input.
2281
+ - BNNS will allocate scratch memory if workspace is NULL
2282
+ - the developer may pre allocate out->data to equal to the memory size of the dense input.
2283
+ - BNNS will allocate the memory for the sparse NDArray given by out if out->data is NULL, it will be the developer's responsibility to free this memory allocated by BNNS
2284
+ - if out->data was allocated to be >= size of input->data, we recommend query the output actual data size using BNNSNDArrayGeteDataSize after sparsify operation has been completed and reallocate to the smaller size
2285
+ - the size of dense input can be obtained by calling BNNSNDArrayGetDataSize
2286
+ - sparse_params are optional for the user to hint the attributes of the sparsity in the input. specifying pattern that doesn't match the sparse weights could result in failure to Sparsify the weights for Sparse Fully Connected
2287
+ @param in_dense_shape - describe the dense shape of the sparse 2D array. developer should set sizes and layout.
2288
+ @param in_indices - A 2D NDArray with shape [NNZ, rank], that contains the interleaved indices of the nonzero values. For row-major ordering, the even elements are the column indices and the odd elements are the row indices. For column-major ordering, the even element are the row indices and the odd elements are the column indices.
2289
+ @param in_values - A 1D NDArray with shape [NNZ] containing all nonzero values.
2290
+ @param out - nd array descriptor of device optimized BNNS Sparse Fully Connected weights. use it when setting BNNSLayerParametersFullyConnected for BNNSDirectApplyFullyConnectedBatch or BNNSFilterCreateLayerFullyConnected
2291
+ @param sparse_params - optional data structure to hint the sparsify function. this could help identifying specialized patterns that can be accelerated compared to unstructured sparsity. see BNNSSparsityType for pattern types.
2292
+ @param batch_size - the expected batch_size when calling BNNSFilterCreateLayerFullyConnected or BNNSFilterApplyBatch with device optimized BNNS Sparse Fully Connected weights. this is important in the decision of how to pack the weights. when set to 0, assuming it will be set to 1 during inference
2293
+ @param workspace - scratch memory to use while generating the opaque BNNS Sparse Fully Connected weights. it is recommended that the size of this buffer should be equal to the memory size of the dense input. if set to NULL, BNNS will allocate and free during the run of BNNSNDArrayFullyConnectedSparsify.
2294
+ @param workspace_size - size in bytes of workspace when preallocated by the developer. Will be ignored if workspace is NULL.
2295
+ @return 0 for success, non 0 on failure (failure reason will reported in os logs)
2296
+ */
2297
+ int BNNSNDArrayFullyConnectedSparsifySparseCOO(const BNNSNDArrayDescriptor * _Nonnull in_dense_shape,
2298
+ const BNNSNDArrayDescriptor * _Nonnull in_indices,
2299
+ const BNNSNDArrayDescriptor * _Nonnull in_values,
2300
+ BNNSNDArrayDescriptor * _Nonnull out,
2301
+ const BNNSSparsityParameters * _Nullable sparse_params,
2302
+ const size_t batch_size,
2303
+ void * _Nullable workspace,
2304
+ const size_t workspace_size,
2305
+ const BNNSFilterParameters *_Nullable filter_params)
2306
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
2307
+
2308
+ /*!
2309
+ @abstract Converts sparse tensor from the standardized CSR layout to a device specific sparse layout used by FullyConnected
2310
+ @discussion
2311
+ - If the developer preallocate the workspace, it must be at least twice the size of the dense input.
2312
+ - BNNS will allocate scratch memory if workspace is NULL
2313
+ - the developer may pre allocate out->data to equal to the memory size of the dense input.
2314
+ - BNNS will allocate the memory for the sparse NDArray given by out if out->data is NULL, it will be the developer's responsibility to free this memory allocated by BNNS
2315
+ - if out->data was allocated to be >= size of input->data, we recommend query the output actual data size using BNNSNDArrayGeteDataSize after sparsify operation has been completed and reallocate to the smaller size
2316
+ - the size of dense input can be obtained by calling BNNSNDArrayGetDataSize
2317
+ - sparse_params are optional for the user to hint the attributes of the sparsity in the input. specifying pattern that doesn't match the sparse weights could result in failure to Sparsify the weights for Sparse Fully Connected
2318
+ @param in_dense_shape - describe the dense shape of the sparse 2D array. developer should set sizes and layout.
2319
+ @param in_column_indices - A 1D NDArray with shape [NNZ], containing the column indices of the nonzero values
2320
+ @param in_row_starts - A 1D NDArray with shape [row_size+1], containing pointers to the start of each row. (expected value 0 in location [0])
2321
+ @param in_values - A 1D NDArray with shape [NNZ] containing all nonzero values.
2322
+ @param out - nd array descriptor of device optimized BNNS Sparse Fully Connected weights. use it when setting BNNSLayerParametersFullyConnected for BNNSDirectApplyFullyConnectedBatch or BNNSFilterCreateLayerFullyConnected
2323
+ @param sparse_params - optional data structure to hint the sparsify function. this could help identifying specialized patterns that can be accelerated compared to unstructured sparsity. see BNNSSparsityType for pattern types.
2324
+ @param batch_size - the expected batch_size when calling BNNSFilterCreateLayerFullyConnected or BNNSFilterApplyBatch with device optimized BNNS Sparse Fully Connected weights. this is important in the decision of how to pack the weights. when set to 0, assuming it will be set to 1 during inference
2325
+ @param workspace - scratch memory to use while generating the opaque BNNS Sparse Fully Connected weights. it is recommended that the size of this buffer should be equal to the memory size of the dense input. if set to NULL, BNNS will allocate and free during the run of BNNSNDArrayFullyConnectedSparsify.
2326
+ @param workspace_size - size in bytes of workspace when preallocated by the developer. Will be ignored if workspace is NULL.
2327
+ @return 0 for success, non 0 on failure (failure reason will reported in os logs)
2328
+ */
2329
+ int BNNSNDArrayFullyConnectedSparsifySparseCSR(const BNNSNDArrayDescriptor * _Nonnull in_dense_shape,
2330
+ const BNNSNDArrayDescriptor * _Nonnull in_column_indices,
2331
+ const BNNSNDArrayDescriptor * _Nonnull in_row_starts,
2332
+ const BNNSNDArrayDescriptor * _Nonnull in_values,
2333
+ BNNSNDArrayDescriptor * _Nonnull out,
2334
+ const BNNSSparsityParameters * _Nullable sparse_params,
2335
+ const size_t batch_size,
2336
+ void * _Nullable workspace,
2337
+ const size_t workspace_size,
2338
+ const BNNSFilterParameters *_Nullable filter_params)
2339
+ __API_DEPRECATED("Use BNNSGraph* APIs", macos(13.0, 15.0), ios(16.0, 18.0), watchos(9.0, 11.0), tvos(16.0, 18.0));
2340
+
2341
+ #endif
2342
+
2343
+ #pragma mark - Random number generation
2344
+
2345
+ /*!
2346
+
2347
+ @abstract Random number generator object
2348
+
2349
+ */
2350
+ typedef void * _Nullable BNNSRandomGenerator;
2351
+
2352
+ /*!
2353
+ @abstract Create a random number generator
2354
+
2355
+ @discussion
2356
+ Creates a BNNSRandomGenerator object that can be used to generate a stream of random numbers.
2357
+ The generator will be intialized using an interally generated seed that will vary from call to call.
2358
+
2359
+ @param method - method to be used for random number generation.
2360
+
2361
+ @param filter_params - options structure, if NULL, defaults are used.
2362
+
2363
+ @returns On success, an BNNSRandomGenerator object describing the RNG state.
2364
+ On failure, returns NULL.
2365
+
2366
+ @seealso BNNSCreateRandomGeneratorWithSeed
2367
+ */
2368
+ BNNSRandomGenerator BNNSCreateRandomGenerator(BNNSRandomGeneratorMethod method, const BNNSFilterParameters * _Nullable filter_params)
2369
+ __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
2370
+
2371
+ /*!
2372
+ @abstract Create a random number generator using the given seed
2373
+
2374
+ @discussion
2375
+ Creates a BNNSRandomGenerator object that can be used to generate a stream of random numbers.
2376
+
2377
+ @param method - method to be used for random number generation.
2378
+
2379
+ @param seed - random seed to be used when initializing generator.
2380
+
2381
+ @param filter_params - options structure, if NULL, defaults are used.
2382
+
2383
+ @returns On success, an BNNSRandomGenerator object describing the RNG state.
2384
+ On failure, returns NULL.
2385
+
2386
+ @seealso BNNSCreateRandomGenerator
2387
+ */
2388
+ BNNSRandomGenerator BNNSCreateRandomGeneratorWithSeed(BNNSRandomGeneratorMethod method, uint64_t seed, const BNNSFilterParameters * _Nullable filter_params)
2389
+ __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
2390
+
2391
+ /*! @abstract Destroys a random number generator object
2392
+ *
2393
+ * @discussion
2394
+ * Frees memory allocated by BNNSCreateRandomGenerator
2395
+ *
2396
+ * @param generator - generator to be destroyed
2397
+ */
2398
+ void BNNSDestroyRandomGenerator(BNNSRandomGenerator generator)
2399
+ __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
2400
+
2401
+ /*! @abstract Get the state size in bytes for a RandomGenerator
2402
+ *
2403
+ * @discussion
2404
+ * This captures the state from a random generator object such that it can be copied or stored and used to restore the
2405
+ * generator at a later point.
2406
+ *
2407
+ * @param generator - generator to be queried
2408
+ *
2409
+ * @returns State size in bytes (0 on failure).
2410
+ */
2411
+ size_t BNNSRandomGeneratorStateSize(BNNSRandomGenerator generator)
2412
+ __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
2413
+
2414
+ /*! @abstract Get the state for a RandomGenerator
2415
+ *
2416
+ * @discussion
2417
+ * This captures the state from a random generator object such that it can be copied or stored and used to restore the
2418
+ * generator at a later point.
2419
+ * Note that if generator is used on multiple threads, usage is serialized through an internal lock. In this scenario we recommend
2420
+ * users create a different BNNSRandomGenerator object with a different seed for each thread to ensure consistency of output
2421
+ * on any replay usingBNNSRandomGeneratorGetState/ BNNSRandomGeneratorSetState.
2422
+ *
2423
+ * @param generator - generator to be queried
2424
+ *
2425
+ * @param state_size - size of state buffer in bytes, must be at least as large as the value returned by BNNSRandomGeneratorStateSize.
2426
+ *
2427
+ * @param state - pointer to space of size returned by call to BNNSRandomGeneratorStateSize(generator)
2428
+ *
2429
+ * @returns 0 on success, nonzero on error.
2430
+ */
2431
+ int BNNSRandomGeneratorGetState(BNNSRandomGenerator generator, size_t state_size, void* state)
2432
+ __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
2433
+
2434
+ /*! @abstract Set the state for a RandomGenerator
2435
+ *
2436
+ * @discussion
2437
+ * Restores the state for a RandomGenerator from one captured by a previous call to BNNSRandomGeneratorGetState().
2438
+ * Note that if generator is used on multiple threads, usage is serialized through an internal lock. In this scenario we recommend
2439
+ * users create a different BNNSRandomGenerator object with a different seed for each thread to ensure consistency of output
2440
+ * on any replay using BNNSRandomGeneratorGetState/BNNSRandomGeneratorSetState.
2441
+ *
2442
+ * @param generator - generator to be updated
2443
+ *
2444
+ * @param state_size - size of state buffer in bytes, only the first BNNSRandomGeneratorStateSize() bytes are copied.
2445
+ *
2446
+ * @param state - pointer to space of size returned by call to BNNSRandomGeneratorStateSize(generator)
2447
+ *
2448
+ * @returns 0 on success, nonzero on error.
2449
+ */
2450
+ int BNNSRandomGeneratorSetState(BNNSRandomGenerator generator, size_t state_size, void* state)
2451
+ __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
2452
+
2453
+ /*! @abstract Fill the supplied tensor with random float data using the supplied generator mapped to the Unif(a, b) distribution
2454
+ *
2455
+ * @discussion
2456
+ * We generate pseudo-random values from Unif(a, b).
2457
+ * Note that if generator is used on multiple threads, usage is serialized through an internal lock. In this scenario we recommend
2458
+ * users create a different BNNSRandomGenerator object with a different seed for each thread to ensure consistency of output
2459
+ * on any replay using BNNSRandomGeneratorGetState/BNNSRandomGeneratorSetState and to eliminate contention.
2460
+ * Should a or b be outside the range of representable values for the output descriptor's data type, they will be capped at the
2461
+ * closest finite value that is representable.
2462
+ *
2463
+ * @param generator - random generator to be used
2464
+ *
2465
+ * @param desc - tensor descriptor to be filled with random values, data type must be floating point
2466
+ *
2467
+ * @param a - lower bound of distribution (if desc.data_type is not BNNSDataTypeFloat32, a must be exact exactly representable in the requested precision)
2468
+ *
2469
+ * @param b - upper bound of distribution (if desc.data_type is not BNNSDataTypeFloat32, b must be exact exactly representable in the requested precision)
2470
+ *
2471
+ * @returns 0 on success, nonzero on error.
2472
+ */
2473
+ int BNNSRandomFillUniformFloat(BNNSRandomGenerator generator, BNNSNDArrayDescriptor *desc, float a, float b)
2474
+ __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
2475
+
2476
+ /*! @abstract Fill the supplied tensor with random integer data using the supplied generator mapped to the Unif(a, b) distribution
2477
+ *
2478
+ * @discussion
2479
+ * We generate pseudo-random values from Unif(mean-variance, mean+variance).
2480
+ * Note that if generator is used on multiple threads, usage is serialized through an internal lock. In this scenario we recommend
2481
+ * users create a different BNNSRandomGenerator object with a different seed for each thread to ensure consistency of output
2482
+ * on any replay using BNNSRandomGeneratorGetState/BNNSRandomGeneratorSetState and to eliminate contention.
2483
+ * Should a or b be outside the range of representable values for the output descriptor's data type, they will be capped at the
2484
+ * closest value that is representable.
2485
+ *
2486
+ * @param generator - random generator to be used
2487
+ *
2488
+ * @param desc - tensor descriptor to be filled with random values, data type must be integer
2489
+ *
2490
+ * @param a - lower bound of distribution
2491
+ *
2492
+ * @param b - upper bound of distribution
2493
+ *
2494
+ * @returns 0 on success, nonzero on error.
2495
+ */
2496
+ int BNNSRandomFillUniformInt(BNNSRandomGenerator generator, BNNSNDArrayDescriptor *desc, int64_t a, int64_t b)
2497
+ __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0));
2498
+
2499
+
2500
+ /*! @abstract Fill the supplied tensor with random float data using the supplied generator mapped to a normal distribution
2501
+ *
2502
+ * @discussion
2503
+ * We generate a standard normal distribution for a specified mean and standard deviation.
2504
+ * Note that if generator is used on multiple threads, usage is serialized through an internal lock. In this scenario we recommend
2505
+ * users create a different BNNSRandomGenerator object with a different seed for each thread to ensure consistency of output
2506
+ * on any replay using BNNSRandomGeneratorGetState/BNNSRandomGeneratorSetState and to eliminate contention.
2507
+ * Should a or b be outside the range of representable values for the output descriptor's data type, they will be capped at the
2508
+ * closest finite value that is representable.
2509
+ *
2510
+ * @param generator - random generator to be used
2511
+ *
2512
+ * @param desc - tensor descriptor to be filled with random values, data type must be floating point
2513
+ *
2514
+ * @param mean - mean of distribution
2515
+ *
2516
+ * @param stddev - standard deviation of distribution
2517
+ *
2518
+ * @returns 0 on success, nonzero on error.
2519
+ */
2520
+ int BNNSRandomFillNormalFloat(BNNSRandomGenerator generator, BNNSNDArrayDescriptor *desc, float mean, float stddev)
2521
+ __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0));
2522
+
2523
+
2524
+ /*! @abstract Fill the supplied tensor with random float data using the supplied generator mapped to
2525
+ * categorical distributions with the given event (log) probabilities.
2526
+ *
2527
+ * @discussion
2528
+ * We generate random values from a categorical distribution with specified event probabilities or event log probabilities.
2529
+ * Note that if generator is used on multiple threads, usage is serialized through an internal lock. In this scenario we recommend
2530
+ * users create a different BNNSRandomGenerator object with a different seed for each thread to ensure consistency of output
2531
+ * on any replay using BNNSRandomGeneratorGetState/BNNSRandomGeneratorSetState and to eliminate contention.
2532
+ * Assume r is the rank of the probabilities tensor, and K is the inner most dimension of probabilities tensor, i.e., probabilities.size[r-1].
2533
+ * Then, desc must be a rank r tensor with the first r-1 dimensions having the same size as the first r-1 dimensions of probabilities, where
2534
+ * the first r-1 dimensions are treated as batch sizes and each desc [i_0, ..., i_r-2, i_r-1] will be an integer in 0,1,..., K-1 drawn from the
2535
+ * categorical distribution from the corresponding probabilities slice [i_0, ..., i_r-2, :]. That is to say desc.size[r-1] samples are drawn from
2536
+ * a categorical distribution, such that P(desc[i_0, ..., i_r-2, i_r-1] == k) = probabilities[i0, ..., i_r-2, k].
2537
+ * The probabilities data is assumed to be nonnegative and finite, which will be normalized to sum one along the inner most dimension.
2538
+ * The log probabilities data will be normalized, so their exponentials sum to one along the inner most dimension.
2539
+ *
2540
+ * @param generator - random generator to be used
2541
+ *
2542
+ * @param desc - tensor descriptor to be filled with random values, data type must be floating point
2543
+ *
2544
+ * @param probabilities - probabilities or log probabilities, data type must be the same as desc
2545
+ *
2546
+ * @param log_probabilities - true if log probabilities is provided, otherwise probabilities data is provided
2547
+ *
2548
+ * @returns 0 on success, nonzero on error.
2549
+ */
2550
+ int BNNSRandomFillCategoricalFloat(BNNSRandomGenerator generator,
2551
+ const BNNSNDArrayDescriptor *desc,
2552
+ const BNNSNDArrayDescriptor *probabilities,
2553
+ bool log_probabilities)
2554
+ __API_AVAILABLE(macos(14.0), ios(17.0), watchos(10.0), tvos(17.0));
2555
+
2556
+ #if !0
2557
+
2558
+ #pragma mark - K-Nearest Neighbors
2559
+
2560
+ /*!
2561
+
2562
+ @abstract K-nearest neighbors container object
2563
+
2564
+ */
2565
+ typedef void * _Nullable BNNSNearestNeighbors;
2566
+
2567
+ /**
2568
+ @abstract Create a BNNSNearestNeighbors object, that is used to calculate k nearest neighbors of data points
2569
+ based on Euclidean distance
2570
+
2571
+ @param max_n_samples - maximum number of data points
2572
+ @param n_features - number of features (dimensions) of each data point
2573
+ @param n_neighbors - number of nearest neighbors
2574
+ @param data_type - data type of the features, only fp32 and fp16 is supported by now
2575
+ @param filter_params - filter runtime parameters, may be NULL for default parameters
2576
+
2577
+ @return On success, a BNNSNearestNeighbors object is created. On failure, returns NULL.
2578
+ */
2579
+ BNNSNearestNeighbors BNNSCreateNearestNeighbors(const unsigned int max_n_samples,
2580
+ const unsigned int n_features,
2581
+ const unsigned int n_neighbors,
2582
+ const BNNSDataType data_type,
2583
+ const BNNSFilterParameters * _Nullable filter_params)
2584
+ __API_AVAILABLE(macos(14.0), ios(17.0), watchos(10.0), tvos(17.0));
2585
+
2586
+ /**
2587
+ @abstract Destroy a BNNSNearestNeighbors object
2588
+
2589
+ @param knn - the BNNSNearestNeighbors object to be destroyed
2590
+ */
2591
+ void BNNSDestroyNearestNeighbors(BNNSNearestNeighbors knn)
2592
+ __API_AVAILABLE(macos(14.0), ios(17.0), watchos(10.0), tvos(17.0));
2593
+
2594
+ /**
2595
+ @abstract Add new sample data to BNNSNearestNeighbors
2596
+
2597
+ @param knn - the BNNSNearestNeighbors object used for calculation and storage
2598
+ @param n_new_samples - number of new data points to be added
2599
+ @param data_ptr - pointer to the new data array of size [n_new_samples, n_features]
2600
+
2601
+ @return 0 for success, nonzero on failure (failure reason will reported in os logs)
2602
+ */
2603
+ int BNNSNearestNeighborsLoad(BNNSNearestNeighbors knn,
2604
+ const unsigned int n_new_samples,
2605
+ const void* data_ptr)
2606
+ __API_AVAILABLE(macos(14.0), ios(17.0), watchos(10.0), tvos(17.0));
2607
+
2608
+ /**
2609
+ @abstract Return the sorted indices and distances of the k nearest neighbors to certain sample point
2610
+
2611
+ @param knn - the BNNSNearestNeighbors object used for calculation and storage
2612
+ @param sample_number - sample number to return the k nearest neighbors, if negative return all of them
2613
+ @param indices - sorted indices of the k nearest neighbors to the sample point (sample_number), if not null.
2614
+ If sample_number is negative, indices is an array of [n_samples, n_neighbors], otherwise indices is an array of [n_neighbors].
2615
+ Return -1 for n_neighbors larger than n_samples.
2616
+ @param distances - sorted distances of the k nearest neighbors to the sample point (sample_number), if not null.
2617
+ If sample_number is negative, distances is an array of [n_samples, n_neighbors], otherwise distances is an array of [n_neighbors].
2618
+ Return INFINITY for n_neighbors larger than n_samples.
2619
+
2620
+ @return 0 for success, nonzero on failure (failure reason will reported in os logs)
2621
+ */
2622
+ int BNNSNearestNeighborsGetInfo(const BNNSNearestNeighbors knn,
2623
+ const int sample_number,
2624
+ int * _Nullable indices,
2625
+ void * _Nullable distances)
2626
+ __API_AVAILABLE(macos(14.0), ios(17.0), watchos(10.0), tvos(17.0));
2627
+
2628
+ #pragma mark - Deprecated Filter Creation Functions
2629
+
2630
+ /*!
2631
+
2632
+ @abstract Create a convolution layer filter (DEPRECATED, Use BNNSFilterCreateLayerConvolution)
2633
+
2634
+ @discussion
2635
+ Creates a filter applying the convolution described in <tt>layer_params</tt>.
2636
+ Some combinations of the parameters may not be supported, in which case the call will fail.
2637
+
2638
+ @param in_desc Input image stack descriptor
2639
+ @param out_desc Output image stack descriptor
2640
+ @param layer_params Layer parameters and weights
2641
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2642
+
2643
+ @return A new non-NULL filter on success, and NULL on failure.
2644
+
2645
+ */
2646
+ BNNSFilter BNNSFilterCreateConvolutionLayer(const BNNSImageStackDescriptor * in_desc,
2647
+ const BNNSImageStackDescriptor * out_desc,
2648
+ const BNNSConvolutionLayerParameters * layer_params,
2649
+ const BNNSFilterParameters * _Nullable filter_params)
2650
+ __API_DEPRECATED_WITH_REPLACEMENT("BNNSFilterCreateLayerConvolution", macos(10.12, 11.0), ios(10.0, 14.0), watchos(3.0, 7.0), tvos(10.0, 14.0));
2651
+
2652
+ /*!
2653
+
2654
+ @abstract Create a fully connected layer filter (DEPRECATED, Use BNNSFilterCreateLayerFullyConnected)
2655
+
2656
+ @discussion
2657
+ Creates a filter applying the fully connected layer described in <tt>layer_params</tt>.
2658
+ Some combinations of the parameters may not be supported, in which case the call will fail.
2659
+
2660
+ @param in_desc Input vector descriptor
2661
+ @param out_desc Output vector descriptor
2662
+ @param layer_params Layer parameters and weights
2663
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2664
+
2665
+ @return A new non-NULL filter on success, and NULL on failure.
2666
+
2667
+ */
2668
+ BNNSFilter BNNSFilterCreateFullyConnectedLayer(const BNNSVectorDescriptor * in_desc,
2669
+ const BNNSVectorDescriptor * out_desc,
2670
+ const BNNSFullyConnectedLayerParameters * layer_params,
2671
+ const BNNSFilterParameters * _Nullable filter_params)
2672
+ __API_DEPRECATED_WITH_REPLACEMENT("BNNSFilterCreateLayerFullyConnected", macos(10.12, 11.0), ios(10.0, 14.0), watchos(3.0, 7.0), tvos(10.0, 14.0));
2673
+
2674
+ /*!
2675
+
2676
+ @abstract Create a pooling layer filter (DEPRECATED, Use BNNSFilterCreateLayerPooling)
2677
+
2678
+ @discussion
2679
+ Creates a filter applying the pooling layer described in <tt>layer_params</tt>
2680
+ Some combinations of the parameters may not be supported, in which case the call will fail.
2681
+
2682
+ @param in_desc Input image stack descriptor
2683
+ @param out_desc Output image stack descriptor
2684
+ @param layer_params Layer parameters and weights
2685
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2686
+
2687
+ @return A new non-NULL filter on success, and NULL on failure.
2688
+
2689
+ */
2690
+ BNNSFilter BNNSFilterCreatePoolingLayer(const BNNSImageStackDescriptor * in_desc,
2691
+ const BNNSImageStackDescriptor * out_desc,
2692
+ const BNNSPoolingLayerParameters * layer_params,
2693
+ const BNNSFilterParameters * _Nullable filter_params)
2694
+ __API_DEPRECATED_WITH_REPLACEMENT("BNNSFilterCreateLayerPooling", macos(10.12, 11.0), ios(10.0, 14.0), watchos(3.0, 7.0), tvos(10.0, 14.0));
2695
+
2696
+ /*!
2697
+
2698
+ @abstract Create a vector conversion/activation layer filter (DEPRECATED, Use BNNSFilterCreateLayerActivation)
2699
+
2700
+ @discussion
2701
+ Creates a filter applying the given activation function and conversions to vectors. Input and output vectors must have the same size.
2702
+
2703
+ @param in_desc Input vector descriptor
2704
+ @param out_desc Output vector descriptor
2705
+ @param activation Activation function to apply and its parameters
2706
+ @param filter_params Filter runtime parameters, may be NULL for default parameters
2707
+
2708
+ @return A new non-NULL filter on success, and NULL on failure.
2709
+
2710
+ */
2711
+ BNNSFilter BNNSFilterCreateVectorActivationLayer(const BNNSVectorDescriptor * in_desc,
2712
+ const BNNSVectorDescriptor * out_desc,
2713
+ const BNNSActivation * activation,
2714
+ const BNNSFilterParameters * _Nullable filter_params)
2715
+ __API_DEPRECATED_WITH_REPLACEMENT("BNNSFilterCreateLayerActivation", macos(10.13, 11.0), ios(11.0, 14.0), watchos(4.0, 7.0), tvos(11.0, 14.0));
2716
+
2717
+ #endif
2718
+
2719
+ #if !__has_include( <Availability.h> )
2720
+ #undef __API_AVAILABLE
2721
+ #undef __API_DEPRECATED
2722
+ #undef __API_DEPRECATED_WITH_REPLACEMENT
2723
+ #endif
2724
+
2725
+ #if __has_feature(assume_nonnull)
2726
+ _Pragma("clang assume_nonnull end")
2727
+ #else
2728
+ #undef _Nullable
2729
+ #undef _Null_unspecified
2730
+ #undef _Nonnull
2731
+ #endif
2732
+
2733
+ #ifdef __cplusplus
2734
+ }
2735
+ #endif
2736
+
2737
+
2738
+ #endif // __BNNS_HEADER__