Skip to content

snake_case FX IR names#50876

Closed
ansley wants to merge 5 commits intogh/ansleyadelaide/34/basefrom
gh/ansleyadelaide/34/head
Closed

snake_case FX IR names#50876
ansley wants to merge 5 commits intogh/ansleyadelaide/34/basefrom
gh/ansleyadelaide/34/head

Conversation

@ansley
Copy link
Copy Markdown

@ansley ansley commented Jan 21, 2021

Stack from ghstack:

Differential Revision: D26002640

[ghstack-poisoned]
ansley pushed a commit that referenced this pull request Jan 21, 2021
ghstack-source-id: 12b9855
Pull Request resolved: #50876
@ansley ansley requested a review from jamesr66a January 21, 2021 12:37
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 21, 2021

Codecov Report

Merging #50876 (2ac4685) into gh/ansleyadelaide/34/base (8e9ed27) will decrease coverage by 0.31%.
The diff coverage is 100.00%.

@@                      Coverage Diff                      @@
##           gh/ansleyadelaide/34/base   #50876      +/-   ##
=============================================================
- Coverage                      81.00%   80.68%   -0.32%     
=============================================================
  Files                           1916     1916              
  Lines                         209481   209488       +7     
=============================================================
- Hits                          169690   169028     -662     
- Misses                         39791    40460     +669     

Copy link
Copy Markdown
Collaborator

@jamesr66a jamesr66a left a comment

Choose a reason for hiding this comment

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

Nice!

Comment thread torch/fx/graph.py Outdated
res.append(s[i].lower())
if len(s) > 1:
res.append(s[-1].lower())
return ''.join(res)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think using a loop-carried variable may be a bit cleaner than +-1 indexing:

def _snake_case(s: str) -> str:
    chars = []
    prev_lower = False
    for c in s:
        if prev_lower and c.isupper():
            chars.append('_')
        chars.append(c.lower())
        prev_lower = c.islower()

    return ''.join(chars)

ansley pushed a commit that referenced this pull request Jan 21, 2021
ghstack-source-id: 9237431
Pull Request resolved: #50876
ansley pushed a commit that referenced this pull request Jan 22, 2021
ghstack-source-id: 309d1ed
Pull Request resolved: #50876
@facebook-github-bot
Copy link
Copy Markdown
Contributor

@ansley merged this pull request in 7494f02.

@facebook-github-bot facebook-github-bot deleted the gh/ansleyadelaide/34/head branch January 25, 2021 15:18
laurentdupin pushed a commit to laurentdupin/pytorch that referenced this pull request Apr 24, 2026
Summary: Pull Request resolved: pytorch#50876

Test Plan: Imported from OSS

Reviewed By: nikithamalgifb

Differential Revision: D26002640

Pulled By: ansley

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants