I have a tensor which contains boxes predict by detection. and it’s format like:
cx, cy, w, h
I want convert this tensor to:
x1, y1, w, h
So I can do this in python:
boxes[:, :2] -= boxes[:, 2:] / 2
boxes[:, 2:] += boxes[:, :2]
But how to do this in libtorch???
support I have
Are you looking for
thank u for your reply Tomas.
Can you elibrate your answer? I am not quit understand of the
narrow usage. I know there is a slice method of tensor.
I got trouble in slice.
My tensor is size as : [2976, 4], which is 2976 rows and 4 columns.
I want get the first 2 columns:
priors.slice(1, 0, 2)
terminate called after throwing an instance of 'std::runtime_error'
what(): invalid argument 0: Sizes of tensors must match except in dimension 0. Got 1 and 2 in dimension 1 at /media/jintain/sg/ai/libs/pytorch/aten/src/THC/generic/THCTensorMath.cu:71
Did I slice it wrong?