Skip to content

Tensor concatenation and appending #2669

Answered by laggui
wangjiawen2013 asked this question in Q&A
Discussion options

You must be logged in to vote

Both manipulations can be accomplished with Tensor::cat for concatenating.

let tensor1 = Tensor::<B, 1>::from([1, 2, 3]);
let tensor2 = Tensor::<B, 1>::from([4, 5, 6]);

let tensor3 = Tensor::cat(vec![tensor1, tensor2], 0);
let tensor1 = Tensor::<B, 1>::from([1, 2, 3]);
let tensor2 = Tensor::<B, 1>::from([4]);

let tensor3 = Tensor::cat(vec![tensor1, tensor2], 0);

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by laggui
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
Converted from issue

This discussion was converted from issue #2666 on January 08, 2025 15:26.