Skip to content

Namespace emulator::inference

Namespace List > emulator > inference

Classes

Type Name
class InferenceBackend
Abstract interface for inference backends.
struct InferenceConfig
Configuration options for inference backends.
class LibTorchBackend
LibTorch backend for native C++ PyTorch inference.
class StubBackend
Stub backend for testing without actual inference.
struct ValidationResult
Result of configuration validation.

Public Types

Type Name
enum BackendType
Enumeration of available inference backend types.

Public Functions

Type Name
std::string backend_type_to_string (BackendType type)
Convert a BackendType to its string representation.
std::unique_ptr< InferenceBackend > create_backend (BackendType type)
Factory function to create an inference backend by type.
std::unique_ptr< InferenceBackend > create_backend (const InferenceConfig & config)
Factory function to create and initialize a backend.
BackendType parse_backend_type (const std::string & str)
Parse a backend type from a string.

Public Types Documentation

enum BackendType

Enumeration of available inference backend types.

enum emulator::inference::BackendType {
    STUB,
    LIBTORCH
};


Public Functions Documentation

function backend_type_to_string

Convert a BackendType to its string representation.

inline std::string emulator::inference::backend_type_to_string (
    BackendType type
) 

Parameters:

  • type The backend type

Returns:

String name of the backend


function create_backend

Factory function to create an inference backend by type.

std::unique_ptr< InferenceBackend > emulator::inference::create_backend (
    BackendType type
) 

Create an inference backend by type.

Creates an uninitialized backend instance. Call initialize() on the returned object before use.

Parameters:

  • type Backend type to create

Returns:

Unique pointer to new backend instance, or nullptr on error

Creates an uninitialized backend instance. The caller must call initialize() on the returned object before using it.

Parameters:

  • type Backend type to create

Returns:

Unique pointer to new backend, or StubBackend if type unavailable

Note:

If a requested backend is not available at compile time (e.g., LIBTORCH without EMULATOR_HAS_LIBTORCH defined), falls back to Stub.


function create_backend

Factory function to create and initialize a backend.

std::unique_ptr< InferenceBackend > emulator::inference::create_backend (
    const InferenceConfig & config
) 

Create and initialize a backend from configuration.

Convenience function that creates a backend and calls initialize().

Parameters:

  • config Configuration including backend type and init parameters

Returns:

Initialized backend, or nullptr if creation/init failed

Convenience function that creates a backend and calls initialize(). If initialization fails, returns nullptr.

Parameters:

  • config Configuration with backend type and parameters

Returns:

Initialized backend, or nullptr on failure


function parse_backend_type

Parse a backend type from a string.

inline BackendType emulator::inference::parse_backend_type (
    const std::string & str
) 

Supports case-insensitive matching and common aliases.

Parameters:

  • str String to parse ("libtorch", "torch", "stub", etc.)

Returns:

Corresponding BackendType (defaults to STUB if unrecognized)



The documentation for this class was generated from the following file components/emulator_comps/common/src/inference/inference_backend.hpp