deepglint / EasyQuant

EasyQuant(EQ) is an efficient and simple post-training quantization method via effectively optimizing the scales of weights and activations.
Other
390 stars 70 forks source link

TensorRT激活值量化 #10

Open zhangfeixiang222 opened 3 years ago

zhangfeixiang222 commented 3 years ago

您好,在TensorRT中,我的理解是[-max, max] 量化为[-127, 127]. 可在TensorRT激活值量化部分,也就是tools/caffe_quanttable_e2e.py收集直方图的部分: print("\nCollect histograms of activations:") for i, image in enumerate(images_files): net_forward(net, image, transformer) for layer in quantize_layer_lists: blob = net.blobs[layer.blob_name].data[0].flatten() blob= blob[blob > 0] layer.initial_histograms(blob) if i % 100 == 0: print("loop stage 2 : %d/%d" % (i, len(images_files)))
为什么只收集blob>0的部分呢,如果卷积后面没有ReLU的情况怎么处理呢?