pub struct Linear<D: Dtype, IT, OT, const RANK: usize> {
pub in_features: usize,
pub out_features: usize,
pub has_bias: bool,
/* private fields */
}Expand description
Fully-connected linear layer: output = input × Wᵀ [+ b]
Operates on the last dimension of an N-D tensor, passing all leading dimensions through unchanged (e.g. a batch dimension).
Type parameters:
D— element dtypeIT— input tensor type (any rank, last dim =in_features)OT— output tensor type (same rank, last dim =out_features)RANK— tensor rank (1 = unbatched, 2 = batched, etc.)
Tensor bounds are on impls, not the struct, so SymTensor can have its
own Layer impl without a coherence conflict.
Fields§
§in_features: usizeSize of the last input dimension.
out_features: usizeSize of the last output dimension.
has_bias: boolWhether to add a learned bias.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl<D, IT, OT, const RANK: usize> Freeze for Linear<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> RefUnwindSafe for Linear<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> Send for Linear<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> Sync for Linear<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> Unpin for Linear<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> UnsafeUnpin for Linear<D, IT, OT, RANK>
impl<D, IT, OT, const RANK: usize> UnwindSafe for Linear<D, IT, OT, RANK>
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