Skip to content
Advertisement

Tag: parallel-processing

Is there a way to speed up looping over numpy.where?

Imagine you have a segmentation map, where each object is identified by a unique index, e.g. looking similar to this: For each object, I would like to save which pixels it covers, but I could only come up with the standard for loop so far. Unfortunately, for larger images with thousands of individual objects, this turns out to be very

Correct usage of numpy.vstack with python’s numba

I am currently trying to speed up some python code using numba. According to the documentation of numba, numpy.meshgrid is not supported but numpy.vstack is. So I replaced the meshgrid call by vstack which works fine when not using numba. It does not work, however, when using numba. Here is the code: And here is the error message: It sounds

Is there a way to use torch.nn.DataParallel with CPU?

I’m trying to change some PyTorch code so that it can run on the CPU. The model was trained with torch.nn.DataParallel() so when I load the pre-trained model and try using it I must use nn.DataParallel() which I am currently doing like this: However after I switched my torch device to cpu like this: I got this error: I’m assuming

Find minimum difference between two vectors with numba

I’ve tried to optimize searching for minimum value between two numpy vectors with numba. There is speed up and result is correct until I use prange and parallel=True option. I understand that the issue is in sharing variables min_val, tmp, min_val_idx_a, min_val_idx_b during parallel execution (maybe with parallel threads). Is there way to overcome the problem and use numba in

Packages that are imported are not recognized during parallel computing?

I’m running the function get_content in parallel setting with multiprocess.Pool. Then it throws out an error NameError: name ‘session’ is not defined. Clearly, I defined it with session = requests.Session() . Could you please elaborate on this issue? Answer First of all, your import statement is incorrect and should be: (You had from multiprocess …, so I am not sure

Predicting in parallel using concurrent.futures of tensorflow.keras models

I am trying to implement some parallel jobs using concurrent.futures. Each worker requires a copy of a TensorFlow model and some data. I implemented it in the following way (MWE) simple_model() creates the model. clone_model clones a TensorFlow model. work represents an MWE of possible work. worker assigns the work in parallel. This is not working, it just stuck and

Advertisement