W3cubDocs

/PyTorch 2.9

UninitializedParameter

class torch.nn.parameter.UninitializedParameter(requires_grad=True, device=None, dtype=None) [source]

A parameter that is not initialized.

Uninitialized Parameters are a special case of torch.nn.Parameter where the shape of the data is still unknown.

Unlike a torch.nn.Parameter, 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.nn.Parameter.

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

cls_to_become [source]

alias of Parameter

© 2025, PyTorch Contributors
PyTorch has a BSD-style license, as found in the LICENSE file.
https://docs.pytorch.org/docs/2.9/generated/torch.nn.parameter.UninitializedParameter.html