forked from pytorch/pytorch
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_base.cpp
More file actions
29 lines (25 loc) · 827 Bytes
/
test_base.cpp
File metadata and controls
29 lines (25 loc) · 827 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#include <test/cpp/jit/test_base.h>
#include <test/cpp/jit/test_utils.h>
#include "torch/csrc/jit/runtime/custom_operator.h"
namespace torch {
namespace jit {
inline c10::AliasAnalysisKind aliasAnalysisFromSchema() {
return c10::AliasAnalysisKind::FROM_SCHEMA;
}
namespace {
RegisterOperators reg({
// This operator is intended to be used in JIT analysis and transformation
// pass unit tests in which Values with type Tensor are often required. It
// should not be used in situations in which the graph is actually executed
// because it always produces empty Tensors.
Operator(
"prim::MakeTestTensor() -> Tensor",
[](Stack& stack) {
push(stack, at::Tensor());
return 0;
},
aliasAnalysisFromSchema()),
});
}
} // namespace jit
} // namespace torch