Class emulator::inference::StubBackend
ClassList > emulator > inference > StubBackend
Stub backend for testing without actual inference. More...
#include <stub_backend.hpp>
Inherits the following classes: emulator::inference::InferenceBackend
Public Functions
| Type | Name |
|---|---|
| StubBackend () = default |
|
| virtual void | finalize () override Release resources and finalize the backend. |
| virtual bool | infer (const double * inputs, double * outputs, int batch_size) override Run inference on input data. |
| virtual bool | initialize (const InferenceConfig & config) override Initialize the backend. |
| virtual bool | is_initialized () override const Check if the backend is ready for inference. |
| virtual std::string | name () override const Get the human-readable name of this backend. |
| virtual BackendType | type () override const Get the backend type enumeration. |
| ~StubBackend () override |
Public Functions inherited from emulator::inference::InferenceBackend
See emulator::inference::InferenceBackend
| Type | Name |
|---|---|
| virtual void | finalize () = 0 Release resources and finalize the backend. |
| virtual bool | infer (const double * inputs, double * outputs, int batch_size) = 0 Run inference on input data. |
| virtual bool | initialize (const InferenceConfig & config) = 0 Initialize the backend. |
| virtual bool | is_initialized () const = 0 Check if the backend is ready for inference. |
| virtual std::string | name () const = 0 Get the human-readable name of this backend. |
| virtual BackendType | type () const = 0 Get the backend type enumeration. |
| virtual ValidationResult | validate () const Validate configuration before running. |
| virtual | ~InferenceBackend () = default |
Detailed Description
Public Functions Documentation
function StubBackend
emulator::inference::StubBackend::StubBackend () = default
function finalize
Release resources and finalize the backend.
virtual void emulator::inference::StubBackend::finalize () override
Finalize the stub backend.
After calling this, the backend is no longer usable until initialize() is called again.
Resets initialization state. Backend can be re-initialized after this.
Implements emulator::inference::InferenceBackend::finalize
function infer
Run inference on input data.
virtual bool emulator::inference::StubBackend::infer (
const double * inputs,
double * outputs,
int batch_size
) override
Run stub inference (no-op).
Executes the model on the provided input batch and writes results to the output buffer.
Parameters:
inputsInput data array, size = batch_size * input_channelsoutputsOutput data array, size = batch_size * output_channelsbatch_sizeNumber of samples in the batch
Returns:
true if inference succeeded, false on error
Precondition:
initialize() must have been called successfully
Precondition:
outputs must be pre-allocated with sufficient size
Sets all output values to zero. Useful for testing the data pipeline without actual model inference.
Parameters:
inputsInput data (unused)outputsOutput data, will be zeroedbatch_sizeNumber of samples in batch
Returns:
true if initialized, false otherwise
Implements emulator::inference::InferenceBackend::infer
function initialize
Initialize the backend.
virtual bool emulator::inference::StubBackend::initialize (
const InferenceConfig & config
) override
Initialize the stub backend.
Loads the model, allocates resources, and prepares for inference. Must be called before infer().
Parameters:
configConfiguration options
Returns:
true if initialization succeeded, false on error
Stores configuration for later use. Always succeeds.
Parameters:
configConfiguration (only input/output channels are used)
Returns:
Always returns true
Implements emulator::inference::InferenceBackend::initialize
function is_initialized
Check if the backend is ready for inference.
inline virtual bool emulator::inference::StubBackend::is_initialized () override const
Returns:
true if initialized and ready
Implements emulator::inference::InferenceBackend::is_initialized
function name
Get the human-readable name of this backend.
inline virtual std::string emulator::inference::StubBackend::name () override const
Returns:
Backend name (e.g., "LibTorch", "Stub")
Implements emulator::inference::InferenceBackend::name
function type
Get the backend type enumeration.
inline virtual BackendType emulator::inference::StubBackend::type () override const
Returns:
BackendType value
Implements emulator::inference::InferenceBackend::type
function ~StubBackend
emulator::inference::StubBackend::~StubBackend () override
The documentation for this class was generated from the following file components/emulator_comps/common/src/inference/stub_backend.hpp