sdemyanov / ConvNet

Convolutional Neural Networks for Matlab for classification and segmentation, including Invariang Backpropagation (IBP) and Adversarial Training (AT) algorithms. Trained on GPU, require cuDNN v5.
240 stars 141 forks source link

compile script #31

Open Anesouadou opened 7 years ago

Anesouadou commented 7 years ago

first thank you sharing the code, I was trying to compile the code, at first I got an error missing "cudnn.h" but I found a solution for it. when I compiled again, I got the following error: Error using mex mex_util.cpp C:\Users\Anes\Desktop\ConvNet-master\c++\sources\mex_util.cpp(175) : error C2057: expected constant expression C:\Users\Anes\Desktop\ConvNet-master\c++\sources\mex_util.cpp(175) : error C2466: cannot allocate an array of constant size 0 C:\Users\Anes\Desktop\ConvNet-master\c++\sources\mex_util.cpp(175) : error C2133: 'dims' : unknown size

Error in compile (line 52) mex(['"' cppfiles '"'], '-c', ...

it seems the issue is that C++ does not support size '0' array or something. can you please advise. thank you

sdemyanov commented 7 years ago

Try like this:

mwSize ndims = dimvect.size(); mwSize dims[ndims];

This might be a compiler's problem.

Anesouadou commented 7 years ago

I tried that, but it gives the same error, in addition to not recognize ndims as a size variable. is there a particular compiler you recommend I should use

sdemyanov commented 7 years ago

Which OS do you use? In Linux GCC 4.8.4 can deal with this. Alternatively, just modify the code to work with fixed size arrays. The size of dimvect can in fact be either 2 or 4, so you can: 1) inside mexNewArray, change the argument list on the pointer to the array with 2 or 4 numbers, and pass the array size (2 or 4) as an additional variable. Using IF block, define dims array as an array of fixed size. 2) only 2 function use mexNewArray: mexNewMatrix (size = 2) and mexSetTensor (size = 4). Modify the function call accordingly.

Anesouadou commented 7 years ago

I use Windows , I will try these modifications, I hope they will work. thank you for your quick reply