Like so?:
# Extract HOG features 
from skimage.feature import hog
def HOG_features(data):
    num_samples = len(data)
    hog_features = []
    for i in range(num_samples):
        img = data[i]
        feature = hog(img, orientations=9)
        hog_features.append(feature)
    return np.array(hog_features)

HOG_X_train = torch.tensor([HOG_features(X_train)])
HOG_X_test = torch.tensor([HOG_features(X_test)])