template of the same scope/unique_name already exists and reuse is false,
an error is raised. Defaults to None.
**kwargs: Keyword arguments to apply to func_
.
Returns:
A function to encapsulate a set of variables which should be created once
and reused. An enclosing scope will created, either where make_template
is called, or wherever the result is called, depending on the value of
create_scope_now_
. Regardless of the value, the first time the template
is called it will enter the scope with no reuse, and call func_
to create
variables, which are guaranteed to be unique. All subsequent calls will
re-enter the scope and reuse those variables.
Raises: ValueError: if the name is None.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def make_template_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.make_template_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.make_template_layer
Return
Applicative
Origial documentation for Builder.make_template_layer
def make_template_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.make_template, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.make_template
def make_template(name_, func_, create_scope_now_=False, unique_name_=None):
Given an arbitrary function, wrap it so that it does variable sharing.
This wraps func_
in a Template and partially evaluates it. Templates are
functions that create variables the first time they are called and reuse them
thereafter. In order for func_
to be compatible with a Template
it must
have the following properties:
- The function should create all trainable variables and any variables that
should be reused by calling
tf.get_variable
. If a trainable variable is created usingtf.Variable
, then a ValueError will be thrown. Variables that are intended to be locals can be created by specifyingtf.Variable(..., trainable=false)
. - The function may use variable scopes and other templates internally to
create and reuse variables, but it shouldn't use
tf.get_variables
to capture variables that are defined outside of the scope of the function. - Internal scopes and variable names should not depend on any arguments that
are not supplied to
make_template
. In general you will get a ValueError telling you that you are trying to reuse a variable that doesn't exist if you make a mistake.
In the following example, both z
and w
will be scaled by the same y
. It
is important to note that if we didn't assign scalar_name
and used a
different name for z and w that a ValueError
would be thrown because it
couldn't reuse the variable.
```python def my_op(x, scalar_name): var1 = tf.get_variable(scalar_name, shape=[], initializer=tf.constant_initializer(1)) return x * var1
scale_by_y = tf.make_template('scale_by_y', my_op, scalar_name='y')
z = scale_by_y(input1) w = scale_by_y(input2) ```
As a safe-guard, the returned function will raise a ValueError
after the
first call if trainable variables are created by calling tf.Variable
.
If all of these are true, then 2 properties are enforced by the template:
- Calling the same template multiple times will share all non-local variables.
- Two different templates are guaranteed to be unique, unless you reenter the same variable scope as the initial definition of a template and redefine it. An examples of this exception:
```python def my_op(x, scalar_name): var1 = tf.get_variable(scalar_name, shape=[], initializer=tf.constant_initializer(1)) return x * var1
with tf.variable_scope('scope') as vs: scale_by_y = tf.make_template('scale_by_y', my_op, scalar_name='y') z = scale_by_y(input1) w = scale_by_y(input2)
Creates a template that reuses the variables above.
with tf.variable_scope(vs, reuse=True): scale_by_y2 = tf.make_template('scale_by_y', my_op, scalar_name='y') z2 = scale_by_y2(input1) w2 = scale_by_y2(input2) ```
Depending on the value of create_scope_now_
, the full variable scope may be
captured either at the time of first call or at the time of construction. If
this option is set to True, then all Tensors created by repeated calls to the
template will have an extra trailing _N+1 to their name, as the first time the
scope is entered in the Template constructor no Tensors are created.
Note: name_
, func_
and create_scope_now_
have a trailing underscore to
reduce the likelihood of collisions with kwargs.
Args:
name_: A name for the scope created by this template. If necessary, the name
will be made unique by appending _N
to the name.
func_: The function to wrap.
create_scope_now_: Boolean controlling whether the scope should be created
when the template is constructed or when the template is called. Default
is False, meaning the scope is created when the template is called.
unique_name_: When used, it overrides name_ and is not made unique. If a
template of the same scope/unique_name already exists and reuse is false,
an error is raised. Defaults to None.
**kwargs: Keyword arguments to apply to func_
.
Returns:
A function to encapsulate a set of variables which should be created once
and reused. An enclosing scope will created, either where make_template
is called, or wherever the result is called, depending on the value of
create_scope_now_
. Regardless of the value, the first time the template
is called it will enter the scope with no reuse, and call func_
to create
variables, which are guaranteed to be unique. All subsequent calls will
re-enter the scope and reuse those variables.
Raises: ValueError: if the name is None.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def map(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.map, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.map
Return
Applicative
Origial documentation for Builder.map
def map(builder, fn):
@immutable
Let x be Tensor inside a Builder builder
and fn be a function from a tensor to a tensor, then builder.map(fn, \*args, **kwargs)
computes fn(x, *args, **kwargs) and stores the result inside a Builder
. The Builder class comes with a lot of patched methods that help you do things quickly and make the syntax nicer, but if we don't have the method you need just pass the function you want to use to map
, or even consider using tensorbuilder.core.builders.Builder.register_map_method
.
Parameters
fn
: a function of typetensor -> tensor
.- All extra positional and named arguments are forwarded to
fn
Return
tensorbuilder.core.builders.Builder
Examples
import tensorflow as tf from tensorflow.contrib import layers from tensorbuilder import tb x = tf.placeholder(tf.float32, shape=[None, 40]) keep_prob = tf.placeholder(tf.float32) h = ( tb.build(x) .map(layers.fully_connected, 100, activation_fn=tf.nn.tanh) .map(tf.nn.dropout, keep_prob) .map(layers.fully_connected, 30, activation_fn=tf.nn.softmax) .tensor() ) print(h)
Same using the DSL
import tensorflow as tf from tensorflow.contrib import layers from tensorbuilder import tb x = tf.placeholder(tf.float32, shape=[None, 40]) keep_prob = tf.placeholder(tf.float32) h = tb.pipe( x, tb.map(layers.fully_connected, 100, activation_fn=tf.nn.tanh) .map(tf.nn.dropout, keep_prob) .map(layers.fully_connected, 30, activation_fn=tf.nn.softmax) .tensor() ) print(h)
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def map_each(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(BuilderTree.map_each, ...)
Arguments
- All other *args and **kwargs are forwarded to
BuilderTree.map_each
Return
Applicative
Origial documentation for BuilderTree.map_each
def map_each(tree, fn):
@immutable
Expects a function fn with type Tensor -> Tensor
and applies this function to all leaf Tensors separately, resulting in a new BuilderTree.
Parameters
fn
: a function of typeTensor -> Tensor
.- All additional *args and **kwargs are forwarded to
fn
Return
tensorbuilder.core.builders.BuilderTree
Example
Lets redu the example in tensorbuilder.core.builders.BuilderTree.reduce
using map_each
to reduce some code
import tensorflow as tf from tensorbuilder import tb x = placeholder(tf.float32, shape=[None, 10]) h = ( tb.build(x) .branch(lambda x: [ x.relu_layer(20) , x.sigmoid_layer(20) , x.tanh_layer(20) ]) .map_each(tf.contrib.layers.fully_connected, 5, activation_fn=None) .reduce(tf.add) .softmax() .tensor() )
Remember that this
.map_each(tf.contrib.layers.fully_connected, 5, activation_fn=None) .reduce(tf.add) .softmax()
is equivalent to just
.softmax_layer(5)
for BuilderTree
s. Same example using the DSL
import tensorflow as tf from tensorbuilder import tb x = placeholder(tf.float32, shape=[None, 10]) h = tb.pipe( x, [ x.relu_layer(20) , x.sigmoid_layer(20) , x.tanh_layer(20) ], tb.map_each(tf.contrib.layers.fully_connected, 5, activation_fn=None) .reduce(tf.add) .softmax() .tensor() )
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def map_fn(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.map_fn, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.map_fn
Return
Applicative
Origial documentation for Builder.map_fn
def map_fn(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.map_fn
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.map_fn
def map_fn(fn, elems, dtype=None, parallel_iterations=10, back_prop=True, swap_memory=False, infer_shape=True, name=None)
map on the list of tensors unpacked from elems
on dimension 0.
The simplest version of map
repeatedly applies the callable fn
to a
sequence of elements from first to last. The elements are made of the
tensors unpacked from elems
. dtype
is the data type of the return
value of fn
. Users must provide dtype
if it is different from
the data type of elems
.
Suppose that elems
is unpacked into values
, a list of tensors. The shape
of the result tensor is [values.shape[0]] + fn(values[0]).shape
.
This method also allows multi-arity elems
and output of fn
. If elems
is a (possibly nested) list or tuple of tensors, then each of these tensors
must have a matching first (unpack) dimension. The signature of fn
may
match the structure of elems
. That is, if elems
is
(t1, [t2, t3, [t4, t5]])
, then an appropriate signature for fn
is:
fn = lambda (t1, [t2, t3, [t4, t5]]):
.
Furthermore, fn
may emit a different structure than its input. For example,
fn
may look like: fn = lambda t1: return (t1 + 1, t1 - 1)
. In this case,
the dtype
parameter is not optional: dtype
must be a type or (possibly
nested) tuple of types matching the output of fn
.
Args:
fn: The callable to be performed. It accepts one argument, which will
have the same (possibly nested) structure as elems
. Its output
must have the same structure as dtype
if one is provided, otherwise
it must have the same structure as elems
.
elems: A tensor or (possibly nested) sequence of tensors, each of which
will be unpacked along their first dimension. The nested sequence
of the resulting slices will be applied to fn
.
dtype: (optional) The output type(s) of fn
. If fn
returns a structure
of Tensors differing from the structure of elems
, then dtype
is not
optional and must have the same structure as the output of fn
.
parallel_iterations: (optional) The number of iterations allowed to run
in parallel.
back_prop: (optional) True enables support for back propagation.
swap_memory: (optional) True enables GPU-CPU memory swapping.
infer_shape: (optional) False disables tests for consistent output shapes.
name: (optional) Name prefix for the returned tensors.
Returns:
A tensor or (possibly nested) sequence of tensors. Each tensor packs the
results of applying fn
to tensors unpacked from elems
along the first
dimension, from first to last.
Raises:
TypeError: if fn
is not callable or the structure of the output of
fn
and dtype
do not match.
ValueError: if the lengths of the output of fn
and dtype
do not match.
Examples:
python
elems = np.array([1, 2, 3, 4, 5, 6])
squares = map_fn(lambda x: x * x, elems)
# squares == [1, 4, 9, 16, 25, 36]
python
elems = (np.array([1, 2, 3]), np.array([-1, 1, -1]))
alternate = map_fn(lambda x: x[0] * x[1], elems, dtype=tf.int64)
# alternate == [-1, 2, -3]
python
elems = np.array([1, 2, 3])
alternates = map_fn(lambda x: (x, -x), elems, dtype=(tf.int64, tf.int64))
# alternates[0] == [1, 2, 3]
# alternates[1] == [-1, -2, -3]
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def map_fn_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.map_fn_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.map_fn_layer
Return
Applicative
Origial documentation for Builder.map_fn_layer
def map_fn_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.map_fn, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.map_fn
def map_fn(fn, elems, dtype=None, parallel_iterations=10, back_prop=True, swap_memory=False, infer_shape=True, name=None):
map on the list of tensors unpacked from elems
on dimension 0.
The simplest version of map
repeatedly applies the callable fn
to a
sequence of elements from first to last. The elements are made of the
tensors unpacked from elems
. dtype
is the data type of the return
value of fn
. Users must provide dtype
if it is different from
the data type of elems
.
Suppose that elems
is unpacked into values
, a list of tensors. The shape
of the result tensor is [values.shape[0]] + fn(values[0]).shape
.
This method also allows multi-arity elems
and output of fn
. If elems
is a (possibly nested) list or tuple of tensors, then each of these tensors
must have a matching first (unpack) dimension. The signature of fn
may
match the structure of elems
. That is, if elems
is
(t1, [t2, t3, [t4, t5]])
, then an appropriate signature for fn
is:
fn = lambda (t1, [t2, t3, [t4, t5]]):
.
Furthermore, fn
may emit a different structure than its input. For example,
fn
may look like: fn = lambda t1: return (t1 + 1, t1 - 1)
. In this case,
the dtype
parameter is not optional: dtype
must be a type or (possibly
nested) tuple of types matching the output of fn
.
Args:
fn: The callable to be performed. It accepts one argument, which will
have the same (possibly nested) structure as elems
. Its output
must have the same structure as dtype
if one is provided, otherwise
it must have the same structure as elems
.
elems: A tensor or (possibly nested) sequence of tensors, each of which
will be unpacked along their first dimension. The nested sequence
of the resulting slices will be applied to fn
.
dtype: (optional) The output type(s) of fn
. If fn
returns a structure
of Tensors differing from the structure of elems
, then dtype
is not
optional and must have the same structure as the output of fn
.
parallel_iterations: (optional) The number of iterations allowed to run
in parallel.
back_prop: (optional) True enables support for back propagation.
swap_memory: (optional) True enables GPU-CPU memory swapping.
infer_shape: (optional) False disables tests for consistent output shapes.
name: (optional) Name prefix for the returned tensors.
Returns:
A tensor or (possibly nested) sequence of tensors. Each tensor packs the
results of applying fn
to tensors unpacked from elems
along the first
dimension, from first to last.
Raises:
TypeError: if fn
is not callable or the structure of the output of
fn
and dtype
do not match.
ValueError: if the lengths of the output of fn
and dtype
do not match.
Examples:
python
elems = np.array([1, 2, 3, 4, 5, 6])
squares = map_fn(lambda x: x * x, elems)
# squares == [1, 4, 9, 16, 25, 36]
python
elems = (np.array([1, 2, 3]), np.array([-1, 1, -1]))
alternate = map_fn(lambda x: x[0] * x[1], elems, dtype=tf.int64)
# alternate == [-1, 2, -3]
python
elems = np.array([1, 2, 3])
alternates = map_fn(lambda x: (x, -x), elems, dtype=(tf.int64, tf.int64))
# alternates[0] == [1, 2, 3]
# alternates[1] == [-1, -2, -3]
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matching_files(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matching_files, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matching_files
Return
Applicative
Origial documentation for Builder.matching_files
def matching_files(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matching_files
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matching_files
def matching_files(pattern, name=None)
Returns the set of files matching a pattern.
Note that this routine only supports wildcard characters in the basename portion of the pattern, not in the directory portion.
Args:
pattern: A Tensor
of type string
. A (scalar) shell wildcard pattern.
name: A name for the operation (optional).
Returns:
A Tensor
of type string
. A vector of matching filenames.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matching_files_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matching_files_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matching_files_layer
Return
Applicative
Origial documentation for Builder.matching_files_layer
def matching_files_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matching_files, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matching_files
def matching_files(pattern, name=None):
Returns the set of files matching a pattern.
Note that this routine only supports wildcard characters in the basename portion of the pattern, not in the directory portion.
Args:
pattern: A Tensor
of type string
. A (scalar) shell wildcard pattern.
name: A name for the operation (optional).
Returns:
A Tensor
of type string
. A vector of matching filenames.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matmul(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matmul, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matmul
Return
Applicative
Origial documentation for Builder.matmul
def matmul(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matmul
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matmul
def matmul(a, b, transpose_a=False, transpose_b=False, a_is_sparse=False, b_is_sparse=False, name=None)
Multiplies matrix a
by matrix b
, producing a
* b
.
The inputs must be two-dimensional matrices, with matching inner dimensions, possibly after transposition.
Both matrices must be of the same type. The supported types are:
float32
, float64
, int32
, complex64
.
Either matrix can be transposed on the fly by setting the corresponding flag
to True
. This is False
by default.
If one or both of the matrices contain a lot of zeros, a more efficient
multiplication algorithm can be used by setting the corresponding
a_is_sparse
or b_is_sparse
flag to True
. These are False
by default.
For example:
```python
2-D tensor a
a = tf.constant([1, 2, 3, 4, 5, 6], shape=[2, 3]) => [[1. 2. 3.] [4. 5. 6.]]
2-D tensor b
b = tf.constant([7, 8, 9, 10, 11, 12], shape=[3, 2]) => [[7. 8.] [9. 10.] [11. 12.]] c = tf.matmul(a, b) => [[58 64] [139 154]] ```
Args:
a: Tensor
of type float32
, float64
, int32
or complex64
.
b: Tensor
with same type as a
.
transpose_a: If True
, a
is transposed before multiplication.
transpose_b: If True
, b
is transposed before multiplication.
a_is_sparse: If True
, a
is treated as a sparse matrix.
b_is_sparse: If True
, b
is treated as a sparse matrix.
name: Name for the operation (optional).
Returns:
A Tensor
of the same type as a
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matmul_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matmul_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matmul_layer
Return
Applicative
Origial documentation for Builder.matmul_layer
def matmul_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matmul, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matmul
def matmul(a, b, transpose_a=False, transpose_b=False, a_is_sparse=False, b_is_sparse=False, name=None):
Multiplies matrix a
by matrix b
, producing a
* b
.
The inputs must be two-dimensional matrices, with matching inner dimensions, possibly after transposition.
Both matrices must be of the same type. The supported types are:
float32
, float64
, int32
, complex64
.
Either matrix can be transposed on the fly by setting the corresponding flag
to True
. This is False
by default.
If one or both of the matrices contain a lot of zeros, a more efficient
multiplication algorithm can be used by setting the corresponding
a_is_sparse
or b_is_sparse
flag to True
. These are False
by default.
For example:
```python
2-D tensor a
a = tf.constant([1, 2, 3, 4, 5, 6], shape=[2, 3]) => [[1. 2. 3.] [4. 5. 6.]]
2-D tensor b
b = tf.constant([7, 8, 9, 10, 11, 12], shape=[3, 2]) => [[7. 8.] [9. 10.] [11. 12.]] c = tf.matmul(a, b) => [[58 64] [139 154]] ```
Args:
a: Tensor
of type float32
, float64
, int32
or complex64
.
b: Tensor
with same type as a
.
transpose_a: If True
, a
is transposed before multiplication.
transpose_b: If True
, b
is transposed before multiplication.
a_is_sparse: If True
, a
is treated as a sparse matrix.
b_is_sparse: If True
, b
is treated as a sparse matrix.
name: Name for the operation (optional).
Returns:
A Tensor
of the same type as a
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_band_part(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_band_part, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_band_part
Return
Applicative
Origial documentation for Builder.matrix_band_part
def matrix_band_part(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matrix_band_part
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matrix_band_part
def matrix_band_part(input, num_lower, num_upper, name=None)
Copy a tensor setting everything outside a central band in each innermost matrix
to zero.
The band
part is computed as follows:
Assume input
has k
dimensions [I, J, K, ..., M, N]
, then the output is a
tensor with the same shape where
band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]
.
The indicator function 'in_band(m, n)is one if
(num_lower < 0 || (m-n) <= num_lower)) &&
(num_upper < 0 || (n-m) <= num_upper)`, and zero otherwise.
For example:
```prettyprint
if 'input' is [[ 0, 1, 2, 3]
[-1, 0, 1, 2] [-2, -1, 0, 1] [-3, -2, -1, 0]],
tf.matrix_band_part(input, 1, -1) ==> [[ 0, 1, 2, 3] [-1, 0, 1, 2] [ 0, -1, 0, 1] [ 0, 0, -1, 0]],
tf.matrix_band_part(input, 2, 1) ==> [[ 0, 1, 0, 0] [-1, 0, 1, 0] [-2, -1, 0, 1] [ 0, -2, -1, 0]] ```
Useful special cases:
prettyprint
tf.matrix_band_part(input, 0, -1) ==> Upper triangular part.
tf.matrix_band_part(input, -1, 0) ==> Lower triangular part.
tf.matrix_band_part(input, 0, 0) ==> Diagonal.
Args:
input: A Tensor
. Rank k
tensor.
num_lower: A Tensor
of type int64
.
0-D tensor. Number of subdiagonals to keep. If negative, keep entire
lower triangle.
num_upper: A Tensor
of type int64
.
0-D tensor. Number of superdiagonals to keep. If negative, keep
entire upper triangle.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
Rank k
tensor of the same shape as input. The extracted banded tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_band_part_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_band_part_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_band_part_layer
Return
Applicative
Origial documentation for Builder.matrix_band_part_layer
def matrix_band_part_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matrix_band_part, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matrix_band_part
def matrix_band_part(input, num_lower, num_upper, name=None):
Copy a tensor setting everything outside a central band in each innermost matrix
to zero.
The band
part is computed as follows:
Assume input
has k
dimensions [I, J, K, ..., M, N]
, then the output is a
tensor with the same shape where
band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]
.
The indicator function 'in_band(m, n)is one if
(num_lower < 0 || (m-n) <= num_lower)) &&
(num_upper < 0 || (n-m) <= num_upper)`, and zero otherwise.
For example:
```prettyprint
if 'input' is [[ 0, 1, 2, 3]
[-1, 0, 1, 2] [-2, -1, 0, 1] [-3, -2, -1, 0]],
tf.matrix_band_part(input, 1, -1) ==> [[ 0, 1, 2, 3] [-1, 0, 1, 2] [ 0, -1, 0, 1] [ 0, 0, -1, 0]],
tf.matrix_band_part(input, 2, 1) ==> [[ 0, 1, 0, 0] [-1, 0, 1, 0] [-2, -1, 0, 1] [ 0, -2, -1, 0]] ```
Useful special cases:
prettyprint
tf.matrix_band_part(input, 0, -1) ==> Upper triangular part.
tf.matrix_band_part(input, -1, 0) ==> Lower triangular part.
tf.matrix_band_part(input, 0, 0) ==> Diagonal.
Args:
input: A Tensor
. Rank k
tensor.
num_lower: A Tensor
of type int64
.
0-D tensor. Number of subdiagonals to keep. If negative, keep entire
lower triangle.
num_upper: A Tensor
of type int64
.
0-D tensor. Number of superdiagonals to keep. If negative, keep
entire upper triangle.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
Rank k
tensor of the same shape as input. The extracted banded tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_determinant(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_determinant, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_determinant
Return
Applicative
Origial documentation for Builder.matrix_determinant
def matrix_determinant(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matrix_determinant
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matrix_determinant
def matrix_determinant(input, name=None)
Computes the determinant of one ore more square matrices.
The input is a tensor of shape [..., M, M]
whose inner-most 2 dimensions
form square matrices. The output is a tensor containing the determinants
for all input submatrices [..., :, :]
.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
.
Shape is [..., M, M]
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
. Shape is [...]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_determinant_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_determinant_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_determinant_layer
Return
Applicative
Origial documentation for Builder.matrix_determinant_layer
def matrix_determinant_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matrix_determinant, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matrix_determinant
def matrix_determinant(input, name=None):
Computes the determinant of one ore more square matrices.
The input is a tensor of shape [..., M, M]
whose inner-most 2 dimensions
form square matrices. The output is a tensor containing the determinants
for all input submatrices [..., :, :]
.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
.
Shape is [..., M, M]
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
. Shape is [...]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_diag(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_diag, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_diag
Return
Applicative
Origial documentation for Builder.matrix_diag
def matrix_diag(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matrix_diag
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matrix_diag
def matrix_diag(diagonal, name=None)
Returns a batched diagonal tensor with a given batched diagonal values.
Given a diagonal
, this operation returns a tensor with the diagonal
and
everything else padded with zeros. The diagonal is computed as follows:
Assume diagonal
has k
dimensions [I, J, K, ..., N]
, then the output is a
tensor of rank k+1
with dimensions [I, J, K, ..., N, N]` where:
output[i, j, k, ..., m, n] = 1{m=n} * diagonal[i, j, k, ..., n]
.
For example:
```prettyprint
'diagonal' is [[1, 2, 3, 4], [5, 6, 7, 8]]
and diagonal.shape = (2, 4)
tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0] [0, 2, 0, 0] [0, 0, 3, 0] [0, 0, 0, 4]], [[5, 0, 0, 0] [0, 6, 0, 0] [0, 0, 7, 0] [0, 0, 0, 8]]]
which has shape (2, 4, 4) ```
Args:
diagonal: A Tensor
. Rank k
, where k >= 1
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as diagonal
.
Rank k+1
, with output.shape = diagonal.shape + [diagonal.shape[-1]]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_diag_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_diag_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_diag_layer
Return
Applicative
Origial documentation for Builder.matrix_diag_layer
def matrix_diag_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matrix_diag, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matrix_diag
def matrix_diag(diagonal, name=None):
Returns a batched diagonal tensor with a given batched diagonal values.
Given a diagonal
, this operation returns a tensor with the diagonal
and
everything else padded with zeros. The diagonal is computed as follows:
Assume diagonal
has k
dimensions [I, J, K, ..., N]
, then the output is a
tensor of rank k+1
with dimensions [I, J, K, ..., N, N]` where:
output[i, j, k, ..., m, n] = 1{m=n} * diagonal[i, j, k, ..., n]
.
For example:
```prettyprint
'diagonal' is [[1, 2, 3, 4], [5, 6, 7, 8]]
and diagonal.shape = (2, 4)
tf.matrix_diag(diagonal) ==> [[[1, 0, 0, 0] [0, 2, 0, 0] [0, 0, 3, 0] [0, 0, 0, 4]], [[5, 0, 0, 0] [0, 6, 0, 0] [0, 0, 7, 0] [0, 0, 0, 8]]]
which has shape (2, 4, 4) ```
Args:
diagonal: A Tensor
. Rank k
, where k >= 1
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as diagonal
.
Rank k+1
, with output.shape = diagonal.shape + [diagonal.shape[-1]]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_diag_part(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_diag_part, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_diag_part
Return
Applicative
Origial documentation for Builder.matrix_diag_part
def matrix_diag_part(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matrix_diag_part
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matrix_diag_part
def matrix_diag_part(input, name=None)
Returns the batched diagonal part of a batched tensor.
This operation returns a tensor with the diagonal
part
of the batched input
. The diagonal
part is computed as follows:
Assume input
has k
dimensions [I, J, K, ..., N, N]
, then the output is a
tensor of rank k - 1
with dimensions [I, J, K, ..., N]
where:
diagonal[i, j, k, ..., n] = input[i, j, k, ..., n, n]
.
The input must be at least a matrix.
For example:
```prettyprint
'input' is [[[1, 0, 0, 0]
[0, 2, 0, 0] [0, 0, 3, 0] [0, 0, 0, 4]], [[5, 0, 0, 0] [0, 6, 0, 0] [0, 0, 7, 0] [0, 0, 0, 8]]]
and input.shape = (2, 4, 4)
tf.matrix_diag_part(input) ==> [[1, 2, 3, 4], [5, 6, 7, 8]]
which has shape (2, 4) ```
Args:
input: A Tensor
.
Rank k
tensor where k >= 2
and the last two dimensions are equal.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
The extracted diagonal(s) having shape
diagonal.shape = input.shape[:-1]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_diag_part_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_diag_part_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_diag_part_layer
Return
Applicative
Origial documentation for Builder.matrix_diag_part_layer
def matrix_diag_part_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matrix_diag_part, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matrix_diag_part
def matrix_diag_part(input, name=None):
Returns the batched diagonal part of a batched tensor.
This operation returns a tensor with the diagonal
part
of the batched input
. The diagonal
part is computed as follows:
Assume input
has k
dimensions [I, J, K, ..., N, N]
, then the output is a
tensor of rank k - 1
with dimensions [I, J, K, ..., N]
where:
diagonal[i, j, k, ..., n] = input[i, j, k, ..., n, n]
.
The input must be at least a matrix.
For example:
```prettyprint
'input' is [[[1, 0, 0, 0]
[0, 2, 0, 0] [0, 0, 3, 0] [0, 0, 0, 4]], [[5, 0, 0, 0] [0, 6, 0, 0] [0, 0, 7, 0] [0, 0, 0, 8]]]
and input.shape = (2, 4, 4)
tf.matrix_diag_part(input) ==> [[1, 2, 3, 4], [5, 6, 7, 8]]
which has shape (2, 4) ```
Args:
input: A Tensor
.
Rank k
tensor where k >= 2
and the last two dimensions are equal.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
The extracted diagonal(s) having shape
diagonal.shape = input.shape[:-1]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_inverse(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_inverse, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_inverse
Return
Applicative
Origial documentation for Builder.matrix_inverse
def matrix_inverse(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matrix_inverse
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matrix_inverse
def matrix_inverse(input, adjoint=None, name=None)
Computes the inverse of one or more square invertible matrices or their
adjoints (conjugate transposes).
The input is a tensor of shape [..., M, M]
whose inner-most 2 dimensions
form square matrices. The output is a tensor of the same shape as the input
containing the inverse for all input submatrices [..., :, :]
.
The op uses LU decomposition with partial pivoting to compute the inverses.
If a matrix is not invertible there is no guarantee what the op does. It may detect the condition and raise an exception or it may simply return a garbage result.
Args:
input: A Tensor
. Must be one of the following types: float64
, float32
.
Shape is [..., M, M]
.
adjoint: An optional bool
. Defaults to False
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
. Shape is [..., M, M]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_inverse_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_inverse_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_inverse_layer
Return
Applicative
Origial documentation for Builder.matrix_inverse_layer
def matrix_inverse_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matrix_inverse, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matrix_inverse
def matrix_inverse(input, adjoint=None, name=None):
Computes the inverse of one or more square invertible matrices or their
adjoints (conjugate transposes).
The input is a tensor of shape [..., M, M]
whose inner-most 2 dimensions
form square matrices. The output is a tensor of the same shape as the input
containing the inverse for all input submatrices [..., :, :]
.
The op uses LU decomposition with partial pivoting to compute the inverses.
If a matrix is not invertible there is no guarantee what the op does. It may detect the condition and raise an exception or it may simply return a garbage result.
Args:
input: A Tensor
. Must be one of the following types: float64
, float32
.
Shape is [..., M, M]
.
adjoint: An optional bool
. Defaults to False
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
. Shape is [..., M, M]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_set_diag(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_set_diag, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_set_diag
Return
Applicative
Origial documentation for Builder.matrix_set_diag
def matrix_set_diag(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matrix_set_diag
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matrix_set_diag
def matrix_set_diag(input, diagonal, name=None)
Returns a batched matrix tensor with new batched diagonal values.
Given input
and diagonal
, this operation returns a tensor with the
same shape and values as input
, except for the diagonals of the innermost
matrices. These will be overwritten by the values in diagonal
.
The batched matrices must be square.
The output is computed as follows:
Assume input
has k+1
dimensions [I, J, K, ..., N, N]
and diagonal
has
k
dimensions [I, J, K, ..., N]
. Then the output is a
tensor of rank k+1
with dimensions [I, J, K, ..., N, N]` where:
output[i, j, k, ..., m, n] = diagonal[i, j, k, ..., n]
form == n
.output[i, j, k, ..., m, n] = input[i, j, k, ..., m, n]
form != n
.
Args:
input: A Tensor
. Rank k+1
, where k >= 1
.
diagonal: A Tensor
. Must have the same type as input
.
Rank k
, where k >= 1
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
Rank k+1
, with output.shape = input.shape
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_set_diag_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_set_diag_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_set_diag_layer
Return
Applicative
Origial documentation for Builder.matrix_set_diag_layer
def matrix_set_diag_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matrix_set_diag, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matrix_set_diag
def matrix_set_diag(input, diagonal, name=None):
Returns a batched matrix tensor with new batched diagonal values.
Given input
and diagonal
, this operation returns a tensor with the
same shape and values as input
, except for the diagonals of the innermost
matrices. These will be overwritten by the values in diagonal
.
The batched matrices must be square.
The output is computed as follows:
Assume input
has k+1
dimensions [I, J, K, ..., N, N]
and diagonal
has
k
dimensions [I, J, K, ..., N]
. Then the output is a
tensor of rank k+1
with dimensions [I, J, K, ..., N, N]` where:
output[i, j, k, ..., m, n] = diagonal[i, j, k, ..., n]
form == n
.output[i, j, k, ..., m, n] = input[i, j, k, ..., m, n]
form != n
.
Args:
input: A Tensor
. Rank k+1
, where k >= 1
.
diagonal: A Tensor
. Must have the same type as input
.
Rank k
, where k >= 1
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
Rank k+1
, with output.shape = input.shape
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_solve(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_solve, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_solve
Return
Applicative
Origial documentation for Builder.matrix_solve
def matrix_solve(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matrix_solve
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matrix_solve
def matrix_solve(matrix, rhs, adjoint=None, name=None)
Solves systems of linear equations.
Matrix
is a tensor of shape [..., M, M]
whose inner-most 2 dimensions
form square matrices. Rhs
is a tensor of shape [..., M, K]
. The output
is
a tensor shape [..., M, K]
. If adjoint
is False
then each output matrix
satisfies matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]
.
If adjoint
is True
then each output matrix satisfies
adjoint(matrix[..., :, :]) * output[..., :, :] = rhs[..., :, :]
.
Args:
matrix: A Tensor
. Must be one of the following types: float64
, float32
.
Shape is [..., M, M]
.
rhs: A Tensor
. Must have the same type as matrix
.
Shape is [..., M, K]
.
adjoint: An optional bool
. Defaults to False
.
Boolean indicating whether to solve with matrix
or its (block-wise)
adjoint.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as matrix
. Shape is [..., M, K]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_solve_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_solve_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_solve_layer
Return
Applicative
Origial documentation for Builder.matrix_solve_layer
def matrix_solve_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matrix_solve, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matrix_solve
def matrix_solve(matrix, rhs, adjoint=None, name=None):
Solves systems of linear equations.
Matrix
is a tensor of shape [..., M, M]
whose inner-most 2 dimensions
form square matrices. Rhs
is a tensor of shape [..., M, K]
. The output
is
a tensor shape [..., M, K]
. If adjoint
is False
then each output matrix
satisfies matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]
.
If adjoint
is True
then each output matrix satisfies
adjoint(matrix[..., :, :]) * output[..., :, :] = rhs[..., :, :]
.
Args:
matrix: A Tensor
. Must be one of the following types: float64
, float32
.
Shape is [..., M, M]
.
rhs: A Tensor
. Must have the same type as matrix
.
Shape is [..., M, K]
.
adjoint: An optional bool
. Defaults to False
.
Boolean indicating whether to solve with matrix
or its (block-wise)
adjoint.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as matrix
. Shape is [..., M, K]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_solve_ls(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_solve_ls, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_solve_ls
Return
Applicative
Origial documentation for Builder.matrix_solve_ls
def matrix_solve_ls(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matrix_solve_ls
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matrix_solve_ls
def matrix_solve_ls(matrix, rhs, l2_regularizer=0.0, fast=True, name=None)
Solves one or more linear least-squares problems.
matrix
is a tensor of shape [..., M, N]
whose inner-most 2 dimensions
form M
-by-N
matrices. Rhs is a tensor of shape [..., M, K]
whose
inner-most 2 dimensions form M
-by-K
matrices. The computed output is a
Tensor
of shape [..., N, K]
whose inner-most 2 dimensions form M
-by-K
matrices that solve the equations
matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]
in the least squares
sense.
Below we will use the following notation for each pair of matrix and right-hand sides in the batch:
matrix
=\(A \in \Re^{m \times n}\),
rhs
=\(B \in \Re^{m \times k}\),
output
=\(X \in \Re^{n \times k}\),
l2_regularizer
=\(\lambda\).
If fast
is True
, then the solution is computed by solving the normal
equations using Cholesky decomposition. Specifically, if \(m \ge n\) then
\(X = (A^T A + \lambda I)^{-1} A^T B\), which solves the least-squares
problem \(X = \mathrm{argmin}{Z \in \Re^{n \times k}} ||A Z - B||_F^2 +
\lambda ||Z||_F^2\). If \(m \lt n\) then output
is computed as
\(X = A^T (A A^T + \lambda I)^{-1} B\), which (for \(\lambda = 0\)) is
the minimum-norm solution to the under-determined linear system, i.e.
\(X = \mathrm{argmin}{Z \in \Re^{n \times k}} ||Z||F^2 \), subject to
\(A Z = B\). Notice that the fast path is only numerically stable when
\(A\) is numerically full rank and has a condition number
\(\mathrm{cond}(A) \lt \frac{1}{\sqrt{\epsilon{mach}}}\) or\(\lambda\)
is sufficiently large.
If fast
is False
an algorithm based on the numerically robust complete
orthogonal decomposition is used. This computes the minimum-norm
least-squares solution, even when \(A\) is rank deficient. This path is
typically 6-7 times slower than the fast path. If fast
is False
then
l2_regularizer
is ignored.
Args:
matrix: Tensor
of shape [..., M, N]
.
rhs: Tensor
of shape [..., M, K]
.
l2_regularizer: 0-D double
Tensor
. Ignored if fast=False
.
fast: bool. Defaults to True
.
name: string, optional name of the operation.
Returns:
output: Tensor
of shape [..., N, K]
whose inner-most 2 dimensions form
M
-by-K
matrices that solve the equations
matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]
in the least
squares sense.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_solve_ls_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_solve_ls_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_solve_ls_layer
Return
Applicative
Origial documentation for Builder.matrix_solve_ls_layer
def matrix_solve_ls_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matrix_solve_ls, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matrix_solve_ls
def matrix_solve_ls(matrix, rhs, l2_regularizer=0.0, fast=True, name=None):
Solves one or more linear least-squares problems.
matrix
is a tensor of shape [..., M, N]
whose inner-most 2 dimensions
form M
-by-N
matrices. Rhs is a tensor of shape [..., M, K]
whose
inner-most 2 dimensions form M
-by-K
matrices. The computed output is a
Tensor
of shape [..., N, K]
whose inner-most 2 dimensions form M
-by-K
matrices that solve the equations
matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]
in the least squares
sense.
Below we will use the following notation for each pair of matrix and right-hand sides in the batch:
matrix
=\(A \in \Re^{m \times n}\),
rhs
=\(B \in \Re^{m \times k}\),
output
=\(X \in \Re^{n \times k}\),
l2_regularizer
=\(\lambda\).
If fast
is True
, then the solution is computed by solving the normal
equations using Cholesky decomposition. Specifically, if \(m \ge n\) then
\(X = (A^T A + \lambda I)^{-1} A^T B\), which solves the least-squares
problem \(X = \mathrm{argmin}{Z \in \Re^{n \times k}} ||A Z - B||_F^2 +
\lambda ||Z||_F^2\). If \(m \lt n\) then output
is computed as
\(X = A^T (A A^T + \lambda I)^{-1} B\), which (for \(\lambda = 0\)) is
the minimum-norm solution to the under-determined linear system, i.e.
\(X = \mathrm{argmin}{Z \in \Re^{n \times k}} ||Z||F^2 \), subject to
\(A Z = B\). Notice that the fast path is only numerically stable when
\(A\) is numerically full rank and has a condition number
\(\mathrm{cond}(A) \lt \frac{1}{\sqrt{\epsilon{mach}}}\) or\(\lambda\)
is sufficiently large.
If fast
is False
an algorithm based on the numerically robust complete
orthogonal decomposition is used. This computes the minimum-norm
least-squares solution, even when \(A\) is rank deficient. This path is
typically 6-7 times slower than the fast path. If fast
is False
then
l2_regularizer
is ignored.
Args:
matrix: Tensor
of shape [..., M, N]
.
rhs: Tensor
of shape [..., M, K]
.
l2_regularizer: 0-D double
Tensor
. Ignored if fast=False
.
fast: bool. Defaults to True
.
name: string, optional name of the operation.
Returns:
output: Tensor
of shape [..., N, K]
whose inner-most 2 dimensions form
M
-by-K
matrices that solve the equations
matrix[..., :, :] * output[..., :, :] = rhs[..., :, :]
in the least
squares sense.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_transpose(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_transpose, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_transpose
Return
Applicative
Origial documentation for Builder.matrix_transpose
def matrix_transpose(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matrix_transpose
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matrix_transpose
def matrix_transpose(a, name="matrix_transpose")
Transposes last two dimensions of tensor a
.
For example:
```python
Matrix with no batch dimension.
'x' is [[1 2 3]
[4 5 6]]
tf.matrix_transpose(x) ==> [[1 4] [2 5] [3 6]]
Matrix with two batch dimensions.
x.shape is [1, 2, 3, 4]
tf.matrix_transpose(x) is shape [1, 2, 4, 3]
```
Args:
a: A Tensor
with rank >= 2
.
name: A name for the operation (optional).
Returns:
A transposed batch matrix Tensor
.
Raises:
ValueError: If a
is determined statically to have rank < 2
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_transpose_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_transpose_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_transpose_layer
Return
Applicative
Origial documentation for Builder.matrix_transpose_layer
def matrix_transpose_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matrix_transpose, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matrix_transpose
def matrix_transpose(a, name="matrix_transpose"):
Transposes last two dimensions of tensor a
.
For example:
```python
Matrix with no batch dimension.
'x' is [[1 2 3]
[4 5 6]]
tf.matrix_transpose(x) ==> [[1 4] [2 5] [3 6]]
Matrix with two batch dimensions.
x.shape is [1, 2, 3, 4]
tf.matrix_transpose(x) is shape [1, 2, 4, 3]
```
Args:
a: A Tensor
with rank >= 2
.
name: A name for the operation (optional).
Returns:
A transposed batch matrix Tensor
.
Raises:
ValueError: If a
is determined statically to have rank < 2
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_triangular_solve(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_triangular_solve, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_triangular_solve
Return
Applicative
Origial documentation for Builder.matrix_triangular_solve
def matrix_triangular_solve(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.matrix_triangular_solve
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.matrix_triangular_solve
def matrix_triangular_solve(matrix, rhs, lower=None, adjoint=None, name=None)
Solves systems of linear equations with upper or lower triangular matrices by
backsubstitution.
matrix
is a tensor of shape [..., M, M]
whose inner-most 2 dimensions form
square matrices. If lower
is True
then the strictly upper triangular part
of each inner-most matrix is assumed to be zero and not accessed.
If lower
is False then the strictly lower triangular part of each inner-most
matrix is assumed to be zero and not accessed.
rhs
is a tensor of shape [..., M, K]
.
The output is a tensor of shape [..., M, K]
. If adjoint
is
True
then the innermost matrices in outputsatisfy matrix equations
matrix[..., :, :] * output[..., :, :] = rhs[..., :, :].
If
adjointis
Falsethen the strictly then the innermost matrices in
outputsatisfy matrix equations
adjoint(matrix[..., i, k]) * output[..., k, j] = rhs[..., i, j]`.
Args:
matrix: A Tensor
. Must be one of the following types: float64
, float32
.
Shape is [..., M, M]
.
rhs: A Tensor
. Must have the same type as matrix
.
Shape is [..., M, K]
.
lower: An optional bool
. Defaults to True
.
Boolean indicating whether the innermost matrices in matrix
are
lower or upper triangular.
adjoint: An optional bool
. Defaults to False
.
Boolean indicating whether to solve with matrix
or its (block-wise)
adjoint.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as matrix
. Shape is [..., M, K]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def matrix_triangular_solve_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.matrix_triangular_solve_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.matrix_triangular_solve_layer
Return
Applicative
Origial documentation for Builder.matrix_triangular_solve_layer
def matrix_triangular_solve_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.matrix_triangular_solve, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.matrix_triangular_solve
def matrix_triangular_solve(matrix, rhs, lower=None, adjoint=None, name=None):
Solves systems of linear equations with upper or lower triangular matrices by
backsubstitution.
matrix
is a tensor of shape [..., M, M]
whose inner-most 2 dimensions form
square matrices. If lower
is True
then the strictly upper triangular part
of each inner-most matrix is assumed to be zero and not accessed.
If lower
is False then the strictly lower triangular part of each inner-most
matrix is assumed to be zero and not accessed.
rhs
is a tensor of shape [..., M, K]
.
The output is a tensor of shape [..., M, K]
. If adjoint
is
True
then the innermost matrices in outputsatisfy matrix equations
matrix[..., :, :] * output[..., :, :] = rhs[..., :, :].
If
adjointis
Falsethen the strictly then the innermost matrices in
outputsatisfy matrix equations
adjoint(matrix[..., i, k]) * output[..., k, j] = rhs[..., i, j]`.
Args:
matrix: A Tensor
. Must be one of the following types: float64
, float32
.
Shape is [..., M, M]
.
rhs: A Tensor
. Must have the same type as matrix
.
Shape is [..., M, K]
.
lower: An optional bool
. Defaults to True
.
Boolean indicating whether the innermost matrices in matrix
are
lower or upper triangular.
adjoint: An optional bool
. Defaults to False
.
Boolean indicating whether to solve with matrix
or its (block-wise)
adjoint.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as matrix
. Shape is [..., M, K]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def max_pool(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.max_pool, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.max_pool
Return
Applicative
Origial documentation for Builder.max_pool
def max_pool(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.max_pool
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.nn.max_pool
def max_pool(value, ksize, strides, padding, data_format="NHWC", name=None)
Performs the max pooling on the input.
Args:
value: A 4-D Tensor
with shape [batch, height, width, channels]
and
type tf.float32
.
ksize: A list of ints that has length >= 4. The size of the window for
each dimension of the input tensor.
strides: A list of ints that has length >= 4. The stride of the sliding
window for each dimension of the input tensor.
padding: A string, either 'VALID'
or 'SAME'
. The padding algorithm.
See the comment here
data_format: A string. 'NHWC' and 'NCHW' are supported.
name: Optional name for the operation.
Returns:
A Tensor
with type tf.float32
. The max pooled output tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def max_pool3d(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.max_pool3d, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.max_pool3d
Return
Applicative
Origial documentation for Builder.max_pool3d
def max_pool3d(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.max_pool3d
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.nn.max_pool3d
def max_pool3d(input, ksize, strides, padding, name=None)
Performs 3D max pooling on the input.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Shape [batch, depth, rows, cols, channels]
tensor to pool over.
ksize: A list of ints
that has length >= 5
.
1-D tensor of length 5. The size of the window for each dimension of
the input tensor. Must have ksize[0] = ksize[4] = 1
.
strides: A list of ints
that has length >= 5
.
1-D tensor of length 5. The stride of the sliding window for each
dimension of input
. Must have strides[0] = strides[4] = 1
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
. The max pooled output tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def max_pool3d_grad(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.max_pool3d_grad, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.max_pool3d_grad
Return
Applicative
Origial documentation for Builder.max_pool3d_grad
def max_pool3d_grad(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.max_pool3d_grad
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.nn.max_pool3d_grad
def max_pool3d_grad(orig_input, orig_output, grad, ksize, strides, padding, name=None)
Computes gradients of max pooling function.
Args:
orig_input: A Tensor
of type float32
. The original input tensor.
orig_output: A Tensor
of type float32
. The original output tensor.
grad: A Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Output backprop of shape [batch, depth, rows, cols, channels]
.
ksize: A list of ints
that has length >= 5
.
1-D tensor of length 5. The size of the window for each dimension of
the input tensor. Must have ksize[0] = ksize[4] = 1
.
strides: A list of ints
that has length >= 5
.
1-D tensor of length 5. The stride of the sliding window for each
dimension of input
. Must have strides[0] = strides[4] = 1
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as grad
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def max_pool3d_grad_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.max_pool3d_grad_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.max_pool3d_grad_layer
Return
Applicative
Origial documentation for Builder.max_pool3d_grad_layer
def max_pool3d_grad_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.max_pool3d_grad, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.nn.max_pool3d_grad
def max_pool3d_grad(orig_input, orig_output, grad, ksize, strides, padding, name=None):
Computes gradients of max pooling function.
Args:
orig_input: A Tensor
of type float32
. The original input tensor.
orig_output: A Tensor
of type float32
. The original output tensor.
grad: A Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Output backprop of shape [batch, depth, rows, cols, channels]
.
ksize: A list of ints
that has length >= 5
.
1-D tensor of length 5. The size of the window for each dimension of
the input tensor. Must have ksize[0] = ksize[4] = 1
.
strides: A list of ints
that has length >= 5
.
1-D tensor of length 5. The stride of the sliding window for each
dimension of input
. Must have strides[0] = strides[4] = 1
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as grad
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def max_pool3d_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.max_pool3d_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.max_pool3d_layer
Return
Applicative
Origial documentation for Builder.max_pool3d_layer
def max_pool3d_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.max_pool3d, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.nn.max_pool3d
def max_pool3d(input, ksize, strides, padding, name=None):
Performs 3D max pooling on the input.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Shape [batch, depth, rows, cols, channels]
tensor to pool over.
ksize: A list of ints
that has length >= 5
.
1-D tensor of length 5. The size of the window for each dimension of
the input tensor. Must have ksize[0] = ksize[4] = 1
.
strides: A list of ints
that has length >= 5
.
1-D tensor of length 5. The stride of the sliding window for each
dimension of input
. Must have strides[0] = strides[4] = 1
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
. The max pooled output tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def max_pool_2d(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.max_pool_2d, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.max_pool_2d
Return
Applicative
Origial documentation for Builder.max_pool_2d
def max_pool_2d(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tflearn.layers.max_pool_2d
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tflearn.layers.max_pool_2d
def max_pool_2d(incoming, kernel_size, strides=None, padding="same", name="MaxPool2D")
Max Pooling 2D.
Input: 4-D Tensor [batch, height, width, in_channels].
Output: 4-D Tensor [batch, pooled height, pooled width, in_channels].
Arguments:
incoming: Tensor
. Incoming 4-D Layer.
kernel_size: 'intor
list of int. Pooling kernel size.
strides: 'int
or list of int
. Strides of conv operation.
Default: same as kernel_size.
padding: str
from "same", "valid"
. Padding algo to use.
Default: 'same'.
name: A name for this layer (optional). Default: 'MaxPool2D'.
Attributes:
scope: Scope
. This layer scope.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def max_pool_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.max_pool_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.max_pool_layer
Return
Applicative
Origial documentation for Builder.max_pool_layer
def max_pool_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.max_pool, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.nn.max_pool
def max_pool(value, ksize, strides, padding, data_format="NHWC", name=None):
Performs the max pooling on the input.
Args:
value: A 4-D Tensor
with shape [batch, height, width, channels]
and
type tf.float32
.
ksize: A list of ints that has length >= 4. The size of the window for
each dimension of the input tensor.
strides: A list of ints that has length >= 4. The stride of the sliding
window for each dimension of the input tensor.
padding: A string, either 'VALID'
or 'SAME'
. The padding algorithm.
See the comment here
data_format: A string. 'NHWC' and 'NCHW' are supported.
name: Optional name for the operation.
Returns:
A Tensor
with type tf.float32
. The max pooled output tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def max_pool_with_argmax(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.max_pool_with_argmax, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.max_pool_with_argmax
Return
Applicative
Origial documentation for Builder.max_pool_with_argmax
def max_pool_with_argmax(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.max_pool_with_argmax
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.nn.max_pool_with_argmax
def max_pool_with_argmax(input, ksize, strides, padding, Targmax=None, name=None)
Performs max pooling on the input and outputs both max values and indices.
The indices in argmax
are flattened, so that a maximum value at position
[b, y, x, c]
becomes flattened index
((b * height + y) * width + x) * channels + c
.
Args:
input: A Tensor
. Must be one of the following types: float32
, half
.
4-D with shape [batch, height, width, channels]
. Input to pool over.
ksize: A list of ints
that has length >= 4
.
The size of the window for each dimension of the input tensor.
strides: A list of ints
that has length >= 4
.
The stride of the sliding window for each dimension of the
input tensor.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
Targmax: An optional tf.DType
from: tf.int32, tf.int64
. Defaults to tf.int64
.
name: A name for the operation (optional).
Returns:
A tuple of Tensor
objects (output, argmax).
output: A Tensor
. Has the same type as input
. The max pooled output tensor.
argmax: A Tensor
of type Targmax
. 4-D. The flattened indices of the max values chosen for each output.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def max_pool_with_argmax_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.max_pool_with_argmax_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.max_pool_with_argmax_layer
Return
Applicative
Origial documentation for Builder.max_pool_with_argmax_layer
def max_pool_with_argmax_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.max_pool_with_argmax, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.nn.max_pool_with_argmax
def max_pool_with_argmax(input, ksize, strides, padding, Targmax=None, name=None):
Performs max pooling on the input and outputs both max values and indices.
The indices in argmax
are flattened, so that a maximum value at position
[b, y, x, c]
becomes flattened index
((b * height + y) * width + x) * channels + c
.
Args:
input: A Tensor
. Must be one of the following types: float32
, half
.
4-D with shape [batch, height, width, channels]
. Input to pool over.
ksize: A list of ints
that has length >= 4
.
The size of the window for each dimension of the input tensor.
strides: A list of ints
that has length >= 4
.
The stride of the sliding window for each dimension of the
input tensor.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
Targmax: An optional tf.DType
from: tf.int32, tf.int64
. Defaults to tf.int64
.
name: A name for the operation (optional).
Returns:
A tuple of Tensor
objects (output, argmax).
output: A Tensor
. Has the same type as input
. The max pooled output tensor.
argmax: A Tensor
of type Targmax
. 4-D. The flattened indices of the max values chosen for each output.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def maximize(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.maximize, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.maximize
Return
Applicative
Origial documentation for Builder.maximize
def maximize(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tensorbuilder.Builder.maximize
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tensorbuilder.Builder.maximize
def maximize(tensor, optimizer)
None
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def maximum(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.maximum, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.maximum
Return
Applicative
Origial documentation for Builder.maximum
def maximum(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.maximum
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.maximum
def maximum(x, y, name=None)
Returns the max of x and y (i.e. x > y ? x : y) element-wise.
NOTE: Maximum
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, int32
, int64
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def maximum_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.maximum_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.maximum_layer
Return
Applicative
Origial documentation for Builder.maximum_layer
def maximum_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.maximum, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.maximum
def maximum(x, y, name=None):
Returns the max of x and y (i.e. x > y ? x : y) element-wise.
NOTE: Maximum
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, int32
, int64
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def merge_all_summaries(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.merge_all_summaries, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.merge_all_summaries
Return
Applicative
Origial documentation for Builder.merge_all_summaries
def merge_all_summaries(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.merge_all_summaries
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.merge_all_summaries
def merge_all_summaries(key="summaries")
Merges all summaries collected in the default graph.
Args:
key: GraphKey
used to collect the summaries. Defaults to
GraphKeys.SUMMARIES
.
Returns:
If no summaries were collected, returns None. Otherwise returns a scalar
Tensor
of type string
containing the serialized Summary
protocol
buffer resulting from the merging.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def merge_all_summaries_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.merge_all_summaries_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.merge_all_summaries_layer
Return
Applicative
Origial documentation for Builder.merge_all_summaries_layer
def merge_all_summaries_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.merge_all_summaries, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.merge_all_summaries
def merge_all_summaries(key="summaries"):
Merges all summaries collected in the default graph.
Args:
key: GraphKey
used to collect the summaries. Defaults to
GraphKeys.SUMMARIES
.
Returns:
If no summaries were collected, returns None. Otherwise returns a scalar
Tensor
of type string
containing the serialized Summary
protocol
buffer resulting from the merging.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def merge_summary(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.merge_summary, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.merge_summary
Return
Applicative
Origial documentation for Builder.merge_summary
def merge_summary(builder, tag):
THIS METHOD IS AUTOMATICALLY GENERATED
Same as tf.merge_summary(inputs, collections=None, name=None)
but the the with the summery tensor as its first parameter.
Return
Builder
Origial documentation for tf.merge_summary
def merge_summary(inputs, collections=None, name=None):
Merges summaries.
This op creates a
Summary
protocol buffer that contains the union of all the values in the input
summaries.
When the Op is run, it reports an InvalidArgument
error if multiple values
in the summaries to merge use the same tag.
Args:
inputs: A list of string
Tensor
objects containing serialized Summary
protocol buffers.
collections: Optional list of graph collections keys. The new summary op is
added to these collections. Defaults to [GraphKeys.SUMMARIES]
.
name: A name for the operation (optional).
Returns:
A scalar Tensor
of type string
. The serialized Summary
protocol
buffer resulting from the merging.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def meshgrid(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.meshgrid, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.meshgrid
Return
Applicative
Origial documentation for Builder.meshgrid
def meshgrid(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.meshgrid
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.meshgrid
def meshgrid()
Broadcasts parameters for evaluation on an N-D grid.
Given N one-dimensional coordinate arrays *args
, returns a list outputs
of N-D coordinate arrays for evaluating expressions on an N-D grid.
Notes:
meshgrid
supports cartesian ('xy') and matrix ('ij') indexing conventions.
When the indexing
argument is set to 'xy' (the default), the broadcasting
instructions for the first two dimensions are swapped.
Examples:
Calling X, Y = meshgrid(x, y)
with the tensors
prettyprint
x = [1, 2, 3]
y = [4, 5, 6]
results in
prettyprint
X = [[1, 1, 1],
[2, 2, 2],
[3, 3, 3]]
Y = [[4, 5, 6],
[4, 5, 6],
[4, 5, 6]]
Args:
*args: Tensor
s with rank 1
indexing: Either 'xy' or 'ij' (optional, default: 'xy')
name: A name for the operation (optional).
Returns:
outputs: A list of N Tensor
s with rank N
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def meshgrid_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.meshgrid_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.meshgrid_layer
Return
Applicative
Origial documentation for Builder.meshgrid_layer
def meshgrid_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.meshgrid, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.meshgrid
def meshgrid():
Broadcasts parameters for evaluation on an N-D grid.
Given N one-dimensional coordinate arrays *args
, returns a list outputs
of N-D coordinate arrays for evaluating expressions on an N-D grid.
Notes:
meshgrid
supports cartesian ('xy') and matrix ('ij') indexing conventions.
When the indexing
argument is set to 'xy' (the default), the broadcasting
instructions for the first two dimensions are swapped.
Examples:
Calling X, Y = meshgrid(x, y)
with the tensors
prettyprint
x = [1, 2, 3]
y = [4, 5, 6]
results in
prettyprint
X = [[1, 1, 1],
[2, 2, 2],
[3, 3, 3]]
Y = [[4, 5, 6],
[4, 5, 6],
[4, 5, 6]]
Args:
*args: Tensor
s with rank 1
indexing: Either 'xy' or 'ij' (optional, default: 'xy')
name: A name for the operation (optional).
Returns:
outputs: A list of N Tensor
s with rank N
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def min_max_variable_partitioner(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.min_max_variable_partitioner, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.min_max_variable_partitioner
Return
Applicative
Origial documentation for Builder.min_max_variable_partitioner
def min_max_variable_partitioner(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.min_max_variable_partitioner
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.min_max_variable_partitioner
def min_max_variable_partitioner(max_partitions=1, axis=0, min_slice_size=262144, bytes_per_string_element=16)
Partitioner to allocate minimum size per slice.
Returns a partitioner that partitions the variable of given shape and dtype
such that each partition has a minimum of min_slice_size
slice of the
variable. The maximum number of such partitions (upper bound) is given by
max_partitions
.
Args:
max_partitions: Upper bound on the number of partitions. Defaults to 1.
axis: Axis along which to partition the variable. Defaults to 0.
min_slice_size: Minimum size of the variable slice per partition. Defaults
to 256K.
bytes_per_string_element: If the Variable
is of type string, this provides
an estimate of how large each scalar in the Variable
is.
Returns:
A partition function usable as the partitioner
argument to
variable_scope
, get_variable
, and get_partitioned_variable_list
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def min_max_variable_partitioner_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.min_max_variable_partitioner_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.min_max_variable_partitioner_layer
Return
Applicative
Origial documentation for Builder.min_max_variable_partitioner_layer
def min_max_variable_partitioner_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.min_max_variable_partitioner, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.min_max_variable_partitioner
def min_max_variable_partitioner(max_partitions=1, axis=0, min_slice_size=262144, bytes_per_string_element=16):
Partitioner to allocate minimum size per slice.
Returns a partitioner that partitions the variable of given shape and dtype
such that each partition has a minimum of min_slice_size
slice of the
variable. The maximum number of such partitions (upper bound) is given by
max_partitions
.
Args:
max_partitions: Upper bound on the number of partitions. Defaults to 1.
axis: Axis along which to partition the variable. Defaults to 0.
min_slice_size: Minimum size of the variable slice per partition. Defaults
to 256K.
bytes_per_string_element: If the Variable
is of type string, this provides
an estimate of how large each scalar in the Variable
is.
Returns:
A partition function usable as the partitioner
argument to
variable_scope
, get_variable
, and get_partitioned_variable_list
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def minimize(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.minimize, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.minimize
Return
Applicative
Origial documentation for Builder.minimize
def minimize(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tensorbuilder.Builder.minimize
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tensorbuilder.Builder.minimize
def minimize(tensor, optimizer)
None
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def minimum(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.minimum, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.minimum
Return
Applicative
Origial documentation for Builder.minimum
def minimum(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.minimum
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.minimum
def minimum(x, y, name=None)
Returns the min of x and y (i.e. x < y ? x : y) element-wise.
NOTE: Minimum
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, int32
, int64
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def minimum_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.minimum_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.minimum_layer
Return
Applicative
Origial documentation for Builder.minimum_layer
def minimum_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.minimum, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.minimum
def minimum(x, y, name=None):
Returns the min of x and y (i.e. x < y ? x : y) element-wise.
NOTE: Minimum
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, int32
, int64
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def mod(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.mod, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.mod
Return
Applicative
Origial documentation for Builder.mod
def mod(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.mod
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.mod
def mod(x, y, name=None)
Returns element-wise remainder of division.
NOTE: Mod
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: int32
, int64
, float32
, float64
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def mod_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.mod_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.mod_layer
Return
Applicative
Origial documentation for Builder.mod_layer
def mod_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.mod, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.mod
def mod(x, y, name=None):
Returns element-wise remainder of division.
NOTE: Mod
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: int32
, int64
, float32
, float64
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def model_variables(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.model_variables, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.model_variables
Return
Applicative
Origial documentation for Builder.model_variables
def model_variables(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.model_variables
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.model_variables
def model_variables()
Returns all variables in the MODEL_VARIABLES collection.
Returns: A list of local Variable objects.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def model_variables_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.model_variables_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.model_variables_layer
Return
Applicative
Origial documentation for Builder.model_variables_layer
def model_variables_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.model_variables, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.model_variables
def model_variables():
Returns all variables in the MODEL_VARIABLES collection.
Returns: A list of local Variable objects.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def moments(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.moments, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.moments
Return
Applicative
Origial documentation for Builder.moments
def moments(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.moments
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.nn.moments
def moments(x, axes, shift=None, name=None, keep_dims=False)
Calculate the mean and variance of x
.
The mean and variance are calculated by aggregating the contents of x
across axes
. If x
is 1-D and axes = [0]
this is just the mean
and variance of a vector.
When using these moments for batch normalization (see
tf.nn.batch_normalization
):
* for so-called "global normalization", used with convolutional filters with
shape [batch, height, width, depth]
, pass axes=[0, 1, 2]
.
* for simple batch normalization pass axes=[0]
(batch only).
Args:
x: A Tensor
.
axes: array of ints. Axes along which to compute mean and
variance.
shift: A Tensor
containing the value by which to shift the data for
numerical stability, or None
if no shift is to be performed. A shift
close to the true mean provides the most numerically stable results.
name: Name used to scope the operations that compute the moments.
keep_dims: produce moments with the same dimensionality as the input.
Returns:
Two Tensor
objects: mean
and variance
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def moments_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.moments_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.moments_layer
Return
Applicative
Origial documentation for Builder.moments_layer
def moments_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.moments, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.nn.moments
def moments(x, axes, shift=None, name=None, keep_dims=False):
Calculate the mean and variance of x
.
The mean and variance are calculated by aggregating the contents of x
across axes
. If x
is 1-D and axes = [0]
this is just the mean
and variance of a vector.
When using these moments for batch normalization (see
tf.nn.batch_normalization
):
* for so-called "global normalization", used with convolutional filters with
shape [batch, height, width, depth]
, pass axes=[0, 1, 2]
.
* for simple batch normalization pass axes=[0]
(batch only).
Args:
x: A Tensor
.
axes: array of ints. Axes along which to compute mean and
variance.
shift: A Tensor
containing the value by which to shift the data for
numerical stability, or None
if no shift is to be performed. A shift
close to the true mean provides the most numerically stable results.
name: Name used to scope the operations that compute the moments.
keep_dims: produce moments with the same dimensionality as the input.
Returns:
Two Tensor
objects: mean
and variance
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def moving_average_variables(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.moving_average_variables, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.moving_average_variables
Return
Applicative
Origial documentation for Builder.moving_average_variables
def moving_average_variables(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.moving_average_variables
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.moving_average_variables
def moving_average_variables()
Returns all variables that maintain their moving averages.
If an ExponentialMovingAverage
object is created and the apply()
method is called on a list of variables, these variables will
be added to the GraphKeys.MOVING_AVERAGE_VARIABLES
collection.
This convenience function returns the contents of that collection.
Returns: A list of Variable objects.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def moving_average_variables_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.moving_average_variables_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.moving_average_variables_layer
Return
Applicative
Origial documentation for Builder.moving_average_variables_layer
def moving_average_variables_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.moving_average_variables, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.moving_average_variables
def moving_average_variables():
Returns all variables that maintain their moving averages.
If an ExponentialMovingAverage
object is created and the apply()
method is called on a list of variables, these variables will
be added to the GraphKeys.MOVING_AVERAGE_VARIABLES
collection.
This convenience function returns the contents of that collection.
Returns: A list of Variable objects.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def mul(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.mul, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.mul
Return
Applicative
Origial documentation for Builder.mul
def mul(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.mul
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.mul
def mul(x, y, name=None)
Returns x * y element-wise.
NOTE: Mul
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, uint8
, int8
, uint16
, int16
, int32
, int64
, complex64
, complex128
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def mul_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.mul_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.mul_layer
Return
Applicative
Origial documentation for Builder.mul_layer
def mul_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.mul, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.mul
def mul(x, y, name=None):
Returns x * y element-wise.
NOTE: Mul
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, uint8
, int8
, uint16
, int16
, int32
, int64
, complex64
, complex128
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def multinomial(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.multinomial, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.multinomial
Return
Applicative
Origial documentation for Builder.multinomial
def multinomial(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.multinomial
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.multinomial
def multinomial(logits, num_samples, seed=None, name=None)
Draws samples from a multinomial distribution.
Example:
```python
samples has shape [1, 5], where each value is either 0 or 1 with equal
probability.
samples = tf.multinomial(tf.log([[10., 10.]]), 5) ```
Args:
logits: 2-D Tensor with shape [batch_size, num_classes]
. Each slice
[i, :]
represents the unnormalized log probabilities for all classes.
num_samples: 0-D. Number of independent samples to draw for each row slice.
seed: A Python integer. Used to create a random seed for the distribution.
See
set_random_seed
for behavior.
name: Optional name for the operation.
Returns:
The drawn samples of shape [batch_size, num_samples]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def multinomial_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.multinomial_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.multinomial_layer
Return
Applicative
Origial documentation for Builder.multinomial_layer
def multinomial_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.multinomial, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.multinomial
def multinomial(logits, num_samples, seed=None, name=None):
Draws samples from a multinomial distribution.
Example:
```python
samples has shape [1, 5], where each value is either 0 or 1 with equal
probability.
samples = tf.multinomial(tf.log([[10., 10.]]), 5) ```
Args:
logits: 2-D Tensor with shape [batch_size, num_classes]
. Each slice
[i, :]
represents the unnormalized log probabilities for all classes.
num_samples: 0-D. Number of independent samples to draw for each row slice.
seed: A Python integer. Used to create a random seed for the distribution.
See
set_random_seed
for behavior.
name: Optional name for the operation.
Returns:
The drawn samples of shape [batch_size, num_samples]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def name_scope(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.name_scope, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.name_scope
Return
Applicative
Origial documentation for Builder.name_scope
def name_scope(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.name_scope
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.name_scope
def name_scope()
Returns a context manager for use when defining a Python op.
This context manager validates that the given values
are from the
same graph, makes that graph the default graph, and pushes a
name scope in that graph (see
Graph.name_scope()
for more details on that).
For example, to define a new Python op called my_op
:
python
def my_op(a, b, c, name=None):
with tf.name_scope(name, "MyOp", [a, b, c]) as scope:
a = tf.convert_to_tensor(a, name="a")
b = tf.convert_to_tensor(b, name="b")
c = tf.convert_to_tensor(c, name="c")
# Define some computation that uses `a`, `b`, and `c`.
return foo_op(..., name=scope)
Args:
name: The name argument that is passed to the op function.
default_name: The default name to use if the name
argument is None
.
values: The list of Tensor
arguments that are passed to the op function.
Returns: A context manager for use in defining Python ops. Yields the name scope.
Raises:
ValueError: if neither name
nor default_name
is provided
but values
are.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def name_scope_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.name_scope_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.name_scope_layer
Return
Applicative
Origial documentation for Builder.name_scope_layer
def name_scope_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.name_scope, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.name_scope
def name_scope():
Returns a context manager for use when defining a Python op.
This context manager validates that the given values
are from the
same graph, makes that graph the default graph, and pushes a
name scope in that graph (see
Graph.name_scope()
for more details on that).
For example, to define a new Python op called my_op
:
python
def my_op(a, b, c, name=None):
with tf.name_scope(name, "MyOp", [a, b, c]) as scope:
a = tf.convert_to_tensor(a, name="a")
b = tf.convert_to_tensor(b, name="b")
c = tf.convert_to_tensor(c, name="c")
# Define some computation that uses `a`, `b`, and `c`.
return foo_op(..., name=scope)
Args:
name: The name argument that is passed to the op function.
default_name: The default name to use if the name
argument is None
.
values: The list of Tensor
arguments that are passed to the op function.
Returns: A context manager for use in defining Python ops. Yields the name scope.
Raises:
ValueError: if neither name
nor default_name
is provided
but values
are.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def nce_loss(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.nce_loss, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.nce_loss
Return
Applicative
Origial documentation for Builder.nce_loss
def nce_loss(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.nce_loss
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.nn.nce_loss
def nce_loss(weights, biases, inputs, labels, num_sampled, num_classes, num_true=1, sampled_values=None, remove_accidental_hits=False, partition_strategy="mod", name="nce_loss")
Computes and returns the noise-contrastive estimation training loss.
See [Noise-contrastive estimation: A new estimation principle for unnormalized statistical models] (http://www.jmlr.org/proceedings/papers/v9/gutmann10a/gutmann10a.pdf). Also see our [Candidate Sampling Algorithms Reference] (../../extras/candidate_sampling.pdf)
Note: By default this uses a log-uniform (Zipfian) distribution for sampling, so your labels must be sorted in order of decreasing frequency to achieve good results. For more details, see log_uniform_candidate_sampler.
Note: In the case where num_true
> 1, we assign to each target class
the target probability 1 / num_true
so that the target probabilities
sum to 1 per-example.
Note: It would be useful to allow a variable number of target classes per example. We hope to provide this functionality in a future release. For now, if you have a variable number of target classes, you can pad them out to a constant number by either repeating them or by padding with an otherwise unused class.
Args:
weights: A Tensor
of shape [num_classes, dim]
, or a list of Tensor
objects whose concatenation along dimension 0 has shape
[num_classes, dim]. The (possibly-partitioned) class embeddings.
biases: A Tensor
of shape [num_classes]
. The class biases.
inputs: A Tensor
of shape [batch_size, dim]
. The forward
activations of the input network.
labels: A Tensor
of type int64
and shape [batch_size,
num_true]
. The target classes.
num_sampled: An int
. The number of classes to randomly sample per batch.
num_classes: An int
. The number of possible classes.
num_true: An int
. The number of target classes per training example.
sampled_values: a tuple of (sampled_candidates
, true_expected_count
,
sampled_expected_count
) returned by a *_candidate_sampler
function.
(if None, we default to log_uniform_candidate_sampler
)
remove_accidental_hits: A bool
. Whether to remove "accidental hits"
where a sampled class equals one of the target classes. If set to
True
, this is a "Sampled Logistic" loss instead of NCE, and we are
learning to generate log-odds instead of log probabilities. See
our [Candidate Sampling Algorithms Reference]
(../../extras/candidate_sampling.pdf).
Default is False.
partition_strategy: A string specifying the partitioning strategy, relevant
if len(weights) > 1
. Currently "div"
and "mod"
are supported.
Default is "mod"
. See tf.nn.embedding_lookup
for more details.
name: A name for the operation (optional).
Returns:
A batch_size
1-D tensor of per-example NCE losses.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def nce_loss_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.nce_loss_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.nce_loss_layer
Return
Applicative
Origial documentation for Builder.nce_loss_layer
def nce_loss_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.nce_loss, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.nn.nce_loss
def nce_loss(weights, biases, inputs, labels, num_sampled, num_classes, num_true=1, sampled_values=None, remove_accidental_hits=False, partition_strategy="mod", name="nce_loss"):
Computes and returns the noise-contrastive estimation training loss.
See [Noise-contrastive estimation: A new estimation principle for unnormalized statistical models] (http://www.jmlr.org/proceedings/papers/v9/gutmann10a/gutmann10a.pdf). Also see our [Candidate Sampling Algorithms Reference] (../../extras/candidate_sampling.pdf)
Note: By default this uses a log-uniform (Zipfian) distribution for sampling, so your labels must be sorted in order of decreasing frequency to achieve good results. For more details, see log_uniform_candidate_sampler.
Note: In the case where num_true
> 1, we assign to each target class
the target probability 1 / num_true
so that the target probabilities
sum to 1 per-example.
Note: It would be useful to allow a variable number of target classes per example. We hope to provide this functionality in a future release. For now, if you have a variable number of target classes, you can pad them out to a constant number by either repeating them or by padding with an otherwise unused class.
Args:
weights: A Tensor
of shape [num_classes, dim]
, or a list of Tensor
objects whose concatenation along dimension 0 has shape
[num_classes, dim]. The (possibly-partitioned) class embeddings.
biases: A Tensor
of shape [num_classes]
. The class biases.
inputs: A Tensor
of shape [batch_size, dim]
. The forward
activations of the input network.
labels: A Tensor
of type int64
and shape [batch_size,
num_true]
. The target classes.
num_sampled: An int
. The number of classes to randomly sample per batch.
num_classes: An int
. The number of possible classes.
num_true: An int
. The number of target classes per training example.
sampled_values: a tuple of (sampled_candidates
, true_expected_count
,
sampled_expected_count
) returned by a *_candidate_sampler
function.
(if None, we default to log_uniform_candidate_sampler
)
remove_accidental_hits: A bool
. Whether to remove "accidental hits"
where a sampled class equals one of the target classes. If set to
True
, this is a "Sampled Logistic" loss instead of NCE, and we are
learning to generate log-odds instead of log probabilities. See
our [Candidate Sampling Algorithms Reference]
(../../extras/candidate_sampling.pdf).
Default is False.
partition_strategy: A string specifying the partitioning strategy, relevant
if len(weights) > 1
. Currently "div"
and "mod"
are supported.
Default is "mod"
. See tf.nn.embedding_lookup
for more details.
name: A name for the operation (optional).
Returns:
A batch_size
1-D tensor of per-example NCE losses.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def neg(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.neg, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.neg
Return
Applicative
Origial documentation for Builder.neg
def neg(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.neg
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.neg
def neg(x, name=None)
Computes numerical negative value element-wise.
I.e., (y = -x).
Args:
x: A Tensor
or SparseTensor
. Must be one of the following types: half
,
float32
, float64
, int32
, int64
, complex64
, complex128
.
name: A name for the operation (optional).
Returns:
A Tensor
or SparseTensor
, respectively. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def neg_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.neg_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.neg_layer
Return
Applicative
Origial documentation for Builder.neg_layer
def neg_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.neg, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.neg
def neg(x, name=None):
Computes numerical negative value element-wise.
I.e., (y = -x).
Args:
x: A Tensor
or SparseTensor
. Must be one of the following types: half
,
float32
, float64
, int32
, int64
, complex64
, complex128
.
name: A name for the operation (optional).
Returns:
A Tensor
or SparseTensor
, respectively. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def no_op(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.no_op, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.no_op
Return
Applicative
Origial documentation for Builder.no_op
def no_op(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.no_op
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.no_op
def no_op(name=None)
Does nothing. Only useful as a placeholder for control edges.
Args: name: A name for the operation (optional).
Returns: The created Operation.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def no_op_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.no_op_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.no_op_layer
Return
Applicative
Origial documentation for Builder.no_op_layer
def no_op_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.no_op, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.no_op
def no_op(name=None):
Does nothing. Only useful as a placeholder for control edges.
Args: name: A name for the operation (optional).
Returns: The created Operation.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def no_regularizer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.no_regularizer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.no_regularizer
Return
Applicative
Origial documentation for Builder.no_regularizer
def no_regularizer(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.no_regularizer
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.no_regularizer
def no_regularizer(_)
Use this function to prevent regularization of variables.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def no_regularizer_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.no_regularizer_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.no_regularizer_layer
Return
Applicative
Origial documentation for Builder.no_regularizer_layer
def no_regularizer_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.no_regularizer, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.no_regularizer
def no_regularizer(_):
Use this function to prevent regularization of variables.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def normalize_moments(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.normalize_moments, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.normalize_moments
Return
Applicative
Origial documentation for Builder.normalize_moments
def normalize_moments(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.normalize_moments
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.nn.normalize_moments
def normalize_moments(counts, mean_ss, variance_ss, shift, name=None)
Calculate the mean and variance of based on the sufficient statistics.
Args:
counts: A Tensor
containing a the total count of the data (one value).
mean_ss: A Tensor
containing the mean sufficient statistics: the (possibly
shifted) sum of the elements to average over.
variance_ss: A Tensor
containing the variance sufficient statistics: the
(possibly shifted) squared sum of the data to compute the variance over.
shift: A Tensor
containing the value by which the data is shifted for
numerical stability, or None
if no shift was performed.
name: Name used to scope the operations that compute the moments.
Returns:
Two Tensor
objects: mean
and variance
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def normalize_moments_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.normalize_moments_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.normalize_moments_layer
Return
Applicative
Origial documentation for Builder.normalize_moments_layer
def normalize_moments_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.normalize_moments, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.nn.normalize_moments
def normalize_moments(counts, mean_ss, variance_ss, shift, name=None):
Calculate the mean and variance of based on the sufficient statistics.
Args:
counts: A Tensor
containing a the total count of the data (one value).
mean_ss: A Tensor
containing the mean sufficient statistics: the (possibly
shifted) sum of the elements to average over.
variance_ss: A Tensor
containing the variance sufficient statistics: the
(possibly shifted) squared sum of the data to compute the variance over.
shift: A Tensor
containing the value by which the data is shifted for
numerical stability, or None
if no shift was performed.
name: Name used to scope the operations that compute the moments.
Returns:
Two Tensor
objects: mean
and variance
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def not_equal(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.not_equal, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.not_equal
Return
Applicative
Origial documentation for Builder.not_equal
def not_equal(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.not_equal
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.not_equal
def not_equal(x, y, name=None)
Returns the truth value of (x != y) element-wise.
NOTE: NotEqual
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, uint8
, int8
, int16
, int32
, int64
, complex64
, quint8
, qint8
, qint32
, string
, bool
, complex128
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
of type bool
.