tfc.ops.perturb_and_apply
Stay organized with collections
Save and categorize content based on your preferences.
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
Args |
f
|
Callable. Pointwise function applied after perturbation.
|
x
|
The inputs.
|
*args
|
Other arguments to f.
|
u
|
The noise to perturb x with. If not set and x_plus_u is not provided,
it will be sampled.
|
x_plus_u
|
Alternative way to provide the noise, as x+u .
|
expected_grads
|
If True, will compute expected gradients.
|
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.
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[]]