forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[pytorch][codegen] migrate gen_variable_factories.py to the new data …
…model (pytorch#47818) Summary: Pull Request resolved: pytorch#47818 This is another relatively small codegen. Ideally we should CppSignature.decl() to generate the c++ function declaration. We didn't because it needs to add 'at::' to the types defined in ATen namespace. E.g.: - standard declaration: ``` Tensor eye(int64_t n, int64_t m, const TensorOptions & options={}) ``` - expected: ``` at::Tensor eye(int64_t n, int64_t m, const at::TensorOptions & options = {}) ``` Kept the hacky fully_qualified_type() method to keep compatibility with old codegen. We could clean up by: - Using these types in torch namespace - but this is a user facing header file, not sure if it will cause problem; - Update cpp.argument_type() method to take optional namespace argument; Confirmed byte-for-byte compatible with the old codegen: ``` Run it before and after this PR: .jenkins/pytorch/codegen-test.sh <baseline_output_dir> .jenkins/pytorch/codegen-test.sh <test_output_dir> Then run diff to compare the generated files: diff -Naur <baseline_output_dir> <test_output_dir> ``` Test Plan: Imported from OSS Reviewed By: bhosmer Differential Revision: D24909478 Pulled By: ljk53 fbshipit-source-id: a0ceaa60cc765c526908fee39f151cd7ed5ec923
- Loading branch information
1 parent
4779553
commit 07e98d2
Showing
3 changed files
with
59 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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