mirror of
https://github.com/pytorch/pytorch.git
synced 2026-11-20 09:04:25 +08:00
Add c10::optional to type syntax (#12582)
Summary: This PR adds optional type to ATen native, autograd, JIT schema and Python Arg parser, closes #9513. It allows us to use optional default values (including None) for function signature and implementations like clamp, etc., and also let us remove the python_default_init hack. Follow up: remove python_default_init completely. Pull Request resolved: https://github.com/pytorch/pytorch/pull/12582 Differential Revision: D10417423 Pulled By: wanchaol fbshipit-source-id: 1c80f0727bb528188b47c595629e2996be269b89
This commit is contained in:
committed by
Facebook Github Bot
parent
569a29b81a
commit
4e1c64caee
@@ -44,8 +44,8 @@ TEST_F(ParallelTest, DifferentiableScatter_MultiCUDA) {
|
||||
TEST_F(ParallelTest, DifferentiableGather_MultiCUDA) {
|
||||
Gather gather(torch::Device(torch::kCUDA, 1));
|
||||
|
||||
auto a = torch::ones(5, torch::requires_grad(true).device({torch::kCUDA, 0}));
|
||||
auto b = torch::ones(5, torch::requires_grad(true).device({torch::kCUDA, 1}));
|
||||
auto a = torch::ones(5, torch::requires_grad(true).device(torch::kCUDA, 0));
|
||||
auto b = torch::ones(5, torch::requires_grad(true).device(torch::kCUDA, 1));
|
||||
|
||||
auto outputs = gather.apply({a, b});
|
||||
ASSERT_EQ(outputs.size(), 1);
|
||||
|
||||
Reference in New Issue
Block a user