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

Start of making bias correction work with Conv1d #2024

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,8 @@ def pass_data_through_model(model, early_stopping_iterations=None, use_cuda=Fals
if module.bias is None:
if isinstance(module, (torch.nn.Conv2d, torch.nn.ConvTranspose2d)):
output_size = module.out_channels
elif isinstance(module, (torch.nn.Conv1d, torch.nn.ConvTranspose1d)):
output_size = module.out_channels
elif isinstance(module, torch.nn.Linear):
output_size = module.out_features
module.bias = torch.nn.Parameter(torch.zeros(output_size))
Expand Down Expand Up @@ -396,4 +398,4 @@ def find_all_conv_bn_with_activation(model: torch.nn.Module, input_shape: Tuple)
graph_searcher.find_all_patterns_in_graph_apply_actions()
convs_bn_activation_dict = layer_select_handler.get_conv_linear_bn_info_dict()

return convs_bn_activation_dict
return convs_bn_activation_dict
2 changes: 1 addition & 1 deletion TrainingExtensions/torch/src/python/aimet_torch/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ def get_input_shape_batch_size(data_loader):
# finding shape of a batch
input_shape = torch.Tensor.size(images_in_one_batch)

return input_shape[0], (1, input_shape[1], input_shape[2], input_shape[3])
return input_shape[0], (1, *input_shape[1:])


def has_hooks(module: torch.nn.Module):
Expand Down