def _validate_predict_sample(
        train_sample: TorchTrainingSample, predict_sample: TorchInferenceDatasetOutput
    ):
        """Validates that the predict sample matches a sample that the model was trained on.

        For models relying on `TorchTrainingDataset` and `TorchInferenceDataset`.

        Parameters
        ----------
        train_sample
            (past target, past covariates, historic future covariates, future covariates, static covariates,
            future target)
        predict_sample
            (past target, past covariates, future past covariates, historic future covariates, future covariates,
            static covariates, target series schema, prediction start time)
        """
        # datasets; we skip future target for train and predict, and skip future past covariates for predict datasets
        ds_names = [
            "series",
            "past_covariates",
            "historic_future_covariates",
            "future_covariates",
            "static_covariates",
        ]

        # ignore sample weight and future target from train sample
        train_features = train_sample[:-1]
        train_has_ds = [ds is not None for ds in train_features]

        # ignore future past covariates, target schema, and prediction start time from predict sample
        predict_features = predict_sample[:2] + predict_sample[3:-2]
        predict_has_ds = [ds is not None for ds in predict_features]

        if len(train_features) != len(predict_features):
            raise_log(
                ValueError(
                    f"Mismatch between number of training features `{len(train_features)}` "
                    f"and prediction features `{len(predict_features)}`. Make sure your prediction "
                    f"dataset's `__getitem__` method returns the same output type as given in "
                    f"`darts.utils.data.inference_dataset.TorchInferenceDataset`."
                ),
                logger=logger,
            )

        for idx, (ds_in_train, ds_in_predict, ds_name) in enumerate(
            zip(train_has_ds, predict_has_ds, ds_names)
        ):
            if ds_in_train and not ds_in_predict:
                raise_log(
                    ValueError(
                        f"This model has been trained with `{ds_name}`; some `{ds_name}` "
                        f"of matching dimensionality are needed for prediction."
                    ),
                    logger=logger,
                )
            if not ds_in_train and ds_in_predict:
                raise_log(
                    ValueError(
                        f"This model has been trained without `{ds_name}`; No `{ds_name}` "
                        f"should be provided for prediction.",
                    ),
                    logger=logger,
                )
            if ds_in_train and ds_in_predict:
                train_shape = train_features[idx].shape
                preds_shape = predict_features[idx].shape

                if ds_name == "static_covariates":
                    train_n_comp = train_shape[0] * train_shape[1]
                    preds_n_comp = preds_shape[0] * preds_shape[1]
                else:
                    train_n_comp = train_shape[-1]
                    preds_n_comp = preds_shape[-1]

                if train_n_comp != preds_n_comp:
                    raise_log(
                        ValueError(
                            f"The provided `{ds_name}` must have equal number of components as the "
                            f"`{ds_name}` used to train the model. Received number of components: "
                            f"`{preds_n_comp}`, expected: `{train_n_comp}`.",
                        ),
                        logger=logger,
                    )
Validates that the predict sample matches a sample that the model was trained on.

        For models relying on `TorchTrainingDataset` and `TorchInferenceDataset`.

        Parameters
        ----------
        train_sample
            (past target, past covariates, historic future covariates, future covariates, static covariates,
            future target)
        predict_sample
            (past target, past covariates, future past covariates, historic future covariates, future covariates,
            static covariates, target series schema, prediction start time)
        
darts/models/forecasting/torch_forecasting_model.py