这个函数是 InterpolatorModel
类的一部分,用于将 numpy
数组转换为 Theano
共享变量(shared variable)后存储到内核中,以便用于模型的计算。
def set_theano_shared_Vs_kernel(self,vsh=None,vsh_grad=None,transpose=False):
"""
Set the input models to be shared. Since we use this function in each iteration
(whenever we loop over kriging iterations or if there is a new set of data to be set for the kriging)
the only time we update the theano values of V and V_grad here is at the beginning of a new layer.
Otherwise, we will be using the theano shared variables already set that are only updated
at the end of a layer
vsh: numpy.ndarray:
input with the models
vsh_grad: numpy.ndarray:
input with the gradient of the models
transpose: bool:
flag to store the transpose version of the shared variable in the kernel
"""
输入包含模型的 numpy
数组。
输入包含模型梯度的 numpy
数组。
标志,用于将转置版本的共享变量存储在内核内。
没有返回值。
> model = gp.InterpolatorModel(grid=my_grid)
> model.range
array([[ 0., 1.],
[ 0., 1.],
[ 0., 1.]])
> model.set_theano_shared_Vs_kernel(vsh=np.array([1,2,3]))
无法处理非 numpy
数组的类型。