Hi, if I am understanding correctly, what you mean is that torch.nonzero operation indeed takes up some time but my measurement of that operation is wrong and it didn’t take that lot of time. I deleted the torch.nonzero operation and run the inference process again, finding that there are just a few decreases in the whole inference time which means that torch.nonzero is not that time-consuming as I expected. But I believe these indexing operations should be less effective than convolutions when the code is running on GPU. So I guess real-time models should avoid these operations as possible.