Unverified Commit 81831111 authored by Hongzhi (Steve), Chen's avatar Hongzhi (Steve), Chen Committed by GitHub
Browse files

[Misc] clang-format auto fix. (#4805)



* [Misc] clang-format auto fix.

* fix
Co-authored-by: default avatarSteve <ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal>
parent 16e771c0
...@@ -5,11 +5,13 @@ ...@@ -5,11 +5,13 @@
*/ */
#include <dgl/array.h> #include <dgl/array.h>
#include <dgl/sampling/negative.h>
#include <dgl/base_heterograph.h> #include <dgl/base_heterograph.h>
#include <dgl/packed_func_ext.h> #include <dgl/packed_func_ext.h>
#include <dgl/runtime/container.h> #include <dgl/runtime/container.h>
#include <dgl/sampling/negative.h>
#include <utility> #include <utility>
#include "../../../c_api_common.h" #include "../../../c_api_common.h"
using namespace dgl::runtime; using namespace dgl::runtime;
...@@ -19,13 +21,8 @@ namespace dgl { ...@@ -19,13 +21,8 @@ namespace dgl {
namespace sampling { namespace sampling {
std::pair<IdArray, IdArray> GlobalUniformNegativeSampling( std::pair<IdArray, IdArray> GlobalUniformNegativeSampling(
HeteroGraphPtr hg, HeteroGraphPtr hg, dgl_type_t etype, int64_t num_samples, int num_trials,
dgl_type_t etype, bool exclude_self_loops, bool replace, double redundancy) {
int64_t num_samples,
int num_trials,
bool exclude_self_loops,
bool replace,
double redundancy) {
auto format = hg->SelectFormat(etype, CSC_CODE | CSR_CODE); auto format = hg->SelectFormat(etype, CSC_CODE | CSR_CODE);
if (format == SparseFormat::kCSC) { if (format == SparseFormat::kCSC) {
CSRMatrix csc = hg->GetCSCMatrix(etype); CSRMatrix csc = hg->GetCSCMatrix(etype);
...@@ -40,28 +37,30 @@ std::pair<IdArray, IdArray> GlobalUniformNegativeSampling( ...@@ -40,28 +37,30 @@ std::pair<IdArray, IdArray> GlobalUniformNegativeSampling(
return CSRGlobalUniformNegativeSampling( return CSRGlobalUniformNegativeSampling(
csr, num_samples, num_trials, exclude_self_loops, replace, redundancy); csr, num_samples, num_trials, exclude_self_loops, replace, redundancy);
} else { } else {
LOG(FATAL) << "COO format is not supported in global uniform negative sampling"; LOG(FATAL)
<< "COO format is not supported in global uniform negative sampling";
return {IdArray(), IdArray()}; return {IdArray(), IdArray()};
} }
} }
DGL_REGISTER_GLOBAL("sampling.negative._CAPI_DGLGlobalUniformNegativeSampling") DGL_REGISTER_GLOBAL("sampling.negative._CAPI_DGLGlobalUniformNegativeSampling")
.set_body([] (DGLArgs args, DGLRetValue* rv) { .set_body([](DGLArgs args, DGLRetValue* rv) {
HeteroGraphRef hg = args[0]; HeteroGraphRef hg = args[0];
dgl_type_t etype = args[1]; dgl_type_t etype = args[1];
CHECK_LE(etype, hg->NumEdgeTypes()) << "invalid edge type " << etype; CHECK_LE(etype, hg->NumEdgeTypes()) << "invalid edge type " << etype;
int64_t num_samples = args[2]; int64_t num_samples = args[2];
int num_trials = args[3]; int num_trials = args[3];
bool exclude_self_loops = args[4]; bool exclude_self_loops = args[4];
bool replace = args[5]; bool replace = args[5];
double redundancy = args[6]; double redundancy = args[6];
List<Value> result; List<Value> result;
std::pair<IdArray, IdArray> ret = GlobalUniformNegativeSampling( std::pair<IdArray, IdArray> ret = GlobalUniformNegativeSampling(
hg.sptr(), etype, num_samples, num_trials, exclude_self_loops, replace, redundancy); hg.sptr(), etype, num_samples, num_trials, exclude_self_loops,
result.push_back(Value(MakeValue(ret.first))); replace, redundancy);
result.push_back(Value(MakeValue(ret.second))); result.push_back(Value(MakeValue(ret.first)));
*rv = result; result.push_back(Value(MakeValue(ret.second)));
}); *rv = result;
});
}; // namespace sampling }; // namespace sampling
}; // namespace dgl }; // namespace dgl
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment