[Tp] rename externallyAllocated -> placeholder
authorJihoon Lee <jhoon.it.lee@samsung.com>
Tue, 9 Nov 2021 05:44:14 +0000 (14:44 +0900)
committerJijoong Moon <jijoong.moon@samsung.com>
Thu, 18 Nov 2021 00:37:18 +0000 (09:37 +0900)
This patch renames externallyAllocated -> placeholder

**Self evaluation:**
1. Build test: [X]Passed [ ]Failed [ ]Skipped
2. Run test: [X]Passed [ ]Failed [ ]Skipped

Signed-off-by: Jihoon Lee <jhoon.it.lee@samsung.com>
nntrainer/tensor/manager.cpp
nntrainer/tensor/tensor_pool.cpp
nntrainer/tensor/tensor_pool.h

index 80f718b..c940a84 100644 (file)
@@ -453,12 +453,8 @@ Manager::requestInputs(const GraphNode &node,
         Tensor::Initializer::ZEROS        /// tensor initializer
       );
     } else {
-      /** requesting externally allocated tensor for input */
-      var = tensor_pool.requestExternallyAllocateTensor(
-        dim,                      /// tensor dim
-        var_name,                 /// name
-        Tensor::Initializer::NONE /// tensor initializer
-      );
+      /** requesting placeholder for input */
+      var = tensor_pool.placeholder(var_name, dim);
 
 #ifdef ENABLE_TEST
       grad = tensor_pool.requestTensor(
@@ -468,11 +464,7 @@ Manager::requestInputs(const GraphNode &node,
         Tensor::Initializer::ZEROS        /// tensor initializer
       );
 #else
-      grad = tensor_pool.requestExternallyAllocateTensor(
-        dim,                              /// tensor dim
-        var_name + Var_Grad::grad_suffix, /// name
-        Tensor::Initializer::ZEROS        /// tensor initializer
-      );
+      grad = tensor_pool.placeholder(var_name + Var_Grad::grad_suffix, dim);
 #endif
     }
 
@@ -562,11 +554,7 @@ Manager::requestOutputs(const GraphNode &node,
         );
       } else {
         /** requesting externally allocated tensor for label */
-        grad = tensor_pool.requestExternallyAllocateTensor(
-          dim,                              /// tensor dim
-          var_name + Var_Grad::grad_suffix, /// name
-          Tensor::Initializer::ZEROS        /// tensor initializer
-        );
+        grad = tensor_pool.placeholder(var_name + Var_Grad::grad_suffix, dim);
       }
     }
 
index b7be963..2202762 100644 (file)
@@ -44,14 +44,9 @@ Tensor *TensorPool::requestTensor(const TensorDim &dim,
  * @brief     Request tensor with the given spec
  *
  * @note returns empty tensor which will be filled when allocate is called.
- * @note we assume that the caller checks if the exec_order and lifespan are
- * compatible.
  */
-Tensor *
-TensorPool::requestExternallyAllocateTensor(const TensorDim &dim,
-                                            const std::string &name,
-                                            const Tensor::Initializer &init) {
-  return requestTensor(dim, {}, TensorLifespan::UNMANAGED, name, init);
+Tensor *TensorPool::placeholder(const std::string &name, const TensorDim &dim) {
+  return requestTensor(dim, {}, TensorLifespan::UNMANAGED, name);
 }
 
 /**
@@ -297,11 +292,6 @@ void TensorPool::fillPlaceholder(const std::string &name, const Tensor &t) {
   syncDependents(spec);
 }
 
-Tensor *TensorPool::placeholder(const std::string &name, const TensorDim &dim) {
-  /// @todo rename requestExternallyAllocateTensor -> placeholder
-  return requestExternallyAllocateTensor(dim, name);
-}
-
 Tensor *TensorPool::request(const std::string &name, const TensorDim &dim,
                             const std::vector<unsigned int> &exec_order,
                             TensorLifespan lifespan,
index 3ec0866..60dad85 100644 (file)
@@ -67,22 +67,6 @@ public:
                 const Tensor::Initializer &init = Tensor::Initializer::NONE);
 
   /**
-   * @brief     Request tensor with the given name which will be allocated
-   * externally
-   *
-   * @param dim Tensor dimensions
-   * @param name Name of this tensor
-   * @param init Initializer of the tensor
-   *
-   * @return ptr to the created tensor
-   *
-   * @note returns empty tensor which must be filled by the caller before use.
-   */
-  Tensor *requestExternallyAllocateTensor(
-    const TensorDim &dim, const std::string &name,
-    const Tensor::Initializer &init = Tensor::Initializer::NONE);
-
-  /**
    * @brief     Request tensor which has been already requested with the given
    * spec
    *