Keraflow
Deep Learning for Python.
 All Classes Namespaces Functions Pages
keraflow.layers.convolution.ConvolutionBase Class Reference

Base layer for convolution layers. More...

Inheritance diagram for keraflow.layers.convolution.ConvolutionBase:
keraflow.layers.convolution.Convolution1D keraflow.layers.convolution.Convolution2D

Public Member Functions

def __init__
 

Detailed Description

Base layer for convolution layers.

Do not use this layer in your code.

Constructor & Destructor Documentation

def keraflow.layers.convolution.ConvolutionBase.__init__ (   self,
  kernel_shape,
  strides,
  pad = 'valid',
  bias = True,
  init = 'glorot_uniform',
  activation = 'linear',
  kwargs 
)
Parameters
kernel_shapetuple of int. Shape of the kernel in the pattern (nb_kernel, k_rows, k_cols ...).
stridestuple of int. Steps for sliding each kernel for convolution.
padstr, 'valid' of 'same'. See descriptions below.
biasboolean. Whether to include a bias (i.e. make the layer affine rather than linear).
initstr/function. Function to initialize trainable parameters. See Initializations.
activationstr/function. Activation function applied on the output. See Activations.
kwargssee Layer.__init__.
Note
We follow tensorflow's padding strategy explained here.
  1. When pad='same', the output length (for each dimension) is computed as:
    1 output_length = ceil( float(input_length) / stride )
    And the padding (for each dimension) is computed as:
    1 padding = (output_length - 1) * stride + kernel_length - input_length
    2 pad_front = floor(padding / 2)
    3 pad_back = (padding % 2==0)? floor(padding / 2): floor(padding / 2) + 1
    When stride=1, output_length will be equal to input_length, which is the reason for the name same.
  2. When pad='valid', the output length (for each dimension) is computed as:
    1 output_length = ceil(float(input_length-kernel_length+1)/stride)
    And the padding is always 0. When stride=1, output_length will be equal to input_length-1.