mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-07-20 18:52:06 +08:00
e333e4f189
* cleanup include path
* continue
* format includes
* fix testraw.cc
* remove include path from SConstruct
* regroup
* rebase master
* almost done
* apply review
* rename FileReader.xx to filereader.xx
* rename Unlogger.x->unlogger.x
* rename FrameReader.xx -> framereader.xx
* apply reviews
* ui.h
* continue
* fix framebuffer.cc build error:mv util.h up
* full path to msm_media_info
* fix qcom2 camerad
Co-authored-by: Comma Device <device@comma.ai>
old-commit-hash: 7222d0f20d
43 lines
963 B
C++
43 lines
963 B
C++
#include "thneedmodel.h"
|
|
|
|
#include <assert.h>
|
|
|
|
ThneedModel::ThneedModel(const char *path, float *loutput, size_t loutput_size, int runtime) {
|
|
thneed = new Thneed(true);
|
|
thneed->record = 0;
|
|
thneed->load(path);
|
|
thneed->clexec();
|
|
thneed->find_inputs_outputs();
|
|
|
|
recorded = false;
|
|
output = loutput;
|
|
}
|
|
|
|
void ThneedModel::addRecurrent(float *state, int state_size) {
|
|
recurrent = state;
|
|
}
|
|
|
|
void ThneedModel::addTrafficConvention(float *state, int state_size) {
|
|
trafficConvention = state;
|
|
}
|
|
|
|
void ThneedModel::addDesire(float *state, int state_size) {
|
|
desire = state;
|
|
}
|
|
|
|
void ThneedModel::execute(float *net_input_buf, int buf_size) {
|
|
float *inputs[4] = {recurrent, trafficConvention, desire, net_input_buf};
|
|
if (!recorded) {
|
|
thneed->record = THNEED_RECORD;
|
|
thneed->copy_inputs(inputs);
|
|
thneed->clexec();
|
|
thneed->copy_output(output);
|
|
thneed->stop();
|
|
|
|
recorded = true;
|
|
} else {
|
|
thneed->execute(inputs, output);
|
|
}
|
|
}
|
|
|