<< " has an empty range: min " << hist->Min()
<< " and max " << hist->Max();
}
+ if (hist->GetHistogram()->empty()) {
+ LOG(WARNING) << "Histogram of "
+ << info->min_max_info.tensor_infos[i].name << " is empty";
+ }
ostringstream ost;
ost << op_index << " " << info->min_max_info.type << " " << i << " "
ost << " " << c;
}
- f << ost.str() << endl;
if (print_total_min_max) {
LOG(INFO) << this << " " << ost.str();
}
- if (hist->GetHistogram()->empty()) {
- LOG(WARNING) << "Histogram of "
- << info->min_max_info.tensor_infos[i].name << " is empty";
- }
+ f << ost.str() << endl;
if (!print_total_min_max) {
info->histograms[i] = DynamicHistogram(hist->GetHistogram()->size());
qparams = qfactory->ChooseQuantizationParams(hist, is_weight);
} else {
qparams.scale = 0.1f;
- qparams.zero_point = -min / qparams.scale;
+ qparams.zero_point =
+ (isinf(min) || isnan(min)) ? 0 : (-min / qparams.scale);
qparams.precision = 8;
}
class HistogramNetObserver final : public NetObserver {
public:
+ /**
+ * @params mul_nets true if we expect multiple nets with the same name so
+ * we include extra information in the file name to
+ * distinghuish them
+ * @params dump_freq if not -1 we dump histogram every dump_freq invocation
+ * of the net
+ */
explicit HistogramNetObserver(
NetBase* subject,
const std::string& out_file_name,