How to flatten tensor before copy to gpu and enqueue

Hi,
Lets say for example that my tensor is 4x3 matrix like this:
x1,x2,x3,x4
y1,y2,y3,y4
z1,z2,z3,z4

Before copying the tensor to the gpu I need to flatten it, whats the way to do it?
Is it:

  1. x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4

or

  1. x1,x2,x3,x4,y1,y2,y3,y4,z1,z2,z3,z4

Thanks

I don’t get why it needs to be flattened. If the 4x3 elements are contiguous in memory, the memory copy should be as simple as copying 12*sizeof(element) bytes.

Sequence of elements will depend on how you organized your data.

In TRT, if an input tensor is marked as NCHW FP32, in that case it will be option 2.

Thanks