首页 > 解决方案 > TensorRT 如何处理数据?

问题描述

在 Tensorflow 中,Tensor 格式为 NxWxHxC 并通过网络。

Tensorflow 模型转换为 TensorRT 引擎时,Tensor 数据是如何处理的。与 Thensoflow 中的形状相同或扁平。

Flattened 表示,例如 1x3x4x3 张量

[[[1,2,3],[4,5,6],[7,8,9],[10,11,12]],
     [[1,2,3],[4,5,6],[7,8,9],[10,11,12]],
     [[1,2,3],[4,5,6],[7,8,9],[10,11,12]]]

被压扁成

[1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12,1,2,3,4,5,6,7,8,9,10,11,12]

单个数组并处理。

标签: tensorflowtensorrt

解决方案


TensorRT 以 NCHW 格式处理数据。当数据被展平时,它是 NCHW 格式。这意味着,数据被展平为

1,4,7,10,1,4,7,10,1,4,7,10,2,5,8,11,2,5,8,11,2,5,8,11,3,6,9,12,3,6,9,12,3,6,9,12

推荐阅读