Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions deepspeed/profiling/flops_profiler/profiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ def _silu_flops_compute(input: Tensor, inplace: bool = False):
return input.numel(), 0


def _gelu_flops_compute(input):
def _gelu_flops_compute(input, **kwargs):
return input.numel(), 0


Expand Down Expand Up @@ -668,16 +668,14 @@ def _instance_norm_flops_compute(
return input.numel() * (5 if has_affine else 4), 0


def _upsample_flops_compute(input,
size=None,
scale_factor=None,
mode="nearest",
align_corners=None):
def _upsample_flops_compute(input, **kwargs):
size = kwargs.get('size', None)
if size is not None:
if isinstance(size, tuple):
if isinstance(size, tuple) or isinstance(size, list):
return int(_prod(size)), 0
else:
return int(size), 0
scale_factor = kwargs.get('scale_factor', None)
assert scale_factor is not None, "either size or scale_factor should be defined"
flops = input.numel()
if isinstance(scale_factor, tuple) and len(scale_factor) == len(input):
Expand Down