Name Date Size #Lines LOC

..--

CMakeLists.txtH A D25-Apr-20253 KiB8272

README.mdH A D25-Apr-20251.3 KiB5646

gtest_assert_float_eq.hH A D25-Apr-20254.6 KiB12031

padded_buffer.cppH A D25-Apr-2025947 3831

padded_buffer.hH A D25-Apr-20256.9 KiB243203

test_approx.cppH A D25-Apr-20252.9 KiB9776

test_aten.cppH A D25-Apr-202530.6 KiB1,069860

test_base.hH A D25-Apr-20252.8 KiB9080

test_boundsinference.cppH A D25-Apr-202534.3 KiB1,023700

test_conv.cppH A D25-Apr-20256.7 KiB235185

test_cpp_codegen.cppH A D25-Apr-20257 KiB260222

test_cuda.cppH A D25-Apr-202572 KiB2,3451,853

test_dynamic_shapes.cppH A D25-Apr-202524.4 KiB702549

test_expr.cppH A D25-Apr-202525.5 KiB837668

test_external_calls.cppH A D25-Apr-202536.7 KiB1,059882

test_graph_opt.cppH A D25-Apr-202510.4 KiB320264

test_ir_printer.cppH A D25-Apr-20252.3 KiB9171

test_ir_verifier.cppH A D25-Apr-20256.6 KiB192143

test_kernel.cppH A D25-Apr-202575.8 KiB2,1341,774

test_llvm.cppH A D25-Apr-202549.8 KiB1,8001,494

test_loopnest.cppH A D25-Apr-2025206.7 KiB6,9545,108

test_memdependency.cppH A D25-Apr-2025101.3 KiB3,2531,771

test_memplanning.cppH A D25-Apr-202521.1 KiB709399

test_ops.cppH A D25-Apr-20252.5 KiB7965

test_quantization.cppH A D25-Apr-202516.8 KiB453408

test_reductions.cppH A D25-Apr-202551 KiB1,9351,480

test_registerizer.cppH A D25-Apr-202587.4 KiB3,7031,972

test_simplify.cppH A D25-Apr-2025170.8 KiB5,6834,022

test_te_fuser_pass.cppH A D25-Apr-202513.2 KiB403328

test_type.cppH A D25-Apr-20255.2 KiB203148

test_type_specializations.cppH A D25-Apr-20252 KiB7661

test_utils.hH A D25-Apr-20252.6 KiB7965

tutorial.cppH A D25-Apr-202522 KiB543171

README.md

1# TensorExpr C++ Tests
2
3## How to add a new test
4First, create a new test file. Test files should have be placed in this
5directory, with a name that starts with `test_`, like `test_foo.cpp`.
6
7Here is an example test file you can copy-paste.
8```cpp
9#include <test/cpp/tensorexpr/test_base.h>
10
11// Tests go in torch::jit
12namespace torch {
13namespace jit {
14
15// 1. Test cases are void() functions.
16// 2. They start with the prefix `test`
17void testCaseOne() {
18    // ...
19}
20
21void testCaseTwo() {
22    // ...
23}
24}
25}
26```
27
28Then, register your test in `tests.h`:
29```cpp
30// Add to TH_FORALL_TESTS_CUDA instead for CUDA-requiring tests
31#define TH_FORALL_TESTS(_)             \
32  _(ADFormulas)                        \
33  _(Attributes)                        \
34  ...
35  _(CaseOne)  // note that the `test` prefix is omitted.
36  _(CaseTwo)
37```
38
39We glob all the test files together in `CMakeLists.txt` so that you don't
40have to edit it every time you add a test. Unfortunately, this means that in
41order to get the build to pick up your new test file, you need to re-run
42cmake:
43```
44python setup.py build --cmake
45```
46
47## How do I run the tests?
48The following commands assume you are in PyTorch root.
49
50 ```bash
51 # (re)build the test binary
52 ninja build/bin/test_tensorexpr
53 # run
54 build/bin/test_tensorexpr --gtest_filter='glob_style_filter*'
55 ```
56