rustnn C and C++ API
WebNN graph construction and execution
Loading...
Searching...
No Matches
rustnn.hpp File Reference

C++17 owning wrappers for the rustnn C API. More...

#include <rustnn/rustnn.h>
#include <cstddef>
#include <cstdint>
#include <optional>
#include <stdexcept>
#include <string>
#include <type_traits>
#include <utility>
#include <vector>

Go to the source code of this file.

Classes

class  rustnn::Error
 Exception containing the C API's failure message. More...
 
struct  rustnn::BackendDevice
 Explicit backend and device hint for context creation. More...
 
struct  rustnn::TrtxOptions
 TensorRT-RTX engine caching and execution options. More...
 
struct  rustnn::RustNNOptions
 rustnn-specific backend configuration. More...
 
struct  rustnn::MLContextOptions
 Backend selection and runtime configuration for MLContext. More...
 
struct  rustnn::MLOperatorOptions
 Optional operator label used in diagnostics. More...
 
class  rustnn::MLOperandDescriptor
 Owns an operand's element type and shape descriptor. More...
 
class  rustnn::MLTensorDescriptor
 Owns a tensor descriptor with host read and write permissions. More...
 
class  rustnn::MLOperand
 Owns an operand handle belonging to a graph builder. More...
 
class  rustnn::MLGraph
 Owns a compiled graph. Its originating context must outlive it. More...
 
class  rustnn::MLTensor
 Owns a backend tensor. Its originating context must outlive it. More...
 
class  rustnn::MLContext
 Owns a backend context for graph compilation, tensors and dispatch. More...
 
class  rustnn::MLGraphBuilder
 Records and validates graph operations. More...
 

Namespaces

namespace  rustnn
 

Enumerations

enum class  rustnn::MLOperandDataType {
  rustnn::Float32 = RustnnDataType_Float32 , rustnn::Float16 = RustnnDataType_Float16 , rustnn::Int32 = RustnnDataType_Int32 , rustnn::Uint32 = RustnnDataType_Uint32 ,
  rustnn::Int64 = RustnnDataType_Int64 , rustnn::Uint64 = RustnnDataType_Uint64 , rustnn::Int8 = RustnnDataType_Int8 , rustnn::Uint8 = RustnnDataType_Uint8 ,
  rustnn::Int4 = RustnnDataType_Int4 , rustnn::Uint4 = RustnnDataType_Uint4
}
 Element type, including packed signed and unsigned 4-bit integers. More...
 
enum class  rustnn::MLPowerPreference { rustnn::Default = RustnnPowerPreference_Default , rustnn::HighPerformance = RustnnPowerPreference_HighPerformance , rustnn::LowPower = RustnnPowerPreference_LowPower }
 Power preference used for automatic backend selection. More...
 
enum class  rustnn::Backend {
  rustnn::Automatic = RustnnBackend_Automatic , rustnn::Onnx = RustnnBackend_Onnx , rustnn::Trtx = RustnnBackend_Trtx , rustnn::Coreml = RustnnBackend_Coreml ,
  rustnn::Litert = RustnnBackend_Litert , rustnn::Cann = RustnnBackend_Cann
}
 Backend hint; Automatic delegates selection to rustnn. More...
 
enum class  rustnn::DeviceType { rustnn::Cpu = RustnnDeviceType_Cpu , rustnn::Gpu = RustnnDeviceType_Gpu , rustnn::Npu = RustnnDeviceType_Npu }
 Kind of device used to execute a graph. More...
 

Functions

void rustnn::initializeLogger ()
 Initialize rustnn's logger using the environment configuration.
 
void rustnn::check (RustnnStatus status)
 Throw Error if a C API call returned a failing status.
 

Detailed Description

C++17 owning wrappers for the rustnn C API.

Handles are move-only. Keep each context alive while using its builder, graphs and tensors. Failing C API calls throw rustnn::Error.

Definition in file rustnn.hpp.