pub struct DistributedTensor { /* private fields */ }Expand description
Distributed tensor metadata
Represents a tensor distributed across multiple devices.
Implementations§
Source§impl DistributedTensor
impl DistributedTensor
Sourcepub fn new(
global_shape: Vec<usize>,
strategy: ShardingStrategy,
device_group: DeviceGroup,
) -> Self
pub fn new( global_shape: Vec<usize>, strategy: ShardingStrategy, device_group: DeviceGroup, ) -> Self
Create a new distributed tensor
Sourcepub fn global_shape(&self) -> &[usize]
pub fn global_shape(&self) -> &[usize]
Get global shape
Sourcepub fn strategy(&self) -> ShardingStrategy
pub fn strategy(&self) -> ShardingStrategy
Get sharding strategy
Sourcepub fn device_group(&self) -> &DeviceGroup
pub fn device_group(&self) -> &DeviceGroup
Get device group
Sourcepub fn shard_for_device(&self, device_id: &DeviceId) -> Option<&Shard>
pub fn shard_for_device(&self, device_id: &DeviceId) -> Option<&Shard>
Get shard for a specific device
Sourcepub fn total_elements(&self) -> usize
pub fn total_elements(&self) -> usize
Get total number of elements across all shards
Trait Implementations§
Source§impl Clone for DistributedTensor
impl Clone for DistributedTensor
Source§fn clone(&self) -> DistributedTensor
fn clone(&self) -> DistributedTensor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for DistributedTensor
impl RefUnwindSafe for DistributedTensor
impl Send for DistributedTensor
impl Sync for DistributedTensor
impl Unpin for DistributedTensor
impl UnsafeUnpin for DistributedTensor
impl UnwindSafe for DistributedTensor
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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