CUDA error: device-side assert triggered

What happens if you execute:

import torch as pt
mask_values = pt.unique(mask.data)

and compare the length of

mask_values

to

codes

?

My assumption is that there is a mismatch between the pixels values and the codes. If that doesn’t help, can you please replace 400 in the following line with src_size:

data = (il.transform(get_transforms(), tfm_y=True,size=400)
        .databunch(bs=2)
        .normalize(imagenet_stats))