def _track(self, x: "torch.Tensor", y_init: "torch.Tensor") -> "torch.Tensor":
        """
        Track object across frames.

        :param x: A single video of shape (nb_frames, nb_height, nb_width, nb_channels)
        :param y_init: Initial bounding box around object on the first frame of `x`.
        :return: Predicted bounding box coordinates for all frames of shape (nb_frames, 4) in format [x1, y1, x2, y2].
        """
        import torch

        num_frames = x.shape[0]
        prev = x[0]
        bbox_0 = y_init
        y_pred_list = [y_init]

        for i in range(1, num_frames):
            curr = x[i]
            bbox_0 = self._track_step(curr, prev, bbox_0)
            bbox = bbox_0
            prev = curr

            y_pred_list.append(bbox)

        y_pred = torch.stack(y_pred_list)

        return y_pred

        Track object across frames.

        :param x: A single video of shape (nb_frames, nb_height, nb_width, nb_channels)
        :param y_init: Initial bounding box around object on the first frame of `x`.
        :return: Predicted bounding box coordinates for all frames of shape (nb_frames, 4) in format [x1, y1, x2, y2].
        
art/estimators/object_tracking/pytorch_goturn.py