def test_blackout_pixel_weights_by_box_regions(self):

    def graph_fn():
        boxes = tf.constant([[0.0, 0.0, 5, 5], [0.0, 0.0, 10.0, 20.0], [6.0, 12.0, 8.0, 18.0]], dtype=tf.float32)
        blackout = tf.constant([True, False, True], dtype=tf.bool)
        blackout_pixel_weights_by_box_regions = tf.function(ta_utils.blackout_pixel_weights_by_box_regions)
        output = blackout_pixel_weights_by_box_regions(10, 20, boxes, blackout)
        return output
    output = self.execute(graph_fn, [])
    self.assertAlmostEqual(np.sum(output[0:6, 0:6]), 0.0)
    self.assertAlmostEqual(np.sum(output[6:9, 12:19]), 0.0)
    self.assertAlmostEqual(np.sum(output), 143.0)
def test_blackout_pixel_weights_by_box_regions(self):

    def graph_fn():
        boxes = tf.constant([[0.0, 0.0, 5, 5], [0.0, 0.0, 10.0, 20.0], [6.0, 12.0, 8.0, 18.0]], dtype=tf.float32)
        blackout = tf.constant([True, False, True], dtype=tf.bool)
        blackout_pixel_weights_by_box_regions = tf.function(ta_utils.blackout_pixel_weights_by_box_regions)
        output = blackout_pixel_weights_by_box_regions(10, 20, boxes, blackout)
        return output
    output = self.execute(graph_fn, [])
    self.assertAlmostEqual(np.sum(output[0:6, 0:6]), 0.0)
    self.assertAlmostEqual(np.sum(output[6:9, 12:19]), 0.0)
    self.assertAlmostEqual(np.sum(output), 143.0)