Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
xiangyuzhi committed Sep 19, 2023
1 parent 5a7558a commit d0d5032
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions dgl_sparse/src/matrix_ops_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <sparse/sparse_matrix.h>

#include <tuple>
#include <vector>

#include "./utils.h"

Expand Down Expand Up @@ -73,19 +74,18 @@ CompactImpl(
nnz.push_back(i);
}
}
long int nnz_size = nnz.size();
if (dim == 0) {
auto ret = SparseMatrix::FromCSR(
VectorToTorchTensor(ret_ptr), VectorToTorchTensor(ret_idx),
VectorToTorchTensor(ret_val),
std::vector<int64_t>{nnz_size, csr->num_cols});
std::vector<int64_t>{static_cast<int64_t>(nnz.size()), csr->num_cols});
auto ret_idx = torch::optional<torch::Tensor>(VectorToTorchTensor(nnz));
return {ret, ret_idx};
} else {
auto ret = SparseMatrix::FromCSC(
VectorToTorchTensor(ret_ptr), VectorToTorchTensor(ret_idx),
VectorToTorchTensor(ret_val),
std::vector<int64_t>{csr->num_cols, nnz_size});
std::vector<int64_t>{csr->num_cols, static_cast<int64_t>(nnz.size())});
auto ret_idx = torch::optional<torch::Tensor>(VectorToTorchTensor(nnz));
return {ret, ret_idx};
}
Expand Down
2 changes: 2 additions & 0 deletions dgl_sparse/src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
#include <torch/custom_class.h>
#include <torch/script.h>

#include <vector>

namespace dgl {
namespace sparse {

Expand Down

0 comments on commit d0d5032

Please sign in to comment.