From c32ade74c2bfd5afbece2453f3bf8d967b00a63b Mon Sep 17 00:00:00 2001 From: Yu Yang Date: Tue, 7 Mar 2017 15:54:24 +0800 Subject: [PATCH] Add todo --- paddle/capi/PaddleCAPI.h | 4 ++++ paddle/capi/Vector.cpp | 10 ++++++++++ paddle/capi/tests/test_Vector.cpp | 4 ++++ 3 files changed, 18 insertions(+) diff --git a/paddle/capi/PaddleCAPI.h b/paddle/capi/PaddleCAPI.h index 6ca4131178..4819be3447 100644 --- a/paddle/capi/PaddleCAPI.h +++ b/paddle/capi/PaddleCAPI.h @@ -55,6 +55,10 @@ PD_API int PDIVecDestroy(PD_IVector ivec); PD_API int PDIVectorGet(PD_IVector ivec, int** buffer); +PD_API int PDIVectorResize(PD_IVector ivec, uint64_t size); + +PD_API int PDIVectorGetSize(PD_IVector ivec, uint64_t* size); + /** * Matrix functions. Return will be a PD_Error type. */ diff --git a/paddle/capi/Vector.cpp b/paddle/capi/Vector.cpp index 5b4fe0666c..eb3501fb5b 100644 --- a/paddle/capi/Vector.cpp +++ b/paddle/capi/Vector.cpp @@ -39,4 +39,14 @@ int PDIVectorGet(PD_IVector ivec, int** buffer) { *buffer = v->vec->getData(); return kPD_NO_ERROR; } + +int PDIVectorResize(PD_IVector ivec, uint64_t size) { + // TODO(lizhao): Complete this method. + return 0; +} + +int PDIVectorGetSize(PD_IVector ivec, uint64_t* size) { + // TODO(lizhao): Complete this method. + return 0; +} } diff --git a/paddle/capi/tests/test_Vector.cpp b/paddle/capi/tests/test_Vector.cpp index 122f7df176..2697e80b92 100644 --- a/paddle/capi/tests/test_Vector.cpp +++ b/paddle/capi/tests/test_Vector.cpp @@ -18,5 +18,9 @@ limitations under the License. */ TEST(CAPIVector, create) { PD_IVector vec; ASSERT_EQ(kPD_NO_ERROR, PDIVecCreateNone(&vec)); + ASSERT_EQ(kPD_NO_ERROR, PDIVectorResize(vec, 1000)); + uint64_t size; + ASSERT_EQ(kPD_NO_ERROR, PDIVectorGetSize(vec, &size)); + ASSERT_EQ(1000, size); ASSERT_EQ(kPD_NO_ERROR, PDIVecDestroy(vec)); } -- GitLab