def forward_once()

in models/yolo.py [0:0]


    def forward_once(self, x, profile=False, hm_only=False):
        y, dt = [], []  # outputs
        
        masks, pred_masks, offsets = None, None, None
        heatmap = None
        if isinstance(x, tuple):
            x, masks = x  # ground-truth masks
        x0 = x
        B, C, H, W = x.shape
        for mi, m in enumerate(self.model):
            if m.f != -1:  # if not from previous layer
                x = y[m.f] if isinstance(m.f, int) else [x if j == -1 else (x0 if j == -100 else y[j]) for j in m.f]  # from earlier layers

            if profile:
                o = thop.profile(m, inputs=(x,), verbose=False)[0] / 1E9 * 2 if thop else 0  # FLOPs
                t = time_synchronized()
                for _ in range(10):
                    _ = m(x)
                dt.append((time_synchronized() - t) * 100)
                if m == self.model[0]:
                    logger.info(f"{'time (ms)':>10s} {'GFLOPs':>10s} {'params':>10s}  {'module'}")
                logger.info(f'{dt[-1]:10.2f} {o:10.2f} {m.np:10.0f}  {m.type}')

            if isinstance(m, HeatMapParser) and masks is not None:
                x = (x[0], masks)
            elif type(m) in [Detect, Center] and offsets is not None:
                x = (x, offsets)
                x = (*x, masks if masks is not None else pred_masks)
            elif isinstance(m, MaskedC3TR):
                x = (x, heatmap)
            elif isinstance(m, Token2Image):
                x = [x, (H, W)]
            
            x = m(x)  # run

            if isinstance(m, Segmenter):
                pred_masks = x
                if hm_only:
                    return (None, None), pred_masks
                if masks is None:
                    masks = pred_masks
            elif isinstance(m, HeatMapParser):
                if isinstance(x, torch.Tensor):
                    offsets = x
                    if offsets.size(0) == 0:
                        return (None, None), pred_masks
                elif isinstance(x[1], torch.Tensor):
                    x, offsets = x
                    if len(x) == 0:
                        return (None, None), pred_masks
                else:
                    x, thresh = x
                    heatmap = pred_masks[0].detach().sigmoid()
                    heatmap = heatmap > thresh
            y.append(x if m.i in self.save else None)  # save output

        if profile:
            logger.info('%.1fms total' % sum(dt))
            
        return x, pred_masks