Types

Preview

MAX Engine is coming in Q1 2024. Sign up for updates.

#include "modular/c/types.h"

Typedefs

typedef struct M_Status M_Status

Contains the success or failure of an API call.

In general, any API that may fail accepts a M_Status argument that is filled in with a meaningful error message on failure.

You can create this with M_newStatus(). When you’re done, call M_freeStatus().

typedef struct M_RuntimeConfig M_RuntimeConfig

Specifies the MAX Engine configuration.

Configuration properties include the number of threads, artifact path, etc.

You can create this with M_newRuntimeConfig(). When you’re done, call M_freeRuntimeConfig().

typedef struct M_RuntimeContext M_RuntimeContext

Contains information that needs to be shared between APIs.

You can create this with M_newRuntimeContext(). When you’re done, call M_freeRuntimeContext().

typedef struct M_CompileConfig M_CompileConfig

Specifies the configuration required for model compilation.

You can create this with M_newCompileConfig(). When you’re done, call M_freeCompileConfig().

typedef struct M_DeviceConfig M_DeviceConfig
typedef struct M_AsyncCompiledModel M_AsyncCompiledModel

Contains an async value to a compiled model.

M_AsyncCompiledModel can be passed to other APIs that accept compiled models as a function parameter. This async value will eventually resolve to a compiled model or an error in the case of compilation failure.

You can create this with M_compileModel(). When you’re done, call M_freeCompiledModel().

typedef struct M_AsyncModel M_AsyncModel

Contains a future used for inference.

The future will resolve to a model that’s ready for inference.

You can create this with M_initModel(). When you’re done, call M_freeModel().

typedef enum M_Dtype M_Dtype

Represents all data types supported by the framework.

typedef struct M_AsyncTensor M_AsyncTensor

Contains an async value to a tensor for inference.

You can get this from M_getTensorByNameFrom(). When you’re done, call M_freeTensor().

typedef struct M_TensorNameArray M_TensorNameArray

Contains an array of tensor names of model inputs or outputs.

You can get this from M_getInputNames() and M_getOutputNames(). When you’re done, call M_freeTensorNameArray().

typedef struct M_TensorSpec M_TensorSpec

Contains the representation of a shape and an element type.

You can create this with M_newTensorSpec(). When you’re done, call M_freeTensorSpec().

typedef struct M_AsyncTensorMap M_AsyncTensorMap

Contains a collection of tensors.

The collection of tensors is used to represent inputs and outputs when executing a model.

You can create this with M_newAsyncTensorMap(). When you’re done, call M_freeAsyncTensorMap().

typedef struct M_TensorMapIterator M_TensorMapIterator

Contains an iterator over a collection of tensors. Note that the iteration order may not be deterministic.

typedef struct M_AsyncValue M_AsyncValue

Contains an async value for inference.

typedef struct M_Config M_Config

Contains a Config.

Enums

enum M_Dtype

Represents all data types supported by the framework.

Values:

enumerator M_UNKNOWN
enumerator M_INT8
enumerator M_INT16
enumerator M_INT32
enumerator M_INT64
enumerator M_UINT8
enumerator M_UINT16
enumerator M_UINT32
enumerator M_UINT64
enumerator M_FLOAT16
enumerator M_FLOAT32
enumerator M_FLOAT64
enumerator M_BOOL

Variables

const int64_t apiDynamicDimension = -1