Common
#include "max/c/common.h"
#include "max/c/common.h"
Functions
M_version()
const char *M_version()
Gets the MAX Engine version.
-
Returns:
A string containing the semantic version of the MAX Engine.
M_newStatus()
M_Status *M_newStatus()
Creates a new status object.
This is required as an argument for several functions, such as M_newRuntimeContext()
and M_compileModel()
. They will update the status object and you can check for errors with M_isError()
and get the status message with M_getError()
. For example:
M_Status *status = M_newStatus();
M_RuntimeConfig *runtimeConfig = M_newRuntimeConfig();
M_RuntimeContext *context = M_newRuntimeContext(runtimeConfig, status);
if (M_isError(status)) {
logError(M_getError(status));
return EXIT_FAILURE;
}
M_Status *status = M_newStatus();
M_RuntimeConfig *runtimeConfig = M_newRuntimeConfig();
M_RuntimeContext *context = M_newRuntimeContext(runtimeConfig, status);
if (M_isError(status)) {
logError(M_getError(status));
return EXIT_FAILURE;
}
-
Returns:
A pointer to the new status object. You are responsible for the memory associated with the pointer returned. You can deallocate the memory by calling
M_freeStatus()
.
M_getError()
const char *M_getError(const M_Status *status)
Gets an error message from the M_Status
parameter.
You should call this only if M_isError()
is true.
-
Parameters:
status – The status object for reporting errors and other messages.
-
Returns:
A pointer to a null-terminated string containing the error message.
M_isError()
int M_isError(const M_Status *status)
Checks if status holds an error value.
-
Parameters:
status – The status object for reporting errors and other messages.
-
Returns:
0
if there is no error,1
otherwise.
M_freeStatus()
void M_freeStatus(M_Status *status)
Deallocates the memory for the status object. No-op if status
is NULL
.
-
Parameters:
status – The status object for reporting errors and other messages.
M_sizeOf()
size_t M_sizeOf(M_Dtype type)
Gets the size (in bytes) of a data type.
-
Parameters:
type – The data type.
-
Returns:
Size in bytes of the given data type. If the data type is
M_UNKNOWN
, then0
.
M_getDynamicDimensionValue()
int64_t M_getDynamicDimensionValue()
Gets the value representing dynamic dimension.
Use this to indicate a dynamic tensor shape when declaring TorchScript input specs with M_TorchInputSpec()
.
-
Returns:
Value representing dynamic dimension.
M_getDynamicRankValue()
int64_t M_getDynamicRankValue()
Gets the value representing dynamic rank.
-
Returns:
Value representing dynamic rank.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!