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

[Misc] Replace \xxx with @XXX in structured comment. (#4822)



* param

* brief

* note

* return

* tparam

* brief2

* file

* return2

* return

* blabla

* all
Co-authored-by: default avatarSteve <ubuntu@ip-172-31-34-29.ap-northeast-1.compute.internal>
parent 96297fb8
/*!
* Copyright (c) 2020 by Contributors
* \file dgl/aten/array_ops.h
* \brief Common array operations required by DGL.
* @file dgl/aten/array_ops.h
* @brief Common array operations required by DGL.
*
* Note that this is not meant for a full support of array library such as ATen.
* Only a limited set of operators required by DGL are implemented.
......@@ -23,36 +23,36 @@ namespace aten {
// ID array
//////////////////////////////////////////////////////////////////////
/*! \return A special array to represent null. */
/*! @return A special array to represent null. */
inline NDArray NullArray(const DGLDataType& dtype = DGLDataType{kDGLInt, 64, 1},
const DGLContext& ctx = DGLContext{kDGLCPU, 0}) {
return NDArray::Empty({0}, dtype, ctx);
}
/*!
* \return Whether the input array is a null array.
* @return Whether the input array is a null array.
*/
inline bool IsNullArray(NDArray array) {
return array->shape[0] == 0;
}
/*!
* \brief Create a new id array with given length
* \param length The array length
* \param ctx The array context
* \param nbits The number of integer bits
* \return id array
* @brief Create a new id array with given length
* @param length The array length
* @param ctx The array context
* @param nbits The number of integer bits
* @return id array
*/
IdArray NewIdArray(int64_t length,
DGLContext ctx = DGLContext{kDGLCPU, 0},
uint8_t nbits = 64);
/*!
* \brief Create a new id array using the given vector data
* \param vec The vector data
* \param nbits The integer bits of the returned array
* \param ctx The array context
* \return the id array
* @brief Create a new id array using the given vector data
* @param vec The vector data
* @param nbits The integer bits of the returned array
* @param ctx The array context
* @return the id array
*/
template <typename T>
IdArray VecToIdArray(const std::vector<T>& vec,
......@@ -60,42 +60,42 @@ IdArray VecToIdArray(const std::vector<T>& vec,
DGLContext ctx = DGLContext{kDGLCPU, 0});
/*!
* \brief Return an array representing a 1D range.
* \param low Lower bound (inclusive).
* \param high Higher bound (exclusive).
* \param nbits result array's bits (32 or 64)
* \param ctx Device context
* \return range array
* @brief Return an array representing a 1D range.
* @param low Lower bound (inclusive).
* @param high Higher bound (exclusive).
* @param nbits result array's bits (32 or 64)
* @param ctx Device context
* @return range array
*/
IdArray Range(int64_t low, int64_t high, uint8_t nbits, DGLContext ctx);
/*!
* \brief Return an array full of the given value
* \param val The value to fill.
* \param length Number of elements.
* \param nbits result array's bits (32 or 64)
* \param ctx Device context
* \return the result array
* @brief Return an array full of the given value
* @param val The value to fill.
* @param length Number of elements.
* @param nbits result array's bits (32 or 64)
* @param ctx Device context
* @return the result array
*/
IdArray Full(int64_t val, int64_t length, uint8_t nbits, DGLContext ctx);
/*!
* \brief Return an array full of the given value with the given type.
* \param val The value to fill.
* \param length Number of elements.
* \param ctx Device context
* \return the result array
* @brief Return an array full of the given value with the given type.
* @param val The value to fill.
* @param length Number of elements.
* @param ctx Device context
* @return the result array
*/
template <typename DType>
NDArray Full(DType val, int64_t length, DGLContext ctx);
/*! \brief Create a deep copy of the given array */
/*! @brief Create a deep copy of the given array */
IdArray Clone(IdArray arr);
/*! \brief Convert the idarray to the given bit width */
/*! @brief Convert the idarray to the given bit width */
IdArray AsNumBits(IdArray arr, uint8_t bits);
/*! \brief Arithmetic functions */
/*! @brief Arithmetic functions */
IdArray Add(IdArray lhs, IdArray rhs);
IdArray Sub(IdArray lhs, IdArray rhs);
IdArray Mul(IdArray lhs, IdArray rhs);
......@@ -138,31 +138,31 @@ IdArray LE(int64_t lhs, IdArray rhs);
IdArray EQ(int64_t lhs, IdArray rhs);
IdArray NE(int64_t lhs, IdArray rhs);
/*! \brief Stack two arrays (of len L) into a 2*L length array */
/*! @brief Stack two arrays (of len L) into a 2*L length array */
IdArray HStack(IdArray arr1, IdArray arr2);
/*! \brief Return the indices of the elements that are non-zero. */
/*! @brief Return the indices of the elements that are non-zero. */
IdArray NonZero(BoolArray bool_arr);
/*!
* \brief Return the data under the index. In numpy notation, A[I]
* \tparam ValueType The type of return value.
* @brief Return the data under the index. In numpy notation, A[I]
* @tparam ValueType The type of return value.
*/
template<typename ValueType>
ValueType IndexSelect(NDArray array, int64_t index);
/*!
* \brief Return the data under the index. In numpy notation, A[I]
* @brief Return the data under the index. In numpy notation, A[I]
*/
NDArray IndexSelect(NDArray array, IdArray index);
/*!
* \brief Return the data from `start` (inclusive) to `end` (exclusive).
* @brief Return the data from `start` (inclusive) to `end` (exclusive).
*/
NDArray IndexSelect(NDArray array, int64_t start, int64_t end);
/*!
* \brief Permute the elements of an array according to given indices.
* @brief Permute the elements of an array according to given indices.
*
* Only support 1D arrays.
*
......@@ -176,7 +176,7 @@ NDArray IndexSelect(NDArray array, int64_t start, int64_t end);
NDArray Scatter(NDArray array, IdArray indices);
/*!
* \brief Scatter data into the output array.
* @brief Scatter data into the output array.
*
* Equivalent to:
*
......@@ -187,15 +187,15 @@ NDArray Scatter(NDArray array, IdArray indices);
void Scatter_(IdArray index, NDArray value, NDArray out);
/*!
* \brief Repeat each element a number of times. Equivalent to np.repeat(array, repeats)
* \param array A 1D vector
* \param repeats A 1D integer vector for number of times to repeat for each element in
* @brief Repeat each element a number of times. Equivalent to np.repeat(array, repeats)
* @param array A 1D vector
* @param repeats A 1D integer vector for number of times to repeat for each element in
* \c array. Must have the same shape as \c array.
*/
NDArray Repeat(NDArray array, IdArray repeats);
/*!
* \brief Relabel the given ids to consecutive ids.
* @brief Relabel the given ids to consecutive ids.
*
* Relabeling is done inplace. The mapping is created from the union
* of the give arrays.
......@@ -206,21 +206,21 @@ NDArray Repeat(NDArray array, IdArray repeats);
* mapping is [2, 3, 10, 4, 0, 5], meaning the new ID 0 maps to the old ID
* 2, 1 maps to 3, so on and so forth.
*
* \param arrays The id arrays to relabel.
* \return mapping array M from new id to old id.
* @param arrays The id arrays to relabel.
* @return mapping array M from new id to old id.
*/
IdArray Relabel_(const std::vector<IdArray>& arrays);
/*!
* \brief concatenate the given id arrays to one array
* @brief concatenate the given id arrays to one array
*
* Example:
*
* Given two IdArrays [2, 3, 10, 0, 2] and [4, 10, 5]
* Return [2, 3, 10, 0, 2, 4, 10, 5]
*
* \param arrays The id arrays to concatenate.
* \return concatenated array.
* @param arrays The id arrays to concatenate.
* @return concatenated array.
*/
NDArray Concat(const std::vector<IdArray>& arrays);
......@@ -230,7 +230,7 @@ inline bool IsValidIdArray(const dgl::runtime::NDArray& arr) {
}
/*!
* \brief Packs a tensor containing padded sequences of variable length.
* @brief Packs a tensor containing padded sequences of variable length.
*
* Similar to \c pack_padded_sequence in PyTorch, except that
*
......@@ -240,11 +240,11 @@ inline bool IsValidIdArray(const dgl::runtime::NDArray& arr) {
* 3. Along with the tensor containing the packed sequence, it returns both the
* length, as well as the offsets to the packed tensor, of each sequence.
*
* \param array The tensor containing sequences padded to the same length
* \param pad_value The padding value
* \return A triplet of packed tensor, the length tensor, and the offset tensor
* @param array The tensor containing sequences padded to the same length
* @param pad_value The padding value
* @return A triplet of packed tensor, the length tensor, and the offset tensor
*
* \note Example: consider the following array with padding value -1:
* @note Example: consider the following array with padding value -1:
*
* <code>
* [[1, 2, -1, -1],
......@@ -262,7 +262,7 @@ template<typename ValueType>
std::tuple<NDArray, IdArray, IdArray> Pack(NDArray array, ValueType pad_value);
/*!
* \brief Batch-slice a 1D or 2D array, and then pack the list of sliced arrays
* @brief Batch-slice a 1D or 2D array, and then pack the list of sliced arrays
* by concatenation.
*
* If a 2D array is given, then the function is equivalent to:
......@@ -285,14 +285,14 @@ std::tuple<NDArray, IdArray, IdArray> Pack(NDArray array, ValueType pad_value);
* return packed, offsets
* </code>
*
* \param array A 1D or 2D tensor for slicing
* \param lengths A 1D tensor indicating the number of elements to slice
* \return The tensor with packed slices along with the offsets.
* @param array A 1D or 2D tensor for slicing
* @param lengths A 1D tensor indicating the number of elements to slice
* @return The tensor with packed slices along with the offsets.
*/
std::pair<NDArray, IdArray> ConcatSlices(NDArray array, IdArray lengths);
/*!
* \brief Return the cumulative summation (or inclusive sum) of the input array.
* @brief Return the cumulative summation (or inclusive sum) of the input array.
*
* The first element out[0] is equal to the first element of the input array
* array[0]. The rest elements are defined recursively, out[i] = out[i-1] + array[i].
......@@ -302,40 +302,40 @@ std::pair<NDArray, IdArray> ConcatSlices(NDArray array, IdArray lengths);
* length is the input array length plus one. This is useful for creating
* an indptr array over a count array.
*
* \param array The 1D input array.
* \return Array after cumsum.
* @param array The 1D input array.
* @return Array after cumsum.
*/
IdArray CumSum(IdArray array, bool prepend_zero = false);
/*!
* \brief Return the nonzero index.
* @brief Return the nonzero index.
*
* Only support 1D array. The result index array is in int64.
*
* \param array The input array.
* \return A 1D index array storing the positions of the non zero values.
* @param array The input array.
* @return A 1D index array storing the positions of the non zero values.
*/
IdArray NonZero(NDArray array);
/*!
* \brief Sort the ID vector in ascending order.
* @brief Sort the ID vector in ascending order.
*
* It performs both sort and arg_sort (returning the sorted index). The sorted index
* is always in int64.
*
* \param array Input array.
* \param num_bits The number of bits used in key comparison. For example, if the data type
* @param array Input array.
* @param num_bits The number of bits used in key comparison. For example, if the data type
* of the input array is int32_t and `num_bits = 8`, it only uses bits in index
* range [0, 8) for sorting. Setting it to a small value could
* speed up the sorting if the underlying sorting algorithm is radix sort (e.g., on GPU).
* Setting it to zero (default value) means using all the bits for comparison.
* On CPU, it currently has no effect.
* \return A pair of arrays: sorted values and sorted index to the original position.
* @return A pair of arrays: sorted values and sorted index to the original position.
*/
std::pair<IdArray, IdArray> Sort(IdArray array, int num_bits = 0);
/*!
* \brief Return a string that prints out some debug information.
* @brief Return a string that prints out some debug information.
*/
std::string ToDebugString(NDArray array);
......@@ -356,7 +356,7 @@ IdArray VecToIdArray(const std::vector<T>& vec,
}
/*!
* \brief Get the context of the first array, and check if the non-null arrays'
* @brief Get the context of the first array, and check if the non-null arrays'
* contexts are the same.
*/
inline DGLContext GetContextOf(const std::vector<IdArray>& arrays) {
......
This diff is collapsed.
This diff is collapsed.
/*!
* Copyright (c) 2020 by Contributors
* \file dgl/aten/macro.h
* \brief Common macros for aten package.
* @file dgl/aten/macro.h
* @brief Common macros for aten package.
*/
#ifndef DGL_ATEN_MACRO_H_
......
......@@ -58,19 +58,19 @@ class BaseHeteroGraph : public runtime::Object {
////////////////////// query/operations on meta graph ///////////////////////
/*! \return the number of vertex types */
/*! @return the number of vertex types */
virtual uint64_t NumVertexTypes() const { return meta_graph_->NumVertices(); }
/*! \return the number of edge types */
/*! @return the number of edge types */
virtual uint64_t NumEdgeTypes() const { return meta_graph_->NumEdges(); }
/*! \return given the edge type, find the source type */
/*! @return given the edge type, find the source type */
virtual std::pair<dgl_type_t, dgl_type_t> GetEndpointTypes(
dgl_type_t etype) const {
return meta_graph_->FindEdge(etype);
}
/*! \return the meta graph */
/*! @return the meta graph */
virtual GraphPtr meta_graph() const { return meta_graph_; }
/*!
......@@ -134,34 +134,34 @@ class BaseHeteroGraph : public runtime::Object {
*/
virtual bool IsMultigraph() const = 0;
/*! \return whether the graph is read-only */
/*! @return whether the graph is read-only */
virtual bool IsReadonly() const = 0;
/*! \return the number of vertices in the graph.*/
/*! @return the number of vertices in the graph.*/
virtual uint64_t NumVertices(dgl_type_t vtype) const = 0;
/*! \return the number of vertices for each type in the graph as a vector */
/*! @return the number of vertices for each type in the graph as a vector */
inline virtual std::vector<int64_t> NumVerticesPerType() const {
LOG(FATAL) << "[BUG] NumVerticesPerType() not supported on this object.";
return {};
}
/*! \return the number of edges in the graph.*/
/*! @return the number of edges in the graph.*/
virtual uint64_t NumEdges(dgl_type_t etype) const = 0;
/*! \return true if the given vertex is in the graph.*/
/*! @return true if the given vertex is in the graph.*/
virtual bool HasVertex(dgl_type_t vtype, dgl_id_t vid) const = 0;
/*! \return a 0-1 array indicating whether the given vertices are in the
/*! @return a 0-1 array indicating whether the given vertices are in the
* graph.
*/
virtual BoolArray HasVertices(dgl_type_t vtype, IdArray vids) const = 0;
/*! \return true if the given edge is in the graph.*/
/*! @return true if the given edge is in the graph.*/
virtual bool HasEdgeBetween(
dgl_type_t etype, dgl_id_t src, dgl_id_t dst) const = 0;
/*! \return a 0-1 array indicating whether the given edges are in the graph.*/
/*! @return a 0-1 array indicating whether the given edges are in the graph.*/
virtual BoolArray HasEdgesBetween(
dgl_type_t etype, IdArray src_ids, IdArray dst_ids) const = 0;
......
......@@ -103,21 +103,21 @@ class Graph : public GraphInterface {
*/
bool IsReadonly() const override { return false; }
/*! \return the number of vertices in the graph.*/
/*! @return the number of vertices in the graph.*/
uint64_t NumVertices() const override { return adjlist_.size(); }
/*! \return the number of edges in the graph.*/
/*! @return the number of edges in the graph.*/
uint64_t NumEdges() const override { return num_edges_; }
/*! \return a 0-1 array indicating whether the given vertices are in the
/*! @return a 0-1 array indicating whether the given vertices are in the
* graph.
*/
BoolArray HasVertices(IdArray vids) const override;
/*! \return true if the given edge is in the graph.*/
/*! @return true if the given edge is in the graph.*/
bool HasEdgeBetween(dgl_id_t src, dgl_id_t dst) const override;
/*! \return a 0-1 array indicating whether the given edges are in the graph.*/
/*! @return a 0-1 array indicating whether the given edges are in the graph.*/
BoolArray HasEdgesBetween(IdArray src_ids, IdArray dst_ids) const override;
/*!
......
......@@ -172,24 +172,24 @@ class GraphInterface : public runtime::Object {
*/
virtual bool IsReadonly() const = 0;
/*! \return the number of vertices in the graph.*/
/*! @return the number of vertices in the graph.*/
virtual uint64_t NumVertices() const = 0;
/*! \return the number of edges in the graph.*/
/*! @return the number of edges in the graph.*/
virtual uint64_t NumEdges() const = 0;
/*! \return true if the given vertex is in the graph.*/
/*! @return true if the given vertex is in the graph.*/
virtual bool HasVertex(dgl_id_t vid) const { return vid < NumVertices(); }
/*! \return a 0-1 array indicating whether the given vertices are in the
/*! @return a 0-1 array indicating whether the given vertices are in the
* graph.
*/
virtual BoolArray HasVertices(IdArray vids) const = 0;
/*! \return true if the given edge is in the graph.*/
/*! @return true if the given edge is in the graph.*/
virtual bool HasEdgeBetween(dgl_id_t src, dgl_id_t dst) const = 0;
/*! \return a 0-1 array indicating whether the given edges are in the graph.*/
/*! @return a 0-1 array indicating whether the given edges are in the graph.*/
virtual BoolArray HasEdgesBetween(IdArray src_ids, IdArray dst_ids) const = 0;
/*!
......
/*!
* Copyright (c) 2018 by Contributors
* \file graph/graph_serializer.cc
* \brief DGL serializer APIs
* @file graph/graph_serializer.cc
* @brief DGL serializer APIs
*/
#ifndef DGL_GRAPH_SERIALIZER_H_
......
......@@ -225,10 +225,10 @@ class CSR : public GraphInterface {
IdArray edge_ids() const { return adj_.data; }
/*! \return Load CSR from stream */
/*! @return Load CSR from stream */
bool Load(dmlc::Stream *fs);
/*! \return Save CSR to stream */
/*! @return Save CSR to stream */
void Save(dmlc::Stream *fs) const;
void SortCSR() override {
......@@ -577,18 +577,18 @@ class ImmutableGraph : public GraphInterface {
return is_unibipartite_;
}
/*! \return the number of vertices in the graph.*/
/*! @return the number of vertices in the graph.*/
uint64_t NumVertices() const override { return AnyGraph()->NumVertices(); }
/*! \return the number of edges in the graph.*/
/*! @return the number of edges in the graph.*/
uint64_t NumEdges() const override { return AnyGraph()->NumEdges(); }
/*! \return true if the given vertex is in the graph.*/
/*! @return true if the given vertex is in the graph.*/
bool HasVertex(dgl_id_t vid) const override { return vid < NumVertices(); }
BoolArray HasVertices(IdArray vids) const override;
/*! \return true if the given edge is in the graph.*/
/*! @return true if the given edge is in the graph.*/
bool HasEdgeBetween(dgl_id_t src, dgl_id_t dst) const override {
if (in_csr_) {
return in_csr_->HasEdgeBetween(dst, src);
......@@ -918,10 +918,10 @@ class ImmutableGraph : public GraphInterface {
*/
ImmutableGraphPtr Reverse() const;
/*! \return Load ImmutableGraph from stream, using out csr */
/*! @return Load ImmutableGraph from stream, using out csr */
bool Load(dmlc::Stream *fs);
/*! \return Save ImmutableGraph to stream, using out csr */
/*! @return Save ImmutableGraph to stream, using out csr */
void Save(dmlc::Stream *fs) const;
void SortCSR() override {
......
......@@ -65,7 +65,7 @@ DGL_DLL void* DGLBackendAllocWorkspace(
* @param device_id The device id which the space will be allocated.
* @return 0 when no error is thrown, -1 when failure happens
*
* \sa DGLBackendAllocWorkspace
* @sa DGLBackendAllocWorkspace
*/
DGL_DLL int DGLBackendFreeWorkspace(int device_type, int device_id, void* ptr);
......
......@@ -166,7 +166,7 @@ typedef struct {
* For a DGLArray, the size of memory required to store the contents of
* data can be calculated as follows:
*
* \code{.c}
* @code{.c}
* static inline size_t GetDataSize(const DGLArray* t) {
* size_t size = 1;
* for (int32_t i = 0; i < t->ndim; ++i) {
......@@ -175,7 +175,7 @@ typedef struct {
* size *= (t->dtype.bits * t->dtype.lanes + 7) / 8;
* return size;
* }
* \endcode
* @endcode
*/
void* data;
/*! @brief The device of the tensor */
......@@ -372,7 +372,7 @@ DGL_DLL int DGLCbArgToReturn(DGLValue* value, int code);
* @param resource_handle The handle additional resouce handle from fron-end.
* @return 0 if success, -1 if failure happens, set error via
* DGLAPISetLastError.
* \sa DGLCFuncSetReturn
* @sa DGLCFuncSetReturn
*/
typedef int (*DGLPackedCFunc)(
DGLValue* args, int* type_codes, int num_args, DGLRetValueHandle ret,
......
......@@ -284,7 +284,7 @@ class List : public ObjectRef {
inline const T operator[](size_t i) const {
return T(static_cast<const ListObject*>(obj_.get())->data[i]);
}
/*! \return The size of the list */
/*! @return The size of the list */
inline size_t size() const {
if (obj_.get() == nullptr) return 0;
return static_cast<const ListObject*>(obj_.get())->data.size();
......@@ -321,7 +321,7 @@ class List : public ObjectRef {
ListObject* n = this->CopyOnWrite();
n->data[i] = value.obj_;
}
/*! \return whether list is empty */
/*! @return whether list is empty */
inline bool empty() const { return size() == 0; }
/*! @brief Copy the content to a vector */
inline std::vector<T> ToVector() const {
......@@ -341,20 +341,20 @@ class List : public ObjectRef {
Ptr2ObjectRef,
std::vector<std::shared_ptr<Object> >::const_reverse_iterator>;
/*! \return begin iterator */
/*! @return begin iterator */
inline iterator begin() const {
return iterator(static_cast<const ListObject*>(obj_.get())->data.begin());
}
/*! \return end iterator */
/*! @return end iterator */
inline iterator end() const {
return iterator(static_cast<const ListObject*>(obj_.get())->data.end());
}
/*! \return rbegin iterator */
/*! @return rbegin iterator */
inline reverse_iterator rbegin() const {
return reverse_iterator(
static_cast<const ListObject*>(obj_.get())->data.rbegin());
}
/*! \return rend iterator */
/*! @return rend iterator */
inline reverse_iterator rend() const {
return reverse_iterator(
static_cast<const ListObject*>(obj_.get())->data.rend());
......@@ -498,12 +498,12 @@ class Map : public ObjectRef {
inline const V at(const K& key) const {
return V(static_cast<const MapObject*>(obj_.get())->data.at(key.obj_));
}
/*! \return The size of the list */
/*! @return The size of the list */
inline size_t size() const {
if (obj_.get() == nullptr) return 0;
return static_cast<const MapObject*>(obj_.get())->data.size();
}
/*! \return The size of the list */
/*! @return The size of the list */
inline size_t count(const K& key) const {
if (obj_.get() == nullptr) return 0;
return static_cast<const MapObject*>(obj_.get())->data.count(key.obj_);
......@@ -533,7 +533,7 @@ class Map : public ObjectRef {
n->data[key.obj_] = value.obj_;
}
/*! \return whether list is empty */
/*! @return whether list is empty */
inline bool empty() const { return size() == 0; }
/*! @brief specify container obj */
using ContainerType = MapObject;
......@@ -549,15 +549,15 @@ class Map : public ObjectRef {
using iterator =
IterAdapter<Ptr2ObjectRef, MapObject::ContainerType::const_iterator>;
/*! \return begin iterator */
/*! @return begin iterator */
inline iterator begin() const {
return iterator(static_cast<const MapObject*>(obj_.get())->data.begin());
}
/*! \return end iterator */
/*! @return end iterator */
inline iterator end() const {
return iterator(static_cast<const MapObject*>(obj_.get())->data.end());
}
/*! \return begin iterator */
/*! @return begin iterator */
inline iterator find(const K& key) const {
return iterator(
static_cast<const MapObject*>(obj_.get())->data.find(key.obj_));
......@@ -644,15 +644,15 @@ class Map<std::string, V, T1, T2> : public ObjectRef {
using iterator =
IterAdapter<Ptr2ObjectRef, StrMapObject::ContainerType::const_iterator>;
/*! \return begin iterator */
/*! @return begin iterator */
inline iterator begin() const {
return iterator(static_cast<const StrMapObject*>(obj_.get())->data.begin());
}
/*! \return end iterator */
/*! @return end iterator */
inline iterator end() const {
return iterator(static_cast<const StrMapObject*>(obj_.get())->data.end());
}
/*! \return begin iterator */
/*! @return begin iterator */
inline iterator find(const std::string& key) const {
return iterator(
static_cast<const StrMapObject*>(obj_.get())->data.find(key));
......
......@@ -60,7 +60,7 @@ class DeviceAPI {
* @param ctx The device context
* @param kind The result kind
* @param rv The return value.
* \sa DeviceAttrKind
* @sa DeviceAttrKind
*/
virtual void GetAttr(
DGLContext ctx, DeviceAttrKind kind, DGLRetValue* rv) = 0;
......
......@@ -43,9 +43,9 @@ class Module {
*/
inline PackedFunc GetFunction(
const std::string& name, bool query_imports = false);
/*! \return internal container */
/*! @return internal container */
inline ModuleNode* operator->();
/*! \return internal container */
/*! @return internal container */
inline const ModuleNode* operator->() const;
// The following functions requires link with runtime.
/*!
......@@ -78,7 +78,7 @@ class ModuleNode {
public:
/*! @brief virtual destructor */
virtual ~ModuleNode() {}
/*! \return The module type key */
/*! @return The module type key */
virtual const char* type_key() const = 0;
/*!
* @brief Get a PackedFunc from module.
......@@ -129,7 +129,7 @@ class ModuleNode {
* @return The corresponding function.
*/
DGL_DLL const PackedFunc* GetFuncFromEnv(const std::string& name);
/*! \return The module it imports from */
/*! @return The module it imports from */
const std::vector<Module>& imports() const { return imports_; }
protected:
......
This diff is collapsed.
......@@ -56,7 +56,7 @@ class Object {
public:
/*! @brief virtual destructor */
virtual ~Object() {}
/*! \return The unique type key of the object */
/*! @return The unique type key of the object */
virtual const char* type_key() const = 0;
/*!
* @brief Apply visitor to each field of the Object
......@@ -65,7 +65,7 @@ class Object {
* @param visitor The visitor
*/
virtual void VisitAttrs(AttrVisitor* visitor) {}
/*! \return the type index of the object */
/*! @return the type index of the object */
virtual uint32_t type_index() const = 0;
/*!
* @brief Whether this object derives from object with type_index=tid.
......@@ -116,7 +116,7 @@ class ObjectRef {
*
* @param other Another object ref.
* @return the compare result.
* \sa same_as
* @sa same_as
*/
inline bool operator==(const ObjectRef& other) const;
/*!
......@@ -142,18 +142,18 @@ class ObjectRef {
* @brief Comparator
* @param other Another object ref.
* @return the compare result.
* \sa same_as
* @sa same_as
*/
inline bool operator!=(const ObjectRef& other) const;
/*! \return the hash function for ObjectRef */
/*! @return the hash function for ObjectRef */
inline size_t hash() const;
/*! \return whether the expression is null */
/*! @return whether the expression is null */
inline bool defined() const;
/*! \return the internal type index of Object */
/*! @return the internal type index of Object */
inline uint32_t type_index() const;
/*! \return the internal object pointer */
/*! @return the internal object pointer */
inline const Object* get() const;
/*! \return the internal object pointer */
/*! @return the internal object pointer */
inline const Object* operator->() const;
/*!
* @brief Downcast this object to its actual type.
......
......@@ -56,7 +56,7 @@ class PackedFunc {
* @param args The arguments to the function.
* @param rv The return value.
*
* \code
* @code
* // Example code on how to implemented FType
* void MyPackedFunc(DGLArgs args, DGLRetValue* rv) {
* // automatically convert arguments to desired type.
......@@ -67,7 +67,7 @@ class PackedFunc {
* std::string my_return_value = "x";
* *rv = my_return_value;
* }
* \endcode
* @endcode
*/
using FType = std::function<void(DGLArgs args, DGLRetValue* rv)>;
/*! @brief default constructor */
......@@ -82,14 +82,14 @@ class PackedFunc {
* @param args Arguments to be passed.
* @tparam Args arguments to be passed.
*
* \code
* @code
* // Example code on how to call packed function
* void CallPacked(PackedFunc f) {
* // call like normal functions by pass in arguments
* // return value is automatically converted back
* int rvalue = f(1, 2.0);
* }
* \endcode
* @endcode
*/
template <typename... Args>
inline DGLRetValue operator()(Args&&... args) const;
......@@ -99,11 +99,11 @@ class PackedFunc {
* @param rv The return value.
*/
inline void CallPacked(DGLArgs args, DGLRetValue* rv) const;
/*! \return the internal body function */
/*! @return the internal body function */
inline FType body() const;
/*! \return Whether the packed function is nullptr */
/*! @return Whether the packed function is nullptr */
bool operator==(std::nullptr_t null) const { return body_ == nullptr; }
/*! \return Whether the packed function is not nullptr */
/*! @return Whether the packed function is not nullptr */
bool operator!=(std::nullptr_t null) const { return body_ != nullptr; }
private:
......@@ -119,7 +119,7 @@ template <typename FType>
class TypedPackedFunc;
/*!
* \anchor TypedPackedFuncAnchor
* @anchor TypedPackedFuncAnchor
* @brief A PackedFunc wrapper to provide typed function signature.
* It is backed by a PackedFunc internally.
*
......@@ -134,7 +134,7 @@ class TypedPackedFunc;
* We can construct a TypedPackedFunc from a lambda function
* with the same signature.
*
* \code
* @code
* // user defined lambda function.
* auto addone = [](int x)->int {
* return x + 1;
......@@ -146,7 +146,7 @@ class TypedPackedFunc;
* int y = ftyped(1);
* // Can be directly converted to PackedFunc
* PackedFunc packed = ftype;
* \endcode
* @endcode
* @tparam R The return value of the function.
* @tparam Args The argument signature of the function.
*/
......@@ -161,7 +161,7 @@ class TypedPackedFunc<R(Args...)> {
* @brief construct by wrap a PackedFunc
*
* Example usage:
* \code
* @code
* PackedFunc packed([](DGLArgs args, DGLRetValue *rv) {
* int x = args[0];
* *rv = x + 1;
......@@ -170,7 +170,7 @@ class TypedPackedFunc<R(Args...)> {
* TypedPackedFunc<int(int)> ftyped(packed);
* // call the typed version.
* CHECK_EQ(ftyped(1), 2);
* \endcode
* @endcode
*
* @param packed The packed function
*/
......@@ -179,13 +179,13 @@ class TypedPackedFunc<R(Args...)> {
* @brief construct from a lambda function with the same signature.
*
* Example usage:
* \code
* @code
* auto typed_lambda = [](int x)->int { return x + 1; }
* // construct from packed function
* TypedPackedFunc<int(int)> ftyped(typed_lambda);
* // call the typed version.
* CHECK_EQ(ftyped(1), 2);
* \endcode
* @endcode
*
* @param typed_lambda typed lambda function.
* @tparam FLambda the type of the lambda function.
......@@ -200,13 +200,13 @@ class TypedPackedFunc<R(Args...)> {
* @brief copy assignment operator from typed lambda
*
* Example usage:
* \code
* @code
* // construct from packed function
* TypedPackedFunc<int(int)> ftyped;
* ftyped = [](int x) { return x + 1; }
* // call the typed version.
* CHECK_EQ(ftyped(1), 2);
* \endcode
* @endcode
*
* @param typed_lambda typed lambda function.
* @tparam FLambda the type of the lambda function.
......@@ -274,7 +274,7 @@ class DGLArgs {
*/
DGLArgs(const DGLValue* values, const int* type_codes, int num_args)
: values(values), type_codes(type_codes), num_args(num_args) {}
/*! \return size of the arguments */
/*! @return size of the arguments */
inline int size() const;
/*!
* @brief Get i-th argument
......@@ -668,7 +668,7 @@ class DGLRetValue : public DGLPODValue_ {
*ret_type_code = type_code_;
type_code_ = kNull;
}
/*! \return The value field, if the data is POD */
/*! @return The value field, if the data is POD */
const DGLValue& value() const {
CHECK(
type_code_ != kObjectHandle && type_code_ != kFuncHandle &&
......
/*!
* Copyright (c) 2021 by Contributors
* \file runtime/container.h
* \brief Defines the container object data structures.
* @file runtime/container.h
* @brief Defines the container object data structures.
*/
#ifndef DGL_RUNTIME_PARALLEL_FOR_H_
#define DGL_RUNTIME_PARALLEL_FOR_H_
......@@ -57,7 +57,7 @@ inline size_t compute_num_threads(size_t begin, size_t end, size_t grain_size) {
static DefaultGrainSizeT default_grain_size;
/*!
* \brief OpenMP-based parallel for loop.
* @brief OpenMP-based parallel for loop.
*
* It requires each thread's workload to have at least \a grain_size elements.
* The loop body will be a function that takes in two arguments \a begin and \a end, which
......@@ -102,7 +102,7 @@ void parallel_for(
}
/*!
* \brief OpenMP-based parallel for loop with default grain size.
* @brief OpenMP-based parallel for loop with default grain size.
*
* parallel_for with grain size to default value, either 1 or controlled through
* environment variable DGL_PARALLEL_FOR_GRAIN_SIZE.
......@@ -118,7 +118,7 @@ void parallel_for(
}
/*!
* \brief OpenMP-based two-stage parallel reduction.
* @brief OpenMP-based two-stage parallel reduction.
*
* The first-stage reduction function \a f works in parallel. Each thread's workload has
* at least \a grain_size elements. The loop body will be a function that takes in
......
......@@ -14,13 +14,13 @@
* then into the same global registry in C++.
* The goal is to mix the front-end language and the DGL back-end.
*
* \code
* @code
* // register the function as MyAPIFuncName
* DGL_REGISTER_GLOBAL(MyAPIFuncName)
* .set_body([](DGLArgs args, DGLRetValue* rv) {
* // my code.
* });
* \endcode
* @endcode
*/
#ifndef DGL_RUNTIME_REGISTRY_H_
#define DGL_RUNTIME_REGISTRY_H_
......@@ -51,12 +51,12 @@ class Registry {
/*!
* @brief set the body of the function to be TypedPackedFunc.
*
* \code
* @code
*
* DGL_REGISTER_API("addone")
* .set_body_typed<int(int)>([](int x) { return x + 1; });
*
* \endcode
* @endcode
*
* @param f The body of the function.
* @tparam FType the signature of the function.
......@@ -122,11 +122,11 @@ class Registry {
/*!
* @brief Register a function globally.
* \code
* @code
* DGL_REGISTER_GLOBAL("MyPrint")
* .set_body([](DGLArgs args, DGLRetValue* rv) {
* });
* \endcode
* @endcode
*/
#define DGL_REGISTER_GLOBAL(OpName) \
DGL_STR_CONCAT(DGL_FUNC_REG_VAR_DEF, __COUNTER__) = \
......
/*!
* Copyright (c) 2017 by Contributors
* \file dgl/runtime/serializer.h
* \brief Serializer extension to support DGL data types
* @file dgl/runtime/serializer.h
* @brief Serializer extension to support DGL data types
* Include this file to enable serialization of DGLDataType, DGLContext
*/
#ifndef DGL_RUNTIME_SMART_PTR_SERIALIZER_H_
......
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