mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
move type inference for arange into c++ (#27629)
Summary: Fixes https://github.com/pytorch/pytorch/issues/17662 I'm not sure if `arange` needs to be in python_arg_parser at all, given the schemas in native_functions.yaml. In any case this at least fixes the dytpe mismatch. In follow up PRs I will try to handle some of the other ops that do type inference at the python level, like randint. Pull Request resolved: https://github.com/pytorch/pytorch/pull/27629 Differential Revision: D17885939 Pulled By: eellison fbshipit-source-id: f97a8bc722b7ab77de1c42a992e49a4a3175ad60
This commit is contained in:
committed by
Facebook Github Bot
parent
9de0b63554
commit
e01fc56ecb
@@ -568,6 +568,13 @@ TEST(TensorTest, TorchTensorCtorWithoutSpecifyingDtype) {
|
||||
ASSERT_EQ(torch::tensor({{1., 2., 3.}}, torch::TensorOptions()).dtype(), torch::kDouble);
|
||||
}
|
||||
|
||||
TEST(TensorTest, Arange) {
|
||||
{ // Test #1
|
||||
auto x = torch::arange(0, 5);
|
||||
TORCH_INTERNAL_ASSERT(x.dtype() == at::ScalarType::Long);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(TensorTest, PrettyPrintTensorDataContainer) {
|
||||
{
|
||||
ASSERT_EQ(
|
||||
|
||||
Reference in New Issue
Block a user