Tf.where() operation for custom FocalLoss in SameDiff

Hi there

I’m implementing a custom FocalLoss in SameDiff. In the original code they make use of the tf.where() operation, is there any similar operation in SameDiff?

The operation I’m looking for should behave like: condition(x[i]) ? y[i] : z[i].
The only thing I found was the SDBaseOps::replaceWhere. But this works as: condition(x[i]) ? y[i] : x[i]

There are different ways to implement such a “where” operation, but nevertheless it would be very handy to have it integrated in SameDiff.

Yes, we don’t implement that operation because it is both possible to implement the same functionality another way and because it isn’t necessary for import, as tensorflow turns it into a different set of operations under the hood.

But I do agree that it would be handy to have it available without needing additional workarounds.