Skip to content

Commit 0282a27

Browse files
committed
Fix linter
1 parent f626df5 commit 0282a27

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

ptflops/pytorch_ops.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,11 @@ def _interpolate_functional_flops_hook(*args, **kwargs):
355355

356356
if size is not None:
357357
if isinstance(size, tuple) or isinstance(size, list):
358-
return int(np.prod(size, dtype=np.int64))*np.prod(input.shape[:2], dtype=np.int64)
358+
return int(np.prod(size, dtype=np.int64)) * \
359+
np.prod(input.shape[:2], dtype=np.int64)
359360
else:
360-
return int(size) ** (input.dim() - 2) * np.prod(input.shape[:2], dtype=np.int64)
361+
return int(size) ** (input.dim() - 2) * \
362+
np.prod(input.shape[:2], dtype=np.int64)
361363

362364
scale_factor = kwargs.get('scale_factor', None)
363365
if scale_factor is None and len(args) > 2:
@@ -368,8 +370,8 @@ def _interpolate_functional_flops_hook(*args, **kwargs):
368370
flops = input.numel()
369371
if isinstance(scale_factor, tuple) and len(scale_factor) == len(input.shape) - 2:
370372
flops *= int(np.prod(scale_factor, dtype=np.int64))
371-
else:
372-
flops *= scale_factor ** (input.dim() - 2) # NC... layout is assumed, see interpolate docs
373+
else: # NC... layout is assumed, see interpolate docs
374+
flops *= scale_factor ** (input.dim() - 2)
373375

374376
return flops
375377

0 commit comments

Comments
 (0)