docstr: Implementation of residual unit presented in:
  
      [1] He et al., Identity mapping in deep residual networks, ECCV 2016
      [2] He et al., Deep residual learning for image recognition, CVPR 2016
  
  The possible types of connections are::
  
      'original': residual unit presented in [2]
      'conv_bn_acti': ReLU before addition presented in [1]
      'acti_conv_bn': ReLU-only pre-activation presented in [1]
      'bn_acti_conv': full pre-activation presented in [1]
  
  [1] recommends 'bn_acti_conv'
  
  :param n_output_chns: number of output feature channels
      if this doesn't match the input, a 1x1 projection will be created.
  :param kernel_size:
  :param dilation:
  :param acti_func:
  :param w_initializer:
  :param w_regularizer:
  :param moving_decay:
  :param eps:
  :param type_string:
  :param name:
docstr_tok: ["Implementation","of","residual","unit","presented","in",":","[","1","]","He","et","al.",",","Identity","mapping","in","deep","residual","networks",",","ECCV","2016","[","2","]","He","et","al.",",","Deep","residual","learning","for","image","recognition",",","CVPR","2016","The","possible","types","of","connections","are",":",":","'original","'",":","residual","unit","presented","in","[","2","]","'conv_bn_acti","'",":","ReLU","before","addition","presented","in","[","1","]","'acti_conv_bn","'",":","ReLU-only","pre-activation","presented","in","[","1","]","'bn_acti_conv","'",":","full","pre-activation","presented","in","[","1","]","[","1","]","recommends","'bn_acti_conv'",":","param","n_output_chns",":","number","of","output","feature","channels","if","this","does","n't","match","the","input",",","a","1x1","projection","will","be","created",".",":","param","kernel_size",":",":","param","dilation",":",":","param","acti_func",":",":","param","w_initializer",":",":","param","w_regularizer",":",":","param","moving_decay",":",":","param","eps",":",":","param","type_string",":",":","param","name",":"]
code: def __init__(
      self,
      n_output_chns=1,
      kernel_size=3,
      dilation=1,
      acti_func="relu",
      w_initializer=None,
      w_regularizer=None,
      moving_decay=0.9,
      eps=1e-5,
      type_string="bn_acti_conv",
      name="res-downsample",
  ):
      """
      Implementation of residual unit presented in:
  
          [1] He et al., Identity mapping in deep residual networks, ECCV 2016
          [2] He et al., Deep residual learning for image recognition, CVPR 2016
  
      The possible types of connections are::
  
          'original': residual unit presented in [2]
          'conv_bn_acti': ReLU before addition presented in [1]
          'acti_conv_bn': ReLU-only pre-activation presented in [1]
          'bn_acti_conv': full pre-activation presented in [1]
  
      [1] recommends 'bn_acti_conv'
  
      :param n_output_chns: number of output feature channels
          if this doesn't match the input, a 1x1 projection will be created.
      :param kernel_size:
      :param dilation:
      :param acti_func:
      :param w_initializer:
      :param w_regularizer:
      :param moving_decay:
      :param eps:
      :param type_string:
      :param name:
      """
  
      super(TrainableLayer, self).__init__(name=name)
      self.type_string = look_up_operations(
          type_string.lower(), SUPPORTED_OP
      )
      self.acti_func = acti_func
      self.conv_param = {
          "w_initializer": w_initializer,
          "w_regularizer": w_regularizer,
          "kernel_size": kernel_size,
          "dilation": dilation,
          "n_output_chns": n_output_chns,
      }
      self.bn_param = {
          "regularizer": w_regularizer,
          "moving_decay": moving_decay,
          "eps": eps,
      }
  
file_path: NiftyNet/niftynet/layer/residual_unit.py
imports: from __future__ import absolute_import, print_function
  from niftynet.layer.activation import ActiLayer
  from niftynet.layer.base_layer import TrainableLayer
  from niftynet.layer.bn import BNLayer
  from niftynet.layer.convolution import ConvolutionalLayer
  from niftynet.layer.elementwise import ElementwiseLayer
  from niftynet.utilities.util_common import look_up_operations
label_desc: Use image node_id 1 to create a new ResidualUnit object from inherited base classes: TrainableLayer with example: obj = ResidualUnit(n_output_chns, kernel_size, dilation, acti_func, w_initializer, w_regularizer, moving_decay, eps, type_string, name)