RTNeuralLSTM.h (1160B)
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 float previousParam1 = 0.0; 22 float steppedValue1 = 0.0; 23 bool changedParam1 = false; 24 25 private: 26 RTNeural::ModelT<float, 1, 1, 27 RTNeural::LSTMLayerT<float, 1, 40>, 28 RTNeural::DenseT<float, 40, 1>> model; 29 30 RTNeural::ModelT<float, 2, 1, 31 RTNeural::LSTMLayerT<float, 2, 40>, 32 RTNeural::DenseT<float, 40, 1>> model_cond1; 33 34 RTNeural::ModelT<float, 3, 1, 35 RTNeural::LSTMLayerT<float, 3, 40>, 36 RTNeural::DenseT<float, 40, 1>> model_cond2; 37 38 // Pre-Allowcate arrays for feeding the models 39 float inArray1[2] = { 0.0, 0.0 }; 40 float inArray2[3] = { 0.0, 0.0, 0.0 }; 41 };