From 8c61b54edf9fdc3e03f5cea01c60bfe8bd8cff44 Mon Sep 17 00:00:00 2001 From: jiahangxu Date: Fri, 25 Mar 2022 11:41:09 -0400 Subject: [PATCH] refactor 'odd' to 'even' in config sampler --- .../kernel_predictor_builder/data_sampler/config_sampler.py | 6 +++--- .../data_sampler/finegrained_sampler.py | 4 ++-- .../data_sampler/prior_distribution_sampler.py | 4 ++-- .../builder/kernel_predictor_builder/data_sampler/utils.py | 6 +++--- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/nn_meter/builder/kernel_predictor_builder/data_sampler/config_sampler.py b/nn_meter/builder/kernel_predictor_builder/data_sampler/config_sampler.py index 6297099..5c5ed00 100644 --- a/nn_meter/builder/kernel_predictor_builder/data_sampler/config_sampler.py +++ b/nn_meter/builder/kernel_predictor_builder/data_sampler/config_sampler.py @@ -63,13 +63,13 @@ class ConcatSampler(BaseConfigSampler): return finegrained_sampling_concats(configs, sample_num) -class CinOddSampler(BaseConfigSampler): +class CinEvenSampler(BaseConfigSampler): def prior_config_sampling(self, sample_num): - return sampling_hw_cin_odd(sample_num) + return sampling_hw_cin_even(sample_num) def finegrained_config_sampling(self, configs, sample_num): - return finegrained_sampling_hw_cin_odd(configs, sample_num) + return finegrained_sampling_hw_cin_even(configs, sample_num) class GlobalAvgPoolSampler(BaseConfigSampler): diff --git a/nn_meter/builder/kernel_predictor_builder/data_sampler/finegrained_sampler.py b/nn_meter/builder/kernel_predictor_builder/data_sampler/finegrained_sampler.py index c5820b8..06ce4ff 100644 --- a/nn_meter/builder/kernel_predictor_builder/data_sampler/finegrained_sampler.py +++ b/nn_meter/builder/kernel_predictor_builder/data_sampler/finegrained_sampler.py @@ -116,8 +116,8 @@ def finegrained_sampling_hw_cin(cfgs, count): return ncfgs -def finegrained_sampling_hw_cin_odd(cfgs, count): - ''' sampling configs for kernels with hw and cin (only odd values) parameter, in case for split / se / channelshuffle +def finegrained_sampling_hw_cin_even(cfgs, count): + ''' sampling configs for kernels with hw and cin (only even values) parameter, in case for split / se / channelshuffle Returned params include: (hw, cin) ''' ncfgs = [] diff --git a/nn_meter/builder/kernel_predictor_builder/data_sampler/prior_distribution_sampler.py b/nn_meter/builder/kernel_predictor_builder/data_sampler/prior_distribution_sampler.py index cfcf355..0d837fe 100644 --- a/nn_meter/builder/kernel_predictor_builder/data_sampler/prior_distribution_sampler.py +++ b/nn_meter/builder/kernel_predictor_builder/data_sampler/prior_distribution_sampler.py @@ -226,8 +226,8 @@ def sampling_hw_cin(count): return ncfgs -def sampling_hw_cin_odd(count): - ''' sampling configs for kernels with hw and cin (only odd values) parameter, in case for split / se / channelshuffle +def sampling_hw_cin_even(count): + ''' sampling configs for kernels with hw and cin (only even values) parameter, in case for split / se / channelshuffle Returned params include: (hw, cin) ''' hws, cins, _, _, _ = read_conv_zoo() diff --git a/nn_meter/builder/kernel_predictor_builder/data_sampler/utils.py b/nn_meter/builder/kernel_predictor_builder/data_sampler/utils.py index 3e79896..0634107 100644 --- a/nn_meter/builder/kernel_predictor_builder/data_sampler/utils.py +++ b/nn_meter/builder/kernel_predictor_builder/data_sampler/utils.py @@ -32,9 +32,9 @@ __BUILTIN_KERNELS__ = { "avgpool_block": ["AvgPoolBlock", "PoolingSampler"], "fc_block": ["FCBlock", "FCSampler"], "concat_block": ["ConcatBlock", "ConcatSampler"], - "split_block": ["SplitBlock", "CinOddSampler"], - "channel_shuffle": ["ChannelShuffle", "CinOddSampler"], - "se_block": ["SEBlock", "CinOddSampler"], + "split_block": ["SplitBlock", "CinEvenSampler"], + "channel_shuffle": ["ChannelShuffle", "CinEvenSampler"], + "se_block": ["SEBlock", "CinEvenSampler"], "globalavgpool_block": ["GlobalAvgPoolBlock", "GlobalAvgPoolSampler"], "bn_relu": ["BnRelu", "HwCinSampler"], "bn_block": ["BnBlock", "HwCinSampler"],