Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

cldnn - meaning of "cldnn_tensor" fields

Sanderson__Hugh
Beginner
517 Views

Hi,

I am looking to use clDNN via the c-api, and have a few queries about the cldnn_tensor (tensor size) struct.

1. Should I always set batch_num and feature_num to 1, and spatial_num to 2 ?  This would always make:

sizes[0] = batch size
sizes[1] = feature size
sizes[2] = spatial_0 (x?)
sizes[3] = spatial_1 (y?)

2. Is the x-coordinate (or width) always first, and y-coordinate (or height) always second?  Even though formats mention y first, eg cldnn_format_yxfb.

3. It seems I need to pad  4...CLDNN_TENSOR_DIM_MAX size elements to '1' to get the byte calculation right.

   How should I pad the elements in the case where "cldnn_tensor" is representing and offset, rather than a size (eg lower_size) ie, should I put size[0] and size[1] to 0 for no batch/feature offset?

4. Is cldnn_format_bfyx the best format for conv2d weights?

5. To confirm, the conv2d bias size should be [1,1,Outputs,1], ie, "spatial_0" should be the feature size.  A little odd, but I can live with it.

I complete example of using the c api to run a conv2d would answer most of these questions. Is there one somewhere?

 

Thanks,

Hugh

 

 

 

 

 

0 Kudos
1 Reply
Sanderson__Hugh
Beginner
517 Views

In answer to my own questions

1,2,3. It works if you always use a 4D vector, x first, padded with 1s everywhere

For the offsets, you describe a 4D vector with the feature and batch 'size' (offset) = 0

4 - seems to work

5 works - but is a little odd.

I would also add that the strings in cldnn_engine_configuration need to be initialized with the empty string "", rather than the null pointer otherwise you get a crash.

But otherwise, everything seems to work out ok.

0 Kudos
Reply