天天看點

keras.backend

keras backend api.

<code>abs(...)</code>: element-wise absolute value.

<code>all(...)</code>: bitwise reduction (logical and).

<code>any(...)</code>: bitwise reduction (logical or).

<code>arange(...)</code>: creates a 1d tensor containing a sequence of integers.

<code>argmax(...)</code>: returns the index of the maximum value along an axis.

<code>argmin(...)</code>: returns the index of the minimum value along an axis.

<code>backend(...)</code>: publicly accessible method for determining the current backend.

<code>batch_dot(...)</code>: batchwise dot product.

<code>batch_flatten(...)</code>: turn a nd tensor into a 2d tensor with same 0th dimension.

<code>batch_get_value(...)</code>: returns the value of more than one tensor variable.

<code>batch_normalization(...)</code>: applies batch normalization on x given mean, var, beta and gamma.

<code>batch_set_value(...)</code>: sets the values of many tensor variables at once.

<code>bias_add(...)</code>: adds a bias vector to a tensor.

<code>binary_crossentropy(...)</code>: binary crossentropy between an output tensor and a target tensor.

<code>cast(...)</code>: casts a tensor to a different dtype and returns it.

<code>cast_to_floatx(...)</code>: cast a numpy array to the default keras float type.

<code>categorical_crossentropy(...)</code>: categorical crossentropy between an output tensor and a target tensor.

<code>clear_session(...)</code>: destroys the current tf graph and creates a new one.

<code>clip(...)</code>: element-wise value clipping.

<code>concatenate(...)</code>: concatenates a list of tensors alongside the specified axis.

<code>constant(...)</code>: creates a constant tensor.

<code>conv1d(...)</code>: 1d convolution.

<code>conv2d(...)</code>: 2d convolution.

<code>conv2d_transpose(...)</code>: 2d deconvolution (i.e.

<code>conv3d(...)</code>: 3d convolution.

<code>cos(...)</code>: computes cos of x element-wise.

<code>count_params(...)</code>: returns the static number of elements in a variable or tensor.

<code>ctc_batch_cost(...)</code>: runs ctc loss algorithm on each batch element.

<code>ctc_decode(...)</code>: decodes the output of a softmax.

<code>ctc_label_dense_to_sparse(...)</code>: converts ctc labels from dense to sparse.

<code>cumprod(...)</code>: cumulative product of the values in a tensor, alongside the specified axis.

<code>cumsum(...)</code>: cumulative sum of the values in a tensor, alongside the specified axis.

<code>dot(...)</code>: multiplies 2 tensors (and/or variables) and returns a tensor.

<code>dropout(...)</code>: sets entries in <code>x</code> to zero at random, while scaling the entire tensor.

<code>dtype(...)</code>: returns the dtype of a keras tensor or variable, as a string.

<code>elu(...)</code>: exponential linear unit.

<code>epsilon(...)</code>: returns the value of the fuzz factor used in numeric expressions.

<code>equal(...)</code>: element-wise equality between two tensors.

<code>eval(...)</code>: evaluates the value of a variable.

<code>exp(...)</code>: element-wise exponential.

<code>expand_dims(...)</code>: adds a 1-sized dimension at index "axis".

<code>eye(...)</code>: instantiate an identity matrix and returns it.

<code>flatten(...)</code>: flatten a tensor.

<code>floatx(...)</code>: returns the default float type, as a string.

<code>foldl(...)</code>: reduce elems using fn to combine them from left to right.

<code>foldr(...)</code>: reduce elems using fn to combine them from right to left.

<code>function(...)</code>: instantiates a keras function.

<code>gather(...)</code>: retrieves the elements of indices <code>indices</code> in the tensor <code>reference</code>.

<code>get_uid(...)</code>: associates a string prefix with an integer counter in a tensorflow graph.

<code>get_value(...)</code>: returns the value of a variable.

<code>gradients(...)</code>: returns the gradients of <code>loss</code> w.r.t. <code>variables</code>.

<code>greater(...)</code>: element-wise truth value of (x &gt; y).

<code>greater_equal(...)</code>: element-wise truth value of (x &gt;= y).

<code>hard_sigmoid(...)</code>: segment-wise linear approximation of sigmoid.

<code>image_data_format(...)</code>: returns the default image data format convention.

<code>in_test_phase(...)</code>: selects <code>x</code> in test phase, and <code>alt</code> otherwise.

<code>in_top_k(...)</code>: returns whether the <code>targets</code> are in the top <code>k</code> <code>predictions</code>.

<code>in_train_phase(...)</code>: selects <code>x</code> in train phase, and <code>alt</code> otherwise.

<code>int_shape(...)</code>: returns the shape of tensor or variable as a tuple of int or none entries.

<code>is_keras_tensor(...)</code>: returns whether <code>x</code> is a keras tensor.

<code>is_sparse(...)</code>: returns whether a tensor is a sparse tensor.

<code>l2_normalize(...)</code>: normalizes a tensor wrt the l2 norm alongside the specified axis.

<code>learning_phase(...)</code>: returns the learning phase flag.

<code>learning_phase_scope(...)</code>: provides a scope within which the learning phase is equal to <code>value</code>.

<code>less(...)</code>: element-wise truth value of (x &lt; y).

<code>less_equal(...)</code>: element-wise truth value of (x &lt;= y).

<code>local_conv1d(...)</code>: apply 1d conv with un-shared weights.

<code>local_conv2d(...)</code>: apply 2d conv with un-shared weights.

<code>log(...)</code>: element-wise log.

<code>manual_variable_initialization(...)</code>: sets the manual variable initialization flag.

<code>map_fn(...)</code>: map the function fn over the elements elems and return the outputs.

<code>max(...)</code>: maximum value in a tensor.

<code>maximum(...)</code>: element-wise maximum of two tensors.

<code>mean(...)</code>: mean of a tensor, alongside the specified axis.

<code>min(...)</code>: minimum value in a tensor.

<code>minimum(...)</code>: element-wise minimum of two tensors.

<code>moving_average_update(...)</code>: compute the moving average of a variable.

<code>name_scope(...)</code>: a context manager for use when defining a python op.

<code>ndim(...)</code>: returns the number of axes in a tensor, as an integer.

<code>normalize_batch_in_training(...)</code>: computes mean and std for batch then apply batch_normalization on batch.

<code>not_equal(...)</code>: element-wise inequality between two tensors.

<code>one_hot(...)</code>: computes the one-hot representation of an integer tensor.

<code>ones(...)</code>: instantiates an all-ones variable and returns it.

<code>ones_like(...)</code>: instantiates an all-ones variable of the same shape as another tensor.

<code>permute_dimensions(...)</code>: permutes axes in a tensor.

<code>placeholder(...)</code>: instantiates a placeholder tensor and returns it.

<code>pool2d(...)</code>: 2d pooling.

<code>pool3d(...)</code>: 3d pooling.

<code>pow(...)</code>: element-wise exponentiation.

<code>print_tensor(...)</code>: prints <code>message</code> and the tensor value when evaluated.

<code>prod(...)</code>: multiplies the values in a tensor, alongside the specified axis.

<code>random_binomial(...)</code>: returns a tensor with random binomial distribution of values.

<code>random_normal(...)</code>: returns a tensor with normal distribution of values.

<code>random_normal_variable(...)</code>: instantiates a variable with values drawn from a normal distribution.

<code>random_uniform(...)</code>: returns a tensor with uniform distribution of values.

<code>random_uniform_variable(...)</code>: instantiates a variable with values drawn from a uniform distribution.

<code>relu(...)</code>: rectified linear unit.

<code>repeat(...)</code>: repeats a 2d tensor.

<code>repeat_elements(...)</code>: repeats the elements of a tensor along an axis, like <code>np.repeat</code>.

<code>reset_uids(...)</code>: resets graph identifiers.

<code>reshape(...)</code>: reshapes a tensor to the specified shape.

<code>resize_images(...)</code>: resizes the images contained in a 4d tensor.

<code>resize_volumes(...)</code>: resizes the volume contained in a 5d tensor.

<code>reverse(...)</code>: reverse a tensor along the specified axes.

<code>rnn(...)</code>: iterates over the time dimension of a tensor.

<code>round(...)</code>: element-wise rounding to the closest integer.

<code>separable_conv2d(...)</code>: 2d convolution with separable filters.

<code>set_epsilon(...)</code>: sets the value of the fuzz factor used in numeric expressions.

<code>set_floatx(...)</code>: sets the default float type.

<code>set_image_data_format(...)</code>: sets the value of the image data format convention.

<code>set_learning_phase(...)</code>: sets the learning phase to a fixed value.

<code>set_value(...)</code>: sets the value of a variable, from a numpy array.

<code>shape(...)</code>: returns the symbolic shape of a tensor or variable.

<code>sigmoid(...)</code>: element-wise sigmoid.

<code>sign(...)</code>: element-wise sign.

<code>sin(...)</code>: computes sin of x element-wise.

<code>softmax(...)</code>: softmax of a tensor.

<code>softplus(...)</code>: softplus of a tensor.

<code>softsign(...)</code>: softsign of a tensor.

<code>sparse_categorical_crossentropy(...)</code>: categorical crossentropy with integer targets.

<code>spatial_2d_padding(...)</code>: pads the 2nd and 3rd dimensions of a 4d tensor.

<code>spatial_3d_padding(...)</code>: pads 5d tensor with zeros along the depth, height, width dimensions.

<code>sqrt(...)</code>: element-wise square root.

<code>square(...)</code>: element-wise square.

<code>squeeze(...)</code>: removes a 1-dimension from the tensor at index "axis".

<code>stack(...)</code>: stacks a list of rank <code>r</code> tensors into a rank <code>r+1</code> tensor.

<code>std(...)</code>: standard deviation of a tensor, alongside the specified axis.

<code>stop_gradient(...)</code>: returns <code>variables</code> but with zero gradient w.r.t. every other variable.

<code>sum(...)</code>: sum of the values in a tensor, alongside the specified axis.

<code>switch(...)</code>: switches between two operations depending on a scalar value.

<code>tanh(...)</code>: element-wise tanh.

<code>temporal_padding(...)</code>: pads the middle dimension of a 3d tensor.

<code>tile(...)</code>: creates a tensor by tiling <code>x</code> by <code>n</code>.

<code>to_dense(...)</code>: converts a sparse tensor into a dense tensor and returns it.

<code>transpose(...)</code>: transposes a tensor and returns it.

<code>truncated_normal(...)</code>: returns a tensor with truncated random normal distribution of values.

<code>update(...)</code>

<code>update_add(...)</code>: update the value of <code>x</code> by adding <code>increment</code>.

<code>update_sub(...)</code>: update the value of <code>x</code> by subtracting <code>decrement</code>.

<code>var(...)</code>: variance of a tensor, alongside the specified axis.

<code>variable(...)</code>: instantiates a variable and returns it.

<code>zeros(...)</code>: instantiates an all-zeros variable and returns it.

<code>zeros_like(...)</code>: instantiates an all-zeros variable of the same shape as another tensor.