mirror of
https://github.com/ml-explore/mlx.git
synced 2025-12-16 01:49:05 +08:00
Fix shared library not exporting symbols on Windows (#1684)
* Fix shared library not exporting symbols on Windows * Function name style
This commit is contained in:
@@ -56,7 +56,10 @@ inline void PrintFormatter::print(std::ostream& os, complex64_t val) {
|
||||
os << val;
|
||||
}
|
||||
|
||||
PrintFormatter global_formatter;
|
||||
PrintFormatter& get_global_formatter() {
|
||||
static PrintFormatter formatter;
|
||||
return formatter;
|
||||
}
|
||||
|
||||
Dtype result_type(const std::vector<array>& arrays) {
|
||||
Dtype t = bool_;
|
||||
@@ -171,7 +174,7 @@ void print_subarray(std::ostream& os, const array& a, size_t index, int dim) {
|
||||
i = n - num_print - 1;
|
||||
index += s * (n - 2 * num_print - 1);
|
||||
} else if (is_last) {
|
||||
global_formatter.print(os, a.data<T>()[index]);
|
||||
get_global_formatter().print(os, a.data<T>()[index]);
|
||||
} else {
|
||||
print_subarray<T>(os, a, index, dim + 1);
|
||||
}
|
||||
@@ -187,7 +190,7 @@ void print_array(std::ostream& os, const array& a) {
|
||||
os << "array(";
|
||||
if (a.ndim() == 0) {
|
||||
auto data = a.data<T>();
|
||||
global_formatter.print(os, data[0]);
|
||||
get_global_formatter().print(os, data[0]);
|
||||
} else {
|
||||
print_subarray<T>(os, a, 0, 0);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user