From a0878ce152dfba5e58a6ed5aa106479cb64f0f0e Mon Sep 17 00:00:00 2001 From: aninda-leonardo Date: Tue, 6 Feb 2024 01:12:58 +0000 Subject: [PATCH] adding kwarg inputs for model --- thop/profile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/thop/profile.py b/thop/profile.py index 6b15d27..c1d58ba 100644 --- a/thop/profile.py +++ b/thop/profile.py @@ -157,6 +157,7 @@ def add_hooks(m): def profile( model: nn.Module, inputs, + kwargs={}, custom_ops=None, verbose=True, ret_layer_info=False, @@ -209,7 +210,7 @@ def add_hooks(m: nn.Module): model.apply(add_hooks) with torch.no_grad(): - model(*inputs) + model(*inputs, **kwargs) def dfs_count(module: nn.Module, prefix="\t") -> (int, int): total_ops, total_params = module.total_ops.item(), 0