wrap¶
- class torchvision.tv_tensors.wrap(wrappee, *, like, **kwargs)[source]¶
[BETA] Convert a
torch.Tensor
(wrappee
) into the sameTVTensor
subclass aslike
.If
like
is aBoundingBoxes
, theformat
andcanvas_size
oflike
are assigned towrappee
, unless they are passed askwargs
.- Parameters:
wrappee (Tensor) – The tensor to convert.
like (
TVTensor
) – The reference.wrappee
will be converted into the same subclass aslike
.kwargs – Can contain “format” and “canvas_size” if
like
is aBoundingBoxes
. Ignored otherwise.
Examples using
wrap
:TVTensors FAQHow to write your own TVTensor class
How to write your own TVTensor class