TinyUNet class

Minimal U-Net for [N, 1, H, W] grayscale images. Two down blocks (stride-2 Conv2d), a mid block, then two up blocks (ConvTranspose2d, stride-2). A per-image scalar timestep is embedded via a linear projection and broadcast-added to the mid features. Predicts an ε-shape tensor [N, 1, H, W].

Inheritance

Constructors

TinyUNet({int hidden = 16, int totalTimesteps = 1000, Device device = Device.CPU, int seed = 0})

Properties

down1 → Conv2d
final
down2 → Conv2d
final
hashCode → int
The hash code for this object.
no setterinherited
mid → Conv2d
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
timeProj → Linear
final
totalTimesteps → int
final
training ↔ bool
Whether this module is in training mode. Layers that behave differently between training and inference (e.g. Dropout) read this flag in their call method. Defaults to training mode.
getter/setter pairinherited
up1 → ConvTranspose2d
final
up2 → ConvTranspose2d
final

Methods

call(Tensor x, int t) → Tensor
eval() → void
Put this module (and any registered submodules) into evaluation mode.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
parameters() → List<Tensor>
Trainable tensors owned by this module (and its submodules).
override
submodules() → List<Module>
Submodules owned by this module. Subclasses that compose other modules should override this so train() / eval() propagate. Default: empty.
override
toString() → String
A string representation of this object.
inherited
train() → void
Put this module (and any registered submodules) into training mode.
inherited
zeroGrad() → void
Zero every parameter's gradient. Safe to call before each backward.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited