p2pfl.learning.compression.lra_strategy moduleΒΆ

LRA compression strategy.

class p2pfl.learning.compression.lra_strategy.LowRankApproximation[source]ΒΆ

Bases: TensorCompressor

Low Rank optimization strategy.

apply_strategy(params, threshold=0.95)[source]ΒΆ

Approximate the parameters preserving a target rank or energy threshold.

Parameters:
  • params (list[ndarray]) – The parameters to compress.

  • threshold (float) – Percentage between 0 and 1 of the energy to preserve.

Return type:

tuple[list[ndarray], dict]

reverse_strategy(params, additional_info)[source]ΒΆ

Restore the payload by computing dot product of LRA components.

Parameters:
  • params (list[ndarray]) – The parameters to compress.

  • additional_info (dict) – Additional information to compress.

Return type:

list[ndarray]