DataLoader Pytorch в Numpy Array

# index is the specific data your want in dataloader
import numpy as np
def transfer_dataloader(dataloader, index=0):
    cache_list = list(iter(dataloader))
    assert len(cache_list) > 0
    assert index < len(cache_list[0])
    result_list = np.array(list(map(lambda x: x[index].numpy(), cache_list)))
    return result_list
Silly Sicily Boy