added to_tensor function for imagedataset, also allowed selection