DatasetType equivalent in fastai-v2 vision

This command does not work in FastAI version 2.
from fastai.vision 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 = (
DatasetType.Fix
) # 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)
else:
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 = learn.data
learn.data = data

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

# Set data back to before
learn.data = 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
https://github.com/microsoft/computervision-recipes/blob/master/utils_cv/similarity/model.py line no. 92

It is used for extracting embeddings from an image.

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

names=[Path(item).stem+'.png' for item in learn2.data.test_dl.dataset.items]
dl = learn2.data.dl(DatasetType.Test)

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,
then
items= dl.items.<df_column>