Jittor 内有没有和 pytorch where 类似的函数

pytorch 的 where 看上去和 jittor jt.where() 的接口不一样,要怎么在 jittor 内显示指定条件得到结果呢?

1 个赞

jt.where(x)numpy.where(x) 的用法类似,与 torch.where(x) 输入输出也一致。

Jittor里和 torch.where(cond, a, b) 相同的接口是 jt.ternary(cond, a, b),即条件运算。