Implementing kernel
C++ engine symbols that back this Python API.An nn.Linear with a BOFT rotation of its input and a scale of its output: .
boft_s is (out_features, 1).
Parameters
base_ layernn.LinearThe layer to adapt; the other parameters are those of
BOFTLayer.adapter_ namestrName of the first butterfly.
configBOFTConfigBlock size or count, butterfly factors, dropout,
init_weights.Examples
>>> import lucid
>>> import lucid.nn as nn
>>> from lucid.peft import BOFTConfig
>>> from lucid.peft.tuners.boft import Linear
>>> base = nn.Linear(8, 4)
>>> layer = Linear(base, "default", BOFTConfig(boft_block_size=4, target_modules=["x"]))
>>> tuple(layer.boft_R["default"].shape), tuple(layer.boft_s["default"].shape)
((1, 2, 4, 4), (4, 1))
>>> x = lucid.randn(3, 8)
>>> bool(lucid.allclose(layer(x), base(x), atol=1e-6)) # identity rotation, unit scale
True