code: def test_masks(self):
      x = tf.random_normal(shape=[2, 4, 5, 4])
      conv1 = ChannelSparseConvolutionalLayer(10)
      conv2 = ChannelSparseConvolutionalLayer(10)
      conv3 = ChannelSparseConvolutionalLayer(10)
      conv4 = ChannelSparseConvolutionalLayer(10)
      x1, mask1 = conv1(x, None, True, 1.0)
      x2, mask2 = conv2(x1, mask1, True, 0.5)
      x3, mask3 = conv3(x2, mask2, True, 0.2)
      x4, mask4 = conv4(x3, mask3, True, 1.0)
  
      with self.cached_session(config=get_config()) as sess:
          sess.run(tf.global_variables_initializer())
          out1, out2, out3, out4 = sess.run(
              [mask1, mask2, mask3, mask4]
          )
      self.assertAllClose(
          [10, 5, 2, 10],
          [np.sum(out1), np.sum(out2), np.sum(out3), np.sum(out4)],
      )
  
file_path: NiftyNet/tests/channel_sparse_convolution_test.py
imports: from __future__ import absolute_import, print_function
  import tensorflow
  import numpy
  from niftynet.layer.channel_sparse_convolution import ChannelSparseConvolutionalLayer
  from tests.niftynet_testcase import NiftyNetTestCase
  from tensorflow.core.protobuf import config_pb2
  from tensorflow.core.protobuf import rewriter_config_pb2
label_desc: Use image node_id 3 for calling the ChannelSparseConvolutionalLayerTest obj's underlying member method code with example usage: obj.test_masks() without return types