Skip to content

Commit 45ed7c1

Browse files
cyyeverpytorchmergebot
authored andcommitted
Remove unneeded std::make_optional (pytorch#141567)
Fixes #ISSUE_NUMBER Pull Request resolved: pytorch#141567 Approved by: https://github.com/albanD
1 parent fea771d commit 45ed7c1

35 files changed

+112
-118
lines changed

aten/src/ATen/DeviceGuard.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace at {
1717
/// Return the Device of a Tensor, if the Tensor is defined.
1818
inline std::optional<Device> device_of(const Tensor& t) {
1919
if (t.defined()) {
20-
return std::make_optional(t.device());
20+
return t.device();
2121
} else {
2222
return std::nullopt;
2323
}

aten/src/ATen/FunctionalTensorWrapper.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -531,7 +531,7 @@ Tensor to_functional_tensor(const Tensor& tensor) {
531531
}
532532
std::optional<Tensor> to_functional_tensor(const std::optional<Tensor>& tensor) {
533533
if (tensor.has_value()) {
534-
return std::make_optional<Tensor>(to_functional_tensor(*tensor));
534+
return to_functional_tensor(*tensor);
535535
}
536536
return std::nullopt;
537537
}
@@ -569,7 +569,7 @@ Tensor from_functional_tensor(const Tensor& tensor, bool assert_functional) {
569569
}
570570
std::optional<Tensor> from_functional_tensor(const std::optional<Tensor>& t, bool assert_functional) {
571571
if (t.has_value()) {
572-
return std::make_optional<Tensor>(from_functional_tensor(*t, assert_functional));
572+
return from_functional_tensor(*t, assert_functional);
573573
}
574574
return std::nullopt;
575575
}

aten/src/ATen/NestedTensorImpl.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ NestedTensorImpl::NestedTensorImpl(
239239
std::optional<int64_t> NestedTensorImpl::opt_size(int64_t d) const {
240240
if (C10_UNLIKELY(!opt_sizes_.has_value())) {
241241
// Cache the metadata to avoid recomputing it each time.
242-
opt_sizes_ = std::make_optional(construct_opt_sizes(nested_sizes_));
242+
opt_sizes_ = construct_opt_sizes(nested_sizes_);
243243
}
244244
d = at::maybe_wrap_dim(d, dim(), false);
245245
if ((*opt_sizes_)[d] == -1) {

aten/src/ATen/TensorIterator.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ TensorIteratorConfig& TensorIteratorConfig::declare_static_shape(IntArrayRef sha
171171
// This will bypass all shape checking in the TensorIterator. Kernels which call this method
172172
// are expected to check shapes before calling `add_owned_input` or `add_owned_output`.
173173
TORCH_CHECK(!resize_outputs_, "resize_outputs() must be called before declare_static_shape(...)")
174-
static_shape_ = std::make_optional(DimVector(shape));
174+
static_shape_ = DimVector(shape);
175175
return *this;
176176
}
177177

aten/src/ATen/core/operator_name.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ struct OperatorName final {
3030
if (pos == std::string::npos) {
3131
return std::nullopt;
3232
} else {
33-
return std::make_optional(std::string_view(name.data(), pos));
33+
return std::string_view(name.data(), pos);
3434
}
3535
}
3636

aten/src/ATen/functorch/BatchRulesFactory.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ static std::tuple<Tensor, std::optional<int64_t>> logspace_Tensor_Tensor_batch_r
187187
std::optional<at::Layout> layout,
188188
std::optional<at::Device> device,
189189
std::optional<bool> pin_memory){
190-
return linspace_logspace_batch_rule_helper(start, start_bdim, end, end_bdim, steps, std::make_optional(base), dtype, layout, device, pin_memory);
190+
return linspace_logspace_batch_rule_helper(start, start_bdim, end, end_bdim, steps, base, dtype, layout, device, pin_memory);
191191
}
192192

193193
static std::tuple<Tensor, std::optional<int64_t>> logspace_Tensor_Scalar_batch_rule(
@@ -201,7 +201,7 @@ static std::tuple<Tensor, std::optional<int64_t>> logspace_Tensor_Scalar_batch_r
201201
std::optional<bool> pin_memory){
202202

203203
auto end_t = at::native::wrapped_scalar_tensor(end, start.device());
204-
return linspace_logspace_batch_rule_helper(start, start_bdim, end_t, std::nullopt, steps, std::make_optional(base), dtype, layout, device, pin_memory);
204+
return linspace_logspace_batch_rule_helper(start, start_bdim, end_t, std::nullopt, steps, base, dtype, layout, device, pin_memory);
205205
}
206206

207207
static std::tuple<Tensor, std::optional<int64_t>> logspace_Scalar_Tensor_batch_rule(
@@ -215,7 +215,7 @@ static std::tuple<Tensor, std::optional<int64_t>> logspace_Scalar_Tensor_batch_r
215215
std::optional<bool> pin_memory){
216216

217217
auto start_t = at::native::wrapped_scalar_tensor(start, end.device());
218-
return linspace_logspace_batch_rule_helper(start_t, std::nullopt, end, end_bdim, steps, std::make_optional(base), dtype, layout, device, pin_memory);
218+
return linspace_logspace_batch_rule_helper(start_t, std::nullopt, end, end_bdim, steps, base, dtype, layout, device, pin_memory);
219219
}
220220

221221
static bool _has_same_storage_numel_batch_rule(const Tensor& a, const Tensor& b) {

aten/src/ATen/hip/impl/HIPGuardImplMasqueradingAsCUDA.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ struct OptionalHIPStreamGuardMasqueradingAsCUDA {
337337
std::optional<HIPStreamMasqueradingAsCUDA> original_stream() const {
338338
auto r = guard_.original_stream();
339339
if (r.has_value()) {
340-
return std::make_optional(HIPStreamMasqueradingAsCUDA(HIPStreamMasqueradingAsCUDA::UNCHECKED, r.value()));
340+
return HIPStreamMasqueradingAsCUDA(HIPStreamMasqueradingAsCUDA::UNCHECKED, r.value());
341341
} else {
342342
return std::nullopt;
343343
}
@@ -346,7 +346,7 @@ struct OptionalHIPStreamGuardMasqueradingAsCUDA {
346346
std::optional<HIPStreamMasqueradingAsCUDA> current_stream() const {
347347
auto r = guard_.current_stream();
348348
if (r.has_value()) {
349-
return std::make_optional(HIPStreamMasqueradingAsCUDA(HIPStreamMasqueradingAsCUDA::UNCHECKED, r.value()));
349+
return HIPStreamMasqueradingAsCUDA(HIPStreamMasqueradingAsCUDA::UNCHECKED, r.value());
350350
} else {
351351
return std::nullopt;
352352
}

aten/src/ATen/native/ReduceOps.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -1981,28 +1981,28 @@ std::tuple<Tensor, Tensor> var_mean(
19811981
const Tensor& self, at::OptionalIntArrayRef dim, bool unbiased, bool keepdim) {
19821982
return at::var_mean(
19831983
self, /*dim=*/at::OptionalIntArrayRef(dim),
1984-
/*correction=*/std::make_optional<Scalar>(unbiased ? 1 : 0),
1984+
/*correction=*/Scalar(unbiased ? 1 : 0),
19851985
keepdim);
19861986
}
19871987

19881988
std::tuple<Tensor, Tensor> std_mean(
19891989
const Tensor& self, at::OptionalIntArrayRef dim, bool unbiased, bool keepdim) {
19901990
return at::std_mean(
19911991
self, /*dim=*/at::OptionalIntArrayRef(dim),
1992-
/*correction=*/std::make_optional<Scalar>(unbiased ? 1 : 0),
1992+
/*correction=*/Scalar(unbiased ? 1 : 0),
19931993
keepdim);
19941994
}
19951995

19961996
std::tuple<Tensor, Tensor> std_mean(const Tensor& self, bool unbiased) {
19971997
return at::std_mean(
19981998
self, /*dim=*/std::nullopt,
1999-
/*correction=*/std::make_optional<Scalar>(unbiased ? 1 : 0));
1999+
/*correction=*/Scalar(unbiased ? 1 : 0));
20002000
}
20012001

20022002
std::tuple<Tensor, Tensor> var_mean(const Tensor& self, bool unbiased) {
20032003
return at::var_mean(
20042004
self, /*dim=*/std::nullopt,
2005-
/*correction=*/std::make_optional<Scalar>(unbiased ? 1 : 0));
2005+
/*correction=*/Scalar(unbiased ? 1 : 0));
20062006
}
20072007
std::tuple<Tensor&, Tensor&> var_mean_out(
20082008
Tensor& result1, Tensor& result2, const Tensor& self, IntArrayRef dim,
@@ -2037,36 +2037,36 @@ std::tuple<Tensor, Tensor> std_mean(
20372037
Tensor var(const Tensor& self, bool unbiased) {
20382038
return at::var(
20392039
self, /*dim=*/std::nullopt,
2040-
/*correction=*/std::make_optional<Scalar>(unbiased ? 1 : 0));
2040+
/*correction=*/Scalar(unbiased ? 1 : 0));
20412041
}
20422042

20432043
Tensor var(const Tensor& self, at::OptionalIntArrayRef dim, bool unbiased, bool keepdim) {
20442044
return at::var(
20452045
self, /*dim=*/at::OptionalIntArrayRef(dim),
2046-
/*correction=*/std::make_optional<Scalar>(unbiased ? 1 : 0),
2046+
/*correction=*/Scalar(unbiased ? 1 : 0),
20472047
keepdim);
20482048
}
20492049

20502050
Tensor& var_out(const Tensor& self, at::OptionalIntArrayRef dim, bool unbiased, bool keepdim, Tensor& result) {
20512051
return at::var_out(
20522052
result, self, /*dim=*/at::OptionalIntArrayRef(dim),
2053-
/*correction=*/std::make_optional<Scalar>(unbiased ? 1 : 0),
2053+
/*correction=*/Scalar(unbiased ? 1 : 0),
20542054
keepdim);
20552055
}
20562056

20572057
Tensor std(const Tensor& self, bool unbiased) {
20582058
return at::std(
2059-
self, /*dim=*/std::nullopt, /*correction=*/std::make_optional<Scalar>(unbiased ? 1 : 0));
2059+
self, /*dim=*/std::nullopt, /*correction=*/Scalar(unbiased ? 1 : 0));
20602060
}
20612061

20622062
Tensor std(const Tensor& self, at::OptionalIntArrayRef dim, bool unbiased, bool keepdim) {
20632063
return at::std(self, dim,
2064-
/*correction=*/std::make_optional<Scalar>(unbiased ? 1 : 0), keepdim);
2064+
/*correction=*/Scalar(unbiased ? 1 : 0), keepdim);
20652065
}
20662066

20672067
Tensor& std_out(const Tensor& self, at::OptionalIntArrayRef opt_dim, bool unbiased, bool keepdim, Tensor& result) {
20682068
return at::std_out(result, self, opt_dim,
2069-
/*correction=*/std::make_optional<Scalar>(unbiased ? 1 : 0), keepdim);
2069+
/*correction=*/Scalar(unbiased ? 1 : 0), keepdim);
20702070
}
20712071

20722072
Tensor std(const Tensor& self, at::OptionalIntArrayRef dim,

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, std::make_optional(storage_offset));
170+
self_->set_sizes_and_strides(size, stride, storage_offset);
171171
}
172172

173173
} // namespace at::native

aten/src/ATen/native/TensorConversions.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -2013,8 +2013,8 @@ Tensor to_sparse_bsc(const Tensor& self, IntArrayRef blocksize, std::optional<in
20132013

20142014
Tensor to_meta(const Tensor& tensor) {
20152015
auto out = at::native::empty_strided_meta_symint(tensor.sym_sizes(), tensor.sym_strides(), \
2016-
/*dtype=*/std::make_optional(tensor.scalar_type()), /*layout=*/std::make_optional(tensor.layout()), \
2017-
/*device=*/std::make_optional(c10::Device(c10::kMeta)), /*pin_memory=*/std::nullopt);
2016+
/*dtype=*/tensor.scalar_type(), /*layout=*/tensor.layout(), \
2017+
/*device=*/c10::Device(c10::kMeta), /*pin_memory=*/std::nullopt);
20182018
// needs to handle wrapped numbers, so dtype promotion works properly.
20192019
if (tensor.unsafeGetTensorImpl()->is_wrapped_number()) {
20202020
out.unsafeGetTensorImpl()->set_wrapped_number(true);

aten/src/ATen/native/TensorShape.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1179,7 +1179,7 @@ inline void setStridedUnchecked(
11791179
ArrayRef<T> stride,
11801180
T&& storage_offset) {
11811181
auto* self_ = self.unsafeGetTensorImpl();
1182-
self_->set_sizes_and_strides(size, stride, std::make_optional(std::forward<T>(storage_offset)));
1182+
self_->set_sizes_and_strides(size, stride, std::forward<T>(storage_offset));
11831183
}
11841184

11851185
Tensor as_strided_tensorimpl_meta_symint(const Tensor& self, SymIntArrayRef sym_size, SymIntArrayRef sym_stride, std::optional<c10::SymInt> sym_storage_offset_) {

aten/src/ATen/native/mkldnn/ConvPrepack.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ ContextConv create(
8282

8383
return ContextConv{
8484
std::move(packed_weight),
85-
bias.has_value() ? std::make_optional(*bias) : std::nullopt,
85+
bias,
8686
{padding_expanded.begin(), padding_expanded.end()},
8787
{stride_expanded.begin(), stride_expanded.end()},
8888
{dilation_expanded.begin(), dilation_expanded.end()},
@@ -276,6 +276,6 @@ Tensor conv_run(
276276
return op_context->run(input);
277277
}
278278

279-
} // namespace at
279+
} // namespace at::native::mkldnn::internal::convolution
280280

281281
#endif // AT_MKLDNN_ENABLED()

aten/src/ATen/native/mps/operations/ReduceOps.mm

+1-2
Original file line numberDiff line numberDiff line change
@@ -1159,8 +1159,7 @@ Tensor _cdist_forward_mps(const Tensor& x1, const Tensor& x2, const double p, st
11591159
return inputTensorPNorm;
11601160
};
11611161

1162-
std::optional<IntArrayRef> inputBroadcastSize =
1163-
std::make_optional(makeArrayRef(tensor1_view.data(), tensor1_view.size()));
1162+
IntArrayRef inputBroadcastSize = makeArrayRef(tensor1_view.data(), tensor1_view.size());
11641163
impl_func_norm_mps(x1,
11651164
x2,
11661165
OptionalScalarRef(p),

aten/src/ATen/native/mps/operations/Unique.mm

+1-1
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ static void runUniqueGraph(UniqueCachedGraph* uniqueGraph,
293293
int64_t dim,
294294
const bool return_inverse,
295295
const bool return_counts) {
296-
return _unique_impl_mps(self, return_inverse, return_counts, true, std::make_optional((int64_t)dim));
296+
return _unique_impl_mps(self, return_inverse, return_counts, true, dim);
297297
}
298298

299299
std::tuple<Tensor, Tensor, Tensor> _unique2_mps(const Tensor& self,

aten/src/ATen/templates/RegisterFunctionalization.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -56,13 +56,13 @@ inline bool has_internal_overlap_helper(const at::Tensor t) {
5656
inline Tensor to_meta(const Tensor& t) {
5757
if (!t.defined()) return t;
5858
return at::native::empty_strided_meta_symint(t.sym_sizes(), t.sym_strides(),
59-
/*dtype=*/std::make_optional(t.scalar_type()), /*layout=*/std::make_optional(t.layout()),
60-
/*device=*/std::make_optional(c10::Device(kMeta)), /*pin_memory=*/std::nullopt);
59+
/*dtype=*/t.scalar_type(), /*layout=*/t.layout(),
60+
/*device=*/c10::Device(kMeta), /*pin_memory=*/std::nullopt);
6161
}
6262

6363
inline std::optional<Tensor> to_meta(const std::optional<Tensor>& t) {
6464
if (t.has_value()) {
65-
return std::make_optional<Tensor>(to_meta(*t));
65+
return to_meta(*t);
6666
}
6767
return std::nullopt;
6868
}

c10/core/SymBool.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ class C10_API SymBool {
6868

6969
std::optional<bool> maybe_as_bool() const {
7070
if (!is_heap_allocated()) {
71-
return std::make_optional(data_);
71+
return data_;
7272
}
7373
return toSymNodeImplUnowned()->constant_bool();
7474
}

c10/core/SymInt.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ class C10_API SymInt {
232232

233233
std::optional<int64_t> maybe_as_int() const {
234234
if (!is_heap_allocated()) {
235-
return std::make_optional(data_);
235+
return data_;
236236
}
237237
auto* node = toSymNodeImplUnowned();
238238
if (auto c = node->constant_int()) {

c10/core/SymbolicShapeMeta.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,8 @@ normalize_sym_sizes_strides(SymIntArrayRef sizes, SymIntArrayRef strides) {
6969
for (const auto& s : strides) {
7070
stride_nodes.emplace_back(s.wrap_node(base));
7171
}
72-
return std::make_optional(
73-
std::tuple<SymNode, std::vector<SymNode>, std::vector<SymNode>>(
74-
std::move(base), std::move(size_nodes), std::move(stride_nodes)));
72+
return std::tuple<SymNode, std::vector<SymNode>, std::vector<SymNode>>(
73+
std::move(base), std::move(size_nodes), std::move(stride_nodes));
7574
}
7675

7776
// Special treatment because of numel

c10/core/TensorOptions.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ struct C10_API TensorOptions {
438438
std::optional<MemoryFormat> optional_memory_format) const noexcept {
439439
TensorOptions merged = *this;
440440
if (optional_memory_format.has_value()) {
441-
merged.set_memory_format(*optional_memory_format);
441+
merged.set_memory_format(optional_memory_format);
442442
}
443443
return merged;
444444
}

c10/core/impl/PyObjectSlot.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ struct C10_API PyObjectSlot {
112112
if (!ignore_hermetic_tls && c10::impl::HermeticPyObjectTLS::get_state()) {
113113
return std::nullopt;
114114
} else {
115-
return std::make_optional(_unchecked_untagged_pyobj());
115+
return _unchecked_untagged_pyobj();
116116
}
117117
} else {
118118
TORCH_CHECK(

c10/cuda/CUDAGuard.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ struct OptionalCUDAStreamGuard {
246246
std::optional<CUDAStream> original_stream() const {
247247
auto r = guard_.original_stream();
248248
if (r.has_value()) {
249-
return std::make_optional(CUDAStream(CUDAStream::UNCHECKED, r.value()));
249+
return CUDAStream(CUDAStream::UNCHECKED, r.value());
250250
} else {
251251
return std::nullopt;
252252
}
@@ -258,7 +258,7 @@ struct OptionalCUDAStreamGuard {
258258
std::optional<CUDAStream> current_stream() const {
259259
auto r = guard_.current_stream();
260260
if (r.has_value()) {
261-
return std::make_optional(CUDAStream(CUDAStream::UNCHECKED, r.value()));
261+
return CUDAStream(CUDAStream::UNCHECKED, r.value());
262262
} else {
263263
return std::nullopt;
264264
}

c10/test/core/DeviceGuard_test.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ TEST(OptionalDeviceGuard, ResetDeviceDifferentDeviceType) {
3636
g.reset_device(Device(DeviceType::HIP, 2), &hip_impl);
3737
ASSERT_EQ(FakeGuardImpl<DeviceType::CUDA>::getDeviceIndex(), 0);
3838
ASSERT_EQ(FakeGuardImpl<DeviceType::HIP>::getDeviceIndex(), 2);
39-
ASSERT_EQ(g.current_device(), std::make_optional(Device(DeviceType::HIP, 2)));
40-
ASSERT_EQ(
41-
g.original_device(), std::make_optional(Device(DeviceType::HIP, 0)));
39+
ASSERT_EQ(g.current_device(), Device(DeviceType::HIP, 2));
40+
ASSERT_EQ(g.original_device(), Device(DeviceType::HIP, 0));
4241
}

c10/test/core/impl/InlineDeviceGuard_test.cpp

+10-10
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ TEST(InlineDeviceGuard, Constructor) {
4444
/*
4545
{
4646
// Optional constructor
47-
TestGuard g(std::make_optional(dev(i)));
47+
TestGuard g(dev(i));
4848
test_body(g);
4949
}
5050
ASSERT_EQ(TestGuardImpl::getDeviceIndex(), init_i);
@@ -136,7 +136,7 @@ TEST(InlineOptionalDeviceGuard, Constructor) {
136136
ASSERT_EQ(TestGuardImpl::getDeviceIndex(), init_i);
137137
{
138138
// Optional constructor
139-
MaybeTestGuard g(std::make_optional(dev(i)));
139+
MaybeTestGuard g(dev(i));
140140
test_body(g);
141141
}
142142
ASSERT_EQ(TestGuardImpl::getDeviceIndex(), init_i);
@@ -170,12 +170,12 @@ TEST(InlineOptionalDeviceGuard, SetDevice) {
170170
MaybeTestGuard g;
171171
DeviceIndex i = 1;
172172
g.set_device(dev(i));
173-
ASSERT_EQ(g.original_device(), std::make_optional(dev(init_i)));
174-
ASSERT_EQ(g.current_device(), std::make_optional(dev(i)));
173+
ASSERT_EQ(g.original_device(), dev(init_i));
174+
ASSERT_EQ(g.current_device(), dev(i));
175175
ASSERT_EQ(TestGuardImpl::getDeviceIndex(), i);
176176
g.set_device(dev(i));
177-
ASSERT_EQ(g.original_device(), std::make_optional(dev(init_i)));
178-
ASSERT_EQ(g.current_device(), std::make_optional(dev(i)));
177+
ASSERT_EQ(g.original_device(), dev(init_i));
178+
ASSERT_EQ(g.current_device(), dev(i));
179179
ASSERT_EQ(TestGuardImpl::getDeviceIndex(), i);
180180
}
181181

@@ -185,11 +185,11 @@ TEST(InlineOptionalDeviceGuard, SetIndex) {
185185
DeviceIndex i = 1;
186186
MaybeTestGuard g;
187187
g.set_index(i);
188-
ASSERT_EQ(g.original_device(), std::make_optional(dev(init_i)));
189-
ASSERT_EQ(g.current_device(), std::make_optional(dev(i)));
188+
ASSERT_EQ(g.original_device(), dev(init_i));
189+
ASSERT_EQ(g.current_device(), dev(i));
190190
ASSERT_EQ(TestGuardImpl::getDeviceIndex(), i);
191191
g.set_index(i);
192-
ASSERT_EQ(g.original_device(), std::make_optional(dev(init_i)));
193-
ASSERT_EQ(g.current_device(), std::make_optional(dev(i)));
192+
ASSERT_EQ(g.original_device(), dev(init_i));
193+
ASSERT_EQ(g.current_device(), dev(i));
194194
ASSERT_EQ(TestGuardImpl::getDeviceIndex(), i);
195195
}

0 commit comments

Comments
 (0)