Add contiguous_copy_cpu util for copying array (#2397)

This commit is contained in:
Cheng
2025-07-21 23:30:35 +09:00
committed by GitHub
parent f55c4ed1d6
commit 56cc858af9
8 changed files with 17 additions and 18 deletions

View File

@@ -87,8 +87,7 @@ void LogSumExp::eval_cpu(const std::vector<array>& inputs, array& out) {
if (x.flags().contiguous && x.strides()[x.ndim() - 1] == 1) {
return x;
} else {
auto x_copy = array(x.shape(), x.dtype(), nullptr, {});
copy_cpu(x, x_copy, CopyType::General, s);
array x_copy = contiguous_copy_cpu(x, s);
encoder.add_temporary(x_copy);
return x_copy;
}