-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add aten::_nnz/_values for SparseXPU and SparsCsrXPU dispatch key (#428)
Signed-off-by: Feng Yuan <feng1.yuan@intel.com>
- Loading branch information
1 parent
01fc85f
commit 31c4001
Showing
3 changed files
with
37 additions
and
5 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,23 @@ | ||
// Basic functions on sparse tensors | ||
#define TORCH_ASSERT_ONLY_METHOD_OPERATORS | ||
#include <ATen/core/Tensor.h> | ||
#include <torch/library.h> | ||
|
||
#ifndef AT_PER_OPERATOR_HEADERS | ||
#include <ATen/Functions.h> | ||
#include <ATen/NativeFunctions.h> | ||
#else | ||
#include <ATen/ops/_nnz_native.h> | ||
#endif | ||
|
||
namespace at::native::xpu { | ||
|
||
int64_t _nnz_csr(const Tensor& self) { | ||
return at::native::_nnz_sparse_csr(self); | ||
} | ||
|
||
TORCH_LIBRARY_IMPL(aten, SparseCsrXPU, m) { | ||
m.impl(TORCH_SELECTIVE_NAME("_nnz"), TORCH_FN(_nnz_csr)); | ||
} | ||
|
||
} // namespace at::native::xpu |
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