From e3c321c03f8b77bfe477023eafbdc923b5f9ea99 Mon Sep 17 00:00:00 2001 From: Dmitri Smirnov Date: Fri, 4 Oct 2024 14:03:56 -0700 Subject: [PATCH] Expose enable_mem_arena property for SessionOptions --- 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 5ac9c149bbe80..ce7259172da30 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; },