cppflow icon indicating copy to clipboard operation
cppflow copied to clipboard

Connect tensor

Open xiaojun-mbed opened this issue 3 years ago • 3 comments

How do I connect two tensors?

std::vector vals1 = { 1.1, 1.2, 1.3, 1.4, 1.5, 1.6,1.7, 1.8, 1.9 }; std::vector vals2 = { 1.11, 1.21, 1.31, 1.41, 1.51, 1.61,1.71, 1.81, 1.91 }; cppflow::tensor t1 = cppflow::tensor(vals1, { 9,1 }); cppflow::tensor t2 = cppflow::tensor(vals2, { 9,1 });

Connect like this in the dimension of axis = 1 to form a tensor of shape dimension (9, 2)

xiaojun-mbed avatar Jul 27 '22 02:07 xiaojun-mbed

Hi @xiaojun-mbed

CppFlow provides a mapping of TF Raw Ops in cppflow/raw_ops.h.

You can use the mapping of concat:

tensor concat(const tensor& concat_dim, const std::vector<tensor>&values)

serizba avatar Aug 02 '22 15:08 serizba

Thank you very much for your help! I can't understand the source code. Can you tell me how to do this example

cppflow::tensor add = cppflow::concat(1, vectorcppflow::tensor(t1,t2));

image

xiaojun-mbed avatar Aug 12 '22 02:08 xiaojun-mbed

It looks fine. You didn't post the error you getting so is hard to tell.

serizba avatar Aug 22 '22 11:08 serizba