From 0645ad19a4aa170457af4bd80ef4ef99db5f9620 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Fri, 4 Oct 2024 16:43:15 -0700 Subject: [PATCH] [PyBind] Expose enable_mem_arena property for SessionOptions (#22323) ### Description Expose enable_mem_arena property for SessionOptions ### Motivation and Context https://github.com/microsoft/onnxruntime/issues/22271 --- onnxruntime/python/onnxruntime_pybind_state.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/onnxruntime/python/onnxruntime_pybind_state.cc b/onnxruntime/python/onnxruntime_pybind_state.cc index 5ac9c149bb..ce7259172d 100644 --- a/onnxruntime/python/onnxruntime_pybind_state.cc +++ b/onnxruntime/python/onnxruntime_pybind_state.cc @@ -1688,6 +1688,13 @@ Serialized model format will default to ONNX unless: - there is no 'session.save_model_format' config entry and optimized_model_filepath ends in '.ort' (case insensitive) )pbdoc") + .def_property( + "enable_cpu_mem_arena", + [](const PySessionOptions* options) -> bool { return options->value.enable_cpu_mem_arena; }, + [](PySessionOptions* options, bool enable_cpu_mem_arena) -> void { + options->value.enable_cpu_mem_arena = enable_cpu_mem_arena; + }, + R"pbdoc(Enable memory arena on CPU. Default is true.)pbdoc") .def_property( "enable_mem_pattern", [](const PySessionOptions* options) -> bool { return options->value.enable_mem_pattern; },