Skip to content

[Pytorch] torch class usage question #1128

Answered by saudet
logicartis asked this question in Q&A
Discussion options

You must be logged in to vote

c10::ArrayRef<> is a wrapper around arrays, in this case arrays of Tensor objects, so something like this should work:

cat(new TensorArrayRef(new Tensor(2).put(a).position(1).put(b).position(0), 2), 1);

But yeah that's not super user-friendly. There is also a constructor taking std::vector<>, so I've just mapped that in commit eeee3e7. With that we can do something like this instead, which is already much better:

cat(new TensorArrayRef(new TensorVector(a, b)), 1);

Please give it a try with the snapshots: http://bytedeco.org/builds/
And thanks for reporting this issue!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@logicartis
Comment options

Answer selected by saudet
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants