from pathlib import Path
import glob
import torch


def read_expert_trajectories(folder_path):
    """
    reads expert features found in folder_path.

    :return: torch tensor of all features of all expert trajectories.
    :rtype: torch float tensor, shape of (num of total features x feature length)
    """

    features_path = Path(folder_path) / '*.states'
    feature_files = glob.glob(str(features_path))

    list_of_trajectories = []

    for feature_file in feature_files:
        list_of_trajectories.append(torch.load(feature_file))

    return list_of_trajectories