mlx.core.exporter#
- exporter(file: str, fun: Callable, *, shapeless: bool = False) mlx.core.FunctionExporter #
创建一个可调用对象,用于将函数的多个跟踪导出到文件。
警告
这是实验性 API 的一部分,未来版本的 MLX 中可能会发生变化。使用旧版本 MLX 导出的函数可能与未来版本不兼容。
示例
def fun(*args): return sum(args) with mx.exporter("fun.mlxfn", fun) as exporter: exporter(mx.array(1)) exporter(mx.array(1), mx.array(2)) exporter(mx.array(1), mx.array(2), mx.array(3))