-
Notifications
You must be signed in to change notification settings - Fork 6.8k
[REFACTOR] Asymmetric Quantization: deduplicate methods #20514
Conversation
Hey @sfraczek , Thanks for submitting the PR
CI supported jobs: [centos-gpu, clang, unix-cpu, unix-gpu, windows-gpu, website, sanity, centos-cpu, edge, miscellaneous, windows-cpu] Note: |
@mxnet-bot run ci [unix-cpu] |
Jenkins CI successfully triggered : [unix-cpu] |
@sfraczek, Thanks! Could you please expand a little bit and explain in more detail what this pull request takes in? |
renaming variables |
@@ -254,21 +215,21 @@ static Graph OneDNNShiftedQuantization(Graph&& g) { | |||
} | |||
}); | |||
if (quantize_fc_counter > 0) { | |||
LOG(INFO) << "applied shifted quantization on QUANTIZE->FC " << quantize_fc_counter | |||
LOG(INFO) << "applied asymmetric quantization on QUANTIZE->FC " << quantize_fc_counter |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please have a look at it, here we start with a lowercase letter, but #185 starts with an uppercase letter. What do you think of keeping the same rules?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks I will make it uppercase too.
@@ -41,7 +41,7 @@ struct QuantizeV2Param : public dmlc::Parameter<QuantizeV2Param> { | |||
int out_type; | |||
dmlc::optional<float> min_calib_range; | |||
dmlc::optional<float> max_calib_range; | |||
dmlc::optional<bool> shifted; | |||
dmlc::optional<bool> shifted_output; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dmlc::optional is found a use for representing a value that may or may not be present. The std::optional was introduced in C++17, so it means that we can try to replace this one by a new one. Unfortunately, there is a bunch of branches have not supported C++17 yet. An exceptation is the master branch that supports c++17, well, maybe is worth making an internal wrapper. On second thoughts, it could be looks like: [proposition]
#define MXNET_HAS_OPTIONAL() 0
#if __cplusplus >= 201703L
# ifdef __has_include
# if __has_include(<optional>)
# include <optional>
# undef MXNET_HAS_OPTIONAL
# define MXNET_HAS_OPTIONAL() 1
# endif
# endif
#endif
#if MXNET_HAS_OPTIONAL()
#warning "optional"
// Please use std::optional<T>
#else
#warning "no optional"
// Please use dmlc::optional<T>
#endif
What are the advantages of using it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think v1.x is more strongly backward compatibility oriented. I think it would be better to keep such change only to master. dmlc::optional is used in a lot of places as well as other functions so it might be hard to justify rewriting parts of it. I don't know what are advantages of either implementations.
Also, in this PR I would prefer to keep consistency with what is already used in operators.
@@ -1255,7 +1255,7 @@ def get_threshold(nd): | |||
|
|||
|
|||
@with_seed() | |||
def test_onednn_shifted_quantize_fc(): | |||
def test_mkldnn_shifted_quantize_fc(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if it might not be better to re-name this function on the off-chance? ~> test_mkldnn_asymetric_quantize_fc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok
@mxnet-bot run ci [unix-cpu] |
Jenkins CI successfully triggered : [unix-cpu] |
Description
Just some refactoring of asymmetric quantization.
Checklist
Essentials
Changes
[x] Mainly deduplication of methods,
[x] Secondly unify naming according to v1.x (onednn->mkldnn),
[x] Also clang-formatting.
Comments