From 3b910bd715da0b9c7b67b3dc1f587f88d5cc5d2c Mon Sep 17 00:00:00 2001 From: mozga-intel Date: Fri, 19 Nov 2021 08:41:44 +0100 Subject: [PATCH 1/2] Clang-format comment style fix --- include/mxnet/c_api.h | 104 +++++++++++++++++++++++++----------------- 1 file changed, 63 insertions(+), 41 deletions(-) diff --git a/include/mxnet/c_api.h b/include/mxnet/c_api.h index 7611236e50e7..2a20e72eb0a2 100644 --- a/include/mxnet/c_api.h +++ b/include/mxnet/c_api.h @@ -1705,18 +1705,25 @@ MXNET_DLL int MXSymbolGrad(SymbolHandle sym, uint32_t num_wrt, const char** wrt, * \brief infer shape of unknown input shapes given the known one. * The shapes are packed into a CSR matrix represented by arg_ind_ptr and arg_shape_data * The call will be treated as a kwargs call if key != NULL or num_args==0, otherwise it is - * positional. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by - * default) \param sym symbol handle \param num_args number of input arguments. \param keys the key - * of keyword args (optional) \param arg_ind_ptr the head pointer of the rows in CSR \param - * arg_shape_data the content of the CSR \param in_shape_size sizeof the returning array of - * in_shapes \param in_shape_ndim returning array of shape dimensions of eachs input shape. \param - * in_shape_data returning array of pointers to head of the input shape. \param out_shape_size - * sizeof the returning array of out_shapes \param out_shape_ndim returning array of shape - * dimensions of each output shape. \param out_shape_data returning array of pointers to head of the - * output shape. \param aux_shape_size sizeof the returning array of aux_shapes \param - * aux_shape_ndim returning array of shape dimensions of each auxiliary shape. \param aux_shape_data - * returning array of pointers to head of the auxiliary shape. \param complete whether infer shape - * completes or more information is needed. \return 0 when success, -1 when failure happens + * positional. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=0 (by + * default) + * + * \param sym symbol handle + * \param num_args number of input arguments. + * \param keys the key of keyword args (optional) + * \param arg_ind_ptr the head pointer of the rows in CSR + * \param arg_shape_data the content of the CSR + * \param in_shape_size sizeof the returning array of in_shapes + * \param in_shape_ndim returning array of shape dimensions of eachs input shape. + * \param in_shape_data returning array of pointers to head of the input shape. + * \param out_shape_size sizeof the returning array of out_shapes + * \param out_shape_ndim returning array of shape dimensions of each output shape. + * \param out_shape_data returning array of pointers to head of the output shape. + * \param aux_shape_size sizeof the returning array of aux_shapes + * \param aux_shape_ndim returning array of shape dimensions of each auxiliary shape. + * \param aux_shape_data returning array of pointers to head of the auxiliary shape. + * \param complete whether infer shape completes or more information is needed. + * \return 0 when success, -1 when failure happens */ MXNET_DLL int MXSymbolInferShape(SymbolHandle sym, uint32_t num_args, @@ -1737,19 +1744,27 @@ MXNET_DLL int MXSymbolInferShape(SymbolHandle sym, /*! * \brief infer shape of unknown input shapes given the known one. * The shapes are packed into a CSR matrix represented by arg_ind_ptr and arg_shape_data + * * The call will be treated as a kwargs call if key != NULL or num_args==0, otherwise it is * positional. This api is available when MXNet is built with flag USE_INT64_TENSOR_SIZE=1 (not - * default) i.e. Large Tensor Support \param sym symbol handle \param num_args number of input - * arguments. \param keys the key of keyword args (optional) \param arg_ind_ptr the head pointer of - * the rows in CSR \param arg_shape_data the content of the CSR \param in_shape_size sizeof the - * returning array of in_shapes \param in_shape_ndim returning array of shape dimensions of each - * input shape. \param in_shape_data returning array of pointers to head of the input shape. \param - * out_shape_size sizeof the returning array of out_shapes \param out_shape_ndim returning array of - * shape dimensions of each output shape. \param out_shape_data returning array of pointers to head - * of the output shape. \param aux_shape_size sizeof the returning array of aux_shapes \param - * aux_shape_ndim returning array of shape dimensions of each auxiliary shape. \param aux_shape_data - * returning array of pointers to head of the auxiliary shape. \param complete whether infer shape - * completes or more information is needed. \return 0 when success, -1 when failure happens + * default) i.e. Large Tensor Support + * + * \param sym symbol handle + * \param num_args number of input arguments. + * \param keys the key of keyword args (optional) + * \param arg_ind_ptr the head pointer of the rows in CSR + * \param arg_shape_data the content of the CSR + * \param in_shape_size sizeof the returning array of in_shapes + * \param in_shape_ndim returning array of shape dimensions of each input shape. + * \param in_shape_data returning array of pointers to head of the input shape. + * \param out_shape_size sizeof the returning array of out_shapes + * \param out_shape_ndim returning array of shape dimensions of each output shape. + * \param out_shape_data returning array of pointers to head of the output shape. + * \param aux_shape_size sizeof the returning array of aux_shapes + * \param aux_shape_ndim returning array of shape dimensions of each auxiliary shape. + * \param aux_shape_data returning array of pointers to head of the auxiliary shape. + * \param complete whether infer shape completes or more information is needed. + * \return 0 when success, -1 when failure happens */ MXNET_DLL int MXSymbolInferShape64(SymbolHandle sym, uint32_t num_args, @@ -1923,14 +1938,16 @@ MXNET_DLL int MXSymbolInferTypePartial(SymbolHandle sym, * \param num_excluded_sym_names number of layers excluded from being quantized in the input symbol * \param excluded_sym_names node names to be excluded from being quantized * \param num_excluded_op_names number of operators excluded from being quantized in the input - * symbol \param excluded_op_names operator names to be excluded from being quantized \param - * num_offline number of parameters that are quantized offline \param offline_params array of c - * strings representing the names of params quantized offline \param quantized_dtype the quantized - * destination type for input data \param calib_quantize **Deprecated**. quantize op will always be - * calibrated if could \param quantize_mode quantize mode to be used in quantize pass \param - * quantize_granularity quantize granularity, tensor-wise or channel-wise \param out_num_calib_names - * return the number of nodes to be calibrated \param out_calib_names return the node names to be - * calibrated + * symbol + * \param excluded_op_names operator names to be excluded from being quantized + * \param num_offline number of parameters that are quantized offline + * \param offline_params array of c strings representing the names of params quantized offline + * \param quantized_dtype the quantized destination type for input data + * \param calib_quantize **Deprecated**. quantize op will always be calibrated if could + * \param quantize_mode quantize mode to be used in quantize pass + * \param quantize_granularity quantize granularity, tensor-wise or channel-wise + * \param out_num_calib_names return the number of nodes to be calibrated + * \param out_calib_names return the node names to be calibrated */ MXNET_DLL int MXQuantizeSymbol(SymbolHandle sym_handle, SymbolHandle* ret_sym_handle, @@ -1950,16 +1967,21 @@ MXNET_DLL int MXQuantizeSymbol(SymbolHandle sym_handle, /*! * \brief Convert a symbol into a mixed precision symbol with cast operators for target dtype - * casting \param sym_handle symbol to be converted \param ret_sym_handle mixed precision symbol - * result \param num_args number of arguments for known dtypes \param arg_type_data arg types of the - * arguments \param target_dtype target_dtype for mixed precision symbol \param cast_optional_params - * whether to cast optional params to target_dtype \param num_target_dtype_op_names number of ops to - * be casted to target_dtype \param num_fp32_op_names number of ops to be casted to FP32 \param - * num_widest_dtype_op_names number of ops to be casted to widest dtype \param - * num_conditional_fp32_op_names number of ops to be casted to FP32 based on a condition \param - * num_excluded_symbols number of symbols to be excluded from casting \param num_model_params number - * of model parameters \param num_widest_dtype_op_names number of ops to be casted to the widest - * dtype \param num_conditional_fp32_op_names number of ops to be cast to fp32 based on precision + * casting + * \param sym_handle symbol to be converted + * \param ret_sym_handle mixed precision symbol result + * \param num_args number of arguments for known dtypes + * \param arg_type_data arg types of the arguments + * \param target_dtype target_dtype for mixed precision symbol + * \param cast_optional_params whether to cast optional params to target_dtype + * \param num_target_dtype_op_names number of ops to be casted to target_dtype + * \param num_fp32_op_names number of ops to be casted to FP32 + * \param num_widest_dtype_op_names number of ops to be casted to widest dtype + * \param num_conditional_fp32_op_names number of ops to be casted to FP32 based on a condition + * \param num_excluded_symbols number of symbols to be excluded from casting + * \param num_model_params number of model parameters + * \param num_widest_dtype_op_names number of ops to be casted to the widest dtype + * \param num_conditional_fp32_op_names number of ops to be cast to fp32 based on precision * \param target_dtype_op_names op names to be casted to target_dtype * \param fp32_op_names op names to be casted to fp32 * \param widest_dtype_op_names names to be casted to widest dtype From 1b45d691a7c405c2bf53c06b77c4d7a23c7b1fd1 Mon Sep 17 00:00:00 2001 From: mozga-intel Date: Mon, 22 Nov 2021 08:50:58 +0100 Subject: [PATCH 2/2] Fix style; files from /src /include --- include/mxnet/executor.h | 24 +++++++++++++++--------- include/mxnet/kvstore.h | 12 ++++++++---- src/operator/tensor/indexing_op.cu | 11 +++++++---- src/operator/tensor/sort_op.h | 10 ++++++---- 4 files changed, 36 insertions(+), 21 deletions(-) diff --git a/include/mxnet/executor.h b/include/mxnet/executor.h index c5c3719fade2..d7638f5298f5 100644 --- a/include/mxnet/executor.h +++ b/include/mxnet/executor.h @@ -108,11 +108,14 @@ class Executor { * * \param partial_shaping Whether to allow changing the shape of unspecified arguments. * \param allow_up_sizing Whether to allow allocating new ndarrays that's larger than the - * original. \param default_ctx the default context of binding. \param ctx_map Context mapping - * group to context. \param provided_arg_shapes New shape for arguments. \param in_args the - * NDArray that stores the input arguments. \param arg_grads NDArray that is used to store the - * gradient output of the input arguments. \param aux_states NDArray that is used as internal - * states. \return a new executor. + * original. + * \param default_ctx the default context of binding. + * \param ctx_map Context mapping group to context. + * \param provided_arg_shapes New shape for arguments. + * \param in_args the NDArray that stores the input arguments. + * \param arg_grads NDArray that is used to store the gradient output of the input arguments. + * \param aux_states NDArray that is used as internal states. + * \return a new executor. */ virtual Executor* Reshape( const bool partial_shaping, @@ -132,10 +135,13 @@ class Executor { * \param group2ctx Context mapping group to context. * \param symbol the symbol that specifies the output of Forward pass. * \param in_args the NDArray that stores the input arguments to the symbol. - * \param arg_grad_store NDArray that is used to store the gradient output of the input arguments. - * \param grad_req_type requirment type of gradient saving. Can only be in {kNullOp, kAddTo, - * kWriteTo}. \param aux_states NDArray that is used as internal state in op \param shared_exec - * input executor to share memory with. \return a new executor. + * \param arg_grad_store NDArray that is used to store the gradient + * output of the input arguments. + * \param grad_req_type requirment type of gradient saving. Can only be in + * {kNullOp, kAddTo, kWriteTo}. + * \param aux_states NDArray that is used as internal state in op + * \param shared_exec input executor to share memory with. + * \return a new executor. */ static Executor* Bind(nnvm::Symbol symbol, const Context& default_ctx, diff --git a/include/mxnet/kvstore.h b/include/mxnet/kvstore.h index 9be22e97e9a8..86a6ee7f9f42 100644 --- a/include/mxnet/kvstore.h +++ b/include/mxnet/kvstore.h @@ -216,8 +216,10 @@ class KVStore { * \brief broadcast a list of key-value pairs from the store * \param vkeys the list of keys to be pushed in string format * \param okeys the list of keys to be pulled in string format. Should be the same set of keys in - * vkeys. \param values the list of values to be pushed \param outs the list of buffers for the - * pulled data, they should be preallocated \param priority Priority of the action. + * vkeys. + * \param values the list of values to be pushed + * \param outs the list of buffers for the pulled data, they should be preallocated + * \param priority Priority of the action. */ virtual void Broadcast(const std::vector& str_vkeys, const std::vector& str_okeys, @@ -243,8 +245,10 @@ class KVStore { * \brief push and pull a list of key-value pairs from the store * \param vkeys the list of keys to be pushed in string format * \param okeys the list of keys to be pulled in string format. Should be the same set of keys in - * vkeys. \param values the list of values to be pushed \param outs the list of buffers for the - * pulled data, they should be preallocated \param priority Priority of the action. + * vkeys. + * \param values the list of values to be pushed + * \param outs the list of buffers for the pulled data, they should be preallocated + * \param priority Priority of the action. */ virtual void PushPull(const std::vector& str_vkeys, const std::vector& str_okeys, diff --git a/src/operator/tensor/indexing_op.cu b/src/operator/tensor/indexing_op.cu index 0fea1a4c0eec..90504301cc22 100644 --- a/src/operator/tensor/indexing_op.cu +++ b/src/operator/tensor/indexing_op.cu @@ -700,10 +700,13 @@ inline int ilog2(unsigned int a) { } // namespace /* - * \brief finds the lower and upper-bound positions of each unique element within a sorted input - * array \param sorted_data input elements previously sorted \param bounds output containing all - * lower-bound followed by all upper-bound positions \param data_dim total number of elements in the - * input array \param vocab_dim maximum number of unique elements + * \brief finds the lower and upper-bound positions of each unique element within + * a sorted input array + * + * \param sorted_data input elements previously sorted + * \param bounds output containing all lower-bound followed by all upper-bound positions + * \param data_dim total number of elements in the input array + * \param vocab_dim maximum number of unique elements */ template __global__ void EmbeddingFindBounds(const IType* sorted_data, diff --git a/src/operator/tensor/sort_op.h b/src/operator/tensor/sort_op.h index b196fdb7f432..f3428ed9fd73 100644 --- a/src/operator/tensor/sort_op.h +++ b/src/operator/tensor/sort_op.h @@ -50,8 +50,9 @@ namespace op { * \param is_ascend whether to sort key in ascending order * \param begin_bit The beginning bit of the different values in keys. Default 0. * \param end_bit The ending bit of the different values in keys. Default to 8 * sizeof(dtype of - * key). \param sorted_keys If specified, keys will be sorted out of place. \param sorted_values If - * specified, values will be sorted out of place. + * key). + * \param sorted_keys If specified, keys will be sorted out of place. + * \param sorted_values If specified, values will be sorted out of place. */ template inline void SortByKey(mshadow::Tensor keys, @@ -123,8 +124,9 @@ inline typename std::enable_if::value, size_t>::type Sort * \param is_ascend whether to sort key in ascending order * \param begin_bit The beginning bit of the different values in keys. Default 0. * \param end_bit The ending bit of the different values in keys. Default to 8 * sizeof(dtype of - * key). \param sorted_keys If specified, keys will be sorted out of place. \param sorted_values If - * specified, values will be sorted out of place. + * key). + * \param sorted_keys If specified, keys will be sorted out of place. + * \param sorted_values If specified, values will be sorted out of place. */ template inline void SortByKey(mshadow::Tensor keys,