pub struct Client { /* private fields */ }Expand description
A client object used by the master to connect and orchestrate the workers. From the Cake perspective, each worker is a server and the master uses multiple Client instances to connect to them.
Implementations§
Source§impl Client
impl Client
Sourcepub async fn new(
device: Device,
address: &str,
layer_name: &str,
cluster_key: Option<&str>,
) -> Result<Self>
pub async fn new( device: Device, address: &str, layer_name: &str, cluster_key: Option<&str>, ) -> Result<Self>
Connects to the given worker address.
NOTE: device and layer_name here are only passed for std::fmt::Display.
If cluster_key is provided, mutual PSK authentication is performed
before any protocol messages.
Trait Implementations§
Source§impl Forwarder for Client
impl Forwarder for Client
Source§fn forward_mut<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
x: &'life1 Tensor,
index_pos: usize,
block_idx: usize,
_: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn forward_mut<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
x: &'life1 Tensor,
index_pos: usize,
block_idx: usize,
_: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Executes the worker’s pipeline for this tensor.
Source§fn forward_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
x: &'life1 Tensor,
batch: Vec<(String, usize, usize)>,
_: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn forward_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
x: &'life1 Tensor,
batch: Vec<(String, usize, usize)>,
_: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Executes the worker’s pipeline with multiple batched steps for this tensor.
Source§fn load(_: String, _: &Context) -> Result<Box<Self>>
fn load(_: String, _: &Context) -> Result<Box<Self>>
Create an instance of this object loading the specified layer(s) from a VarBuilder.
Source§fn forward<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_: &'life1 Tensor,
__arg2: usize,
__arg3: usize,
_: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn forward<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
_: &'life1 Tensor,
__arg2: usize,
__arg3: usize,
_: &'life2 mut Context,
) -> Pin<Box<dyn Future<Output = Result<Tensor>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Applies a forward operation to the input tensor, does not require mutability.
fn goodbye<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§fn layer_name(&self) -> &str
fn layer_name(&self) -> &str
Return the layer name.
Auto Trait Implementations§
impl !Freeze for Client
impl RefUnwindSafe for Client
impl Send for Client
impl Sync for Client
impl Unpin for Client
impl UnsafeUnpin for Client
impl UnwindSafe for Client
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a
CompactString. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.