Skip to content

Instantly share code, notes, and snippets.

@pwl
Created November 21, 2017 12: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/998ef2a3dafb2614d6573d82ad273b6b to your computer and use it in GitHub Desktop.
Save pwl/998ef2a3dafb2614d6573d82ad273b6b to your computer and use it in GitHub Desktop.
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
/opt/conda/lib/python3.6/site-packages/theano/gof/op.py in __call__(self, *inputs, **kwargs)
624 try:
--> 625 storage_map[ins] = [self._get_test_value(ins)]
626 compute_map[ins] = [True]
/opt/conda/lib/python3.6/site-packages/theano/gof/op.py in _get_test_value(cls, v)
580 detailed_err_msg = utils.get_variable_trace_string(v)
--> 581 raise AttributeError('%s has no test value %s' % (v, detailed_err_msg))
582
AttributeError: mrg_uniform{TensorType(float32, vector),no_inplace}.0 has no test value
Backtrace when that variable is created:
File "<ipython-input-18-b6f6d16a7d28>", line 2, in <module>
approx.sample_node(zs,size=1,more_replacements={xs_t:shared(data[:minibatch_size])}).eval()
File "/opt/conda/lib/python3.6/site-packages/theano/configparser.py", line 117, in res
return f(*args, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/pymc3/variational/opvi.py", line 1436, in sample_node
node_out = self.set_size_and_deterministic(node_out, size, deterministic, more_replacements)
File "/opt/conda/lib/python3.6/site-packages/theano/configparser.py", line 117, in res
return f(*args, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/pymc3/variational/opvi.py", line 1364, in set_size_and_deterministic
flat2rand = self.make_size_and_deterministic_replacements(s, d, more_replacements)
File "/opt/conda/lib/python3.6/site-packages/pymc3/variational/opvi.py", line 1339, in make_size_and_deterministic_replacements
flat2rand.update(g.make_size_and_deterministic_replacements(s, d, more_replacements))
File "/opt/conda/lib/python3.6/site-packages/pymc3/variational/opvi.py", line 1106, in make_size_and_deterministic_replacements
initial = self._new_initial(s, d, more_replacements)
File "/opt/conda/lib/python3.6/site-packages/pymc3/variational/opvi.py", line 1000, in _new_initial
return getattr(self._rng, dist_name)(shape)
During handling of the above exception, another exception occurred:
ValueError Traceback (most recent call last)
<ipython-input-18-b6f6d16a7d28> in <module>()
1 with model:
----> 2 approx.sample_node(zs,size=1,more_replacements={xs_t:shared(data[:minibatch_size])}).eval()
/opt/conda/lib/python3.6/site-packages/theano/gof/graph.py in eval(self, inputs_to_values)
520 inputs = tuple(sorted(inputs_to_values.keys(), key=id))
521 if inputs not in self._fn_cache:
--> 522 self._fn_cache[inputs] = theano.function(inputs, self)
523 args = [inputs_to_values[param] for param in inputs]
524
/opt/conda/lib/python3.6/site-packages/theano/compile/function.py in function(inputs, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input)
315 on_unused_input=on_unused_input,
316 profile=profile,
--> 317 output_keys=output_keys)
318 return fn
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in pfunc(params, outputs, mode, updates, givens, no_default_updates, accept_inplace, name, rebuild_strict, allow_input_downcast, profile, on_unused_input, output_keys)
447 rebuild_strict=rebuild_strict,
448 copy_inputs_over=True,
--> 449 no_default_updates=no_default_updates)
450 # extracting the arguments
451 input_variables, cloned_extended_outputs, other_stuff = output_vars
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in rebuild_collect_shared(outputs, inputs, replace, updates, rebuild_strict, copy_inputs_over, no_default_updates)
217 for v in outputs:
218 if isinstance(v, Variable):
--> 219 cloned_v = clone_v_get_shared_updates(v, copy_inputs_over)
220 cloned_outputs.append(cloned_v)
221 elif isinstance(v, Out):
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
91 if owner not in clone_d:
92 for i in owner.inputs:
---> 93 clone_v_get_shared_updates(i, copy_inputs_over)
94
95 clone_d[owner] = owner.clone_with_new_inputs(
/opt/conda/lib/python3.6/site-packages/theano/compile/pfunc.py in clone_v_get_shared_updates(v, copy_inputs_over)
112 if v not in update_d:
113 v_update = v.type.filter_variable(v.default_update,
--> 114 allow_convert=False)
115 if v_update.type != v.type:
116 raise TypeError(
/opt/conda/lib/python3.6/site-packages/theano/gpuarray/type.py in filter_variable(self, other, allow_convert)
334 other = other2
335
--> 336 return other.transfer(self.context_name)
337
338 @staticmethod
/opt/conda/lib/python3.6/site-packages/theano/tensor/var.py in transfer(self, target)
376 The desired location of the output variable
377 """
--> 378 return theano.tensor.transfer(self, target)
379
380 # Elemwise
/opt/conda/lib/python3.6/site-packages/theano/tensor/basic.py in transfer(var, target)
3145 else:
3146 for trans in transfer._others:
-> 3147 res = trans(var, target)
3148 if res is not None:
3149 return res
/opt/conda/lib/python3.6/site-packages/theano/gpuarray/__init__.py in transfer(x, target)
35 try:
36 get_context(target)
---> 37 return as_gpuarray_variable(x, target)
38 except ContextNotDefined:
39 pass
/opt/conda/lib/python3.6/site-packages/theano/gpuarray/basic_ops.py in as_gpuarray_variable(x, context_name)
77 # If we couldn't deal with transfers, then maybe it's a tensor
78 if isinstance(x.type, tensor.TensorType):
---> 79 return copy_stack_trace(x, GpuFromHost(context_name)(x))
80
81 # Try _as_GpuArrayVariable if possible
/opt/conda/lib/python3.6/site-packages/theano/gof/op.py in __call__(self, *inputs, **kwargs)
637 raise ValueError(
638 'Cannot compute test value: input %i (%s) of Op %s missing default value. %s' %
--> 639 (i, ins, node, detailed_err_msg))
640 elif config.compute_test_value == 'ignore':
641 # silently skip test
ValueError: Cannot compute test value: input 0 (mrg_uniform{TensorType(float32, vector),no_inplace}.0) of Op GpuFromHost<None>(mrg_uniform{TensorType(float32, vector),no_inplace}.0) missing default value.
Backtrace when that variable is created:
File "<ipython-input-18-b6f6d16a7d28>", line 2, in <module>
approx.sample_node(zs,size=1,more_replacements={xs_t:shared(data[:minibatch_size])}).eval()
File "/opt/conda/lib/python3.6/site-packages/theano/configparser.py", line 117, in res
return f(*args, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/pymc3/variational/opvi.py", line 1436, in sample_node
node_out = self.set_size_and_deterministic(node_out, size, deterministic, more_replacements)
File "/opt/conda/lib/python3.6/site-packages/theano/configparser.py", line 117, in res
return f(*args, **kwargs)
File "/opt/conda/lib/python3.6/site-packages/pymc3/variational/opvi.py", line 1364, in set_size_and_deterministic
flat2rand = self.make_size_and_deterministic_replacements(s, d, more_replacements)
File "/opt/conda/lib/python3.6/site-packages/pymc3/variational/opvi.py", line 1339, in make_size_and_deterministic_replacements
flat2rand.update(g.make_size_and_deterministic_replacements(s, d, more_replacements))
File "/opt/conda/lib/python3.6/site-packages/pymc3/variational/opvi.py", line 1106, in make_size_and_deterministic_replacements
initial = self._new_initial(s, d, more_replacements)
File "/opt/conda/lib/python3.6/site-packages/pymc3/variational/opvi.py", line 1000, in _new_initial
return getattr(self._rng, dist_name)(shape)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment