Category "array-broadcasting"

Efficiently get first N numbers that satisfy a condition in each row in a pytorch/numpy tensor

Given a tensor b, and I would like to extract N elements in each row that satisfy a specific condition. For example, suppose a is a matrix that indicates whethe

Is there something like np.linspace for 3D lines?

I have a 3x1 point vector representing the start point of some line, and a 3x1 point vector representing the end of some line. I would like to sample an arbitra

How can I convert boolean values from np.diff() to the actual values

I have a numpy array of np.shape=(n,) I am attempting to iterate through each value of the array and subtract the 2nd value from the 1st, then see if the differ