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,889 @@
|
|
|
1
|
+
#include "../../../version.h"
|
|
2
|
+
#if (defined(RL_TOOLS_DISABLE_INCLUDE_GUARDS) || !defined(RL_TOOLS_NN_LAYERS_GRU_OPERATIONS_GENERIC_H)) && (RL_TOOLS_USE_THIS_VERSION == 1)
|
|
3
|
+
#pragma once
|
|
4
|
+
#define RL_TOOLS_NN_LAYERS_GRU_OPERATIONS_GENERIC_H
|
|
5
|
+
|
|
6
|
+
#include "layer.h"
|
|
7
|
+
#include "helper_operations_generic.h"
|
|
8
|
+
#ifdef RL_TOOLS_OPERATIONS_CPU_MUX_INCLUDE_CUDA
|
|
9
|
+
#include "helper_operations_cuda.h"
|
|
10
|
+
#endif
|
|
11
|
+
#include "../../parameters/operations_generic.h"
|
|
12
|
+
|
|
13
|
+
RL_TOOLS_NAMESPACE_WRAPPER_START
|
|
14
|
+
namespace rl_tools{
|
|
15
|
+
template <typename DEVICE, typename SPEC>
|
|
16
|
+
RL_TOOLS_FUNCTION_PLACEMENT void malloc(DEVICE& device, nn::layers::gru::LayerForward<SPEC>& layer){
|
|
17
|
+
malloc(device, layer.weights_input);
|
|
18
|
+
malloc(device, layer.biases_input);
|
|
19
|
+
malloc(device, layer.weights_hidden);
|
|
20
|
+
malloc(device, layer.biases_hidden);
|
|
21
|
+
|
|
22
|
+
malloc(device, layer.initial_hidden_state);
|
|
23
|
+
}
|
|
24
|
+
template <typename DEVICE, typename SPEC>
|
|
25
|
+
RL_TOOLS_FUNCTION_PLACEMENT void malloc(DEVICE& device, nn::layers::gru::LayerBackward<SPEC>& layer){
|
|
26
|
+
malloc(device, static_cast<nn::layers::gru::LayerForward<SPEC>&>(layer));
|
|
27
|
+
malloc(device, layer.n_pre_pre_activation);
|
|
28
|
+
malloc(device, layer.post_activation);
|
|
29
|
+
malloc(device, layer.output);
|
|
30
|
+
}
|
|
31
|
+
template <typename DEVICE, typename SPEC>
|
|
32
|
+
RL_TOOLS_FUNCTION_PLACEMENT void malloc(DEVICE& device, nn::layers::gru::buffers::Evaluation<SPEC>& buffers){
|
|
33
|
+
malloc(device, buffers.post_activation);
|
|
34
|
+
malloc(device, buffers.n_pre_pre_activation);
|
|
35
|
+
malloc(device, buffers.step_by_step_output);
|
|
36
|
+
malloc(device, buffers.previous_output_scratch);
|
|
37
|
+
}
|
|
38
|
+
template <typename DEVICE, typename SPEC>
|
|
39
|
+
RL_TOOLS_FUNCTION_PLACEMENT void free(DEVICE& device, nn::layers::gru::buffers::Evaluation<SPEC>& buffers){
|
|
40
|
+
free(device, buffers.post_activation);
|
|
41
|
+
free(device, buffers.n_pre_pre_activation);
|
|
42
|
+
free(device, buffers.step_by_step_output);
|
|
43
|
+
free(device, buffers.previous_output_scratch);
|
|
44
|
+
}
|
|
45
|
+
template <typename DEVICE, typename BUFFER_SPEC>
|
|
46
|
+
RL_TOOLS_FUNCTION_PLACEMENT void init(DEVICE& device, nn::layers::gru::buffers::Backward<BUFFER_SPEC>& buffers){
|
|
47
|
+
using SPEC = typename BUFFER_SPEC::SPEC;
|
|
48
|
+
using VIEW_SPEC_DOUBLE = tensor::ViewSpec<1, 2*SPEC::HIDDEN_DIM>;
|
|
49
|
+
buffers.buffer_rz = view_range(device, buffers.buffer, 0*SPEC::HIDDEN_DIM, VIEW_SPEC_DOUBLE{});
|
|
50
|
+
using VIEW_SPEC = tensor::ViewSpec<1, SPEC::HIDDEN_DIM>;
|
|
51
|
+
buffers.buffer_r = view_range(device, buffers.buffer, 0*SPEC::HIDDEN_DIM, VIEW_SPEC{});
|
|
52
|
+
buffers.buffer_z = view_range(device, buffers.buffer, 1*SPEC::HIDDEN_DIM, VIEW_SPEC{});
|
|
53
|
+
buffers.buffer_n = view_range(device, buffers.buffer, 2*SPEC::HIDDEN_DIM, VIEW_SPEC{});
|
|
54
|
+
}
|
|
55
|
+
template <typename DEVICE, typename SPEC>
|
|
56
|
+
RL_TOOLS_FUNCTION_PLACEMENT void malloc(DEVICE& device, nn::layers::gru::buffers::Backward<SPEC>& buffers){
|
|
57
|
+
malloc(device, static_cast<nn::layers::gru::buffers::Evaluation<SPEC>&>(buffers));
|
|
58
|
+
malloc(device, buffers.buffer);
|
|
59
|
+
malloc(device, buffers.buffer2);
|
|
60
|
+
init(device, buffers);
|
|
61
|
+
}
|
|
62
|
+
template <typename DEVICE, typename SPEC>
|
|
63
|
+
RL_TOOLS_FUNCTION_PLACEMENT void free(DEVICE& device, nn::layers::gru::buffers::Backward<SPEC>& buffer){
|
|
64
|
+
free(device, static_cast<nn::layers::gru::buffers::Evaluation<SPEC>&>(buffer));
|
|
65
|
+
free(device, buffer.buffer);
|
|
66
|
+
free(device, buffer.buffer2);
|
|
67
|
+
}
|
|
68
|
+
template <typename DEVICE, typename SPEC>
|
|
69
|
+
RL_TOOLS_FUNCTION_PLACEMENT void malloc(DEVICE& device, nn::layers::gru::State<SPEC>& state){
|
|
70
|
+
malloc(device, state.state);
|
|
71
|
+
malloc(device, state.step);
|
|
72
|
+
}
|
|
73
|
+
template <typename SOURCE_DEVICE, typename TARGET_DEVICE, typename SOURCE_SPEC, typename TARGET_SPEC>
|
|
74
|
+
RL_TOOLS_FUNCTION_PLACEMENT void copy(SOURCE_DEVICE& source_device, TARGET_DEVICE& target_device, nn::layers::gru::State<SOURCE_SPEC>& source, nn::layers::gru::State<TARGET_SPEC>& target){
|
|
75
|
+
copy(source_device, target_device, source.state, target.state);
|
|
76
|
+
copy(source_device, target_device, source.step, target.step);
|
|
77
|
+
}
|
|
78
|
+
template<typename DEVICE, typename SPEC, typename STATE_SPEC, typename MODE>
|
|
79
|
+
RL_TOOLS_FUNCTION_PLACEMENT void reset_truncate(DEVICE& device, const nn::layers::gru::LayerForward<SPEC>& layer, nn::layers::gru::State<STATE_SPEC>& state, Mode<MODE> mode = Mode<mode::Default<>>{}){
|
|
80
|
+
if constexpr(!mode::is<MODE, nn::layers::gru::NoAutoResetMode>){
|
|
81
|
+
using TI = typename DEVICE::index_t;
|
|
82
|
+
static constexpr TI BATCH_SIZE = get<0>(typename decltype(state.state)::SPEC::SHAPE{});
|
|
83
|
+
for(TI batch_i=0; batch_i < BATCH_SIZE; batch_i++){
|
|
84
|
+
if(get(device, state.step, batch_i) >= SPEC::SEQUENCE_LENGTH){
|
|
85
|
+
auto row = view(device, state.state, batch_i);
|
|
86
|
+
copy(device, device, layer.initial_hidden_state.parameters, row);
|
|
87
|
+
set(device, state.step, 0, batch_i);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
template<typename DEVICE, typename SPEC, typename STATE_SPEC, typename BASE_MODE, typename MODE_SPEC>
|
|
93
|
+
RL_TOOLS_FUNCTION_PLACEMENT void _reset_sequential(DEVICE& device, const nn::layers::gru::LayerForward<SPEC>& layer, nn::layers::gru::State<STATE_SPEC>& state, mode::sequential::ResetMask<BASE_MODE, MODE_SPEC>& mode){
|
|
94
|
+
using TI = typename DEVICE::index_t;
|
|
95
|
+
static constexpr TI BATCH_SIZE = get<0>(typename decltype(state.state)::SPEC::SHAPE{});
|
|
96
|
+
static_assert(decltype(mode.mask)::ROWS == 1 && decltype(mode.mask)::COLS == BATCH_SIZE, "The reset mask for GRU layers must have one row and one column per batch element.");
|
|
97
|
+
for(TI batch_i=0; batch_i < BATCH_SIZE; batch_i++){
|
|
98
|
+
if (get(mode.mask, 0, batch_i)) {
|
|
99
|
+
set(device, state.step, 0, batch_i);
|
|
100
|
+
auto row = view(device, state.state, batch_i);
|
|
101
|
+
copy(device, device, layer.initial_hidden_state.parameters, row);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
template<typename DEVICE, typename SPEC, typename STATE_SPEC, typename RNG, typename MODE = mode::Default<>>
|
|
106
|
+
RL_TOOLS_FUNCTION_PLACEMENT void reset(DEVICE& device, const nn::layers::gru::LayerForward<SPEC>& layer, nn::layers::gru::State<STATE_SPEC>& state, RNG&, Mode<MODE> mode = Mode<mode::Default<>>{}) {
|
|
107
|
+
using TI = typename DEVICE::index_t;
|
|
108
|
+
static constexpr TI BATCH_SIZE = get<0>(typename decltype(state.state)::SPEC::SHAPE{});
|
|
109
|
+
if constexpr(mode::is<MODE, mode::sequential::ResetMask>){
|
|
110
|
+
_reset_sequential(device, layer, state, mode);
|
|
111
|
+
}
|
|
112
|
+
else{
|
|
113
|
+
if constexpr(mode::is<MODE, mode::Default>){
|
|
114
|
+
set_all(device, state.step, 0);
|
|
115
|
+
for(TI batch_i=0; batch_i < BATCH_SIZE; batch_i++){
|
|
116
|
+
auto row = view(device, state.state, batch_i);
|
|
117
|
+
copy(device, device, layer.initial_hidden_state.parameters, row);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
else{
|
|
121
|
+
utils::assert_exit(device, false, "Unsupported mode");
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
template<typename DEVICE, typename SPEC>
|
|
126
|
+
RL_TOOLS_FUNCTION_PLACEMENT void free(DEVICE& device, nn::layers::gru::State<SPEC>& state){
|
|
127
|
+
free(device, state.state);
|
|
128
|
+
free(device, state.step);
|
|
129
|
+
}
|
|
130
|
+
template <typename DEVICE, typename SPEC, typename RNG>
|
|
131
|
+
RL_TOOLS_FUNCTION_PLACEMENT void init_weights(DEVICE& device, nn::layers::gru::LayerForward<SPEC>& l, RNG& rng){
|
|
132
|
+
// same as in PyTorch
|
|
133
|
+
using T = typename SPEC::TYPE_POLICY::DEFAULT;
|
|
134
|
+
T scale_input = 1 / math::sqrt(device.math, (T)SPEC::INPUT_DIM);
|
|
135
|
+
T scale_hidden = 1 / math::sqrt(device.math, (T)SPEC::HIDDEN_DIM);
|
|
136
|
+
rand(device, l.weights_hidden.parameters, rng, -scale_hidden, scale_hidden);
|
|
137
|
+
rand(device, l.weights_input.parameters, rng, -scale_input, scale_input);
|
|
138
|
+
rand(device, l.biases_hidden.parameters, rng, -scale_hidden, scale_hidden);
|
|
139
|
+
rand(device, l.biases_input.parameters, rng, -scale_input, scale_input);
|
|
140
|
+
set_all(device, l.initial_hidden_state.parameters, 0);
|
|
141
|
+
}
|
|
142
|
+
template<typename DEVICE, typename SPEC_1, typename SPEC_2, typename SPEC_OUTPUT>
|
|
143
|
+
RL_TOOLS_FUNCTION_PLACEMENT void multiply_broadcast_accumulate(DEVICE& device, const Tensor<SPEC_1>& t1, const Tensor<SPEC_2>& t2, Tensor<SPEC_OUTPUT>& t_output){
|
|
144
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
145
|
+
ZoneScopedN("gru::multiply_broadcast_accumulate");
|
|
146
|
+
#endif
|
|
147
|
+
static_assert(length(typename SPEC_1::SHAPE{}) == 2);
|
|
148
|
+
static_assert(length(typename SPEC_2::SHAPE{}) == 1);
|
|
149
|
+
static_assert(get<0>(typename SPEC_1::SHAPE{}) == get<0>(typename SPEC_OUTPUT::SHAPE{}));
|
|
150
|
+
static_assert(get<1>(typename SPEC_1::SHAPE{}) == get<0>(typename SPEC_2::SHAPE{}));
|
|
151
|
+
static_assert(get<1>(typename SPEC_OUTPUT::SHAPE{}) == get<1>(typename SPEC_1::SHAPE{}));
|
|
152
|
+
using TI = typename DEVICE::index_t;
|
|
153
|
+
using T = typename SPEC_1::T;
|
|
154
|
+
// for(TI i=0; i < get<0>(typename SPEC_1::SHAPE{}); i++){
|
|
155
|
+
// for(TI j=0; j < get<1>(typename SPEC_1::SHAPE{}); j++){
|
|
156
|
+
// T t1_value = get(device, t1, i, j);
|
|
157
|
+
// T t2_value = get(device, t2, j);
|
|
158
|
+
// T t_output_value = get(device, t_output, i, j);
|
|
159
|
+
// set(device, t_output, t1_value * t2_value + t_output_value, i, j);
|
|
160
|
+
// }
|
|
161
|
+
// }
|
|
162
|
+
using NEW_SHAPE = tensor::Shape<TI, SPEC_1::SHAPE::template GET<0>, SPEC_2::SHAPE::template GET<0>>;;
|
|
163
|
+
using NEW_STRIDE = tensor::Stride<TI, 0, SPEC_2::STRIDE::template GET<0>>;
|
|
164
|
+
using NEW_SPEC = tensor::Specification<typename SPEC_2::T, typename SPEC_2::TI, NEW_SHAPE, true, NEW_STRIDE, true>;
|
|
165
|
+
const Tensor<NEW_SPEC> t2_broadcasted{{data(t2)}};
|
|
166
|
+
multiply_accumulate(device, t1, t2_broadcasted, t_output);
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
namespace nn::layers::gru{
|
|
170
|
+
namespace multi_step_intermediates_tag_dispatch{ // this is required for MSVC because it complains about the slicker SFINAE-based version
|
|
171
|
+
struct three_dimensional_tag{};
|
|
172
|
+
struct two_dimensional_tag{};
|
|
173
|
+
|
|
174
|
+
template <typename SPEC>
|
|
175
|
+
struct dimension_tag{
|
|
176
|
+
using type = typename utils::typing::conditional_t<length(typename SPEC::SHAPE{})==3, three_dimensional_tag, two_dimensional_tag>;
|
|
177
|
+
};
|
|
178
|
+
template <auto BATCH_SIZE, typename DEVICE, typename SPEC>
|
|
179
|
+
RL_TOOLS_FUNCTION_PLACEMENT auto impl(DEVICE& device, Tensor<SPEC>& tensor, typename DEVICE::index_t step_i, three_dimensional_tag){
|
|
180
|
+
auto post_activation = view_range(device, tensor, 0, tensor::ViewSpec<1, BATCH_SIZE>{});
|
|
181
|
+
return view(device, post_activation, step_i);
|
|
182
|
+
}
|
|
183
|
+
template <auto BATCH_SIZE, typename DEVICE, typename SPEC>
|
|
184
|
+
RL_TOOLS_FUNCTION_PLACEMENT auto impl(DEVICE& device, Tensor<SPEC>& tensor, typename DEVICE::index_t step_i, two_dimensional_tag){
|
|
185
|
+
auto post_activation = view_range(device, tensor, 0, tensor::ViewSpec<0, BATCH_SIZE>{});
|
|
186
|
+
return post_activation;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
template <auto BATCH_SIZE, typename DEVICE, typename SPEC>
|
|
190
|
+
RL_TOOLS_FUNCTION_PLACEMENT auto multi_step_intermediates(DEVICE& device, Tensor<SPEC>& tensor, typename DEVICE::index_t step_i) {
|
|
191
|
+
return multi_step_intermediates_tag_dispatch::impl<BATCH_SIZE>(device, tensor, step_i, typename multi_step_intermediates_tag_dispatch::dimension_tag<SPEC>::type{});
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
template<typename DEVICE, typename LAYER_SPEC, typename INPUT_SPEC, typename OUTPUT_SPEC, typename POST_ACTIVATION_SPEC, typename N_PRE_PRE_ACTIVATION_SPEC, typename PREVIOUS_OUTPUT_SCRATCH, typename BUFFER_SPEC, typename RNG, typename MODE = mode::Default<>>
|
|
196
|
+
RL_TOOLS_FUNCTION_PLACEMENT void evaluate(DEVICE& device, const nn::layers::gru::LayerForward<LAYER_SPEC>& layer, const Tensor<INPUT_SPEC>& input, Tensor<POST_ACTIVATION_SPEC>& post_activation_full, Tensor<N_PRE_PRE_ACTIVATION_SPEC>& n_pre_pre_activation_full, Tensor<OUTPUT_SPEC>& output_full, Tensor<PREVIOUS_OUTPUT_SCRATCH>& previous_output_scratch_full, nn::layers::gru::buffers::Evaluation<BUFFER_SPEC>& buffers, RNG& rng, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
197
|
+
using TI = typename DEVICE::index_t;
|
|
198
|
+
constexpr TI SEQUENCE_LENGTH = get<0>(typename INPUT_SPEC::SHAPE{});
|
|
199
|
+
constexpr TI BATCH_SIZE = get<1>(typename INPUT_SPEC::SHAPE{});
|
|
200
|
+
// you can either pass post_activation and n_pre_pre_activation as intermediate tensors with steps (e.g. for "forward" to maintain the state for the backward pass) or in a purely iterative fashion
|
|
201
|
+
static_assert(nn::layers::gru::check_input_output<LAYER_SPEC, INPUT_SPEC, OUTPUT_SPEC>, "Input and output spec not matching");
|
|
202
|
+
static_assert(length(typename POST_ACTIVATION_SPEC::SHAPE{}) == 3 || length(typename POST_ACTIVATION_SPEC::SHAPE{}) == 2);
|
|
203
|
+
static_assert(length(typename N_PRE_PRE_ACTIVATION_SPEC::SHAPE{}) == 3 || length(typename N_PRE_PRE_ACTIVATION_SPEC::SHAPE{}) == 2);
|
|
204
|
+
constexpr bool MULTI_STEP_INTERMEDIATES = length(typename POST_ACTIVATION_SPEC::SHAPE{}) == 3;
|
|
205
|
+
constexpr TI BUFFER_BATCH_SIZE = get<length(typename POST_ACTIVATION_SPEC::SHAPE{})-2>(typename POST_ACTIVATION_SPEC::SHAPE{});
|
|
206
|
+
static_assert(BATCH_SIZE <= BUFFER_BATCH_SIZE);
|
|
207
|
+
static_assert(MULTI_STEP_INTERMEDIATES == (length(typename N_PRE_PRE_ACTIVATION_SPEC::SHAPE{}) == 3), "N_PRE_PRE_ACTIVATION_SPEC must have the same number of dimensions as POST_ACTIVATION_SPEC");
|
|
208
|
+
static_assert(get<length(typename POST_ACTIVATION_SPEC::SHAPE{})-1>(typename POST_ACTIVATION_SPEC::SHAPE{}) == 3*LAYER_SPEC::HIDDEN_DIM);
|
|
209
|
+
static_assert(get<length(typename POST_ACTIVATION_SPEC::SHAPE{})-2>(typename POST_ACTIVATION_SPEC::SHAPE{}) >= BATCH_SIZE);
|
|
210
|
+
static_assert(get<length(typename N_PRE_PRE_ACTIVATION_SPEC::SHAPE{})-1>(typename N_PRE_PRE_ACTIVATION_SPEC::SHAPE{}) == LAYER_SPEC::HIDDEN_DIM);
|
|
211
|
+
static_assert(get<length(typename N_PRE_PRE_ACTIVATION_SPEC::SHAPE{})-2>(typename N_PRE_PRE_ACTIVATION_SPEC::SHAPE{}) >= BATCH_SIZE);
|
|
212
|
+
|
|
213
|
+
auto previous_output_scratch = view_range(device, previous_output_scratch_full, 0, tensor::ViewSpec<0, BATCH_SIZE>{});
|
|
214
|
+
auto output = view_range(device, output_full, 0, tensor::ViewSpec<1, BATCH_SIZE>{});
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
// constexpr bool STEP_BY_STEP = mode::is<MODE, nn::layers::gru::StepByStepMode>;
|
|
218
|
+
constexpr bool CAN_RESET_SAMPLE = nn::layers::gru::mode::can_reset_sample<LAYER_SPEC>(utils::typing::remove_reference_t<decltype(mode)>{});
|
|
219
|
+
for(TI step_i=0; step_i < SEQUENCE_LENGTH; step_i++){
|
|
220
|
+
bool reset_full_batch = nn::layers::gru::mode::reset_full_batch<LAYER_SPEC>(mode) || (step_i == 0);
|
|
221
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
222
|
+
ZoneScopedN("gru::evaluate_step");
|
|
223
|
+
#endif
|
|
224
|
+
auto input_step = view(device, input, step_i);
|
|
225
|
+
auto post_activation_step = nn::layers::gru::multi_step_intermediates<BATCH_SIZE>(device, post_activation_full, step_i);
|
|
226
|
+
auto n_pre_pre_activation_step = nn::layers::gru::multi_step_intermediates<BATCH_SIZE>(device, n_pre_pre_activation_full, step_i);
|
|
227
|
+
auto output_step = view(device, output, step_i);
|
|
228
|
+
|
|
229
|
+
auto rz_post_activation = view_range(device, post_activation_step, 0*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, 2*LAYER_SPEC::HIDDEN_DIM>{});
|
|
230
|
+
auto r_post_activation = view_range(device, post_activation_step, 0*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, LAYER_SPEC::HIDDEN_DIM>{});
|
|
231
|
+
auto z_post_activation = view_range(device, post_activation_step, 1*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, LAYER_SPEC::HIDDEN_DIM>{});
|
|
232
|
+
auto n_post_activation = view_range(device, post_activation_step, 2*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, LAYER_SPEC::HIDDEN_DIM>{});
|
|
233
|
+
|
|
234
|
+
if(reset_full_batch){
|
|
235
|
+
nn::layers::gru::helper::matrix_multiply_broadcast_transpose_bias(device, layer.weights_hidden.parameters, layer.initial_hidden_state.parameters, layer.biases_hidden.parameters, post_activation_step);
|
|
236
|
+
}
|
|
237
|
+
else{
|
|
238
|
+
if constexpr(CAN_RESET_SAMPLE){
|
|
239
|
+
auto output_previous_step = view(device, output, step_i-1);
|
|
240
|
+
nn::layers::gru::helper::select_previous_output<LAYER_SPEC>(device, layer.initial_hidden_state.parameters, output_previous_step, previous_output_scratch, step_i, mode);
|
|
241
|
+
nn::layers::gru::helper::matrix_multiply_transpose_bias(device, layer.weights_hidden.parameters, previous_output_scratch, layer.biases_hidden.parameters, post_activation_step);
|
|
242
|
+
}
|
|
243
|
+
else{
|
|
244
|
+
auto output_previous_step = view(device, output, step_i-1);
|
|
245
|
+
nn::layers::gru::helper::matrix_multiply_transpose_bias(device, layer.weights_hidden.parameters, output_previous_step, layer.biases_hidden.parameters, post_activation_step);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
copy(device, device, n_post_activation, n_pre_pre_activation_step);
|
|
250
|
+
set_all(device, n_post_activation, 0);
|
|
251
|
+
|
|
252
|
+
nn::layers::gru::helper::matrix_multiply_transpose_bias_accumulate(device, layer.weights_input.parameters, input_step, layer.biases_input.parameters, post_activation_step);
|
|
253
|
+
if(LAYER_SPEC::FAST_TANH){
|
|
254
|
+
fast_sigmoid(device, rz_post_activation);
|
|
255
|
+
}
|
|
256
|
+
else{
|
|
257
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
258
|
+
ZoneScopedN("gru::evaluate_step::sigmoid");
|
|
259
|
+
#endif
|
|
260
|
+
sigmoid(device, rz_post_activation);
|
|
261
|
+
}
|
|
262
|
+
multiply_accumulate(device, n_pre_pre_activation_step, r_post_activation, n_post_activation);
|
|
263
|
+
if constexpr(LAYER_SPEC::FAST_TANH){
|
|
264
|
+
fast_tanh(device, n_post_activation);
|
|
265
|
+
}
|
|
266
|
+
else{
|
|
267
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
268
|
+
ZoneScopedN("gru::evaluate_step::tanh");
|
|
269
|
+
#endif
|
|
270
|
+
tanh(device, n_post_activation);
|
|
271
|
+
}
|
|
272
|
+
one_minus(device, z_post_activation, output_step);
|
|
273
|
+
multiply(device, n_post_activation, output_step);
|
|
274
|
+
if(reset_full_batch){
|
|
275
|
+
multiply_broadcast_accumulate(device, z_post_activation, layer.initial_hidden_state.parameters, output_step);
|
|
276
|
+
}
|
|
277
|
+
else{
|
|
278
|
+
if constexpr(CAN_RESET_SAMPLE) {
|
|
279
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
280
|
+
ZoneScopedN("gru::evaluate_step::CAN_RESET_SAMPLE_2");
|
|
281
|
+
#endif
|
|
282
|
+
// we don't need to assemble previous_output_scratch again because we know that we assembled it before already
|
|
283
|
+
multiply_accumulate(device, z_post_activation, previous_output_scratch, output_step);
|
|
284
|
+
}
|
|
285
|
+
else{
|
|
286
|
+
auto output_previous_step = view(device, output, step_i-1);
|
|
287
|
+
multiply_accumulate(device, z_post_activation, output_previous_step, output_step);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
template<typename DEVICE, typename LAYER_SPEC, typename INPUT_SPEC, typename OUTPUT_SPEC, typename BUFFER_SPEC, typename RNG, typename MODE = mode::Default<>>
|
|
293
|
+
RL_TOOLS_FUNCTION_PLACEMENT void evaluate(DEVICE& device, const nn::layers::gru::LayerForward<LAYER_SPEC>& layer, const Tensor<INPUT_SPEC>& input, Tensor<OUTPUT_SPEC>& output, nn::layers::gru::buffers::Evaluation<BUFFER_SPEC>& buffers, RNG& rng, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
294
|
+
using TI = typename DEVICE::index_t;
|
|
295
|
+
constexpr TI BATCH_SIZE = get<1>(typename INPUT_SPEC::SHAPE{});
|
|
296
|
+
evaluate(device, layer, input, buffers.post_activation, buffers.n_pre_pre_activation, output, buffers.previous_output_scratch, buffers, rng, mode);
|
|
297
|
+
}
|
|
298
|
+
template<auto BATCH_SIZE, typename DEVICE, typename LAYER_SPEC, typename STATE_SPEC, typename MODE>
|
|
299
|
+
RL_TOOLS_FUNCTION_PLACEMENT void advance_gru_step(DEVICE& device, const nn::layers::gru::LayerForward<LAYER_SPEC>& layer, nn::layers::gru::State<STATE_SPEC>& state, const Mode<MODE>&){
|
|
300
|
+
using TI = typename DEVICE::index_t;
|
|
301
|
+
if constexpr(mode::is<MODE, nn::layers::gru::NoAutoResetMode>){
|
|
302
|
+
increment(device, state.step);
|
|
303
|
+
}
|
|
304
|
+
else{
|
|
305
|
+
for(TI batch_i = 0; batch_i < BATCH_SIZE; batch_i++){
|
|
306
|
+
TI new_step = get(device, state.step, batch_i) + 1;
|
|
307
|
+
if(new_step >= LAYER_SPEC::SEQUENCE_LENGTH){
|
|
308
|
+
new_step = 0;
|
|
309
|
+
auto row = view(device, state.state, batch_i);
|
|
310
|
+
copy(device, device, layer.initial_hidden_state.parameters, row);
|
|
311
|
+
}
|
|
312
|
+
set(device, state.step, new_step, batch_i);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
template<typename DEVICE, typename LAYER_SPEC, typename INPUT_SPEC, typename STATE_SPEC, typename OUTPUT_SPEC, typename BUFFER_SPEC, typename RNG, typename MODE = mode::Default<>>
|
|
317
|
+
RL_TOOLS_FUNCTION_PLACEMENT void evaluate_step(DEVICE& device, const nn::layers::gru::LayerForward<LAYER_SPEC>& layer, const Tensor<INPUT_SPEC>& input, typename nn::layers::gru::State<STATE_SPEC>& state, Tensor<OUTPUT_SPEC>& output, nn::layers::gru::buffers::Evaluation<BUFFER_SPEC>& buffers, RNG& rng, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
318
|
+
using TI = typename DEVICE::index_t;
|
|
319
|
+
static_assert(length(typename INPUT_SPEC::SHAPE{}) == 2, "evaluate_step does not have a squence dimension (only batch_size x input_dim)");
|
|
320
|
+
static_assert(length(typename OUTPUT_SPEC::SHAPE{}) == 2);
|
|
321
|
+
constexpr TI BATCH_SIZE = get<0>(typename INPUT_SPEC::SHAPE{});
|
|
322
|
+
auto previous_output_scratch = view_range(device, buffers.previous_output_scratch, 0, tensor::ViewSpec<0, BATCH_SIZE>{});
|
|
323
|
+
auto relevant_state = view_range(device, state.state, 0, tensor::ViewSpec<0, BATCH_SIZE>{});
|
|
324
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
325
|
+
ZoneScopedN("gru::evaluate_step");
|
|
326
|
+
#endif
|
|
327
|
+
auto input_step = input;
|
|
328
|
+
auto output_step = output;
|
|
329
|
+
|
|
330
|
+
reset_truncate(device, layer, state, mode);
|
|
331
|
+
|
|
332
|
+
auto post_activation_batch = view_range(device, buffers.post_activation, 0, tensor::ViewSpec<0, BATCH_SIZE>{});
|
|
333
|
+
auto n_pre_pre_activation_batch = view_range(device, buffers.n_pre_pre_activation, 0, tensor::ViewSpec<0, BATCH_SIZE>{});
|
|
334
|
+
|
|
335
|
+
auto rz_post_activation = view_range(device, post_activation_batch, 0*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, 2*LAYER_SPEC::HIDDEN_DIM>{});
|
|
336
|
+
auto r_post_activation = view_range(device, post_activation_batch, 0*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, LAYER_SPEC::HIDDEN_DIM>{});
|
|
337
|
+
auto z_post_activation = view_range(device, post_activation_batch, 1*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, LAYER_SPEC::HIDDEN_DIM>{});
|
|
338
|
+
auto n_post_activation = view_range(device, post_activation_batch, 2*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, LAYER_SPEC::HIDDEN_DIM>{});
|
|
339
|
+
|
|
340
|
+
copy(device, device, relevant_state, previous_output_scratch);
|
|
341
|
+
nn::layers::gru::helper::matrix_multiply_transpose_bias(device, layer.weights_hidden.parameters, relevant_state, layer.biases_hidden.parameters, post_activation_batch);
|
|
342
|
+
|
|
343
|
+
copy(device, device, n_post_activation, n_pre_pre_activation_batch);
|
|
344
|
+
set_all(device, n_post_activation, 0);
|
|
345
|
+
|
|
346
|
+
nn::layers::gru::helper::matrix_multiply_transpose_bias_accumulate(device, layer.weights_input.parameters, input_step, layer.biases_input.parameters, post_activation_batch);
|
|
347
|
+
if(LAYER_SPEC::FAST_TANH){
|
|
348
|
+
fast_sigmoid(device, rz_post_activation);
|
|
349
|
+
}
|
|
350
|
+
else{
|
|
351
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
352
|
+
ZoneScopedN("gru::evaluate_step::sigmoid");
|
|
353
|
+
#endif
|
|
354
|
+
sigmoid(device, rz_post_activation);
|
|
355
|
+
}
|
|
356
|
+
multiply_accumulate(device, n_pre_pre_activation_batch, r_post_activation, n_post_activation);
|
|
357
|
+
if constexpr(LAYER_SPEC::FAST_TANH){
|
|
358
|
+
fast_tanh(device, n_post_activation);
|
|
359
|
+
}
|
|
360
|
+
else{
|
|
361
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
362
|
+
ZoneScopedN("gru::evaluate_step::tanh");
|
|
363
|
+
#endif
|
|
364
|
+
tanh(device, n_post_activation);
|
|
365
|
+
}
|
|
366
|
+
one_minus(device, z_post_activation, output_step);
|
|
367
|
+
static_assert(length(typename decltype(z_post_activation)::SPEC::SHAPE{}) == 2);
|
|
368
|
+
static_assert(length(typename decltype(output_step)::SPEC::SHAPE{}) == 2);
|
|
369
|
+
static_assert(get<0>(typename decltype(z_post_activation)::SPEC::SHAPE{}) == get<0>(typename decltype(output_step)::SPEC::SHAPE{}));
|
|
370
|
+
static_assert(get<1>(typename decltype(z_post_activation)::SPEC::SHAPE{}) == get<1>(typename decltype(output_step)::SPEC::SHAPE{}));
|
|
371
|
+
multiply(device, n_post_activation, output_step);
|
|
372
|
+
multiply_accumulate(device, z_post_activation, previous_output_scratch, output_step);
|
|
373
|
+
copy(device, device, output_step, relevant_state);
|
|
374
|
+
advance_gru_step<BATCH_SIZE>(device, layer, state, mode);
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
template<typename DEVICE, typename LAYER_SPEC, typename INPUT_SPEC, typename RNG, typename BUFFER_SPEC, typename MODE = mode::Default<>>
|
|
378
|
+
RL_TOOLS_FUNCTION_PLACEMENT void forward(DEVICE& device, nn::layers::gru::LayerBackward<LAYER_SPEC>& layer, const Tensor<INPUT_SPEC>& input, nn::layers::gru::buffers::Evaluation<BUFFER_SPEC>& buffers, RNG& rng, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
379
|
+
evaluate(device, layer, input, layer.post_activation, layer.n_pre_pre_activation, layer.output, buffers.previous_output_scratch, buffers, rng, mode);
|
|
380
|
+
}
|
|
381
|
+
template<typename DEVICE, typename SPEC_FACTOR, typename SPEC_1, typename SPEC_2, typename SPEC_OUTPUT>
|
|
382
|
+
RL_TOOLS_FUNCTION_PLACEMENT void multiply_subtract_broadcast(DEVICE& device, Tensor<SPEC_FACTOR>& factor, Tensor<SPEC_1>& t1, Tensor<SPEC_2>& t2, Tensor<SPEC_OUTPUT>& t_output) {
|
|
383
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
384
|
+
ZoneScopedN("gru::multiply_subtract_broadcast");
|
|
385
|
+
#endif
|
|
386
|
+
// broadcast t1 along first dimension
|
|
387
|
+
static_assert(length(typename SPEC_FACTOR::SHAPE{}) == 2);
|
|
388
|
+
static_assert(get<0>(typename SPEC_FACTOR::SHAPE{}) == get<0>(typename SPEC_2::SHAPE{}));
|
|
389
|
+
static_assert(get<1>(typename SPEC_FACTOR::SHAPE{}) == get<1>(typename SPEC_2::SHAPE{}));
|
|
390
|
+
static_assert(length(typename SPEC_1::SHAPE{}) == 1);
|
|
391
|
+
static_assert(length(typename SPEC_2::SHAPE{}) == 2);
|
|
392
|
+
static_assert(get<0>(typename SPEC_2::SHAPE{}) == get<0>(typename SPEC_OUTPUT::SHAPE{}));
|
|
393
|
+
static_assert(get<0>(typename SPEC_1::SHAPE{}) == get<1>(typename SPEC_2::SHAPE{}));
|
|
394
|
+
static_assert(get<1>(typename SPEC_OUTPUT::SHAPE{}) == get<1>(typename SPEC_2::SHAPE{}));
|
|
395
|
+
using TI = typename DEVICE::index_t;
|
|
396
|
+
using T = typename SPEC_1::T;
|
|
397
|
+
for(TI i=0; i < get<0>(typename SPEC_2::SHAPE{}); i++){
|
|
398
|
+
for(TI j=0; j < get<1>(typename SPEC_2::SHAPE{}); j++){
|
|
399
|
+
T factor_value = get(device, factor, i, j);
|
|
400
|
+
T t1_value = get(device, t1, j);
|
|
401
|
+
T t2_value = get(device, t2, i, j);
|
|
402
|
+
set(device, t_output, factor_value*(t1_value - t2_value), i, j);
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
namespace tensor::operations::ternary{
|
|
407
|
+
template <typename T>
|
|
408
|
+
struct MultiplySubtract: Operation{
|
|
409
|
+
template <typename DEVICE, typename T_T>
|
|
410
|
+
RL_TOOLS_FUNCTION_PLACEMENT T_T static operation(DEVICE& device, const MultiplySubtract<T_T>& parameter, T_T factor, T_T a, T_T b){
|
|
411
|
+
return factor * (a-b);
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
}
|
|
415
|
+
template<typename DEVICE, typename SPEC_FACTOR, typename SPEC_1, typename SPEC_2, typename SPEC_OUT>
|
|
416
|
+
RL_TOOLS_FUNCTION_PLACEMENT void multiply_subtract(DEVICE& device, Tensor<SPEC_FACTOR>& factor, Tensor<SPEC_1>& t1, Tensor<SPEC_2>& t2, Tensor<SPEC_OUT>& result){
|
|
417
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
418
|
+
ZoneScopedN("gru::multiply_subtract");
|
|
419
|
+
#endif
|
|
420
|
+
ternary_operation(device, tensor::operations::ternary::MultiplySubtract<typename SPEC_1::T>{}, factor, t1, t2, result);
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
#ifndef RL_TOOLS_NN_DISABLE_GENERIC_FORWARD_BACKWARD
|
|
424
|
+
template<typename DEVICE, typename SPEC_1, typename SPEC_2, typename SPEC_OUT>
|
|
425
|
+
RL_TOOLS_FUNCTION_PLACEMENT void matrix_multiply_broadcast_accumulate(DEVICE& device, Tensor<SPEC_1>& t1, Tensor<SPEC_2>& t2, Tensor<SPEC_OUT>& result){
|
|
426
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
427
|
+
ZoneScopedN("gru::matrix_multiply_broadcast_accumulate");
|
|
428
|
+
#endif
|
|
429
|
+
static_assert(length(typename SPEC_1::SHAPE{}) == 2);
|
|
430
|
+
static_assert(length(typename SPEC_2::SHAPE{}) == 1);
|
|
431
|
+
static_assert(length(typename SPEC_OUT::SHAPE{}) == 2);
|
|
432
|
+
static_assert(get<0>(typename SPEC_1::SHAPE{}) == get<0>(typename SPEC_OUT::SHAPE{}));
|
|
433
|
+
static_assert(get<0>(typename SPEC_2::SHAPE{}) == get<1>(typename SPEC_OUT::SHAPE{}));
|
|
434
|
+
using T = typename SPEC_1::T;
|
|
435
|
+
using TI = typename DEVICE::index_t;
|
|
436
|
+
for(TI row_i=0; row_i < get<0>(typename SPEC_1::SHAPE{}); ++row_i){
|
|
437
|
+
for(TI col_j=0; col_j < get<0>(typename SPEC_2::SHAPE{}); ++col_j){
|
|
438
|
+
T acc = get(device, result, row_i, col_j);
|
|
439
|
+
T t2_value = get(device, t2, col_j);
|
|
440
|
+
for(TI k=0; k < get<1>(typename SPEC_1::SHAPE{}); ++k){
|
|
441
|
+
acc += get(device, t1, row_i, k) * t2_value;
|
|
442
|
+
}
|
|
443
|
+
set(device, result, acc, row_i, col_j);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
template<typename DEVICE, typename SPEC_1, typename SPEC_2, typename SPEC_OUT>
|
|
448
|
+
RL_TOOLS_FUNCTION_PLACEMENT void matrix_multiply_accumulate_reduce(DEVICE& device, const Tensor<SPEC_1>& t1, const Tensor<SPEC_2>& t2, Tensor<SPEC_OUT>& result){
|
|
449
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
450
|
+
ZoneScopedN("gru::matrix_multiply_accumulate_reduce");
|
|
451
|
+
#endif
|
|
452
|
+
static_assert(length(typename SPEC_1::SHAPE{}) == 2);
|
|
453
|
+
static_assert(length(typename SPEC_2::SHAPE{}) == 2);
|
|
454
|
+
static_assert(length(typename SPEC_OUT::SHAPE{}) == 1);
|
|
455
|
+
static_assert(get<1>(typename SPEC_1::SHAPE{}) == get<0>(typename SPEC_2::SHAPE{}));
|
|
456
|
+
static_assert(get<1>(typename SPEC_2::SHAPE{}) == get<0>(typename SPEC_OUT::SHAPE{}));
|
|
457
|
+
using T = typename SPEC_1::T;
|
|
458
|
+
using TI = typename DEVICE::index_t;
|
|
459
|
+
for(TI row_i=0; row_i < get<0>(typename SPEC_1::SHAPE{}); ++row_i){
|
|
460
|
+
for(TI col_j=0; col_j < get<1>(typename SPEC_2::SHAPE{}); ++col_j){
|
|
461
|
+
T acc = get(device, result, col_j);
|
|
462
|
+
for(TI k=0; k < get<1>(typename SPEC_1::SHAPE{}); ++k){
|
|
463
|
+
acc += get(device, t1, row_i, k) * get(device, t2, k, col_j);
|
|
464
|
+
}
|
|
465
|
+
set(device, result, acc, col_j);
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
#endif
|
|
470
|
+
template<typename DEVICE, typename SPEC_1, typename SPEC_2, typename SPEC_OUTPUT>
|
|
471
|
+
RL_TOOLS_FUNCTION_PLACEMENT void multiply_accumulate_reduce(DEVICE& device, Tensor<SPEC_1>& t1, Tensor<SPEC_2>& t2, Tensor<SPEC_OUTPUT>& t_output){
|
|
472
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
473
|
+
ZoneScopedN("gru::multiply_accumulate_reduce");
|
|
474
|
+
#endif
|
|
475
|
+
static_assert(length(typename SPEC_1::SHAPE{}) == 2);
|
|
476
|
+
static_assert(length(typename SPEC_2::SHAPE{}) == 2);
|
|
477
|
+
static_assert(length(typename SPEC_OUTPUT::SHAPE{}) == 1);
|
|
478
|
+
static_assert(get<0>(typename SPEC_1::SHAPE{}) == get<0>(typename SPEC_2::SHAPE{}));
|
|
479
|
+
static_assert(get<1>(typename SPEC_1::SHAPE{}) == get<1>(typename SPEC_2::SHAPE{}));
|
|
480
|
+
static_assert(get<1>(typename SPEC_2::SHAPE{}) == get<0>(typename SPEC_OUTPUT::SHAPE{}));
|
|
481
|
+
using T = typename SPEC_1::T;
|
|
482
|
+
using TI = typename DEVICE::index_t;
|
|
483
|
+
for(TI row_i=0; row_i < get<0>(typename SPEC_1::SHAPE{}); ++row_i){
|
|
484
|
+
for(TI col_j=0; col_j < get<1>(typename SPEC_1::SHAPE{}); ++col_j){
|
|
485
|
+
T increment = get(device, t1, row_i, col_j) * get(device, t2, row_i, col_j);
|
|
486
|
+
set(device, t_output, get(device, t_output, col_j) + increment, col_j);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
template<typename DEVICE, typename SPEC>
|
|
491
|
+
RL_TOOLS_FUNCTION_PLACEMENT void zero_gradient(DEVICE& device, nn::layers::gru::LayerGradient<SPEC>& layer) {
|
|
492
|
+
zero_gradient(device, layer.weights_input);
|
|
493
|
+
zero_gradient(device, layer.biases_input);
|
|
494
|
+
zero_gradient(device, layer.weights_hidden);
|
|
495
|
+
zero_gradient(device, layer.biases_hidden);
|
|
496
|
+
zero_gradient(device, layer.initial_hidden_state);
|
|
497
|
+
}
|
|
498
|
+
template<typename DEVICE, typename SOURCE_SPEC, typename TARGET_SPEC>
|
|
499
|
+
RL_TOOLS_FUNCTION_PLACEMENT void add_gradient(DEVICE& device, nn::layers::gru::LayerGradient<SOURCE_SPEC>& source, nn::layers::gru::LayerGradient<TARGET_SPEC>& target) {
|
|
500
|
+
add_gradient(device, source.weights_input, target.weights_input);
|
|
501
|
+
add_gradient(device, source.biases_input, target.biases_input);
|
|
502
|
+
add_gradient(device, source.weights_hidden, target.weights_hidden);
|
|
503
|
+
add_gradient(device, source.biases_hidden, target.biases_hidden);
|
|
504
|
+
add_gradient(device, source.initial_hidden_state, target.initial_hidden_state);
|
|
505
|
+
}
|
|
506
|
+
template<typename SOURCE_DEVICE, typename TARGET_DEVICE, typename SOURCE_SPEC, typename TARGET_SPEC>
|
|
507
|
+
RL_TOOLS_FUNCTION_PLACEMENT void copy_gradient(SOURCE_DEVICE& source_device, TARGET_DEVICE& target_device, const nn::layers::gru::LayerGradient<SOURCE_SPEC>& source, nn::layers::gru::LayerGradient<TARGET_SPEC>& target) {
|
|
508
|
+
copy_gradient(source_device, target_device, source.weights_input, target.weights_input);
|
|
509
|
+
copy_gradient(source_device, target_device, source.biases_input, target.biases_input);
|
|
510
|
+
copy_gradient(source_device, target_device, source.weights_hidden, target.weights_hidden);
|
|
511
|
+
copy_gradient(source_device, target_device, source.biases_hidden, target.biases_hidden);
|
|
512
|
+
copy_gradient(source_device, target_device, source.initial_hidden_state, target.initial_hidden_state);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
template<typename DEVICE, typename SPEC, typename OPTIMIZER>
|
|
516
|
+
RL_TOOLS_FUNCTION_PLACEMENT void update(DEVICE& device, nn::layers::gru::LayerGradient<SPEC>& layer, OPTIMIZER& optimizer){
|
|
517
|
+
update(device, layer.weights_input, optimizer);
|
|
518
|
+
update(device, layer.biases_input, optimizer);
|
|
519
|
+
update(device, layer.weights_hidden, optimizer);
|
|
520
|
+
update(device, layer.biases_hidden, optimizer);
|
|
521
|
+
update(device, layer.initial_hidden_state, optimizer);
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
template<typename DEVICE, typename SPEC, typename OPTIMIZER>
|
|
525
|
+
RL_TOOLS_FUNCTION_PLACEMENT void _reset_optimizer_state(DEVICE& device, nn::layers::gru::LayerGradient<SPEC>& layer, OPTIMIZER& optimizer) {
|
|
526
|
+
_reset_optimizer_state(device, layer.weights_input, optimizer);
|
|
527
|
+
_reset_optimizer_state(device, layer.biases_input, optimizer);
|
|
528
|
+
_reset_optimizer_state(device, layer.weights_hidden, optimizer);
|
|
529
|
+
_reset_optimizer_state(device, layer.biases_hidden, optimizer);
|
|
530
|
+
_reset_optimizer_state(device, layer.initial_hidden_state, optimizer);
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
namespace tensor::operations::ternary{
|
|
534
|
+
// template <typename T>
|
|
535
|
+
// T multiply_one_minus_times_d_tanh_post_activation(T factor, T one_minus, T tanh_post_activation){
|
|
536
|
+
// return factor * (1-one_minus) * (1-tanh_post_activation*tanh_post_activation);
|
|
537
|
+
// }
|
|
538
|
+
template <typename T>
|
|
539
|
+
struct MultiplyOneMinusTimesDTanhPostActivation: Operation{
|
|
540
|
+
template <typename DEVICE, typename T_T>
|
|
541
|
+
RL_TOOLS_FUNCTION_PLACEMENT T_T static operation(DEVICE& device, const MultiplyOneMinusTimesDTanhPostActivation<T_T>& parameter, T_T factor, T_T one_minus, T_T tanh_post_activation){
|
|
542
|
+
return factor * (1-one_minus) * (1-tanh_post_activation*tanh_post_activation);
|
|
543
|
+
}
|
|
544
|
+
};
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
template<typename DEVICE, typename SPEC_FACTOR, typename SPEC_OM, typename SPEC_TANH, typename SPEC_RESULT>
|
|
548
|
+
RL_TOOLS_FUNCTION_PLACEMENT void multiply_one_minus_times_d_tanh_post_activation(DEVICE& device, Tensor<SPEC_FACTOR>& factor, Tensor<SPEC_OM>& one_minus, Tensor<SPEC_TANH>& tanh_post_activation, Tensor<SPEC_RESULT>& result){
|
|
549
|
+
using T = typename SPEC_FACTOR::T;
|
|
550
|
+
using PARAMETER = T;
|
|
551
|
+
tensor::operations::ternary::MultiplyOneMinusTimesDTanhPostActivation<T> op{};
|
|
552
|
+
ternary_operation(device, op, factor, one_minus, tanh_post_activation, result);
|
|
553
|
+
}
|
|
554
|
+
namespace tensor::operations::binary{
|
|
555
|
+
struct MultiplyDSigmoidPostActivation{
|
|
556
|
+
template <typename DEVICE, typename T_T>
|
|
557
|
+
RL_TOOLS_FUNCTION_PLACEMENT static T_T operation(DEVICE& device, const MultiplyDSigmoidPostActivation& parameters, T_T factor, T_T post_activation){
|
|
558
|
+
return factor * post_activation * (1-post_activation);
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
template<typename DEVICE, typename SPEC_FACTOR, typename SPEC_PA, typename SPEC_RESULT>
|
|
563
|
+
RL_TOOLS_FUNCTION_PLACEMENT void multiply_d_sigmoid_post_activation(DEVICE& device, Tensor<SPEC_FACTOR>& factor, Tensor<SPEC_PA>& pre_activation, Tensor<SPEC_RESULT>& result){
|
|
564
|
+
using T = typename SPEC_FACTOR::T;
|
|
565
|
+
tensor::operations::binary::MultiplyDSigmoidPostActivation op{};
|
|
566
|
+
binary_operation(device, op, factor, pre_activation, result);
|
|
567
|
+
}
|
|
568
|
+
|
|
569
|
+
template<bool CALCULATE_D_INPUT, bool CALCULATE_D_PARAMETERS, typename DEVICE, typename LAYER_SPEC, typename INPUT_SPEC, typename D_OUTPUT_SPEC, typename D_INPUT_SPEC, typename BUFFER_SPEC, typename MODE = mode::Default<>>
|
|
570
|
+
RL_TOOLS_FUNCTION_PLACEMENT void _backward(DEVICE& device, nn::layers::gru::LayerGradient<LAYER_SPEC>& layer, const Tensor<INPUT_SPEC>& input, Tensor<D_OUTPUT_SPEC>& d_output, Tensor<D_INPUT_SPEC>& d_input, nn::layers::gru::buffers::Backward<BUFFER_SPEC>& buffers, typename DEVICE::index_t step_i, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
571
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
572
|
+
ZoneScopedN("gru::_backward_step");
|
|
573
|
+
#endif
|
|
574
|
+
// call with backward<false> to disable d_input calculation
|
|
575
|
+
// warning: this modifies d_output!
|
|
576
|
+
static_assert(tensor::same_dimensions<typename decltype(layer.output)::SPEC, D_OUTPUT_SPEC>());
|
|
577
|
+
static_assert(tensor::same_dimensions<INPUT_SPEC, D_INPUT_SPEC>());
|
|
578
|
+
static_assert(nn::layers::gru::check_input_output<LAYER_SPEC, INPUT_SPEC, typename decltype(layer.output)::SPEC>, "Input and output spec not matching");
|
|
579
|
+
using TI = typename DEVICE::index_t;
|
|
580
|
+
constexpr TI BATCH_SIZE = get<1>(typename INPUT_SPEC::SHAPE{});
|
|
581
|
+
auto input_step = view(device, input, step_i);
|
|
582
|
+
auto n_pre_pre_activation_step = view(device, layer.n_pre_pre_activation, step_i);
|
|
583
|
+
auto post_activation_step = view(device, layer.post_activation, step_i);
|
|
584
|
+
auto d_output_step = view(device, d_output, step_i);
|
|
585
|
+
auto d_input_step = view(device, d_input, step_i);
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
auto rz_post_activation = view_range(device, post_activation_step, 0*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, 2*LAYER_SPEC::HIDDEN_DIM>{});
|
|
589
|
+
auto r_post_activation = view_range(device, post_activation_step, 0*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, LAYER_SPEC::HIDDEN_DIM>{});
|
|
590
|
+
auto z_post_activation = view_range(device, post_activation_step, 1*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, LAYER_SPEC::HIDDEN_DIM>{});
|
|
591
|
+
auto n_post_activation = view_range(device, post_activation_step, 2*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<1, LAYER_SPEC::HIDDEN_DIM>{});
|
|
592
|
+
|
|
593
|
+
constexpr bool CAN_RESET_SAMPLE = nn::layers::gru::mode::can_reset_sample<LAYER_SPEC>(utils::typing::remove_reference_t<decltype(mode)>{});
|
|
594
|
+
bool reset_full_batch = nn::layers::gru::mode::reset_full_batch<LAYER_SPEC>(mode) || step_i == 0;
|
|
595
|
+
if(reset_full_batch){
|
|
596
|
+
multiply_subtract_broadcast(device, d_output_step, layer.initial_hidden_state.parameters, n_post_activation, buffers.buffer_z);
|
|
597
|
+
if constexpr (CALCULATE_D_PARAMETERS && LAYER_SPEC::LEARN_INITIAL_HIDDEN_STATE){
|
|
598
|
+
auto d_output_previous_step = layer.initial_hidden_state.gradient;
|
|
599
|
+
multiply_accumulate_reduce(device, d_output_step, z_post_activation, d_output_previous_step);
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
else{
|
|
603
|
+
if constexpr(CAN_RESET_SAMPLE){
|
|
604
|
+
auto output_previous_step = view(device, layer.output, step_i-1);
|
|
605
|
+
nn::layers::gru::helper::select_previous_output<LAYER_SPEC>(device, layer.initial_hidden_state.parameters, output_previous_step, buffers.previous_output_scratch, step_i, mode);
|
|
606
|
+
auto d_output_previous_step = view(device, d_output, step_i-1);
|
|
607
|
+
nn::layers::gru::helper::multiply_accumulate_d_output_previous_step<LAYER_SPEC, CALCULATE_D_PARAMETERS && LAYER_SPEC::LEARN_INITIAL_HIDDEN_STATE>(device, d_output_step, z_post_activation, d_output_previous_step, layer.initial_hidden_state.gradient, step_i, mode);
|
|
608
|
+
multiply_subtract(device, d_output_step, buffers.previous_output_scratch, n_post_activation, buffers.buffer_z);
|
|
609
|
+
}
|
|
610
|
+
else{
|
|
611
|
+
auto output_previous_step = view(device, layer.output, step_i-1);
|
|
612
|
+
multiply_subtract(device, d_output_step, output_previous_step, n_post_activation, buffers.buffer_z);
|
|
613
|
+
auto d_output_previous_step = view(device, d_output, step_i-1);
|
|
614
|
+
multiply_accumulate(device, d_output_step, z_post_activation, d_output_previous_step);
|
|
615
|
+
}
|
|
616
|
+
}
|
|
617
|
+
multiply_one_minus_times_d_tanh_post_activation(device, d_output_step, z_post_activation, n_post_activation, buffers.buffer_n);
|
|
618
|
+
multiply(device, buffers.buffer_n, n_pre_pre_activation_step, buffers.buffer_r);
|
|
619
|
+
multiply_d_sigmoid_post_activation(device, buffers.buffer_rz, rz_post_activation, buffers.buffer_rz);
|
|
620
|
+
auto buffer_transpose = permute(device, buffers.buffer, tensor::PermutationSpec<1, 0>{});
|
|
621
|
+
static_assert(decltype(buffer_transpose)::SPEC::SIZE == decltype(buffers.buffer)::SPEC::SIZE);
|
|
622
|
+
if constexpr(CALCULATE_D_PARAMETERS){
|
|
623
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
624
|
+
ZoneScopedN("gru::CALCULATE_D_PARAMETERS::weights_input");
|
|
625
|
+
#endif
|
|
626
|
+
matrix_multiply_accumulate(device, buffer_transpose, input_step, layer.weights_input.gradient);
|
|
627
|
+
reduce_sum<true>(device, buffer_transpose, layer.biases_input.gradient);
|
|
628
|
+
auto b_irz_grad = view_range(device, layer.biases_input.gradient, 0*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<0, 2*LAYER_SPEC::HIDDEN_DIM>{});
|
|
629
|
+
auto b_hrz_grad = view_range(device, layer.biases_hidden.gradient, 0*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<0, 2*LAYER_SPEC::HIDDEN_DIM>{});
|
|
630
|
+
copy(device, device, b_irz_grad, b_hrz_grad);
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
if constexpr(CALCULATE_D_INPUT){
|
|
634
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
635
|
+
ZoneScopedN("gru::CALCULATE_D_INPUT::d_input");
|
|
636
|
+
#endif
|
|
637
|
+
matrix_multiply(device, buffers.buffer, layer.weights_input.parameters, d_input_step);
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
multiply(device, r_post_activation, buffers.buffer_n);
|
|
641
|
+
|
|
642
|
+
if(reset_full_batch){
|
|
643
|
+
if constexpr(CALCULATE_D_PARAMETERS){
|
|
644
|
+
matrix_multiply_broadcast_accumulate(device, buffer_transpose, layer.initial_hidden_state.parameters, layer.weights_hidden.gradient);
|
|
645
|
+
if constexpr(LAYER_SPEC::LEARN_INITIAL_HIDDEN_STATE){
|
|
646
|
+
matrix_multiply_accumulate_reduce(device, buffers.buffer, layer.weights_hidden.parameters, layer.initial_hidden_state.gradient);
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
else{
|
|
651
|
+
if constexpr(CAN_RESET_SAMPLE){
|
|
652
|
+
if constexpr(CALCULATE_D_PARAMETERS){
|
|
653
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
654
|
+
ZoneScopedN("gru::CAN_RESET_SAMPLE::d_weights_hidden");
|
|
655
|
+
#endif
|
|
656
|
+
auto output_previous_step = buffers.previous_output_scratch;
|
|
657
|
+
matrix_multiply_accumulate(device, buffer_transpose, output_previous_step, layer.weights_hidden.gradient);
|
|
658
|
+
}
|
|
659
|
+
auto d_output_previous_step = view(device, d_output, step_i-1);
|
|
660
|
+
if constexpr(CALCULATE_D_PARAMETERS && LAYER_SPEC::LEARN_INITIAL_HIDDEN_STATE){
|
|
661
|
+
copy(device, device, buffers.buffer, buffers.buffer2);
|
|
662
|
+
}
|
|
663
|
+
nn::layers::gru::helper::zero_reset_samples<LAYER_SPEC>(device, buffers.buffer, step_i, mode);
|
|
664
|
+
if constexpr(CALCULATE_D_PARAMETERS && LAYER_SPEC::LEARN_INITIAL_HIDDEN_STATE){
|
|
665
|
+
nn::layers::gru::helper::zero_continuing_samples<LAYER_SPEC>(device, buffers.buffer2, step_i, mode);
|
|
666
|
+
}
|
|
667
|
+
matrix_multiply_accumulate(device, buffers.buffer, layer.weights_hidden.parameters, d_output_previous_step);
|
|
668
|
+
if constexpr(CALCULATE_D_PARAMETERS && LAYER_SPEC::LEARN_INITIAL_HIDDEN_STATE){
|
|
669
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
670
|
+
ZoneScopedN("gru::CAN_RESET_SAMPLE::matrix_multiply_accumulate_reduce");
|
|
671
|
+
#endif
|
|
672
|
+
matrix_multiply_accumulate_reduce(device, buffers.buffer2, layer.weights_hidden.parameters, layer.initial_hidden_state.gradient);
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
else{
|
|
676
|
+
if constexpr(CALCULATE_D_PARAMETERS){
|
|
677
|
+
auto output_previous_step = view(device, layer.output, step_i-1);
|
|
678
|
+
matrix_multiply_accumulate(device, buffer_transpose, output_previous_step, layer.weights_hidden.gradient);
|
|
679
|
+
}
|
|
680
|
+
auto d_output_previous_step = view(device, d_output, step_i-1);
|
|
681
|
+
matrix_multiply_accumulate(device, buffers.buffer, layer.weights_hidden.parameters, d_output_previous_step);
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
if constexpr(CALCULATE_D_PARAMETERS){
|
|
686
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
687
|
+
ZoneScopedN("gru::CAN_RESET_SAMPLE::d_hn_grad");
|
|
688
|
+
#endif
|
|
689
|
+
auto b_hn_grad = view_range(device, layer.biases_hidden.gradient, 2*LAYER_SPEC::HIDDEN_DIM, tensor::ViewSpec<0, LAYER_SPEC::HIDDEN_DIM>{});
|
|
690
|
+
auto buffer_n_transpose = permute(device, buffers.buffer_n, tensor::PermutationSpec<1, 0>{});
|
|
691
|
+
reduce_sum<true>(device, buffer_n_transpose, b_hn_grad);
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
template<bool CALCULATE_D_INPUT, bool CALCULATE_D_PARAMETERS, typename DEVICE, typename LAYER_SPEC, typename INPUT_SPEC, typename D_OUTPUT_SPEC, typename D_INPUT_SPEC, typename BUFFER_SPEC, typename MODE = mode::Default<>>
|
|
695
|
+
RL_TOOLS_FUNCTION_PLACEMENT void _backward(DEVICE& device, nn::layers::gru::LayerGradient<LAYER_SPEC>& layer, const Tensor<INPUT_SPEC>& input, Tensor<D_OUTPUT_SPEC>& d_output, Tensor<D_INPUT_SPEC>& d_input, nn::layers::gru::buffers::Backward<BUFFER_SPEC>& buffers, const Mode<MODE>& mode){
|
|
696
|
+
using TI = typename DEVICE::index_t;
|
|
697
|
+
for(TI step_i=LAYER_SPEC::SEQUENCE_LENGTH-1; true; step_i--){
|
|
698
|
+
_backward<CALCULATE_D_INPUT, CALCULATE_D_PARAMETERS>(device, layer, input, d_output, d_input, buffers, step_i, mode);
|
|
699
|
+
if(step_i == 0){
|
|
700
|
+
break;
|
|
701
|
+
}
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
template<typename DEVICE, typename LAYER_SPEC, typename INPUT_SPEC, typename D_OUTPUT_SPEC, typename D_INPUT_SPEC, typename BUFFER_SPEC, typename MODE = mode::Default<>>
|
|
705
|
+
RL_TOOLS_FUNCTION_PLACEMENT void backward_full(DEVICE& device, nn::layers::gru::LayerGradient<LAYER_SPEC>& layer, const Tensor<INPUT_SPEC>& input, Tensor<D_OUTPUT_SPEC>& d_output, Tensor<D_INPUT_SPEC>& d_input, nn::layers::gru::buffers::Backward<BUFFER_SPEC>& buffers, typename DEVICE::index_t step_i, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
706
|
+
_backward<true, true>(device, layer, input, d_output, d_input, buffers, step_i, mode);
|
|
707
|
+
}
|
|
708
|
+
template<typename DEVICE, typename LAYER_SPEC, typename INPUT_SPEC, typename D_OUTPUT_SPEC, typename BUFFER_SPEC, typename MODE = mode::Default<>>
|
|
709
|
+
RL_TOOLS_FUNCTION_PLACEMENT void backward(DEVICE& device, nn::layers::gru::LayerGradient<LAYER_SPEC>& layer, const Tensor<INPUT_SPEC>& input, Tensor<D_OUTPUT_SPEC>& d_output, nn::layers::gru::buffers::Backward<BUFFER_SPEC>& buffers, typename DEVICE::index_t step_i, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
710
|
+
using T = typename LAYER_SPEC::T;
|
|
711
|
+
using TI = typename DEVICE::index_t;
|
|
712
|
+
Tensor<tensor::Specification<T, TI, typename INPUT_SPEC::SHAPE, true>> d_input_dummy; // not allocated, pointer should be optimized away because it is not used
|
|
713
|
+
_backward<false, true>(device, layer, input, d_output, d_input_dummy, buffers, step_i, mode);
|
|
714
|
+
}
|
|
715
|
+
template<typename DEVICE, typename LAYER_SPEC, typename INPUT_SPEC, typename D_OUTPUT_SPEC, typename D_INPUT_SPEC, typename BUFFER_SPEC, typename MODE = mode::Default<>>
|
|
716
|
+
RL_TOOLS_FUNCTION_PLACEMENT void backward_full(DEVICE& device, nn::layers::gru::LayerGradient<LAYER_SPEC>& layer, const Tensor<INPUT_SPEC>& input, Tensor<D_OUTPUT_SPEC>& d_output, Tensor<D_INPUT_SPEC>& d_input, nn::layers::gru::buffers::Backward<BUFFER_SPEC>& buffers, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
717
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
718
|
+
ZoneScopedN("gru::backward_full");
|
|
719
|
+
#endif
|
|
720
|
+
_backward<true, true>(device, layer, input, d_output, d_input, buffers, mode);
|
|
721
|
+
}
|
|
722
|
+
template<typename DEVICE, typename LAYER_SPEC, typename D_OUTPUT_SPEC, typename D_INPUT_SPEC, typename BUFFER_SPEC, typename MODE = mode::Default<>>
|
|
723
|
+
RL_TOOLS_FUNCTION_PLACEMENT void backward_input(DEVICE& device, nn::layers::gru::LayerGradient<LAYER_SPEC>& layer, Tensor<D_OUTPUT_SPEC>& d_output, Tensor<D_INPUT_SPEC>& d_input, nn::layers::gru::buffers::Backward<BUFFER_SPEC>& buffers, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
724
|
+
#ifdef RL_TOOLS_ENABLE_TRACY
|
|
725
|
+
ZoneScopedN("gru::backward_full");
|
|
726
|
+
#endif
|
|
727
|
+
using T = typename LAYER_SPEC::TYPE_POLICY::DEFAULT;
|
|
728
|
+
using TI = typename DEVICE::index_t;
|
|
729
|
+
Tensor<tensor::Specification<T, TI, typename D_INPUT_SPEC::SHAPE, true>> input_dummy; // not allocated, pointer should be optimized away because it is not used
|
|
730
|
+
_backward<true, false>(device, layer, input_dummy, d_output, d_input, buffers, mode);
|
|
731
|
+
}
|
|
732
|
+
template<typename DEVICE, typename LAYER_SPEC, typename INPUT_SPEC, typename D_OUTPUT_SPEC, typename BUFFER_SPEC, typename MODE = mode::Default<>>
|
|
733
|
+
RL_TOOLS_FUNCTION_PLACEMENT void backward(DEVICE& device, nn::layers::gru::LayerGradient<LAYER_SPEC>& layer, const Tensor<INPUT_SPEC>& input, Tensor<D_OUTPUT_SPEC>& d_output, nn::layers::gru::buffers::Backward<BUFFER_SPEC>& buffers, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
734
|
+
using T = typename LAYER_SPEC::TYPE_POLICY::DEFAULT;
|
|
735
|
+
using TI = typename DEVICE::index_t;
|
|
736
|
+
Tensor<tensor::Specification<T, TI, typename INPUT_SPEC::SHAPE, true>> d_input_dummy; // not allocated, pointer should be optimized away because it is not used
|
|
737
|
+
_backward<false, true>(device, layer, input, d_output, d_input_dummy, buffers, mode);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
template <typename SOURCE_DEVICE, typename TARGET_DEVICE, typename SOURCE_SPEC, typename TARGET_SPEC>
|
|
741
|
+
RL_TOOLS_FUNCTION_PLACEMENT void copy(SOURCE_DEVICE& source_device, TARGET_DEVICE& target_device, const nn::layers::gru::LayerForward<SOURCE_SPEC>& source, nn::layers::gru::LayerForward<TARGET_SPEC>& target){
|
|
742
|
+
copy(source_device, target_device, source.weights_input, target.weights_input);
|
|
743
|
+
copy(source_device, target_device, source.biases_input, target.biases_input);
|
|
744
|
+
copy(source_device, target_device, source.weights_hidden, target.weights_hidden);
|
|
745
|
+
copy(source_device, target_device, source.biases_hidden, target.biases_hidden);
|
|
746
|
+
copy(source_device, target_device, source.initial_hidden_state, target.initial_hidden_state);
|
|
747
|
+
}
|
|
748
|
+
template <typename SOURCE_DEVICE, typename TARGET_DEVICE, typename SOURCE_SPEC, typename TARGET_SPEC>
|
|
749
|
+
RL_TOOLS_FUNCTION_PLACEMENT void copy(SOURCE_DEVICE& source_device, TARGET_DEVICE& target_device, const nn::layers::gru::LayerBackward<SOURCE_SPEC>& source, nn::layers::gru::LayerBackward<TARGET_SPEC>& target){
|
|
750
|
+
copy(source_device, target_device, static_cast<const nn::layers::gru::LayerForward<SOURCE_SPEC>&>(source), static_cast<nn::layers::gru::LayerForward<TARGET_SPEC>&>(target));
|
|
751
|
+
if constexpr(tensor::same_dimensions_shape<typename SOURCE_SPEC::INPUT_SHAPE, typename TARGET_SPEC::INPUT_SHAPE>()){
|
|
752
|
+
copy(source_device, target_device, source.post_activation, target.post_activation);
|
|
753
|
+
copy(source_device, target_device, source.n_pre_pre_activation, target.n_pre_pre_activation);
|
|
754
|
+
copy(source_device, target_device, source.output, target.output);
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
template <typename SOURCE_DEVICE, typename TARGET_DEVICE, typename SOURCE_SPEC, typename TARGET_SPEC>
|
|
758
|
+
RL_TOOLS_FUNCTION_PLACEMENT void copy(SOURCE_DEVICE& source_device, TARGET_DEVICE& target_device, const nn::layers::gru::LayerGradient<SOURCE_SPEC>& source, nn::layers::gru::LayerGradient<TARGET_SPEC>& target){
|
|
759
|
+
copy(source_device, target_device, static_cast<const nn::layers::gru::LayerBackward<SOURCE_SPEC>&>(source), static_cast<nn::layers::gru::LayerBackward<TARGET_SPEC>&>(target));
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
template <typename SOURCE_DEVICE, typename TARGET_DEVICE, typename SOURCE, typename TARGET_SPEC>
|
|
763
|
+
RL_TOOLS_FUNCTION_PLACEMENT void copy_from_generic(SOURCE_DEVICE& source_device, TARGET_DEVICE& target_device, const SOURCE& source, nn::layers::gru::LayerForward<TARGET_SPEC>& target){
|
|
764
|
+
copy_from_generic(source_device, target_device, source.weights_input, target.weights_input);
|
|
765
|
+
copy_from_generic(source_device, target_device, source.biases_input, target.biases_input);
|
|
766
|
+
copy_from_generic(source_device, target_device, source.weights_hidden, target.weights_hidden);
|
|
767
|
+
copy_from_generic(source_device, target_device, source.biases_hidden, target.biases_hidden);
|
|
768
|
+
copy_from_generic(source_device, target_device, source.initial_hidden_state, target.initial_hidden_state);
|
|
769
|
+
}
|
|
770
|
+
template <typename SOURCE_DEVICE, typename TARGET_DEVICE, typename SOURCE, typename TARGET_SPEC>
|
|
771
|
+
RL_TOOLS_FUNCTION_PLACEMENT void copy_from_generic(SOURCE_DEVICE& source_device, TARGET_DEVICE& target_device, const SOURCE& source, nn::layers::gru::LayerBackward<TARGET_SPEC>& target){
|
|
772
|
+
copy_from_generic(source_device, target_device, static_cast<const typename SOURCE::PARENT&>(source), static_cast<nn::layers::gru::LayerForward<TARGET_SPEC>&>(target));
|
|
773
|
+
if constexpr(tensor::same_dimensions_shape<typename SOURCE::SPEC::INPUT_SHAPE, typename TARGET_SPEC::INPUT_SHAPE>()){
|
|
774
|
+
copy_from_generic(source_device, target_device, source.post_activation, target.post_activation);
|
|
775
|
+
copy_from_generic(source_device, target_device, source.n_pre_pre_activation, target.n_pre_pre_activation);
|
|
776
|
+
copy_from_generic(source_device, target_device, source.output, target.output);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
template <typename SOURCE_DEVICE, typename TARGET_DEVICE, typename SOURCE, typename TARGET_SPEC>
|
|
780
|
+
RL_TOOLS_FUNCTION_PLACEMENT void copy_from_generic(SOURCE_DEVICE& source_device, TARGET_DEVICE& target_device, const SOURCE& source, nn::layers::gru::LayerGradient<TARGET_SPEC>& target){
|
|
781
|
+
copy_from_generic(source_device, target_device, static_cast<const typename SOURCE::SPEC&>(source), static_cast<nn::layers::gru::LayerBackward<TARGET_SPEC>&>(target));
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
template <typename SOURCE_DEVICE, typename TARGET_DEVICE, typename SOURCE_SPEC, typename TARGET_SPEC>
|
|
785
|
+
RL_TOOLS_FUNCTION_PLACEMENT void copy(SOURCE_DEVICE& source_device, TARGET_DEVICE& target_device, const nn::layers::gru::buffers::Evaluation<SOURCE_SPEC>& source, nn::layers::gru::buffers::Evaluation<TARGET_SPEC>& target){
|
|
786
|
+
copy(source_device, target_device, source.post_activation, target.post_activation);
|
|
787
|
+
copy(source_device, target_device, source.n_pre_pre_activation, target.n_pre_pre_activation);
|
|
788
|
+
copy(source_device, target_device, source.step_by_step_output, target.step_by_step_output);
|
|
789
|
+
copy(source_device, target_device, source.previous_output_scratch, target.previous_output_scratch);
|
|
790
|
+
}
|
|
791
|
+
template <typename SOURCE_DEVICE, typename TARGET_DEVICE, typename SOURCE_SPEC, typename TARGET_SPEC>
|
|
792
|
+
RL_TOOLS_FUNCTION_PLACEMENT void copy(SOURCE_DEVICE& source_device, TARGET_DEVICE& target_device, const nn::layers::gru::buffers::Backward<SOURCE_SPEC>& source, nn::layers::gru::buffers::Backward<TARGET_SPEC>& target){
|
|
793
|
+
copy(source_device, target_device, static_cast<const nn::layers::gru::buffers::Evaluation<SOURCE_SPEC>&>(source), static_cast<nn::layers::gru::buffers::Evaluation<TARGET_SPEC>&>(target));
|
|
794
|
+
copy(source_device, target_device, source.buffer, target.buffer);
|
|
795
|
+
copy(source_device, target_device, source.buffer2, target.buffer2);
|
|
796
|
+
}
|
|
797
|
+
|
|
798
|
+
template <typename DEVICE, typename SPEC>
|
|
799
|
+
RL_TOOLS_FUNCTION_PLACEMENT void reset_forward_state(DEVICE& device, rl_tools::nn::layers::gru::LayerForward<SPEC>& l) { }
|
|
800
|
+
|
|
801
|
+
template <typename DEVICE, typename SPEC>
|
|
802
|
+
RL_TOOLS_FUNCTION_PLACEMENT void reset_forward_state(DEVICE& device, rl_tools::nn::layers::gru::LayerBackward<SPEC>& l) {
|
|
803
|
+
set_all(device, l.post_activation, 0);
|
|
804
|
+
set_all(device, l.n_pre_pre_activation, 0);
|
|
805
|
+
set_all(device, l.output, 0);
|
|
806
|
+
reset_forward_state(device, static_cast<rl_tools::nn::layers::gru::LayerForward<SPEC>&>(l));
|
|
807
|
+
}
|
|
808
|
+
|
|
809
|
+
template <typename DEVICE, typename SPEC_1, typename SPEC_2>
|
|
810
|
+
RL_TOOLS_FUNCTION_PLACEMENT typename SPEC_1::TYPE_POLICY::DEFAULT abs_diff(DEVICE& device, const rl_tools::nn::layers::gru::LayerForward<SPEC_1>& l1, const rl_tools::nn::layers::gru::LayerForward<SPEC_2>& l2) {
|
|
811
|
+
typename SPEC_1::TYPE_POLICY::DEFAULT diff = 0;
|
|
812
|
+
diff += abs_diff(device, l1.weights_input, l2.weights_input);
|
|
813
|
+
diff += abs_diff(device, l1.biases_input, l2.biases_input);
|
|
814
|
+
diff += abs_diff(device, l1.weights_hidden, l2.weights_hidden);
|
|
815
|
+
diff += abs_diff(device, l1.biases_hidden, l2.biases_hidden);
|
|
816
|
+
diff += abs_diff(device, l1.initial_hidden_state, l2.initial_hidden_state);
|
|
817
|
+
return diff;
|
|
818
|
+
}
|
|
819
|
+
template <typename DEVICE, typename SPEC_1, typename SPEC_2>
|
|
820
|
+
RL_TOOLS_FUNCTION_PLACEMENT typename SPEC_1::TYPE_POLICY::DEFAULT abs_diff(DEVICE& device, const rl_tools::nn::layers::gru::LayerBackward<SPEC_1>& l1, const rl_tools::nn::layers::gru::LayerBackward<SPEC_2>& l2) {
|
|
821
|
+
using T = typename SPEC_1::TYPE_POLICY::DEFAULT;
|
|
822
|
+
T diff = abs_diff(device, static_cast<const rl_tools::nn::layers::gru::LayerForward<SPEC_1>&>(l1), static_cast<const rl_tools::nn::layers::gru::LayerForward<SPEC_2>&>(l2));
|
|
823
|
+
diff += abs_diff(device, l1.post_activation, l2.post_activation);
|
|
824
|
+
diff += abs_diff(device, l1.n_pre_pre_activation, l2.n_pre_pre_activation);
|
|
825
|
+
diff += abs_diff(device, l1.output, l2.output);
|
|
826
|
+
return diff;
|
|
827
|
+
}
|
|
828
|
+
template <typename DEVICE, typename SPEC_1, typename SPEC_2>
|
|
829
|
+
RL_TOOLS_FUNCTION_PLACEMENT typename SPEC_1::TYPE_POLICY::DEFAULT abs_diff(DEVICE& device, const rl_tools::nn::layers::gru::LayerGradient<SPEC_1>& l1, const rl_tools::nn::layers::gru::LayerGradient<SPEC_2>& l2) {
|
|
830
|
+
return abs_diff(device, static_cast<const rl_tools::nn::layers::gru::LayerBackward<SPEC_1>&>(l1), static_cast<const rl_tools::nn::layers::gru::LayerBackward<SPEC_2>&>(l2));
|
|
831
|
+
}
|
|
832
|
+
template <typename DEVICE, typename SPEC_1, typename SPEC_2>
|
|
833
|
+
RL_TOOLS_FUNCTION_PLACEMENT typename SPEC_1::SPEC::TYPE_POLICY::DEFAULT abs_diff(DEVICE& device, const rl_tools::nn::layers::gru::State<SPEC_1>& s1, const rl_tools::nn::layers::gru::State<SPEC_2>& s2) {
|
|
834
|
+
return abs_diff(device, s1.state, s2.state);
|
|
835
|
+
}
|
|
836
|
+
|
|
837
|
+
template <typename DEVICE, typename SPEC, typename MODE = mode::Default<>>
|
|
838
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool is_nan(DEVICE& device, const rl_tools::nn::layers::gru::LayerForward<SPEC>& l, const Mode<MODE>& mode = Mode<mode::Default<>>{}) {
|
|
839
|
+
bool weights_nan = is_nan(device, l.weights_input, mode) || is_nan(device, l.weights_hidden, mode);
|
|
840
|
+
bool biases_nan = is_nan(device, l.biases_input, mode) || is_nan(device, l.biases_hidden, mode);
|
|
841
|
+
bool initial_hidden_state_nan = is_nan(device, l.initial_hidden_state, mode);
|
|
842
|
+
return weights_nan || biases_nan || initial_hidden_state_nan;
|
|
843
|
+
}
|
|
844
|
+
template <typename DEVICE, typename SPEC, typename MODE = mode::Default<>>
|
|
845
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool is_nan(DEVICE& device, const rl_tools::nn::layers::gru::LayerBackward<SPEC>& l, const Mode<MODE>& mode = Mode<mode::Default<>>{}) {
|
|
846
|
+
bool upstream_nan = is_nan(device, static_cast<const rl_tools::nn::layers::gru::LayerForward<SPEC>&>(l), mode);
|
|
847
|
+
if constexpr(mode::is<MODE, nn::parameters::mode::ParametersOnly>){
|
|
848
|
+
return upstream_nan;
|
|
849
|
+
}
|
|
850
|
+
return upstream_nan || is_nan(device, l.post_activation, mode) || is_nan(device, l.n_pre_pre_activation, mode) || is_nan(device, l.output, mode);
|
|
851
|
+
}
|
|
852
|
+
template <typename DEVICE, typename SPEC, typename MODE = mode::Default<>>
|
|
853
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool is_nan(DEVICE& device, const rl_tools::nn::layers::gru::LayerGradient<SPEC>& l, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
854
|
+
return is_nan(device, static_cast<const rl_tools::nn::layers::gru::LayerBackward<SPEC>&>(l), mode);
|
|
855
|
+
}
|
|
856
|
+
template<typename DEVICE, typename SPEC, typename MODE = mode::Default<>>
|
|
857
|
+
RL_TOOLS_FUNCTION_PLACEMENT bool is_nan(DEVICE& device, nn::layers::gru::State<SPEC>& state, const Mode<MODE>& mode = Mode<mode::Default<>>{}){
|
|
858
|
+
return is_nan(device, state.state);
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
template <typename DEVICE, typename SPEC>
|
|
862
|
+
RL_TOOLS_FUNCTION_PLACEMENT void free(DEVICE& device, nn::layers::gru::LayerForward<SPEC>& layer){
|
|
863
|
+
free(device, layer.weights_input);
|
|
864
|
+
free(device, layer.biases_input);
|
|
865
|
+
free(device, layer.weights_hidden);
|
|
866
|
+
free(device, layer.biases_hidden);
|
|
867
|
+
free(device, layer.initial_hidden_state);
|
|
868
|
+
}
|
|
869
|
+
template <typename DEVICE, typename SPEC>
|
|
870
|
+
RL_TOOLS_FUNCTION_PLACEMENT void free(DEVICE& device, nn::layers::gru::LayerBackward<SPEC>& layer){
|
|
871
|
+
free(device, static_cast<nn::layers::gru::LayerForward<SPEC>&>(layer));
|
|
872
|
+
free(device, layer.n_pre_pre_activation);
|
|
873
|
+
free(device, layer.post_activation);
|
|
874
|
+
free(device, layer.output);
|
|
875
|
+
}
|
|
876
|
+
template <typename DEVICE, typename SPEC>
|
|
877
|
+
RL_TOOLS_FUNCTION_PLACEMENT auto output(DEVICE& device, nn::layers::gru::LayerBackward<SPEC>& layer){
|
|
878
|
+
auto tensor_flat = to_tensor(device, layer.output);
|
|
879
|
+
auto tensor = view_memory<typename SPEC::OUTPUT_SHAPE>(device, tensor_flat);
|
|
880
|
+
return tensor;
|
|
881
|
+
}
|
|
882
|
+
template<typename DEVICE, typename SPEC>
|
|
883
|
+
RL_TOOLS_FUNCTION_PLACEMENT auto gradient_norm(DEVICE& device, const nn::layers::gru::LayerGradient<SPEC>& layer) {
|
|
884
|
+
return gradient_norm(device, layer.weights_input) + gradient_norm(device, layer.weights_hidden) + gradient_norm(device, layer.biases_input) + gradient_norm(device, layer.biases_hidden) + gradient_norm(device, layer.initial_hidden_state);
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
RL_TOOLS_NAMESPACE_WRAPPER_END
|
|
888
|
+
|
|
889
|
+
#endif
|