8000 Fix ODR violations across headers (inline linkage, guards, extern "C") by 60k41p · Pull Request #33 · rl-tools/rl-tools · GitHub
[go: up one dir, main page]

Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/rl_tools/devices/cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ RL_TOOLS_NAMESPACE_WRAPPER_END
RL_TOOLS_NAMESPACE_WRAPPER_START
namespace rl_tools{
namespace devices::cpu{
void display_compile_options() {
inline void display_compile_options() {
bool isOptimal = true;
const char* ANSI_RED = "\033[31m";
const char* ANSI_GREEN = "\033[32m";
Expand Down
2 changes: 1 addition & 1 deletion include/rl_tools/devices/cuda.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ namespace rl_tools {
#endif
}

void print_graph(cudaGraph_t graph){
inline void print_graph(cudaGraph_t graph){

// Step 8: Retrieve and list nodes and dependencies
// Get all nodes
Expand Down
31 changes: 19 additions & 12 deletions include/rl_tools/inference/applications/l2f/c_backend.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
#include "../../../version.h"
#if (defined(RL_TOOLS_DISABLE_INCLUDE_GUARDS) || !defined(RL_TOOLS_INFERENCE_APPLICATIONS_L2F_C_BACKEND_H)) && (RL_TOOLS_USE_THIS_VERSION == 1)
#pragma once
#define RL_TOOLS_INFERENCE_APPLICATIONS_L2F_C_BACKEND_H

#include "../../executor/operations_generic.h"
#include "c_interface.h"
#include "../../executor/c_backend.h"
Expand All @@ -21,37 +26,37 @@ namespace rl_tools::inference::applications::l2f{

// state
using SPEC = rl_tools::inference::applications::l2f::Specification<TYPE_POLICY, TI, RLtoolsInferenceTimestamp, CONFIG::ACTION_HISTORY_LENGTH, OUTPUT_DIM, typename CONFIG::POLICY, CONFIG::CONTROL_INTERVAL_INTERMEDIATE_NS, CONFIG::CONTROL_INTERVAL_NATIVE_NS, CONFIG::FORCE_SYNC_INTERMEDIATE, CONFIG::FORCE_SYNC_NATIVE, CONFIG::FORCE_SYNC_NATIVE_RUNTIME, CONFIG::WARNING_LEVELS, CONFIG::DYNAMIC_ALLOCATION>;
typename CONFIG::DEVICE device;
typename CONFIG::RNG rng;
static rl_tools::inference::applications::L2F<SPEC> executor;
inline typename CONFIG::DEVICE device;
inline typename CONFIG::RNG rng;
inline rl_tools::inference::applications::L2F<SPEC> executor;
// Test Buffers
#ifndef RL_TOOLS_DISABLE_TEST
static CONFIG::POLICY_TEST::template Buffer<false> buffers_test;
static CONFIG::POLICY_TEST::State<false> policy_state_test;
static rl_tools::Tensor<rl_tools::tensor::Specification<TYPE_POLICY::DEFAULT, TI, rl_tools::tensor::Shape<TI, 1, OUTPUT_DIM>, false>> output;
inline CONFIG::POLICY_TEST::template Buffer<false> buffers_test;
inline CONFIG::POLICY_TEST::State<false> policy_state_test;
inline rl_tools::Tensor<rl_tools::tensor::Specification<TYPE_POLICY::DEFAULT, TI, rl_tools::tensor::Shape<TI, 1, OUTPUT_DIM>, false>> output;
#endif
}



// Main functions (possibly with side effects)
void rl_tools_inference_applications_l2f_reset(){
extern "C" inline void rl_tools_inference_applications_l2f_reset(){
using namespace rl_tools::inference::applications::l2f;
rl_tools::reset(device, executor, CONFIG::policy(), rng);
}
void rl_tools_inference_applications_l2f_init(){
extern "C" inline void rl_tools_inference_applications_l2f_init(){
using namespace rl_tools::inference::applications::l2f;
TI seed = 0;
rl_tools::malloc(device, executor);
rl_tools::init(device, rng, seed);
rl_tools_inference_applications_l2f_reset();
}

const char* rl_tools_inference_applications_l2f_checkpoint_name(){
extern "C" inline const char* rl_tools_inference_applications_l2f_checkpoint_name(){
return rl_tools::checkpoint::meta::name;
}

float rl_tools_inference_applications_l2f_test(RLtoolsInferenceApplicationsL2FAction* p_output){
extern "C" inline float rl_tools_inference_applications_l2f_test(RLtoolsInferenceApplicationsL2FAction* p_output){
using namespace rl_tools::inference::applications::l2f;
#ifndef RL_TOOLS_DISABLE_TEST
rl_tools::Mode<rl_tools::mode::Evaluation<>> mode;
Expand Down Expand Up @@ -82,14 +87,14 @@ float rl_tools_inference_applications_l2f_test(RLtoolsInferenceApplicationsL2FAc
#endif
}

void rl_tools_inference_applications_l2f_set_force_sync_native(uint32_t force_sync_native){
extern "C" inline void rl_tools_inference_applications_l2f_set_force_sync_native(uint32_t force_sync_native){
using namespace rl_tools::inference::applications::l2f;
executor.executor.force_sync_native = force_sync_native;
executor.executor.force_sync_native_initialized = true;
}


RLtoolsInferenceExecutorStatus rl_tools_inference_applications_l2f_control(RLtoolsInferenceTimestamp nanoseconds, RLtoolsInferenceApplicationsL2FObservation* c_observation, RLtoolsInferenceApplicationsL2FAction* c_action){
extern "C" inline RLtoolsInferenceExecutorStatus rl_tools_inference_applications_l2f_control(RLtoolsInferenceTimestamp nanoseconds, RLtoolsInferenceApplicationsL2FObservation* c_observation, RLtoolsInferenceApplicationsL2FAction* c_action){
using namespace rl_tools::inference::applications::l2f;
static_assert(RL_TOOLS_INTERFACE_APPLICATIONS_L2F_ACTION_DIM == OUTPUT_DIM);
rl_tools::inference::applications::l2f::Observation<SPEC> observation;
Expand All @@ -110,3 +115,5 @@ RLtoolsInferenceExecutorStatus rl_tools_inference_applications_l2f_control(RLtoo
}
return rl_tools::convert(status);
}

#endif
1 change: 1 addition & 0 deletions include/rl_tools/inference/applications/l2f/c_interface.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
#ifndef RL_TOOLS_INFERENCE_APPLICATIONS_L2F_C_INTERFACE_H
#define RL_TOOLS_INFERENCE_APPLICATIONS_L2F_C_INTERFACE_H

Expand Down
24 changes: 16 additions & 8 deletions include/rl_tools/inference/debugging_pool/c_backend.h
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
#pragma once
#ifndef RL_TOOLS_INFERENCE_DEBUGGING_POOL_C_BACKEND_H
#define RL_TOOLS_INFERENCE_DEBUGGING_POOL_C_BACKEND_H

#include <stdint.h>

#ifdef RL_TOOLS_ENABLE_DEBUGGING_POOL
char rl_tools_debugging_pool_names[RL_TOOLS_DEBUGGING_POOL_NUMBER][RL_TOOLS_DEBUGGING_POOL_NAME_LENGTH];
float rl_tools_debugging_pool[RL_TOOLS_DEBUGGING_POOL_NUMBER][RL_TOOLS_DEBUGGING_POOL_SIZE];
uint64_t rl_tools_debugging_pool_indices[RL_TOOLS_DEBUGGING_POOL_NUMBER];
uint64_t rl_tools_debugging_pool_index = 0;
bool rl_tools_debugging_pool_locked = false;
bool rl_tools_debugging_pool_updated = false;
inline char rl_tools_debugging_pool_names[RL_TOOLS_DEBUGGING_POOL_NUMBER][RL_TOOLS_DEBUGGING_POOL_NAME_LENGTH];
inline float rl_tools_debugging_pool[RL_TOOLS_DEBUGGING_POOL_NUMBER][RL_TOOLS_DEBUGGING_POOL_SIZE];
inline uint64_t rl_tools_debugging_pool_indices[RL_TOOLS_DEBUGGING_POOL_NUMBER];
inline uint64_t rl_tools_debugging_pool_index = 0;
inline bool rl_tools_debugging_pool_locked = false;
inline bool rl_tools_debugging_pool_updated = false;
#endif

static void rl_tools_reset_debuging_pool(){
inline void rl_tools_reset_debuging_pool(){
if(!rl_tools_debugging_pool_locked){
rl_tools_debugging_pool_index = 0;
rl_tools_debugging_pool_updated = true;
}
}
static void rl_tools_add_to_debuging_pool(const char* name, const float* values, uint64_t num){
inline void rl_tools_add_to_debuging_pool(const char* name, const float* values, uint64_t num){
if(!rl_tools_debugging_pool_locked && rl_tools_debugging_pool_index < RL_TOOLS_DEBUGGING_POOL_NUMBER){
uint32_t size = (num < RL_TOOLS_DEBUGGING_POOL_SIZE ? num : RL_TOOLS_DEBUGGING_POOL_SIZE);
for(uint64_t i = 0; i < size; i++){
Expand All @@ -29,3 +35,5 @@ static void rl_tools_add_to_debuging_pool(const char* name, const float* values,
rl_tools_debugging_pool_updated = true;
}
}

#endif
11 changes: 11 additions & 0 deletions include/rl_tools/inference/debugging_pool/c_interface.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#pragma once
#ifndef RL_TOOLS_INFERENCE_DEBUGGING_POOL_C_INTERFACE_H
#define RL_TOOLS_INFERENCE_DEBUGGING_POOL_C_INTERFACE_H

#include <stdint.h>
#ifndef __cplusplus
#include <stdbool.h>
#endif

#define RL_TOOLS_ENABLE_DEBUGGING_POOL
#ifdef RL_TOOLS_ENABLE_DEBUGGING_POOL
#define RL_TOOLS_DEBUGGING_POOL_NUMBER 10
Expand All @@ -10,3 +19,5 @@ extern uint64_t rl_tools_debugging_pool_index;
extern bool rl_tools_debugging_pool_locked;
extern bool rl_tools_debugging_pool_updated;
#endif

#endif
15 changes: 11 additions & 4 deletions include/rl_tools/inference/executor/c_backend.h
Original file line number Diff line number Diff line change
@@ -1,31 +1,36 @@
#include "../../version.h"
#if (defined(RL_TOOLS_DISABLE_INCLUDE_GUARDS) || !defined(RL_TOOLS_INFERENCE_EXECUTOR_C_BACKEND_H)) && (RL_TOOLS_USE_THIS_VERSION == 1)
#pragma once
#define RL_TOOLS_INFERENCE_EXECUTOR_C_BACKEND_H

#include <stdio.h>
#include "executor.h"
#include "c_interface.h"
#include "helper.h"

static int portable_strlen(const char* str) {
inline int portable_strlen(const char* str) {
const char* ptr = str;
while (*ptr != '\0') {
ptr++;
}
return ptr - str;
}

static char * portable_strcpy(char *dest, const char *src) {
inline char * portable_strcpy(char *dest, const char *src) {
char *original_dest = dest;
while ((*dest++ = *src++) != '\0');
return original_dest;
}

static void append(char* target, int target_size, const char* message, int &position){
inline void append(char* target, int target_size, const char* message, int &position){
if(position + portable_strlen(message) < target_size){
portable_strcpy(target + position, message);
position += portable_strlen(message);
}
}


void rl_tools_inference_executor_status_message(RLtoolsInferenceExecutorStatus status, char* target, int target_size){
extern "C" inline void rl_tools_inference_executor_status_message(RLtoolsInferenceExecutorStatus status, char* target, int target_size){
int position = 0;
if(status.OK){
append(target, target_size, "OK", position);
Expand Down Expand Up @@ -96,3 +101,5 @@ namespace rl_tools{
return output;
}
}

#endif
1 change: 1 addition & 0 deletions include/rl_tools/inference/executor/c_interface.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#pragma once
#ifndef RL_TOOLS_INFERENCE_EXECUTOR_C_INTERFACE_H
#define RL_TOOLS_INFERENCE_EXECUTOR_C_INTERFACE_H

Expand Down
12 changes: 9 additions & 3 deletions include/rl_tools/inference/executor/helper.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
#pragma once
#ifndef RL_TOOLS_INFERENCE_EXECUTOR_HELPER_H
#define RL_TOOLS_INFERENCE_EXECUTOR_HELPER_H

#include <stdint.h>
#include <stddef.h>
#include <math.h>

static size_t rl_tools_inference_executor_u32_to_revstr(uint32_t v, char *buf, size_t cap){
inline size_t rl_tools_inference_executor_u32_to_revstr(uint32_t v, char *buf, size_t cap){
size_t idx = 0;
if (v == 0 && idx < cap) {
buf[idx++] = '0';
Expand All @@ -15,7 +19,7 @@ static size_t rl_tools_inference_executor_u32_to_revstr(uint32_t v, char *buf, s
return idx;
}

int rl_tools_inference_executor_int_to_str(int32_t v, char *dst, size_t dst_size){
inline int rl_tools_inference_executor_int_to_str(int32_t v, char *dst, size_t dst_size){
if (!dst || dst_size == 0)
return 0;

Expand All @@ -41,7 +45,7 @@ int rl_tools_inference_executor_int_to_str(int32_t v, char *dst, size_t dst_size
}


int rl_tools_inference_executor_float_to_str(float f, char *dst, size_t dst_size){
inline int rl_tools_inference_executor_float_to_str(float f, char *dst, size_t dst_size){
static const double POW10_6 = 1e6;
if (!dst || dst_size == 0)
return 0;
Expand Down Expand Up @@ -107,3 +111,5 @@ int rl_tools_inference_executor_float_to_str(float f, char *dst, size_t dst_size
dst[out] = '\0';
return (int)needed;
}

#endif
4 changes: 2 additions & 2 deletions include/rl_tools/logging/operations_arduino.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "../version.h"
#if (defined(RL_TOOLS_DISABLE_INCLUDE_GUARDS) || !defined(RL_TOOLS_LOGGING_OPERATIONS_CPU_H)) && (RL_TOOLS_USE_THIS_VERSION == 1)
#if (defined(RL_TOOLS_DISABLE_INCLUDE_GUARDS) || !defined(RL_TOOLS_LOGGING_OPERATIONS_ARDUINO_H)) && (RL_TOOLS_USE_THIS_VERSION == 1)
#pragma once
#define RL_TOOLS_LOGGING_OPERATIONS_CPU_H
#define RL_TOOLS_LOGGING_OPERATIONS_ARDUINO_H

RL_TOOLS_NAMESPACE_WRAPPER_START
namespace rl_tools{
Expand Down
6 changes: 3 additions & 3 deletions include/rl_tools/math/operations_cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,15 @@ namespace rl_tools::math {
}
#else
template <typename T>
bool is_nan(const devices::math::CPU, T){
inline bool is_nan(const devices::math::CPU, T){
return false;
}
bool is_nan(const devices::math::CPU, const float x){
inline bool is_nan(const devices::math::CPU, const float x){
is_nan_struct_float u;
u.f = x;
return (u.i & 0x7f800000) == 0x7f800000 && (u.i & 0x007fffff) != 0;
}
bool is_nan(const devices::math::CPU, const double x){
inline bool is_nan(const devices::math::CPU, const double x){
is_nan_struct_double u;
u.f = x;
return (u.i & 0x7ff0000000000000) == 0x7ff0000000000000 && (u.i & 0x000fffffffffffff) != 0;
Expand Down
4 changes: 2 additions & 2 deletions include/rl_tools/math/operations_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ namespace rl_tools::math {
*/

namespace generic::acos{
static constexpr float
inline constexpr float
pio2_hi = 1.5707962513e+00f, /* 0x3fc90fda */
pio2_lo = 7.5497894159e-08f, /* 0x33a22168 */
pS0 = 1.6666586697e-01f,
pS1 = -4.2743422091e-02f,
pS2 = -8.6563630030e-03f,
qS1 = -7.0662963390e-01f;
static inline float R(float z){
inline float R(float z){
float p, q;
p = z*(pS0+z*(pS1+z*pS2));
q = 1.0f+z*qS1;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

RL_TOOLS_NAMESPACE_WRAPPER_START
namespace rl_tools{
std::string get_type_string(nn::parameters::Adam p){
inline std::string get_type_string(nn::parameters::Adam p){
return "RL_TOOLS""_NAMESPACE_WRAPPER ::rl_tools::nn::parameters::Adam";
}
template<typename DEVICE, typename SPEC>
Expand Down
4 changes: 2 additions & 2 deletions include/rl_tools/nn/parameters/persist_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
RL_TOOLS_NAMESPACE_WRAPPER_START
namespace rl_tools {

std::string get_type_string(nn::parameters::Plain p){
inline std::string get_type_string(nn::parameters::Plain p){
return "RL_TOOLS""_NAMESPACE_WRAPPER ::rl_tools::nn::parameters::Plain";
}
std::string get_type_string(nn::parameters::Gradient p){
inline std::string get_type_string(nn::parameters::Gradient p){
return "RL_TOOLS""_NAMESPACE_WRAPPER ::rl_tools::nn::parameters::Gradient";
}

Expand Down
2 changes: 1 addition & 1 deletion include/rl_tools/nn/persist_code.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

RL_TOOLS_NAMESPACE_WRAPPER_START
namespace rl_tools{
std::string to_string(nn::LayerCapability capability){
inline std::string to_string(nn::LayerCapability capability){
switch(capability){
case nn::LayerCapability::Forward:
return "Forward";
Expand Down
20 changes: 10 additions & 10 deletions include/rl_tools/rl/environment_wrappers/operations_generic.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@
RL_TOOLS_NAMESPACE_WRAPPER_START
namespace rl_tools{
template<typename DEVICE, typename ENVIRONMENT>
RL_TOOLS_FUNCTION_PLACEMENT static void malloc(DEVICE& device, rl::environment_wrappers::Wrapper<ENVIRONMENT>& env){
RL_TOOLS_FUNCTION_PLACEMENT inline void malloc(DEVICE& device, rl::environment_wrappers::Wrapper<ENVIRONMENT>& env){
malloc(device, env.env);
}
template<typename DEVICE, typename ENVIRONMENT>
RL_TOOLS_FUNCTION_PLACEMENT static void free(DEVICE& device, rl::environment_wrappers::Wrapper<ENVIRONMENT>& env){
RL_TOOLS_FUNCTION_PLACEMENT inline void free(DEVICE& device, rl::environment_wrappers::Wrapper<ENVIRONMENT>& env){
free(device, env.env);
}
template<typename DEVICE, typename ENVIRONMENT>
RL_TOOLS_FUNCTION_PLACEMENT static void init(DEVICE& device, rl::environment_wrappers::Wrapper<ENVIRONMENT>& env){
RL_TOOLS_FUNCTION_PLACEMENT inline< D45A /span> void init(DEVICE& device, rl::environment_wrappers::Wrapper<ENVIRONMENT>& env){
init(device, env.env);
}
template<typename DEVICE, typename ENVIRONMENT, typename RNG>
RL_TOOLS_FUNCTION_PLACEMENT static void sample_initial_parameters(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, RNG& rng){
RL_TOOLS_FUNCTION_PLACEMENT inline void sample_initial_parameters(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, RNG& rng){
sample_initial_parameters(device, env.env, parameters, rng);
}
template<typename DEVICE, typename ENVIRONMENT>
static void initial_parameters(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters){
inline void initial_parameters(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters){
initial_parameters(device, env.env, parameters);
}
template<typename DEVICE, typename ENVIRONMENT, typename RNG>
RL_TOOLS_FUNCTION_PLACEMENT static void sample_initial_state(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State& state, RNG& rng){
RL_TOOLS_FUNCTION_PLACEMENT inline void sample_initial_state(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State& state, RNG& rng){
sample_initial_state(device, env.env, parameters, state, rng);
}
template<typename DEVICE, typename ENVIRONMENT>
static void initial_state(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State& state){
inline void initial_state(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State& state){
initial_state(device, env.env, parameters, state);
}
template<typename DEVICE, typename ENVIRONMENT, typename ACTION_SPEC, typename RNG>
Expand All @@ -40,17 +40,17 @@ namespace rl_tools{
return step(device, env.env, parameters, state, action, next_state, rng);
}
template<typename DEVICE, typename ENVIRONMENT, typename ACTION_SPEC, typename RNG>
RL_TOOLS_FUNCTION_PLACEMENT static typename ENVIRONMENT::T reward(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, const typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State& state, const Matrix<ACTION_SPEC>& action, const typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State& next_state, RNG& rng){
RL_TOOLS_FUNCTION_PLACEMENT inline typename ENVIRONMENT::T reward(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, const typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State& state, const Matrix<ACTION_SPEC>& action, const typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State& next_state, RNG& rng){
return reward(device, env.env, parameters, state, action, next_state, rng);
}

template<typename DEVICE, typename ENVIRONMENT, typename OBS_TYPE, typename OBS_SPEC, typename RNG>
RL_TOOLS_FUNCTION_PLACEMENT static void observe(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, const typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, const typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State& state, OBS_TYPE& obs_type, Matrix<OBS_SPEC>& observation, RNG& rng){
RL_TOOLS_FUNCTION_PLACEMENT inline void observe(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, const typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, const typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State& state, OBS_TYPE& obs_type, Matrix<OBS_SPEC>& observation, RNG& rng){
static_assert(OBS_SPEC::ROWS == 1);
observe(device, env.env, parameters, state, obs_type, observation, rng);
}
template<typename DEVICE, typename ENVIRONMENT, typename RNG>
RL_TOOLS_FUNCTION_PLACEMENT static bool terminated(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, const typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State state, RNG& rng){
RL_TOOLS_FUNCTION_PLACEMENT inline bool terminated(DEVICE& device, const rl::environment_wrappers::Wrapper<ENVIRONMENT>& env, typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::Parameters& parameters, const typename rl::environment_wrappers::Wrapper<ENVIRONMENT>::State state, RNG& rng){
return terminated(device, env.env, parameters, state, rng);
}
}
Expand Down
Loading
0