docstr: :param input_tensor: tensor, input to the UNet block
  :param is_training: boolean, True if network is in training mode
  :return: output tensor of the UNet block and branch before downsampling (if required)
docstr_tok: [":","param","input_tensor",":","tensor",",","input","to","the","UNet","block",":","param","is_training",":","boolean",",","True","if","network","is","in","training","mode",":","return",":","output","tensor","of","the","UNet","block","and","branch","before","downsampling","(","if","required",")"]
code: def layer_op(self, input_tensor, is_training):
      """
  
      :param input_tensor: tensor, input to the UNet block
      :param is_training: boolean, True if network is in training mode
      :return: output tensor of the UNet block and branch before downsampling (if required)
      """
      output_tensor = input_tensor
      for kernel_size, n_features in zip(self.kernels, self.n_chns):
          conv_op = ConvolutionalLayer(
              n_output_chns=n_features,
              kernel_size=kernel_size,
              w_initializer=self.initializers["w"],
              w_regularizer=self.regularizers["w"],
              acti_func=self.acti_func,
              name="{}".format(n_features),
          )
          output_tensor = conv_op(output_tensor, is_training)
  
      if self.with_downsample_branch:
          branch_output = output_tensor
      else:
          branch_output = None
  
      if self.func == "DOWNSAMPLE":
          downsample_op = DownSampleLayer(
              "MAX", kernel_size=2, stride=2, name="down_2x2"
          )
          output_tensor = downsample_op(output_tensor)
      elif self.func == "UPSAMPLE":
          upsample_op = DeconvolutionalLayer(
              n_output_chns=self.n_chns[-1],
              kernel_size=2,
              stride=2,
              name="up_2x2",
          )
          output_tensor = upsample_op(output_tensor, is_training)
      elif self.func == "NONE":
          pass  # do nothing
      return output_tensor, branch_output
  
file_path: NiftyNet/niftynet/network/unet.py
imports: from __future__ import absolute_import, print_function
  from niftynet.layer import layer_util
  from niftynet.layer.base_layer import TrainableLayer
  from niftynet.layer.convolution import ConvolutionalLayer
  from niftynet.layer.deconvolution import DeconvolutionalLayer
  from niftynet.layer.downsample import DownSampleLayer
  from niftynet.layer.elementwise import ElementwiseLayer
  from niftynet.layer.crop import CropLayer
  from niftynet.utilities.util_common import look_up_operations
label_desc: Use image node_id 2 for calling the UNetBlock obj's underlying member method code with example usage: obj.layer_op(input_tensor, is_training) and returns: output_tensor,  branch_output