Operations

Operations

See the official TensorFlow documentation for a complete description of these operations.

Basic operations

placeholder
constant
concat
stack
split
expand_dims
argmin
argmax
add_n
one_hot
random_uniform
random_normal

Variables

Variable
global_variables_initializer
variable_scope
get_variable
ConstantInitializer
assign
assign_add
assign_sub
scatter_update

Reductions

reduce_sum
reduce_prod
reduce_min
reduce_max
reduce_all
reduce_any
reduce_mean

Comparisons

equal
not_equal
less
less_equal
greater
greater_equal
select
where

Images

image.decode_jpeg
image.encode_jpeg
image.decode_png
image.encode_png
image.resize_images
image.central_crop

Neural networks

Convolutions

TensorFlow.Ops.conv2dFunction.
 conv2d(input, filter; use_cudnn_on_gpu=true, data_format=NHWC, dilations=[1, 1, 1, 1])
source
 max_pool(input; data_format=NHWC)
source

Embeddings

embedding_lookup(params, ids; partition_strategy="mod", name="", validate_indices=true)

Looks up values of ids in params. Currently only supports one Tensor in params.

Args:

  • params: A list of Tensors of the same type and which can be concatenated along their first dimension.

  • ids: A Tensor of Int32 or Int64 ids to be looked up in params.

  • partition_strategy: If "mod" (default), assign each id to partition p = id % len(params). If "div", assign each id contiguously.

  • name: An optional name for the operation.

  • validate_indices: If true (default), make sure the indices are valid.

source

Recurrent neural nets

nn.rnn
nn.dynamic_rnn
nn.zero_state
nn.output_size
nn.zero_state

Nonlinearities

nn.relu
nn.relu6
nn.elu
nn.softplus
nn.softsign
nn.softmax
nn.sigmoid
nn.tanh

Losses

TensorFlow.nn.l2_lossFunction.

l2_loss(t)

Computes half the L2-norm of a Tensor t, without taking the square root.

source

Regularizations

TensorFlow.nn.dropoutFunction.

dropout(x, keep_prob; noise_shape=nothing, seed=0)

Keeps each element of x with keep_prob, scaled by 1/keep_prob, otherwise outputs 0. This computes dropout.

Args:

  • x: A Tensor.

  • keep_prob: Probability that each element is kept.

  • noise_shape: Shape for randomly generated keep/drop flags.

  • seed: Integer used to seed the RNG. Defaults to 0.

source

Evaluations

TensorFlow.nn.top_kFunction.

top_k(input, k=1; sorted=true)

Finds values and indices of the top k largest entries of input in its last dimension.

Args:

  • input: One or more dimensional Tensor with last dimension at least size k.

  • k: Number of largest elements of input to look for. Defaults to 1.

  • sorted: If true (default), the returned values will be sorted in descending order.

source

in_top_k(predictions, targets, k)

Determines whether the targets are in the top k predictions. Outputs a batch_size (first dimension of predictions) array of boolean values.

Args:

  • predictions: Two dimensional Tensor.

  • targets: A Tensor.

  • k: Number of elements to look at for comparison.

source

Logic

 logical_and(x, y)
source
 logical_not(x)
source
 logical_or(x, y)
source
logical_xor(x, y; name="LogicalXor")

Returns the truth value of x XOR y element-wise.

NOTE: LogicalXor supports broadcasting. More about broadcasting here

Args:

  • x: A Tensor of type bool.

  • y: A Tensor of type bool.

  • name: A name for the operation (optional).

Returns: A Tensor of type bool.

source

Control flow

identity
TensorFlow.make_tuple
TensorFlow.group
TensorFlow.no_op
cond