ai.muna.muna 0.0.42

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (185) hide show
  1. package/Editor/Build/AndroidBuildHandler.cs +96 -0
  2. package/Editor/Build/AndroidBuildHandler.cs.meta +11 -0
  3. package/Editor/Build/BuildHandler.cs +128 -0
  4. package/Editor/Build/BuildHandler.cs.meta +11 -0
  5. package/Editor/Build/LinuxBuildHandler.cs +26 -0
  6. package/Editor/Build/LinuxBuildHandler.cs.meta +11 -0
  7. package/Editor/Build/WebGLBuildHandler.cs +69 -0
  8. package/Editor/Build/WebGLBuildHandler.cs.meta +11 -0
  9. package/Editor/Build/WindowsBuildHandler.cs +24 -0
  10. package/Editor/Build/WindowsBuildHandler.cs.meta +11 -0
  11. package/Editor/Build/iOSBuildHandler.cs +119 -0
  12. package/Editor/Build/iOSBuildHandler.cs.meta +11 -0
  13. package/Editor/Build/macOSBuildHandler.cs +133 -0
  14. package/Editor/Build/macOSBuildHandler.cs.meta +11 -0
  15. package/Editor/Build.meta +8 -0
  16. package/Editor/Muna.Editor.asmdef +18 -0
  17. package/Editor/Muna.Editor.asmdef.meta +7 -0
  18. package/Editor/MunaMenu.cs +32 -0
  19. package/Editor/MunaMenu.cs.meta +11 -0
  20. package/Editor/MunaProjectSettings.cs +43 -0
  21. package/Editor/MunaProjectSettings.cs.meta +11 -0
  22. package/Editor/MunaSettingsProvider.cs +27 -0
  23. package/Editor/MunaSettingsProvider.cs.meta +11 -0
  24. package/Editor.meta +8 -0
  25. package/LICENSE +201 -0
  26. package/LICENSE.meta +7 -0
  27. package/Plugins/Android/Function.aar +0 -0
  28. package/Plugins/Android/Function.aar.meta +32 -0
  29. package/Plugins/Android.meta +8 -0
  30. package/Plugins/Linux/arm64/libFunction.so +0 -0
  31. package/Plugins/Linux/arm64/libFunction.so.meta +62 -0
  32. package/Plugins/Linux/arm64.meta +8 -0
  33. package/Plugins/Linux/x86_64/libFunction.so +0 -0
  34. package/Plugins/Linux/x86_64/libFunction.so.meta +82 -0
  35. package/Plugins/Linux/x86_64.meta +8 -0
  36. package/Plugins/Linux.meta +8 -0
  37. package/Plugins/Web/libFunction.a +0 -0
  38. package/Plugins/Web/libFunction.a.meta +87 -0
  39. package/Plugins/Web.meta +8 -0
  40. package/Plugins/Windows/arm64/Function.dll +0 -0
  41. package/Plugins/Windows/arm64/Function.dll.meta +58 -0
  42. package/Plugins/Windows/arm64.meta +8 -0
  43. package/Plugins/Windows/x86_64/Function.dll +0 -0
  44. package/Plugins/Windows/x86_64/Function.dll.meta +82 -0
  45. package/Plugins/Windows/x86_64.meta +8 -0
  46. package/Plugins/Windows.meta +8 -0
  47. package/Plugins/iOS/Function.xcframework/Info.plist +75 -0
  48. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Function +0 -0
  49. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNConfiguration.h +313 -0
  50. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNPrediction.h +165 -0
  51. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNPredictionStream.h +63 -0
  52. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNPredictor.h +108 -0
  53. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNStatus.h +42 -0
  54. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNValue.h +395 -0
  55. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNValueMap.h +148 -0
  56. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/FXNVersion.h +26 -0
  57. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Headers/Function.h +18 -0
  58. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Info.plist +0 -0
  59. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/Modules/module.modulemap +6 -0
  60. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/PrivacyInfo.xcprivacy +36 -0
  61. package/Plugins/iOS/Function.xcframework/ios-arm64/Function.framework/_CodeSignature/CodeResources +223 -0
  62. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Function +0 -0
  63. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNConfiguration.h +313 -0
  64. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNPrediction.h +165 -0
  65. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNPredictionStream.h +63 -0
  66. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNPredictor.h +108 -0
  67. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNStatus.h +42 -0
  68. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNValue.h +395 -0
  69. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNValueMap.h +148 -0
  70. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/FXNVersion.h +26 -0
  71. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Headers/Function.h +18 -0
  72. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Info.plist +0 -0
  73. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/Modules/module.modulemap +6 -0
  74. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/PrivacyInfo.xcprivacy +36 -0
  75. package/Plugins/iOS/Function.xcframework/ios-arm64_x86_64-simulator/Function.framework/_CodeSignature/CodeResources +223 -0
  76. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Function +0 -0
  77. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNConfiguration.h +313 -0
  78. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNPrediction.h +165 -0
  79. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNPredictionStream.h +63 -0
  80. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNPredictor.h +108 -0
  81. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNStatus.h +42 -0
  82. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNValue.h +395 -0
  83. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNValueMap.h +148 -0
  84. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/FXNVersion.h +26 -0
  85. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Headers/Function.h +18 -0
  86. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Info.plist +0 -0
  87. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/Modules/module.modulemap +6 -0
  88. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/PrivacyInfo.xcprivacy +36 -0
  89. package/Plugins/iOS/Function.xcframework/xros-arm64/Function.framework/_CodeSignature/CodeResources +223 -0
  90. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Function +0 -0
  91. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNConfiguration.h +313 -0
  92. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNPrediction.h +165 -0
  93. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNPredictionStream.h +63 -0
  94. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNPredictor.h +108 -0
  95. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNStatus.h +42 -0
  96. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNValue.h +395 -0
  97. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNValueMap.h +148 -0
  98. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/FXNVersion.h +26 -0
  99. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Headers/Function.h +18 -0
  100. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Info.plist +0 -0
  101. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/Modules/module.modulemap +6 -0
  102. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/PrivacyInfo.xcprivacy +36 -0
  103. package/Plugins/iOS/Function.xcframework/xros-arm64_x86_64-simulator/Function.framework/_CodeSignature/CodeResources +223 -0
  104. package/Plugins/iOS/Function.xcframework.meta +83 -0
  105. package/Plugins/iOS.meta +8 -0
  106. package/Plugins/macOS/Function.dylib +0 -0
  107. package/Plugins/macOS/Function.dylib.meta +82 -0
  108. package/Plugins/macOS.meta +8 -0
  109. package/Plugins.meta +8 -0
  110. package/README.md +79 -0
  111. package/README.md.meta +7 -0
  112. package/Runtime/API/DotNetClient.cs +106 -0
  113. package/Runtime/API/DotNetClient.cs.meta +11 -0
  114. package/Runtime/API/MunaClient.cs +96 -0
  115. package/Runtime/API/MunaClient.cs.meta +11 -0
  116. package/Runtime/API.meta +8 -0
  117. package/Runtime/Beta/BetaClient.cs +33 -0
  118. package/Runtime/Beta/BetaClient.cs.meta +11 -0
  119. package/Runtime/Beta/PredictionService.cs +32 -0
  120. package/Runtime/Beta/PredictionService.cs.meta +11 -0
  121. package/Runtime/Beta/RemoteAcceleration.cs +38 -0
  122. package/Runtime/Beta/RemoteAcceleration.cs.meta +11 -0
  123. package/Runtime/Beta/RemotePredictionService.cs +187 -0
  124. package/Runtime/Beta/RemotePredictionService.cs.meta +11 -0
  125. package/Runtime/Beta/Value.cs +92 -0
  126. package/Runtime/Beta/Value.cs.meta +11 -0
  127. package/Runtime/Beta.meta +8 -0
  128. package/Runtime/C/Configuration.cs +139 -0
  129. package/Runtime/C/Configuration.cs.meta +11 -0
  130. package/Runtime/C/Function.cs +294 -0
  131. package/Runtime/C/Function.cs.meta +11 -0
  132. package/Runtime/C/Prediction.cs +70 -0
  133. package/Runtime/C/Prediction.cs.meta +11 -0
  134. package/Runtime/C/PredictionStream.cs +36 -0
  135. package/Runtime/C/PredictionStream.cs.meta +11 -0
  136. package/Runtime/C/Predictor.cs +42 -0
  137. package/Runtime/C/Predictor.cs.meta +11 -0
  138. package/Runtime/C/Value.cs +194 -0
  139. package/Runtime/C/Value.cs.meta +11 -0
  140. package/Runtime/C/ValueMap.cs +50 -0
  141. package/Runtime/C/ValueMap.cs.meta +11 -0
  142. package/Runtime/C.meta +8 -0
  143. package/Runtime/Muna.Runtime.asmdef +27 -0
  144. package/Runtime/Muna.Runtime.asmdef.meta +7 -0
  145. package/Runtime/Muna.cs +109 -0
  146. package/Runtime/Muna.cs.meta +11 -0
  147. package/Runtime/Services/Prediction.cs +247 -0
  148. package/Runtime/Services/Prediction.cs.meta +11 -0
  149. package/Runtime/Services/Predictor.cs +44 -0
  150. package/Runtime/Services/Predictor.cs.meta +11 -0
  151. package/Runtime/Services/User.cs +43 -0
  152. package/Runtime/Services/User.cs.meta +11 -0
  153. package/Runtime/Services.meta +8 -0
  154. package/Runtime/Types/Dtype.cs +118 -0
  155. package/Runtime/Types/Dtype.cs.meta +11 -0
  156. package/Runtime/Types/Image.cs +93 -0
  157. package/Runtime/Types/Image.cs.meta +11 -0
  158. package/Runtime/Types/Prediction.cs +113 -0
  159. package/Runtime/Types/Prediction.cs.meta +11 -0
  160. package/Runtime/Types/Predictor.cs +193 -0
  161. package/Runtime/Types/Predictor.cs.meta +11 -0
  162. package/Runtime/Types/Tensor.cs +58 -0
  163. package/Runtime/Types/Tensor.cs.meta +11 -0
  164. package/Runtime/Types/User.cs +54 -0
  165. package/Runtime/Types/User.cs.meta +11 -0
  166. package/Runtime/Types.meta +8 -0
  167. package/Runtime.meta +8 -0
  168. package/Unity/API/PredictionCacheClient.cs +144 -0
  169. package/Unity/API/PredictionCacheClient.cs.meta +11 -0
  170. package/Unity/API/UnityClient.cs +147 -0
  171. package/Unity/API/UnityClient.cs.meta +11 -0
  172. package/Unity/API.meta +8 -0
  173. package/Unity/Internal/MunaSettings.cs +59 -0
  174. package/Unity/Internal/MunaSettings.cs.meta +11 -0
  175. package/Unity/Internal.meta +8 -0
  176. package/Unity/Muna.Unity.asmdef +29 -0
  177. package/Unity/Muna.Unity.asmdef.meta +7 -0
  178. package/Unity/MunaUnity.cs +130 -0
  179. package/Unity/MunaUnity.cs.meta +11 -0
  180. package/Unity/Types/CachedPrediction.cs +36 -0
  181. package/Unity/Types/CachedPrediction.cs.meta +11 -0
  182. package/Unity/Types.meta +8 -0
  183. package/Unity.meta +8 -0
  184. package/package.json +38 -0
  185. package/package.json.meta +7 -0
@@ -0,0 +1,63 @@
1
+ //
2
+ // FXNPredictionStream.h
3
+ // Function
4
+ //
5
+ // Created by Yusuf Olokoba on 4/19/2024.
6
+ // Copyright © 2025 NatML Inc. All rights reserved.
7
+ //
8
+
9
+ #pragma once
10
+
11
+ #include <Function/FXNPrediction.h>
12
+
13
+ #pragma region --Types--
14
+ /*!
15
+ @struct FXNPredictionStream
16
+
17
+ @abstract Prediction stream.
18
+
19
+ @discussion Prediction stream.
20
+ */
21
+ struct FXNPredictionStream;
22
+ typedef struct FXNPredictionStream FXNPredictionStream;
23
+ #pragma endregion
24
+
25
+
26
+ #pragma region --Lifecycle--
27
+ /*!
28
+ @function FXNPredictionStreamRelease
29
+
30
+ @abstract Release a prediction stream.
31
+
32
+ @discussion Release a prediction stream.
33
+
34
+ @param stream
35
+ Prediction stream.
36
+ */
37
+ FXN_API FXNStatus FXNPredictionStreamRelease (FXNPredictionStream* stream);
38
+ #pragma endregion
39
+
40
+
41
+ #pragma region --Operations--
42
+ /*!
43
+ @function FXNPredictionStreamReadNext
44
+
45
+ @abstract Read the next prediction in the stream.
46
+
47
+ @discussion Read the next prediction in the stream.
48
+
49
+ @param stream
50
+ Prediction stream.
51
+
52
+ @param prediction
53
+ Prediction.
54
+ You MUST release the prediction with `FXNPredictionRelease` when no longer needed.
55
+
56
+ @returns `FXN_OK` a prediction was successfully read from the stream.
57
+ `FXN_ERROR_INVALID_OPERATION` if the stream has no more predictions.
58
+ */
59
+ FXN_API FXNStatus FXNPredictionStreamReadNext (
60
+ FXNPredictionStream* stream,
61
+ FXNPrediction** prediction
62
+ );
63
+ #pragma endregion
@@ -0,0 +1,108 @@
1
+ //
2
+ // FXNPredictor.h
3
+ // Function
4
+ //
5
+ // Created by Yusuf Olokoba on 10/14/2023.
6
+ // Copyright © 2025 NatML Inc. All rights reserved.
7
+ //
8
+
9
+ #pragma once
10
+
11
+ #include <Function/FXNConfiguration.h>
12
+ #include <Function/FXNPrediction.h>
13
+ #include <Function/FXNPredictionStream.h>
14
+
15
+ #pragma region --Types--
16
+ /*!
17
+ @struct FXNPredictor
18
+
19
+ @abstract Predictor.
20
+
21
+ @discussion Predictor.
22
+ */
23
+ struct FXNPredictor;
24
+ typedef struct FXNPredictor FXNPredictor;
25
+ #pragma endregion
26
+
27
+
28
+ #pragma region --Lifecycle--
29
+ /*!
30
+ @function FXNPredictorCreate
31
+
32
+ @abstract Create a predictor.
33
+
34
+ @discussion Create a predictor.
35
+
36
+ @param configuration
37
+ Predictor configuration.
38
+
39
+ @param predictor
40
+ Created predictor.
41
+ */
42
+ FXN_API FXNStatus FXNPredictorCreate (
43
+ FXNConfiguration* configuration,
44
+ FXNPredictor** predictor
45
+ );
46
+
47
+ /*!
48
+ @function FXNPredictorRelease
49
+
50
+ @abstract Release a predictor.
51
+
52
+ @discussion Release a predictor.
53
+
54
+ @param predictor
55
+ Predictor.
56
+ */
57
+ FXN_API FXNStatus FXNPredictorRelease (FXNPredictor* predictor);
58
+ #pragma endregion
59
+
60
+
61
+ #pragma region --Operations--
62
+ /*!
63
+ @function FXNPredictorCreatePrediction
64
+
65
+ @abstract Create a prediction.
66
+
67
+ @discussion Create a prediction.
68
+
69
+ @param predictor
70
+ Predictor.
71
+
72
+ @param inputs
73
+ Prediction inputs.
74
+
75
+ @param prediction
76
+ Prediction.
77
+ You MUST release the prediction with `FXNPredictionRelease` when no longer needed.
78
+ */
79
+ FXN_API FXNStatus FXNPredictorCreatePrediction (
80
+ FXNPredictor* predictor,
81
+ FXNValueMap* inputs,
82
+ FXNPrediction** prediction
83
+ );
84
+
85
+ /*!
86
+ @function FXNPredictorStreamPrediction
87
+
88
+ @abstract Create a streaming prediction.
89
+
90
+ @discussion Create a streaming prediction.
91
+ NOTE: This API is currently experimental.
92
+
93
+ @param predictor
94
+ Predictor.
95
+
96
+ @param inputs
97
+ Prediction inputs.
98
+
99
+ @param prediction
100
+ Prediction stream.
101
+ You MUST release the prediction stream with `FXNPredictionStreamRelease` when no longer needed.
102
+ */
103
+ FXN_API FXNStatus FXNPredictorStreamPrediction (
104
+ FXNPredictor* predictor,
105
+ FXNValueMap* inputs,
106
+ FXNPredictionStream** stream
107
+ );
108
+ #pragma endregion
@@ -0,0 +1,42 @@
1
+ //
2
+ // FXNStatus.h
3
+ // Function
4
+ //
5
+ // Created by Yusuf Olokoba on 10/14/2023.
6
+ // Copyright © 2025 NatML Inc. All rights reserved.
7
+ //
8
+
9
+ #pragma once
10
+
11
+ #ifdef __cplusplus
12
+ #define FXN_API extern "C"
13
+ #else
14
+ #define FXN_API extern
15
+ #endif
16
+
17
+ #pragma region --Enumerations--
18
+ /*!
19
+ @enum FXNStatus
20
+
21
+ @abstract Function status codes.
22
+
23
+ @constant FXN_OK
24
+ Successful operation.
25
+
26
+ @constant FXN_ERROR_INVALID_ARGUMENT
27
+ Provided argument is invalid.
28
+
29
+ @constant FXN_ERROR_INVALID_OPERATION
30
+ Operation is invalid in current state.
31
+
32
+ @constant FXN_ERROR_NOT_IMPLEMENTED
33
+ Operation has not been implemented.
34
+ */
35
+ enum FXNStatus {
36
+ FXN_OK = 0,
37
+ FXN_ERROR_INVALID_ARGUMENT = 1,
38
+ FXN_ERROR_INVALID_OPERATION = 2,
39
+ FXN_ERROR_NOT_IMPLEMENTED = 3,
40
+ };
41
+ typedef enum FXNStatus FXNStatus;
42
+ #pragma endregion
@@ -0,0 +1,395 @@
1
+ //
2
+ // FXNValue.h
3
+ // Function
4
+ //
5
+ // Created by Yusuf Olokoba on 5/27/2023.
6
+ // Copyright © 2025 NatML Inc. All rights reserved.
7
+ //
8
+
9
+ #pragma once
10
+
11
+ #include <stdint.h>
12
+ #include <Function/FXNStatus.h>
13
+
14
+ #pragma region --Enumerations--
15
+ /*!
16
+ @enum FXNDtype
17
+
18
+ @abstract Value data type.
19
+
20
+ @constant FXN_DTYPE_NULL
21
+ Null or undefined.
22
+
23
+ @constant FXN_DTYPE_FLOAT16
24
+ IEEE 754 half precision 16-bit float.
25
+
26
+ @constant FXN_DTYPE_FLOAT32
27
+ IEEE 754 single precision 32-bit float.
28
+
29
+ @constant FXN_DTYPE_FLOAT64
30
+ IEEE 754 double precision 64-bit float.
31
+
32
+ @constant FXN_DTYPE_INT8
33
+ Signed 8-bit integer.
34
+
35
+ @constant FXN_DTYPE_INT16
36
+ Signed 16-bit integer.
37
+
38
+ @constant FXN_DTYPE_INT32
39
+ Signed 32-bit integer.
40
+
41
+ @constant FXN_DTYPE_INT64
42
+ Signed 64-bit integer.
43
+
44
+ @constant FXN_DTYPE_UINT8
45
+ Unsigned 8-bit integer.
46
+
47
+ @constant FXN_DTYPE_UINT16
48
+ Unsigned 16-bit integer.
49
+
50
+ @constant FXN_DTYPE_UINT32
51
+ Unsigned 32-bit integer.
52
+
53
+ @constant FXN_DTYPE_UINT64
54
+ Unsigned 64-bit integer.
55
+
56
+ @constant FXN_DTYPE_BOOL
57
+ 8-bit boolean where zero is `false` and non-zero is `true`.
58
+
59
+ @constant FXN_DTYPE_STRING
60
+ UTF-8 encoded string.
61
+
62
+ @constant FXN_DTYPE_LIST
63
+ JSON-serializable list.
64
+
65
+ @constant FXN_DTYPE_DICT
66
+ JSON-serializable dictionary.
67
+
68
+ @constant FXN_DTYPE_IMAGE
69
+ Pixel buffer with 8 bits per intensity, interleaved by channel.
70
+
71
+ @constant FXN_DTYPE_BINARY
72
+ Binary blob.
73
+
74
+ @constant FXN_DTYPE_BFLOAT16
75
+ 16-bit brain float.
76
+ */
77
+ enum FXNDtype {
78
+ FXN_DTYPE_NULL = 0,
79
+ FXN_DTYPE_FLOAT16 = 1,
80
+ FXN_DTYPE_FLOAT32 = 2,
81
+ FXN_DTYPE_FLOAT64 = 3,
82
+ FXN_DTYPE_INT8 = 4,
83
+ FXN_DTYPE_INT16 = 5,
84
+ FXN_DTYPE_INT32 = 6,
85
+ FXN_DTYPE_INT64 = 7,
86
+ FXN_DTYPE_UINT8 = 8,
87
+ FXN_DTYPE_UINT16 = 9,
88
+ FXN_DTYPE_UINT32 = 10,
89
+ FXN_DTYPE_UINT64 = 11,
90
+ FXN_DTYPE_BOOL = 12,
91
+ FXN_DTYPE_STRING = 13,
92
+ FXN_DTYPE_LIST = 14,
93
+ FXN_DTYPE_DICT = 15,
94
+ FXN_DTYPE_IMAGE = 16,
95
+ FXN_DTYPE_BINARY = 17,
96
+ FXN_DTYPE_BFLOAT16 = 18,
97
+ };
98
+ typedef enum FXNDtype FXNDtype;
99
+
100
+ /*!
101
+ @enum FXNValueFlags
102
+
103
+ @abstract Value flags.
104
+
105
+ @constant FXN_VALUE_FLAG_NONE
106
+ No flags.
107
+
108
+ @constant FXN_VALUE_FLAG_COPY_DATA
109
+ Copy input data when creating the value.
110
+ When this flag is not set, the value data MUST remain valid for the lifetime of the created value.
111
+ */
112
+ enum FXNValueFlags {
113
+ FXN_VALUE_FLAG_NONE = 0,
114
+ FXN_VALUE_FLAG_COPY_DATA = 1,
115
+ };
116
+ typedef enum FXNValueFlags FXNValueFlags;
117
+ #pragma endregion
118
+
119
+
120
+ #pragma region --Types--
121
+ /*!
122
+ @struct FXNValue
123
+
124
+ @abstract Prediction input or output value.
125
+
126
+ @discussion Prediction input or output value.
127
+ */
128
+ struct FXNValue;
129
+ typedef struct FXNValue FXNValue;
130
+ #pragma endregion
131
+
132
+
133
+ #pragma region --Lifecycle--
134
+ /*!
135
+ @function FXNValueRelease
136
+
137
+ @abstract Release a value.
138
+
139
+ @discussion Release a value.
140
+
141
+ @param value
142
+ Value.
143
+ */
144
+ FXN_API FXNStatus FXNValueRelease (FXNValue* value);
145
+ #pragma endregion
146
+
147
+
148
+ #pragma region --Operations--
149
+ /*!
150
+ @function FXNValueGetData
151
+
152
+ @abstract Get the value data.
153
+
154
+ @discussion Get the value data.
155
+
156
+ @param value
157
+ Value.
158
+
159
+ @param data
160
+ Opaque pointer to value data.
161
+ */
162
+ FXN_API FXNStatus FXNValueGetData (
163
+ FXNValue* value,
164
+ void** data
165
+ );
166
+
167
+ /*!
168
+ @function FXNValueGetType
169
+
170
+ @abstract Get the data type of a given value.
171
+
172
+ @discussion Get the data type of a given valuie.
173
+
174
+ @param value
175
+ Value.
176
+
177
+ @param type
178
+ Value data type.
179
+ */
180
+ FXN_API FXNStatus FXNValueGetType (
181
+ FXNValue* value,
182
+ FXNDtype* type
183
+ );
184
+
185
+ /*!
186
+ @function FXNValueGetDimensions
187
+
188
+ @abstract Get the number of dimensions for a given value.
189
+
190
+ @discussion Get the number of dimensions for a given value.
191
+ If the type is not a tensor, this function will return zero.
192
+
193
+ @param value
194
+ Value.
195
+
196
+ @param dimensions
197
+ Number of dimensions for a given value.
198
+ */
199
+ FXN_API FXNStatus FXNValueGetDimensions (
200
+ FXNValue* value,
201
+ int32_t* dimensions
202
+ );
203
+
204
+ /*!
205
+ @function FXNValueGetShape
206
+
207
+ @abstract Get the shape of a given value.
208
+
209
+ @discussion Get the shape of a given value.
210
+
211
+ @param value
212
+ Value.
213
+
214
+ @param shape
215
+ Destination shape array.
216
+
217
+ @param shapeLen
218
+ Length of the destination array in elements.
219
+ */
220
+ FXN_API FXNStatus FXNValueGetShape (
221
+ FXNValue* value,
222
+ int32_t* shape,
223
+ int32_t shapeLen
224
+ );
225
+ #pragma endregion
226
+
227
+
228
+ #pragma region --Constructors--
229
+ /*!
230
+ @function FXNValueCreateArray
231
+
232
+ @abstract Create an array value from a data buffer.
233
+
234
+ @discussion Create an array value from a data buffer.
235
+
236
+ @param data
237
+ Array data.
238
+ Can be `NULL` in which case the value will allocate its own memory.
239
+
240
+ @param shape
241
+ Array shape.
242
+ Can be `NULL` for scalar values.
243
+
244
+ @param dims
245
+ Number of dimensions in `shape`.
246
+ Zero dims indicates a scalar value.
247
+
248
+ @param dtype
249
+ Value data type.
250
+
251
+ @param flags
252
+ Value creation flags.
253
+
254
+ @param value
255
+ Created value.
256
+ */
257
+ FXN_API FXNStatus FXNValueCreateArray (
258
+ void* data,
259
+ const int32_t* shape,
260
+ int32_t dims,
261
+ FXNDtype dtype,
262
+ FXNValueFlags flags,
263
+ FXNValue** value
264
+ );
265
+
266
+ /*!
267
+ @function FXNValueCreateString
268
+
269
+ @abstract Create a string value from a UTF-8 encoded string.
270
+
271
+ @discussion Create a string value from a UTF-8 encoded string.
272
+
273
+ @param data
274
+ UTF-8 encoded string.
275
+
276
+ @param value
277
+ Created value.
278
+ */
279
+ FXN_API FXNStatus FXNValueCreateString (
280
+ const char* data,
281
+ FXNValue** value
282
+ );
283
+
284
+ /*!
285
+ @function FXNValueCreateList
286
+
287
+ @abstract Create a list value from a JSON-encoded list.
288
+
289
+ @discussion Create a list value from a JSON-encoded list.
290
+
291
+ @param data
292
+ JSON-encoded list.
293
+
294
+ @param value
295
+ Created value.
296
+ */
297
+ FXN_API FXNStatus FXNValueCreateList (
298
+ const char* data,
299
+ FXNValue** value
300
+ );
301
+
302
+ /*!
303
+ @function FXNValueCreateDict
304
+
305
+ @abstract Create a dictionary value from a JSON-encoded dictionary.
306
+
307
+ @discussion Create a dictionary value from a JSON-encoded dictionary.
308
+
309
+ @param data
310
+ JSON-encoded dictionary.
311
+
312
+ @param value
313
+ Created value.
314
+ */
315
+ FXN_API FXNStatus FXNValueCreateDict (
316
+ const char* data,
317
+ FXNValue** value
318
+ );
319
+
320
+ /*!
321
+ @function FXNValueCreateImage
322
+
323
+ @abstract Create an image value from a pixel buffer.
324
+
325
+ @discussion Create an image value from a pixel buffer.
326
+ The pixel buffer MUST have an interleaved R8 (8bpp), RGB888 (24bpp), or RGBA8888 layout (32bpp).
327
+
328
+ @param pixelBuffer
329
+ Pixel buffer.
330
+
331
+ @param width
332
+ Pixel buffer width.
333
+
334
+ @param height
335
+ Pixel buffer height.
336
+
337
+ @param channels
338
+ Pixel buffer channels.
339
+ MUST be 1, 3, or 4.
340
+
341
+ @param flags
342
+ Value creation flags.
343
+
344
+ @param value
345
+ Created value.
346
+ The value `type` will be `FXN_DTYPE_IMAGE`.
347
+ The value `shape` will be `(H,W,C)`.
348
+ */
349
+ FXN_API FXNStatus FXNValueCreateImage (
350
+ const uint8_t* pixelBuffer,
351
+ int32_t width,
352
+ int32_t height,
353
+ int32_t channels,
354
+ FXNValueFlags flags,
355
+ FXNValue** value
356
+ );
357
+
358
+ /*!
359
+ @function FXNValueCreateBinary
360
+
361
+ @abstract Create a binary value from a raw buffer.
362
+
363
+ @discussion Create a binary value from a raw buffer.
364
+
365
+ @param buffer
366
+ Buffer.
367
+
368
+ @param bufferLen
369
+ Buffer length in bytes.
370
+
371
+ @param flags
372
+ Value creation flags.
373
+
374
+ @param value
375
+ Created value.
376
+ */
377
+ FXN_API FXNStatus FXNValueCreateBinary (
378
+ void* buffer,
379
+ int32_t bufferLen, // CHECK // max buffer size becomes 2GB
380
+ FXNValueFlags flags,
381
+ FXNValue** value
382
+ );
383
+
384
+ /*!
385
+ @function FXNValueCreateNull
386
+
387
+ @abstract Create a null value.
388
+
389
+ @discussion Create a null value.
390
+
391
+ @param value
392
+ Created value.
393
+ */
394
+ FXN_API FXNStatus FXNValueCreateNull (FXNValue** value);
395
+ #pragma endregion