Implementing kernel
C++ engine symbols that back this Python API.An nn.Linear with HRA reflections of its input: .
Parameters
Examples
>>> import lucid
>>> import lucid.nn as nn
>>> from lucid.peft import HRAConfig
>>> from lucid.peft.tuners.hra import Linear
>>> base = nn.Linear(8, 4)
>>> layer = Linear(base, "default", HRAConfig(r=2, target_modules=["x"]))
>>> tuple(layer.hra_u["default"].shape)
(8, 2)
>>> x = lucid.randn(3, 8)
>>> bool(lucid.allclose(layer(x), base(x), atol=1e-6)) # equal pairs of vectors cancel
True