of type string
.
All the elements must have the same length.
out_type: A tf.DType
from: tf.float32, tf.float64, tf.int32, tf.uint8, tf.int16, tf.int8, tf.int64
.
little_endian: An optional bool
. Defaults to True
.
Whether the input bytes
are in little-endian order.
Ignored for out_type
values that are stored in a single byte like
uint8
.
name: A name for the operation (optional).
Returns:
A Tensor
of type out_type
.
A Tensor with one more dimension than the input bytes
. The
added dimension will have size equal to the length of the elements
of bytes
divided by the number of bytes to represent out_type
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def decode_raw_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.decode_raw_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.decode_raw_layer
Return
Applicative
Origial documentation for Builder.decode_raw_layer
def decode_raw_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.decode_raw, ...)
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.decode_raw
def decode_raw(bytes, out_type, little_endian=None, name=None):
Reinterpret the bytes of a string as a vector of numbers.
Args:
bytes: A Tensor
of type string
.
All the elements must have the same length.
out_type: A tf.DType
from: tf.float32, tf.float64, tf.int32, tf.uint8, tf.int16, tf.int8, tf.int64
.
little_endian: An optional bool
. Defaults to True
.
Whether the input bytes
are in little-endian order.
Ignored for out_type
values that are stored in a single byte like
uint8
.
name: A name for the operation (optional).
Returns:
A Tensor
of type out_type
.
A Tensor with one more dimension than the input bytes
. The
added dimension will have size equal to the length of the elements
of bytes
divided by the number of bytes to represent out_type
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def delete_session_tensor(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.delete_session_tensor, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.delete_session_tensor
Return
Applicative
Origial documentation for Builder.delete_session_tensor
def delete_session_tensor(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.delete_session_tensor
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.delete_session_tensor
def delete_session_tensor(handle, name=None)
Delete the tensor for the given tensor handle.
This is EXPERIMENTAL and subject to change.
Delete the tensor of a given tensor handle. The tensor is produced in a previous run() and stored in the state of the session.
Args: handle: The string representation of a persistent tensor handle. name: Optional name prefix for the return tensor.
Returns: A pair of graph elements. The first is a placeholder for feeding a tensor handle and the second is a deletion operation.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def delete_session_tensor_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.delete_session_tensor_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.delete_session_tensor_layer
Return
Applicative
Origial documentation for Builder.delete_session_tensor_layer
def delete_session_tensor_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.delete_session_tensor, ...)
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.delete_session_tensor
def delete_session_tensor(handle, name=None):
Delete the tensor for the given tensor handle.
This is EXPERIMENTAL and subject to change.
Delete the tensor of a given tensor handle. The tensor is produced in a previous run() and stored in the state of the session.
Args: handle: The string representation of a persistent tensor handle. name: Optional name prefix for the return tensor.
Returns: A pair of graph elements. The first is a placeholder for feeding a tensor handle and the second is a deletion operation.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def depth_to_space(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.depth_to_space, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.depth_to_space
Return
Applicative
Origial documentation for Builder.depth_to_space
def depth_to_space(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.depth_to_space
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.depth_to_space
def depth_to_space(input, block_size, name=None)
DepthToSpace for tensors of type T.
Rearranges data from depth into blocks of spatial data.
This is the reverse transformation of SpaceToDepth. More specifically,
this op outputs a copy of the input tensor where values from the depth
dimension are moved in spatial blocks to the height
and width
dimensions.
The attr block_size
indicates the input block size and how the data is moved.
- Chunks of data of size
block_size * block_size
from depth are rearranged into non-overlapping blocks of sizeblock_size x block_size
- The width the output tensor is
input_depth * block_size
, whereas the height isinput_height * block_size
. - The depth of the input tensor must be divisible by
block_size * block_size
.
That is, assuming the input is in the shape:
[batch, height, width, depth]
,
the shape of the output will be:
[batch, height*block_size, width*block_size, depth/(block_size*block_size)]
This operation requires that the input tensor be of rank 4, and that
block_size
be >=1 and that block_size * block_size
be a divisor of the
input depth.
This operation is useful for resizing the activations between convolutions (but keeping all data), e.g. instead of pooling. It is also useful for training purely convolutional models.
For example, given this input of shape [1, 1, 1, 4]
, and a block size of 2:
```prettyprint x = [[[[1, 2, 3, 4]]]]
```
This operation will output a tensor of shape [1, 2, 2, 1]
:
prettyprint
[[[[1], [2]],
[[3], [4]]]]
Here, the input has a batch of 1 and each batch element has shape [1, 1, 4]
,
the corresponding output will have 2x2 elements and will have a depth of
1 channel (1 = 4 / (block_size * block_size)
).
The output element shape is [2, 2, 1]
.
For an input tensor with larger depth, here of shape [1, 1, 1, 12]
, e.g.
prettyprint
x = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
This operation, for block size of 2, will return the following tensor of shape
[1, 2, 2, 3]
```prettyprint [[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]]
```
Similarly, for the following input of shape [1 2 2 4]
, and a block size of 2:
prettyprint
x = [[[[1, 2, 3, 4],
[5, 6, 7, 8]],
[[9, 10, 11, 12],
[13, 14, 15, 16]]]]
the operator will return the following tensor of shape [1 4 4 1]
:
```prettyprint x = [[ [1], [2], [5], [6]], [ [3], [4], [7], [8]], [ [9], [10], [13], [14]], [ [11], [12], [15], [16]]]
```
Args:
input: A Tensor
.
block_size: An int
that is >= 2
.
The size of the spatial block, same as in Space2Depth.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def depth_to_space_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.depth_to_space_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.depth_to_space_layer
Return
Applicative
Origial documentation for Builder.depth_to_space_layer
def depth_to_space_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.depth_to_space, ...)
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.depth_to_space
def depth_to_space(input, block_size, name=None):
DepthToSpace for tensors of type T.
Rearranges data from depth into blocks of spatial data.
This is the reverse transformation of SpaceToDepth. More specifically,
this op outputs a copy of the input tensor where values from the depth
dimension are moved in spatial blocks to the height
and width
dimensions.
The attr block_size
indicates the input block size and how the data is moved.
- Chunks of data of size
block_size * block_size
from depth are rearranged into non-overlapping blocks of sizeblock_size x block_size
- The width the output tensor is
input_depth * block_size
, whereas the height isinput_height * block_size
. - The depth of the input tensor must be divisible by
block_size * block_size
.
That is, assuming the input is in the shape:
[batch, height, width, depth]
,
the shape of the output will be:
[batch, height*block_size, width*block_size, depth/(block_size*block_size)]
This operation requires that the input tensor be of rank 4, and that
block_size
be >=1 and that block_size * block_size
be a divisor of the
input depth.
This operation is useful for resizing the activations between convolutions (but keeping all data), e.g. instead of pooling. It is also useful for training purely convolutional models.
For example, given this input of shape [1, 1, 1, 4]
, and a block size of 2:
```prettyprint x = [[[[1, 2, 3, 4]]]]
```
This operation will output a tensor of shape [1, 2, 2, 1]
:
prettyprint
[[[[1], [2]],
[[3], [4]]]]
Here, the input has a batch of 1 and each batch element has shape [1, 1, 4]
,
the corresponding output will have 2x2 elements and will have a depth of
1 channel (1 = 4 / (block_size * block_size)
).
The output element shape is [2, 2, 1]
.
For an input tensor with larger depth, here of shape [1, 1, 1, 12]
, e.g.
prettyprint
x = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
This operation, for block size of 2, will return the following tensor of shape
[1, 2, 2, 3]
```prettyprint [[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]]
```
Similarly, for the following input of shape [1 2 2 4]
, and a block size of 2:
prettyprint
x = [[[[1, 2, 3, 4],
[5, 6, 7, 8]],
[[9, 10, 11, 12],
[13, 14, 15, 16]]]]
the operator will return the following tensor of shape [1 4 4 1]
:
```prettyprint x = [[ [1], [2], [5], [6]], [ [3], [4], [7], [8]], [ [9], [10], [13], [14]], [ [11], [12], [15], [16]]]
```
Args:
input: A Tensor
.
block_size: An int
that is >= 2
.
The size of the spatial block, same as in Space2Depth.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def depthwise_conv2d(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.depthwise_conv2d, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.depthwise_conv2d
Return
Applicative
Origial documentation for Builder.depthwise_conv2d
def depthwise_conv2d(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.depthwise_conv2d
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.depthwise_conv2d
def depthwise_conv2d(input, filter, strides, padding, name=None)
Depthwise 2-D convolution.
Given an input tensor of shape [batch, in_height, in_width, in_channels]
and a filter tensor of shape
[filter_height, filter_width, in_channels, channel_multiplier]
containing in_channels
convolutional filters of depth 1, depthwise_conv2d
applies a different filter to each input channel (expanding from 1 channel
to channel_multiplier
channels for each), then concatenates the results
together. The output has in_channels * channel_multiplier
channels.
In detail,
output[b, i, j, k * channel_multiplier + q] = sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] * filter[di, dj, k, q]
Must have strides[0] = strides[3] = 1
. For the most common case of the
same horizontal and vertical strides, strides = [1, stride, stride, 1]
.
Args:
input: 4-D with shape [batch, in_height, in_width, in_channels]
.
filter: 4-D with shape
[filter_height, filter_width, in_channels, channel_multiplier]
.
strides: 1-D of size 4. The stride of the sliding window for each
dimension of input
.
padding: A string, either 'VALID'
or 'SAME'
. The padding algorithm.
See the comment
here
name: A name for this operation (optional).
Returns:
A 4-D Tensor
of shape
[batch, out_height, out_width, in_channels * channel_multiplier].
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def depthwise_conv2d_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.depthwise_conv2d_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.depthwise_conv2d_layer
Return
Applicative
Origial documentation for Builder.depthwise_conv2d_layer
def depthwise_conv2d_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.depthwise_conv2d, ...)
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.depthwise_conv2d
def depthwise_conv2d(input, filter, strides, padding, name=None):
Depthwise 2-D convolution.
Given an input tensor of shape [batch, in_height, in_width, in_channels]
and a filter tensor of shape
[filter_height, filter_width, in_channels, channel_multiplier]
containing in_channels
convolutional filters of depth 1, depthwise_conv2d
applies a different filter to each input channel (expanding from 1 channel
to channel_multiplier
channels for each), then concatenates the results
together. The output has in_channels * channel_multiplier
channels.
In detail,
output[b, i, j, k * channel_multiplier + q] = sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] * filter[di, dj, k, q]
Must have strides[0] = strides[3] = 1
. For the most common case of the
same horizontal and vertical strides, strides = [1, stride, stride, 1]
.
Args:
input: 4-D with shape [batch, in_height, in_width, in_channels]
.
filter: 4-D with shape
[filter_height, filter_width, in_channels, channel_multiplier]
.
strides: 1-D of size 4. The stride of the sliding window for each
dimension of input
.
padding: A string, either 'VALID'
or 'SAME'
. The padding algorithm.
See the comment
here
name: A name for this operation (optional).
Returns:
A 4-D Tensor
of shape
[batch, out_height, out_width, in_channels * channel_multiplier].
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def depthwise_conv2d_native(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.depthwise_conv2d_native, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.depthwise_conv2d_native
Return
Applicative
Origial documentation for Builder.depthwise_conv2d_native
def depthwise_conv2d_native(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.depthwise_conv2d_native
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.depthwise_conv2d_native
def depthwise_conv2d_native(input, filter, strides, padding, name=None)
Computes a 2-D depthwise convolution given 4-D input
and filter
tensors.
Given an input tensor of shape [batch, in_height, in_width, in_channels]
and a filter / kernel tensor of shape
[filter_height, filter_width, in_channels, channel_multiplier]
, containing
in_channels
convolutional filters of depth 1, depthwise_conv2d
applies
a different filter to each input channel (expanding from 1 channel to
channel_multiplier
channels for each), then concatenates the results
together. Thus, the output has in_channels * channel_multiplier
channels.
for k in 0..in_channels-1 for q in 0..channel_multiplier-1 output[b, i, j, k * channel_multiplier + q] = sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] * filter[di, dj, k, q]
Must have strides[0] = strides[3] = 1
. For the most common case of the same
horizontal and vertices strides, strides = [1, stride, stride, 1]
.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
.
filter: A Tensor
. Must have the same type as input
.
strides: A list of ints
.
1-D of length 4. The stride of the sliding window for each dimension
of input
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def depthwise_conv2d_native_backprop_filter(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.depthwise_conv2d_native_backprop_filter, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.depthwise_conv2d_native_backprop_filter
Return
Applicative
Origial documentation for Builder.depthwise_conv2d_native_backprop_filter
def depthwise_conv2d_native_backprop_filter(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.depthwise_conv2d_native_backprop_filter
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.depthwise_conv2d_native_backprop_filter
def depthwise_conv2d_native_backprop_filter(input, filter_sizes, out_backprop, strides, padding, name=None)
Computes the gradients of depthwise convolution with respect to the filter.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
.
4-D with shape [batch, in_height, in_width, in_channels]
.
filter_sizes: A Tensor
of type int32
.
An integer vector representing the tensor shape of filter
,
where filter
is a 4-D
[filter_height, filter_width, in_channels, depthwise_multiplier]
tensor.
out_backprop: A Tensor
. Must have the same type as input
.
4-D with shape [batch, out_height, out_width, out_channels]
.
Gradients w.r.t. the output of the convolution.
strides: A list of ints
.
The stride of the sliding window for each dimension of the input
of the convolution.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
. 4-D with shape
[filter_height, filter_width, in_channels, out_channels]
. Gradient w.r.t.
the filter
input of the convolution.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def depthwise_conv2d_native_backprop_filter_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.depthwise_conv2d_native_backprop_filter_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.depthwise_conv2d_native_backprop_filter_layer
Return
Applicative
Origial documentation for Builder.depthwise_conv2d_native_backprop_filter_layer
def depthwise_conv2d_native_backprop_filter_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.depthwise_conv2d_native_backprop_filter, ...)
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.depthwise_conv2d_native_backprop_filter
def depthwise_conv2d_native_backprop_filter(input, filter_sizes, out_backprop, strides, padding, name=None):
Computes the gradients of depthwise convolution with respect to the filter.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
.
4-D with shape [batch, in_height, in_width, in_channels]
.
filter_sizes: A Tensor
of type int32
.
An integer vector representing the tensor shape of filter
,
where filter
is a 4-D
[filter_height, filter_width, in_channels, depthwise_multiplier]
tensor.
out_backprop: A Tensor
. Must have the same type as input
.
4-D with shape [batch, out_height, out_width, out_channels]
.
Gradients w.r.t. the output of the convolution.
strides: A list of ints
.
The stride of the sliding window for each dimension of the input
of the convolution.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
. 4-D with shape
[filter_height, filter_width, in_channels, out_channels]
. Gradient w.r.t.
the filter
input of the convolution.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def depthwise_conv2d_native_backprop_input(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.depthwise_conv2d_native_backprop_input, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.depthwise_conv2d_native_backprop_input
Return
Applicative
Origial documentation for Builder.depthwise_conv2d_native_backprop_input
def depthwise_conv2d_native_backprop_input(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.depthwise_conv2d_native_backprop_input
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.depthwise_conv2d_native_backprop_input
def depthwise_conv2d_native_backprop_input(input_sizes, filter, out_backprop, strides, padding, name=None)
Computes the gradients of depthwise convolution with respect to the input.
Args:
input_sizes: A Tensor
of type int32
.
An integer vector representing the shape of input
,
where input
is a 4-D [batch, height, width, channels]
tensor.
filter: A Tensor
. Must be one of the following types: float32
, float64
.
4-D with shape
[filter_height, filter_width, in_channels, depthwise_multiplier]
.
out_backprop: A Tensor
. Must have the same type as filter
.
4-D with shape [batch, out_height, out_width, out_channels]
.
Gradients w.r.t. the output of the convolution.
strides: A list of ints
.
The stride of the sliding window for each dimension of the input
of the convolution.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as filter
.
4-D with shape [batch, in_height, in_width, in_channels]
. Gradient
w.r.t. the input of the convolution.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def depthwise_conv2d_native_backprop_input_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.depthwise_conv2d_native_backprop_input_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.depthwise_conv2d_native_backprop_input_layer
Return
Applicative
Origial documentation for Builder.depthwise_conv2d_native_backprop_input_layer
def depthwise_conv2d_native_backprop_input_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.depthwise_conv2d_native_backprop_input, ...)
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.depthwise_conv2d_native_backprop_input
def depthwise_conv2d_native_backprop_input(input_sizes, filter, out_backprop, strides, padding, name=None):
Computes the gradients of depthwise convolution with respect to the input.
Args:
input_sizes: A Tensor
of type int32
.
An integer vector representing the shape of input
,
where input
is a 4-D [batch, height, width, channels]
tensor.
filter: A Tensor
. Must be one of the following types: float32
, float64
.
4-D with shape
[filter_height, filter_width, in_channels, depthwise_multiplier]
.
out_backprop: A Tensor
. Must have the same type as filter
.
4-D with shape [batch, out_height, out_width, out_channels]
.
Gradients w.r.t. the output of the convolution.
strides: A list of ints
.
The stride of the sliding window for each dimension of the input
of the convolution.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as filter
.
4-D with shape [batch, in_height, in_width, in_channels]
. Gradient
w.r.t. the input of the convolution.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def depthwise_conv2d_native_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.depthwise_conv2d_native_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.depthwise_conv2d_native_layer
Return
Applicative
Origial documentation for Builder.depthwise_conv2d_native_layer
def depthwise_conv2d_native_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.depthwise_conv2d_native, ...)
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.depthwise_conv2d_native
def depthwise_conv2d_native(input, filter, strides, padding, name=None):
Computes a 2-D depthwise convolution given 4-D input
and filter
tensors.
Given an input tensor of shape [batch, in_height, in_width, in_channels]
and a filter / kernel tensor of shape
[filter_height, filter_width, in_channels, channel_multiplier]
, containing
in_channels
convolutional filters of depth 1, depthwise_conv2d
applies
a different filter to each input channel (expanding from 1 channel to
channel_multiplier
channels for each), then concatenates the results
together. Thus, the output has in_channels * channel_multiplier
channels.
for k in 0..in_channels-1 for q in 0..channel_multiplier-1 output[b, i, j, k * channel_multiplier + q] = sum_{di, dj} input[b, strides[1] * i + di, strides[2] * j + dj, k] * filter[di, dj, k, q]
Must have strides[0] = strides[3] = 1
. For the most common case of the same
horizontal and vertices strides, strides = [1, stride, stride, 1]
.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
.
filter: A Tensor
. Must have the same type as input
.
strides: A list of ints
.
1-D of length 4. The stride of the sliding window for each dimension
of input
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def deserialize_many_sparse(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.deserialize_many_sparse, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.deserialize_many_sparse
Return
Applicative
Origial documentation for Builder.deserialize_many_sparse
def deserialize_many_sparse(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.deserialize_many_sparse
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.deserialize_many_sparse
def deserialize_many_sparse(serialized_sparse, dtype, rank=None, name=None)
Deserialize and concatenate SparseTensors
from a serialized minibatch.
The input serialized_sparse
must be a string matrix of shape [N x 3]
where
N
is the minibatch size and the rows correspond to packed outputs of
serialize_sparse
. The ranks of the original SparseTensor
objects
must all match. When the final SparseTensor
is created, it has rank one
higher than the ranks of the incoming SparseTensor
objects (they have been
concatenated along a new row dimension).
The output SparseTensor
object's shape values for all dimensions but the
first are the max across the input SparseTensor
objects' shape values
for the corresponding dimensions. Its first shape value is N
, the minibatch
size.
The input SparseTensor
objects' indices are assumed ordered in
standard lexicographic order. If this is not the case, after this
step run sparse_reorder
to restore index ordering.
For example, if the serialized input is a [2, 3]
matrix representing two
original SparseTensor
objects:
index = [ 0] [10] [20] values = [1, 2, 3] shape = [50]
and
index = [ 2] [10] values = [4, 5] shape = [30]
then the final deserialized SparseTensor
will be:
index = [0 0] [0 10] [0 20] [1 2] [1 10] values = [1, 2, 3, 4, 5] shape = [2 50]
Args:
serialized_sparse: 2-D Tensor
of type string
of shape [N, 3]
.
The serialized and packed SparseTensor
objects.
dtype: The dtype
of the serialized SparseTensor
objects.
rank: (optional) Python int, the rank of the SparseTensor
objects.
name: A name prefix for the returned tensors (optional)
Returns:
A SparseTensor
representing the deserialized SparseTensor
s,
concatenated along the SparseTensor
s' first dimension.
All of the serialized SparseTensor
s must have had the same rank and type.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def deserialize_many_sparse_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.deserialize_many_sparse_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.deserialize_many_sparse_layer
Return
Applicative
Origial documentation for Builder.deserialize_many_sparse_layer
def deserialize_many_sparse_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.deserialize_many_sparse, ...)
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.deserialize_many_sparse
def deserialize_many_sparse(serialized_sparse, dtype, rank=None, name=None):
Deserialize and concatenate SparseTensors
from a serialized minibatch.
The input serialized_sparse
must be a string matrix of shape [N x 3]
where
N
is the minibatch size and the rows correspond to packed outputs of
serialize_sparse
. The ranks of the original SparseTensor
objects
must all match. When the final SparseTensor
is created, it has rank one
higher than the ranks of the incoming SparseTensor
objects (they have been
concatenated along a new row dimension).
The output SparseTensor
object's shape values for all dimensions but the
first are the max across the input SparseTensor
objects' shape values
for the corresponding dimensions. Its first shape value is N
, the minibatch
size.
The input SparseTensor
objects' indices are assumed ordered in
standard lexicographic order. If this is not the case, after this
step run sparse_reorder
to restore index ordering.
For example, if the serialized input is a [2, 3]
matrix representing two
original SparseTensor
objects:
index = [ 0] [10] [20] values = [1, 2, 3] shape = [50]
and
index = [ 2] [10] values = [4, 5] shape = [30]
then the final deserialized SparseTensor
will be:
index = [0 0] [0 10] [0 20] [1 2] [1 10] values = [1, 2, 3, 4, 5] shape = [2 50]
Args:
serialized_sparse: 2-D Tensor
of type string
of shape [N, 3]
.
The serialized and packed SparseTensor
objects.
dtype: The dtype
of the serialized SparseTensor
objects.
rank: (optional) Python int, the rank of the SparseTensor
objects.
name: A name prefix for the returned tensors (optional)
Returns:
A SparseTensor
representing the deserialized SparseTensor
s,
concatenated along the SparseTensor
s' first dimension.
All of the serialized SparseTensor
s must have had the same rank and type.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def diag(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.diag, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.diag
Return
Applicative
Origial documentation for Builder.diag
def diag(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.diag
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.diag
def diag(diagonal, name=None)
Returns a diagonal tensor with a given diagonal values.
Given a diagonal
, this operation returns a tensor with the diagonal
and
everything else padded with zeros. The diagonal is computed as follows:
Assume diagonal
has dimensions [D1,..., Dk], then the output is a tensor of
rank 2k with dimensions [D1,..., Dk, D1,..., Dk] where:
output[i1,..., ik, i1,..., ik] = diagonal[i1, ..., ik]
and 0 everywhere else.
For example:
```prettyprint
'diagonal' is [1, 2, 3, 4]
tf.diag(diagonal) ==> [[1, 0, 0, 0] [0, 2, 0, 0] [0, 0, 3, 0] [0, 0, 0, 4]] ```
Args:
diagonal: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, complex64
, complex128
.
Rank k tensor where k is at most 3.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as diagonal
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def diag_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.diag_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.diag_layer
Return
Applicative
Origial documentation for Builder.diag_layer
def diag_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.diag, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.diag
def diag(diagonal, name=None):
Returns a diagonal tensor with a given diagonal values.
Given a diagonal
, this operation returns a tensor with the diagonal
and
everything else padded with zeros. The diagonal is computed as follows:
Assume diagonal
has dimensions [D1,..., Dk], then the output is a tensor of
rank 2k with dimensions [D1,..., Dk, D1,..., Dk] where:
output[i1,..., ik, i1,..., ik] = diagonal[i1, ..., ik]
and 0 everywhere else.
For example:
```prettyprint
'diagonal' is [1, 2, 3, 4]
tf.diag(diagonal) ==> [[1, 0, 0, 0] [0, 2, 0, 0] [0, 0, 3, 0] [0, 0, 0, 4]] ```
Args:
diagonal: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, complex64
, complex128
.
Rank k tensor where k is at most 3.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as diagonal
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def diag_part(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.diag_part, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.diag_part
Return
Applicative
Origial documentation for Builder.diag_part
def diag_part(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.diag_part
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.diag_part
def diag_part(input, name=None)
Returns the diagonal part of the tensor.
This operation returns a tensor with the diagonal
part
of the input
. The diagonal
part is computed as follows:
Assume input
has dimensions [D1,..., Dk, D1,..., Dk]
, then the output is a
tensor of rank k
with dimensions [D1,..., Dk]
where:
diagonal[i1,..., ik] = input[i1, ..., ik, i1,..., ik]
.
For example:
```prettyprint
'input' is [[1, 0, 0, 0]
[0, 2, 0, 0] [0, 0, 3, 0] [0, 0, 0, 4]]
tf.diag_part(input) ==> [1, 2, 3, 4] ```
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, complex64
, complex128
.
Rank k tensor where k is 2, 4, or 6.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
. The extracted diagonal.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def diag_part_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.diag_part_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.diag_part_layer
Return
Applicative
Origial documentation for Builder.diag_part_layer
def diag_part_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.diag_part, ...)
Arguments
size
: the size of the resulting layer- All other *args and **kwargs are forwarded to
tf.contrib.layers.fully_connected
Return
Builder
Origial documentation for tf.diag_part
def diag_part(input, name=None):
Returns the diagonal part of the tensor.
This operation returns a tensor with the diagonal
part
of the input
. The diagonal
part is computed as follows:
Assume input
has dimensions [D1,..., Dk, D1,..., Dk]
, then the output is a
tensor of rank k
with dimensions [D1,..., Dk]
where:
diagonal[i1,..., ik] = input[i1, ..., ik, i1,..., ik]
.
For example:
```prettyprint
'input' is [[1, 0, 0, 0]
[0, 2, 0, 0] [0, 0, 3, 0] [0, 0, 0, 4]]
tf.diag_part(input) ==> [1, 2, 3, 4] ```
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, complex64
, complex128
.
Rank k tensor where k is 2, 4, or 6.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
. The extracted diagonal.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def digamma(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.digamma, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.digamma
Return
Applicative
Origial documentation for Builder.digamma
def digamma(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.digamma
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.digamma
def digamma(x, name=None)
Computes Psi, the derivative of Lgamma (the log of the absolute value of
Gamma(x)
), element-wise.
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
.
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 digamma_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.digamma_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.digamma_layer
Return
Applicative
Origial documentation for Builder.digamma_layer
def digamma_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.digamma, ...)
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.digamma
def digamma(x, name=None):
Computes Psi, the derivative of Lgamma (the log of the absolute value of
Gamma(x)
), element-wise.
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
.
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 dilation2d(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dilation2d, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dilation2d
Return
Applicative
Origial documentation for Builder.dilation2d
def dilation2d(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.dilation2d
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.dilation2d
def dilation2d(input, filter, strides, rates, padding, name=None)
Computes the grayscale dilation of 4-D input
and 3-D filter
tensors.
The input
tensor has shape [batch, in_height, in_width, depth]
and the
filter
tensor has shape [filter_height, filter_width, depth]
, i.e., each
input channel is processed independently of the others with its own structuring
function. The output
tensor has shape
[batch, out_height, out_width, depth]
. The spatial dimensions of the output
tensor depend on the padding
algorithm. We currently only support the default
"NHWC" data_format
.
In detail, the grayscale morphological 2-D dilation is the max-sum correlation
(for consistency with conv2d
, we use unmirrored filters):
output[b, y, x, c] = max_{dy, dx} input[b, strides[1] * y + rates[1] * dy, strides[2] * x + rates[2] * dx, c] + filter[dy, dx, c]
Max-pooling is a special case when the filter has size equal to the pooling kernel size and contains all zeros.
Note on duality: The dilation of input
by the filter
is equal to the
negation of the erosion of -input
by the reflected filter
.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
4-D with shape [batch, in_height, in_width, depth]
.
filter: A Tensor
. Must have the same type as input
.
3-D with shape [filter_height, filter_width, depth]
.
strides: A list of ints
that has length >= 4
.
The stride of the sliding window for each dimension of the input
tensor. Must be: [1, stride_height, stride_width, 1]
.
rates: A list of ints
that has length >= 4
.
The input stride for atrous morphological dilation. Must be:
[1, rate_height, rate_width, 1]
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
4-D with shape [batch, out_height, out_width, depth]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dilation2d_backprop_filter(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dilation2d_backprop_filter, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dilation2d_backprop_filter
Return
Applicative
Origial documentation for Builder.dilation2d_backprop_filter
def dilation2d_backprop_filter(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.dilation2d_backprop_filter
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.dilation2d_backprop_filter
def dilation2d_backprop_filter(input, filter, out_backprop, strides, rates, padding, name=None)
Computes the gradient of morphological 2-D dilation with respect to the filter.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
4-D with shape [batch, in_height, in_width, depth]
.
filter: A Tensor
. Must have the same type as input
.
3-D with shape [filter_height, filter_width, depth]
.
out_backprop: A Tensor
. Must have the same type as input
.
4-D with shape [batch, out_height, out_width, depth]
.
strides: A list of ints
that has length >= 4
.
1-D of length 4. The stride of the sliding window for each dimension of
the input tensor. Must be: [1, stride_height, stride_width, 1]
.
rates: A list of ints
that has length >= 4
.
1-D of length 4. The input stride for atrous morphological dilation.
Must be: [1, rate_height, rate_width, 1]
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
3-D with shape [filter_height, filter_width, depth]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dilation2d_backprop_filter_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dilation2d_backprop_filter_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dilation2d_backprop_filter_layer
Return
Applicative
Origial documentation for Builder.dilation2d_backprop_filter_layer
def dilation2d_backprop_filter_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.dilation2d_backprop_filter, ...)
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.dilation2d_backprop_filter
def dilation2d_backprop_filter(input, filter, out_backprop, strides, rates, padding, name=None):
Computes the gradient of morphological 2-D dilation with respect to the filter.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
4-D with shape [batch, in_height, in_width, depth]
.
filter: A Tensor
. Must have the same type as input
.
3-D with shape [filter_height, filter_width, depth]
.
out_backprop: A Tensor
. Must have the same type as input
.
4-D with shape [batch, out_height, out_width, depth]
.
strides: A list of ints
that has length >= 4
.
1-D of length 4. The stride of the sliding window for each dimension of
the input tensor. Must be: [1, stride_height, stride_width, 1]
.
rates: A list of ints
that has length >= 4
.
1-D of length 4. The input stride for atrous morphological dilation.
Must be: [1, rate_height, rate_width, 1]
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
3-D with shape [filter_height, filter_width, depth]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dilation2d_backprop_input(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dilation2d_backprop_input, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dilation2d_backprop_input
Return
Applicative
Origial documentation for Builder.dilation2d_backprop_input
def dilation2d_backprop_input(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.dilation2d_backprop_input
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.dilation2d_backprop_input
def dilation2d_backprop_input(input, filter, out_backprop, strides, rates, padding, name=None)
Computes the gradient of morphological 2-D dilation with respect to the input.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
4-D with shape [batch, in_height, in_width, depth]
.
filter: A Tensor
. Must have the same type as input
.
3-D with shape [filter_height, filter_width, depth]
.
out_backprop: A Tensor
. Must have the same type as input
.
4-D with shape [batch, out_height, out_width, depth]
.
strides: A list of ints
that has length >= 4
.
1-D of length 4. The stride of the sliding window for each dimension of
the input tensor. Must be: [1, stride_height, stride_width, 1]
.
rates: A list of ints
that has length >= 4
.
1-D of length 4. The input stride for atrous morphological dilation.
Must be: [1, rate_height, rate_width, 1]
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
4-D with shape [batch, in_height, in_width, depth]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dilation2d_backprop_input_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dilation2d_backprop_input_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dilation2d_backprop_input_layer
Return
Applicative
Origial documentation for Builder.dilation2d_backprop_input_layer
def dilation2d_backprop_input_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.dilation2d_backprop_input, ...)
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.dilation2d_backprop_input
def dilation2d_backprop_input(input, filter, out_backprop, strides, rates, padding, name=None):
Computes the gradient of morphological 2-D dilation with respect to the input.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
4-D with shape [batch, in_height, in_width, depth]
.
filter: A Tensor
. Must have the same type as input
.
3-D with shape [filter_height, filter_width, depth]
.
out_backprop: A Tensor
. Must have the same type as input
.
4-D with shape [batch, out_height, out_width, depth]
.
strides: A list of ints
that has length >= 4
.
1-D of length 4. The stride of the sliding window for each dimension of
the input tensor. Must be: [1, stride_height, stride_width, 1]
.
rates: A list of ints
that has length >= 4
.
1-D of length 4. The input stride for atrous morphological dilation.
Must be: [1, rate_height, rate_width, 1]
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
4-D with shape [batch, in_height, in_width, depth]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dilation2d_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dilation2d_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dilation2d_layer
Return
Applicative
Origial documentation for Builder.dilation2d_layer
def dilation2d_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.dilation2d, ...)
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.dilation2d
def dilation2d(input, filter, strides, rates, padding, name=None):
Computes the grayscale dilation of 4-D input
and 3-D filter
tensors.
The input
tensor has shape [batch, in_height, in_width, depth]
and the
filter
tensor has shape [filter_height, filter_width, depth]
, i.e., each
input channel is processed independently of the others with its own structuring
function. The output
tensor has shape
[batch, out_height, out_width, depth]
. The spatial dimensions of the output
tensor depend on the padding
algorithm. We currently only support the default
"NHWC" data_format
.
In detail, the grayscale morphological 2-D dilation is the max-sum correlation
(for consistency with conv2d
, we use unmirrored filters):
output[b, y, x, c] = max_{dy, dx} input[b, strides[1] * y + rates[1] * dy, strides[2] * x + rates[2] * dx, c] + filter[dy, dx, c]
Max-pooling is a special case when the filter has size equal to the pooling kernel size and contains all zeros.
Note on duality: The dilation of input
by the filter
is equal to the
negation of the erosion of -input
by the reflected filter
.
Args:
input: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
4-D with shape [batch, in_height, in_width, depth]
.
filter: A Tensor
. Must have the same type as input
.
3-D with shape [filter_height, filter_width, depth]
.
strides: A list of ints
that has length >= 4
.
The stride of the sliding window for each dimension of the input
tensor. Must be: [1, stride_height, stride_width, 1]
.
rates: A list of ints
that has length >= 4
.
The input stride for atrous morphological dilation. Must be:
[1, rate_height, rate_width, 1]
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
4-D with shape [batch, out_height, out_width, depth]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def div(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.div, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.div
Return
Applicative
Origial documentation for Builder.div
def div(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.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.div
def div(x, y, name=None)
Returns x / y element-wise.
NOTE: Div
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, uint8
, int8
, uint16
, int16
, int32
, int64
, complex64
, complex128
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def div_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.div_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.div_layer
Return
Applicative
Origial documentation for Builder.div_layer
def div_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.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.div
def div(x, y, name=None):
Returns x / y element-wise.
NOTE: Div
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, uint8
, int8
, uint16
, int16
, int32
, int64
, complex64
, complex128
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def drop_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.drop_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.drop_layer
Return
Applicative
Origial documentation for Builder.drop_layer
def drop_layer(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tensorbuilder.Builder.drop_layer
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tensorbuilder.Builder.drop_layer
def drop_layer(x, keep_prob, seed=None, name=None)
Computes dropout.
With probability keep_prob
, outputs the input element scaled up by
1 / keep_prob
, otherwise outputs 0
. The scaling is so that the expected
sum is unchanged.
Args:
x: A tensor.
keep_prob: A scalar Tensor
with the same type as x. The probability
that each element is kept.
noise_shape: A 1-D Tensor
of type int32
, representing the
shape for randomly generated keep/drop flags.
seed: A Python integer. Used to create random seeds. See
set_random_seed
for behavior.
name: A name for this operation (optional).
Returns:
A Tensor of the same shape of x
.
Raises:
ValueError: If keep_prob
is not in (0, 1]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dropout(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dropout, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dropout
Return
Applicative
Origial documentation for Builder.dropout
def dropout(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.dropout
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.dropout
def dropout(x, keep_prob, noise_shape=None, seed=None, name=None)
Computes dropout.
With probability keep_prob
, outputs the input element scaled up by
1 / keep_prob
, otherwise outputs 0
. The scaling is so that the expected
sum is unchanged.
By default, each element is kept or dropped independently. If noise_shape
is specified, it must be
broadcastable
to the shape of x
, and only dimensions with noise_shape[i] == shape(x)[i]
will make independent decisions. For example, if shape(x) = [k, l, m, n]
and noise_shape = [k, 1, 1, n]
, each batch and channel component will be
kept independently and each row and column will be kept or not kept together.
Args:
x: A tensor.
keep_prob: A scalar Tensor
with the same type as x. The probability
that each element is kept.
noise_shape: A 1-D Tensor
of type int32
, representing the
shape for randomly generated keep/drop flags.
seed: A Python integer. Used to create random seeds. See
set_random_seed
for behavior.
name: A name for this operation (optional).
Returns:
A Tensor of the same shape of x
.
Raises:
ValueError: If keep_prob
is not in (0, 1]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dropout_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dropout_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dropout_layer
Return
Applicative
Origial documentation for Builder.dropout_layer
def dropout_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.dropout, ...)
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.dropout
def dropout(x, keep_prob, noise_shape=None, seed=None, name=None):
Computes dropout.
With probability keep_prob
, outputs the input element scaled up by
1 / keep_prob
, otherwise outputs 0
. The scaling is so that the expected
sum is unchanged.
By default, each element is kept or dropped independently. If noise_shape
is specified, it must be
broadcastable
to the shape of x
, and only dimensions with noise_shape[i] == shape(x)[i]
will make independent decisions. For example, if shape(x) = [k, l, m, n]
and noise_shape = [k, 1, 1, n]
, each batch and channel component will be
kept independently and each row and column will be kept or not kept together.
Args:
x: A tensor.
keep_prob: A scalar Tensor
with the same type as x. The probability
that each element is kept.
noise_shape: A 1-D Tensor
of type int32
, representing the
shape for randomly generated keep/drop flags.
seed: A Python integer. Used to create random seeds. See
set_random_seed
for behavior.
name: A name for this operation (optional).
Returns:
A Tensor of the same shape of x
.
Raises:
ValueError: If keep_prob
is not in (0, 1]
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dynamic_partition(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dynamic_partition, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dynamic_partition
Return
Applicative
Origial documentation for Builder.dynamic_partition
def dynamic_partition(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.dynamic_partition
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.dynamic_partition
def dynamic_partition(data, partitions, num_partitions, name=None)
Partitions data
into num_partitions
tensors using indices from partitions
.
For each index tuple js
of size partitions.ndim
, the slice data[js, ...]
becomes part of outputs[partitions[js]]
. The slices with partitions[js] = i
are placed in outputs[i]
in lexicographic order of js
, and the first
dimension of outputs[i]
is the number of entries in partitions
equal to i
.
In detail,
outputs[i].shape = [sum(partitions == i)] + data.shape[partitions.ndim:] outputs[i] = pack([data[js, ...] for js if partitions[js] == i])
data.shape
must start with partitions.shape
.
For example:
# Scalar partitions partitions = 1 num_partitions = 2 data = [10, 20] outputs[0] = [] # Empty with shape [0, 2] outputs[1] = [[10, 20]] # Vector partitions partitions = [0, 0, 1, 1, 0] num_partitions = 2 data = [10, 20, 30, 40, 50] outputs[0] = [10, 20, 50] outputs[1] = [30, 40]
Args:
data: A Tensor
.
partitions: A Tensor
of type int32
.
Any shape. Indices in the range [0, num_partitions)
.
num_partitions: An int
that is >= 1
.
The number of partitions to output.
name: A name for the operation (optional).
Returns:
A list of num_partitions
Tensor
objects of the same type as data.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dynamic_partition_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dynamic_partition_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dynamic_partition_layer
Return
Applicative
Origial documentation for Builder.dynamic_partition_layer
def dynamic_partition_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.dynamic_partition, ...)
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.dynamic_partition
def dynamic_partition(data, partitions, num_partitions, name=None):
Partitions data
into num_partitions
tensors using indices from partitions
.
For each index tuple js
of size partitions.ndim
, the slice data[js, ...]
becomes part of outputs[partitions[js]]
. The slices with partitions[js] = i
are placed in outputs[i]
in lexicographic order of js
, and the first
dimension of outputs[i]
is the number of entries in partitions
equal to i
.
In detail,
outputs[i].shape = [sum(partitions == i)] + data.shape[partitions.ndim:] outputs[i] = pack([data[js, ...] for js if partitions[js] == i])
data.shape
must start with partitions.shape
.
For example:
# Scalar partitions partitions = 1 num_partitions = 2 data = [10, 20] outputs[0] = [] # Empty with shape [0, 2] outputs[1] = [[10, 20]] # Vector partitions partitions = [0, 0, 1, 1, 0] num_partitions = 2 data = [10, 20, 30, 40, 50] outputs[0] = [10, 20, 50] outputs[1] = [30, 40]
Args:
data: A Tensor
.
partitions: A Tensor
of type int32
.
Any shape. Indices in the range [0, num_partitions)
.
num_partitions: An int
that is >= 1
.
The number of partitions to output.
name: A name for the operation (optional).
Returns:
A list of num_partitions
Tensor
objects of the same type as data.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dynamic_rnn(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dynamic_rnn, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dynamic_rnn
Return
Applicative
Origial documentation for Builder.dynamic_rnn
def dynamic_rnn(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.dynamic_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.dynamic_rnn
def dynamic_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 dynamic_rnn_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dynamic_rnn_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dynamic_rnn_layer
Return
Applicative
Origial documentation for Builder.dynamic_rnn_layer
def dynamic_rnn_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.dynamic_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.dynamic_rnn
def dynamic_rnn(cell, inputs, sequence_length=None, initial_state=None, dtype=None, parallel_iterations=None, swap_memory=False, time_major=False, scope=None):
Creates a recurrent neural network specified by RNNCell cell
.
This function is functionally identical to the function rnn
above, but
performs fully dynamic unrolling of inputs
.
Unlike rnn
, the input inputs
is not a Python list of Tensors
, one for
each frame. Instead, inputs
may be a single Tensor
where
the maximum time is either the first or second dimension (see the parameter
time_major
). Alternatively, it may be a (possibly nested) tuple of
Tensors, each of them having matching batch and time dimensions.
The corresponding output is either a single Tensor
having the same number
of time steps and batch size, or a (possibly nested) tuple of such tensors,
matching the nested structure of cell.output_size
.
The parameter sequence_length
is optional and is used to copy-through state
and zero-out outputs when past a batch element's sequence length. So it's more
for correctness than performance, unlike in rnn().
Args: cell: An instance of RNNCell. inputs: The RNN inputs.
If `time_major == False` (default), this must be a `Tensor` of shape: `[batch_size, max_time, ...]`, or a nested tuple of such elements. If `time_major == True`, this must be a `Tensor` of shape: `[max_time, batch_size, ...]`, or a nested tuple of such elements. This may also be a (possibly nested) tuple of Tensors satisfying this property. The first two dimensions must match across all the inputs, but otherwise the ranks and other shape components may differ. In this case, input to `cell` at each time-step will replicate the structure of these tuples, except for the time dimension (from which the time is taken). The input to `cell` at each time step will be a `Tensor` or (possibly nested) tuple of Tensors each with dimensions `[batch_size, ...]`.
sequence_length: (optional) An int32/int64 vector sized [batch_size]
.
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.
parallel_iterations: (Default: 32). The number of iterations to run in
parallel. Those operations which do not have any temporal dependency
and can be run in parallel, will be. This parameter trades off
time for space. Values >> 1 use more memory but take less time,
while smaller values use less memory but computations take longer.
swap_memory: Transparently swap the tensors produced in forward inference
but needed for back prop from GPU to CPU. This allows training RNNs
which would typically not fit on a single GPU, with very minimal (or no)
performance penalty.
time_major: The shape format of the inputs
and outputs
Tensors.
If true, these Tensors
must be shaped [max_time, batch_size, depth]
.
If false, these Tensors
must be shaped [batch_size, max_time, depth]
.
Using time_major = True
is a bit more efficient because it avoids
transposes at the beginning and end of the RNN calculation. However,
most TensorFlow data is batch-major, so by default this function
accepts input and emits output in batch-major form.
scope: VariableScope for the created subgraph; defaults to "RNN".
Returns: A pair (outputs, state) where:
outputs: The RNN output `Tensor`. If time_major == False (default), this will be a `Tensor` shaped: `[batch_size, max_time, cell.output_size]`. If time_major == True, this will be a `Tensor` shaped: `[max_time, batch_size, cell.output_size]`. Note, if `cell.output_size` is a (possibly nested) tuple of integers or `TensorShape` objects, then `outputs` will be a tuple having the same structure as `cell.output_size`, containing Tensors having shapes corresponding to the shape data in `cell.output_size`. state: The final state. If `cell.state_size` is an int, this will be shaped `[batch_size, cell.state_size]`. If it is a `TensorShape`, this will be shaped `[batch_size] + cell.state_size`. If it is a (possibly nested) tuple of ints or `TensorShape`, this will be a tuple having the corresponding shapes.
Raises:
TypeError: If cell
is not an instance of RNNCell.
ValueError: If inputs is None or an empty list.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dynamic_stitch(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dynamic_stitch, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dynamic_stitch
Return
Applicative
Origial documentation for Builder.dynamic_stitch
def dynamic_stitch(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.dynamic_stitch
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.dynamic_stitch
def dynamic_stitch(indices, data, name=None)
Interleave the values from the data
tensors into a single tensor.
Builds a merged tensor such that
merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...]
For example, if each indices[m]
is scalar or vector, we have
# Scalar indices merged[indices[m], ...] = data[m][...] # Vector indices merged[indices[m][i], ...] = data[m][i, ...]
Each data[i].shape
must start with the corresponding indices[i].shape
,
and the rest of data[i].shape
must be constant w.r.t. i
. That is, we
must have data[i].shape = indices[i].shape + constant
. In terms of this
constant
, the output shape is
merged.shape = [max(indices)] + constant
Values are merged in order, so if an index appears in both indices[m][i]
and
indices[n][j]
for (m,i) < (n,j)
the slice data[n][j]
will appear in the
merged result.
For example:
indices[0] = 6 indices[1] = [4, 1] indices[2] = [[5, 2], [0, 3]] data[0] = [61, 62] data[1] = [[41, 42], [11, 12]] data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]] merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42], [51, 52], [61, 62]]
Args:
indices: A list of at least 1 Tensor
objects of type int32
.
data: A list with the same number of Tensor
objects as indices
of Tensor
objects of the same type.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as data
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def dynamic_stitch_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.dynamic_stitch_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.dynamic_stitch_layer
Return
Applicative
Origial documentation for Builder.dynamic_stitch_layer
def dynamic_stitch_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.dynamic_stitch, ...)
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.dynamic_stitch
def dynamic_stitch(indices, data, name=None):
Interleave the values from the data
tensors into a single tensor.
Builds a merged tensor such that
merged[indices[m][i, ..., j], ...] = data[m][i, ..., j, ...]
For example, if each indices[m]
is scalar or vector, we have
# Scalar indices merged[indices[m], ...] = data[m][...] # Vector indices merged[indices[m][i], ...] = data[m][i, ...]
Each data[i].shape
must start with the corresponding indices[i].shape
,
and the rest of data[i].shape
must be constant w.r.t. i
. That is, we
must have data[i].shape = indices[i].shape + constant
. In terms of this
constant
, the output shape is
merged.shape = [max(indices)] + constant
Values are merged in order, so if an index appears in both indices[m][i]
and
indices[n][j]
for (m,i) < (n,j)
the slice data[n][j]
will appear in the
merged result.
For example:
indices[0] = 6 indices[1] = [4, 1] indices[2] = [[5, 2], [0, 3]] data[0] = [61, 62] data[1] = [[41, 42], [11, 12]] data[2] = [[[51, 52], [21, 22]], [[1, 2], [31, 32]]] merged = [[1, 2], [11, 12], [21, 22], [31, 32], [41, 42], [51, 52], [61, 62]]
Args:
indices: A list of at least 1 Tensor
objects of type int32
.
data: A list with the same number of Tensor
objects as indices
of Tensor
objects of the same type.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as data
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def edit_distance(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.edit_distance, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.edit_distance
Return
Applicative
Origial documentation for Builder.edit_distance
def edit_distance(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.edit_distance
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.edit_distance
def edit_distance(hypothesis, truth, normalize=True, name="edit_distance")
Computes the Levenshtein distance between sequences.
This operation takes variable-length sequences (hypothesis
and truth
),
each provided as a SparseTensor
, and computes the Levenshtein distance.
You can normalize the edit distance by length of truth
by setting
normalize
to true.
For example, given the following input:
```python
'hypothesis' is a tensor of shape [2, 1]
with variable-length values:
(0,0) = ["a"]
(1,0) = ["b"]
hypothesis = tf.SparseTensor( [[0, 0, 0], [1, 0, 0]], ["a", "b"] (2, 1, 1))
'truth' is a tensor of shape [2, 2]
with variable-length values:
(0,0) = []
(0,1) = ["a"]
(1,0) = ["b", "c"]
(1,1) = ["a"]
truth = tf.SparseTensor( [[0, 1, 0], [1, 0, 0], [1, 0, 1], [1, 1, 0]] ["a", "b", "c", "a"], (2, 2, 2))
normalize = True ```
This operation would return the following:
```python
'output' is a tensor of shape [2, 2]
with edit distances normalized
by 'truth' lengths.
output ==> [[inf, 1.0], # (0,0): no truth, (0,1): no hypothesis [0.5, 1.0]] # (1,0): addition, (1,1): no hypothesis ```
Args:
hypothesis: A SparseTensor
containing hypothesis sequences.
truth: A SparseTensor
containing truth sequences.
normalize: A bool
. If True
, normalizes the Levenshtein distance by
length of truth.
name: A name for the operation (optional).
Returns:
A dense Tensor
with rank R - 1
, where R is the rank of the
SparseTensor
inputs hypothesis
and truth
.
Raises:
TypeError: If either hypothesis
or truth
are not a SparseTensor
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def edit_distance_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.edit_distance_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.edit_distance_layer
Return
Applicative
Origial documentation for Builder.edit_distance_layer
def edit_distance_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.edit_distance, ...)
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.edit_distance
def edit_distance(hypothesis, truth, normalize=True, name="edit_distance"):
Computes the Levenshtein distance between sequences.
This operation takes variable-length sequences (hypothesis
and truth
),
each provided as a SparseTensor
, and computes the Levenshtein distance.
You can normalize the edit distance by length of truth
by setting
normalize
to true.
For example, given the following input:
```python
'hypothesis' is a tensor of shape [2, 1]
with variable-length values:
(0,0) = ["a"]
(1,0) = ["b"]
hypothesis = tf.SparseTensor( [[0, 0, 0], [1, 0, 0]], ["a", "b"] (2, 1, 1))
'truth' is a tensor of shape [2, 2]
with variable-length values:
(0,0) = []
(0,1) = ["a"]
(1,0) = ["b", "c"]
(1,1) = ["a"]
truth = tf.SparseTensor( [[0, 1, 0], [1, 0, 0], [1, 0, 1], [1, 1, 0]] ["a", "b", "c", "a"], (2, 2, 2))
normalize = True ```
This operation would return the following:
```python
'output' is a tensor of shape [2, 2]
with edit distances normalized
by 'truth' lengths.
output ==> [[inf, 1.0], # (0,0): no truth, (0,1): no hypothesis [0.5, 1.0]] # (1,0): addition, (1,1): no hypothesis ```
Args:
hypothesis: A SparseTensor
containing hypothesis sequences.
truth: A SparseTensor
containing truth sequences.
normalize: A bool
. If True
, normalizes the Levenshtein distance by
length of truth.
name: A name for the operation (optional).
Returns:
A dense Tensor
with rank R - 1
, where R is the rank of the
SparseTensor
inputs hypothesis
and truth
.
Raises:
TypeError: If either hypothesis
or truth
are not a SparseTensor
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def einsum(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.einsum, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.einsum
Return
Applicative
Origial documentation for Builder.einsum
def einsum(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.einsum
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.einsum
def einsum(axes)
A generalized contraction between tensors of arbitrary dimension.
Like numpy.einsum.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def einsum_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.einsum_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.einsum_layer
Return
Applicative
Origial documentation for Builder.einsum_layer
def einsum_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.einsum, ...)
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.einsum
def einsum(axes):
A generalized contraction between tensors of arbitrary dimension.
Like numpy.einsum.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def elu(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.elu, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.elu
Return
Applicative
Origial documentation for Builder.elu
def elu(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.elu
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.elu
def elu(features, name=None)
Computes exponential linear: exp(features) - 1
if < 0, features
otherwise.
See Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs)
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 elu_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.elu_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.elu_layer
Return
Applicative
Origial documentation for Builder.elu_layer
def elu_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.elu, ...)
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.elu
def elu(features, name=None):
Computes exponential linear: exp(features) - 1
if < 0, features
otherwise.
See Fast and Accurate Deep Network Learning by Exponential Linear Units (ELUs)
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 embedding(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.embedding, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.embedding
Return
Applicative
Origial documentation for Builder.embedding
def embedding(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tflearn.layers.embedding_ops.embedding
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tflearn.layers.embedding_ops.embedding
def embedding(incoming, input_dim, output_dim, validate_indices=False, weights_init="truncated_normal", trainable=True, restore=True, reuse=False, scope=None, name="Embedding")
Embedding.
Embedding layer for a sequence of integer ids or floats.
Input: 2-D Tensor [samples, ids].
Output: 3-D Tensor [samples, embedded_ids, features].
Arguments:
incoming: Incoming 2-D Tensor.
input_dim: list of int
. Vocabulary size (number of ids).
output_dim: list of int
. Embedding size.
validate_indices: bool
. Whether or not to validate gather indices.
weights_init: str
(name) or Tensor
. Weights initialization.
(see tflearn.initializations) Default: 'truncated_normal'.
trainable: bool
. If True, weights will be trainable.
restore: bool
. If True, this layer weights will be restored when
loading a model
reuse: bool
. If True and 'scope' is provided, this layer variables
will be reused (shared).
scope: str
. Define this layer scope (optional). A scope can be
used to share variables between layers. Note that scope will
override name.
name: A name for this layer (optional). Default: 'Embedding'.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def embedding_lookup(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.embedding_lookup, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.embedding_lookup
Return
Applicative
Origial documentation for Builder.embedding_lookup
def embedding_lookup(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.embedding_lookup
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.embedding_lookup
def embedding_lookup(params, ids, partition_strategy="mod", name=None, validate_indices=True)
Looks up ids
in a list of embedding tensors.
This function is used to perform parallel lookups on the list of
tensors in params
. It is a generalization of
tf.gather()
, where params
is
interpreted as a partition of a larger embedding tensor.
If len(params) > 1
, each element id
of ids
is partitioned between
the elements of params
according to the partition_strategy
.
In all strategies, if the id space does not evenly divide the number of
partitions, each of the first (max_id + 1) % len(params)
partitions will
be assigned one more id.
If partition_strategy
is "mod"
, we assign each id to partition
p = id % len(params)
. For instance,
13 ids are split across 5 partitions as:
[[0, 5, 10], [1, 6, 11], [2, 7, 12], [3, 8], [4, 9]]
If partition_strategy
is "div"
, we assign ids to partitions in a
contiguous manner. In this case, 13 ids are split across 5 partitions as:
[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10], [11, 12]]
The results of the lookup are concatenated into a dense
tensor. The returned tensor has shape shape(ids) + shape(params)[1:]
.
Args:
params: A list of tensors with the same type and which can be concatenated
along dimension 0. Each Tensor
must be appropriately sized for the given
partition_strategy
.
ids: A Tensor
with type int32
or int64
containing the ids to be looked
up in params
.
partition_strategy: A string specifying the partitioning strategy, relevant
if len(params) > 1
. Currently "div"
and "mod"
are supported. Default
is "mod"
.
name: A name for the operation (optional).
validate_indices: Whether or not to validate gather indices.
Returns:
A Tensor
with the same type as the tensors in params
.
Raises:
ValueError: If params
is empty.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def embedding_lookup_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.embedding_lookup_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.embedding_lookup_layer
Return
Applicative
Origial documentation for Builder.embedding_lookup_layer
def embedding_lookup_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.embedding_lookup, ...)
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.embedding_lookup
def embedding_lookup(params, ids, partition_strategy="mod", name=None, validate_indices=True):
Looks up ids
in a list of embedding tensors.
This function is used to perform parallel lookups on the list of
tensors in params
. It is a generalization of
tf.gather()
, where params
is
interpreted as a partition of a larger embedding tensor.
If len(params) > 1
, each element id
of ids
is partitioned between
the elements of params
according to the partition_strategy
.
In all strategies, if the id space does not evenly divide the number of
partitions, each of the first (max_id + 1) % len(params)
partitions will
be assigned one more id.
If partition_strategy
is "mod"
, we assign each id to partition
p = id % len(params)
. For instance,
13 ids are split across 5 partitions as:
[[0, 5, 10], [1, 6, 11], [2, 7, 12], [3, 8], [4, 9]]
If partition_strategy
is "div"
, we assign ids to partitions in a
contiguous manner. In this case, 13 ids are split across 5 partitions as:
[[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10], [11, 12]]
The results of the lookup are concatenated into a dense
tensor. The returned tensor has shape shape(ids) + shape(params)[1:]
.
Args:
params: A list of tensors with the same type and which can be concatenated
along dimension 0. Each Tensor
must be appropriately sized for the given
partition_strategy
.
ids: A Tensor
with type int32
or int64
containing the ids to be looked
up in params
.
partition_strategy: A string specifying the partitioning strategy, relevant
if len(params) > 1
. Currently "div"
and "mod"
are supported. Default
is "mod"
.
name: A name for the operation (optional).
validate_indices: Whether or not to validate gather indices.
Returns:
A Tensor
with the same type as the tensors in params
.
Raises:
ValueError: If params
is empty.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def embedding_lookup_sparse(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.embedding_lookup_sparse, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.embedding_lookup_sparse
Return
Applicative
Origial documentation for Builder.embedding_lookup_sparse
def embedding_lookup_sparse(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.embedding_lookup_sparse
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.embedding_lookup_sparse
def embedding_lookup_sparse(params, sp_ids, sp_weights, partition_strategy="mod", name=None, combiner=None)
Computes embeddings for the given ids and weights.
This op assumes that there is at least one id for each row in the dense tensor represented by sp_ids (i.e. there are no rows with empty features), and that all the indices of sp_ids are in canonical row-major order.
It also assumes that all id values lie in the range [0, p0), where p0 is the sum of the size of params along dimension 0.
Args:
params: A single tensor representing the complete embedding tensor,
or a list of P tensors all of same shape except for the first dimension,
representing sharded embedding tensors.
sp_ids: N x M SparseTensor of int64 ids (typically from FeatureValueToId),
where N is typically batch size and M is arbitrary.
sp_weights: either a SparseTensor of float / double weights, or None to
indicate all weights should be taken to be 1. If specified, sp_weights
must have exactly the same shape and indices as sp_ids.
partition_strategy: A string specifying the partitioning strategy, relevant
if len(params) > 1
. Currently "div"
and "mod"
are supported. Default
is "mod"
. See tf.nn.embedding_lookup
for more details.
name: Optional name for the op.
combiner: A string specifying the reduction op. Currently "mean", "sqrtn"
and "sum" are supported.
"sum" computes the weighted sum of the embedding results for each row.
"mean" is the weighted sum divided by the total weight.
"sqrtn" is the weighted sum divided by the square root of the sum of the
squares of the weights.
Returns: A dense tensor representing the combined embeddings for the sparse ids. For each row in the dense tensor represented by sp_ids, the op looks up the embeddings for all ids in that row, multiplies them by the corresponding weight, and combines these embeddings as specified.
In other words, if shape(combined params) = [p0, p1, ..., pm] and shape(sp_ids) = shape(sp_weights) = [d0, d1, ..., dn] then shape(output) = [d0, d1, ..., dn-1, p1, ..., pm].
For instance, if params is a 10x20 matrix, and sp_ids / sp_weights are
[0, 0]: id 1, weight 2.0 [0, 1]: id 3, weight 0.5 [1, 0]: id 0, weight 1.0 [2, 3]: id 1, weight 3.0
with combiner="mean", then the output will be a 3x20 matrix where output[0, :] = (params[1, :] * 2.0 + params[3, :] * 0.5) / (2.0 + 0.5) output[1, :] = params[0, :] * 1.0 output[2, :] = params[1, :] * 3.0
Raises: TypeError: If sp_ids is not a SparseTensor, or if sp_weights is neither None nor SparseTensor. ValueError: If combiner is not one of {"mean", "sqrtn", "sum"}.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def embedding_lookup_sparse_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.embedding_lookup_sparse_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.embedding_lookup_sparse_layer
Return
Applicative
Origial documentation for Builder.embedding_lookup_sparse_layer
def embedding_lookup_sparse_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.embedding_lookup_sparse, ...)
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.embedding_lookup_sparse
def embedding_lookup_sparse(params, sp_ids, sp_weights, partition_strategy="mod", name=None, combiner=None):
Computes embeddings for the given ids and weights.
This op assumes that there is at least one id for each row in the dense tensor represented by sp_ids (i.e. there are no rows with empty features), and that all the indices of sp_ids are in canonical row-major order.
It also assumes that all id values lie in the range [0, p0), where p0 is the sum of the size of params along dimension 0.
Args:
params: A single tensor representing the complete embedding tensor,
or a list of P tensors all of same shape except for the first dimension,
representing sharded embedding tensors.
sp_ids: N x M SparseTensor of int64 ids (typically from FeatureValueToId),
where N is typically batch size and M is arbitrary.
sp_weights: either a SparseTensor of float / double weights, or None to
indicate all weights should be taken to be 1. If specified, sp_weights
must have exactly the same shape and indices as sp_ids.
partition_strategy: A string specifying the partitioning strategy, relevant
if len(params) > 1
. Currently "div"
and "mod"
are supported. Default
is "mod"
. See tf.nn.embedding_lookup
for more details.
name: Optional name for the op.
combiner: A string specifying the reduction op. Currently "mean", "sqrtn"
and "sum" are supported.
"sum" computes the weighted sum of the embedding results for each row.
"mean" is the weighted sum divided by the total weight.
"sqrtn" is the weighted sum divided by the square root of the sum of the
squares of the weights.
Returns: A dense tensor representing the combined embeddings for the sparse ids. For each row in the dense tensor represented by sp_ids, the op looks up the embeddings for all ids in that row, multiplies them by the corresponding weight, and combines these embeddings as specified.
In other words, if shape(combined params) = [p0, p1, ..., pm] and shape(sp_ids) = shape(sp_weights) = [d0, d1, ..., dn] then shape(output) = [d0, d1, ..., dn-1, p1, ..., pm].
For instance, if params is a 10x20 matrix, and sp_ids / sp_weights are
[0, 0]: id 1, weight 2.0 [0, 1]: id 3, weight 0.5 [1, 0]: id 0, weight 1.0 [2, 3]: id 1, weight 3.0
with combiner="mean", then the output will be a 3x20 matrix where output[0, :] = (params[1, :] * 2.0 + params[3, :] * 0.5) / (2.0 + 0.5) output[1, :] = params[0, :] * 1.0 output[2, :] = params[1, :] * 3.0
Raises: TypeError: If sp_ids is not a SparseTensor, or if sp_weights is neither None nor SparseTensor. ValueError: If combiner is not one of {"mean", "sqrtn", "sum"}.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def encode_base64(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.encode_base64, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.encode_base64
Return
Applicative
Origial documentation for Builder.encode_base64
def encode_base64(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.encode_base64
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.encode_base64
def encode_base64(input, pad=None, name=None)
Encode strings into web-safe base64 format.
Refer to the following article for more information on base64 format: en.wikipedia.org/wiki/Base64. Base64 strings may have padding with '=' at the end so that the encoded has length multiple of 4. See Padding section of the link above.
Web-safe means that the encoder uses - and _ instead of + and /.
Args:
input: A Tensor
of type string
. Strings to be encoded.
pad: An optional bool
. Defaults to False
.
Bool whether padding is applied at the ends.
name: A name for the operation (optional).
Returns:
A Tensor
of type string
. Input strings encoded in base64.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def encode_base64_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.encode_base64_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.encode_base64_layer
Return
Applicative
Origial documentation for Builder.encode_base64_layer
def encode_base64_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.encode_base64, ...)
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.encode_base64
def encode_base64(input, pad=None, name=None):
Encode strings into web-safe base64 format.
Refer to the following article for more information on base64 format: en.wikipedia.org/wiki/Base64. Base64 strings may have padding with '=' at the end so that the encoded has length multiple of 4. See Padding section of the link above.
Web-safe means that the encoder uses - and _ instead of + and /.
Args:
input: A Tensor
of type string
. Strings to be encoded.
pad: An optional bool
. Defaults to False
.
Bool whether padding is applied at the ends.
name: A name for the operation (optional).
Returns:
A Tensor
of type string
. Input strings encoded in base64.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def ensamble_dropout(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(BuilderTree.ensamble_dropout, ...)
Arguments
- All other *args and **kwargs are forwarded to
BuilderTree.ensamble_dropout
Return
Applicative
Origial documentation for BuilderTree.ensamble_dropout
def ensamble_dropout(tree, keep_prob, seed=None, name=None):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method the same as tensorbuilder.BuilderTree.ensamble_dropout
.
Original Documentation for tensorbuilder.BuilderTree.ensamble_dropout
def ensamble_dropout(tree, keep_prob, seed=None, name=None)
None
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def equal(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.equal, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.equal
Return
Applicative
Origial documentation for Builder.equal
def equal(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.equal
to work with tensorbuilder.core.builders.Builder
s. Instead of taking a Tensor as its first argument it takes a builder, the rest of the arguments are exactly the same.
Original Documentation for tf.equal
def equal(x, y, name=None)
Returns the truth value of (x == y) element-wise.
NOTE: Equal
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, uint8
, int8
, int16
, int32
, int64
, complex64
, quint8
, qint8
, qint32
, string
, bool
, complex128
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
of type bool
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def equal_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.equal_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.equal_layer
Return
Applicative
Origial documentation for Builder.equal_layer
def equal_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.equal, ...)
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.equal
def equal(x, y, name=None):
Returns the truth value of (x == y) element-wise.
NOTE: Equal
supports broadcasting. More about broadcasting
here
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
, uint8
, int8
, int16
, int32
, int64
, complex64
, quint8
, qint8
, qint32
, string
, bool
, complex128
.
y: A Tensor
. Must have the same type as x
.
name: A name for the operation (optional).
Returns:
A Tensor
of type bool
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def erf(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.erf, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.erf
Return
Applicative
Origial documentation for Builder.erf
def erf(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.erf
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.erf
def erf(x, name=None)
Computes the Gauss error function of x
element-wise.
Args:
x: A Tensor
of SparseTensor
. Must be one of the following types: half
,
float32
, float64
.
name: A name for the operation (optional).
Returns:
A Tensor
or SparseTensor
, respectively. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def erf_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.erf_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.erf_layer
Return
Applicative
Origial documentation for Builder.erf_layer
def erf_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.erf, ...)
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.erf
def erf(x, name=None):
Computes the Gauss error function of x
element-wise.
Args:
x: A Tensor
of SparseTensor
. Must be one of the following types: half
,
float32
, float64
.
name: A name for the operation (optional).
Returns:
A Tensor
or SparseTensor
, respectively. Has the same type as x
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def erfc(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.erfc, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.erfc
Return
Applicative
Origial documentation for Builder.erfc
def erfc(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.erfc
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.erfc
def erfc(x, name=None)
Computes the complementary error function of x
element-wise.
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
.
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 erfc_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.erfc_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.erfc_layer
Return
Applicative
Origial documentation for Builder.erfc_layer
def erfc_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.erfc, ...)
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.erfc
def erfc(x, name=None):
Computes the complementary error function of x
element-wise.
Args:
x: A Tensor
. Must be one of the following types: half
, float32
, float64
.
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 erosion2d(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.erosion2d, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.erosion2d
Return
Applicative
Origial documentation for Builder.erosion2d
def erosion2d(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.nn.erosion2d
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.erosion2d
def erosion2d(value, kernel, strides, rates, padding, name=None)
Computes the grayscale erosion of 4-D value
and 3-D kernel
tensors.
The value
tensor has shape [batch, in_height, in_width, depth]
and the
kernel
tensor has shape [kernel_height, kernel_width, depth]
, i.e.,
each input channel is processed independently of the others with its own
structuring function. The output
tensor has shape
[batch, out_height, out_width, depth]
. The spatial dimensions of the
output tensor depend on the padding
algorithm. We currently only support the
default "NHWC" data_format
.
In detail, the grayscale morphological 2-D erosion is given by:
output[b, y, x, c] = min_{dy, dx} value[b, strides[1] * y - rates[1] * dy, strides[2] * x - rates[2] * dx, c] - kernel[dy, dx, c]
Duality: The erosion of value
by the kernel
is equal to the negation of
the dilation of -value
by the reflected kernel
.
Args:
value: A Tensor
. 4-D with shape [batch, in_height, in_width, depth]
.
kernel: A Tensor
. Must have the same type as value
.
3-D with shape [kernel_height, kernel_width, depth]
.
strides: A list of ints
that has length >= 4
.
1-D of length 4. The stride of the sliding window for each dimension of
the input tensor. Must be: [1, stride_height, stride_width, 1]
.
rates: A list of ints
that has length >= 4
.
1-D of length 4. The input stride for atrous morphological dilation.
Must be: [1, rate_height, rate_width, 1]
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional). If not specified "erosion2d"
is used.
Returns:
A Tensor
. Has the same type as value
.
4-D with shape [batch, out_height, out_width, depth]
.
Raises:
ValueError: If the value
depth does not match kernel
' shape, or if
padding is other than 'VALID'
or 'SAME'
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def erosion2d_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.erosion2d_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.erosion2d_layer
Return
Applicative
Origial documentation for Builder.erosion2d_layer
def erosion2d_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.nn.erosion2d, ...)
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.erosion2d
def erosion2d(value, kernel, strides, rates, padding, name=None):
Computes the grayscale erosion of 4-D value
and 3-D kernel
tensors.
The value
tensor has shape [batch, in_height, in_width, depth]
and the
kernel
tensor has shape [kernel_height, kernel_width, depth]
, i.e.,
each input channel is processed independently of the others with its own
structuring function. The output
tensor has shape
[batch, out_height, out_width, depth]
. The spatial dimensions of the
output tensor depend on the padding
algorithm. We currently only support the
default "NHWC" data_format
.
In detail, the grayscale morphological 2-D erosion is given by:
output[b, y, x, c] = min_{dy, dx} value[b, strides[1] * y - rates[1] * dy, strides[2] * x - rates[2] * dx, c] - kernel[dy, dx, c]
Duality: The erosion of value
by the kernel
is equal to the negation of
the dilation of -value
by the reflected kernel
.
Args:
value: A Tensor
. 4-D with shape [batch, in_height, in_width, depth]
.
kernel: A Tensor
. Must have the same type as value
.
3-D with shape [kernel_height, kernel_width, depth]
.
strides: A list of ints
that has length >= 4
.
1-D of length 4. The stride of the sliding window for each dimension of
the input tensor. Must be: [1, stride_height, stride_width, 1]
.
rates: A list of ints
that has length >= 4
.
1-D of length 4. The input stride for atrous morphological dilation.
Must be: [1, rate_height, rate_width, 1]
.
padding: A string
from: "SAME", "VALID"
.
The type of padding algorithm to use.
name: A name for the operation (optional). If not specified "erosion2d"
is used.
Returns:
A Tensor
. Has the same type as value
.
4-D with shape [batch, out_height, out_width, depth]
.
Raises:
ValueError: If the value
depth does not match kernel
' shape, or if
padding is other than 'VALID'
or 'SAME'
.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def exp(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.exp, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.exp
Return
Applicative
Origial documentation for Builder.exp
def exp(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.exp
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.exp
def exp(x, name=None)
Computes exponential of x element-wise. \(y = e^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 exp_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.exp_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.exp_layer
Return
Applicative
Origial documentation for Builder.exp_layer
def exp_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.exp, ...)
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.exp
def exp(x, name=None):
Computes exponential of x element-wise. \(y = e^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 expand_dims(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.expand_dims, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.expand_dims
Return
Applicative
Origial documentation for Builder.expand_dims
def expand_dims(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.expand_dims
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.expand_dims
def expand_dims(input, dim, name=None)
Inserts a dimension of 1 into a tensor's shape.
Given a tensor input
, this operation inserts a dimension of 1 at the
dimension index dim
of input
's shape. The dimension index dim
starts at
zero; if you specify a negative number for dim
it is counted backward from
the end.
This operation is useful if you want to add a batch dimension to a single
element. For example, if you have a single image of shape [height, width,
channels]
, you can make it a batch of 1 image with expand_dims(image, 0)
,
which will make the shape [1, height, width, channels]
.
Other examples:
```prettyprint
't' is a tensor of shape [2]
shape(expand_dims(t, 0)) ==> [1, 2] shape(expand_dims(t, 1)) ==> [2, 1] shape(expand_dims(t, -1)) ==> [2, 1]
't2' is a tensor of shape [2, 3, 5]
shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5] shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5] shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1] ```
This operation requires that:
-1-input.dims() <= dim <= input.dims()
This operation is related to squeeze()
, which removes dimensions of
size 1.
Args:
input: A Tensor
.
dim: A Tensor
. Must be one of the following types: int32
, int64
.
0-D (scalar). Specifies the dimension index at which to
expand the shape of input
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
Contains the same data as input
, but its shape has an additional
dimension of size 1 added.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def expand_dims_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.expand_dims_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.expand_dims_layer
Return
Applicative
Origial documentation for Builder.expand_dims_layer
def expand_dims_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.expand_dims, ...)
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.expand_dims
def expand_dims(input, dim, name=None):
Inserts a dimension of 1 into a tensor's shape.
Given a tensor input
, this operation inserts a dimension of 1 at the
dimension index dim
of input
's shape. The dimension index dim
starts at
zero; if you specify a negative number for dim
it is counted backward from
the end.
This operation is useful if you want to add a batch dimension to a single
element. For example, if you have a single image of shape [height, width,
channels]
, you can make it a batch of 1 image with expand_dims(image, 0)
,
which will make the shape [1, height, width, channels]
.
Other examples:
```prettyprint
't' is a tensor of shape [2]
shape(expand_dims(t, 0)) ==> [1, 2] shape(expand_dims(t, 1)) ==> [2, 1] shape(expand_dims(t, -1)) ==> [2, 1]
't2' is a tensor of shape [2, 3, 5]
shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5] shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5] shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1] ```
This operation requires that:
-1-input.dims() <= dim <= input.dims()
This operation is related to squeeze()
, which removes dimensions of
size 1.
Args:
input: A Tensor
.
dim: A Tensor
. Must be one of the following types: int32
, int64
.
0-D (scalar). Specifies the dimension index at which to
expand the shape of input
.
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as input
.
Contains the same data as input
, but its shape has an additional
dimension of size 1 added.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def extract(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(BuilderTree.extract, ...)
Arguments
- All other *args and **kwargs are forwarded to
BuilderTree.extract
Return
Applicative
Origial documentation for BuilderTree.extract
def extract(tree, fn):
@immutable
Expects a function fn with type list( Tensor ) -> Tensor
and applies this function to tensorbuilder.core.builders.BuilderTree.tensors
, the resulting Tensor is wrapped in Builder. This function
Parameters
fn
: a function of typelist( Tensor ) -> Tensor
.- All additional *args and **kwargs are forwarded to
fn
Return
tensorbuilder.core.builders.Builder
Example
Lets redu the example in tensorbuilder.core.builders.BuilderTree.map_each
using extract
import tensorflow as tf from tensorbuilder import tb x = placeholder(tf.float32, shape=[None, 10]) h = ( tb.build(x) .branch(lambda x: [ x.relu_layer(20) , x.sigmoid_layer(20) , x.tanh_layer(20) ]) .map_each(tf.contrib.layers.fully_connected, 5, activation_fn=None) .extract(lambda tensors: tf.add_n(tensors)) #or just .extract(tf.add_n) .softmax() .tensor() )
Same example using the DSL
import tensorflow as tf from tensorbuilder import tb x = placeholder(tf.float32, shape=[None, 10]) h = ( x, [ tb.relu_layer(20) , tb.sigmoid_layer(20) , tb.tanh_layer(20) ], tb.map_each(tf.contrib.layers.fully_connected, 5, activation_fn=None) .extract(lambda tensors: tf.add_n(tensors)) #or just .extract(tf.add_n) .softmax() .tensor() )
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def extract_image_patches(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.extract_image_patches, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.extract_image_patches
Return
Applicative
Origial documentation for Builder.extract_image_patches
def extract_image_patches(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.extract_image_patches
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.extract_image_patches
def extract_image_patches(images, ksizes, strides, rates, padding, name=None)
Extract patches
from images
and put them in the "depth" output dimension.
Args:
images: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
4-D Tensor with shape [batch, in_rows, in_cols, depth]
.
ksizes: A list of ints
that has length >= 4
.
The size of the sliding window for each dimension of images
.
strides: A list of ints
that has length >= 4
.
1-D of length 4. How far the centers of two consecutive patches are in
the images. Must be: [1, stride_rows, stride_cols, 1]
.
rates: A list of ints
that has length >= 4
.
1-D of length 4. Must be: [1, rate_rows, rate_cols, 1]
. This is the
input stride, specifying how far two consecutive patch samples are in the
input. Equivalent to extracting patches with
patch_sizes_eff = patch_sizes + (patch_sizes - 1) * (rates - 1), followed by
subsampling them spatially by a factor of
rates.
padding: A
stringfrom:
"SAME", "VALID"`.
The type of padding algorithm to use.
We specify the size-related attributes as: ksizes = [1, ksize_rows, ksize_cols, 1] strides = [1, strides_rows, strides_cols, 1] rates = [1, rates_rows, rates_cols, 1]
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as images
.
4-D Tensor with shape [batch, out_rows, out_cols, ksize_rows *
ksize_cols * depth]
containing image patches with size
ksize_rows x ksize_cols x depth
vectorized in the "depth" dimension.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def extract_image_patches_layer(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.extract_image_patches_layer, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.extract_image_patches_layer
Return
Applicative
Origial documentation for Builder.extract_image_patches_layer
def extract_image_patches_layer(builder, size):
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .fully_connected(size, activation_fn = tf.extract_image_patches, ...)
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.extract_image_patches
def extract_image_patches(images, ksizes, strides, rates, padding, name=None):
Extract patches
from images
and put them in the "depth" output dimension.
Args:
images: A Tensor
. Must be one of the following types: float32
, float64
, int32
, int64
, uint8
, int16
, int8
, uint16
, half
.
4-D Tensor with shape [batch, in_rows, in_cols, depth]
.
ksizes: A list of ints
that has length >= 4
.
The size of the sliding window for each dimension of images
.
strides: A list of ints
that has length >= 4
.
1-D of length 4. How far the centers of two consecutive patches are in
the images. Must be: [1, stride_rows, stride_cols, 1]
.
rates: A list of ints
that has length >= 4
.
1-D of length 4. Must be: [1, rate_rows, rate_cols, 1]
. This is the
input stride, specifying how far two consecutive patch samples are in the
input. Equivalent to extracting patches with
patch_sizes_eff = patch_sizes + (patch_sizes - 1) * (rates - 1), followed by
subsampling them spatially by a factor of
rates.
padding: A
stringfrom:
"SAME", "VALID"`.
The type of padding algorithm to use.
We specify the size-related attributes as: ksizes = [1, ksize_rows, ksize_cols, 1] strides = [1, strides_rows, strides_cols, 1] rates = [1, rates_rows, rates_cols, 1]
name: A name for the operation (optional).
Returns:
A Tensor
. Has the same type as images
.
4-D Tensor with shape [batch, out_rows, out_cols, ksize_rows *
ksize_cols * depth]
containing image patches with size
ksize_rows x ksize_cols x depth
vectorized in the "depth" dimension.
def _method(app, *args, **kwargs): def _lambda(builder): g = getattr(builder, f.__name__) return g(*args, **kwargs) return app.compose(_lambda)
def fft(
app, *args, **kwargs)
THIS METHOD IS AUTOMATICALLY GENERATED
Alias for .compose(Builder.fft, ...)
Arguments
- All other *args and **kwargs are forwarded to
Builder.fft
Return
Applicative
Origial documentation for Builder.fft
def fft(builder):
THIS METHOD IS AUTOMATICALLY GENERATED
@immutable
This method is a lifted version the function tf.fft
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.fft
def fft(input, name=None)
Compute the 1-dimensional discrete Fourier Transform over the inner-most
dimension of input
.
Args:
input: A Tensor