Skip to main content
Log in

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.

For details, see how to run inference with Mojo.

Modules​

  • ​info: Provides information about MAX Engine, such as the version.
  • ​model: Defines the Model type that holds a model ready for execution.
  • ​session: Defines the InferenceSession 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 the TensorMap type that holds input and output tensors for a model.
  • ​tensor_spec: Defines EngineTensorSpec 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?