2023-12-01 03:12:53 +08:00
|
|
|
// Copyright © 2023 Apple Inc.
|
|
|
|
|
2023-11-30 02:52:08 +08:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "mlx/array.h"
|
|
|
|
|
|
|
|
namespace mlx::core {
|
|
|
|
|
2024-02-08 05:15:59 +08:00
|
|
|
struct NodeNamer {
|
|
|
|
std::unordered_map<std::uintptr_t, std::string> names;
|
|
|
|
|
|
|
|
const std::string& get_name(const array& x);
|
|
|
|
};
|
|
|
|
|
2023-11-30 02:52:08 +08:00
|
|
|
void print_graph(std::ostream& os, const std::vector<array>& outputs);
|
|
|
|
|
|
|
|
template <typename... Arrays>
|
|
|
|
void print_graph(std::ostream& os, Arrays... outputs) {
|
|
|
|
print_graph(os, std::vector<array>{std::forward<Arrays>(outputs)...});
|
|
|
|
}
|
|
|
|
|
|
|
|
void export_to_dot(std::ostream& os, const std::vector<array>& outputs);
|
|
|
|
|
|
|
|
template <typename... Arrays>
|
|
|
|
void export_to_dot(std::ostream& os, Arrays... outputs) {
|
|
|
|
export_to_dot(os, std::vector<array>{std::forward<Arrays>(outputs)...});
|
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace mlx::core
|