pub struct PaddedCausalBatch<B: Backend> {
pub input_ids: Tensor<B, 2, Int>,
pub labels: Tensor<B, 2, Int>,
pub attention_mask: Tensor<B, 2, Bool>,
pub position_ids: Tensor<B, 2, Int>,
pub lengths: Vec<usize>,
pub supervised_tokens: usize,
pub ignore_index: i64,
pub target_alignment: CausalTargetAlignment,
}Available on crate feature
std only.Expand description
Rectangular actual documents with explicitly masked batch-padding cells.
Fields§
§input_ids: Tensor<B, 2, Int>Token IDs shaped [actual examples, maximum actual sequence length].
labels: Tensor<B, 2, Int>Same shape as input_ids; all padding cells contain ignore_index.
attention_mask: Tensor<B, 2, Bool>True exactly at real source tokens, never at padding cells.
position_ids: Tensor<B, 2, Int>Real positions reset per document; masked padding positions are zero.
lengths: Vec<usize>Original encoded lengths in actual batch order.
supervised_tokens: usizeActual nonignored supervised targets under the selected alignment.
ignore_index: i64Actual label sentinel used during collation.
target_alignment: CausalTargetAlignmentTarget alignment recorded for the downstream loss contract.
Implementations§
Source§impl<B: Backend> PaddedCausalBatch<B>
impl<B: Backend> PaddedCausalBatch<B>
Source§impl<B: Backend> PaddedCausalBatch<B>
impl<B: Backend> PaddedCausalBatch<B>
Sourcepub fn token_inputs(&self) -> PaddedTokenBatch<B>
pub fn token_inputs(&self) -> PaddedTokenBatch<B>
Label-free input view; cloning tensor handles does not duplicate token values.
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for PaddedCausalBatch<B>
impl<B> RefUnwindSafe for PaddedCausalBatch<B>
impl<B> Send for PaddedCausalBatch<B>
impl<B> Sync for PaddedCausalBatch<B>
impl<B> Unpin for PaddedCausalBatch<B>
impl<B> UnsafeUnpin for PaddedCausalBatch<B>
impl<B> UnwindSafe for PaddedCausalBatch<B>
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