mirror of
https://github.com/pykeio/ort
synced 2026-04-25 16:34:55 +02:00
refactor!: flatten operator module
This commit is contained in:
@@ -1,9 +1,5 @@
|
|||||||
use ort::{
|
use ort::{
|
||||||
operator::{
|
operator::{Kernel, KernelAttributes, KernelContext, Operator, OperatorDomain, OperatorInput, OperatorOutput},
|
||||||
Operator, OperatorDomain,
|
|
||||||
io::{OperatorInput, OperatorOutput},
|
|
||||||
kernel::{Kernel, KernelAttributes, KernelContext}
|
|
||||||
},
|
|
||||||
session::Session,
|
session::Session,
|
||||||
value::{Tensor, TensorElementType}
|
value::{Tensor, TensorElementType}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ use smallvec::SmallVec;
|
|||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
AsPointer, Error, OnceLock, Result,
|
AsPointer, Error, OnceLock, Result,
|
||||||
operator::attribute::Attribute,
|
operator::Attribute,
|
||||||
ortsys,
|
ortsys,
|
||||||
session::{Session, builder::SessionBuilder},
|
session::{Session, builder::SessionBuilder},
|
||||||
util::{with_cstr, with_cstr_ptr_array},
|
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.
|
/// - `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<()> {
|
/// # fn main() -> ort::Result<()> {
|
||||||
/// let node = Node::new(
|
/// let node = Node::new(
|
||||||
/// "Conv",
|
/// "Conv",
|
||||||
|
|||||||
@@ -210,7 +210,7 @@ impl<'a> AsPointer for Logger<'a> {
|
|||||||
/// Logs a message to a given [`Logger`].
|
/// Logs a message to a given [`Logger`].
|
||||||
///
|
///
|
||||||
/// ```
|
/// ```
|
||||||
/// # use ort::operator::kernel::{Kernel, KernelContext};
|
/// # use ort::operator::{Kernel, KernelContext};
|
||||||
/// struct MyKernel;
|
/// struct MyKernel;
|
||||||
///
|
///
|
||||||
/// impl Kernel for MyKernel {
|
/// impl Kernel for MyKernel {
|
||||||
|
|||||||
@@ -3,18 +3,18 @@
|
|||||||
use alloc::{boxed::Box, ffi::CString, vec::Vec};
|
use alloc::{boxed::Box, ffi::CString, vec::Vec};
|
||||||
use core::ptr::{self, NonNull};
|
use core::ptr::{self, NonNull};
|
||||||
|
|
||||||
pub mod attribute;
|
mod attribute;
|
||||||
pub(crate) mod bound;
|
pub(crate) mod bound;
|
||||||
pub mod io;
|
mod io;
|
||||||
pub mod kernel;
|
mod kernel;
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
mod tests;
|
mod tests;
|
||||||
|
|
||||||
use self::{
|
use self::bound::BoundOperator;
|
||||||
attribute::FromOpAttr,
|
pub use self::{
|
||||||
bound::BoundOperator,
|
attribute::{Attribute, FromKernelAttributes, FromOpAttr, ToAttribute},
|
||||||
io::{OperatorInput, OperatorOutput},
|
io::{InputOutputCharacteristic, OperatorInput, OperatorOutput},
|
||||||
kernel::{Kernel, KernelAttributes}
|
kernel::{Kernel, KernelAttributes, KernelContext, ScratchBuffer}
|
||||||
};
|
};
|
||||||
use crate::{
|
use crate::{
|
||||||
AsPointer, Error,
|
AsPointer, Error,
|
||||||
@@ -45,7 +45,7 @@ pub trait Operator: Send {
|
|||||||
/// stream.
|
/// stream.
|
||||||
///
|
///
|
||||||
/// [`Tensor::data_ptr`]: crate::value::Tensor::data_ptr
|
/// [`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> {
|
fn execution_provider_type(&self) -> Option<&str> {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,6 @@
|
|||||||
use crate::{
|
use crate::{
|
||||||
Result,
|
Result,
|
||||||
operator::{
|
operator::{Kernel, KernelAttributes, KernelContext, Operator, OperatorDomain, OperatorInput, OperatorOutput},
|
||||||
Operator, OperatorDomain,
|
|
||||||
io::{OperatorInput, OperatorOutput},
|
|
||||||
kernel::{Kernel, KernelAttributes, KernelContext}
|
|
||||||
},
|
|
||||||
session::Session,
|
session::Session,
|
||||||
value::{Tensor, TensorElementType}
|
value::{Tensor, TensorElementType}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
use ort::{
|
use ort::{
|
||||||
ep,
|
ep,
|
||||||
memory::{AllocationDevice, Allocator, AllocatorType, MemoryInfo, MemoryType},
|
memory::{AllocationDevice, Allocator, AllocatorType, MemoryInfo, MemoryType},
|
||||||
operator::{
|
operator::{Kernel, KernelAttributes, KernelContext, Operator, OperatorDomain, OperatorInput, OperatorOutput},
|
||||||
Operator, OperatorDomain,
|
|
||||||
io::{OperatorInput, OperatorOutput},
|
|
||||||
kernel::{Kernel, KernelAttributes, KernelContext}
|
|
||||||
},
|
|
||||||
session::{Adapter, RunOptions, Session},
|
session::{Adapter, RunOptions, Session},
|
||||||
value::{Tensor, TensorElementType}
|
value::{Tensor, TensorElementType}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user