pub struct HeteroExecutable { /* private fields */ }Expand description
A graph compiled across multiple devices. Feed inputs / params by name and
run; intermediates that cross a device boundary round-trip
through host memory.
Implementations§
Source§impl HeteroExecutable
impl HeteroExecutable
Sourcepub fn compile(graph: &Graph, map: &DeviceMap, options: &CompileOptions) -> Self
pub fn compile(graph: &Graph, map: &DeviceMap, options: &CompileOptions) -> Self
Partition graph per map and compile each segment to its device.
Sourcepub fn with_fallback(
graph: &Graph,
primary: Device,
fallback: Device,
options: &CompileOptions,
) -> Self
pub fn with_fallback( graph: &Graph, primary: Device, fallback: Device, options: &CompileOptions, ) -> Self
compile with the DeviceMap::auto_fallback policy —
run graph on primary, spilling unsupported ops to fallback.
Sourcepub fn set_param(&mut self, name: &str, data: &[f32])
pub fn set_param(&mut self, name: &str, data: &[f32])
Set a parameter value (routed to whichever segment(s) consume it).
Sourcepub fn run(&mut self, inputs: &[(&str, &[f32])]) -> Vec<Vec<f32>>
pub fn run(&mut self, inputs: &[(&str, &[f32])]) -> Vec<Vec<f32>>
Run the pipeline: seed inputs + params, execute each segment on its device (transferring boundary tensors through host memory), return the graph outputs in declaration order.
Sourcepub fn num_segments(&self) -> usize
pub fn num_segments(&self) -> usize
Number of device segments the graph was split into.
Sourcepub fn segment_devices(&self) -> Vec<Device>
pub fn segment_devices(&self) -> Vec<Device>
The device of each segment, in execution order.
Auto Trait Implementations§
impl !RefUnwindSafe for HeteroExecutable
impl !Sync for HeteroExecutable
impl !UnwindSafe for HeteroExecutable
impl Freeze for HeteroExecutable
impl Send for HeteroExecutable
impl Unpin for HeteroExecutable
impl UnsafeUnpin for HeteroExecutable
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more