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