def forward(self, x, inputs=None):
        """
        Take pyramid features as input to perform Cross Layer Refinement and finally output the prediction lanes.
        Each feature is a 4D tensor.
        Args:
            x: input features (list[Tensor])
        Return:
            prediction_list: each layer's prediction result
            seg: segmentation result for auxiliary loss
        """
        batch_features = list(x[len(x) - self.refine_layers:])
        batch_features.reverse()
        batch_size = batch_features[-1].shape[0]

        if self.training:
            self.priors, self.priors_on_featmap = self.generate_priors_from_embeddings(
            )
        priors, priors_on_featmap = self.priors.tile(
            [batch_size, 1,
             1]), self.priors_on_featmap.tile([batch_size, 1, 1])
        predictions_lists = []
        prior_features_stages = []

        for stage in range(self.refine_layers):
            num_priors = priors_on_featmap.shape[1]
            prior_xs = paddle.flip(x=priors_on_featmap, axis=[2])
            batch_prior_features = self.pool_prior_features(
                batch_features[stage], num_priors, prior_xs)
            prior_features_stages.append(batch_prior_features)

            fc_features = self.roi_gather(prior_features_stages,
                                          batch_features[stage], stage)
            # return fc_features
            fc_features = fc_features.reshape(
                [num_priors, batch_size, -1]).reshape(
                    [batch_size * num_priors, self.fc_hidden_dim])
            cls_features = fc_features.clone()
            reg_features = fc_features.clone()

            for cls_layer in self.cls_modules:
                cls_features = cls_layer(cls_features)

            # return cls_features
            for reg_layer in self.reg_modules:
                reg_features = reg_layer(reg_features)
            cls_logits = self.cls_layers(cls_features)
            reg = self.reg_layers(reg_features)

            cls_logits = cls_logits.reshape(
                [batch_size, -1, cls_logits.shape[1]])
            reg = reg.reshape([batch_size, -1, reg.shape[1]])
            predictions = priors.clone()
            predictions[:, :, :2] = cls_logits
            predictions[:, :, 2:5] += reg[:, :, :3]
            predictions[:, :, 5] = reg[:, :, 3]

            def tran_tensor(t):
                return t.unsqueeze(axis=2).clone().tile([1, 1, self.n_offsets])

            predictions[..., 6:] = (
                tran_tensor(predictions[..., 3]) * (self.img_w - 1) +
                ((1 - self.prior_ys.tile([batch_size, num_priors, 1]) -
                  tran_tensor(predictions[..., 2])) * self.img_h / paddle.tan(
                      tran_tensor(predictions[..., 4]) * math.pi + 1e-05))) / (
                          self.img_w - 1)

            prediction_lines = predictions.clone()
            predictions[..., 6:] += reg[..., 4:]
            predictions_lists.append(predictions)

            if stage != self.refine_layers - 1:
                priors = prediction_lines.detach().clone()
                priors_on_featmap = priors.index_select(
                    6 + self.sample_x_indexs, axis=-1)

        if self.training:
            seg = None
            seg_features = paddle.concat(
                [
                    F.interpolate(
                        feature,
                        size=[
                            batch_features[-1].shape[2],
                            batch_features[-1].shape[3]
                        ],
                        mode='bilinear',
                        align_corners=False) for feature in batch_features
                ],
                axis=1)

            seg = self.seg_decoder(seg_features)

            output = {'predictions_lists': predictions_lists, 'seg': seg}
            return self.loss(output, inputs)
        return predictions_lists[-1]

        Take pyramid features as input to perform Cross Layer Refinement and finally output the prediction lanes.
        Each feature is a 4D tensor.
        Args:
            x: input features (list[Tensor])
        Return:
            prediction_list: each layer's prediction result
            seg: segmentation result for auxiliary loss
        
ppdet/modeling/heads/clrnet_head.py