Common
#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;
}
-
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!
If you'd like to share more information, please report an issue on GitHub
π What went wrong?