plenoptic.loss.l2_norm#

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

Calculate the L2-norm of the difference between ref_rep and synth_rep.

For two tensors, \(x\) and \(y\), with \(n\) values each:

\[L2 = \sqrt{\sum_{i=1}^n (x_i - y_i)^2}\]
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 – The L2-norm of the difference between ref_rep and synth_rep.