Created
April 6, 2021 20:02
-
-
Save RonRichman/326da7ccb459d892457f4f742d71a0f2 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
t1 <- torch_tensor(array(1:50, dim = c(2, 25))) | |
t1[1,] | |
batch_size <- 2 | |
no_embeds = 5 | |
embed_dim = 5 | |
t1_reshape <- torch_unsqueeze(t1,3) | |
t1_reshape2 <- torch_reshape(t1_reshape,c(batch_size, no_embeds, embed_dim)) | |
t1_reshape3 <- torch_transpose(t1_reshape2,2,1) | |
t1_reshape | |
t1_reshape2[1,,] | |
t1_reshape3[,1,] | |
t1_reshape4 <- torch_transpose(t1_reshape3,1,2) | |
t1_reshape5 <- torch_reshape(t1_reshape4, c(batch_size, no_embeds*embed_dim)) | |
#t1_reshape6 <- torch_squeeze(t1_reshape5,dim = 3) | |
t1_reshape5[1,] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment