2015-05-14 9 views
8

कुछ सरल थेनो कोड है कि पूरी तरह से काम करता है, जब मैं क्रम में pymc3PyMC3 और थेनो - थेनो कोड कि pymc3 आयात के बाद काम करना बंद कर काम करता है

यहाँ कुछ snipets आयात त्रुटि पुन: पेश करने से काम करना बंद:

#Initial Theano Code (this works)  
import theano.tensor as tsr 

x = tsr.dscalar('x') 
y = tsr.dscalar('y') 
z = x + y 

#Snippet 1 
import pymc3 as pm 
import theano.tensor as tsr 

x = tsr.dscalar('x') 
y = tsr.dscalar('y') 
z = x + y 

#Snippet 2 
import theano.tensor as tsr 
import pymc3 as pm 

x = tsr.dscalar('x') 
y = tsr.dscalar('y') 
z = x + y 

#Snippet 3 
import pymc3 as pm 

x = pm.theano.tensor.dscalar('x') 
y = pm.theano.tensor.dscalar('y') 
z = x + y 

और मैं पिछले के टुकड़े से प्रत्येक के लिए निम्न त्रुटि मिलती है:

--------------------------------------------------------------------------- 
AttributeError       Traceback (most recent call last) 
/Users/tom/anaconda/lib/python3.4/site-packages/theano/gof/op.py in __call__(self, *inputs, **kwargs) 
    516     try: 
--> 517      storage_map[ins] = [self._get_test_value(ins)] 
    518      compute_map[ins] = [True] 

/Users/tom/anaconda/lib/python3.4/site-packages/theano/gof/op.py in _get_test_value(cls, v) 
    478 
--> 479   raise AttributeError('%s has no test value' % v) 
    480 

AttributeError: x has no test value 

During handling of the above exception, another exception occurred: 

ValueError        Traceback (most recent call last) 
<ipython-input-2-ef8582b040f8> in <module>() 
     3 x = pm.theano.tensor.dscalar('x') 
     4 y = pm.theano.tensor.dscalar('y') 
----> 5 z = x + y 

/Users/tom/anaconda/lib/python3.4/site-packages/theano/tensor/var.py in __add__(self, other) 
    126  def __add__(self, other): 
    127   try: 
--> 128    return theano.tensor.basic.add(self, other) 
    129   # We should catch the minimum number of exception here. 
    130   # Otherwise this will convert error when Theano flags 

/Users/tom/anaconda/lib/python3.4/site-packages/theano/gof/op.py in __call__(self, *inputs, **kwargs) 
    523       run_perform = False 
    524      elif config.compute_test_value == 'raise': 
--> 525       raise ValueError('Cannot compute test value: input %i (%s) of Op %s missing default value' % (i, ins, node)) 
    526      elif config.compute_test_value == 'ignore': 
    527       # silently skip test 

ValueError: Cannot compute test value: input 0 (x) of Op Elemwise{add,no_inplace}(x, y) missing default value 

किसी भी विचार? अग्रिम धन्यवाद

उत्तर

7

में मुझे लगता है कि इस pymc3 की स्थापना theano.config.compute_test_value = 'raise' से संबंधित है: https://github.com/pymc-devs/pymc3/blob/master/pymc3/model.py#L395

आप स्पष्ट रूप से वापस theano.config.compute_test_value सेट कर सकते हैं 'ignore' करने के लिए त्रुटि से छुटकारा पाने के।

+0

धन्यवाद यह काम करता है;) –

2

समाधान प्रस्तावित here ध्वज सेट करने से थोड़ा लंबा रहता है। आपके खोल प्रकार में:

theano-cache purge 
संबंधित मुद्दे