On this page
UninitializedBuffer
class torch.nn.parameter.UninitializedBuffer(requires_grad=False, device=None, dtype=None)[source]-
A buffer that is not initialized.
Uninitialized Buffer is a a special case of
torch.Tensorwhere 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 regulartorch.Tensor.The default device or dtype to use when the buffer is materialized can be set during construction using e.g.
device='cuda'.
© 2024, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://pytorch.org/docs/2.1/generated/torch.nn.parameter.UninitializedBuffer.html