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

TypeNameDefaultDescription
IntegernInputElements (from BaseNeuralNet)product(inputSizes)
IntegernOutputElements (from BaseNeuralNet)product(outputSizes)
Selected Model
StringpathToAIModel (from BaseNeuralNet)""Choose path to AI model
Tensor sizing
IntegerinputDimensions (from BaseNeuralNet)1Number of input dimension
IntegerinputSizes (from BaseNeuralNet){1}Vector with size of tensor in each dimension
IntegeroutputDimensions (from BaseNeuralNet)1Number of output dimension
IntegeroutputSizes (from BaseNeuralNet){1}Vector with size of tensor in each dimension
RNN Timing Settings
Booleanstateful (from BaseNeuralNet)falseActivate state handling for RNN with state in-/outputs
RealsamplePeriod (from BaseNeuralNet)0Fixed sample period for RNNs
IntegernHistoricElements10Number of elements from sampling steps for each input fed to the neural net
Booleancontinuousfalse=true: model operates continuously; input values are delayed
BooleanuseClaRaDelaytrueUse the ClaRa delay instead of MSL delay
Advanced › Performance
IntegernumberOfThreads (from BaseNeuralNet)1Number of threads used for inference (0: Number of CPU cores)
Advanced › TFLite
BooleanuseFlexOps (from BaseNeuralNet)falseActivate to allow Tensorflow Flex Ops for tflite models
Advanced › ONNX
BooleanuseGPU (from BaseNeuralNet)falseActivate to use a compatible CUDA GPU for inference
IntegergpuDeviceID (from BaseNeuralNet)0CUDA device ID
SMArtInt.Internal.Types.ExecutionModeexecutionMode (from BaseNeuralNet)SMArtInt.Internal.Types.ExecutionMode.SequentialExecution mode for run inference
Input/Output Sizing
IntegernumberOfInputs1Number of input values
IntegernumberOfOutputs1Number of output values
IntegerbatchSize1Number of parallel batched simulations
BooleanreturnSequencesfalse

Components

TypeNameDefaultDescription
Internal.Utilities.Dependencies.OnnxGpuDependenciesonnxGpuDependencies (from BaseNeuralNet)
Internal.Utilities.Dependencies.TFFlexOpsDependenciestFFlexOpsDependencies (from BaseNeuralNet)
Internal.Utilities.RunInterferenceRNNrunInterferenceHistory