Onyx comes with a set of built-in tools to help create and manage model features:
Output: Features the model predicts (acceleration)
Input: Features fed into the model (velocity, position, control_input)
The parent and relation parameters of the Input and Output classes define how features update in the simulate() method:
'derivative': The parent is the time derivative of this feature
'delta': The parent is the delta change per timestep
'equal': The parent is equal to this feature (feed output straight back in as input)
In this example, we chained acceleration -> velocity -> position.You can also always use the underlying PyTorch model as is without calling simulate():
# Call the PyTorch model prediction directlytest_input = torch.ones(batch_size, sequence_length, num_features)with torch.no_grad(): test_output = model(test_input)print(test_output)
The simulate() method handles multi-step prediction:
Takes initial state values in x0
Takes the full trajectory for non-derived features in external_inputs
Automatically integrates states using the defined relations to roll out the trajectory
Returns a SimulationResult with trajectory data for all features
Note that simulating with integration schemes is a serial operation, since each timestep depends on the previous one.
For applications that can leverage parallel GPU acceleration, you may want to avoid features that require step-wise integration (no parent and relation).