Skip to main content
Log in

Types

#include "max/c/types.h"
#include "max/c/types.h"

Typedefs

M_Status

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().

M_RuntimeConfig

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().

M_RuntimeContext

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().

M_UInt64Counter

typedef struct M_UInt64Counter M_UInt64Counter

Represents custom counters created by user to be fed to the custom metrics end-point.

M_DoubleCounter

typedef struct M_DoubleCounter M_DoubleCounter

M_UInt64Histogram

typedef struct M_UInt64Histogram M_UInt64Histogram

M_DoubleHistogram

typedef struct M_DoubleHistogram M_DoubleHistogram

M_Int64Gauge

typedef struct M_Int64Gauge M_Int64Gauge

M_DoubleGauge

typedef struct M_DoubleGauge M_DoubleGauge

M_CustomMetricReader

typedef struct M_CustomMetricReader M_CustomMetricReader

Represents a custom metrics reader created by the user to generate custom metrics.

M_CompileConfig

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().

M_DeviceConfig

typedef struct M_DeviceConfig M_DeviceConfig

M_AsyncCompiledModel

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().

M_AsyncModel

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().

M_AsyncTensor

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().

M_TensorNameArray

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().

M_TensorSpec

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().

M_AsyncTensorMap

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().

M_TensorMapIterator

typedef struct M_TensorMapIterator M_TensorMapIterator

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

M_AsyncValue

typedef struct M_AsyncValue M_AsyncValue

Contains an async value for inference.

M_Config

typedef struct M_Config M_Config

Contains a Config.

M_AsyncDict

typedef struct M_AsyncDict M_AsyncDict

Contains an async value to a dict.

M_AsyncList

typedef struct M_AsyncList M_AsyncList

Contains an async value to a list.

M_AsyncTuple

typedef struct M_AsyncTuple M_AsyncTuple

Contains an async value to a tuple.

M_AsyncNone

typedef struct M_AsyncNone M_AsyncNone

Contains an async value to none.

M_MaxContext

typedef struct M_MaxContext M_MaxContext

Global context for MAX.

M_ModelSource

typedef struct M_ModelSource M_ModelSource

Contains the source format and representation to compile a model.

M_WeightsRegistry

typedef struct M_WeightsRegistry M_WeightsRegistry

Maps unique weight names to their backing data.

M_DevicesList

typedef struct M_DevicesList M_DevicesList

Contains the a list of device pointers.

M_DeviceRefsList

typedef struct M_DeviceRefsList M_DeviceRefsList

Contains the a list of device refs.

Enums

M_Dtype

enum M_Dtype

Represents all data types supported by the framework.

Values:

M_UNKNOWN

enumerator M_UNKNOWN

M_INT8

enumerator M_INT8

M_INT16

enumerator M_INT16

M_INT32

enumerator M_INT32

M_INT64

enumerator M_INT64

M_UINT8

enumerator M_UINT8

M_UINT16

enumerator M_UINT16

M_UINT32

enumerator M_UINT32

M_UINT64

enumerator M_UINT64

M_FLOAT16

enumerator M_FLOAT16

M_FLOAT32

enumerator M_FLOAT32

M_FLOAT64

enumerator M_FLOAT64

M_BFLOAT16

enumerator M_BFLOAT16

M_FLOAT8_E4M3

enumerator M_FLOAT8_E4M3

M_FLOAT8_E4M3FNUZ

enumerator M_FLOAT8_E4M3FNUZ

M_FLOAT8_E5M2

enumerator M_FLOAT8_E5M2

M_FLOAT8_E5M2FNUZ

enumerator M_FLOAT8_E5M2FNUZ

M_BOOL

enumerator M_BOOL

M_AllocatorType

enum M_AllocatorType

Contains an AllocatorType. You can choose between kCaching and kSystem kCaching trades off higher memory usage for better performance. kSystem uses the default system allocator.

Values:

kSystem

enumerator kSystem

kCaching

enumerator kCaching

M_ValueType

enum M_ValueType

Represents the type of a value.

Values:

M_STRING_VALUE

enumerator M_STRING_VALUE

M_DOUBLE_VALUE

enumerator M_DOUBLE_VALUE

M_LONG_VALUE

enumerator M_LONG_VALUE

M_BOOL_VALUE

enumerator M_BOOL_VALUE

M_TENSOR_VALUE

enumerator M_TENSOR_VALUE

M_LIST_VALUE

enumerator M_LIST_VALUE

M_TUPLE_VALUE

enumerator M_TUPLE_VALUE

M_DICT_VALUE

enumerator M_DICT_VALUE

M_NONE_VALUE

enumerator M_NONE_VALUE

M_UNKNOWN_VALUE

enumerator M_UNKNOWN_VALUE

M_MOJO_VALUE

enumerator M_MOJO_VALUE

M_PYTHON_MOJO_VALUE

enumerator M_PYTHON_MOJO_VALUE

M_FrameworkFormat

enum M_FrameworkFormat

Represents the format.

Values:

M_MAX_GRAPH_FRAMEWORK_FORMAT

enumerator M_MAX_GRAPH_FRAMEWORK_FORMAT

M_TORCHSCRIPT_MODULE_FRAMEWORK_FORMAT

enumerator M_TORCHSCRIPT_MODULE_FRAMEWORK_FORMAT

M_TORCHSCRIPT_FUNCTION_FRAMEWORK_FORMAT

enumerator M_TORCHSCRIPT_FUNCTION_FRAMEWORK_FORMAT

M_TORCH_MLIR_FRAMEWORK_FORMAT

enumerator M_TORCH_MLIR_FRAMEWORK_FORMAT

M_ResultOutputStyle

enum M_ResultOutputStyle

Represents the the result output style for debug printing.

Values:

M_COMPACT

enumerator M_COMPACT

M_FULL

enumerator M_FULL

M_BINARY

enumerator M_BINARY

M_BINARY_MAX_CHECKPOINT

enumerator M_BINARY_MAX_CHECKPOINT

M_NONE

enumerator M_NONE