mirror of
https://github.com/saymrwulf/pytorch.git
synced 2026-05-15 21:00:47 +00:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/34588 I constructed the patch by deleting OperatorOptions and then rerouting all queries for AliasAnalysisKind to FunctionSchema. Some of the behavior is kind of bogus: we really shouldn't be mutating FunctionSchema after the fact, but that won't get fixed until we actually switch to true schema merging. Reland of https://github.com/pytorch/pytorch/pull/34160 Signed-off-by: Edward Z. Yang <ezyang@fb.com> Test Plan: Imported from OSS Differential Revision: D20387079 Pulled By: ezyang fbshipit-source-id: d189f7a6ad8cd186b88b6fbfa3f189994eea14e8
27 lines
813 B
C++
27 lines
813 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::AliasAnalysisKind aliasAnalysisFromSchema() {
|
|
return c10::AliasAnalysisKind::FROM_SCHEMA;
|
|
}
|
|
|
|
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
|