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