DatasetType equivalent in fastai-v2 vision

This command does not work in FastAI version 2.
from import DatasetType, open_image

I was trying to calculate the features of image using the below code
What would be the equivalent of DatasetType in fastai v2

def compute_features_learner(
data, dataset_type: DatasetType, learn: Learner, embedding_layer: Module
) -> List[Dict[str, np.array]]:
if dataset_type == DatasetType.Train or dataset_type == DatasetType.Fix:
dataset_type = (
) # Training set without shuffeling and no dropping of last batch. See note above.
label_list = list(data.train_ds.items)
elif dataset_type == DatasetType.Valid:
label_list = list(data.valid_ds.items)
elif dataset_type == DatasetType.Test:
label_list = list(data.test_ds.items)
raise Exception(
“Dataset_type needs to be of type DatasetType.Train, DatasetType.Valid, DatasetType.Test or DatasetType.Fix.”

# Update what data the learner object is using
tmp_data = = data

# Compute features
featurizer = SaveFeatures(embedding_layer)
feats = featurizer.features[:]

# Set data back to before = tmp_data

# Get corresponding image paths
assert len(feats) == len(label_list)
im_paths = [str(x) for x in label_list]
return dict(zip(im_paths, feats))

I am unsure of what you are trying to do but fastai v2 is not backward compatible with v1. Which means trying to use a v1 function with v2 will likely fail.

Im trying to replicate the code present in the following link line no. 92

It is used for extracting embeddings from an image.

there are lot of useful methods we were able to access using learner object

names=[Path(item).stem+'.png' for item in]
dl =

How i can get fastaiv2 eq of these.
Are below equiwalents above

dl = learn.dls.valid
if i need the items that loader valid would get during iter,
items= dl.items.<df_column>