2016-10-19 7 views
0

그래서 Theano를 사용하는 방법을 배우려고하고 특히 신경망에 사용하는 방법을 배우려고합니다. Windows 10 시스템에서 mingw64와 설치 페이지의 나머지 모든 필수 파일을 사용하고 있습니다 (Microsoft Visual Studio 및 Cuda는 예외이며 내 GPU를 사용하지 않으려합니다). 모든 것이 작동하는 것으로 보이고 튜토리얼의 "아기 단계"부분이 잘 작동합니다. 나는 실행하려고하면 코드 다음 그러나, 좀 이상한 결과를 얻을 - 다음과 같은 오류가 나타나는으로이상한 결과를 반환하는 Theano 연산

self.W = theano.shared(value=np.random.standard_normal((state_dim, 4*state_dim)) * np.sqrt(2/in_dim), name='W', borrow=True) 
print(theano.dot(self.W.get_value(), self.W.get_value().T) 

을 :

Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "C:\mingw64\WinPython-64bit-3.4.4.4Qt5\python-3.4.4.amd64\lib\site-packages\theano\__init__.py", line 172, in dot 
    (e0, e1)) 
NotImplementedError: ('Dot failed for the following reasons:', (None, None)) 

내가 get_value없이 W 참조하려고() , ie print (theano.dot (self.W, self.WT)) 반환 값은 입니다. 점은입니다.

무엇이 누락 되었습니까?

답변

0

단지 theano 작업을 인쇄 할 수 없습니다.

첫째, theano.function

result = theano.dot(self.W, self.W.T) 
f = theano.function([],result) 
print f() 

을 사용하거나 개체를 인쇄 할 수 파이썬에서 np.dot

result = numpy.dot(self.W.get_value(), self.W.get_value().T) 
print result 
0

사용 : 같은 결과를 보여주는 두 가지 대안이있다. 따라서 print 절은 OK입니다. 문제는 theano 식에서 만 기호 변수를 사용할 수 있다는 것입니다. 당신은 theano 표현식에서 직접 값을 사용할 수 없습니다.

self.W = theano.shared(value=np.random.standard_normal((state_dim, 4*state_dim)) * np.sqrt(2/in_dim), name='W', borrow=True) 
print(theano.dot(self.W, self.W.T) 

는 그냥 get_value() 기능을 제거 : 그래서 코드는 다음과 같이 쓸 수 있습니다.