Skip to main content

clika_runtime.nn.functional

Functional interface to the neural-network operators::

import clika_runtime.nn.functional as F

y = F.relu(x)
p = F.softmax(y, dim=-1)

Use these when a computation has no state worth holding in a :class:~clika_runtime.nn.Module: activations, padding, pooling, normalization, losses, attention. Every function takes its input tensor first and returns a new tensor; a trailing-underscore twin (F.relu_) writes through its input instead of allocating. A mode argument takes a name (F.gelu(x, approximate="tanh")) or the bound enum value.

Pooling and convolution run over channels-last tensors ([batch, *spatial, channels]); pooling knobs take an int or a per-dimension sequence. The random regularizers are the identity outside training; with training=True the dropout family draws its Bernoulli mask on the tensor's device, while rrelu refuses with RuntimeError (no per-element random slope is served). __all__ lists every available name.

NameKind

| functions | module functions |