pytorch/test
Chen Lai 8c04593c0a [PyTorch Edge] Add backport to export old bytecode models (#56802)
Summary:
Add an api to backport a model vn to model vi. It accept an input model (file or buffer) and output a model (file or buffer) with an expected bytecode version.

In this change, the input is a model and it can come from a file or buffer. The output is a model and can be either file path or buffer.

When backport fails, function return false with a warning message :
```
/Users/chenlai/pytorch/cmake-build-debug/bin/test_jit --gtest_filter=LiteInterpreterTest.BackPortByteCodeModelV4:LiteInterpreterTest/*.BackPortByteCodeModelV4:*/LiteInterpreterTest.BackPortByteCodeModelV4/*:*/LiteInterpreterTest/*.BackPortByteCodeModelV4 --gtest_color=no
Testing started at 2:32 PM ...
CUDA not available. Disabling CUDA and MultiCUDA tests

[W backport.cpp:419] Warning: Backport doesn't support backport to version3 (function _backport_for_mobile_impl)
Process finished with exit code 0
```

## Test
1. Run both `caffe2/test/cpp/jit/test_lite_interpreter.cpp` and `caffe2/test/mobile/test_bytecode.py`.
2. Run all prod models with backport api.

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

ghstack-source-id: 128425510

Test Plan: CI

Reviewed By: raziel, iseeyuan

Differential Revision: D27844651

fbshipit-source-id: 8a803cf6c76433ee0a3049b1a5570585d569f8d6
2021-05-07 18:14:33 -07:00
..
backward_compatibility Remove compute_uv flag from torch.linalg.svd (#57180) 2021-05-07 15:16:42 -07:00
benchmark_utils Add lint for unqualified noqa (#56272) 2021-04-19 13:16:18 -07:00
bottleneck_test
cpp [PyTorch Edge] Add backport to export old bytecode models (#56802) 2021-05-07 18:14:33 -07:00
cpp_api_parity
cpp_extensions [torch distributed] Implementing all_gather_base (#56315) 2021-04-23 14:16:47 -07:00
custom_backend
custom_operator AutoDispatchBelowAutograd takes no arguments. (#56424) 2021-04-21 14:44:12 -07:00
distributed [torch/elastic] Rename etcd-/c10d-experimental to etcd-v2 and c10d (#57764) 2021-05-06 19:51:53 -07:00
distributions
error_messages
expect Enable backward/forward compatibility for TS runtime (#57498) 2021-05-07 15:41:45 -07:00
fx Maintain submodule references during subgraph rewriting (#55463) 2021-04-30 16:46:44 -07:00
jit Enable backward/forward compatibility for TS runtime (#57498) 2021-05-07 15:41:45 -07:00
jit_hooks Un-ignore F403 in .flake8 (#55838) 2021-04-13 09:24:07 -07:00
mobile [PyTorch Edge] Add backport to export old bytecode models (#56802) 2021-05-07 18:14:33 -07:00
onnx Add correction parameter to std/var (#50903) 2021-05-07 14:40:28 -07:00
optim
package [package] fix corner case in PacakgeImporter.whichmodule (#57651) 2021-05-06 14:15:21 -07:00
quantization Fixing quantize_per_tensor on cuda (#57703) 2021-05-07 12:26:19 -07:00
scripts
test_img
typing Port NumPy typing testing style to PyTorch (#54234) 2021-04-15 01:25:16 -07:00
HowToWriteTestsUsingFileCheck.md
linear.py
run_test.py Torchelastic: add multiprocessing tests to ci/cd (#56842) 2021-05-02 14:03:47 -07:00
simulate_nccl_errors.py
test_ao_sparse.py [sparsity] Moving the sparsity python files to OSS (#56617) 2021-04-22 14:07:31 -07:00
test_autograd.py Update the default detach semantic for forward mode AD (#57820) 2021-05-07 15:51:18 -07:00
test_binary_ufuncs.py Support auto generation of device check (#56872) 2021-05-01 12:02:09 -07:00
test_bundled_images.py [easy] Rename fb::jpeg_decode_to_NCHW to fb::image_decode_to_NCHW (#55857) 2021-04-15 13:44:13 -07:00
test_bundled_inputs.py Add lint for unqualified type: ignore (#56290) 2021-04-21 08:07:23 -07:00
test_complex.py
test_cpp_api_parity.py
test_cpp_extensions_aot.py Fix ordered_dict.h for CUDA on Windows (#55275) 2021-04-07 23:43:35 -07:00
test_cpp_extensions_jit.py Add minidump collection via breakpad (#55647) 2021-04-16 13:05:01 -07:00
test_cuda.py Fix internal assert in CUDA caching allocator when trying to allocate ~2^64 memory (#57571) 2021-05-06 01:36:58 -07:00
test_cuda_primary_ctx.py
test_dataloader.py [DataLoader] Add generate_state for NumPy seeding (#56797) 2021-04-27 08:14:02 -07:00
test_datapipe.py Add lint for unqualified type: ignore (#56290) 2021-04-21 08:07:23 -07:00
test_determination.py
test_dispatch.py Add lint for unqualified noqa (#56272) 2021-04-19 13:16:18 -07:00
test_expecttest.py
test_foreach.py
test_function_schema.py Add stricter check for function schemas with varargs (#56509) 2021-04-20 20:04:38 -07:00
test_functional_autograd_benchmark.py
test_futures.py Add lint for unqualified type: ignore (#56290) 2021-04-21 08:07:23 -07:00
test_fx.py [FX] Adds PyTree support to FX through concrete_args (#55888) 2021-05-07 04:48:35 -07:00
test_fx_experimental.py OpInfo: expand and expand_as (#57606) 2021-05-07 02:50:00 -07:00
test_import_time.py Add a test to measure import torch time (#56041) 2021-04-15 00:53:30 -07:00
test_indexing.py Migrate thrust->cub for index put (#55693) 2021-04-27 12:27:09 -07:00
test_jit.py Enable backward/forward compatibility for TS runtime (#57498) 2021-05-07 15:41:45 -07:00
test_jit_cuda_fuser.py Fixing error in jit cuda on ROCm: non-constant-expression cannot be n… (#55243) 2021-04-21 16:35:27 -07:00
test_jit_disabled.py
test_jit_fuser.py
test_jit_fuser_legacy.py Un-ignore F403 in .flake8 (#55838) 2021-04-13 09:24:07 -07:00
test_jit_fuser_te.py Add Gelu To NNC (#57753) 2021-05-06 16:04:50 -07:00
test_jit_legacy.py Un-ignore F403 in .flake8 (#55838) 2021-04-13 09:24:07 -07:00
test_jit_profiling.py Un-ignore F403 in .flake8 (#55838) 2021-04-13 09:24:07 -07:00
test_jit_simple.py Un-ignore F403 in .flake8 (#55838) 2021-04-13 09:24:07 -07:00
test_jit_string.py
test_kernel_launch_checks.py
test_license.py
test_linalg.py Change name for namedtuple return of torch.linalg.svd (#57181) 2021-05-07 15:17:43 -07:00
test_logging.py
test_metal.py Remove legacy constructor calls from pytorch codebase. (#54142) 2021-04-11 15:45:17 -07:00
test_mkldnn.py [BE] Improve has_bf16_support (#57408) 2021-05-03 09:11:04 -07:00
test_mobile_optimizer.py [Pytorch Edge] Remove methods_to_optimize arg (#57045) 2021-04-27 14:54:13 -07:00
test_model_dump.py model_dump tool for model inspection (#56868) 2021-04-28 07:33:10 -07:00
test_module_init.py Support factory kwargs in torch.nn modules (#54508) 2021-04-22 16:16:53 -07:00
test_multiprocessing.py Fix mp serialization for integer nn.Parameter on CUDA (#56529) 2021-04-22 16:21:04 -07:00
test_multiprocessing_spawn.py
test_namedtensor.py
test_namedtuple_return_api.py Change name for namedtuple return of torch.linalg.svd (#57181) 2021-05-07 15:17:43 -07:00
test_native_functions.py
test_nn.py Fix compatibility problem with LSTMs and torch.save (#57558) 2021-05-05 07:36:13 -07:00
test_nnapi.py NNAPI: flex size support for upsample_nearest2d op (#57563) 2021-05-05 13:54:43 -07:00
test_numba_integration.py
test_numpy_interop.py Add lint for unqualified type: ignore (#56290) 2021-04-21 08:07:23 -07:00
test_op_aliases.py [OpInfo] Add opinfo for transpose and its aliases (#56122) 2021-04-25 21:58:16 -07:00
test_openmp.py
test_ops.py hardswish reland (#57652) 2021-05-05 17:21:43 -07:00
test_optim.py Remove legacy constructor calls from pytorch codebase. (#54142) 2021-04-11 15:45:17 -07:00
test_overrides.py Update test_overrides for gradcheck (#57155) 2021-04-29 07:43:18 -07:00
test_package.py
test_profiler.py [profiler] Add profiler fallback (#57612) 2021-05-06 13:35:27 -07:00
test_pruning_op.py
test_public_bindings.py
test_pytree.py [FX] Adds PyTree support to FX through concrete_args (#55888) 2021-05-07 04:48:35 -07:00
test_quantization.py Add lint for unqualified noqa (#56272) 2021-04-19 13:16:18 -07:00
test_reductions.py Add correction parameter to std/var (#50903) 2021-05-07 14:40:28 -07:00
test_segment_reductions.py [torch][segment_reduce] Add support for initial value (#56923) 2021-04-30 18:01:31 -07:00
test_serialization.py
test_set_default_mobile_cpu_allocator.py
test_shape_ops.py Fix tensor device in test_kthvalue_overlap (#56869) 2021-05-01 12:01:09 -07:00
test_show_pickle.py
test_sort_and_select.py Implement torch.sort with cub::DeviceSegmentedRadixSort (#56821) 2021-05-04 13:16:52 -07:00
test_sparse.py New: sparse complex: add linear algebra, addmm (#57129) 2021-05-07 05:37:48 -07:00
test_sparse_csr.py Modernize test-suite in sparse tensor CSR (#56392) 2021-04-27 15:22:17 -07:00
test_spectral_ops.py Remove distutils (#57040) 2021-04-29 12:10:11 -07:00
test_static_runtime.py
test_tensor_creation_ops.py [resubmit] Remove sync for randperm on small tensors. (#54113) (#57364) 2021-05-03 20:48:04 -07:00
test_tensorboard.py Add lint for unqualified noqa (#56272) 2021-04-19 13:16:18 -07:00
test_tensorexpr.py [nnc][tests] Skip long running tests when using TE interpreter (#57568) 2021-05-04 16:57:48 -07:00
test_tensorexpr_pybind.py Fix lint in test_tensorexpr_pybind (#57869) 2021-05-07 15:58:21 -07:00
test_testing.py add torch.testing to docs (#57247) 2021-05-07 09:16:39 -07:00
test_throughput_benchmark.py
test_torch.py Relax tp_new so that it is OK to call (#57544) 2021-05-05 09:04:39 -07:00
test_type_hints.py Add lint for unqualified type: ignore (#56290) 2021-04-21 08:07:23 -07:00
test_type_info.py
test_type_promotion.py New: Initial support for sparse complex tensors constructors for CPU/CUDA (#57125) 2021-05-07 05:36:41 -07:00
test_typing.py Port NumPy typing testing style to PyTorch (#54234) 2021-04-15 01:25:16 -07:00
test_unary_ufuncs.py [testing] clean-up test_unary_ufuncs.py (#57615) 2021-05-07 02:26:10 -07:00
test_utils.py Add lint for unqualified type: ignore (#56290) 2021-04-21 08:07:23 -07:00
test_view_ops.py Adding hsplit,vsplit and dsplit methods (#53536) 2021-04-26 09:39:09 -07:00
test_vmap.py
test_vulkan.py Remove legacy constructor calls from pytorch codebase. (#54142) 2021-04-11 15:45:17 -07:00
test_xnnpack_integration.py Remove legacy constructor calls from pytorch codebase. (#54142) 2021-04-11 15:45:17 -07:00