Dataloader giving list of tensor instead of tensor

(Akash ) #1

path = datasets.untar_data(datasets.URLs.IMAGENETTE_160)
tfms = [make_rgb, ResizeFixed(128), to_byte_tensor, to_float_tensor]

il = ImageList.from_files(path, extensions= image_extensions,tfms=tfms)
sd = SplitData.split_by_func(il, partial(grandparent_splitter, valid_name=‘val’))
ll = label_by_func(sd, parent_labeler, proc_y=CategoryProcessor())
data = ll.to_databunch(bs = 32, c_in=3, c_out=10, num_workers=4)

xb, yb = next(iter(data.valid_dl))
type(xb)

type of xb is given as list of tensors of shape([3, 128, 128]) and not tensor of size [bs,3, 128, 128]

how do i fix this?

0 Likes

(julian) #2

I think type giving that may be correct, what does print(xb.shape) give?

0 Likes

(Akash ) #3

List has no attribute shape

0 Likes