报错描述
在使用fvcore模块计算pytorch中模型计算量时,遇到了以下报错问题:
ValueError: Invalid type <class 'numpy.int32'> for the flop count! Please use a wider type to avoid overflow.
解决方案
根据报错提示信息找到jit_analysis.py文件,打开,进行如下修改:
if not isinstance(v, (int, float, np.float64, np.int64)):
改为
if not isinstance(np.float(v), (int, float, np.float64, np.int64)):