-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add Aten::adaptive_avg_pool3d forward/backward (#851)
- [x] Aten::adaptive_avg_pool3d forward - [x] Aten::adaptive_avg_pool3d backward --------- Co-authored-by: Yutao Xu <[email protected]>
- Loading branch information
1 parent
4034556
commit 88b029e
Showing
8 changed files
with
766 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#include <ATen/core/Tensor.h> | ||
#include <ATen/native/AdaptivePooling.h> | ||
#include <ATen/native/xpu/sycl/AdaptiveAveragePooling3dKernels.h> | ||
|
||
#include <ATen/ops/empty.h> | ||
#include <ATen/ops/empty_like.h> | ||
#include <xpu/ATen/ops/adaptive_avg_pool3d_backward_native.h> | ||
#include <xpu/ATen/ops/adaptive_avg_pool3d_native.h> | ||
|
||
namespace at::native { | ||
|
||
Tensor& adaptive_avg_pool3d_out_xpu( | ||
const Tensor& input, | ||
IntArrayRef output_size, | ||
Tensor& output) { | ||
at::native::xpu::adaptive_avg_pool3d_kernel(output, input, output_size); | ||
return output; | ||
} | ||
|
||
Tensor adaptive_avg_pool3d_xpu(const Tensor& input, IntArrayRef output_size) { | ||
auto output = at::empty({0}, input.options()); | ||
at::native::xpu::adaptive_avg_pool3d_kernel(output, input, output_size); | ||
return output; | ||
} | ||
|
||
Tensor& adaptive_avg_pool3d_backward_out_xpu( | ||
const Tensor& gradOutput_, | ||
const Tensor& input, | ||
Tensor& gradInput) { | ||
globalContext().alertNotDeterministic("adaptive_avg_pool3d_backward_xpu"); | ||
at::native::xpu::adaptive_avg_pool3d_backward_kernel( | ||
gradInput, gradOutput_, input); | ||
return gradInput; | ||
} | ||
|
||
Tensor adaptive_avg_pool3d_backward_xpu( | ||
const Tensor& gradOutput_, | ||
const Tensor& input) { | ||
globalContext().alertNotDeterministic("adaptive_avg_pool3d_backward_xpu"); | ||
auto gradInput = at::empty_like(input, LEGACY_CONTIGUOUS_MEMORY_FORMAT); | ||
at::native::xpu::adaptive_avg_pool3d_backward_kernel( | ||
gradInput, gradOutput_, input); | ||
return gradInput; | ||
} | ||
|
||
} // namespace at::native |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.