plenoptic.loss.relative_sse#

plenoptic.loss.relative_sse(synth_rep, ref_rep, **kwargs)[source]#

Calculate the relative sum of squared errors between two tensors.

This is the squared L2-norm of the difference between reference representation and synthesized representation relative to the squared L2-norm of the reference representation:

For two tensors, \(x\) and \(y\):

\[\frac{||x - y||_2^2}{||x||_2^2}\]

where \(x\) is ref_rep, \(x\) is synth_rep, and \(||x||_2\) is the L2-norm.

Parameters:
  • synth_rep (Tensor) – The first tensor to compare, model representation of the synthesized image.

  • ref_rep (Tensor) – The second tensor to compare, model representation of the reference image. must be same size as synth_rep.

  • **kwargs (Any) – Ignored, only present to absorb extra arguments.

Return type:

Tensor

Returns:

loss – Ratio of the squared l2-norm of the difference between ref_rep and synth_rep to the squared l2-norm of ref_rep.