@@ -242,8 +242,7 @@ TensorBase empty_cpu(
242
242
c10::optional<Device> device_opt,
243
243
c10::optional<bool > pin_memory_opt,
244
244
c10::optional<c10::MemoryFormat> memory_format_opt) {
245
- auto device = device_or_default (device_opt);
246
- TORCH_INTERNAL_ASSERT_DEBUG_ONLY (device.type () == DeviceType::CPU);
245
+ TORCH_INTERNAL_ASSERT_DEBUG_ONLY (device_or_default (device_opt).type () == DeviceType::CPU);
247
246
TORCH_INTERNAL_ASSERT_DEBUG_ONLY (layout_or_default (layout_opt) == Layout::Strided);
248
247
249
248
auto pin_memory = pinned_memory_or_default (pin_memory_opt);
@@ -277,8 +276,7 @@ TensorBase empty_strided_cpu(
277
276
c10::optional<Layout> layout_opt,
278
277
c10::optional<Device> device_opt,
279
278
c10::optional<bool > pin_memory_opt) {
280
- auto device = device_or_default (device_opt);
281
- TORCH_INTERNAL_ASSERT_DEBUG_ONLY (device.type () == DeviceType::CPU);
279
+ TORCH_INTERNAL_ASSERT_DEBUG_ONLY (device_or_default (device_opt).type () == DeviceType::CPU);
282
280
TORCH_INTERNAL_ASSERT_DEBUG_ONLY (layout_or_default (layout_opt) == Layout::Strided);
283
281
284
282
auto pin_memory = pinned_memory_or_default (pin_memory_opt);
@@ -335,8 +333,7 @@ TensorBase empty_meta(
335
333
c10::optional<bool > pin_memory_opt,
336
334
c10::optional<c10::MemoryFormat> memory_format_opt
337
335
) {
338
- auto device = device_or_default (device_opt);
339
- TORCH_INTERNAL_ASSERT_DEBUG_ONLY (device.type () == DeviceType::Meta);
336
+ TORCH_INTERNAL_ASSERT_DEBUG_ONLY (device_or_default (device_opt).type () == DeviceType::Meta);
340
337
// NB: because there is no SparseMeta (yet), non-strided layout is
341
338
// exerciseable
342
339
TORCH_CHECK_NOT_IMPLEMENTED (
@@ -388,8 +385,7 @@ TensorBase empty_strided_meta(
388
385
c10::optional<Layout> layout_opt,
389
386
c10::optional<Device> device_opt,
390
387
c10::optional<bool > pin_memory_opt) {
391
- auto device = device_or_default (device_opt);
392
- TORCH_INTERNAL_ASSERT_DEBUG_ONLY (device.type () == DeviceType::Meta);
388
+ TORCH_INTERNAL_ASSERT_DEBUG_ONLY (device_or_default (device_opt).type () == DeviceType::Meta);
393
389
TORCH_INTERNAL_ASSERT_DEBUG_ONLY (layout_or_default (layout_opt) == Layout::Strided);
394
390
395
391
auto dtype = dtype_or_default (dtype_opt);
@@ -424,8 +420,7 @@ TensorBase empty_strided_symint_meta(
424
420
c10::optional<Layout> layout_opt,
425
421
c10::optional<Device> device_opt,
426
422
c10::optional<bool > pin_memory_opt) {
427
- auto device = device_or_default (device_opt);
428
- TORCH_INTERNAL_ASSERT_DEBUG_ONLY (device.type () == DeviceType::Meta);
423
+ TORCH_INTERNAL_ASSERT_DEBUG_ONLY (device_or_default (device_opt).type () == DeviceType::Meta);
429
424
TORCH_INTERNAL_ASSERT_DEBUG_ONLY (layout_or_default (layout_opt) == Layout::Strided);
430
425
431
426
auto dtype = dtype_or_default (dtype_opt);
0 commit comments