Implementing kernel
C++ engine symbols that back this Python API.An nn.Linear whose output a RoAd rotation turns: .
Stackable: the rotation turns the output of whatever layer it stands on.
Parameters
base_ layernn.LinearThe layer to adapt; the other parameters are those of
RoadLayer.adapter_ namestrName of the first adapter.
configRoadConfigvariant, group_size and init_weights.Examples
>>> import lucid
>>> import lucid.nn as nn
>>> from lucid.peft import RoadConfig
>>> from lucid.peft.tuners.road import Linear
>>> base = nn.Linear(4, 8)
>>> layer = Linear(base, "default", RoadConfig(group_size=4, target_modules=["x"]))
>>> tuple(layer.road_theta["default"].shape), tuple(layer.road_alpha["default"].shape)
((4,), (4,))
>>> x = lucid.randn(3, 4)
>>> bool((layer(x) == base(x)).all().item()) # angle 0 and scale 1 start at the identity
True