mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
Summary:
This reverts commit 37cb357d8d.
Try to see if it unbreaks master
Pull Request resolved: https://github.com/pytorch/pytorch/pull/14082
Differential Revision: D13095888
Pulled By: bddppq
fbshipit-source-id: c728f80f233b4d9daaf65f43202d8104651029a9
This commit is contained in:
committed by
Facebook Github Bot
parent
45fd77d3b7
commit
2fe4711eb4
@@ -134,7 +134,7 @@ TEST_F(ParallelTest, ParallelApply_MultiCUDA) {
|
||||
TEST_F(ParallelTest, ParallelApplyWithDifferentOutputDevice_MultiCUDA) {
|
||||
struct M : torch::nn::Module {
|
||||
torch::Tensor forward(torch::Tensor input) {
|
||||
return torch::ones(5, torch::kInt32);
|
||||
return torch::ones({5}, torch::dtype(torch::kInt32));
|
||||
}
|
||||
};
|
||||
|
||||
@@ -176,9 +176,12 @@ TEST_F(
|
||||
struct M : torch::nn::Cloneable<M> {
|
||||
void reset() override {}
|
||||
torch::Tensor forward(torch::Tensor input) {
|
||||
// Intermediate tensors should be on the replica's current device.
|
||||
intermediate_tensor = torch::rand(5);
|
||||
// The returned tensor should be on the output device.
|
||||
return torch::ones(3);
|
||||
}
|
||||
torch::Tensor intermediate_tensor;
|
||||
};
|
||||
auto m = std::make_shared<M>();
|
||||
auto input = torch::ones({10, 3});
|
||||
@@ -199,6 +202,9 @@ TEST_F(
|
||||
input,
|
||||
/*devices=*/std::vector<torch::Device>{torch::Device(torch::kCUDA, 0)},
|
||||
/*output_device=*/torch::Device(torch::kCUDA, 1));
|
||||
ASSERT_TRUE(m->intermediate_tensor.defined());
|
||||
ASSERT_TRUE(m->intermediate_tensor.device().is_cuda());
|
||||
ASSERT_EQ(m->intermediate_tensor.device().index(), 0);
|
||||
ASSERT_TRUE(output.defined());
|
||||
ASSERT_TRUE(output.device().is_cuda());
|
||||
ASSERT_EQ(output.device().index(), 1);
|
||||
@@ -209,7 +215,7 @@ TEST_F(ParallelTest, DataParallelUsesAllAvailableCUDADevices_CUDA) {
|
||||
struct M : torch::nn::Cloneable<M> {
|
||||
void reset() override {}
|
||||
torch::Tensor forward(torch::Tensor input) {
|
||||
return torch::tensor(input.device().index());
|
||||
return torch::tensor(torch::getDefaultTensorOptions().device().index());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user