Skip to content

Instantly share code, notes, and snippets.

@pwl
Created June 28, 2017 08:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwl/7c393e722622e4395e48986c76d015a9 to your computer and use it in GitHub Desktop.
Save pwl/7c393e722622e4395e48986c76d015a9 to your computer and use it in GitHub Desktop.
sample_node error
---------------------------------------------------------------------------
MethodNotDefined Traceback (most recent call last)
theano/scan_module/scan_perform.pyx in theano.scan_module.scan_perform.perform (/home/edward/.theano/compiledir_Linux-4.11--ARCH-x86_64-with-debian-stretch-sid-x86_64-3.5.3-64/scan_perform/mod.cpp:4490)()
/opt/conda/lib/python3.5/site-packages/theano/gof/op.py in rval(p, i, o, n, params)
880 params=params_val):
--> 881 r = p(n, [x[0] for x in i], o, params)
882 for o in node.outputs:
/opt/conda/lib/python3.5/site-packages/theano/gof/op.py in perform(self, node, inputs, output_storage, params)
777 "perform", type(self), self.__class__.__name__,
--> 778 "Did you used Theano flags mode=FAST_COMPILE?"
779 " You can use optimizer=fast_compile instead.")
MethodNotDefined: ('perform', <class 'theano.gpuarray.elemwise.GpuElemwise'>, 'GpuElemwise', 'Did you used Theano flags mode=FAST_COMPILE? You can use optimizer=fast_compile instead.')
During handling of the above exception, another exception occurred:
MethodNotDefined Traceback (most recent call last)
<ipython-input-8-a6610b5541b7> in <module>()
3 mu = pm.Gamma('U',1,1,shape=3)).logp(theano.shared(np.arange(3)))
4 inference = pm.ADVI()
----> 5 inference.approx.sample_node(val)
/opt/conda/lib/python3.5/site-packages/pymc3/variational/opvi.py in sample_node(self, node, size, more_replacements)
729
730 def sample(z): return theano.clone(node, {self.input: z}, strict=False)
--> 731 nodes, _ = theano.scan(sample, posterior, n_steps=size)
732 return nodes
733
/opt/conda/lib/python3.5/site-packages/theano/scan_module/scan.py in scan(fn, sequences, outputs_info, non_sequences, n_steps, truncate_gradient, go_backwards, mode, name, profile, allow_gc, strict, return_list)
1069 pass
1070 scan_inputs += [arg]
-> 1071 scan_outs = local_op(*scan_inputs)
1072 if type(scan_outs) not in (list, tuple):
1073 scan_outs = [scan_outs]
/opt/conda/lib/python3.5/site-packages/theano/gof/op.py in __call__(self, *inputs, **kwargs)
672 thunk.outputs = [storage_map[v] for v in node.outputs]
673
--> 674 required = thunk()
675 assert not required # We provided all inputs
676
/opt/conda/lib/python3.5/site-packages/theano/scan_module/scan_op.py in rval(p, i, o, n, allow_gc)
987 def rval(p=p, i=node_input_storage, o=node_output_storage, n=node,
988 allow_gc=allow_gc):
--> 989 r = p(n, [x[0] for x in i], o)
990 for o in node.outputs:
991 compute_map[o][0] = True
/opt/conda/lib/python3.5/site-packages/theano/scan_module/scan_op.py in p(node, args, outs)
976 args,
977 outs,
--> 978 self, node)
979 except (ImportError, theano.gof.cmodule.MissingGXX):
980 p = self.execute
theano/scan_module/scan_perform.pyx in theano.scan_module.scan_perform.perform (/home/edward/.theano/compiledir_Linux-4.11--ARCH-x86_64-with-debian-stretch-sid-x86_64-3.5.3-64/scan_perform/mod.cpp:4606)()
/opt/conda/lib/python3.5/site-packages/theano/gof/link.py in raise_with_op(node, thunk, exc_info, storage_map)
323 # extra long error message in that case.
324 pass
--> 325 reraise(exc_type, exc_value, exc_trace)
326
327
/opt/conda/lib/python3.5/site-packages/six.py in reraise(tp, value, tb)
683 value = tp()
684 if value.__traceback__ is not tb:
--> 685 raise value.with_traceback(tb)
686 raise value
687
theano/scan_module/scan_perform.pyx in theano.scan_module.scan_perform.perform (/home/edward/.theano/compiledir_Linux-4.11--ARCH-x86_64-with-debian-stretch-sid-x86_64-3.5.3-64/scan_perform/mod.cpp:4490)()
/opt/conda/lib/python3.5/site-packages/theano/gof/op.py in rval(p, i, o, n, params)
879 def rval(p=p, i=node_input_storage, o=node_output_storage, n=node,
880 params=params_val):
--> 881 r = p(n, [x[0] for x in i], o, params)
882 for o in node.outputs:
883 compute_map[o][0] = True
/opt/conda/lib/python3.5/site-packages/theano/gof/op.py in perform(self, node, inputs, output_storage, params)
776 raise utils.MethodNotDefined(
777 "perform", type(self), self.__class__.__name__,
--> 778 "Did you used Theano flags mode=FAST_COMPILE?"
779 " You can use optimizer=fast_compile instead.")
780
MethodNotDefined: ('perform', <class 'theano.gpuarray.elemwise.GpuElemwise'>, 'GpuElemwise', 'Did you used Theano flags mode=FAST_COMPILE? You can use optimizer=fast_compile instead.')
Apply node that caused the error: Gpugammaln(GpuElemwise{add,no_inplace}.0)
Toposort index: 5
Inputs types: [GpuArrayType<None>(int64, (False,))]
Inputs shapes: [(3,)]
Inputs strides: [(8,)]
Inputs values: [gpuarray.array([1, 2, 3])]
Inputs type_num: [7]
Outputs clients: [[GpuElemwise{Composite{Switch((EQ(i0, i1) * EQ(i2, i3)), i4, Switch(Identity((GE(i5, i6) * GE(i2, i7))), ((Switch(EQ(i0, i1), i8, (i2 * log(i9))) - i10) - i11), i12))}}[(0, 10)]<gpuarray>(GpuFromHost<None>.0, GpuArrayConstant{[0]}, GpuFromHost<None>.0, GpuArrayConstant{[0]}, GpuArrayConstant{[0]}, GpuFromHost<None>.0, GpuArrayConstant{[0]}, GpuArrayConstant{[0]}, GpuArrayConstant{[-inf]}, GpuFromHost<None>.0, Gpugammaln.0, GpuFromHost<None>.0, GpuArrayConstant{[-inf]})]]
Debugprint of the apply node:
Gpugammaln [id A] <GpuArrayType<None>(float64, (False,))> ''
|GpuElemwise{add,no_inplace} [id B] <GpuArrayType<None>(int64, (False,))> ''
|GpuArrayConstant{[1]} [id C] <GpuArrayType<None>(int64, (True,))>
|GpuFromHost<None> [id D] <GpuArrayType<None>(int64, (False,))> ''
|<TensorType(int64, vector)> [id E] <TensorType(int64, vector)>
HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'.
HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment