def PWC_full(B,
                     lvl_h,
                     lvl_w,
                     pwc_h,
                     pwc_w,
                     lvl,
                     frameNum=5,
                     blur=False):
            ratio_h = float(lvl_h) / float(pwc_h)
            ratio_w = float(lvl_w) / float(pwc_w)
            nn = ModelPWCNet(mode='test', options=nn_opts)
            nn.print_config()
            for i in range(frameNum):
                B[i] = tf.image.resize_bilinear(B[i], (pwc_h, pwc_w),
                                                align_corners=True)

            tmp_list = []
            for i in range(frameNum):
                for j in range(frameNum):
                    tmp_list.append(tf.stack([B[i], B[j]], 1))

            PWC_input = tf.concat(tmp_list, 0)  # [batch_size*20, 2, H, W, 3]
            PWC_input = tf.reshape(
                PWC_input,
                [FLAGS.batch_size * (frameNum * frameNum), 2, pwc_h, pwc_w, 3])
            pred_labels, _ = nn.nn(PWC_input, reuse=tf.AUTO_REUSE)
            print(pred_labels)

            pred_labels = tf.image.resize_bilinear(pred_labels, (lvl_h, lvl_w),
                                                   align_corners=True)
            """
            0: W
            1: H
            """
            ratio_tensor = tf.expand_dims(
                tf.expand_dims(
                    tf.expand_dims(
                        tf.convert_to_tensor(np.asarray([ratio_w, ratio_h]),
                                             dtype=tf.float32), 0), 0), 0)

            FB = []
            counter = 0
            for i in range(frameNum):
                FB_tmp = []
                for j in range(frameNum):
                    FB_tmp.append(
                        tf.stop_gradient(pred_labels[FLAGS.batch_size *
                                                     counter:FLAGS.batch_size *
                                                     (counter + 1)] *
                                         ratio_tensor))
                    counter += 1
                FB.append(FB_tmp)

            return FB
    def PWC_full(F0, F1, F2, F3, F4, B0, B1, B2, B3, B4, lvl_h, lvl_w, pwc_h, pwc_w):
        ratio_h = float(lvl_h) / float(pwc_h)
        ratio_w = float(lvl_w) / float(pwc_w)
        nn = ModelPWCNet(mode='test', options=nn_opts)
        nn.print_config()
        F0 = tf.image.resize_bilinear(F0, (pwc_h, pwc_w))
        F1 = tf.image.resize_bilinear(F1, (pwc_h, pwc_w))
        F2 = tf.image.resize_bilinear(F2, (pwc_h, pwc_w))
        F3 = tf.image.resize_bilinear(F3, (pwc_h, pwc_w))
        F4 = tf.image.resize_bilinear(F4, (pwc_h, pwc_w))
        B0 = tf.image.resize_bilinear(B0, (pwc_h, pwc_w))
        B1 = tf.image.resize_bilinear(B1, (pwc_h, pwc_w))
        B2 = tf.image.resize_bilinear(B2, (pwc_h, pwc_w))
        B3 = tf.image.resize_bilinear(B3, (pwc_h, pwc_w))
        B4 = tf.image.resize_bilinear(B4, (pwc_h, pwc_w))
        tmp_list = []
        tmp_list.append(tf.stack([F0, F1], 1))
        tmp_list.append(tf.stack([F0, F2], 1))
        tmp_list.append(tf.stack([F0, F3], 1))
        tmp_list.append(tf.stack([F0, F4], 1))
        tmp_list.append(tf.stack([F1, F0], 1))
        tmp_list.append(tf.stack([F1, F2], 1))
        tmp_list.append(tf.stack([F1, F3], 1))
        tmp_list.append(tf.stack([F1, F4], 1))
        tmp_list.append(tf.stack([F2, F0], 1))
        tmp_list.append(tf.stack([F2, F1], 1))
        tmp_list.append(tf.stack([F2, F3], 1))
        tmp_list.append(tf.stack([F2, F4], 1))
        tmp_list.append(tf.stack([F3, F0], 1))
        tmp_list.append(tf.stack([F3, F1], 1))
        tmp_list.append(tf.stack([F3, F2], 1))
        tmp_list.append(tf.stack([F3, F4], 1))
        tmp_list.append(tf.stack([F4, F0], 1))
        tmp_list.append(tf.stack([F4, F1], 1))
        tmp_list.append(tf.stack([F4, F2], 1))
        tmp_list.append(tf.stack([F4, F3], 1))
        tmp_list.append(tf.stack([B0, B1], 1))
        tmp_list.append(tf.stack([B0, B2], 1))
        tmp_list.append(tf.stack([B0, B3], 1))
        tmp_list.append(tf.stack([B0, B4], 1))
        tmp_list.append(tf.stack([B1, B0], 1))
        tmp_list.append(tf.stack([B1, B2], 1))
        tmp_list.append(tf.stack([B1, B3], 1))
        tmp_list.append(tf.stack([B1, B4], 1))
        tmp_list.append(tf.stack([B2, B0], 1))
        tmp_list.append(tf.stack([B2, B1], 1))
        tmp_list.append(tf.stack([B2, B3], 1))
        tmp_list.append(tf.stack([B2, B4], 1))
        tmp_list.append(tf.stack([B3, B0], 1))
        tmp_list.append(tf.stack([B3, B1], 1))
        tmp_list.append(tf.stack([B3, B2], 1))
        tmp_list.append(tf.stack([B3, B4], 1))
        tmp_list.append(tf.stack([B4, B0], 1))
        tmp_list.append(tf.stack([B4, B1], 1))
        tmp_list.append(tf.stack([B4, B2], 1))
        tmp_list.append(tf.stack([B4, B3], 1))

        PWC_input = tf.concat(tmp_list, 0)  # [batch_size*20, 2, H, W, 3]
        PWC_input = tf.reshape(PWC_input, [FLAGS.batch_size * 40, 2, pwc_h, pwc_w, 3])
        pred_labels, _ = nn.nn(PWC_input, reuse=tf.AUTO_REUSE)
        print(pred_labels)

        pred_labels = tf.image.resize_bilinear(pred_labels, (lvl_h, lvl_w))
        """
        0: W
        1: H
        """
        ratio_tensor = tf.expand_dims(tf.expand_dims(tf.expand_dims(tf.convert_to_tensor(np.asarray([ratio_w, ratio_h]), dtype=tf.float32), 0), 0), 0)

        FF01 = pred_labels[FLAGS.batch_size * 0:FLAGS.batch_size * 1] * ratio_tensor
        FF02 = pred_labels[FLAGS.batch_size * 1:FLAGS.batch_size * 2] * ratio_tensor
        FF03 = pred_labels[FLAGS.batch_size * 2:FLAGS.batch_size * 3] * ratio_tensor
        FF04 = pred_labels[FLAGS.batch_size * 3:FLAGS.batch_size * 4] * ratio_tensor
        FF10 = pred_labels[FLAGS.batch_size * 4:FLAGS.batch_size * 5] * ratio_tensor
        FF12 = pred_labels[FLAGS.batch_size * 5:FLAGS.batch_size * 6] * ratio_tensor
        FF13 = pred_labels[FLAGS.batch_size * 6:FLAGS.batch_size * 7] * ratio_tensor
        FF14 = pred_labels[FLAGS.batch_size * 7:FLAGS.batch_size * 8] * ratio_tensor
        FF20 = pred_labels[FLAGS.batch_size * 8:FLAGS.batch_size * 9] * ratio_tensor
        FF21 = pred_labels[FLAGS.batch_size * 9:FLAGS.batch_size * 10] * ratio_tensor
        FF23 = pred_labels[FLAGS.batch_size * 10:FLAGS.batch_size * 11] * ratio_tensor
        FF24 = pred_labels[FLAGS.batch_size * 11:FLAGS.batch_size * 12] * ratio_tensor
        FF30 = pred_labels[FLAGS.batch_size * 12:FLAGS.batch_size * 13] * ratio_tensor
        FF31 = pred_labels[FLAGS.batch_size * 13:FLAGS.batch_size * 14] * ratio_tensor
        FF32 = pred_labels[FLAGS.batch_size * 14:FLAGS.batch_size * 15] * ratio_tensor
        FF34 = pred_labels[FLAGS.batch_size * 15:FLAGS.batch_size * 16] * ratio_tensor
        FF40 = pred_labels[FLAGS.batch_size * 16:FLAGS.batch_size * 17] * ratio_tensor
        FF41 = pred_labels[FLAGS.batch_size * 17:FLAGS.batch_size * 18] * ratio_tensor
        FF42 = pred_labels[FLAGS.batch_size * 18:FLAGS.batch_size * 19] * ratio_tensor
        FF43 = pred_labels[FLAGS.batch_size * 19:FLAGS.batch_size * 20] * ratio_tensor
        FB01 = pred_labels[FLAGS.batch_size * 20:FLAGS.batch_size * 21] * ratio_tensor
        FB02 = pred_labels[FLAGS.batch_size * 21:FLAGS.batch_size * 22] * ratio_tensor
        FB03 = pred_labels[FLAGS.batch_size * 22:FLAGS.batch_size * 23] * ratio_tensor
        FB04 = pred_labels[FLAGS.batch_size * 23:FLAGS.batch_size * 24] * ratio_tensor
        FB10 = pred_labels[FLAGS.batch_size * 24:FLAGS.batch_size * 25] * ratio_tensor
        FB12 = pred_labels[FLAGS.batch_size * 25:FLAGS.batch_size * 26] * ratio_tensor
        FB13 = pred_labels[FLAGS.batch_size * 26:FLAGS.batch_size * 27] * ratio_tensor
        FB14 = pred_labels[FLAGS.batch_size * 27:FLAGS.batch_size * 28] * ratio_tensor
        FB20 = pred_labels[FLAGS.batch_size * 28:FLAGS.batch_size * 29] * ratio_tensor
        FB21 = pred_labels[FLAGS.batch_size * 29:FLAGS.batch_size * 30] * ratio_tensor
        FB23 = pred_labels[FLAGS.batch_size * 30:FLAGS.batch_size * 31] * ratio_tensor
        FB24 = pred_labels[FLAGS.batch_size * 31:FLAGS.batch_size * 32] * ratio_tensor
        FB30 = pred_labels[FLAGS.batch_size * 32:FLAGS.batch_size * 33] * ratio_tensor
        FB31 = pred_labels[FLAGS.batch_size * 33:FLAGS.batch_size * 34] * ratio_tensor
        FB32 = pred_labels[FLAGS.batch_size * 34:FLAGS.batch_size * 35] * ratio_tensor
        FB34 = pred_labels[FLAGS.batch_size * 35:FLAGS.batch_size * 36] * ratio_tensor
        FB40 = pred_labels[FLAGS.batch_size * 36:FLAGS.batch_size * 37] * ratio_tensor
        FB41 = pred_labels[FLAGS.batch_size * 37:FLAGS.batch_size * 38] * ratio_tensor
        FB42 = pred_labels[FLAGS.batch_size * 38:FLAGS.batch_size * 39] * ratio_tensor
        FB43 = pred_labels[FLAGS.batch_size * 39:FLAGS.batch_size * 40] * ratio_tensor

        return FF01, FF02, FF03, FF04, \
               FF10, FF12, FF13, FF14, \
               FF20, FF21, FF23, FF24, \
               FF30, FF31, FF32, FF34, \
               FF40, FF41, FF42, FF43, \
               FB01, FB02, FB03, FB04, \
               FB10, FB12, FB13, FB14, \
               FB20, FB21, FB23, FB24, \
               FB30, FB31, FB32, FB34, \
               FB40, FB41, FB42, FB43
    B3_pred_0_down = tf.image.resize_bilinear(apply_gaussian_blur_image(B3_pred_0), (pwc_h, pwc_w), align_corners=True)
    B4_pred_0_down = tf.image.resize_bilinear(apply_gaussian_blur_image(B4_pred_0), (pwc_h, pwc_w), align_corners=True)

    ratio_h = float(CROP_PATCH_H // (2 ** down_level)) / float(pwc_h)
    ratio_w = float(CROP_PATCH_W // (2 ** down_level)) / float(pwc_w)
    nn = ModelPWCNet(mode='test', options=nn_opts)
    nn.print_config()
    tmp_list = []
    tmp_list.append(tf.stack([B2_pred_0_down, B0_pred_0_down], 1))
    tmp_list.append(tf.stack([B2_pred_0_down, B1_pred_0_down], 1))
    tmp_list.append(tf.stack([B2_pred_0_down, B3_pred_0_down], 1))
    tmp_list.append(tf.stack([B2_pred_0_down, B4_pred_0_down], 1))

    PWC_input = tf.concat(tmp_list, 0)  # [batch_size*20, 2, H, W, 3]
    PWC_input = tf.reshape(PWC_input, [FLAGS.batch_size * 4, 2, pwc_h, pwc_w, 3])
    pred_labels, _ = nn.nn(PWC_input, reuse=tf.AUTO_REUSE)
    pred_labels = tf.image.resize_bilinear(pred_labels, (RESIZED_H // (2 ** down_level), RESIZED_W // (2 ** down_level)), align_corners=True)
    """
    0: W
    1: H
    """
    ratio_tensor = tf.expand_dims(tf.expand_dims(tf.expand_dims(tf.convert_to_tensor(np.asarray([ratio_w, ratio_h]), dtype=tf.float32), 0), 0), 0)
    FB20 = pred_labels[FLAGS.batch_size * 0:FLAGS.batch_size * 1] * ratio_tensor * (2 ** down_level)
    FB21 = pred_labels[FLAGS.batch_size * 1:FLAGS.batch_size * 2] * ratio_tensor * (2 ** down_level)
    FB23 = pred_labels[FLAGS.batch_size * 2:FLAGS.batch_size * 3] * ratio_tensor * (2 ** down_level)
    FB24 = pred_labels[FLAGS.batch_size * 3:FLAGS.batch_size * 4] * ratio_tensor * (2 ** down_level)

    FB20 = tf.image.resize_bilinear(FB20, [RESIZED_H, RESIZED_W], align_corners=True)
    FB21 = tf.image.resize_bilinear(FB21, [RESIZED_H, RESIZED_W], align_corners=True)
    FB23 = tf.image.resize_bilinear(FB23, [RESIZED_H, RESIZED_W], align_corners=True)
    FB24 = tf.image.resize_bilinear(FB24, [RESIZED_H, RESIZED_W], align_corners=True)