diff --git a/torch/csrc/api/include/torch/nn/parallel/data_parallel.h b/torch/csrc/api/include/torch/nn/parallel/data_parallel.h index c5144497c7576..8dc06d9dd4404 100644 --- a/torch/csrc/api/include/torch/nn/parallel/data_parallel.h +++ b/torch/csrc/api/include/torch/nn/parallel/data_parallel.h @@ -275,7 +275,7 @@ Tensor data_parallel( return module->forward(std::move(input)).to(*output_device); } - autograd::Scatter scatter(*devices, /*chunk_sizes=*/nullopt, dim); + autograd::Scatter scatter(*devices, /*chunk_sizes=*/std::nullopt, dim); auto scattered_inputs = fmap(scatter.apply({std::move(input)})); // Input tensor might not be big enough to scale across all available devices if (scattered_inputs.size() < devices->size()) {