pytorch/test/cpp/jit
Hao Lu eda2ddb5b0 [ATen] Fix aten::to schema (#60001)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/60001

Fix the aten::to schema to reflect that the output may alias input.

Test Plan: Added new unit tests.

Reviewed By: ezyang

Differential Revision: D29121620

fbshipit-source-id: c29b6aa22d367ffedf06e47116bc46b3e188c39c
2021-06-15 20:04:20 -07:00
..
__init__.py
CMakeLists.txt Reapply "[jit] Implement ScriptProfile to collect instruction profiles." (#58783) 2021-05-24 18:23:21 -07:00
README.md
script_module_v4.ptl
script_module_v5.ptl
script_module_v6.ptl [Pytorch Edge] Model Ops compatibility api (#57501) 2021-05-24 12:00:06 -07:00
test_alias_analysis.cpp [ATen] Fix aten::to schema (#60001) 2021-06-15 20:04:20 -07:00
test_argument_spec.cpp Make JIT not assume that the device is CUDA. (#54238) 2021-06-03 22:21:27 -07:00
test_autodiff.cpp [clang-tidy] Exclude cppcoreguidelines-avoid-magic-numbers (#57841) 2021-05-07 20:02:33 -07:00
test_backend.cpp [Pytorch Delegated Backend] Save function name in debug info (#57481) 2021-05-25 13:19:02 -07:00
test_backend_compiler_lib.cpp [Pytorch Backend delegation] Add api for backend lowering to query debug (#55462) 2021-05-22 08:33:07 -07:00
test_backend_compiler_preprocess.cpp [Pytorch backend delegation] Preprocess to accept (#58873) 2021-06-11 10:16:00 -07:00
test_backend_lib.cpp [Pytorch backend delegation] Preprocess to accept (#58873) 2021-06-11 10:16:00 -07:00
test_class_import.cpp
test_class_parser.cpp
test_class_type.cpp
test_cleanup_passes.cpp
test_code_template.cpp
test_concat_opt.cpp [JIT] Adding a concat optimization pass (#55474) 2021-05-09 22:06:44 -07:00
test_constant_pooling.cpp
test_create_autodiff_subgraphs.cpp
test_cs_debug_info_serialization.cpp [Pytorch Delegated Backend] Save function name in debug info (#57481) 2021-05-25 13:19:02 -07:00
test_custom_class.cpp
test_custom_class_registrations.cpp [clang-tidy] Exclude cppcoreguidelines-avoid-magic-numbers (#57841) 2021-05-07 20:02:33 -07:00
test_custom_class_registrations.h
test_custom_operators.cpp [clang-tidy] Exclude cppcoreguidelines-avoid-magic-numbers (#57841) 2021-05-07 20:02:33 -07:00
test_dce.cpp
test_fuser.cpp [clang-tidy] Exclude cppcoreguidelines-avoid-magic-numbers (#57841) 2021-05-07 20:02:33 -07:00
test_gpu.cpp
test_graph_executor.cpp
test_inliner.cpp
test_interface.cpp
test_interpreter.cpp Revert "Striding for lists Part 2 (#49352)" (#58523) 2021-05-20 13:20:33 -07:00
test_interpreter_async.pt
test_ir.cpp Added OperatorMap for mapping Operator to any template <T> (#58060) 2021-05-19 11:38:49 -07:00
test_irparser.cpp
test_jit_type.cpp VaryingShape<Strides>::isComplete() needs to consider whether each Stride is complete (#58510) 2021-05-18 21:45:46 -07:00
test_lite_interpreter.cpp Add kMaxSupportedBytecodeVersion for Lite Interpreter (#59472) 2021-06-04 17:55:02 -07:00
test_lite_trainer.cpp [PyTorch Mobile]Fix unit test (#58202) 2021-05-14 13:43:22 -07:00
test_memory_dag.cpp
test_misc.cpp [JIT] Add a phase to perform inplace<->functional conversion for activation operators (#57477) 2021-06-03 06:43:23 -07:00
test_mobile_type_parser.cpp
test_module_api.cpp [JIT] Add optimize_for_inference API (#58193) 2021-05-15 15:50:14 -07:00
test_peephole_optimize.cpp
test_qualified_name.cpp
test_save_load.cpp [clang-tidy] Exclude cppcoreguidelines-avoid-magic-numbers (#57841) 2021-05-07 20:02:33 -07:00
test_schema_matching.cpp [clang-tidy] Exclude cppcoreguidelines-avoid-magic-numbers (#57841) 2021-05-07 20:02:33 -07:00
test_script_profile.cpp Reapply "[jit] Implement ScriptProfile to collect instruction profiles." (#58783) 2021-05-24 18:23:21 -07:00
test_subgraph_matcher.cpp
test_subgraph_rewriter.cpp
test_subgraph_utils.cpp [clang-tidy] Exclude cppcoreguidelines-avoid-magic-numbers (#57841) 2021-05-07 20:02:33 -07:00
test_utils.cpp Revert "Striding for lists Part 2 (#49352)" (#58523) 2021-05-20 13:20:33 -07:00
test_utils.h [Pytorch Backend delegation] Add api for backend lowering to query debug (#55462) 2021-05-22 08:33:07 -07:00
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*'