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 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!
π What went wrong?