Table of Contents
Shortcuts

# UninitializedBuffer

class torch.nn.parameter.UninitializedBuffer(requires_grad=False, device=None, dtype=None)

  A buffer that is not initialized.

  Uninitialized Buffer is a a special case of `torch.Tensor` where the shape of the data is still unknown.

  Unlike a `torch.Tensor`, uninitialized parameters hold no data and attempting to access some properties, like their shape, will throw a runtime error. The only operations that can be performed on a uninitialized parameter are changing its datatype, moving it to a different device and converting it to a regular `torch.Tensor`.

  The default device or dtype to use when the buffer is materialized can be set during construction using e.g. `device='cuda'`.

## 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

To analyze traffic and optimize your experience, we serve cookies on this site. By clicking or navigating, you agree to allow our usage of cookies. As the current maintainers of this site, Facebook’s Cookies Policy applies. Learn more, including about available controls: Cookies Policy.