snake_case FX IR names#50876
Closed
ansley wants to merge 5 commits intogh/ansleyadelaide/34/basefrom
Closed
Conversation
[ghstack-poisoned]
Codecov Report
@@ 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 |
jamesr66a
reviewed
Jan 21, 2021
| res.append(s[i].lower()) | ||
| if len(s) > 1: | ||
| res.append(s[-1].lower()) | ||
| return ''.join(res) |
Collaborator
There was a problem hiding this comment.
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)
[ghstack-poisoned]
Differential Revision: [D26002640](https://our.internmc.facebook.com/intern/diff/D26002640) [ghstack-poisoned]
Differential Revision: [D26002640](https://our.internmc.facebook.com/intern/diff/D26002640) [ghstack-poisoned]
Differential Revision: [D26002640](https://our.internmc.facebook.com/intern/diff/D26002640) [ghstack-poisoned]
Contributor
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stack from ghstack:
Differential Revision: D26002640