hyperdrone 0.1.0__py3-none-any.whl

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 (660) hide show
  1. hyperdrone/__init__.py +28 -0
  2. hyperdrone/_native/cmake/hyperdrone_jit.cmake +43 -0
  3. hyperdrone/_native/common/bindings.h +39 -0
  4. hyperdrone/_native/common/cuda_staging.h +68 -0
  5. hyperdrone/_native/common/jit_host.h +69 -0
  6. hyperdrone/_native/dynamics/CMakeLists.txt +66 -0
  7. hyperdrone/_native/dynamics/host.cpp +191 -0
  8. hyperdrone/_native/dynamics/iface.h +81 -0
  9. hyperdrone/_native/dynamics/impl.cpp +659 -0
  10. hyperdrone/_native/render/CMakeLists.txt +96 -0
  11. hyperdrone/_native/render/host.cpp +276 -0
  12. hyperdrone/_native/render/iface.h +132 -0
  13. hyperdrone/_native/render/impl.cpp +620 -0
  14. hyperdrone/_native/render/scene_bindings.cpp +279 -0
  15. hyperdrone/_vendor/rl-tools/CMakeLists.txt +159 -0
  16. hyperdrone/_vendor/rl-tools/LICENSE +21 -0
  17. hyperdrone/_vendor/rl-tools/cmake/autodetect/all.cmake +14 -0
  18. hyperdrone/_vendor/rl-tools/cmake/autodetect/git-diff.cmake +103 -0
  19. hyperdrone/_vendor/rl-tools/cmake/autodetect/git-hash.cmake +13 -0
  20. hyperdrone/_vendor/rl-tools/cmake/autodetect/tier1-blas.cmake +43 -0
  21. hyperdrone/_vendor/rl-tools/cmake/autodetect/tier2-json-hdf5-zlib.cmake +84 -0
  22. hyperdrone/_vendor/rl-tools/cmake/autodetect/tier3-tensorboard.cmake +29 -0
  23. hyperdrone/_vendor/rl-tools/cmake/autodetect/tier4-cuda.cmake +33 -0
  24. hyperdrone/_vendor/rl-tools/cmake/autodetect/tier5-cli11.cmake +26 -0
  25. hyperdrone/_vendor/rl-tools/cmake/optional/assimp_fixup.cmake +16 -0
  26. hyperdrone/_vendor/rl-tools/cmake/optional/googletest.cmake +17 -0
  27. hyperdrone/_vendor/rl-tools/cmake/optional/metal.cmake +27 -0
  28. hyperdrone/_vendor/rl-tools/cmake/optional/mujoco.cmake +32 -0
  29. hyperdrone/_vendor/rl-tools/cmake/optional/optix.cmake +17 -0
  30. hyperdrone/_vendor/rl-tools/cmake/optional/raytracing_generic.cmake +4 -0
  31. hyperdrone/_vendor/rl-tools/cmake/optional/vulkan.cmake +6 -0
  32. hyperdrone/_vendor/rl-tools/cmake/scripts/embed_text.cmake +7 -0
  33. hyperdrone/_vendor/rl-tools/cmake/scripts/generate-git-snapshot.cmake +138 -0
  34. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/matrix.h +143 -0
  35. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_arm.h +33 -0
  36. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu.h +314 -0
  37. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_accelerate.h +37 -0
  38. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_blas.h +67 -0
  39. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_mkl.h +38 -0
  40. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cpu_openblas.h +34 -0
  41. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_cuda.h +289 -0
  42. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_dummy.h +20 -0
  43. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_esp32.h +29 -0
  44. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_generic.h +946 -0
  45. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/operations_wasm32.h +13 -0
  46. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/matrix/persist_code.h +136 -0
  47. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_arm.h +1 -0
  48. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu.h +94 -0
  49. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_accelerate.h +25 -0
  50. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_blas.h +115 -0
  51. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_mkl.h +25 -0
  52. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cpu_openblas.h +25 -0
  53. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_cuda.h +703 -0
  54. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/operations_generic.h +1334 -0
  55. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/persist_code.h +130 -0
  56. hyperdrone/_vendor/rl-tools/include/rl_tools/containers/tensor/tensor.h +490 -0
  57. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/arm.h +91 -0
  58. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu.h +205 -0
  59. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_accelerate.h +23 -0
  60. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_blas.h +21 -0
  61. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_mkl.h +45 -0
  62. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_openblas.h +56 -0
  63. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cpu_tensorboard.h +34 -0
  64. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/cuda.h +411 -0
  65. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/devices.h +92 -0
  66. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/dummy.h +55 -0
  67. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/esp32.h +85 -0
  68. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/generic.h +0 -0
  69. hyperdrone/_vendor/rl-tools/include/rl_tools/devices/wasm32.h +59 -0
  70. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/model.h +218 -0
  71. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/operations_generic.h +771 -0
  72. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/persist.h +278 -0
  73. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter.h +100 -0
  74. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/policy_adapter_persist.h +52 -0
  75. hyperdrone/_vendor/rl-tools/include/rl_tools/dyn/tensor_operations_generic.h +55 -0
  76. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_backend.h +112 -0
  77. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/c_interface.h +36 -0
  78. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/l2f.h +98 -0
  79. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_dyn.h +18 -0
  80. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/applications/l2f/operations_generic.h +268 -0
  81. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_backend.h +31 -0
  82. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/debugging_pool/c_interface.h +12 -0
  83. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_backend.h +98 -0
  84. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/c_interface.h +50 -0
  85. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/executor.h +133 -0
  86. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/helper.h +109 -0
  87. hyperdrone/_vendor/rl-tools/include/rl_tools/inference/executor/operations_generic.h +219 -0
  88. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arduino.h +117 -0
  89. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_arm.h +56 -0
  90. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu.h +93 -0
  91. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cpu_tensorboard.h +151 -0
  92. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_cuda.h +65 -0
  93. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_dummy.h +45 -0
  94. hyperdrone/_vendor/rl-tools/include/rl_tools/logging/operations_wasm32.h +56 -0
  95. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_arm.h +98 -0
  96. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cpu.h +139 -0
  97. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_cuda.h +382 -0
  98. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_dummy.h +93 -0
  99. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_esp32.h +92 -0
  100. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_generic.h +297 -0
  101. hyperdrone/_vendor/rl-tools/include/rl_tools/math/operations_wasm32.h +225 -0
  102. hyperdrone/_vendor/rl-tools/include/rl_tools/mode/mode.h +75 -0
  103. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/activation_functions.h +115 -0
  104. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/capability.h +63 -0
  105. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/capability/persist_code.h +27 -0
  106. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/layer.h +122 -0
  107. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_cuda.h +64 -0
  108. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/operations_generic.h +184 -0
  109. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/avg_pool2d/persist.h +33 -0
  110. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/layer.h +300 -0
  111. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cpu_mkl.h +590 -0
  112. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_cuda.h +739 -0
  113. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/operations_generic.h +1185 -0
  114. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist.h +99 -0
  115. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/conv2d/persist_code.h +170 -0
  116. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/layer.h +145 -0
  117. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/dsp.h +63 -0
  118. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_arm/opt.h +173 -0
  119. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu.h +13 -0
  120. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_accelerate.h +66 -0
  121. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_blas.h +282 -0
  122. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_mkl.h +66 -0
  123. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cpu_openblas.h +65 -0
  124. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_cuda.h +519 -0
  125. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_dummy.h +8 -0
  126. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/dsp.h +58 -0
  127. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_esp32/opt.h +167 -0
  128. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/operations_generic.h +421 -0
  129. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist.h +62 -0
  130. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_code.h +178 -0
  131. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dense/persist_common.h +55 -0
  132. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/layer.h +188 -0
  133. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_cuda.h +356 -0
  134. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/operations_generic.h +534 -0
  135. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/dynamic_conv2d/persist.h +32 -0
  136. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/layer.h +119 -0
  137. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/operations_generic.h +217 -0
  138. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/embedding/persist.h +46 -0
  139. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/layer.h +121 -0
  140. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/operations_generic.h +152 -0
  141. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist.h +44 -0
  142. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/flatten/persist_code.h +106 -0
  143. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_cuda.h +375 -0
  144. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/helper_operations_generic.h +158 -0
  145. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/layer.h +218 -0
  146. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/operations_generic.h +947 -0
  147. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist.h +75 -0
  148. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/gru/persist_code.h +199 -0
  149. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/layers.h +3 -0
  150. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/layer.h +143 -0
  151. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_cuda.h +80 -0
  152. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/operations_generic.h +214 -0
  153. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/max_pool2d/persist.h +39 -0
  154. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu.h +1 -0
  155. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_accelerate.h +1 -0
  156. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_blas.h +1 -0
  157. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_mkl.h +3 -0
  158. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cpu_openblas.h +1 -0
  159. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_cuda.h +9 -0
  160. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_dummy.h +1 -0
  161. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/operations_generic.h +3 -0
  162. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/layer.h +223 -0
  163. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_cuda.h +138 -0
  164. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/operations_generic.h +428 -0
  165. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/resnet_block/persist.h +70 -0
  166. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/layer.h +154 -0
  167. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_cuda.h +119 -0
  168. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/operations_generic.h +494 -0
  169. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist.h +50 -0
  170. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/sample_and_squash/persist_code.h +173 -0
  171. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/layer.h +116 -0
  172. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_cuda.h +156 -0
  173. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/operations_generic.h +291 -0
  174. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist.h +83 -0
  175. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/standardize/persist_code.h +163 -0
  176. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/layer.h +123 -0
  177. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/operations_generic.h +268 -0
  178. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist.h +17 -0
  179. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/td3_sampling/persist_code.h +164 -0
  180. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/layer.h +122 -0
  181. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_cuda.h +55 -0
  182. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/operations_generic.h +158 -0
  183. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist.h +47 -0
  184. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/unflatten/persist_code.h +106 -0
  185. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/layer.h +132 -0
  186. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_cuda.h +141 -0
  187. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/layers/upsample2d/operations_generic.h +228 -0
  188. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/categorical_cross_entropy/operations_generic.h +102 -0
  189. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_cuda.h +97 -0
  190. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/mse/operations_generic.h +101 -0
  191. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/loss_functions/operations_generic.h +2 -0
  192. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/nn.h +16 -0
  193. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu.h +1 -0
  194. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_accelerate.h +1 -0
  195. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_blas.h +1 -0
  196. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mkl.h +1 -0
  197. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_mux.h +16 -0
  198. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cpu_openblas.h +1 -0
  199. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_cuda.h +2 -0
  200. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_dummy.h +1 -0
  201. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/operations_generic.h +17 -0
  202. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/adam.h +120 -0
  203. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_cuda.h +90 -0
  204. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/operations_generic.h +144 -0
  205. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist.h +39 -0
  206. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/instance/persist_code.h +79 -0
  207. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_cuda.h +72 -0
  208. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/operations_generic.h +102 -0
  209. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/adam/persist.h +25 -0
  210. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/instance/operations_generic.h +101 -0
  211. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/lamb.h +40 -0
  212. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/lamb/operations_generic.h +61 -0
  213. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/optimizers.h +3 -0
  214. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_cuda.h +77 -0
  215. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/operations_generic.h +134 -0
  216. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist.h +37 -0
  217. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/instance/persist_code.h +71 -0
  218. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_cuda.h +40 -0
  219. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/operations_generic.h +43 -0
  220. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/optimizers/sgd/sgd.h +91 -0
  221. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_cuda.h +0 -0
  222. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/operations_generic.h +90 -0
  223. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/parameters.h +78 -0
  224. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist.h +34 -0
  225. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/parameters/persist_code.h +133 -0
  226. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist.h +2 -0
  227. hyperdrone/_vendor/rl-tools/include/rl_tools/nn/persist_code.h +27 -0
  228. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/network.h +174 -0
  229. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_cuda.h +10 -0
  230. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_dummy.h +8 -0
  231. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/operations_generic.h +381 -0
  232. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist.h +56 -0
  233. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp/persist_code.h +137 -0
  234. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/network.h +45 -0
  235. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/operations_generic.h +76 -0
  236. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist.h +43 -0
  237. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/mlp_unconditional_stddev/persist_code.h +135 -0
  238. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/models.h +3 -0
  239. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/model.h +148 -0
  240. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/operations_generic.h +280 -0
  241. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist.h +25 -0
  242. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/multi_agent_wrapper/persist_code.h +71 -0
  243. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cpu.h +0 -0
  244. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_cuda.h +1 -0
  245. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_dummy.h +1 -0
  246. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/operations_generic.h +6 -0
  247. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/model.h +276 -0
  248. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_cuda.h +165 -0
  249. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/operations_generic.h +571 -0
  250. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist.h +80 -0
  251. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/parallel/persist_code.h +196 -0
  252. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist.h +1 -0
  253. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/persist_code.h +1 -0
  254. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/model.h +43 -0
  255. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/random_uniform/operations_generic.h +73 -0
  256. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/resnet/resnet.h +97 -0
  257. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/model.h +256 -0
  258. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/operations_generic.h +564 -0
  259. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist.h +99 -0
  260. hyperdrone/_vendor/rl-tools/include/rl_tools/nn_models/sequential/persist_code.h +107 -0
  261. hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/bf16.h +28 -0
  262. hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/categories.h +22 -0
  263. hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/persist_code.h +54 -0
  264. hyperdrone/_vendor/rl-tools/include/rl_tools/numeric_types/policy.h +48 -0
  265. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_1.h +18 -0
  266. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_2.h +14 -0
  267. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm/group_3.h +14 -0
  268. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/arm.h +19 -0
  269. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_1.h +16 -0
  270. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_2.h +12 -0
  271. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu/group_3.h +15 -0
  272. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu.h +19 -0
  273. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_1.h +16 -0
  274. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_2.h +12 -0
  275. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate/group_3.h +15 -0
  276. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_accelerate.h +19 -0
  277. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_1.h +17 -0
  278. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_2.h +12 -0
  279. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl/group_3.h +15 -0
  280. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mkl.h +18 -0
  281. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_mux.h +148 -0
  282. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_1.h +16 -0
  283. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_2.h +12 -0
  284. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas/group_3.h +15 -0
  285. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_openblas.h +18 -0
  286. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_1.h +16 -0
  287. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_2.h +12 -0
  288. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard/group_3.h +15 -0
  289. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cpu_tensorboard.h +19 -0
  290. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_1.h +18 -0
  291. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_2.h +12 -0
  292. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda/group_3.h +12 -0
  293. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/cuda.h +19 -0
  294. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_1.h +15 -0
  295. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_2.h +12 -0
  296. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy/group_3.h +12 -0
  297. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/dummy.h +19 -0
  298. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_1.h +16 -0
  299. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_2.h +12 -0
  300. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32/group_3.h +13 -0
  301. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/esp32.h +19 -0
  302. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_1.h +15 -0
  303. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_2.h +12 -0
  304. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32/group_3.h +12 -0
  305. hyperdrone/_vendor/rl-tools/include/rl_tools/operations/wasm32.h +19 -0
  306. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/hdf5.h +54 -0
  307. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/hdf5/operations_cpu.h +419 -0
  308. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/io.h +55 -0
  309. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_cpu.h +58 -0
  310. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_generic.h +620 -0
  311. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/operations_posix.h +63 -0
  312. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/backends/tar/tar.h +74 -0
  313. hyperdrone/_vendor/rl-tools/include/rl_tools/persist/code.h +38 -0
  314. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_arm.h +39 -0
  315. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cpu.h +61 -0
  316. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_cuda.h +164 -0
  317. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_dummy.h +72 -0
  318. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_esp32.h +45 -0
  319. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic.h +133 -0
  320. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_generic_array.h +64 -0
  321. hyperdrone/_vendor/rl-tools/include/rl_tools/random/operations_wasm32.h +57 -0
  322. hyperdrone/_vendor/rl-tools/include/rl_tools/random/persist.h +77 -0
  323. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/README.md +149 -0
  324. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_cpu.h +768 -0
  325. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/generic/operations_generic.h +1173 -0
  326. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/context.h +177 -0
  327. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/device_source.h +17 -0
  328. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/metal/operations_cpu.h +1122 -0
  329. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device.h +212 -0
  330. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/device_impl.h +934 -0
  331. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/operations_cuda.h +1678 -0
  332. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/optix/overlay_accel.h +57 -0
  333. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/context.h +220 -0
  334. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/device_source.h +40 -0
  335. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/backends/vulkan/operations_cpu.h +1967 -0
  336. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_common.h +1986 -0
  337. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/operations_cpu_mux.h +19 -0
  338. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/renderer.h +376 -0
  339. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene/procthor/operations_cpu.h +226 -0
  340. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene/procthor/scene.h +25 -0
  341. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene/scene.h +31 -0
  342. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/scene.h +107 -0
  343. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/transforms_generic.h +159 -0
  344. hyperdrone/_vendor/rl-tools/include/rl_tools/rendering/raytracing/types.h +39 -0
  345. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/algorithms.h +6 -0
  346. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu.h +1 -0
  347. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_cpu_mkl.h +1 -0
  348. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/operations_generic.h +1 -0
  349. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/config.h +240 -0
  350. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_cuda.h +62 -0
  351. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/operations_generic.h +245 -0
  352. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/persist.h +102 -0
  353. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/loop/core/state.h +52 -0
  354. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_cuda.h +193 -0
  355. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic.h +334 -0
  356. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/operations_generic_extensions.h +244 -0
  357. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/persist.h +28 -0
  358. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/ppo/ppo.h +105 -0
  359. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_gru.h +84 -0
  360. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/approximators_mlp.h +61 -0
  361. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/config.h +106 -0
  362. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/operations_generic.h +193 -0
  363. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/loop/core/state.h +52 -0
  364. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu.h +9 -0
  365. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_accelerate.h +2 -0
  366. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mkl.h +2 -0
  367. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cpu_mux.h +9 -0
  368. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_cuda.h +131 -0
  369. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/operations_generic.h +580 -0
  370. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/sac/sac.h +151 -0
  371. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_gru.h +72 -0
  372. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/approximators_mlp.h +54 -0
  373. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/config.h +107 -0
  374. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/operations_generic.h +172 -0
  375. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/loop/core/state.h +46 -0
  376. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu.h +9 -0
  377. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_accelerate.h +2 -0
  378. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mkl.h +2 -0
  379. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cpu_mux.h +9 -0
  380. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_cuda.h +111 -0
  381. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/operations_generic.h +359 -0
  382. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/algorithms/td3/td3.h +141 -0
  383. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/components.h +4 -0
  384. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/off_policy_runner.h +225 -0
  385. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu.h +95 -0
  386. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_accelerate.h +21 -0
  387. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cpu_mkl.h +21 -0
  388. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_cuda.h +237 -0
  389. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic.h +498 -0
  390. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/off_policy_runner/operations_generic_per_env.h +112 -0
  391. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/on_policy_runner.h +106 -0
  392. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu.h +16 -0
  393. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_accelerate.h +28 -0
  394. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cpu_mkl.h +15 -0
  395. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_cuda.h +195 -0
  396. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic.h +197 -0
  397. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic_extensions.h +98 -0
  398. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/operations_generic_per_env.h +91 -0
  399. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/on_policy_runner/persist.h +61 -0
  400. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu.h +2 -0
  401. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_accelerate.h +1 -0
  402. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_cpu_mkl.h +1 -0
  403. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/operations_generic.h +2 -0
  404. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_cpu.h +9 -0
  405. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/operations_generic.h +123 -0
  406. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/persist.h +57 -0
  407. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/replay_buffer/replay_buffer.h +93 -0
  408. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/operations_generic.h +76 -0
  409. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/persist.h +31 -0
  410. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/components/running_normalizer/running_normalizer.h +33 -0
  411. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/operations_generic.h +58 -0
  412. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/operations_generic.h +28 -0
  413. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/scale_observations/wrapper.h +26 -0
  414. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environment_wrappers/wrappers.h +29 -0
  415. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/acrobot.h +88 -0
  416. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_cpu.h +152 -0
  417. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/acrobot/operations_generic.h +202 -0
  418. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/car.h +119 -0
  419. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_cpu.h +110 -0
  420. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_generic.h +206 -0
  421. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/operations_json.h +59 -0
  422. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/track.h +23 -0
  423. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/car/ui.h +189 -0
  424. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/environments.h +28 -0
  425. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/environment.h +87 -0
  426. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_cpu.h +212 -0
  427. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/flag/operations_generic.h +215 -0
  428. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/metrics.h +266 -0
  429. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/multirotor.h +1083 -0
  430. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_cpu.h +2119 -0
  431. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_cuda.h +38 -0
  432. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/05_state_is_nan.h +126 -0
  433. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/10_sample_initial_parameters.h +228 -0
  434. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/20_initial_state.h +189 -0
  435. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/30_sample_initial_state.h +276 -0
  436. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/35_get_desired_state.h +63 -0
  437. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/40_observe.h +625 -0
  438. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/50_state_algebra.h +57 -0
  439. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/60_dynamics.h +134 -0
  440. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/70_post_integration.h +329 -0
  441. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic/80_abs_diff.h +290 -0
  442. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_generic.h +369 -0
  443. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_helper_generic.h +45 -0
  444. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic.h +72 -0
  445. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/operations_multitask_generic_forward.h +26 -0
  446. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/default.h +202 -0
  447. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/arpl.h +112 -0
  448. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie.h +127 -0
  449. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/crazyflie_openmv.h +119 -0
  450. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/flightmare.h +111 -0
  451. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/fs.h +113 -0
  452. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/mrs.h +110 -0
  453. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft.h +117 -0
  454. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/soft_rigid.h +118 -0
  455. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_real.h +88 -0
  456. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/dynamics/x500_sim.h +114 -0
  457. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/init/default.h +56 -0
  458. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/registry.h +90 -0
  459. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/default.h +64 -0
  460. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/reward_functions.h +1 -0
  461. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/operations_generic.h +202 -0
  462. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/reward_functions/squared/squared.h +52 -0
  463. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/termination/default.h +33 -0
  464. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/lissajous.h +72 -0
  465. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/parameters/trajectories/trajectory.h +78 -0
  466. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/persist_code.h +53 -0
  467. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/quaternion_helper.h +94 -0
  468. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f/ui.h +180 -0
  469. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/multirotor_visual.h +135 -0
  470. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/operations_cpu.h +244 -0
  471. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/operations_cuda.h +180 -0
  472. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/l2f_visual/operations_generic.h +149 -0
  473. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/environment.h +69 -0
  474. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_cpu.h +46 -0
  475. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/memory/operations_generic.h +78 -0
  476. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/README.MD +5 -0
  477. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ant.h +77 -0
  478. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/model.h +415 -0
  479. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/operations_cpu.h +160 -0
  480. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/ant/ui.h +141 -0
  481. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/mujoco/mujoco.h +1 -0
  482. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/bottleneck.h +113 -0
  483. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_cpu.h +289 -0
  484. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/bottleneck/operations_generic.h +495 -0
  485. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/multi_agent/environments.h +16 -0
  486. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/observation.h +37 -0
  487. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_cpu.h +2 -0
  488. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/operations_generic.h +33 -0
  489. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_cpu.h +146 -0
  490. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/operations_generic.h +262 -0
  491. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/pendulum.h +197 -0
  492. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui.h +97 -0
  493. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/pendulum/ui_xeus.h +124 -0
  494. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_cpu.h +426 -0
  495. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/operations_generic.h +424 -0
  496. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/environments/reacher/reacher.h +137 -0
  497. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/loop.h +15 -0
  498. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/config.h +28 -0
  499. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/operations_cpu.h +233 -0
  500. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/persist.h +30 -0
  501. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/checkpoint/state.h +21 -0
  502. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/config.h +25 -0
  503. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/operations_generic.h +47 -0
  504. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/persist.h +20 -0
  505. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/curriculum/state.h +17 -0
  506. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/config.h +47 -0
  507. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/operations_generic.h +106 -0
  508. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/persist.h +40 -0
  509. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/evaluation/state.h +36 -0
  510. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/config.h +22 -0
  511. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/operations_cpu.h +44 -0
  512. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/persist.h +20 -0
  513. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/extrack/state.h +26 -0
  514. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/config.h +37 -0
  515. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/operations_cpu.h +113 -0
  516. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/persist.h +20 -0
  517. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/nn_analytics/state.h +24 -0
  518. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/config.h +43 -0
  519. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/operations_cpu.h +190 -0
  520. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/persist.h +30 -0
  521. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/save_trajectories/state.h +37 -0
  522. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/steps.h +4 -0
  523. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/config.h +27 -0
  524. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/operations_cpu.h +52 -0
  525. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/persist.h +20 -0
  526. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/loop/steps/timing/state.h +25 -0
  527. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/operations_generic.h +3 -0
  528. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/rl.h +5 -0
  529. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/evaluation.h +106 -0
  530. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_cpu.h +48 -0
  531. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/evaluation/operations_generic.h +275 -0
  532. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation.h +269 -0
  533. hyperdrone/_vendor/rl-tools/include/rl_tools/rl/utils/validation_analysis.h +85 -0
  534. hyperdrone/_vendor/rl-tools/include/rl_tools/rl_tools.h +37 -0
  535. hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/client.h +50 -0
  536. hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_boost.h +92 -0
  537. hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_cpu.h +174 -0
  538. hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/client/operations_websocket.h +208 -0
  539. hyperdrone/_vendor/rl-tools/include/rl_tools/ui_server/server.h +448 -0
  540. hyperdrone/_vendor/rl-tools/include/rl_tools/universe.h +4 -0
  541. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/declarations_cpu.h +13 -0
  542. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_arm.h +25 -0
  543. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cpu.h +21 -0
  544. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_cuda.h +25 -0
  545. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_dummy.h +18 -0
  546. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_esp32.h +20 -0
  547. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_generic.h +19 -0
  548. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/assert/operations_wasm32.h +18 -0
  549. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_cpu.h +16 -0
  550. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/env/operations_generic.h +14 -0
  551. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/extrack.h +129 -0
  552. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/extrack/operations_cpu.h +588 -0
  553. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/integrators.h +105 -0
  554. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/memcpy.h +16 -0
  555. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/operations_generic.h +48 -0
  556. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/tuple/tuple.h +149 -0
  557. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/typing.h +118 -0
  558. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/generic/vector_operations.h +174 -0
  559. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_cuda.h +53 -0
  560. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/polyak/operations_generic.h +93 -0
  561. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/string/operations_generic.h +201 -0
  562. hyperdrone/_vendor/rl-tools/include/rl_tools/utils/zlib/operations_cpu.h +45 -0
  563. hyperdrone/_vendor/rl-tools/include/rl_tools/version.h +28 -0
  564. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/CMakeLists.txt +15 -0
  565. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/CMakeLists.txt +9 -0
  566. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/CMakeLists.txt +17 -0
  567. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/generic/freestanding_check.cpp +113 -0
  568. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/CMakeLists.txt +31 -0
  569. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/device.metal +815 -0
  570. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/metal/metal_cpp_impl.cpp +6 -0
  571. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/CMakeLists.txt +51 -0
  572. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/device.cu +1 -0
  573. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/optix/overlay_accel.cu +275 -0
  574. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/CMakeLists.txt +37 -0
  575. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device.comp +865 -0
  576. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/backends/vulkan/device_spirv.cpp +34 -0
  577. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/CMakeLists.txt +205 -0
  578. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/README.md +281 -0
  579. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark.cpp +175 -0
  580. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/benchmark_dynamic.cpp +494 -0
  581. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix.cpp +1629 -0
  582. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics.cu +523 -0
  583. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/benchmark/simulator_matrix_physics.h +37 -0
  584. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/CMakeLists.txt +164 -0
  585. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/antialiasing.cpp +213 -0
  586. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone.cpp +367 -0
  587. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/drone_device.cu +385 -0
  588. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/environment.h +85 -0
  589. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/environment/operations_cpu.h +270 -0
  590. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/example.cpp +276 -0
  591. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/fixed_pose.cpp +218 -0
  592. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/interactive.cpp +866 -0
  593. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/make_drone_glb.py +172 -0
  594. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/motion_blur.cpp +232 -0
  595. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace.cpp +1833 -0
  596. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/example/render_pose_trace_motion_blur.cpp +646 -0
  597. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/CMakeLists.txt +147 -0
  598. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/README.md +15 -0
  599. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/job.sbatch +28 -0
  600. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model.h +260 -0
  601. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_config.h +24 -0
  602. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_forward_cuda.h +397 -0
  603. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_operations.h +418 -0
  604. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_persist.h +45 -0
  605. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/model_student.h +70 -0
  606. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.cpp +221 -0
  607. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/scene.h +68 -0
  608. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.build-check/inference_ios.o +0 -0
  609. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.build-check/libinference_ios.a +0 -0
  610. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/.gitignore +4 -0
  611. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/CMakeLists.txt +4 -0
  612. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info.plist +24 -0
  613. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Info_ios.plist +36 -0
  614. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/CameraManager.swift +120 -0
  615. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/ContentView.swift +703 -0
  616. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/DatasetRecorder.swift +285 -0
  617. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/Sources/YawPredictorApp.swift +25 -0
  618. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/YawPredictor.entitlements +8 -0
  619. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build.sh +66 -0
  620. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/build_ios.sh +133 -0
  621. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/generate.sh +6 -0
  622. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/h5_to_tar.cpp +82 -0
  623. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.cpp +166 -0
  624. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/inference.h +26 -0
  625. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/project.yml +30 -0
  626. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/swift_app/test_tar_vs_hdf5.cpp +173 -0
  627. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_cuda.cu +699 -0
  628. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_dataset_overlay.cpp +475 -0
  629. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_distill_cuda.cu +995 -0
  630. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_eval.cu +456 -0
  631. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_real_world_eval.cpp +660 -0
  632. hyperdrone/_vendor/rl-tools/src/rendering/raytracing/yaw_prediction/yaw_prediction_viewer.cu +445 -0
  633. hyperdrone/cuda/__init__.py +78 -0
  634. hyperdrone/dynamics/__init__.py +22 -0
  635. hyperdrone/dynamics/_component.py +40 -0
  636. hyperdrone/dynamics/_config.py +47 -0
  637. hyperdrone/dynamics/_sim.py +201 -0
  638. hyperdrone/env/__init__.py +15 -0
  639. hyperdrone/env/_sampling.py +67 -0
  640. hyperdrone/env/_world.py +60 -0
  641. hyperdrone/examples/__init__.py +11 -0
  642. hyperdrone/examples/benchmark.py +236 -0
  643. hyperdrone/examples/benchmark_minimal.py +66 -0
  644. hyperdrone/examples/data.py +42 -0
  645. hyperdrone/examples/drone_flythrough.py +142 -0
  646. hyperdrone/examples/render_procthor.py +41 -0
  647. hyperdrone/jit/__init__.py +111 -0
  648. hyperdrone/jit/_build.py +94 -0
  649. hyperdrone/jit/_lock.py +23 -0
  650. hyperdrone/jit/_patches.py +95 -0
  651. hyperdrone/jit/_toolchain.py +13 -0
  652. hyperdrone/jit/_workspace.py +70 -0
  653. hyperdrone/render/__init__.py +48 -0
  654. hyperdrone/render/_component.py +35 -0
  655. hyperdrone/render/_config.py +90 -0
  656. hyperdrone/render/_renderer.py +306 -0
  657. hyperdrone/render/_scene.py +34 -0
  658. hyperdrone-0.1.0.dist-info/METADATA +15 -0
  659. hyperdrone-0.1.0.dist-info/RECORD +660 -0
  660. hyperdrone-0.1.0.dist-info/WHEEL +4 -0
@@ -0,0 +1,771 @@
1
+ #include "../version.h"
2
+ #if (defined(RL_TOOLS_DISABLE_INCLUDE_GUARDS) || !defined(RL_TOOLS_DYN_OPERATIONS_GENERIC_H)) && (RL_TOOLS_USE_THIS_VERSION == 1)
3
+ #pragma once
4
+ #define RL_TOOLS_DYN_OPERATIONS_GENERIC_H
5
+
6
+ #include "tensor_operations_generic.h"
7
+
8
+ #ifndef RL_TOOLS_FUNCTION_PLACEMENT
9
+ #define RL_TOOLS_FUNCTION_PLACEMENT
10
+ #endif
11
+
12
+ RL_TOOLS_NAMESPACE_WRAPPER_START
13
+ namespace rl_tools{
14
+ namespace dyn{
15
+
16
+ // --- Activation ---
17
+ template <typename MATH_DEVICE>
18
+ RL_TOOLS_FUNCTION_PLACEMENT inline float apply_activation(MATH_DEVICE& math_dev, ActivationFunction af, float x){
19
+ switch(af){
20
+ case ActivationFunction::IDENTITY: return x;
21
+ case ActivationFunction::RELU: return math::max(math_dev, x, 0.0f);
22
+ case ActivationFunction::GELU: { float a = math::FRAC_2_SQRTPI<float> * math::SQRT1_2<float> * 0.5f; return 0.5f * (x + x * math::tanh(math_dev, a * (0.044715f * x * x * x + x))); }
23
+ case ActivationFunction::TANH: return math::tanh(math_dev, x);
24
+ case ActivationFunction::FAST_TANH: return math::fast_tanh(math_dev, x);
25
+ case ActivationFunction::SIGMOID: return 1.0f / (1.0f + math::exp(math_dev, -x));
26
+ default: return x;
27
+ }
28
+ }
29
+
30
+ template <typename TI>
31
+ RL_TOOLS_FUNCTION_PLACEMENT TI infer_flat_input_dim(const Layer<TI>& layer){
32
+ switch(layer.type){
33
+ case LayerType::DENSE: return layer.template as<const layers::Dense<TI>>().input_dim;
34
+ case LayerType::STANDARDIZE: return layer.template as<const layers::Standardize<TI>>().dim;
35
+ case LayerType::SEQUENTIAL: case LayerType::MLP:
36
+ for(TI i = 0; i < layer.num_children; i++){
37
+ TI dim = infer_flat_input_dim(layer.children[i]);
38
+ if(dim > 0) return dim;
39
+ }
40
+ return 0;
41
+ default: return 0;
42
+ }
43
+ }
44
+
45
+ template <typename TI>
46
+ RL_TOOLS_FUNCTION_PLACEMENT TI product(const TI* shape, TI rank){
47
+ TI s = 1;
48
+ for(TI i = 0; i < rank; i++) s *= shape[i];
49
+ return s;
50
+ }
51
+
52
+ // --- Shape propagation ---
53
+ template <typename TI>
54
+ RL_TOOLS_FUNCTION_PLACEMENT void compute_leaf_output_shape(Layer<TI>& layer, const TI* in_shape, TI in_rank){
55
+ TI in_size = product(in_shape, in_rank);
56
+ auto replace_last_dim = [&](TI new_dim){
57
+ layer.output_rank = in_rank; layer.output_size = 1;
58
+ for(TI i = 0; i < in_rank - 1; i++){ layer.output_shape[i] = in_shape[i]; layer.output_size *= in_shape[i]; }
59
+ layer.output_shape[in_rank - 1] = new_dim; layer.output_size *= new_dim;
60
+ };
61
+ // Mirror real nn_models shape propagation: preserve all leading batch/time
62
+ // dims, only transform the last 3 (HWC for Conv/Pool) or the last N dims.
63
+ auto replace_last_three = [&](TI new_h, TI new_w, TI new_c){
64
+ layer.output_rank = in_rank;
65
+ for(TI i = 0; i < in_rank - 3; i++) layer.output_shape[i] = in_shape[i];
66
+ layer.output_shape[in_rank - 3] = new_h;
67
+ layer.output_shape[in_rank - 2] = new_w;
68
+ layer.output_shape[in_rank - 1] = new_c;
69
+ TI leading = 1; for(TI i = 0; i < in_rank - 3; i++) leading *= in_shape[i];
70
+ layer.output_size = leading * new_h * new_w * new_c;
71
+ };
72
+ auto collapse_last_three_to_one = [&](TI flat_dim){
73
+ layer.output_rank = in_rank - 2;
74
+ for(TI i = 0; i < in_rank - 3; i++) layer.output_shape[i] = in_shape[i];
75
+ layer.output_shape[in_rank - 3] = flat_dim;
76
+ TI leading = 1; for(TI i = 0; i < in_rank - 3; i++) leading *= in_shape[i];
77
+ layer.output_size = leading * flat_dim;
78
+ };
79
+ auto insert_last_three = [&](TI h, TI w, TI c){
80
+ layer.output_rank = in_rank + 2;
81
+ for(TI i = 0; i < in_rank - 1; i++) layer.output_shape[i] = in_shape[i];
82
+ layer.output_shape[in_rank - 1] = h;
83
+ layer.output_shape[in_rank] = w;
84
+ layer.output_shape[in_rank + 1] = c;
85
+ layer.output_size = in_size;
86
+ };
87
+ switch(layer.type){
88
+ case LayerType::DENSE: replace_last_dim(layer.template as<layers::Dense<TI>>().output_dim); break;
89
+ case LayerType::GRU: replace_last_dim(layer.template as<layers::GRU<TI>>().hidden_dim); break;
90
+ case LayerType::CONV2D: {
91
+ if(in_rank < 3){ layer.output_size = 0; break; }
92
+ auto& c = layer.template as<layers::Conv2d<TI>>();
93
+ TI ih = in_shape[in_rank-3], iw = in_shape[in_rank-2];
94
+ TI oh = (ih+2*c.padding_h-c.kernel_height)/c.stride_h+1;
95
+ TI ow = (iw+2*c.padding_w-c.kernel_width)/c.stride_w+1;
96
+ replace_last_three(oh, ow, c.output_channels);
97
+ break;
98
+ }
99
+ case LayerType::MAX_POOL2D: {
100
+ if(in_rank < 3){ layer.output_size = 0; break; }
101
+ auto& mp = layer.template as<layers::MaxPool2d<TI>>();
102
+ TI ih = in_shape[in_rank-3], iw = in_shape[in_rank-2], ch = in_shape[in_rank-1];
103
+ TI oh = (ih+2*mp.padding_h-mp.kernel_height)/mp.stride_h+1;
104
+ TI ow = (iw+2*mp.padding_w-mp.kernel_width)/mp.stride_w+1;
105
+ replace_last_three(oh, ow, ch);
106
+ break;
107
+ }
108
+ case LayerType::AVG_POOL2D: {
109
+ if(in_rank < 3){ layer.output_size = 0; break; }
110
+ TI ch = in_shape[in_rank-1];
111
+ // Global avg pool collapses H,W → one value per channel; preserve leading dims, last dim becomes C.
112
+ layer.output_rank = in_rank - 2;
113
+ for(TI i = 0; i < in_rank - 3; i++) layer.output_shape[i] = in_shape[i];
114
+ layer.output_shape[in_rank - 3] = ch;
115
+ TI leading = 1; for(TI i = 0; i < in_rank - 3; i++) leading *= in_shape[i];
116
+ layer.output_size = leading * ch;
117
+ break;
118
+ }
119
+ case LayerType::FLATTEN: {
120
+ if(in_rank >= 3){
121
+ TI flat = 1;
122
+ for(TI i = in_rank-3; i < in_rank; i++) flat *= in_shape[i];
123
+ collapse_last_three_to_one(flat);
124
+ }
125
+ else{ layer.output_rank = in_rank; for(TI i = 0; i < in_rank; i++) layer.output_shape[i] = in_shape[i]; layer.output_size = in_size; }
126
+ break;
127
+ }
128
+ case LayerType::UNFLATTEN: {
129
+ auto& u = layer.template as<layers::Unflatten<TI>>();
130
+ if(u.height > 0 && u.width > 0 && u.channels > 0){
131
+ insert_last_three(u.height, u.width, u.channels);
132
+ }
133
+ else{
134
+ // Unflatten requires its target (height, width, channels) to be known — typically loaded
135
+ // from the checkpoint's saved attributes. If they're missing we cannot recover them:
136
+ // spatial = height * width is underdetermined and channels has no independent source here.
137
+ // Signal failure explicitly via output_size=0 so the composite propagates the failure.
138
+ layer.output_rank = 0;
139
+ layer.output_size = 0;
140
+ }
141
+ break;
142
+ }
143
+ case LayerType::SAMPLE_AND_SQUASH: {
144
+ replace_last_dim(in_shape[in_rank-1] / 2);
145
+ break;
146
+ }
147
+ default: {
148
+ layer.output_rank = in_rank; layer.output_size = in_size;
149
+ for(TI i = 0; i < in_rank; i++) layer.output_shape[i] = in_shape[i];
150
+ break;
151
+ }
152
+ }
153
+ }
154
+
155
+ template <typename TI>
156
+ RL_TOOLS_FUNCTION_PLACEMENT void propagate_parallel_output(Layer<TI>& layer){
157
+ auto* p = layer.data ? &layer.template as<const layers::Parallel<TI>>() : nullptr;
158
+ if(p == nullptr || p->num_branches == 0){ layer.output_size = 0; return; }
159
+ TI num_branches = p->num_branches;
160
+ TI rank = layer.children[0].output_rank;
161
+ TI concat_last = 0;
162
+ TI total_size = 0;
163
+ for(TI i = 0; i < num_branches; i++){
164
+ concat_last += layer.children[i].output_shape[rank - 1];
165
+ total_size += layer.children[i].output_size;
166
+ }
167
+ layer.output_rank = rank;
168
+ layer.output_size = total_size;
169
+ for(TI i = 0; i < rank - 1; i++) layer.output_shape[i] = layer.children[0].output_shape[i];
170
+ layer.output_shape[rank - 1] = concat_last;
171
+ if(p->has_head){
172
+ TI head_idx = num_branches;
173
+ propagate_shapes(layer.children[head_idx], layer.output_shape, layer.output_rank);
174
+ layer.output_rank = layer.children[head_idx].output_rank;
175
+ layer.output_size = layer.children[head_idx].output_size;
176
+ for(TI i = 0; i < layer.output_rank; i++) layer.output_shape[i] = layer.children[head_idx].output_shape[i];
177
+ }
178
+ }
179
+
180
+ template <typename TI>
181
+ RL_TOOLS_FUNCTION_PLACEMENT void propagate_shapes(Layer<TI>& layer, const TensorTuple<TI>& inputs){
182
+ if(layer.type == LayerType::PARALLEL && layer.num_children >= 2){
183
+ auto* p = layer.data ? &layer.template as<const layers::Parallel<TI>>() : nullptr;
184
+ TI num_branches = p ? p->num_branches : 0;
185
+ for(TI i = 0; i < num_branches && i < inputs.num_tensors; i++){
186
+ propagate_shapes(layer.children[i], inputs.tensors[i].shape, inputs.tensors[i].rank);
187
+ }
188
+ propagate_parallel_output(layer);
189
+ } else if(inputs.num_tensors > 0){
190
+ propagate_shapes(layer, inputs.tensors[0].shape, inputs.tensors[0].rank);
191
+ }
192
+ }
193
+
194
+ template <typename TI>
195
+ RL_TOOLS_FUNCTION_PLACEMENT void propagate_shapes(Layer<TI>& layer, const TI* in_shape, TI in_rank){
196
+ if(layer.num_children == 0){
197
+ compute_leaf_output_shape(layer, in_shape, in_rank);
198
+ }
199
+ else if(layer.type == LayerType::PARALLEL){
200
+ layer.output_size = 0;
201
+ }
202
+ else{
203
+ const TI* cur_shape = in_shape; TI cur_rank = in_rank;
204
+ for(TI i = 0; i < layer.num_children; i++){
205
+ propagate_shapes(layer.children[i], cur_shape, cur_rank);
206
+ if(layer.children[i].output_size == 0){ layer.output_size = 0; return; }
207
+ cur_shape = layer.children[i].output_shape;
208
+ cur_rank = layer.children[i].output_rank;
209
+ }
210
+ if(layer.type == LayerType::RESNET_BLOCK && layer.num_children == 3){
211
+ propagate_shapes(layer.children[2], in_shape, in_rank);
212
+ }
213
+ TI last = (layer.type == LayerType::RESNET_BLOCK) ? 1 : layer.num_children - 1;
214
+ layer.output_rank = layer.children[last].output_rank;
215
+ layer.output_size = layer.children[last].output_size;
216
+ for(TI i = 0; i < layer.output_rank; i++) layer.output_shape[i] = layer.children[last].output_shape[i];
217
+ }
218
+ }
219
+
220
+ // --- Buffer sizing (no switch needed for composites — just recurse children) ---
221
+ template <typename TI>
222
+ RL_TOOLS_FUNCTION_PLACEMENT TI max_output_size(const Layer<TI>& layer){
223
+ TI m = layer.output_size;
224
+ if(layer.type == LayerType::PARALLEL){
225
+ auto* p = layer.data ? &layer.template as<const layers::Parallel<TI>>() : nullptr;
226
+ TI num_branches = p ? p->num_branches : 0;
227
+ TI concat = 0;
228
+ for(TI i = 0; i < num_branches; i++) concat += layer.children[i].output_size;
229
+ if(concat > m) m = concat;
230
+ }
231
+ for(TI i = 0; i < layer.num_children; i++){ TI s = max_output_size(layer.children[i]); if(s > m) m = s; }
232
+ return m;
233
+ }
234
+ template <typename TI>
235
+ RL_TOOLS_FUNCTION_PLACEMENT TI max_scratch_size(const Layer<TI>& layer){
236
+ TI m = 0;
237
+ // Leaf-specific scratch needs
238
+ switch(layer.type){
239
+ case LayerType::GRU: {
240
+ auto& g = layer.template as<const layers::GRU<TI>>();
241
+ TI batch = (layer.output_rank == 3) ? layer.output_shape[1] : (layer.output_size / g.hidden_dim);
242
+ m = batch * 3 * g.hidden_dim;
243
+ break;
244
+ }
245
+ case LayerType::RESNET_BLOCK: {
246
+ m = layer.children[0].output_size; // conv1 intermediate
247
+ TI child_max = 0;
248
+ for(TI i = 0; i < layer.num_children; i++){ TI s = max_scratch_size(layer.children[i]); if(s > child_max) child_max = s; }
249
+ m += child_max;
250
+ return m;
251
+ }
252
+ case LayerType::PARALLEL: {
253
+ auto* p = layer.data ? &layer.template as<const layers::Parallel<TI>>() : nullptr;
254
+ TI num_branches = p ? p->num_branches : 0;
255
+ TI inter_size = 0;
256
+ for(TI i = 0; i < num_branches; i++) inter_size += layer.children[i].output_size;
257
+ if(inter_size > m) m = inter_size;
258
+ break;
259
+ }
260
+ default: break;
261
+ }
262
+ // Recurse into children
263
+ for(TI i = 0; i < layer.num_children; i++){ TI s = max_scratch_size(layer.children[i]); if(s > m) m = s; }
264
+ return m;
265
+ }
266
+
267
+ // --- Leaf evaluate helpers ---
268
+ template <typename DEVICE, typename TI>
269
+ RL_TOOLS_FUNCTION_PLACEMENT void evaluate_dense(DEVICE& device, const layers::Dense<TI>& layer, const Tensor<TensorSpecification<TI>>& input, Tensor<TensorSpecification<TI>>& output){
270
+ TI batch_size = input.size() / layer.input_dim;
271
+ if(input.type == Type::FLOAT32 && layer.weights.type == Type::FLOAT32 && layer.biases.type == Type::FLOAT32 && output.type == Type::FLOAT32){
272
+ const float* w = reinterpret_cast<const float*>(layer.weights.data);
273
+ const float* bias = reinterpret_cast<const float*>(layer.biases.data);
274
+ const float* in = reinterpret_cast<const float*>(input.data);
275
+ float* out = reinterpret_cast<float*>(output.data);
276
+ for(TI b = 0; b < batch_size; b++)
277
+ for(TI o = 0; o < layer.output_dim; o++){
278
+ float acc = bias[o];
279
+ for(TI i = 0; i < layer.input_dim; i++) acc += w[o * layer.input_dim + i] * in[b * layer.input_dim + i];
280
+ out[b * layer.output_dim + o] = apply_activation(device.math, layer.activation_function, acc);
281
+ }
282
+ } else {
283
+ for(TI b = 0; b < batch_size; b++)
284
+ for(TI o = 0; o < layer.output_dim; o++){
285
+ float acc = get(device, layer.biases, o);
286
+ for(TI i = 0; i < layer.input_dim; i++) acc += get(device, layer.weights, o * layer.input_dim + i) * get(device, input, b * layer.input_dim + i);
287
+ set(device, output, apply_activation(device.math, layer.activation_function, acc), b * layer.output_dim + o);
288
+ }
289
+ }
290
+ }
291
+ template <typename DEVICE, typename TI>
292
+ RL_TOOLS_FUNCTION_PLACEMENT void evaluate_step_gru(DEVICE& device, const layers::GRU<TI>& layer, const Tensor<TensorSpecification<TI>>& input, state::GRU<TI>& gru_state, Tensor<TensorSpecification<TI>>& scratch){
293
+ TI batch_size = input.size() / layer.input_dim, hidden_dim = layer.hidden_dim;
294
+ if(input.type == Type::FLOAT32 && layer.weights_input.type == Type::FLOAT32 && layer.biases_input.type == Type::FLOAT32 && layer.weights_hidden.type == Type::FLOAT32 && layer.biases_hidden.type == Type::FLOAT32 && layer.initial_hidden_state.type == Type::FLOAT32 && gru_state.hidden.type == Type::FLOAT32 && scratch.type == Type::FLOAT32){
295
+ const float* wi_ptr = reinterpret_cast<const float*>(layer.weights_input.data);
296
+ const float* bi_ptr = reinterpret_cast<const float*>(layer.biases_input.data);
297
+ const float* wh_ptr = reinterpret_cast<const float*>(layer.weights_hidden.data);
298
+ const float* bh_ptr = reinterpret_cast<const float*>(layer.biases_hidden.data);
299
+ const float* init_h = reinterpret_cast<const float*>(layer.initial_hidden_state.data);
300
+ const float* in = reinterpret_cast<const float*>(input.data);
301
+ float* hid = reinterpret_cast<float*>(gru_state.hidden.data);
302
+ float* sc = reinterpret_cast<float*>(scratch.data);
303
+ if(!gru_state.initialized){
304
+ for(TI b = 0; b < batch_size; b++) for(TI h = 0; h < hidden_dim; h++) hid[b*hidden_dim+h] = init_h[h];
305
+ gru_state.initialized = true;
306
+ }
307
+ TI input_dim = layer.input_dim;
308
+ for(TI b = 0; b < batch_size; b++){
309
+ for(TI g = 0; g < 2*hidden_dim; g++){
310
+ float wh = bh_ptr[g];
311
+ for(TI h = 0; h < hidden_dim; h++) wh += wh_ptr[g*hidden_dim+h] * hid[b*hidden_dim+h];
312
+ float wi = bi_ptr[g];
313
+ for(TI i = 0; i < input_dim; i++) wi += wi_ptr[g*input_dim+i] * in[b*input_dim+i];
314
+ sc[b*2*hidden_dim+g] = 1.0f / (1.0f + math::exp(device.math, -(wh+wi)));
315
+ }
316
+ for(TI h = 0; h < hidden_dim; h++){
317
+ TI g = 2*hidden_dim+h;
318
+ float wh_n = bh_ptr[g];
319
+ for(TI hh = 0; hh < hidden_dim; hh++) wh_n += wh_ptr[g*hidden_dim+hh] * hid[b*hidden_dim+hh];
320
+ float wi_n = bi_ptr[g];
321
+ for(TI i = 0; i < input_dim; i++) wi_n += wi_ptr[g*input_dim+i] * in[b*input_dim+i];
322
+ float r = sc[b*2*hidden_dim+h];
323
+ float n_pre = r * wh_n + wi_n;
324
+ float n = math::tanh(device.math, n_pre);
325
+ float z = sc[b*2*hidden_dim+hidden_dim+h];
326
+ sc[b*2*hidden_dim+h] = z * hid[b*hidden_dim+h] + (1.0f-z) * n;
327
+ }
328
+ for(TI h = 0; h < hidden_dim; h++) hid[b*hidden_dim+h] = sc[b*2*hidden_dim+h];
329
+ }
330
+ } else {
331
+ if(!gru_state.initialized){
332
+ for(TI b = 0; b < batch_size; b++) for(TI h = 0; h < hidden_dim; h++) set(device, gru_state.hidden, get(device, layer.initial_hidden_state, h), b*hidden_dim+h);
333
+ gru_state.initialized = true;
334
+ }
335
+ for(TI b = 0; b < batch_size; b++){
336
+ for(TI g = 0; g < 2*hidden_dim; g++){
337
+ float wh = get(device, layer.biases_hidden, g);
338
+ for(TI h = 0; h < hidden_dim; h++) wh += get(device, layer.weights_hidden, g*hidden_dim+h) * get(device, gru_state.hidden, b*hidden_dim+h);
339
+ float wi = get(device, layer.biases_input, g);
340
+ for(TI i = 0; i < layer.input_dim; i++) wi += get(device, layer.weights_input, g*layer.input_dim+i) * get(device, input, b*layer.input_dim+i);
341
+ set(device, scratch, 1.0f / (1.0f + math::exp(device.math, -(wh+wi))), b*2*hidden_dim+g);
342
+ }
343
+ for(TI h = 0; h < hidden_dim; h++){
344
+ TI g = 2*hidden_dim+h;
345
+ float wh_n = get(device, layer.biases_hidden, g);
346
+ for(TI hh = 0; hh < hidden_dim; hh++) wh_n += get(device, layer.weights_hidden, g*hidden_dim+hh) * get(device, gru_state.hidden, b*hidden_dim+hh);
347
+ float wi_n = get(device, layer.biases_input, g);
348
+ for(TI i = 0; i < layer.input_dim; i++) wi_n += get(device, layer.weights_input, g*layer.input_dim+i) * get(device, input, b*layer.input_dim+i);
349
+ float r = get(device, scratch, b*2*hidden_dim+h);
350
+ float n_pre = r * wh_n + wi_n;
351
+ float n = math::tanh(device.math, n_pre);
352
+ float z = get(device, scratch, b*2*hidden_dim+hidden_dim+h);
353
+ set(device, scratch, z * get(device, gru_state.hidden, b*hidden_dim+h) + (1.0f-z) * n, b*2*hidden_dim+h);
354
+ }
355
+ for(TI h = 0; h < hidden_dim; h++) set(device, gru_state.hidden, get(device, scratch, b*2*hidden_dim+h), b*hidden_dim+h);
356
+ }
357
+ }
358
+ }
359
+ template <typename DEVICE, typename TI>
360
+ RL_TOOLS_FUNCTION_PLACEMENT void evaluate_conv2d(DEVICE& device, const layers::Conv2d<TI>& layer, const Tensor<TensorSpecification<TI>>& input, Tensor<TensorSpecification<TI>>& output){
361
+ TI ih = input.shape[input.rank-3], iw = input.shape[input.rank-2];
362
+ TI batch = input.size() / (ih * iw * layer.input_channels);
363
+ TI oh = (ih + 2*layer.padding_h - layer.kernel_height) / layer.stride_h + 1;
364
+ TI ow = (iw + 2*layer.padding_w - layer.kernel_width) / layer.stride_w + 1;
365
+ bool all_f32 = input.type == Type::FLOAT32 && layer.weights.type == Type::FLOAT32 && layer.biases.type == Type::FLOAT32 && output.type == Type::FLOAT32;
366
+ if(all_f32){
367
+ const float* w = reinterpret_cast<const float*>(layer.weights.data);
368
+ const float* bias = reinterpret_cast<const float*>(layer.biases.data);
369
+ const float* in = reinterpret_cast<const float*>(input.data);
370
+ float* out = reinterpret_cast<float*>(output.data);
371
+ for(TI bi = 0; bi < batch; bi++)
372
+ for(TI ohi = 0; ohi < oh; ohi++)
373
+ for(TI owi = 0; owi < ow; owi++)
374
+ for(TI oc = 0; oc < layer.output_channels; oc++){
375
+ float acc = bias[oc];
376
+ for(TI kh = 0; kh < layer.kernel_height; kh++){
377
+ TI ihi = ohi*layer.stride_h+kh-layer.padding_h; if(ihi >= ih) continue;
378
+ for(TI kw = 0; kw < layer.kernel_width; kw++){
379
+ TI iwi = owi*layer.stride_w+kw-layer.padding_w; if(iwi >= iw) continue;
380
+ for(TI ic = 0; ic < layer.input_channels; ic++)
381
+ acc += w[((oc*layer.kernel_height+kh)*layer.kernel_width+kw)*layer.input_channels+ic]
382
+ * in[((bi*ih+ihi)*iw+iwi)*layer.input_channels+ic];
383
+ }
384
+ }
385
+ out[((bi*oh+ohi)*ow+owi)*layer.output_channels+oc] = acc;
386
+ }
387
+ if(layer.normalization == layers::Conv2d<TI>::Normalization::BATCH_NORM){
388
+ const float* gamma = reinterpret_cast<const float*>(layer.gamma.data);
389
+ const float* beta = reinterpret_cast<const float*>(layer.beta.data);
390
+ const float* running_mean = reinterpret_cast<const float*>(layer.running_mean.data);
391
+ const float* running_var = reinterpret_cast<const float*>(layer.running_var.data);
392
+ float eps = 1e-5f;
393
+ TI total = output.size();
394
+ for(TI i = 0; i < total; i++){
395
+ TI oc = i % layer.output_channels;
396
+ out[i] = gamma[oc] * (out[i] - running_mean[oc]) / math::sqrt(device.math, running_var[oc] + eps) + beta[oc];
397
+ }
398
+ }
399
+ if(layer.activation_function != ActivationFunction::IDENTITY){
400
+ TI total = output.size();
401
+ for(TI i = 0; i < total; i++) out[i] = apply_activation(device.math, layer.activation_function, out[i]);
402
+ }
403
+ } else {
404
+ for(TI bi = 0; bi < batch; bi++)
405
+ for(TI ohi = 0; ohi < oh; ohi++)
406
+ for(TI owi = 0; owi < ow; owi++)
407
+ for(TI oc = 0; oc < layer.output_channels; oc++){
408
+ float acc = get(device, layer.biases, oc);
409
+ for(TI kh = 0; kh < layer.kernel_height; kh++){
410
+ TI ihi = ohi*layer.stride_h+kh-layer.padding_h; if(ihi >= ih) continue;
411
+ for(TI kw = 0; kw < layer.kernel_width; kw++){
412
+ TI iwi = owi*layer.stride_w+kw-layer.padding_w; if(iwi >= iw) continue;
413
+ for(TI ic = 0; ic < layer.input_channels; ic++)
414
+ acc += get(device, layer.weights, ((oc*layer.kernel_height+kh)*layer.kernel_width+kw)*layer.input_channels+ic)
415
+ * get(device, input, ((bi*ih+ihi)*iw+iwi)*layer.input_channels+ic);
416
+ }
417
+ }
418
+ set(device, output, acc, ((bi*oh+ohi)*ow+owi)*layer.output_channels+oc);
419
+ }
420
+ if(layer.normalization == layers::Conv2d<TI>::Normalization::BATCH_NORM){
421
+ float eps = 1e-5f;
422
+ for(TI i = 0; i < output.size(); i++){
423
+ TI oc = i % layer.output_channels;
424
+ set(device, output, get(device, layer.gamma, oc) * (get(device, output, i) - get(device, layer.running_mean, oc)) / math::sqrt(device.math, get(device, layer.running_var, oc) + eps) + get(device, layer.beta, oc), i);
425
+ }
426
+ }
427
+ if(layer.activation_function != ActivationFunction::IDENTITY)
428
+ for(TI i = 0; i < output.size(); i++) set(device, output, apply_activation(device.math, layer.activation_function, get(device, output, i)), i);
429
+ }
430
+ }
431
+ template <typename DEVICE, typename TI>
432
+ RL_TOOLS_FUNCTION_PLACEMENT void evaluate_max_pool2d(DEVICE& device, const layers::MaxPool2d<TI>& layer, const Tensor<TensorSpecification<TI>>& input, Tensor<TensorSpecification<TI>>& output){
433
+ TI ih = input.shape[input.rank-3], iw = input.shape[input.rank-2], ch = input.shape[input.rank-1];
434
+ TI batch = input.size() / (ih*iw*ch);
435
+ TI oh = (ih + 2*layer.padding_h - layer.kernel_height) / layer.stride_h + 1;
436
+ TI ow = (iw + 2*layer.padding_w - layer.kernel_width) / layer.stride_w + 1;
437
+ for(TI bi = 0; bi < batch; bi++)
438
+ for(TI ohi = 0; ohi < oh; ohi++)
439
+ for(TI owi = 0; owi < ow; owi++)
440
+ for(TI c = 0; c < ch; c++){
441
+ float mx = -1e30f;
442
+ for(TI kh = 0; kh < layer.kernel_height; kh++){
443
+ TI ihi = ohi*layer.stride_h+kh-layer.padding_h; if(ihi >= ih) continue;
444
+ for(TI kw = 0; kw < layer.kernel_width; kw++){
445
+ TI iwi = owi*layer.stride_w+kw-layer.padding_w; if(iwi >= iw) continue;
446
+ float v = get(device, input, ((bi*ih+ihi)*iw+iwi)*ch+c); if(v > mx) mx = v;
447
+ }
448
+ }
449
+ set(device, output, mx, ((bi*oh+ohi)*ow+owi)*ch+c);
450
+ }
451
+ }
452
+ }
453
+
454
+ // Forward declarations
455
+ template <typename DEVICE, typename TI>
456
+ RL_TOOLS_FUNCTION_PLACEMENT bool evaluate(DEVICE& device, const dyn::Layer<TI>& layer, const dyn::Tensor<dyn::TensorSpecification<TI>>& input, dyn::Tensor<dyn::TensorSpecification<TI>>& output, dyn::Buffer<TI>& buffer);
457
+ template <typename DEVICE, typename TI>
458
+ RL_TOOLS_FUNCTION_PLACEMENT bool evaluate_step(DEVICE& device, const dyn::Layer<TI>& layer, const dyn::Tensor<dyn::TensorSpecification<TI>>& input, dyn::State<TI>& state, dyn::Tensor<dyn::TensorSpecification<TI>>& output, dyn::Buffer<TI>& buffer);
459
+
460
+ namespace dyn{
461
+ template <typename DEVICE, typename TI>
462
+ RL_TOOLS_FUNCTION_PLACEMENT bool evaluate_chain(DEVICE& device, const Layer<TI>& layer, const Tensor<TensorSpecification<TI>>& input, Tensor<TensorSpecification<TI>>& output, Buffer<TI>& buffer){
463
+ const Tensor<TensorSpecification<TI>>* current_input = &input;
464
+ for(TI i = 0; i < layer.num_children; i++){
465
+ Tensor<TensorSpecification<TI>>* current_output;
466
+ if(i == layer.num_children - 1) current_output = &output;
467
+ else current_output = (current_input == &buffer.tick) ? &buffer.tock : &buffer.tick;
468
+ if(!rl_tools::evaluate(device, layer.children[i], *current_input, *current_output, buffer)) return false;
469
+ current_input = current_output;
470
+ }
471
+ return true;
472
+ }
473
+ template <typename DEVICE, typename TI>
474
+ RL_TOOLS_FUNCTION_PLACEMENT bool evaluate_step_chain(DEVICE& device, const Layer<TI>& layer, state::Composite<TI>& comp_state, const Tensor<TensorSpecification<TI>>& input, Tensor<TensorSpecification<TI>>& output, Buffer<TI>& buffer){
475
+ const Tensor<TensorSpecification<TI>>* current_input = &input;
476
+ for(TI i = 0; i < layer.num_children; i++){
477
+ Tensor<TensorSpecification<TI>>* current_output;
478
+ if(i == layer.num_children - 1) current_output = &output;
479
+ else current_output = (current_input == &buffer.tick) ? &buffer.tock : &buffer.tick;
480
+ if(!rl_tools::evaluate_step(device, layer.children[i], *current_input, comp_state.child_states[i], *current_output, buffer)) return false;
481
+ current_input = current_output;
482
+ }
483
+ return true;
484
+ }
485
+ template <typename DEVICE, typename TI>
486
+ RL_TOOLS_FUNCTION_PLACEMENT void evaluate_gru(DEVICE& device, const layers::GRU<TI>& gru, const Layer<TI>& layer, const Tensor<TensorSpecification<TI>>& input, Tensor<TensorSpecification<TI>>& output, Buffer<TI>& buffer){
487
+ TI hidden_dim = gru.hidden_dim;
488
+ TI batch = (input.rank == 3) ? input.shape[1] : (input.size() / gru.input_dim);
489
+ state::GRU<TI> tmp_state;
490
+ TI state_shape[] = {batch, hidden_dim};
491
+ set_shape(tmp_state.hidden, (TI)2, state_shape);
492
+ tmp_state.hidden.type = Type::FLOAT32;
493
+ tmp_state.hidden.data = buffer.scratch.data;
494
+ tmp_state.initialized = false;
495
+ Tensor<TensorSpecification<TI>> gate_scratch;
496
+ TI gate_shape[] = {batch * 2 * hidden_dim};
497
+ set_shape(gate_scratch, (TI)1, gate_shape);
498
+ gate_scratch.type = Type::FLOAT32;
499
+ gate_scratch.data = reinterpret_cast<char*>(buffer.scratch.data) + batch * hidden_dim * sizeof(float);
500
+ if(input.rank == 2){
501
+ evaluate_step_gru(device, gru, input, tmp_state, gate_scratch);
502
+ for(TI b = 0; b < batch; b++) for(TI h = 0; h < hidden_dim; h++) set(device, output, get(device, tmp_state.hidden, b*hidden_dim+h), b*hidden_dim+h);
503
+ }
504
+ else{
505
+ TI seq_len = input.shape[0];
506
+ Tensor<TensorSpecification<TI>> step_input;
507
+ TI step_shape[] = {batch, gru.input_dim};
508
+ set_shape(step_input, (TI)2, step_shape);
509
+ step_input.type = input.type;
510
+ for(TI t = 0; t < seq_len; t++){
511
+ step_input.data = reinterpret_cast<char*>(const_cast<void*>(input.data)) + t * batch * gru.input_dim * size_of<TI>(input.type);
512
+ evaluate_step_gru(device, gru, step_input, tmp_state, gate_scratch);
513
+ for(TI b = 0; b < batch; b++) for(TI h = 0; h < hidden_dim; h++) set(device, output, get(device, tmp_state.hidden, b*hidden_dim+h), (t*batch+b)*hidden_dim+h);
514
+ }
515
+ }
516
+ }
517
+ }
518
+
519
+ // --- Buffer malloc/free ---
520
+ template <typename DEVICE, typename TI>
521
+ RL_TOOLS_FUNCTION_PLACEMENT void malloc(DEVICE& device, dyn::Buffer<TI>& buffer){
522
+ TI tt_size = dyn::max_output_size(*buffer.layer);
523
+ TI sc_size = dyn::max_scratch_size(*buffer.layer);
524
+ TI tt[] = {tt_size}; dyn::set_shape(buffer.tick, (TI)1, tt); buffer.tick.type = dyn::Type::FLOAT32; rl_tools::malloc(device, buffer.tick);
525
+ dyn::set_shape(buffer.tock, (TI)1, tt); buffer.tock.type = dyn::Type::FLOAT32; rl_tools::malloc(device, buffer.tock);
526
+ if(sc_size > 0){ TI sc[] = {sc_size}; dyn::set_shape(buffer.scratch, (TI)1, sc); buffer.scratch.type = dyn::Type::FLOAT32; rl_tools::malloc(device, buffer.scratch); }
527
+ }
528
+ template <typename DEVICE, typename TI>
529
+ RL_TOOLS_FUNCTION_PLACEMENT void free(DEVICE& device, dyn::Buffer<TI>& buffer){
530
+ rl_tools::free(device, buffer.tick); rl_tools::free(device, buffer.tock); rl_tools::free(device, buffer.scratch);
531
+ }
532
+
533
+ // --- State malloc/free/reset ---
534
+ template <typename DEVICE, typename TI>
535
+ RL_TOOLS_FUNCTION_PLACEMENT void malloc(DEVICE& device, dyn::State<TI>& state){
536
+ state.type = state.layer->type;
537
+ if(state.type == dyn::LayerType::GRU){
538
+ auto& g = state.layer->template as<const dyn::layers::GRU<TI>>();
539
+ auto* gs = new dyn::state::GRU<TI>();
540
+ TI shape[] = {state.batch_size, g.hidden_dim};
541
+ dyn::set_shape(gs->hidden, (TI)2, shape); gs->hidden.type = dyn::Type::FLOAT32;
542
+ rl_tools::malloc(device, gs->hidden); gs->initialized = false;
543
+ state.data = gs;
544
+ }
545
+ else if(state.layer->num_children > 0){
546
+ auto* cs = new dyn::state::Composite<TI>();
547
+ cs->num_children = state.layer->num_children;
548
+ cs->child_states = new dyn::State<TI>[cs->num_children];
549
+ for(TI i = 0; i < cs->num_children; i++){
550
+ cs->child_states[i].batch_size = state.batch_size;
551
+ cs->child_states[i].layer = &state.layer->children[i];
552
+ rl_tools::malloc(device, cs->child_states[i]);
553
+ }
554
+ state.data = cs;
555
+ }
556
+ else{ state.data = nullptr; }
557
+ }
558
+ template <typename DEVICE, typename TI>
559
+ RL_TOOLS_FUNCTION_PLACEMENT void free(DEVICE& device, dyn::State<TI>& state){
560
+ if(state.type == dyn::LayerType::GRU){
561
+ auto* gs = reinterpret_cast<dyn::state::GRU<TI>*>(state.data);
562
+ rl_tools::free(device, gs->hidden); delete gs;
563
+ }
564
+ else if(state.data){
565
+ auto* cs = reinterpret_cast<dyn::state::Composite<TI>*>(state.data);
566
+ for(TI i = 0; i < cs->num_children; i++) rl_tools::free(device, cs->child_states[i]);
567
+ delete[] cs->child_states; delete cs;
568
+ }
569
+ state.data = nullptr;
570
+ }
571
+ template <typename DEVICE, typename TI>
572
+ RL_TOOLS_FUNCTION_PLACEMENT void reset(DEVICE& device, const dyn::Layer<TI>& layer, dyn::State<TI>& state){
573
+ if(state.type == dyn::LayerType::GRU) reinterpret_cast<dyn::state::GRU<TI>*>(state.data)->initialized = false;
574
+ else if(state.data){
575
+ auto* cs = reinterpret_cast<dyn::state::Composite<TI>*>(state.data);
576
+ for(TI i = 0; i < cs->num_children; i++) reset(device, layer.children[i], cs->child_states[i]);
577
+ }
578
+ }
579
+ template <typename DEVICE, typename TI>
580
+ RL_TOOLS_FUNCTION_PLACEMENT void copy(DEVICE& device, DEVICE&, const dyn::State<TI>& src, dyn::State<TI>& dst){
581
+ if(src.type == dyn::LayerType::GRU){
582
+ auto* src_gs = reinterpret_cast<const dyn::state::GRU<TI>*>(src.data);
583
+ auto* dst_gs = reinterpret_cast<dyn::state::GRU<TI>*>(dst.data);
584
+ TI bytes = src_gs->hidden.size() * dyn::size_of<TI>(src_gs->hidden.type);
585
+ const char* s = reinterpret_cast<const char*>(src_gs->hidden.data);
586
+ char* d = reinterpret_cast<char*>(dst_gs->hidden.data);
587
+ for(TI i = 0; i < bytes; i++) d[i] = s[i];
588
+ dst_gs->initialized = src_gs->initialized;
589
+ }
590
+ else if(src.data && dst.data){
591
+ auto* src_cs = reinterpret_cast<const dyn::state::Composite<TI>*>(src.data);
592
+ auto* dst_cs = reinterpret_cast<dyn::state::Composite<TI>*>(dst.data);
593
+ for(TI i = 0; i < src_cs->num_children; i++) copy(device, device, src_cs->child_states[i], dst_cs->child_states[i]);
594
+ }
595
+ }
596
+
597
+ // --- Layer free ---
598
+ template <typename DEVICE, typename TI>
599
+ RL_TOOLS_FUNCTION_PLACEMENT void free(DEVICE& device, dyn::Layer<TI>& layer){
600
+ // Free children first
601
+ for(TI i = 0; i < layer.num_children; i++) rl_tools::free(device, layer.children[i]);
602
+ if(layer.children){ delete[] layer.children; layer.children = nullptr; }
603
+ // Free leaf data
604
+ switch(layer.type){
605
+ case dyn::LayerType::DENSE: { auto& d = layer.template as<dyn::layers::Dense<TI>>(); rl_tools::free(device, d.weights); rl_tools::free(device, d.biases); delete &d; break; }
606
+ case dyn::LayerType::GRU: { auto& g = layer.template as<dyn::layers::GRU<TI>>(); rl_tools::free(device, g.weights_input); rl_tools::free(device, g.biases_input); rl_tools::free(device, g.weights_hidden); rl_tools::free(device, g.biases_hidden); rl_tools::free(device, g.initial_hidden_state); delete &g; break; }
607
+ case dyn::LayerType::CONV2D: { auto& c = layer.template as<dyn::layers::Conv2d<TI>>(); rl_tools::free(device, c.weights); rl_tools::free(device, c.biases); if(c.normalization != dyn::layers::Conv2d<TI>::Normalization::NONE){ rl_tools::free(device, c.gamma); rl_tools::free(device, c.beta); if(c.normalization == dyn::layers::Conv2d<TI>::Normalization::BATCH_NORM){ rl_tools::free(device, c.running_mean); rl_tools::free(device, c.running_var); } } delete &c; break; }
608
+ case dyn::LayerType::MAX_POOL2D: delete reinterpret_cast<dyn::layers::MaxPool2d<TI>*>(layer.data); break;
609
+ case dyn::LayerType::STANDARDIZE: { auto& s = layer.template as<dyn::layers::Standardize<TI>>(); rl_tools::free(device, s.mean); rl_tools::free(device, s.precision); delete &s; break; }
610
+ case dyn::LayerType::EMBEDDING: { auto& e = layer.template as<dyn::layers::Embedding<TI>>(); rl_tools::free(device, e.weights); delete &e; break; }
611
+ case dyn::LayerType::PARALLEL: delete reinterpret_cast<dyn::layers::Parallel<TI>*>(layer.data); break;
612
+ default: break;
613
+ }
614
+ layer.data = nullptr;
615
+ }
616
+
617
+ // --- Top-level evaluate ---
618
+ template <typename DEVICE, typename TI>
619
+ RL_TOOLS_FUNCTION_PLACEMENT bool evaluate(DEVICE& device, const dyn::Layer<TI>& layer, const dyn::Tensor<dyn::TensorSpecification<TI>>& input, dyn::Tensor<dyn::TensorSpecification<TI>>& output, dyn::Buffer<TI>& buffer){
620
+ if(layer.output_size == 0) return false;
621
+ if(output.capacity < layer.output_size) return false;
622
+ if(buffer.tick.data == nullptr) return false;
623
+ if(input.data == nullptr) return false;
624
+ dyn::set_shape(output, layer.output_rank, layer.output_shape);
625
+ output.type = dyn::Type::FLOAT32;
626
+ switch(layer.type){
627
+ case dyn::LayerType::DENSE: dyn::evaluate_dense(device, layer.template as<const dyn::layers::Dense<TI>>(), input, output); return true;
628
+ case dyn::LayerType::GRU: dyn::evaluate_gru(device, layer.template as<const dyn::layers::GRU<TI>>(), layer, input, output, buffer); return true;
629
+ case dyn::LayerType::CONV2D: dyn::evaluate_conv2d(device, layer.template as<const dyn::layers::Conv2d<TI>>(), input, output); return true;
630
+ case dyn::LayerType::MAX_POOL2D: dyn::evaluate_max_pool2d(device, layer.template as<const dyn::layers::MaxPool2d<TI>>(), input, output); return true;
631
+ case dyn::LayerType::SAMPLE_AND_SQUASH: {
632
+ TI last = input.shape[input.rank-1], half = last/2, batch = input.size()/last;
633
+ for(TI b = 0; b < batch; b++) for(TI i = 0; i < half; i++) rl_tools::set(device, output, math::tanh(device.math, rl_tools::get(device, input, b*last+i)), b*half+i);
634
+ return true;
635
+ }
636
+ case dyn::LayerType::STANDARDIZE: {
637
+ auto& s = layer.template as<const dyn::layers::Standardize<TI>>();
638
+ TI batch = input.size() / s.dim;
639
+ if(input.type == dyn::Type::FLOAT32 && s.mean.type == dyn::Type::FLOAT32 && s.precision.type == dyn::Type::FLOAT32 && output.type == dyn::Type::FLOAT32){
640
+ const float* in = reinterpret_cast<const float*>(input.data);
641
+ const float* mean = reinterpret_cast<const float*>(s.mean.data);
642
+ const float* prec = reinterpret_cast<const float*>(s.precision.data);
643
+ float* out = reinterpret_cast<float*>(output.data);
644
+ for(TI b = 0; b < batch; b++) for(TI i = 0; i < s.dim; i++) out[b*s.dim+i] = (in[b*s.dim+i] - mean[i]) * prec[i];
645
+ } else {
646
+ for(TI b = 0; b < batch; b++) for(TI i = 0; i < s.dim; i++) rl_tools::set(device, output, (rl_tools::get(device, input, b*s.dim+i) - rl_tools::get(device, s.mean, i)) * rl_tools::get(device, s.precision, i), b*s.dim+i);
647
+ }
648
+ return true;
649
+ }
650
+ case dyn::LayerType::FLATTEN: case dyn::LayerType::UNFLATTEN: {
651
+ output.type = input.type;
652
+ TI bytes = input.size() * dyn::size_of<TI>(input.type);
653
+ const char* src = reinterpret_cast<const char*>(input.data); char* dst = reinterpret_cast<char*>(output.data);
654
+ for(TI i = 0; i < bytes; i++) dst[i] = src[i];
655
+ return true;
656
+ }
657
+ case dyn::LayerType::AVG_POOL2D: {
658
+ TI ch = input.shape[input.rank-1], w = input.shape[input.rank-2], h = input.shape[input.rank-3], batch = input.size()/(h*w*ch);
659
+ float scale = 1.0f / (float)(h*w);
660
+ for(TI b = 0; b < batch; b++) for(TI c = 0; c < ch; c++){
661
+ float sum = 0; for(TI hi = 0; hi < h; hi++) for(TI wi = 0; wi < w; wi++) sum += rl_tools::get(device, input, ((b*h+hi)*w+wi)*ch+c);
662
+ rl_tools::set(device, output, sum*scale, b*ch+c);
663
+ }
664
+ return true;
665
+ }
666
+ case dyn::LayerType::SEQUENTIAL: case dyn::LayerType::MLP:
667
+ return dyn::evaluate_chain(device, layer, input, output, buffer);
668
+ case dyn::LayerType::PARALLEL:
669
+ return false;
670
+ case dyn::LayerType::RESNET_BLOCK: {
671
+ if(!rl_tools::evaluate(device, layer.children[0], input, buffer.scratch, buffer)) return false;
672
+ if(!rl_tools::evaluate(device, layer.children[1], buffer.scratch, output, buffer)) return false;
673
+ if(layer.num_children == 3){
674
+ dyn::Buffer<TI> sub_buffer = buffer;
675
+ TI conv1_bytes = layer.children[0].output_size * sizeof(float);
676
+ sub_buffer.scratch.data = reinterpret_cast<char*>(buffer.scratch.data) + conv1_bytes;
677
+ sub_buffer.scratch.capacity = buffer.scratch.capacity - layer.children[0].output_size;
678
+ if(!rl_tools::evaluate(device, layer.children[2], input, buffer.scratch, sub_buffer)) return false;
679
+ }
680
+ const dyn::Tensor<dyn::TensorSpecification<TI>>& shortcut = (layer.num_children == 3) ? buffer.scratch : input;
681
+ for(TI i = 0; i < output.size(); i++){
682
+ float val = rl_tools::get(device, output, i) + rl_tools::get(device, shortcut, i);
683
+ rl_tools::set(device, output, val > 0 ? val : 0, i);
684
+ }
685
+ return true;
686
+ }
687
+ default: return false;
688
+ }
689
+ }
690
+
691
+ // --- Top-level evaluate (TensorTuple) ---
692
+ template <typename DEVICE, typename TI>
693
+ RL_TOOLS_FUNCTION_PLACEMENT bool evaluate(DEVICE& device, const dyn::Layer<TI>& layer, const dyn::TensorTuple<TI>& inputs, dyn::Tensor<dyn::TensorSpecification<TI>>& output, dyn::Buffer<TI>& buffer){
694
+ if(layer.type != dyn::LayerType::PARALLEL){
695
+ if(inputs.num_tensors > 0) return rl_tools::evaluate(device, layer, inputs.tensors[0], output, buffer);
696
+ return false;
697
+ }
698
+ auto* p = layer.data ? &layer.template as<const dyn::layers::Parallel<TI>>() : nullptr;
699
+ if(p == nullptr || p->num_branches == 0) return false;
700
+ TI num_branches = p->num_branches;
701
+ if(layer.output_size == 0) return false;
702
+ if(output.capacity < layer.output_size) return false;
703
+ dyn::set_shape(output, layer.output_rank, layer.output_shape);
704
+ output.type = dyn::Type::FLOAT32;
705
+ if(inputs.num_tensors < num_branches) return false;
706
+ dyn::Tensor<dyn::TensorSpecification<TI>> intermediates[dyn::TensorTuple<TI>::MAX_TENSORS];
707
+ TI offset = 0;
708
+ for(TI i = 0; i < num_branches; i++){
709
+ auto& child = layer.children[i];
710
+ dyn::set_shape(intermediates[i], child.output_rank, child.output_shape);
711
+ intermediates[i].type = dyn::Type::FLOAT32;
712
+ intermediates[i].data = reinterpret_cast<char*>(buffer.scratch.data) + offset * sizeof(float);
713
+ intermediates[i].capacity = child.output_size;
714
+ if(!rl_tools::evaluate(device, child, inputs.tensors[i], intermediates[i], buffer)) return false;
715
+ offset += child.output_size;
716
+ }
717
+ TI rank = layer.children[0].output_rank;
718
+ TI last_dims[dyn::TensorTuple<TI>::MAX_TENSORS];
719
+ TI last_out = 0;
720
+ for(TI i = 0; i < num_branches; i++){ last_dims[i] = layer.children[i].output_shape[rank - 1]; last_out += last_dims[i]; }
721
+ TI batch = layer.children[0].output_size / last_dims[0];
722
+ dyn::Tensor<dyn::TensorSpecification<TI>>& concat_target = p->has_head ? buffer.tick : output;
723
+ TI concat_shape[dyn::TensorSpecification<TI>::MAX_RANK];
724
+ for(TI i = 0; i < rank - 1; i++) concat_shape[i] = layer.children[0].output_shape[i];
725
+ concat_shape[rank - 1] = last_out;
726
+ dyn::set_shape(concat_target, rank, concat_shape);
727
+ concat_target.type = dyn::Type::FLOAT32;
728
+ for(TI b = 0; b < batch; b++){
729
+ TI col = 0;
730
+ for(TI i = 0; i < num_branches; i++){
731
+ for(TI j = 0; j < last_dims[i]; j++){
732
+ rl_tools::set(device, concat_target, rl_tools::get(device, intermediates[i], b * last_dims[i] + j), b * last_out + col + j);
733
+ }
734
+ col += last_dims[i];
735
+ }
736
+ }
737
+ if(p->has_head) return rl_tools::evaluate(device, layer.children[num_branches], buffer.tick, output, buffer);
738
+ return true;
739
+ }
740
+
741
+ // --- Top-level evaluate_step ---
742
+ template <typename DEVICE, typename TI>
743
+ RL_TOOLS_FUNCTION_PLACEMENT bool evaluate_step(DEVICE& device, const dyn::Layer<TI>& layer, const dyn::Tensor<dyn::TensorSpecification<TI>>& input, dyn::State<TI>& state, dyn::Tensor<dyn::TensorSpecification<TI>>& output, dyn::Buffer<TI>& buffer){
744
+ if(layer.output_size == 0) return false;
745
+ if(output.capacity < layer.output_size) return false;
746
+ if(buffer.tick.data == nullptr) return false;
747
+ switch(layer.type){
748
+ case dyn::LayerType::GRU: {
749
+ auto& g = layer.template as<const dyn::layers::GRU<TI>>();
750
+ auto* gs = reinterpret_cast<dyn::state::GRU<TI>*>(state.data);
751
+ if(!gs) return false;
752
+ dyn::set_shape(output, layer.output_rank, layer.output_shape); output.type = dyn::Type::FLOAT32;
753
+ dyn::Tensor<dyn::TensorSpecification<TI>> gate_scratch;
754
+ TI batch = input.size() / g.input_dim;
755
+ TI gs_shape[] = {batch * 2 * g.hidden_dim};
756
+ dyn::set_shape(gate_scratch, (TI)1, gs_shape); gate_scratch.type = dyn::Type::FLOAT32; gate_scratch.data = buffer.scratch.data;
757
+ dyn::evaluate_step_gru(device, g, input, *gs, gate_scratch);
758
+ for(TI b = 0; b < batch; b++) for(TI h = 0; h < g.hidden_dim; h++) rl_tools::set(device, output, rl_tools::get(device, gs->hidden, b*g.hidden_dim+h), b*g.hidden_dim+h);
759
+ return true;
760
+ }
761
+ case dyn::LayerType::SEQUENTIAL: case dyn::LayerType::MLP: {
762
+ auto* cs = reinterpret_cast<dyn::state::Composite<TI>*>(state.data);
763
+ if(!cs) return false;
764
+ return dyn::evaluate_step_chain(device, layer, *cs, input, output, buffer);
765
+ }
766
+ default: return evaluate(device, layer, input, output, buffer);
767
+ }
768
+ }
769
+ }
770
+ RL_TOOLS_NAMESPACE_WRAPPER_END
771
+ #endif