peachsim 0.1.1692 → 0.1.1700
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli/bridge-flow-runner.ts +61 -39
- package/cli/commands/agent-wrapper.ts +21 -10
- package/cli/commands/control.ts +27 -7
- package/cli/commands/coverage.ts +1 -1
- package/cli/commands/detect.ts +17 -4
- package/cli/commands/maestro-compare.ts +25 -99
- package/cli/help-core.ts +3 -4
- package/cli/maestro-compare.ts +172 -4
- package/cli/outbound-endpoints.ts +2 -10
- package/detox/index.ts +15 -0
- package/detox/launch-permissions.ts +169 -0
- package/dist-lib/agent-daemon-client.cjs +2 -2
- package/dist-lib/agent-events.cjs +2 -2
- package/dist-lib/attached-projects.cjs +2 -2
- package/dist-lib/auth/shared-session.cjs +2 -2
- package/dist-lib/backend-origin.cjs +2 -2
- package/dist-lib/beta.cjs +2 -2
- package/dist-lib/beta.mjs +1 -1
- package/dist-lib/bridge-constants.cjs +2 -2
- package/dist-lib/bridge-contract-input.cjs +2 -2
- package/dist-lib/bridge-contract-input.mjs +1 -1
- package/dist-lib/bridge-contract.cjs +2 -2
- package/dist-lib/bridge-contract.mjs +1 -1
- package/dist-lib/bundle-channel.cjs +18273 -15925
- package/dist-lib/capture-contract.cjs +2 -2
- package/dist-lib/capture-contract.mjs +1 -1
- package/dist-lib/cloud-contract.cjs +2 -2
- package/dist-lib/cloud-contract.mjs +1 -1
- package/dist-lib/cloud-test-args.cjs +2 -2
- package/dist-lib/cloud-test-args.mjs +1 -1
- package/dist-lib/cloud.cjs +2 -2
- package/dist-lib/cloud.mjs +1 -1
- package/dist-lib/config.cjs +2 -2
- package/dist-lib/config.mjs +1 -1
- package/dist-lib/detox/index.cjs +104 -3
- package/dist-lib/dev-bundle-resolution.cjs +208 -44
- package/dist-lib/expo-swift-bundle.cjs +2349 -1778
- package/dist-lib/expo-swift-metadata.cjs +2 -2
- package/dist-lib/expo-swift-metadata.mjs +1 -1
- package/dist-lib/home-paths.cjs +2 -2
- package/dist-lib/host/bridge-host.cjs +7885 -3334
- package/dist-lib/host/fetch-proxy-handler.cjs +331 -39
- package/dist-lib/host/fetch-proxy-overrides.cjs +2 -2
- package/dist-lib/host/fetch-proxy-overrides.mjs +1 -1
- package/dist-lib/host/replacement-module-handler.cjs +2 -2
- package/dist-lib/host/websocket-proxy.cjs +2 -2
- package/dist-lib/index.cjs +297 -77
- package/dist-lib/jump-to-source-babel.cjs +2 -2
- package/dist-lib/jump-to-source-native.cjs +2 -2
- package/dist-lib/kotlin-host.cjs +2 -2
- package/dist-lib/menu.cjs +2 -2
- package/dist-lib/menu.mjs +1 -1
- package/dist-lib/metro-fingerprint-registry.cjs +2 -2
- package/dist-lib/metro-fingerprint-registry.mjs +1 -1
- package/dist-lib/metro-production-bundle.cjs +2 -2
- package/dist-lib/metro-production-bundle.mjs +1 -1
- package/dist-lib/metro.cjs +294 -74
- package/dist-lib/native-app-identity-project.cjs +48 -37
- package/dist-lib/native-app-identity-project.mjs +47 -36
- package/dist-lib/native-app-identity.cjs +2 -2
- package/dist-lib/native-app-identity.mjs +1 -1
- package/dist-lib/native-firebase-metadata.cjs +2 -2
- package/dist-lib/native-firebase-metadata.mjs +1 -1
- package/dist-lib/plist.cjs +2 -2
- package/dist-lib/plist.mjs +1 -1
- package/dist-lib/profiles.cjs +2 -2
- package/dist-lib/public-brand.cjs +2 -2
- package/dist-lib/public-origins-lib-esm.json +24 -23
- package/dist-lib/public-origins-lib.json +199 -79
- package/dist-lib/react-native-host-modules.cjs +2 -2
- package/dist-lib/react-native-host-modules.mjs +1 -1
- package/dist-lib/reap-browser.cjs +2 -2
- package/dist-lib/scripts/dev-server-scanner.cjs +206 -31
- package/dist-lib/sdk.cjs +2 -2
- package/dist-lib/sdk.mjs +1 -1
- package/dist-lib/skills.cjs +19600 -15992
- package/dist-lib/swift-compile.cjs +640 -402
- package/dist-lib/swift-compile.mjs +595 -357
- package/dist-lib/swift-package.cjs +24 -20
- package/dist-lib/swift-package.mjs +23 -19
- package/dist-lib/swift-submit.cjs +2 -2
- package/dist-lib/swift-submit.mjs +1 -1
- package/dist-lib/swift-toolchain.cjs +31 -4
- package/dist-lib/swift.cjs +2 -2
- package/dist-lib/vite-swift.cjs +1559 -1208
- package/dist-lib/vite.cjs +251 -42
- package/dist-lib/worklet-executable.cjs +2 -2
- package/dist-lib/worklet-executable.mjs +1 -1
- package/dist-types/packages/peach-engine/src/engine/font-config.d.ts +1 -1
- package/dist-types/packages/peach-engine/src/engine/node.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/engine/scroll-pan-contacts.d.ts +3 -1
- package/dist-types/packages/peach-engine/src/engine/scroll.d.ts +7 -0
- package/dist-types/packages/peach-engine/src/engine/types.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/remote-stream/cloud-display.d.ts +2 -2
- package/dist-types/packages/peach-engine/src/render-worker/host-service-protocol.d.ts +3 -0
- package/dist-types/packages/peach-engine/src/render-worker/protocol.d.ts +1 -0
- package/dist-types/packages/peach-engine/src/render-worker/scroll-mirror.d.ts +17 -0
- package/dist-types/packages/peach-engine/src/render-worker/worker-input-runtime.d.ts +2 -1
- package/dist-types/packages/peach-engine/src/render-worker/worklet-runtime.d.ts +3 -0
- package/dist-types/packages/peach-globals/src/cameraBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/replayBridgeContract.d.ts +1 -0
- package/dist-types/packages/peach-globals/src/shellHostBridgeContract.d.ts +3 -0
- package/dist-types/packages/peach-kit/src/materials/types.d.ts +1 -0
- package/package.json +1 -1
- package/runtime-companion.json +1 -1
- package/scripts/dev-server-scanner.ts +4 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Alpha.h +2282 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/BasicImageTypes.h +55 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Conversion.h +10551 -6
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Convolution.h +4236 -3
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Geometry.h +827 -8
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Histogram.h +1369 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Morphology.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/Transform.h +1747 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage.h +291 -2
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_CVUtilities.h +1283 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Types.h +811 -91
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vImage.framework/Headers/vImage_Utilities.h +1342 -25
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns.h +2738 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_constants.h +1685 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_graph.h +913 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/BNNS/bnns_structures.h +1917 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/LinearAlgebra.h +23 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/arithmetic.h +209 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/base.h +104 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/linear_systems.h +77 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/matrix.h +554 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/norms.h +58 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/object.h +186 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/splat.h +86 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/LinearAlgebra/vector.h +364 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Integration.h +195 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Quadrature/Quadrature.h +44 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/BLAS.h +2330 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/BLAS/Types.h +123 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Solve.h +8339 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementation.h +520 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/SolveImplementationTyped.h +1893 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/Sparse/Sparse.h +10 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/blas_new.h +1098 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas.h +859 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/cblas_new.h +1134 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/clapack.h +10555 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/fortran_blas.h +695 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack.h +38526 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_types.h +60 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/lapack_version.h +20 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/thread_api.h +50 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBasicOps.h +1218 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vBigNum.h +1458 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP.h +10377 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vDSP_translate.h +167 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vForce.h +1243 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLib.h +114 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vecLibTypes.h +146 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vectorOps.h +1106 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Frameworks/vecLib.framework/Headers/vfp.h +294 -0
- package/sdk/ios/System/Library/Frameworks/Accelerate.framework/Headers/Accelerate.h +25 -1
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFArray.h +673 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFAvailability.h +232 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFBase.h +827 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCalendar.h +121 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFCharacterSet.h +387 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFData.h +79 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDate.h +122 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFDictionary.h +674 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFError.h +182 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFLocale.h +213 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNotificationCenter.h +82 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFNumber.h +129 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFSet.h +491 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFString.h +883 -2
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CFTimeZone.h +98 -0
- package/sdk/ios/System/Library/Frameworks/CoreFoundation.framework/Headers/CoreFoundation.h +11 -229
- package/sdk/ios/System/Library/Frameworks/CoreGraphics.framework/Headers/CoreGraphics.h +2 -6
- package/sdk/ios/System/Library/Frameworks/Foundation.framework/Headers/Foundation.h +2 -1
- package/sdk/ios/System/Library/Frameworks/QuartzCore.framework/Headers/QuartzCore.h +1 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecBase.h +906 -3
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecCertificate.h +613 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecItem.h +1284 -29
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecPolicy.h +441 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/SecTrust.h +845 -0
- package/sdk/ios/System/Library/Frameworks/Security.framework/Headers/Security.h +4 -0
- package/sdk/ios/usr/include/AvailabilityMacros.h +3985 -0
- package/sdk/ios/usr/include/copyfile.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc.h +143 -0
- package/sdk/ios/usr/include/malloc/_malloc_type.h +153 -0
- package/sdk/ios/usr/include/malloc/_platform.h +80 -0
- package/sdk/ios/usr/include/malloc/_ptrcheck.h +43 -0
- package/sdk/ios/usr/include/malloc/malloc.h +768 -0
- package/sdk/ios/usr/include/os/availability.h +168 -6
- package/sdk/ios/usr/include/os/base.h +351 -0
- package/sdk/ios/usr/include/os/clock.h +18 -0
- package/sdk/ios/usr/include/os/lock.h +232 -10
- package/sdk/ios/usr/include/os/log.h +521 -38
- package/sdk/ios/usr/include/os/object.h +320 -3
- package/sdk/ios/usr/include/os/trace.h +492 -0
- package/sdk/ios/usr/include/os/trace_base.h +167 -0
- package/sdk/ios/usr/include/os/workgroup.h +37 -0
- package/sdk/ios/usr/include/os/workgroup_base.h +91 -0
- package/sdk/ios/usr/include/os/workgroup_interval.h +156 -0
- package/sdk/ios/usr/include/os/workgroup_object.h +359 -0
- package/sdk/ios/usr/include/os/workgroup_parallel.h +76 -0
- package/sdk/ios/usr/include/sys/cdefs.h +38 -0
- package/sdk/ios/wasm/include/unistd.h +3 -0
- package/skills/contrast/SKILL.md +3 -0
- package/src/codex-client.ts +11 -6
- package/src/dev-bundle-resolution.ts +124 -48
- package/src/expo-native-workspace.ts +176 -0
- package/src/expo-swift-host.ts +161 -26
- package/src/expo-swift-ready.ts +14 -28
- package/src/expoSwiftContract.ts +4 -1
- package/src/generated/swift-c-predefines.json +68 -12
- package/src/host/bridge-host.ts +5 -0
- package/src/installed-package-versions.ts +14 -1
- package/src/metro-project-root.ts +44 -33
- package/src/native-app-identity-project.ts +1 -0
- package/src/nitro-adapter.lock.json +916 -10
- package/src/nitro-adapter.ts +33 -24
- package/src/nitro-bundle.ts +108 -22
- package/src/nitro-compile.ts +32 -5
- package/src/nitro-source.ts +13 -3
- package/src/nitroAdapterContract.ts +100 -20
- package/src/node-http-fetch.ts +116 -0
- package/src/packageVersionsContract.ts +46 -0
- package/src/serverDiscoveryContract.ts +1 -0
- package/src/settingsContract.ts +0 -30
- package/src/swift-binary-modules.ts +20 -5
- package/src/swift-compile.ts +168 -48
- package/src/swift-coverage/xcode-assets.ts +4 -3
- package/src/swift-host.ts +14 -3
- package/src/swift-objc-compile.ts +32 -5
- package/src/swift-objc-metadata.ts +2 -2
- package/src/swift-objc-platform.ts +2 -2
- package/src/swift-objc-standin.ts +43 -13
- package/src/swift-package.ts +33 -26
- package/src/swift-source-pods.ts +126 -41
- package/src/swift-standin-digest.ts +77 -0
- package/src/swift-standin-emit.ts +40 -4
- package/src/swift-standins.ts +68 -19
- package/src/swift-toolchain.ts +38 -0
- package/src/swiftContract.ts +8 -0
- package/src/vite-plugin.ts +0 -10
- package/src/xcode-project.ts +62 -42
- package/src/settings-flags.ts +0 -107
|
@@ -0,0 +1,1685 @@
|
|
|
1
|
+
//
|
|
2
|
+
// bnns_constants.h
|
|
3
|
+
// BasicNeuralNetworkSubroutines
|
|
4
|
+
//
|
|
5
|
+
// Copyright © 2017 Apple Inc. All rights reserved.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifndef __BNNS_CONSTANTS_HEADER__
|
|
9
|
+
#define __BNNS_CONSTANTS_HEADER__
|
|
10
|
+
|
|
11
|
+
#include <stdint.h>
|
|
12
|
+
|
|
13
|
+
#if __has_feature(objc_fixed_enum) || __has_extension(cxx_strong_enums)
|
|
14
|
+
#define BNNS_ENUM(_name, _type, ...) \
|
|
15
|
+
typedef enum : _type { __VA_ARGS__ } _name
|
|
16
|
+
#else
|
|
17
|
+
#define BNNS_ENUM(_name, _type, ...) \
|
|
18
|
+
enum { __VA_ARGS__ }; typedef _type _name
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#if __has_include( <Availability.h> )
|
|
22
|
+
#include <Availability.h>
|
|
23
|
+
#else
|
|
24
|
+
#define __API_AVAILABLE(...)
|
|
25
|
+
#define __API_DEPRECATED_WITH_REPLACEMENT(...)
|
|
26
|
+
#define __API_AVAILABLE(...)
|
|
27
|
+
#endif
|
|
28
|
+
|
|
29
|
+
/*!
|
|
30
|
+
|
|
31
|
+
@abstract Storage data type
|
|
32
|
+
|
|
33
|
+
@constant BNNSDataTypeFloatBit
|
|
34
|
+
Common bit to floating point types, this constant is not a valid type
|
|
35
|
+
|
|
36
|
+
@constant BNNSDataTypeFloat16
|
|
37
|
+
16-bit half precision floating point
|
|
38
|
+
|
|
39
|
+
@constant BNNSDataTypeFloat32
|
|
40
|
+
32-bit single precision floating point
|
|
41
|
+
|
|
42
|
+
@constant BNNSDataTypeBFloat16
|
|
43
|
+
16-bit brain floating Point
|
|
44
|
+
|
|
45
|
+
@constant BNNSDataTypeIntBit
|
|
46
|
+
Common bit to signed integer types, this constant is not a valid type
|
|
47
|
+
|
|
48
|
+
@constant BNNSDataTypeInt8
|
|
49
|
+
8-bit signed integer
|
|
50
|
+
|
|
51
|
+
@constant BNNSDataTypeInt16
|
|
52
|
+
16-bit signed integer
|
|
53
|
+
|
|
54
|
+
@constant BNNSDataTypeInt32
|
|
55
|
+
32-bit signed integer
|
|
56
|
+
|
|
57
|
+
@constant BNNSDataTypeInt64
|
|
58
|
+
64-bit signed integer
|
|
59
|
+
|
|
60
|
+
@constant BNNSDataTypeUIntBit
|
|
61
|
+
Common bit to unsigned integer types, this constant is not a valid type
|
|
62
|
+
|
|
63
|
+
@constant BNNSDataTypeUInt8
|
|
64
|
+
8-bit unsigned integer
|
|
65
|
+
|
|
66
|
+
@constant BNNSDataTypeUInt16
|
|
67
|
+
16-bit unsigned integer
|
|
68
|
+
|
|
69
|
+
@constant BNNSDataTypeUInt32
|
|
70
|
+
32-bit unsigned integer
|
|
71
|
+
|
|
72
|
+
@constant BNNSDataTypeUInt64
|
|
73
|
+
64-bit unsigned integer
|
|
74
|
+
|
|
75
|
+
@constant BNNSDataTypeIndexedBit
|
|
76
|
+
Common bit to indexed floating point types, this constant is not a valid type
|
|
77
|
+
|
|
78
|
+
@constant BNNSDataTypeIndexed2
|
|
79
|
+
2-bit unsigned indices into a floating point conversion table (4 values)
|
|
80
|
+
|
|
81
|
+
@constant BNNSDataTypeIndexed4
|
|
82
|
+
4-bit unsigned indices into a floating point conversion table (16 values)
|
|
83
|
+
|
|
84
|
+
@constant BNNSDataTypeIndexed8
|
|
85
|
+
8-bit unsigned indices into a floating point conversion table (256 values)
|
|
86
|
+
|
|
87
|
+
@constant BNNSDataTypeMiscellaneousBit
|
|
88
|
+
Common bit to miscellaneous types, this constant is not a valid type
|
|
89
|
+
|
|
90
|
+
@constant BNNSDataTypeBoolean
|
|
91
|
+
bool value
|
|
92
|
+
|
|
93
|
+
*/
|
|
94
|
+
BNNS_ENUM(BNNSDataType, uint32_t,
|
|
95
|
+
|
|
96
|
+
BNNSDataTypeFloatBit __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 0x10000,
|
|
97
|
+
BNNSDataTypeFloat16 __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = BNNSDataTypeFloatBit | 16,
|
|
98
|
+
BNNSDataTypeFloat32 __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = BNNSDataTypeFloatBit | 32,
|
|
99
|
+
BNNSDataTypeBFloat16 __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = BNNSDataTypeFloatBit | 0x8000 | 16,
|
|
100
|
+
|
|
101
|
+
BNNSDataTypeIntBit __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 0x20000,
|
|
102
|
+
BNNSDataTypeInt1 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSDataTypeIntBit | 1,
|
|
103
|
+
BNNSDataTypeInt2 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSDataTypeIntBit | 2,
|
|
104
|
+
BNNSDataTypeInt4 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSDataTypeIntBit | 4,
|
|
105
|
+
BNNSDataTypeInt8 __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = BNNSDataTypeIntBit | 8,
|
|
106
|
+
BNNSDataTypeInt16 __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = BNNSDataTypeIntBit | 16,
|
|
107
|
+
BNNSDataTypeInt32 __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = BNNSDataTypeIntBit | 32,
|
|
108
|
+
BNNSDataTypeInt64 __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = BNNSDataTypeIntBit | 64,
|
|
109
|
+
|
|
110
|
+
BNNSDataTypeUIntBit __API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = 0x40000,
|
|
111
|
+
BNNSDataTypeUInt1 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSDataTypeUIntBit | 1,
|
|
112
|
+
BNNSDataTypeUInt2 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSDataTypeUIntBit | 2,
|
|
113
|
+
BNNSDataTypeUInt3 __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = BNNSDataTypeUIntBit | 3,
|
|
114
|
+
BNNSDataTypeUInt4 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSDataTypeUIntBit | 4,
|
|
115
|
+
BNNSDataTypeUInt6 __API_AVAILABLE(macos(15.0), ios(18.0), watchos(11.0), tvos(18.0)) = BNNSDataTypeUIntBit | 6,
|
|
116
|
+
BNNSDataTypeUInt8 __API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = BNNSDataTypeUIntBit | 8,
|
|
117
|
+
BNNSDataTypeUInt16 __API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = BNNSDataTypeUIntBit | 16,
|
|
118
|
+
BNNSDataTypeUInt32 __API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = BNNSDataTypeUIntBit | 32,
|
|
119
|
+
BNNSDataTypeUInt64 __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = BNNSDataTypeUIntBit | 64,
|
|
120
|
+
|
|
121
|
+
BNNSDataTypeIndexedBit __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 0x80000,
|
|
122
|
+
BNNSDataTypeIndexed1 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSDataTypeIndexedBit | 1,
|
|
123
|
+
BNNSDataTypeIndexed2 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSDataTypeIndexedBit | 2,
|
|
124
|
+
BNNSDataTypeIndexed4 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSDataTypeIndexedBit | 4,
|
|
125
|
+
BNNSDataTypeIndexed8 __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = BNNSDataTypeIndexedBit | 8,
|
|
126
|
+
|
|
127
|
+
BNNSDataTypeMiscellaneousBit __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x100000,
|
|
128
|
+
BNNSDataTypeBoolean __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSDataTypeMiscellaneousBit | 8,
|
|
129
|
+
);
|
|
130
|
+
|
|
131
|
+
/*!
|
|
132
|
+
|
|
133
|
+
@abstract Pooling layer function
|
|
134
|
+
|
|
135
|
+
@discussion
|
|
136
|
+
In the definitions below, the input sample is <tt>X<sub>i</sub></tt> and has <tt>N</tt> elements.
|
|
137
|
+
|
|
138
|
+
@constant BNNSPoolingFunctionMax
|
|
139
|
+
max(X<sub>i</sub>)
|
|
140
|
+
|
|
141
|
+
@constant BNNSPoolingFunctionAverageCountIncludePadding
|
|
142
|
+
∑<sub>i</sub> X<sub>i</sub> / N
|
|
143
|
+
|
|
144
|
+
@constant BNNSPoolingFunctionAverageCountExcludePadding
|
|
145
|
+
∑<sub>i</sub> X<sub>i</sub> / n
|
|
146
|
+
- n is number of elements that weren't zero padded
|
|
147
|
+
|
|
148
|
+
@constant BNNSPoolingFunctionUnMax
|
|
149
|
+
partial inverse of max(X<sub>i</sub>) in which all non-maximal values are set to zero
|
|
150
|
+
|
|
151
|
+
@constant BNNSPoolingFunctionL2Norm
|
|
152
|
+
<math><msqrt><mi>∑<sub>i</sub> X<sub>i</sub><sup>2</sup></mi></msqrt></math>
|
|
153
|
+
|
|
154
|
+
*/
|
|
155
|
+
BNNS_ENUM(BNNSPoolingFunction, uint32_t,
|
|
156
|
+
|
|
157
|
+
BNNSPoolingFunctionMax __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 0,
|
|
158
|
+
BNNSPoolingFunctionAverageCountIncludePadding __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
159
|
+
BNNSPoolingFunctionAverageCountExcludePadding __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2,
|
|
160
|
+
BNNSPoolingFunctionUnMax __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 3,
|
|
161
|
+
BNNSPoolingFunctionL2Norm __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 4,
|
|
162
|
+
|
|
163
|
+
BNNSPoolingFunctionAverage __API_DEPRECATED_WITH_REPLACEMENT("BNNSPoolingFunctionAverageCountIncludePadding", macos(10.12, 11.0), ios(10.0, 14.0), watchos(3.0, 7.0), tvos(10.0, 14.0)) = BNNSPoolingFunctionAverageCountIncludePadding,
|
|
164
|
+
|
|
165
|
+
);
|
|
166
|
+
|
|
167
|
+
/*!
|
|
168
|
+
|
|
169
|
+
@abstract Activation layer function
|
|
170
|
+
|
|
171
|
+
@constant BNNSActivationFunctionIdentity
|
|
172
|
+
x
|
|
173
|
+
|
|
174
|
+
@constant BNNSActivationFunctionRectifiedLinear
|
|
175
|
+
0 if x<0, and x if x>=0
|
|
176
|
+
|
|
177
|
+
@constant BNNSActivationFunctionReLU6
|
|
178
|
+
min(max(0,x),6)
|
|
179
|
+
|
|
180
|
+
@constant BNNSActivationFunctionLeakyRectifiedLinear
|
|
181
|
+
alpha*x if x<0, and x if x>=0
|
|
182
|
+
A pointer to the alpha value can be obtained via a BNNSGetPointer() call, and the delta with respect to alpha
|
|
183
|
+
is obtained via the weights_delta field in a call to BNNSApplyBackward() or BNNSApplyBackwardBatch() of a standalone
|
|
184
|
+
Activation layer (the delta is not available in situations where the activation is fused with another layer).
|
|
185
|
+
|
|
186
|
+
@constant BNNSActivationFunctionSigmoid
|
|
187
|
+
sigmoid(x)
|
|
188
|
+
|
|
189
|
+
@constant BNNSActivationFunctionLogSigmoid
|
|
190
|
+
log(sigmoid(x))
|
|
191
|
+
|
|
192
|
+
@constant BNNSActivationFunctionTanh
|
|
193
|
+
tanh(x)
|
|
194
|
+
|
|
195
|
+
@constant BNNSActivationFunctionScaledTanh
|
|
196
|
+
alpha*tanh(x*beta)
|
|
197
|
+
|
|
198
|
+
@constant BNNSActivationFunctionAbs
|
|
199
|
+
abs(x)
|
|
200
|
+
|
|
201
|
+
@constant BNNSActivationFunctionLinear
|
|
202
|
+
alpha*x
|
|
203
|
+
|
|
204
|
+
@constant BNNSActivationFunctionClamp
|
|
205
|
+
min(max(x, alpha), beta)
|
|
206
|
+
|
|
207
|
+
@constant BNNSActivationFunctionIntegerLinearSaturate
|
|
208
|
+
Saturate<output_type>((iscale * x + ioffset) >> ishift)
|
|
209
|
+
This is an arithmetic shift, preserving sign.
|
|
210
|
+
|
|
211
|
+
@constant BNNSActivationFunctionIntegerLinearSaturatePerChannel
|
|
212
|
+
Saturate<output_type>((iscale_per_channel[channel] * x + ioffset_per_channel[channel]) >> ishift_per_channel[channel]) for each channel
|
|
213
|
+
This is an arithmetic shift, preserving sign.
|
|
214
|
+
|
|
215
|
+
@constant BNNSActivationFunctionSoftmax
|
|
216
|
+
softmax(x)_i = exp(x_i) / ( sum_i exp(x_i) ).
|
|
217
|
+
|
|
218
|
+
@constant BNNSActivationFunctionGELUApproximation
|
|
219
|
+
GELUApproximation(x)_i = 0.5f * x * (1.0f + tanh(alpha*(x + beta * x * x * x))).
|
|
220
|
+
|
|
221
|
+
@constant BNNSActivationFunctionGumbel
|
|
222
|
+
Gumbel_i = −log(−log(alpha*Uniform(0,1)+beta)+beta)
|
|
223
|
+
|
|
224
|
+
@constant BNNSActivationFunctionGumbelMax
|
|
225
|
+
GumbelMax(X)_i = MAX(−log(−log(alpha*Uniform(0,1)+beta)+beta) + Xj)
|
|
226
|
+
|
|
227
|
+
@constant BNNSActivationFunctionHardSigmoid
|
|
228
|
+
HardSigmoid(x) = max(0, min(1, alpha*x + beta))
|
|
229
|
+
|
|
230
|
+
@constant BNNSActivationFunctionSoftplus
|
|
231
|
+
Softplus(x) = alpha * log( 1 + exp(beta*x) )
|
|
232
|
+
|
|
233
|
+
@constant BNNSActivationFunctionSoftsign
|
|
234
|
+
Softsign(x) = x / (1 + |x| )
|
|
235
|
+
|
|
236
|
+
@constant BNNSActivationFunctionELU
|
|
237
|
+
ELU(x) = alpha*(exp(x) - 1) if x < 0, and x if x >= 0
|
|
238
|
+
|
|
239
|
+
@constant BNNSActivationFunctionSELU
|
|
240
|
+
SELU(x) = 1.0507009873554804934193349852946*(1.6732632423543772848170429916717*(exp(x) - 1)) if x < 0,
|
|
241
|
+
and 1.0507009873554804934193349852946*x if x >= 0
|
|
242
|
+
|
|
243
|
+
@constant BNNSActivationFunctionCELU
|
|
244
|
+
ELU(x) = alpha*(exp(x/alpha) - 1) if x < 0, and x if x >= 0
|
|
245
|
+
|
|
246
|
+
@constant BNNSActivationFunctionClampedLeakyRectifiedLinear
|
|
247
|
+
CLReLU(x) = min( alpha*x, beta) if x < 0, and min(x, beta) if x >= 0
|
|
248
|
+
|
|
249
|
+
@constant BNNSActivationFunctionLinearWithBias
|
|
250
|
+
alpha*x + beta
|
|
251
|
+
|
|
252
|
+
@constant BNNSActivationFunctionLogSoftmax
|
|
253
|
+
log_softmax(x)_i = log( exp(x_i) / ( sum_i exp(x_i) ) ).
|
|
254
|
+
|
|
255
|
+
@constant BNNSActivationFunctionHardShrink
|
|
256
|
+
0 if abs(x) < abs(alpha), and x otherwise
|
|
257
|
+
|
|
258
|
+
@constant BNNSActivationFunctionSoftShrink
|
|
259
|
+
0 if abs(x) < abs(alpha), and x-copysign(alpha, x) otherwise
|
|
260
|
+
|
|
261
|
+
@constant BNNSActivationFunctionTanhShrink
|
|
262
|
+
TanhShrink(x) = x − tanh(x)
|
|
263
|
+
|
|
264
|
+
@constant BNNSActivationFunctionThreshold
|
|
265
|
+
beta if x <= alpha, and x otherwise
|
|
266
|
+
|
|
267
|
+
@constant BNNSActivationFunctionPReLUPerChannel
|
|
268
|
+
alpha_c*x if x<0, and x if x>=0 (i.e. Leaky ReLU with per-channel alpha values)
|
|
269
|
+
This activation is only valid for use with layouts of type BNNSDataLayoutImageCHW.
|
|
270
|
+
The provided alpha value is used to initialize an array of alpha_c values, one per channel: if a PReLU with a shared alpha
|
|
271
|
+
across all channels is required, use BNNSActivationFunctionLeakyRectifiedLinear with BNNSGetPointer().
|
|
272
|
+
These values can then be updated (i.e. trained) individually using pointers obtained via BNNSGetPointer() calls.
|
|
273
|
+
The delta vector with respect to alpha_c is obtained via the weights_delta field in a call to BNNSApplyBackward() or
|
|
274
|
+
BNNSApplyBackwardBatch() of a standalone Activation layer (the delta is not available if situations where the activation is fused with another layer).
|
|
275
|
+
|
|
276
|
+
@constant BNNSActivationFunctionGELUApproximation2
|
|
277
|
+
GELUApproximation2(x) = x*(ReLU6(x + 3.0) * 1.0/6.0)
|
|
278
|
+
|
|
279
|
+
@constant BNNSActivationFunctionHardSwish
|
|
280
|
+
Same as BNNSActivationFunctionGELUApproximation2.
|
|
281
|
+
HardSwish(x) = GELUApproximation2(x) = x*(ReLU6(x + 3.0) * 1.0/6.0)
|
|
282
|
+
|
|
283
|
+
@constant BNNSActivationFunctionSiLU
|
|
284
|
+
SiLU(x) = x*sigmoid(x)
|
|
285
|
+
|
|
286
|
+
@constant BNNSActivationFunctionErf
|
|
287
|
+
erf(x)
|
|
288
|
+
|
|
289
|
+
@constant BNNSActivationFunctionGELU
|
|
290
|
+
GELU(x)_i = 0.5*x * ( 1 + erf(x/sqrt(2)) )
|
|
291
|
+
|
|
292
|
+
@constant BNNSActivationFunctionGELUApproximationSigmoid
|
|
293
|
+
GELUApproxSigmoid(x)_i = x * sigmoid(1.702 * x)
|
|
294
|
+
|
|
295
|
+
*/
|
|
296
|
+
BNNS_ENUM(BNNSActivationFunction, uint32_t,
|
|
297
|
+
|
|
298
|
+
BNNSActivationFunctionIdentity __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 0,
|
|
299
|
+
BNNSActivationFunctionRectifiedLinear __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 1,
|
|
300
|
+
BNNSActivationFunctionLeakyRectifiedLinear __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 2,
|
|
301
|
+
BNNSActivationFunctionSigmoid __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 3,
|
|
302
|
+
BNNSActivationFunctionTanh __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 4,
|
|
303
|
+
BNNSActivationFunctionScaledTanh __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 5,
|
|
304
|
+
BNNSActivationFunctionAbs __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 6,
|
|
305
|
+
BNNSActivationFunctionLinear __API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = 7,
|
|
306
|
+
BNNSActivationFunctionClamp __API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = 8,
|
|
307
|
+
BNNSActivationFunctionIntegerLinearSaturate __API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = 9,
|
|
308
|
+
BNNSActivationFunctionIntegerLinearSaturatePerChannel __API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = 10,
|
|
309
|
+
BNNSActivationFunctionSoftmax __API_AVAILABLE(macos(10.13), ios(11.0), watchos(4.0), tvos(11.0)) = 11,
|
|
310
|
+
BNNSActivationFunctionGELUApproximation __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 12,
|
|
311
|
+
BNNSActivationFunctionGumbel __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 13,
|
|
312
|
+
BNNSActivationFunctionGumbelMax __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 14,
|
|
313
|
+
BNNSActivationFunctionHardSigmoid __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 15,
|
|
314
|
+
BNNSActivationFunctionSoftplus __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 16,
|
|
315
|
+
BNNSActivationFunctionSoftsign __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 17,
|
|
316
|
+
BNNSActivationFunctionELU __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 18,
|
|
317
|
+
BNNSActivationFunctionClampedLeakyRectifiedLinear __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 19,
|
|
318
|
+
BNNSActivationFunctionLinearWithBias __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 20,
|
|
319
|
+
BNNSActivationFunctionLogSoftmax __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 21,
|
|
320
|
+
BNNSActivationFunctionLogSigmoid __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 22,
|
|
321
|
+
BNNSActivationFunctionSELU __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 23,
|
|
322
|
+
BNNSActivationFunctionCELU __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 24,
|
|
323
|
+
BNNSActivationFunctionHardShrink __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 25,
|
|
324
|
+
BNNSActivationFunctionSoftShrink __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 26,
|
|
325
|
+
BNNSActivationFunctionTanhShrink __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 27,
|
|
326
|
+
BNNSActivationFunctionThreshold __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 28,
|
|
327
|
+
BNNSActivationFunctionPReLUPerChannel __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 29,
|
|
328
|
+
BNNSActivationFunctionGELUApproximation2 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 30,
|
|
329
|
+
BNNSActivationFunctionHardSwish __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = BNNSActivationFunctionGELUApproximation2,
|
|
330
|
+
BNNSActivationFunctionSiLU __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 31,
|
|
331
|
+
BNNSActivationFunctionReLU6 __API_AVAILABLE(macos(13.3), ios(16.4), watchos(9.4), tvos(16.4)) = 32,
|
|
332
|
+
BNNSActivationFunctionErf __API_AVAILABLE(macos(13.3), ios(16.4), watchos(9.4), tvos(16.4)) = 33,
|
|
333
|
+
BNNSActivationFunctionGELU __API_AVAILABLE(macos(13.3), ios(16.4), watchos(9.4), tvos(16.4)) = 34,
|
|
334
|
+
BNNSActivationFunctionGELUApproximationSigmoid __API_AVAILABLE(macos(13.3), ios(16.4), watchos(9.4), tvos(16.4)) = 35,
|
|
335
|
+
|
|
336
|
+
);
|
|
337
|
+
|
|
338
|
+
/*!
|
|
339
|
+
|
|
340
|
+
@abstract Filter flags
|
|
341
|
+
|
|
342
|
+
@constant BNNSFlagsUseClientPtr
|
|
343
|
+
|
|
344
|
+
Instructs the filter to keep the pointers provided by the client at creation time (weights, bias), and work directly from this data. In that
|
|
345
|
+
case, the client must ensure these pointers remain valid through the entire lifetime of the filter.
|
|
346
|
+
|
|
347
|
+
If not set, the filter creation function must allocate buffers, and keep an internal copy of the data. In that case, the client doesn't have
|
|
348
|
+
to keep the pointers valid after the filter is created.
|
|
349
|
+
|
|
350
|
+
*/
|
|
351
|
+
BNNS_ENUM(BNNSFlags, uint32_t,
|
|
352
|
+
|
|
353
|
+
BNNSFlagsUseClientPtr __API_AVAILABLE(macos(10.12), ios(10.0), watchos(3.0), tvos(10.0)) = 0x0001,
|
|
354
|
+
);
|
|
355
|
+
|
|
356
|
+
/*!
|
|
357
|
+
|
|
358
|
+
@abstract Loss layer function
|
|
359
|
+
|
|
360
|
+
@constant BNNSLossFunctionSoftmaxCrossEntropy
|
|
361
|
+
perform softmax on input logits and compute cross entropy loss with one hot encoded labels.
|
|
362
|
+
labels can be smoothed according to smoothing factor, loss can be scaled with scalar or vector weight and reduced according to reduction function
|
|
363
|
+
for each sample in the batch:
|
|
364
|
+
p = softmax(in sample)
|
|
365
|
+
labels = one hot encoded lables for in sample
|
|
366
|
+
weight = scaling factor
|
|
367
|
+
sample loss = (1/number_of_classes)*(-1*sum_over_all_classes_i(labels[i]*log(p[i])*weight)
|
|
368
|
+
|
|
369
|
+
@constant BNNSLossFunctionSigmoidCrossEntropy
|
|
370
|
+
perform sigmoid on input logits and compute cross entropy loss for each class independently.
|
|
371
|
+
labels can be smoothed according to smoothing factor, loss can be scaled with scalar or weight matrix (matrix size = number_of_classes*batch_size) and reduced according to reduction function
|
|
372
|
+
for each class in each sample in the batch:
|
|
373
|
+
weight = scaling factor
|
|
374
|
+
sample class loss[i] = weight*(-label[i]*log(sigmoid(logit[i])) - (1-label[i])*log(1-sigmoid(logit[i])))
|
|
375
|
+
|
|
376
|
+
loss = reduction(all batch sample class loss)
|
|
377
|
+
|
|
378
|
+
@constant BNNSLossFunctionMeanSquareError
|
|
379
|
+
performs mean square error (MSE) computation between input logits and one hot encoded labels.
|
|
380
|
+
loss can be scaled with scalar or weight matrix (matrix size = number_of_classes*batch_size) and reduced according to reduction function
|
|
381
|
+
for each class in each sample in the batch:
|
|
382
|
+
weight = scaling factor
|
|
383
|
+
sample class mse[i] = weight * (logit[i] - label[i]) * (logit[i] - label[i])
|
|
384
|
+
|
|
385
|
+
loss = reduction(all batch sample class loss)
|
|
386
|
+
|
|
387
|
+
@constant BNNSLossFunctionHuber
|
|
388
|
+
performs huber loss computation between input logits and one hot encoded labels.
|
|
389
|
+
loss can be scaled with scalar or weight matrix (matrix size = number_of_classes*batch_size) and reduced according to reduction function
|
|
390
|
+
for each class in each sample in the batch:
|
|
391
|
+
weight = scaling factor
|
|
392
|
+
error[i] = logit[i] - label[i]
|
|
393
|
+
abs(error[i]) <= delta : huber[i] = weight * 0.5 * error[i] * error[i]
|
|
394
|
+
abs(error[i]) > delta : huber[i] = weight * delta * (abs(error) - 0.5 * delta)
|
|
395
|
+
|
|
396
|
+
loss = reduction(all batch sample loss)
|
|
397
|
+
|
|
398
|
+
@constant BNNSLossFunctionYolo
|
|
399
|
+
performs yolo loss computation between prediction and ground truth labels
|
|
400
|
+
Implementation is based on yolo papers, such as the following:
|
|
401
|
+
You Only Look Once: Unified, Real-Time Object Detection: https://arxiv.org/abs/1506.02640
|
|
402
|
+
SSD: Single Shot MultiBox Detector: https://arxiv.org/abs/1512.02325
|
|
403
|
+
YOLO9000: Better, Faster, Stronger: https://arxiv.org/abs/1612.08242
|
|
404
|
+
|
|
405
|
+
prediction represented as: |x,y,w,h,conf,c1,c2...cn| * number of anchors * number of cells in grid
|
|
406
|
+
ground_truth represented as: |x,y,w,h,conf,c1,c2...cn| * number of anchors * number of cells in grid
|
|
407
|
+
It is assumed that ground truth confidence is 0 if there is no object in the current cell, or 1 if there is an object in the current cell
|
|
408
|
+
It is also assumed that ground truth is duplicated for all anchors in a given cell.
|
|
409
|
+
|
|
410
|
+
The loss function is a hybrid of the following functions:
|
|
411
|
+
x,y: MSE
|
|
412
|
+
w,h: Huber
|
|
413
|
+
confidence: Sigmoid Cross Entropy
|
|
414
|
+
classification: Softmax Cross Entropy
|
|
415
|
+
|
|
416
|
+
loss = sum of all loss componenets (x,y,w,h,conf,class)
|
|
417
|
+
|
|
418
|
+
@constant BNNSLossFunctionLog
|
|
419
|
+
performs log loss computation between labels (ground truth output tensor) and predictions (predicted outputs).
|
|
420
|
+
loss can be scaled with scalar or weight matrix (matrix size = number_of_classes*batch_size) and reduced according to reduction function
|
|
421
|
+
for each class in each sample in the batch:
|
|
422
|
+
weight = scaling factor
|
|
423
|
+
p_i = predictions[i] + epsilon;
|
|
424
|
+
pm1_i = 1 - predictions[i] + epsilon;
|
|
425
|
+
t_i = labels[i];
|
|
426
|
+
log_loss[i] = -t_i *log( p_i ) - (1 - t_i) * log( pm1_i );
|
|
427
|
+
in_delta[i] = (p_i - t_i)/(p_i*pm1_i);
|
|
428
|
+
|
|
429
|
+
loss = reduction(all batch sample class loss)
|
|
430
|
+
|
|
431
|
+
@constant BNNSLossFunctionCosineDistance
|
|
432
|
+
performs cosine distance loss computation between labels (ground truth output tensor) and predictions (predicted outputs).
|
|
433
|
+
both labels and predictions SHOULD be unit-normalized.
|
|
434
|
+
loss can be scaled with scalar or weight matrix (matrix size = number_of_classes*batch_size) and reduced according to reduction function
|
|
435
|
+
for each class in each sample in the batch:
|
|
436
|
+
weight = scaling factor
|
|
437
|
+
p_i = predictions[i];
|
|
438
|
+
t_i = labels[i];
|
|
439
|
+
loss = 1. - SUM (weight * t_i * p_i );
|
|
440
|
+
in_delta[i] = -t_i + (1-loss)) * p_i;
|
|
441
|
+
|
|
442
|
+
loss = reduction(all batch sample class loss)
|
|
443
|
+
|
|
444
|
+
@constant BNNSLossFunctionHinge
|
|
445
|
+
performs Hinge loss computation between labels (ground truth output tensor, 0 or 1) and logits (unbpunded 0-centered binary predictions).
|
|
446
|
+
loss can be scaled with scalar or weight matrix (matrix size = number_of_classes*batch_size) and reduced according to reduction function
|
|
447
|
+
for each class in each sample in the batch:
|
|
448
|
+
weight = scaling factor
|
|
449
|
+
t_i = 2*labels[i] - 1; // convert 0 or 1 to -1 or 1
|
|
450
|
+
loss = max(0, 1 - t_i * logits_i;
|
|
451
|
+
|
|
452
|
+
in_delta[i] = -1 if logits_i <= 1 and t_i == 1
|
|
453
|
+
0 if logits_i > 1 and t_i == 1
|
|
454
|
+
1 if logits_i >= -1 and t_i == -1
|
|
455
|
+
0 if logits_i < -1 and t_i == -1
|
|
456
|
+
|
|
457
|
+
|
|
458
|
+
loss = reduction(all batch sample class loss)
|
|
459
|
+
|
|
460
|
+
@constant BNNSLossFunctionMeanAbsoluteError
|
|
461
|
+
performs mean absolute error (MAE) computation between input prediction and labels.
|
|
462
|
+
loss can be scaled with scalar or weight matrix (matrix size = number_of_classes*batch_size) and reduced according to reduction function
|
|
463
|
+
for each class in each sample in the batch:
|
|
464
|
+
weight = scaling factor
|
|
465
|
+
sample class mae[i] = weight * absolute(prediction[i] - label[i]);
|
|
466
|
+
|
|
467
|
+
in_delta[i] = 1 if prediction_i >= label_i
|
|
468
|
+
-1 otherwisze
|
|
469
|
+
|
|
470
|
+
loss = reduction(all batch sample class loss)
|
|
471
|
+
|
|
472
|
+
@constant BNNSLossFunctionCategoricalCrossEntropy
|
|
473
|
+
performs categorical cross entropy (softmax activation plus a cross entropy loss) computation between input prediction and labels.
|
|
474
|
+
loss can be scaled with scalar or weight matrix (matrix size = number_of_classes*batch_size) and reduced according to reduction function
|
|
475
|
+
for each class in each sample in the batch:
|
|
476
|
+
weight = scaling factor
|
|
477
|
+
numM = number of nonzero labels;
|
|
478
|
+
scale_factor = 1/numM;
|
|
479
|
+
logprobs = 0;
|
|
480
|
+
for each element c in labels
|
|
481
|
+
if (labels[r,c] != 0) logprobs += -log(probs[c]) * labels[c] * weight[c] * scale_factor;
|
|
482
|
+
|
|
483
|
+
if (labels[r,c] != 0)
|
|
484
|
+
in_delta[r,c] = weight[c] * (probs[c] - scale_factor);
|
|
485
|
+
else
|
|
486
|
+
in_delta[r,c] = probs[c];
|
|
487
|
+
|
|
488
|
+
loss = reduction(all batch sample class loss)
|
|
489
|
+
|
|
490
|
+
*/
|
|
491
|
+
BNNS_ENUM(BNNSLossFunction, uint32_t,
|
|
492
|
+
|
|
493
|
+
BNNSLossFunctionSoftmaxCrossEntropy __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
494
|
+
BNNSLossFunctionSigmoidCrossEntropy __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2,
|
|
495
|
+
BNNSLossFunctionMeanSquareError __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 3,
|
|
496
|
+
BNNSLossFunctionHuber __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 4,
|
|
497
|
+
BNNSLossFunctionYolo __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 5,
|
|
498
|
+
BNNSLossFunctionLog __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 6,
|
|
499
|
+
BNNSLossFunctionCosineDistance __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 7,
|
|
500
|
+
BNNSLossFunctionHinge __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 8,
|
|
501
|
+
BNNSLossFunctionMeanAbsoluteError __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 9,
|
|
502
|
+
BNNSLossFunctionCategoricalCrossEntropy __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 10,
|
|
503
|
+
);
|
|
504
|
+
|
|
505
|
+
/*!
|
|
506
|
+
|
|
507
|
+
@abstract Loss layer reduction function
|
|
508
|
+
|
|
509
|
+
@constant BNNSLossReductionNone
|
|
510
|
+
No reduction. Output loss size equal to input size.
|
|
511
|
+
|
|
512
|
+
@constant BNNSLossReductionSum
|
|
513
|
+
Sum the loss of all samples in the batch.
|
|
514
|
+
|
|
515
|
+
@constant BNNSLossReductionWeightedMean
|
|
516
|
+
Sum the loss of all samples in the batch and divide by the sum of all weights.
|
|
517
|
+
0 is returned if the sum of all weights is 0.
|
|
518
|
+
|
|
519
|
+
@constant BNNSLossReductionMean
|
|
520
|
+
Sum the loss of all samples in the batch and divide by number of samples.
|
|
521
|
+
|
|
522
|
+
@constant BNNSLossReductionNonZeroWeightMean
|
|
523
|
+
Sum the loss of all samples in the batch and divide by number of nonzero weights.
|
|
524
|
+
0 is returned in case all weights are zero.
|
|
525
|
+
|
|
526
|
+
*/
|
|
527
|
+
BNNS_ENUM(BNNSLossReductionFunction, uint32_t,
|
|
528
|
+
|
|
529
|
+
BNNSLossReductionNone __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
530
|
+
BNNSLossReductionSum __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
531
|
+
BNNSLossReductionWeightedMean __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2,
|
|
532
|
+
BNNSLossReductionMean __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 3,
|
|
533
|
+
BNNSLossReductionNonZeroWeightMean __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 4,
|
|
534
|
+
);
|
|
535
|
+
|
|
536
|
+
/*!
|
|
537
|
+
|
|
538
|
+
@abstract Arithmetic function
|
|
539
|
+
|
|
540
|
+
@constant BNNSArithmeticAdd
|
|
541
|
+
Arithmetic function add
|
|
542
|
+
element-wise computation of out = in1+in2
|
|
543
|
+
in-place computation is supported for forward and gradient
|
|
544
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
545
|
+
|
|
546
|
+
@constant BNNSArithmeticSubtract
|
|
547
|
+
Arithmetic function subtract
|
|
548
|
+
element-wise computation of out = in1-in2
|
|
549
|
+
in-place computation is supported for forward and gradient
|
|
550
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
551
|
+
|
|
552
|
+
@constant BNNSArithmeticMultiply
|
|
553
|
+
Arithmetic function multiply
|
|
554
|
+
element-wise computation of out = in1*in2
|
|
555
|
+
in-place computation is supported for inference only
|
|
556
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
557
|
+
|
|
558
|
+
@constant BNNSArithmeticDivide
|
|
559
|
+
Arithmetic function divide
|
|
560
|
+
element-wise computation of out = in1/in2
|
|
561
|
+
in-place computation is supported for inference only
|
|
562
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
563
|
+
|
|
564
|
+
@constant BNNSArithmeticSquareRoot
|
|
565
|
+
Arithmetic function square root
|
|
566
|
+
element-wise computation of out = √in
|
|
567
|
+
in-place computation is supported for inference
|
|
568
|
+
in-place computation is supported for gradient if activation function is identity
|
|
569
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
570
|
+
|
|
571
|
+
@constant BNNSArithmeticReciprocalSquareRoot
|
|
572
|
+
Arithmetic function reciprocal square root
|
|
573
|
+
element-wise computation of out = 1/√in
|
|
574
|
+
in-place computation is supported for inference
|
|
575
|
+
in-place computation is supported for gradient if activation function is identity
|
|
576
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
577
|
+
|
|
578
|
+
@constant BNNSArithmeticCeil
|
|
579
|
+
Arithmetic function ceil
|
|
580
|
+
element-wise computation of out = ceil(in)
|
|
581
|
+
in-place computation is supported for forward and gradient
|
|
582
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
583
|
+
|
|
584
|
+
@constant BNNSArithmeticFloor
|
|
585
|
+
Arithmetic function floor
|
|
586
|
+
element-wise computation of out = floor(in)
|
|
587
|
+
in-place computation is supported for forward and gradient
|
|
588
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
589
|
+
|
|
590
|
+
@constant BNNSArithmeticRound
|
|
591
|
+
Arithmetic function round
|
|
592
|
+
element-wise computation of out = round(in)
|
|
593
|
+
in-place computation is supported for forward and gradient
|
|
594
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
595
|
+
|
|
596
|
+
@constant BNNSArithmeticSin
|
|
597
|
+
Arithmetic function sine
|
|
598
|
+
element-wise computation of out = sin(in)
|
|
599
|
+
in-place computation is supported for inference only
|
|
600
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
601
|
+
|
|
602
|
+
@constant BNNSArithmeticCos
|
|
603
|
+
Arithmetic function cosine
|
|
604
|
+
element-wise computation of out = cos(in)
|
|
605
|
+
in-place computation is supported for inference only
|
|
606
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
607
|
+
|
|
608
|
+
@constant BNNSArithmeticTan
|
|
609
|
+
Arithmetic function tangent
|
|
610
|
+
element-wise computation of out = tan(in)
|
|
611
|
+
in-place computation is supported for inference only
|
|
612
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
613
|
+
|
|
614
|
+
@constant BNNSArithmeticAsin
|
|
615
|
+
Arithmetic function inverse sine
|
|
616
|
+
element-wise computation of out = asin(in)
|
|
617
|
+
in-place computation is supported for inference only
|
|
618
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
619
|
+
|
|
620
|
+
@constant BNNSArithmeticAcos
|
|
621
|
+
Arithmetic function inverse cosine
|
|
622
|
+
element-wise computation of out = acos(in)
|
|
623
|
+
in-place computation is supported for inference only
|
|
624
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
625
|
+
|
|
626
|
+
@constant BNNSArithmeticAtan
|
|
627
|
+
Arithmetic function inverse tangent
|
|
628
|
+
element-wise computation of out = atan(in)
|
|
629
|
+
in-place computation is supported for inference only
|
|
630
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
631
|
+
|
|
632
|
+
@constant BNNSArithmeticSinh
|
|
633
|
+
Arithmetic function hyperbolic sine
|
|
634
|
+
element-wise computation of out = sinh(in)
|
|
635
|
+
in-place computation is supported for inference only
|
|
636
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
637
|
+
|
|
638
|
+
@constant BNNSArithmeticCosh
|
|
639
|
+
Arithmetic function hyperbolic cosine
|
|
640
|
+
element-wise computation of out = cosh(in)
|
|
641
|
+
in-place computation is supported for inference only
|
|
642
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
643
|
+
|
|
644
|
+
@constant BNNSArithmeticTanh
|
|
645
|
+
Arithmetic function hyperbolic tangent
|
|
646
|
+
element-wise computation of out = tanh(in)
|
|
647
|
+
in-place computation is supported for inference
|
|
648
|
+
in-place computation is supported for gradient if activation function is identity
|
|
649
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
650
|
+
|
|
651
|
+
@constant BNNSArithmeticAsinh
|
|
652
|
+
Arithmetic function inverse hyperbolic sine
|
|
653
|
+
element-wise computation of out = asinh(in)
|
|
654
|
+
in-place computation is supported for inference only
|
|
655
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
656
|
+
|
|
657
|
+
@constant BNNSArithmeticAcosh
|
|
658
|
+
Arithmetic function inverse hyperbolic cosine
|
|
659
|
+
element-wise computation of out = acosh(in)
|
|
660
|
+
in-place computation is supported for inference only
|
|
661
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
662
|
+
|
|
663
|
+
@constant BNNSArithmeticAtanh
|
|
664
|
+
Arithmetic function inverse hyperbolic tangent
|
|
665
|
+
element-wise computation of out = atanh(in)
|
|
666
|
+
in-place computation is supported for inference only
|
|
667
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
668
|
+
|
|
669
|
+
@constant BNNSArithmeticPow
|
|
670
|
+
Arithmetic function power
|
|
671
|
+
element-wise computation of out = in1**in2
|
|
672
|
+
in-place computation is supported for inference only
|
|
673
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
674
|
+
|
|
675
|
+
@constant BNNSArithmeticExp
|
|
676
|
+
Arithmetic function exp
|
|
677
|
+
element-wise computation of e raised to the power of x. out = e^x
|
|
678
|
+
in-place computation is supported for inference
|
|
679
|
+
in-place computation is supported for gradient if activation function is identity
|
|
680
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
681
|
+
|
|
682
|
+
@constant BNNSArithmeticExp2
|
|
683
|
+
Arithmetic function exp2
|
|
684
|
+
element-wise computation of 2 raised to the power of x. out = 2^x
|
|
685
|
+
in-place computation is supported for inference
|
|
686
|
+
in-place computation is supported for gradient if activation function is identity
|
|
687
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
688
|
+
|
|
689
|
+
@constant BNNSArithmeticLog
|
|
690
|
+
Arithmetic function log
|
|
691
|
+
element-wise computation of the natural logarithm of x. out = log(x)
|
|
692
|
+
in-place computation is supported for inference only
|
|
693
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
694
|
+
|
|
695
|
+
@constant BNNSArithmeticLog2
|
|
696
|
+
Arithmetic function log2
|
|
697
|
+
element-wise computation of the base 2 logarithm of x. out = log2(x)
|
|
698
|
+
in-place computation is supported for inference only
|
|
699
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
700
|
+
|
|
701
|
+
@constant BNNSArithmeticMultiplyNoNaN
|
|
702
|
+
Arithmetic function multiply, returns 0 if the in2 is zero, even if in1 is NaN or infinite
|
|
703
|
+
element-wise computation of out = in1*in2
|
|
704
|
+
in-place computation is supported for inference only
|
|
705
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
706
|
+
|
|
707
|
+
@constant BNNSArithmeticDivideNoNaN
|
|
708
|
+
Arithmetic function divide, returns 0 if the in2 is zero.
|
|
709
|
+
element-wise computation of out = in1/in2
|
|
710
|
+
in-place computation is supported for inference only
|
|
711
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
712
|
+
|
|
713
|
+
@constant BNNSArithmeticMultiplyAdd
|
|
714
|
+
Arithmetic function multiply-add
|
|
715
|
+
element-wise computation of out = in1*in2 + in3
|
|
716
|
+
in-place computation is supported for inference only
|
|
717
|
+
arithmetic_function_fields must point to BNNSArithmeticTernary structure
|
|
718
|
+
|
|
719
|
+
@constant BNNSArithmeticMinimum
|
|
720
|
+
Arithmetic function minimum
|
|
721
|
+
element-wise computation of out = min(in1, in2)
|
|
722
|
+
in-place computation is supported for inference only
|
|
723
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
724
|
+
|
|
725
|
+
@constant BNNSArithmeticMaximum
|
|
726
|
+
Arithmetic function maximum
|
|
727
|
+
element-wise computation of out = max(in1, in2)
|
|
728
|
+
in-place computation is supported for inference only
|
|
729
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
730
|
+
|
|
731
|
+
@constant BNNSArithmeticSelect
|
|
732
|
+
Arithmetic function select
|
|
733
|
+
element-wise computation of out = in1 ? in2 : in3
|
|
734
|
+
in-place computation is supported for inference only
|
|
735
|
+
arithmetic_function_fields must point to BNNSArithmeticTernary structure
|
|
736
|
+
|
|
737
|
+
@constant BNNSArithmeticAbs
|
|
738
|
+
Arithmetic function absolute
|
|
739
|
+
element-wise computation of absolute value
|
|
740
|
+
in-place computation is supported for inference only
|
|
741
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
742
|
+
|
|
743
|
+
@constant BNNSArithmeticSign
|
|
744
|
+
Arithmetic function sign
|
|
745
|
+
element-wise computation of the sign (1 for positive, -1 for negative, 0 for zero)
|
|
746
|
+
in-place computation is supported for forward and gradient
|
|
747
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
748
|
+
|
|
749
|
+
@constant BNNSArithmeticNegate
|
|
750
|
+
Arithmetic function negate
|
|
751
|
+
element-wise computation of out = -in1
|
|
752
|
+
in-place computation is supported for forward and gradient
|
|
753
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
754
|
+
|
|
755
|
+
@constant BNNSArithmeticReciprocal
|
|
756
|
+
Arithmetic function reciprocal
|
|
757
|
+
element-wise computation of out = 1/in1
|
|
758
|
+
in-place computation is supported for inference
|
|
759
|
+
in-place computation is supported for gradient if activation function is identity
|
|
760
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
761
|
+
|
|
762
|
+
@constant BNNSArithmeticSquare
|
|
763
|
+
Arithmetic function square
|
|
764
|
+
element-wise computation of out = in1 * in1
|
|
765
|
+
in-place computation is supported for inference only
|
|
766
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
767
|
+
|
|
768
|
+
@constant BNNSArithmeticFloorDivide
|
|
769
|
+
Arithmetic function floor divide (quotient rounds towards negative infinity)
|
|
770
|
+
element-wise computation of out = floor(in1 / in2)
|
|
771
|
+
in-place computation is supported for inference
|
|
772
|
+
no gradient computation is supported
|
|
773
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
774
|
+
|
|
775
|
+
@constant BNNSArithmeticTruncDivide
|
|
776
|
+
Arithmetic function truncated divide (quotient rounds towards zero)
|
|
777
|
+
element-wise computation of out = trunc(in1 / in2)
|
|
778
|
+
in-place computation is supported for inference
|
|
779
|
+
no gradient computation is supported
|
|
780
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
781
|
+
|
|
782
|
+
@constant BNNSArithmeticTruncRemainder
|
|
783
|
+
Arithmetic function remainder of truncated division
|
|
784
|
+
element-wise computation of remainder of (trunc) division
|
|
785
|
+
in-place computation is supported for inference
|
|
786
|
+
no gradient computation is supported
|
|
787
|
+
arithmetic_function_fields must point to BNNSArithmeticBinary structure
|
|
788
|
+
|
|
789
|
+
@constant BNNSArithmeticErf
|
|
790
|
+
Arithmetic function erf
|
|
791
|
+
element-wise computation of error function
|
|
792
|
+
arithmetic_function_fields must point to BNNSArithmeticUnary structure
|
|
793
|
+
|
|
794
|
+
*/
|
|
795
|
+
BNNS_ENUM(BNNSArithmeticFunction, uint32_t,
|
|
796
|
+
|
|
797
|
+
BNNSArithmeticAdd __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
798
|
+
BNNSArithmeticSubtract __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
799
|
+
BNNSArithmeticMultiply __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2,
|
|
800
|
+
BNNSArithmeticDivide __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 3,
|
|
801
|
+
BNNSArithmeticSquareRoot __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 4,
|
|
802
|
+
BNNSArithmeticReciprocalSquareRoot __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 5,
|
|
803
|
+
BNNSArithmeticCeil __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 6,
|
|
804
|
+
BNNSArithmeticFloor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 7,
|
|
805
|
+
BNNSArithmeticRound __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 8,
|
|
806
|
+
BNNSArithmeticSin __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 9,
|
|
807
|
+
BNNSArithmeticCos __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 10,
|
|
808
|
+
BNNSArithmeticTan __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 11,
|
|
809
|
+
BNNSArithmeticAsin __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 12,
|
|
810
|
+
BNNSArithmeticAcos __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 13,
|
|
811
|
+
BNNSArithmeticAtan __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 14,
|
|
812
|
+
BNNSArithmeticSinh __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 15,
|
|
813
|
+
BNNSArithmeticCosh __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 16,
|
|
814
|
+
BNNSArithmeticTanh __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 17,
|
|
815
|
+
BNNSArithmeticAsinh __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 18,
|
|
816
|
+
BNNSArithmeticAcosh __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 19,
|
|
817
|
+
BNNSArithmeticAtanh __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 20,
|
|
818
|
+
BNNSArithmeticPow __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 21,
|
|
819
|
+
BNNSArithmeticExp __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 22,
|
|
820
|
+
BNNSArithmeticExp2 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 23,
|
|
821
|
+
BNNSArithmeticLog __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 24,
|
|
822
|
+
BNNSArithmeticLog2 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 25,
|
|
823
|
+
BNNSArithmeticMultiplyNoNaN __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 26,
|
|
824
|
+
BNNSArithmeticDivideNoNaN __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 27,
|
|
825
|
+
BNNSArithmeticMultiplyAdd __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 28,
|
|
826
|
+
BNNSArithmeticMinimum __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 29,
|
|
827
|
+
BNNSArithmeticMaximum __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 30,
|
|
828
|
+
BNNSArithmeticSelect __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 31,
|
|
829
|
+
BNNSArithmeticAbs __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 32,
|
|
830
|
+
BNNSArithmeticSign __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 33,
|
|
831
|
+
BNNSArithmeticNegate __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 34,
|
|
832
|
+
BNNSArithmeticReciprocal __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 35,
|
|
833
|
+
BNNSArithmeticSquare __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 36,
|
|
834
|
+
BNNSArithmeticFloorDivide __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 37,
|
|
835
|
+
BNNSArithmeticTruncDivide __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 38,
|
|
836
|
+
BNNSArithmeticTruncRemainder __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 39,
|
|
837
|
+
BNNSArithmeticErf __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 40,
|
|
838
|
+
);
|
|
839
|
+
|
|
840
|
+
/*!
|
|
841
|
+
|
|
842
|
+
@abstract BNNS Descriptor Data type
|
|
843
|
+
|
|
844
|
+
@constant BNNSConstant
|
|
845
|
+
A constant that does not have a gradient.
|
|
846
|
+
the constant is broadcasted across batch samples if batch size > 1
|
|
847
|
+
|
|
848
|
+
@constant BNNSSample
|
|
849
|
+
A sample such as input or output.
|
|
850
|
+
batch size is taken into account and it has a different gradient for each sample in the batch.
|
|
851
|
+
|
|
852
|
+
@constant BNNSParameter
|
|
853
|
+
A trainable parameter such as weights or bias.
|
|
854
|
+
the parameter is broadcasted across batch samples if batch size > 1
|
|
855
|
+
the parameter gradient is summed across the batch samples
|
|
856
|
+
|
|
857
|
+
*/
|
|
858
|
+
BNNS_ENUM(BNNSDescriptorType, uint32_t,
|
|
859
|
+
|
|
860
|
+
BNNSConstant __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
861
|
+
BNNSSample __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
862
|
+
BNNSParameter __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2
|
|
863
|
+
);
|
|
864
|
+
|
|
865
|
+
/*!
|
|
866
|
+
|
|
867
|
+
@abstract Optimizer layer function
|
|
868
|
+
|
|
869
|
+
@constant BNNSOptimizerFunctionSGDMomentum
|
|
870
|
+
Update parameters according to Stochastic Gradient Descent (SGD) with momentum algorithm.
|
|
871
|
+
|
|
872
|
+
@constant BNNSOptimizerFunctionAdam
|
|
873
|
+
Update parameters according to Adam algorithm.
|
|
874
|
+
|
|
875
|
+
@constant BNNSOptimizerFunctionRMSProp
|
|
876
|
+
Update parameters according to RMSProp algorithm.
|
|
877
|
+
|
|
878
|
+
@constant BNNSOptimizerFunctionAdamW
|
|
879
|
+
Update parameters according to AdamW algorithm.
|
|
880
|
+
|
|
881
|
+
@constant BNNSOptimizerFunctionAdamAMSGrad
|
|
882
|
+
Update parameters according to AMSGrad variant of the Adam algorithm.
|
|
883
|
+
|
|
884
|
+
@constant BNNSOptimizerFunctionAdamWAMSGrad
|
|
885
|
+
Update parameters according to AMSGrad variant of the AdamW algorithm.
|
|
886
|
+
|
|
887
|
+
@constant BNNSOptimizerFunctionSGDMomentumWithClipping
|
|
888
|
+
Update parameters according to Stochastic Gradient Descent (SGD) with momentum algorithm using clipped gradient.
|
|
889
|
+
|
|
890
|
+
@constant BNNSOptimizerFunctionAdamWithClipping
|
|
891
|
+
Update parameters according to Adam algorithm using clipped gradient.
|
|
892
|
+
|
|
893
|
+
@constant BNNSOptimizerFunctionRMSPropWithClipping
|
|
894
|
+
Update parameters according to RMSProp algorithm using clipped gradient.
|
|
895
|
+
|
|
896
|
+
@constant BNNSOptimizerFunctionAdamWWithClipping
|
|
897
|
+
Update parameters according to AdamW algorithm using clipped gradient.
|
|
898
|
+
|
|
899
|
+
@constant BNNSOptimizerFunctionAdamAMSGradWithClipping
|
|
900
|
+
Update parameters according to AMSGrad variant of the Adam algorithm using clipped gradient.
|
|
901
|
+
|
|
902
|
+
@constant BNNSOptimizerFunctionAdamWAMSGradWithClipping
|
|
903
|
+
Update parameters according to AMSGrad variant of the AdamW algorithm using clipped gradient.
|
|
904
|
+
|
|
905
|
+
*/
|
|
906
|
+
BNNS_ENUM(BNNSOptimizerFunction, uint32_t,
|
|
907
|
+
|
|
908
|
+
BNNSOptimizerFunctionSGDMomentum __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
909
|
+
BNNSOptimizerFunctionAdam __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2,
|
|
910
|
+
BNNSOptimizerFunctionRMSProp __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 3,
|
|
911
|
+
BNNSOptimizerFunctionAdamW __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 4,
|
|
912
|
+
BNNSOptimizerFunctionAdamAMSGrad __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 5,
|
|
913
|
+
BNNSOptimizerFunctionAdamWAMSGrad __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 6,
|
|
914
|
+
|
|
915
|
+
BNNSOptimizerFunctionSGDMomentumWithClipping __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 7,
|
|
916
|
+
BNNSOptimizerFunctionAdamWithClipping __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 8,
|
|
917
|
+
BNNSOptimizerFunctionRMSPropWithClipping __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 9,
|
|
918
|
+
BNNSOptimizerFunctionAdamWWithClipping __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 10,
|
|
919
|
+
BNNSOptimizerFunctionAdamAMSGradWithClipping __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 11,
|
|
920
|
+
BNNSOptimizerFunctionAdamWAMSGradWithClipping __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 12,
|
|
921
|
+
);
|
|
922
|
+
|
|
923
|
+
/*!
|
|
924
|
+
|
|
925
|
+
@abstract Optimizer regularization function
|
|
926
|
+
|
|
927
|
+
@constant BNNSOptimizerRegularizationNone
|
|
928
|
+
No Regularization
|
|
929
|
+
|
|
930
|
+
@constant BNNSOptimizerRegularizationL1
|
|
931
|
+
L1 Regularization
|
|
932
|
+
|
|
933
|
+
@constant BNNSOptimizerRegularizationL2
|
|
934
|
+
L2 Regularization
|
|
935
|
+
|
|
936
|
+
*/
|
|
937
|
+
BNNS_ENUM(BNNSOptimizerRegularizationFunction, uint32_t,
|
|
938
|
+
|
|
939
|
+
BNNSOptimizerRegularizationNone __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
940
|
+
BNNSOptimizerRegularizationL1 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
941
|
+
BNNSOptimizerRegularizationL2 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2,
|
|
942
|
+
|
|
943
|
+
);
|
|
944
|
+
|
|
945
|
+
/*!
|
|
946
|
+
|
|
947
|
+
@abstract Optimizer SGD with momentum variant
|
|
948
|
+
|
|
949
|
+
@constant BNNSSGDMomentumVariant0
|
|
950
|
+
V[t+1] = m*V[t] - g*lr
|
|
951
|
+
Nesterov diabled: W[t+1] += V[t+1]
|
|
952
|
+
Nesterov enabled: W[t+1] += V[t+1]+m*(V[t+1]-V[t])
|
|
953
|
+
|
|
954
|
+
@constant BNNSSGDMomentumVariant1
|
|
955
|
+
V[t+1] = m*V[t]+g
|
|
956
|
+
Nesterov disabled: W[t+1] -= V[t+1]*lr
|
|
957
|
+
Nesterov enabled: W[t+1] -= (m*V[t+1]+g)*lr
|
|
958
|
+
|
|
959
|
+
@constant BNNSSGDMomentumVariant2
|
|
960
|
+
Nesterov disabled:
|
|
961
|
+
V[t+1] = m*V[t] + lr*g
|
|
962
|
+
W[t+1] -= V[t+1]
|
|
963
|
+
Nesterov enabled:
|
|
964
|
+
V[t+1] = m*V[t]+g
|
|
965
|
+
W[t+1] -= lr*(g+V[t+1]*m)
|
|
966
|
+
*/
|
|
967
|
+
BNNS_ENUM(BNNSOptimizerSGDMomentumVariant, uint32_t,
|
|
968
|
+
|
|
969
|
+
BNNSSGDMomentumVariant0 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
970
|
+
BNNSSGDMomentumVariant1 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
971
|
+
BNNSSGDMomentumVariant2 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2,
|
|
972
|
+
|
|
973
|
+
);
|
|
974
|
+
|
|
975
|
+
/*!
|
|
976
|
+
|
|
977
|
+
@abstract Optimizer clipping function
|
|
978
|
+
|
|
979
|
+
@constant BNNSOptimizerClippingNone
|
|
980
|
+
No clipping
|
|
981
|
+
|
|
982
|
+
@constant BNNSOptimizerClippingByValue
|
|
983
|
+
Clipping gradient values to specified min and max
|
|
984
|
+
|
|
985
|
+
@constant BNNSOptimizerClippingByNorm
|
|
986
|
+
Clipping gradient values to a maximum L2-norm
|
|
987
|
+
|
|
988
|
+
@constant BNNSOptimizerClippingByGlobalNorm
|
|
989
|
+
Clipping gradient values by the ratio of the specified L2-norm and the global L2-norm
|
|
990
|
+
|
|
991
|
+
*/
|
|
992
|
+
BNNS_ENUM(BNNSOptimizerClippingFunction, uint32_t,
|
|
993
|
+
|
|
994
|
+
BNNSOptimizerClippingNone __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 0,
|
|
995
|
+
BNNSOptimizerClippingByValue __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 1,
|
|
996
|
+
BNNSOptimizerClippingByNorm __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 2,
|
|
997
|
+
BNNSOptimizerClippingByGlobalNorm __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 3,
|
|
998
|
+
);
|
|
999
|
+
|
|
1000
|
+
/*!
|
|
1001
|
+
|
|
1002
|
+
@abstract Type of norm
|
|
1003
|
+
|
|
1004
|
+
@constant BNNSL2Norm L-2 norm
|
|
1005
|
+
|
|
1006
|
+
*/
|
|
1007
|
+
BNNS_ENUM(BNNSNormType, uint32_t,
|
|
1008
|
+
|
|
1009
|
+
BNNSL2Norm __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 1,
|
|
1010
|
+
);
|
|
1011
|
+
|
|
1012
|
+
/*!
|
|
1013
|
+
|
|
1014
|
+
@abstract filter type
|
|
1015
|
+
|
|
1016
|
+
@constant BNNSConvolution
|
|
1017
|
+
Convolution filter
|
|
1018
|
+
|
|
1019
|
+
@constant BNNSFullyConnected
|
|
1020
|
+
Fully connected filter
|
|
1021
|
+
|
|
1022
|
+
@constant BNNSBatchNorm
|
|
1023
|
+
Batchnorm filter
|
|
1024
|
+
|
|
1025
|
+
@constant BNNSInstanceNorm
|
|
1026
|
+
Instance normalization filter
|
|
1027
|
+
|
|
1028
|
+
@constant BNNSLayerNorm
|
|
1029
|
+
Layer normalization filter
|
|
1030
|
+
|
|
1031
|
+
@constant BNNSGroupNorm
|
|
1032
|
+
Group normalization filter
|
|
1033
|
+
|
|
1034
|
+
@constant BNNSTransposedConvolution
|
|
1035
|
+
Transposed Convolution filter
|
|
1036
|
+
|
|
1037
|
+
@constant BNNSQuantization
|
|
1038
|
+
Quantization filter
|
|
1039
|
+
|
|
1040
|
+
@constant BNNSArithmetic
|
|
1041
|
+
Arithmetic filter
|
|
1042
|
+
|
|
1043
|
+
*/
|
|
1044
|
+
BNNS_ENUM(BNNSFilterType, uint32_t,
|
|
1045
|
+
|
|
1046
|
+
BNNSConvolution __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
1047
|
+
BNNSFullyConnected __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
1048
|
+
BNNSBatchNorm __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2,
|
|
1049
|
+
BNNSInstanceNorm __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 3,
|
|
1050
|
+
BNNSLayerNorm __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 4,
|
|
1051
|
+
BNNSGroupNorm __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 5,
|
|
1052
|
+
BNNSTransposedConvolution __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 6,
|
|
1053
|
+
BNNSQuantization __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 7,
|
|
1054
|
+
BNNSArithmetic __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 8,
|
|
1055
|
+
);
|
|
1056
|
+
|
|
1057
|
+
/*!
|
|
1058
|
+
|
|
1059
|
+
@abstract Reduction layer functions
|
|
1060
|
+
|
|
1061
|
+
@constant BNNSReduceFunctionMax
|
|
1062
|
+
max(X)
|
|
1063
|
+
|
|
1064
|
+
@constant BNNSReduceFunctionMin
|
|
1065
|
+
min(X)
|
|
1066
|
+
|
|
1067
|
+
@constant BNNSReduceFunctionArgMax
|
|
1068
|
+
arg max(X)
|
|
1069
|
+
i.e. the index of the maximum value
|
|
1070
|
+
|
|
1071
|
+
@constant BNNSReduceFunctionArgMin
|
|
1072
|
+
arg min(X)
|
|
1073
|
+
i.e. the index of the minimum value
|
|
1074
|
+
|
|
1075
|
+
@constant BNNSReduceFunctionMean
|
|
1076
|
+
mean(X) = sum(X) / size(X)
|
|
1077
|
+
|
|
1078
|
+
@constant BNNSReduceFunctionMeanNonZero
|
|
1079
|
+
Y = {X_i such as Weight_i != 0}
|
|
1080
|
+
MeanNonZero(X) = sum(Y) / size(Y)
|
|
1081
|
+
|
|
1082
|
+
@constant BNNSReduceFunctionSum
|
|
1083
|
+
sum(X)
|
|
1084
|
+
|
|
1085
|
+
@constant BNNSReduceFunctionSumSquare
|
|
1086
|
+
sum(X_i * X_i)
|
|
1087
|
+
|
|
1088
|
+
@constant BNNSReduceFunctionSumLog
|
|
1089
|
+
SumLog(X) = sum log(X_i + epsilon)
|
|
1090
|
+
|
|
1091
|
+
@constant BNNSReduceFunctionL1Norm
|
|
1092
|
+
L1Norm(X) = sum | X_i |
|
|
1093
|
+
i.e. sum of the absolute value of each element
|
|
1094
|
+
|
|
1095
|
+
@constant BNNSReduceFunctionLogicalOr
|
|
1096
|
+
AnyOf(X) = X_0 || X_1 || ... X_n
|
|
1097
|
+
|
|
1098
|
+
@constant BNNSReduceFunctionLogicalAnd
|
|
1099
|
+
AllOf(X) = X_0 && X_1 && ... X_n
|
|
1100
|
+
|
|
1101
|
+
@constant BNNSReduceFunctionL2Norm
|
|
1102
|
+
L2Norm(X) = sqrt(sum (X_i * X_i) )
|
|
1103
|
+
i.e. the Euclidean norm
|
|
1104
|
+
|
|
1105
|
+
@constant BNNSReduceFunctionLogSumExp
|
|
1106
|
+
LogSumExp(X) = log(sum(exp(X_i)))
|
|
1107
|
+
|
|
1108
|
+
@constant BNNSReduceFunctionProduct
|
|
1109
|
+
product(X)
|
|
1110
|
+
|
|
1111
|
+
@constant BNNSReduceFunctionLogSum
|
|
1112
|
+
log(sum(X))
|
|
1113
|
+
|
|
1114
|
+
@constant BNNSReduceFunctionAny
|
|
1115
|
+
Alias of BNNSReduceFunctionLogicalOr
|
|
1116
|
+
|
|
1117
|
+
@constant BNNSReduceFunctionAll
|
|
1118
|
+
Alias of BNNSReduceFunctionLogicalAnd
|
|
1119
|
+
|
|
1120
|
+
@constant BNNSReduceFunctionNone
|
|
1121
|
+
Just copies input to output.
|
|
1122
|
+
This function is provided for use in operations with an optional reduction operation
|
|
1123
|
+
where it is used to indicate no reduction operation is required. It is not supported
|
|
1124
|
+
in the reduction layer (users should just use BNNSCopy() or a suitable contraction layer
|
|
1125
|
+
if they wish to perform a copy or conversion operation).
|
|
1126
|
+
*/
|
|
1127
|
+
BNNS_ENUM(BNNSReduceFunction, uint32_t,
|
|
1128
|
+
|
|
1129
|
+
BNNSReduceFunctionMax __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
1130
|
+
BNNSReduceFunctionMin __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
1131
|
+
BNNSReduceFunctionArgMax __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2,
|
|
1132
|
+
BNNSReduceFunctionArgMin __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 3,
|
|
1133
|
+
BNNSReduceFunctionMean __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 4,
|
|
1134
|
+
BNNSReduceFunctionMeanNonZero __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 5,
|
|
1135
|
+
BNNSReduceFunctionSum __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 6,
|
|
1136
|
+
BNNSReduceFunctionSumSquare __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 7,
|
|
1137
|
+
BNNSReduceFunctionSumLog __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 8,
|
|
1138
|
+
BNNSReduceFunctionL1Norm __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 9,
|
|
1139
|
+
BNNSReduceFunctionLogicalOr __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 10,
|
|
1140
|
+
BNNSReduceFunctionLogicalAnd __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 11,
|
|
1141
|
+
BNNSReduceFunctionL2Norm __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 12,
|
|
1142
|
+
BNNSReduceFunctionLogSumExp __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 13,
|
|
1143
|
+
BNNSReduceFunctionProduct __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 14,
|
|
1144
|
+
BNNSReduceFunctionNone __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 15,
|
|
1145
|
+
BNNSReduceFunctionLogSum __API_AVAILABLE(macos(13.3), ios(16.4), watchos(9.4), tvos(16.4)) = 16,
|
|
1146
|
+
|
|
1147
|
+
// Friendly aliases
|
|
1148
|
+
BNNSReduceFunctionAny __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSReduceFunctionLogicalOr,
|
|
1149
|
+
BNNSReduceFunctionAll __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = BNNSReduceFunctionLogicalAnd,
|
|
1150
|
+
);
|
|
1151
|
+
|
|
1152
|
+
/*!
|
|
1153
|
+
@discussion LSTM layer flags
|
|
1154
|
+
@constant BNNSLayerFlagsLSTMBidirectional - enable bidirectional LSTM
|
|
1155
|
+
@constant BNNSLayerFlagsLSTMDefaultActivations - ignore forget_gate_layer.activation, input_gate_layer.activation, candidate_gate_layer.activation, output_gate_layer.activation and hidden_activation and use default activations (see BNNSLayerParametersLSTM)
|
|
1156
|
+
*/
|
|
1157
|
+
BNNS_ENUM(BNNSLayerFlags, uint32_t,
|
|
1158
|
+
|
|
1159
|
+
BNNSLayerFlagsLSTMBidirectional __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x0001,
|
|
1160
|
+
BNNSLayerFlagsLSTMDefaultActivations __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x0002,
|
|
1161
|
+
);
|
|
1162
|
+
|
|
1163
|
+
/*!
|
|
1164
|
+
|
|
1165
|
+
@abstract Data layout and dimension
|
|
1166
|
+
|
|
1167
|
+
@discussion The layout defines the nature of the data stored in a N-dimensional array
|
|
1168
|
+
Introduced in macOS 10.15, iOS 13, tvOS 13, watchOS 6.
|
|
1169
|
+
|
|
1170
|
+
Note that we require that stride is always increasing, i.e. stride[i+1] >= stride[i].
|
|
1171
|
+
As such, the formulae given below for the location of an element uniquely determine what each stride value should be
|
|
1172
|
+
for a given memory layout.
|
|
1173
|
+
|
|
1174
|
+
if stride[k] is 0, it's replaced by the default value corresponding to contiguous memory. If size[k] corresponds to stride[k], as
|
|
1175
|
+
is true for most (but not all) of the layouts below, these would be:
|
|
1176
|
+
stride[k] = 1 for k = 0
|
|
1177
|
+
stride[k] = size[k-1] * stride[k-1] for k > 0
|
|
1178
|
+
|
|
1179
|
+
@constant BNNSDataLayoutVector
|
|
1180
|
+
One-dimensional vector.
|
|
1181
|
+
size[0] is the dimension of the vector. Value (i) is at index i * stride[0]
|
|
1182
|
+
|
|
1183
|
+
@constant BNNSDataLayoutRowMajorMatrix
|
|
1184
|
+
Two-dimensional matrix. Value (row, col) is at index col * stride[0] + row * stride[1]
|
|
1185
|
+
size[0] is the number of columns.
|
|
1186
|
+
size[1] is the number of rows.
|
|
1187
|
+
|
|
1188
|
+
@constant BNNSDataLayoutColumnMajorMatrix
|
|
1189
|
+
Two-dimensional matrix. Value (row, col) is at index row * stride[0] + col * stride[1]
|
|
1190
|
+
size[0] is the number of rows.
|
|
1191
|
+
size[1] is the number of columns.
|
|
1192
|
+
|
|
1193
|
+
@constant BNNSDataLayoutFullyConnectedSparse
|
|
1194
|
+
Two-dimensional array stored in sparse packed format.
|
|
1195
|
+
Use BNNSNDArrayGetSparseParameters() to determine the actual sparse parameters
|
|
1196
|
+
|
|
1197
|
+
@constant BNNSDataLayoutImageCHW
|
|
1198
|
+
Three-dimensional image stack. Value (x,y,channel) is at index x * stride[0] + y * stride[1] + channel * stride[2]
|
|
1199
|
+
size[0] is the image width (pixels).
|
|
1200
|
+
size[1] is the image height (pixels).
|
|
1201
|
+
size[2] is the number of channels.
|
|
1202
|
+
|
|
1203
|
+
@constant BNNSDataLayoutSNE
|
|
1204
|
+
Three dimensional tensor. Value (e, n, s) is at index e * stride[0] + n * stride[1] + s * stride[2].
|
|
1205
|
+
size[0] is E, the embedding dimension
|
|
1206
|
+
size[1] is N, the batch size
|
|
1207
|
+
size[2] is S, the sequence length
|
|
1208
|
+
|
|
1209
|
+
@constant BNNSDataLayoutNSE
|
|
1210
|
+
Three dimensional tensor. Value (e, s, n) is at index e * stride[0] + s * stride[1] + n * stride[2].
|
|
1211
|
+
size[0] is E, the embedding dimension
|
|
1212
|
+
size[1] is S, the sequence length
|
|
1213
|
+
size[2] is N, the batch size
|
|
1214
|
+
|
|
1215
|
+
@constant BNNSDataLayoutConvolutionWeightsOIHW
|
|
1216
|
+
Four-dimensional array of convolution weights.
|
|
1217
|
+
Value (kx,ky,InChannel,OutChannel) is at index kx * stride[0] + ky * stride[1] + InChannel * stride[2] + OutChannel * stride[3]
|
|
1218
|
+
size[0] is the convolution kernel width (pixels).
|
|
1219
|
+
size[1] is the convolution kernel height (pixels).
|
|
1220
|
+
size[2] is the number of input channels.
|
|
1221
|
+
size[3] is the number of output channels.
|
|
1222
|
+
|
|
1223
|
+
@constant BNNSDataLayoutConvolutionWeightsOIHrWr
|
|
1224
|
+
Four-dimensional array of rotated convolution weights.
|
|
1225
|
+
Value (kx,ky,InChannel,OutChannel) is at index (kw - 1 - kx) * stride[0] + (kh - 1 - ky) * stride[1] + InChannel * stride[2] + OutChannel * stride[3]
|
|
1226
|
+
size[0] is the convolution kernel width (pixels).
|
|
1227
|
+
size[1] is the convolution kernel height (pixels).
|
|
1228
|
+
size[2] is the number of input channels.
|
|
1229
|
+
size[3] is the number of output channels.
|
|
1230
|
+
kw is size[0] and kx is between 0 to kw-1.
|
|
1231
|
+
kh is size[1] and ky is between 0 to kh-1.
|
|
1232
|
+
|
|
1233
|
+
@constant BNNSDataLayoutConvolutionWeightsIOHrWr
|
|
1234
|
+
Four-dimensional array of rotated convolution weights.
|
|
1235
|
+
Value (kx,ky,InChannel,OutChannel) is at index (kw - 1 - kx) * stride[0] + (kh - 1 - ky) * stride[1] + OutChannel * stride[2] + InChannel * stride[3]
|
|
1236
|
+
size[0] is the convolution kernel width (pixels).
|
|
1237
|
+
size[1] is the convolution kernel height (pixels).
|
|
1238
|
+
size[2] is the number of output channels.
|
|
1239
|
+
size[3] is the number of input channels.
|
|
1240
|
+
kw is size[0] and kx is between 0 to kw-1.
|
|
1241
|
+
kh is size[1] and ky is between 0 to kh-1.
|
|
1242
|
+
|
|
1243
|
+
@constant BNNSDataLayoutConvolutionWeightsOIHW_Pack32
|
|
1244
|
+
Four-dimensional array of packed convolution weights with 32 output channel packing and 128 Byte array address alignment.
|
|
1245
|
+
|
|
1246
|
+
A value position in the packed array can be determined in the following way:
|
|
1247
|
+
kernel_width is the kernel width
|
|
1248
|
+
kernel_height is the kernel height
|
|
1249
|
+
input_channels is the number of input channels
|
|
1250
|
+
output_channels is the number of output channels
|
|
1251
|
+
OutChannelGroup = OutChannel/32
|
|
1252
|
+
OutChannelPositionInGroup = OutChannel%32
|
|
1253
|
+
Value (kx,ky,InChannel,OutChannel) is at index OutChannelPositionInGroup + kw * 32 + ky * kernel_width * 32 + InChannel * kernel_height * kernel_width * 32 + OutChannelGroup * input_channels * kernel_height * kernel_width * 32
|
|
1254
|
+
|
|
1255
|
+
The inner most output channel packing must alway have a size of 32 elements, even in the last OutChannelGroup where number of output channels may be less than 32.
|
|
1256
|
+
The minimal weight array size in bytes is: 32*kernel_width*kernel_height*input_channels*((output_channels+31)/32)*(weight element size in bytes)
|
|
1257
|
+
Failing to allocate the minimal weight array size may result in runtime error.
|
|
1258
|
+
size and stride structures must match BNNSDataLayoutConvolutionWeightsOIYX layout.
|
|
1259
|
+
memory layout must be contiguous, such that stride[0] is either 1 or 0.
|
|
1260
|
+
|
|
1261
|
+
@constant BNNSDataLayoutMHA_DHK
|
|
1262
|
+
Three-dimensional array of multihead-attention weights. Value (k, d, h) is at d * stride[0] + h * stride[1] + k * stride[2]
|
|
1263
|
+
size[0] is d_model/d_key/d_value (depending on weight matrix being specified)
|
|
1264
|
+
size[1] is d_key/d_value (depending on weight matrix being specified)
|
|
1265
|
+
size[2] is the number of heads
|
|
1266
|
+
|
|
1267
|
+
@constant BNNSDataLayout2DLastMajor
|
|
1268
|
+
Two-dimensional matrix. Value (i, j) is at index i * stride[0] + j * stride[1]
|
|
1269
|
+
size[0] is the size of the first dimension (i).
|
|
1270
|
+
size[1] is the size of the second dimension (j).
|
|
1271
|
+
(This is the BLAS/LAPACK column major equivalent - this layout matches BNNSDataLayoutColumnMajorMatrix)
|
|
1272
|
+
|
|
1273
|
+
@constant BNNSDataLayout2DFirstMajor
|
|
1274
|
+
Two-dimensional matrix. Value (i, j) is at index j * stride[0] + i * stride[1]
|
|
1275
|
+
size[0] is the size of the first dimension (i).
|
|
1276
|
+
size[1] is the size of the second dimension (j).
|
|
1277
|
+
(This is the BLAS/LAPACK row major equivalent - note that BNNSDataLayoutRowMajorMatrix uses different ordering of size[])
|
|
1278
|
+
|
|
1279
|
+
@constant BNNSDataLayout3DLastMajor
|
|
1280
|
+
Three-dimensional tensor. Value (i, j, k) is at index i * stride[0] + j * stride[1] + k * stride[2]
|
|
1281
|
+
size[0] is the size of the first dimension (i).
|
|
1282
|
+
size[1] is the size of the second dimension (j).
|
|
1283
|
+
size[2] is the size of the third dimension (k).
|
|
1284
|
+
|
|
1285
|
+
@constant BNNSDataLayout3DFirstMajor
|
|
1286
|
+
Three-dimensional tensor. Value (i, j, k) is at index k * stride[0] + j * stride[1] + i * stride[2]
|
|
1287
|
+
size[0] is the size of the first dimension (i).
|
|
1288
|
+
size[1] is the size of the second dimension (j).
|
|
1289
|
+
size[2] is the size of the third dimension (k).
|
|
1290
|
+
|
|
1291
|
+
@constant BNNSDataLayout4DLastMajor
|
|
1292
|
+
Four-dimensional tensor. Value (i, j, k, l) is at index i * stride[0] + j * stride[1] +
|
|
1293
|
+
k * stride[2] + l * stride[3]
|
|
1294
|
+
size[0] is the size of the first dimension (i).
|
|
1295
|
+
size[1] is the size of the second dimension (j).
|
|
1296
|
+
size[2] is the size of the third dimension (k).
|
|
1297
|
+
size[3] is the size of the fourth dimension (l).
|
|
1298
|
+
|
|
1299
|
+
@constant BNNSDataLayout4DFirstMajor
|
|
1300
|
+
Four-dimensional tensor. Value (i, j, k, l) is at index l * stride[0] + k * stride[1] +
|
|
1301
|
+
j * stride[2] + i * stride[3]
|
|
1302
|
+
size[0] is the size of the first dimension (i).
|
|
1303
|
+
size[1] is the size of the second dimension (j).
|
|
1304
|
+
size[2] is the size of the third dimension (k).
|
|
1305
|
+
size[3] is the size of the fourth dimension (l).
|
|
1306
|
+
|
|
1307
|
+
@constant BNNSDataLayout5DLastMajor
|
|
1308
|
+
Five-dimensional tensor. Value (i, j, k, l, m) is at index i * stride[0] + j * stride[1] +
|
|
1309
|
+
k * stride[2] + l * stride[3] + m * stride[4]
|
|
1310
|
+
size[0] is the size of the first dimension (i).
|
|
1311
|
+
size[1] is the size of the second dimension (j).
|
|
1312
|
+
size[2] is the size of the third dimension (k).
|
|
1313
|
+
size[3] is the size of the fourth dimension (l).
|
|
1314
|
+
size[4] is the size of the fifth dimension (m).
|
|
1315
|
+
|
|
1316
|
+
@constant BNNSDataLayout5DFirstMajor
|
|
1317
|
+
Five-dimensional tensor. Value (i, j, k, l, m) is at index m * stride[0] + l * stride[1] +
|
|
1318
|
+
k * stride[2] + j * stride[3] + i * stride[4]
|
|
1319
|
+
size[0] is the size of the first dimension (i).
|
|
1320
|
+
size[1] is the size of the second dimension (j).
|
|
1321
|
+
size[2] is the size of the third dimension (k).
|
|
1322
|
+
size[3] is the size of the fourth dimension (l).
|
|
1323
|
+
size[4] is the size of the fifth dimension (m).
|
|
1324
|
+
|
|
1325
|
+
@constant BNNSDataLayout6DLastMajor
|
|
1326
|
+
Six-dimensional tensor. Value (i, j, k, l, m, n) is at index i * stride[0] + j * stride[1] +
|
|
1327
|
+
k * stride[2] + l * stride[3] + m * stride[4] + n * stride[5]
|
|
1328
|
+
size[0] is the size of the first dimension (i).
|
|
1329
|
+
size[1] is the size of the second dimension (j).
|
|
1330
|
+
size[2] is the size of the third dimension (k).
|
|
1331
|
+
size[3] is the size of the fourth dimension (l).
|
|
1332
|
+
size[4] is the size of the fifth dimension (m).
|
|
1333
|
+
size[5] is the size of the sixth dimension (n).
|
|
1334
|
+
|
|
1335
|
+
@constant BNNSDataLayout6DFirstMajor
|
|
1336
|
+
Six-dimensional tensor. Value (i, j, k, l, m, n) is at index n * stride[0] + m * stride[1] +
|
|
1337
|
+
l * stride[2] + k * stride[3] + j * stride[4] + i * stride[5]
|
|
1338
|
+
size[0] is the size of the first dimension (i).
|
|
1339
|
+
size[1] is the size of the second dimension (j).
|
|
1340
|
+
size[2] is the size of the third dimension (k).
|
|
1341
|
+
size[3] is the size of the fourth dimension (l).
|
|
1342
|
+
size[4] is the size of the fifth dimension (m).
|
|
1343
|
+
size[5] is the size of the sixth dimension (n).
|
|
1344
|
+
|
|
1345
|
+
@constant BNNSDataLayout7DLastMajor
|
|
1346
|
+
Seven-dimensional tensor. Value (i, j, k, l, m, n, o) is at index i * stride[0] + j * stride[1] +
|
|
1347
|
+
k * stride[2] + l * stride[3] + m * stride[4] + n * stride[5] + o * stride[6]
|
|
1348
|
+
size[0] is the size of the first dimension (i).
|
|
1349
|
+
size[1] is the size of the second dimension (j).
|
|
1350
|
+
size[2] is the size of the third dimension (k).
|
|
1351
|
+
size[3] is the size of the fourth dimension (l).
|
|
1352
|
+
size[4] is the size of the fifth dimension (m).
|
|
1353
|
+
size[5] is the size of the sixth dimension (n).
|
|
1354
|
+
size[6] is the size of the seventh dimension (o).
|
|
1355
|
+
|
|
1356
|
+
@constant BNNSDataLayout7DFirstMajor
|
|
1357
|
+
Seven-dimensional tensor. Value (i, j, k, l, m, n, o) is at index o * stride[0] + n * stride[1] +
|
|
1358
|
+
m * stride[2] + l * stride[3] + k * stride[4] + j * stride[5] + i * stride[6]
|
|
1359
|
+
size[0] is the size of the first dimension (i).
|
|
1360
|
+
size[1] is the size of the second dimension (j).
|
|
1361
|
+
size[2] is the size of the third dimension (k).
|
|
1362
|
+
size[3] is the size of the fourth dimension (l).
|
|
1363
|
+
size[4] is the size of the fifth dimension (m).
|
|
1364
|
+
size[5] is the size of the sixth dimension (n).
|
|
1365
|
+
size[6] is the size of the seventh dimension (o).
|
|
1366
|
+
|
|
1367
|
+
@constant BNNSDataLayout8DLastMajor
|
|
1368
|
+
Eight-dimensional tensor. Value (i, j, k, l, m, n, o, p) is at index
|
|
1369
|
+
i * stride[0] + j * stride[1] + k * stride[2] + l * stride[3] +
|
|
1370
|
+
m * stride[4] + n * stride[5] + o * stride[6] + p * stride[7]
|
|
1371
|
+
size[0] is the size of the first dimension (i).
|
|
1372
|
+
size[1] is the size of the second dimension (j).
|
|
1373
|
+
size[2] is the size of the third dimension (k).
|
|
1374
|
+
size[3] is the size of the fourth dimension (l).
|
|
1375
|
+
size[4] is the size of the fifth dimension (m).
|
|
1376
|
+
size[5] is the size of the sixth dimension (n).
|
|
1377
|
+
size[6] is the size of the seventh dimension (o).
|
|
1378
|
+
size[7] is the size of the eighth dimension (p).
|
|
1379
|
+
|
|
1380
|
+
@constant BNNSDataLayout8DFirstMajor
|
|
1381
|
+
Eight-dimensional tensor. Value (i, j, k, l, m, n, o, p) is at index
|
|
1382
|
+
p * stride[0] + o * stride[1] + n * stride[2] + m * stride[3] +
|
|
1383
|
+
l * stride[4] + k * stride[5] + j * stride[6] + i * stride[7]
|
|
1384
|
+
size[0] is the size of the first dimension (i).
|
|
1385
|
+
size[1] is the size of the second dimension (j).
|
|
1386
|
+
size[2] is the size of the third dimension (k).
|
|
1387
|
+
size[3] is the size of the fourth dimension (l).
|
|
1388
|
+
size[4] is the size of the fifth dimension (m).
|
|
1389
|
+
size[5] is the size of the sixth dimension (n).
|
|
1390
|
+
size[6] is the size of the seventh dimension (o).
|
|
1391
|
+
size[7] is the size of the eighth dimension (p).
|
|
1392
|
+
|
|
1393
|
+
*/
|
|
1394
|
+
BNNS_ENUM(BNNSDataLayout, uint32_t,
|
|
1395
|
+
|
|
1396
|
+
// 1-dimensional layouts (are identical and only included for ease of use and consistent numbering)
|
|
1397
|
+
BNNSDataLayoutVector __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x10000,
|
|
1398
|
+
BNNSDataLayout1DLastMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x18000,
|
|
1399
|
+
BNNSDataLayout1DFirstMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x18001,
|
|
1400
|
+
|
|
1401
|
+
// 2-dimensional layouts
|
|
1402
|
+
BNNSDataLayoutRowMajorMatrix __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x20000,
|
|
1403
|
+
BNNSDataLayoutColumnMajorMatrix __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x20001,
|
|
1404
|
+
BNNSDataLayout2DLastMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x28000,
|
|
1405
|
+
BNNSDataLayout2DFirstMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x28001,
|
|
1406
|
+
BNNSDataLayoutFullyConnectedSparse __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 0x21001,
|
|
1407
|
+
|
|
1408
|
+
// 3-dimensional layouts
|
|
1409
|
+
BNNSDataLayoutImageCHW __API_AVAILABLE(macos(10.15), ios(13.0), watchos(6.0), tvos(13.0)) = 0x30000,
|
|
1410
|
+
BNNSDataLayoutSNE __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 0x30001,
|
|
1411
|
+
BNNSDataLayoutNSE __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 0x30002,
|
|
1412
|
+
BNNSDataLayoutMHA_DHK __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 0x30003,
|
|
1413
|
+
BNNSDataLayout3DLastMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x38000,
|
|
1414
|
+
BNNSDataLayout3DFirstMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x38001,
|
|
1415
|
+
|
|
1416
|
+
// 4-dimensional layouts
|
|
1417
|
+
BNNSDataLayoutConvolutionWeightsOIHW __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x40000,
|
|
1418
|
+
BNNSDataLayoutConvolutionWeightsOIHrWr __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x40001,
|
|
1419
|
+
BNNSDataLayoutConvolutionWeightsIOHrWr __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x40002,
|
|
1420
|
+
BNNSDataLayoutConvolutionWeightsOIHW_Pack32 __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x40010,
|
|
1421
|
+
BNNSDataLayout4DLastMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x48000,
|
|
1422
|
+
BNNSDataLayout4DFirstMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x48001,
|
|
1423
|
+
|
|
1424
|
+
// 5-dimensional layouts
|
|
1425
|
+
BNNSDataLayout5DLastMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x58000,
|
|
1426
|
+
BNNSDataLayout5DFirstMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x58001,
|
|
1427
|
+
|
|
1428
|
+
// 6-dimensional layouts
|
|
1429
|
+
BNNSDataLayout6DLastMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x68000,
|
|
1430
|
+
BNNSDataLayout6DFirstMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x68001,
|
|
1431
|
+
|
|
1432
|
+
// 7-dimensional layouts
|
|
1433
|
+
BNNSDataLayout7DLastMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x78000,
|
|
1434
|
+
BNNSDataLayout7DFirstMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x78001,
|
|
1435
|
+
|
|
1436
|
+
// 8-dimensional layouts
|
|
1437
|
+
BNNSDataLayout8DLastMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x88000,
|
|
1438
|
+
BNNSDataLayout8DFirstMajor __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0x88001,
|
|
1439
|
+
);
|
|
1440
|
+
|
|
1441
|
+
/*! @abstract Interpolation methods for resize.
|
|
1442
|
+
*
|
|
1443
|
+
* @constant BNNSInterpolationMethodNearest - Use nearest neighbor interpolation, suitable for any number of interpolation dimensions.
|
|
1444
|
+
* @constant BNNSInterpolationMethodLinear - Use linear or bilinear interpolation depending on number of resized dimensions. Requires that we are interpolating in at most two dimensions.
|
|
1445
|
+
*/
|
|
1446
|
+
BNNS_ENUM(BNNSInterpolationMethod, uint32_t,
|
|
1447
|
+
|
|
1448
|
+
BNNSInterpolationMethodNearest __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
1449
|
+
BNNSInterpolationMethodLinear __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
1450
|
+
);
|
|
1451
|
+
|
|
1452
|
+
/*! @abstract Interpolation sampling mode.
|
|
1453
|
+
* This parameter controls how the grid is sampled. If the input grid is [0, Xin-1] (corresponding to an input size of Xin),
|
|
1454
|
+
* and if the output size is Xout, then the grid points are sampled in the following manner
|
|
1455
|
+
*
|
|
1456
|
+
* @constant BNNSLinearSamplingDefault - spacing = (Xin - Xin/Xout) / (Xout - 1),
|
|
1457
|
+
* grid_point[i] = min(Xin-1, max(0, i*spacing)), for i=0,1,...,Xout-1
|
|
1458
|
+
* @constant BNNSLinearSamplingAlignCorners - Same as "STRICT_ALIGN_CORNERS" unless Xout=1,
|
|
1459
|
+
* in which case, grid_point[0] = (Xin-1) / 2, if Xout==1
|
|
1460
|
+
* @constant BNNSLinearSamplingUnalignCorners - spacing = Xin / Xout, grid_point[i] = min(Xin - 1, max(0, i*spacing + 0.5*spacing - 0.5)), for i=0,1,...,Xout-1
|
|
1461
|
+
* @constant BNNSLinearSamplingStrictAlignCorners - spacing = (Xin - 1) / (Xout - 1), grid_point[i] = min(Xin-1, max(0, i*spacing)), for i=0,1,...,Xout-1
|
|
1462
|
+
* @constant BNNSLinearSamplingOffsetCorners - delta = max(1, Xin - 1) / Xout, spacing = ((Xout - 1) * delta) / (Xout - 1),
|
|
1463
|
+
* grid_point[i] = min(Xin-1, max(0, 0.5*delta + i*spacing)), for i=0,1,...,Xout-1
|
|
1464
|
+
*/
|
|
1465
|
+
BNNS_ENUM(BNNSLinearSamplingMode, uint32_t,
|
|
1466
|
+
|
|
1467
|
+
BNNSLinearSamplingDefault __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 0,
|
|
1468
|
+
BNNSLinearSamplingAlignCorners __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 1,
|
|
1469
|
+
BNNSLinearSamplingUnalignCorners __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 2,
|
|
1470
|
+
BNNSLinearSamplingStrictAlignCorners __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 3,
|
|
1471
|
+
BNNSLinearSamplingOffsetCorners __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 4,
|
|
1472
|
+
);
|
|
1473
|
+
|
|
1474
|
+
/*! @abstract
|
|
1475
|
+
* Specifies the convention for specifying the four bounding box coordinates for an 2D image
|
|
1476
|
+
*
|
|
1477
|
+
* @constant BNNSCornersHeightFirst - [h_start, w_start, h_end, w_end]
|
|
1478
|
+
* @constant BNNSCornersWidthFirst - [w_start, h_start, w_end, h_end]
|
|
1479
|
+
* @constant BNNSCenterSizeHeightFirst - [h_center, w_center, box_height, box_width]
|
|
1480
|
+
* @constant BNNSCenterSizeWidthFirst - [w_center, h_center, box_width, box_height]
|
|
1481
|
+
*/
|
|
1482
|
+
BNNS_ENUM(BNNSBoxCoordinateMode, uint32_t,
|
|
1483
|
+
|
|
1484
|
+
BNNSCornersHeightFirst __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 0,
|
|
1485
|
+
BNNSCornersWidthFirst __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 1,
|
|
1486
|
+
BNNSCenterSizeHeightFirst __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 2,
|
|
1487
|
+
BNNSCenterSizeWidthFirst __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 3,
|
|
1488
|
+
);
|
|
1489
|
+
|
|
1490
|
+
|
|
1491
|
+
/*! @abstract padding modes for padding.
|
|
1492
|
+
*
|
|
1493
|
+
* @constant BNNSPaddingModeConstant - padded area is filled with constant value specified by the user
|
|
1494
|
+
* @constant BNNSPaddingModeReflect - padded area is filled up so that the padded area and the adjacent area with input data form an odd-symmetric pattern: x x A B C -> C B A B C
|
|
1495
|
+
* @constant BNNSPaddingModeSymmetric - padded area is filled up so that the padded area and the adjacent area with input data form an even-symmetric pattern: x x A B -> B A A B
|
|
1496
|
+
*/
|
|
1497
|
+
BNNS_ENUM(BNNSPaddingMode, uint32_t,
|
|
1498
|
+
BNNSPaddingModeConstant __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
1499
|
+
BNNSPaddingModeReflect __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
1500
|
+
BNNSPaddingModeSymmetric __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2,
|
|
1501
|
+
);
|
|
1502
|
+
|
|
1503
|
+
/*!
|
|
1504
|
+
|
|
1505
|
+
@abstract Relational layer operation type
|
|
1506
|
+
|
|
1507
|
+
@constant BNNSRelationalOperatorEqual
|
|
1508
|
+
Perform element-by-element comparison of A == B
|
|
1509
|
+
|
|
1510
|
+
@constant BNNSRelationalOperatorLess
|
|
1511
|
+
Perform element-by-element comparison of A < B
|
|
1512
|
+
|
|
1513
|
+
@constant BNNSRelationalOperatorLessEqual
|
|
1514
|
+
Perform element-by-element comparison of A <= B
|
|
1515
|
+
|
|
1516
|
+
@constant BNNSRelationalOperatorGreater
|
|
1517
|
+
Perform element-by-element comparison of A > B
|
|
1518
|
+
|
|
1519
|
+
@constant BNNSRelationalOperatorGreaterEqual
|
|
1520
|
+
Perform element-by-element comparison of A >= B
|
|
1521
|
+
|
|
1522
|
+
@constant BNNSRelationalOperatorNotEqual
|
|
1523
|
+
Perform element-by-element comparison of A != B
|
|
1524
|
+
|
|
1525
|
+
@constant BNNSRelationalOperatorLogicalAND
|
|
1526
|
+
Perform element-by-element A && B
|
|
1527
|
+
|
|
1528
|
+
@constant BNNSRelationalOperatorLogicalOR
|
|
1529
|
+
Perform element-by-element A || B
|
|
1530
|
+
|
|
1531
|
+
@constant BNNSRelationalOperatorLogicalNOT
|
|
1532
|
+
Perform element-by-element !A
|
|
1533
|
+
|
|
1534
|
+
@constant BNNSRelationalOperatorLogicalNAND
|
|
1535
|
+
Perform element-by-element !(A && B)
|
|
1536
|
+
|
|
1537
|
+
@constant BNNSRelationalOperatorLogicalNOR
|
|
1538
|
+
Perform element-by-element !(A || B)
|
|
1539
|
+
|
|
1540
|
+
@constant BNNSRelationalOperatorLogicalXOR
|
|
1541
|
+
Perform element-by-element A ^ B
|
|
1542
|
+
|
|
1543
|
+
*/
|
|
1544
|
+
BNNS_ENUM(BNNSRelationalOperator, uint32_t,
|
|
1545
|
+
BNNSRelationalOperatorEqual __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
1546
|
+
BNNSRelationalOperatorLess __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
1547
|
+
BNNSRelationalOperatorLessEqual __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 2,
|
|
1548
|
+
BNNSRelationalOperatorGreater __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 3,
|
|
1549
|
+
BNNSRelationalOperatorGreaterEqual __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 4,
|
|
1550
|
+
BNNSRelationalOperatorNotEqual __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 5,
|
|
1551
|
+
BNNSRelationalOperatorLogicalAND __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 6,
|
|
1552
|
+
BNNSRelationalOperatorLogicalOR __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 7,
|
|
1553
|
+
BNNSRelationalOperatorLogicalNOT __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 8,
|
|
1554
|
+
BNNSRelationalOperatorLogicalNAND __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 9,
|
|
1555
|
+
BNNSRelationalOperatorLogicalNOR __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 10,
|
|
1556
|
+
BNNSRelationalOperatorLogicalXOR __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 11,
|
|
1557
|
+
);
|
|
1558
|
+
|
|
1559
|
+
/*! @abstract Pointer extraction specifiers
|
|
1560
|
+
*
|
|
1561
|
+
* @discussion
|
|
1562
|
+
* These enums are passed to BNNSGetPointer() to specify what pointer should be returned.
|
|
1563
|
+
*
|
|
1564
|
+
* @constant BNNSPointerSpecifierAlpha - alpha parameter associated with layer (supported by: activation)
|
|
1565
|
+
* @constant BNNSPointerSpecifierBeta - beta parameter associated with layer (supported by: activation)
|
|
1566
|
+
*/
|
|
1567
|
+
BNNS_ENUM(BNNSPointerSpecifier, uint32_t,
|
|
1568
|
+
|
|
1569
|
+
BNNSPointerSpecifierAlpha __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
1570
|
+
BNNSPointerSpecifierBeta __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1
|
|
1571
|
+
);
|
|
1572
|
+
|
|
1573
|
+
/*! @abstract Flags to control behaviors on BNNSNDArrayDescriptors
|
|
1574
|
+
*
|
|
1575
|
+
* @constant BNNSNDArrayFlagBackpropSet - During back propogation, the elements of this ndarray are overwritten by the jacobian.
|
|
1576
|
+
* If the NDArray does not represent a backpropgation gradient calculated by the function, this variable is ignored (i.e. this will typically
|
|
1577
|
+
* only be used for output variables with names ending _delta).
|
|
1578
|
+
* @constant BNNSNDArrayFlagBackpropAccumulate - During back propogation, the value of the jacobian is added to the elements of this ndarray
|
|
1579
|
+
* (i.e. if the value is input_delta on entry to the function and dL/dx is the jacobian, then on exit it will be input_delta + dL/dx).
|
|
1580
|
+
* If the NDArray does not represent a backpropgation gradient calculated by the function, this variable is ignored (i.e. this will typically
|
|
1581
|
+
* only be used for output variables with names ending _delta).
|
|
1582
|
+
*/
|
|
1583
|
+
BNNS_ENUM(BNNSNDArrayFlags, uint32_t,
|
|
1584
|
+
|
|
1585
|
+
BNNSNDArrayFlagBackpropSet __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 0,
|
|
1586
|
+
BNNSNDArrayFlagBackpropAccumulate __API_AVAILABLE(macos(11.0), ios(14.0), watchos(7.0), tvos(14.0)) = 1,
|
|
1587
|
+
);
|
|
1588
|
+
|
|
1589
|
+
/*! @abstract Flags to control behavior of Embedding layers
|
|
1590
|
+
*
|
|
1591
|
+
* @constant BNNSEmbeddingFlagScaleGradientByFrequency - If true, gradients calculated during the backward pass are scaled
|
|
1592
|
+
* based on the number of occurrence of the corresponding index in the input.
|
|
1593
|
+
*/
|
|
1594
|
+
BNNS_ENUM(BNNSEmbeddingFlags, uint32_t,
|
|
1595
|
+
BNNSEmbeddingFlagScaleGradientByFrequency __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 1,
|
|
1596
|
+
);
|
|
1597
|
+
|
|
1598
|
+
/*!
|
|
1599
|
+
|
|
1600
|
+
@abstract Quantizer function
|
|
1601
|
+
|
|
1602
|
+
@constant BNNSQuantizerFunctionQuantize
|
|
1603
|
+
y = scale*x + bias
|
|
1604
|
+
|
|
1605
|
+
@constant BNNSQuantizerFunctionDequantize
|
|
1606
|
+
y = (x-bias)/scale
|
|
1607
|
+
|
|
1608
|
+
*/
|
|
1609
|
+
BNNS_ENUM(BNNSQuantizerFunction, uint32_t,
|
|
1610
|
+
BNNSQuantizerFunctionQuantize __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 0,
|
|
1611
|
+
BNNSQuantizerFunctionDequantize __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 1
|
|
1612
|
+
);
|
|
1613
|
+
|
|
1614
|
+
|
|
1615
|
+
/*! @abstract Random number generation methods
|
|
1616
|
+
*
|
|
1617
|
+
* @discussion
|
|
1618
|
+
* This method should not be used for cryptographic applications.
|
|
1619
|
+
*
|
|
1620
|
+
* @constant BNNSRandomGeneratorMethodAES_CTR
|
|
1621
|
+
* Implementation based on the AES hash of a counter.
|
|
1622
|
+
*/
|
|
1623
|
+
BNNS_ENUM(BNNSRandomGeneratorMethod, uint32_t,
|
|
1624
|
+
BNNSRandomGeneratorMethodAES_CTR __API_AVAILABLE(macos(12.0), ios(15.0), watchos(8.0), tvos(15.0)) = 0,
|
|
1625
|
+
);
|
|
1626
|
+
|
|
1627
|
+
/*!
|
|
1628
|
+
@constant BNNSSparsityTypeUnstructured - no special pattern in the sparsity
|
|
1629
|
+
|
|
1630
|
+
*/
|
|
1631
|
+
BNNS_ENUM(BNNSSparsityType, uint32_t,
|
|
1632
|
+
BNNSSparsityTypeUnstructured __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 0x0,
|
|
1633
|
+
);
|
|
1634
|
+
|
|
1635
|
+
/*! @abstract Target System values for BNNSGetBestDataLayout* functions
|
|
1636
|
+
* @discussion
|
|
1637
|
+
* Due to architectural and microarchitectural changes between different types and generations of apple devices, the optimal packing
|
|
1638
|
+
* of data varies from device to device. In order to determine the optimal repacking for a given device, the user may call the
|
|
1639
|
+
* BNNSGetBestDataLayout* family of functions. These functions take an argument representing the Target System from the values
|
|
1640
|
+
* provided by this enumeration.
|
|
1641
|
+
*
|
|
1642
|
+
* @constant BNNSTargetSystemGeneric - Provide a single layout that is support and will provide reasonable performance on most devices
|
|
1643
|
+
*/
|
|
1644
|
+
BNNS_ENUM(BNNSTargetSystem, uint32_t,
|
|
1645
|
+
BNNSTargetSystemGeneric __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 0,
|
|
1646
|
+
);
|
|
1647
|
+
|
|
1648
|
+
/*! @abstract Shuffle type for BNNSShuffle function
|
|
1649
|
+
*
|
|
1650
|
+
* @constant BNNSShuffleTypePixelShuffleNCHW
|
|
1651
|
+
* pixel shuffle for NCHW format, equivalent to depth-to-space in "CRD" mode, i.e.,
|
|
1652
|
+
* rearranges elements in a tensor of shape (N,C×rxr,H,W) to a tensor of shape (N,C,H×r,W×r), where r is an upscale factor
|
|
1653
|
+
*
|
|
1654
|
+
* @constant BNNSShuffleTypePixelUnshuffleNCHW
|
|
1655
|
+
* pixel unshuffle for NCHW format, reverse of pixel shuffle, i.e.,
|
|
1656
|
+
* reverses the PixelShuffle operation by rearranging elements in a tensor of shape (N,C,H×r,W×r) to a tensor of shape (N,C×rxr,H,W),
|
|
1657
|
+
* where r is a downscale factor
|
|
1658
|
+
*
|
|
1659
|
+
* @constant BNNSShuffleTypeDepthToSpaceNCHW
|
|
1660
|
+
* `depth_to_space` for NCHW format, reverse of `space_to_depth` for NCHW.
|
|
1661
|
+
* `depth_to_space` rearranges elements from (N, Cxbxb, H, W) --> (N, C, Hxb, Wxb), where b is the block size
|
|
1662
|
+
* Elements are rearranged different to `BNNSShuffleTypePixelShuffleNCHW` for cases
|
|
1663
|
+
* where the number of output channels is > 1. e.g., (1, 12, 3, 3) --> (1, 3, 6, 6)
|
|
1664
|
+
*
|
|
1665
|
+
* @constant BNNSShuffleTypeSpaceToDepthNCHW
|
|
1666
|
+
* `space_to_depth` for NCHW format, reverse of `depth_to_space`,
|
|
1667
|
+
* rearranges elements to enable atrous convolution to be performed using dense convolution operations
|
|
1668
|
+
*/
|
|
1669
|
+
|
|
1670
|
+
BNNS_ENUM(BNNSShuffleType, uint32_t,
|
|
1671
|
+
BNNSShuffleTypePixelShuffleNCHW __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 0,
|
|
1672
|
+
BNNSShuffleTypePixelUnshuffleNCHW __API_AVAILABLE(macos(13.0), ios(16.0), watchos(9.0), tvos(16.0)) = 1,
|
|
1673
|
+
BNNSShuffleTypeDepthToSpaceNCHW __API_AVAILABLE(macos(13.3), ios(16.4), watchos(9.4), tvos(16.4)) = 2,
|
|
1674
|
+
BNNSShuffleTypeSpaceToDepthNCHW __API_AVAILABLE(macos(13.3), ios(16.4), watchos(9.4), tvos(16.4)) = 3,
|
|
1675
|
+
);
|
|
1676
|
+
|
|
1677
|
+
#if !__has_include( <Availability.h> )
|
|
1678
|
+
#undef __API_AVAILABLE
|
|
1679
|
+
#undef __API_DEPRECATED_WITH_REPLACEMENT
|
|
1680
|
+
#undef __API_AVAILABLE
|
|
1681
|
+
#endif
|
|
1682
|
+
|
|
1683
|
+
#undef BNNS_ENUM // remove local defintion of BNNS_ENUM
|
|
1684
|
+
|
|
1685
|
+
#endif /* __BNNS_CONSTANTS_HEADER__ */
|