//  [python]
def compute_for_render_hierarchical_mid(self,
                                            coeffs,
                                            deformation_map,
                                            UVs,
                                            visualize=False,
                                            de_retouched_albedo_map=None):
        if type(coeffs) == dict:
            coef_dict = coeffs
        elif type(coeffs) == torch.Tensor:
            coef_dict = self.split_coeff(coeffs)

        face_shape = self.compute_shape(coef_dict['id'],
                                        coef_dict['exp'])  # (B, n, 3)
        face_shape_base = face_shape.clone()

        face_shape, shape_offset = self.add_nonlinear_offset(
            face_shape, deformation_map, UVs)  # (B, n, 3)

        rotation = self.compute_rotation(coef_dict['angle'])

        face_shape_transformed = self.transform(face_shape, rotation,
                                                coef_dict['trans'])
        face_vertex = self.to_camera(face_shape_transformed.clone())

        face_proj = self.to_image(face_vertex)
        landmark = self.get_landmarks(face_proj)

        face_norm = self.compute_norm(face_shape)
        face_norm_roted = face_norm @ rotation

        face_albedo_map = self.compute_albedo_map(
            coef_dict['tex'])  # (B, 512, 512, 3)
        face_albedo_map = face_albedo_map.permute(0, 3, 1, 2)
        face_albedo_map = torch.nn.functional.interpolate(
            face_albedo_map, [self.render.uv_size, self.render.uv_size],
            mode='bilinear')
        face_norm_roted_uv = self.render.world2uv(face_norm_roted)

        albedo_for_render = face_albedo_map if de_retouched_albedo_map is None else de_retouched_albedo_map
        face_color_map = self.compute_color_map(albedo_for_render,
                                                face_norm_roted_uv,
                                                coef_dict['gamma'])

        extra_results = None
        if visualize:
            extra_results = {}
            extra_results['tex_mid_color'] = face_color_map

            face_shape_transformed_base = self.transform(
                face_shape_base, rotation, coef_dict['trans'])
            face_vertex_base = self.to_camera(
                face_shape_transformed_base.clone())
            extra_results['pred_vertex_base'] = face_vertex_base
            face_norm_base = self.compute_norm(face_shape_base)
            face_norm_roted_base = face_norm_base @ rotation

            batch_size = albedo_for_render.shape[0]
            size = albedo_for_render.shape[2]
            gray_tex = torch.ones((batch_size, 3, size, size),
                                  dtype=torch.float32).to(self.device) * 0.8
            zero_displacement = torch.zeros(
                (batch_size, 1, size, size),
                dtype=torch.float32).to(self.device)

            tex_mid_gray = self.compute_color_with_displacement(
                gray_tex.detach(), face_shape_transformed, face_norm_roted,
                zero_displacement, coef_dict['gamma'])
            tex_mid_gray = self.recolor_texture(tex_mid_gray)
            extra_results['tex_mid_gray'] = tex_mid_gray

            tex_base_color = self.compute_color_with_displacement(
                albedo_for_render, face_shape_transformed_base,
                face_norm_roted_base, zero_displacement, coef_dict['gamma'])
            extra_results['tex_base_color'] = tex_base_color

            tex_base_gray = self.compute_color_with_displacement(
                gray_tex.detach(), face_shape_transformed_base,
                face_norm_roted_base, zero_displacement, coef_dict['gamma'])
            tex_base_gray = self.recolor_texture(tex_base_gray)
            extra_results['tex_base_gray'] = tex_base_gray

            # to export rotate video
            init_angle = torch.zeros_like(coef_dict['angle']).to(
                coef_dict['angle'].device)

            pi = 3.14
            n_frame = 30
            y_angles = torch.linspace(-pi / 6, pi / 6, steps=n_frame).float()

            extra_results['face_shape_transformed_list'] = []
            extra_results['face_norm_roted_list'] = []
            extra_results['face_vertex_list'] = []
            for y_angle in y_angles:
                cur_angle = init_angle.clone()
                cur_angle[:, 1] = y_angle
                cur_angle[:, 0] = pi / 36
                cur_rotation = self.compute_rotation(cur_angle)
                cur_face_shape_transformed = self.transform(
                    face_shape, cur_rotation, coef_dict['trans'] * 0)
                cur_face_norm_roted = face_norm @ cur_rotation
                cur_face_vertex = self.to_camera(
                    cur_face_shape_transformed.clone())

                extra_results['face_shape_transformed_list'].append(
                    cur_face_shape_transformed)
                extra_results['face_norm_roted_list'].append(
                    cur_face_norm_roted)
                extra_results['face_vertex_list'].append(cur_face_vertex)

        return (face_vertex, face_color_map, landmark, face_proj,
                face_albedo_map, face_shape_transformed, face_norm_roted,
                extra_results)