Hello! I am trying to create a 4d tensor out of a  vector of 3d tensors, and am calling stack repeatedly. However, this is causing a segmentation fault, and Im not sure why. The size of the tensors shouldnt be the issue as stack works with torch::randn() of same dimensions.
         imageAndClass firstElem = images[0]; 
         imageAndClass secondElem = images[1]; 
         torch::Tensor training_data = firstElem.image; 
         cout << "test" << endl; 
         torch::Tensor test = torch::stack({training_data, secondElem.image}, 0); 
         cout << "test" << endl;


Where images is a std::vector of structs containing a torch::Tensor, and an integer classification.