wrap
- class torchvision.tv_tensors.wrap(wrappee, *, like, **kwargs)[source]
Convert a
torch.Tensor(wrappee) into the sameTVTensorsubclass as .
Convert a torch.Tensor (wrappee) into the same TVTensor subclass as .
likeIf like carries metadata (e.g. format, canvas_size), that
metadata is copied to the output. Individual metadata fields can be
overridden via kwargs.
Subclass authors can override wrap()
to define how their metadata is propagated.
wrappee (Tensor) – The tensor to convert.
like (TVTensor) – The reference.
wrappee will be converted into the same subclass as like.
kwargs – Metadata overrides passed to the subclass’s
wrap() method.
Examples using wrap: