| 20 | namespace at::detail { |
| 21 | |
| 22 | at::Tensor empty_cuda(IntArrayRef size, |
| 23 | ScalarType dtype, |
| 24 | std::optional<Device> device_opt, |
| 25 | std::optional<c10::MemoryFormat> memory_format_opt) { |
| 26 | PD_CHECK(!(memory_format_opt.has_value() && |
| 27 | memory_format_opt.value() != c10::MemoryFormat::Contiguous), |
| 28 | "`MemoryFormat` other than Contiguous is not supported now."); |
| 29 | return paddle::experimental::empty( |
| 30 | size._PD_ToPaddleIntArray(), |
| 31 | compat::_PD_AtenScalarTypeToPhiDataType(dtype), |
| 32 | device_opt && device_opt->has_index() ? phi::GPUPlace(device_opt->index()) |
| 33 | : paddle::DefaultGPUPlace()); |
| 34 | } |
| 35 | |
| 36 | at::Tensor empty_cuda(IntArrayRef size, const TensorOptions &options) { |
| 37 | auto place = options.has_device() && options.device().has_index() |