image = torch.from_numpy(image.transpose(2, 0, 1)).unsqueeze(0).float()
image.transpose
with more than 2 dims is a numpy method and thus not usable in libtorch.
You would have to either transpose two dimensions (using the same syntax as in Python) or use permute
instead (tensor.oermute({2, 0, 1})
).
torch.from_numpy
is not available in libtorch, if I’m not mistaken.
unsqueeze(0) is available in C++, and you can just directly write it as tensor.unsqueeze(0)