burn icon indicating copy to clipboard operation
burn copied to clipboard

Module: Implement for Tuple

Open dcvz opened this issue 2 years ago • 2 comments

Feature description

Implementing Module support for Tuple

Feature motivation

Would allow syntax such as:

#[derive(Module, Debug)]
pub struct UNetMidBlock2D<B: Backend> {
    resnet: ResnetBlock2D<B>,
    attn_resnets: Vec<(AttentionBlock<B>, ResnetBlock2D<B>)>,
}

Workaround

Use struct instead of tuple.

dcvz avatar Dec 04 '23 14:12 dcvz

Would a workaround of using struct work in this case? Suggesting in case if someone is stuck on this issue.

antimora avatar Dec 05 '23 18:12 antimora

Would a workaround of using struct work in this case? Suggesting in case if someone is stuck on this issue.

Yup! That’s the workaround I’ve gone with but raised the issue after a conversation with Nathaniel.

dcvz avatar Dec 05 '23 18:12 dcvz

Done via #1186

antimora avatar Mar 29 '24 01:03 antimora