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(
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
}
);
} 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);
}
}
* @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);
}
/**
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,
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
*