# Building cov1d model with residual block + hypermeter tunner

**URL:** <https://discuss.pytorch.org/t/building-cov1d-model-with-residual-block-hypermeter-tunner/209060>\
**Category:** Uncategorized\
**Created:** [September 4, 2024, 5:08am UTC](https://discuss.pytorch.org/t/building-cov1d-model-with-residual-block-hypermeter-tunner/209060 "2024-09-04T05:08:59Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![ptrblck](https://discuss.pytorch.org/user_avatar/discuss.pytorch.org/ptrblck/32/1823_2.png) [@ptrblck](https://discuss.pytorch.org/u/ptrblck)\
**Post date:** [September 4, 2024, 3:08pm UTC](https://discuss.pytorch.org/t/building-cov1d-model-with-residual-block-hypermeter-tunner/209060/2 "2024-09-04T15:08:27Z")

</div>

This definition:

```python
        self.blocks = nn.Sequential(
            *[ResidualBlock(in_channels, out_channels, kernel_size, l2_lambda=l2_lambda) for _ in range(num_blocks)]
        )

```

won’t work for multiple `ResidualBlock`s since each of these will expect an input with `in_channels` channels while the previous one will return an activation with `out_channels`.  
You could fix it e.g. via:

```python
        self.blocks = nn.Sequential(
            ResidualBlock(in_channels, out_channels, kernel_size, l2_lambda=l2_lambda),
            *[ResidualBlock(out_channels, out_channels, kernel_size, l2_lambda=l2_lambda) for _ in range(num_blocks-1)]
        )

```

but would need to double check if the “internal” `ResidualBlock`s should use `out_channels` for their input and output.

---

_[View the full topic](https://discuss.pytorch.org/t/building-cov1d-model-with-residual-block-hypermeter-tunner/209060)._
