Skip to content

Commit

Permalink
Merge branch 'minjean/welford_layernorm' of https://github.com/intel/…
Browse files Browse the repository at this point in the history
…torch-xpu-ops into minjean/welford_layernorm
  • Loading branch information
min-jean-cho committed Feb 19, 2025
2 parents 4358e06 + e3a1135 commit 5fe435b
Show file tree
Hide file tree
Showing 10 changed files with 664 additions and 242 deletions.
23 changes: 0 additions & 23 deletions src/ATen/native/sparse/SparseCsrTensor.cpp

This file was deleted.

20 changes: 20 additions & 0 deletions src/ATen/native/sparse/xpu/SparseCsrTensorMath.cpp
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
#include <ATen/native/sparse/SparseStubs.h>
#include <ATen/native/sparse/xpu/sycl/SparseCsrTensorMathKernels.h>
#include <xpu/ATen/ops/_convert_indices_from_coo_to_csr_native.h>
#include <xpu/ATen/ops/_convert_indices_from_csr_to_coo_native.h>

namespace at::native {

using namespace at::sparse;

TORCH_IMPL_FUNC(_convert_indices_from_coo_to_csr_structured_xpu)
(const Tensor& input,
const int64_t size,
Expand All @@ -23,4 +26,21 @@ TORCH_IMPL_FUNC(_convert_indices_from_csr_to_coo_structured_xpu)
crow_indices, col_indices, out_int32, transpose, result);
};

Tensor _sparse_csr_sum_xpu(
const Tensor& input,
IntArrayRef dims_to_sum,
bool keepdim,
std::optional<ScalarType> dtype) {
return xpu::_sparse_csr_sum_xpu_kernel(input, dims_to_sum, keepdim, dtype);
}

Tensor _sparse_csr_prod_xpu(
const Tensor& input,
IntArrayRef dims_to_reduce,
bool keepdim,
std::optional<ScalarType> dtype) {
return xpu::_sparse_csr_prod_xpu_kernel(
input, dims_to_reduce, keepdim, dtype);
}

} // namespace at::native
Loading

0 comments on commit 5fe435b

Please sign in to comment.