Skip to content

Commit 007e759

Browse files
cyyeverpytorchmergebot
authored andcommitted
[4/N] Change #include <c10/util/Optional.h> to #include <optional> (pytorch#130329)
Follows pytorch#130300 Pull Request resolved: pytorch#130329 Approved by: https://github.com/ezyang
1 parent 9912209 commit 007e759

File tree

107 files changed

+300
-306
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

107 files changed

+300
-306
lines changed

aten/src/ATen/native/Blas.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ TORCH_IMPL_FUNC(addmv_out_cpu)(const Tensor &self, const Tensor &mat, const Tens
7171
const_cast<Tensor&>(result),
7272
self,
7373
at::native::scalar_tensor(
74-
beta_, self.scalar_type(), c10::nullopt /* layout */, at::kCPU, c10::nullopt /* pin_memory */));
74+
beta_, self.scalar_type(), std::nullopt /* layout */, at::kCPU, std::nullopt /* pin_memory */));
7575
}
7676
} else {
7777
if (!result.is_same(*self_) && betaval != 0.0) { //if beta is 0, result contents is ignored

aten/src/ATen/native/CPUFallback.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ static std::optional<c10::Device> compute_target_device(std::vector<at::Tensor>&
6363
}
6464
}
6565
}
66-
return c10::nullopt;
66+
return std::nullopt;
6767
}
6868

6969
static bool validate_tensor_list(const c10::List<at::Tensor>& tensorlist) {
@@ -89,7 +89,7 @@ void cpu_fallback(const c10::OperatorHandle& op, torch::jit::Stack* stack, bool
8989
std::vector<c10::List<at::Tensor>> tensorlist_args;
9090
std::vector<int> tensorlist_args_indices;
9191

92-
std::optional<c10::Device> tgt_device = c10::nullopt;
92+
std::optional<c10::Device> tgt_device = std::nullopt;
9393
// save converted cpu tensor for TensorList
9494
std::vector<c10::IValue> tensorlist_cpu_args;
9595

@@ -188,7 +188,7 @@ void cpu_fallback(const c10::OperatorHandle& op, torch::jit::Stack* stack, bool
188188
auto returns = torch::jit::last(stack, num_returns);
189189
const auto returns_begin = stack->size() - num_returns;
190190

191-
if (tgt_device == c10::nullopt) {
191+
if (tgt_device == std::nullopt) {
192192
tgt_device = compute_target_device(tensor_args, tensorlist_args);
193193
}
194194

aten/src/ATen/native/Constraints.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <c10/core/MemoryFormat.h>
77
#include <c10/core/Scalar.h>
88
#include <c10/core/ScalarType.h>
9-
#include <c10/util/Optional.h>
9+
#include <optional>
1010

1111
#ifndef AT_PER_OPERATOR_HEADERS
1212
#include <ATen/Functions.h>

aten/src/ATen/native/Convolution.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1504,7 +1504,7 @@ at::Tensor _convolution(
15041504
}
15051505

15061506
// Select appropriate backend to use.
1507-
auto bias_sizes_opt = bias.defined() ? std::optional<IntArrayRef>(bias.sizes()) : c10::nullopt;
1507+
auto bias_sizes_opt = bias.defined() ? std::optional<IntArrayRef>(bias.sizes()) : std::nullopt;
15081508
bool need_backward = GradMode::is_enabled() &&
15091509
(input.requires_grad() || weight.requires_grad() || (bias.defined() && bias.requires_grad()));
15101510
ConvBackend backend = _select_conv_backend(input, weight, bias, c10::OptionalIntArrayRef(bias_sizes_opt), need_backward, params);

aten/src/ATen/native/DistributionTemplates.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
#include <ATen/NamedTensorUtils.h>
1111
#include <ATen/native/Resize.h>
1212
#include <ATen/native/TensorIterator.h>
13-
#include <c10/util/Optional.h>
14-
#include <limits>
1513
#include <cmath>
14+
#include <limits>
15+
#include <optional>
1616

1717
#ifndef AT_PER_OPERATOR_HEADERS
1818
#include <ATen/Functions.h>

aten/src/ATen/native/Distributions.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <ATen/TensorIterator.h>
55
#include <ATen/TensorOperators.h>
66
#include <c10/util/Exception.h>
7-
#include <c10/util/Optional.h>
7+
#include <optional>
88

99
#include <ATen/CPUGeneratorImpl.h>
1010
#include <ATen/core/DistributionsHelper.h>

aten/src/ATen/native/EmbeddingBag.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ void _embedding_bag_cpu_impl_out(Tensor& output, Tensor& offset2bag,
129129
Tensor& bag_size, Tensor* max_indices,
130130
const Tensor &weight, const Tensor &indices,
131131
const Tensor &offsets, const int64_t mode = 0,
132-
const std::optional<Tensor>& per_sample_weights = c10::nullopt,
132+
const std::optional<Tensor>& per_sample_weights = std::nullopt,
133133
bool include_last_offset = false,
134134
int64_t padding_idx = -1,
135135
_EmbeddingBagKernelCache* fbgemm_kernel_cache = nullptr);

aten/src/ATen/native/ForeachOpsKernels.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ void foreach_tensor_zero_slow_(TensorList tensors) {
441441
std::vector<Tensor> foreach_tensor_norm_slow(
442442
TensorList tensors,
443443
const Scalar& ord,
444-
c10::optional<ScalarType> dtype) {
444+
std::optional<ScalarType> dtype) {
445445
check_foreach_api_restrictions(tensors);
446446
std::vector<Tensor> result;
447447
for (const auto& t : tensors) {

aten/src/ATen/native/LinearAlgebra.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ Tensor& linalg_matrix_power_out(const Tensor& self, int64_t n, Tensor& result) {
708708
}
709709

710710
Tensor linalg_matrix_power(const Tensor& self, int64_t n) {
711-
return linalg_matrix_power_impl(self, n, c10::nullopt);
711+
return linalg_matrix_power_impl(self, n, std::nullopt);
712712
}
713713

714714
Tensor& matrix_power_out(const Tensor& self, int64_t n, Tensor& result) {
@@ -1092,7 +1092,7 @@ Tensor multi_dot_impl(TensorList _tensors, std::optional<Tensor> _out) {
10921092
} // namespace
10931093

10941094
Tensor linalg_multi_dot(TensorList tensors) {
1095-
return multi_dot_impl(tensors, c10::nullopt);
1095+
return multi_dot_impl(tensors, std::nullopt);
10961096
}
10971097

10981098
Tensor& linalg_multi_dot_out(TensorList tensors, Tensor& result) {

aten/src/ATen/native/LinearAlgebra.h

-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#pragma once
22

33
#include <ATen/native/DispatchStub.h>
4-
#include <c10/util/Optional.h>
54

65
namespace c10 {
76
class Scalar;

aten/src/ATen/native/LinearAlgebraUtils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ inline c10::MaybeOwned<Tensor> borrow_else_clone(const bool cond, const Tensor&
9393
* broadcasted shape.
9494
*/
9595
inline Tensor copyBatchedColumnMajor(const Tensor& src, int64_t nrows = -1,
96-
at::OptionalIntArrayRef desired_batch_sizes = c10::nullopt) {
96+
at::OptionalIntArrayRef desired_batch_sizes = std::nullopt) {
9797
nrows = (nrows == -1) ? src.size(-2) : nrows;
9898
auto copy_sizes = desired_batch_sizes.has_value()
9999
? desired_batch_sizes.value().vec()

aten/src/ATen/native/NonSymbolicBC.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ namespace at::native {
99
// In those cases, we will duplicate the signature here with non-symbolic ints, and also duplicate the C++ implementation.
1010
TORCH_API at::Tensor reshape(const at::Tensor& self, at::IntArrayRef proposed_shape);
1111
TORCH_API at::Tensor narrow(const at::Tensor& self, int64_t dim, int64_t start, int64_t length);
12-
TORCH_API at::Tensor _sparse_coo_tensor_unsafe(const at::Tensor & indices, const at::Tensor & values, at::IntArrayRef size, std::optional<at::ScalarType> dtype=c10::nullopt, std::optional<at::Layout> layout=c10::nullopt, std::optional<at::Device> device=c10::nullopt, std::optional<bool> pin_memory=c10::nullopt, std::optional<bool> is_coalesced=c10::nullopt);
12+
TORCH_API at::Tensor _sparse_coo_tensor_unsafe(const at::Tensor & indices, const at::Tensor & values, at::IntArrayRef size, std::optional<at::ScalarType> dtype=std::nullopt, std::optional<at::Layout> layout=std::nullopt, std::optional<at::Device> device=std::nullopt, std::optional<bool> pin_memory=std::nullopt, std::optional<bool> is_coalesced=std::nullopt);
1313
TORCH_API at::Tensor nll_loss(const at::Tensor & self, const at::Tensor & target, const std::optional<at::Tensor>& weight_opt, int64_t reduction, int64_t ignore_index);
1414
TORCH_API at::Tensor nll_loss2d(const at::Tensor & self, const at::Tensor & target, const std::optional<at::Tensor>& weight_opt, int64_t reduction, int64_t ignore_index);
1515
// The below ops don't get a duplicated C++ implementation.

aten/src/ATen/native/PadNd.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ Tensor constant_pad_nd(const Tensor& self, IntArrayRef pad, const Scalar& value)
8686
"Only per-tensor padding is supported.");
8787
output = at::_empty_affine_quantized(
8888
new_shape, self.options().memory_format(memory_format),
89-
self.q_scale(), self.q_zero_point(), c10::nullopt);
89+
self.q_scale(), self.q_zero_point(), std::nullopt);
9090
} else {
9191
output = at::empty(new_shape, self.options().memory_format(memory_format));
9292
}

aten/src/ATen/native/QuantizedLinear.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ Tensor fbgemm_pack_gemm_matrix_fp16(const Tensor& weight) {
404404
auto ptr = std::make_unique<fbgemm::PackedGemmMatrixFP16>(
405405
fbgemm::matrix_op_t::Transpose, K, N, 1, weight_contig_ptr);
406406
c10::intrusive_ptr<LinearPackedParamsBase> packed_weight =
407-
c10::make_intrusive<PackedLinearWeightFp16>(std::move(ptr), c10::nullopt);
407+
c10::make_intrusive<PackedLinearWeightFp16>(std::move(ptr), std::nullopt);
408408
auto unique_ptr_wrapper =
409409
std::make_unique<decltype(packed_weight)>(std::move(packed_weight));
410410
return cpp_custom_type_hack::create(

aten/src/ATen/native/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ signature.
4242
- `Tensor`. A `Tensor` argument translates into a C++ argument of type `const Tensor&`
4343
(except when the argument is "inplace"; in this case, it is simply `Tensor&`).
4444
A trailing `?`, as in `Tensor?`, indicates that the tensor argument is optional
45-
and may be omitted by passing c10::nullopt. When a function takes multiple
45+
and may be omitted by passing std::nullopt. When a function takes multiple
4646
`Tensor` arguments, these tensors are assumed to be the same type (e.g.,
4747
if one argument is a `FloatTensor`, all other arguments are checked
4848
to be `FloatTensor`s).

aten/src/ATen/native/ReduceOps.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
#include <ATen/native/DispatchStub.h>
44
#include <c10/util/ArrayRef.h>
5-
#include <c10/util/Optional.h>
5+
#include <optional>
66

77
namespace c10 {
88
class Scalar;

aten/src/ATen/native/ReduceOpsUtils.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ inline std::optional<Tensor> _allreduce_return_trivial(
8484
if (self.numel() == 0) {
8585
return at::scalar_tensor(ident, self.options());
8686
}
87-
return c10::nullopt;
87+
return std::nullopt;
8888
}
8989

9090
#define OPTION_TYPE_EQUALITY_CHECK(option, out, self) \

aten/src/ATen/native/Resize.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ const Tensor& _resize_(
239239
auto* self_ = self.unsafeGetTensorImpl();
240240
int64_t old_storage_nbytes = self_->unsafe_storage() ? self_->unsafe_storage().sym_nbytes().maybe_as_int().value_or(-1) : 0;
241241
// NOLINTNEXTLINE(bugprone-argument-comment)
242-
_resize_impl_<T>(self_, size, /*strides=*/c10::nullopt, true);
242+
_resize_impl_<T>(self_, size, /*strides=*/std::nullopt, true);
243243
if (optional_memory_format.has_value()) {
244244
auto memory_format =
245245
optional_memory_format.value();

aten/src/ATen/native/Resize.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ inline void setStrided(
167167

168168
/* storage offset */
169169
TORCH_CHECK(storage_offset >= 0, "Tensor: invalid storage offset ", storage_offset);
170-
self_->set_sizes_and_strides(size, stride, c10::make_optional(storage_offset));
170+
self_->set_sizes_and_strides(size, stride, std::make_optional(storage_offset));
171171
}
172172

173173
} // namespace at::native

aten/src/ATen/native/ScatterGatherChecks.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static void scatter_gather_dtype_check(
1515
const std::string& method_name,
1616
const Tensor& self,
1717
const Tensor& index,
18-
const std::optional<Tensor>& src_opt = c10::nullopt
18+
const std::optional<Tensor>& src_opt = std::nullopt
1919
) {
2020
if (index.numel() != 0) {
2121
TORCH_CHECK(
@@ -66,7 +66,7 @@ static C10_UNUSED void gather_shape_check(const Tensor& self, int64_t dim,
6666
// 3. index.dim() == self.dim() == src.dim()
6767
static C10_UNUSED void scatter_shape_check(
6868
const Tensor& self, int64_t dim, const Tensor& index,
69-
const std::optional<Tensor>& src_opt = c10::nullopt
69+
const std::optional<Tensor>& src_opt = std::nullopt
7070
) {
7171
if (index.numel() == 0) return;
7272
TORCH_CHECK(

aten/src/ATen/native/SegmentReduce.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#include <ATen/native/DispatchStub.h>
44
#include <ATen/native/ReductionType.h>
55
#include <c10/core/Scalar.h>
6-
#include <c10/util/Optional.h>
6+
#include <optional>
77

88
namespace at {
99
class Tensor;

aten/src/ATen/native/TensorConversions.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <c10/core/Layout.h>
55
#include <c10/core/MemoryFormat.h>
66
#include <c10/core/ScalarType.h>
7-
#include <c10/util/Optional.h>
7+
#include <optional>
88

99
namespace at {
1010
class Tensor;

aten/src/ATen/native/UpSample.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ TORCH_API c10::SmallVector<int64_t, 3> compute_output_size(
5959

6060
inline std::optional<double> get_scale_value(std::optional<c10::ArrayRef<double>> scales, int idx) {
6161
if (!scales) {
62-
return c10::nullopt;
62+
return std::nullopt;
6363
}
6464
return scales->at(idx);
6565
}

aten/src/ATen/native/cpu/MaxUnpoolKernel.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
#include <ATen/native/cpu/utils.h>
88
#include <c10/util/irange.h>
99

10-
#include <c10/util/Optional.h>
10+
#include <optional>
1111

1212
namespace at::native {
1313

aten/src/ATen/native/cpu/ReduceOpsKernel.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
#include <ATen/ops/imag.h>
2121
#endif
2222

23-
#include <c10/util/Optional.h>
2423
#include <c10/util/irange.h>
2524
#include <ATen/AccumulateType.h>
2625

aten/src/ATen/native/cpu/SoftMaxKernel.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
#include <ATen/core/Tensor.h>
1414
#include <ATen/cpu/vec/functional.h>
1515
#include <ATen/cpu/vec/vec.h>
16-
#include <c10/util/Optional.h>
1716
#include <c10/util/irange.h>
1817
#include <ATen/OpMathType.h>
1918

aten/src/ATen/native/cpu/TensorCompareKernel.cpp

-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
#include <ATen/NumericUtils.h>
1616
#include <ATen/TensorIterator.h>
1717
#include <ATen/WrapDimUtils.h>
18-
#include <c10/util/Optional.h>
1918
#include <c10/util/irange.h>
2019
#include <ATen/native/ReduceOpsUtils.h>
2120
#include <ATen/native/Resize.h>

aten/src/ATen/native/cuda/Blas.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -331,9 +331,9 @@ Tensor& addmm_out_cuda_impl(Tensor& result, const Tensor& self, const Tensor& ma
331331
at::native::scalar_tensor(
332332
beta,
333333
self.scalar_type(),
334-
c10::nullopt /* layout */,
334+
std::nullopt /* layout */,
335335
at::kCPU,
336-
c10::nullopt /* pin_memory */));
336+
std::nullopt /* pin_memory */));
337337
}
338338

339339
TORCH_INTERNAL_ASSERT_DEBUG_ONLY(!args.result->is_conj());
@@ -716,7 +716,7 @@ TORCH_IMPL_FUNC(addmv_out_cuda)(const Tensor &self, const Tensor &mat, const Ten
716716
const_cast<Tensor&>(result),
717717
self,
718718
at::native::scalar_tensor(
719-
beta_, self.scalar_type(), c10::nullopt /* layout */, at::kCPU, c10::nullopt /* pin_memory */));
719+
beta_, self.scalar_type(), std::nullopt /* layout */, at::kCPU, std::nullopt /* pin_memory */));
720720
}
721721
} else {
722722
if (!result.is_same(*self_) && betaval != 0.0) { //if beta is 0, result contents will be zeroed later

aten/src/ATen/native/cuda/CUDAScalar.cu

+3-3
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ Scalar _local_scalar_dense_cuda(const Tensor& self) {
2222
auto value = at::detail::empty_cpu(
2323
{1}, /* size */
2424
c10::CppTypeToScalarType<scalar_t>(), /* dtype */
25-
c10::nullopt, /* layout */
26-
c10::nullopt, /* device */
25+
std::nullopt, /* layout */
26+
std::nullopt, /* device */
2727
true, /* pin_memory */
28-
c10::nullopt /* memory format */
28+
std::nullopt /* memory format */
2929
);
3030
cudaStream_t stream = at::cuda::getCurrentCUDAStream();
3131
at::cuda::memcpy_and_sync((void *)value.const_data_ptr<scalar_t>(), self.const_data_ptr<scalar_t>(), sizeof(scalar_t), cudaMemcpyDeviceToHost, stream);

aten/src/ATen/native/cuda/Dropout.cu

+1-1
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,7 @@ native_dropout_cuda(const Tensor& self, double p, std::optional<bool> train){
380380
return std::tuple<Tensor,Tensor>(ret, mask);
381381
}
382382
383-
auto gen = get_generator_or_default<CUDAGeneratorImpl>(c10::nullopt, cuda::detail::getDefaultCUDAGenerator());
383+
auto gen = get_generator_or_default<CUDAGeneratorImpl>(std::nullopt, cuda::detail::getDefaultCUDAGenerator());
384384
double p1m = 1. - p;
385385
return dropout_cuda<bool>(gen, self, p1m);
386386
}

aten/src/ATen/native/cuda/ForeachReduceOp.cu

+1-1
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ inline void check_foreach_norm_dtype(
393393
std::vector<Tensor> foreach_tensor_norm_cuda(
394394
TensorList tensors,
395395
const Scalar& ord,
396-
c10::optional<ScalarType> dtype) {
396+
std::optional<ScalarType> dtype) {
397397
const auto p = [&]() -> double {
398398
if (ord.isIntegral(false)) {
399399
return ord.to<int64_t>();

aten/src/ATen/native/cuda/FusedAdamKernel.cu

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,12 @@ void _fused_adam_kernel_cuda_(
111111
// Manually check devices since we specify no device check in
112112
// native_functions.yaml
113113
Device param_device = params[0].device();
114-
if (grad_scale != c10::nullopt) {
114+
if (grad_scale != std::nullopt) {
115115
TORCH_CHECK(
116116
grad_scale->device() == param_device,
117117
"grad_scale must be on the same GPU device as the params");
118118
}
119-
if (found_inf != c10::nullopt) {
119+
if (found_inf != std::nullopt) {
120120
TORCH_CHECK(
121121
found_inf->device() == param_device,
122122
"found_inf must be on the same GPU device as the params");

aten/src/ATen/native/cuda/FusedAdamWKernel.cu

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,12 +112,12 @@ void _fused_adamw_kernel_cuda_(
112112
// Manually check devices since we specify no device check in
113113
// native_functions.yaml
114114
Device param_device = params[0].device();
115-
if (grad_scale != c10::nullopt) {
115+
if (grad_scale != std::nullopt) {
116116
TORCH_CHECK(
117117
grad_scale->device() == param_device,
118118
"grad_scale must be on the same GPU device as the params");
119119
}
120-
if (found_inf != c10::nullopt) {
120+
if (found_inf != std::nullopt) {
121121
TORCH_CHECK(
122122
found_inf->device() == param_device,
123123
"found_inf must be on the same GPU device as the params");

aten/src/ATen/native/cuda/FusedSgdKernel.cu

+2-2
Original file line numberDiff line numberDiff line change
@@ -220,12 +220,12 @@ void _fused_sgd_with_momentum_kernel_cuda_(
220220
TORCH_CHECK_GT(momentum, 0);
221221
TORCH_CHECK(at::native::check_fast_path_restrictions(
222222
{params, grads, momentum_buffer_list}));
223-
if (grad_scale != c10::nullopt) {
223+
if (grad_scale != std::nullopt) {
224224
TORCH_CHECK(
225225
grad_scale->device() == params[0].device(),
226226
"grad_scale must be on the same GPU device as the params");
227227
}
228-
if (found_inf != c10::nullopt) {
228+
if (found_inf != std::nullopt) {
229229
TORCH_CHECK(
230230
found_inf->device() == params[0].device(),
231231
"found_inf must be on the same GPU device as the params");

aten/src/ATen/native/cuda/Normalization.cuh

+1-1
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ void batch_norm_elemt_channels_last_cuda_template(
14701470
const at::Tensor& shift, // bias of BN
14711471
const at::Tensor& mean,
14721472
const at::Tensor& inv_std,
1473-
const std::optional<at::Tensor>& z = c10::nullopt, // bias after BN
1473+
const std::optional<at::Tensor>& z = std::nullopt, // bias after BN
14741474
const bool fuse_relu = false) {
14751475
const auto stride = input.sizes()[1];
14761476
const auto reduction_size = input.numel() / stride;

aten/src/ATen/native/cuda/Resize.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ const Tensor& resize_cuda_(
5555
}
5656
auto* self_ = self.unsafeGetTensorImpl();
5757
int64_t old_storage_nbytes = self_->unsafe_storage() ? self_->unsafe_storage().nbytes() : 0;
58-
resize_impl_cuda_(self_, size, /*strides=*/c10::nullopt);
58+
resize_impl_cuda_(self_, size, /*strides=*/std::nullopt);
5959
if (optional_memory_format.has_value()) {
6060
auto memory_format =
6161
optional_memory_format.value();

0 commit comments

Comments
 (0)