Skip to main content

DetrDecoderLayerWeights

Struct DetrDecoderLayerWeights 

Source
pub struct DetrDecoderLayerWeights {
Show 20 fields pub self_qkv_weight: Vec<f32>, pub self_qkv_bias: Vec<f32>, pub self_out_weight: Vec<f32>, pub self_out_bias: Vec<f32>, pub cross_q_weight: Vec<f32>, pub cross_q_bias: Vec<f32>, pub cross_kv_weight: Vec<f32>, pub cross_kv_bias: Vec<f32>, pub cross_out_weight: Vec<f32>, pub cross_out_bias: Vec<f32>, pub ffn1_weight: Vec<f32>, pub ffn1_bias: Vec<f32>, pub ffn2_weight: Vec<f32>, pub ffn2_bias: Vec<f32>, pub ln1_weight: Vec<f32>, pub ln1_bias: Vec<f32>, pub ln2_weight: Vec<f32>, pub ln2_bias: Vec<f32>, pub ln3_weight: Vec<f32>, pub ln3_bias: Vec<f32>,
}
Expand description

All learnable weights for a single DETR decoder layer.

Fields§

§self_qkv_weight: Vec<f32>

Fused QKV projection: [3 × embed_dim × embed_dim].

§self_qkv_bias: Vec<f32>

Fused QKV bias: [3 × embed_dim].

§self_out_weight: Vec<f32>

Output projection: [embed_dim × embed_dim].

§self_out_bias: Vec<f32>

Output projection bias: [embed_dim].

§cross_q_weight: Vec<f32>

Query projection: [embed_dim × embed_dim].

§cross_q_bias: Vec<f32>

Query projection bias: [embed_dim].

§cross_kv_weight: Vec<f32>

Fused Key+Value projection from encoder: [2 × embed_dim × embed_dim].

§cross_kv_bias: Vec<f32>

Fused KV bias: [2 × embed_dim].

§cross_out_weight: Vec<f32>

Cross-attention output projection: [embed_dim × embed_dim].

§cross_out_bias: Vec<f32>

Cross-attention output bias: [embed_dim].

§ffn1_weight: Vec<f32>

FFN first layer: [mlp_dim × embed_dim].

§ffn1_bias: Vec<f32>

FFN first layer bias: [mlp_dim].

§ffn2_weight: Vec<f32>

FFN second layer: [embed_dim × mlp_dim].

§ffn2_bias: Vec<f32>

FFN second layer bias: [embed_dim].

§ln1_weight: Vec<f32>

LN after self-attention: scale [embed_dim].

§ln1_bias: Vec<f32>

LN after self-attention: bias [embed_dim].

§ln2_weight: Vec<f32>

LN before cross-attention: scale [embed_dim].

§ln2_bias: Vec<f32>

LN before cross-attention: bias [embed_dim].

§ln3_weight: Vec<f32>

LN before FFN: scale [embed_dim].

§ln3_bias: Vec<f32>

LN before FFN: bias [embed_dim].

Implementations§

Source§

impl DetrDecoderLayerWeights

Source

pub fn default_init(cfg: &DetrConfig, rng: &mut LcgRng) -> Self

Xavier-style default initialisation.

Attention/FFN weights: N(0, 1/√embed_dim); biases: zeros; LayerNorm weights: ones; biases: zeros.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.