Skip to content

Commit c2cf74e

Browse files
Sanggyu LeeSanggyu Lee
authored andcommitted
[utils] Allow condition_fn to be None in RecordingInput
Set default value of condition to None instead of a lambda. Use a default lambda (lambda args_dict: True) internally if condition is not provided. TICO-DCO-1.0-Signed-off-by: Sanggyu Lee <[email protected]>
1 parent c6012c2 commit c2cf74e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tico/utils/record_input.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ class RecordingInput:
4949
def __init__(
5050
self,
5151
module: nn.Module,
52-
condition: Callable[[dict], bool] = lambda args_dict: True,
52+
condition: Optional[Callable[[dict], bool]] = None,
5353
*,
5454
input_to_remove: Optional[List[str]] = [],
5555
):
5656
self.module = module
5757
self.forward_org = module.forward
58-
self.condition = condition
58+
self.condition = condition or (lambda args_dict: True)
5959
self.input_to_remove = input_to_remove
6060
self.sig = inspect.signature(self.forward_org)
6161

0 commit comments

Comments
 (0)