MCPcopy Create free account
hub / github.com/ml-explore/mlx / PrintOptionsContext

Class PrintOptionsContext

python/src/print.cpp:16–28  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14using namespace nb::literals;
15
16struct PrintOptionsContext {
17 mx::PrintOptions old_options;
18 mx::PrintOptions new_options;
19 PrintOptionsContext(mx::PrintOptions p) : new_options(p) {}
20 PrintOptionsContext& enter() {
21 old_options = mx::get_global_formatter().format_options;
22 mx::set_printoptions(new_options);
23 return *this;
24 }
25 void exit(nb::args) {
26 mx::set_printoptions(old_options);
27 }
28};
29
30void init_print(nb::module_& m) {
31 // Set Python print formatting options

Callers 1

init_printFunction · 0.85

Calls 1

set_printoptionsFunction · 0.85

Tested by

no test coverage detected