Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Source/Cmlx/include-framework/mlx-c-export.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ int mlx_imported_function_apply_kwargs(
const mlx_imported_function xfunc,
const mlx_vector_array args,
const mlx_map_string_to_array kwargs);
int mlx_export_to_dot_file(const char* path, mlx_array output);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need this change on the mlx-c side. I suspect you made changes locally to that. it is a good idea, I will talk to Ronan.

/**@}*/

#ifdef __cplusplus
Expand Down
1 change: 1 addition & 0 deletions Source/Cmlx/include/mlx/c/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ int mlx_imported_function_apply_kwargs(
const mlx_imported_function xfunc,
const mlx_vector_array args,
const mlx_map_string_to_array kwargs);
int mlx_export_to_dot_file(const char* path, mlx_array output);
/**@}*/

#ifdef __cplusplus
Expand Down
8 changes: 8 additions & 0 deletions Source/MLX/GraphExport.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import Cmlx

/// Export the computation graph of an array to a DOT file for visualization.
public func exportGraphToDot(path: String, output: MLXArray) {
path.withCString { cPath in
mlx_export_to_dot_file(cPath, output.ctx)
}
}