Update export function example for array input (#2598)

After changing the shape to conform (same shapes for all objects), the example works.
This commit is contained in:
Umberto Mignozzetti
2025-09-16 14:38:05 -07:00
committed by GitHub
parent caecbe876a
commit 3f730e77aa

View File

@@ -164,11 +164,11 @@ to export a function which can be used for inputs with variable shapes:
.. code-block:: python .. code-block:: python
mx.export_function("fun.mlxfn", mx.abs, mx.array(0.0), shapeless=True) mx.export_function("fun.mlxfn", mx.abs, mx.array([0.0]), shapeless=True)
imported_abs = mx.import_function("fun.mlxfn") imported_abs = mx.import_function("fun.mlxfn")
# Ok # Ok
out, = imported_abs(mx.array(-1.0)) out, = imported_abs(mx.array([-1.0]))
# Also ok # Also ok
out, = imported_abs(mx.array([-1.0, -2.0])) out, = imported_abs(mx.array([-1.0, -2.0]))