pytorch/torch/csrc/jit/python
Chen Lai e755a4f124 Update the operator version check logic when generating models for testing upgraders (#71894)
Summary:
The model generation script will check the model version, to ensure the developer run the script before they change operator

Previously, the version use the old model version. However, it's hard for developer to know the old version number. In this change, it use the current max operator version to check. It's less strict, but more developer friendly

Pull Request resolved: https://github.com/pytorch/pytorch/pull/71894

ghstack-source-id: 147769215

Test Plan:
first time run:
```
chenlai@devvm5615:~/fbsource/fbcode(b82243650)$ buck run mode/opt //caffe2/torch/fb/mobile/upgrader_codegen:upgrader_test_models_gen
Parsing buck files: finished in 0.7 sec
Downloaded 0/2 artifacts, 0.00 bytes, 100.0% cache miss (for updated rules)
Building: finished in 21.6 sec (100%) 11547/11547 jobs, 2/11547 updated
  Total time: 22.4 sec
BUILD SUCCEEDED
TestVersionedDivTensorExampleV7() aten::div.Tensor
INFO:test.jit.fixtures_srcs.generate_models:Processing TestVersionedDivTensorExampleV7
INFO:test.jit.fixtures_srcs.generate_models:Generating model test_versioned_div_tensor_example_v7 and it's save to /data/users/chenlai/fbsource/fbcode/caffe2/test/jit/fixtures/test_versioned_div_tensor_example_v7.ptl
chenlai@devvm5615:~/fbsource/fbcode(b82243650)$
```

second time run:
```
chenlai@devvm5615:~/fbsource/fbcode(b82243650)$ rm caffe2/test/jit/fixtures/test_versioned_div_tensor_example_v4.ptl
chenlai@devvm5615:~/fbsource/fbcode(b82243650)$ buck run mode/opt //caffe2/torch/fb/mobile/upgrader_codegen:upgrader_test_models_gen
Action graph will be rebuilt because files have been added or removed.
Parsing buck files: finished in 2.0 sec
Building... 17.4 sec (99%) 9289/9290 jobs, 0/9290 updated
TestVersionedDivTensorExampleV7() aten::div.Tensor
INFO:test.jit.fixtures_srcs.generate_models:Processing TestVersionedDivTensorExampleV7
INFO:test.jit.fixtures_srcs.generate_models:Model test_versioned_div_tensor_example_v7 already exists, skipping
chenlai@devvm5615:~/fbsource/fbcode(b82243650)$ jf s
```

Reviewed By: tugsbayasgalan

Differential Revision: D33804737

fbshipit-source-id: 7424b81a700703bdf896ec606c2dac8df6dbf8a6
(cherry picked from commit 44b4e37d30)
2022-01-27 21:15:32 +00:00
..
init.cpp backout D33469839 (#71443) 2022-01-18 23:51:51 +00:00
init.h
module_python.h
pybind_utils.cpp Enable Python bindings for UntypedStorage (#68945) 2022-01-20 02:11:34 +00:00
pybind_utils.h Enable Python bindings for UntypedStorage (#68945) 2022-01-20 02:11:34 +00:00
pybind.h [AutoAccept][Codemod][FBSourceClangFormatLinter] Daily arc lint --take CLANGFORMAT 2021-12-19 16:38:25 -08:00
python_arg_flatten.cpp
python_arg_flatten.h
python_custom_class.cpp
python_custom_class.h
python_dict.cpp
python_dict.h
python_interpreter.cpp [jit] Make operation call accept Stack& instead Stack* (#63414) 2021-08-30 11:49:20 -07:00
python_ir.cpp [AutoAccept][Codemod][FBSourceClangFormatLinter] Daily arc lint --take CLANGFORMAT 2022-01-14 06:10:57 -08:00
python_ir.h
python_ivalue.h
python_list.cpp
python_list.h Use ptrdiff_t rather than ssize_t (#71271) 2022-01-13 12:41:53 -08:00
python_sugared_value.cpp backout D33469839 (#71443) 2022-01-18 23:51:51 +00:00
python_sugared_value.h Back out "Make TorchScript Preserve Fully Qualified Class Name for Python Exceptions" 2021-12-27 09:11:46 -08:00
python_tracer.cpp
python_tracer.h
python_tree_views.cpp Add SourceView which doesn't own source text as base class of Source (#65309) 2021-10-18 23:17:22 -07:00
python_tree_views.h
script_init.cpp Update the operator version check logic when generating models for testing upgraders (#71894) 2022-01-27 21:15:32 +00:00
script_init.h
update_graph_executor_opt.cpp
update_graph_executor_opt.h Remove WindowsTorchApiMacro.h in favor of Export.h (#69585) 2021-12-09 17:30:09 -08:00