Keraflow
Deep Learning for Python.
 All Classes Namespaces Functions Pages
keraflow.backend.theano_backend.TheanoBackend Class Reference
Inheritance diagram for keraflow.backend.theano_backend.TheanoBackend:

Public Member Functions

def variable
 Instantiate a tensor variable.
 
def placeholder
 Instantiate an input data placeholder variable.
 
def shape
 Returns the symbolic shape of a tensor.
 
def eval
 Evaluates the value of a tensor. More...
 
def switch
 condition: scalar tensor.
 
def zeros
 Instantiate an all-zeros tensor variable.
 
def ones
 Instantiate 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
 Multiply the values in a tensor, alongside the specified axis.
 
def any
 Bitwise reduction (logical OR).
 
def transpose
 Transpose dimensions. More...
 
def repeat
 Repeat the elements of a tensor along an axis, like np.repeat. More...
 
def expand_dims
 Add a 1-sized dimension at index "axis".
 
def squeeze
 Remove a 1-dimension from the tensor at index "axis".
 
def dropout
 Sets entries in x to zero at random, while scaling the entire tensor. More...
 
def rnn
 Iterates over the time dimension of a tensor. More...
 

Member Function Documentation

def keraflow.backend.theano_backend.TheanoBackend.dropout (   self,
  x,
  drop_rate,
  noise_shape = None 
)

Sets entries in x to zero at random, while scaling the entire tensor.

Parameters
xtensor
drop_ratefraction of the entries in the tensor that will be set to 0.
noise_shapeshape for randomly generated keep/drop flags, must be broadcastable to the shape of x
def keraflow.backend.theano_backend.TheanoBackend.eval (   self,
  x 
)

Evaluates the value of a tensor.

Returns a Numpy array.

def keraflow.backend.theano_backend.TheanoBackend.gather (   self,
  reference,
  indices 
)

Retrieves the vectors of indices indices in the 2D tensor reference.

Parameters
referencea 2D tensor.
indices2D int tensor or list.
Returns
3D tensor.
def keraflow.backend.theano_backend.TheanoBackend.repeat (   self,
  x,
  rep,
  axis 
)

Repeat 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.theano_backend.TheanoBackend.rnn (   self,
  step_function,
  inputs,
  initial_states,
  go_backwards = False,
  mask = None,
  unroll = False,
  input_length = None 
)

Iterates over the time dimension of a tensor.

Arguments

inputs: tensor of temporal data of shape (samples, time, ...) (at least 3D). step_function: Parameters: input: tensor with shape (samples, ...) (no time dimension), representing input for the batch of samples at a certain time step. states: list of tensors. Returns: output: tensor with shape (samples, ...) (no time dimension), new_states: list of tensors, same length and shapes as 'states'. initial_states: tensor with shape (samples, ...) (no time dimension), containing the initial values for the states used in the step function. go_backwards: boolean. If True, do the iteration over the time dimension in reverse order. mask: binary tensor with shape (samples, time), with a zero for every element that is masked. unroll: whether to unroll the RNN or to use a symbolic loop (scan). input_length: must be specified if using unroll.

Returns

A tuple (last_output, outputs, new_states). last_output: the latest output of the rnn, of shape (samples, ...) outputs: tensor with shape (samples, time, ...) where each entry outputs[s, t] is the output of the step function at time t for sample s. new_states: list of tensors, latest states returned by the step function, of shape (samples, ...).

def keraflow.backend.theano_backend.TheanoBackend.transpose (   self,
  x,
  dims 
)

Transpose dimensions.

dims should be a tuple or list of dimension indices, e.g. [0, 2, 1].