Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add conv4_stride to VGG4LayerActFrontendV1 #33

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions i6_models/parts/frontend/vgg_act.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class VGG4LayerActFrontendV1Config(ModelConfiguration):
conv3_channels: number of channels for third conv layer
conv4_channels: number of channels for fourth conv layer
conv_kernel_size: kernel size of conv layers
conv4_stride: stride of the fourth conv layer
conv_padding: padding for the convolution
pool1_kernel_size: kernel size of first pooling layer
pool1_stride: stride of first pooling layer
Expand All @@ -43,6 +44,7 @@ class VGG4LayerActFrontendV1Config(ModelConfiguration):
conv3_channels: int
conv4_channels: int
conv_kernel_size: Tuple[int, int]
conv4_stride: Optional[Tuple[int, int]]
conv_padding: Optional[Tuple[int, int]]
pool1_kernel_size: Tuple[int, int]
pool1_stride: Optional[Tuple[int, int]]
Expand Down Expand Up @@ -133,6 +135,7 @@ def __init__(self, model_cfg: VGG4LayerActFrontendV1Config):
in_channels=model_cfg.conv3_channels,
out_channels=model_cfg.conv4_channels,
kernel_size=model_cfg.conv_kernel_size,
stride=model_cfg.conv4_stride if model_cfg.conv4_stride is not None else 1,
padding=conv_padding,
)
self.pool2 = nn.MaxPool2d(
Expand Down
2 changes: 1 addition & 1 deletion tests/test_frontend_vgg.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

import torch
from torch import nn
from torch.nn import functional

from i6_models.parts.frontend.vgg_act import (
VGG4LayerActFrontendV1,
Expand Down Expand Up @@ -49,6 +48,7 @@ def get_output_shape(test_parameters: VGG4LayerActTestParams):
conv3_channels=test_parameters.conv3_channels,
conv4_channels=test_parameters.conv4_channels,
conv_kernel_size=(3, 3),
conv4_stride=None,
conv_padding=None,
pool1_kernel_size=test_parameters.pool1_kernel_size,
pool1_stride=test_parameters.pool1_stride,
Expand Down
Loading