Skip to content

Rename variable string mapping utils and move them to variableslib #4503

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

Merged
merged 1 commit into from
Jan 26, 2025

Conversation

IvyZX
Copy link
Collaborator

@IvyZX IvyZX commented Jan 25, 2025

  • Renamed variable_type and variable_type_name to more concise named_variable and variable_name

  • Move the registry that maps nnx.Variable types to strings from nnx.bridge.variables to nnx.variablelib, so that it can be used in core NNX methods like nnx.Module.sow and perturb.

return VariableTypeCache[name]


def variable_name(typ: tp.Type[Variable[tp.Any]]) -> str:
Copy link
Collaborator

Choose a reason for hiding this comment

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

Name suggestions: variable_type_from_name and variable_name_from_type. A bit more verbose but current names are a bit ambiguous.

@copybara-service copybara-service bot merged commit a8a192f into google:main Jan 26, 2025
16 checks passed
@IvyZX IvyZX deleted the varmap branch March 24, 2025 21:18
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.

2 participants