Skip to content

Conversation

@Flamefire
Copy link
Collaborator

As discussed in #46392 this makes the code more readable and possibly more performant.

It also fixes a bug detected by this where the argument order of map was confused: Flamefire@030a249#diff-5bb26bd3a23ee3bb540aeadcc0385df2a4e48de39f87ed9ea76b21990738fe98L1537-R1537

Fixes #46392

Done by replacing the regexp `list\(map\(lambda (\w+): (.*?), (\w+)\)\)`
by `[$2 for $1 in $3]`
Use the search regexp `list\(map\(lambda (\w+): (.*?), ([0-9a-z_.\]\[]+)\)\)`
Fixes an argument order confusion in distributed_test.py
@facebook-github-bot facebook-github-bot added oncall: jit Add this issue/PR to JIT oncall triage queue oncall: distributed Add this issue/PR to distributed oncall triage queue labels Oct 16, 2020
@facebook-github-bot
Copy link
Contributor

facebook-github-bot commented Oct 16, 2020

💊 CI failures summary and remediations

As of commit 9c06b80 (more details on the Dr. CI page):


💚 💚 Looks good so far! There are no failures yet. 💚 💚


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

This comment has been revised 5 times.

@codecov
Copy link

codecov bot commented Oct 16, 2020

Codecov Report

Merging #46461 into master will not change coverage.
The diff coverage is 21.05%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #46461   +/-   ##
=======================================
  Coverage   68.38%   68.38%           
=======================================
  Files         411      411           
  Lines       53953    53953           
=======================================
  Hits        36897    36897           
  Misses      17056    17056           
Impacted Files Coverage Δ
torch/nn/parallel/_functions.py 31.76% <0.00%> (ø)
torch/nn/parallel/data_parallel.py 20.93% <0.00%> (ø)
torch/nn/parallel/distributed.py 42.48% <0.00%> (ø)
torch/nn/parallel/parallel_apply.py 12.28% <0.00%> (ø)
torch/nn/parallel/replicate.py 9.43% <0.00%> (ø)
torch/nn/parallel/scatter_gather.py 12.76% <0.00%> (ø)
torch/overrides.py 97.08% <ø> (ø)
.../testing/_internal/distributed/distributed_test.py 29.57% <0.00%> (ø)
torch/jit/frontend.py 91.90% <100.00%> (ø)
torch/optim/lr_scheduler.py 88.80% <100.00%> (ø)
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ecf6335...9c06b80. Read the comment docs.

@dr-ci
Copy link

dr-ci bot commented Oct 16, 2020

💊 CI failures summary and remediations

As of commit 9c06b80 (more details on the Dr. CI page):


  • 1/1 failures possibly* introduced in this PR
    • 1/1 non-CircleCI failure(s)

codecov.io: 1 failed


This comment was automatically generated by Dr. CI (expand for details).Follow this link to opt-out of these comments for your Pull Requests.

Please report bugs/suggestions on the GitHub issue tracker or post in the (internal) Dr. CI Users group.

See how this bot performed.

Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ezyang has imported this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@facebook-github-bot
Copy link
Contributor

@ezyang merged this pull request in 5b0f400.

2 similar comments
@facebook-github-bot
Copy link
Contributor

@ezyang merged this pull request in 5b0f400.

@facebook-github-bot
Copy link
Contributor

@ezyang merged this pull request in 5b0f400.

@Flamefire Flamefire deleted the list_map_replacement branch October 20, 2020 07:13
facebook-github-bot pushed a commit that referenced this pull request Oct 22, 2020
Summary:
Follow-up of #46461 with a similar goal

Makes them more readable and possibly faster. Care has to be taken because `map` applies the function immediately while `(x for x in xs)` is a generator expression which gets evaluated later. This is a benefit in some cases where it is not required to actually create the list of values in memory (e.g. when passing to `tuple` or `extend` or `join`)

Pull Request resolved: #46462

Reviewed By: zou3519

Differential Revision: D24422343

Pulled By: ezyang

fbshipit-source-id: 252e33499c92ac0b15238f2df32681dbbda2b237
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merged oncall: distributed Add this issue/PR to distributed oncall triage queue oncall: jit Add this issue/PR to JIT oncall triage queue open source

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Replace list(map(lambda constructs by list comprehension

4 participants