vkML 0.1.0

Dropout

Zero elements with probability p during training, scaling the rest.

class Dropout : Modulepython/vkml/nn.py:544

Advances an offset on every call. The underlying rand is a pure function of (seed, offset, index), so a module reusing one offset would drop the same elements at every step — silently, while the loss curve still looked plausible. The counter is what makes successive masks independent, and there is a test that two consecutive calls differ.

Seeding from a module-local counter rather than a global stream keeps the whole thing reproducible: the same seed replays the same run.

ⓘ Note

p must be in [0, 1). p=0.0 short-circuits to the identity, as does evaluation mode.

Construction

__init__

def __init__self, p: float=0.5, seed: int=0python/vkml/nn.py:557

Forward

forward

def forwardself, x: V.Tensor -> V.Tensorpython/vkml/nn.py:565

Internals

__repr__

def __repr__self -> strpython/vkml/nn.py:572

See also dropout, rand, Module

vkML — Vulkan-first machine learning in C++20. Apache-2.0. Signatures on this page are generated from the installed module.