提交 8f1242f7 authored 作者: Seon-Wook Park's avatar Seon-Wook Park

Fix comments for compress

上级 f1ae9055
...@@ -514,15 +514,14 @@ def squeeze(x): ...@@ -514,15 +514,14 @@ def squeeze(x):
def compress(condition, x, axis=None, out=None): def compress(condition, x, axis=None, out=None):
"""Return selected slices of an array along given axis. """Return selected slices of an array along given axis.
It returns the input array, but with the It returns the input tensor, but with selected slices along a given axis
broadcastable dimensions removed. This is retained. If no axis is provided, the tensor is flattened
always `x` itself or a view into `x`. Corresponds to numpy.compress
Wrapping of numpy.compress
:param x: 1 dimension, bools :param x: Input data, tensor variable
:param condition: array of the same shape as x with corresponding weights. :param condition: 1 dimensional array of non-zero and zero values
Optional. corresponding to indices of slices along a selected axis
:return: `x` with selected slices :return: `x` with selected slices
...@@ -530,6 +529,7 @@ def compress(condition, x, axis=None, out=None): ...@@ -530,6 +529,7 @@ def compress(condition, x, axis=None, out=None):
""" """
# This is done to keep the same function signature then NumPy. # This is done to keep the same function signature then NumPy.
assert out is None assert out is None
indices = theano.tensor.basic.flatnonzero(condition) indices = theano.tensor.basic.flatnonzero(condition)
return x.take(indices, axis=axis) return x.take(indices, axis=axis)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论