mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-06 12:20:52 +01:00
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/37034 c10 takes a Stack* in boxed functions while JIT took Stack&. c10 doesn't return anything while JIT returns an int which is always zero. This changes JIT to follow the c10 behavior. ghstack-source-id: 106834069 Test Plan: unit tests Differential Revision: D20567950 fbshipit-source-id: 1a7aea291023afc52ae706957e9a5ca576fbb53b
27 lines
789 B
C++
27 lines
789 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;
|
|
}
|
|
|
|
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()); },
|
|
aliasAnalysisFromSchema()),
|
|
});
|
|
}
|
|
|
|
} // namespace jit
|
|
} // namespace torch
|