pytorch/test/cpp/jit
Raziel Alvarez Guevara 70bed6a55a Removes deprecated preprocess method from the backend interface (#52258)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/52258

Removes deprecated preprocess method from the backend interface.

Preprocessing logic should be now registered along with the backend interface (i.e. PyTorchBackendInterface) via the BackendPreprocessFunction.

Also refactored internal dependencies.
ghstack-source-id: 121704837

Test Plan:
Validates all related tests pass:

buck test mode/dev //caffe2/test/cpp/jit:jit -- --exact 'caffe2/test/cpp/jit:jit - BackendTest.ToBackend'

python test/test_jit.py TestBackends

===== Glow

buck test mode/dev //glow/fb/torch_glow/tests:TorchGlowBackendTests

buck test mode/dev //glow/fb/torch_glow/tests:torch_glow_backend_tests

Reviewed By: jackm321

Differential Revision: D26443479

fbshipit-source-id: afdc51ae619ced293d10c7a6a12f3530e4c4e53c
2021-02-17 17:53:36 -08:00
..
__init__.py
CMakeLists.txt [TorchScript] C++ interface of to_<backend> (Re-land) (#52340) 2021-02-17 07:17:50 -08:00
README.md
test_alias_analysis.cpp
test_argument_spec.cpp
test_autodiff.cpp
test_backend.cpp [TorchScript] C++ interface of to_<backend> (Re-land) (#52340) 2021-02-17 07:17:50 -08:00
test_backend_lib.cpp Removes deprecated preprocess method from the backend interface (#52258) 2021-02-17 17:53:36 -08:00
test_class_import.cpp
test_class_parser.cpp
test_class_type.cpp [JIT] Print out CU address in ClassType::repr_str() (#50194) 2021-01-19 23:04:30 -08:00
test_cleanup_passes.cpp
test_code_template.cpp
test_constant_pooling.cpp
test_create_autodiff_subgraphs.cpp
test_custom_class.cpp
test_custom_class_registrations.cpp [JIT] Add support for default argument values to Torchbind (#51253) 2021-02-17 11:27:03 -08:00
test_custom_class_registrations.h
test_custom_operators.cpp Support complex number list in JIT (#51145) 2021-01-31 23:54:14 -08:00
test_dce.cpp
test_fuser.cpp
test_gpu.cpp [PyTorch][codemod] Replace immediately-dereferenced cast calls w/castRaw (#50229) 2021-02-01 23:12:07 -08:00
test_graph_executor.cpp [JIT] Fix archive file extension in examples and docs (#50649) 2021-01-20 02:04:46 -08:00
test_inliner.cpp
test_interface.cpp
test_interpreter.cpp [JIT] Fix archive file extension in examples and docs (#50649) 2021-01-20 02:04:46 -08:00
test_interpreter_async.pt
test_ir.cpp
test_irparser.cpp
test_jit_type.cpp
test_lite_interpreter.cpp [PyTorch Mobile] Support torchbind custom classes in lite interpreter (#51432) 2021-02-03 21:57:19 -08:00
test_lite_trainer.cpp
test_memory_dag.cpp
test_misc.cpp Improve PyTorch profiler flop computation formulas (#51377) 2021-02-02 11:49:04 -08:00
test_mobile_type_parser.cpp
test_module_api.cpp
test_peephole_optimize.cpp
test_qualified_name.cpp
test_save_load.cpp
test_schema_matching.cpp
test_subgraph_matcher.cpp
test_subgraph_rewriter.cpp
test_subgraph_utils.cpp
test_utils.cpp
test_utils.h
tests_setup.py
torch_python_test.cpp

JIT C++ Tests

Adding a new test

First, create a new test file. Test files should have be placed in this directory, with a name that starts with test_, like test_foo.cpp.

In general a single test suite

Add your test file to the JIT_TEST_SRCS list in test/cpp/jit/CMakeLists.txt.

A test file may look like:

#include <gtest/gtest.h>

using namespace ::torch::jit

TEST(FooTest, BarBaz) {
   // ...
}

// Append '_CUDA' to the test case name will automatically filter it out if CUDA
// is not compiled.
TEST(FooTest, NeedsAGpu_CUDA) {
   // ...
}

// Similarly, if only one GPU is detected, tests with `_MultiCUDA` at the end
// will not be run.
TEST(FooTest, NeedsMultipleGpus_MultiCUDA) {
   // ...
}

Building and running the tests

The following commands assume you are in PyTorch root.

# ... Build PyTorch from source, e.g.
python setup.py develop
# (re)build just the binary
ninja -C build bin/test_jit
# run tests
build/bin/test_jit --gtest_filter='glob_style_filter*'