Class ParameterInit
java.lang.Object
smile.deep.layer.ParameterInit
Controls whether
LinearLayer / EmbeddingLayer skip default
parameter initialization (Kaiming / normal) and where empty parameter
storage is allocated. Inference weight load wraps model construction in
uninitialized(Device) so shells land on the target GPU without a
full host-side empty model footprint.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumDecrements the skip depth when closed. -
Method Summary
Modifier and TypeMethodDescriptionstatic Devicedevice()Target device for empty Linear/Embedding shells in the current scope.static booleanskip()static ParameterInit.ScopeOpens a scope where new Linear/Embedding layers skip parameter init and allocate empty storage on CPU.static ParameterInit.Scopeuninitialized(Device device) Opens a scope where new Linear/Embedding layers skip parameter init and allocate empty storage ondevice(e.g.
-
Method Details
-
skip
public static boolean skip()- Returns:
trueif parameter init should be skipped.
-
device
Target device for empty Linear/Embedding shells in the current scope. Defaults to CPU when not inside a device-aware uninitialized scope.- Returns:
- target device for empty parameter storage.
-
uninitialized
Opens a scope where new Linear/Embedding layers skip parameter init and allocate empty storage on CPU.- Returns:
- scope handle (close to leave the uninitialized region).
-
uninitialized
Opens a scope where new Linear/Embedding layers skip parameter init and allocate empty storage ondevice(e.g. the rank's CUDA device).- Parameters:
device- target device for empty parameter tensors.- Returns:
- scope handle (close to leave the uninitialized region).
-