Keraflow
Deep Learning for Python.
|
Public Member Functions | |
def | shape |
Returns the symbolic shape of a tensor. | |
def | int_shape |
Returns the shape of a tensor as a tuple of integers or None entries. More... | |
def | ndim |
Returns the number of axes in a tensor, as an integer. | |
def | dtype |
Returns the dtype of a tensor, as a string. | |
def | eval |
Evaluates the value of a tensor. More... | |
def | cast |
Casts a tensor to a different dtype. | |
def | set_value |
Sets the value of a tensor variable, from a Numpy array. | |
def | switch |
Switches between two operations depending on a scalar value (int or bool). More... | |
def | function |
Instantiates a Keraflow function. More... | |
def | gradients |
Returns the gradients of variables (list of tensor variables) with regard to loss . | |
def | zeros |
Instantiates an all-zeros tensor variable. | |
def | ones |
Instantiates an all-ones tensor variable. | |
def | eye |
Instantiate an identity matrix. | |
def | zeros_like |
Instantiates an all-zeros tensor of the same shape as another tensor. | |
def | ones_like |
Instantiates an all-ones tensor of the same shape as another tensor. | |
def | dot |
numpy.dot on tensors | |
def | gather |
Retrieves the vectors of indices indices in the 2D tensor reference . More... | |
def | prod |
Multiplies the values in a tensor, alongside the specified axis. | |
def | mean |
Mean of a tensor, alongside the specificied axis. | |
def | std |
Standard deviation of a tensor, alongside the specificied axis. | |
def | any |
Bitwise reduction (logical OR). More... | |
def | argmax |
Returns the index of the maximum value along a tensor axis. | |
def | argmin |
Returns the index of the minimum value along a tensor axis. | |
def | square |
Element-wise square. | |
def | abs |
Element-wise absolute value. | |
def | sqrt |
Element-wise square root. | |
def | exp |
Element-wise exponential. | |
def | log |
Element-wise log. | |
def | round |
Element-wise rounding to the closest integer. | |
def | sign |
Element-wise sign. | |
def | pow |
Element-wise exponentiation. | |
def | clip |
Element-wise value clipping. | |
def | equal |
Element-wise equality between two tensors. More... | |
def | not_equal |
Element-wise inequality between two tensors. More... | |
def | maximum |
Element-wise maximum of two tensors. | |
def | minimum |
Element-wise minimum of two tensors. | |
def | sin |
Computes sin of x element-wise. | |
def | cos |
Computes cos of x element-wise. | |
def | concatenate |
Concantes a list of tensors alongside the specified axis. | |
def | reshape |
Reshapes a tensor to the specified shape. | |
def | transpose |
Permutes axes in a tensor. More... | |
def | repeat |
Repeats the elements of a tensor along an axis, like np.repeat. More... | |
def | expand_dims |
Adds a 1-sized dimension at index "axis". | |
def | squeeze |
Removes a 1-dimension from the tensor at index "axis". | |
def | sigmoid |
Element-wise sigmoid. | |
def | hard_sigmoid |
Segment-wise linear approximation of sigmoid. More... | |
def | tanh |
Element-wise tanh. | |
def | relu |
Rectified linear unit. More... | |
def | softmax |
Softmax of a tensor. | |
def | softplus |
Softplus of a tensor. | |
def | dropout |
Sets entries in x to zero at random, while scaling the entire tensor. More... | |
def keraflow.backend.tensorflow_backend.TensorflowBackend.any | ( | self, | |
x, | |||
axis = None , |
|||
keepdims = False |
|||
) |
Bitwise reduction (logical OR).
Returns an uint8 tensor (0s and 1s).
def keraflow.backend.tensorflow_backend.TensorflowBackend.dropout | ( | self, | |
x, | |||
drop_rate, | |||
noise_shape = None |
|||
) |
Sets entries in x
to zero at random, while scaling the entire tensor.
x | tensor |
drop_rate | fraction of the entries in the tensor that will be set to 0. |
noise_shape | shape for randomly generated keep/drop flags, must be broadcastable to the shape of x |
def keraflow.backend.tensorflow_backend.TensorflowBackend.equal | ( | self, | |
x, | |||
y | |||
) |
Element-wise equality between two tensors.
Returns a bool tensor.
def keraflow.backend.tensorflow_backend.TensorflowBackend.eval | ( | self, | |
x | |||
) |
Evaluates the value of a tensor.
Returns a Numpy array.
def keraflow.backend.tensorflow_backend.TensorflowBackend.function | ( | self, | |
inputs, | |||
outputs, | |||
updates = [] , |
|||
kwargs | |||
) |
Instantiates a Keraflow function.
inputs: list of placeholder/variable tensors. outputs: list of output tensors. updates: list of update tuples (old_tensor, new_tensor).
def keraflow.backend.tensorflow_backend.TensorflowBackend.gather | ( | self, | |
reference, | |||
indices | |||
) |
Retrieves the vectors of indices indices
in the 2D tensor reference
.
reference | a 2D tensor. |
indices | 2D int tensor or list. |
def keraflow.backend.tensorflow_backend.TensorflowBackend.hard_sigmoid | ( | self, | |
x | |||
) |
Segment-wise linear approximation of sigmoid.
Faster than sigmoid.
def keraflow.backend.tensorflow_backend.TensorflowBackend.int_shape | ( | self, | |
x | |||
) |
Returns the shape of a tensor as a tuple of integers or None entries.
Note that this function only works with TensorFlow.
def keraflow.backend.tensorflow_backend.TensorflowBackend.not_equal | ( | self, | |
x, | |||
y | |||
) |
Element-wise inequality between two tensors.
Returns a bool tensor.
def keraflow.backend.tensorflow_backend.TensorflowBackend.relu | ( | self, | |
x, | |||
alpha = 0. , |
|||
max_value = None |
|||
) |
Rectified linear unit.
alpha: slope of negative section. max_value: saturation threshold.
def keraflow.backend.tensorflow_backend.TensorflowBackend.repeat | ( | self, | |
x, | |||
rep, | |||
axis | |||
) |
Repeats the elements of a tensor along an axis, like np.repeat.
If x has shape (s1, s2, s3) and axis=1, the output will have shape (s1, s2 * rep, s3)
def keraflow.backend.tensorflow_backend.TensorflowBackend.switch | ( | self, | |
condition, | |||
then_expression, | |||
else_expression | |||
) |
Switches between two operations depending on a scalar value (int or bool).
Note that both then_expression
and else_expression
should be symbolic tensors of the same shape.
condition: scalar tensor. then_expression: TensorFlow operation. else_expression: TensorFlow operation.
def keraflow.backend.tensorflow_backend.TensorflowBackend.transpose | ( | self, | |
x, | |||
dims | |||
) |
Permutes axes in a tensor.
dims: should be a tuple of dimension indices, e.g. (0, 2, 1).