Class ModuleLayer

java.lang.Object
smile.deep.layer.ModuleLayer
All Implemented Interfaces:
Function<Tensor,Tensor>, Layer
Direct Known Subclasses:
AdaptiveAvgPool2dLayer, AvgPool2dLayer, BatchNorm1dLayer, BatchNorm2dLayer, Conv2dLayer, DropoutLayer, EmbeddingLayer, GroupNormLayer, LinearLayer, MaxPool2dLayer

public abstract class ModuleLayer extends Object implements Layer
Base class for layers backed by a native smile_torch module (Linear, Conv2d, pooling, normalization, …).

Each instance owns two native handles: the typed layer handle (e.g. ST_Linear) used for forward, and an ST_Module view of the same module used for registration into blocks and for device/dtype moves. Both are released together once the wrapper becomes unreachable.

  • Method Details

    • module

      public MemorySegment module()
      Description copied from interface: Layer
      Returns the native ST_Module handle for this layer.
      Specified by:
      module in interface Layer
      Returns:
      the native ST_Module handle.
    • toString

      public String toString()
      Overrides:
      toString in class Object