Skip to content

Conversation

@playaswd
Copy link

@playaswd playaswd commented Nov 9, 2025

This pull request adds support for converting the internal torch._C._linalg.linalg_vector_norm function to the public torch.linalg.vector_norm API in both the graph transformation logic and the graph serialization utility. This ensures that models using the internal function are properly mapped to the stable, public API during processing and serialization.

API normalization and conversion:

  • Added a new method _impl_unstable_to_stable_linalg_vector_norm in unstable_to_stable_backend.py to replace all uses of torch._C._linalg.linalg_vector_norm with torch.linalg.vector_norm in a given GraphModule and its nested modules.
  • Updated the serialize_graph_module_to_str function in fx_graph_serialize_util.py to include a regex replacement rule that serializes torch._C._linalg.linalg_vector_norm as torch.linalg.vector_norm.
image

…e API torch.linalg.vector_norm in UnstableToStableBackend class. Update serialization utility to include new replacement rule for vector_norm. Refactor serialization logic for better reusability across the codebase.
@paddle-bot
Copy link

paddle-bot bot commented Nov 9, 2025

Thanks for your contribution!

@paddle-bot paddle-bot bot added the contributor External developers label Nov 9, 2025
@playaswd playaswd changed the title 【Hackathon 9th No.116】 feat: implement torch.\_C.\_linalg.linalg\_vector\_norm to stable API conversion 【Hackathon 9th No.116】 feat: implement torch._C._linalg.linalg_vector_norm to stable API conversion Nov 9, 2025
…ecessary blank lines in the vector norm conversion method.
@G2uge
Copy link
Contributor

G2uge commented Nov 9, 2025

image Hasn’t this PR already been submitted yesterday?

@playaswd
Copy link
Author

playaswd commented Nov 9, 2025

image Hasn’t this PR already been submitted yesterday?

ok

@lixinqi
Copy link
Collaborator

lixinqi commented Nov 10, 2025

#352 请按照这个 pr 的要求改动代码,减少合入冲突。

@luotao1
Copy link
Collaborator

luotao1 commented Nov 12, 2025

@luotao1 luotao1 closed this Nov 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants