Class ParameterInit

java.lang.Object
smile.deep.layer.ParameterInit

public final class ParameterInit extends Object
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.
  • Method Details

    • skip

      public static boolean skip()
      Returns true when the current thread is inside an uninitialized() / uninitialized(Device) scope.
      Returns:
      true if parameter init should be skipped.
    • device

      public static Device 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

      public static ParameterInit.Scope 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

      public static ParameterInit.Scope uninitialized(Device device)
      Opens a scope where new Linear/Embedding layers skip parameter init and allocate empty storage on device (e.g. the rank's CUDA device).
      Parameters:
      device - target device for empty parameter tensors.
      Returns:
      scope handle (close to leave the uninitialized region).