Shortcuts

write_file

torchvision.io.write_file(filename: str, data: Tensor) Tensor[source]

[DEPRECATED] Use TorchCodec instead.

Write the content of an uint8 1D tensor to a file.

Warning

The image decoding and encoding capabilities of TorchVision are deprecated since torchvision 0.29 and will be removed in a future release. They are superseded by the more complete decoders and encoders of TorchCodec (from torchcodec 0.16). Please see this migration guide on how to migrate your code.

Parameters:
  • filename (str or pathlib.Path) – the path to the file to be written

  • data (Tensor) – the contents to be written to the output file

Returns:

the input data, returned as-is.

Return type:

data (Tensor)

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