modifed Paddle.swig to specially handle UnsupportError only

avx_docs
wangyang59 9 years ago
parent b207535198
commit 4c86285a99

@ -53,7 +53,8 @@ Matrix* Matrix::createDense(const std::vector<float>& data, size_t height,
}
Matrix* Matrix::createDenseFromNumpy(float* data, int dim1, int dim2,
bool copy, bool useGpu) {
bool copy, bool useGpu)
throw (UnsupportError) {
if (useGpu) {
/// Gpu mode only supports copy=True
if (!copy) {

@ -6,17 +6,10 @@
%}
%include "exception.i"
%exception{
try{
$action
}
catch(UnsupportError &ex ){
SWIG_exception(SWIG_RuntimeError, ex.what());
}
catch( ... ){
%typemap(throws) UnsupportError %{
SWIG_exception(SWIG_RuntimeError, $1.what());
SWIG_fail;
}
}
%}
%include "std_vector.i"
%include "std_pair.i"

@ -139,7 +139,8 @@ public:
static Matrix* createDenseFromNumpy(float* data, int dim1, int dim2,
bool copy = true,
bool useGpu = isUsingGpu());
bool useGpu = isUsingGpu())
throw (UnsupportError);
/**
* Create Cpu Dense Matrix from numpy matrix, dtype=float32
@ -248,7 +249,8 @@ public:
bool useGpu = isUsingGpu());
static Vector* createVectorFromNumpy(float* data, int dim, bool copy = true,
bool useGpu = isUsingGpu());
bool useGpu = isUsingGpu())
throw (UnsupportError);
/**
* Create Cpu Vector from numpy array, which dtype=float32
*
@ -311,7 +313,8 @@ public:
bool useGpu = isUsingGpu());
static IVector* createVectorFromNumpy(int* data, int dim, bool copy = true,
bool useGpu = isUsingGpu());
bool useGpu = isUsingGpu())
throw (UnsupportError);
/**
* Create Cpu IVector from numpy array, which dtype=int32

@ -40,7 +40,7 @@ IVector* IVector::create(const std::vector<int>& data, bool useGpu) {
}
IVector* IVector::createVectorFromNumpy(int* data, int dim, bool copy,
bool useGpu) {
bool useGpu) throw (UnsupportError){
if (useGpu) {
/// if use gpu only copy=true is supported
if (!copy) {
@ -202,7 +202,7 @@ Vector* Vector::createByPaddleVectorPtr(void* ptr) {
}
Vector* Vector::createVectorFromNumpy(float* data, int dim, bool copy,
bool useGpu) {
bool useGpu) throw (UnsupportError){
if (useGpu) {
/// if use gpu only copy=True is supported
if (!copy) {

Loading…
Cancel
Save