code: def _computing_bending_energy(displacement):
      """
  
      :param displacement: tensor, displacement field
      :return: bending energy
      """
      spatial_rank = infer_spatial_rank(displacement)
      if spatial_rank == 2:
          return _computing_bending_energy_2d(displacement)
      if spatial_rank == 3:
          return _computing_bending_energy_3d(displacement)
      raise NotImplementedError(
          "Not implmented: bending energy for {}-d input".format(
              spatial_rank
          )
      )
  
imports: from __future__ import absolute_import, print_function
  import numpy
  import tensorflow
  from tensorflow.contrib.layers.python.layers import regularizers
  from niftynet.engine.application_initializer import GlorotUniform
  from niftynet.layer.convolution import ConvolutionalLayer
  from niftynet.layer.downsample_res_block import DownBlock
  from niftynet.layer.grid_warper import _create_affine_features
  from niftynet.layer.layer_util import infer_spatial_rank, check_spatial_dims
  from niftynet.layer.linear_resize import LinearResizeLayer
  from niftynet.layer.spatial_gradient import SpatialGradientLayer
  from niftynet.layer.upsample_res_block import UpBlock
  from niftynet.network.base_net import BaseNet
label_desc: Use image node_id 3 for calling a global function with example usage: _computing_bending_energy(displacement) and returns: _computing_bending_energy_2d, _computing_bending_energy_3d