Losses¶
Module name: qmlt.tf.losses
Code author: Maria Schuld <maria@xanadu.ai>
A collection of loss functions for tensorflow that are specific to quantum machine learning and optimization.
Summary¶
trace_distance (rho, sigma) 
Trace distance \(\frac{1}{2}\tr \{ \sqrt{ (\rho  \sigma})^2 \}\) between quantum states \(\rho\) and \(\sigma\). 
expectation (rho, operator) 
Expectation value \(\tr\{ \rho O\}\) of operator \(O\) with respect to the quantum state \(\rho\). 
Code details¶

qmlt.tf.losses.
trace_distance
(rho, sigma)[source]¶ Trace distance \(\frac{1}{2}\tr \{ \sqrt{ (\rho  \sigma})^2 \}\) between quantum states \(\rho\) and \(\sigma\).
The inputs and outputs are tensors of dtype float, and all computations support automatic differentiation.
Parameters:  rho (tf.Tensor) – 2dimensional Hermitian matrix representing state \(\rho\).
 sigma (tf.Tensor) – 2dimensional Hermitian matrix of the same dimensions and dtype as rho, representing state \(\sigma\).
Returns: Returns the scalar trace distance.
Return type: tf.Tensor

qmlt.tf.losses.
expectation
(rho, operator)[source]¶ Expectation value \(\tr\{ \rho O\}\) of operator \(O\) with respect to the quantum state \(\rho\).
The inputs and outputs are tensors of dtype float, and all computations support automatic differentiation.
Parameters:  rho (tf.Tensor) – 2dimensional Hermitian tensor representing state \(\rho\).
 operator (tf.Tensor) – 2dimensional Hermitian tensor of the same dimensions and dtype as rho.
Returns: Returns the scalar expectation value.
Return type: tf.Tensor