BayesFlow Stochastic Graph (contrib)
Classes and helper functions for Stochastic Computation Graphs.
Stochastic Computation Graph Helper Functions
tf.contrib.bayesflow.stochastic_graph.surrogate_loss(sample_losses, stochastic_tensors=None, name='SurrogateLoss')
Surrogate loss for stochastic graphs.
This function will call
loss_fn on each
sample_losses, passing the losses that it influenced.
Note that currently
surrogate_loss does not work with
while_loops or other control structures.
sample_losses: a list or tuple of final losses. Each loss should be per example in the batch (and possibly per sample); that is, it should have dimensionality of 1 or greater. All losses should have the same shape.
stochastic_tensors: a list of
StochasticTensors to add loss terms for. If None, defaults to all
StochasticTensors in the graph upstream of the
name: the name with which to prepend created ops.
Tensor loss, which is the sum of
sample_losses and the
loss_fns returned by the
sample_lossesis not a list or tuple, or if its elements are not
ValueError: if any loss in
sample_lossesdoes not have dimensionality 1 or greater.