mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-15 21:00:47 +00:00
30 lines
877 B
C++
30 lines
877 B
C++
|
|
#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::OperatorOptions aliasAnalysisFromSchema() {
|
||
|
|
c10::OperatorOptions result;
|
||
|
|
result.setAliasAnalysis(c10::AliasAnalysisKind::FROM_SCHEMA);
|
||
|
|
return result;
|
||
|
|
}
|
||
|
|
|
||
|
|
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
|