mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
Revert "parse pysymints to IValues (#80066)"
This reverts commit f532b3a619.
Reverted https://github.com/pytorch/pytorch/pull/80066 on behalf of https://github.com/seemethere due to Uses relative includes which causes internal builds to fail
This commit is contained in:
parent
c1d11f40c9
commit
0322ecc3fd
|
|
@ -292,17 +292,6 @@ class TestPySymInt(TestCase):
|
|||
self.assertTrue(str(expand_x.sym_size(1)), str(x.sym_size(0)))
|
||||
self.assertTrue(str(expand_x.sym_size(1)), str(result.sym_size(0)))
|
||||
|
||||
@skipIfNoSympy
|
||||
def test_aten_ops(self):
|
||||
|
||||
shape_env = ShapeEnv()
|
||||
x = create_symbolic_tensor("x", torch.randn(5), shape_env)
|
||||
torch.ops.aten.narrow_copy.SymInt(x, 0, 0, x.sym_size(0))
|
||||
|
||||
shape_env = ShapeEnv()
|
||||
x = create_symbolic_tensor("x", torch.randn(5, 4, 3), shape_env)
|
||||
torch.ops.aten.expand.SymInt(x, [x.sym_size(0), x.sym_size(1), x.sym_size(2)])
|
||||
|
||||
def test_fx_trace_intlist(self):
|
||||
class CustomModule(torch.nn.Module):
|
||||
def forward(self, x):
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include <c10/core/QScheme.h>
|
||||
#include <c10/util/irange.h>
|
||||
#include <utils/python_arg_parser.h>
|
||||
|
||||
namespace torch {
|
||||
namespace jit {
|
||||
|
|
@ -66,9 +65,7 @@ IValue toIValue(py::handle obj, const TypePtr& type, c10::optional<int32_t> N) {
|
|||
return static_cast<c10::complex<double>>(c_obj);
|
||||
}
|
||||
case TypeKind::SymIntType:
|
||||
return torch::is_symint_node(obj)
|
||||
? obj.cast<c10::SymbolicIntNode*>()->toSymInt()
|
||||
: c10::SymInt{py::cast<int64_t>(obj)};
|
||||
return py::cast<int64_t>(obj);
|
||||
case TypeKind::IntType:
|
||||
// NB: Typically, these switches are completely dead, because
|
||||
// Argument::type() will always report IntType for these types.
|
||||
|
|
@ -175,17 +172,6 @@ IValue toIValue(py::handle obj, const TypePtr& type, c10::optional<int32_t> N) {
|
|||
}
|
||||
return repeated;
|
||||
}
|
||||
case TypeKind::SymIntType: {
|
||||
c10::List<c10::SymInt> symints;
|
||||
for (auto it = obj.begin(); it != obj.end(); it++) {
|
||||
auto elm = *it;
|
||||
auto si = torch::is_symint_node(elm)
|
||||
? elm.cast<c10::SymbolicIntNode*>()->toSymInt()
|
||||
: c10::SymInt{py::cast<int64_t>(elm)};
|
||||
symints.push_back(si);
|
||||
}
|
||||
return symints;
|
||||
}
|
||||
case TypeKind::FloatType:
|
||||
if (!N || !py::isinstance<py::float_>(obj)) {
|
||||
return IValue(py::cast<std::vector<double>>(obj));
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user