View source on GitHub |
Perturbs the inputs of a pointwise function.
tfc.ops.perturb_and_apply(
f, x, *args, u=None, x_plus_u=None, expected_grads=True
)
This function adds uniform noise in the range -0.5 to 0.5 to the first argument of the given function. It further replaces derivatives of the function with (analytically computed) expected derivatives w.r.t. the noise.
This is described in Sec. 4.2. in the paper
"Universally Quantized Neural Compression"
Eirikur Agustsson & Lucas Theis
https://arxiv.org/abs/2006.09952
Returns | |
---|---|
A tuple (y, x+u) where y=f(x+u, *args) and u is uniform noise, and the
gradient of y w.r.t. x uses expected derivatives w.r.t. the distribution
of u.
|