From d2643f5fcad20537d8f50afe02e89ed5299a1a85 Mon Sep 17 00:00:00 2001 From: Isaac Zi Date: Thu, 17 Nov 2022 17:46:16 +0000 Subject: [PATCH] 123 --- pytorch_mlp_framework/arg_extractor.py | 2 +- pytorch_mlp_framework/experiment_builder.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/pytorch_mlp_framework/arg_extractor.py b/pytorch_mlp_framework/arg_extractor.py index 039f2554..2750c442 100644 --- a/pytorch_mlp_framework/arg_extractor.py +++ b/pytorch_mlp_framework/arg_extractor.py @@ -37,7 +37,7 @@ def get_args(): parser.add_argument('--num_filters', nargs="?", type=int, default=16, help='Number of convolutional filters per convolutional layer in the network (excluding ' 'dimensionality reduction layers)') - parser.add_argument('--num_epochs', nargs="?", type=int, default=100, help='Total number of epochs for model training') + parser.add_argument('--num_epochs', nargs="?", type=int, default=10, help='Total number of epochs for model training') parser.add_argument('--num_classes', nargs="?", type=int, default=100, help='Number of classes in the dataset') parser.add_argument('--experiment_name', nargs="?", type=str, default="exp_1", help='Experiment name - to be used for building the experiment folder') diff --git a/pytorch_mlp_framework/experiment_builder.py b/pytorch_mlp_framework/experiment_builder.py index c0b5380c..51edd19f 100644 --- a/pytorch_mlp_framework/experiment_builder.py +++ b/pytorch_mlp_framework/experiment_builder.py @@ -154,8 +154,10 @@ def plot_grad_flow(self, named_parameters): Complete the code in the block below to collect absolute mean of the gradients for each layer in all_grads with the layer names in layers. """ ######################################## - - + for n, p in named_parameters: + if(p.requires_grad) and ("bias" not in n): + layers.append(n) + all_grads.append(p.grad.abs().mean()) ########################################