clDNN
cldnn::format Struct Reference

Represents memory formats (orders).
In CNN most of data is described as 4 dimensional blocks. In Intel(R) clDNN library we describe memory with 4 letters. More...

#include <tensor.hpp>

Public Types

enum  type : int32_t {
  yxfb = cldnn_format_yxfb, byxf = cldnn_format_byxf, bfyx = cldnn_format_bfyx, fyxb = cldnn_format_fyxb,
  os_iyx_osv16 = cldnn_format_os_iyx_osv16, bs_xs_xsv8_bsv8 = cldnn_format_bs_xs_xsv8_bsv8, bs_xs_xsv8_bsv16 = cldnn_format_bs_xs_xsv8_bsv16, bs_x_bsv16 = cldnn_format_bs_x_bsv16,
  bf8_xy16 = cldnn_format_bf8_xy16, image_2d_weights_c4_fyx_b = cldnn_format_image_2d_weights_c4_fyx_b, image_2d_weights_c1_b_fyx = cldnn_format_image_2d_weights_c1_b_fyx, winograd_2x3_s1_data,
  winograd_2x3_s1_weights, winograd_2x3_s1_fused_weights, format_num = cldnn_format_format_num, any = cldnn_format_any
}
 

Public Member Functions

size_t batch_num () const
 Returns number of batch dimensions.
 
size_t feature_num () const
 Returns number of feature dimensions.
 
size_t spatial_num () const
 Returns number of spatial dimensions.
 
const std::string & order () const
 Returns an order of dimensions in form of string.
 
const std::string & internal_order () const
 Returns an internal orders of dimensions form of string.
 
size_t dimension () const
 Returns number of dimensions contained within this format.
 
bool is_winograd () const
 Checks if format is a winograd format.
 
bool is_image_2d () const
 Checks if format is of image 2d type.
 
bool is_image () const
 Checks if format is of image type.
 
constexpr format (type t)
 Implicit conversion from format::type.
 
constexpr operator type () const
 Implicit conversion to format::type.
 
constexpr format (cldnn_format_type t)
 Conversion from C API cldnn_format_type.
 
constexpr operator cldnn_format_type () const
 Conversion to C API cldnn_format_type.
 

Static Public Member Functions

static const format_traitstraits (type fmt)
 Get format traits for particular format::type.
 
static size_t batch_num (type fmt)
 Returns number of batch dimensions for a format.
 
static size_t feature_num (type fmt)
 Returns number of feature dimensions for a format.
 
static size_t spatial_num (type fmt)
 Returns number of spatial dimensions for a format.
 
static const std::string & order (type fmt)
 Returns an order of dimensions for a @ format.
 
static const std::string & internal_order (type fmt)
 Returns an internal orders of dimensions for a format.
 
static size_t dimension (type fmt)
 Returns number of dimensions contained within a format.
 
static bool is_winograd (type fmt)
 Checks if format is a winograd format.
 
static bool is_image_2d (type fmt)
 Checks if format is of image2d type.
 
static bool is_image (type fmt)
 Checks if format is of image type.
 

Public Attributes

type value
 

Detailed Description

Represents memory formats (orders).
In CNN most of data is described as 4 dimensional blocks. In Intel(R) clDNN library we describe memory with 4 letters.

  • b - number of blocks in batch. For weights formats: output features - conv, neurons - inner product
  • f - number of feature maps, features or channels. For weights formats: input features - conv, inputs, inner product
  • x - spatial, width
  • y - spatial, height /n For explanation how each format type is implemented in memory we will use naming shown bellow (b=2,f=3,y=3,x=3):
    layout_memory_representation.jpg

Definition at line 75 of file tensor.hpp.

Member Enumeration Documentation

◆ type

enum cldnn::format::type : int32_t
Enumerator
yxfb 

batch first, feature and than spatials

yxfb.jpg
byxf 

used in bitmaps, input from user i.e b images of RGB format

byxf.jpg
bfyx 

the most common format for activations in clDNN.

bfyx.jpg
fyxb 

format not used inside clDNN, but supported in reorder as extension for user provided formats.

os_iyx_osv16 

format used only for convolution weights: os - output feature maps slice, i - input feature maps, yx - spatials, sv16 - 16 values of single slice.

os_iyx_osv16.jpg
bs_xs_xsv8_bsv8 

format used only for fully connected weights: bs - batch slice, xs - x slice, bsv8 - 8 values of single slice.

bs_xs_xsv8_bsv8.jpg
bs_xs_xsv8_bsv16 

format used only for fully connected weights: bs - batch slice, xs - x slice, bsv16 - 16 values of single slice.

bs_xs_xsv8_bsv16.jpg
bs_x_bsv16 

format used only for fully connected weights fp16 batch=1 : bs - batch slice (responses slice), bsv16 - 16 values of single batch slice, x - flattened plane of (fyx).

bs_x_bsv16.jpg
bf8_xy16 

format used only for convolution 1x1 input, xy aligned to 16, f aligned to 8

bf8_xy16.jpg
image_2d_weights_c4_fyx_b 


image format for weights, width size is f*y*x/4 (4-channels filled with fyx data), height is b

image_2d_weights_c4_fyx_b.jpg
image_2d_weights_c1_b_fyx 

image format for weights, width size is b, height is f*y*x, single channel

image_2d_weights_c1_b_fyx.jpg
winograd_2x3_s1_data 

format used for input for winograd convolution, F(2,3) – filter 3x3 with stride 1

winograd_2x3_s1_weights 

format used for weights for winograd non-fused convolution, F(2,3) – filter 3x3 with stride 1

winograd_2x3_s1_fused_weights 

format used for weights for winograd fused convolution, F(2,3) – filter 3x3 with stride 1

format_num 

number of format types

Definition at line 77 of file tensor.hpp.


The documentation for this struct was generated from the following file: