pub struct Seating { /* private fields */ }Expand description
Which lane each seat of a turn’s batch carries: the index is the seat, the
value is the lane. max_lanes is the extent of the lane axis, fixed for the
life of the state, so an op sizing a buffer on first eval knows how wide to
make it – a turn seating one lane of many still needs the full width.
A lane appears at most once, which is what makes a stream’s state sequential: two seats of one turn cannot both advance the same lane. A model with no session-scoped state has nothing to address, so its seating is inert.
Seats and lanes both index axis 0 – of the turn’s tensors and of a laned state’s buffers respectively. A runtime seating more than one lane is what must have checked that axis 0 of every stateful node is the model’s batch axis; ops only assert that their input carries one stream per seat.
Implementations§
Source§impl Seating
impl Seating
pub fn new( max_lanes: usize, lanes: impl IntoIterator<Item = LaneId>, ) -> TractResult<Seating>
Sourcepub fn single() -> Seating
pub fn single() -> Seating
The seating of a state one stream owns: one lane wide, that lane seated. Every turn has a seating, and this is what an unbatched turn is.
pub fn max_lanes(&self) -> usize
pub fn lanes(&self) -> &[LaneId]
Sourcepub fn occupancy(&self) -> usize
pub fn occupancy(&self) -> usize
Seats filled this turn, i.e. the extent of the batch axis of the tensors flowing through it.
Sourcepub fn address(&self, ix: usize) -> (Option<usize>, Option<usize>)
pub fn address(&self, ix: usize) -> (Option<usize>, Option<usize>)
Where seat ix reads its stream and writes its state: the seat on axis 0
of the turn’s tensors, the lane on axis 0 of the state’s buffers. Both are
absent when the state is one lane wide, as its buffers then have no lane
axis and axis 0 of the tensors carries data rather than streams.
Trait Implementations§
impl Eq for Seating
impl StructuralPartialEq for Seating
Auto Trait Implementations§
impl Freeze for Seating
impl RefUnwindSafe for Seating
impl Send for Seating
impl Sync for Seating
impl Unpin for Seating
impl UnsafeUnpin for Seating
impl UnwindSafe for Seating
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
impl<T> CloneAny for T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> ⓘ
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> ⓘ
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