class_docstr: ### Description
      This is a generic encoder composed of
      {convolutions then downsampling} blocks followed by
      fully-connected layers.
class_docstr_tok: ["#","#","#","Description","This","is","a","generic","encoder","composed","of","{","convolutions","then","downsampling","}","blocks","followed","by","fully-connected","layers","."]
docstr: :param denoising_variance: variance of gaussian noise to add to the input
  :param conv_output_channels: array, number of output channels for each conv layer
  :param conv_kernel_sizes: array, kernel sizes for each conv layer
  :param conv_pooling_factors: array, stride values for downsampling convolutions
  :param acti_func_conv: array, activation functions of each layer
  :param layer_sizes_encoder: array, number of output channels for each encoding FC layer
  :param acti_func_encoder: array, activation functions for each encoding FC layer
  :param serialised_shape: array, flatten shape to enter the FC layers
  :param w_initializer: weight initialisation for network
  :param w_regularizer: weight regularisation for network
  :param b_initializer: bias initialisation for network
  :param b_regularizer: bias regularisation for network
  :param name: layer name
docstr_tok: [":","param","denoising_variance",":","variance","of","gaussian","noise","to","add","to","the","input",":","param","conv_output_channels",":","array",",","number","of","output","channels","for","each","conv","layer",":","param","conv_kernel_sizes",":","array",",","kernel","sizes","for","each","conv","layer",":","param","conv_pooling_factors",":","array",",","stride","values","for","downsampling","convolutions",":","param","acti_func_conv",":","array",",","activation","functions","of","each","layer",":","param","layer_sizes_encoder",":","array",",","number","of","output","channels","for","each","encoding","FC","layer",":","param","acti_func_encoder",":","array",",","activation","functions","for","each","encoding","FC","layer",":","param","serialised_shape",":","array",",","flatten","shape","to","enter","the","FC","layers",":","param","w_initializer",":","weight","initialisation","for","network",":","param","w_regularizer",":","weight","regularisation","for","network",":","param","b_initializer",":","bias","initialisation","for","network",":","param","b_regularizer",":","bias","regularisation","for","network",":","param","name",":","layer","name"]
code: def __init__(
      self,
      denoising_variance,
      conv_output_channels,
      conv_kernel_sizes,
      conv_pooling_factors,
      acti_func_conv,
      layer_sizes_encoder,
      acti_func_encoder,
      serialised_shape,
      w_initializer=None,
      w_regularizer=None,
      b_initializer=None,
      b_regularizer=None,
      name="ConvEncoder",
  ):
      """
  
      :param denoising_variance: variance of gaussian noise to add to the input
      :param conv_output_channels: array, number of output channels for each conv layer
      :param conv_kernel_sizes: array, kernel sizes for each conv layer
      :param conv_pooling_factors: array, stride values for downsampling convolutions
      :param acti_func_conv: array, activation functions of each layer
      :param layer_sizes_encoder: array, number of output channels for each encoding FC layer
      :param acti_func_encoder: array, activation functions for each encoding FC layer
      :param serialised_shape: array, flatten shape to enter the FC layers
      :param w_initializer: weight initialisation for network
      :param w_regularizer: weight regularisation for network
      :param b_initializer: bias initialisation for network
      :param b_regularizer: bias regularisation for network
      :param name: layer name
      """
  
      super(ConvEncoder, self).__init__(name=name)
  
      self.denoising_variance = denoising_variance
      self.conv_output_channels = conv_output_channels
      self.conv_kernel_sizes = conv_kernel_sizes
      self.conv_pooling_factors = conv_pooling_factors
      self.acti_func_conv = acti_func_conv
      self.layer_sizes_encoder = layer_sizes_encoder
      self.acti_func_encoder = acti_func_encoder
      self.serialised_shape = serialised_shape
  
      self.initializers = {"w": w_initializer, "b": b_initializer}
      self.regularizers = {"w": w_regularizer, "b": b_regularizer}
  
imports: from __future__ import absolute_import, print_function, division
  import numpy
  import tensorflow
  from niftynet.layer.base_layer import TrainableLayer
  from niftynet.layer.convolution import ConvolutionalLayer
  from niftynet.layer.deconvolution import DeconvolutionalLayer
  from niftynet.layer.fully_connected import FullyConnectedLayer
  from niftynet.layer.upsample import UpSampleLayer
label_desc: Use image node_id 1 to create a new ConvEncoder object from inherited base classes: TrainableLayer with example: obj = ConvEncoder(denoising_variance, conv_output_channels, conv_kernel_sizes, conv_pooling_factors, acti_func_conv, layer_sizes_encoder, acti_func_encoder, serialised_shape, w_initializer, w_regularizer, b_initializer, b_regularizer, name)