refactor!: flatten operator module

This commit is contained in:
Carson M.
2026-01-15 02:21:04 -06:00
parent 2650caa43c
commit 98519baca8
6 changed files with 15 additions and 27 deletions

View File

@@ -1,9 +1,5 @@
use ort::{
operator::{
Operator, OperatorDomain,
io::{OperatorInput, OperatorOutput},
kernel::{Kernel, KernelAttributes, KernelContext}
},
operator::{Kernel, KernelAttributes, KernelContext, Operator, OperatorDomain, OperatorInput, OperatorOutput},
session::Session,
value::{Tensor, TensorElementType}
};

View File

@@ -9,7 +9,7 @@ use smallvec::SmallVec;
use crate::{
AsPointer, Error, OnceLock, Result,
operator::attribute::Attribute,
operator::Attribute,
ortsys,
session::{Session, builder::SessionBuilder},
util::{with_cstr, with_cstr_ptr_array},
@@ -68,7 +68,7 @@ impl Node {
/// - `attributes` is an array of attributes used to configure the operator, e.g. `strides` for `Conv` nodes.
///
/// ```
/// # use ort::{editor::{Node, ONNX_DOMAIN}, operator::attribute::Attribute};
/// # use ort::{editor::{Node, ONNX_DOMAIN}, operator::Attribute};
/// # fn main() -> ort::Result<()> {
/// let node = Node::new(
/// "Conv",

View File

@@ -210,7 +210,7 @@ impl<'a> AsPointer for Logger<'a> {
/// Logs a message to a given [`Logger`].
///
/// ```
/// # use ort::operator::kernel::{Kernel, KernelContext};
/// # use ort::operator::{Kernel, KernelContext};
/// struct MyKernel;
///
/// impl Kernel for MyKernel {

View File

@@ -3,18 +3,18 @@
use alloc::{boxed::Box, ffi::CString, vec::Vec};
use core::ptr::{self, NonNull};
pub mod attribute;
mod attribute;
pub(crate) mod bound;
pub mod io;
pub mod kernel;
mod io;
mod kernel;
#[cfg(test)]
mod tests;
use self::{
attribute::FromOpAttr,
bound::BoundOperator,
io::{OperatorInput, OperatorOutput},
kernel::{Kernel, KernelAttributes}
use self::bound::BoundOperator;
pub use self::{
attribute::{Attribute, FromKernelAttributes, FromOpAttr, ToAttribute},
io::{InputOutputCharacteristic, OperatorInput, OperatorOutput},
kernel::{Kernel, KernelAttributes, KernelContext, ScratchBuffer}
};
use crate::{
AsPointer, Error,
@@ -45,7 +45,7 @@ pub trait Operator: Send {
/// stream.
///
/// [`Tensor::data_ptr`]: crate::value::Tensor::data_ptr
/// [`KernelContext::compute_stream`]: crate::operator::kernel::KernelContext::compute_stream
/// [`KernelContext::compute_stream`]: crate::operator::KernelContext::compute_stream
fn execution_provider_type(&self) -> Option<&str> {
None
}

View File

@@ -1,10 +1,6 @@
use crate::{
Result,
operator::{
Operator, OperatorDomain,
io::{OperatorInput, OperatorOutput},
kernel::{Kernel, KernelAttributes, KernelContext}
},
operator::{Kernel, KernelAttributes, KernelContext, Operator, OperatorDomain, OperatorInput, OperatorOutput},
session::Session,
value::{Tensor, TensorElementType}
};

View File

@@ -1,11 +1,7 @@
use ort::{
ep,
memory::{AllocationDevice, Allocator, AllocatorType, MemoryInfo, MemoryType},
operator::{
Operator, OperatorDomain,
io::{OperatorInput, OperatorOutput},
kernel::{Kernel, KernelAttributes, KernelContext}
},
operator::{Kernel, KernelAttributes, KernelContext, Operator, OperatorDomain, OperatorInput, OperatorOutput},
session::{Adapter, RunOptions, Session},
value::{Tensor, TensorElementType}
};