Skip to main content
 首页 » 编程设计

python之如何将 numpy.ndarray 对象转换为 theano.tensor

2024年10月24日12yxwkf

我有一个要更改为 thenao.tensor 的 csv 文件,我计划通过 2 个步骤完成 1 个 csv 到 ndarray:使用 genfromtxt 方法很容易。 2 ndarray to theano.tensor:这一步怎么做?有示例代码吗?

谢谢!

请您参考如下方法:

您可以使用 _shared,显然:http://deeplearning.net/software/theano/library/tensor/basic.html#converting-from-python-objects

from theano.tensor import _shared 
import numpy as np 
x = _shared(np.arange(10))