tf.contrib.layers.rev_block
Stay organized with collections
Save and categorize content based on your preferences.
A block of reversible residual layers.
tf.contrib.layers.rev_block(
x1, x2, f, g, num_layers=1, f_side_input=None, g_side_input=None,
is_training=True
)
A reversible residual layer is defined as:
y1 = x1 + f(x2, f_side_input)
y2 = x2 + g(y1, g_side_input)
A reversible residual block, defined here, is a series of reversible residual
layers.
Limitations:
- f and g must not close over any Tensors; all side inputs to f and g should
be passed in with f_side_input and g_side_input which will be forwarded to
f and g.
- f and g must not change the dimensionality of their inputs in order for the
addition in the equations above to work.
Args |
x1
|
a float Tensor.
|
x2
|
a float Tensor.
|
f
|
a function, (Tensor) -> (Tensor) (or list of such of length num_layers).
Should not change the shape of the Tensor. Can make calls to get_variable.
See f_side_input if there are side inputs.
|
g
|
a function, (Tensor) -> (Tensor) (or list of such of length num_layers).
Should not change the shape of the Tensor. Can make calls to get_variable.
See g_side_input if there are side inputs.
|
num_layers
|
int, number of reversible residual layers. Each layer will
apply f and g according to the equations above, with new variables in each
layer.
|
f_side_input
|
list of Tensors, side input to f. If not None, signature of f
should be (Tensor, list) -> (Tensor).
|
g_side_input
|
list of Tensors, side input to g. If not None, signature of g
should be (Tensor, list) -> (Tensor).
|
is_training
|
bool, whether to actually use the efficient backprop codepath.
|
Returns |
y1, y2: tuple of float Tensors.
|
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.
Last updated 2020-10-01 UTC.
[null,null,["Last updated 2020-10-01 UTC."],[],[],null,["# tf.contrib.layers.rev_block\n\n\u003cbr /\u003e\n\n|---------------------------------------------------------------------------------------------------------------------------------------------------|\n| [View source on GitHub](https://github.com/tensorflow/tensorflow/blob/v1.15.0/tensorflow/contrib/layers/python/layers/rev_block_lib.py#L383-L439) |\n\nA block of reversible residual layers. \n\n tf.contrib.layers.rev_block(\n x1, x2, f, g, num_layers=1, f_side_input=None, g_side_input=None,\n is_training=True\n )\n\nA reversible residual layer is defined as: \n\n y1 = x1 + f(x2, f_side_input)\n y2 = x2 + g(y1, g_side_input)\n\nA reversible residual block, defined here, is a series of reversible residual\nlayers.\n\n#### Limitations:\n\n- f and g must not close over any Tensors; all side inputs to f and g should be passed in with f_side_input and g_side_input which will be forwarded to f and g.\n- f and g must not change the dimensionality of their inputs in order for the addition in the equations above to work.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ---- ||\n|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `x1` | a float Tensor. |\n| `x2` | a float Tensor. |\n| `f` | a function, (Tensor) -\\\u003e (Tensor) (or list of such of length num_layers). Should not change the shape of the Tensor. Can make calls to get_variable. See f_side_input if there are side inputs. |\n| `g` | a function, (Tensor) -\\\u003e (Tensor) (or list of such of length num_layers). Should not change the shape of the Tensor. Can make calls to get_variable. See g_side_input if there are side inputs. |\n| `num_layers` | int, number of reversible residual layers. Each layer will apply f and g according to the equations above, with new variables in each layer. |\n| `f_side_input` | list of Tensors, side input to f. If not None, signature of f should be (Tensor, list) -\\\u003e (Tensor). |\n| `g_side_input` | list of Tensors, side input to g. If not None, signature of g should be (Tensor, list) -\\\u003e (Tensor). |\n| `is_training` | bool, whether to actually use the efficient backprop codepath. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ------- ||\n|---|---|\n| y1, y2: tuple of float Tensors. ||\n\n\u003cbr /\u003e"]]