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)
```

Differential Revision: D65178563
  • Loading branch information
craymichael authored and facebook-github-bot committed Oct 30, 2024
1 parent 1a4e012 commit 31cea2e
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 31cea2e

Please sign in to comment.