add bernoulli

This commit is contained in:
li-xl 2021-03-17 20:22:36 +08:00
parent 33f85afe6c
commit 36a3c24a46
2 changed files with 3 additions and 1 deletions

View File

@ -8,7 +8,7 @@
# This file is subject to the terms and conditions defined in
# file 'LICENSE.txt', which is part of this source code package.
# ***************************************************************
__version__ = '1.2.2.49'
__version__ = '1.2.2.50'
from . import lock
with lock.lock_scope():
ori_int = int

View File

@ -64,6 +64,8 @@ def any(x,dim):
return x.any_(dim).bool()
jt.Var.any = any
def bernoulli(input):
return (input>jt.rand_like(input)).cast(input.dtype)
def repeat(x, *shape):
r'''