UninitializedParameter
ParameterUninitializedParameter(data: Tensor | list[object] | None = None, requires_grad: bool = True)A parameter that exists before its shape does.
A lazy layer cannot build its weights until it sees an input, but
parameters() is read before that — by an optimizer, an EMA, a
parameter-server shard — and whatever is read then is what those
hold for the rest of the run. Returning nothing means they hold
nothing, and the layer silently never trains.
So the object is created up front over a zero-element buffer and
materialize fills it in place. What matters is that the
object survives: id(param) is the same before and after, so a
list captured early still names the weights that eventually exist.
Parameters
None (default) yields a zero-sized
placeholder F32/CPU parameter, useful when the actual shape is
deferred until first forward (lazy modules). A Tensor
clones its storage so the new parameter is independent of the
source. A list / nested-list is converted via _to_impl.requires_gradbool= TrueTrue).Notes
Lucid's engine optimizers capture TensorImpl pointers, one level
below the Parameter, so preserving the Python object is
necessary but not sufficient — see the deferred binding in
lucid.optim.Optimizer, which is the other half.
Used by 6
Instance methods
1Take on data's storage, shape and dtype, in place.
Parameters
dataTensorNotes
Rebinds _impl rather than copying into it: the buffer is a
different size, and copy_from is shape-strict by design. The
instance's class is rewritten to Parameter so nothing
downstream keeps treating a fully-formed weight as pending.