tf.contrib.gan.losses.wargs.cycle_consistency_loss( data_x, reconstructed_data_x, data_y, reconstructed_data_y, scope=None, add_summaries=False )
Defines the cycle consistency loss.
The cyclegan model has two partial models where
model_x2y generator F maps
data set X to Y,
model_y2x generator G maps data set Y to X. For a
in data set X, we could reconstruct it by
reconstructed_data_x = G(F(data_x))
reconstructed_data_y = F(G(data_y))
The cycle consistency loss is about the difference between data and
reconstructed data, namely
loss_x2x = |data_x - G(F(data_x))| (L1-norm)
loss_y2y = |data_y - F(G(data_y))| (L1-norm)
* loss = (loss_x2x + loss_y2y) / 2
loss is the final result.
See https://arxiv.org/abs/1703.10593 for more details.
Tensorof data X.
Tensorof reconstructed data X.
Tensorof data Y.
Tensorof reconstructed data Y.
scope: The scope for the operations performed in computing the loss. Defaults to None.
add_summaries: Whether or not to add detailed summaries for the loss. Defaults to False.
Tensor of cycle consistency loss.