feat: add LiteralLinearTransformInitializer
This commit is contained in:
parent
784a963527
commit
08b3f9bbb9
@ -460,11 +460,19 @@ class AbstractDataAwareLTInitializer(AbstractLinearTransformInitializer):
|
||||
|
||||
class PCALinearTransformInitializer(AbstractDataAwareLTInitializer):
|
||||
"""Initialize a matrix with Eigenvectors from the data."""
|
||||
|
||||
def generate(self, in_dim: int, out_dim: int):
|
||||
_, _, weights = torch.pca_lowrank(self.data, q=out_dim)
|
||||
return self.generate_end_hook(weights)
|
||||
|
||||
|
||||
class LiteralLinearTransformInitializer(AbstractDataAwareLTInitializer):
|
||||
"""'Generate' the provided weights."""
|
||||
|
||||
def generate(self, in_dim: int, out_dim: int):
|
||||
return self.generate_end_hook(self.data)
|
||||
|
||||
|
||||
# Aliases - Components
|
||||
CACI = ClassAwareCompInitializer
|
||||
DACI = DataAwareCompInitializer
|
||||
@ -497,3 +505,4 @@ Eye = EyeTransformInitializer
|
||||
OLTI = OnesLinearTransformInitializer
|
||||
ZLTI = ZerosLinearTransformInitializer
|
||||
PCALTI = PCALinearTransformInitializer
|
||||
LLTI = LiteralLinearTransformInitializer
|
||||
|
Loading…
Reference in New Issue
Block a user