这是一段产生错误的代码:
error[E0277]: the trait bound `[f64; 33]: std::clone::Clone` is not satisfied
--> <std macros>:2:1
|
2 | $ crate :: vec :: from_elem ( $ elem , $ n ) ) ; ( $ ( $ x : expr ) , * ) => (
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^
tes3.rs:4:35: 4:58 note: in this expansion of vec! (defined in <std macros>)
|
= help: the following implementations were found:
= help: <[T; 0] as std::clone::Clone>
= help: <[T; 1] as std::clone::Clone>
= help: <[T; 2] as std::clone::Clone>
= help: <[T; 3] as std::clone::Clone>
= help: and 29 others
= note: required by `std::vec::from_elem`
当我尝试提取import pymc
import numpy as np
a = pymc.Normal('a', 1, 1)
b = np.empty(4, dtype=object)
for i in range(4):
b[i] = 1*a
b[i].__name__ = 'b_%i'%i
M = pymc.MCMC([a,b])
M.sample(10)
M.trace('b_0') # Causes a KeyError:'b_0'
以及所有其他b的痕迹时,我不明白为什么会得到KeyError: 'b_0'
。痕迹是不是被保存了?如果是这样,有没有办法直接轻弹一些开关来改变它而不必使用@deminministic来制作对象。
答案 0 :(得分:0)
我仔细检查了一下,显然这条痕迹并没有得到保存。另外,&#34;标志变量&#34;为了保持跟踪不是.trace
,它是.keep_trace