Skip to content

Commit

Permalink
Resolve C417 in tcav.py (#1426)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #1426

Resolve flake8 lint

```
>>> Lint for fbcode/pytorch/captum/captum/concept/_core/tcav.py:

   Advice  (FLAKE8) C417
    Unnecessary use of map - use a list comprehension instead.
    See https://github.com/adamchainz/flake8-comprehensions#rules

             694         # Retrieves the lengths of the experimental sets so that we can sort
             695         # them by the length and compute TCAV scores in batches.
             696         exp_set_lens = np.array(
    >>>      697             list(map(lambda exp_set: len(exp_set), experimental_sets)), dtype=object
             698         )
             699         exp_set_lens_arg_sort = np.argsort(exp_set_lens)
```

Reviewed By: cyrjano

Differential Revision: D65178563

fbshipit-source-id: 2b302e8c3f315d7372aaf0ea4478becfdbb9d159
  • Loading branch information
craymichael authored and facebook-github-bot committed Oct 31, 2024
1 parent f3496d9 commit d28efcd
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion captum/concept/_core/tcav.py
Original file line number Diff line number Diff line change
Expand Up @@ -694,7 +694,7 @@ def interpret(
# Retrieves the lengths of the experimental sets so that we can sort
# them by the length and compute TCAV scores in batches.
exp_set_lens = np.array(
list(map(lambda exp_set: len(exp_set), experimental_sets)), dtype=object
[len(exp_set) for exp_set in experimental_sets], dtype=object
)
exp_set_lens_arg_sort = np.argsort(exp_set_lens)

Expand Down

0 comments on commit d28efcd

Please sign in to comment.