summaryrefslogtreecommitdiff
path: root/caffe2
diff options
context:
space:
mode:
authorJongsoo Park <jongsoo@fb.com>2019-02-06 15:10:07 -0800
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>2019-02-06 15:23:08 -0800
commit30ab1773f9b0e32e3423c2f23b6561dac752252c (patch)
tree8ad21eddbf6e0010bbf7342c8dbd08ca1180e9b9 /caffe2
parentea35d8e40a8ce070d4f1e60a4c2471745d7dbe31 (diff)
downloadpytorch-30ab1773f9b0e32e3423c2f23b6561dac752252c.tar.gz
pytorch-30ab1773f9b0e32e3423c2f23b6561dac752252c.tar.bz2
pytorch-30ab1773f9b0e32e3423c2f23b6561dac752252c.zip
call istringstream clear after str (#16820)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16820 Sometimes parsing histogram was not working correctly due to changes in D13633256 We need to call istringstream clear after str Reviewed By: csummersea Differential Revision: D13977509 fbshipit-source-id: ce3e8cb390641d8f0b5c9a7d6d6daadffeddbe11
Diffstat (limited to 'caffe2')
-rw-r--r--caffe2/quantization/server/activation_distribution_observer.cc2
-rw-r--r--caffe2/quantization/server/caffe2_dnnlowp_utils.cc2
2 files changed, 4 insertions, 0 deletions
diff --git a/caffe2/quantization/server/activation_distribution_observer.cc b/caffe2/quantization/server/activation_distribution_observer.cc
index 85401d22e6..a341eb83c8 100644
--- a/caffe2/quantization/server/activation_distribution_observer.cc
+++ b/caffe2/quantization/server/activation_distribution_observer.cc
@@ -498,6 +498,7 @@ RegisterQuantizationParamsWithHistogramNetObserver::
}
ist.str(first_line);
+ ist.clear();
bool new_format = true;
int op_index, i, nbins;
@@ -506,6 +507,7 @@ RegisterQuantizationParamsWithHistogramNetObserver::
ist >> op_index >> op_type >> i >> tensor_name >> min >> max >> nbins;
if (nwords_first_line != nbins + 7) {
ist.str(first_line);
+ ist.clear();
ist >> op_index >> i >> tensor_name >> min >> max >> nbins;
if (nwords_first_line == nbins + 6) {
new_format = false;
diff --git a/caffe2/quantization/server/caffe2_dnnlowp_utils.cc b/caffe2/quantization/server/caffe2_dnnlowp_utils.cc
index d4ca0baac7..9af991d3a9 100644
--- a/caffe2/quantization/server/caffe2_dnnlowp_utils.cc
+++ b/caffe2/quantization/server/caffe2_dnnlowp_utils.cc
@@ -438,6 +438,7 @@ NetDef AddScaleZeroOffsetArgumentsWithHistogram(
}
ist.str(first_line);
+ ist.clear();
bool new_format = true;
int op_index, i, nbins;
@@ -446,6 +447,7 @@ NetDef AddScaleZeroOffsetArgumentsWithHistogram(
ist >> op_index >> op_type >> i >> tensor_name >> min >> max >> nbins;
if (nwords_first_line != nbins + 7) {
ist.str(first_line);
+ ist.clear();
ist >> op_index >> i >> tensor_name >> min >> max >> nbins;
if (nwords_first_line == nbins + 6) {
new_format = false;