Skip to content

Commit e2d47a1

Browse files
r-barnespytorchmergebot
authored andcommitted
Disable c10::optional macros (#138912)
Test Plan: Sandcastle Pull Request resolved: #138912 Approved by: https://github.com/Skylion007, https://github.com/malfet
1 parent c3f3a6e commit e2d47a1

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

aten/src/ATen/native/mkldnn/xpu/detail/QConv.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ at::Tensor quantized_convolution(
194194
Tensor scratchpad_tensor = at::empty(
195195
{static_cast<int64_t>(scratchpad_size)},
196196
act.options().dtype(at::kByte),
197-
c10::nullopt);
197+
std::nullopt);
198198
auto scratchpad_m = make_onednn_memory(
199199
conv_fwd_pd.scratchpad_desc(), engine, scratchpad_tensor.data_ptr());
200200
args.insert({DNNL_ARG_SCRATCHPAD, scratchpad_m});

aten/src/ATen/native/mkldnn/xpu/qconv.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,12 +94,12 @@ class QConvoneDNNXPU final {
9494
output,
9595
inv_output_scale,
9696
output_zero_point,
97-
/*accum*/ c10::nullopt,
97+
/*accum*/ std::nullopt,
9898
/*accum_scale*/ 0.0,
9999
/*accum_zero_point*/ 0,
100100
/*output_dtype*/ output_dtype,
101-
/*binary_attr*/ c10::nullopt,
102-
/*binary_alpha*/ c10::nullopt,
101+
/*binary_attr*/ std::nullopt,
102+
/*binary_alpha*/ std::nullopt,
103103
/*unary_attr*/ attr,
104104
/*unary_scalars*/ scalars,
105105
/*unary_algorithm*/ algorithm);

c10/util/Optional.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
// up builds.
1010

1111
namespace c10 {
12+
13+
#if !defined(FBCODE_CAFFE2) && !defined(C10_NODEPRECATED)
1214
// NOLINTNEXTLINE(misc-unused-using-decls)
1315
using std::bad_optional_access;
1416
// NOLINTNEXTLINE(misc-unused-using-decls)
@@ -19,6 +21,7 @@ using std::nullopt;
1921
using std::nullopt_t;
2022
// NOLINTNEXTLINE(misc-unused-using-decls)
2123
using std::optional;
24+
#endif
2225

2326
#if !defined(FBCODE_CAFFE2) && !defined(C10_NODEPRECATED)
2427

torch/csrc/api/include/torch/types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,10 @@ namespace torch {
3838
// the `func()` function defined in `at::` namespace is always hidden.
3939
using namespace at; // NOLINT
4040

41+
#if !defined(FBCODE_CAFFE2) && !defined(C10_NODEPRECATED)
4142
using std::nullopt; // NOLINT
4243
using std::optional; // NOLINT
44+
#endif
4345

4446
using Dtype = at::ScalarType;
4547

0 commit comments

Comments
 (0)