当前位置:网站首页>Detailed definition of tensorrt data format
Detailed definition of tensorrt data format
2022-07-02 06:27:00 【Little Heshang sweeping the floor】
TensorRT Detailed definition of data format
Click here to join NVIDIA Developer Program
TensorRT Support different data formats . There are two aspects to consider : Data type and layout .
Data type format
The data type is the representation of each individual value . Its size determines the range of values and the accuracy of the representation , Namely FP32
(32 Bit floating point , Or single precision ),FP16
(16 Bit floating point or half precision ),INT32
(32 Bit integers represent ), and INT8
(8 Who said ).
Layout format
The layout format determines the order in which values are stored . Usually ,batch Dimension is the leftmost dimension , Other dimensions refer to aspects of each data item , For example, in the image C It's a channel , H It's height , W It's the width . Ignore the batch size always before these , C 、 H and W Usually sorted as CHW ( See chart 1 ) or HWC ( See chart 2 ).
chart 1. CHW The layout of : The image is divided into HxW matrix , One per channel , The matrix is stored sequentially ; All values of the channel are stored continuously .
chart 2. HWC The layout of : Images are stored as a single file HxW matrix , The value is actually C Tuples , Each channel has a value ; One point ( Pixels ) All values of are stored continuously .
For faster computing , More formats are defined to package channel values together and use reduced precision . therefore ,TensorRT And support NC / 2HW2
and NHWC8
Equiform .
stay NC / 2HW2 ( TensorFormat::kCHW2 )
in , Channel value pairs are in each HxW Packed together in a matrix ( Null in case of odd channels ). The result is a format , among ⌈ C/2 ⌉ HxW
The value of the matrix is the value pair of two consecutive channels ( See chart 3 ); Please note that , If they are in the same pair , Then this sort interleaves the dimensions into steps 1 Value of the channel of , Otherwise, the step size will be 2xHxW .
The following figure shows a pair of channel values in each HxW Packed together in a matrix . The result is a format , among [C/2] HxW
The value of the matrix is the value pair of two consecutive channels
stay NHWC8 ( TensorFormat::kHWC8 )
in , HxW The entries of the matrix include the values of all channels ( See chart 4 ). Besides , These values are packaged in ⌈ C/8 ⌉
8 Tuple , also C Round up to the nearest 8 Multiple .
The following figure is in this NHWC8
In the format , HxW The entries of the matrix include the values of all channels .
other TensorFormat Follow the above mentioned TensorFormat::kCHW2
and TensorFormat::kHWC8
Similar rules .
边栏推荐
猜你喜欢
随机推荐
ModuleNotFoundError: No module named ‘jieba.analyse‘; ‘jieba‘ is not a package
构建学习tensorflow
Hydration failed because the initial UI does not match what was rendered on the server.问题原因之一
Is there a really free applet?
Generic classes and parameterized classes of SystemVerilog
数据科学【八】:SVD(一)
Summary of advertisement business bug replay
IPv6 experiment and summary
Golang -- map capacity expansion mechanism (including source code)
Sentinel rules persist to Nacos
程序员的自我修养—找工作反思篇
CUDA中的动态全局内存分配和操作
Linked list (linear structure)
浅谈三点建议为所有已经毕业和终将毕业的同学
LeetCode 40. Combined sum II
10 erreurs classiques de MySQL
Sparse array (nonlinear structure)
Log (common log framework)
CUDA中的函数执行空间说明符
The difference between session and cookies