Skip to content

Commit 1af9bee

Browse files
committed
Update SpectralOps.cpp
1 parent adcedd2 commit 1af9bee

File tree

1 file changed

+0
-84
lines changed

1 file changed

+0
-84
lines changed

src/ATen/native/xpu/mkl/SpectralOps.cpp

-84
Original file line numberDiff line numberDiff line change
@@ -373,90 +373,6 @@ Tensor& _fft_c2c_mkl_out(
373373
return out;
374374
}
375375

376-
Tensor _fft_r2c_mkl(
377-
const Tensor& self,
378-
IntArrayRef dim,
379-
int64_t normalization,
380-
bool onesided) {
381-
if (dim.empty()) {
382-
return self.clone();
383-
}
384-
385-
auto input_sizes = self.sizes();
386-
DimVector out_sizes(input_sizes.begin(), input_sizes.end());
387-
auto last_dim = dim.back();
388-
auto last_dim_halfsize = (input_sizes[last_dim]) / 2 + 1;
389-
390-
if (onesided) {
391-
out_sizes[last_dim] = last_dim_halfsize;
392-
}
393-
394-
auto sorted_dims = impl::_sort_dims(self, dim, /*exclude_last=*/true);
395-
auto out = at::empty(
396-
out_sizes, self.options().dtype(c10::toComplexType(self.scalar_type())));
397-
398-
{
399-
auto working_tensor = self;
400-
while (!sorted_dims.empty()) {
401-
const auto max_dims =
402-
std::min(static_cast<size_t>(impl::mkl_max_ndim), sorted_dims.size());
403-
auto fft_dims = IntArrayRef(sorted_dims)
404-
.slice(sorted_dims.size() - max_dims, max_dims);
405-
impl::_exec_fft(
406-
out,
407-
working_tensor,
408-
out_sizes,
409-
fft_dims,
410-
onesided,
411-
/*forward=*/true);
412-
sorted_dims.resize(sorted_dims.size() - max_dims);
413-
414-
if (sorted_dims.empty()) {
415-
break;
416-
}
417-
418-
sorted_dims = impl::_sort_dims(self, sorted_dims);
419-
420-
if (working_tensor.is_same(self)) {
421-
working_tensor = std::move(out);
422-
out = at::empty(
423-
out_sizes,
424-
self.options().dtype(c10::toComplexType(self.scalar_type())));
425-
} else {
426-
std::swap(out, working_tensor);
427-
}
428-
}
429-
}
430-
431-
// Only need to normalize the onesided slice since data in the other half is
432-
// overwritten
433-
out = impl::_fft_apply_normalization(out, normalization, input_sizes, dim);
434-
auto working_tensor = self;
435-
if (!onesided) {
436-
if (out.size(last_dim) != out_sizes[last_dim]) {
437-
working_tensor.resize_(out_sizes, MemoryFormat::Contiguous);
438-
working_tensor.slice(last_dim, 0, last_dim_halfsize).copy_(out);
439-
out = std::move(working_tensor);
440-
}
441-
_fft_fill_with_conjugate_symmetry_(out, dim);
442-
}
443-
444-
return out;
445-
}
446-
447-
Tensor& _fft_r2c_mkl_out(
448-
const Tensor& self,
449-
IntArrayRef dim,
450-
int64_t normalization,
451-
bool onesided,
452-
Tensor& out) {
453-
auto result = _fft_r2c_mkl(
454-
self, dim, static_cast<int64_t>(fft_norm_mode::none), onesided);
455-
at::native::resize_output(out, result.sizes());
456-
out.copy_(result);
457-
return out;
458-
}
459-
460376
void HermitSymmImpl(Tensor& input, int64_t dim, int pos) {
461377
std::vector<at::indexing::TensorIndex> indices(
462378
input.dim(), at::indexing::Slice());

0 commit comments

Comments
 (0)