Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does C-contiguous fashion mean in caffe blob storage?

in caffe document :http://caffe.berkeleyvision.org/tutorial/net_layer_blob.html

Blob storage and communication# A Blob is a wrapper over the actual data being processed and passed along by Caffe, and also under the hood provides synchronization capability between the CPU and the GPU. Mathematically, a blob is an N-dimensional array stored in a C-contiguous fashion.

it said a blob is stored in a C-contiguous fashion. what does C-contiguous fashion mean?

like image 392
Long Avatar asked Jun 02 '16 16:06

Long


1 Answers

C contiguous fashion, is the opposite of Fortran fashion (also used by Matlab). It means that the n-dim data is stored as a long and contiguous array in memory. The order of the elements in memory is according to C fashion: trailing dimensions are stored first. That is if you have c by h by w 3d blob, in memory rows will be saved one after the other, and after completing all the rows of the first channel, only then the rows of the next channel are written.

Another way to look at it is that the i, j, k element is stored at

  blob[i*w*h + j*w + k]

See this wiki page for more information.

like image 178
Shai Avatar answered Nov 01 '22 15:11

Shai