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
@@ -929,9 +929,9 @@ TEST_F(FunctionalTest, LocalResponseNorm) {
|
||||
|
||||
TEST_F(FunctionalTest, Linear) {
|
||||
{
|
||||
const auto x = torch::arange(100, 118).resize_({3, 3, 2});
|
||||
const auto w = torch::arange(200, 206).resize_({3, 2});
|
||||
const auto b = torch::arange(300, 303);
|
||||
const auto x = torch::arange(100., 118).resize_({3, 3, 2});
|
||||
const auto w = torch::arange(200., 206).resize_({3, 2});
|
||||
const auto b = torch::arange(300., 303);
|
||||
const auto y = F::linear(x, w, b);
|
||||
ASSERT_EQ(y.ndimension(), 3);
|
||||
ASSERT_EQ(y.sizes(), torch::IntArrayRef({3, 3, 3}));
|
||||
@@ -950,8 +950,8 @@ TEST_F(FunctionalTest, Linear) {
|
||||
ASSERT_TRUE(torch::allclose(y, y_exp));
|
||||
}
|
||||
{
|
||||
const auto x = torch::arange(100, 118).resize_({3, 3, 2});
|
||||
const auto w = torch::arange(200, 206).resize_({3, 2});
|
||||
const auto x = torch::arange(100., 118).resize_({3, 3, 2});
|
||||
const auto w = torch::arange(200., 206).resize_({3, 2});
|
||||
const auto y = F::linear(x, w);
|
||||
ASSERT_EQ(y.ndimension(), 3);
|
||||
ASSERT_EQ(y.sizes(), torch::IntArrayRef({3, 3, 3}));
|
||||
|
||||
Reference in New Issue
Block a user