Added formatter structure and a boolean value formatter (#354)

* added formatter structure and a boolean value formatter

---------

Co-authored-by: Awni Hannun <awni@apple.com>
This commit is contained in:
toji
2024-01-18 21:19:41 +05:30
committed by GitHub
parent d1fef34138
commit 49a52610b7
4 changed files with 64 additions and 3 deletions

View File

@@ -9,6 +9,24 @@
namespace mlx::core {
struct PrintFormatter {
inline void print(std::ostream& os, bool val);
inline void print(std::ostream& os, int16_t val);
inline void print(std::ostream& os, uint16_t val);
inline void print(std::ostream& os, int32_t val);
inline void print(std::ostream& os, uint32_t val);
inline void print(std::ostream& os, int64_t val);
inline void print(std::ostream& os, uint64_t val);
inline void print(std::ostream& os, float16_t val);
inline void print(std::ostream& os, bfloat16_t val);
inline void print(std::ostream& os, float val);
inline void print(std::ostream& os, complex64_t val);
bool capitalize_bool{false};
};
extern PrintFormatter global_formatter;
/** The type from promoting the arrays' types with one another. */
Dtype result_type(const std::vector<array>& arrays);