简体   繁体   中英

What is the memory layout of the underlying data buffer used by the Tensorflow C API?

I am using TF_TensorData to read the output from my graph, which is a tensor of dimensions {1, 520, 420, 1}. My objective is to pull out a 520 x 420 image of floats. I was wondering what is the layout of the underlying data buffer retrieved with TF_TensorData. On the input side, am I correct in assuming the layout of the data buffer passed to TF_NewTensor would be the same?

In the general case, what is the layout of a tensor of arbitrary dimensions?

For your two tensors, yes the layout is the same.

As per the documentation in tensorflow/c/c_api.h , data is laid out in row-major order.

{1, 520, 420, 1} is the same shape as {520 , 420}

On the input side, am I correct in assuming the layout of the data buffer passed to TF_NewTensor would be the same?

must be the same, just import some data and printout.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM