Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored Identifiers #3381

Merged
merged 2 commits into from
Aug 30, 2024

Conversation

congyuluo
Copy link
Contributor

Description

Refactored certain identifiers in the code - expanded certain variable names according to its usage in the code to make them more descriptive. Meanwhile, changed "testOffLine" to "testOffline" as "Offline" is a single word, to conform to Java naming conventions.

  • If this change is a backward incompatible change, why must this change be made?
  • Interesting edge cases to note here

@congyuluo congyuluo requested review from zachgk, frankfliu and a team as code owners August 2, 2024 20:24
@@ -197,7 +197,7 @@ public Trainer newTrainer(TrainingConfig trainingConfig) {
// Unfreeze parameters if training directly
block.freezeParameters(
false,
p -> p.getType() != Type.RUNNING_MEAN && p.getType() != Type.RUNNING_VAR);
param -> param.getType() != Type.RUNNING_MEAN && param.getType() != Type.RUNNING_VAR);
Copy link
Contributor

Choose a reason for hiding this comment

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

short parameter name in lambda is very common. I don't think this change is necessary.

@@ -91,8 +91,8 @@ public void load(Path modelPath, String prefix, Map<String, ?> options)
configProto = (ConfigProto) config;
} else if (config instanceof String) {
try {
byte[] buf = Base64.getDecoder().decode((String) config);
configProto = ConfigProto.parseFrom(buf);
byte[] buffer = Base64.getDecoder().decode((String) config);
Copy link
Contributor

Choose a reason for hiding this comment

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

The same here, buf is pretty common short name for buffer

@@ -72,8 +72,8 @@ public static void testGetterSetters(Class<?> baseClass)
continue;
}

Method[] methods = clazz.getDeclaredMethods();
for (Method method : methods) {
Method[] declaredMethods = clazz.getDeclaredMethods();
Copy link
Contributor

Choose a reason for hiding this comment

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

declaredMethods might be more clear, but I don't feel methods is a bad local variable name.

@frankfliu frankfliu merged commit 61d2f3a into deepjavalibrary:master Aug 30, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants