diff --git a/paddle/capi/Arguments.cpp b/paddle/capi/Arguments.cpp index 60bdea15ae76d3d977c15ef87172e3aacaf793f5..678a80ac3f4d5ca5aa3321d0b089fe5a8c465af1 100644 --- a/paddle/capi/Arguments.cpp +++ b/paddle/capi/Arguments.cpp @@ -72,4 +72,37 @@ int PDArgsGetIds(PD_Arguments args, uint64_t ID, PD_IVector ids) { iv->vec = a->args[ID].ids; return kPD_NO_ERROR; } + +int PDArgsSetIds(PD_Arguments args, uint64_t ID, PD_IVector ids) { + //! TODO(lizhao): Complete this method. + return kPD_UNDEFINED_ERROR; +} + +int PDArgsSetSequenceStartPos(PD_Arguments args, + uint64_t ID, + PD_IVector seqPos) { + //! TODO(lizhao): Complete this method. + return kPD_UNDEFINED_ERROR; +} + +int PDArgsSetSubSequenceStartPos(PD_Arguments args, + uint64_t ID, + PD_IVector subSeqPos) { + //! TODO(lizhao): Complete this method. + return kPD_UNDEFINED_ERROR; +} + +int PDArgsGetSequenceStartPos(PD_Arguments args, + uint64_t ID, + PD_IVector seqPos) { + //! TODO(lizhao): Complete this method. + return kPD_UNDEFINED_ERROR; +} + +int PDArgsGetSubSequenceStartPos(PD_Arguments args, + uint64_t ID, + PD_IVector subSeqPos) { + //! TODO(lizhao): Complete this method. + return kPD_UNDEFINED_ERROR; +} } diff --git a/paddle/capi/PaddleCAPI.h b/paddle/capi/PaddleCAPI.h index 4819be3447f41ee30ffb1b50828f23492b84d2ef..6eea60ef749152a2a69c68874ffc1156cb1b81ae 100644 --- a/paddle/capi/PaddleCAPI.h +++ b/paddle/capi/PaddleCAPI.h @@ -51,6 +51,19 @@ typedef void* PD_IVector; PD_API int PDIVecCreateNone(PD_IVector* ivec); +/** + * @brief PDIVectorCreate create a paddle int vector + * @param [out] ivec: output int vector. + * @param [in] array: input array. + * @param [in] size: input array size. + * @param [in] copy: memory copy or just use same memory. True if copy. + * @return PD_Error + */ +PD_API int PDIVectorCreate(PD_IVector* ivec, + int* array, + uint64_t size, + bool copy); + PD_API int PDIVecDestroy(PD_IVector ivec); PD_API int PDIVectorGet(PD_IVector ivec, int** buffer); @@ -99,6 +112,23 @@ PD_API int PDArgsGetValue(PD_Arguments args, uint64_t ID, PD_Matrix mat); PD_API int PDArgsGetIds(PD_Arguments args, uint64_t ID, PD_IVector ids); +PD_API int PDArgsSetIds(PD_Arguments args, uint64_t ID, PD_IVector ids); + +PD_API int PDArgsSetSequenceStartPos(PD_Arguments args, + uint64_t ID, + PD_IVector seqPos); + +PD_API int PDArgsGetSequenceStartPos(PD_Arguments args, + uint64_t ID, + PD_IVector seqPos); + +PD_API int PDArgsSetSubSequenceStartPos(PD_Arguments args, + uint64_t ID, + PD_IVector subSeqPos); + +PD_API int PDArgsGetSubSequenceStartPos(PD_Arguments args, + uint64_t ID, + PD_IVector subSeqPos); /** * @brief GradientMachine means a neural network. */ diff --git a/paddle/capi/Vector.cpp b/paddle/capi/Vector.cpp index eb3501fb5b8ff6f725c4fda4cd3bf68a520698ed..a2e6f3507de3d1fcc3693bf6fce42e8ed5991644 100644 --- a/paddle/capi/Vector.cpp +++ b/paddle/capi/Vector.cpp @@ -26,6 +26,11 @@ int PDIVecCreateNone(PD_IVector* ivec) { return kPD_NO_ERROR; } +int PDIVectorCreate(PD_IVector* ivec, int* array, uint64_t size, bool copy) { + //! TODO(lizhao): Complete this method. + return kPD_UNDEFINED_ERROR; +} + int PDIVecDestroy(PD_IVector ivec) { if (ivec == nullptr) return kPD_NULLPTR; delete cast(ivec); @@ -41,12 +46,12 @@ int PDIVectorGet(PD_IVector ivec, int** buffer) { } int PDIVectorResize(PD_IVector ivec, uint64_t size) { - // TODO(lizhao): Complete this method. - return 0; + //! TODO(lizhao): Complete this method. + return kPD_UNDEFINED_ERROR; } int PDIVectorGetSize(PD_IVector ivec, uint64_t* size) { - // TODO(lizhao): Complete this method. - return 0; + //! TODO(lizhao): Complete this method. + return kPD_UNDEFINED_ERROR; } }