I want to combine two 3D tensors (Pytorch) alternatively
import torch
x = torch.ones(2, 2, 2, requires_grad=False, dtype=torch.float64)
y = torch.zeros(2, 2, 2, requires_grad=False, dtype=torch.float64)
#The results I want are
#Slicing[:,:,0]
#1010
#1010
#Slicing[:,:,1]
#1010
#1010
I found this one from the previous question (Interweaving two numpy arrays), but I think it only works for 1d array (tensor)
import torch
x = torch.ones(2, 2, 2, requires_grad=False, dtype=torch.float64)
y = torch.zeros(2, 2, 2, requires_grad=False, dtype=torch.float64)
result=torch.ravel(torch.column_stack((x, y)))
print('Check\n',result)