2014-09-11 2 views
2

저는이 벡터에서 중복 값을 제거하려고합니다. 어떻게해야합니까? theano에서 numpy.unique()와 동일한 기능은 무엇입니까?Theano는 테세라에서 고유 한 값을 얻습니다.

x1 = T.itensor3('x1') 
y1 = T.flatten(x1) 
#z1 = T.unique() How do I do this? 

For e.g. my tensor may be : [1,1,2,3,3,4,4,5,1,3,4] 
and I want : [1,2,3,4,5] 

답변

3

편집 :이 Theano에서 사용할 수 있습니다 : http://deeplearning.net/software/theano/library/tensor/extra_ops.html#theano.tensor.extra_ops.Unique

이 질문도 theano 사용자 메일 링리스트에 질문을 받았다. 결론은 이것이 Theano에 싸여 있지 않은 NumPy 함수의 함수 중 하나라는 것입니다. 그는 대학원을 필요로하지 않으므로 빠르게 감쌀 수 있습니다. 다음은 출력이 입력과 같을 것으로 예상하는 예제입니다. as_op에 대한

from theano.compile.ops import as_op 


@as_op(itypes=[theano.tensor.imatrix], 
     otypes=[theano.tensor.imatrix]) 
def numpy_unique(a): 
    return numpy.unique(a) 

더 많은 문서가 여기에 있습니다 : http://deeplearning.net/software/theano/tutorial/extending_theano.html#as-op-example

관련 문제