Commit 12b90b92 by Zhihong Ma

fix: modify resnet and module for trail

parent f641275d
......@@ -527,6 +527,8 @@ class QLinear(QModule):
#需要加入qi 对于resnet,并不是所有的qrelu都不需要统计qi (对于残差结构,需要做elementwise add,则不能直接通过使用前面某一层的qo作为该层的qi) / 但qo可以不加,与qi没有太大区别
#需要加入qi,qo 对于resnet,并不是所有的qrelu都不需要统计qi,qo
class QReLU(QModule):
def __init__(self, qi=False, num_bits=None, n_exp=4, mode=1):
......@@ -542,6 +544,7 @@ class QReLU(QModule):
if not hasattr(self, 'qi') and qi is None:
raise ValueError('qi is not existed, should be provided.')
# 若非none,则是接受外部给的值,否则仍使用自己统计的qi
if qi is not None:
self.qi = qi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment