提交 b4dd3871 authored 作者: Frederic's avatar Frederic

add tensor.where as an alias for tensor.switch to support the same name as numpy.

上级 f0fdc95d
...@@ -986,6 +986,11 @@ Condition ...@@ -986,6 +986,11 @@ Condition
x,y = T.dmatrices('x','y') x,y = T.dmatrices('x','y')
z = T.switch(T.lt(a,b), x, y) z = T.switch(T.lt(a,b), x, y)
.. function:: where(cond, ift, iff)
Alias for `switch`. where is the numpy name.
.. function:: clip(x, min, max) .. function:: clip(x, min, max)
Return a variable representing x, but with all elements greater than Return a variable representing x, but with all elements greater than
......
...@@ -2605,11 +2605,11 @@ def isinf(a): ...@@ -2605,11 +2605,11 @@ def isinf(a):
# Condition # Condition
########################## ##########################
@_scal_elemwise @_scal_elemwise_with_nfunc('where', 3, 1)
def switch(cond, ift, iff): def switch(cond, ift, iff):
"""if cond then ift else iff""" """if cond then ift else iff"""
where = switch
########################## ##########################
# Bit-wise # Bit-wise
########################## ##########################
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论