FlashX icon indicating copy to clipboard operation
FlashX copied to clipboard

[FlashMatrix]: avoid computation in ifelse

Open zheng-da opened this issue 8 years ago • 0 comments

    X1 = -fp.log(1 + fp.exp(-X))
    X2 = X - fp.log(1 + fp.exp(X))
    return fp.where(X > 0, X1, X2)

The code above has redundant computation. log and exp can be expensive. We should avoid unnecessary computation here.

zheng-da avatar Aug 04 '17 18:08 zheng-da