Skip to content

Commit

Permalink
fixed cpu backup issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr4k committed Jul 9, 2023
1 parent 5d50a78 commit 5311353
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion aten/src/ATen/native/mps/operations/UnaryOps.mm
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,12 @@ void cumulative_op_impl(const Tensor& self,
")");
if (!is_macos_13_or_newer()) {
TORCH_WARN_ONCE(op_name, " supported by MPS on MacOS 13+, please upgrade");
auto cpu_result = self.to(at::Device(kCPU)).cumsum(dim, dtype);
Tensor cpu_result;
if (cumulativeOpType == MPSCumulativeOpType::CUMSUM) {
cpu_result = self.to(at::Device(kCPU)).cumsum(dim, dtype);
} else if (cumulativeOpType == MPSCumulativeOpType::CUMPROD) {
cpu_result = self.to(at::Device(kCPU)).cumprod(dim, dtype);
}
at::_copy_from_and_resize(cpu_result, result);
return;
}
Expand Down

0 comments on commit 5311353

Please sign in to comment.