mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-22 14:13:52 +08:00
* use cstring instead of string.h * use cstdio instead of stdio.h * remove inttypes.h * use cstdlib instead of stdlib.h * use cstdint instead of stdint.h * #include <cstddef> * cstdlib * use cmath * remove stddef.h * use cassert * use csignal * use ctime * use cerror * rebase master
35 lines
843 B
C++
35 lines
843 B
C++
#pragma once
|
|
|
|
#include <cstdlib>
|
|
|
|
#include "selfdrive/modeld/runners/runmodel.h"
|
|
|
|
class ONNXModel : public RunModel {
|
|
public:
|
|
ONNXModel(const char *path, float *output, size_t output_size, int runtime);
|
|
~ONNXModel();
|
|
void addRecurrent(float *state, int state_size);
|
|
void addDesire(float *state, int state_size);
|
|
void addTrafficConvention(float *state, int state_size);
|
|
void execute(float *net_input_buf, int buf_size);
|
|
private:
|
|
int proc_pid;
|
|
|
|
float *output;
|
|
size_t output_size;
|
|
|
|
float *rnn_input_buf = NULL;
|
|
int rnn_state_size;
|
|
float *desire_input_buf = NULL;
|
|
int desire_state_size;
|
|
float *traffic_convention_input_buf = NULL;
|
|
int traffic_convention_size;
|
|
|
|
// pipe to communicate to keras subprocess
|
|
void pread(float *buf, int size);
|
|
void pwrite(float *buf, int size);
|
|
int pipein[2];
|
|
int pipeout[2];
|
|
};
|
|
|