Parallel()

(chris pugmire) #1

I’m getting a fault in ‘parallel()’ so I want recode this function without it and see what is going wrong but parallel doesn’t seem to have the same parameters as the non parallel function so to understand it I tried 'doc(“parallel”) but cannot find any docs on it, I also tried google search on parallel() python and pytorch and found nothing.

I’m new to python so I’m unclear how to find the documentation on a function.
Clues please?

The code looks like this:
parallel(partial(resize_one, path=p, size=size), il.items)
which I want to change to:
for anitem in il.items:
resize_one(path=p,size=size)
but resize_one requires ‘fn’ and ‘i’ parameters, which are not passed in the current code and I cannot see where they are magically coming from?

Thanks. ChrisP.

0 Likes

(Rohit Gupta) #2

parallel is a fastai function. fn is the item present in il.items and i is a required parameter within func which refers to the index of the current item fn inside il.items. In case if you are using parallel you don’t need to add any for-loop in your code as it will do it for you.

0 Likes