wrap¶
- class torchvision.tv_tensors.wrap(wrappee, *, like, **kwargs)[source]¶
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
:How to write your own v2 transforms
How to write your own v2 transformsTVTensors FAQHow to write your own TVTensor class
How to write your own TVTensor class