Mojo package
engine
APIs to run inference with MAX Engine.
Although there are several modules in this max.engine
package, you'll get
everything you need from this top-level engine
namespace, so you don't need
to import each module.
For example, the basic code you need to run an inference looks like this:
from max import engine
def main():
# Load your model:
var session = engine.InferenceSession()
var model = session.load(model_path)
# Get the inputs, then run an inference:
var outputs = model.execute(inputs)
# Process the outputs here.
from max import engine
def main():
# Load your model:
var session = engine.InferenceSession()
var model = session.load(model_path)
# Get the inputs, then run an inference:
var outputs = model.execute(inputs)
# Process the outputs here.
Modules
-
info
: Provides information about MAX Engine, such as the version. -
model
: Defines theModel
type that holds a model ready for execution. -
session
: Defines theInferenceSession
type that serves as an entry point to MAX Engine. -
shape_element
: ShapeElement API. See ShapeElement struct definition for details. -
tensor
: Defines different data formats you can use to pass inputs to MAX Engine when executing a model. -
tensor_map
: Defines theTensorMap
type that holds input and output tensors for a model. -
tensor_spec
: DefinesEngineTensorSpec
to define a model's input and output specs. -
value
: Defines different value types you can be pass in and out of models.
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!