I’m looking for a fast operation than can separate the positive and negative values of a tensor X to two tensors of the same size.
One way to do this is using maximum  and minimum like below:
neg = torch.minimum(X, 0)
pos = torch.maximum(X, 0)

In the above solution, each element of X gets compared to 0 twice. But really the comparison only needs to happen once, because if you know X < 0 is true then you already know X > 0 is False.
So you can cut the computation in half.
If we call that operation sieve, then it would look like this:
pos, neg = torch.sieve(X, condition=(X > 0))
Is there an operation in torch that can achieve that?