Convolution

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

2 Dimensional convolutional layer, expects NCHW data format

Parameters:
  • input_shape (List[int]) – The shape of the data flowing into the convolution.
  • filter_shape (List[int]) – The shape of the convolutional filter. Expected to be 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]

The backward pass for training.

forward(x)[source]

Forward pass for inference

get_output_shape() → List[int][source]

Returns the layer’s output shape