bendtorch
Search uses release 1.3.0.0 · 1,049 definitions
Definitions (1,049)
- type Fwdwhat a forward pass returns: the parameters, the output, what the backward pass will need
- type Bwdwhat a backward pass returns: the parameters, the gradient of the input, the accumulated gradient of the parameters
- type Twoa pair of owned values (parameters of two layers or their saved values)
- def Pair3Type helpers for the left-associated pairs used by Seq/Fork and for Residual's two parameter-free layers.
- def ResidualType
- type PTreeAdamW's moments stored as packed BF16 (CAdamWBF16): a tree that follows the parameters' pairs as the step walks them, with the buffers of each matrix at its leaf.
- type OptStateOwned optimizer buffers: SGD has none, momentum one, Adam/AdamW two (Packed: two, in packed BF16, see PTree).
- def OptState.mapTwo affine maps are supplied separately: each is called at most once.
- def OptState.splitA packed tree splits at its node; a part not yet stepped splits into two such parts.
- def OptState.joinPair the buffers present on both sides.
- type Stepwhat an optimizer step returns: the new parameters, the zeroed gradient, the optimizer state
- type OptThe optimizer, with the scalars of the current step.
- type PLParameters and their flat dump in a fixed order.
- type PALoading cursor: the shared source array and next element offset, handed back without a list or a clone.
- type Layer
- def Layer.fwd
- def Layer.bwd
- def Layer.step
- def Layer.zeros
- def Layer.dumpevery number of the parameters, in the layer's fixed order (the parameters handed back)
- def Layer.loadParameters overwritten from xs at an element offset, in dump order; xs and the next offset come back.
- def Layer.storeThe parameters copied into xs from an element offset, in dump order (load's inverse); xs and the next offset come back.
- def Layer.count
- def ew1_la[t] = f(a[t]) for the n numbers from t; ra holds the array and a[t], already read
- def ew2_la[t] = f(a[t], b[t]): the result replaces a; b comes back unchanged
- def Ew.map
- def ew2_fin
- def Ew.zip(f(a, b), b), element by element
- def f32_add
- def f32_mul
- def Mat.add(a + b, b)
- def zero_of
- def depth_gothe smallest d with 2^d >= n (TA.cap_depth's answer), by doubling a U32: log2(n) cheap steps, where cap_depth compares Nats one unit at a time at each doubling; f is fuel (32 doublings cover every U32)
- def depth
- type Q3
- type Q4
- type MatStep
- def sgd_lw <- w + (-lr)*g, as PyTorch's p.add_(g, alpha=-lr)
- def mom_lbuf <- buf*mu + g; w <- w + (-lr)*buf, as PyTorch's SGD with momentum (no dampening, not Nesterov)
- def adam_gradthe Adam family, in PyTorch's order of operations (torch.optim.adam._single_tensor_adam): g' = g + wd*w (Adam) or w' = w*(1 - lr*wd) (AdamW); m = m + (1-b1)*(g' - m) (lerp); v = v*b2 + (1-b2)*g'*g'; w = w' + (-step*m) / (sqrt(v)/bc2 + eps)
- def adam_decay
- def adam_mc1 = 1 - b1 and c2 = 1 - b2 are given as their own constants (0.1, 0.001), as PyTorch computes 1 - beta in float64 before rounding: 1 - b2 taken in F32 from b2 = 0.999 (0.99900001287 in F32) is 1.3e-5 too small, and over 100 steps that alone put the tiny Llama 21x further from float64 than PyTorch's float32 (NOTES, 2026-10-18)
- def adam_v
- def adam_w
- def adam_l