code: def get_valid_ratio(mask):
      _, H, W = paddle.shape(mask)
      valid_ratio_h = paddle.sum(mask[:, :, 0], 1) / H
      valid_ratio_w = paddle.sum(mask[:, 0, :], 1) / W
      # [b, 2]
      return paddle.stack([valid_ratio_w, valid_ratio_h], -1)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import copy
  import math
  import paddle
  import paddle.nn
  import paddle.nn.functional
  from ..bbox_utils import bbox_overlaps
label_desc: Use image node_id 7 for calling a global function with example usage: get_valid_ratio(mask) and returns: paddle