negative MAdds appear, shall update datatype of np.int32 to int64
canornot opened this issue · 0 comments
canornot commented
For large networks, negative MAdds appear. It's because the caculated macs exceed the data range at line 53:
param.nelement() returns python int64
but np.prod(info["out"][2:])) returns numpy np.int32
multiplication of these two gives np.int32, with maximum value limitation of 2,147,483,647
Shall update line 53 into info["macs"] += param.nelement() * int(np.prod(info["out"][2:]))
so that maximum limitation of both mulitpliers, as well as results are 9,223,372,036,854,775,807