PCGrad

class torchjd.aggregation.PCGrad[source]

Aggregator as defined in algorithm 1 of Gradient Surgery for Multi-Task Learning.

__call__(matrix, /)[source]

Computes the aggregation from the input matrix and applies all registered hooks.

Parameters:

matrix (Tensor) – The Jacobian to aggregate.

Return type:

Tensor

class torchjd.aggregation.PCGradWeighting[source]

Weighting giving the weights of PCGrad.

__call__(gramian, /)[source]

Computes the vector of weights from the input gramian and applies all registered hooks.

Parameters:

gramian (Tensor) – The gramian from which the weights must be extracted.

Return type:

Tensor