当前位置:网站首页>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 .
边栏推荐
猜你喜欢

找到页面当前元素z-index最高的数值

Idea announced a new default UI, which is too refreshing (including the application link)

LeetCode 78. 子集

BGP中的状态机

Singleton mode compilation

In depth understanding of JUC concurrency (I) what is JUC

【张三学C语言之】—深入理解数据存储

ctf-web之练习赛

Cglib agent - Code enhancement test

Distributed transactions: the final consistency scheme of reliable messages
随机推荐
State machine in BGP
LeetCode 47. Full arrangement II
kali最新更新指南
Sentinel rules persist to Nacos
日期时间API详解
Contest3147 - game 38 of 2021 Freshmen's personal training match_ A: chicken
Arduino Wire 库使用
MySQL的10大經典錯誤
Pbootcms collection and warehousing tutorial quick collection release
压力测试修改解决方案
BGP报文详细解释
队列(线性结构)
Ruijie ebgp configuration case
CUDA与Direct3D 一致性
PgSQL学习笔记
深入了解JUC并发(二)并发理论
Eco express micro engine system has supported one click deployment to cloud hosting
记录一次RDS故障排除--RDS容量徒增
Network related knowledge (Hardware Engineer)
数据科学【八】:SVD(一)