modelBaseRecurrentNeuralNet
Extends from BaseNeuralNet.
Information
Use this base class if you want to include a recurrent neural network in Modelica.
Please extend this model in your own model. After extending you have to
- give the path to the TFLite/ONNX model
- specify the number of inputs
- specify the sampling interval and how many elements from previous times should be fed into the net
- create input and output connectors
- connect input and output connectors to the single input and single output vector of the runInference submodel
In continuous mode the historic values are generated by a delay. You could choose between the computational improved Clara-Delay and the delay in the Modelica-Standard-Library. If continuous is deactivated the model will create an event when reaching the sampling time - this should be avoided for performance reasons.
As tensorflow lite uses a flattened input array, you have to specify the flattening method. In the standard tensorflow setting you have to use the predefined option OldFirstInputSequential.
For an exemplaric usage the user can take a look at the model TF_PI_RNN_tflite which uses the block EvaluateRecurrentNeuralNet which extends from this base model.
Parameters
| Type | Name | Default | Description |
|---|---|---|---|
| Integer | nInputElements (from BaseNeuralNet) | product(inputSizes) | |
| Integer | nOutputElements (from BaseNeuralNet) | product(outputSizes) | |
| Selected Model | |||
| String | pathToAIModel (from BaseNeuralNet) | "" | Choose path to AI model |
| Tensor sizing | |||
| Integer | inputDimensions (from BaseNeuralNet) | 1 | Number of input dimension |
| Integer | inputSizes (from BaseNeuralNet) | {1} | Vector with size of tensor in each dimension |
| Integer | outputDimensions (from BaseNeuralNet) | 1 | Number of output dimension |
| Integer | outputSizes (from BaseNeuralNet) | {1} | Vector with size of tensor in each dimension |
| RNN Timing Settings | |||
| Boolean | stateful (from BaseNeuralNet) | false | Activate state handling for RNN with state in-/outputs |
| Real | samplePeriod (from BaseNeuralNet) | 0 | Fixed sample period for RNNs |
| Integer | nHistoricElements | 10 | Number of elements from sampling steps for each input fed to the neural net |
| Boolean | continuous | false | =true: model operates continuously; input values are delayed |
| Boolean | useClaRaDelay | true | Use the ClaRa delay instead of MSL delay |
| Advanced › Performance | |||
| Integer | numberOfThreads (from BaseNeuralNet) | 1 | Number of threads used for inference (0: Number of CPU cores) |
| Advanced › TFLite | |||
| Boolean | useFlexOps (from BaseNeuralNet) | false | Activate to allow Tensorflow Flex Ops for tflite models |
| Advanced › ONNX | |||
| Boolean | useGPU (from BaseNeuralNet) | false | Activate to use a compatible CUDA GPU for inference |
| Integer | gpuDeviceID (from BaseNeuralNet) | 0 | CUDA device ID |
| SMArtInt.Internal.Types.ExecutionMode | executionMode (from BaseNeuralNet) | SMArtInt.Internal.Types.ExecutionMode.Sequential | Execution mode for run inference |
| Input/Output Sizing | |||
| Integer | numberOfInputs | 1 | Number of input values |
| Integer | numberOfOutputs | 1 | Number of output values |
| Integer | batchSize | 1 | Number of parallel batched simulations |
| Boolean | returnSequences | false | |
Components
| Type | Name | Default | Description |
|---|---|---|---|
| Internal.Utilities.Dependencies.OnnxGpuDependencies | onnxGpuDependencies (from BaseNeuralNet) | ||
| Internal.Utilities.Dependencies.TFFlexOpsDependencies | tFFlexOpsDependencies (from BaseNeuralNet) | ||
| Internal.Utilities.RunInterferenceRNN | runInterferenceHistory |