pub struct MultiViewUNet { /* private fields */ }Expand description
The multi-view U-Net for diffusion-based avatar generation.
Architecture matches SD 2.1 but with multi-view cross-attention in every spatial transformer block, camera-pose conditioning added to the timestep embedding, and IP-adapter cross-attention for reference-image conditioning.
Implementations§
Source§impl MultiViewUNet
impl MultiViewUNet
Sourcepub fn new(vs: VarBuilder<'_>, config: &DiffusionConfig) -> Result<Self>
pub fn new(vs: VarBuilder<'_>, config: &DiffusionConfig) -> Result<Self>
Build the U-Net from a DiffusionConfig and VarBuilder.
Sourcepub fn forward(
&self,
sample: &Tensor,
timestep: usize,
context: Option<&Tensor>,
camera_poses: Option<&Tensor>,
ip_tokens: Option<&Tensor>,
) -> Result<Tensor, DiffusionError>
pub fn forward( &self, sample: &Tensor, timestep: usize, context: Option<&Tensor>, camera_poses: Option<&Tensor>, ip_tokens: Option<&Tensor>, ) -> Result<Tensor, DiffusionError>
Forward pass.
sample:(B*V, in_channels, H, W)noisy latent input.timestep: scalar timestep (will be broadcast to batch).context:(B*V, seq_len, cross_attn_dim)text/null embedding.camera_poses:(B*V, pose_dim)flattened extrinsics.ip_tokens:(B*V, ip_len, ip_dim)CLIP image tokens.
§Errors
Returns DiffusionError::SkipConnectionUnderflow if skip connections are
exhausted before all up blocks have consumed them.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MultiViewUNet
impl !RefUnwindSafe for MultiViewUNet
impl Send for MultiViewUNet
impl Sync for MultiViewUNet
impl Unpin for MultiViewUNet
impl UnsafeUnpin for MultiViewUNet
impl !UnwindSafe for MultiViewUNet
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> 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