Changing item and batch transform

does anyone know how to change the item_tfms and batch_tfms? I got an error when I want to change directly using the way like the image above.

1 Like

what if you pass them in as a Pipeline? so you would do:

batch_tfms = Pipeline([Resizeblha,blahblaha])

I haven’t tested with your specific transforms, but I think that will do it

1 Like

another option may be to pass your lists through to your createDataBlock function (not 100% sure what that function is.

Here’s an example from the tranform docs:

mean,std = [0.5]*3,[0.5]*3
mean,std = broadcast_vec(1, 4, mean, std)
batch_tfms = [IntToFloatTensor(), Normalize.from_stats(mean,std)]
tdl = TfmdDL(train_ds, after_batch=batch_tfms, bs=4, device=default_device())

so you would pass batch_tfms to after_batch and item_tfms to after_item

2 Likes

Resize is an item transform, not a batch transform which operate on Tensors on the GPU.

I solved it using the new() method from class DataBlock