How to convert a list of tensors into a torch::Tensor?
问题 I'm trying to convert the following Python code into its equivalent libtorch: tfm = np.float32([[A[0, 0], A[1, 0], A[2, 0]], [A[0, 1], A[1, 1], A[2, 1]] ]) In Pytorch we could simply use torch.stack or simply use a torch.tensor() like below: tfm = torch.tensor([[A_tensor[0,0], A_tensor[1,0],0], [A_tensor[0,1], A_tensor[1,1],0] ]) However, in libtorch, this doesn't hold, that is I can not simply do: auto tfm = torch::tensor ({{A.index({0,0}), A.index({1,0}), A.index({2,0})}, {A.index({0,1}), A