tf.reduce_join(a, 0) ==> ["ac", "bd"] tf.reduce_join(a, 1) ==> ["ab", "cd"] tf.reduce_join(a, -2) = tf.reduce_join(a, 0) ==> ["ac", "bd"] tf.reduce_join(a, -1) = tf.reduce_join(a, 1) ==> ["ab", "cd"] tf.reduce_join(a, 0, keep_dims=True) ==> [["ac", "bd"]] tf.reduce_join(a, 1, keep_dims=True) ==> [["ab"], ["cd"]] tf.reduce_join(a, 0, separator=".") ==> ["a.c", "b.d"] tf.reduce_join(a, [0, 1]) ==> ["acbd"] tf.reduce_join(a, [1, 0]) ==> ["abcd"] tf.reduce_join(a, []) ==> ["abcd"] ```
Args:
inputs: A Tensor
of type string
.
The input to be joined. All reduced indices must have non-zero size.
reduction_indices: A Tensor
of type int32
.
The dimensions to reduce over. Dimensions are reduced in the
order specified. Omitting reduction_indices
is equivalent to passing
[n-1, n-2, ..., 0]
. Negative indices from -n
to -1
are supported.
keep_dims: An optional bool
. Defaults to False
.
If True
, retain reduced dimensions with length 1
.
separator: An optional string
. Defaults to ""
.
The separator to use when joining.
name: A name for the operation (optional).
Returns:
A Tensor
of type string
.
Has shape equal to that of the input with reduced dimensions removed or
set to 1
depending on keep_dims
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_join_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_join_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_join_layer
Return
Applicative
Origial documentation for Builder.reduce_join_layer
def reduce_join_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.reduce_join, ...)
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.reduce_join
def reduce_join(inputs, reduction_indices, keep_dims=None, separator=None, name=None):
Joins a string Tensor across the given dimensions.
Computes the string join across dimensions in the given string Tensor of shape
[d_0, d_1, ..., d_n-1]
. Returns a new Tensor created by joining the input
strings with the given separator (default: empty string). Negative indices are
counted backwards from the end, with -1
being equivalent to n - 1
. Passing
an empty reduction_indices
joins all strings in linear index order and outputs
a scalar string.
For example:
```
tensor a
is [["a", "b"], ["c", "d"]]
tf.reduce_join(a, 0) ==> ["ac", "bd"] tf.reduce_join(a, 1) ==> ["ab", "cd"] tf.reduce_join(a, -2) = tf.reduce_join(a, 0) ==> ["ac", "bd"] tf.reduce_join(a, -1) = tf.reduce_join(a, 1) ==> ["ab", "cd"] tf.reduce_join(a, 0, keep_dims=True) ==> [["ac", "bd"]] tf.reduce_join(a, 1, keep_dims=True) ==> [["ab"], ["cd"]] tf.reduce_join(a, 0, separator=".") ==> ["a.c", "b.d"] tf.reduce_join(a, [0, 1]) ==> ["acbd"] tf.reduce_join(a, [1, 0]) ==> ["abcd"] tf.reduce_join(a, []) ==> ["abcd"] ```
Args:
inputs: A Tensor
of type string
.
The input to be joined. All reduced indices must have non-zero size.
reduction_indices: A Tensor
of type int32
.
The dimensions to reduce over. Dimensions are reduced in the
order specified. Omitting reduction_indices
is equivalent to passing
[n-1, n-2, ..., 0]
. Negative indices from -n
to -1
are supported.
keep_dims: An optional bool
. Defaults to False
.
If True
, retain reduced dimensions with length 1
.
separator: An optional string
. Defaults to ""
.
The separator to use when joining.
name: A name for the operation (optional).
Returns:
A Tensor
of type string
.
Has shape equal to that of the input with reduced dimensions removed or
set to 1
depending on keep_dims
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_logsumexp(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_logsumexp, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_logsumexp
Return
Applicative
Origial documentation for Builder.reduce_logsumexp
def reduce_logsumexp(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.reduce_logsumexp
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.reduce_logsumexp
def reduce_logsumexp(input_tensor, reduction_indices=None, keep_dims=False, name=None)
Computes log(sum(exp(elements across dimensions of a tensor))).
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
This funciton is more numerically stable than log(sum(exp(input))). It avoids overflows caused by taking the exp of large inputs and underflows caused by taking the log of small inputs.
For example:
```python
'x' is [[0, 0, 0]]
[0, 0, 0]]
tf.reduce_logsumexp(x) ==> log(6) tf.reduce_logsumexp(x, 0) ==> [log(2), log(2), log(2)] tf.reduce_logsumexp(x, 1) ==> [log(3), log(3)] tf.reduce_logsumexp(x, 1, keep_dims=True) ==> [[log(3)], [log(3)]] tf.reduce_logsumexp(x, [0, 1]) ==> log(6) ```
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the defaut),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_logsumexp_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_logsumexp_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_logsumexp_layer
Return
Applicative
Origial documentation for Builder.reduce_logsumexp_layer
def reduce_logsumexp_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.reduce_logsumexp, ...)
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.reduce_logsumexp
def reduce_logsumexp(input_tensor, reduction_indices=None, keep_dims=False, name=None):
Computes log(sum(exp(elements across dimensions of a tensor))).
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
This funciton is more numerically stable than log(sum(exp(input))). It avoids overflows caused by taking the exp of large inputs and underflows caused by taking the log of small inputs.
For example:
```python
'x' is [[0, 0, 0]]
[0, 0, 0]]
tf.reduce_logsumexp(x) ==> log(6) tf.reduce_logsumexp(x, 0) ==> [log(2), log(2), log(2)] tf.reduce_logsumexp(x, 1) ==> [log(3), log(3)] tf.reduce_logsumexp(x, 1, keep_dims=True) ==> [[log(3)], [log(3)]] tf.reduce_logsumexp(x, [0, 1]) ==> log(6) ```
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the defaut),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_max(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_max, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_max
Return
Applicative
Origial documentation for Builder.reduce_max
def reduce_max(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.reduce_max
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.reduce_max
def reduce_max(input_tensor, reduction_indices=None, keep_dims=False, name=None)
Computes the maximum of elements across dimensions of a tensor.
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_max_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_max_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_max_layer
Return
Applicative
Origial documentation for Builder.reduce_max_layer
def reduce_max_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.reduce_max, ...)
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.reduce_max
def reduce_max(input_tensor, reduction_indices=None, keep_dims=False, name=None):
Computes the maximum of elements across dimensions of a tensor.
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_mean(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_mean, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_mean
Return
Applicative
Origial documentation for Builder.reduce_mean
def reduce_mean(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.reduce_mean
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.reduce_mean
def reduce_mean(input_tensor, reduction_indices=None, keep_dims=False, name=None)
Computes the mean of elements across dimensions of a tensor.
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
For example:
```python
'x' is [[1., 1.]
[2., 2.]]
tf.reduce_mean(x) ==> 1.5 tf.reduce_mean(x, 0) ==> [1.5, 1.5] tf.reduce_mean(x, 1) ==> [1., 2.] ```
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_mean_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_mean_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_mean_layer
Return
Applicative
Origial documentation for Builder.reduce_mean_layer
def reduce_mean_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.reduce_mean, ...)
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.reduce_mean
def reduce_mean(input_tensor, reduction_indices=None, keep_dims=False, name=None):
Computes the mean of elements across dimensions of a tensor.
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
For example:
```python
'x' is [[1., 1.]
[2., 2.]]
tf.reduce_mean(x) ==> 1.5 tf.reduce_mean(x, 0) ==> [1.5, 1.5] tf.reduce_mean(x, 1) ==> [1., 2.] ```
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_min(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_min, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_min
Return
Applicative
Origial documentation for Builder.reduce_min
def reduce_min(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.reduce_min
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.reduce_min
def reduce_min(input_tensor, reduction_indices=None, keep_dims=False, name=None)
Computes the minimum of elements across dimensions of a tensor.
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_min_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_min_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_min_layer
Return
Applicative
Origial documentation for Builder.reduce_min_layer
def reduce_min_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.reduce_min, ...)
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.reduce_min
def reduce_min(input_tensor, reduction_indices=None, keep_dims=False, name=None):
Computes the minimum of elements across dimensions of a tensor.
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_prod(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_prod, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_prod
Return
Applicative
Origial documentation for Builder.reduce_prod
def reduce_prod(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.reduce_prod
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.reduce_prod
def reduce_prod(input_tensor, reduction_indices=None, keep_dims=False, name=None)
Computes the product of elements across dimensions of a tensor.
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_prod_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_prod_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_prod_layer
Return
Applicative
Origial documentation for Builder.reduce_prod_layer
def reduce_prod_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.reduce_prod, ...)
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.reduce_prod
def reduce_prod(input_tensor, reduction_indices=None, keep_dims=False, name=None):
Computes the product of elements across dimensions of a tensor.
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_sum(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_sum, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_sum
Return
Applicative
Origial documentation for Builder.reduce_sum
def reduce_sum(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.reduce_sum
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.reduce_sum
def reduce_sum(input_tensor, reduction_indices=None, keep_dims=False, name=None)
Computes the sum of elements across dimensions of a tensor.
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
For example:
```python
'x' is [[1, 1, 1]
[1, 1, 1]]
tf.reduce_sum(x) ==> 6 tf.reduce_sum(x, 0) ==> [2, 2, 2] tf.reduce_sum(x, 1) ==> [3, 3] tf.reduce_sum(x, 1, keep_dims=True) ==> [[3], [3]] tf.reduce_sum(x, [0, 1]) ==> 6 ```
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reduce_sum_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reduce_sum_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reduce_sum_layer
Return
Applicative
Origial documentation for Builder.reduce_sum_layer
def reduce_sum_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.reduce_sum, ...)
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.reduce_sum
def reduce_sum(input_tensor, reduction_indices=None, keep_dims=False, name=None):
Computes the sum of elements across dimensions of a tensor.
Reduces input_tensor
along the dimensions given in reduction_indices
.
Unless keep_dims
is true, the rank of the tensor is reduced by 1 for each
entry in reduction_indices
. If keep_dims
is true, the reduced dimensions
are retained with length 1.
If reduction_indices
has no entries, all dimensions are reduced, and a
tensor with a single element is returned.
For example:
```python
'x' is [[1, 1, 1]
[1, 1, 1]]
tf.reduce_sum(x) ==> 6 tf.reduce_sum(x, 0) ==> [2, 2, 2] tf.reduce_sum(x, 1) ==> [3, 3] tf.reduce_sum(x, 1, keep_dims=True) ==> [[3], [3]] tf.reduce_sum(x, [0, 1]) ==> 6 ```
Args:
input_tensor: The tensor to reduce. Should have numeric type.
reduction_indices: The dimensions to reduce. If None
(the default),
reduces all dimensions.
keep_dims: If true, retains reduced dimensions with length 1.
name: A name for the operation (optional).
Returns: The reduced tensor.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def register_map_method(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.register_map_method, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.register_map_method
Return
Applicative
Origial documentation for Builder.register_map_method
def register_map_method(cls, fn, library_path, alias=None, doc=None):
This method enables you to register any function fn
that takes a Tensor as its first argument and returns a Tensor as a method of the Builder class. The resulting method is created by lifting the function to work with a Builder.
Arguments
fn
: a function of typeTensor -> Tensor
.library_path
: the route of the librar from which this function was taken, used for documentation purposes.alias
: allows you to specify the name of the method, it will take the name of the function if itsNone
.doc
: the documentation for the method, ifNone
a predefied documentation will be generated based on the documentation offn
.
Return
None
Examples
In this example we will register tf.reshape
as a method of the Builder class
import tensorflow as tf from tensorbuilder import tb tb.Builder.register_map_method(tf.reshape, "tf")
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def register_method(
cls, fn, library_path, alias=None, doc=None)
This method enables you to register any function fn
that takes an Applicative as its first argument as a method of the Builder class.
Arguments
fn
: a function that atleast takes an Applicative as its first argument.library_path
: the route of the librar from which this function was taken, used for documentation purposes.alias
: allows you to specify the name of the method, it will take the name of the function if itsNone
.doc
: the documentation for the method, ifNone
a predefied documentation will be generated based on the documentation offn
.
Return
None
Examples
@classmethod def register_method(cls, fn, library_path, alias=None, doc=None): """ This method enables you to register any function `fn` that takes an Applicative as its first argument as a method of the Builder class. **Arguments** * `fn`: a function that atleast takes an Applicative as its first argument. * `library_path`: the route of the librar from which this function was taken, used for documentation purposes. * `alias`: allows you to specify the name of the method, it will take the name of the function if its `None`. * `doc`: the documentation for the method, if `None` a predefied documentation will be generated based on the documentation of `fn`. **Return** `None` **Examples** """ fn_signature = utils.get_method_sig(fn) fn_docs = inspect.getdoc(fn) original_name = fn.__name__ name = alias if alias else original_name fn.__name__ = name fn.__doc__ = doc if doc else """ THIS METHOD IS AUTOMATICALLY GENERATED This method accepts the same arguments as `{3}.{0}` ** Documentation from `{3}.{0}`** def {1} """.format(name, fn_signature, fn.__doc__, library_path) setattr(cls, name, fn)
def register_reduce_method(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(BuilderTree.register_reduce_method, ...)
Arguments
- All other *args and **kwargs are forwarded to
BuilderTree.register_reduce_method
Return
Applicative
Origial documentation for BuilderTree.register_reduce_method
def register_reduce_method(cls, fn, library_path, alias=None, doc=None):
This method enables you to register a function fn
of type (Tensor, Tensor) -> Tensor
as a method of the Builder class.
Arguments
fn
: a function of type(Tensor, Tensor) -> Tensor
library_path
: the route of the librar from which this function was taken, used for documentation purposes.alias
: allows you to specify the name of the method, it will take the name of the function if itsNone
.doc
: the documentation for the method, ifNone
a predefied documentation will be generated based on the documentation offn
.
Return
None
Examples
In this example we will create the method reduce_add
for the BuilderTree class
import tensorflow as tf from tensorbuilder import tb tb.BuilderTree.register_reduce_method(tf.add, "tf", alias="reduce_add")
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def register_tensor_conversion_function(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.register_tensor_conversion_function, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.register_tensor_conversion_function
Return
Applicative
Origial documentation for Builder.register_tensor_conversion_function
def register_tensor_conversion_function(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.register_tensor_conversion_function
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.register_tensor_conversion_function
def register_tensor_conversion_function(base_type, conversion_func, priority=100)
Registers a function for converting objects of base_type
to Tensor
.
The conversion function must have the following signature:
def conversion_func(value, dtype=None, name=None, as_ref=False): # ...
It must return a Tensor
with the given dtype
if specified. If the
conversion function creates a new Tensor
, it should use the given
name
if specified. All exceptions will be propagated to the caller.
The conversion function may return NotImplemented
for some
inputs. In this case, the conversion process will continue to try
subsequent conversion functions.
If as_ref
is true, the function must return a Tensor
reference,
such as a Variable
.
NOTE: The conversion functions will execute in order of priority,
followed by order of registration. To ensure that a conversion function
F
runs before another conversion function G
, ensure that F
is
registered with a smaller priority than G
.
Args:
base_type: The base type or tuple of base types for all objects that
conversion_func
accepts.
conversion_func: A function that converts instances of base_type
to
Tensor
.
priority: Optional integer that indicates the priority for applying this
conversion function. Conversion functions with smaller priority values
run earlier than conversion functions with larger priority values.
Defaults to 100.
Raises: TypeError: If the arguments do not have the appropriate type.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def register_tensor_conversion_function_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.register_tensor_conversion_function_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.register_tensor_conversion_function_layer
Return
Applicative
Origial documentation for Builder.register_tensor_conversion_function_layer
def register_tensor_conversion_function_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.register_tensor_conversion_function, ...)
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.register_tensor_conversion_function
def register_tensor_conversion_function(base_type, conversion_func, priority=100):
Registers a function for converting objects of base_type
to Tensor
.
The conversion function must have the following signature:
def conversion_func(value, dtype=None, name=None, as_ref=False): # ...
It must return a Tensor
with the given dtype
if specified. If the
conversion function creates a new Tensor
, it should use the given
name
if specified. All exceptions will be propagated to the caller.
The conversion function may return NotImplemented
for some
inputs. In this case, the conversion process will continue to try
subsequent conversion functions.
If as_ref
is true, the function must return a Tensor
reference,
such as a Variable
.
NOTE: The conversion functions will execute in order of priority,
followed by order of registration. To ensure that a conversion function
F
runs before another conversion function G
, ensure that F
is
registered with a smaller priority than G
.
Args:
base_type: The base type or tuple of base types for all objects that
conversion_func
accepts.
conversion_func: A function that converts instances of base_type
to
Tensor
.
priority: Optional integer that indicates the priority for applying this
conversion function. Conversion functions with smaller priority values
run earlier than conversion functions with larger priority values.
Defaults to 100.
Raises: TypeError: If the arguments do not have the appropriate type.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def register_tensor_method(
cls, fn, library_path, alias=None, doc=None)
This method enables you to register any function fn
that takes an tensor as its first argument as a method of the Builder and Applicative class.
Arguments
fn
: a function that atleast takes an Tensor as its first argument.library_path
: the route of the librar from which this function was taken, used for documentation purposes.alias
: allows you to specify the name of the method, it will take the name of the function if itsNone
.doc
: the documentation for the method, ifNone
a predefied documentation will be generated based on the documentation offn
.
Return
None
Examples
@classmethod def register_tensor_method(cls, fn, library_path, alias=None, doc=None): """ This method enables you to register any function `fn` that takes an tensor as its first argument as a method of the Builder and Applicative class. **Arguments** * `fn`: a function that atleast takes an Tensor as its first argument. * `library_path`: the route of the librar from which this function was taken, used for documentation purposes. * `alias`: allows you to specify the name of the method, it will take the name of the function if its `None`. * `doc`: the documentation for the method, if `None` a predefied documentation will be generated based on the documentation of `fn`. **Return** `None` **Examples** """ original_name = fn.__name__ name = alias if alias else original_name method = get_app_method(name) cls.register_method(method, library_path, alias=name, doc=doc)
def relu(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.relu, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.relu
Return
Applicative
Origial documentation for Builder.relu
def relu(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.relu
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.relu
def relu(features, name=None)
Computes rectified linear: max(features, 0)
.
Args:
features: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as features
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def relu6(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.relu6, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.relu6
Return
Applicative
Origial documentation for Builder.relu6
def relu6(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.relu6
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.relu6
def relu6(features, name=None)
Computes Rectified Linear 6: min(max(features, 0), 6)
.
Args:
features: A Tensor
with type float
, double
, int32
, int64
, uint8
,
int16
, or int8
.
name: A name for the operation (optional).
Returns:
A Tensor
with the same type as features
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def relu6_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.relu6_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.relu6_layer
Return
Applicative
Origial documentation for Builder.relu6_layer
def relu6_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.relu6, ...)
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.relu6
def relu6(features, name=None):
Computes Rectified Linear 6: min(max(features, 0), 6)
.
Args:
features: A Tensor
with type float
, double
, int32
, int64
, uint8
,
int16
, or int8
.
name: A name for the operation (optional).
Returns:
A Tensor
with the same type as features
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def relu_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.relu_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.relu_layer
Return
Applicative
Origial documentation for Builder.relu_layer
def relu_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.relu, ...)
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.relu
def relu(features, name=None):
Computes rectified linear: max(features, 0)
.
Args:
features: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as features
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def report_uninitialized_variables(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.report_uninitialized_variables, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.report_uninitialized_variables
Return
Applicative
Origial documentation for Builder.report_uninitialized_variables
def report_uninitialized_variables(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.report_uninitialized_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.report_uninitialized_variables
def report_uninitialized_variables(var_list=None, name="report_uninitialized_variables")
Adds ops to list the names of uninitialized variables.
When run, it returns a 1-D tensor containing the names of uninitialized variables if there are any, or an empty array if there are none.
Args:
var_list: List of Variable
objects to check. Defaults to the
value of all_variables() + local_variables()
name: Optional name of the Operation
.
Returns: A 1-D tensor containing names of the uninitialized variables, or an empty 1-D tensor if there are no variables or no uninitialized variables.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def report_uninitialized_variables_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.report_uninitialized_variables_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.report_uninitialized_variables_layer
Return
Applicative
Origial documentation for Builder.report_uninitialized_variables_layer
def report_uninitialized_variables_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.report_uninitialized_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.report_uninitialized_variables
def report_uninitialized_variables(var_list=None, name="report_uninitialized_variables"):
Adds ops to list the names of uninitialized variables.
When run, it returns a 1-D tensor containing the names of uninitialized variables if there are any, or an empty array if there are none.
Args:
var_list: List of Variable
objects to check. Defaults to the
value of all_variables() + local_variables()
name: Optional name of the Operation
.
Returns: A 1-D tensor containing names of the uninitialized variables, or an empty 1-D tensor if there are no variables or no uninitialized variables.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def required_space_to_batch_paddings(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.required_space_to_batch_paddings, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.required_space_to_batch_paddings
Return
Applicative
Origial documentation for Builder.required_space_to_batch_paddings
def required_space_to_batch_paddings(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.required_space_to_batch_paddings
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.required_space_to_batch_paddings
def required_space_to_batch_paddings(input_shape, block_shape, base_paddings=None, name=None)
Calculate padding required to make block_shape divide input_shape.
This function can be used to calculate a suitable paddings argument for use with space_to_batch_nd and batch_to_space_nd.
Args: input_shape: int32 Tensor of shape [N]. block_shape: int32 Tensor of shape [N]. base_paddings: Optional int32 Tensor of shape [N, 2]. Specifies the minimum amount of padding to use. All elements must be >= 0. If not specified, defaults to 0. name: string. Optional name prefix.
Returns: (paddings, crops), where:
paddings
and crops
are int32 Tensors of rank 2 and shape [N, 2]
satisfying:
paddings[i, 0] = base_paddings[i, 0]. 0 <= paddings[i, 1] - base_paddings[i, 1] < block_shape[i] (input_shape[i] + paddings[i, 0] + paddings[i, 1]) % block_shape[i] == 0 crops[i, 0] = 0 crops[i, 1] = paddings[i, 1] - base_paddings[i, 1]
Raises: ValueError if called with incompatible shapes.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def required_space_to_batch_paddings_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.required_space_to_batch_paddings_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.required_space_to_batch_paddings_layer
Return
Applicative
Origial documentation for Builder.required_space_to_batch_paddings_layer
def required_space_to_batch_paddings_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.required_space_to_batch_paddings, ...)
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.required_space_to_batch_paddings
def required_space_to_batch_paddings(input_shape, block_shape, base_paddings=None, name=None):
Calculate padding required to make block_shape divide input_shape.
This function can be used to calculate a suitable paddings argument for use with space_to_batch_nd and batch_to_space_nd.
Args: input_shape: int32 Tensor of shape [N]. block_shape: int32 Tensor of shape [N]. base_paddings: Optional int32 Tensor of shape [N, 2]. Specifies the minimum amount of padding to use. All elements must be >= 0. If not specified, defaults to 0. name: string. Optional name prefix.
Returns: (paddings, crops), where:
paddings
and crops
are int32 Tensors of rank 2 and shape [N, 2]
satisfying:
paddings[i, 0] = base_paddings[i, 0]. 0 <= paddings[i, 1] - base_paddings[i, 1] < block_shape[i] (input_shape[i] + paddings[i, 0] + paddings[i, 1]) % block_shape[i] == 0 crops[i, 0] = 0 crops[i, 1] = paddings[i, 1] - base_paddings[i, 1]
Raises: ValueError if called with incompatible shapes.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reset_default_graph(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reset_default_graph, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reset_default_graph
Return
Applicative
Origial documentation for Builder.reset_default_graph
def reset_default_graph(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.reset_default_graph
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.reset_default_graph
def reset_default_graph()
Clears the default graph stack and resets the global default graph.
NOTE: The default graph is a property of the current thread. This
function applies only to the current thread. Calling this function while
a tf.Session
or tf.InteractiveSession
is active will result in undefined
behavior. Using any previously created tf.Operation
or tf.Tensor
objects
after calling this function will result in undefined behavior.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reset_default_graph_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reset_default_graph_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reset_default_graph_layer
Return
Applicative
Origial documentation for Builder.reset_default_graph_layer
def reset_default_graph_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.reset_default_graph, ...)
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.reset_default_graph
def reset_default_graph():
Clears the default graph stack and resets the global default graph.
NOTE: The default graph is a property of the current thread. This
function applies only to the current thread. Calling this function while
a tf.Session
or tf.InteractiveSession
is active will result in undefined
behavior. Using any previously created tf.Operation
or tf.Tensor
objects
after calling this function will result in undefined behavior.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reshape(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reshape, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reshape
Return
Applicative
Origial documentation for Builder.reshape
def reshape(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.reshape
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.reshape
def reshape(tensor, shape, name=None)
Reshapes a tensor.
Given tensor
, this operation returns a tensor that has the same values
as tensor
with shape shape
.
If one component of shape
is the special value -1, the size of that dimension
is computed so that the total size remains constant. In particular, a shape
of [-1]
flattens into 1-D. At most one component of shape
can be -1.
If shape
is 1-D or higher, then the operation returns a tensor with shape
shape
filled with the values of tensor
. In this case, the number of elements
implied by shape
must be the same as the number of elements in tensor
.
For example:
```prettyprint
tensor 't' is [1, 2, 3, 4, 5, 6, 7, 8, 9]
tensor 't' has shape [9]
reshape(t, [3, 3]) ==> [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
tensor 't' is [[[1, 1], [2, 2]],
[[3, 3], [4, 4]]]
tensor 't' has shape [2, 2, 2]
reshape(t, [2, 4]) ==> [[1, 1, 2, 2], [3, 3, 4, 4]]
tensor 't' is [[[1, 1, 1],
[2, 2, 2]],
[[3, 3, 3],
[4, 4, 4]],
[[5, 5, 5],
[6, 6, 6]]]
tensor 't' has shape [3, 2, 3]
pass '[-1]' to flatten 't'
reshape(t, [-1]) ==> [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6]
-1 can also be used to infer the shape
-1 is inferred to be 9:
reshape(t, [2, -1]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], [4, 4, 4, 5, 5, 5, 6, 6, 6]]
-1 is inferred to be 2:
reshape(t, [-1, 9]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], [4, 4, 4, 5, 5, 5, 6, 6, 6]]
-1 is inferred to be 3:
reshape(t, [ 2, -1, 3]) ==> [[[1, 1, 1], [2, 2, 2], [3, 3, 3]], [[4, 4, 4], [5, 5, 5], [6, 6, 6]]]
tensor 't' is [7]
shape []
reshapes to a scalar
reshape(t, []) ==> 7 ```
Args:
tensor: A Tensor
.
shape: A Tensor
. Must be one of the following types: int32
, int64
.
Defines the shape of the output tensor.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as tensor
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reshape_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reshape_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reshape_layer
Return
Applicative
Origial documentation for Builder.reshape_layer
def reshape_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.reshape, ...)
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.reshape
def reshape(tensor, shape, name=None):
Reshapes a tensor.
Given tensor
, this operation returns a tensor that has the same values
as tensor
with shape shape
.
If one component of shape
is the special value -1, the size of that dimension
is computed so that the total size remains constant. In particular, a shape
of [-1]
flattens into 1-D. At most one component of shape
can be -1.
If shape
is 1-D or higher, then the operation returns a tensor with shape
shape
filled with the values of tensor
. In this case, the number of elements
implied by shape
must be the same as the number of elements in tensor
.
For example:
```prettyprint
tensor 't' is [1, 2, 3, 4, 5, 6, 7, 8, 9]
tensor 't' has shape [9]
reshape(t, [3, 3]) ==> [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
tensor 't' is [[[1, 1], [2, 2]],
[[3, 3], [4, 4]]]
tensor 't' has shape [2, 2, 2]
reshape(t, [2, 4]) ==> [[1, 1, 2, 2], [3, 3, 4, 4]]
tensor 't' is [[[1, 1, 1],
[2, 2, 2]],
[[3, 3, 3],
[4, 4, 4]],
[[5, 5, 5],
[6, 6, 6]]]
tensor 't' has shape [3, 2, 3]
pass '[-1]' to flatten 't'
reshape(t, [-1]) ==> [1, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6]
-1 can also be used to infer the shape
-1 is inferred to be 9:
reshape(t, [2, -1]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], [4, 4, 4, 5, 5, 5, 6, 6, 6]]
-1 is inferred to be 2:
reshape(t, [-1, 9]) ==> [[1, 1, 1, 2, 2, 2, 3, 3, 3], [4, 4, 4, 5, 5, 5, 6, 6, 6]]
-1 is inferred to be 3:
reshape(t, [ 2, -1, 3]) ==> [[[1, 1, 1], [2, 2, 2], [3, 3, 3]], [[4, 4, 4], [5, 5, 5], [6, 6, 6]]]
tensor 't' is [7]
shape []
reshapes to a scalar
reshape(t, []) ==> 7 ```
Args:
tensor: A Tensor
.
shape: A Tensor
. Must be one of the following types: int32
, int64
.
Defines the shape of the output tensor.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as tensor
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reverse(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reverse, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reverse
Return
Applicative
Origial documentation for Builder.reverse
def reverse(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.reverse
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.reverse
def reverse(tensor, dims, name=None)
Reverses specific dimensions of a tensor.
Given a tensor
, and a bool
tensor dims
representing the dimensions
of tensor
, this operation reverses each dimension i of tensor
where
dims[i]
is True
.
tensor
can have up to 8 dimensions. The number of dimensions
of tensor
must equal the number of elements in dims
. In other words:
rank(tensor) = size(dims)
For example:
```prettyprint
tensor 't' is [[[[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]],
[[12, 13, 14, 15],
[16, 17, 18, 19],
[20, 21, 22, 23]]]]
tensor 't' shape is [1, 2, 3, 4]
'dims' is [False, False, False, True]
reverse(t, dims) ==> [[[[ 3, 2, 1, 0], [ 7, 6, 5, 4], [ 11, 10, 9, 8]], [[15, 14, 13, 12], [19, 18, 17, 16], [23, 22, 21, 20]]]]
'dims' is [False, True, False, False]
reverse(t, dims) ==> [[[[12, 13, 14, 15], [16, 17, 18, 19], [20, 21, 22, 23] [[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]]]]
'dims' is [False, False, True, False]
reverse(t, dims) ==> [[[[8, 9, 10, 11], [4, 5, 6, 7], [0, 1, 2, 3]] [[20, 21, 22, 23], [16, 17, 18, 19], [12, 13, 14, 15]]]] ```
Args:
tensor: A Tensor
. Must be one of the following types: uint8
, int8
, int32
, int64
, bool
, half
, float32
, float64
, complex64
, complex128
.
Up to 8-D.
dims: A Tensor
of type bool
. 1-D. The dimensions to reverse.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as tensor
. The same shape as tensor
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reverse_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reverse_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reverse_layer
Return
Applicative
Origial documentation for Builder.reverse_layer
def reverse_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.reverse, ...)
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.reverse
def reverse(tensor, dims, name=None):
Reverses specific dimensions of a tensor.
Given a tensor
, and a bool
tensor dims
representing the dimensions
of tensor
, this operation reverses each dimension i of tensor
where
dims[i]
is True
.
tensor
can have up to 8 dimensions. The number of dimensions
of tensor
must equal the number of elements in dims
. In other words:
rank(tensor) = size(dims)
For example:
```prettyprint
tensor 't' is [[[[ 0, 1, 2, 3],
[ 4, 5, 6, 7],
[ 8, 9, 10, 11]],
[[12, 13, 14, 15],
[16, 17, 18, 19],
[20, 21, 22, 23]]]]
tensor 't' shape is [1, 2, 3, 4]
'dims' is [False, False, False, True]
reverse(t, dims) ==> [[[[ 3, 2, 1, 0], [ 7, 6, 5, 4], [ 11, 10, 9, 8]], [[15, 14, 13, 12], [19, 18, 17, 16], [23, 22, 21, 20]]]]
'dims' is [False, True, False, False]
reverse(t, dims) ==> [[[[12, 13, 14, 15], [16, 17, 18, 19], [20, 21, 22, 23] [[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]]]]
'dims' is [False, False, True, False]
reverse(t, dims) ==> [[[[8, 9, 10, 11], [4, 5, 6, 7], [0, 1, 2, 3]] [[20, 21, 22, 23], [16, 17, 18, 19], [12, 13, 14, 15]]]] ```
Args:
tensor: A Tensor
. Must be one of the following types: uint8
, int8
, int32
, int64
, bool
, half
, float32
, float64
, complex64
, complex128
.
Up to 8-D.
dims: A Tensor
of type bool
. 1-D. The dimensions to reverse.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as tensor
. The same shape as tensor
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reverse_sequence(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reverse_sequence, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reverse_sequence
Return
Applicative
Origial documentation for Builder.reverse_sequence
def reverse_sequence(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.reverse_sequence
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.reverse_sequence
def reverse_sequence(input, seq_lengths, seq_dim, batch_dim=None, name=None)
Reverses variable length slices.
This op first slices input
along the dimension batch_dim
, and for each
slice i
, reverses the first seq_lengths[i]
elements along
the dimension seq_dim
.
The elements of seq_lengths
must obey seq_lengths[i] < input.dims[seq_dim]
,
and seq_lengths
must be a vector of length input.dims[batch_dim]
.
The output slice i
along dimension batch_dim
is then given by input
slice i
, with the first seq_lengths[i]
slices along dimension
seq_dim
reversed.
For example:
```prettyprint
Given this:
batch_dim = 0 seq_dim = 1 input.dims = (4, 8, ...) seq_lengths = [7, 2, 3, 5]
then slices of input are reversed on seq_dim, but only up to seq_lengths:
output[0, 0:7, :, ...] = input[0, 7:0:-1, :, ...] output[1, 0:2, :, ...] = input[1, 2:0:-1, :, ...] output[2, 0:3, :, ...] = input[2, 3:0:-1, :, ...] output[3, 0:5, :, ...] = input[3, 5:0:-1, :, ...]
while entries past seq_lens are copied through:
output[0, 7:, :, ...] = input[0, 7:, :, ...] output[1, 2:, :, ...] = input[1, 2:, :, ...] output[2, 3:, :, ...] = input[2, 3:, :, ...] output[3, 2:, :, ...] = input[3, 2:, :, ...] ```
In contrast, if:
```prettyprint
Given this:
batch_dim = 2 seq_dim = 0 input.dims = (8, ?, 4, ...) seq_lengths = [7, 2, 3, 5]
then slices of input are reversed on seq_dim, but only up to seq_lengths:
output[0:7, :, 0, :, ...] = input[7:0:-1, :, 0, :, ...] output[0:2, :, 1, :, ...] = input[2:0:-1, :, 1, :, ...] output[0:3, :, 2, :, ...] = input[3:0:-1, :, 2, :, ...] output[0:5, :, 3, :, ...] = input[5:0:-1, :, 3, :, ...]
while entries past seq_lens are copied through:
output[7:, :, 0, :, ...] = input[7:, :, 0, :, ...] output[2:, :, 1, :, ...] = input[2:, :, 1, :, ...] output[3:, :, 2, :, ...] = input[3:, :, 2, :, ...] output[2:, :, 3, :, ...] = input[2:, :, 3, :, ...] ```
Args:
input: A Tensor
. The input to reverse.
seq_lengths: A Tensor
. Must be one of the following types: int32
, int64
.
1-D with length input.dims(batch_dim)
and
max(seq_lengths) < input.dims(seq_dim)
seq_dim: An int
. The dimension which is partially reversed.
batch_dim: An optional int
. Defaults to 0
.
The dimension along which reversal is performed.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
The partially reversed input. It has the same shape as input
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def reverse_sequence_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.reverse_sequence_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.reverse_sequence_layer
Return
Applicative
Origial documentation for Builder.reverse_sequence_layer
def reverse_sequence_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.reverse_sequence, ...)
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.reverse_sequence
def reverse_sequence(input, seq_lengths, seq_dim, batch_dim=None, name=None):
Reverses variable length slices.
This op first slices input
along the dimension batch_dim
, and for each
slice i
, reverses the first seq_lengths[i]
elements along
the dimension seq_dim
.
The elements of seq_lengths
must obey seq_lengths[i] < input.dims[seq_dim]
,
and seq_lengths
must be a vector of length input.dims[batch_dim]
.
The output slice i
along dimension batch_dim
is then given by input
slice i
, with the first seq_lengths[i]
slices along dimension
seq_dim
reversed.
For example:
```prettyprint
Given this:
batch_dim = 0 seq_dim = 1 input.dims = (4, 8, ...) seq_lengths = [7, 2, 3, 5]
then slices of input are reversed on seq_dim, but only up to seq_lengths:
output[0, 0:7, :, ...] = input[0, 7:0:-1, :, ...] output[1, 0:2, :, ...] = input[1, 2:0:-1, :, ...] output[2, 0:3, :, ...] = input[2, 3:0:-1, :, ...] output[3, 0:5, :, ...] = input[3, 5:0:-1, :, ...]
while entries past seq_lens are copied through:
output[0, 7:, :, ...] = input[0, 7:, :, ...] output[1, 2:, :, ...] = input[1, 2:, :, ...] output[2, 3:, :, ...] = input[2, 3:, :, ...] output[3, 2:, :, ...] = input[3, 2:, :, ...] ```
In contrast, if:
```prettyprint
Given this:
batch_dim = 2 seq_dim = 0 input.dims = (8, ?, 4, ...) seq_lengths = [7, 2, 3, 5]
then slices of input are reversed on seq_dim, but only up to seq_lengths:
output[0:7, :, 0, :, ...] = input[7:0:-1, :, 0, :, ...] output[0:2, :, 1, :, ...] = input[2:0:-1, :, 1, :, ...] output[0:3, :, 2, :, ...] = input[3:0:-1, :, 2, :, ...] output[0:5, :, 3, :, ...] = input[5:0:-1, :, 3, :, ...]
while entries past seq_lens are copied through:
output[7:, :, 0, :, ...] = input[7:, :, 0, :, ...] output[2:, :, 1, :, ...] = input[2:, :, 1, :, ...] output[3:, :, 2, :, ...] = input[3:, :, 2, :, ...] output[2:, :, 3, :, ...] = input[2:, :, 3, :, ...] ```
Args:
input: A Tensor
. The input to reverse.
seq_lengths: A Tensor
. Must be one of the following types: int32
, int64
.
1-D with length input.dims(batch_dim)
and
max(seq_lengths) < input.dims(seq_dim)
seq_dim: An int
. The dimension which is partially reversed.
batch_dim: An optional int
. Defaults to 0
.
The dimension along which reversal is performed.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
The partially reversed input. It has the same shape as input
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def rnn(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.rnn, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.rnn
Return
Applicative
Origial documentation for Builder.rnn
def rnn(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.rnn
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.rnn
def rnn(inputs, cell)
None
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def rnn_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.rnn_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.rnn_layer
Return
Applicative
Origial documentation for Builder.rnn_layer
def rnn_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.rnn, ...)
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.rnn
def rnn(cell, inputs, initial_state=None, dtype=None, sequence_length=None, scope=None):
Creates a recurrent neural network specified by RNNCell cell
.
The simplest form of RNN network generated is:
python
state = cell.zero_state(...)
outputs = []
for input_ in inputs:
output, state = cell(input_, state)
outputs.append(output)
return (outputs, state)
However, a few other options are available:
An initial state can be provided. If the sequence_length vector is provided, dynamic calculation is performed. This method of calculation does not compute the RNN steps past the maximum sequence length of the minibatch (thus saving computational time), and properly propagates the state at an example's sequence length to the final state output.
The dynamic calculation performed is, at time t
for batch row b
,
python
(output, state)(b, t) =
(t >= sequence_length(b))
? (zeros(cell.output_size), states(b, sequence_length(b) - 1))
: cell(input(b, t), state(b, t - 1))
Args:
cell: An instance of RNNCell.
inputs: A length T list of inputs, each a Tensor
of shape
[batch_size, input_size]
, or a nested tuple of such elements.
initial_state: (optional) An initial state for the RNN.
If cell.state_size
is an integer, this must be
a Tensor
of appropriate type and shape [batch_size, cell.state_size]
.
If cell.state_size
is a tuple, this should be a tuple of
tensors having shapes [batch_size, s] for s in cell.state_size
.
dtype: (optional) The data type for the initial state and expected output.
Required if initial_state is not provided or RNN state has a heterogeneous
dtype.
sequence_length: Specifies the length of each sequence in inputs.
An int32 or int64 vector (tensor) size [batch_size]
, values in [0, T)
.
scope: VariableScope for the created subgraph; defaults to "RNN".
Returns: A pair (outputs, state) where: - outputs is a length T list of outputs (one for each input), or a nested tuple of such elements. - state is the final state
Raises:
TypeError: If cell
is not an instance of RNNCell.
ValueError: If inputs
is None
or an empty list, or if the input depth
(column size) cannot be inferred from inputs via shape inference.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def rnn_placeholders_from_state(
applicative, zero_state, name='rnn_state')
THIS METHOD IS AUTOMATICALLY GENERATED
This method accepts the same arguments as tensorbuilder.Applicative.rnn_placeholders_from_state
Documentation from tensorbuilder.Applicative.rnn_placeholders_from_state
def rnn_placeholders_from_state(applicative, zero_state, name="rnn_state")
def rnn_placeholders_from_state(applicative, zero_state, name="rnn_state"): if isinstance(zero_state, tuple): return tuple([applicative.rnn_placeholders_from_state(substate, name=name) for substate in zero_state]) else: return tf.placeholder(zero_state.dtype, shape=zero_state.get_shape(), name=name)
def rnn_state_feed_dict(
applicative, placeholders, values)
THIS METHOD IS AUTOMATICALLY GENERATED
This method accepts the same arguments as tensorbuilder.Applicative.rnn_state_feed_dict
Documentation from tensorbuilder.Applicative.rnn_state_feed_dict
def rnn_state_feed_dict(applicative, placeholders, values)
def rnn_state_feed_dict(applicative, placeholders, values): return dict(zip(utils.flatten(placeholders), utils.flatten(values)))
def round(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.round, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.round
Return
Applicative
Origial documentation for Builder.round
def round(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.round
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.round
def round(x, name=None)
Rounds the values of a tensor to the nearest integer, element-wise.
For example:
```python
'a' is [0.9, 2.5, 2.3, -4.4]
tf.round(a) ==> [ 1.0, 3.0, 2.0, -4.0 ] ```
Args:
x: A Tensor
of type float32
or float64
.
name: A name for the operation (optional).
Returns:
A Tensor
of same shape and 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 round_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.round_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.round_layer
Return
Applicative
Origial documentation for Builder.round_layer
def round_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.round, ...)
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.round
def round(x, name=None):
Rounds the values of a tensor to the nearest integer, element-wise.
For example:
```python
'a' is [0.9, 2.5, 2.3, -4.4]
tf.round(a) ==> [ 1.0, 3.0, 2.0, -4.0 ] ```
Args:
x: A Tensor
of type float32
or float64
.
name: A name for the operation (optional).
Returns:
A Tensor
of same shape and 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 rsqrt(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.rsqrt, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.rsqrt
Return
Applicative
Origial documentation for Builder.rsqrt
def rsqrt(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.rsqrt
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.rsqrt
def rsqrt(x, name=None)
Computes reciprocal of square root of x element-wise.
I.e., \(y = 1 / \sqrt{x}\).
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, complex64
, complex128
.
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 rsqrt_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.rsqrt_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.rsqrt_layer
Return
Applicative
Origial documentation for Builder.rsqrt_layer
def rsqrt_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.rsqrt, ...)
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.rsqrt
def rsqrt(x, name=None):
Computes reciprocal of square root of x element-wise.
I.e., \(y = 1 / \sqrt{x}\).
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, complex64
, complex128
.
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 sampled_softmax_loss(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.sampled_softmax_loss, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.sampled_softmax_loss
Return
Applicative
Origial documentation for Builder.sampled_softmax_loss
def sampled_softmax_loss(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tensorbuilder.sampled_softmax_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 tensorbuilder.sampled_softmax_loss
def sampled_softmax_loss()
Adds a fully connected layer.
fully_connected
creates a variable called weights
, representing a fully
connected weight matrix, which is multiplied by the inputs
to produce a
Tensor
of hidden units. If a normalizer_fn
is provided (such as
batch_norm
), it is then applied. Otherwise, if normalizer_fn
is
None and a biases_initializer
is provided then a biases
variable would be
created and added the hidden units. Finally, if activation_fn
is not None
,
it is applied to the hidden units as well.
Note: that if inputs
have a rank greater than 2, then inputs
is flattened
prior to the initial matrix multiply by weights
.
Args:
inputs: A tensor of with at least rank 2 and value for the last dimension,
i.e. [batch_size, depth]
, [None, None, None, channels]
.
num_outputs: Integer, the number of output units in the layer.
activation_fn: activation function.
normalizer_fn: normalization function to use instead of biases
. If
normalize_fn
is provided then biases_initializer
and
biases_regularizer
are ignored and biases
are not created nor added.
normalizer_params: normalization function parameters.
weights_initializer: An initializer for the weights.
weights_regularizer: Optional regularizer for the weights.
biases_initializer: An initializer for the biases. If None skip biases.
biases_regularizer: Optional regularizer for the biases.
reuse: whether or not the layer and its variables should be reused. To be
able to reuse the layer scope must be given.
variables_collections: Optional list of collections for all the variables or
a dictionary containing a different list of collections per variable.
outputs_collections: collection to add the outputs.
trainable: If True
also add variables to the graph collection
GraphKeys.TRAINABLE_VARIABLES
(see tf.Variable).
scope: Optional scope for variable_op_scope.
Returns:
the tensor variable representing the result of the series of operations.
Raises:
ValueError: if x has rank less than 2 or if its last dimension is not set.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def saturate_cast(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.saturate_cast, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.saturate_cast
Return
Applicative
Origial documentation for Builder.saturate_cast
def saturate_cast(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.saturate_cast
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.saturate_cast
def saturate_cast(value, dtype, name=None)
Performs a safe saturating cast of value
to dtype
.
This function casts the input to dtype
without applying any scaling. If
there is a danger that values would over or underflow in the cast, this op
applies the appropriate clamping before the cast.
Args:
value: A Tensor
.
dtype: The desired output DType
.
name: A name for the operation (optional).
Returns:
value
safely cast to dtype
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def saturate_cast_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.saturate_cast_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.saturate_cast_layer
Return
Applicative
Origial documentation for Builder.saturate_cast_layer
def saturate_cast_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.saturate_cast, ...)
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.saturate_cast
def saturate_cast(value, dtype, name=None):
Performs a safe saturating cast of value
to dtype
.
This function casts the input to dtype
without applying any scaling. If
there is a danger that values would over or underflow in the cast, this op
applies the appropriate clamping before the cast.
Args:
value: A Tensor
.
dtype: The desired output DType
.
name: A name for the operation (optional).
Returns:
value
safely cast to dtype
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scalar_mul(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scalar_mul, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scalar_mul
Return
Applicative
Origial documentation for Builder.scalar_mul
def scalar_mul(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.scalar_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.scalar_mul
def scalar_mul(scalar, x)
Multiplies a scalar times a Tensor
or IndexedSlices
object.
Intended for use in gradient code which might deal with IndexedSlices
objects, which are easy to multiply by a scalar but more expensive to
multiply with arbitrary tensors.
Args:
scalar: A 0-D scalar Tensor
. Must have known shape.
x: A Tensor
or IndexedSlices
to be scaled.
Returns:
scalar * x
of the same type (Tensor
or IndexedSlices
) as x
.
Raises:
ValueError: if scalar is not a 0-D scalar
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scalar_mul_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scalar_mul_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scalar_mul_layer
Return
Applicative
Origial documentation for Builder.scalar_mul_layer
def scalar_mul_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.scalar_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.scalar_mul
def scalar_mul(scalar, x):
Multiplies a scalar times a Tensor
or IndexedSlices
object.
Intended for use in gradient code which might deal with IndexedSlices
objects, which are easy to multiply by a scalar but more expensive to
multiply with arbitrary tensors.
Args:
scalar: A 0-D scalar Tensor
. Must have known shape.
x: A Tensor
or IndexedSlices
to be scaled.
Returns:
scalar * x
of the same type (Tensor
or IndexedSlices
) as x
.
Raises:
ValueError: if scalar is not a 0-D scalar
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scalar_summary(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scalar_summary, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scalar_summary
Return
Applicative
Origial documentation for Builder.scalar_summary
def scalar_summary(builder, tag):
THIS METHOD IS AUTOMATICALLY GENERATED
Same as tf.scalar_summary(tags, values, collections=None, name=None)
but the the with the summery tensor as its first parameter.
Return
Builder
Origial documentation for tf.scalar_summary
def scalar_summary(tags, values, collections=None, name=None):
Outputs a Summary
protocol buffer with scalar values.
The input tags
and values
must have the same shape. The generated
summary has a summary value for each tag-value pair in tags
and values
.
Args:
tags: A string
Tensor
. Tags for the summaries.
values: A real numeric Tensor. Values for the summaries.
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.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scan(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scan, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scan
Return
Applicative
Origial documentation for Builder.scan
def scan(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.scan
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.scan
def scan(fn, elems, initializer=None, parallel_iterations=10, back_prop=True, swap_memory=False, infer_shape=True, name=None)
scan on the list of tensors unpacked from elems
on dimension 0.
The simplest version of scan
repeatedly applies the callable fn
to a
sequence of elements from first to last. The elements are made of the tensors
unpacked from elems
on dimension 0. The callable fn takes two tensors as
arguments. The first argument is the accumulated value computed from the
preceding invocation of fn. If initializer
is None, elems
must contain
at least one element, and its first element is used as the initializer.
Suppose that elems
is unpacked into values
, a list of tensors. The shape
of the result tensor is [len(values)] + fn(initializer, values[0]).shape
.
This method also allows multi-arity elems
and accumulator. If elems
is a (possibly nested) list or tuple of tensors, then each of these tensors
must have a matching first (unpack) dimension. The second argument of
fn
must match the structure of elems
.
If no initializer
is provided, the output structure and dtypes of fn
are assumed to be the same as its input; and in this case, the first
argument of fn
must match the structure of elems
.
If an initializer
is provided, then the output of fn
must have the same
structure as initializer
; and the first argument of fn
must match
this structure.
For example, if elems
is (t1, [t2, t3])
and initializer
is
[i1, i2]
then an appropriate signature for fn
in python2
is:
fn = lambda (acc_p1, acc_p2), (t1 [t2, t3]):
and fn
must return a list,
[acc_n1, acc_n2]
. An alternative correct signature for fn
, and the
one that works in python3
, is:
fn = lambda a, t:
, where a
and t
correspond to the input tuples.
Args:
fn: The callable to be performed. It accepts two arguments. The first
will have the same (possibly nested) structure as elems
. The second
will have the same structure as initializer
if one is provided,
otherwise it will have the same structure as elems
. Its output
must have the same structure as initializer
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 the first argument to fn
.
initializer: (optional) A tensor or (possibly nested) sequence of tensors,
initial value for the accumulator, and the expected output type 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, and the previous accumulator value(s), from first to last.
Raises:
TypeError: if fn
is not callable or the structure of the output of
fn
and initializer
do not match.
ValueError: if the lengths of the output of fn
and initializer
do not match.
Examples:
python
elems = np.array([1, 2, 3, 4, 5, 6])
sum = scan(lambda a, x: a + x, elems)
# sum == [1, 3, 6, 10, 15, 21]
python
elems = np.array([1, 2, 3, 4, 5, 6])
initializer = np.array(0)
sum_one = scan(
lambda a, x: x[0] - x[1] + a, (elems + 1, elems), initializer)
# sum_one == [1, 2, 3, 4, 5, 6]
python
elems = np.array([1, 0, 0, 0, 0, 0])
initializer = (np.array(0), np.array(1))
fibonaccis = scan(lambda a, _: (a[1], a[0] + a[1]), elems, initializer)
# fibonaccis == ([1, 1, 2, 3, 5, 8], [1, 2, 3, 5, 8, 13])
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scan_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scan_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scan_layer
Return
Applicative
Origial documentation for Builder.scan_layer
def scan_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.scan, ...)
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.scan
def scan(fn, elems, initializer=None, parallel_iterations=10, back_prop=True, swap_memory=False, infer_shape=True, name=None):
scan on the list of tensors unpacked from elems
on dimension 0.
The simplest version of scan
repeatedly applies the callable fn
to a
sequence of elements from first to last. The elements are made of the tensors
unpacked from elems
on dimension 0. The callable fn takes two tensors as
arguments. The first argument is the accumulated value computed from the
preceding invocation of fn. If initializer
is None, elems
must contain
at least one element, and its first element is used as the initializer.
Suppose that elems
is unpacked into values
, a list of tensors. The shape
of the result tensor is [len(values)] + fn(initializer, values[0]).shape
.
This method also allows multi-arity elems
and accumulator. If elems
is a (possibly nested) list or tuple of tensors, then each of these tensors
must have a matching first (unpack) dimension. The second argument of
fn
must match the structure of elems
.
If no initializer
is provided, the output structure and dtypes of fn
are assumed to be the same as its input; and in this case, the first
argument of fn
must match the structure of elems
.
If an initializer
is provided, then the output of fn
must have the same
structure as initializer
; and the first argument of fn
must match
this structure.
For example, if elems
is (t1, [t2, t3])
and initializer
is
[i1, i2]
then an appropriate signature for fn
in python2
is:
fn = lambda (acc_p1, acc_p2), (t1 [t2, t3]):
and fn
must return a list,
[acc_n1, acc_n2]
. An alternative correct signature for fn
, and the
one that works in python3
, is:
fn = lambda a, t:
, where a
and t
correspond to the input tuples.
Args:
fn: The callable to be performed. It accepts two arguments. The first
will have the same (possibly nested) structure as elems
. The second
will have the same structure as initializer
if one is provided,
otherwise it will have the same structure as elems
. Its output
must have the same structure as initializer
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 the first argument to fn
.
initializer: (optional) A tensor or (possibly nested) sequence of tensors,
initial value for the accumulator, and the expected output type 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, and the previous accumulator value(s), from first to last.
Raises:
TypeError: if fn
is not callable or the structure of the output of
fn
and initializer
do not match.
ValueError: if the lengths of the output of fn
and initializer
do not match.
Examples:
python
elems = np.array([1, 2, 3, 4, 5, 6])
sum = scan(lambda a, x: a + x, elems)
# sum == [1, 3, 6, 10, 15, 21]
python
elems = np.array([1, 2, 3, 4, 5, 6])
initializer = np.array(0)
sum_one = scan(
lambda a, x: x[0] - x[1] + a, (elems + 1, elems), initializer)
# sum_one == [1, 2, 3, 4, 5, 6]
python
elems = np.array([1, 0, 0, 0, 0, 0])
initializer = (np.array(0), np.array(1))
fibonaccis = scan(lambda a, _: (a[1], a[0] + a[1]), elems, initializer)
# fibonaccis == ([1, 1, 2, 3, 5, 8], [1, 2, 3, 5, 8, 13])
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scatter_add(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scatter_add, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scatter_add
Return
Applicative
Origial documentation for Builder.scatter_add
def scatter_add(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.scatter_add
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.scatter_add
def scatter_add(ref, indices, updates, use_locking=None, name=None)
Adds sparse updates to a variable reference.
This operation computes
# Scalar indices ref[indices, ...] += updates[...] # Vector indices (for each i) ref[indices[i], ...] += updates[i, ...] # High rank indices (for each i, ..., j) ref[indices[i, ..., j], ...] += updates[i, ..., j, ...]
This operation outputs ref
after the update is done.
This makes it easier to chain operations that need to use the reset value.
Duplicate entries are handled correctly: if multiple indices
reference
the same location, their contributions add.
Requires updates.shape = indices.shape + ref.shape[1:]
.
Args:
ref: A mutable Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Should be from a Variable
node.
indices: A Tensor
. Must be one of the following types: int32
, int64
.
A tensor of indices into the first dimension of ref
.
updates: A Tensor
. Must have the same type as ref
.
A tensor of updated values to add to ref
.
use_locking: An optional bool
. Defaults to False
.
If True, the addition will be protected by a lock;
otherwise the behavior is undefined, but may exhibit less contention.
name: A name for the operation (optional).
Returns:
Same as ref
. Returned as a convenience for operations that want
to use the updated values after the update is done.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scatter_add_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scatter_add_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scatter_add_layer
Return
Applicative
Origial documentation for Builder.scatter_add_layer
def scatter_add_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.scatter_add, ...)
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.scatter_add
def scatter_add(ref, indices, updates, use_locking=None, name=None):
Adds sparse updates to a variable reference.
This operation computes
# Scalar indices ref[indices, ...] += updates[...] # Vector indices (for each i) ref[indices[i], ...] += updates[i, ...] # High rank indices (for each i, ..., j) ref[indices[i, ..., j], ...] += updates[i, ..., j, ...]
This operation outputs ref
after the update is done.
This makes it easier to chain operations that need to use the reset value.
Duplicate entries are handled correctly: if multiple indices
reference
the same location, their contributions add.
Requires updates.shape = indices.shape + ref.shape[1:]
.
Args:
ref: A mutable Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Should be from a Variable
node.
indices: A Tensor
. Must be one of the following types: int32
, int64
.
A tensor of indices into the first dimension of ref
.
updates: A Tensor
. Must have the same type as ref
.
A tensor of updated values to add to ref
.
use_locking: An optional bool
. Defaults to False
.
If True, the addition will be protected by a lock;
otherwise the behavior is undefined, but may exhibit less contention.
name: A name for the operation (optional).
Returns:
Same as ref
. Returned as a convenience for operations that want
to use the updated values after the update is done.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scatter_div(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scatter_div, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scatter_div
Return
Applicative
Origial documentation for Builder.scatter_div
def scatter_div(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.scatter_div
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.scatter_div
def scatter_div(ref, indices, updates, use_locking=None, name=None)
Divides a variable reference by sparse updates.
This operation computes
# Scalar indices ref[indices, ...] /= updates[...] # Vector indices (for each i) ref[indices[i], ...] /= updates[i, ...] # High rank indices (for each i, ..., j) ref[indices[i, ..., j], ...] /= updates[i, ..., j, ...]
This operation outputs ref
after the update is done.
This makes it easier to chain operations that need to use the reset value.
Duplicate entries are handled correctly: if multiple indices
reference
the same location, their contributions divide.
Requires updates.shape = indices.shape + ref.shape[1:]
.
Args:
ref: A mutable Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Should be from a Variable
node.
indices: A Tensor
. Must be one of the following types: int32
, int64
.
A tensor of indices into the first dimension of ref
.
updates: A Tensor
. Must have the same type as ref
.
A tensor of values that ref
is divided by.
use_locking: An optional bool
. Defaults to False
.
If True, the operation will be protected by a lock;
otherwise the behavior is undefined, but may exhibit less contention.
name: A name for the operation (optional).
Returns:
Same as ref
. Returned as a convenience for operations that want
to use the updated values after the update is done.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scatter_div_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scatter_div_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scatter_div_layer
Return
Applicative
Origial documentation for Builder.scatter_div_layer
def scatter_div_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.scatter_div, ...)
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.scatter_div
def scatter_div(ref, indices, updates, use_locking=None, name=None):
Divides a variable reference by sparse updates.
This operation computes
# Scalar indices ref[indices, ...] /= updates[...] # Vector indices (for each i) ref[indices[i], ...] /= updates[i, ...] # High rank indices (for each i, ..., j) ref[indices[i, ..., j], ...] /= updates[i, ..., j, ...]
This operation outputs ref
after the update is done.
This makes it easier to chain operations that need to use the reset value.
Duplicate entries are handled correctly: if multiple indices
reference
the same location, their contributions divide.
Requires updates.shape = indices.shape + ref.shape[1:]
.
Args:
ref: A mutable Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Should be from a Variable
node.
indices: A Tensor
. Must be one of the following types: int32
, int64
.
A tensor of indices into the first dimension of ref
.
updates: A Tensor
. Must have the same type as ref
.
A tensor of values that ref
is divided by.
use_locking: An optional bool
. Defaults to False
.
If True, the operation will be protected by a lock;
otherwise the behavior is undefined, but may exhibit less contention.
name: A name for the operation (optional).
Returns:
Same as ref
. Returned as a convenience for operations that want
to use the updated values after the update is done.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scatter_mul(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scatter_mul, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scatter_mul
Return
Applicative
Origial documentation for Builder.scatter_mul
def scatter_mul(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.scatter_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.scatter_mul
def scatter_mul(ref, indices, updates, use_locking=None, name=None)
Multiplies sparse updates into a variable reference.
This operation computes
# Scalar indices ref[indices, ...] *= updates[...] # Vector indices (for each i) ref[indices[i], ...] *= updates[i, ...] # High rank indices (for each i, ..., j) ref[indices[i, ..., j], ...] *= updates[i, ..., j, ...]
This operation outputs ref
after the update is done.
This makes it easier to chain operations that need to use the reset value.
Duplicate entries are handled correctly: if multiple indices
reference
the same location, their contributions multiply.
Requires updates.shape = indices.shape + ref.shape[1:]
.
Args:
ref: A mutable Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Should be from a Variable
node.
indices: A Tensor
. Must be one of the following types: int32
, int64
.
A tensor of indices into the first dimension of ref
.
updates: A Tensor
. Must have the same type as ref
.
A tensor of updated values to multiply to ref
.
use_locking: An optional bool
. Defaults to False
.
If True, the operation will be protected by a lock;
otherwise the behavior is undefined, but may exhibit less contention.
name: A name for the operation (optional).
Returns:
Same as ref
. Returned as a convenience for operations that want
to use the updated values after the update is done.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scatter_mul_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scatter_mul_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scatter_mul_layer
Return
Applicative
Origial documentation for Builder.scatter_mul_layer
def scatter_mul_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.scatter_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.scatter_mul
def scatter_mul(ref, indices, updates, use_locking=None, name=None):
Multiplies sparse updates into a variable reference.
This operation computes
# Scalar indices ref[indices, ...] *= updates[...] # Vector indices (for each i) ref[indices[i], ...] *= updates[i, ...] # High rank indices (for each i, ..., j) ref[indices[i, ..., j], ...] *= updates[i, ..., j, ...]
This operation outputs ref
after the update is done.
This makes it easier to chain operations that need to use the reset value.
Duplicate entries are handled correctly: if multiple indices
reference
the same location, their contributions multiply.
Requires updates.shape = indices.shape + ref.shape[1:]
.
Args:
ref: A mutable Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Should be from a Variable
node.
indices: A Tensor
. Must be one of the following types: int32
, int64
.
A tensor of indices into the first dimension of ref
.
updates: A Tensor
. Must have the same type as ref
.
A tensor of updated values to multiply to ref
.
use_locking: An optional bool
. Defaults to False
.
If True, the operation will be protected by a lock;
otherwise the behavior is undefined, but may exhibit less contention.
name: A name for the operation (optional).
Returns:
Same as ref
. Returned as a convenience for operations that want
to use the updated values after the update is done.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scatter_sub(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scatter_sub, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scatter_sub
Return
Applicative
Origial documentation for Builder.scatter_sub
def scatter_sub(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.scatter_sub
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.scatter_sub
def scatter_sub(ref, indices, updates, use_locking=None, name=None)
Subtracts sparse updates to a variable reference.
# Scalar indices ref[indices, ...] -= updates[...] # Vector indices (for each i) ref[indices[i], ...] -= updates[i, ...] # High rank indices (for each i, ..., j) ref[indices[i, ..., j], ...] -= updates[i, ..., j, ...]
This operation outputs ref
after the update is done.
This makes it easier to chain operations that need to use the reset value.
Duplicate entries are handled correctly: if multiple indices
reference
the same location, their (negated) contributions add.
Requires updates.shape = indices.shape + ref.shape[1:]
.
Args:
ref: A mutable Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Should be from a Variable
node.
indices: A Tensor
. Must be one of the following types: int32
, int64
.
A tensor of indices into the first dimension of ref
.
updates: A Tensor
. Must have the same type as ref
.
A tensor of updated values to subtract from ref
.
use_locking: An optional bool
. Defaults to False
.
If True, the subtraction will be protected by a lock;
otherwise the behavior is undefined, but may exhibit less contention.
name: A name for the operation (optional).
Returns:
Same as ref
. Returned as a convenience for operations that want
to use the updated values after the update is done.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scatter_sub_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scatter_sub_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scatter_sub_layer
Return
Applicative
Origial documentation for Builder.scatter_sub_layer
def scatter_sub_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.scatter_sub, ...)
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.scatter_sub
def scatter_sub(ref, indices, updates, use_locking=None, name=None):
Subtracts sparse updates to a variable reference.
# Scalar indices ref[indices, ...] -= updates[...] # Vector indices (for each i) ref[indices[i], ...] -= updates[i, ...] # High rank indices (for each i, ..., j) ref[indices[i, ..., j], ...] -= updates[i, ..., j, ...]
This operation outputs ref
after the update is done.
This makes it easier to chain operations that need to use the reset value.
Duplicate entries are handled correctly: if multiple indices
reference
the same location, their (negated) contributions add.
Requires updates.shape = indices.shape + ref.shape[1:]
.
Args:
ref: A mutable Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
Should be from a Variable
node.
indices: A Tensor
. Must be one of the following types: int32
, int64
.
A tensor of indices into the first dimension of ref
.
updates: A Tensor
. Must have the same type as ref
.
A tensor of updated values to subtract from ref
.
use_locking: An optional bool
. Defaults to False
.
If True, the subtraction will be protected by a lock;
otherwise the behavior is undefined, but may exhibit less contention.
name: A name for the operation (optional).
Returns:
Same as ref
. Returned as a convenience for operations that want
to use the updated values after the update is done.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scatter_update(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scatter_update, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scatter_update
Return
Applicative
Origial documentation for Builder.scatter_update
def scatter_update(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.scatter_update
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.scatter_update
def scatter_update(ref, indices, updates, use_locking=None, name=None)
Applies sparse updates to a variable reference.
This operation computes
# Scalar indices ref[indices, ...] = updates[...] # Vector indices (for each i) ref[indices[i], ...] = updates[i, ...] # High rank indices (for each i, ..., j) ref[indices[i, ..., j], ...] = updates[i, ..., j, ...]
This operation outputs ref
after the update is done.
This makes it easier to chain operations that need to use the reset value.
If values in ref
is to be updated more than once, because there are
duplicate entires in indices
, the order at which the updates happen
for each value is undefined.
Requires updates.shape = indices.shape + ref.shape[1:]
.
Args:
ref: A mutable Tensor
. Should be from a Variable
node.
indices: A Tensor
. Must be one of the following types: int32
, int64
.
A tensor of indices into the first dimension of ref
.
updates: A Tensor
. Must have the same type as ref
.
A tensor of updated values to store in ref
.
use_locking: An optional bool
. Defaults to True
.
If True, the assignment will be protected by a lock;
otherwise the behavior is undefined, but may exhibit less contention.
name: A name for the operation (optional).
Returns:
Same as ref
. Returned as a convenience for operations that want
to use the updated values after the update is done.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def scatter_update_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.scatter_update_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.scatter_update_layer
Return
Applicative
Origial documentation for Builder.scatter_update_layer
def scatter_update_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.scatter_update, ...)
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.scatter_update
def scatter_update(ref, indices, updates, use_locking=None, name=None):
Applies sparse updates to a variable reference.
This operation computes
# Scalar indices ref[indices, ...] = updates[...] # Vector indices (for each i) ref[indices[i], ...] = updates[i, ...] # High rank indices (for each i, ..., j) ref[indices[i, ..., j], ...] = updates[i, ..., j, ...]
This operation outputs ref
after the update is done.
This makes it easier to chain operations that need to use the reset value.
If values in ref
is to be updated more than once, because there are
duplicate entires in indices
, the order at which the updates happen
for each value is undefined.
Requires updates.shape = indices.shape + ref.shape[1:]
.
Args:
ref: A mutable Tensor
. Should be from a Variable
node.
indices: A Tensor
. Must be one of the following types: int32
, int64
.
A tensor of indices into the first dimension of ref
.
updates: A Tensor
. Must have the same type as ref
.
A tensor of updated values to store in ref
.
use_locking: An optional bool
. Defaults to True
.
If True, the assignment will be protected by a lock;
otherwise the behavior is undefined, but may exhibit less contention.
name: A name for the operation (optional).
Returns:
Same as ref
. Returned as a convenience for operations that want
to use the updated values after the update is done.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def segment_max(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.segment_max, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.segment_max
Return
Applicative
Origial documentation for Builder.segment_max
def segment_max(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.segment_max
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.segment_max
def segment_max(data, segment_ids, name=None)
Computes the maximum along segments of a tensor.
Read the section on Segmentation for an explanation of segments.
Computes a tensor such that
\(output_i = \max_j(data_j)\) where max
is over j
such
that segment_ids[j] == i
.
Args:
data: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
segment_ids: A Tensor
. Must be one of the following types: int32
, int64
.
A 1-D tensor whose rank is equal to the rank of data
's
first dimension. Values should be sorted and can be repeated.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as data
.
Has same shape as data, except for dimension 0 which
has size k
, the number of segments.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def segment_max_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.segment_max_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.segment_max_layer
Return
Applicative
Origial documentation for Builder.segment_max_layer
def segment_max_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.segment_max, ...)
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.segment_max
def segment_max(data, segment_ids, name=None):
Computes the maximum along segments of a tensor.
Read the section on Segmentation for an explanation of segments.
Computes a tensor such that
\(output_i = \max_j(data_j)\) where max
is over j
such
that segment_ids[j] == i
.
Args:
data: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
segment_ids: A Tensor
. Must be one of the following types: int32
, int64
.
A 1-D tensor whose rank is equal to the rank of data
's
first dimension. Values should be sorted and can be repeated.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as data
.
Has same shape as data, except for dimension 0 which
has size k
, the number of segments.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def segment_mean(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.segment_mean, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.segment_mean
Return
Applicative
Origial documentation for Builder.segment_mean
def segment_mean(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.segment_mean
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.segment_mean
def segment_mean(data, segment_ids, name=None)
Computes the mean along segments of a tensor.
Read the section on Segmentation for an explanation of segments.
Computes a tensor such that
\(output_i = \frac{\sum_j data_j}{N}\) where mean
is
over j
such that segment_ids[j] == i
and N
is the total number of
values summed.
Args:
data: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
segment_ids: A Tensor
. Must be one of the following types: int32
, int64
.
A 1-D tensor whose rank is equal to the rank of data
's
first dimension. Values should be sorted and can be repeated.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as data
.
Has same shape as data, except for dimension 0 which
has size k
, the number of segments.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def segment_mean_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.segment_mean_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.segment_mean_layer
Return
Applicative
Origial documentation for Builder.segment_mean_layer
def segment_mean_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.segment_mean, ...)
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.segment_mean
def segment_mean(data, segment_ids, name=None):
Computes the mean along segments of a tensor.
Read the section on Segmentation for an explanation of segments.
Computes a tensor such that
\(output_i = \frac{\sum_j data_j}{N}\) where mean
is
over j
such that segment_ids[j] == i
and N
is the total number of
values summed.
Args:
data: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
segment_ids: A Tensor
. Must be one of the following types: int32
, int64
.
A 1-D tensor whose rank is equal to the rank of data
's
first dimension. Values should be sorted and can be repeated.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as data
.
Has same shape as data, except for dimension 0 which
has size k
, the number of segments.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def segment_min(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.segment_min, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.segment_min
Return
Applicative
Origial documentation for Builder.segment_min
def segment_min(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.segment_min
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.segment_min
def segment_min(data, segment_ids, name=None)
Computes the minimum along segments of a tensor.
Read the section on Segmentation for an explanation of segments.
Computes a tensor such that
\(output_i = \min_j(data_j)\) where min
is over j
such
that segment_ids[j] == i
.
Args:
data: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
segment_ids: A Tensor
. Must be one of the following types: int32
, int64
.
A 1-D tensor whose rank is equal to the rank of data
's
first dimension. Values should be sorted and can be repeated.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as data
.
Has same shape as data, except for dimension 0 which
has size k
, the number of segments.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def segment_min_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.segment_min_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.segment_min_layer
Return
Applicative
Origial documentation for Builder.segment_min_layer
def segment_min_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.segment_min, ...)
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.segment_min
def segment_min(data, segment_ids, name=None):
Computes the minimum along segments of a tensor.
Read the section on Segmentation for an explanation of segments.
Computes a tensor such that
\(output_i = \min_j(data_j)\) where min
is over j
such
that segment_ids[j] == i
.
Args:
data: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
segment_ids: A Tensor
. Must be one of the following types: int32
, int64
.
A 1-D tensor whose rank is equal to the rank of data
's
first dimension. Values should be sorted and can be repeated.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as data
.
Has same shape as data, except for dimension 0 which
has size k
, the number of segments.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def segment_prod(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.segment_prod, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.segment_prod
Return
Applicative
Origial documentation for Builder.segment_prod
def segment_prod(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.segment_prod
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.segment_prod
def segment_prod(data, segment_ids, name=None)
Computes the product along segments of a tensor.
Read the section on Segmentation for an explanation of segments.
Computes a tensor such that
\(output_i = \prod_j data_j\) where the product is over j
such
that segment_ids[j] == i
.
Args:
data: A Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
segment_ids: A Tensor
. Must be one of the following types: int32
, int64
.
A 1-D tensor whose rank is equal to the rank of data
's
first dimension. Values should be sorted and can be repeated.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as data
.
Has same shape as data, except for dimension 0 which
has size k
, the number of segments.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def segment_prod_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.segment_prod_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.segment_prod_layer
Return
Applicative
Origial documentation for Builder.segment_prod_layer
def segment_prod_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.segment_prod, ...)
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.segment_prod
def segment_prod(data, segment_ids, name=None):
Computes the product along segments of a tensor.
Read the section on Segmentation for an explanation of segments.
Computes a tensor such that
\(output_i = \prod_j data_j\) where the product is over j
such
that segment_ids[j] == i
.
Args:
data: A Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
segment_ids: A Tensor
. Must be one of the following types: int32
, int64
.
A 1-D tensor whose rank is equal to the rank of data
's
first dimension. Values should be sorted and can be repeated.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as data
.
Has same shape as data, except for dimension 0 which
has size k
, the number of segments.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def segment_sum(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.segment_sum, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.segment_sum
Return
Applicative
Origial documentation for Builder.segment_sum
def segment_sum(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.segment_sum
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.segment_sum
def segment_sum(data, segment_ids, name=None)
Computes the sum along segments of a tensor.
Read the section on Segmentation for an explanation of segments.
Computes a tensor such that
\(output_i = \sum_j data_j\) where sum is over j
such
that segment_ids[j] == i
.
Args:
data: A Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.
segment_ids: A Tensor
. Must be one of the following types: int32
, int64
.
A 1-D tensor whose rank is equal to the rank of data
's
first dimension. Values should be sorted and can be repeated.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as data
.
Has same shape as data, except for dimension 0 which
has size k
, the number of segments.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def segment_sum_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.segment_sum_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.segment_sum_layer
Return
Applicative
Origial documentation for Builder.segment_sum_layer
def segment_sum_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.segment_sum, ...)
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.segment_sum
def segment_sum(data, segment_ids, name=None):
Computes the sum along segments of a tensor.
Read the section on Segmentation for an explanation of segments.
Computes a tensor such that
\(output_i = \sum_j data_j\) where sum is over j
such
that segment_ids[j] == i
.
Args:
data: A Tensor
. Must be one of the following types: float32
, float64
, int64
, int32
, uint8
, uint16
, int16
, int8
, complex64
, complex128
, qint8
, quint8
, qint32
, half
.