pub struct CudaModel<'a> {
pub dag: Dag<CompiledNode>,
pub names: HashMap<usize, String>,
/* private fields */
}Expand description
A compiled model: a DAG of CompiledNodes, not yet loaded into GPU memory. Call
CudaModel::load to load it and get a runnable LoadedModel.
Fields§
§dag: Dag<CompiledNode>The compiled node DAG.
names: HashMap<usize, String>DAG node index → dotted name (e.g. "model.0.conv"), populated from the
source Graph::names field during compilation.
Implementations§
Source§impl<'a> CudaModel<'a>
impl<'a> CudaModel<'a>
Sourcepub fn new(dag: Dag<CompiledNode>) -> Result<Self>
pub fn new(dag: Dag<CompiledNode>) -> Result<Self>
Wraps a compiled node DAG as a CudaModel, with no node names.
Sourcepub fn with_names(
dag: Dag<CompiledNode>,
names: HashMap<usize, String>,
) -> Result<Self>
pub fn with_names( dag: Dag<CompiledNode>, names: HashMap<usize, String>, ) -> Result<Self>
Wraps a compiled node DAG as a CudaModel, with the given node-index → name mapping.
Sourcepub fn load(
self,
_device: &CudaDevice<'_>,
batch_size: usize,
) -> Result<LoadedModel>
pub fn load( self, _device: &CudaDevice<'_>, batch_size: usize, ) -> Result<LoadedModel>
Load all compiled PTX kernels into GPU memory and pre-allocate
zero-initialised parameter buffers, producing a LoadedModel ready
for inference.
batch_size resolves dynamic (None) shape dimensions when computing
parameter buffer sizes.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for CudaModel<'a>
impl<'a> !RefUnwindSafe for CudaModel<'a>
impl<'a> Send for CudaModel<'a>
impl<'a> Sync for CudaModel<'a>
impl<'a> Unpin for CudaModel<'a>
impl<'a> UnsafeUnpin for CudaModel<'a>
impl<'a> !UnwindSafe for CudaModel<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more