RTNeuralLSTM.h (1065B)
1 #pragma once 2 3 #include <RTNeural/RTNeural.h> 4 5 class RT_LSTM 6 { 7 public: 8 RT_LSTM() = default; 9 10 void reset(); 11 void load_json(const char* filename); 12 template <typename T1> 13 14 void set_weights(T1 model, const char* filename); 15 16 void process(const float* inData, float* outData, int numSamples); 17 void process(const float* inData, float param, float* outData, int numSamples); 18 void process(const float* inData, float param1, float param2, float* outData, int numSamples); 19 20 int input_size = 1; 21 22 private: 23 RTNeural::ModelT<float, 1, 1, 24 RTNeural::LSTMLayerT<float, 1, 20>, 25 RTNeural::DenseT<float, 20, 1>> model; 26 27 RTNeural::ModelT<float, 2, 1, 28 RTNeural::LSTMLayerT<float, 2, 20>, 29 RTNeural::DenseT<float, 20, 1>> model_cond1; 30 31 RTNeural::ModelT<float, 3, 1, 32 RTNeural::LSTMLayerT<float, 3, 20>, 33 RTNeural::DenseT<float, 20, 1>> model_cond2; 34 35 // Pre-Allowcate arrays for feeding the models 36 float inArray1[2] = { 0.0, 0.0 }; 37 float inArray2[3] = { 0.0, 0.0, 0.0 }; 38 };