From d322c6b84d2e7225de3426d810a4e051b3ae21d9 Mon Sep 17 00:00:00 2001 From: Donghyeon Jeong Date: Wed, 31 Jul 2024 12:15:33 +0900 Subject: [PATCH] [doc] Extend code documentation This PR adds summary content to help users quickly understand the role and scope of the Tensor API. **Self-evaluation:** 1. Build test: [ ]Passed [ ]Failed [X]Skipped 2. Run test: [ ]Passed [ ]Failed [X]Skipped Signed-off-by: Donghyeon Jeong --- nntrainer/tensor/tensor.h | 14 ++++++++++++-- nntrainer/tensor/tensor_base.h | 12 +++++++++++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/nntrainer/tensor/tensor.h b/nntrainer/tensor/tensor.h index b5df3ab9bd..dd6e97587c 100644 --- a/nntrainer/tensor/tensor.h +++ b/nntrainer/tensor/tensor.h @@ -37,8 +37,18 @@ namespace nntrainer { class LazyTensor; /** - * @class Tensor Class - * @brief Tensor Class + * @class Tensor Class + * @brief Tensor is a multidimensional matrix that contain elements of a single + * data type and can perform various operations like addition, division, + * multiplication, dot product, data averaging, and more. + * NNTrainer defines tensor types using different data types and memory formats. + * Supported data types and format are specified in the file 'tensor_dim.h'. + * + * @note The Tensor class utilizes the TensorBase class to support tensors with + * various data types. In other words, this tensor class serves as a container + * for tensors, and thus the functionality of the tensor should be defined in + * each tensor class (FloatTensor, HalfTensor, etc.). + * */ class Tensor { public: diff --git a/nntrainer/tensor/tensor_base.h b/nntrainer/tensor/tensor_base.h index c3b4bfb875..2cded86154 100644 --- a/nntrainer/tensor/tensor_base.h +++ b/nntrainer/tensor/tensor_base.h @@ -77,7 +77,17 @@ class SrcSharedTensorBase; /** * @class TensorBase class - * @brief TensorBase is an abstract class + * @brief TensorBase is an abstract class that provides a base for various + * tensor classes with different data types such as FloatTensor to extend and + * implement abstract methods. + * + * @note Basic functions required for tensor memory allocation and data + * modification, such as allocate(), getData(), and setValue(), are necessary + * when creating subclasses (new tensor class). + * + * The remaining operations that are used for mathematical operations are not + * essential to create a new tensor class but later should be implemented in a + * child class in order to utilize its tensor operations fully. */ class TensorBase { public: