How to print at::tensor in C++ during debugging a custom op?
1.code line?
2.gdb?
1 Like
You can use std::cout << your_tensor << std::endl;
to print the content of a Tensor.
Is there a way of printing the size of a tensor without iterating through all elements of size()
?
So doing something like cout << t.size() << end
.
I believe std::cout << self.sizes() << std::endl;
will work no?
1 Like
Thanks for your reply. Indeed, tensor impl has some attributes of tensor.
How about if you would only like to print a part of a tensor? For example, if you have a tensor of size {1,1,224,224} what if you wanted to index specific elements?
indexing works!
std::cout << system -> m_q[0] << std::endl;
0
[ CPUFloatType{1,1} ]