Skip to content

Commit

Permalink
Add some more interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
reyoung committed Mar 7, 2017
1 parent c32ade7 commit 97c6425
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 4 deletions.
33 changes: 33 additions & 0 deletions paddle/capi/Arguments.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
30 changes: 30 additions & 0 deletions paddle/capi/PaddleCAPI.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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.
*/
Expand Down
13 changes: 9 additions & 4 deletions paddle/capi/Vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<paddle::capi::CIVector>(ivec);
Expand All @@ -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;
}
}

0 comments on commit 97c6425

Please sign in to comment.