Fix float zeros format (#5491)
* Fix float zeros format * 255 to integer
This commit is contained in:
1 parent
8a803f36d3
commit
5866646cc8
16 files changed
+36
-36
No files matched your search
@@ -111,7 +111,7 @@ def profile(input, ops, n=10, device=None):
|
||||
for m in ops if isinstance(ops, list) else [ops]:
|
||||
m = m.to(device) if hasattr(m, 'to') else m # device
|
||||
m = m.half() if hasattr(m, 'half') and isinstance(x, torch.Tensor) and x.dtype is torch.float16 else m
|
||||
tf, tb, t = 0., 0., [0., 0., 0.] # dt forward, backward
|
||||
tf, tb, t = 0, 0, [0, 0, 0] # dt forward, backward
|
||||
try:
|
||||
flops = thop.profile(m, inputs=(x,), verbose=False)[0] / 1E9 * 2 # GFLOPs
|
||||
except:
|
||||
@@ -177,7 +177,7 @@ def find_modules(model, mclass=nn.Conv2d):
|
||||
|
||||
def sparsity(model):
|
||||
# Return global model sparsity
|
||||
a, b = 0., 0.
|
||||
a, b = 0, 0
|
||||
for p in model.parameters():
|
||||
a += p.numel()
|
||||
b += (p == 0).sum()
|
||||
@@ -336,7 +336,7 @@ class ModelEMA:
|
||||
for k, v in self.ema.state_dict().items():
|
||||
if v.dtype.is_floating_point:
|
||||
v *= d
|
||||
v += (1. - d) * msd[k].detach()
|
||||
v += (1 - d) * msd[k].detach()
|
||||
|
||||
def update_attr(self, model, include=(), exclude=('process_group', 'reducer')):
|
||||
# Update EMA attributes
|
||||
|
||||
Reference in new issue
Block a user