def build_and_apply_nas_policy(policies, image, bboxes, augmentation_hparams):
    'Build a policy from the given policies passed in and apply to image.\n\n  Args:\n    policies: list of lists of tuples in the form `(func, prob, level)`, `func`\n      is a string name of the augmentation function, `prob` is the probability\n      of applying the `func` operation, `level` is the input argument for\n      `func`.\n    image: tf.Tensor that the resulting policy will be applied to.\n    bboxes: tf.Tensor of shape [N, 4] representing ground truth boxes that are\n      normalized between [0, 1].\n    augmentation_hparams: Hparams associated with the NAS learned policy.\n\n  Returns:\n    A version of image that now has data augmentation applied to it based on\n    the `policies` pass into the function. Additionally, returns bboxes if\n    a value for them is passed in that is not None\n  '
    replace_value = [128, 128, 128]
    tf_policies = []
    for policy in policies:
        tf_policy = []
        for policy_info in policy:
            policy_info = (list(policy_info) + [replace_value, augmentation_hparams])
            tf_policy.append(_parse_policy_info(*policy_info))

        def make_final_policy(tf_policy_):

            def final_policy(image_, bboxes_):
                for (func, prob, args) in tf_policy_:
                    (image_, bboxes_) = _apply_func_with_prob(func, image_, args, prob, bboxes_)
                return (image_, bboxes_)
            return final_policy
        tf_policies.append(make_final_policy(tf_policy))
    (augmented_images, augmented_bboxes) = select_and_apply_random_policy(tf_policies, image, bboxes)
    return (augmented_images, augmented_bboxes)
Build a policy from the given policies passed in and apply to image.

Args:
  policies: list of lists of tuples in the form `(func, prob, level)`, `func`
    is a string name of the augmentation function, `prob` is the probability
    of applying the `func` operation, `level` is the input argument for
    `func`.
  image: tf.Tensor that the resulting policy will be applied to.
  bboxes: tf.Tensor of shape [N, 4] representing ground truth boxes that are
    normalized between [0, 1].
  augmentation_hparams: Hparams associated with the NAS learned policy.

Returns:
  A version of image that now has data augmentation applied to it based on
  the `policies` pass into the function. Additionally, returns bboxes if
  a value for them is passed in that is not None
def build_and_apply_nas_policy(policies, image, bboxes, augmentation_hparams):
    'Build a policy from the given policies passed in and apply to image.\n\n  Args:\n    policies: list of lists of tuples in the form `(func, prob, level)`, `func`\n      is a string name of the augmentation function, `prob` is the probability\n      of applying the `func` operation, `level` is the input argument for\n      `func`.\n    image: tf.Tensor that the resulting policy will be applied to.\n    bboxes: tf.Tensor of shape [N, 4] representing ground truth boxes that are\n      normalized between [0, 1].\n    augmentation_hparams: Hparams associated with the NAS learned policy.\n\n  Returns:\n    A version of image that now has data augmentation applied to it based on\n    the `policies` pass into the function. Additionally, returns bboxes if\n    a value for them is passed in that is not None\n  '
    replace_value = [128, 128, 128]
    tf_policies = []
    for policy in policies:
        tf_policy = []
        for policy_info in policy:
            policy_info = (list(policy_info) + [replace_value, augmentation_hparams])
            tf_policy.append(_parse_policy_info(*policy_info))

        def make_final_policy(tf_policy_):

            def final_policy(image_, bboxes_):
                for (func, prob, args) in tf_policy_:
                    (image_, bboxes_) = _apply_func_with_prob(func, image_, args, prob, bboxes_)
                return (image_, bboxes_)
            return final_policy
        tf_policies.append(make_final_policy(tf_policy))
    (augmented_images, augmented_bboxes) = select_and_apply_random_policy(tf_policies, image, bboxes)
    return (augmented_images, augmented_bboxes)