Shortcuts

wrap

class torchvision.tv_tensors.wrap(wrappee, *, like, **kwargs)[source]

Convert a torch.Tensor (wrappee) into the same TVTensor subclass as like.

If like is a BoundingBoxes, the format and canvas_size of like are assigned to wrappee, unless they are passed as kwargs.

Parameters:
  • wrappee (Tensor) – The tensor to convert.

  • like (TVTensor) – The reference. wrappee will be converted into the same subclass as like.

  • kwargs – Can contain “format” and “canvas_size” if like is a BoundingBoxes. Ignored otherwise.

Examples using wrap:

TVTensors FAQ

TVTensors FAQ

How to write your own TVTensor class

How to write your own TVTensor class

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources