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

[Misc] Minor code style fix. (#4825)



* blabla

* more

* blabla

* blabla

* ablabla

* blabla
Co-authored-by: default avatarSteve <ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal>
parent 8ac27dad
......@@ -188,9 +188,11 @@ class BaseHeteroGraph : public runtime::Object {
/**
* @brief Get all edge ids between the two given endpoints
* @note The given src and dst vertices should belong to the source vertex
* type and the dest vertex type of the given edge type, respectively. \param
* etype The edge type \param src The source vertex. \param dst The
* destination vertex. \return the edge id array.
* type and the dest vertex type of the given edge type, respectively.
* @param etype The edge type
* @param src The source vertex.
* @param dst The destination vertex.
* @return the edge id array.
*/
virtual IdArray EdgeId(
dgl_type_t etype, dgl_id_t src, dgl_id_t dst) const = 0;
......@@ -284,17 +286,18 @@ class BaseHeteroGraph : public runtime::Object {
* @brief Get all the edges in the graph.
* @note If order is "srcdst", the returned edges list is sorted by their src
* and dst ids. If order is "eid", they are in their edge id order. Otherwise,
* in the arbitrary order. \param etype The edge type \param order The order
* of the returned edge list. \return the id arrays of the two endpoints of
* the edges.
* in the arbitrary order.
* @param etype The edge type
* @param order The order of the returned edge list.
* @return the id arrays of the two endpoints of the edges.
*/
virtual EdgeArray Edges(
dgl_type_t etype, const std::string& order = "") const = 0;
/**
* @brief Get the in degree of the given vertex.
* @note The given vertex should belong to the dest vertex type
* of the given edge type.
* @note The given vertex should belong to the dest vertex type of the given
* edge type.
* @param etype The edge type
* @param vid The vertex id.
* @return the in degree
......@@ -303,8 +306,8 @@ class BaseHeteroGraph : public runtime::Object {
/**
* @brief Get the in degrees of the given vertices.
* @note The given vertex should belong to the dest vertex type
* of the given edge type.
* @note The given vertex should belong to the dest vertex type of the given
* edge type.
* @param etype The edge type
* @param vid The vertex id array.
* @return the in degree array
......@@ -313,8 +316,8 @@ class BaseHeteroGraph : public runtime::Object {
/**
* @brief Get the out degree of the given vertex.
* @note The given vertex should belong to the source vertex type
* of the given edge type.
* @note The given vertex should belong to the source vertex type of the given
* edge type.
* @param etype The edge type
* @param vid The vertex id.
* @return the out degree
......@@ -323,8 +326,8 @@ class BaseHeteroGraph : public runtime::Object {
/**
* @brief Get the out degrees of the given vertices.
* @note The given vertex should belong to the source vertex type
* of the given edge type.
* @note The given vertex should belong to the source vertex type of the given
* edge type.
* @param etype The edge type
* @param vid The vertex id array.
* @return the out degree array
......@@ -333,8 +336,8 @@ class BaseHeteroGraph : public runtime::Object {
/**
* @brief Return the successor vector
* @note The given vertex should belong to the source vertex type
* of the given edge type.
* @note The given vertex should belong to the source vertex type of the given
* edge type.
* @param vid The vertex id.
* @return the successor vector iterator pair.
*/
......@@ -342,8 +345,8 @@ class BaseHeteroGraph : public runtime::Object {
/**
* @brief Return the out edge id vector
* @note The given vertex should belong to the source vertex type
* of the given edge type.
* @note The given vertex should belong to the source vertex type of the given
* edge type.
* @param vid The vertex id.
* @return the out edge id vector iterator pair.
*/
......@@ -351,8 +354,8 @@ class BaseHeteroGraph : public runtime::Object {
/**
* @brief Return the predecessor vector
* @note The given vertex should belong to the dest vertex type
* of the given edge type.
* @note The given vertex should belong to the dest vertex type of the given
* edge type.
* @param vid The vertex id.
* @return the predecessor vector iterator pair.
*/
......@@ -360,8 +363,8 @@ class BaseHeteroGraph : public runtime::Object {
/**
* @brief Return the in edge id vector
* @note The given vertex should belong to the dest vertex type
* of the given edge type.
* @note The given vertex should belong to the dest vertex type of the given
* edge type.
* @param vid The vertex id.
* @return the in edge id vector iterator pair.
*/
......@@ -391,7 +394,6 @@ class BaseHeteroGraph : public runtime::Object {
/**
* @brief Determine which format to use with a preference.
*
* Otherwise, it will return whatever DGL thinks is the most appropriate given
* the arguments.
*
......@@ -477,7 +479,8 @@ class BaseHeteroGraph : public runtime::Object {
*
* @param eids The edges in the subgraph.
* @param preserve_nodes If true, the vertices will not be relabeled, so some
* vertices may have no incident edges. \return the subgraph.
* vertices may have no incident edges.
* @return the subgraph.
*/
virtual HeteroSubgraph EdgeSubgraph(
const std::vector<IdArray>& eids, bool preserve_nodes = false) const = 0;
......@@ -713,7 +716,8 @@ HeteroGraphPtr CreateFromCSC(
* @param graph Graph
* @param nodes Node IDs of each type
* @param relabel_nodes Whether to remove isolated nodes and relabel the rest
* ones \return Subgraph containing only the in edges. The returned graph has
* ones
* @return Subgraph containing only the in edges. The returned graph has
* the same schema as the original one.
*/
HeteroSubgraph InEdgeGraph(
......@@ -725,7 +729,8 @@ HeteroSubgraph InEdgeGraph(
* @param graph Graph
* @param nodes Node IDs of each type
* @param relabel_nodes Whether to remove isolated nodes and relabel the rest
* ones \return Subgraph containing only the out edges. The returned graph has
* ones
* @return Subgraph containing only the out edges. The returned graph has
* the same schema as the original one.
*/
HeteroSubgraph OutEdgeGraph(
......
......@@ -246,7 +246,8 @@ DGL_DLL void DGLAPISetLastError(const char* msg);
* DGLGetLastError can be called to retrieve the error
*
* this function is threadsafe and can be called by different thread
* \return error info
*
* @return error info
*/
DGL_DLL const char* DGLGetLastError(void);
/**
......
......@@ -235,7 +235,9 @@ class List : public ObjectRef {
}
/**
* @brief Constructs a container with n elements. Each element is a copy of
* val \param n The size of the container \param val The init value
* val
* @param n The size of the container
* @param val The init value
*/
explicit List(size_t n, const T& val) {
auto tmp_obj = std::make_shared<ListObject>();
......
......@@ -32,13 +32,13 @@ namespace impl {
// *ATTENTION*: This function will be invoked concurrently. Please make sure
// it is thread-safe.
//
// \param rowid The row to pick from.
// \param off Starting offset of this row.
// \param len NNZ of the row.
// \param num_picks Number of picks on the row.
// \param col Pointer of the column indices.
// \param data Pointer of the data indices.
// \param out_idx Picked indices in [off, off + len).
// @param rowid The row to pick from.
// @param off Starting offset of this row.
// @param len NNZ of the row.
// @param num_picks Number of picks on the row.
// @param col Pointer of the column indices.
// @param data Pointer of the data indices.
// @param out_idx Picked indices in [off, off + len).
template <typename IdxType>
using PickFn = std::function<void(
IdxType rowid, IdxType off, IdxType len, IdxType num_picks,
......@@ -57,11 +57,11 @@ using PickFn = std::function<void(
// *ATTENTION*: This function will be invoked concurrently. Please make sure
// it is thread-safe.
//
// \param rowid The row to pick from.
// \param off Starting offset of this row.
// \param len NNZ of the row.
// \param col Pointer of the column indices.
// \param data Pointer of the data indices.
// @param rowid The row to pick from.
// @param off Starting offset of this row.
// @param len NNZ of the row.
// @param col Pointer of the column indices.
// @param data Pointer of the data indices.
template <typename IdxType>
using NumPicksFn = std::function<IdxType(
IdxType rowid, IdxType off, IdxType len, const IdxType* col,
......@@ -80,14 +80,14 @@ using NumPicksFn = std::function<IdxType(
// *ATTENTION*: This function will be invoked concurrently. Please make sure
// it is thread-safe.
//
// \param off Starting offset of this row.
// \param et_offset Starting offset of this range.
// \param cur_et The edge type.
// \param et_len Length of the range.
// \param et_idx A map from local idx to column id.
// \param et_eid Edge-type-specific id array.
// \param eid Pointer of the homogenized edge id array.
// \param out_idx Picked indices in [et_offset, et_offset + et_len).
// @param off Starting offset of this row.
// @param et_offset Starting offset of this range.
// @param cur_et The edge type.
// @param et_len Length of the range.
// @param et_idx A map from local idx to column id.
// @param et_eid Edge-type-specific id array.
// @param eid Pointer of the homogenized edge id array.
// @param out_idx Picked indices in [et_offset, et_offset + et_len).
template <typename IdxType>
using EtypeRangePickFn = std::function<void(
IdxType off, IdxType et_offset, IdxType cur_et, IdxType et_len,
......
......@@ -226,7 +226,8 @@ void UpdateGradMinMax_hetero(
/**
* @brief CUDA implementation of backward phase of Segment Reduce with Min/Max
* reducer.
* @note math equation: out[arg[i, k], k] = feat[i, k] \param feat The input
* @note math equation: out[arg[i, k], k] = feat[i, k]
* @param feat The input
* tensor.
* @param arg The ArgMin/Max information, used for indexing.
* @param out The output tensor.
......
......@@ -39,7 +39,7 @@ inline int FindNumThreads(int dim, int max_nthrs = CUDA_MAX_NUM_THREADS) {
}
/**
* !\brief Find number of blocks is smaller than nblks and max_nblks
* @brief Find number of blocks is smaller than nblks and max_nblks
* on the given axis ('x', 'y' or 'z').
*/
template <char axis>
......
/**
Copyright (c) 2021 Intel Corporation
\file distgnn/partition/main_Libra.py
\brief Libra - Vertex-cut based graph partitioner for distirbuted training
\author Vasimuddin Md <vasimuddin.md@intel.com>,
Guixiang Ma <guixiang.ma@intel.com>
Sanchit Misra <sanchit.misra@intel.com>,
Ramanarayan Mohanty <ramanarayan.mohanty@intel.com>,
Sasikanth Avancha <sasikanth.avancha@intel.com>
Nesreen K. Ahmed <nesreen.k.ahmed@intel.com>
*/
* Copyright (c) 2021 Intel Corporation
*
* @file distgnn/partition/main_Libra.py
* @brief Libra - Vertex-cut based graph partitioner for distirbuted training
* @author Vasimuddin Md <vasimuddin.md@intel.com>,
* Guixiang Ma <guixiang.ma@intel.com>
* Sanchit Misra <sanchit.misra@intel.com>,
* Ramanarayan Mohanty <ramanarayan.mohanty@intel.com>,
* Sasikanth Avancha <sasikanth.avancha@intel.com>
* Nesreen K. Ahmed <nesreen.k.ahmed@intel.com>
*/
#include <dgl/base_heterograph.h>
#include <dgl/packed_func_ext.h>
......@@ -347,7 +348,8 @@ DGL_REGISTER_GLOBAL("sparse._CAPI_DGLLibraVertexCut")
* @param[in, out] offset start of the range of local node IDs for this
* partition
* @param[in] nc number of partitions/communities
* @param[in] c current partition number \param[in] fsize size of pre-allocated
* @param[in] c current partition number
* @param[in] fsize size of pre-allocated
* memory tensor
* @param[in] prefix input Libra partition file location
*/
......@@ -516,7 +518,8 @@ DGL_REGISTER_GLOBAL("sparse._CAPI_DGLLibra2dglSetLR")
* @param[out] inner_nodes marks whether a node is split or not.
* @param[in] ldt_key per partition dict for tracking global to local node IDs
* @param[out] gdt_key global dict for storing number of local nodes (or split
* nodes) for a given global node ID \param[out] gdt_value global
* nodes) for a given global node ID
* @param[out] gdt_value global
* dict, stores local node IDs (due to split) across partitions for
* a given global node ID.
* @param[in] node_map keeps track of range of local node IDs (consecutive)
......
......@@ -255,7 +255,8 @@ class HeteroGraph : public BaseHeteroGraph {
*/
void RecordStream(DGLStreamHandle stream) override;
/** @brief Copy the data to shared memory.
/**
* @brief Copy the data to shared memory.
*
* Also save names of node types and edge types of the HeteroGraph object to
* shared memory
......@@ -266,8 +267,10 @@ class HeteroGraph : public BaseHeteroGraph {
const std::vector<std::string>& etypes,
const std::set<std::string>& fmts);
/** @brief Create a heterograph from
* \return the HeteroGraphPtr, names of node types, names of edge types
/**
* @brief Create a heterograph from
*
* @return the HeteroGraphPtr, names of node types, names of edge types
*/
static std::tuple<
HeteroGraphPtr, std::vector<std::string>, std::vector<std::string>>
......@@ -296,11 +299,14 @@ class HeteroGraph : public BaseHeteroGraph {
/** @brief The shared memory object for meta info*/
std::shared_ptr<runtime::SharedMemory> shared_mem_;
/** @brief The name of the shared memory. Return empty string if it is not in
* shared memory. */
/**
* @brief The name of the shared memory. Return empty string if it is not in
* shared memory.
*/
std::string SharedMemName() const;
/** @brief template class for Flatten operation
/**
* @brief template class for Flatten operation
*
* @tparam IdType Graph's index data type, can be int32_t or int64_t
* @param etypes vector of etypes to be falttened
......
......@@ -115,7 +115,8 @@ std::tuple<dgl_id_t, dgl_id_t, bool> MetapathRandomWalkStep(
* @param edges_by_type Vector of results from \c GetAdj() by edge type.
* @param metapath_data Edge types of given metapath.
* @param prob Transition probability per edge type, for this special case this
* will be a NullArray \param terminate Predicate for terminating the current
* will be a NullArray
* @param terminate Predicate for terminating the current
* random walk path.
*
* @return A pair of ID of next successor (-1 if not exist), as well as whether
......@@ -158,13 +159,14 @@ std::tuple<dgl_id_t, dgl_id_t, bool> MetapathRandomWalkStepUniform(
* @brief Metapath-based random walk.
* @param hg The heterograph.
* @param seeds A 1D array of seed nodes, with the type the source type of the
* first edge type in the metapath. \param metapath A 1D array of edge types
* representing the metapath. \param prob A vector of 1D float arrays,
* indicating the transition probability of each edge by edge type. An empty
* float array assumes uniform transition. \param terminate Predicate for
* terminating a random walk path. \return A 2D array of shape (len(seeds),
* len(metapath) + 1) with node IDs, and A 2D array of shape (len(seeds),
* len(metapath)) with edge IDs.
* first edge type in the metapath.
* @param metapath A 1D array of edge types representing the metapath.
* @param prob A vector of 1D float arrays, indicating the transition
* probability of each edge by edge type. An empty float array assumes uniform
* transition.
* @param terminate Predicate for terminating a random walk path.
* @return A 2D array of shape (len(seeds), len(metapath) + 1) with node IDs,
* and A 2D array of shape (len(seeds), len(metapath)) with edge IDs.
*/
template <DGLDeviceType XPU, typename IdxType>
std::pair<IdArray, IdArray> MetapathBasedRandomWalk(
......
......@@ -31,11 +31,14 @@ namespace impl {
* @param seeds A 1D array of seed nodes, with the type the source type of the
* first edge type in the metapath.
* @param p Float, indicating likelihood of immediately revisiting a node in the
* walk. \param q Float, control parameter to interpolate between breadth-first
* strategy and depth-first strategy. \param walk_length Int, length of walk.
* walk.
* @param q Float, control parameter to interpolate between breadth-first
* strategy and depth-first strategy.
* @param walk_length Int, length of walk.
* @param prob A vector of 1D float arrays, indicating the transition
* probability of each edge by edge type. An empty float array assumes
* uniform transition. \return A 2D array of shape (len(seeds), len(walk_length)
* uniform transition.
* @return A 2D array of shape (len(seeds), len(walk_length)
* + 1) with node IDs. The paths that terminated early are padded with -1.
*/
template <DGLDeviceType XPU, typename IdxType>
......
......@@ -56,11 +56,12 @@ bool has_edge_between(const CSRMatrix &csr, dgl_id_t u, dgl_id_t v) {
* @param q Float, control parameter to interpolate between breadth-first
* strategy and depth-first strategy.
* @param len The number of nodes generated so far. Note that the seed node is
* always included as \c data[0], and the successors start from \c
* data[1]. \param csr The CSR matrix \param prob Transition probability \param
* terminate Predicate for terminating the current random walk path. \return A
* tuple of ID of next successor (-1 if not exist), the edge ID traversed, as
* well as whether to terminate.
* always included as \c data[0], and the successors start from \c data[1].
* @param csr The CSR matrix
* @param prob Transition probability
* @param terminate Predicate for terminating the current random walk path.
* @return A tuple of ID of next successor (-1 if not exist), the edge ID
* traversed, as well as whether to terminate.
*/
template <DGLDeviceType XPU, typename IdxType>
......
......@@ -31,12 +31,13 @@ namespace {
/**
* @brief Generic Random Walk.
* @param seeds A 1D array of seed nodes, with the type the source type of the
* first edge type in the metapath. \param max_num_steps The maximum number of
* steps of a random walk path. \param step The random walk step function with
* type \c StepFunc. \param max_nodes Throws an error if one of the values in \c
* seeds exceeds this argument. \return A 2D array of shape (len(seeds),
* max_num_steps + 1) with node IDs. \note The graph itself should be bounded in
* the closure of \c step.
* first edge type in the metapath.
* @param max_num_steps The maximum number of steps of a random walk path.
* @param step The random walk step function with type \c StepFunc.
* @param max_nodes Throws an error if one of the values in \c seeds exceeds
* this argument.
* @return A 2D array of shape (len(seeds), max_num_steps + 1) with node IDs.
* @note The graph itself should be bounded in the closure of \c step.
*/
template <DGLDeviceType XPU, typename IdxType>
std::pair<IdArray, IdArray> GenericRandomWalk(
......
......@@ -47,10 +47,13 @@ TypeArray GetNodeTypesFromMetapath(
* @brief Metapath-based random walk.
* @param hg The heterograph.
* @param seeds A 1D array of seed nodes, with the type the source type of the
* first edge type in the metapath. \param metapath A 1D array of edge types
* representing the metapath. \param prob A vector of 1D float arrays,
* first edge type in the metapath.
* @param metapath A 1D array of edge types
* representing the metapath.
* @param prob A vector of 1D float arrays,
* indicating the transition probability of each edge by edge type. An empty
* float array assumes uniform transition. \return A 2D array of shape
* float array assumes uniform transition.
* @return A 2D array of shape
* (len(seeds), len(metapath) + 1) with node IDs. The paths that terminated
* early are padded with -1. A 2D array of shape (len(seeds), len(metapath))
* with edge IDs. The paths that terminated early are padded with -1. \note
......@@ -66,11 +69,15 @@ std::pair<IdArray, IdArray> RandomWalk(
* @brief Metapath-based random walk with restart probability.
* @param hg The heterograph.
* @param seeds A 1D array of seed nodes, with the type the source type of the
* first edge type in the metapath. \param metapath A 1D array of edge types
* representing the metapath. \param prob A vector of 1D float arrays,
* first edge type in the metapath.
* @param metapath A 1D array of edge types
* representing the metapath.
* @param prob A vector of 1D float arrays,
* indicating the transition probability of each edge by edge type. An empty
* float array assumes uniform transition. \param restart_prob Restart
* probability \return A 2D array of shape (len(seeds), len(metapath) + 1) with
* float array assumes uniform transition.
* @param restart_prob Restart
* probability
* @return A 2D array of shape (len(seeds), len(metapath) + 1) with
* node IDs. The paths that terminated early are padded with -1. A 2D array of
* shape (len(seeds), len(metapath)) with edge IDs. The paths that terminated
* early are padded with -1. \note This function should be called together with
......@@ -87,12 +94,16 @@ std::pair<IdArray, IdArray> RandomWalkWithRestart(
* for PinSAGE-like models.
* @param hg The heterograph.
* @param seeds A 1D array of seed nodes, with the type the source type of the
* first edge type in the metapath. \param metapath A 1D array of edge types
* representing the metapath. \param prob A vector of 1D float arrays,
* first edge type in the metapath.
* @param metapath A 1D array of edge types
* representing the metapath.
* @param prob A vector of 1D float arrays,
* indicating the transition probability of each edge by edge type. An empty
* float array assumes uniform transition. \param restart_prob Restart
* float array assumes uniform transition.
* @param restart_prob Restart
* probability array which has the same number of elements as \c metapath,
* indicating the probability to terminate after transition. \return A 2D array
* indicating the probability to terminate after transition.
* @return A 2D array
* of shape (len(seeds), len(metapath) + 1) with node IDs. The paths that
* terminated early are padded with -1. A 2D array of shape (len(seeds),
* len(metapath)) with edge IDs. The paths that terminated early are padded
......
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