Skip to main content

onnx_runtime_memory/
options.rs

1//! Planner configuration knobs.
2
3/// Options controlling what the activation planner considers part of the arena.
4#[derive(Clone, Copy, Debug, PartialEq, Eq, Default)]
5pub struct PlanOptions {
6    /// Include graph **inputs** as buffer owners in the activation arena.
7    ///
8    /// Defaults to `false`: graph inputs are supplied by the caller (feeds) and
9    /// are not part of the executor-owned scratch arena. Set to `true` when the
10    /// caller wants the planner to also account for input buffers (e.g. a
11    /// self-contained arena that copies feeds in).
12    pub include_graph_inputs: bool,
13}
14
15impl PlanOptions {
16    /// The default options (graph inputs excluded).
17    pub fn new() -> Self {
18        Self::default()
19    }
20
21    /// Also treat graph inputs as arena buffer owners.
22    pub fn with_graph_inputs(mut self, include: bool) -> Self {
23        self.include_graph_inputs = include;
24        self
25    }
26}