Convolution

class tf_encrypted.layers.convolution.Conv2D(input_shape, filter_shape, strides=1, padding='SAME', filter_init=<function Conv2D.<lambda>>, l2reg_lambda=0.0, channels_first=True)[source]

2 Dimensional convolutional layer, expects NCHW data format

Parameters:
  • input_shape (List[int]) – The shape of the convolution input. Rank 4.
  • filter_shape (List[int]) – The shape of the convolution filter. Rank 4.
  • strides (int) – The size of the stride
  • str (padding) – The type of padding (“SAAME” or “VALID”)
  • filter_init (lambda) –

    lambda function with shape parameter

    Example

    Conv2D((4, 4, 1, 20), strides=2, filter_init=lambda shp:
            np.random.normal(scale=0.01, size=shp))
    
backward(d_y, learning_rate)[source]

Compute the convolution derivatives.

forward(x)[source]

Compute the forward convolution.

get_output_shape()[source]

Compute output_shape for the layer.

initialize(initial_weights=None, initial_bias=None)[source]

Initialize layer weights as needed.