code: def test_MAE_loss_value_weight(self):
      with self.cached_session():
          weights = tf.constant(
              [[1, 2]], dtype=tf.float32, name="weights"
          )
          predicted = tf.constant(
              [[1, 1]], dtype=tf.float32, name="predicted"
          )
          labels = tf.constant(
              [[1, 0]], dtype=tf.float32, name="labels"
          )
          test_loss_func = LossFunction(loss_type="MAE")
          computed_MAE_loss = test_loss_func(predicted, labels, weights)
          self.assertAlmostEqual(computed_MAE_loss.eval(), 2.0 / 3.0)
  
imports: from __future__ import absolute_import, print_function
  import tensorflow
  from niftynet.layer.loss_regression import LossFunction
  from niftynet.layer.loss_regression import l1_loss, l2_loss, huber_loss, smooth_l1_loss, cosine_loss
  from tests.niftynet_testcase import NiftyNetTestCase
label_desc: Use image node_id 2 for calling the MAELossTests obj's underlying member method code with example usage: obj.test_MAE_loss_value_weight() without return types